http://stackoverflow.com/q/23490147
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
has title: LinkedList && Servlet
tagged with: servlets
has comment: http://stackoverflow.com/comment/36021148
type: Question
accepted answer: http://stackoverflow.com/a/23490905
answer count: 1
has comment: http://stackoverflow.com/comment/36020268
score: 0
has comment: http://stackoverflow.com/comment/36021289
has body: `I am a new to java and to servlet topic. I write a little web application. it's collect some data from web-form and add it into a LinkedList. But my debugger shown me that adding to LL doesnt occur. HELP PLEASE! Here some code: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name = request.getParameter("name"); String surname = request.getParameter("surname"); String fatherName = request.getParameter("fathername"); String department = request.getParameter("department").toLowerCase(); Integer age = Integer.valueOf(request.getParameter("age")); System.out.println(name); System.out.println(surname); System.out.println(fatherName); responseToUser(addEmployee(name,surname,fatherName,department, age),response); } public boolean addEmployee(String name, String surname, String fathername, String department, Integer age) { AllWorkers workers = new AllWorkers(); if (!name.equals("") &amp;&amp; !surname.equals("") &amp;&amp; !fathername.equals("") &amp;&amp; !dep artment.equals("") &amp;&amp; age != null) { Person person = new Person(surname, name, fathername, department, age); Departments dep = Departments.valueOf(person.getDepartment()); if (dep == Departments.логистика) { workers.addLogistic(person); } else if (dep == Departments.продажи) { workers.addSales(person); } return true; } else { return false; } } public void responseToUser(boolean boo, HttpServletResponse response) throws IOException { Gson gson = new Gson(); response.setContentType("application/json"); if(boo == true){ response.getWriter().write(gson.toJson(true)); }else if(boo == false){ response.getWriter().write(gson.toJson(false)); } } Departments: public enum Departments { логистика,продажи } AllWorkers.java public class AllWorkers { LinkedList&lt;Person&gt; logistic = new LinkedList&lt;Person&gt;(); LinkedList&lt;Person&gt; sales = new LinkedList&lt;Person&gt;(); public void addLogistic(Person person){ logistic.add(person); } pu…
has answer: http://stackoverflow.com/a/23490905

http://stackoverflow.com/q/23606088
answer count: 1
duplicate of: http://stackoverflow.com/q/2126607
favorite count: 0
has title: IOException: socket write error
has comment: http://stackoverflow.com/comment/36237366
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23606335
has comment: http://stackoverflow.com/comment/36238203
downvote count: 1
tagged with: ojb
score: 1
has body: While editing one report I am facing this issue(all other reports are working fine) don't know what goes wrong org.apache.ojb.broker.PersistenceBrokerSQLException: * SQLException during execution of sql-statement: --some sql statement(correct one) Exception message is [Io exception: Software caused connection abort: socket write error] Vendor error code [17002] ---adding stack trace as well Target class is 'com.dto.CurrentDTO' PK of the target object is [currentId] at org.apache.ojb.broker.util.ExceptionHelper.generateException(ExceptionHelper.java:256) at org.apache.ojb.broker.util.ExceptionHelper.generateException(ExceptionHelper.java:90) at org.apache.ojb.broker.util.ExceptionHelper.generateException(ExceptionHelper.java:71) at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.materializeObject(JdbcAccessImpl.java:594) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getPlainDBObject(PersistenceBrokerImpl.java:1504) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(PersistenceBrokerImpl.java:1548) at org.apache.ojb.broker.core.PersistenceBrokerImpl.doGetObjectByIdentity(PersistenceBrokerImpl.java:1671) at org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(PersistenceBrokerImpl.java:1643) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(DelegatingPersistenceBroker.java:357) at org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(DelegatingPersistenceBroker.java:357) at com.common.OJBUtil.findByPK(OJBUtil.java:104) at com.dao.AbsDAO.find(AbsDAO.java:55)
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/2126607

http://stackoverflow.com/q/23538066
has answer: http://stackoverflow.com/a/23539855
upvote count: 3
score: 0
has title: Does Tomcat implement or run the Java Servlet and the JavaServer Pages (JSP) specifications?
has answer: http://stackoverflow.com/a/71701620
downvote count: 3
answer count: 4
has body: I'm learning about Apache Tomcat and I didn't understand the term implementation from the below line. I was thinking Tomcat runs Java Servlet and the JavaServer Pages (JSP). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems Does Tomcat implement or run the Java Servlet and the JavaServer Pages (JSP)?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36110181
has comment: http://stackoverflow.com/comment/36109994
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/727844
has answer: http://stackoverflow.com/a/23538248
tagged with: servlets
accepted answer: http://stackoverflow.com/a/23539855
has comment: http://stackoverflow.com/comment/36110492
possible better answer: http://stackoverflow.com/a/23538228
tagged with: jsp
tagged with: tomcat
has answer: http://stackoverflow.com/a/23538228
favorite count: 0
tagged with: specifications
has comment: http://stackoverflow.com/comment/36110767

http://stackoverflow.com/comment/36269072
has text: its the @RemoteServiceRelativePath for server side code
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23608360

james
tags question: http://stackoverflow.com/q/23543978
type: Tag
tags question: http://stackoverflow.com/q/23602002
tag name: james

http://stackoverflow.com/a/23545393
type: Answer
has body: You need to escape the asterisks to avoid them being interpreted as part of a regular expression: a = a.replaceFirst(Pattern.escape("**"), ""); Or: a = a.replaceFirst("\\Q**\\E", "") Or: a = a.replaceFirst("\\*\\*"), ""); To perform your translation you could do this: a = a.replaceAll("\\*\\*(.*?)\\*\\*", "$1"); The advantage of a single replaceAll over a pair of replaceFirst calls is that replaceAll would work for strings containing multiple asterisked words, e.g. "John **Doe** is a **bad** boy". Essentially the matching expression means: \\*\\* -- literal "**" ( -- start a capturing group . -- match any character (except LF, CR) * -- zero or more of them ? -- not greedily (i.e. find the shortest match possible) ) -- end the group \\*\\* -- literal "**" The replacement: -- literal $1 -- the contents of the captured group (i.e. text inside the asterisks) -- literal By the way, I've changed your end tag to instead of <\u> :-) Depending on your requirements, you might be able to use a Markdown parser, e.g. Txtmark and save yourself reinventing the wheel.
upvote count: 5
score: 5
accepted answer of: http://stackoverflow.com/q/23545324
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23545324

http://stackoverflow.com/comment/36024667
comment on: http://stackoverflow.com/a/23492719
type: AnswerComment
score: 0
has text: Ok, this answer is great. I now understand. Thanks very much for the answer.
type: Comment

http://stackoverflow.com/comment/36152232
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23560275
has text: You could have an interface `C` I suppose, but given there was a common property that the user wanted to access, it made sense that I move that to a superclass.

http://stackoverflow.com/comment/36186777
has text: Sounds like the ID is dynamically generated.
type: Comment
comment on: http://stackoverflow.com/q/23577636
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36254888
has text: I also updated the image to show where my log4j.jar is. I would suggest try to do a project > clean > build from eclipse see if that solves your issue. Or I another thing you can do is make sure your build path in eclipse is good and that that jar is actually present. Right click on your project go to properties > Java Build Path> Libraries make sure every thing looks good there and no errors.
type: AnswerComment
comment on: http://stackoverflow.com/a/23614367
score: 0
type: Comment

http://stackoverflow.com/q/23540292
has comment: http://stackoverflow.com/comment/36113944
tagged with: java
tagged with: webdriver
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23540495
has comment: http://stackoverflow.com/comment/36115595
accepted answer: http://stackoverflow.com/a/23540495
possible better answer: http://stackoverflow.com/a/23540471
has comment: http://stackoverflow.com/comment/36114318
has answer: http://stackoverflow.com/a/23540471
has comment: http://stackoverflow.com/comment/36113998
has body: I am Trying to Automate a Test sequence of Login - Booking - Cancellation. Till Booking its Fine , But moment it Reaches Cancellation, It throws a java lang Null-Pointer Exp. I rechecked and My locators(xpath) is correct(xpath-Checker) and I am Trying to getText() the Ticket Number and proceed to cancellation. Problem is whenever WebDriver is reaching the Booking confirmation Page , which Loads after a While, it Fails and Returns Null Pointer Exp.. It may be a Loading Issue which is handled or I am messed up with my Java Concept... Please Help !! anyone... public class StackOverflow { public static WebDriver driver; public static Properties p; public static FileInputStream f ; @Test public void loginTest() { System.out.println("Enter Login"); Properties p=new Properties(); FileInputStream f = null; try { f = new FileInputStream("D:\\BOSSFramework\\Framework\\locators.properties"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { p.load(f); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } driver = new FirefoxDriver(); driver.get("https://in3.seatseller.travel/"); driver.manage().window().maximize(); try{ driver.findElement(By.name(p.getProperty("login.username.textfield"))).sendKeys("UserName"); driver.findElement(By.name(p.getProperty("login.password.textfield"))).sendKeys("Password"); WebElement ele =driver.findElement(By.id(p.getProperty("login.signin.button"))); ele.click(); } catch (Exception e) { } } @Test (dependsOnMethods={"loginTest"}) public void booking() throws InterruptedException{ System.out.println("Enter Booking"); // Type Bangalore on Source Field.. Properties p=new Properties(); FileInputStream f = null; try { f = new FileInputStream("D:\\BOSSFramework\\Framework\\locators.properties"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { p.load(f); } catch (IOException e) { // TODO Auto-generated catch block e.printSt…
has title: Webdriver is Not able to read element-Null Pointer exception..
tagged with: selenium
type: AnsweredQuestion

http://stackoverflow.com/a/23607982
has comment: http://stackoverflow.com/comment/36240762
type: Answer
has comment: http://stackoverflow.com/comment/36273279
upvote count: 2
has body: return a reference to the internal object In this case receiver end can able to modify the object's set or list which might not be requirement. If you allow users to modify state of object then it is simplest approach. construct a new set/list and fill it up (this seems bad practice?) This is example shallow copy where collection object will not be modifiable but object would be used same. So any change in object state will effect the actual collection. use Collections.unmodifiableList(partitions); In this case it returns an unmodifiable view of the specified list. This method allows modules to provide users with "read-only" access to internal lists. This could be used as best practice in situation where you want to keep object's state safe.
score: 2
has comment: http://stackoverflow.com/comment/36240945
answers question: http://stackoverflow.com/q/23607881
downvote count: 0

http://stackoverflow.com/q/23491902
has title: Adding try/catch block in bytecode through ASM
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24000739
has comment: http://stackoverflow.com/comment/36038315
tagged with: java
upvote count: 10
score: 9
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23558972
has comment: http://stackoverflow.com/comment/36062640
has body: I am new to ASM and I want some help related to bytecode transformation. Question: I would like to add try/catch block for the entire method in bytecode through ASM and want to run the method with out using java -noverify option. I can able to add try/catch block for the entire method but when I tried to execute the method I am getting 'java.lang.VerifyError'. If I use java -noverify option then it will run. Please help me. Below are the details. public class Example { public static void hello() { System.out.println("Hello world"); } } I want to transform the above code as below introducing try/catch blocks, with ASM bytecode instrumentation. public class Example { public static void hello() { try { System.out.println("Hello world"); } catch(Exception ex) { ex.printStackTrace(); } } } Below code add try/catch block but fails to execute the code with out java -noverify option. public class InstrumentExample { /** * Our custom method modifier method visitor class. It delegate all calls to * the super class. Do our logic of adding try/catch block * */ public static class ModifierMethodWriter extends MethodVisitor { // methodName to make sure adding try catch block for the specific // method. private String methodName; // below label variables are for adding try/catch blocks in instrumented // code. private Label lTryBlockStart; private Label lTryBlockEnd; private Label lCatchBlockStart; private Label lCatchBlockEnd; /** * constructor for accepting methodVisitor object and methodName * * @param api: the ASM API version implemented by this visitor * @param mv: MethodVisitor obj * @param methodName : methodName to make sure adding try catch block for the specific method. */ public ModifierMethodWriter(int api, MethodVisitor mv, String methodName) { super(api, mv); this.methodName = methodName; } // We want to add try/catch block for the entire code in the method // so adding the try/catch when the method is started visiting the code. @Override public void visitCode() { su…
has answer: http://stackoverflow.com/a/23558972
favorite count: 0
has answer: http://stackoverflow.com/a/24000739
tagged with: java-bytecode-asm

http://stackoverflow.com/comment/36115017
comment on: http://stackoverflow.com/q/23540593
type: Comment
has text: The visitor pattern is a good approach for Dynamic type searching, that way you create yourself a Teacher Visitor and an Age Visitor , they pull the details off the object you actually want.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23587476
downvote count: 0
score: 1
has body: The @Table annotation set the table name to cbhistory_article, but the ormlite's TableInfo get the table name is article. You didn't provide the code that you are using to define the entity but I assume it was something like: @Entity @Table(name = "cbhistory_article") public class Article { ... Unfortunately, at this time ORMLite does not support the @Table annotation. I've added the code for this to trunk and it will be in version 4.49. Sorry for the miss. Right now it only listens to the name field however. Do you need more support for other fields? To get it to work, use the name field on the @Entity annotation: @Entity(name = "cbhistory_article") public class Article { ...
upvote count: 1
answers question: http://stackoverflow.com/q/23567960
type: Answer

http://stackoverflow.com/a/23582214
answers question: http://stackoverflow.com/q/23582123
score: 0
type: Answer
has body: Is my assumption correct? Yes, your assumption is correct. Two Date instances are correct if both their getTime() results are the same from Date.java public boolean equals(Object obj) { return obj instanceof Date &amp;&amp; getTime() == ((Date) obj).getTime(); } Converting just assumes you need to set the hours,minutes and seconds to 0: calendar.set(Calendar.HOUR_OF_DAY,0); calendar.set(Calendar.MINUTE,0); calendar.set(Calendar.SECOND,0);

http://stackoverflow.com/q/23530658
favorite count: 0
tagged with: postgresql
possible better answer: http://stackoverflow.com/a/23530694
linked to: http://stackoverflow.com/q/19009117
has body: In my spring project, I am looking for a way to create the database which will be used by my application from java code to avoid the final user having to create it manually. I have this service class where I want to implement this feature: @Service public class InstallService { public boolean create_database(String maquina, String usuario, String senha) { return false; } public boolean create_user(String usuario, String senha, String email) { return false; } } Searching in the web, I find this topic here in stackoverflow with a suggestion to do this for mysql: creating a database in mysql from java In my application, the database is created through one of steps in a wizard, where the user informs the machine where the DBMS is running, besides the username and password who will own the database. Plus, I am using Hibernate, then the jdbc driver and db name already is stored in a file called persistence.properties, which has the following content: jdbc.Classname=org.postgresql.Driver jdbc.url= jdbc.user= jdbc.pass= hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect hibernate.show_sql=false hibernate.hbm2ddl.auto=update After the user informs the machine, username and password data, I want to save this data in this file too. Can anyone point to the direction how to modify the example from the other topic to accomplish what I want? ps.: the project is this: https://github.com/klebermo/webapp_horario_livre UPDATE My current code (still doesn't create the database): @Service public class InstallService { @Autowired UsuarioHome usuario; @Autowired AutorizacaoHome autorizacao; public boolean create_database(String maquina, String usuario, String senha) { Configuration config = new Configuration(); config.setProperty("jdbc.Classname", "org.postgresql.Driver"); config.setProperty("jdbc.url", "jdbc:postgresql://"+maquina+"/horario?charSet=LATIN1"); config.setProperty("jdbc.user", usuario); config.setProperty("jdbc.pass", senha); config.setProperty("hibernate.dialect", "o…
tagged with: spring
type: Question
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/36164715
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23530694
has answer: http://stackoverflow.com/a/23584885
answer count: 2
accepted answer: http://stackoverflow.com/a/23584885
upvote count: 1
has comment: http://stackoverflow.com/comment/36097148
has title: Application creates the database, but doesn't create the tables
downvote count: 0
has comment: http://stackoverflow.com/comment/36119409

http://stackoverflow.com/q/23609097
has answer: http://stackoverflow.com/a/23609219
has body: this snippet of code works fine on my development machine (Windows 7 installed on VirtualBox jre 8 using Netbeans IDE), but on another machine (Windows 7 jre 8) always returns true. It should only find files with a name like "town_house.html" instead it always returns true for every file in the folder.Running the jar file from prompt I don't get any exceptions. Maybe it's just a trivial error I usually program in C/C++ ... any idea? for(File f : files) { if(f.toString().contains("_") &amp;&amp; f.toString().contains(".html")){ System.out.print("Processing file: " + f.getName()+ "\n"); String[] fileSplit = f.getName().split("_"); towns.add(fileSplit[0]); } } Thanks in advance
has comment: http://stackoverflow.com/comment/36242543
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36242599
answer count: 1
accepted answer: http://stackoverflow.com/a/23609219
has comment: http://stackoverflow.com/comment/36242556
has title: Java - String.contains() behaves oddly
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: string
favorite count: 0
type: Question
tagged with: windows

http://stackoverflow.com/comment/36179755
score: 0
comment on: http://stackoverflow.com/q/23575110
has text: What do you want to retrieve? You are converting the value to a character with only the hour and minute, so it shouldn't surprise you that you are only getting the hour and minute.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36113245
type: QuestionComment
comment on: http://stackoverflow.com/q/23539692
score: 0
type: Comment
has text: Do you have the source code of the Java agent that you're using?

http://stackoverflow.com/q/23585873
has answer: http://stackoverflow.com/a/23966267
favorite count: 0
has body: So, I setup a custom Policy and enabled the SecurityManager and decided that I don't need any file permissions for my app. But if I try to open a URL with the https protocol, I get this error: access: access denied ("java.io.FilePermission" "jdk1.8.0/jre/lib/ext/amd64/libsunec.so" "read") java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1329) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:447) at java.security.AccessController.checkPermission(AccessController.java:884) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkRead(SecurityManager.java:888) at java.io.File.exists(File.java:814) at sun.misc.Launcher$ExtClassLoader.findLibrary(Launcher.java:222) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1820) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1119) at sun.security.ec.SunEC$1.run(SunEC.java:60) at sun.security.ec.SunEC$1.run(SunEC.java:58) So, some class within the JRE is not able to load a native library because it doesn't get the file read permission. Is there a good way to setup a permissive policy for JDK's own classes?
has comment: http://stackoverflow.com/comment/36199440
tagged with: securitymanager
score: 2
upvote count: 2
type: UnansweredQuestion
has title: How to allow JRE to access itself?
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36199698
has comment: http://stackoverflow.com/comment/36205443
downvote count: 0
answer count: 1

http://stackoverflow.com/q/23510754
has comment: http://stackoverflow.com/comment/36059376
answer count: 3
upvote count: 7
has answer: http://stackoverflow.com/a/23510952
favorite count: 0
has title: Collections remove method doesn't give Concurrent Modification Exception
possible better answer: http://stackoverflow.com/a/23510952
has answer: http://stackoverflow.com/a/23511240
tagged with: collections
type: AnsweredQuestion
has body: I have read an article regarding removing elements from Collections from this link As per my understanding iterator remove method prevents Concurrent modification exception then remove method of Collection.But when i try to run the below codde i am unable to get concurrentmoficationexception List dayList= new ArrayList(); dayList.add("Sunday"); dayList.add("Monday"); dayList.add("Tuesday"); dayList.add("Wednesday"); dayList.remove("Tuesday"); Iterator itr=dayList.iterator(); while(itr.hasNext()) { Object testList=itr.next(); if(testList.equals("Monday")) { dayList.remove(testList); } } System.out.println(dayList); } As per javadoc the ConcurrentModicationException is thrown when we try to do any modification during iteartion.I am using collections remove method,but still there is no exception.But if I comment line dayList.remove("Tuesday");,exception is thrown. Can anyone explain what is happening behind the scene in this code?
downvote count: 0
has comment: http://stackoverflow.com/comment/36059564
has comment: http://stackoverflow.com/comment/36063757
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/23514944
accepted answer: http://stackoverflow.com/a/23514944
type: Question
has comment: http://stackoverflow.com/comment/36060845
linked to: http://stackoverflow.com/q/16079931
has comment: http://stackoverflow.com/comment/36059378
has comment: http://stackoverflow.com/comment/36059317

http://stackoverflow.com/comment/36145557
comment on: http://stackoverflow.com/q/23551438
type: Comment
has text: I would suggest you to use **freemarker template library** for sending template emails for appengine as it is very flexible and easy to use.
score: 0
type: QuestionComment

http://stackoverflow.com/a/23584158
has comment: http://stackoverflow.com/comment/36196787
has comment: http://stackoverflow.com/comment/109958044
type: Answer
upvote count: 33
has comment: http://stackoverflow.com/comment/36196544
has comment: http://stackoverflow.com/comment/109950670
has comment: http://stackoverflow.com/comment/36196617
has body: This is seriously dancing on the line of what is and is not appropriate for SO, IMHO, but it's an important issue, so I'll tackle it. What are the 37 Java API packages possibly encumbered by the May 2014 Oracle v Google decision? According to the appellate court decision, they are: java.awt.font java.beans java.io java.lang java.lang.annotation java.lang.ref java.lang.reflect java.net java.nio java.nio.channels java.nio.channels.spi java.nio.charset java.nio.charset.spi java.security java.security.acl java.security.cert java.security.interfaces java.security.spec java.sql java.text java.util java.util.jar java.util.logging java.util.prefs java.util.regex java.util.zip javax.crypto javax.crypto.interfaces javax.crypto.spec javax.net javax.net.ssl javax.security.auth javax.security.auth.callback javax.security.auth.login javax.security.auth.x500 javax.security.cert javax.sql Note that this is merely the roster that Oracle sued Google over, and does not necessarily represent all of the APIs to which Oracle claims copyright. What are the 3 packages that the Appellate Court decided were essential to the language? I am not aware that they made any such statement. You are welcome to read through the decision to find what you are seeking. The court did not decide anything was essential. Oracle claims that java.lang, java.io, and java.util are essential to basically do anything meaningful with the language. How can I avoid using the encumbered APIs in my Java code? Don't write in Java. Anything written in the Java programming language will involve classes from the affected packages. If the community were going to create a competing open classpath what would it look like? I am not aware that this would be technically possible. For further legal analysis, please consult with qualified legal counsel.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23583968
score: 33
answers question: http://stackoverflow.com/q/23583968
type: AcceptedAnswer

http://stackoverflow.com/a/60052787
has body: This worked for me:(Specifying "UTF-8" to StringEntity) Object obj = parser.parse(new FileReader( "/home/user/paylod.txt")); org.json.simple.JSONObject jsonObject = (org.json.simple.JSONObject) obj; StringEntity input = new StringEntity( jsonObject.toString(),"UTF-8"); input.setContentType("application/json");
type: Answer
answers question: http://stackoverflow.com/q/23573994
score: 0

http://stackoverflow.com/q/23602794
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36231448
has answer: http://stackoverflow.com/a/23602872
answer count: 4
has title: URL encode a name in java
tagged with: urlencode
upvote count: 0
has body: I want to URL encode a name in java including the double quotes also but it is omitting the double quote from the name. e.g. String name = "abc"; String url = URLEncode(name,"UTF-8"); System.out.println(url); it is printing abc but i want the url as %22abc%22 I searched on net but did not get anything.
score: -3
has answer: http://stackoverflow.com/a/23602833
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36231222
has answer: http://stackoverflow.com/a/23602845
favorite count: 0
has comment: http://stackoverflow.com/comment/36231396
downvote count: 3
has answer: http://stackoverflow.com/a/23602835

deployment
tags question: http://stackoverflow.com/q/23493263
tag name: deployment
tags question: http://stackoverflow.com/q/23561836
tags question: http://stackoverflow.com/q/23468960
tags question: http://stackoverflow.com/q/23609227
type: Tag
tags question: http://stackoverflow.com/q/23456089
tags question: http://stackoverflow.com/q/23543158
tags question: http://stackoverflow.com/q/23497066

http://stackoverflow.com/a/23496139
accepted answer of: http://stackoverflow.com/q/23495944
score: 0
type: Answer
has body: The Runtime.exec() method spawns a process, but doesn't wait for it to complete. You should use the waitFor() method on the returned Process instance, in order to wait for the process to end. Plus, @ixe013's comment is correct: you should remove the start word from the command, as it spawns yet another process. If you don't remove start, then waitFor() won't help you much: it will wait for the start command to end, which is instantaneous.
has comment: http://stackoverflow.com/comment/36031492
has comment: http://stackoverflow.com/comment/36031408
has comment: http://stackoverflow.com/comment/36031943
has comment: http://stackoverflow.com/comment/36031669
answers question: http://stackoverflow.com/q/23495944
has comment: http://stackoverflow.com/comment/36031296
has comment: http://stackoverflow.com/comment/36032145
type: AcceptedAnswer

http://stackoverflow.com/q/23596530
answer count: 5
tagged with: timezone
has answer: http://stackoverflow.com/a/33369889
upvote count: 76
has comment: http://stackoverflow.com/comment/99605335
tagged with: java-8
type: AnsweredQuestion
tagged with: java
tagged with: java-time
has title: Unable to obtain ZonedDateTime from TemporalAccessor using DateTimeFormatter and ZonedDateTime in Java 8
type: Question
linked to: http://stackoverflow.com/q/22463062
possible better answer: http://stackoverflow.com/a/23605733
has comment: http://stackoverflow.com/comment/94119332
accepted answer: http://stackoverflow.com/a/23596623
score: 76
tagged with: datetime-format
has answer: http://stackoverflow.com/a/27285822
has answer: http://stackoverflow.com/a/49060861
has answer: http://stackoverflow.com/a/23596623
downvote count: 0
has body: I recently moved to Java 8 to, hopefully, deal with local and zoned times more easily. However, I'm facing an, in my opinion, simple problem when parsing a simple date. public static ZonedDateTime convertirAFecha(String fecha) throws Exception { DateTimeFormatter formatter = DateTimeFormatter.ofPattern( ConstantesFechas.FORMATO_DIA).withZone( obtenerZonaHorariaServidor()); ZonedDateTime resultado = ZonedDateTime.parse(fecha, formatter); return resultado; } In my case: fecha is '15/06/2014' ConstantesFechas.FORMATO_DIA is 'dd/MM/yyyy' obtenerZonaHorariaServidor returns ZoneId.systemDefault() So, this is a simple example. However, the parse throws this exception: java.time.format.DateTimeParseException: Text '15/06/2014' could not be parsed: Unable to obtain ZonedDateTime from TemporalAccessor: {},ISO resolved to 2014-06-15 of type java.time.format.Parsed Any tips? I've been trying different combinations of parsing and using TemporalAccesor, but without any luck so far.
favorite count: 0
has answer: http://stackoverflow.com/a/23605733

http://stackoverflow.com/comment/39547363
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23606183
score: 0
has text: ya i got solution from your reply

http://stackoverflow.com/comment/36035161
score: 0
type: QuestionComment
has text: what is System.out.println(""+s); printing
type: Comment
comment on: http://stackoverflow.com/q/23498018

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/23564855
tags question: http://stackoverflow.com/q/23491509
tags question: http://stackoverflow.com/q/23546561
tag name: jfreechart

http://stackoverflow.com/comment/36040191
has text: It depends; different queues have different limits.
comment on: http://stackoverflow.com/q/23500391
score: 0
type: Comment
type: QuestionComment

swingx
tags question: http://stackoverflow.com/q/23607433
tag name: swingx
type: Tag

http://stackoverflow.com/q/23520496
has answer: http://stackoverflow.com/a/23533633
has comment: http://stackoverflow.com/comment/36084024
has answer: http://stackoverflow.com/a/23533451
has comment: http://stackoverflow.com/comment/36084153
has comment: http://stackoverflow.com/comment/36084203
has title: Is it possible to pass parameters to TestNG's @DataProvider?
tagged with: java
type: AnsweredQuestion
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/21290122
favorite count: 0
accepted answer: http://stackoverflow.com/a/23533451
type: Question
tagged with: testng
tagged with: selenium-webdriver
has body: I've got an Excel Spreadsheet in which I store all of the test Credit Cards. These credit cards have different types. Some of these are VISA, others are MasterCard, Amex etc... I have got a test case in which I sometimes want to use VISA cards, and sometimes MasterCard cards. Is it possible to pass parameters to the @DataProvider? Here is my code for @DataProvider: @DataProvider(name="dpCreditCards") public Object[][] getCreditCards() { Object[][] testData = null; try { FileInputStream fis = new FileInputStream(dir); XSSFWorkbook workbook = new XSSFWorkbook(fis); XSSFSheet worksheet = workbook.getSheet("Credit Cards"); String type = ""; String cardNumber = ""; int numOfRows = worksheet.getPhysicalNumberOfRows(); int j = 0; if (numOfRows &gt; 0) { for (int i = 1; i &lt; numOfRows; i++) { XSSFRow r = worksheet.getRow(i); if (r.getCell(0).getCellType() == Cell.CELL_TYPE_NUMERIC) { type = Integer.toString((int)r.getCell(0).getNumericCellValue()); } else if (r.getCell(0).getCellType() == Cell.CELL_TYPE_STRING) { type = r.getCell(0).getStringCellValue(); } if (type.equalsIgnoreCase("visa")) j++; } testData = new Object[j][1]; } for (int i = 1; i &lt; numOfRows; i++) { XSSFRow r = worksheet.getRow(i); if (r.getCell(0).getCellType() == Cell.CELL_TYPE_NUMERIC) { type = Integer.toString((int)r.getCell(0).getNumericCellValue()); } else if (r.getCell(0).getCellType() == Cell.CELL_TYPE_STRING) { type = r.getCell(0).getStringCellValue(); } if (type.equalsIgnoreCase("visa")) { if (r.getCell(1).getCellType() == Cell.CELL_TYPE_NUMERIC) { cardNumber = Integer.toString((int)r.getCell(1).getNumericCellValue()); } else if (r.getCell(1).getCellType() == Cell.CELL_TYPE_STRING) { cardNumber = r.getCell(1).getStringCellValue(); } testData[i-1][0] = cardNumber; } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return testData; } I've checked this link: http://testng.org/doc/documentation-main.html#parameters-dataproviders but couldn…
answer count: 2
possible better answer: http://stackoverflow.com/a/23533633
tagged with: selenium
upvote count: 1
has comment: http://stackoverflow.com/comment/36107408

http://stackoverflow.com/comment/35990316
type: Comment
comment on: http://stackoverflow.com/a/23472801
type: AnswerComment
score: 1
has text: Ok, then my advice would be to decompose. First, think globally. What would you do if you had to do it yourself? Find the general idea, and assume you have big basic blocks to build your algorithm. Then, refine the basic blocks. That's how you end up with the kind of methods hierarchy that I provided.

http://stackoverflow.com/comment/35984630
type: QuestionComment
comment on: http://stackoverflow.com/q/23471074
score: 2
type: Comment
has text: Make sure you are using the `onCreateView` method to find, call your views and not `onCreate` method from your activity. [See this answer](http://stackoverflow.com/a/23172981/2668136), it might help you to understand.

http://stackoverflow.com/comment/36122754
has text: Seems you're right, I changed everything to BufferedImage and added setAccelerationPriority(1), and the application sped up significantly. Thanks
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23543944

http://stackoverflow.com/comment/36236234
type: AnswerComment
comment on: http://stackoverflow.com/a/23599989
type: Comment
score: 1
has text: Thanks saveChanges() worked .. message.saveChanges(); message.writeTo(System.out);

http://stackoverflow.com/comment/36192333
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23581979
type: AnswerComment
has text: I have edited the code. I just need to split the string into array. I don't know why compiler not recognizing it :String array[] = gf.split("\\", -1);

http://stackoverflow.com/q/23471450
has answer: http://stackoverflow.com/a/23472827
has comment: http://stackoverflow.com/comment/35985908
has comment: http://stackoverflow.com/comment/35985824
upvote count: 1
has comment: http://stackoverflow.com/comment/35985577
favorite count: 0
has comment: http://stackoverflow.com/comment/35987069
has comment: http://stackoverflow.com/comment/35986209
has comment: http://stackoverflow.com/comment/35987290
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23472827
tagged with: java
has comment: http://stackoverflow.com/comment/35986378
downvote count: 3
type: Question
has body: I'm going totally nuts on my BankLogic now. Three classes, Customer, SavingsAccount and BankLogic where I want to create customers and savings accounts. I have two methods that works fine, addCustomer() (where I add customers to arraylist Customer) and addSavingsAccount() (where I add savings accounts to customers with certain pNr). My problem is that I don't know how to print stuff out from two arraylists that somehow have to be linked together. How do I do that? This method is Ok if I only have info = customer.toString(). How do I get the right accountId to the pNr? I know I can't fetch it from SavingsAccount, it will generate a new number. But how do I do? BankLogic class import java.util.ArrayList; import java.util.Scanner; public class BankLogic { private double amount; private double balance; private ArrayList&lt;Customer&gt; customerlist; private ArrayList&lt;SavingsAccount&gt; accounts; Scanner in = new Scanner(System.in); public BankLogic() { customerlist = new ArrayList&lt;Customer&gt;(); accounts = new ArrayList&lt;SavingsAccount&gt;(); } public String infoBank() { String customers = customerlist.toString(); return customers.substring(1, customers.length() - 1); } public boolean addCustomer(String name, long pNr) { boolean add = true; for(int i = 0; i &lt; customerlist.size(); i++) { if (customerlist.get(i).getPCode() == pNr) { add = false; } } if(add) { customerlist.add(new Customer(name, pNr)); add = true; } return add; } public String infoCustomer(long pNr){ String info = ""; for (Customer customer : customerlist) { if (customer.getPCode() == pNr) { info = customer.toString() + "\tKontonr: " + findAccount(pNr); } } return info; } public String findAccount(long pNr){ for(SavingsAccount account : accounts) { if (account.getPCode() == pNr) { return "account found"; } } return "Nothing found"; } public boolean changeCustomerName(String name, long pNr){ boolean result = false; for(int i = 0; i &lt; customerlist.size(); i++) { if (customerlist.get(i).getPCod…
answer count: 2
has comment: http://stackoverflow.com/comment/35985419
score: -2
has comment: http://stackoverflow.com/comment/35986032
has comment: http://stackoverflow.com/comment/35985972
has title: Implementing two arraylists in another class
tagged with: arraylist
has answer: http://stackoverflow.com/a/23472133
accepted answer: http://stackoverflow.com/a/23472133

http://stackoverflow.com/q/23469710
has comment: http://stackoverflow.com/comment/35984578
has title: Liferay with LDAP
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23492350
accepted answer: http://stackoverflow.com/a/23492350
has comment: http://stackoverflow.com/comment/35985215
tagged with: liferay
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/23478461
favorite count: 0
tagged with: liferay-6
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/35984639
type: Question
has body: I am configuring Liferay with my organization LDAP. 1.While configuring LDAP, I specify "ldap.security.principal" and "ldap.security.credentials" as my user id and password to authenticate against LDAP and test connection succeeds. Are these mandatory attributes? As in production ,I will not be able to specify my own credentials in portal-ext.properties. Do I need separate user created in LDAP to specify in portal-ext for production? I unfortunately do not have control over configuring LDAP as its an org LDAP. Any pointers would help. Thanks.

http://stackoverflow.com/comment/36052484
type: Comment
has text: I have a wonderfully simple algorithm to do that, but unfortunately it won't fit in this [margin](http://en.wikipedia.org/wiki/Fermat%27s_Last_Theorem)....
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23507112

http://stackoverflow.com/comment/36049297
has text: Hi Braj, I found this for Chrome "https://groups.google.com/forum/#!topic/google-web-toolkit/l5dj2xxPBuk". It seems there is an issue with Chrome in Windows 8. I have installed the Explorer plugin by selecting "Plugins for other systems", selecting the Explorer plugin, save and then run. However, when I try to run my application I get the same yellow popup requiring me to install the plugin. Regards, Glyn.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23487772
type: Comment

http://stackoverflow.com/q/23588880
answer count: 0
score: 0
type: UnansweredQuestion
tagged with: jtextpane
tagged with: jcomponent
has comment: http://stackoverflow.com/comment/36205476
tagged with: java
has comment: http://stackoverflow.com/comment/36205233
linked to: http://stackoverflow.com/q/13165617
has comment: http://stackoverflow.com/comment/36215638
type: Question
has comment: http://stackoverflow.com/comment/36205380
has title: JtextPane count visible line numbers
has body: I use a JTextpane in a JScrollpane and the contents of the Jtextpane currently displayed are, Row1 Row2 Row3 Row4 I type CLEAR and on press of ENTER i need to display only the last line scrolling the other lines upwards like below, Row4 caret at the end of last line(Row4) and while scrolling up the following should be displayed, Row1 Row2 Row3 Note : I have used keybindings to get enter action and using if condition i get to know that clear is typed. How can i achieve this please help.
has comment: http://stackoverflow.com/comment/36227385
has comment: http://stackoverflow.com/comment/36205141

http://stackoverflow.com/q/23614381
type: AnsweredQuestion
has body: I have a very basic Android app. When I launch it on an Android Virtual device, and look at LogCat I see a number of errors and warnings - largely not from my application code, from com.android.* and system_process For example 05-12 14:45:05.554: E/ActivityThread(392): Failed to find provider info for com.android.inputmethod.latin.dictionarypack 05-12 14:45:05.564: E/BinaryDictionaryGetter(392): Could not find a dictionary pack 05-12 14:45:06.163: W/ContextImpl(997): Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1352 android.content.ContextWrapper.startService:450 android.content.ContextWrapper.startService:450 com.android.keychain.KeyChainBroadcastReceiver.onReceive:12 android.app.ActivityThread.handleReceiver:2376 05-12 14:52:06.206: E/ThrottleService(300): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory) 05-12 15:11:42.594: E/Trace(2448): error opening trace file: No such file or directory (2) 05-12 15:11:42.944: E/Trace(2464): error opening trace file: No such file or directory (2) 05-12 15:11:43.283: E/ActivityThread(2464): Failed to find provider info for com.google.settings 05-12 15:11:43.293: E/ActivityThread(2464): Failed to find provider info for com.google.settings 05-12 15:11:43.424: E/DictionaryBackupAgent(455): Couldn't read from the cursor So here's my question: Are these normal or is there some real information there I need to pay attention to here.
tagged with: java
accepted answer: http://stackoverflow.com/a/23614612
type: Question
score: 0
linked to: http://stackoverflow.com/q/20729853
answer count: 1
duplicate of: http://stackoverflow.com/q/20729853
has answer: http://stackoverflow.com/a/23614612
has title: LogCat shows errors from Android while testing with AVD
tagged with: android

http://stackoverflow.com/a/23477205
has comment: http://stackoverflow.com/comment/35996590
downvote count: 0
has comment: http://stackoverflow.com/comment/35997143
answers question: http://stackoverflow.com/q/23477117
has comment: http://stackoverflow.com/comment/35996693
has body: Change the method to: public &lt;T extends A&gt; void Foo (Class&lt;T&gt; cls) { System.out.println(cls.getField("BOUNDS").get(null)); } Test for this method: class Bounds { int a, b, c, d; public Bounds (int a, int b, int c, int d) { this.a = a; this.b = b; this.c = c; this.d = d; } @Override public String toString() { return "Bounds [a=" + a + ", b=" + b + ", c=" + c + ", d=" + d + "]"; } } //classes A and B were kept as defined in OP's code public class Test { public static &lt;T extends A&gt; void Foo (Class&lt;T&gt; cls) { try { System.out.println(cls.getField("BOUNDS").get(null)); } catch(Exception lazyToHandle) {} } public static void main(String[] args) throws Exception { Foo(B.class); } } Prints: Bounds [a=5, b=6, c=7, d=8]
type: Answer
has comment: http://stackoverflow.com/comment/35996891
upvote count: 1
has comment: http://stackoverflow.com/comment/35996762
score: 1
has comment: http://stackoverflow.com/comment/35996207

java
tags question: http://stackoverflow.com/q/23512858
tags question: http://stackoverflow.com/q/23568364
tags question: http://stackoverflow.com/q/23495415
tags question: http://stackoverflow.com/q/23595722
tags question: http://stackoverflow.com/q/23542101
tags question: http://stackoverflow.com/q/23535988
tags question: http://stackoverflow.com/q/23590912
tags question: http://stackoverflow.com/q/23607585
tags question: http://stackoverflow.com/q/23577192
tags question: http://stackoverflow.com/q/23559862
tags question: http://stackoverflow.com/q/23493164
tags question: http://stackoverflow.com/q/23600478
tags question: http://stackoverflow.com/q/23606092
tags question: http://stackoverflow.com/q/23517244
tags question: http://stackoverflow.com/q/23476457
tags question: http://stackoverflow.com/q/23546003
tags question: http://stackoverflow.com/q/23465723
tags question: http://stackoverflow.com/q/23483905
tags question: http://stackoverflow.com/q/23542610
tags question: http://stackoverflow.com/q/23584409
tags question: http://stackoverflow.com/q/23572168
tags question: http://stackoverflow.com/q/23606047
tags question: http://stackoverflow.com/q/23484359
tags question: http://stackoverflow.com/q/23583848
tags question: http://stackoverflow.com/q/23531575
tags question: http://stackoverflow.com/q/23504430
tags question: http://stackoverflow.com/q/23584846
tags question: http://stackoverflow.com/q/23492979
tags question: http://stackoverflow.com/q/23524458
tags question: http://stackoverflow.com/q/23554036
tags question: http://stackoverflow.com/q/23460393
tags question: http://stackoverflow.com/q/23613895
tags question: http://stackoverflow.com/q/23501706
tags question: http://stackoverflow.com/q/23508187
tags question: http://stackoverflow.com/q/23520063
tags question: http://stackoverflow.com/q/23495167
tags question: http://stackoverflow.com/q/23582478
tags question: http://stackoverflow.com/q/23472896
tags question: http://stackoverflow.com/q/23456520
tags question: http://stackoverflow.com/q/23488796
tags question: http://stackoverflow.com/q/23474815
tags question: http://stackoverflow.com/q/23541092
tags question: http://stackoverflow.com/q/23563368
tags question: http://stackoverflow.com/q/23577470
tags question: http://stackoverflow.com/q/23614721
tags question: http://stackoverflow.com/q/23496995
tags question: http://stackoverflow.com/q/23519229
tags question: http://stackoverflow.com/q/23577076
tags question: http://stackoverflow.com/q/23591245
tags question: http://stackoverflow.com/q/23565346
tags question: http://stackoverflow.com/q/23479355
tags question: http://stackoverflow.com/q/23522523
tags question: http://stackoverflow.com/q/23536437
tags question: http://stackoverflow.com/q/23494397
tags question: http://stackoverflow.com/q/23488676
tags question: http://stackoverflow.com/q/23587065
tags question: http://stackoverflow.com/q/23605379
tags question: http://stackoverflow.com/q/23492218
tags question: http://stackoverflow.com/q/23611122
tags question: http://stackoverflow.com/q/23463740
tags question: http://stackoverflow.com/q/23543843
tags question: http://stackoverflow.com/q/23607109
tags question: http://stackoverflow.com/q/23509216
tags question: http://stackoverflow.com/q/23527506
tags question: http://stackoverflow.com/q/23541809
tags question: http://stackoverflow.com/q/23460478
tags question: http://stackoverflow.com/q/23581303
tags question: http://stackoverflow.com/q/23527646
tags question: http://stackoverflow.com/q/23561878
tags question: http://stackoverflow.com/q/23510014
tags question: http://stackoverflow.com/q/23513165
tags question: http://stackoverflow.com/q/23514499
tags question: http://stackoverflow.com/q/23518886
tags question: http://stackoverflow.com/q/23610227
tags question: http://stackoverflow.com/q/23476246
tags question: http://stackoverflow.com/q/23504647
tags question: http://stackoverflow.com/q/23510885
tags question: http://stackoverflow.com/q/23535318
tags question: http://stackoverflow.com/q/23540169
tags question: http://stackoverflow.com/q/23555188

http://stackoverflow.com/q/23610462
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36802138
possible better answer: http://stackoverflow.com/a/23611557
favorite count: 0
has answer: http://stackoverflow.com/a/23611557
has comment: http://stackoverflow.com/comment/36851792
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/42521619
has body: I got problems while reading arabic characters from oracle in java using JDBC driver, the main problem was i couldn't find the proper character encoding to get the correct data , but i solved the problem manually using this method: public static String cleanORCLString(String s) throws UnsupportedEncodingException { byte[] bytes = s.getBytes("UTF16"); String x = new String(bytes, "Cp1256"); String finalS = x.substring(3); StringBuilder sb = new StringBuilder(finalS); for(int k = sb.length() - 1 ; k &gt; 0 ; k--) { if(!isEven(k)) { sb.deleteCharAt(k); } } return sb.toString(); } this method give me the correct characters like its shown in database, but when I try to update/insert arabic data, it save wrong characters. For example: my text saved in database as "?????????" instead of "مرحبا". This is the way I connect to oracle database. URL = ORCLConnProperties.ORCL_THIN_PREFIX + orclProp.getIpAddress() + orclProp.getPortNumber() + ORCLConnProperties.ORCL_THIN_SUFIX; // URL = jdbc:oracle:thin:@10.0.0.12:1521:ORCL System.out.println("URL: " + URL); Properties connectionProps = new Properties(); connectionProps.put("characterEncoding", "Cp1256"); connectionProps.put("useUnicode", "true"); connectionProps.put("user", orclProp.getUserName()); connectionProps.put("password", orclProp.getPassword()); try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException ex) { System.out.println("Error: unable to load driver class!"); System.exit(1); } myDriver = new oracle.jdbc.driver.OracleDriver(); DriverManager.registerDriver(myDriver); conn = DriverManager.getConnection(URL, connectionProps); please help me in solving this issue ? Thanks. New Note: Database itself don't use UTF16 character set, but "the JDBC OCI driver transfers the data from the server to the client in the character set of the database. Depending on the value of the NLS_LANG environment variable, the driver handles character set conversions: OCI converts the data from the database chara…
score: 1
tagged with: java
tagged with: character-encoding
has title: Can't insert arabic characters into oracle database
accepted answer: http://stackoverflow.com/a/42521619
type: Question
answer count: 2
downvote count: 0
tagged with: arabic
tagged with: oracle-database

http://stackoverflow.com/q/23510624
tagged with: android
tagged with: php
has comment: http://stackoverflow.com/comment/36058729
upvote count: 0
has comment: http://stackoverflow.com/comment/36058631
has body: I am using a php web service to return SQL queries results to android in a JSON object format. It works fine for me but now I want to be able to return the result of a Joint query in a JSON Object, and I don't know how to do it. how would be able to put all the result in a JSON object and how do I access the result if I select data from two tables via a INNER JOIN? EDIT : HERE IS THE QUERY $query = " SELECT * FROM question INNER JOIN comment ON question.id = comment.id_question WHERE question.id = :id"; WHy question is : this does return all I need and I encode it using json_encode. But when I receive it on my Android side, how to I access columns from table question or from table comment knowing that all I have is one json Object, let's said called "json".
tagged with: java
has answer: http://stackoverflow.com/a/23512760
tagged with: http://stackoverflow.com/tag/json
tagged with: mysql
type: Question
has title: Return JOIN query result as a JSON
score: -2
has comment: http://stackoverflow.com/comment/36062269
downvote count: 2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36061221
type: UnansweredQuestion

http://stackoverflow.com/comment/36226771
comment on: http://stackoverflow.com/a/23509458
has text: There's in input redirection (`<`) in your example, and I' not sure if that would work any way...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23471714
favorite count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Does the InvocationContext propagate to the nested methods
tagged with: ejb
has answer: http://stackoverflow.com/a/31249592
has body: I need to send to the nested methods prarmeter from the parent one I defined an EJB interceptor and use it at the business methods level and I need in the nested method to know some information that should be send from the parent invoker method (non businesss data) that will be used in aduit so, my question is , does InvocationContext propagate to the nested methods
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/36101545
score: 0
has text: `Customer` class `compareToIgnoreCase(Customer customer)` method code???
comment on: http://stackoverflow.com/q/23532990
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23585466
has comment: http://stackoverflow.com/comment/36198867
upvote count: 2
has comment: http://stackoverflow.com/comment/36199053
answers question: http://stackoverflow.com/q/23585423
has comment: http://stackoverflow.com/comment/36199429
type: Answer
has comment: http://stackoverflow.com/comment/36199935
score: 2
downvote count: 0
has body: I'm guessing as to your use case, but is "ground" a background image containing JPanel? If so, then add it in such a way so that it fills the container, perhaps via BorderLayout.CENTER with the container using BorderLayout of course. The ship, I'm guessing is a sprite that is drawn on the background. If so, consider having it not be a JPanel but rather a logical object that holds an image Sprite that can be drawn in the ground's paintComponent method. As always the devil will be found in the details. You first. Edit You state in comment: Stage is my background and it extends JPanel. Ship is a player element (JComponent). Ground (JComponent) is something which player can't touch. I wanted to have this two elements (ground and ship) like layers where the image is drawn. I need to have one point reference to check collisions. I assume that you have a paintComponent(Graphics g) override method in your Stage object where you draw your background image. Based on this assumption, I change my previous recommendation in that I feel that neither ground nor ship should extend JPanel since you don't really need for them to do this. You already have a JPanel on which you can do your drawing and game interaction, so why create more when they'll only clutter things up? The only exception I see is if either ground or ship need to hold other components, and if so, then yes, they should extend JPanel. Consider: What is important to both of these objects, both ground and ship, are their locations and their images. Give both ground and ship a BufferedImage field that can hold their images, with getters and setters. Give them x and y int position fields and width and height, with getters and setters that can be used to test for collision and can be used to move their respective sprite (image). Give them a draw(Graphics g) method that draws their respective images at the x an y location when called and passed a valid Graphics instance. Have Stage hold an instance of each ground and ship,…
has comment: http://stackoverflow.com/comment/36199490

http://stackoverflow.com/a/23614549
has body: Use a database. Define a table with two columns: order and value. Make order an automatically incrementing sequence (most databases, including MySQL have this). Use max length for value (often 255 chars for a varchar). BLOBs and CLOBs are often overkill if you just want rows in insert order.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23613992

http://stackoverflow.com/comment/36430200
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23631998
type: Comment
has text: Once I get more time, I'll start dealing with this issue again. Until then, product will have targetSdkLevel 18.

http://stackoverflow.com/comment/36221012
score: 1
comment on: http://stackoverflow.com/q/23597331
has text: Oh, then what's the purpose of addLast() ? just extra function.
type: Comment
type: QuestionComment

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

http://stackoverflow.com/q/23502933
type: Question
has comment: http://stackoverflow.com/comment/36050073
tagged with: java
tagged with: character-encoding
has body: I was reading the Google Java Style Guide and came across this: String unitAbbrev = "μs"; Best: perfectly clear even without a comment. String unitAbbrev = "\u03bcs"; // "μs" Allowed, but there's no reason to do this. String unitAbbrev = "\u03bcs"; // Greek letter mu, "s" Allowed, but awkward and prone to mistakes. String unitAbbrev = "\u03bcs"; Poor: the reader has no idea what this is. I understand how to type "\u03bcs" in java editors such as eclipse, but how exactly do I type "μ"??? Copy and paste from internet source? Please enlighten me.... EDIT: Especially say, I want to type a sentence in Greek letters, it would be kinda dumb to use "\u03bcs" &lt;- this way, but copy/paste from internet sources seem to be too much work...
answer count: 3
has answer: http://stackoverflow.com/a/23503043
tagged with: unicode
score: 0
has answer: http://stackoverflow.com/a/23503059
has answer: http://stackoverflow.com/a/23503536
type: UnansweredQuestion
has title: How to write Unicodes in Java (editors)

java-ee-7
tags question: http://stackoverflow.com/q/23524565
tag name: java-ee-7
type: Tag
tags question: http://stackoverflow.com/q/23469904
tags question: http://stackoverflow.com/q/23566392
tags question: http://stackoverflow.com/q/23521195

http://stackoverflow.com/comment/47836336
score: 0
comment on: http://stackoverflow.com/a/29849004
type: Comment
has text: Thanks. I'm afraid that might indeed be the only solution. Putting it all together it's much more verbose than I'd hoped, but still better then nothing.
type: AnswerComment

http://stackoverflow.com/comment/36036784
comment on: http://stackoverflow.com/a/23498621
has text: Brilliant this is what I'm looking for, thanks for the help been struggling with this for a while
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36060127
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23510027
has text: Your Welcome, Have fun coding. :)
type: Comment

http://stackoverflow.com/a/23573858
has comment: http://stackoverflow.com/comment/36177794
accepted answer of: http://stackoverflow.com/q/23573831
has comment: http://stackoverflow.com/comment/36177214
answers question: http://stackoverflow.com/q/23573831
has comment: http://stackoverflow.com/comment/36177154
has comment: http://stackoverflow.com/comment/36177563
score: 0
type: AcceptedAnswer
has body: So, extend UIWatcher in a named inner class (contained inside your existing classfile/class body): public class MyUIWatcher implements UiWatcher() { public boolean checkForCondition() { // logic } } and then declare crash as: UiWatcher crash = new MyUIWatcher();
has comment: http://stackoverflow.com/comment/36177754
type: Answer
has comment: http://stackoverflow.com/comment/36177314

http://stackoverflow.com/q/23573752
has body: I am trying to build my first android app. I have multiple Activities and I am using a Handler and an AssetFileDescriptor in order to play a sound file. My problem is, how can I pass these objects around? I have one Activity that starts a timer via the handler, and another which stops the timer via the handler. Should I pass these objects around between Activities, or is there another way? I am not used to Java, but I was wondering if I could make a config static class or something that creates all of these objects, and then each one of my Activities would just access these objects from this static config class. However, this has its own problems, since in order to call the method getAssets(), I cannot use a static class ("Cannot make a static reference to a non-static method.") Any ideas?
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23574638
score: 0
tagged with: android
tagged with: config
tagged with: android-activity
linked to: http://stackoverflow.com/q/4208886
has comment: http://stackoverflow.com/comment/36179313
type: UnansweredQuestion
has title: Passing objects between Android Activities, or config file?

http://stackoverflow.com/comment/36067831
has text: and the time taken for output will be the same???
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23513450

http://stackoverflow.com/comment/36183015
type: QuestionComment
comment on: http://stackoverflow.com/q/23576608
score: 0
has text: write a java program to get the inputstream from the url above and then use ImageIO api to write the image...
type: Comment

http://stackoverflow.com/q/23533952
tagged with: java
tagged with: duplicates
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23534328
tagged with: arrays
has body: This is my jsp page. &lt;body&gt; &lt;% String a[] = {"PAK", "ENG", "IND", "USA"}; String b[] = {"ON", "UK","IND","ENG","SA"}; String[] Filterjoined = ObjectArrays.concat(a, b, String.class); out.println(Arrays.toString(Filterjoined)); StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; Filterjoined.length; i++) { boolean found = false; for (int j = i + 1; j &lt; Filterjoined.length; j++) { if (Filterjoined[j].equals(Filterjoined[i])) { found = true; break; } } if (!found) { if (sb.length() &gt; 0) { sb.append(','); } sb.append(Filterjoined[i]); } } out.println("&lt;br&gt;"); out.println(sb); %&gt; &lt;/body&gt; Here i'm getting output as PAK,USA,ON,UK,IND,ENG,SA but i need to delete string from both arrays if string has duplicated. i.e., expected output is:PAK,USA,ON,UK,ENG,SA because IND has duplicated in both arrays so i need to delete it,remaining elements has to display.Thanks for your reply
has comment: http://stackoverflow.com/comment/36102979
has title: How can i remove duplicate string from both arrays in java?
tagged with: string
has comment: http://stackoverflow.com/comment/36103035
has comment: http://stackoverflow.com/comment/36102915
possible better answer: http://stackoverflow.com/a/23534188
has answer: http://stackoverflow.com/a/23534188
has comment: http://stackoverflow.com/comment/36102934
has answer: http://stackoverflow.com/a/23534328
type: AnsweredQuestion
score: 0

http://stackoverflow.com/comment/35976324
comment on: http://stackoverflow.com/q/23466313
type: Comment
type: QuestionComment
has text: If you are getting NullPointerException, Reader object is not created, that means file is not present.
score: 0

http://stackoverflow.com/q/23575586
has answer: http://stackoverflow.com/a/23576907
type: UnansweredQuestion
tagged with: java
type: Question
has title: JSP with Java beans complex types
has body: I have a Java bean class with property Jobs which returns complex type jobs. I am unable to find how to catch all the jobs at once in JSP file. Let me show my code below: My javabean Class: public Jobs[] getMatchingJobs() throws RemoteException { JobProviderServiceStub stub = new JobProviderServiceStub(); ViewMatchingJobs matchingJobs = new ViewMatchingJobs(); matchingJobs.setSkillcode(skillcode); Job[] j = stub.viewMatchingJobs(matchingJobs).get_return(); return j; } Now I am writing something like this in JSP: &lt;body&gt; &lt;jsp:useBean id="jobs" class="com.cs.javabean.jobsBean"&gt; &lt;p&gt; &lt;jsp:getProperty name="jobs" property="MatchingJobs"/&gt; &lt;/p&gt; I even don't know whether I can use the above JSP to get all jobs. and even if I get I don't know how to display them. Can somebody help me do that? Any help could be greatly appreciated.
score: 0
answer count: 1
tagged with: jsp
tagged with: javabeans

http://stackoverflow.com/comment/36093848
has text: And what if I wanted to include "Game Over" while the snake is still size 5?
type: Comment
comment on: http://stackoverflow.com/a/23528783
score: 0
type: AnswerComment

http://stackoverflow.com/q/23478096
has comment: http://stackoverflow.com/comment/35998188
accepted answer: http://stackoverflow.com/a/23478566
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35998716
has comment: http://stackoverflow.com/comment/35998652
has answer: http://stackoverflow.com/a/23478465
tagged with: if-statement
score: 1
tagged with: java
type: Question
has title: Hi, im struggling to understand O-notation runtime for the if statement in this piece of code
has comment: http://stackoverflow.com/comment/35998174
downvote count: 0
has comment: http://stackoverflow.com/comment/35998178
has comment: http://stackoverflow.com/comment/35998746
has answer: http://stackoverflow.com/a/23478452
has answer: http://stackoverflow.com/a/23478566
answer count: 3
tagged with: matrix
possible better answer: http://stackoverflow.com/a/23478452
has body: for (int i=0; i&lt;V-1; i++) { for (int j=i+1; j&lt;V; j++) { if (matrix[i][j]) { from[nextedge]=i; to[nextedge]=j; nextedge++; } } } I am trying to find out the o notation runtime for the if statement and inner for loop but am struggling with how to solve this
favorite count: 0
tagged with: big-o
upvote count: 1

jdialog
tags question: http://stackoverflow.com/q/23590596
type: Tag
tags question: http://stackoverflow.com/q/23467700
tag name: jdialog
tags question: http://stackoverflow.com/q/23461643

http://stackoverflow.com/comment/36063622
type: Comment
has text: @Dariusz :Yes, I clearly stated, **in Java**, both are same. Not sure why this was down voted.!
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23513481

http://stackoverflow.com/comment/36022749
type: Comment
has text: Thanks, I know that. In debugger I see request.getParameter("thumbnail") as null anyhow. I need to set thumbnail "true" only if I got "on" from jsp.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23491571

http://stackoverflow.com/comment/35998811
comment on: http://stackoverflow.com/q/23478451
type: Comment
type: QuestionComment
has text: The code works for me. Did you try to debug?
score: 0

http://stackoverflow.com/comment/36147608
type: Comment
has text: I saw this code from edu4java.com and I am a complete beginner to make games, please let me know am I working in a correct way or not, because I have to develop a game within a month anyhow.
comment on: http://stackoverflow.com/a/23552779
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35954624
has text: @LukasEder Make up your mind. Ether you are asking SO members to trawl through the mailing list for you, which is an off-topic request for a off-site resource, or you are asking for a 'public Q&A', in which case it is 'primarily opinion-based'. In either case it's off-topic, however interesting.
comment on: http://stackoverflow.com/q/23453287
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36082877
type: Comment
has text: I want to try to keep resources outside the packages.
comment on: http://stackoverflow.com/a/23522955
score: 0
type: AnswerComment

http://stackoverflow.com/q/23594066
has answer: http://stackoverflow.com/a/23594152
type: Question
tagged with: bytestream
tagged with: java
has title: Writing to a file using a byte stream
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23594189
accepted answer: http://stackoverflow.com/a/23594152
possible better answer: http://stackoverflow.com/a/23594189
tagged with: text-files
type: AnsweredQuestion
has body: I'm trying to write a series of 10000 random integers to a text file using a byte stream, however once I open the text file up it has a collection of random characters which seemingly have little to do with the integer values I want to be shown. I'm new to this form of stream, I'm guessing that the integer values are being taken as byte values, but I can't think of a way to get round this. My current attempt... import java.io.FileOutputStream; import java.io.IOException; import java.util.Random; public class Question1ByteStream { public static void main(String[] args) throws IOException { FileOutputStream out = new FileOutputStream("ByteStream.txt"); try { for(int i = 0; i &lt; 10000; i ++){ Integer randomNumber = randInt(0, 100000); int by = randomNumber.byteValue(); out.write(by); } }finally{ if (out != null) { out.close(); } } } public static int randInt(int min, int max) { Random rand = new Random(); int randomNum = rand.nextInt((max - min) + 1) + min; return randomNum; } } Apologies if this lacks clarity.
has comment: http://stackoverflow.com/comment/36214632

http://stackoverflow.com/comment/35959593
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23457376
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). 2) For many (or one & 'none') components in one space, use a [`CardLayout`](http://docs.oracle.com/javase/7/docs/api/java/awt/CardLayout.html) as seen in this [short example](http://stackoverflow.com/a/5786005/418556). 3) For a `JCheckBox`, use an `ActionListener` rather than a `MouseListener`.

http://stackoverflow.com/a/23544967
score: 0
has comment: http://stackoverflow.com/comment/36123941
type: Answer
answers question: http://stackoverflow.com/q/23544726
has body: You need to pass the values to the parameters. The error is because you are not providing any parameters. Take a look in here for examples: http://docs.oracle.com/cd/F49540_01/DOC/java.815/a64686/05_dev4.htm

http://stackoverflow.com/q/23486403
accepted answer: http://stackoverflow.com/a/23486911
type: AnsweredQuestion
tagged with: java
has body: It seems that a common (centralized) Id generator is used to generate Ids for JBPM tables. Hence the task (case Ids) are often not in sequence. Our requirement is to get these task (case) Ids in sequence and I know it can be achieved if I can control / customize the task Id generation.
type: Question
has answer: http://stackoverflow.com/a/23486911
score: 0
has title: How to generate custom task Id in JBPM 4?
tagged with: jbpm
answer count: 1

http://stackoverflow.com/comment/36271192
comment on: http://stackoverflow.com/a/23502287
has text: I set the path properly its working but it gives an error due to feat.params file. There is no feat.params file in HindiASR. HindiASR also have a feat folder but this empty. Exception in thread "main" Property exception component:'null' property:'null' - java.io.FileNotFoundException: models\acoustic\hindi.cd_cont_1000\feat.params (The system cannot find the file specified) Caused by: java.io.FileNotFoundException: models\acoustic\hindi.cd_cont_1000\feat.params (The system cannot find the file specified)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35996296
comment on: http://stackoverflow.com/a/23464226
type: AnswerComment
has text: I change it to: customers.add(customer); (forgot the "s") But now my display is ... empty just shows []..??
score: 0
type: Comment

http://stackoverflow.com/q/23504805
answer count: 1
downvote count: 1
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/23504882
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/36048808
tagged with: dictionary
upvote count: 0
has title: Sorting an arraylist into map using iteration
type: Question
type: AnsweredQuestion
tagged with: syntax
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
score: -1
has comment: http://stackoverflow.com/comment/36048145
has body: I am making a small programme, part of which iterates over an arraylist sorting the different competitors into a map depending on abilty of each competitor in the array list. It seems to work apart from one problem. The first if statement is not working. Any competitor classed as beginer is not sorted into beginerResults, but instead standardResults. The others are working fine however. Any suggestions? public void sort() { for (Golfer rating : competitors) { if (competitors.getScore()== "beginer") { beginerResults.put(competitor.getName()); } if (competitors.getScore()== "Intermediate") { intermediateResults.put(competitor.getName()); } else { expertResults.put(age.getName()); } } }
accepted answer: http://stackoverflow.com/a/23504882

http://stackoverflow.com/comment/35996533
has text: Note that you don't need a setter method for an autowired field, even a private one.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23477348

android
tags question: http://stackoverflow.com/q/23505672
tags question: http://stackoverflow.com/q/23583501
tags question: http://stackoverflow.com/q/23466688
tags question: http://stackoverflow.com/q/23544755
tags question: http://stackoverflow.com/q/23578137
tags question: http://stackoverflow.com/q/23464040
tags question: http://stackoverflow.com/q/23517829
tags question: http://stackoverflow.com/q/23587217
tags question: http://stackoverflow.com/q/23481743
tags question: http://stackoverflow.com/q/23484309
tags question: http://stackoverflow.com/q/23459299
tags question: http://stackoverflow.com/q/23465375
tags question: http://stackoverflow.com/q/23511045
tags question: http://stackoverflow.com/q/23615126
tags question: http://stackoverflow.com/q/23587639
tags question: http://stackoverflow.com/q/23602041
tags question: http://stackoverflow.com/q/23495442
tags question: http://stackoverflow.com/q/23508146
tags question: http://stackoverflow.com/q/23583190
tags question: http://stackoverflow.com/q/23555697
tags question: http://stackoverflow.com/q/23593166
tags question: http://stackoverflow.com/q/23485005
tags question: http://stackoverflow.com/q/23522217
tags question: http://stackoverflow.com/q/23464351
tags question: http://stackoverflow.com/q/23582248
tags question: http://stackoverflow.com/q/23529040
tags question: http://stackoverflow.com/q/23500436
tags question: http://stackoverflow.com/q/23565489
tags question: http://stackoverflow.com/q/23458659
tags question: http://stackoverflow.com/q/23567864
tags question: http://stackoverflow.com/q/23549476
tags question: http://stackoverflow.com/q/23538802
tags question: http://stackoverflow.com/q/23558448
tags question: http://stackoverflow.com/q/23494624
tags question: http://stackoverflow.com/q/23540862
tags question: http://stackoverflow.com/q/23565912
tags question: http://stackoverflow.com/q/23583777
tags question: http://stackoverflow.com/q/23546937
tags question: http://stackoverflow.com/q/23499155
tags question: http://stackoverflow.com/q/23594213
tags question: http://stackoverflow.com/q/23607128
tags question: http://stackoverflow.com/q/23596036
tags question: http://stackoverflow.com/q/23540163
tags question: http://stackoverflow.com/q/23606110
tags question: http://stackoverflow.com/q/23595121
tags question: http://stackoverflow.com/q/23535365
tags question: http://stackoverflow.com/q/23591709
tags question: http://stackoverflow.com/q/23519050
tags question: http://stackoverflow.com/q/23470600
tags question: http://stackoverflow.com/q/23467674
tags question: http://stackoverflow.com/q/23523450
tags question: http://stackoverflow.com/q/23587057
tags question: http://stackoverflow.com/q/23549482
tags question: http://stackoverflow.com/q/23603227
tags question: http://stackoverflow.com/q/23607100
tags question: http://stackoverflow.com/q/23487558
tags question: http://stackoverflow.com/q/23461637
tags question: http://stackoverflow.com/q/23512231
tags question: http://stackoverflow.com/q/23493167
tags question: http://stackoverflow.com/q/23524933
tags question: http://stackoverflow.com/q/23513684
tags question: http://stackoverflow.com/q/23614228
tags question: http://stackoverflow.com/q/23588733
tags question: http://stackoverflow.com/q/23459875
tags question: http://stackoverflow.com/q/23506215
tags question: http://stackoverflow.com/q/23551007
tags question: http://stackoverflow.com/q/23574093
tags question: http://stackoverflow.com/q/23561747
tags question: http://stackoverflow.com/q/23572791
tags question: http://stackoverflow.com/q/23560795
tags question: http://stackoverflow.com/q/23481057
tags question: http://stackoverflow.com/q/23468302
tags question: http://stackoverflow.com/q/23478047
tags question: http://stackoverflow.com/q/23465363
tags question: http://stackoverflow.com/q/23459899
tags question: http://stackoverflow.com/q/23543232
tags question: http://stackoverflow.com/q/23471523
tags question: http://stackoverflow.com/q/23550634
tags question: http://stackoverflow.com/q/23571548
tags question: http://stackoverflow.com/q/23530097

http://stackoverflow.com/a/23595302
type: Answer
accepted answer of: http://stackoverflow.com/q/23595101
has comment: http://stackoverflow.com/comment/36217330
has comment: http://stackoverflow.com/comment/36221449
type: AcceptedAnswer
has body: And if you create a new thread each time you enter in the listener? Because who executes the listener is the caller of the listener.
has comment: http://stackoverflow.com/comment/36305875
score: 0
answers question: http://stackoverflow.com/q/23595101

http://stackoverflow.com/q/23482627
type: AnsweredQuestion
has title: How to implement statement which multiplies 1 or 2 or 3 values of the array and checks if the result is in the next array
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23482694
score: -1
has body: My array: int tab[] = {1,2,3,4,5,6,7,8,9,10,12,14,15,16,18,20,21,24,27,28,30,32,35,36,40,42,45,48,49,54,56,63,64,63,72,81}; i have nine numbers[ids array],i draws max 3 random numbers from an array of ids and one from tab array, and i multiply them by yourself and want to check whether the outcome of these numbers are equal to draw number from array. private int[] ids = {1,2,3,4,5,6,7,8,9,10}; example. I draws from an ids array random numbers 3,7,1 and i draw random number from tab array 63 I can not in any way to multiply these numbers to result 63.I want draw from tab array 3 7 1 21 so i can gain the good result. CAn u help me ? private int[] ids = {1,2,3,4,5,6,7,8,9,10}; private static final int a=7; private static final int b=7; Button buttons [][]= new Button[a][b]; int tablica[] = {1,2,3,4,5,6,7,8,9,10,12,14,15,16,18,20,21,24,27,28,30,32,35,36,40,42,45,48,49,54,56,63,64,63,72,81}; int i = tablica[rand.nextInt(36)]; for ( int qq = 1; qq &lt; a; qq++) { TableRow tableRow = new TableRow(this); won.addView(tableRow); for ( int q = 1; q &lt; b; q++) { myButton = new Button(this); myButton.setTypeface(type); final int number = new Random().nextInt(9); final int rand = (ids[number]); myButton.setText(""+rand); myButton.setId(rand); myButton.setTag(rand); buttons[q][qq]=myButton; } myButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { int buttonValue = (int)v.getTag(); total *= buttonValue; score.setText(String.valueOf(total)); }); } } I have 9x9 buttons tabble and multiply numbers from them. so i click buttons to gain 15. but i cant gain it.. becase there is no 3 and 5. how to check if there is 3 and 5 button if not draw another result which i can gain pushing this numbers in button.
has comment: http://stackoverflow.com/comment/36007081
has comment: http://stackoverflow.com/comment/36007063
has comment: http://stackoverflow.com/comment/36007145
has comment: http://stackoverflow.com/comment/36007007
upvote count: 0
tagged with: arrays
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23482694
has comment: http://stackoverflow.com/comment/36007060

http://stackoverflow.com/q/23485987
has answer: http://stackoverflow.com/a/23486075
tagged with: jtable
score: 0
has answer: http://stackoverflow.com/a/23486044
has title: how to add items to a JTable using a loop
tagged with: swing
accepted answer: http://stackoverflow.com/a/23486044
type: AnsweredQuestion
tagged with: java
has body: I came up with this loop here: for(int i = 0; i &lt; memberArrayList.size(); i++){ int j = 0; memberTable.setValueAt(memberArrayList.get(i).getFirstName(), i, j); j++; memberTable.setValueAt(memberArrayList.get(i).getLastName(), i, j); j++; memberTable.setValueAt(memberArrayList.get(i).getEmail(), i, j); j++; memberTable.setValueAt(memberArrayList.get(i).getPhoneNumber(), i, j); j++; memberTable.setValueAt(memberArrayList.get(i).getLevel(), i, j); } It works but I'm sure there is a better way
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23486075

http://stackoverflow.com/comment/36080792
comment on: http://stackoverflow.com/q/23521521
score: 0
type: Comment
has text: Why does `menuSetup` extend `Activity`?
type: QuestionComment

http://stackoverflow.com/comment/36020379
has text: Then you should discard this question and write a new one for this specific problem including the code, the servlet-mapping etc.
comment on: http://stackoverflow.com/q/23488666
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36048023
score: 0
type: AnswerComment
has text: Ok so I implemented the code like this in the OnCreate part.
type: Comment
comment on: http://stackoverflow.com/a/23498046

http://stackoverflow.com/q/23526955
tagged with: string-comparison
answer count: 1
tagged with: jsp
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23527080
has title: Comparing two dates in JSP
type: Question
tagged with: java
has body: I know this could be a basic question but i have been stuck on this for hours. What i am trying to do is a comparing two dates in JSP and if the following equals each other do the follow. &lt;% if(!viewBean.isHiddenEndDate()) { (reportVO.getEndDate().getYear() == 9999 &amp;&amp; reportVO.getEndDate().getMonth() == 12 &amp;&amp; reportVO.getEndDate().getDate() == 31); %&gt; &lt;td headers="EndDate&lt;%=localizationHelper.getContentString(reportVO.getLocalizedTypeLabel())%&gt;"&gt;"Until terminated"&lt;/td&gt; &lt;% }else{ %&gt; &lt;td headers="EndDate"&gt;&lt;%=localizationHelper.formatDate(reportVO.getEndDate())%&gt;&lt;/td&gt; &lt;% } %&gt; However when i do this, mySyntax error, insert AssignmentOperator Expression to complete Assignment and Syntax error, insert ; to complete BlockStatements. Thanks.
tagged with: date
score: 0
has answer: http://stackoverflow.com/a/23527080

http://stackoverflow.com/a/23539154
answers question: http://stackoverflow.com/q/23539053
has comment: http://stackoverflow.com/comment/36113040
type: AcceptedAnswer
has body: Open the page in browser and see HTML code for the page using Firebug, Developer Tools etc. If HTML has tag iframe, that means your page has iframe and hence you'll have to use driver.switchTo.frame(frame); to interact with elements within the frame. If you want to check with Java code, do following: driver.getPageSource().contains("iframe"); //this will return true if there is iframe
has comment: http://stackoverflow.com/comment/36113099
has comment: http://stackoverflow.com/comment/36112238
has comment: http://stackoverflow.com/comment/36114720
type: Answer
has comment: http://stackoverflow.com/comment/36112034
has comment: http://stackoverflow.com/comment/67244732
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36113463
accepted answer of: http://stackoverflow.com/q/23539053
upvote count: 2
has comment: http://stackoverflow.com/comment/36113811

http://stackoverflow.com/comment/36041938
score: 1
has text: Are you sure you can use System.out.println in abstract method. lol..
type: QuestionComment
comment on: http://stackoverflow.com/q/23501579
type: Comment

http://stackoverflow.com/a/23556430
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23556349
downvote count: 0
type: Answer
has body: System.out.println(intArray[row][col]) - println will end every print with a new line. To avoid this, use system.out.print()

cxf-codegen-plugin
tags question: http://stackoverflow.com/q/23582723
tag name: cxf-codegen-plugin
type: Tag

http://stackoverflow.com/comment/36073889
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23518760
has text: @PaulTomblin perhaps if points gained from closed questions will would be retracted, people wouldn't struggle to answer an obvious duplicate question by googling for it and finding it... where else... on StackOverflow.
score: 0

http://stackoverflow.com/comment/35994512
type: Comment
has text: Hm, one thing I spot is that your Room.getInventory() uses "id_room" as the joincolumn and not "id_inventory" as I would expect.
score: 0
comment on: http://stackoverflow.com/q/23475983
type: QuestionComment

http://stackoverflow.com/comment/36226542
has text: Alright so method is essentially referred to a chuck of code? correct me if i'm wrong. But isn't this already public? Which method isn't public?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23599688
type: Comment

http://stackoverflow.com/comment/36099567
score: 0
type: Comment
type: QuestionComment
has text: Thank you so much, I was able to solve my problem with the advice you gave. Am I able to give you rep or something? :)
comment on: http://stackoverflow.com/q/23531969

http://stackoverflow.com/comment/36115908
score: 0
type: AnswerComment
has text: You can post a solution that works for you as another answer to this question, no need to bury your code in a comment. Note that my answer works just as well with `Vector` as `ArrayList`, so you can substitute `Vector` above if you need to. Note also however that using `Vector` essentially marks you as uninformed and behind the times. I would never hire someone who attempted to use this class in production code, and any assignment requiring the use of `Vector` is actively doing you and your classmates a disservice.
comment on: http://stackoverflow.com/a/23504810
type: Comment

http://stackoverflow.com/comment/35995917
comment on: http://stackoverflow.com/a/23476963
type: Comment
has text: @user2966511 you **CANNOT** call any method or field in a variable which has `null` value. If you have `SomeClass foo = null;` and do `foo.whatever()` it will throw a `NullPointerException` because `foo` is `null`, not `whatever`.
type: AnswerComment
score: 0

http://stackoverflow.com/a/33719200
answers question: http://stackoverflow.com/q/23462940
downvote count: 0
has body: There could be 2 reasons for your problem Either the the source folder is not properly configured in the your build java build path. If the source folder is not properly configured the autocomplete wont get the required class definitions and autocomplete would fail for your project. Restoring the default options in 'Windows > Preferences > Java > Editor > Content Assist > Advanced'
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/35980918
score: 0
comment on: http://stackoverflow.com/q/23468880
type: Comment
type: QuestionComment
has text: The stack trace tells you where the error took place (file:line). The topmost file that belongs to your source (in this case LevelLoader.java) is where the problem is. The lines above that one indicate that there was a problem reading from the stream. Check the docs for `ClassLoader.getResourceAsStream()` to make sure you are using the method correctly. You should also make sure that the file you are trying to load exists.

http://stackoverflow.com/comment/36022096
type: Comment
type: AnswerComment
has text: Changed to your code and have the same problem I get with mine. The remoteDBDoa isn't getting injected and when running the code I get a nullpointerexception
score: 0
comment on: http://stackoverflow.com/a/23491046

http://stackoverflow.com/a/23525993
has comment: http://stackoverflow.com/comment/36087844
score: 42
has comment: http://stackoverflow.com/comment/36087628
has comment: http://stackoverflow.com/comment/36087952
upvote count: 43
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23525768
has comment: http://stackoverflow.com/comment/37100389
has comment: http://stackoverflow.com/comment/36088014
has comment: http://stackoverflow.com/comment/36087684
type: Answer
has comment: http://stackoverflow.com/comment/36089207
has body: If you compile an enum like enum Suit {SPADES, HEARTS, CLUBS, DIAMONDS} You will see that the generated bytcodes (i.e. javap -p Suit) correspond to a synthetic class: final class Suit extends java.lang.Enum&lt;Suit&gt; { public static final Suit SPADES; public static final Suit HEARTS; public static final Suit CLUBS; public static final Suit DIAMONDS; private static final Suit[] $VALUES; public static Suit[] values(); public static Suit valueOf(java.lang.String); private Suit(); } So, instances of the enum are static members of the class itself. Then I think the only way in which this could be garbage collected would be if the class itself is garbage collected, which is very unlikely to happen if it was loaded by the system class loader.
has comment: http://stackoverflow.com/comment/36088477
downvote count: 1
has comment: http://stackoverflow.com/comment/36089060
accepted answer of: http://stackoverflow.com/q/23525768

http://stackoverflow.com/q/23522130
accepted answer: http://stackoverflow.com/a/23524537
downvote count: 0
tagged with: javafx
score: 23
linked to: http://stackoverflow.com/q/53587113
type: Question
tagged with: java
has body: I want to use JavaFX properties for UI binding, but I don't want them in my model classes (see Using javafx.beans properties in model classes). My model classes have getters and setters, and I want to create properties based on those. For example, assuming an instance bean with methods String getName() and setName(String name), I would write SimpleStringProperty property = new SimpleStringProperty(bean, "name") expecting that property.set("Foobar") would trigger a call to bean.setName. But this doesn't seem to work. What am I missing?
answer count: 1
upvote count: 23
tagged with: javabeans
favorite count: 0
tagged with: model
has comment: http://stackoverflow.com/comment/36091542
linked to: http://stackoverflow.com/q/23187989
tagged with: model-view-controller
has title: JavaBean wrapping with JavaFX Properties
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23524537

http://stackoverflow.com/q/23518760
answer count: 4
type: AnsweredQuestion
upvote count: 3
tagged with: java
duplicate of: http://stackoverflow.com/q/2187482
downvote count: 3
duplicate of: http://stackoverflow.com/q/10455677
has comment: http://stackoverflow.com/comment/36073559
has body: I have the following java code long x=25782 float y=x/1000000000 Instead of y being equal to 0.000025782 as I would expect, it is equals 0.0 What am I doing wrong?
type: Question
has answer: http://stackoverflow.com/a/23518816
linked to: http://stackoverflow.com/q/10455677
possible better answer: http://stackoverflow.com/a/23518778
accepted answer: http://stackoverflow.com/a/23518864
has answer: http://stackoverflow.com/a/23518778
has comment: http://stackoverflow.com/comment/36073889
has title: Calculation always results in zero
has answer: http://stackoverflow.com/a/23518809
score: 0
linked to: http://stackoverflow.com/q/2187482
has comment: http://stackoverflow.com/comment/36073549
has comment: http://stackoverflow.com/comment/36073695
favorite count: 0
has comment: http://stackoverflow.com/comment/36073813
has answer: http://stackoverflow.com/a/23518864

http://stackoverflow.com/comment/36248757
has text: It's quite a lot appearantly, i've pastebinned it: http://pastebin.com/SgpjytpB
comment on: http://stackoverflow.com/q/23611648
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36021750
has text: `addPropertyReference` only works with a `String` if you pass anything else in there it will be converted to a `String` instead of the actual bean.
comment on: http://stackoverflow.com/q/23489928
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23580346
has comment: http://stackoverflow.com/comment/36191993
answers question: http://stackoverflow.com/q/23580284
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36192079
has body: sentence "import java.util." imports only the classes under the util package. You can use "import java.util.regex." to import Matcher and Pattern classes . A package is a namespace for your classes, it's used to group related classes togheter and for access privilege reasons.
upvote count: 2

http://stackoverflow.com/comment/36875135
type: AnswerComment
type: Comment
has text: Sorry, I am out of here. You do not answer my questions. Why should I continue trying to answer yours? You are making it too hard for me helping you. Ask someone else, please.
score: 0
comment on: http://stackoverflow.com/a/23558486

http://stackoverflow.com/a/23464224
has comment: http://stackoverflow.com/comment/35975112
has comment: http://stackoverflow.com/comment/35973161
has comment: http://stackoverflow.com/comment/35975160
has body: What you need to do is set the src attribute of the IFRAME to the jsp url when your link is clicked. Another way to do it is doing something like this: W3Schools.com with the correct parameters of course
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/35972863
has comment: http://stackoverflow.com/comment/35973059
answers question: http://stackoverflow.com/q/23464101

http://stackoverflow.com/a/23569264
downvote count: 0
has comment: http://stackoverflow.com/comment/36168357
score: 6
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/23569056
has body: The size of the arrays may be defined only at runtime (for instance, the simplest case, if the size of an array depends on the user input). Therefore it would be impossible to check at compile time for such kind of exceptions, by checking the accesses of an array without actually know its bounds (size).

http://stackoverflow.com/comment/36118866
has text: well, that's a weird construct and most likely a bug. but it's still valid. why all the down votes?
comment on: http://stackoverflow.com/q/23542101
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/23481277
answers question: http://stackoverflow.com/q/23481004
upvote count: 2
has body: Lucene is a library for Information Retrieval (IR), it focuses on how to search queries (keywords) in a huge corpus, based on an index, similar to (some of the things) google do. The most basic idea of IR is to build an inverted index from the corpus that maps from each word to all documents containing it. If for example you have: d1 = as good as it gets and more d2 = the good the bad and the ugly d3 = Is it ugly and bad? It is, and more! It will build an inverted index that looks something like that: as: d1, good: d1, d2 it: d1, d3 gets: d1 and: d1, d2, d3 ... Now, if you search for the word (term) 'it', the index can efficiently and easily tell you 'it' appears in d1 and in d2. This is the most basic concept of building an index and searching it. Of course, there is much more to it and you are encouraged to learn more about these algorithms. This is in fact a huge area of study, and new research are published on daily basis. To learn more, I found Manning's Introduction to Information Retrieval very helpful.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/23489342
favorite count: 0
tagged with: ajax
has comment: http://stackoverflow.com/comment/36018744
type: Question
has answer: http://stackoverflow.com/a/23539776
linked to: http://stackoverflow.com/q/19262356
upvote count: 1
has body: In my application I use JSF2.2 and Primefaces 4.0. I have a functionality that uploads the new image and needs to update the existing one. Sometimes after new image is uploaded, the old one might still be shown, it may happen because of cache or re-rendering problems. I can see that this especially usual happens with high resolution images like 2500x1600. This can be reproduced in IE, Chrome and Firefox. Here are my Primefaces components: <h:panelGroup id="mr-img-panel"> <h:outputLink id="mr-image-link" target="_blank" process="@this" value="#{myBean.image}" rendered="#{myBean.image ne null}"> <p:graphicImage id="mr-image" value="#{myBean.image}" cache="false" title="Title" styleClass="image-preview" /> </h:outputLink> </h:panelGroup> <h:panelGroup styleClass="upload-view"> <p:fileUpload id="mr-upload" fileUploadListener="#{myBean.handleFileUpload}" mode="advanced" auto="true" label="Upload new image" dragDropSupport="true" invalidFileMessage="#{msg['msg.invalid.filetype']}" messageTemplate=" " invalidSizeMessage="#{msg['msg.invalid.filesize']}" update="mr-upload-messages, mr-img-panel" sizeLimit="2097152" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" styleClass="upload-view-button" oncomplete="setTimeout(function() { $('[id$=mr-upload-messages]').hide(1000); }, 2000);"> <f:attribute name="someId" value="#{some.id}" /> </p:fileUpload> <p:messages id="mr-upload-messages" showDetail="true" showSummary="false" closable="true"/> At first, I thought that this can happen because of cache problems, so I have written a cache control listener: public class CacheControlPhaseListener implements PhaseListener { @Override public void afterPhase(final PhaseEvent event) { } @Override public void beforePhase(final PhaseEvent event) { final FacesContext facesContext = event.getFacesContext(); final HttpServletResponse response = (HttpServletResponse) facesContext .getExternalContext().getResponse(); response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. re…
accepted answer: http://stackoverflow.com/a/23539776
answer count: 1
tagged with: jsf
tagged with: primefaces
has title: JSF 2.2 and Primefaces 4.0: Refreshing image after file upload
tagged with: java
has comment: http://stackoverflow.com/comment/36345156
tagged with: jsf-2
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/36023893
has text: And `fragment_main.xml` really contains the views with those ids?
comment on: http://stackoverflow.com/a/23491906
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23529975
tagged with: for-loop
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36095625
has answer: http://stackoverflow.com/a/23530242
accepted answer: http://stackoverflow.com/a/23530242
has comment: http://stackoverflow.com/comment/36095691
has body: java.io.File s1 = new java.io.File("/saves/save1.sav"); java.io.File s2 = new java.io.File("/saves/save2.sav"); java.io.File s3 = new java.io.File("/saves/save3.sav"); java.io.File s4 = new java.io.File("/saves/save4.sav"); This code sets the s variables to the location of specific files. I am looking for a way to use a for loop to check if variable s+"i" exists until it finds that it doesn't exist, then creates a new file named "save+"i".sav". (The +"i" means the number that will go after it.) Basically, I want it to create a new save file that does not overwrite other save files if there are any and gives it the name of "save(save #).sav". The code above may become obsolete. This way, I won't have to write a bunch of if statements and I can put all the code in a single statement. Thanks in advance to anyone willing to help. -Santiago
linked to: http://stackoverflow.com/q/11291785
has answer: http://stackoverflow.com/a/23530230
downvote count: 0
has comment: http://stackoverflow.com/comment/36095748
tagged with: save
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: java-io
type: Question
has title: For loop that checks if files exist and if they don't create one
possible better answer: http://stackoverflow.com/a/23530230
answer count: 2

http://stackoverflow.com/comment/84975896
type: Comment
comment on: http://stackoverflow.com/a/23493344
score: 0
has text: Is there an easy way to describe then exactly what updates that are dropped?
type: AnswerComment

http://stackoverflow.com/a/23856052
answers question: http://stackoverflow.com/q/23581564
score: 0
type: Answer
has body: On the contrary, JBoss wants you to use EntityManager instead of Session. The documentation for doing so has moved. You can find it here. Also, any book on JPA 2 (such as Pro JPA 2) will be 100% applicable to Hibernate.

http://stackoverflow.com/comment/36112981
score: 0
comment on: http://stackoverflow.com/q/23539180
type: Comment
type: QuestionComment
has text: Do you provide the username and password to establish the connection?

http://stackoverflow.com/comment/36016704
comment on: http://stackoverflow.com/q/23486643
type: Comment
type: QuestionComment
score: 1
has text: *"That is why I would like to embed the game client into my web page instead."* Many of those users would not agree to run an applet (which they would be prompted to do). Those that would OK the prompts when asked, would probably be better served by a free floating frame launched from a link using [Java Web Start](http://stackoverflow.com/tags/java-web-start/info).

http://stackoverflow.com/comment/36219322
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23596447
score: 1
has text: +1 Same here. Started a week ago. Still haven't found a solution.

http://stackoverflow.com/q/23585462
has comment: http://stackoverflow.com/comment/36198794
has answer: http://stackoverflow.com/a/23585612
has title: management classes and interfaces Java
type: UnansweredQuestion
tagged with: interface
has body: I have a problem with management classes and interfaces in Java. I have a interface Superhero and other interface called Human. Then I have various classe of Human type for example PeterParker. At the end I have a Interface called HumanAndSuper that has this method: public interface HumanAndSuper{ public Superhero fromHumanToSuperhero(); public Human fromSuperheroToHuman(); } public interface SuperHero{ public void attacks(); } When I create a Human object,for example PeterParker,in this class I have a private nested Superhero class. For example: public class PeterParker implements Human,HumanAndSuper{ //Constructors public Superhero fromHumanToSuperhero(){ //the human turns into superhero associated return new Spiderman(); } public Human fromSuperheroToHuman(){ //the superhero becomes a human return this; } public void speaks(){//It's a example //Implementation } private class Spiderman extends PeterParker implements SuperHero{ public void attacks(){ //Implementation } } } In practice the implementation of the superhero relative to human is internal to the same class of the human. what I would like is to be able to instantiate a human with the same variable can pass from human to superhero and vice versa. For example: PeterParker peter=new PeterParker();//Human peter.speaks(); peter=peter.fromHumanToSuperhero();//peter becomes spiderman peter.attacks();//method in Spiderman class peter=peter.fromSuperheroToHuman();//spiderman becomes Human how can I achieve such a thing?
has comment: http://stackoverflow.com/comment/36198710
linked to: http://stackoverflow.com/q/91932
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23585710
has comment: http://stackoverflow.com/comment/36198712
tagged with: class
score: 0

http://stackoverflow.com/comment/36135251
type: AnswerComment
score: 0
type: Comment
has text: @PradeepYaduvanshy Implementing Serializable rather than Parcelable solved the problem. Thank you so much for your help
comment on: http://stackoverflow.com/a/23550215

http://stackoverflow.com/a/23570755
score: 1
upvote count: 1
has body: Check InactivityListener in http://tips4java.wordpress.com/2008/10/24/application-inactivity/ There are times when you may want to monitor your application for inactivity. Maybe you want to log out a user after a certain time interval. This requirement can be broken down into two main steps. We will need to: listen for events at the application level track the time interval between these events Whenever the time interval between events exceeds our inactivity threshhold we will then invoke the inactivity Action.
accepted answer of: http://stackoverflow.com/q/23570431
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23570431

http://stackoverflow.com/a/23598730
type: Answer
answers question: http://stackoverflow.com/q/23598714
accepted answer of: http://stackoverflow.com/q/23598714
has comment: http://stackoverflow.com/comment/36223739
has body: boolean done = true; must be boolean done = false;
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36223732
score: 0

http://stackoverflow.com/q/23467112
answer count: 2
upvote count: 1
tagged with: intellij-idea
has body: I recently started the learning process of creating android apps, I am using IntelliJ IDEA 13.1.1 and I am following this tutorial of adding action bar buttons and I am getting the error cannot resolve symbol navutils. I have searched online and came across couple of stackoverflow posts (1 and 2) and in those post they seem to be talking about fixing the problem via build.gradle which i have no idea what it is and cant seem to find this file anywhere. here is my DisplayMessageActivity.java code, so far the app seems to be working just fine, i am able to post the text and see it but this action bar button is driving me crazy. package com.example.My_First_App; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.MenuItem; import android.widget.TextView; public class DisplayMessageActivity extends Activity { @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); // Get the message from the intent Intent intent = getIntent(); String received_message = intent.getStringExtra(MyActivity.SOME_MESSAGE); // Create the text view TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(received_message); // Set the text view as the activity layout setContentView(textView); // 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); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } I will really appreciate any help in this matter as i am stuck and cant move forward with the tutorial.
favorite count: 0
has comment: http://stackoverflow.com/comment/35977594
linked to: http://stackoverflow.com/q/19075268
tagged with: android
linked to: http://stackoverflow.com/q/19569472
possible better answer: http://stackoverflow.com/a/23467153
accepted answer: http://stackoverflow.com/a/23467156
downvote count: 0
score: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23467156
has title: creating first android app and stuck at cannot resolve symbol navutils
tagged with: java
has answer: http://stackoverflow.com/a/23467153
linked to: http://stackoverflow.com/q/18299898
type: Question

http://stackoverflow.com/q/23491143
favorite count: 0
tagged with: aes
has comment: http://stackoverflow.com/comment/36031415
has answer: http://stackoverflow.com/a/37253005
tagged with: encryption
has answer: http://stackoverflow.com/a/23502494
downvote count: 1
has answer: http://stackoverflow.com/a/28169107
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/9655181
type: Question
has comment: http://stackoverflow.com/comment/36028947
upvote count: 5
score: 4
possible better answer: http://stackoverflow.com/a/28169107
answer count: 3
tagged with: exception
has title: AES128 Decryption :javax.crypto.badpaddingexception pad block corrupted
has comment: http://stackoverflow.com/comment/36023710
tagged with: android
has body: I try to decrypt an encrypted data that I receive from a web service. The encryption is done using AES 128. I use the following code to decrypt the data: public static String decrypt(String strToDecrypt) { try { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); //AES/CBC/PKCS7Padding SecretKeySpec secretKey = new SecretKeySpec(AppConstants.AESEncryptionKey.getBytes("UTF8"), "AES"); int blockSize = cipher.getBlockSize(); cipher.init(Cipher.DECRYPT_MODE, secretKey, new IvParameterSpec(new byte[blockSize])); //new IvParameterSpec(new byte[16]) byte decBytes[] = cipher.doFinal(Base64.decode(strToDecrypt, 0)); // byte decBytes[] = cipher.doFinal(Base64.decodeBase64(strToDecrypt)); String decStr = new String(decBytes); System.out.println("After decryption :" + decStr); return decStr; } catch (Exception e) { System.out.println("Exception in decryption : " + e.getMessage()); } return null; } At cipher.doFinal() I got the following Exception: javax.crypto.badpaddingexception pad block corrupted I went through my post but ended up with no solution. I am badly stuck over here.
has comment: http://stackoverflow.com/comment/67884449
accepted answer: http://stackoverflow.com/a/23502494

http://stackoverflow.com/a/23598494
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36223447
type: Answer
has comment: http://stackoverflow.com/comment/36223438
accepted answer of: http://stackoverflow.com/q/23598286
upvote count: 1
has comment: http://stackoverflow.com/comment/36223549
has body: Issue is that you are trying to access the views in Fragment Layout from Activity. This is not possible. . Your Activity Layout has only a container to hold the Fragment.So the Activity onCreate should be to just add the Fragment Move your code in Activity onCreate to Fragment onCreateView like below You can access the Buttons and TextView in Fragment Layout from PlaceholderFragment in onCreateView after the Fragment Layout inflate @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fregment_starting_point, container,false); dd = (Button) rootView.findViewById(R.id.btn_add); substract = (Button) rootView.findViewById(R.id.btn_subscract); display = (TextView) rootView.findViewById(R.id.txt_display); add.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { counter++; display.setText("Your total is " + counter); } }); return rootView; }
score: 1
answers question: http://stackoverflow.com/q/23598286
has comment: http://stackoverflow.com/comment/36223481

http://stackoverflow.com/q/23552134
has answer: http://stackoverflow.com/a/23554945
tagged with: performance
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/24072979
tagged with: tomcat
has body: I have java tomcat application that is serving web requests. It should execute each web request as fast as possible. Every second I receive about 4 requests. I've done a serious job optimizing the servlet. Now it generally serves each request in less then 100ms. But sometimes requests are served after 200ms. If I rerun these slow requests, they are again faster then 100ms. I've enabled GC logging and found out that almost always before each "slow" request I have CMS-initial-mark that freezes JVM: [GC [1 CMS-initial-mark: 1411302K(1415616K)] 1912881K(2029056K), 0.3224110 secs] [Times: user=0.00 sys=0.00, real=0.32 secs] And mostly all the time request execution time is the same order of magnitude as GC collection time. I use 8-core server with 32GB of RAM. My JVM settings are: -Xmx2G -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails. My OS is latest Debian with default settings. No other processes are running except mongodb. The only process that is shown in top command output is java and it uses ~100% of CPU (I have 8 CPUs, so it is only 1/8 of load). How can I overcome this problem? What else can be diagnosed?
has title: java GC CMS-initial-mark slows queries on highload tomcat production server
linked to: http://stackoverflow.com/q/1009577
answer count: 3
upvote count: 1
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/23552315
type: UnansweredQuestion
tagged with: garbage-collection

http://stackoverflow.com/comment/57404896
comment on: http://stackoverflow.com/a/32153874
type: AnswerComment
type: Comment
has text: The `ShellExecute` does not work for me (win10) unless `sei.fMask = SEE_MASK_INVOKEIDLIST` is set as suggested here http://stackoverflow.com/a/21182262/362515
score: 1

http://stackoverflow.com/comment/36231649
comment on: http://stackoverflow.com/q/23602871
score: 0
type: Comment
type: QuestionComment
has text: *"Thats just something I do because the stack trace bothers me."* ..are you sure you're cut out for programming? Seriously, someone who is 'bothered' by stack traces just does not strike me as a person who could become an effective programmer.

http://stackoverflow.com/comment/35983660
score: 2
comment on: http://stackoverflow.com/q/23470471
has text: This may help you http://stackoverflow.com/questions/8799121/java-lang-nosuchmethoderror-org-hibernate-sessionfactory-opensessionlorg-hibe
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23508883
upvote count: 0
has body: Found this answer in the stack, this will explains you better. !! It depends upon things like (a) how large the integers are, (b) whether the input array contains integers in a random order or in a nearly-sorted order, (c) whether you need the sorting algorithm to be stable or not, as well as other factors, (d) whether the entire list of numbers fits in memory (in-memory sort vs external sort), and (e) the machine you run it on. In practice, the sorting algorithm in your language's standard library will probably be pretty good (pretty close to optimal), if you need an in-memory sort. Therefore, in practice, just use whatever sort function is provided by the standard library, and measure running time. Only if you find that (i) sorting is a large fraction of the overall running time, and (ii) the running time is unacceptable, should you bother messing around with the sorting algorithm. If those two conditions do hold, then you can look at the specific aspects of your particular domain and experiment with other fast sorting algorithms. But realistically, in practice, the sorting algorithm is rarely a major performance bottleneck. The complexities of different sort functions can be found at this link Copied from the Link
downvote count: 1
answers question: http://stackoverflow.com/q/23508792
score: -1
type: Answer

http://stackoverflow.com/q/23576623
tagged with: java
linked to: http://stackoverflow.com/q/17004160
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/36185813
has body: I was wondering how can I get the time at any one of point of the schedule task method when @Schedule method is triggered. I have tested using Calendar.getInstance() but the timing does not match. E.g. At 2pm the @Schedule is triggered While the Calendar.getInstance() return is before 2pm Thanks in advance for any suggestion.
score: 0
tagged with: schedule
has comment: http://stackoverflow.com/comment/36183565
type: UnansweredQuestion
has title: How to get the time when @Schedule is triggered
has comment: http://stackoverflow.com/comment/36183658
has comment: http://stackoverflow.com/comment/36185376
has comment: http://stackoverflow.com/comment/36184612
answer count: 0
has comment: http://stackoverflow.com/comment/36182795

http://stackoverflow.com/q/23534412
has answer: http://stackoverflow.com/a/23542497
type: Question
answer count: 2
tagged with: swingworker
score: 2
has answer: http://stackoverflow.com/a/23542640
has comment: http://stackoverflow.com/comment/36111827
downvote count: 0
tagged with: progressdialog
favorite count: 0
tagged with: event-dispatch-thread
upvote count: 2
has title: Java Swing Progress Monitor for GUI Creation (EDT)
type: UnansweredQuestion
has body: I want to use a progress monitor to show progress during the start of a real complex dialog!!! The dialog creation is done within the event dispatcher thread. It can take up to 10 seconds, depending on the client system. My desire is then to see a progress monitor in the foreground which shows status of each current loading part. Meanwhile the Dialog is building up in the background. The problem is the progressmonitor always freezes until the dialog is started. When the dialog starting is finished the progressmonitor reacts and shows the current state. I tried a lot of things read in forums, but without two different threads it doesn't work. Here is the example that let both the progress monitor and the dialog creation running in the EDT. final CVProgressMonitorDialog progressMonitor = new CVProgressMonitorDialog(); progressMonitor.startPollingThread(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { startComplexDialog(); } finally { close(progressMonitor); } } }); The CVProgressMonitorDialog is mainly the ProgressMonitor shipped with swing. The solution is to let the creation of the dialog run in an other thread. final CVProgressMonitorDialog progressMonitor = new CVProgressMonitorDialog(); progressMonitor.startPollingThread(); new Thread() { @Override public void run() { try { startComplexDialog(); } finally { close(progressMonitor); } } }.start(); Do using the second solution causes potential troubles since swing is not threadsafe? Is there a general solution to monitoring task within the EDT?
tagged with: swing
tagged with: java

http://stackoverflow.com/comment/36224042
has text: If it isn't too much hassle, I would love to see a an implementation of this. I am not too confident in my skills in this, but I will look into it as well! EDIT: As written, I have already done the initial sorting, and now I need to merge two and two threads, using braiding. (If that is the correct word, I am not a native speaker of english) the problem is how to manage the threads and make them respond to each other and start merging. If ForkJoinPool can do this, I will be very happy. Looking into it now.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23598673
type: Comment

http://stackoverflow.com/q/23502167
has title: SQLiteOpenHelper .update() does not persist
type: Question
tagged with: java
tagged with: database
tagged with: class
score: 0
has body: I have a sortid row in my table to have a custom order of my data. in my SQLiteOpenHelper class, i have a drop() function which calls .update(), and in loadCities() the rows are queried but i get the old sortId. here are parts of my code: public class TimesHelper extends SQLiteOpenHelper { private static final String TABLE_CREATE = "CREATE TABLE " + TABLE_NAME + " (" + KEY__ID + " INTEGER PRIMARY KEY AUTOINCREMENT," + [...] + KEY_SORTID + " INTEGER);"; private SQLiteDatabase mDB; private Handler mHandler; public SQLiteDatabase getDB() { if (mDB == null) { mDB = getWritableDatabase(); } else { mHandler.removeCallbacks(mClose); } //useful, but i am not sure wether this is good practise, please comment... mHandler.postDelayed(mClose, 500); return mDB; } private Runnable mClose = new Runnable() { @Override public void run() { if (mDB != null) { mDB.close(); mDB = null; } } }; public void drop(int from, int to) { List&lt;Integer&gt; keys = new ArrayList&lt;Integer&gt;(Times.Cities.keySet()); Integer key = keys.get(from); keys.remove(key); keys.add(to, key); getDB().beginTransaction(); for (Integer i : keys) { ContentValues val = new ContentValues(); val.put(KEY_SORTID, keys.indexOf(i)); getDB().update(TABLE_NAME, val, KEY__ID + "=" + i, null);//returning 1 } getDB().endTransaction(); loadCities(); } public void loadCities() { HashMap&lt;Integer, Times&gt; cities = Times.Cities; cities.clear(); Cursor c = getDB().query(TABLE_NAME, null, null, null, null, null, KEY_SORTID); c.moveToFirst(); if (c.isAfterLast()) { c.close(); return; } do { int s = c.getInt(c.getColumnIndex(KEY_SORTID)); int id = c.getInt(c.getColumnIndex(KEY__ID)); //here i still have the old values... //do whatever } } while (c.moveToNext()); c.close(); } } i tried anything, but without success... Metin Kale
tagged with: sqlite
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/23502355
accepted answer: http://stackoverflow.com/a/23502355
type: AnsweredQuestion

http://stackoverflow.com/q/23509954
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23509996
favorite count: 0
tagged with: synchronization
has title: synchronize 2 method with another method but not with each other
type: AnsweredQuestion
score: 2
has body: I have methodA and methodB and methodSync in my java program. I want that when a thread is inside methodSync other threads don't run the methodA and methodB and wait for methodSync to end. But methodA and methodB can run simultaneously. If I want to sync 3 methods with each other I can use this code: private static final Object LOCK = new Object(); public static void methodA() { synchronized (LOCK) { //Do Job } } public static void methodB() { synchronized (LOCK) { //Do Job } } public static void methodSync() { synchronized (LOCK) { //Do Job } } But this is not a solution for me because I want to run methodA and methodB simultaneously.
upvote count: 2
tagged with: java
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/23509996
type: Question

http://stackoverflow.com/q/23453568
score: 224
tagged with: default-method
has comment: http://stackoverflow.com/comment/36184506
has answer: http://stackoverflow.com/a/23463334
accepted answer: http://stackoverflow.com/a/23463334
tagged with: java
has comment: http://stackoverflow.com/comment/35952584
upvote count: 226
has body: In Java 8, I can easily write: interface Interface1 { default void method1() { synchronized (this) { // Something } } static void method2() { synchronized (Interface1.class) { // Something } } } I will get the full synchronisation semantics that I can use also in classes. I cannot, however, use the synchronized modifier on method declarations: interface Interface2 { default synchronized void method1() { // ^^^^^^^^^^^^ Modifier 'synchronized' not allowed here } static synchronized void method2() { // ^^^^^^^^^^^^ Modifier 'synchronized' not allowed here } } Now, one can argue that the two interfaces behave the same way except that Interface2 establishes a contract on method1() and on method2(), which is a bit stronger than what Interface1 does. Of course, we might also argue that default implementations should not make any assumptions about concrete implementation state, or that such a keyword simply wouldn't pull its weight. Question: What is the reason why the JSR-335 expert group decided not to support synchronized on interface methods?
answer count: 2
tagged with: synchronized
favorite count: 0
possible better answer: http://stackoverflow.com/a/55738129
has comment: http://stackoverflow.com/comment/35957380
has comment: http://stackoverflow.com/comment/35958347
has comment: http://stackoverflow.com/comment/35952412
type: AnsweredQuestion
has title: What is the reason why “synchronized” is not allowed in Java 8 interface methods?
has answer: http://stackoverflow.com/a/55738129
downvote count: 2
tagged with: java-8
tagged with: jsr335
type: Question

http://stackoverflow.com/q/23520684
possible better answer: http://stackoverflow.com/a/23527423
has answer: http://stackoverflow.com/a/23527423
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/31029429
has title: ElasticSearch Java API:NoNodeAvailableException: No node available
score: 22
has answer: http://stackoverflow.com/a/23521094
upvote count: 22
has body: public static void main(String[] args) throws IOException { Settings settings = ImmutableSettings.settingsBuilder() .put("cluster.name", "foxzen") .put("node.name", "yu").build(); Client client = new TransportClient(settings) .addTransportAddress(new InetSocketTransportAddress("XXX.XXX.XXX.XXX", 9200)); // XXX is my server's ip address IndexResponse response = client.prepareIndex("twitter", "tweet") .setSource(XContentFactory.jsonBuilder() .startObject() .field("productId", "1") .field("productName", "XXX").endObject()).execute().actionGet(); System.out.println(response.getIndex()); System.out.println(response.getType()); System.out.println(response.getVersion()); client.close(); } I access server from my computer curl -get http://XXX.XXX.XXX.XXX:9200/ get this { "status" : 200, "name" : "yu", "version" : { "number" : "1.1.0", "build_hash" : "2181e113dea80b4a9e31e58e9686658a2d46e363", "build_timestamp" : "2014-03-25T15:59:51Z", "build_snapshot" : false, "lucene_version" : "4.7" }, "tagline" : "You Know, for Search" } Why get error by using Java API? EDIT There is the cluster and node part config of elasticsearch.yml ################################### Cluster ################################### # Cluster name identifies your cluster for auto-discovery. If you're running # multiple clusters on the same network, make sure you're using unique names. # cluster.name: foxzen #################################### Node ##################################### # Node names are generated dynamically on startup, so you're relieved # from configuring them manually. You can tie this node to a specific name: # node.name: yu
has answer: http://stackoverflow.com/a/47735003
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/35367186
has answer: http://stackoverflow.com/a/40121031
has answer: http://stackoverflow.com/a/37866931
tagged with: elasticsearch
has answer: http://stackoverflow.com/a/42775619
accepted answer: http://stackoverflow.com/a/23521094
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/23591690
accepted answer: http://stackoverflow.com/a/23807611
tagged with: android
answer count: 1
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has body: I'm trying to implement a custom JoystickView for my project and through my search I found this library : https://github.com/zerokol/JoystickView I've added the jar to the lib folder and added the jar file to the build path. The problem is when I try to add it on my screen it doesn't work. I'm new to android and I'm stuck now. Can you tell me where I'm wrong? The following code is same on the links example code except the xml file My main class : package com.example.joystickdeneme; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.widget.TextView; import com.zerokol.views.JoystickView; import com.zerokol.views.JoystickView.OnJoystickMoveListener; public class MainActivity extends Activity { private TextView angleTextView; private TextView powerTextView; private TextView directionTextView; // Importing as others views private JoystickView joystick; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); angleTextView = (TextView) findViewById(R.id.angleTextView); powerTextView = (TextView) findViewById(R.id.powerTextView); directionTextView = (TextView) findViewById(R.id.directionTextView); // referring as others views joystick = (JoystickView) findViewById(R.id.joystickView); // Listener of events, it'll return the angle in graus and power in percents // return to the direction of the moviment joystick.setOnJoystickMoveListener(new OnJoystickMoveListener() { @Override public void onValueChanged(int angle, int power, int direction) { angleTextView.setText(" " + String.valueOf(angle) + "°"); powerTextView.setText(" " + String.valueOf(power) + "%"); switch (direction) { case JoystickView.FRONT: directionTextView.setText(R.string.front_lab); break; case JoystickView.FRONT_RIGHT: directionTextView.setText(R.string.front_right_lab); break; case JoystickView.RIGHT: directionTextView.setText(R.string.right_lab); break; case JoystickView.RIGHT_BOTTOM:…
tagged with: joystick
type: AnsweredQuestion
has title: custom joystickView doesn't work in xml - Android
tagged with: java
has answer: http://stackoverflow.com/a/23807611
upvote count: 1
type: Question
downvote count: 0

http://stackoverflow.com/comment/36057098
has text: You should skip loading everything until something is actually requested. You should provide it as a ClassLoader. In which case you would be merely duplicating URLClassLoader.
comment on: http://stackoverflow.com/a/23508310
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23463376
upvote count: 2
has title: White Screen After Unminimizing Java Window
has body: I'm using LWJGL to make a small game, everything runs smooth and fine, but when I try to minimize and unminimize it, the screen just turns white and nothings shows up. This is my main class: package net.battleboy; import org.newdawn.slick.*; import org.newdawn.slick.state.*; public class Main extends StateBasedGame { public static final String gamename = "Battle Boy 1.0 ALPHA"; public static final int menu = 0; public static final int play = 1; public static final int settings = 2; public static final int LoadingScreen = 3; public Main(String gamename) { super(gamename); this.addState(new Menu(menu)); this.addState(new Play(play)); this.addState(new Settings(settings)); this.addState(new LoadingScreen(LoadingScreen)); } public void initStatesList(GameContainer gc)throws SlickException { this.getState(menu).init(gc, this); this.getState(play).init(gc, this); this.getState(settings).init(gc, this); this.getState(LoadingScreen).init(gc, this); this.enterState(LoadingScreen); } public static void main(String[] args) { AppGameContainer appgc; try { appgc = new AppGameContainer(new Main(gamename)); appgc.setIcon("res/icon.png"); appgc.setDisplayMode(840, 470, false); appgc.start(); }catch(SlickException e) { e.printStackTrace(); } } } I have 4 states and each of them seem to turn white.. Even when everything is being initialized. Is there something I have missed when settings un my classes or is it something I did wrong? (I'll post any other classes if needed)
downvote count: 1
type: Question
score: 1
tagged with: java
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35971342
has comment: http://stackoverflow.com/comment/35970904
answer count: 0

http://stackoverflow.com/q/23572940
type: Question
accepted answer: http://stackoverflow.com/a/23573185
tagged with: java
tagged with: concurrency
has body: I am trying to implement a cached thread pool in Java to read data coming in off of a bus. Everything works great... so long as I have data coming in on that bus. If I leave the data cable disconnected, the program starts generating endless threads from the pool. I intermittently check /proc/{PID}/fd and it goes from 8 to 100+ in about an hour. Eventually the system crashes. I am submitting a timeout value for these threads (30 seconds) and they do trigger a TimeoutException Catch which I see in my log file. Shouldn't these threads be ending when they time out? Some code: private static ExecutorService executorService = Executors.newCachedThreadPool(); (I later supply a callable) long[] rawFrame; Future&lt;long[]&gt; future = executorService.submit(callable); try { rawFrame = future.get(timeout, timeUnit); // timeout is 30 seconds // Do some things with the raw frame and store as parsedFrame return parsedFrame; } catch (TimeoutException e) { LOGGER.error("Bus timeout. Check connection"); return null; } finally { future.cancel(true); } I am just learning how to do concurrent processing in Java but as far as I know, these processes should be timing out but instead it appears they just sit there waiting for data on a bus that isn't spitting data. What am I missing? EDIT: Thanks for helping me narrow it down. Here is my callable private class BusCallable implements Callable&lt;long[]&gt; { private long messageId; private boolean readAnyFrame = false; public BusCallable() { super(); readAnyFrame = true; } public BusCallable(long id) { super(); this.messageId = id; readAnyFrame = false; } @Override public long[] call() throws Exception() { if (readAnyFrame) { return read(busInterface); } return readFrame(busInterface, messageId); }
has answer: http://stackoverflow.com/a/23573185
score: 0
answer count: 1
tagged with: concurrent.futures
type: AnsweredQuestion
has title: Cached Thread Pool growing infinitely

http://stackoverflow.com/q/23542312
has comment: http://stackoverflow.com/comment/36130634
has comment: http://stackoverflow.com/comment/36789901
tagged with: java
has answer: http://stackoverflow.com/a/25001572
has title: Retrieve Dicom image from Pacs server
type: Question
has comment: http://stackoverflow.com/comment/36128940
has comment: http://stackoverflow.com/comment/36735975
has comment: http://stackoverflow.com/comment/36802085
has comment: http://stackoverflow.com/comment/36824520
score: 0
has body: I am Querying / retrieving dicom image from remote Pacs server using DcmQR , i able to get list of Dicom objects by specified criteria. 1. when writing dicom object its showing 1 kb in size only. 2. When print object data its printing each data null. I am very new in this please help me out .. :( My code : public static void main(String args[]){ dcmqr = new DcmQR("DCM4CHEE"); dcmqr.setCalledAET("DCM4CHEE", true); dcmqr.setRemoteHost("remote ip"); dcmqr.setRemotePort(remote port); dcmqr.getKeys(); dcmqr.setDateTimeMatching(true); dcmqr.setCFind(true); dcmqr.setCGet(true); dcmqr.setQueryLevel(DcmQR.QueryRetrieveLevel.IMAGE); dcmqr.addMatchingKey(Tag.toTagPath("PatientName"),"Vicens^DICOM"); dcmqr.configureTransferCapability(true); List&lt;DicomObject&gt; result = null; try { dcmqr.start(); dcmqr.open(); result = dcmqr.query(); dcmqr.get(result); System.out.println("List Size : " + result.size()); displayObjectDetails(result); for (DicomObject dco : result) { Byte data[] = toByteArray(dco); // here how can get dicom image ?? } } catch (Exception e) { System.out.println("error " + e); } try { if (dcmqr != null) { dcmqr.stop(); dcmqr.close(); } } catch (Exception e) { e.printStackTrace(); } } // toByteArray Method here private static byte[] toByteArray(DicomObject obj) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedOutputStream bos = new BufferedOutputStream(baos); DicomOutputStream dos = new DicomOutputStream(bos); dos.writeDicomFile(obj); dos.close(); byte[] data = baos.toByteArray(); return data; } // display object details private static void displayObjectDetails(List resultimg) { DicomObject obj = new BasicDicomObject(); List&lt;String&gt; listimg = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; resultimg.size(); i++) { obj = resultimg.get(i); System.out.println("InstanceNumber : "+obj.getString(Tag.InstanceNumber, VR.IS)); System.out.println("ImageType : "+obj.getString(Tag.ImageType, VR.CS)); System.out.println("Image…
has comment: http://stackoverflow.com/comment/36130384
tagged with: dicom
answer count: 1
has comment: http://stackoverflow.com/comment/36694950
has comment: http://stackoverflow.com/comment/36118449
has comment: http://stackoverflow.com/comment/36735722
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36746183

http://stackoverflow.com/a/23590346
score: 0
type: Answer
has body: set it under environment variable. Here are the steps. Then you don't have do it every time. http://docs.oracle.com/javase/tutorial/essential/environment/paths.html
answers question: http://stackoverflow.com/q/23590308

http://stackoverflow.com/comment/35959732
has text: Post an [MCVE (link)](http://stackoverflow.com/help/mcve).
comment on: http://stackoverflow.com/q/23457488
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/23531826
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23531713
has comment: http://stackoverflow.com/comment/36118683
has body: Could not load JDBC driver class [org.postgresql.Driver] Make sure that related jar file is added on your classpath.
has comment: http://stackoverflow.com/comment/36099124

string
tags question: http://stackoverflow.com/q/23601564
tags question: http://stackoverflow.com/q/23525976
tags question: http://stackoverflow.com/q/23534131
tags question: http://stackoverflow.com/q/23515644
tags question: http://stackoverflow.com/q/23595743
tags question: http://stackoverflow.com/q/23595121
tags question: http://stackoverflow.com/q/23503569
tags question: http://stackoverflow.com/q/23590049
tags question: http://stackoverflow.com/q/23465919
tags question: http://stackoverflow.com/q/23600172
tags question: http://stackoverflow.com/q/23577333
tags question: http://stackoverflow.com/q/23457377
tags question: http://stackoverflow.com/q/23464803
tags question: http://stackoverflow.com/q/23600073
tags question: http://stackoverflow.com/q/23538861
tags question: http://stackoverflow.com/q/23517305
tags question: http://stackoverflow.com/q/23561872
tags question: http://stackoverflow.com/q/23583228
tags question: http://stackoverflow.com/q/23581955
tags question: http://stackoverflow.com/q/23607609
tags question: http://stackoverflow.com/q/23496954
tags question: http://stackoverflow.com/q/23520205
tags question: http://stackoverflow.com/q/23508727
tags question: http://stackoverflow.com/q/23526654
tags question: http://stackoverflow.com/q/23466675
tags question: http://stackoverflow.com/q/23464401
tags question: http://stackoverflow.com/q/23544484
tags question: http://stackoverflow.com/q/23492764
tags question: http://stackoverflow.com/q/23592271
tags question: http://stackoverflow.com/q/23535723
tags question: http://stackoverflow.com/q/23602045
tags question: http://stackoverflow.com/q/23490991
tags question: http://stackoverflow.com/q/23555613
tags question: http://stackoverflow.com/q/23563826
tags question: http://stackoverflow.com/q/23583993
tags question: http://stackoverflow.com/q/23528381
tags question: http://stackoverflow.com/q/23487376
tags question: http://stackoverflow.com/q/23480911
tag name: string
tags question: http://stackoverflow.com/q/23533952
tags question: http://stackoverflow.com/q/23534209
tags question: http://stackoverflow.com/q/23598796
tags question: http://stackoverflow.com/q/23549775
tags question: http://stackoverflow.com/q/23525231
tags question: http://stackoverflow.com/q/23526949
tags question: http://stackoverflow.com/q/23458619
tags question: http://stackoverflow.com/q/23534767
tags question: http://stackoverflow.com/q/23504449
tags question: http://stackoverflow.com/q/23563212
tags question: http://stackoverflow.com/q/23544752
tags question: http://stackoverflow.com/q/23492655
tags question: http://stackoverflow.com/q/23596136
tags question: http://stackoverflow.com/q/23588618
tags question: http://stackoverflow.com/q/23505952
type: Tag
tags question: http://stackoverflow.com/q/23455681
tags question: http://stackoverflow.com/q/23498836
tags question: http://stackoverflow.com/q/23599619
tags question: http://stackoverflow.com/q/23528890
tags question: http://stackoverflow.com/q/23511800
tags question: http://stackoverflow.com/q/23486247
tags question: http://stackoverflow.com/q/23506875
tags question: http://stackoverflow.com/q/23557254
tags question: http://stackoverflow.com/q/23598505
tags question: http://stackoverflow.com/q/23456353
tags question: http://stackoverflow.com/q/23518930
tags question: http://stackoverflow.com/q/23613895
tags question: http://stackoverflow.com/q/23496995
tags question: http://stackoverflow.com/q/23491255
tags question: http://stackoverflow.com/q/23498126
tags question: http://stackoverflow.com/q/23583242
tags question: http://stackoverflow.com/q/23595210
tags question: http://stackoverflow.com/q/23584278
tags question: http://stackoverflow.com/q/23503642
tags question: http://stackoverflow.com/q/23571096
tags question: http://stackoverflow.com/q/23609097
tags question: http://stackoverflow.com/q/23462382
tags question: http://stackoverflow.com/q/23590156
tags question: http://stackoverflow.com/q/23585083
tags question: http://stackoverflow.com/q/23567744

http://stackoverflow.com/q/23563937
score: 1
tagged with: java
type: Question
tagged with: datasource
has comment: http://stackoverflow.com/comment/36159962
upvote count: 1
has title: add a dynamic resultSet in Crystal Reports in eclipse
has body: My problem is this. I have Crystal Reports with Java in Eclipse, and I was unable to connect to a database using a JDBC connector IBM but graphically. But now I want to connect to the report by code, to pass data database, and can not find how to do it. Since Crystal Reports for Java does not allow me to use a ResultSet as a data source to generate the report dynamically. Thanks
favorite count: 0
tagged with: report
tagged with: resultset
type: UnansweredQuestion
tagged with: crystal-reports
linked to: http://stackoverflow.com/q/10683249
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/36028595
type: QuestionComment
has text: Code is pretty much verbatim as per the sample code on the Android developers website. See http://developer.android.com/training/connect-devices-wirelessly/nsd.html#discover.
score: 0
comment on: http://stackoverflow.com/q/23466675
type: Comment

http://stackoverflow.com/comment/36121617
score: 0
type: Comment
type: QuestionComment
has text: I don't think it would reserve new space for each number through the iteration of the loop, it would simply change the value that is already in the reserved heap memory.
comment on: http://stackoverflow.com/q/23544321

http://stackoverflow.com/a/23560505
answers question: http://stackoverflow.com/q/23560063
downvote count: 0
has body: You can use getTableCellRendererComponent function in as described below. The icon, row and coulmn to display icon, you can set from out side using a setter methode import java.awt.Component; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; public class MyRenderer extends DefaultTableCellRenderer { public MyRenderer() { // TODO Auto-generated constructor stub } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); int neededRow=0; // set the needed row here in which the icon to be dispayed int neededcolumn=0; // set the needed column here in which the icon to be dispayed if(row==neededRow &amp;&amp; column==neededcolumn) { setIcon(icon); } return this } }
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/36011471
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23484962
has text: Simpler than what I wrote at least. Using for-each would make it simpler again.
score: 1

http://stackoverflow.com/comment/36081325
comment on: http://stackoverflow.com/a/23519331
has text: I don't think it will work.. For tat u need to change in analyzer
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23567071
tagged with: android
tagged with: sensors
type: UnansweredQuestion
has title: Collect synchronize data from different sensor in Android
tagged with: timestamp
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23594214
has body: I doing an app that collect data from the different sensor that are in a smart-phone. My doubts are : how I can collect different data? My goal is create an Matrix of array. There are the data capture from the signal in every row in the same time. If I use "timestamp " in the code above, it could be ok? I am not sure, because the definition of timestamp is "the time on which the event occur", but the problem is that the event can occur only in one sensor. Sincerely I am a bit confused about it. mSensorManager = (SensorManager) this .getSystemService(Context.SENSOR_SERVICE); mSensorListener = new SensorEventListener() { @Override public void onAccuracyChanged(Sensor arg0, int arg1) { }`enter code here` @Override public void onSensorChanged(SensorEvent event) { Sensor sensor = event.sensor; if (sensor.getType() == Sensor.TYPE_ACCELEROMETER) { //TODO: get values }else if (sensor.getType() == Sensor.TYPE_ORIENTATION) { //TODO: get values } } }
answer count: 1
tagged with: database
score: 0

http://stackoverflow.com/q/23523224
has body: I need to implement my own F5 algorithm. I have read the F5 documentation and the paper can be found here. In the section 6.2 Matrix Encoding of the paper, equations 16-18 define the change density, D(k), the embedding rate, R(k) and the efficiency rate, W(k), as follows: D(k) = 1 / (n + 1) = 1 / 2**k R(k) = k / n = k / (2**k - 1) W(k) = R(k) / D(k) = k * 2**k / (2**k - 1) Where n is the number of modifiable places in a code word and k the number of embedding bits. W(k) indicats the average number of bits we can embed per change. In the source code we find the number of bits as stated below. Can someome please explain why usable and changed are calculated this way? I simply don't understand the logic. int _changed = 0; int _expected = 0; int _one = 0; int _large = 0; int _zero = 0; for (i = 0; i &lt; coeffCount; i++) { if (i % 64 == 0) { continue; } if (coeff[i] == 1) { _one++; } if (coeff[i] == -1) { _one++; } if (coeff[i] == 0) { _zero++; } } _large = coeffCount - _zero - _one - coeffCount / 64; _expected = _large + (int) (0.49 * _one); for (i = 1; i &lt; 8; i++) { int usable, changed, n; n = (1 &lt;&lt; i) - 1; usable = _expected * i / n - _expected * i / n % n; changed = coeffCount - _zero - coeffCount / 64; changed = changed * i / n - changed * i / n % n; changed = n * changed / (n + 1) / i; // changed = _large - _large % (n + 1); changed = (changed + _one + _one / 2 - _one / (n + 1)) / (n + 1); usable /= 8; if (usable == 0) { break; } if (i == 1) { System.out.print("default"); } else { System.out.print("(1, " + n + ", " + i + ")"); } System.out.println(" code: " + usable + " bytes (efficiency: " + usable * 8 / changed + "." + usable * 8 / changed % 10 + " bits per change)"); } coeff is an array that holds the DCT coefficients,coeffCount is the number of DCT coefficients,_large is the teoretical number of bits from the image that can be encoded and expected is the expected capacity of the image(with shrinkage).I don't understand what is the logic behind usable …
score: 0
has comment: http://stackoverflow.com/comment/36092545
answer count: 1
has answer: http://stackoverflow.com/a/23531407
has comment: http://stackoverflow.com/comment/36091189
type: AnsweredQuestion
has title: Matrix encoding implementation in the F5 steganography algorithm is unclear
tagged with: java
accepted answer: http://stackoverflow.com/a/23531407
type: Question
tagged with: steganography

http://stackoverflow.com/q/23497740
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23498542
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36035044
has body: I'm wondering what to expect when I use cascade = CascadeType.ALL as such, @OneToMany( mappedBy = "employeeProfile", cascade = CascadeType.ALL, orphanRemoval = true) private List&lt;ProfileEffortAllocation&gt; effortAllocations; public List&lt;ProfileEffortAllocation&gt; getEffortAllocations() { if (effortAllocations == null) { effortAllocations = new ArrayList&lt;&gt;(); } return effortAllocations; } public void setEffortAllocations(List&lt;ProfileEffortAllocation&gt; effortAllocations) { this.effortAllocations = effortAllocations; } I'm finding when I add a new effortAllocation and attempt to save object, but have a validation failure preventing my code from ever reaching session.saveOrUpdate(parentObj), I'm still getting a pk rather than null as if persist is being called on the child OneToMany. Should my parent object call session.saveOrUpdate(parentObj); before I ever see a pk from effortAllocation? I'd like to point out that the parent object is an existing object and has been loaded from the database with a pk prior to adding a new child record.
favorite count: 0
tagged with: tapestry
has comment: http://stackoverflow.com/comment/36035304
has title: cascade = CascadeType.ALL what to expect?
possible better answer: http://stackoverflow.com/a/23503923
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23503923
has answer: http://stackoverflow.com/a/23498542
tagged with: java
tagged with: hibernate
upvote count: 1
has comment: http://stackoverflow.com/comment/36035450

http://stackoverflow.com/comment/36080592
comment on: http://stackoverflow.com/a/23521094
has text: Sorry, not sure how I missed that at first. [9200-9300] is for HTTP traffic, [9300-9400] is for node-to-node (and transport client) communication. I've edited my answer to include this as well.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/23588680
has body: The logic shown in the above code makes sense to what you have described. It should perform what you desire.
answers question: http://stackoverflow.com/q/23588607
score: 0
type: Answer

http://stackoverflow.com/comment/35952844
comment on: http://stackoverflow.com/a/23453791
type: Comment
score: 0
type: AnswerComment
has text: i edited my post with my compareTo method. I tried changing the parameter to List<Member>...same problem except now the error is: cannot find method compareTo(Member)

http://stackoverflow.com/q/23586308
favorite count: 0
has comment: http://stackoverflow.com/comment/36200223
has answer: http://stackoverflow.com/a/23586361
has comment: http://stackoverflow.com/comment/36200264
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/20393099
tagged with: extend
type: Question
has answer: http://stackoverflow.com/a/23586357
has comment: http://stackoverflow.com/comment/36200251
score: -1
tagged with: class
answer count: 2
downvote count: 2
upvote count: 1
duplicate of: http://stackoverflow.com/q/20393099
has body: If I have public class main { public void randomFunction() { //Test Code } } And I wish to be able to pass this randomFunction over to another class in another file how would I be able to do this?
has title: Java Extend Classes Over Files

http://stackoverflow.com/q/23589683
tagged with: stack
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23589814
has comment: http://stackoverflow.com/comment/36206305
score: 0
has answer: http://stackoverflow.com/a/23589814
tagged with: exception
has body: I am trying to write a program that checks for parentheses matching using stacks.This is my ArrayStack class. public class ArrayStack{ private final int DEFAULT_SIZE=10; public int tos; Object[] array; public ArrayStack(){ array =new Object[DEFAULT_SIZE]; tos=-1; } public void push(Object e)throws OverFlowException{ if (isFull()){ throw new OverFlowException("OverFlow"); } else{ array[tos+1]=e; tos++; } } public Object topAndpop() throws EmptyStackException{ Object returnPop; if (isEmpty()) throw new EmptyStackException("Stack empty"); else{ returnPop=top(); pop(); } return returnPop; } public void pop() throws EmptyStackException{ if (isEmpty()) throw new EmptyStackException("Stack empty"); else tos--; } public Object top() throws EmptyStackException{ if (isEmpty()) throw new EmptyStackException("Stack empty"); else return array[tos]; } public boolean isEmpty(){ return tos==-1; } public boolean isFull(){ if(tos==array.length) return true; else return false; } public void makeEmpty() throws EmptyStackException{ while (tos&gt;=0){ if (isEmpty()) throw new EmptyStackException("Stack empty"); else pop(); } } public void print(){ for (int i=0;i&lt;=tos;i++){ System.out.println(array[i]); } } public static void main (String args[]) throws EmptyStackException,OverFlowException { ArrayStack newStack=new ArrayStack(); newStack.push("S"); newStack.push("apple"); newStack.push("D"); newStack.topAndpop(); newStack.push("P"); newStack.print(); } } And this is my matching class. public class Matching{ ArrayStack match_Stack=new ArrayStack(); Object popped; Object[] array_match={"{","}"}; public boolean matching() { for(int i=0;i&lt; array_match.length;i++){ if (array_match[i]=="{" || array_match[i]=="[" ||array_match[i]=="(" ) match_Stack.push(array_match[i]); if(array_match[i]=="}" || array_match[i]=="]" || array_match[i]==")"){ if (match_Stack.isEmpty()) return false; if (match_Stack.topAndpop()==array_match[i]); return true; } } if (match_Stack.isEmpty()) return true; else re…
answer count: 1
has comment: http://stackoverflow.com/comment/36206517
has title: exception handling in parentheses matching using stacks in java
type: AnsweredQuestion

http://stackoverflow.com/comment/36036592
comment on: http://stackoverflow.com/q/23498836
score: 0
type: QuestionComment
type: Comment
has text: You should use a formula parser library or even better, use JavaScript as shown here: [Algebra equation parser for java](http://stackoverflow.com/q/4681959/1065197).

http://stackoverflow.com/comment/36118534
type: Comment
comment on: http://stackoverflow.com/a/23542234
type: AnswerComment
score: 0
has text: What do you mean by "...but is a bit longer"?

http://stackoverflow.com/comment/36154362
type: Comment
comment on: http://stackoverflow.com/a/23561875
has text: I have Removed it from Bar Graph's JRXML and now it prints it only once. But still multiple Time series graphs even if i remove it from Time series graphs JRXML
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36262878
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23575981
has text: In web.xml, you declare spring org.springframework.web.servlet.DispatcherServlet as standart servlet. Add init parameter to this servlet, as I described above.

http://stackoverflow.com/comment/77501462
has text: Sure, multiple servers are planned for midterm future (this year); that's why I'm interested in the cluster. My caching isn't hibernate query cache, but a request-response cache skipping the whole processing (with invalidation based on Hibernate post commit events). According to [this article](http://puredanger.github.io/tech.puredanger.com/2009/07/10/hibernate-query-cache), Hibernate query cache gets invalidated on *every write to a corresponding table*, so it's rather ineffective. Haven't tried.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23559789

http://stackoverflow.com/comment/137113675
comment on: http://stackoverflow.com/q/23454952
score: 0
type: Comment
type: QuestionComment
has text: A useful article about Optional may help: https://www.camelcodes.net/simple-java-optionals-guide-null-handling-java-8-code-readability/

http://stackoverflow.com/comment/35971442
comment on: http://stackoverflow.com/a/23463456
has text: So if I understand you correctly you're saying I need to add get methods to my super class (because I'm pretty sure I have setters) and set them to return true and then just put them in the the subclass replacing all the variables in parenthesis?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36145825
has text: @akhilless added the info.
type: Comment
comment on: http://stackoverflow.com/a/23557076
score: 0
type: AnswerComment

http://stackoverflow.com/q/23522606
answer count: 2
tagged with: ubuntu-14.04
tagged with: xubuntu
tagged with: ubuntu
possible better answer: http://stackoverflow.com/a/23522786
upvote count: 3
has body: Eclipse (both Juno and Kepler) started crashing after the Ubuntu upgrade from 13.10 to 14.04. They're not crashing after adding: org.eclipse.swt.browser.DefaultType=mozilla to configuration/config.ini (from https://askubuntu.com/questions/457506) But now the auto-completion has gone. I updated to java 8, added org.eclipse.swt.browser.XULRunnerPath=/usr/bin/xulrunner to configuration/config.ini, using both xulrunner 20 and 29. To no avail. (from https://bugs.eclipse.org/bugs/show_bug.cgi?id=404776 ) Even a re-install of Kepler doesn't fix the issue. What can I do to make it work?
favorite count: 0
has title: no auto completion on Eclipse after upgrade to ubuntu 14.04
has answer: http://stackoverflow.com/a/23522786
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/23538917
accepted answer: http://stackoverflow.com/a/23538917
type: Question

http://stackoverflow.com/q/23612471
has comment: http://stackoverflow.com/comment/36276439
downvote count: 0
has body: I've got the following error: 07:27:02,736 INFO Version:37 - HCANN000001: Hibernate Commons Annotations {4.0.1.Final} 07:27:02,745 INFO Version:41 - HHH000412: Hibernate Core {4.2.0.Final} 07:27:02,755 INFO Environment:239 - HHH000206: hibernate.properties not found 07:27:02,757 INFO Environment:342 - HHH000021: Bytecode provider name : javassist 07:27:02,799 INFO Configuration:1933 - HHH000043: Configuring from resource: ./hibernate.cfg.xml 07:27:02,799 INFO Configuration:1952 - HHH000040: Configuration resource: ./hibernate.cfg.xml 07:27:02,888 WARN DTDEntityResolver:74 - HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide! 07:27:02,960 INFO Configuration:2074 - HHH000041: Configured SessionFactory: null 07:27:03,677 INFO DriverManagerConnectionProviderImpl:98 - HHH000402: Using Hibernate built-in connection pool (not for production use!) 07:27:03,712 INFO DriverManagerConnectionProviderImpl:134 - HHH000115: Hibernate connection pool size: 20 07:27:03,713 INFO DriverManagerConnectionProviderImpl:137 - HHH000006: Autocommit mode: false 07:27:03,713 INFO DriverManagerConnectionProviderImpl:151 - HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/ForBook] 07:27:03,713 INFO DriverManagerConnectionProviderImpl:156 - HHH000046: Connection properties: {user=root, password=****} 07:27:05,539 INFO Dialect:128 - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect 07:27:05,570 INFO LobCreatorBuilder:94 - HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4 07:27:05,608 INFO TransactionFactoryInitiator:68 - HHH000399: Using default transaction strategy (direct JDBC transactions) 07:27:05,633 INFO ASTQueryTranslatorFactory:48 - HHH000397: Using ASTQueryTranslatorFactory 07:27:05,822 INFO Version:39 - HSEARCH000034: Hibernate Search 4.3.0.Alpha1 07:27:05,988 WARN ConfigCont…
favorite count: 0
has title: Could not prepare statement while saving via entity manager
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36272799
has comment: http://stackoverflow.com/comment/36249733
score: 2
has comment: http://stackoverflow.com/comment/36269753
answer count: 0
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/comment/36031101
type: Comment
has text: Oh was that your problem?? Thats because in user.jsp you are trying to access a list of users while you set only one user bean.. Again "users" - "user" problem. I've updated the user.jsp in my answer. Try that.
type: AnswerComment
comment on: http://stackoverflow.com/a/23489450
score: 0

http://stackoverflow.com/comment/46217021
comment on: http://stackoverflow.com/a/23466998
has text: @nize I'm not entirely sure about the inner workings of the Promise, but there are async AJAX and HTTP calls available to use. And HTML5 has features that doesn't require the browser to request data, but can accept a stream of incoming data (Server Sent Events and WebSockets).
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36054526
comment on: http://stackoverflow.com/q/23508024
has text: Benchnmark and measure.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23519937
downvote count: 0
type: Answer
has body: Avoid unnecessary restrictions You should always try to declare your variables with the least unnecessary restriction; often that means to an interface like Queue or Collection. This allows you to more easily change your implementation. I will use two classes from the collections framework as my example but the principle is general. Imagine the following objective: I need 2 collections that can have objects added to it. And I also need to be able to find which objects are in both collections. So in other words I need the following methods Collection#add Collection#retainAll These are both within Collection so any collection will do. Collection is an interface so I need to choose a concrete implementation. I choose ArrayList, on a whim. My code is the following: public static void main(String[] args){ Collection&lt;Integer&gt; a=new ArrayList&lt;&gt;(); Collection&lt;Integer&gt; b=new ArrayList&lt;&gt;(); initialise(a); initialise(b); testRetain(a,b); } public static void initialise(Collection&lt;Integer&gt; collection){ Random rnd=new Random(); for(int i=0;i&lt;1000;i++){ collection.add(rnd.nextInt()); } } public static void testRetain(Collection&lt;Integer&gt; collection1, Collection&lt;Integer&gt; collection2){ collection1.removeAll(collection2); } This code works fine and does exactly what I asked it to do. However; in profiling I find that it is a bottleneck. So I test out different implentations of the Collection class and profile the results. As you can see, for the retainAll operation the HashSet turned out to be much better. So I can change my implementation by changing just new ArrayList&lt;&gt;(); to new HashSet&lt;&gt;(); in one place. No need to change every other method I've used to HashSet as well because they don't care, as long as they get some sort of Collection they are happy public static void main(String[] args){ Collection&lt;Integer&gt; a=new HashSet&lt;&gt;(); Collection&lt;Integer&gt; b=new HashSet&lt;&gt;(); initialise(a); //&lt;--no need to…
upvote count: 1
answers question: http://stackoverflow.com/q/23519011
score: 1
accepted answer of: http://stackoverflow.com/q/23519011
type: AcceptedAnswer

http://stackoverflow.com/comment/36306433
type: QuestionComment
comment on: http://stackoverflow.com/q/23597434
has text: I'm by no means a skilled enough programmer to provide you a solution, but perhaps you might begin with a list of vertices along the edge. Then, find a point inside the shape and connect the nearest vertices to it. Then, find a point further in, and repeat. Do so until each vertex either A (has a minimum amount of edges connected), or B (the points never exceed x distance apart). Either way, the naive algorithm above connects only existing points; your desired algorithm must create new points near existing points.
score: 0
type: Comment

awt
tags question: http://stackoverflow.com/q/23525922
tags question: http://stackoverflow.com/q/23470604
tags question: http://stackoverflow.com/q/23523648
tags question: http://stackoverflow.com/q/23505800
tags question: http://stackoverflow.com/q/23457754
tags question: http://stackoverflow.com/q/23602787
tags question: http://stackoverflow.com/q/23586010
tags question: http://stackoverflow.com/q/23588895
tag name: awt
tags question: http://stackoverflow.com/q/23582698
tags question: http://stackoverflow.com/q/23569236
tags question: http://stackoverflow.com/q/23487181
tags question: http://stackoverflow.com/q/23493526
tags question: http://stackoverflow.com/q/23538005
tags question: http://stackoverflow.com/q/23589018
tags question: http://stackoverflow.com/q/23541519
tags question: http://stackoverflow.com/q/23608166
tags question: http://stackoverflow.com/q/23477051
tags question: http://stackoverflow.com/q/23605427
tags question: http://stackoverflow.com/q/23484255
tags question: http://stackoverflow.com/q/23554966
tags question: http://stackoverflow.com/q/23483525
tags question: http://stackoverflow.com/q/23496046
tags question: http://stackoverflow.com/q/23533899
tags question: http://stackoverflow.com/q/23554176
tags question: http://stackoverflow.com/q/23561509
tags question: http://stackoverflow.com/q/23525947
type: Tag
tags question: http://stackoverflow.com/q/23519848
tags question: http://stackoverflow.com/q/23491812
tags question: http://stackoverflow.com/q/23482419
tags question: http://stackoverflow.com/q/23555707

http://stackoverflow.com/q/23543167
has comment: http://stackoverflow.com/comment/36119485
has comment: http://stackoverflow.com/comment/36119788
score: -6
answer count: 4
favorite count: 0
type: UnansweredQuestion
tagged with: addition
downvote count: 6
has answer: http://stackoverflow.com/a/23543260
has comment: http://stackoverflow.com/comment/36119530
has body: Can you help me find my error? I'm trying to use these two methods here but my output is not working. class Nine { public static void Nine(String[] args) { int x,y,z; y = 3; x = 7; z = addEm(a, b); System.out.println("answer= " +x); } public static addEm (double a, double b){ int c; c = a+b; } }
tagged with: java
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/23543443
upvote count: 0
has comment: http://stackoverflow.com/comment/36119496
has title: Why wont my code run? Java program to add numbers
tagged with: logic
has answer: http://stackoverflow.com/a/23543299
has answer: http://stackoverflow.com/a/23543242

http://stackoverflow.com/comment/36151974
score: 0
has text: You are reinventing the wheel. The ⟨[Instrumentation API](http://docs.oracle.com/javase/7/docs/api/java/lang/instrument/package-summary.html)⟩ already provides a way to transform every class before use.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23558106

http://stackoverflow.com/comment/36200383
type: Comment
has text: Try with sample code that I have already shared you. Simply add it in `RootPanel.get().add(formPanel)`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23544044

http://stackoverflow.com/comment/36095309
has text: This is a typical exercise in CS related courses. He wants you to understand how sorting can be done, and probably to learn about its many different and exotic algorithms.
comment on: http://stackoverflow.com/q/23529720
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35951897
type: Comment
has text: This looks exactly what I wanted. Thank you very much!
comment on: http://stackoverflow.com/a/23453252
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36192656
type: Comment
has text: There's a onClick on the RelativeView (which is clickable) in calculadoras_activity.xml
comment on: http://stackoverflow.com/a/23553876
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36059005
comment on: http://stackoverflow.com/a/23486128
has text: Is there a tutorial I could follow online to import this into a mysql database? I'm not really a database guy..
type: AnswerComment
score: 0
type: Comment

object
tags question: http://stackoverflow.com/q/23530795
tags question: http://stackoverflow.com/q/23499859
tags question: http://stackoverflow.com/q/23523820
tag name: object
tags question: http://stackoverflow.com/q/23530609
tags question: http://stackoverflow.com/q/23453921
tags question: http://stackoverflow.com/q/23464149
tags question: http://stackoverflow.com/q/23560146
tags question: http://stackoverflow.com/q/23460554
tags question: http://stackoverflow.com/q/23595821
tags question: http://stackoverflow.com/q/23460460
tags question: http://stackoverflow.com/q/23530568
tags question: http://stackoverflow.com/q/23531969
tags question: http://stackoverflow.com/q/23571065
tags question: http://stackoverflow.com/q/23479374
tags question: http://stackoverflow.com/q/23483903
tags question: http://stackoverflow.com/q/23601916
tags question: http://stackoverflow.com/q/23496284
tags question: http://stackoverflow.com/q/23554775
tags question: http://stackoverflow.com/q/23477974
tags question: http://stackoverflow.com/q/23532874
tags question: http://stackoverflow.com/q/23462017
tags question: http://stackoverflow.com/q/23585277
tags question: http://stackoverflow.com/q/23615241
tags question: http://stackoverflow.com/q/23575888
tags question: http://stackoverflow.com/q/23601046
tags question: http://stackoverflow.com/q/23528708
tags question: http://stackoverflow.com/q/23613103
tags question: http://stackoverflow.com/q/23565443
tags question: http://stackoverflow.com/q/23588794
tags question: http://stackoverflow.com/q/23535133
tags question: http://stackoverflow.com/q/23552854
tags question: http://stackoverflow.com/q/23555129
tags question: http://stackoverflow.com/q/23527001
tags question: http://stackoverflow.com/q/23563964
tags question: http://stackoverflow.com/q/23476052
tags question: http://stackoverflow.com/q/23596031
tags question: http://stackoverflow.com/q/23563212
tags question: http://stackoverflow.com/q/23473525
type: Tag
tags question: http://stackoverflow.com/q/23478813
tags question: http://stackoverflow.com/q/23574167
tags question: http://stackoverflow.com/q/23491934
tags question: http://stackoverflow.com/q/23515914
tags question: http://stackoverflow.com/q/23583182
tags question: http://stackoverflow.com/q/23461128
tags question: http://stackoverflow.com/q/23561958

http://stackoverflow.com/q/23554986
upvote count: 2
tagged with: java
has title: Is it possible to get rid of Scala when using Play Framework?
has answer: http://stackoverflow.com/a/23560019
type: Question
has answer: http://stackoverflow.com/a/23562869
has body: Good day! I am using Play Framework in doing a Java application. Even though I am using Java, I noticed that Scala is still needed in the HTML files (like how PHP works when you have to do some if statements and looping). I am wondering if it is possible to get rid of using Scala (just pure Java and HTML) even though I use conditionals and loops in the HTML files. If I can't, are there better alternatives? Thank you!
answer count: 3
tagged with: playframework
downvote count: 0
has answer: http://stackoverflow.com/a/23555085
favorite count: 0
type: UnansweredQuestion
tagged with: scala
score: 2
tagged with: playframework-2.0

http://stackoverflow.com/q/23596100
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/36389229
has comment: http://stackoverflow.com/comment/36376692
has comment: http://stackoverflow.com/comment/36389334
has comment: http://stackoverflow.com/comment/36256195
answer count: 1
tagged with: netbeans
has comment: http://stackoverflow.com/comment/36364903
has comment: http://stackoverflow.com/comment/36353162
type: UnansweredQuestion
has title: Deploy a Java Enterprise Application fails
has comment: http://stackoverflow.com/comment/36356406
has comment: http://stackoverflow.com/comment/36261891
has comment: http://stackoverflow.com/comment/36389489
score: 0
tagged with: java
tagged with: jboss
has body: Using Netbeans, I've created my Java Enterprise Application with a ejb module and a war module. I've done some changes in the war module and everything worked just fine. But now I'm trying to call an remote ejb defined in the ejb module. I've followed this tutorial https://netbeans.org/kb/docs/javaee/entappclient.html. Now, when I try to deploy the ear file in my applicational server (JBoss AS7) I get the following error: {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.subunit.\"events.ear\".\"events-ejb.jar\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.subunit.\"events.ear\".\"events-ejb.jar\".POST_MODULE: Failed to process phase POST_MODULE of subdeployment \"events-ejb.jar\" of deployment \"events.ear\""}}}} /Users/Luis/NetBeansProjects/events/nbproject/build-impl.xml:307: The module has not been deployed. Why is this happening? EDIT teste-ejb module NewSessionBean package a; import javax.ejb.Stateless; @Stateless public class NewSessionBean implements NewSessionBeanRemote { // Add business logic below. (Right-click in editor and choose // "Insert Code &gt; Add Business Method") } teste-war module (not modified) AuthenticationInterface (the java application) SessionbeanRemote package a; import javax.ejb.Remote; @Remote public interface NewSessionBeanRemote { } 2º EDIT 17:59:24,759 WARN [org.jboss.modules] (MSC service thread 1-4) Failed to define class a.NewSessionBean in Module "deployment.teste-ejb.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link a/NewSessionBean (Module "deployment.teste-ejb.jar:main" from Service Module Loader) at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396) at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) at org.jboss.mod…
has answer: http://stackoverflow.com/a/23684820
type: Question

http://stackoverflow.com/a/23586768
has comment: http://stackoverflow.com/comment/36201583
has comment: http://stackoverflow.com/comment/36201039
has comment: http://stackoverflow.com/comment/36201209
has comment: http://stackoverflow.com/comment/36201608
type: Answer
has comment: http://stackoverflow.com/comment/36201401
upvote count: 2
has comment: http://stackoverflow.com/comment/36201117
has comment: http://stackoverflow.com/comment/36201373
has comment: http://stackoverflow.com/comment/36202827
has comment: http://stackoverflow.com/comment/36201194
has comment: http://stackoverflow.com/comment/36202122
has comment: http://stackoverflow.com/comment/36201098
answers question: http://stackoverflow.com/q/23586732
has comment: http://stackoverflow.com/comment/36201329
has body: You're using a try-with-resources, which will automatically close it when you finish the try block. Try setting it to a variable like so: public class MyClass { private static Scanner scan; public static void main(String[] args) { scan = new Scanner(System.in); } } Avoid making multiple scanners with the System.in input as well, as they will consume the stream and then you have an entirely different problem.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36201429

http://stackoverflow.com/comment/36282413
type: AnswerComment
score: 0
has text: Listen, I don't know how to stop thread except using while loop to check if keysStillRequired > 0. Anyway I edited code to put decrement into synchronized block
type: Comment
comment on: http://stackoverflow.com/a/23596527

http://stackoverflow.com/q/23477741
tagged with: android
has answer: http://stackoverflow.com/a/23480012
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: setting values at child views in linear layout
type: Question
upvote count: 2
answer count: 1
has body: I have template of linear layout which has two text fields to hold question number and questions. This template is used in master activity by using include tag multiple times. I was trying to set the question numbers in this master view based on the count of child views it has, but only last iterations of loop gets updated . example, If there are 3 child views, the first question will have question number set to 3, others are not impacted at all. Relevant codes are as below. Master Activity: &lt;LinearLayout ... android:id="@+id/id_activity_main" &gt; &lt;include android:id="@+id/inc_id_1" layout="@layout/template" /&gt; &lt;include android:id="@+id/inc_id_2" layout="@layout/template" /&gt; &lt;include android:id="@+id/inc_id_3" layout="@layout/template" /&gt; &lt;/LinearLayout&gt; Template layout: &lt;LinearLayout ... &gt; &lt;TextView android:id="@+id/tv_q_number" ....../&gt; &lt;TextView android:id="@+id/tv_question" ..... /&gt; &lt;/LinearLayout&gt; and in my activity for master (I think I have done some stupidity in this loop but too blind to see it ) : LinearLayout masterLayout=(LinearLayout) findViewById(R.id.id_activity_main); int childCount=masterLayout.getChildCount(); for(int i=0;i&lt;childCount;i++){ //individual embedded template LinearLayout linearRowView=(LinearLayout) masterLayout.getChildAt(0); //fetchin question number text field for each embedded template TextView questionNumberTextView=(TextView) linearRowView.findViewById(R.id.tv_q_number); //setting question number in each question number field of included template questionNumberTextView.setText(i+1+""); } In above example, when I leave default text for question number text view as 1, the out put would be : 3. first questions text. 1. second question text. 1. third question text. My question is , why its not updated as 1,2,3 but updated as 3,1,1. ( 1 is default). Thanks for your help in advance.
accepted answer: http://stackoverflow.com/a/23480012
favorite count: 0

http://stackoverflow.com/comment/99678681
comment on: http://stackoverflow.com/a/23487806
has text: @AliKhaleqiYekta it depends on the definition of ```isRunning``` variable. My understanding is the runnable is running while the thread is in the try block, once it exits, ```isRunning=false```. Consider this, if the delay time in ```mHandler.postDelayed(sendData, time);``` is very large. There is a period in which all the statements in the current try block complete, and the delayed runnable is yet to start. In such a period, ```isRunnable``` should be ```false``` in my understanding.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36039585
type: QuestionComment
type: Comment
has text: Seems like `dslrDAO` has incorrect imports of `DSLR` within itself. Now it's working
comment on: http://stackoverflow.com/q/23499960
score: 0

http://stackoverflow.com/a/23514972
type: Answer
has comment: http://stackoverflow.com/comment/36066250
score: 2
accepted answer of: http://stackoverflow.com/q/23514889
answers question: http://stackoverflow.com/q/23514889
has comment: http://stackoverflow.com/comment/36066321
has comment: http://stackoverflow.com/comment/36066285
has body: All the numeric literals at ((100 * 20)/100)/45 are integers so each operation performs integer arithmetic instead floating pointer arithmetic and finally the result is cast to double at the assignation operation. You should change at least one of your literals to 100.0, 20.0, 45.0, ...
has comment: http://stackoverflow.com/comment/36066382
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36066351
has comment: http://stackoverflow.com/comment/36066450
upvote count: 2

http://stackoverflow.com/comment/36148280
score: 0
type: Comment
type: QuestionComment
has text: obviously, you need to show your code..
comment on: http://stackoverflow.com/q/23558448

http://stackoverflow.com/comment/36066270
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23514726
type: Comment
has text: i had only included included google-play-services_lib which contains com.google.android.gms.ads.AdView, i have not included GoogleAdMobAdsSdk-6.4.1.jar file i am trying to achieve it through gms

http://stackoverflow.com/a/23541230
type: AcceptedAnswer
downvote count: 0
score: 8
upvote count: 8
type: Answer
has body: You should set the receive timeout immediately after performing your tell to the other actor. Once you do that, a clock basically starts ticking. If this actor does not receive any message to its mailbox within that timeframe, then a ReceiveTimeout message will be put into the mailbox indicating that you did not get a response in time. An updated version of your code to account for this would look something like: public void onReceive(Object message) throws Exception { if (message.equals("start")) { child.tell("fetch something for me!", getSelf()); getContext().setReceiveTimeout(Duration.create("1 second")); } else if (message.equals("child's response")) { getContext().setReceiveTimeout(Duration.Undefined()); //turn off receive timeout // handle a response from a child here } else if (message instanceof ReceiveTimeout) { getContext().setReceiveTimeout(Duration.Undefined()); //turn off receive timeout // handle situation where I did not get a response in time } } You'll notice that whether I get an actual response or I get a receive timeout, I'm always turning off the receive timeout I set after the tell. The receive timeout is repeating; if I don't explicitly turn it off it will continue to send me ReceiveTimeout messages every interval (based on what I set the interval to when I set the receive timeout). Be sure to keep in mind that the receive timeout functionality is message inspecific. That is it is skipped for an interval provided I receive any message to my mailbox; not just the one I want. So if some other actor sent me another completely different message, it will skip the receive timeout for that interval. If this is not going to be an issue, then no need to worry about it. But if it is possible that other messages besides the response might be arriving, you will need to handle that accordingly, resetting the original receive timeout based on how much time has elapsed since originally setting it (probably via a Deadline instance.
accepted answer of: http://stackoverflow.com/q/23533757
answers question: http://stackoverflow.com/q/23533757

recursion
type: Tag
tags question: http://stackoverflow.com/q/23462380
tags question: http://stackoverflow.com/q/23492114
tags question: http://stackoverflow.com/q/23461443
tag name: recursion
tags question: http://stackoverflow.com/q/23460371
tags question: http://stackoverflow.com/q/23588527
tags question: http://stackoverflow.com/q/23460804
tags question: http://stackoverflow.com/q/23582900
tags question: http://stackoverflow.com/q/23464692
tags question: http://stackoverflow.com/q/23541692
tags question: http://stackoverflow.com/q/23454446
tags question: http://stackoverflow.com/q/23537757
tags question: http://stackoverflow.com/q/23479456
tags question: http://stackoverflow.com/q/23588299
tags question: http://stackoverflow.com/q/23508469
tags question: http://stackoverflow.com/q/23487328
tags question: http://stackoverflow.com/q/23531410
tags question: http://stackoverflow.com/q/23589700
tags question: http://stackoverflow.com/q/23600700
tags question: http://stackoverflow.com/q/23522156
tags question: http://stackoverflow.com/q/23554535
tags question: http://stackoverflow.com/q/23577696
tags question: http://stackoverflow.com/q/23588618

http://stackoverflow.com/q/23497324
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/46731840
upvote count: 6
type: AnsweredQuestion
tagged with: java
score: 6
type: Question
has comment: http://stackoverflow.com/comment/36034466
possible better answer: http://stackoverflow.com/a/46731840
has body: I'm using pdfbox for the first time. Now I'm reading something on the website Pdf Summarizing I have a pdf like this: only that my file has many and many different component(textField,RadionButton,CheckBox). For this pdf I have to read these values : Mauro,Rossi,MyCompany. For now I wrote the following code: PDDocument pdDoc = PDDocument.loadNonSeq( myFile, null ); PDDocumentCatalog pdCatalog = pdDoc.getDocumentCatalog(); PDAcroForm pdAcroForm = pdCatalog.getAcroForm(); for(PDField pdField : pdAcroForm.getFields()){ System.out.println(pdField.getValue()) } Is this a correct way to read the value inside the form component? Any suggestion about this? Where can I learn other things on pdfbox?
has answer: http://stackoverflow.com/a/23498817
accepted answer: http://stackoverflow.com/a/23498817
tagged with: pdfbox
has title: Using pdfbox to get form field values
answer count: 2

arrays
tags question: http://stackoverflow.com/q/23464528
tags question: http://stackoverflow.com/q/23577844
tags question: http://stackoverflow.com/q/23538265
tags question: http://stackoverflow.com/q/23550817
tags question: http://stackoverflow.com/q/23597212
tags question: http://stackoverflow.com/q/23600097
tags question: http://stackoverflow.com/q/23456742
type: Tag
tags question: http://stackoverflow.com/q/23598632
tags question: http://stackoverflow.com/q/23602506
tags question: http://stackoverflow.com/q/23596923
tags question: http://stackoverflow.com/q/23458188
tags question: http://stackoverflow.com/q/23565794
tags question: http://stackoverflow.com/q/23510648
tags question: http://stackoverflow.com/q/23467836
tags question: http://stackoverflow.com/q/23608866
tags question: http://stackoverflow.com/q/23585852
tags question: http://stackoverflow.com/q/23540204
tags question: http://stackoverflow.com/q/23506468
tags question: http://stackoverflow.com/q/23476485
tags question: http://stackoverflow.com/q/23507380
tags question: http://stackoverflow.com/q/23521967
tags question: http://stackoverflow.com/q/23471051
tags question: http://stackoverflow.com/q/23484148
tags question: http://stackoverflow.com/q/23532229
tags question: http://stackoverflow.com/q/23463740
tags question: http://stackoverflow.com/q/23516030
tags question: http://stackoverflow.com/q/23458619
tags question: http://stackoverflow.com/q/23457366
tags question: http://stackoverflow.com/q/23457966
tags question: http://stackoverflow.com/q/23601542
tags question: http://stackoverflow.com/q/23573545
tags question: http://stackoverflow.com/q/23528725
tags question: http://stackoverflow.com/q/23528656
tags question: http://stackoverflow.com/q/23511729
tags question: http://stackoverflow.com/q/23576640
tags question: http://stackoverflow.com/q/23460578
tags question: http://stackoverflow.com/q/23465798
tags question: http://stackoverflow.com/q/23464124
tags question: http://stackoverflow.com/q/23594278
tags question: http://stackoverflow.com/q/23555867
tags question: http://stackoverflow.com/q/23501353
tags question: http://stackoverflow.com/q/23530501
tags question: http://stackoverflow.com/q/23509082
tags question: http://stackoverflow.com/q/23460460
tags question: http://stackoverflow.com/q/23604510
tags question: http://stackoverflow.com/q/23598620
tags question: http://stackoverflow.com/q/23570936
tags question: http://stackoverflow.com/q/23575276
tags question: http://stackoverflow.com/q/23496284
tags question: http://stackoverflow.com/q/23600964
tags question: http://stackoverflow.com/q/23454489
tags question: http://stackoverflow.com/q/23480154
tags question: http://stackoverflow.com/q/23460768
tags question: http://stackoverflow.com/q/23485477
tags question: http://stackoverflow.com/q/23556349
tags question: http://stackoverflow.com/q/23544039
tags question: http://stackoverflow.com/q/23458712
tags question: http://stackoverflow.com/q/23460367
tags question: http://stackoverflow.com/q/23568386
tags question: http://stackoverflow.com/q/23528602
tags question: http://stackoverflow.com/q/23552791
tags question: http://stackoverflow.com/q/23532009
tags question: http://stackoverflow.com/q/23571065
tags question: http://stackoverflow.com/q/23570961
tags question: http://stackoverflow.com/q/23571245
tags question: http://stackoverflow.com/q/23463522
tags question: http://stackoverflow.com/q/23592424
tags question: http://stackoverflow.com/q/23477153
tags question: http://stackoverflow.com/q/23486621
tags question: http://stackoverflow.com/q/23471553
tags question: http://stackoverflow.com/q/23593966
tags question: http://stackoverflow.com/q/23503346
tags question: http://stackoverflow.com/q/23474984
tags question: http://stackoverflow.com/q/23582463
tags question: http://stackoverflow.com/q/23509862
tag name: arrays
tags question: http://stackoverflow.com/q/23596276
tags question: http://stackoverflow.com/q/23589412
tags question: http://stackoverflow.com/q/23474159

http://stackoverflow.com/q/23613651
has comment: http://stackoverflow.com/comment/36251411
tagged with: mysql
downvote count: 1
has comment: http://stackoverflow.com/comment/36251427
type: Question
has comment: http://stackoverflow.com/comment/36252034
has comment: http://stackoverflow.com/comment/36251720
score: 0
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23614261
favorite count: 0
has title: How to fix: “No suitable driver found for jdbc:mysql://localhost/dbname”
has answer: http://stackoverflow.com/a/23614453
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36251406
has comment: http://stackoverflow.com/comment/36251426
tagged with: jdbc
has body: Hi, I have this code here, but when the application starts showing me the error! How to fix it? : ERROR : "No suitable driver found for jdbc:mysql://localhost/database" CODE : try { connection = DriverManager.getConnection("jdbc:mysql://"+host+"/"+database,username,password); connection.setAutoCommit(false); System.out.println("Connected to MySQL!"); } catch (SQLException e) { System.out.println("Couldn't connect to MySQL!"); System.out.println(e.getMessage()); System.exit(0); }
tagged with: java

http://stackoverflow.com/comment/36055487
type: QuestionComment
comment on: http://stackoverflow.com/q/23508719
has text: So many things could be wrong. Check if the user "someuser" has access via this connection. Try using mysql connector and connecting to the remote server using the credentials provided.
score: 0
type: Comment

http://stackoverflow.com/q/23522217
favorite count: 0
has title: Change in top right bar
tagged with: android
score: -3
downvote count: 4
tagged with: http://stackoverflow.com/tag/xml
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23522484
has body: How can I changed from "Settings" to "About" in the top right? Im using Android 4.0 like this picture https://i.sstatic.net/oEyRQ.png
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/23522484

http://stackoverflow.com/q/23525380
has answer: http://stackoverflow.com/a/23525431
type: Question
has comment: http://stackoverflow.com/comment/36086561
has title: How to access object not stored in variable
has comment: http://stackoverflow.com/comment/36086574
has answer: http://stackoverflow.com/a/23525511
has answer: http://stackoverflow.com/a/23525687
has comment: http://stackoverflow.com/comment/36087371
score: -1
has comment: http://stackoverflow.com/comment/36086579
has comment: http://stackoverflow.com/comment/36086520
downvote count: 2
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/36087272
favorite count: 0
has comment: http://stackoverflow.com/comment/36087149
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36124360
has comment: http://stackoverflow.com/comment/36086719
has comment: http://stackoverflow.com/comment/36086776
has comment: http://stackoverflow.com/comment/36086491
has body: I have this method that I pass a newly created object into foo(new WebObject()); How do I get access to the WebObject to use in another object? In other words where do newly created objects reference go?
tagged with: java
has comment: http://stackoverflow.com/comment/36086892

http://stackoverflow.com/q/23489444
type: Question
score: 0
has answer: http://stackoverflow.com/a/23489521
answer count: 1
tagged with: parsing
has body: I am trying to display a text from a news in any category of a newspaper. I use RSS of this newspaper. However when I run the code, sometimes I get the exception message in the above, sometimes it works correctly. Here is my RSS Parser code: And the rss page that I use is: RSSFeedParser parser = new RSSFeedParser("http://www.cumhuriyet.com.tr/rss/5"); Feed feed = parser.readFeed(); The RSS parser code: package main; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.Characters; import javax.xml.stream.events.XMLEvent; public class RSSFeedParser { static final String TITLE = "title"; static final String DESCRIPTION = "description"; static final String CHANNEL = "channel"; static final String LANGUAGE = "language"; static final String COPYRIGHT = "copyright"; static final String LINK = "link"; static final String AUTHOR = "author"; static final String ITEM = "item"; static final String PUB_DATE = "pubDate"; static final String GUID = "guid"; static final String IMG = "img"; final URL url; public RSSFeedParser(String feedUrl) { try { this.url = new URL(feedUrl); } catch (MalformedURLException e) { throw new RuntimeException(e); } } public Feed readFeed() { Feed feed = null; try { boolean isFeedHeader = true; // Set header values intial to the empty string String description = ""; String title = ""; String link = ""; String language = ""; String copyright = ""; String author = ""; String pubDate = ""; String guid = ""; String img = ""; // First create a new XMLInputFactory XMLInputFactory inputFactory = XMLInputFactory.newInstance(); // Setup a new eventReader InputStream in = read(); XMLEventReader eventReader = inputFactory.createXMLEventReader(in); // read the XML document while (eventReader.hasNext()) { XMLEvent event = eventReader.nextEvent(); if (…
accepted answer: http://stackoverflow.com/a/23489521
type: AnsweredQuestion
tagged with: java
has title: XMLStreamException: ParseError at [row,col]:[5,3] Message: The element type "meta" must be terminated by the matching end-tag " "

http://stackoverflow.com/comment/36199768
comment on: http://stackoverflow.com/q/23586010
type: Comment
type: QuestionComment
has text: I'm confused. I don't see anything that immediately strikes me as "wrong" (except some naming conventions), but I also don't know of the response you're receiving back from the server - you haven't provided that detail. What's actually going awry with this method? (And why would a block be throwing a `ClassNotFoundException`?)
score: 0

http://stackoverflow.com/comment/36012131
has text: @Lilshieste could you elaborate? To use `sq_executesql` it would be necessary to escape `AAA` in that example since `AAA'` would cause a syntax error, wouldn't it?
comment on: http://stackoverflow.com/q/23477126
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23459504
answer count: 2
has answer: http://stackoverflow.com/a/23459932
has comment: http://stackoverflow.com/comment/35963591
has comment: http://stackoverflow.com/comment/35963548
has comment: http://stackoverflow.com/comment/35963744
has answer: http://stackoverflow.com/a/23459623
tagged with: arraylist
has body: I've read quite a few sources that talk about xlint, the unsafe operation stuff, and a lot of it has said something along the lines of: you probably initialized your arraylist with, Arraylist x = new Arraylist(); instead, do, List&lt;String&gt; x = new ArrayList&lt;String&gt;(); that's all fine and dandy, but that doesn't help me at all with this situation. In my project, I'm trying to make a turn based game, and I have a Commander class that has an arraylist of units and buildings. Units are seperate objects, with subclasses. When constructing the subclasses, the Commander object is a parameter, so that's why I used this, which I assume is fine? here's where the problem is at: public void buyUnit(int u) { if (u &lt; 1 || u &gt; 23) { if (u == 1) this.getUnits().add(new Grunt(this)); if (u == 2) this.getUnits().add(new Rifleman(this)); if (u == 3) this.getUnits().add(new Scout(this)); if (u == 4) this.getUnits().add(new Mortar(this)); if (u == 5) this.getUnits().add(new FlakTrooper(this)); if (u == 6) this.getUnits().add(new RPG(this)); if (u == 7) this.getUnits().add(new Sniper(this)); if (u == 8) this.getUnits().add(new Minigunner(this)); if (u == 9) this.getUnits().add(new Humvee(this)); if (u == 10) this.getUnits().add(new Tank(this)); if (u == 11) this.getUnits().add(new Artillery(this)); if (u == 12) this.getUnits().add(new MissileBattery(this)); if (u == 13) this.getUnits().add(new GattlingGun(this)); if (u == 14) this.getUnits().add(new IFV(this)); if (u == 15) this.getUnits().add(new TankBuster(this)); if (u == 16) this.getUnits().add(new Flamethrower(this)); if (u == 17) this.getUnits().add(new Fighter(this)); if (u == 18) this.getUnits().add(new Bomber(this)); if (u == 19) this.getUnits().add(new Gunship(this)); if (u == 20) this.getUnits().add(new Gunner(this)); if (u == 21) this.getUnits().add(new Jet(this)); if (u == 22) this.getUnits().add(new Chopper(this)); if (u == 23) this.getUnits().add(new Harrier(this)); this.loseBalance(units.get(units.size() …
score: 0
has comment: http://stackoverflow.com/comment/35964188
type: UnansweredQuestion
type: Question
tagged with: java
has title: Unsafe operations... Recompile with -Xlint:unchecked... I can't seem to understand why the operation is unsafe

http://stackoverflow.com/comment/36132737
type: Comment
has text: As I said, it depends on what you're trying to measure. If generating the output is what matters, thne you should definitely measure it, because one implemenation might be slower at generating the output than the other. If the efficiency of the algorithm is what you want to measure, then make the algorithm return output rather than writing it, and make sure both implementation use the same way date structures to generate the returned value.
type: QuestionComment
comment on: http://stackoverflow.com/q/23550028
score: 0

http://stackoverflow.com/comment/36065616
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23513804
has text: @PauliusM What `Layout` are you using?

http://stackoverflow.com/q/23588607
has answer: http://stackoverflow.com/a/23588679
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36204685
has comment: http://stackoverflow.com/comment/36204844
has answer: http://stackoverflow.com/a/23588665
type: Question
has title: Empty line in file
has comment: http://stackoverflow.com/comment/36204616
tagged with: java
linked to: http://stackoverflow.com/q/2231369
score: 0
has body: I could not find an explanation and those I found I am unsure of. So please confirm my doubts: I am reading through a file using a while loop and if the line in the file is empty it skips and goes to next line. I just want to make sure the code I am using is correct for the what I just described: while((strLine = reader.readLine())!= null) &lt;----- While loop that is suppose to read Line by Line { if (strLine.isEmpty() == false) &lt;----- Check for empty Line { /** My Code **/ } else { /** My Code **/ } }
has comment: http://stackoverflow.com/comment/36204677
has answer: http://stackoverflow.com/a/23588680
possible better answer: http://stackoverflow.com/a/23588679
has answer: http://stackoverflow.com/a/23588688
accepted answer: http://stackoverflow.com/a/23588688

http://stackoverflow.com/q/23458188
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/35961160
has comment: http://stackoverflow.com/comment/35961067
tagged with: java
downvote count: 2
upvote count: 1
type: Question
has body: Here is the my string array..here is the question how to apply custom font through java code. Here string array declare to get resource from array--> navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items); Typeface face=Typeface.createFromAsset(getAssets(),"fonts/BRADHITC.TTF"); Please share your knowledge..thank for advance. Home Temples Resorts Travels Colleges Queries
has title: How to use custom font from String.xml file
tagged with: arrays
score: -1
has answer: http://stackoverflow.com/a/23458312
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35961112

http://stackoverflow.com/comment/36207898
type: Comment
comment on: http://stackoverflow.com/a/23590422
has text: Use android:gravity="center" and android:layout_width="fill_parent"
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36039577
comment on: http://stackoverflow.com/a/23494803
score: 0
type: AnswerComment
type: Comment
has text: Thank you, i'll search the same questions before ask any question!

http://stackoverflow.com/q/23544180
has answer: http://stackoverflow.com/a/23544961
has comment: http://stackoverflow.com/comment/36121672
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23545584
has comment: http://stackoverflow.com/comment/36121438
has comment: http://stackoverflow.com/comment/36121321
has body: I need insert node to the beginning of my XML file, after I sought in web I found keyword insertBefore but I can't apply this keyword in my code. However when I used appendChild, then inserted this keyword the element gets inserted to the end of xml file.How can I use insertBefore keyword to insert to beginning of xml tree. For example: <n> <c></c> <c></c> </n> I need to insert element to the beginning of the xml file same that: <n> <c></c> <c></c> </n> my java code: public void insertNewProject(Project entity) { String filePath = "location.xml"; File xmlFile = new File(filePath); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder; try { dBuilder = dbFactory.newDocumentBuilder(); Document doc; doc = dBuilder.parse(xmlFile); doc.getDocumentElement().normalize(); Node n = doc.getElementsByTagName("n").item(0); Element a = doc.createElement("a"); n.appendChild(a); Element b = doc.createElement("b"); b.appendChild(doc.createTextNode(entity.getLocation())); a.appendChild(b); Element c = doc.createElement("c"); c.appendChild(doc.createTextNode(entity.getName())); a.appendChild(c); doc.getDocumentElement().normalize(); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource domSource = new DOMSource(doc); StreamResult streamResult = new StreamResult(new File("location.xml")); transformer.transform(domSource, streamResult); } catch (ParserConfigurationException pce) { return; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (TransformerException tfe) { return; } }
possible better answer: http://stackoverflow.com/a/23544535
tagged with: sax
upvote count: 1
has answer: http://stackoverflow.com/a/23544535
type: AnsweredQuestion
has title: How I can insert node at beginning xml file?
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23545584
tagged with: dom
type: Question
tagged with: xml-parsing
downvote count: 0
has comment: http://stackoverflow.com/comment/36121976
favorite count: 0
answer count: 3

http://stackoverflow.com/q/23576213
tagged with: java
type: Question
score: 12
upvote count: 12
has body: i am new Spring learner.i'm really confused about what is the difference between two concept: @ModelAttribute model.addAttribute in below there are two "user" value.Are these same thing?Why should I use like this? Thank you all @RequestMapping(method = RequestMethod.GET) public String setupForm(ModelMap model) { model.addAttribute("user", new User()); return "editUser"; } @RequestMapping(method = RequestMethod.POST) public String processSubmit( @ModelAttribute("user") User user, BindingResult result, SessionStatus status) { userStorageDao.save(user); status.setComplete(); return "redirect:users.htm"; }
downvote count: 0
has title: What is the difference between @ModelAttribute, model.addAttribute in spring?
answer count: 1
favorite count: 0
tagged with: model
has answer: http://stackoverflow.com/a/23576925
accepted answer: http://stackoverflow.com/a/23576925
tagged with: modelattribute
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/a/23557328
type: Answer
accepted answer of: http://stackoverflow.com/q/23502819
has body: Ok, this seems to be tied to the DB engine. When using MySQL, it is handeled by the rules the selected MySQL engine dicates. This answer was very helpful
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23502819
score: 0

http://stackoverflow.com/a/54305885
answers question: http://stackoverflow.com/q/23512547
has body: Perfect code for uploading any files to google drive along with metadata of files easily. String url = String.format("https://www.googleapis.com/upload/drive/v2/files?uploadType=multipart"); //String url = String.format("https://www.googleapis.com/upload/drive/v2/files?uploadType=resumable"); boolean status; String metaDataFile = "{\"title\":\"" + step.getFile_name() + "\"," + "\"description\":\"" + step.getDescription() + "\"," + "\"parents\":[{\"id\":\"" + step.getFolderId() + "\"}]," + "\"capabilities\":{\"canEdit\":\"" + false + "\", \"canDownload\":\" "+ false +" \" }, " + "\"type\":\"" + step.getFile_access() + "\"" + "}"; //get the encoded byte data for decode byte[] file = Base64.decodeBase64(step.getFile_data()); //attaching metadata to our request object RequestBody requestBodyMetaData = RequestBody.create(MediaType.parse("application/json"), metaDataFile); //passing both meta data and file content for uploading RequestBody requestBodyMultipart = new MultipartBody.Builder() .setType(MultipartBody.FORM) .addFormDataPart("metadata", null, requestBodyMetaData) .addFormDataPart("file", null, RequestBody.create(MediaType.parse("application/octet-stream"), file)) .build(); Request request = new Request.Builder() .url(url) .addHeader("Authorization", String.format("Bearer %s", step.getAccess_token())) .post(requestBodyMultipart) .build(); OkHttpClient okHttpClient = new OkHttpClient(); try { // Get response after rest call. Response response = okHttpClient.newCall(request).execute(); status = response.code() == 200 ? true : false; map.put(step.getOutput_variable(), response.code());
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/95432439
downvote count: 1
score: 1

http://stackoverflow.com/comment/36013681
has text: Notice that there is another message interleaved with the stack trace, and the stack trace is helpfully highlighted in red.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23486247

http://stackoverflow.com/a/23515762
has body: Adding Google Play Services support to your project As per the Google Play Services setup guide, one does not simply "add the jars". Since GPS comes bundled with resources, you have to import it as a new seperate project, and reference it from your own, exisiting project. Please follow the setup guide. I've just verified that I can reference AdView successfully from my own project incorporating GPS. Ensuring your device supports Google Play Services GPS is an external service - it's an APK managed by the Play Store app and you need to ensure that the user has the latest GPS APK and/or one that complies with what you wanna do. Here is the guide: Ensure Devices Have the Google Play services APK. If the device does not have GPS installed (not a Google device, special ROM, AOSP ROM, old Android, etc...) you can not use AdView.
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/38375906
has comment: http://stackoverflow.com/comment/36074805
has comment: http://stackoverflow.com/comment/36070220
has comment: http://stackoverflow.com/comment/36075166
has comment: http://stackoverflow.com/comment/36074721
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36071470
accepted answer of: http://stackoverflow.com/q/23514726
has comment: http://stackoverflow.com/comment/38371449
upvote count: 3
has comment: http://stackoverflow.com/comment/36071446
has comment: http://stackoverflow.com/comment/36070091
answers question: http://stackoverflow.com/q/23514726
type: Answer
has comment: http://stackoverflow.com/comment/36074032

http://stackoverflow.com/a/23615646
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23615451
score: 15
accepted answer of: http://stackoverflow.com/q/23615451
has comment: http://stackoverflow.com/comment/36331053
has body: Because the compiler can infer the type from the variable declaration. Example: List&lt;String&gt; list = Lists.newArrayList(), the compiler will understand that the type of the collection (the type of E) will be &lt;String&gt;, since you expect to get a List of String. It was useful to avoid rewriting entire &lt;> arguments, but with Java7 and diamond operator you can avoid it using List&lt;String&gt; list = new ArrayList&lt;&gt;(); (Imaginate it was a List&lt;List&lt;String&gt;&gt; you should rewrite List&lt;List&lt;String&gt;&gt;) I found this for you: The Java compiler takes advantage of target typing to infer the type parameters of a generic method invocation. The target type of an expression is the data type that the Java compiler expects depending on where the expression appears. Consider the method Collections.emptyList, which is declared as follows: static &lt;T&gt; List&lt;T&gt; emptyList(); Consider the following assignment statement: List&lt;String&gt; listOne = Collections.emptyList(); This statement is expecting an instance of List; this data type is the target type. Because the method emptyList returns a value of type List, the compiler infers that the type argument T must be the value String. This works in both Java SE 7 and 8. Alternatively, you could use a type witness and specify the value of T as follows: List&lt;String&gt; listOne = Collections.&lt;String&gt;emptyList(); However, this is not necessary in this context. It was necessary in other contexts, though. Consider the following method: void processStringList(List&lt;String&gt; stringList) { // process stringList } Suppose you want to invoke the method processStringList with an empty list. In Java SE 7, the following statement does not compile: processStringList(Collections.emptyList()); The Java SE 7 compiler generates an error message similar to the following: List&lt;Object&gt; cannot be converted to List&lt;String&gt; The compiler requires a value for the type argument T so it starts wi…
upvote count: 15
type: AcceptedAnswer

http://stackoverflow.com/q/23570085
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36171490
has answer: http://stackoverflow.com/a/23570231
has comment: http://stackoverflow.com/comment/36171429
has body: So I have a simple android app where I take text from a text file (that part is working) and I want to set that text to EditText.setText(). The problem I'm having is that I cannot do this in the onCreate() method because the EditText field and the UI hasn't been created yet(from what it seems). My question is where would be a good place to do this? Is there a function that is called right after the GUI elements are created? public class MainActivity extends ActionBarActivity { private final String FILE_NAME = "awayReply"; private EditText myEditMessage; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction().add(R.id.container, new PlaceholderFragment()).commit(); } } @Override protected void onStart() { String message = readMessage(); myEditMessage = (EditText)findViewById(R.id.edit_message); if(myEditMessage != null) { myEditMessage.setText(message, TextView.BufferType.EDITABLE); } } XML Layout: &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:orientation="horizontal" android:paddingBottom="16dp" android:paddingTop="16dp" &gt; &lt;EditText android:id="@+id/edit_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/lbl_message" android:inputType="textImeMultiLine" /&gt; &lt;Button android:id="@+id/btn_update" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/edit_message" android:onClick="updateMessage" android:text="@string/lbl_update" /&gt; &lt;ToggleButton android:id="@+id/toggle_away" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/lbl_enable" android:layout_alignBottom="@+id/lbl_enable…
type: Question
has title: Android, set text for an EditText on startup
possible better answer: http://stackoverflow.com/a/23570231
tagged with: java
has answer: http://stackoverflow.com/a/23571319
has comment: http://stackoverflow.com/comment/36169674
score: 0
answer count: 2
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36170250
has comment: http://stackoverflow.com/comment/36171452
accepted answer: http://stackoverflow.com/a/23571319
has comment: http://stackoverflow.com/comment/36169672
tagged with: android

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

http://stackoverflow.com/q/23476879
has body: I'm not sure how to write it in a way the query will take all the values stored in the excludeRooms and use it in the query then add the results to the tableRoomsData vector Code: List&lt;String&gt; excludeRooms = new ArrayList&lt;String&gt;(); Vector&lt;String&gt; tableRoomsData = new Vector&lt;String&gt;(); m.dbConnect(); PreparedStatement stmt = m.getCon().prepareStatement("SELECT * FROM room_view WHERE room_num != ?"); //get all data where room_num is not equal to the room numbers stored in excludeRooms result = stmt.executeQuery(); while (result.next()) { d.add(result.getString("room_num"); d.add(result.getString("room_type"); } PS. I'm a total newbie in Java and is trying to create a program alongside learning on my own. This is also my first time to post a question here so I hope you could bear with me on my formatting. Thank y'all in advance!
has title: Retrieve ResultSet from MySQL using ArrayList in Query
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23477209
has answer: http://stackoverflow.com/a/23477085
possible better answer: http://stackoverflow.com/a/23477209
tagged with: java
linked to: http://stackoverflow.com/q/178479
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/178479
accepted answer: http://stackoverflow.com/a/23477085
type: Question
tagged with: jdbc

http://stackoverflow.com/comment/36197831
has text: doesn't matter because you have handled it in catch block where it's never thrown
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23584936
type: Comment

http://stackoverflow.com/q/23581912
has comment: http://stackoverflow.com/comment/36192094
has comment: http://stackoverflow.com/comment/36192337
upvote count: 1
linked to: http://stackoverflow.com/q/5309150
answer count: 1
has title: Mouse Dragged out of Window
favorite count: 0
has body: This code is in my mouseDragged function and it drags the undecorated JFrame if (mouse.y &lt; 25 &amp;&amp; !closePol.contains(mouse)){ getParent().getParent().getParent().getParent().setLocation(new Point(e.getXOnScreen() - mouse.x, e.getYOnScreen() - mouse.y)); } and I have code that sets mouse = new Point() whenever I move the mouse out of the JFrame. It works fine but there is a bug. Whenever I start dragging with mouse.y &gt;= 25 and drag out the window, this happens. The window moves the top left corner to the mouse.
downvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/36192850
tagged with: mouse
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36192202
has answer: http://stackoverflow.com/a/23582858
accepted answer: http://stackoverflow.com/a/23582858
has comment: http://stackoverflow.com/comment/36191945
type: Question
score: -1

http://stackoverflow.com/comment/36061642
comment on: http://stackoverflow.com/a/23467533
has text: @Michael You could have your customer pass an argument to the JVM running the app you do not control, to set the time zone. See link in last part of my updated answer.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23494045
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23492410
type: Answer
has body: You wrote: String query = "UPDATE STUDENT SET RESULT = ? WHERE OBJ_ID IN ( SELECT * FROM TABLE )"; getJdbcTemplate().query(updateStateSQL, ...) You didn't write the value of updateStateSQL. If it's the same as query, then this cannot work: ps.setString(1, 'PASS'); ps.setArray(2, stud_ids); Because you would need precisely 2 question marks (?) in the query and you have only one in your post. You could try this: String query = "UPDATE STUDENT SET RESULT = ? WHERE OBJ_ID IN ( ? )"; But to be honest I've never used ps.setArray and I'm not sure it will do what you expect. What should work is using NamedParameterJdbcTemplate, something like this: String sql = "UPDATE STUDENT SET RESULT = :result WHERE OBJ_ID IN ( :ids )"; Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); params.put("result", "PASS"); params.put("ids", Arrays.asList(new Integer[] {100, 101, 102})); getSimpleJdbcTemplate().update(sql, params);

http://stackoverflow.com/q/23457376
tagged with: java
accepted answer: http://stackoverflow.com/a/23457736
has answer: http://stackoverflow.com/a/23458020
has answer: http://stackoverflow.com/a/23457866
type: Question
linked to: http://stackoverflow.com/q/5665156
has body: I am trying to toggle visibility of a JTextField with a checkbox. If the checkbox is selected I want the JTextField to be displayed and vice-versa. My program works fine until I add the line that initializes the JTextField to be invisible at the start. If I remove this the segment works fine! Can you help me? final JCheckBox chckbxNewCheckBox_1 = new JCheckBox("New Folder"); panel_3.add(chckbxNewCheckBox_1); final JTextField textField_3 = new JTextField(); panel_3.add(textField_3); textField_3.setColumns(20); //textField_3.setVisible(false); if a comment it in.. it never becomes visible chckbxNewCheckBox_1.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { if(chckbxNewCheckBox_1.isSelected()){ textField_3.setVisible(true); } else textField_3.setVisible(false); } });
has answer: http://stackoverflow.com/a/23457736
answer count: 4
has comment: http://stackoverflow.com/comment/35959593
favorite count: 0
linked to: http://stackoverflow.com/q/1097366
has answer: http://stackoverflow.com/a/23457959
upvote count: 1
tagged with: swing
has title: Toggle visibility of a JComponent Swing
downvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23458020
score: 0

ant
tags question: http://stackoverflow.com/q/23487804
tags question: http://stackoverflow.com/q/23489327
tags question: http://stackoverflow.com/q/23570907
tags question: http://stackoverflow.com/q/23614676
tags question: http://stackoverflow.com/q/23536635
tags question: http://stackoverflow.com/q/23545705
type: Tag
tags question: http://stackoverflow.com/q/23606336
tags question: http://stackoverflow.com/q/23473612
tags question: http://stackoverflow.com/q/23477880
tags question: http://stackoverflow.com/q/23505006
tags question: http://stackoverflow.com/q/23564038
tag name: ant
tags question: http://stackoverflow.com/q/23456831
tags question: http://stackoverflow.com/q/23557035
tags question: http://stackoverflow.com/q/23470220
tags question: http://stackoverflow.com/q/23479580
tags question: http://stackoverflow.com/q/23520487
tags question: http://stackoverflow.com/q/23554403
tags question: http://stackoverflow.com/q/23532966
tags question: http://stackoverflow.com/q/23515394
tags question: http://stackoverflow.com/q/23550283
tags question: http://stackoverflow.com/q/23598915
tags question: http://stackoverflow.com/q/23546779
tags question: http://stackoverflow.com/q/23586994

http://stackoverflow.com/comment/36245417
comment on: http://stackoverflow.com/q/23600768
score: 0
type: Comment
type: QuestionComment
has text: Or maybe using indexed color which I think is also not supported.

http://stackoverflow.com/q/23455141
score: 2
type: AnsweredQuestion
has title: How to escape a { character in a MessageFormat pattern string?
tagged with: placeholder
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35955318
has comment: http://stackoverflow.com/comment/35955524
has body: I have a string like the following. ABC {A WELL-KNOWN MAGICIAN} WILL PERFORM AT {0} FOR {1} HOURS. There is no placeholder for the first pair of curly braces. When I pass this string to MessageFormat.format(String, Object[]) method with an object array containing two strings to replace the placeholders {0} and {1}, I get the following error. java.lang.IllegalArgumentException: All argument identifiers have to be either non-negative numbers or strings following the pattern ([:ID_Start:] [:ID_Continue:]*). It appears that the first pair of brace is being parsed for the first placeholder and since it is not a valid placeholder, the error occurs. How can I tell MessageFormat.format to ignore the first pair of curly braces and work with the other two?
tagged with: messageformat
tagged with: replace
tagged with: illegalargumentexception
has answer: http://stackoverflow.com/a/23455193
linked to: http://stackoverflow.com/q/1187093
accepted answer: http://stackoverflow.com/a/23455193
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/35955506

http://stackoverflow.com/q/23468219
tagged with: permgen
has body: I am experimenting some issues while deploying my app in the production server. I have an ubuntu machine for development in which my servlet works fine. About a month without problems. Then I deploy it to my production machine (VM debian). I stopped tomcat, I copy war file to the webapps folder and start tomcat again. First, when I try to stop/start/restart tomcat, I get this "error": root@VMMachine-34199:~/folder# sudo /etc/init.d/tomcat6 restart [ ok ] Stopping Tomcat servlet engine: tomcat6 Tomcat servlet engine is not running but pid file exists, cleaning up. [ ok ] Starting Tomcat servlet engine: tomcat6. root@VMMachine-34199:~/folder# sudo /etc/init.d/tomcat6 status [ ok ] Tomcat servlet engine is running with pid 22627. root@VMMachine-34199:~/folder# sudo /etc/init.d/tomcat6 status [ ok ] Tomcat servlet engine is not running, but pid file exists.. I don't know what to do to avoid this. Always happends just in production machine. After that, I have this other problem, don't know if related to the first one. In catalina.out I get: java.net.BindException: Address already in use &lt;null&gt;:9010 9010 is the tomcat port. This port is just used to connect to one of my deployed wars by other service I have. With netstat -atnp |grep 9010 I see just the other service LISTEN. But after this, tomcat seems to start, register both resources availables in my servlet and so on. And at the end, I get this in catalina.out: May 05, 2014 8:34:29 AM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(/var/lib/tomcat6/webapps/SERVLET/WEB-INF/lib/servlet-api-2.3.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class May 05, 2014 8:34:47 AM org.apache.tomcat.util.digester.Digester endElement SEVERE: End event threw error java.lang.OutOfMemoryError: PermGen space May 05, 2014 8:34:47 AM org.apache.tomcat.util.modeler.Registry registerComponent SEVERE: Null component Catalina:type=JspMonitor,name=jsp,We…
linked to: http://stackoverflow.com/q/3003855
has title: Tomcat6 problems and PermGen space
has answer: http://stackoverflow.com/a/54304752
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: servlets
tagged with: tomcat6
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/23468723
favorite count: 0
has answer: http://stackoverflow.com/a/23468742

http://stackoverflow.com/a/23526915
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23511824
has body: Having 1000 students (rows) and 4 field (columns), we will run this switch 4000 times. The premise is false, but you should profile to verify. JTable uses the flyweight pattern for cell rendering, so only visible cells will be examined. This simplified example illustrates the essential mechanism. This related example scales well into the thousands of rows.
answers question: http://stackoverflow.com/q/23511824

http://stackoverflow.com/a/23598121
answers question: http://stackoverflow.com/q/23598059
upvote count: 1
type: AcceptedAnswer
has body: You could try that : listModel.removeElement(str) And don't forget to check Strings for null values !
type: Answer
has comment: http://stackoverflow.com/comment/36222708
has comment: http://stackoverflow.com/comment/36222849
has comment: http://stackoverflow.com/comment/36222806
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36222771
accepted answer of: http://stackoverflow.com/q/23598059

http://stackoverflow.com/comment/61334676
type: AnswerComment
has text: @Dave Syer In case of a 403:forbidden due to an invalid CSRF check triggered by Spring-Security, "everything" (principal, request params etc) are lost in the controller. Do you believe that this is possibly due to an error in my config or that, in that case, this behaviour is normal ? I'll create a full post on stack if necessary, depending on your answer :)
comment on: http://stackoverflow.com/a/23584691
type: Comment
score: 0

http://stackoverflow.com/q/23584629
has comment: http://stackoverflow.com/comment/36197082
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23584674
tagged with: random
answer count: 2
has comment: http://stackoverflow.com/comment/36197061
upvote count: 0
has body: For example, I have a,b,c,d, which are int variables and I need to know the way to generate one random variable. Thats a part of my code: Random rand = new Random(); int a = 1; int b = 2; int c = m.getlength()-2; int d = m.getlength()-1; int r = rand.nextInt();//I think I have to use this but I dont know how.
favorite count: 0
has comment: http://stackoverflow.com/comment/36197255
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36197050
has answer: http://stackoverflow.com/a/23584687
has title: How do I generate a random variable between 4 variables?
has comment: http://stackoverflow.com/comment/36197111
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36197049

http://stackoverflow.com/q/23565443
has comment: http://stackoverflow.com/comment/36161132
possible better answer: http://stackoverflow.com/a/23565542
has comment: http://stackoverflow.com/comment/36161039
has answer: http://stackoverflow.com/a/23565542
has answer: http://stackoverflow.com/a/23565604
has comment: http://stackoverflow.com/comment/36161789
type: Question
tagged with: object
type: AnsweredQuestion
tagged with: java
has body: SOLVED Fixed code at the end of post along with progression I apologize in advance if my question seems unclear or if I leave anything out. I'm new to programming and java, so I may not know how to phrase my questions appropriately yet. I'm going to set up what you should know in order to help me with my question, and then ask it. I'll continue editing this post if I can make things more clear. I have an array, arrStudents, of (7) Student objects: (firstName, lastName, grade) (String, String, int) getGrade() returns the grade I want to create a method that bubble sorts the array and prints, so for example, this is the output prior to sort: John Smith 90 Barack Obama 95 Al Clark 80 Sue Taylor 55 Ann Miller 75 George Bush 58 John Miller 65 and here is the sorted output Sue Taylor 55 George Bush 58 John Miller 65 Ann Miller 75 Al Clark 80 John Smith 90 Barack Obama 95 I have some code to work from, but it hasn't gotten me anywhere. Here's the example I was given with bubble sort: import java.util.Scanner; class array { public static void main (String[] args) { Scanner scan = new Scanner(System.in); int [] a = new int [100]; int i, n = 0, min, max; float total = 0; System.out.println ("Enter integers separated by blanks (&lt;Enter&gt; &lt;Ctrl-Z&gt; to end):"); while (scan.hasNext()) { a[n] = scan.nextInt(); n = n + 1; } min = a[0]; max = a[0]; for (i = 0; i &lt; n; i++) { if (max &lt; a[i]) max = a[i]; if (min &gt; a[i]) min = a[i]; total = total + a[i]; } System.out.print ("You entered " + n + " numbers: "); System.out.print ("Min = " + min + ", Max = " + max + ", Average = " + total/n); int t, swap = 0; do { swap = 0; for (i=0; i&lt;n-1; i++) if (a[i]&gt;a[i+1]) { t=a[i]; a[i]=a[i+1]; a[i+1]=t; swap++; } } while (swap&gt;0); System.out.print ("\nSorted: "); for (i=0; i&lt;n; i++) System.out.print (a[i] + " "); System.out.println (); } } I'm unable to use the array of objects with the > operator, so I I tried using arrStudents[i].getGrade(), but I'm not sure if that w…
accepted answer: http://stackoverflow.com/a/23565604
upvote count: 4
score: 0
answer count: 2
downvote count: 4
has title: Java - Bubble Sort Objects in Array
tagged with: arrays
tagged with: sorting
favorite count: 0
has comment: http://stackoverflow.com/comment/36161183

http://stackoverflow.com/a/23553910
upvote count: 3
answers question: http://stackoverflow.com/q/23456383
type: AcceptedAnswer
downvote count: 0
has body: I've identified the problem....and it was really simple. changed the following: @Override protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception { auth.jdbcAuthentication().dataSource(dataSource).passwordEncoder(passwordEncoder); } to the below @Override protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(customUserService).passwordEncoder(passwordEncoder).and jdbcAuthentication().dataSource(dataSource); } moved it from HttpSecurity configuration.
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/23456383

http://stackoverflow.com/comment/36128545
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23547404
has text: "My understanding is that a package is just like another folder in that java program that it can access" This is a very broad statement, as well as your answer, containing no explination. The OP never specified the directory of where his images were, and as I said, your answer teaches him nothing (it actually encourages c&p). I asked about something relevant, no need to be a peeskillet, buddy..
type: AnswerComment

http://stackoverflow.com/comment/36008352
type: Comment
has text: Thank you very much @jdiver. I applied what you have said but it still gives me this error: Multiple markers at this line - The method readValue(JsonParser, Class<T>) in the type ObjectMapper is not applicable for the arguments (URI, Class<City>) - The method readValue(JsonParser, Class<T>) in the type ObjectMapper is not applicable for the arguments (URI, Class<City>)
comment on: http://stackoverflow.com/a/23479462
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36130061
type: AnswerComment
comment on: http://stackoverflow.com/a/23548766
type: Comment
score: 1
has text: Bit overkill , I would have gone for creating a simple properties file. http://stackoverflow.com/questions/9670738/reading-and-writing-properties-file-in-a-java-swing-application

http://stackoverflow.com/a/25346233
answers question: http://stackoverflow.com/q/23566823
has body: You can expose the OSB proxy service either as an http/https service and make your ADF application post to this and do the required function. Regards, Sajeev
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23566823
upvote count: 1
score: 1

http://stackoverflow.com/comment/36072323
score: 0
type: AnswerComment
type: Comment
has text: every APK is a packaged Android project. Every APK should have a manifest file. android:minSdkVersion is the parameter that sets minimal device version. You should look at that. But most likely it is less than 16
comment on: http://stackoverflow.com/a/23518000

http://stackoverflow.com/q/23532063
has comment: http://stackoverflow.com/comment/36100064
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36099829
has answer: http://stackoverflow.com/a/23532493
favorite count: 0
has title: NoSuchMethodError exception for backtype.storm.topology.TopologyBuilder.setBolt method
has answer: http://stackoverflow.com/a/26368534
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/56146813
has body: When trying to run the Getting Started with Storm example code (https://github.com/storm-book/examples-ch03-topologies): &gt; storm jar target/Topologies-0.0.1-SNAPSHOT.jar countword.TopologyMain src/main/resources/words.txt I am getting the following exception: Exception in thread "main" java.lang.NoSuchMethodError: backtype.storm.topology.TopologyBuilder.setBolt(Ljava/lang/String;Lbacktype/storm/topology/IRichBolt;Ljava/lang/Integer;)Lbacktype/storm/topology/BoltDeclarer; at countword.TopologyMain.main(TopologyMain.java:23) I have checked the method signature, and all seems correct. Any insight into the issue would be greatly appreciated. Thanks!
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36141410
tagged with: apache-storm
answer count: 2

http://stackoverflow.com/comment/35954680
type: QuestionComment
comment on: http://stackoverflow.com/q/23453287
score: 6
has text: @VinceEmigh "*...seeing how you MUST override methods inherited from interfaces...*" That isn't true in Java 8. Java 8 allows you to implement methods in interfaces, which means you don't have to implement them in implementing classes. Here, `final` would have a use in preventing implementing classes from overriding the default implementation of an interface method.
type: Comment

http://stackoverflow.com/comment/36231354
type: AnswerComment
comment on: http://stackoverflow.com/a/23598813
type: Comment
has text: I modify my code with the dto.mToInte.CreateFile , I have the same problem. ---- java.lang.NoSuchMethodException: inteToM.CreateFileAction.<init>(dto.mToInte.CreateFile) in the getContructor(dto.mToInte.CreateFile.class); ----- I modify my post.
score: 0

http://stackoverflow.com/comment/35959654
comment on: http://stackoverflow.com/q/23457470
has text: tried -dates ? (-1500 in long)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23523271
has comment: http://stackoverflow.com/comment/36083914
accepted answer: http://stackoverflow.com/a/23523552
score: 0
has comment: http://stackoverflow.com/comment/36083822
has comment: http://stackoverflow.com/comment/36082398
has comment: http://stackoverflow.com/comment/36082757
answer count: 1
has comment: http://stackoverflow.com/comment/36082925
has comment: http://stackoverflow.com/comment/36082458
has comment: http://stackoverflow.com/comment/36082435
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23523552
tagged with: java
has comment: http://stackoverflow.com/comment/36082493
has body: I have to sort a list of objects by the date provided in them. My initial thought was to use a switch case. But that means a maximum of 31 cases. Here is the code im using: if (e.getSource() == btnSalesPerDay) { //int i =0; SalesTextArea.setText(""); Object[] possibilities = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"}; String dayOption = (String)JOptionPane.showInputDialog(frame,"Pick a day you wish to display the records for : ", "Catagory pick", JOptionPane.PLAIN_MESSAGE, null, possibilities,"ham"); switch(dayOption) { case 1: if(salesdata[i].day == 1) { int i =0; while (salesdata != null) { SalesTextArea.insert("\t" + salesdata[i].totalPrice, 0); SalesTextArea.insert("\t" + salesdata[i].year, 0); SalesTextArea.insert("\t" + salesdata[i].month, 0); SalesTextArea.insert("\t" + salesdata[i].day, 0); SalesTextArea.insert("\t" + salesdata[i].customerName, 0); SalesTextArea.insert("\t" + salesdata[i].salesNo, 0); SalesTextArea.insert("\n", 0); i++; } } break; case 2: if(salesdata[i].day == 2) { int i =0; while (salesdata != null) { SalesTextArea.insert("\t" + salesdata[i].totalPrice, 0); SalesTextArea.insert("\t" + salesdata[i].year, 0); SalesTextArea.insert("\t" + salesdata[i].month, 0); SalesTextArea.insert("\t" + salesdata[i].day, 0); SalesTextArea.insert("\t" + salesdata[i].customerName, 0); SalesTextArea.insert("\t" + salesdata[i].salesNo, 0); SalesTextArea.insert("\n", 0); i++; } } break; It goes on up to the 31 cases.. My question is.. is there a simpler way? Whats the most efficient way to go about this? Thanks :)
has comment: http://stackoverflow.com/comment/36082858
tagged with: switch-statement
type: Question
tagged with: case
has title: Is there an easier/shorter code for switch case in this case?
has comment: http://stackoverflow.com/comment/36082730
has comment: http://stackoverflow.com/comment/36082842
has comment: http://stackoverflow.com/comment/36083997
has comment: http://stackoverflow.com/comment/36082921
has comment: http://stackoverflow.com/comment/36082867

http://stackoverflow.com/comment/36256719
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23611085
has text: You don't use a *timestamp*, you use a version counter (per entire cache, partition or entry) - the difference is that the counter is incremented by the updater. Caches simply store the version count with their entry - they "validate" the entry by checking the store version is the same as the updater provides for that item (sort of how modCount works in collections and their iterators). Entries would only be detected as invalid if they are actually requested, a *local* cache could/should only be accessed by its worker thread (that would allow you to omit all locking there).

http://stackoverflow.com/comment/36193145
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23581545
type: Comment
has text: Refer this SO question: http://stackoverflow.com/questions/12618038/why-to-use-handlers-while-runonuithread-does-the-same Using `runOnUiThread` ensures that your code will run in the UI thread.

http://stackoverflow.com/q/23474460
has comment: http://stackoverflow.com/comment/35990810
score: -2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35990821
tagged with: java
downvote count: 2
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36031270
has body: I'm confused about Synchronized Methods. Is like that threads,or synchronized methods have special properties then different from threads? I read that code segment and I think synchronized mean thread. Can someone explain the difference between thread with synchronized Methods? Of course,if they have difference. synchronized method = monitor: class Account { private double balance; public Account (double initialDeposit) { balance = initialDeposit; } public synchronized double getBalance() { return balance; } public synchronized void deposit(double amount) { balance += amount; } public synchronized void withdraw(double amount) { balance -= amount; } }
type: Question
has title: Do "Java Synchronized Methods" mean "threads"?
has answer: http://stackoverflow.com/a/23474664
answer count: 2
upvote count: 0
possible better answer: http://stackoverflow.com/a/23474600
tagged with: synchronized
has answer: http://stackoverflow.com/a/23474600
favorite count: 0
accepted answer: http://stackoverflow.com/a/23474664

http://stackoverflow.com/comment/36175306
has text: Yes asking if the letters "tbestse" contains alphabets needed for words "test" and "bet"
comment on: http://stackoverflow.com/q/23572785
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23507869
answers question: http://stackoverflow.com/q/23507829
has comment: http://stackoverflow.com/comment/36053982
score: 0
type: Answer
has body: Store each number in a map: Map&lt;Integer, Integer&gt; numberCounts = new HashMap&lt;&gt;(); int n = 7; int limit = 100; Map&lt;Integer, Integer&gt; numberCounts = new HashMap&lt;&gt;(); Random random = new Random(); for (int i = 0 ; i &lt; n; i++) { int randNum = random.nextInt(limit); Integer count = numberCounts.get(randNum); if (count == null) { count = Integer.valueOf(1); } else { count = count.intValue() + 1; } numberCounts.put(randNum, count); } for (Map.Entry&lt;Integer, Integer&gt; entry : numberCounts.entrySet()) { System.out.println(entry.getKey() + " came up " + entry.getValue() + ((entry.getValue() &gt; 1) ? " times" : " time")); }
has comment: http://stackoverflow.com/comment/36054576
has comment: http://stackoverflow.com/comment/36054533

http://stackoverflow.com/comment/36082708
score: 3
has text: Profile your application and/or add some logging to find precisely where the bottlenecks are.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23523407

http://stackoverflow.com/comment/36094965
has text: @jpsf Done. I put both the user and system limits.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23529359

http://stackoverflow.com/comment/36174365
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23509422
has text: My point is that you can't see what you have done in another thread. This has nothing to do with Spring or the transaction manager that you use. Even if in some edge case, there's a way to make it work, a transaction is private to its thread.

http://stackoverflow.com/comment/36177361
has text: Thanks! Unfortunately the application uses Java 6 and cannot be changed. Any suggestions with Java 6?
type: QuestionComment
comment on: http://stackoverflow.com/q/23573937
type: Comment
score: 0

http://stackoverflow.com/a/23568524
has body: I wouldn't know too much but at a guess i would approach it like this: String string="something"; Byte[] byteArray=string.getbytes(); //split the byte array into two one for each image. probably want something different than what i did. int count=0 Byte[] bytes1=new Bytes[byteArray.length]; Byte[] bytes2=new Bytes[byteArray.length]; for(Byte b:byteArray){ bytes1[count]=b*0.2; bytes2[count]=b*0.8; count++; } //init images BufferedImage img1 = new BufferedImage(bytes1.length, 1,BufferedImage.TYPE_INT_RGB); BufferedImage img2 = new BufferedImage(bytes1.length, 1,BufferedImage.TYPE_INT_RGB); //put bytes into pixels as int int count=0; for(Byte b: bytes1){ img1.setRGB(0, count, (int)b); count++;} count=0; for(Byte b: bytes2){ img2.setRGB(0, count, (int)b); count++; } then get the two images pixels parse the rgb value back into byte and and reverse your separation process, to decode.
type: Answer
answers question: http://stackoverflow.com/q/23568114
score: 0

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/23608166
tags question: http://stackoverflow.com/q/23552126
tags question: http://stackoverflow.com/q/23483786
tags question: http://stackoverflow.com/q/23478347
tags question: http://stackoverflow.com/q/23556472
type: Tag
tags question: http://stackoverflow.com/q/23554966
tags question: http://stackoverflow.com/q/23479355
tags question: http://stackoverflow.com/q/23505305
tags question: http://stackoverflow.com/q/23495420
tags question: http://stackoverflow.com/q/23570314
tags question: http://stackoverflow.com/q/23457419
tags question: http://stackoverflow.com/q/23594663
tags question: http://stackoverflow.com/q/23591034
tags question: http://stackoverflow.com/q/23457488
tags question: http://stackoverflow.com/q/23463951
tags question: http://stackoverflow.com/q/23481017

http://stackoverflow.com/q/23543978
type: UnansweredQuestion
has body: I'm using Apache James version 3.0-beta1 and I would like to know if there is a way to save separately the body of the e-mails from the attachments. Right now both of them are saved inside the DB, that leads to a noticeable increase in the table size due to the fact that all the attachments are saved inside the MAIL_BYTES column in the shape of a byte stream. Is there a way to move outside the DB the attachments and leave inside the DB only the body of the emails? On the long run this default behaviour will make my DB collapse.
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: apache
downvote count: 0
has title: Apache James Mail Server - Save attachments on filesystem
tagged with: jakarta-mail
answer count: 1
tagged with: james
favorite count: 0
has answer: http://stackoverflow.com/a/24031618

http://stackoverflow.com/q/23584563
has answer: http://stackoverflow.com/a/23584856
tagged with: println
favorite count: 0
score: 33
type: Question
has answer: http://stackoverflow.com/a/44672270
has answer: http://stackoverflow.com/a/51329720
possible better answer: http://stackoverflow.com/a/23615373
has answer: http://stackoverflow.com/a/23588004
has answer: http://stackoverflow.com/a/23615373
linked to: http://stackoverflow.com/q/3615721
has body: I'm trying to print the test data used in webdriver test inside a print line in Java I need to print multiple variables used in a class inside a system.out.print function (printf/println/whatever). public String firstname; public String lastname; firstname = "First " + genData.generateRandomAlphaNumeric(10); driver.findElement(By.id("firstname")).sendKeys(firstname); lastname = "Last " + genData.generateRandomAlphaNumeric(10); driver.findElement(By.id("lastname")).sendKeys(lastname); I need those print in a print statement as: First name: (the variable value I used) Last name: (the variable value I used) Using something like below gives the exact result. But I need to reduce the number of printf lines and use a more efficient way. System.out.printf("First Name: ", firstname); System.out.printf("Last Name: ", lastname); Thanks!
tagged with: java
downvote count: 2
accepted answer: http://stackoverflow.com/a/23588004
has comment: http://stackoverflow.com/comment/36196945
answer count: 5
tagged with: printf
has title: How to print multiple variable lines in Java
type: AnsweredQuestion
upvote count: 35

http://stackoverflow.com/q/23593392
score: 0
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/23593566
has body: Ok so this is a prototype of a app I'm building . I have added the code and image of what the problem is I want the correct data to display in the correct column so what I labeled as 1 in the image should be in the second row under title , what I labeled as 2 in the image should be in the second row under studio ect . can any one see where I went wrong? There are other issues with the app like the JMenuBar but ill address that later in a new question, thanks! //Date : 11-05-2014 import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; public class DVD extends JFrame implements ActionListener { //construct components JLabel sortPromt= new JLabel("Sort by:"); JComboBox fieldCombo= new JComboBox(); JTextPane textPane = new JTextPane(); //initalize data in arrays String title[]={"Casablanca", "Citizen Kane", "Singin in the rain", "The wizzard of Oz"}; String studio[]={"Wanner Brothers", "RKO Pictures", "MGM", "MGM"}; String year[]={"1942", "1941", "1952", "1939"}; //construct an instance of DVD public DVD() { super("Classic on DVD"); } //create the menu system public JMenuBar createMenuBar() { ///create instance of menu bar JMenuBar mnuBar =new JMenuBar(); setJMenuBar(mnuBar); //Construct and Populate the File menu JMenu mnuFile = new JMenu("File",true); mnuFile.setMnemonic(KeyEvent.VK_F); mnuFile.setDisplayedMnemonicIndex(0); mnuBar.add(mnuFile); JMenuItem mnuFileExit =new JMenuItem("Exit"); mnuFileExit.setMnemonic(KeyEvent.VK_E); mnuFileExit.setDisplayedMnemonicIndex(1); mnuBar.add(mnuFileExit); mnuFileExit.setActionCommand("Exit"); mnuFileExit.addActionListener(this); //construct and pop the edit menu JMenu mnuEdit = new JMenu("Edit",true); mnuEdit.setMnemonic(KeyEvent.VK_E); mnuEdit.setDisplayedMnemonicIndex(0); mnuBar.add(mnuEdit); JMenuItem mnuEditInsert = new JMenuItem("Insert New DVD"); mnuEditInsert.setMnemonic(KeyEvent.VK_I); mnuEditInsert.setDisplayedMnemonicIndex(1); mnuBar.add(mnuEditInsert); mnuEditInsert.setActionComman…
has title: JTextPane issues while printing values from array to Java Swing Application
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23593566
tagged with: java
tagged with: jtextpane
tagged with: swing
type: Question

http://stackoverflow.com/a/23602227
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23602002
has comment: http://stackoverflow.com/comment/36230128
has comment: http://stackoverflow.com/comment/36229984
has comment: http://stackoverflow.com/comment/36230574
has comment: http://stackoverflow.com/comment/36230318
type: Answer
score: 2
downvote count: 0
has body: The problem is ensuring that Big Providers (like: Yahoo, Gmail, Hotmail) accepts email sent from your server. Email Deliverability issues are the reason why people tends to buy a paid services. If you setup own mail server, you must consider at least: Setup mail daemon for receiving and sending (like Apache James) Setup DNS related things like SPF, DKIM, PTR-record, etc Rate limited sending, some provider doesn't like when you throw 1000 email at once. Bounce management (e.g. you must stop delivering email to dead account) Spam/Virus Filtering (you don't want to receiving too many spam) Note: Paid services may added several facilities like nice Statistics Dashboard.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23602002

http://stackoverflow.com/comment/36089478
type: Comment
comment on: http://stackoverflow.com/a/23526248
has text: Thanks to both of you, I queried the API from within my app to get the available tax codes. I accepted @Manas answer only because you have more rep than him ;)
type: AnswerComment
score: 0

http://stackoverflow.com/q/23543971
has title: Java file operations
linked to: http://stackoverflow.com/q/2131444
has comment: http://stackoverflow.com/comment/36121151
upvote count: 2
has answer: http://stackoverflow.com/a/23544208
has answer: http://stackoverflow.com/a/23544237
has comment: http://stackoverflow.com/comment/36121046
duplicate of: http://stackoverflow.com/q/2131444
downvote count: 1
possible better answer: http://stackoverflow.com/a/23544088
tagged with: parsing
has answer: http://stackoverflow.com/a/23544113
favorite count: 0
has answer: http://stackoverflow.com/a/23544088
has comment: http://stackoverflow.com/comment/36121499
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
has body: I'm doing an assignment using Java, and our lecturers provided an example code for us. I'm unable to understand some of the code so can anyone explain? private long magic; private int minor; magic = file.readUnsignedShort() &lt;&lt; 16 | file.readUnsignedShort(); mnior = file.readUnsignedShort(); I don't understand why did he use "readUnsignedShort" for both of them and why did he add "&lt;&lt; 16 | file.readUnsignedShort()" for magic. Any help will be much appreciated
type: Question
accepted answer: http://stackoverflow.com/a/23544237
has comment: http://stackoverflow.com/comment/36121000
has comment: http://stackoverflow.com/comment/36121156

http://stackoverflow.com/comment/36167746
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23561149
type: QuestionComment
has text: Maybe you should be a little bit clearer what shutdown an application means to you: Marked as stopped in an administration tool (hard), or only take no requests (simple with a ServletFilter). But however to me it still looks harder to recognize deployment problems. Especially if you want to *reliably* recognize *all* of them

http://stackoverflow.com/a/23562806
accepted answer of: http://stackoverflow.com/q/23562757
answers question: http://stackoverflow.com/q/23562757
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: Before calling the nextInt method, you can use the hasNextInt() method on the scanner object to check if there is a value to get, which can be used to avoid exception. Try this: if (kb.hasNextInt()){ lengthTail = kb.nextInt(); } In your case, I think you are not providing enough inputs, which could lead to NoSuchInputException. Have a look at the Scanner class doc for more information.

http://stackoverflow.com/q/23484152
possible better answer: http://stackoverflow.com/a/23500283
tagged with: jsf-2.2
tagged with: jsf
linked to: http://stackoverflow.com/q/19262356
has answer: http://stackoverflow.com/a/23500283
has answer: http://stackoverflow.com/a/23530889
accepted answer: http://stackoverflow.com/a/23530889
tagged with: jakarta-ee
type: AnsweredQuestion
has title: p:fileUpload doesn't work with p:commandButton
tagged with: primefaces
tagged with: java
has body: I'm having a problem with firing an action with a p:commandButton when there's a p:fileUpload on my page: Here's the p:fileUpload &lt;p:fileUpload auto="true" update="seqForm:sequence1" allowTypes="/(\.|\/)(txt)$/" fileUploadListener="#{fileUploadController.fileUploadListener1}" /&gt; and the p:commandButton: &lt;p:commandButton id="submitButton" value="Submit!" action="#{submitAction.actionTest}" update="seqForm:content" /&gt; When I add the fileUpload component to the page, its listener gets normally fired. However, the action of the commandButton doesn't work. If i remove the fileUpload from the page, the action from the button works fine. Is it a bug or something I still haven't discovered? Thanks in advance.
type: Question
score: 0
answer count: 2

http://stackoverflow.com/comment/36133090
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23549604
has text: this would be a sort of masking, as I am sending the message on behalf of someone else -- a user.
type: AnswerComment

http://stackoverflow.com/a/23515714
has comment: http://stackoverflow.com/comment/36094167
has comment: http://stackoverflow.com/comment/36093623
score: 1
has comment: http://stackoverflow.com/comment/36126762
upvote count: 1
answers question: http://stackoverflow.com/q/23506516
has comment: http://stackoverflow.com/comment/36127017
downvote count: 0
has body: Either handle it manually or add a reverse relationship @OneToMany(orphanRemoval=true) in Obj1.
type: Answer

http://stackoverflow.com/comment/36209910
comment on: http://stackoverflow.com/q/23591490
score: 0
type: Comment
type: QuestionComment
has text: @user3623843 your classes must be available in the web application WEB-INF/lib in a jar or in WEB-INF/classes (if it's not in a jar). These are the default classpath for a web app.

http://stackoverflow.com/q/23479848
tagged with: android
has answer: http://stackoverflow.com/a/23479966
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23480971
tagged with: java
upvote count: 1
downvote count: 1
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23479966
has body: As the title reads, I am unsure if what I have created is a separate thread or not. I have used a Handler, and a Runnable and such, but I don't know what counts as a thread and what doesn't. My code: Handler hand = new Handler(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set full-screen requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.mainlayout); // Initialize variables from popup window LayoutInflater inflater = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); PopupWindow pw = new PopupWindow(inflater.inflate(R.layout.storemenu, null, false)); storeDismiss = (Button) pw.getContentView().findViewById( R.id.menudismissid); prefs = getSharedPreferences("LeagueClicker", Context.MODE_PRIVATE); goldCount = (long) prefs.getFloat("goldCount", 0.0f); textGoldCount = (TextView) findViewById(R.id.textviewtop); textGoldCount.setText(goldCount + " Gold"); textGoldCount.setGravity(Gravity.CENTER); Typeface tf = Typeface.createFromAsset(getAssets(), "mechanical.ttf"); textGoldCount.setTypeface(tf); textGoldCount.setTextSize(35); // Linking the variables minionClick = (Button) findViewById(R.id.minioncentreid); storeClick = (Button) findViewById(R.id.storeimageid); spinningBars = (ImageView) findViewById(R.id.spinningbarsid); // Setting onClickListeners minionClick.setOnClickListener(this); storeClick.setOnClickListener(this); storeDismiss.setOnClickListener(this); // Begin animation of bars Animation rotation = AnimationUtils.loadAnimation(this, R.anim.spinningbarsanimation); rotation.setRepeatCount(Animation.INFINITE); spinningBars.startAnimation(rotation); hand.postDelayed(run, 1000); /*goldPerSecondMethod();*/ } Runnable run = new Runnable() { @Override public void run() { // TODO Auto-generated method stub longSwordPerSecond(); } }; public void longSwordPerSecond()…
score: 0
tagged with: handler
tagged with: runnable
has title: Have I created a thread?
favorite count: 0
has answer: http://stackoverflow.com/a/23480971
tagged with: multithreading

http://stackoverflow.com/comment/36074254
comment on: http://stackoverflow.com/q/23519125
type: Comment
type: QuestionComment
has text: It would be easier to upgrade your spring to version 4.
score: 2

http://stackoverflow.com/q/23488519
has title: Akka- How to scale when using TimerBasedThrottler and RoundRobinRouter
type: AnsweredQuestion
score: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/23511451
type: Question
has answer: http://stackoverflow.com/a/25931107
answer count: 2
tagged with: akka
downvote count: 0
possible better answer: http://stackoverflow.com/a/25931107
has answer: http://stackoverflow.com/a/23511451
favorite count: 0
upvote count: 2
tagged with: throttling
has body: I have a design whereby a Supervisor Actor creates an Actor based on the Akka TimerBasedThrottler class. This Actor dynamically creates child Actors to execute web service requests to upstream systems. This works fine at small scale however as the number of requests start to build up my Actor mailboxes start to grow and response times deteriorate. What i need is the ability to create a RoundRobinRouter which will load balance requests to more than one instance of the Supervisor. However i need the TimerBasedThrottler to be a single instance which is shared by each Actor instance created by the RoundRobinRouter. Can someone help me with how i can use the RoundRobinRouter to create new supervisor Actor instances passing in a single instance of the TimerBasedThrottler?

http://stackoverflow.com/comment/36164054
comment on: http://stackoverflow.com/q/23552791
score: 0
has text: Try using `strace` to see what is going on with `open()`, `read()` and other system calls.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23559150
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/23559309
has comment: http://stackoverflow.com/comment/36150519
has body: I'm developing two spring web application and I would want deploy it on apache tomcat 8.0.3. Now my trouble is that if I put one of the web applications in webapp folder (through tomcat7:deploy) everything work, but if I put both of them in the webapps folder, then only one of the two applications will work. If I try to load the application that does not work and I get a 404 error. This is the webapp folder structure: > $CATALINA_HOME/webapps/ > $CATALINA_HOME/webapps/MyApp1/ > $CATALINA_HOME/webapps/MyApp1/... > $CATALINA_HOME/webapps/MyApp2/ > $CATALINA_HOME/webapps/MyApp2/... I try to access through the following urls: > http://localhost:8080/MyApp1 > http://localhost:8080/MyApp2 web.xml of MyApp1: <?xml version="1.0" encoding="UTF-8"?> MyApp1 contextConfigLocation classpath*:spring-MyApp1-context.xml org.springframework.web.context.ContextLoaderListener org.springframework.web.util.Log4jConfigListener org.springframework.web.context.request.RequestContextListener 30 MyApp1Servlet it.myCompany.servlet.springVaadin.AutowiringApplicationServlet Vaadin UI class to use UI it.myCompany.vaadin.application.myApplication MyApp1Servlet /* web.xml of MyApp2: <?xml version="1.0" encoding="UTF-8"?> MyApp2 contextConfigLocation classpath*:spring-MyApp2-context.xml org.springframework.web.util.Log4jConfigListener org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener MyApp2Servlet it.myCompany.servlet.springVaadin.AutowiringApplicationServlet Vaadin UI class to use UI it.myCompany.vaadin.application.myUI MyApp2Servlet /* 30 This is my catalina.out: 09-May-2014 09:24:24.956 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. INFO Con…
has comment: http://stackoverflow.com/comment/36149527
has comment: http://stackoverflow.com/comment/36151698
score: 0
answer count: 3
has title: Multiple web app in Tomcat
has comment: http://stackoverflow.com/comment/36153116
has answer: http://stackoverflow.com/a/23566730
accepted answer: http://stackoverflow.com/a/23566730
has comment: http://stackoverflow.com/comment/36150376
has comment: http://stackoverflow.com/comment/36150805
linked to: http://stackoverflow.com/q/2437465
tagged with: tomcat7
tagged with: spring
linked to: http://stackoverflow.com/q/5014651
has comment: http://stackoverflow.com/comment/36152326
has answer: http://stackoverflow.com/a/23559309
has comment: http://stackoverflow.com/comment/36149756
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36156122
has comment: http://stackoverflow.com/comment/36149661
tagged with: java
has comment: http://stackoverflow.com/comment/36150485
has comment: http://stackoverflow.com/comment/36150005
type: Question
has comment: http://stackoverflow.com/comment/36149545
has answer: http://stackoverflow.com/a/23559252

http://stackoverflow.com/q/23521691
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
answer count: 1
upvote count: 3
favorite count: 0
tagged with: ibm-mq
has body: I am trying to connect a queue manager from a standalone program and am getting the following error. Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED'). I understand that the connecting ID needs to be configured at the MQ to allow this connection. But strangely, when I try to connect from Websphere Application Server (WAS), I am successfully connected to the queue. My standalone program is using the same JDK as WAS. Should the JVM ID for both these programs be the same? I am using a CCDT file to connect to the queue.
has answer: http://stackoverflow.com/a/23527100
accepted answer: http://stackoverflow.com/a/23527100
has title: Connecting IBM MQ from a Standalone program | Error: ('MQRC_NOT_AUTHORIZED')

http://stackoverflow.com/comment/36022978
comment on: http://stackoverflow.com/q/23485363
type: Comment
type: QuestionComment
score: 1
has text: Aren't you missing a bracket in `driver.findElement(By.id("repassword")).sendKeys);`?

http://stackoverflow.com/a/23585064
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23583460
has comment: http://stackoverflow.com/comment/36210713
has comment: http://stackoverflow.com/comment/36198468
has body: To answer the original question about using a Layout Manager, you can try reading through the Java tutorial here: Swing Group Layout Here's some simple starter code to help you get a basic understanding of how to rearrange your components in a single row, horizontally: ... /* when you add components to the layout, it will automatically add them to your mainPanel, so the following is unnecessary. mainPanel.add(application1); mainPanel.add(application2); mainPanel.add(application3); */ frame.add(mainPanel); GroupLayout layout = new GroupLayout(mainPanel); mainPanel.setLayout(layout); //set margins around components by default layout.setAutoCreateContainerGaps(true); layout.setAutoCreateGaps(true); layout.setHorizontalGroup(layout.createSequentialGroup() .addComponent(application1) .addComponent(application2) .addComponent(application3)); layout.setVerticalGroup(layout.createParallelGroup() .addComponent(application1) .addComponent(application2) .addComponent(application3)); The link above has pictures to better visualize how the layout manager interprets horizontal and vertical groups.
has comment: http://stackoverflow.com/comment/36198298

http://stackoverflow.com/q/23461729
tagged with: android
tagged with: java
type: Question
has body: What I'm trying to do is, making a game object move slower when a certain score is reached. I'm trying to do so with the help of boolean. There´s the score. public boolean bol = false; And there´s my bool. if(score == 2) { bol = true; } Here´s the statement. if(gw.bol = true) { acceleration = new Vector2(0, 200); } And if bol is true (which it will be when the user reaches the score 2?) then should the acceleration became that new one I wrote? But when I run the code I get: Exception in thread "LWJGL Application" java.lang.NullPointerException at com.kilobolt.GameObjects.Bird.&lt;init&gt;(Bird.java:31) at com.kilobolt.GameWorld.GameWorld.&lt;init&gt;(GameWorld.java:32) at com.kilobolt.Screens.GameScreen.&lt;init&gt;(GameScreen.java:25) at com.kilobolt.ZombieBird.ZBGame.create(ZBGame.java:13) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
tagged with: boolean
score: 0
has answer: http://stackoverflow.com/a/23461756
has comment: http://stackoverflow.com/comment/35968279
has title: Android game java boolean solution
answer count: 1
has comment: http://stackoverflow.com/comment/35967801
type: UnansweredQuestion

http://stackoverflow.com/comment/36137429
type: QuestionComment
has text: Alternately, SEARCH BEFORE ASKING. Because there's a question with almost exactly the same title. And it's answered with a workaround for 1.4.
comment on: http://stackoverflow.com/q/23552303
score: 0
type: Comment

http://stackoverflow.com/comment/36102771
comment on: http://stackoverflow.com/a/23532654
score: 0
type: AnswerComment
has text: Corrected those errors and it's still not displaying correctly. Thank you for catching those though, my eyes are crossing.
type: Comment

http://stackoverflow.com/comment/35996816
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23459513
has text: startActivity? Do you mean onCreate()? I am sorry, I am a college student doing my school project....

http://stackoverflow.com/q/23501244
tagged with: java
has answer: http://stackoverflow.com/a/23506015
accepted answer: http://stackoverflow.com/a/23506015
tagged with: maven
score: 19
type: Question
has answer: http://stackoverflow.com/a/23664965
tagged with: database
has comment: http://stackoverflow.com/comment/105939909
has answer: http://stackoverflow.com/a/55334003
has answer: http://stackoverflow.com/a/35370050
upvote count: 19
has body: I'm trying to start using flyway with maven integration but can't make it work. I'm following the documentation seems to be very simple so no strange things seem to be done. My pom.xml is the following: 4.0.0 com.test test 0.0.1-SNAPSHOT org.flywaydb flyway-maven-plugin 3.0 jdbc:mysql://localhost:3306/test test_fede test_fede mysql mysql-connector-java 5.1.21 com.google.guava guava 13.0.1 mysql mysql-connector-java 5.1.21 junit junit 4.8.1 compile I have the directory resources/db/migration/ without any migration yet. When I issuing flyway:info on cygwin or cmd I got an flyway error: $ mvn compile flyway:info [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Unnamed - com.test:test:jar:0.0.1-SNAPSHOT [INFO] task-segment: [compile, flyway:info] [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources {execution: default-resources}] [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] Copying 0 resource [INFO] [compiler:compile {execution: default-compile}] [INFO] Nothing to compile - all classes are up to date [INFO] [flyway:info {execution: default-cli}] [INFO] Database: jdbc:mysql://localhost:3306/test (MySQL 5.5) [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] org.flywaydb.core.api.FlywayException: Unable to scan for SQL migrations in location: classpath:db/migration Embedded error: Unable to determine URL for classpath location: db/migration (ClassLoader: org.codehaus.classworlds.RealmClassLoader@5bcdbf6) [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total t…
has answer: http://stackoverflow.com/a/49947089
tagged with: flyway
answer count: 7
has answer: http://stackoverflow.com/a/47240666
favorite count: 0
has comment: http://stackoverflow.com/comment/115940022
linked to: http://stackoverflow.com/q/55328817
possible better answer: http://stackoverflow.com/a/23664965
has answer: http://stackoverflow.com/a/57901004
type: AnsweredQuestion
downvote count: 0
has title: FlywayException: Unable to scan for SQL migrations in location: classpath:db/migration

http://stackoverflow.com/q/23553880
tagged with: java
has title: Find process and write to it
has comment: http://stackoverflow.com/comment/36140090
type: Question
has comment: http://stackoverflow.com/comment/36140125
downvote count: 0
score: 1
has body: I want to find a process and write to it in Java. I'm running a program with: Runtime.getRuntime().exec("cmd /c start C:\\myProgram.exe -command"); I've tried to use OutputStream, which doesn't seem to work for my program. My guess is that my program creates a new process which I can't access from the one I made. (The program is a game if it's of any need) So, I want to fetch the process by using it's ID or name which I'm able to fetch, but I can't figure out how to get the process object. Any ideas?
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: process
upvote count: 1
has comment: http://stackoverflow.com/comment/36140059
has comment: http://stackoverflow.com/comment/36140073
has comment: http://stackoverflow.com/comment/36140441

http://stackoverflow.com/q/23566575
has comment: http://stackoverflow.com/comment/36163492
has comment: http://stackoverflow.com/comment/36164380
has comment: http://stackoverflow.com/comment/36163358
has title: symbol cannot be found java
has comment: http://stackoverflow.com/comment/36163712
favorite count: 0
score: -3
has answer: http://stackoverflow.com/a/23566675
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36163542
has answer: http://stackoverflow.com/a/23566695
has comment: http://stackoverflow.com/comment/36163331
accepted answer: http://stackoverflow.com/a/23566695
has comment: http://stackoverflow.com/comment/36163950
tagged with: java
has comment: http://stackoverflow.com/comment/36163347
upvote count: 1
has comment: http://stackoverflow.com/comment/36163656
type: Question
has comment: http://stackoverflow.com/comment/36163180
has comment: http://stackoverflow.com/comment/36163158
has comment: http://stackoverflow.com/comment/36163286
possible better answer: http://stackoverflow.com/a/23566675
has comment: http://stackoverflow.com/comment/36163428
downvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/36163472
has body: I am just starting to learn some java guyz this was my first class to create and am stuck i keep getting an error like symbol not found when i try to compile the class NameTest.java classes.java public class classes { // defining classes public class Name { //class members or variables or fields private String first; private String middle; private String last; //constructor methods public Name(String f, String m, String l) { // assigning letters first = f; middle = m; last = l; } //default constructor has no parameters public Name() { first = ""; middle = ""; last = ""; } public String toString() { return first + " " + middle + " " + last; } /* class methods method name(public) method return type string and method name displayName methods r like operations in a class */ public String displayName() { return first + " " + middle + " " + last; } public String getInitials() { //substring for getting a sub sting in a string //(0,1) 0 is for the position for the character in a sting // 1 is the number of characters to b pulled from a substring return first.substring(0,1) + middle.substring(0,1) + last.substring(0,1); } } public static void main(String[] args) { } } NameTest.java public class NameTest { public static void main(String[] args) { //instantiation Name myName = new Name("smart", "daniel", "zulu"); Name yourName = new Name("daniel", "Zulu"); Name aName = new Name("Zulu"); System.out.println("myName: " + myName.toString()); } } i need some assistance on how to solve the error

http://stackoverflow.com/comment/36220516
comment on: http://stackoverflow.com/a/23597042
type: AnswerComment
has text: @MarcoAcierno I think it's just better way of presenting code. but yes it can be written by returning just one long string. It's matter of own choice. :)
score: 0
type: Comment

http://stackoverflow.com/comment/36032251
comment on: http://stackoverflow.com/q/23495260
has text: yes I am, but I also tested it in an environment where I do not use a proxy and it still does not work. So it can't be this
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36099535
type: Comment
type: QuestionComment
has text: @vkg I'm not sure what you mean. This jar I'm talking about is a library that I've imported. My code is definitely separated from it.
score: 0
comment on: http://stackoverflow.com/q/23531157

http://stackoverflow.com/comment/56513715
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23464794
has text: @Shorn I hope returning Optional from a private method instead of null is also a valid case just like a public API. correct?

http://stackoverflow.com/a/23502355
accepted answer of: http://stackoverflow.com/q/23502167
downvote count: 0
answers question: http://stackoverflow.com/q/23502167
has body: You forgot setTransactionSuccessful(). Calling endTransaction() without it rolls back any changes done within the transaction. The preferred, exception-safe pattern to handle transactions is beginTransaction(); try { // db operations... setTransactionSuccessful(); // didn't throw so far } finally { endTransaction(); // rollback or commit }
type: AcceptedAnswer
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/36013885
score: 0
has text: I mean the "at In.readAll(In.java:244)" line.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23486247

http://stackoverflow.com/comment/36400222
has text: Couldn't figure this out still, program was due this week so we just made note to the grader and asked him to grade it on a Linux machine which was no problem. Strange bug, I might look into it more this summer as I'm still curious.
comment on: http://stackoverflow.com/a/23511818
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23600107
duplicate of: http://stackoverflow.com/q/2797162
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23600340
has answer: http://stackoverflow.com/a/23600474
upvote count: 1
has comment: http://stackoverflow.com/comment/36227116
type: Question
score: 1
tagged with: java
has body: In my package com.foo.bar, I have two files, Config.java and config.properties. At the top of Config, I'm trying to read config.properties and set some internal variables: public class Config { public static String foo; public static String bar; static { try { System.out.println("Loading"); InputStream is = Config.class.getClassLoader().getResourceAsStream("config.properties"); System.out.println("stream: " + is ); Properties props = new Properties(); props.load(is); foo = props.getProperty("foo"); bar = props.getProperty("bar"); is.close(); } catch (IOException e) { e.printStackTrace(); } } //snip... } Despite config.properties file existing in the same package, I get this output: Loading stream: null And then a NullPointerException on the line props.load(is). What am I doing wrong? From some googling, it seems that I'm using the correct method for reading the file. Is it because I'm doing this in a static block, that I'm having this issue?
tagged with: inputstream
answer count: 2
downvote count: 0
favorite count: 0
tagged with: nullpointerexception
linked to: http://stackoverflow.com/q/2797162
has title: Unable to read an InputStream even though the file exists

http://stackoverflow.com/q/23612135
has title: Is there any wrong with this BigDecimal calculation?
has comment: http://stackoverflow.com/comment/36249645
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36248854
type: Question
has answer: http://stackoverflow.com/a/23612330
has comment: http://stackoverflow.com/comment/36248831
tagged with: bigdecimal
score: 4
linked to: http://stackoverflow.com/q/13649703
answer count: 2
has body: I am new to BigDecimal. I tried some math calculations using Java code. When I try the same calculations using Google calculator it gives me a slightly different results. Which one is the most accurate?. If Google calculator is more accurate, then how to improve java code to match it?. On Google calculator: 134.23576185216913 - (134.23576185216913 × √(1 - (200000000^2 ÷ 299800000^2))) = 34.2357618522 On Java: BigDecimal t1 = new BigDecimal(134.23576185216913); BigDecimal one = new BigDecimal(1); BigDecimal speed = new BigDecimal(200000000).pow(2); BigDecimal lightsSpeed = new BigDecimal(299800000).pow(2); MathContext mc = new MathContext(2, RoundingMode.HALF_UP); System.out.println(t1.subtract((t1.multiply(SquareRoot.bigSqrt(one.subtract(speed.divide(lightsSpeed,mc))))))); The method of bigSqrt is from here The result is: run: 34.683856455950090090043113321827989040137639817587194953722595479211000578082422197809603912048352550091209304856567024386365147605287692511973841869226169664820176852861655846233912503305984796190828666994508412096618025960010635831985100961879858807909056676663493607611105279976694118991120829708264297254294821755138400476425886154174804687500 BUILD SUCCESSFUL (total time: 0 seconds)
has comment: http://stackoverflow.com/comment/36248927
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23612297
upvote count: 4

http://stackoverflow.com/a/23611499
score: 1
has comment: http://stackoverflow.com/comment/36262224
downvote count: 0
has comment: http://stackoverflow.com/comment/36247472
type: Answer
has body: here is an instruction use UTF-8 encoding and it will work http://stijndewitt.wordpress.com/2010/05/05/unicode-utf-8-in-eclipse-java/
upvote count: 1
answers question: http://stackoverflow.com/q/23610639

http://stackoverflow.com/q/23595722
tagged with: java
type: Question
tagged with: jboss-arquillian
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/36618452
upvote count: 4
has comment: http://stackoverflow.com/comment/38255966
linked to: http://stackoverflow.com/q/3263560
has body: I am trying to add a resource to an Arquillian shrink-wrap archive and to load it via the classpath. However, I did not manage to make it working. I tried using addAsResource() and addAsWebInfResource(). The version below is the one I think should work, but does not. Any solutions? import static org.junit.Assert.assertNotNull; import java.io.InputStream; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(Arquillian.class) public class ResourceLoadingTest { @Deployment public static WebArchive createDeployment() { WebArchive archive = ShrinkWrap.create(WebArchive.class) .addAsWebInfResource(new StringAsset("Hello World"), "classes/test.properties"); System.out.println(archive.toString(true)); return archive; } @Test public void testLoadResource() { InputStream stream = Thread.currentThread().getContextClassLoader() .getResourceAsStream("/test.properties"); assertNotNull(stream); } } Console output: 411ad6b1-7705-406f-ba05-d7f46ca14966.war: /WEB-INF/ /WEB-INF/classes/ /WEB-INF/classes/test.properties
has comment: http://stackoverflow.com/comment/40299937
answer count: 0
type: UnansweredQuestion
tagged with: jakarta-ee
tagged with: testing
downvote count: 0
has title: Loading Resource from Classpath in Arquillian Test

http://stackoverflow.com/comment/36217319
type: Comment
type: QuestionComment
has text: @RomanC: yes, I removed the jar file from the library but I get another error. See the edited question.
score: 0
comment on: http://stackoverflow.com/q/23587046

http://stackoverflow.com/comment/36054988
has text: And the if block would be entered (not the else).
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23508509

http://stackoverflow.com/q/23502606
answer count: 2
has answer: http://stackoverflow.com/a/23502846
accepted answer: http://stackoverflow.com/a/23502846
tagged with: generics
favorite count: 0
has body: The Java Guidelines for Wildcard Use says: Using a wildcard as a return type should be avoided because it forces programmers using the code to deal with wildcards. The Object getClass method returns a Class&lt;?&gt;. The various methods in Class accept a Class&lt;?&gt; and if you pass in a Class the compiler returns an unchecked warning. This leads me to think that always using Class&lt;?&gt; is preferable. If I have a method which returns a Class, and I don't know how that object will be used, which type should I return Class or Class&lt;?&gt;? Why? Are there any scenarios in which I might want to return simply Class?
score: 13
possible better answer: http://stackoverflow.com/a/23502841
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has title: Should a method return Class or Class<?>?
upvote count: 13
has comment: http://stackoverflow.com/comment/36044223
has answer: http://stackoverflow.com/a/23502841

http://stackoverflow.com/comment/36267158
score: 2
comment on: http://stackoverflow.com/q/23615451
has text: I wouldn't say obsoleted, those factory methods are a little more descriptive (`Lists.newArrayListWithCapacity(5)` instead of `new ArrayList<>(5)`), and there's no good alternative for `Lists.newArrayList("a", "b", "c")`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36040735
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23500790
has text: http://stackoverflow.com/questions/12292389/converting-key-to-string-and-back-to-key-java

http://stackoverflow.com/q/23588755
favorite count: 0
has answer: http://stackoverflow.com/a/23588796
tagged with: android
accepted answer: http://stackoverflow.com/a/23588800
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: view
tagged with: java
has title: Strange difference between EditText added in layout XML and from code
has answer: http://stackoverflow.com/a/23588800
type: Question
possible better answer: http://stackoverflow.com/a/23588796
tagged with: android-layout
has body: There is difference between text edit added in activity_main.xml and one added from code. That is how they look. Code of EditText added from xml. And code of EditText added programmatically. Function getDisplayInfo just get width and height of the screen. It does nothing connected with ui.
score: 0
answer count: 2
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/23464650
tagged with: apache
answer count: 1
has answer: http://stackoverflow.com/a/23465752
score: 0
accepted answer: http://stackoverflow.com/a/23465752
tagged with: asynchronous
has title: XML-RPC exception switching from execute to executeAsync
type: AnsweredQuestion
has body: I have the following XML-RPC implementation working which I copied and slightly modified from the apache website. public class DemoServer { public static void main (String [] args) { try { WebServer webServer = new WebServer(8080); XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer(); PropertyHandlerMapping phm = new PropertyHandlerMapping(); phm.addHandler("sample", RequestHandler.class); xmlRpcServer.setHandlerMapping(phm); XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) xmlRpcServer.getConfig(); serverConfig.setEnabledForExtensions(true); serverConfig.setContentLengthOptional(false); webServer.start(); } catch (Exception e) { e.printStackTrace(); } } } With a client: public class DemoClient { public static void main (String[] args) { try { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL("http://127.0.0.1:8080/xmlrpc")); config.setEnabledForExtensions(true); config.setConnectionTimeout(60 * 1000); config.setReplyTimeout(60 * 1000); XmlRpcClient client = new XmlRpcClient(); // set configuration client.setConfig(config); // make the a regular call Object[] params = new Object[] { new Integer(2), new Integer(3) }; //!CRITICAL LINE! Integer result = (Integer) client.execute("sample.sum", params); System.out.println("2 + 3 = " + result); } catch (Exception e) { e.printStackTrace(); } } } I run DemoServer first, and then I run DemoClient, and it prints "2 + 3 = 5". However if I change Integer result = (Integer) client.execute("sample.sum", params); to client.executeAsync("sample.sum", params, new ClientCallback()); then I get the following: In error java.lang.ExceptionInInitializerError at java.lang.Runtime.addShutdownHook(Runtime.java:192) at java.util.logging.LogManager.&lt;init&gt;(LogManager.java:237) at java.util.logging.LogManager$1.run(LogManager.java:177) at java.security.AccessController.doPrivileged(Native Method) at java.util.logging.LogManager.&lt;clinit&gt;(LogManager.java:158) at java.util.logging…
tagged with: java
tagged with: xml-rpc
type: Question

http://stackoverflow.com/a/23535245
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36105198
has body: try nowa.prac = nowa.new firma.pracownik('f','m',2); Here is more on why: http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
has comment: http://stackoverflow.com/comment/36105212
answers question: http://stackoverflow.com/q/23535133

http://stackoverflow.com/comment/36002350
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23480128
has text: Do you have maven dependencies added to your eclipse project? You can check this in Project-->Properties-->Java Build Path-->Libraries and checking if you have added Maven dependencies. if you don't see them may be your project is not being imported correctly as Maven Project
score: 0

http://stackoverflow.com/q/23595305
has answer: http://stackoverflow.com/a/23595361
tagged with: java
accepted answer: http://stackoverflow.com/a/23595361
type: Question
possible better answer: http://stackoverflow.com/a/23595338
tagged with: sorting
tagged with: arraylist
has answer: http://stackoverflow.com/a/23595338
score: 0
has comment: http://stackoverflow.com/comment/36217048
has comment: http://stackoverflow.com/comment/36217020
has answer: http://stackoverflow.com/a/23595751
has body: I have an arraylist which holds arrays of double values and I want to sort the rows for example by the third value in the field. Is there a smart way to do it? (ascending/descending) declaration: private List&lt;double[]&gt; row = new ArrayList&lt;double[]&gt;(); example: 10.0, 5.0, 200.3 9.1, 1.4, 3.3 1.1, 7.6, 3.4 sorts by the second column (asc) 9.1, 1.4, 3.3 10.0, 5.0, 200.3 1.1, 7.6, 3.4 EDIT!! later iam gonna try this but imo I have no time to test it! mby someone could verify this if (sortDir == SortDirection.ASCENDING) { Collections.sort(tabelle,new Comparator&lt;double[]&gt;() { public int compare(double[] array1, double[] array2) { return Double.compare(array1[colIds.indexOf(aColId)], array2[colIds.indexOf(aColId)]); } }); } if (sortDir == SortDirection.DESCENDING) { Collections.sort(tabelle,new Comparator&lt;double[]&gt;() { public int compare(double[] array1, double[] array2) { return Double.compare(array1[colIds.indexOf(aColId)], array2[colIds.indexOf(aColId)]); } }); Collections.reverse(tabelle); } wow soo many comments :D thanks
has title: Need help to sort an arraylist of arrays
has answer: http://stackoverflow.com/a/23595383
answer count: 4
type: AnsweredQuestion
tagged with: list

http://stackoverflow.com/comment/36203719
type: QuestionComment
has text: @Wamlab What do you want to initialize the variable to anyways? It's initialized to 0 when the class is created...
comment on: http://stackoverflow.com/q/23587953
score: 0
type: Comment

http://stackoverflow.com/comment/36067325
type: Comment
comment on: http://stackoverflow.com/a/23515532
has text: okay, but since we are working as a group using git, an absolute path will bring problems to every other member since they do not use the same folder to download to project to
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36021753
has text: You have to use **XQuery Update**. However, you will need a processor which supports XQuery Update. You should check first what technology you want to use and then come back with a **specific** question.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23480631

http://stackoverflow.com/q/23482840
upvote count: 2
has comment: http://stackoverflow.com/comment/36007385
has body: I am new to UI design and JavaFX, and due to the problem I am faced with I wonder which of these layouts will be easier to work with: The first option is one element/component per cell in the grid: The second option is using a separator for each cell in the grid: PS: if you know a easier way to handle this I would be happy to try it.
tagged with: javafx-2
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23483032
accepted answer: http://stackoverflow.com/a/23483032
tagged with: java
type: Question
has title: JavaFX layout: all in Grid vs Separator for each cell
tagged with: layout
answer count: 1
tagged with: user-interface
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36059548
has text: Will this even work if we have threads from 2 different class object [One is from legacyDAOObj and another is newDAOObj] ?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23511119

http://stackoverflow.com/comment/36214448
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23594004
score: 0
has text: It isn't though. It should, but it isn't.

http://stackoverflow.com/comment/36154106
has text: Instantiate an object of your address class in saver class. And get them via getter or something. Or instantiate an object of your save class in the address class and write the values to the array via your addresspool method.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23561871
score: 0

http://stackoverflow.com/comment/36049780
type: Comment
has text: so it's from the keyboard, i suppose?
type: QuestionComment
comment on: http://stackoverflow.com/q/23505330
score: 0

http://stackoverflow.com/q/23571405
answer count: 1
accepted answer: http://stackoverflow.com/a/23571701
has body: I know how to do it "brutally" but I am wondering of a smart and short way to read xml parameters from a string: x="0" y="0" width="30" height="64" Do you have any ideas? I want to create a very small and fast method like: int getValue(String string, String key)
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36172812
type: Question
tagged with: parameters
has answer: http://stackoverflow.com/a/23571701
has comment: http://stackoverflow.com/comment/36172297
has title: The shortest possible xml attribute read
tagged with: java
score: 0

http://stackoverflow.com/a/23549803
has body: As others have mentioned, you can use serialization to persist the state of the object, or you could read / write the value to something like a properties file. While these will work I'm not sure its the best solution for what you are trying to to. If you are trying to keep track of a build number for your application, typically that would be kept as a static value from within your project and only change every time you truly deploy your app, whether it be a release/snapshot/etc. Hope that helps.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23548720

http://stackoverflow.com/comment/48859157
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23520416
has text: were you able to resolve this?

http://stackoverflow.com/comment/35987450
has text: but the problem is not the hasChange
comment on: http://stackoverflow.com/a/23469000
score: 0
type: AnswerComment
type: Comment

android-intent
tags question: http://stackoverflow.com/q/23527378
tags question: http://stackoverflow.com/q/23462476
tags question: http://stackoverflow.com/q/23495438
tags question: http://stackoverflow.com/q/23454264
tags question: http://stackoverflow.com/q/23524933
tags question: http://stackoverflow.com/q/23516262
tags question: http://stackoverflow.com/q/23521751
tags question: http://stackoverflow.com/q/23556549
tags question: http://stackoverflow.com/q/23560067
tags question: http://stackoverflow.com/q/23494624
tags question: http://stackoverflow.com/q/23478909
tags question: http://stackoverflow.com/q/23513684
tags question: http://stackoverflow.com/q/23506215
type: Tag
tags question: http://stackoverflow.com/q/23494408
tags question: http://stackoverflow.com/q/23555749
tag name: android-intent
tags question: http://stackoverflow.com/q/23593775
tags question: http://stackoverflow.com/q/23593433
tags question: http://stackoverflow.com/q/23539186
tags question: http://stackoverflow.com/q/23592748

http://stackoverflow.com/comment/35997226
comment on: http://stackoverflow.com/q/23476355
type: Comment
has text: Irrelevant to your problem but you are both extending from `JFrame` and creating a `JFrame` You probably only want one of those. Also, you must execute your code in the appropiate thread, so you must call `invokeLater` in your main, see [Swing's Hello World](http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java), you can find a detailed explanation of this [here](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html).
type: QuestionComment
score: 1

http://stackoverflow.com/a/23507538
has body: try this: private LayoutInflater mInflater; Context mContext; public TestListAdapter(Context context,int viewResourceId, List&lt;TestObjects&gt; objects) { super(context, viewResourceId, objects); this.mContext = context; this.mInflater = LayoutInflater.from(context); this.iHostViewID = viewResourceId; } @Override public View getView(int pos, View convertView, ViewGroup parent) { CollectHolder holder = null; if (convertView == null) { convertView = mInflater.inflate(iHostViewID, null); holder = new CollectHolder(convertView); convertView.setTag(holder); } else { holder = (CollectHolder) convertView.getTag(); } holder.testTV.setText("Testing..."); return convertView; } class CollectHolder { TextView testTV; public CollectHolder(View root) { this.testTV = (TextView) root .findViewById(R.id.widget_listitem_test_TV); } }
has comment: http://stackoverflow.com/comment/36053386
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23506614
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23506614
downvote count: 0

http://stackoverflow.com/q/23583624
has comment: http://stackoverflow.com/comment/36195515
upvote count: 1
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36195437
favorite count: 0
has answer: http://stackoverflow.com/a/23583914
has comment: http://stackoverflow.com/comment/36195692
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/36195539
tagged with: java
tagged with: bukkit
has title: Minecraft bukkit zombie-spawning error
type: Question
has body: I am writing a simple zombie-spawning plugin. The spawning is done by another thread. When I run the plugin, I get the following error after some time of playing: [Server thread/ERROR]: Encountered an unexpected exception java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(Unknown Source) ~[?:1.7.0_25] at java.util.HashMap$KeyIterator.next(Unknown Source) ~[?:1.7.0_25] at net.minecraft.server.v1_7_R1.EntityTracker.updatePlayers(EntityTracker.java:152) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:646) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:250) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:545) ~[craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:457) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks] This error continues to occur, but it occurs rarely and it seems random. My thoughts to this problem are that the spawning-thread is asynchroune to the EntityTracker, which leads to a exception because my thread modifies the entity-list while another part of bukkit tries to tell the players the positions of the monsters. I don't have any idea what the exact error-source is, but I think I have to synchronize my thread with some part of bukkit. Does anyone have a solution for that? (And is there any way to set the items which a zombie will drop? The whole rotten flesh is starting to give me nightmares). Thanks in advance.
tagged with: minecraft
accepted answer: http://stackoverflow.com/a/23583914
has comment: http://stackoverflow.com/comment/36195895

http://stackoverflow.com/a/23473314
type: AcceptedAnswer
score: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/35988870
type: Answer
has body: The high-level consideration must be whether it safely precludes concurrent access to the critical ressource. This works as AtomicBoolean provides the necessary guarantees. As a rule of thump, the JMM is designed in a way that if you implement the high-level logic correctly, the low level things will be too. Going more into detail as you do in your question, the volatile reads and writes preclude unintended re-ordering just as you expect (aka “piggybacking”). You are basically doing what a Lock does too. A ReentrantLock will use an int rather than a boolean, and the Locks provide a waiting queue which a simple atomic variable does not. The AbstractQueuedSynchronizer shows how that logic (similar to yours) is implemented around one atomic int variable.
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23473208
has comment: http://stackoverflow.com/comment/35988947
answers question: http://stackoverflow.com/q/23473208
has comment: http://stackoverflow.com/comment/35989440

http://stackoverflow.com/a/23543645
score: 0
has body: ArrayList fileList = new ArrayList(); Cursor cursor = database.rawQuery("SELECT * FROM " + your table name + " WHERE " + your conditions + "\"", null); cursor.moveToFirst(); while (!cursor.isAfterLast()) { &lt;the type you want to get the result&gt; offlineFile = cursorToOfflineFile(cursor); fileList.add(offlineFile); cursor.moveToNext(); } cursor.close(); return fileList;
answers question: http://stackoverflow.com/q/23542082
type: Answer

http://stackoverflow.com/a/23553531
has comment: http://stackoverflow.com/comment/36146390
accepted answer of: http://stackoverflow.com/q/23553368
has comment: http://stackoverflow.com/comment/36160688
has comment: http://stackoverflow.com/comment/36160315
score: 0
answers question: http://stackoverflow.com/q/23553368
has comment: http://stackoverflow.com/comment/36142681
has comment: http://stackoverflow.com/comment/36176436
type: AcceptedAnswer
has body: One way is to just store each row into a Map. To do this, you can retrieve the column names using ResultSetMetaData (key = column name) or you can just retrieve the column values using the column index (key = index). ResultSet can deal with it both ways. Then, your result will look like a List&lt;Map&gt; structure.
has comment: http://stackoverflow.com/comment/36160214
type: Answer

http://stackoverflow.com/a/23527271
has comment: http://stackoverflow.com/comment/36091005
accepted answer of: http://stackoverflow.com/q/23527239
upvote count: 1
downvote count: 1
has body: I use for times/dates long lastUsed = Long.MIN_VALUE; Date expireTime = new Date(Long.MAX_VALUE); LocalDate maxDate = LocalDate.MAX; // Java 8. For an "invliad" string I have used String invalid = "\uFFFF"; The \uFFFF is defined as a non-character and is greater than all other Strings (which don't start with this character, if you ignore code points)
answers question: http://stackoverflow.com/q/23527239
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/36090764

http://stackoverflow.com/a/23563983
answers question: http://stackoverflow.com/q/23563826
score: 0
type: Answer
has body: for (String part : "string1 &amp; string2 / string3".split(" [/|&amp;] ")) { System.out.println(part); } So what you're interested in is the .split(" [/|&amp;] ") part

http://stackoverflow.com/a/23588713
type: Answer
accepted answer of: http://stackoverflow.com/q/23568641
has body: Like you said Connection Reset could be caused by many possible reasons. One such possibility could be that server timed out while processing the request, thats why the client receives connection reset. The comments section of the answered question here discusses possible causes of connection reset in detail. One possible solution I can think of is to configure HttpClient to retry the request in case of a failure. You could set the HttpMethodRetryHandler like below to do so (Reference). You may perhaps need to modify the code based on the exception you receive. HttpMethodRetryHandler retryHandler = new HttpMethodRetryHandler() { public boolean retryMethod( final HttpMethod method, final IOException exception, int executionCount) { if (executionCount &gt;= 5) { // Do not retry if over max retry count return false; } if (exception instanceof NoHttpResponseException) { // Retry if the server dropped connection on us return true; } if (!method.isRequestSent()) { // Retry if the request has not been sent fully or // if it's OK to retry methods that have been sent return true; } // otherwise do not retry return false; } }; ApacheHttpClient client = ApacheHttpClient.create(); HttpClient hc = client.getClientHandler().getHttpClient(); hc.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler); client.resource("/stores/"+storeId).type(MediaType.APPLICATION_JSON_TYPE).put(ClientResponse.class,indexableStore);
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23568641

http://stackoverflow.com/comment/36205497
score: 0
type: AnswerComment
type: Comment
has text: What is OpenCVLoader? Do I need to install some package?
comment on: http://stackoverflow.com/a/23585226

http://stackoverflow.com/comment/35973503
type: Comment
has text: Alright I made some changes to my decreaseKey() and I will add my correct method to the code, just give me a second to edit my post. I see the problem with my contains method, so I did away with it all together and just checked the validity of the handle (see if it was equal to -1)
type: AnswerComment
comment on: http://stackoverflow.com/a/23463977
score: 0

http://stackoverflow.com/comment/36146836
score: 0
comment on: http://stackoverflow.com/a/23546455
type: AnswerComment
has text: Thank you very much. The second one works for me. It turns out, that I had to manually set `login.setConnectionHealthValidationOnError(true); ` which I understand should be true by default.
type: Comment

http://stackoverflow.com/q/23533074
score: 2
tagged with: camera
tagged with: java
type: Question
upvote count: 2
has body: I am getting the Mat image that is provided from the OpenCV callback method onCameraFrame(). this I get from CvCameraViewFrame inputFrame that is passed in the parameters. This callback method required a Mat image to be returned back. the purpose is to get give this Mat image to thhe HoughCircles() method to detect circle shaped objects in the camera viewfinder frame image. This use of OpenCV in this example is the Java API version to be used in Android The problem is that two methods I am using inside of the onCameraFrame() callback method take time to process and slow down the camera fiewfinder video frame rate. Imgproc.GaussianBlur(mGray, mGray, new Size(5, 5), 2, 2); Imgproc.HoughCircles(mGray, circles, Imgproc.CV_HOUGH_GRADIENT, 1, mGray.rows()/8, 150, 60, 30, 0); the frame rate becomes vary slow especially if objects are detected in the frame. The only way I found to improve this frame rate is to reduce the frame size. This results in a low quality image, and even this change the frame rate is still too slow. How can I avoid this problem? I tried to pass the Mat mGray and mRGB objects into a separate thread and start it from inside the onCameraFrame() callback method. Using a background thread is not working. Tried both Java thread and AsyncTask. two types of solutions were tried, type one possible solution Tried using a counter with a integer variable that in incremented each time the onCameraFrame() method is called, so that only one out of ten, or one out of 20 method calls will start a new thread for processing the image HoughCircles. This did not work. type two possible solution The other thing I tried is to use either a AtomicBoolean or Boolean to block the starting of a new thread until the last thread has completed execution, This will make sure that only one background thread will be launched at a time, and only one Mat image is processed by the HoughCircles Method at a time. This also is not working for some reason. it is shown in the example code be…
answer count: 1
has answer: http://stackoverflow.com/a/23533742
favorite count: 0
tagged with: android
downvote count: 0
type: UnansweredQuestion
tagged with: multithreading
has title: getting image from callback method without blocking in OpenCV
tagged with: opencv

http://stackoverflow.com/comment/36060249
score: 0
type: Comment
has text: one advice ( may be unrelated to your question though), don't do wildcard import. Specifying what is needed is a better practice.
type: QuestionComment
comment on: http://stackoverflow.com/q/23511445

http://stackoverflow.com/comment/36130004
type: QuestionComment
has text: Both the validators: validation-api.jar and hibernate-validator.jar are present in my classpath. Yes, the package is: `import javax.validation.constraints.Size;`
comment on: http://stackoverflow.com/q/23548645
score: 0
type: Comment

http://stackoverflow.com/a/23527319
has body: On whatever socket pair you're using (assuming you didn't rewrite that as well), respond with the body of an HTTP response. The full scope of the response is well outside the scope of a simple SO question, but the basics will be: An HTTP status code (in your case, probably something in the 400 range) and message Appropriate HTTP headers An appropriate payload, probably consisting of either structured data or plain text, with the desired message. For example, if you wanted the browser to display a page with a "Sorry, that user is already in the database" message, you could send this over the wire: HTTP 401 Unauthorized Content-Type: text/html Already in database Sorry, that user is already in the database
has comment: http://stackoverflow.com/comment/36092043
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36094407
downvote count: 0
answers question: http://stackoverflow.com/q/23527077
type: Answer
accepted answer of: http://stackoverflow.com/q/23527077
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36092903

http://stackoverflow.com/comment/36023501
type: Comment
has text: Yes, but you probably need to split the script up into seperate `java.sql.Statement`s for each `go`
comment on: http://stackoverflow.com/a/23491992
type: AnswerComment
score: 0

http://stackoverflow.com/a/23593376
answers question: http://stackoverflow.com/q/23591935
type: Answer
accepted answer of: http://stackoverflow.com/q/23591935
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Th problem is with the debugging method here. Using the debugger without the client connection will not proceed further than the first call to the accept() method. In order find out the problem, you need to put one System.out.println() statement inside the Server while-loop before the call to accept() and check if the loop is entered.

http://stackoverflow.com/q/23471516
linked to: http://stackoverflow.com/q/25552
has comment: http://stackoverflow.com/comment/35985486
has answer: http://stackoverflow.com/a/23471573
type: Question
linked to: http://stackoverflow.com/q/21878666
tagged with: javascript
score: -1
has comment: http://stackoverflow.com/comment/35985427
has title: How to retrive hardware details using a programming language?
answer count: 1
downvote count: 1
tagged with: applet
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35985476
tagged with: php
upvote count: 0
tagged with: hardware
tagged with: java
has body: I want to retrieve the following things from the user's desktop when the user uses logs into my website: 1) Mother Board Serial Number 2) Hard Disk Serial Number 3) CPU Serial Number Now I am confused and not sure which way to go. I cannot use Javascript because it will not provide these details because of security reasons. I cannot use php because php runs on server side and not client side. So last option is using Java Applets. As soon as the user logs in, the applet will be downloaded. When the user runs the applets, it will retrieve the necessary information. But I dont want to be using this because applets are obsolete these days and nobody uses them. So is there any method in which I find find the user's hardware details without using Java Applets.
has comment: http://stackoverflow.com/comment/35985544

http://stackoverflow.com/comment/36031485
comment on: http://stackoverflow.com/a/23496191
has text: No, this is not happening: if I run the application without create the database, I receive an error. My configuration file is that: https://github.com/klebermo/maven_example/blob/master/src/main/java/hibernate.properties.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/79352977
score: 0
type: Comment
type: QuestionComment
has text: It has been a long time, but by any chance do you remember how did you solve the problem?
comment on: http://stackoverflow.com/q/23553053

http://stackoverflow.com/comment/125323801
comment on: http://stackoverflow.com/a/23608448
score: 0
type: AnswerComment
has text: Except, sadly it seems not possible to get controller method parameter values through the interceptor. See https://stackoverflow.com/questions/39039695
type: Comment

http://stackoverflow.com/comment/36245533
score: 0
comment on: http://stackoverflow.com/q/23610325
type: Comment
type: QuestionComment
has text: Works just fine for me, its even case-insensitive. Note: On Windows 7.

http://stackoverflow.com/q/23508278
has comment: http://stackoverflow.com/comment/36058668
answer count: 3
has comment: http://stackoverflow.com/comment/36054634
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23509072
has answer: http://stackoverflow.com/a/23509066
tagged with: android
has comment: http://stackoverflow.com/comment/36054542
accepted answer: http://stackoverflow.com/a/23509066
has comment: http://stackoverflow.com/comment/36054651
upvote count: 1
has title: I need help on what to do next in trying to create a listview for android
type: AnsweredQuestion
score: 1
tagged with: java
has body: So i'm fairly a beginner at this but what i want to do is create a listview with two pictures and three text views. I created a class called custom list to serve as my adapter the problem i am running into is in my main activity listed here I can't set that adapter to the actually listview what did i do wrong. The error i get when i try to add the listView to oncreate is that i'd need a local variable. class MainActivity package j.motors.cars; import java.util.ArrayList; import java.util.List; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; // i have alot going on here can't figure out which way i want to use this array adapter public class MainActivity extends Activity { private List&lt;Craigslist&gt; myCraigs = new ArrayList&lt;Craigslist&gt;(); String[] make = { "Chevy", "Ford", "Dodge", "Hyundai", "Jeep", "Toyata", "Honda", "Kia" }; Integer[] imageId = { R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher, }; String[] price = { "$1500", "$3000", "$1700", "$800" }; Integer[] arrow = { R.drawable.imgright, R.drawable.imgright, R.drawable.imgright, R.drawable.imgright, }; String[] description = { "This car runs well and has all the right parts", "This car is a steal at the price since it barely has 15 miles on it", "Almost new condition", "This car runs well" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); populateCraigslist(); CustomList adapter = new CustomList(MainActivity.this, make, imageId, price, description, arrow); lv = findViewById(R.id.listView1); lv.setadapter(adapter) } private void populateCraigslist() { // TODO Auto-generated method stub //String make, int imageID, String description, String price, int arrow myCraigs.add(new Craigslist("Good", R.drawable.ic_launcher, "Great condition", "$150…
has comment: http://stackoverflow.com/comment/36058050
possible better answer: http://stackoverflow.com/a/23508466
has comment: http://stackoverflow.com/comment/36054539
has answer: http://stackoverflow.com/a/23508466
has comment: http://stackoverflow.com/comment/36054619
type: Question

http://stackoverflow.com/q/23592879
tagged with: ajax
score: 0
has title: java.lang.IllegalArgumentException: "json" does not contain '/'
answer count: 1
type: UnansweredQuestion
has body: When I try to send data to server by POST method, I got this error on the server side: java.lang.IllegalArgumentException: "json" does not contain '/'. First I thought that date format from jQuery UI DatePicker is wrong and I changed it to "yy-mm-dd", but unfortunately is still does not work. I am really confused, because I don't know where is '/' which makes me trouble. I would be very happy if anybody decides to help me - Thank you This is error, $.ajax and mapping are also below: java.lang.IllegalArgumentException: "json" does not contain '/' at org.springframework.http.MediaType.parseMediaType(MediaType.java:648) at org.springframework.web.servlet.mvc.condition.ConsumesRequestCondition$ConsumeMediaTypeExpression.matchMediaType(ConsumesRequestCondition.java:215) at org.springframework.web.servlet.mvc.condition.AbstractMediaTypeExpression.match(AbstractMediaTypeExpression.java:63) at org.springframework.web.servlet.mvc.condition.ConsumesRequestCondition.getMatchingCondition(ConsumesRequestCondition.java:165) at org.springframework.web.servlet.mvc.method.RequestMappingInfo.getMatchingCondition(RequestMappingInfo.java:174) at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.getMatchingMapping(RequestMappingInfoHandlerMapping.java:64) // snip That is how I send data: $.ajax({ url: _getContextPath() + "/event/addEvent", method: "POST", contentType: "json", data: { "ownerId": $("#ownerIdHidden").val(), "title": $("#title").val(), "place": $("#place").val(), "startdate": $("#startDate").val(), "starthour": $("#startHour").val(), "duration": $("#duration").val(), "description": $("#eventDescription").val(), "invited": _getLoginsFromTable(invitedTable) } }); And here is how I try to map it in Spring MVC Cotroller: @ResponseBody @RequestMapping(value="event/addEvent", method=RequestMethod.POST, consumes="application/json") public String addEvent(@RequestParam("ownerid") Long ownerid, @RequestParam("title") String title, @RequestParam("place") Str…
tagged with: spring
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23593150
type: Question
tagged with: jquery

http://stackoverflow.com/comment/36271831
score: 0
has text: Thanks for the info! I managed to find the answer after learning more about type erasure.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23601619

http://stackoverflow.com/comment/36013862
comment on: http://stackoverflow.com/a/23486485
type: Comment
has text: @raj what you want to ask??
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36186323
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23578151
has text: indicate line 196 @ `ListAdapter`

http://stackoverflow.com/q/23466022
type: UnansweredQuestion
tagged with: ireport
score: 0
tagged with: java
type: Question
tagged with: jasper-reports
has answer: http://stackoverflow.com/a/23466649
answer count: 1
has body: As I was generating sample outputs for my reports in Jasper iReport, I noticed something. As I was paging along the preview, everything was fine like this: I configured the vertical lines on the table to adjust whenever any of the fields stretch upon overflow. But then, I get to Page 9 and this is what happens: The vertical lines at this page don't seem to print/are cut because the record at the top of the table is still part of the last record from the previous page. My question now is, how do I fix or prevent this?
has title: line cuts off/does not print at next page in Jasper
tagged with: oracle-database

http://stackoverflow.com/q/23610215
score: 0
has title: Hibernate 4 entities and Jackson 2, lazy loading issue
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/23614328
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has body: so I read this topic: deserialize lazy loading in hibernate and jackson and I would like to achieve similar - or actually - the same as previous author. However for two days now I am stuck and I do not understand my mistake. So f.e I have this UserModel and AuthoritiesModel class for Hibernate entity: UserModel: @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "username") @JsonAutoDetect @Entity @Table(name = "users") public class UserModel implements Serializable, Cloneable { private static final long serialVersionUID = 8019466778684575940L; @Id @Column(name = "username") private String username; @Column(name = "password") private String password; @Column(name = "enabled") private Boolean enabled; @Column(name = "email") private String email; @Column(name = "name") private String name; @Version @Column(name = "VERSION") private int version; @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, targetEntity = AuthorityModel.class) private List&lt;AuthorityModel&gt; authorities = new ArrayList&lt;AuthorityModel&gt;(); @OneToMany(mappedBy = "user", fetch = FetchType.LAZY, targetEntity = MessageModel.class) private List&lt;MessageModel&gt; messages = new ArrayList&lt;MessageModel&gt;(); @ManyToOne(fetch = FetchType.LAZY, targetEntity = StatusModel.class) @JoinColumn(name = "status") private StatusModel status; @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "meeting_user", joinColumns = { @JoinColumn(name = "username", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "id_meeting", nullable = false, updatable = false) }) private List&lt;MeetingModel&gt; meetings = new ArrayList&lt;MeetingModel&gt;(); @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "contact_user", joinColumns = @JoinColumn(name = "username", nullable = false, updatable = false), inverseJoinColumns = @JoinColumn(name = "contact_username", nullable = false, updatable = fals…
type: Question
answer count: 1
tagged with: jackson
linked to: http://stackoverflow.com/q/12923803

http://stackoverflow.com/a/43311914
has body: The difference between both codes can be seen in their generated bytecodes. The first one has extra two instructions over the second one; it stores the return value of someMethod() on the local stack and then loads it again for accessing it's iterator. However the second one immediately uses the Iterator without storing the return value of someMethod() on the local stack. Below code shows the elimination of 3: and 4: instructions. First: Collection&lt;String&gt; collection = someMethod(); for(String element : collection) { ... } 0: invokestatic #3 // Call someMethod() 3: astore_1 // Store the result as first item on local stack 4: aload_1 // Load the Collection again into operand stack 5: invokeinterface #4, 1 // Get Iterator (of Collection) - InterfaceMethod java/util/Collection.iterator:()Ljava/util/Iterator; 10: astore_2 // Store Iterator on local stack #2 11: aload_2 // LOOP STARTS - Load iterator 12: invokeinterface #5, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z 17: ifeq 33 20: aload_2 21: invokeinterface #6, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object; 26: checkcast #7 // class java/lang/String 29: astore_3 30: goto 11 // LOOP ENDS 33: return Second for(String element : someMethod()) { ... } 0: invokestatic #3 // Call someMethod() 3: invokeinterface #4, 1 // Get Iterator (of Collection) - Interface Method java/util/Collection.iterator:()Ljava/util/Iterator;/ 8: astore_1 // Store Iterator on local stack #2 9: aload_1 // LOOP STARTS - Load iterator 10: invokeinterface #5, 1 // InterfaceMethod java/util/Iterator.hasNext:()Z 15: ifeq 31 18: aload_1 19: invokeinterface #6, 1 // InterfaceMethod java/util/Iterator.next:()Ljava/lang/Object; 24: checkcast #7 // class java/lang/String 27: astore_2 28: goto 9 // LOOP ENDS 31: return BTW, I don't think that they will have a big difference in terms of performance since both have 9 instructions inside the loop.
downvote count: 0
answers question: http://stackoverflow.com/q/23494344
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/23478611
downvote count: 1
has title: how to get a console output (e.g. on eclipse) AND write/copy the same output to file?
linked to: http://stackoverflow.com/q/15758685
score: 1
tagged with: java
has body: I know that this type of question have been asked many times. But I didn't find any answer for myself. That's why i am asking once more. I have got an output on my console. I want to copy the same output 1-to-1 to a file. I don't want to redirect. I want some kind of "copy" it and "write" into a file. I hope the question is clear enough, cause I have seen that the other times, the question wasn't clear. Anyways, I have tried it with the "System.setOut" methode. But it just redirect everything to the file. I cannot write all the "System.out.println"s with a write() into a file, that to much. Thanks for helping.
tagged with: nio
type: Question
has answer: http://stackoverflow.com/a/23486054
answer count: 2
has comment: http://stackoverflow.com/comment/35999235
has answer: http://stackoverflow.com/a/23479201
linked to: http://stackoverflow.com/q/16237546
tagged with: printstream
tagged with: system
tagged with: file-io
has comment: http://stackoverflow.com/comment/36000546
favorite count: 0
has comment: http://stackoverflow.com/comment/35999017
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/23611255
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36247775
has answer: http://stackoverflow.com/a/23641946
has comment: http://stackoverflow.com/comment/36275889
upvote count: 2
has comment: http://stackoverflow.com/comment/36275577
has comment: http://stackoverflow.com/comment/36276280
accepted answer: http://stackoverflow.com/a/23641946
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36274752
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36276018
has body: I am currently trying to get all SVN Revisions and afterwards check them out one after another and do something with them. With svn checkout http://hamcrest.googlecode.com/svn/trunk/ hamcrest-read-only (using SVN 1.8.8) I get the code (I am just using hamcrest as an example). After getting it, I am trying to do the following: FSRepositoryFactory.setup(); SVNURL localRepo = FSRepositoryFactory.createLocalRepository(f, true, true); System.out.println("Repo: " + localRepo); SVNRepository repo = FSRepositoryFactory.create(localRepo); log.info("Revisions: " + repo.getLatestRevision() + " Path: " + f.getAbsolutePath()); List&lt;SVNLogEntry&gt; col = (List&lt;SVNLogEntry&gt;) repo.log( new String[] { "" }, null, 0, repo.getLatestRevision(), true, true); for (Object o : col) { System.out.println("O: " + o + " " + o.getClass()); } System.out.println("Col: " + col.getClass()); This unfortunately creates an empty repository, and deletes everything in it. This corresponds to the documentation of FSRepositoryFactory.create. So I searched for an way to open an existing repository another way, and found SVNURL localRepo = SVNURL.fromFile(f);. Unfortunately, this produces the errors: Exception in thread "main" org.tmatesoft.svn.core.SVNException: svn: E180001: Unable to open an ra_local session to URL svn: E180001: Unable to open repository 'file:///home/reichelt/workspace/hamcrest/hamcrest-read-only' svn: E180001: Unable to open repository 'file:///home/reichelt/workspace/hamcrest/hamcrest-read-only' at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:64) at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:51) at org.tmatesoft.svn.core.internal.io.fs.FSRepository.openRepository(FSRepository.java:796) at org.tmatesoft.svn.core.internal.io.fs.FSRepository.getLatestRevision(FSRepository.java:121) at de.performanzanalysator.vcs.SVNUtils.getVersions(SVNUtils.java:70) at de.performanzanalysator.vcs.SVNUtils.main(SVNUtils.java:90)…
tagged with: svn
has comment: http://stackoverflow.com/comment/36274398
tagged with: svnkit
has title: Getting all Revisions with SVNKit
score: 2
answer count: 1

http://stackoverflow.com/comment/85916494
type: AnswerComment
comment on: http://stackoverflow.com/a/23606319
type: Comment
has text: What happens when the buffer is filled beyond 1024 bytes?
score: 1

web-services
tags question: http://stackoverflow.com/q/23573429
type: Tag
tags question: http://stackoverflow.com/q/23457290
tags question: http://stackoverflow.com/q/23538833
tags question: http://stackoverflow.com/q/23473814
tags question: http://stackoverflow.com/q/23488786
tags question: http://stackoverflow.com/q/23493181
tags question: http://stackoverflow.com/q/23492160
tags question: http://stackoverflow.com/q/23572501
tags question: http://stackoverflow.com/q/23510132
tags question: http://stackoverflow.com/q/23541334
tags question: http://stackoverflow.com/q/23525747
tags question: http://stackoverflow.com/q/23594856
tags question: http://stackoverflow.com/q/23481809
tags question: http://stackoverflow.com/q/23453224
tags question: http://stackoverflow.com/q/23550568
tags question: http://stackoverflow.com/q/23478434
tags question: http://stackoverflow.com/q/23561149
tags question: http://stackoverflow.com/q/23613942
tags question: http://stackoverflow.com/q/23504430
tags question: http://stackoverflow.com/q/23527830
tags question: http://stackoverflow.com/q/23491090
tags question: http://stackoverflow.com/q/23589141
tags question: http://stackoverflow.com/q/23604577
tags question: http://stackoverflow.com/q/23550895
tags question: http://stackoverflow.com/q/23538626
tags question: http://stackoverflow.com/q/23494308
tags question: http://stackoverflow.com/q/23499134
tags question: http://stackoverflow.com/q/23598365
tag name: web-services
tags question: http://stackoverflow.com/q/23615126
tags question: http://stackoverflow.com/q/23565610
tags question: http://stackoverflow.com/q/23489066
tags question: http://stackoverflow.com/q/23473355
tags question: http://stackoverflow.com/q/23540869
tags question: http://stackoverflow.com/q/23514814
tags question: http://stackoverflow.com/q/23495260
tags question: http://stackoverflow.com/q/23598288
tags question: http://stackoverflow.com/q/23482416
tags question: http://stackoverflow.com/q/23610303
tags question: http://stackoverflow.com/q/23477730
tags question: http://stackoverflow.com/q/23473693
tags question: http://stackoverflow.com/q/23607729
tags question: http://stackoverflow.com/q/23484911
tags question: http://stackoverflow.com/q/23475189
tags question: http://stackoverflow.com/q/23548368
tags question: http://stackoverflow.com/q/23498045

http://stackoverflow.com/comment/36175281
comment on: http://stackoverflow.com/q/23572748
has text: @helderdarocha I have a statement i = i - 1; Doesn't it nullify the Conflicting placement?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23592238
has comment: http://stackoverflow.com/comment/36211075
accepted answer: http://stackoverflow.com/a/23592813
has answer: http://stackoverflow.com/a/23592813
upvote count: 1
answer count: 1
favorite count: 0
tagged with: sockets
has title: Java socket - client and server IP address
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/36211063
has body: I am writing a program with TCP sockets connection between client and server. When the server starts I want to display the IP and port that clients need to use to connect, and when client connects I want the server to show what IP did the client connect from. I am getting confused which command should i use to each of those: getInetAdress() getLocalAdress() getRemoteSocketAdress() edit I earlier used int port = 1234 and String IP = "localhost" to test and it worked, but I only used it on one PC, so I think localhost will not work if i start server and client on different computers. This is server side: int port = 1234; ... public void start() { keepRunning = true; // create socket try { ServerSocket server = new ServerSocket(port); while (keepRunning) { display("Waiting for client connections on " + server.getInetAddress().getLocalHost() .getHostAddress() + ":" + port); Socket conn = server.accept(); if (!keepRunning) break; ClientThread t = new ClientThread(conn); cList.add(t); t.start(); And this is client: int port = 1234; String IP = "localhost"; //these variables can be changed from Client GUI before making connection ... public boolean start() { try { socket = new Socket(IP, port); } catch (Exception e) { display("Error connectiong to server:" + e); return false; } try { sInput = new ObjectInputStream(socket.getInputStream()); sOutput = new ObjectOutputStream(socket.getOutputStream()); } catch (IOException e) { display("Exception creating new Input/output Streams: " + e); return false; } When i start the server, display("Waiting for client connections on " + server.getInetAddress().getLocalHost().getHostAddress() + ":" + port); return this: Waiting for client connections on 192.168.1.104:1234 which is kind of what i want, but I still cant get it to show me the port. 1234 is a fixed value i used, but I want to use ServerSocket server = new ServerSocket(0); to asign port dynamically, then when i start the client i just put in the values that i got from server an…
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/5757900
type: Question

http://stackoverflow.com/comment/35990767
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23474279
type: Comment
has text: What code is present at line 49 ?

http://stackoverflow.com/a/28936383
upvote count: 10
score: 10
has comment: http://stackoverflow.com/comment/51427980
has body: you can solve this problem by opening rstudio in super user like sudo rstudio then inside R run install.packages('rJava')
has comment: http://stackoverflow.com/comment/72279448
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23469061

http://stackoverflow.com/comment/36229620
comment on: http://stackoverflow.com/a/23559312
type: Comment
score: 0
type: AnswerComment
has text: That i know brother please check my question i have to Notify Single record of a List not whole class or Whole list

http://stackoverflow.com/a/23553223
has comment: http://stackoverflow.com/comment/36138897
has comment: http://stackoverflow.com/comment/36139355
has body: Add default case of null. switch (generator.nextInt(2)) { case 0: return new Tree(x, y); case 1: return new Bush(x, y); default: // Requires default case return null; } Or create a dummy NoPlant class public class NoPlant extends Plant { ... } Now use in this way switch (generator.nextInt(2)) { case 0: return new Tree(x, y); case 1: return new Bush(x, y); default: // Requires default case return new NoPlant(); } --EDIT-- Try in this way also int random=generator.nextInt(2); // return either 0 or 1 if(random==0){ return new Tree(x,y); }else{ return new Bush(x, y); }
has comment: http://stackoverflow.com/comment/36139224
has comment: http://stackoverflow.com/comment/36139322
has comment: http://stackoverflow.com/comment/36139163
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23553108
has comment: http://stackoverflow.com/comment/36139246
answers question: http://stackoverflow.com/q/23553108
score: 0
has comment: http://stackoverflow.com/comment/36139236
has comment: http://stackoverflow.com/comment/36139132
type: Answer

http://stackoverflow.com/comment/68730618
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25620315
has text: With ScalaTest, use `testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oF")`
type: Comment

http://stackoverflow.com/comment/36195144
type: Comment
comment on: http://stackoverflow.com/q/23583242
score: 0
type: QuestionComment
has text: possible duplicate of [How to replace case-insensitive literal substrings in Java](http://stackoverflow.com/questions/5054995/how-to-replace-case-insensitive-literal-substrings-in-java)

http://stackoverflow.com/q/23603450
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/23603508
accepted answer: http://stackoverflow.com/a/23603508
possible better answer: http://stackoverflow.com/a/23682059
tagged with: maven
type: AnsweredQuestion
has body: I tried the solutions given online but none of them work. Tools used : Hibernate Maven Eclipse IDE JAXB JSP HTML I have several bean classes. I have mapped them to the schema as well using hbm xmls.. I am looking to convert the objects to xml and store it in an xml file. Please help me out with an example
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
tagged with: jaxb
type: Question
has title: How do I convert java objects to xml using JAXB without using annotation?
answer count: 2
has answer: http://stackoverflow.com/a/23682059
upvote count: 1

http://stackoverflow.com/comment/36104731
comment on: http://stackoverflow.com/q/23534492
type: Comment
type: QuestionComment
score: 0
has text: possible duplicate of [How does BufferedOutputStream actually work at a low level?](http://stackoverflow.com/questions/9282909/how-does-bufferedoutputstream-actually-work-at-a-low-level)

http://stackoverflow.com/comment/36086491
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23525380
has text: you need a reference to the object.

http://stackoverflow.com/q/23571993
score: 0
has title: How does writing a new scanner in a while loop stop an otherwise infinite loop?
has body: So I am trying to stop an error from happening if the user inputs a number other than 1,2,3, so I created a while loop to make the program keep asking the user for a new number if their input is outside 1,2,3. Before I didn't have the Scanner user1 = new Scanner(System.in); input = user1.nextInt(); lines, and the while loop kept running infinitely. But now the code does what I want, it stops and evaluates the new user input for as many times as the input is wrong (I've entered 3,6,7 wrong values before a correct one and it works every time). My question is, how does the scanner stop the infinite loop? Does the Scanner impletmentation cause the computer to wait for a user input before it continues, and so because of this it goes back to evaluate it continuously, instead of infinitely printing out "I'm sorry that's not a valid input..." ? I just want to be sure I know WHY it's stopping. Scanner user = new Scanner(System.in); System.out.println("Hello, what would you like to do?" + "\n" + "1. Search" + "\n" + "2. Add new instructor" + "\n" + "3. Remove Intsructor"); int input = user.nextInt(); boolean valid = false; while(valid == false) { if(input&lt;3 &amp;&amp; input&gt;=1) { valid = true; } else { System.out.println("I'm sorry, that's not a valid input, please enter 1, 2, or 3."); Scanner user1 = new Scanner(System.in); input = user1.nextInt(); }
tagged with: java.util.scanner
type: UnansweredQuestion
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23572205
has comment: http://stackoverflow.com/comment/36180356
has answer: http://stackoverflow.com/a/23572201
has comment: http://stackoverflow.com/comment/36173573

http://stackoverflow.com/comment/36131051
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23548879
has text: First this tests are by definition no more unit tests. They are integration tests, cause there are not independent. Apart from that you have to solve this via a test framework like TestNG which can define dependencies between test methods. Furthermore they should be run by maven-failsafe-plugin cause they are integration tests. As already explained that sounds really weird.
score: 0

http://stackoverflow.com/q/23604648
has comment: http://stackoverflow.com/comment/36234485
has answer: http://stackoverflow.com/a/23604701
tagged with: java
score: -1
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/23604712
favorite count: 0
has body: Shifting between activities isn't working. What the app does is it opens the android.xml file then after 5 secs open the main file Here's the code: android manifest file: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.intent.action.ANDROID" /> <category android:name="android.intent.category.LAUNCHER" /> android.java file: package com.example.android; import android.app.Activity; import android.content.Intent; import android.media.MediaPlayer; import android.os.Bundle; public class android extends Activity{ MediaPlayer sound1; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.android); sound1 = MediaPlayer.create(android.this , R.raw.android); sound1.start(); Thread timer = new Thread() {public void run() { try{ sleep(5000); } catch(InterruptedException ac){ ac.printStackTrace(); } finally{ Intent openactivity = new Intent ("android.intent.action.MAIN"); startActivity(openactivity); } } }; timer.start(); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); sound1.release(); finish(); } } Mainactivity.java: package com.example.android; 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; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { su…
has comment: http://stackoverflow.com/comment/36234478
type: UnansweredQuestion
tagged with: android
upvote count: 0
type: Question
has title: Shifting between activities (Android)

http://stackoverflow.com/q/23460458
upvote count: 1
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: swing
has title: Exporting MySql DB
score: 1
tagged with: java
tagged with: mysql
type: Question
has body: I am using Mysql database for my Java project. I have created DB connection using following command: Connection conn = DriverManager.getConnection(url+dbName,userName,password); Now I am exporting MySql DB on other PC by creating MySqlDump file so that my project can run on other PC. I have created same database on other pc. But for running my project on other pc, I have to change password which I have set in my project with host machine password. Problem is that after making Jar file of project, how I would be able to do so. If I don't give user name and password in getConnection() method, data is not loaded into JTable in my project. What to do?

http://stackoverflow.com/comment/36167074
score: 0
type: AnswerComment
has text: can you explain it, i didnt understand what actually try adds and what you want to retype outside try
type: Comment
comment on: http://stackoverflow.com/a/23568546

http://stackoverflow.com/comment/36022517
type: QuestionComment
type: Comment
has text: @Ben I've been add some code, hope can help... Ian yeah, that is array, but when I edit the data just first of my checkbox like that the other of checkbox is ok...
comment on: http://stackoverflow.com/q/23491086
score: 0

http://stackoverflow.com/a/24455833
has body: You do not actually need to add the security filter manually. You can extend AbstractSecurityWebApplicationInitializer, which will insert the filter. You do not need to add any additional code than what is in the example below: package com.example.spring.security.config; import org.springframework.core.annotation.Order; import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer; @Order(1) public class SecurityWebAppInitializer extends AbstractSecurityWebApplicationInitializer { } I typically will have my Security App Initializer with @Order(1) and the standard Web App Initializer with @Order(2). You also need to make sure that your component scan is setup correctly. I have had it pointing at a wrong package and I have gotten this error before.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23572516
upvote count: 5
score: 5

http://stackoverflow.com/q/23528826
has comment: http://stackoverflow.com/comment/36104672
type: Question
has comment: http://stackoverflow.com/comment/74067836
downvote count: 0
answer count: 1
favorite count: 0
has body: My company is exploring the possibility of using the Netty Framework to implement a message router. The messages that it will be routing come from many different sources and all have their own formats. In most cases the messages are in XML which includes a header that contains the body length. However we have one vendor who's message are different and don't contain the length of the body. This one vendors message contains a HEADER, BODY and TRAILER. The header is 1 byte and is an STX (0x02) The body is variable length The trailer is 2 bytes which contain an ETX(0x03) followed by an LRC. So a typical message might look like: STX BODY ETX LRC 02 37000000 06 18 We initially used the DelimiterBasedFrameDecoder defining the ETX as the delimiter, however when we do that we lose the LRC byte that is part of the message. As a result, the LRC ends up being the first byte of the next message that we decode. Is there a way to use the DelimiterBasedFrameDecoder and read one byte past the ETX delimiter? Further, when we send a response back to the source, the source will then send us an ACK which we have to respond to with an ACK as well. I am thinking that we need a custom decoder that reads the byte, if it is an ACK then it notifies the next handler, otherwise, it continues reading until it reads 1 byte past the ETX and then sends that message on to the next handler. Does that seem reasonable? Is there a better way or is there a decoder in Netty that I might want to use instead of of the DelimiterBasedFrameDecoder? Any help that I can get on this is appreciated! UPDATE So at Norman's suggestion, I created the following decoder: public class MyDecoder extends DelimiterBasedFrameDecoder{ public MyDecoder(int maxFrameLength, boolean stripDelimiter, ByteBuf delimiter) { super(maxFrameLength, stripDelimiter, delimiter); this.setSingleDecode(true); } @Override protected Object decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception { Object frame = super.decode(ctx, buffe…
has title: Netty Custom DelimiterBasedFrameDecoder
has answer: http://stackoverflow.com/a/23559635
upvote count: 2
type: UnansweredQuestion
tagged with: netty
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/36110402

http://stackoverflow.com/q/23490188
has comment: http://stackoverflow.com/comment/36020472
has title: Switch Screen/Activity By Swiping Android Java
has comment: http://stackoverflow.com/comment/36020889
tagged with: listview
answer count: 2
linked to: http://stackoverflow.com/q/79041428
has answer: http://stackoverflow.com/a/23492894
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36020742
has body: I have an application with different screens/activity's. At the moment it works fine, but I've a previous and next button. I'll remove this button, and use a swipe move to "say" next of previous. I found a lot on the internet, Something about Action detection, But it doesn't work with my listview. When I swipe on a textview it works fine, but when I put the same code in my code with the listview, it doesn't detect anything anymore. Can anybody help me? In my own code I use a: ListAdapter, onItemClick and a public View getView to put some images and textviews in my listview. The onTouchEvent what does not work with my listview. public boolean onTouchEvent(MotionEvent touchevent) { switch (touchevent.getAction()) { // when user first touches the screen we get x and y coordinate case MotionEvent.ACTION_DOWN: { x1 = touchevent.getX(); y1 = touchevent.getY(); break; } case MotionEvent.ACTION_UP: { x2 = touchevent.getX(); y2 = touchevent.getY(); // if left to right sweep event on screen if (x1 &lt; x2) { Toast.makeText(this, "Left to Right Swap Performed", Toast.LENGTH_LONG).show(); } // if right to left sweep event on screen if (x1 &gt; x2) { Toast.makeText(this, "Right to Left Swap Performed", Toast.LENGTH_LONG).show(); } // if UP to Down sweep event on screen if (y1 &lt; y2) { Toast.makeText(this, "UP to Down Swap Performed", Toast.LENGTH_LONG).show(); } // if Down to UP sweep event on screen if (y1 &gt; y2) { Toast.makeText(this, "Down to UP Swap Performed", Toast.LENGTH_LONG).show(); } break; } } return false; } Update But everything I find is with different classes. In the examples, they use fragment1.java, fragment2.java, fragment3.java. But I have only my main_activity.java and these is running, and when I click my next button, it reloads the main activity, and shows other information And again and again. till my counter is on its max.
tagged with: android
has comment: http://stackoverflow.com/comment/36020862
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23490609
tagged with: swipe
accepted answer: http://stackoverflow.com/a/23492894
has comment: http://stackoverflow.com/comment/36020545
tagged with: detection
tagged with: java
has answer: http://stackoverflow.com/a/23490609
upvote count: 1
has comment: http://stackoverflow.com/comment/36020160
type: Question

http://stackoverflow.com/comment/35964814
has text: Thank you for the comment, guys. I'm new to android programming and this has been helpful. perhaps the problem wasn't that I'm using a certain kind of quit, but that I'm quitting at all. I'll change my question in such a way that doesn't try to exit the app. Thanks for the insights! P.S. I'll be deleting the question as the solution to my problem is completely different from my original question. Thanks! P.P.S... Sorry I'm new to StackOverflow, and I didn't realize I could delete a question with answers...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23459966
type: Comment

http://stackoverflow.com/q/23481251
has comment: http://stackoverflow.com/comment/36004380
answer count: 1
accepted answer: http://stackoverflow.com/a/23483530
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
type: Question
has body: I like to markup some strings in an xml document. For example, I have: I like to go to Florida I need to tag the string "go" and have the output as: I like to go to Florida What is the best way to do this? I am using Java. I need to treat the XML file as XML not as text. I found some solutions that treat an xml file as a text file and use string.replace but I do not think those are good solutions. Any suggestion is much appreciated. Thank you,
has title: markup specific strings in Xml
has answer: http://stackoverflow.com/a/23483530
score: 0

http://stackoverflow.com/comment/36214367
has text: Don't you need to have employee and manager as special cases of person?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23593868

http://stackoverflow.com/comment/36016914
type: QuestionComment
has text: You could, replace the `TableModel` with a new one which represents the current state of the table. You could update the existing `TableModel` when the operation completes, inserting, updating or removing the row.
score: 1
comment on: http://stackoverflow.com/q/23488314
type: Comment

oracle-database
tags question: http://stackoverflow.com/q/23573303
tags question: http://stackoverflow.com/q/23485722
tags question: http://stackoverflow.com/q/23455101
tags question: http://stackoverflow.com/q/23516185
tags question: http://stackoverflow.com/q/23583968
tag name: oracle-database
tags question: http://stackoverflow.com/q/23537451
tags question: http://stackoverflow.com/q/23602789
tags question: http://stackoverflow.com/q/23541921
tags question: http://stackoverflow.com/q/23529123
tags question: http://stackoverflow.com/q/23582240
tags question: http://stackoverflow.com/q/23521369
tags question: http://stackoverflow.com/q/23537285
type: Tag
tags question: http://stackoverflow.com/q/23470688
tags question: http://stackoverflow.com/q/23603353
tags question: http://stackoverflow.com/q/23525416
tags question: http://stackoverflow.com/q/23561982
tags question: http://stackoverflow.com/q/23581549
tags question: http://stackoverflow.com/q/23466022
tags question: http://stackoverflow.com/q/23473946
tags question: http://stackoverflow.com/q/23507046
tags question: http://stackoverflow.com/q/23476908
tags question: http://stackoverflow.com/q/23610462
tags question: http://stackoverflow.com/q/23579634
tags question: http://stackoverflow.com/q/23520243
tags question: http://stackoverflow.com/q/23486547
tags question: http://stackoverflow.com/q/23476547
tags question: http://stackoverflow.com/q/23542807
tags question: http://stackoverflow.com/q/23511962
tags question: http://stackoverflow.com/q/23590308
tags question: http://stackoverflow.com/q/23537022
tags question: http://stackoverflow.com/q/23466740

http://stackoverflow.com/comment/35995006
comment on: http://stackoverflow.com/q/23474984
has text: @Joffrey I fixed a mistake in my post that may clear some things up. I also added an example JSON.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36078039
score: 0
comment on: http://stackoverflow.com/a/23521046
type: Comment
type: AnswerComment
has text: Thanks, but I was thinking Antlr4 is a little too heavy for this purpose. I'm looking for the most efficient way.

http://stackoverflow.com/comment/36152724
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23550802
has text: @Shakti You mean restart EGLContext right? If yes I'm willingly to help you but you have to "ask question" :)
score: 0

http://stackoverflow.com/a/23569794
upvote count: 35
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23569213
type: Answer
has body: HTTP Error 415 Unsupported media type - means that you send the data which is not supported by the service. In this case it means that you don't set the Content-Type header and actual content in the request. I suppose the JSON is expected content, so your call should look like this: this.mockMvc.perform(post("/payment").contentType(MediaType.APPLICATION_JSON) .content("{\"json\":\"request to be send\"}")) .andExpect(status().isOk()) .and_the_rest_of_validation_part
answers question: http://stackoverflow.com/q/23569213
score: 35

http://stackoverflow.com/comment/36254506
comment on: http://stackoverflow.com/q/23615094
score: 0
has text: That URL returns nothing for me on firefox or chrome, indicating that the site likely sets a cookie on a previous page, then checks for it before returning the results (probably an anti-scraping measure).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36101263
score: 0
type: Comment
has text: I converted the image to Black and white using Otsu's method for thresholding with the hope of getting object/background pixels ratio to a certain range for images that have mostly text but that didn't work very well. Any suggestion on recognizing lines? @JoopEggen
type: AnswerComment
comment on: http://stackoverflow.com/a/23531212

http://stackoverflow.com/comment/35958471
has text: Do you have any antivirus software on Windows 8?
score: 0
comment on: http://stackoverflow.com/q/23456861
type: QuestionComment
type: Comment

collections
tags question: http://stackoverflow.com/q/23543663
tags question: http://stackoverflow.com/q/23529720
tags question: http://stackoverflow.com/q/23570637
tags question: http://stackoverflow.com/q/23602973
tags question: http://stackoverflow.com/q/23489718
tags question: http://stackoverflow.com/q/23526672
tags question: http://stackoverflow.com/q/23518887
tags question: http://stackoverflow.com/q/23474574
tags question: http://stackoverflow.com/q/23612460
tags question: http://stackoverflow.com/q/23540287
tags question: http://stackoverflow.com/q/23610488
tags question: http://stackoverflow.com/q/23563343
tags question: http://stackoverflow.com/q/23455836
type: Tag
tags question: http://stackoverflow.com/q/23510754
tags question: http://stackoverflow.com/q/23477274
tags question: http://stackoverflow.com/q/23509964
tags question: http://stackoverflow.com/q/23605955
tags question: http://stackoverflow.com/q/23609880
tags question: http://stackoverflow.com/q/23527163
tags question: http://stackoverflow.com/q/23554208
tags question: http://stackoverflow.com/q/23465433
tags question: http://stackoverflow.com/q/23597331
tags question: http://stackoverflow.com/q/23589851
tags question: http://stackoverflow.com/q/23545394
tag name: collections
tags question: http://stackoverflow.com/q/23604055
tags question: http://stackoverflow.com/q/23582753
tags question: http://stackoverflow.com/q/23547584
tags question: http://stackoverflow.com/q/23523182
tags question: http://stackoverflow.com/q/23563728
tags question: http://stackoverflow.com/q/23599739
tags question: http://stackoverflow.com/q/23608964
tags question: http://stackoverflow.com/q/23469242

http://stackoverflow.com/q/23605744
tagged with: swing
has comment: http://stackoverflow.com/comment/36237021
has title: KeyAdapter creating weird boxes
type: Question
has body: public void keyReleased(KeyEvent e){ int key = e.getKeyCode(); for(GameObject tempObject : handler.object){ if(tempObject.getID() == ObjectID.Player){ if(key == KeyEvent.VK_D){ tempObject.setVelX(0); } if(key == KeyEvent.VK_A){ tempObject.setVelX(0); } if(key == KeyEvent.VK_S){ tempObject.setVelY(0); } if(key == KeyEvent.VK_W){ tempObject.setVelY(0); } } } if(Game.getChat().isWorking()){ Game.getChat().passText(e.getKeyChar(e.getKey)); //.replaceAll("Space", " ").replaceAll("Period", ".").replaceAll("Backspace","").replaceAll("Shift","Shift").replaceAll("Slash","/").replaceAll("comma",",") } } } This code basically checks when a user releases a key while typing something in the chat box for my game. Then it passes it onto a method that basically sets the text to be rendered in the game to that. This really doesn't matter though, the problem is this: As you can see, those annoying boxes only appear when I have shift being released. More code: KeyInput: http://pastebin.com/BM8yZ1i6 Game Class: http://pastebin.com/vViQ23pS Static Chat: http: (slash slash) pastebin (dot) com/CgQE7SgN ChatManager: http: (slash slash) pastebin (dot) com/yVM5rdUs Additional info: when I System out the text that is being typed, the boxes are not boxes, they are question marks instead.
tagged with: java
has comment: http://stackoverflow.com/comment/36239001
has comment: http://stackoverflow.com/comment/36236519
has comment: http://stackoverflow.com/comment/36236902
score: 0
has comment: http://stackoverflow.com/comment/36236611
answer count: 0
type: UnansweredQuestion
tagged with: shift

http://stackoverflow.com/a/42932557
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23590808
downvote count: 0
type: Answer
has body: /** * @param source : source kStream to sink output-topic */ private static void pipe(KStream&lt;String, String&gt; source) { source.to(Serdes.String(), Serdes.String(), new StreamPartitioner&lt;String, String&gt;() { @Override public Integer partition(String arg0, String arg1, int arg2) { return 0; } }, "output-topic"); } above code will write record at partition 1 of topic name "output-topic"

http://stackoverflow.com/a/26316668
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/23469061
downvote count: 0
type: Answer
has body: I was able to solve this permanentelly using this answer: https://stackoverflow.com/a/25932828/3939832 This is usefull if you have Oracle java 7 or 8 installed. Exporting variables in my case was not a permanent solution. You should check what R is using as environment by doing: Sys.getenv("JAVA_HOME") and then you can use that environment by creating a java.conf file on /etc/ld.so.conf.d/ as stated in the above answer link.

http://stackoverflow.com/a/23461993
upvote count: 2
has body: Yes, in Java at least, interface implementation propagates from superclass to subclass. In a general sense, both class inheritance and interface implementation represent an "is-a" relationship: interface Vehicle { /* ... */ } class Car implements Vehicle { /* ... */ } class ElectricCar extends Car { /* ... */ } // This works because ElectricCar is a Car, which is a Vehicle. Vehicle vehicle = new ElectricCar(); In practice, methods that are part of an interface implementation are required to be public, so any instantiable implementor of an interface (e.g. ElectricCar above) will have exposed all of the methods required by the interface, either by inheritance from its superclass or by its own necessarily-public overrides. Note that nothing is "automatically implemented": If Car were marked abstract it could be missing implementations for one or more of Vehicle's methods, as if Car had itself marked the unimplemented Vehicle method as abstract. Under any circumstance, the subclass ElectricCar would be considered (and required to be) an implementor of Vehicle, but consequently if Car doesn't provide an implementation of a Vehicle method then ElectricCar will not compile until it provides its own.
answers question: http://stackoverflow.com/q/23461769
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23461769
type: Answer

http://stackoverflow.com/q/23538005
has answer: http://stackoverflow.com/a/23538642
has comment: http://stackoverflow.com/comment/36110353
has comment: http://stackoverflow.com/comment/36110552
tagged with: swing
has answer: http://stackoverflow.com/a/23538356
possible better answer: http://stackoverflow.com/a/23538642
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36110717
has body: First of all, apologies for how long winded this is. I'm trying to make a simple roulette game that allows a user to add players, place bets for these players, and spin the roulette wheel, which is represented as a simple JLabel that updates it's text with each number it passes. However, I've run into a bug that I'm having a lot of trouble with: the JLabel only updates the text for the last element in my loop. Basically, my solution works like this: When a user presses a button labelled "Spin" (given that users have been added to the game), I call a method from a class called SpinWheelService, which is an Observable singleton which in turn calls the notifyObservers() method: public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); String description = null; if (ADD_PLAYER.equals(cmd)) { addDialog(); } else if (PLACE_BET.equals(cmd)) { betDialog(); } else if (SPIN.equals(cmd)) { SpinWheelService.sws.setSpinWheelService(); } else if (DISPLAY.equals(cmd)) { System.out.println("Display selected!"); } } Here is my SpinWheelService class: package model; import java.util.*; public class SpinWheelService extends Observable { public static SpinWheelService sws = new SpinWheelService(); public void setSpinWheelService() { setChanged(); notifyObservers(); } } The only listener registered for SpinWheelService is this class, where GameEngine is my game engine that handles internal game logic, WheelCallbackImpl is a class that updates the View: class SpinWheelObserver implements Observer { GameEngine gameEngine; ArrayList&lt;SimplePlayer&gt; players; WheelCallbackImpl wheelCall; int n; public SpinWheelObserver(GameEngine engine, WheelCallbackImpl wheel, ArrayList&lt;SimplePlayer&gt; playerList) { players = playerList; gameEngine = engine; wheelCall = wheel; } public void update(Observable sender, Object arg) { // check if any players are present if (players.size() == 0) { System.out.println("Empty player array!"); return; } do { gameEngine.spin(40, 1, 300, …
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/36110938
tagged with: awt
has comment: http://stackoverflow.com/comment/36110304
answer count: 3
has answer: http://stackoverflow.com/a/23538298
has title: JLabel.setText() is only setting text for last element in a loop
accepted answer: http://stackoverflow.com/a/23538298
tagged with: user-interface
favorite count: 0
tagged with: event-dispatch-thread

http://stackoverflow.com/a/23538503
type: Answer
has body: You could create class to save state of data you have got and override method equals for compare in your class. Further, for save data use ArrayList. For compare used next code. Collection&lt;YourObject&gt; one= new ArrayList(Arrays.asList(obj1, obj2, obj3)); Collection&lt;YourObject&gt; two = new ArrayList(Arrays.asList(obj1, obj2, obj3)); one.equals(two)
answers question: http://stackoverflow.com/q/23538265
has comment: http://stackoverflow.com/comment/36110882
score: 0

http://stackoverflow.com/comment/36226133
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23600044
score: 1
has text: It's not in the runtime CLASSPATH.

http://stackoverflow.com/comment/36133695
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23550497
type: AnswerComment
has text: Double or float, you can use what you want. "I can only resize by height and not by width because of the structure my programm has." Please explain the because it doesn't make realy sense to me.

http://stackoverflow.com/a/23462753
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35970157
type: Answer
upvote count: 1
has body: When doing the comparison, you are storing the student object in temp. Instead just store the gpa in temp, so tmp = students[i].getGPA() (or whatever your accessor for gpa is) and compare it against students[j].getGPA(). You can still swap the students themselves, just compare the GPA. Also, as for the actual sorting, there are a variety of sorting algorithms you can use (bubble, selection, merge, quicksort, etc). I have not verified the correctness of your sort algorithm, but the more efficient sort algorithms are not n^2 complexity.
has comment: http://stackoverflow.com/comment/35970081
score: 1
accepted answer of: http://stackoverflow.com/q/23462722
has comment: http://stackoverflow.com/comment/35969869
answers question: http://stackoverflow.com/q/23462722
has comment: http://stackoverflow.com/comment/35970039
has comment: http://stackoverflow.com/comment/35969951

http://stackoverflow.com/comment/36022632
score: 0
type: AnswerComment
has text: Didn't know about the existence of those callbacks. Thanks! Your answer makes perfect sense but I can only test it later. I will accept it or give more details as soon as I'm able to.
type: Comment
comment on: http://stackoverflow.com/a/23491407

http://stackoverflow.com/q/23508491
upvote count: 1
downvote count: 1
has title: Java seems to be ignoring my toString method
has answer: http://stackoverflow.com/a/23508636
type: Question
has comment: http://stackoverflow.com/comment/36143545
has answer: http://stackoverflow.com/a/23508609
has comment: http://stackoverflow.com/comment/36054880
has comment: http://stackoverflow.com/comment/36054903
tagged with: overriding
has answer: http://stackoverflow.com/a/23508590
possible better answer: http://stackoverflow.com/a/23508609
has body: Ok, so I have made a toString() method for this Coordinate Class, but when I try to print a Coordinate using system.out.print(), it seems to ignore my method and just use the Object.toString() method, and just returns a memory address. Here is my code for the toString method: package spacetable; public class Coordinate { private int x; private int y; public Coordinate(){ x=0; y=0; } public Coordinate(int x, int y){ this.x = x; this.y = y; } public int getX(){ return x; } public int getY(){ return y; } public double distTo(Coordinate xy){ double run = xy.getX() - this.getX(); double rise = xy.getY() - this.getX(); double dist = sqrt(run*run + rise*rise); return dist; } public double distTo(int x, int y){ double run = x - this.getX(); double rise = y - this.getX(); double dist = sqrt(run*run + rise*rise); return dist; } @Override public String toString(){ String Strx = Integer.toString(x); String Stry = Integer.toString(y); String result = "(" Strx + ", " + Stry + ")"; return result; } } and my code that tries to print: package spacetable; public class CordinateTest { public static void main(String[] args) { Coordinate place = new Coordinate(2,3); System.out.println(place); } } And the output is: spacetable.Coordinate@e53108 why is my toString() being ignored?
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23508636
favorite count: 0
has comment: http://stackoverflow.com/comment/36055054
has comment: http://stackoverflow.com/comment/36054930
has comment: http://stackoverflow.com/comment/36054955
has comment: http://stackoverflow.com/comment/36054950
has comment: http://stackoverflow.com/comment/36055007
tagged with: tostring
has comment: http://stackoverflow.com/comment/36054901
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/23464032
score: 1
accepted answer of: http://stackoverflow.com/q/23464016
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23464016
has body: It looks like your indices are rows and indices instead of i and j.
upvote count: 1

http://stackoverflow.com/q/23489362
answer count: 3
downvote count: 3
has comment: http://stackoverflow.com/comment/36019172
has answer: http://stackoverflow.com/a/23490041
type: UnansweredQuestion
has body: I need help. I want to appear for upgrade to java se 7 programmer certification exam. While searching on net, I found this.. Oracle Tutorial for upgrade to java se 7 certification Is there any book for the same? Thanks
tagged with: ocpjp
type: Question
favorite count: 0
tagged with: scjp
has comment: http://stackoverflow.com/comment/36019335
has answer: http://stackoverflow.com/a/23489547
has answer: http://stackoverflow.com/a/23489927
upvote count: 3
score: 0
tagged with: java
has title: Is there any book for upgrade to java se 7 programmer certification exam?

http://stackoverflow.com/comment/36178498
type: Comment
has text: Vice Versa can you make it look like a Mac on a Windows machine.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23574169

http://stackoverflow.com/a/23498542
downvote count: 0
type: Answer
has body: When you use CascadeType.ALL, whenever you do any operation on the parent all those operations would also get cascaded to the child. Yes you should call saveOrUpdate(parent) In your case as the parent objects are already existing. You could load the existing parent and create a new child and attach the child to parent and when you call saveOrUpdate(parent), it should update the parent and create all those child and relate it to that parent. Yes it is generating a id for child, because it is trying to create a child due to cascade all and you could have configured it to generate id in @Id. Enable sql logs using hibernate.show_sql to understand better whats happening. I assume you would have a @JoinColumn in your child which would map to the parent primary key.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23497740
answers question: http://stackoverflow.com/q/23497740
score: 1
has comment: http://stackoverflow.com/comment/36044500
type: AcceptedAnswer

http://stackoverflow.com/comment/36200123
has text: No, I can't find those annywhere
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23585635
type: AnswerComment

http://stackoverflow.com/comment/36212555
type: QuestionComment
comment on: http://stackoverflow.com/q/23581058
score: 0
has text: @Voo I see that this stems from the design of streams really. As a terminal operation `sum()` may be the end of a compound-operation, so it couldn't easily apply such heuristics, even if it was in control of the threading.
type: Comment

http://stackoverflow.com/comment/36247436
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23609324
has text: `@Before` could be a lot of things. The code I posted would initialize a component at application start up.
type: Comment

http://stackoverflow.com/a/30498514
score: 53
has comment: http://stackoverflow.com/comment/102865006
downvote count: 1
has comment: http://stackoverflow.com/comment/69506014
has body: Here is a basic function that uses okhttp to upload a file and some arbitrary field (it literally simulates a regular HTML form submission) Change the mime type to match your file (here I am assuming .csv) or make it a parameter to the function if you are going to upload different file types public static Boolean uploadFile(String serverURL, File file) { try { RequestBody requestBody = new MultipartBody.Builder().setType(MultipartBody.FORM) .addFormDataPart("file", file.getName(), RequestBody.create(MediaType.parse("text/csv"), file)) .addFormDataPart("some-field", "some-value") .build(); Request request = new Request.Builder() .url(serverURL) .post(requestBody) .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(final Call call, final IOException e) { // Handle the error } @Override public void onResponse(final Call call, final Response response) throws IOException { if (!response.isSuccessful()) { // Handle the error } // Upload successful } }); return true; } catch (Exception ex) { // Handle the error } return false; } Note: because it is async call, the boolean return type does not indicate successful upload but only that the request was submitted to okhttp queue.
has comment: http://stackoverflow.com/comment/58103780
answers question: http://stackoverflow.com/q/23512547
has comment: http://stackoverflow.com/comment/58091188
type: Answer
upvote count: 54
has comment: http://stackoverflow.com/comment/69505017

http://stackoverflow.com/q/23528218
accepted answer: http://stackoverflow.com/a/23528892
upvote count: 7
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/2745265
has answer: http://stackoverflow.com/a/23528892
possible better answer: http://stackoverflow.com/a/23528298
has comment: http://stackoverflow.com/comment/36092514
tagged with: diamond-operator
score: 6
has comment: http://stackoverflow.com/comment/36092529
has comment: http://stackoverflow.com/comment/36092230
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36092389
has body: class A {} class B extends A {} class Holder&lt;T&gt; { T object; Holder(T object) { this.object = object; } } There's a Holder class to hold some object, created using generics. In the main(), when initialized using the diamond operator it doesn't compile (Java 7) with derived class passed to the Holder's constructor (required A / found B): public static void main(String[] args) { Holder&lt;A&gt; holder = new Holder&lt;&gt;(new B()); } But it compiles and works if the base type is specified in the right part: public static void main(String[] args) { Holder&lt;A&gt; holder = new Holder&lt;A&gt;(new B()); } Why? Doesn't diamond operator define the right part of the assignment with the same type parameters as the left side?
tagged with: java
has comment: http://stackoverflow.com/comment/36092786
has comment: http://stackoverflow.com/comment/36092452
has title: Java 7 diamond operator and initialization with the derived class
type: Question
has comment: http://stackoverflow.com/comment/36092292
has comment: http://stackoverflow.com/comment/36093537
has answer: http://stackoverflow.com/a/23528298
answer count: 2

http://stackoverflow.com/comment/36126954
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23547045
has text: Have you at least looked at the documentation? http://docs.oracle.com/javase/6/docs/api/java/util/GregorianCalendar.html
score: 0

http://stackoverflow.com/comment/36223843
has text: And binary what? What "binary representation" is that? Note that you `.getBytes()` without specifying the encoding; if I `.getBytes(StandardCharsets.UTF_16)` I will obtain a different result than if I `.getBytes(StandardCharsets.US_ASCII)`.
score: 0
comment on: http://stackoverflow.com/q/23598796
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23518862
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: google-ads-api
has comment: http://stackoverflow.com/comment/36164782
has answer: http://stackoverflow.com/a/27445218
favorite count: 0
has body: I have a problem during creating the campaign. I have test account on google Adwords. I used code from google: AddCampaigns.java Im getting error: [OperationAccessDenied.ADD_OPERATION_NOT_PERMITTED @ class campaignmgmt.campaign.MutateAction (ADD) requires CREATE_CAMPAIGN, OperationAccessDenied.ADD_OPERATION_NOT_PERMITTED @ class campaignmgmt.campaign.MutateAction (ADD) requires CREATE_CAMPAIGN] It occurs in line: // Add campaigns. CampaignReturnValue result = campaignService.mutate(operations); I found one problem this type on a google dev webpage, however the 'solution' did not help. Anyone have any idea why is it happening? Thank you so much and have a nice day!
upvote count: 1
accepted answer: http://stackoverflow.com/a/27445218
type: AnsweredQuestion
has title: Adding campaign in google AdWords

http://stackoverflow.com/q/23493732
has body: I'm doing a prototype for showing some basic functions of a painting program. Now, here is how the window looks like: The window is compound of a panel with a vertical BoxLayout, inside it, there are a custom image control and another panel with a FlowLayout containing all the buttons. The problem is that I have to specify the height for the buttons panel (in 100px). If I delete that line, the window looks like this: But, if I only specify the width, and I write a 0 for the height, I get this: I want the layouts determine the correct height of the buttons panel by themselves. Here is the code that produces the first image: public void createAndShowGui(){ JFrame.setDefaultLookAndFeelDecorated(true); setTitle("SimplePaint"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); //Main container layout. BoxLayout mainLayout = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS); getContentPane().setLayout(mainLayout); drawingPanel = new JPanel(); drawingPanel.setLayout(null); drawingPanel.setPreferredSize(new Dimension(width, height)); TextBox editor = new TextBox(); drawingPanel.add(editor); editor.setVisible(false); canvasControl = new DrawableCanvas(editor); drawingPanel.add(canvasControl); canvasControl.setBounds(0, 0, width, height); getContentPane().add(drawingPanel); drawingSurface = canvasControl.getDrawingSurface(); //Buttons layout. FlowLayout buttonsLayout = new FlowLayout(); JPanel buttonsPanel = new JPanel(buttonsLayout); buttonsPanel.setPreferredSize(new Dimension(width, 100)); // &lt;-- Not in this way //Buttons creation... pack(); } Thanks in advance.
has comment: http://stackoverflow.com/comment/36058860
tagged with: flowlayout
has comment: http://stackoverflow.com/comment/36031957
tagged with: java
tagged with: swing
has title: How can I use Swing FlowLayout with fixed width?
has answer: http://stackoverflow.com/a/23499116
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36064896
has comment: http://stackoverflow.com/comment/36027192
score: 4
upvote count: 4
tagged with: layout
answer count: 1
downvote count: 0
tagged with: layout-manager
accepted answer: http://stackoverflow.com/a/23499116
has comment: http://stackoverflow.com/comment/36027063
favorite count: 0

http://stackoverflow.com/a/23522275
answers question: http://stackoverflow.com/q/23483192
type: Answer
score: 0
has body: After more hair pulling I did two things to isolate and resolve the issue, first I created a a default constructor and initialized the parameters to sensible defaults, null for strings and 0 for Ints, then I renamed all my XML IDs to match the Java variables I created in the Activity. Now I am able to create instance of my Customer objects and persist to database.

http://stackoverflow.com/comment/36017514
comment on: http://stackoverflow.com/a/23488739
type: AnswerComment
score: 0
type: Comment
has text: **^** is not OR but XOR!

http://stackoverflow.com/q/23608613
accepted answer: http://stackoverflow.com/a/23609047
tagged with: java
has title: Spring MVC, controller: how to convert string to List<Integer> and List<Date[]>?
downvote count: 1
type: Question
has body: Hope you are doing well. I have a question that's related to Spring MVC and its controller. I have following code snippets inside a controller: @RequestMapping(value = "/booking-curve/history/journeys/{journeyIds}/travel-date-ranges/{travelDateRanges}", method = RequestMethod.GET) @ResponseBody public String generateHistoricalBookingCurve(@PathVariable List&lt;Integer&gt; journeyIds, @PathVariable List&lt;Date[]&gt; travelDateRanges) { double[] aveBookingLoadFactors = pricingService.calculateAveBookingLoadFactors(journeyIds, travelDateRanges); JsonNodeFactory nodeFactory = JsonNodeFactory.instance; ArrayNode array = nodeFactory.arrayNode(); for (int i = 0; i &lt; aveBookingLoadFactors.length; i++) { ObjectNode object = nodeFactory.objectNode(); object.put("daysBefore", aveBookingLoadFactors.length - 1 - i); object.put("aveBookingLoadFactor", aveBookingLoadFactors[i]); array.add(object); } return array.toString(); } the journeyIds in the url link is made up of comma separated ids, and travelDateRanges in the url link is made up of comma separated from to date pairs. e.g. journeyIds are somethings like 11,22,44 and travelDateRanges are somethings like 2012-11-11to2012-12-01,2014-02-11to2014-05-03. I want to spring mvc can automatically convert above strings to List'&lt;'Integer'>' and List'&lt;'Date[]'>' as shown in my method above. I think PropertyEditor or Converter are supposed to work for my case, but I tried without luck or probably I didn't configure them correctly. Experts here, please shed some light on my questions! Thank you very much! Best regards,
has answer: http://stackoverflow.com/a/23609047
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/36276796
answer count: 1
has comment: http://stackoverflow.com/comment/36242132
favorite count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/48676186
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23572460
has text: I have this same issue. Guess the only workaround is to downgrade

http://stackoverflow.com/a/23601696
answers question: http://stackoverflow.com/q/23601628
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: I would suggest using a ballot box and making the developers choose anonymously. The answers you're going to get for this question will in all likelyhood be extremely opinionated so just go with your gut. Both scale easily to a 100k users so you won't run into trouble there. In essence this is a decision you have to make for yourself, based on your preferences.

http://stackoverflow.com/a/24653831
has comment: http://stackoverflow.com/comment/123852681
type: AcceptedAnswer
downvote count: 0
has body: You can find all worklog records for selected issue: List&lt;Worklog&gt; worklogByIssue = ComponentAccessor.getWorklogManager().getByIssue(issue); After that you can parse all worklog records to determine for what user this record created: for (Worklog worklogByIssueItem : worklogByIssue) { int timeSpent = worklogByIssueItem.getTimeSpent().intValue(); String worklogAuthorName = worklogByIssueItem.getAuthorObject().getName(); ... } And last task is search of issues by some params: public static List&lt;Issue&gt; searchIssues(SearchParametersAggregator searchParams) { String jqlQuery = searchParams.getJqlQuery(); String projectId = searchParams.getProjectId(); String condition = createCondition(jqlQuery, projectId); JqlQueryBuilder jqlQueryBuilder = prepareJqlQueryBuilder(condition); return searchIssues(jqlQueryBuilder); } static List&lt;Issue&gt; searchIssues(JqlQueryBuilder jqlQueryBuilder) { Query query = jqlQueryBuilder.buildQuery(); SearchService searchService = ComponentAccessor.getComponent(SearchService.class); try { ApplicationUser applicationUser = ComponentAccessor.getJiraAuthenticationContext().getUser(); User user = applicationUser.getDirectoryUser(); SearchResults searchResults = searchService.search(user, query, PagerFilter.getUnlimitedFilter()); List&lt;Issue&gt; issues = searchResults.getIssues(); return issues; } catch (SearchException e) { LOGGER.error("Error occurs during search of issues"); e.printStackTrace(); } return new ArrayList&lt;Issue&gt;(); } static JqlQueryBuilder prepareJqlQueryBuilder(String condition) { try { Query query = jqlQueryParser.parseQuery(condition); JqlQueryBuilder builder = JqlQueryBuilder.newBuilder(query); return builder; } catch (JqlParseException e) { throw new RuntimeException("JqlParseException during parsing jqlQuery!"); } }
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23472620
has comment: http://stackoverflow.com/comment/38940134
accepted answer of: http://stackoverflow.com/q/23472620
has comment: http://stackoverflow.com/comment/38939837
has comment: http://stackoverflow.com/comment/38939591

http://stackoverflow.com/comment/36106131
has text: It's not changed as String is immutable. `replaceAll` returns the new String
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23535771

http://stackoverflow.com/comment/35997237
has text: It is safe if both classes `A` and `B` are defined by the same `ClassLoader`. Given the simplicity of the example, it’s always safe as the `PrintStream` does it’s own synchronization. But if you use `Sync.class` to guard access to resources within the `class Sync` it is safe as well, because *if* `A` and `B` are loaded by different `ClassLoader`s and receive a different `Class` instance for `Sync` they will access different resources when accessing fields of `class Sync`. (That might contradict your intentions, but don’t try to fix a misbehaving `ClassLoader` within *your* application code…)
type: Comment
comment on: http://stackoverflow.com/a/23474238
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36228614
comment on: http://stackoverflow.com/q/23532246
has text: Take a look at [this answer](http://stackoverflow.com/questions/21106431/parse-html-table-after-clicking-a-button-to-make-it-visible/21113377#21113377) to get an idea.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23485608
favorite count: 0
possible better answer: http://stackoverflow.com/a/23485717
score: 0
has answer: http://stackoverflow.com/a/23485717
has answer: http://stackoverflow.com/a/23485719
accepted answer: http://stackoverflow.com/a/23485719
tagged with: regex
tagged with: pattern-matching
has comment: http://stackoverflow.com/comment/36012421
has body: I have list of keywords: String[] keywords = {"xxxx", "yyyy", "zzzz"}; String[] another = {"aaa", "bbb", "ccc"}; I am trying to identify text that has one of the keywords followed by a space and then followed by one of the "another" words. if I use: Pattern pattern = Pattern.compile(keywords+"\\s"+another); This throws an exception at runtime: Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class near index 57 [Ljava.lang.String;@3dd4ab05\s[Ljava.lang.String;@5527f4f9 ^ How can I fix this?
type: AnsweredQuestion
tagged with: java
has title: Why does this use, in Java, of regular expressions throw an "Unclosed character class" exception at runtime?
type: Question
upvote count: 2
downvote count: 2
answer count: 2

http://stackoverflow.com/q/23554179
has comment: http://stackoverflow.com/comment/36140623
has comment: http://stackoverflow.com/comment/36141223
type: UnansweredQuestion
tagged with: java
type: Question
score: -2
has answer: http://stackoverflow.com/a/23554216
has title: method processTickets in class BlancovichProject3 cannot be applied to given types
has body: I am getting an error that looks like this: 1 error found: File: C:\Users\Josh\Documents\java\BlancovichProject3.java [line: 18] Error: method processTickets in class BlancovichProject3 cannot be applied to given types; required: java.lang.String,java.lang.String found: no arguments reason: actual and formal argument lists differ in length I am getting the error in the third method where it processes tickets. The code that has the problem is here: import java.util.Scanner; import java.io.*; public class BlancovichProject3 { static Scanner keyboard = new Scanner(System.in); public static void main(String[] args) throws IOException { //methods String inputFileName=getInputFileName(); String outputFileName=getOutputFileName(); processTickets(); } //getting the input file name public static String getInputFileName() { String inputFileName; System.out.println("what is the name of the input file ?"); inputFileName=keyboard.nextLine(); return inputFileName; } //getting the output file name public static String getOutputFileName() { String outputFileName; System.out.println("What would you like to save this file to?"); outputFileName=keyboard.nextLine(); return outputFileName; } // processing tickets public static void processTickets(String inputFileName, String outputFileName)throws IOException { PrintWriter outputFile=new PrintWriter(outputFileName); int amount; // the tickets prices int tprice1=0; int tprice2=0; int tprice3=0; String ticket1=null; String ticket2=null; String ticket3=null; // the total price double price=0; // customers name String firstName; String lastName; // type of ticket String seat; //processing tickets File file = new File(inputFileName); Scanner inputFile = new Scanner(file); ticket1=inputFile.next(); tprice1=inputFile.nextInt(); ticket2=inputFile.next(); tprice2=inputFile.nextInt(); ticket3=inputFile.next(); tprice3=inputFile.nextInt(); outputFile.println(ticket1 + " "+"$" + tprice1); outputFile.println(ticket2 + " "+"$" + tprice2); outputFile.p…
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23554202
favorite count: 0
downvote count: 3

http://stackoverflow.com/a/23491066
score: 0
has body: public float distanceFrom(float lat1, float lng1, float lat2, float lng2) { double earthRadius = 3958.75; double dLat = Math.toRadians(lat2-lat1); double dLng = Math.toRadians(lng2-lng1); double a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(Math.toRadians(lat1)) *Math.cos(Math.toRadians(lat2)) * Math.sin(dLng/2) * Math.sin(dLng/2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); double dist = earthRadius * c; int meterConversion = 1609; return new Float(dist * meterConversion).floatValue(); }
type: Answer
accepted answer of: http://stackoverflow.com/q/23490952
answers question: http://stackoverflow.com/q/23490952
type: AcceptedAnswer

http://stackoverflow.com/a/23583171
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36195174
accepted answer of: http://stackoverflow.com/q/23582694
has comment: http://stackoverflow.com/comment/36195577
type: Answer
answers question: http://stackoverflow.com/q/23582694
has body: You need to convert the alphabet array to List to use the indexOf method: private List&lt;Character&gt; alphabetList = java.util.Arrays.asList(alphabet); Inside you can then do the following: decodedText[i] = alphabet[(alphabetList.indexOf(message[i])+key) % alphabet.length]; You should probably begin the iteration of key with 1 and not with 0, because you will then just get the ciphertext back. Complete solution: public class Test01 { private Character[] 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[] decodedText; private String[] plainText; private java.util.List&lt;Character&gt; alphabetList; public Test01(){ alphabetList = java.util.Arrays.asList(alphabet); plainText = new String[alphabet.length]; } public String[] producePlaintext(String cipherText) { //put each letter of the ciphertext in an array of characters in the upper case format char[] message = cipherText.toUpperCase().toCharArray(); //loop through all the possible keys for (int key = 0; key &lt; alphabet.length; key++) { //set the value of the decrypted array of characters to be the same as the length of the cipher text decodedText = new char[message.length]; //loop through the characters of the ciphertext for (int i = 0; i &lt; message.length; i++) { //if character is not space if (message[i] != ' ') { //shift the letters decodedText[i] = alphabet[(alphabetList.indexOf(message[i])+key) % alphabet.length]; }else{ decodedText[i] = ' '; } } plainText[key] = String.valueOf(decodedText); } return plainText; } public static void main(String[] args) { Test01 t = new Test01(); for(String pt : t.producePlaintext("abc")) { System.out.println(pt); } } } Note the differences of the char types.
downvote count: 0

http://stackoverflow.com/q/23526644
has answer: http://stackoverflow.com/a/36243650
has body: I'm attempting to implement an API with resources that are protected by either Oauth2 OR Http-Basic authentication. When I load the WebSecurityConfigurerAdapter which applies http-basic authentication to the resource first, Oauth2 token authentication is not accepted. And vice-versa. Example configurations: This applies http-basic authentication to all /user/** resources @Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { private LoginApi loginApi; @Autowired public void setLoginApi(LoginApi loginApi) { this.loginApi = loginApi; } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.authenticationProvider(new PortalUserAuthenticationProvider(loginApi)); } @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/users/**").authenticated() .and() .httpBasic(); } @Override @Bean public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } } This applies oauth token protection to the /user/** resource @Configuration @EnableResourceServer protected static class ResourceServerConfiguration extends ResourceServerConfigurerAdapter { @Override public void configure(HttpSecurity http) throws Exception { http .requestMatchers().antMatchers("/users/**") .and() .authorizeRequests() .antMatchers("/users/**").access("#oauth2.clientHasRole('ROLE_CLIENT') and #oauth2.hasScope('read')"); } } I'm sure there is some piece of magic code I'm missing which tells spring to attempt both if the first has failed? Any assistance would be most appreciated.
tagged with: spring-security
tagged with: spring-security-oauth2
tagged with: security
has answer: http://stackoverflow.com/a/23575945
has answer: http://stackoverflow.com/a/47218548
favorite count: 0
answer count: 9
score: 54
type: UnansweredQuestion
upvote count: 54
has answer: http://stackoverflow.com/a/28060682
tagged with: java
has answer: http://stackoverflow.com/a/74181822
tagged with: oauth-2.0
has answer: http://stackoverflow.com/a/39403052
has title: Spring security with Oauth2 or Http-Basic authentication for the same resource
type: Question
has answer: http://stackoverflow.com/a/63498728
has answer: http://stackoverflow.com/a/25382366
has answer: http://stackoverflow.com/a/40254402
downvote count: 0

http://stackoverflow.com/a/23538978
type: Answer
has comment: http://stackoverflow.com/comment/36115073
has comment: http://stackoverflow.com/comment/36113015
has body: To be specific, JAVA bin directory is not in your PATH variable. Add it to PATH variable. In order to search the executables, the OS need to have a list of directories to look up. So, Add the directory which contains 'jartool in thePATH` environment variable Note : For Windows, Path separator is (;) and for Unix-like OS, Path separator is (:)
upvote count: 7
score: 7
has comment: http://stackoverflow.com/comment/36112773
has comment: http://stackoverflow.com/comment/36112640
has comment: http://stackoverflow.com/comment/36115438
downvote count: 0
has comment: http://stackoverflow.com/comment/36115593
has comment: http://stackoverflow.com/comment/36118156
answers question: http://stackoverflow.com/q/23538864

http://stackoverflow.com/a/34129328
answers question: http://stackoverflow.com/q/23462940
type: Answer
score: 2
upvote count: 3
has body: Right click on project -> Add framework support -> Select Maven -> Click OK
downvote count: 1

http://stackoverflow.com/comment/36032321
type: AnswerComment
has text: Oh, great :) Looking at where `updateRunning()` and `drawRunningUI()` are called should also help make definite sense out of this. Especially since this is typical drawing paradigm ; in Android framework it would be similarly implemented in `onTouchEvent()` and `onDraw()` for example.
type: Comment
comment on: http://stackoverflow.com/a/23495355
score: 0

http://stackoverflow.com/q/23555264
has body: I've made an enum with 2 values (id of item, exp of item) How do I pull the exp value from the enum? here is the enum; public enum boneData { NORMAL_BONE(526, 5), BIG_BONE(532, 15), BABYDRAGON_BONE(534, 30), DRAGON_BONE(536, 72), DAGGONOTH_BONE(6729, 125); private int boneId; public double boneExp; boneData(int boneId, int boneExp) { this.boneId = boneId; this.boneExp = boneExp; } public int boneId() { return boneId(); } public int boneExp() { return boneExp(); } } This is the method for an array; public int getExp(int id) { for (int j = 0; j &lt; bonesExp.length; j++) { if (bonesExp[j][0] == id) return bonesExp[j][1]; } return 0; } How do I convert it to an enum, thanks!
score: -2
tagged with: java
type: Question
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/23555286
has answer: http://stackoverflow.com/a/23555617
favorite count: 0
has comment: http://stackoverflow.com/comment/36142644
has title: Getting Values from an Enum, how to?
has comment: http://stackoverflow.com/comment/93027834
type: UnansweredQuestion
downvote count: 2
tagged with: enums

http://stackoverflow.com/a/23634706
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23612140
has body: For now I have resolved it like this - @POST @Path("saveIncidents") @Consumes(MediaType.APPLICATION_JSON) public void saveIncidents(String encodedIncidentData) { JSONObject jsonObject = null; String incidentData = ""; StringTokenizer mainTokenizer = new StringTokenizer(encodedIncidentData, "&amp;"); while(mainTokenizer.hasMoreElements()) { String token = mainTokenizer.nextElement().toString(); StringTokenizer innerTokenizer = new StringTokenizer(token, "="); String character = null; while(innerTokenizer.hasMoreElements()) { character = innerTokenizer.nextElement().toString(); } if(character.equals("%2C")){ character = ","; } else if(character.equals("%22")){ character = "\""; } else if(character.equals("%7B")){ character = "{"; } else if(character.equals("%7D")){ character = "}"; } else if(character.equals("%3A")){ character = ":"; } else if(character.equals("%5D")){ character = "]"; } else if(character.equals("%5B")){ character = "["; } else if(character.equals("%20")){ character = " "; } incidentData += character; } try { jsonObject = new JSONObject(incidentData); } catch (JSONException e) { e.printStackTrace(); } } Still, please let me know if any efficient solution is there. Thanks.

http://stackoverflow.com/q/23554966
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
tagged with: graphics
answer count: 2
has answer: http://stackoverflow.com/a/23555096
tagged with: awt
has comment: http://stackoverflow.com/comment/36142247
tagged with: graphics2d
has comment: http://stackoverflow.com/comment/36142134
has body: Hi I need to draw an image and I want only a portion of it to be visible (circle shape) what I planned first was to draw the image (takes up the whole JFrame), then cover it with a black rectangle and then draw a completely transparent circle over the center, but it does not work because you can only see the black rectangle i drew over the image. My second approach is to draw a black rectangle with a circle cut out in the center, so only a portion of the image can be seen. How do I do this? Is there another way to do this? Thanks //the transparent approach int mat[][] = {{0, 0, 0}, {0, 1, 0}, {0, 0, 0}; for (int r = 0; r &lt; mat.length; r++) { for (int c = 0; c &lt; mat[r].length; c++) { if (mat[r][c] == 0) g2d.setPaint(Color.RED) else if (mat[r][c] == 1) g2d.setPaint(Color.BLACK) g2d.fillRect(r * 10, c * 10, 10, 10); } } g2d.setPaint(Color.DARK_GRAY); g2d.fillRect(0, 0, panel.getWidth(), panel.getHeight()); g2d.setPaint(new Color(0f, 0f, 0f, .100f)); g2d.fillOval(0, 0, 100, 100);
score: 1
has title: How do I draw a rectangle with a circle cut out in the middle?
favorite count: 0
tagged with: geometry
upvote count: 2
accepted answer: http://stackoverflow.com/a/23555096
possible better answer: http://stackoverflow.com/a/23555083
has answer: http://stackoverflow.com/a/23555083

http://stackoverflow.com/comment/36271738
comment on: http://stackoverflow.com/q/23601363
type: Comment
type: QuestionComment
has text: Yes, you are right! The third party lib I am using is javassist (mentioned in my question though)
score: 0

http://stackoverflow.com/q/23597143
possible better answer: http://stackoverflow.com/a/23597173
has title: Trying to add sum of all even integers between 2 and the input, and I just get the input back
score: -4
has body: I'm attempting to write something for an assignment that takes the sum of all the even integers between 2 and the number entered by the user and prints it. If it is below 2 it should return an error. I'm getting an error for anything under 2, however, when I go have it return the sum it just returns the input. I think I may have messed a variable up in this loop, but I can't see where I went wrong. import java.util.Scanner; public class EvenSum { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter a number larger than 2"); int num = input.nextInt(); if (num &gt;= 2) { int sum = 0; for (int i = 2; i &lt;= num; i +=2) { sum += i; } System.out.println("The sum of all even numbers between 2 and the input is " + num); } else { System.out.println("Invalid, please enter a number above 2"); } } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23597188
tagged with: java
accepted answer: http://stackoverflow.com/a/23597183
tagged with: loops
type: Question
upvote count: 0
downvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/23597173
has answer: http://stackoverflow.com/a/23597183
favorite count: 0

http://stackoverflow.com/q/23536628
has body: I've got a list of objects of type Catalog. the class Catalog has a method called getName which returns the name of the object. I've got List&lt;Catalogue&gt; catalogList = /*code to retrieve list*/ I tried this but it did not work JList jlist = new JList(catalogList.toArray()); My question is how do I display the names in a Jlist?
downvote count: 0
favorite count: 0
tagged with: jlist
type: AnsweredQuestion
tagged with: list
has answer: http://stackoverflow.com/a/23536763
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23536740
upvote count: 1
type: Question
has title: Display list of objects
possible better answer: http://stackoverflow.com/a/23536778
has answer: http://stackoverflow.com/a/23536778
accepted answer: http://stackoverflow.com/a/23536740
answer count: 3

http://stackoverflow.com/comment/36250039
comment on: http://stackoverflow.com/q/23611541
score: 0
type: Comment
type: QuestionComment
has text: I want to set an icon for all the Tree components. In `tree.setIcon()` description they say that it set all component's icon.

http://stackoverflow.com/comment/36165130
type: Comment
type: QuestionComment
has text: So long as your not calling setContentView, I don't see why anything would be displayed?
score: 0
comment on: http://stackoverflow.com/q/23565912

http://stackoverflow.com/q/23476337
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36051647
tagged with: codebase
upvote count: 0
answer count: 1
score: -1
has title: - RMI code base doesn't work - Registry Lookup very slow and doesn't work
tagged with: rmiregistry
favorite count: 0
type: UnansweredQuestion
tagged with: lookup
has body: I can not understand how to use the codebase. I have the following structure: CLIENT: Client.java client.policy SERVER: Server.java Hello.java HelloInterfaces.java HelloInterfaces.java public interface HelloInterfaces extends Remote { } Hello.java public class Hello extends UnicastRemoteObject implements HelloInterfaces{ public Hello() throws RemoteException{ } } Server.java public class Server { public static void main(String[] arg) throws RemoteException { Registry reg = LocateRegistry.createRegistry(1099); reg.rebind("Hello", new Hello()); System.out.println("Ready"); } } Client.java public class Client { public static void main(String[] args) throws RemoteException, NotBoundException, MalformedURLException { String host="192.168.1.227"; //IP SERVER System.setProperty("java.rmi.server.codebase", "http://" + host + ":8080"); System.setProperty("java.security.policy", "client.policy"); System.setSecurityManager(new RMISecurityManager()); Registry reg = LocateRegistry.getRegistry(host); System.out.println("Regitry Found!"); System.out.println(reg.list().length); System.out.println(reg.list()[0]); HelloInterfaces h; h = (HelloInterfaces) reg.lookup("Hello"); System.out.println(h); } } client.policy grant { permission java.security.AllPermission; }; Execute on server (Virtual Machine with Linux) directly from Netbeans: Output Server: Ready! On the client, I have compiled the source with option --classpath .:Server.jar (where Server.jar contains HelloInterfaces.class). execute Client: Output Client: Registry Found! 1 Hello (Running......) and after two minutes: Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: HelloInterfaces at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at Client.main(Client.java:36) Caused by: java.lang.ClassNotFoundException: HelloInterfaces at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.j…
tagged with: rmi
tagged with: java
has answer: http://stackoverflow.com/a/23482893

http://stackoverflow.com/comment/36016736
has text: @LuiggiMendoza thanks, but that reference is about how to write microbenchmarks well. I'm asking about why we should write microbenchmarks if we've laready had `System.getNanotime()`?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23480236
score: 0

http://stackoverflow.com/comment/36085425
comment on: http://stackoverflow.com/a/23512760
score: 0
type: AnswerComment
has text: UP! anybody can help me?
type: Comment

http://stackoverflow.com/comment/36204175
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23588371
has text: By the way, the problem is completely unrelated to the IDE. Looks like you changed something in your file and that's why this doesn't work *anymore*.
score: 0

http://stackoverflow.com/a/23467012
upvote count: 1
has body: Remove both lines of setting the dialect, Hibernate 4 does a fantastic job of determining which dialect to use based on the JDBC Driver you give it and the database that it connects too. You don't need to specify a dialect. If you force a dialect that is incorrect or doesn't quite match the driver (which can happen as dialects get updated more often than JDBC drivers do) Hibernate might not perform as expected. Configuring Hibernate using a hibernate.cfg.xml is how things were done when using Hibernate 3. Hibernate 4 supports XML configuration within the Spring Application context. (I'm assuming that you are using Spring) It hooks in really smoothly. I suggest that you switch to using the new method of configuring Hibernate as your configuration doctype is set for Hibernate 3. This is how you want to specify a dataSource for Hibernate 4 using the Spring application context. and then you wire it into your session factory like this: true validate
type: Answer
has comment: http://stackoverflow.com/comment/35977664
has comment: http://stackoverflow.com/comment/35977487
has comment: http://stackoverflow.com/comment/35977826
downvote count: 0
has comment: http://stackoverflow.com/comment/36100336
score: 1
has comment: http://stackoverflow.com/comment/35978416
answers question: http://stackoverflow.com/q/23466951
has comment: http://stackoverflow.com/comment/35978292
has comment: http://stackoverflow.com/comment/35977911

http://stackoverflow.com/q/23613704
score: -2
has comment: http://stackoverflow.com/comment/36251805
has comment: http://stackoverflow.com/comment/36252581
has answer: http://stackoverflow.com/a/32337834
has answer: http://stackoverflow.com/a/23613878
tagged with: random
tagged with: divide
upvote count: 0
has comment: http://stackoverflow.com/comment/36263860
has body: So what i need is basically described in the subject. Like if i would put in number 12 and amount of parts it should devide into, i would like it to return something like (with 4 parts) 8, 2, 1, 1. But not doubles because i need the values as int. I had found one answer earlier but it only worked using doubles. not ints. (this is the one i found) public double[] divideUniformlyRandomly(double number, int part) { double uniformRandoms[] = new double[part]; Random random = new Random(); double mean = number / part; double sum = 0.0; for (int i=0; i&lt;part / 2; i++) { uniformRandoms[i] = random.nextDouble() * mean; uniformRandoms[part - i - 1] = mean + random.nextDouble() * mean; sum += uniformRandoms[i] + uniformRandoms[part - i -1]; } uniformRandoms[(int)Math.ceil(part/2)] = uniformRandoms[(int)Math.ceil(part/2)] + number - sum; return uniformRandoms; I had tried changing this code to work using Ints by doing this: public int[] divide(int number) { int part = getDivider(number); int uniformRandoms[] = new int[part]; Random random = new Random(); int mean = number / part; int sum = 0; for (int i=0; i&lt;part / 2; i++) { uniformRandoms[i] = random.nextInt() * mean; uniformRandoms[part - i - 1] = mean + random.nextInt() * mean; sum += uniformRandoms[i] + uniformRandoms[part - i -1]; } uniformRandoms[(int)Math.round(part/2)] = uniformRandoms[(int)Math.round(part/2)] + number - sum; for(int i : uniformRandoms) System.out.println(i); return uniformRandoms; } But when running that using number: 512 and using 10 parts (getDivider() will return 10) itll output this: -1058809647, -2102647561, 469849949, 1627965716, -290084223, -33347991 And alot more of this kind of numbers. Thanks.
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23614324
answer count: 4
has comment: http://stackoverflow.com/comment/36252660
has comment: http://stackoverflow.com/comment/36251532
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36251609
has title: Dividing a number into smaller random ints
has answer: http://stackoverflow.com/a/23616638
type: Question

http://stackoverflow.com/a/23479709
has body: Yes, it is absolutely possible and very easy: val clazz = classOf[String] val ct = ClassTag(clazz) // just use ClassTag.apply() method In your example you'd want to call getRelationModelClass method like this: getRelationModelClass(clazz)(ClassTag(clazz)) This is possible because [T: ClassTag] syntax implicitly creates second parameters list like (implicit ct: ClassTag[T]). Usually it is filled by the compiler, but nothing prevents you from using it explicitly. You also don't really need to pass the class AND class tag for this clazz at the same time to the method. You're not even using explicit class object in its body. Just pass the class tag, it will be enough.
has comment: http://stackoverflow.com/comment/36014128
has comment: http://stackoverflow.com/comment/36009839
upvote count: 9
has comment: http://stackoverflow.com/comment/36008053
accepted answer of: http://stackoverflow.com/q/23479361
answers question: http://stackoverflow.com/q/23479361
has comment: http://stackoverflow.com/comment/36014049
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36756251
score: 9
type: Answer

http://stackoverflow.com/q/23549255
linked to: http://stackoverflow.com/q/2742380
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/2742380
score: 1
linked to: http://stackoverflow.com/q/974973
favorite count: 0
has comment: http://stackoverflow.com/comment/36131093
type: Question
has answer: http://stackoverflow.com/a/23549299
has title: Convert Date to Timestamp
upvote count: 3
possible better answer: http://stackoverflow.com/a/23549420
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/23549420
tagged with: timestamp
accepted answer: http://stackoverflow.com/a/23549299
has body: How to convert Date to Timestamp in java? This line give me the following error: "The constructor Timpestamp(Date) is undefined" Timestamp timestamp = new Timestamp(Date);
tagged with: java
tagged with: date

http://stackoverflow.com/q/23483899
has body: I am trying to check if a string equals quotation marks ("). However, string.equals(""") does not work since it thinks I have an extra quotation mark. How can I check if the string equals quotation marks?
has answer: http://stackoverflow.com/a/23483916
has answer: http://stackoverflow.com/a/23484181
upvote count: 7
accepted answer: http://stackoverflow.com/a/23483916
type: AnsweredQuestion
score: 7
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23484846
downvote count: 0
has answer: http://stackoverflow.com/a/23483921
favorite count: 0
possible better answer: http://stackoverflow.com/a/23483921
answer count: 4
has title: Check if string equals quotation marks

http://stackoverflow.com/comment/36001027
score: 1
comment on: http://stackoverflow.com/q/23479450
has text: at runtime or in your source code?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35952552
type: Comment
has text: As a side note, if you can at all avoid it you don't want shared mutable state, especially anything in a `static` variable. When possible, give it to the needing instance (note that this _can_ still be dangerous, but at least you've made the explicit choice of who to share it with).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23453043

http://stackoverflow.com/a/23597393
score: 0
type: Answer
has body: Specify the position of adding "B" for example ls.add(ls.size() - 1, "B"); Then "F" will be added in last.
answers question: http://stackoverflow.com/q/23597331

http://stackoverflow.com/comment/36046574
comment on: http://stackoverflow.com/q/23503835
score: 0
type: QuestionComment
has text: I'm not getting any errors. Is there any other way I can add an image from a filepath?
type: Comment

http://stackoverflow.com/a/23583959
type: Answer
has comment: http://stackoverflow.com/comment/36196755
has comment: http://stackoverflow.com/comment/36196326
upvote count: 1
has body: Create your own method to add the elements in the map: public void addIntoMap(Map&lt;String, List&lt;Integer&gt;&gt; emp, String key, Integer value) { List&lt;Integer&gt; list = emp.get(key); if (list == null) { list = new ArrayList&lt;Integer&gt;(); emp.put(key, list); } list.add(value); } If you don't want/need to deal with these problems, use MultiMap from Guava.
has comment: http://stackoverflow.com/comment/36196709
answers question: http://stackoverflow.com/q/23583946
score: 1
has comment: http://stackoverflow.com/comment/36195880
has comment: http://stackoverflow.com/comment/36195894
has comment: http://stackoverflow.com/comment/36196279
has comment: http://stackoverflow.com/comment/36196256
downvote count: 0
has comment: http://stackoverflow.com/comment/36196891
has comment: http://stackoverflow.com/comment/36196444
has comment: http://stackoverflow.com/comment/36196461
has comment: http://stackoverflow.com/comment/36196831

http://stackoverflow.com/comment/36095960
type: QuestionComment
score: 0
has text: Well you may be able to configure it given that you're using the `DefaultChannelHandlerContext`. This implies you can create your own that perhaps uses a different sort of channel factory or something.
type: Comment
comment on: http://stackoverflow.com/q/23528586

http://stackoverflow.com/a/23610774
has body: When running a process there is only one environment. The user variables are merged into the system variables, with overwriting existing ones. This complete environment is then retrieved by the System.getenv() method. So you actually see the user's environment variables. I just tested it with these four scenarios: 1) No variable named MYVAR: Running System.out.println(System.getenv("MYVAR")) prints out null. 2) System variable called MYVAR with value System: Running System.out.println(System.getenv("MYVAR")) prints out System. 3) User variable called MYVAR with value User: Running System.out.println(System.getenv("MYVAR")) prints out User. 4) System variable called MYVAR with value System and user variable called MYVAR with value User: Running System.out.println(System.getenv("MYVAR")) prints out User. Maybe you did try it out from an IDE (like Eclipse)? When changing the environment variables, you unfortunately have to restart Eclipse, as they are not correctly propagated to the run configurations.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23610325
score: 14
has comment: http://stackoverflow.com/comment/138056208
upvote count: 14

http://stackoverflow.com/q/23548677
accepted answer: http://stackoverflow.com/a/58985252
answer count: 5
has answer: http://stackoverflow.com/a/23548819
has title: Adding seconds to a Date
has comment: http://stackoverflow.com/comment/36190062
type: AnsweredQuestion
upvote count: 19
linked to: http://stackoverflow.com/q/3581258
downvote count: 2
has comment: http://stackoverflow.com/comment/36130350
has comment: http://stackoverflow.com/comment/36129900
type: Question
has comment: http://stackoverflow.com/comment/36130502
has answer: http://stackoverflow.com/a/58985252
tagged with: java
has comment: http://stackoverflow.com/comment/36129983
possible better answer: http://stackoverflow.com/a/23548927
has answer: http://stackoverflow.com/a/23548927
has comment: http://stackoverflow.com/comment/36145097
has answer: http://stackoverflow.com/a/23548787
linked to: http://stackoverflow.com/q/1999766
has answer: http://stackoverflow.com/a/67892279
has comment: http://stackoverflow.com/comment/36145067
has comment: http://stackoverflow.com/comment/36130639
score: 17
favorite count: 0
has body: I need add a certain time in seconds to my Date. For this, I'm making it: Date startTime = dayStart(dateSelected); startTime.setSeconds(startTime.getSeconds()+30); But, for this way I get this alerts: Multiple markers at this line - The method setSeconds(int) from the type Date is deprecated - The method getSeconds() from the type Date is deprecated What's the better way to don't get these deprecated alerts?

http://stackoverflow.com/a/23526631
has body: Question: Are the two codes invoking the same constructor of String(char[])? No, absolutely not. The first form bakes the the string content directly into the bytecode, then uses the ldc (load constant) instruction to load it from the string pool. Importantly, every occurrence of the string constant "hello" will refer to the same object. Compare that with your second form, which will create a new string every time you execute the statement. As to the details of the field being final: it's a private field anyway, so you shouldn't care. But it's final because Java strings are immutable - there's no reason why you'd want to change the value of it. (In itself that isn't enough to enforce immutability; anyone with access to that char[] can modify the contents of the array.)
answers question: http://stackoverflow.com/q/23526493
score: 4
has comment: http://stackoverflow.com/comment/36090127
has comment: http://stackoverflow.com/comment/36090159
type: AcceptedAnswer
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/36089045
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23526493

http://stackoverflow.com/comment/56818884
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23493684
type: QuestionComment
has text: I think this question is a duplicate of http://stackoverflow.com/questions/7470861/return-multiple-values-from-a-java-method-why-no-n-tuple-objects and has very good answers there (especially: http://stackoverflow.com/a/7471030/1694043). The question is also very similar to http://stackoverflow.com/questions/457629/how-to-return-multiple-objects-from-a-java-method and http://stackoverflow.com/questions/16609269/best-practice-for-returning-multiple-values-in-java.

http://stackoverflow.com/a/23541900
has comment: http://stackoverflow.com/comment/36134853
has body: JOptionPane.showConfirmDialog(null, "Do you want to save your document?", "Save", OptionPane.YES_NO_OPTION); This line is your issue. Within the if statement. You're not actually setting the "reply" variable again, and are still looking at the "reply" variable from the first JOptionPane. Set this to... reply = JOptionPane.showConfirmDialog(null,"Do you want to save your document?", "Save", OptionPane.YES_NO_OPTION); Just like you did in the first iteration.
upvote count: 1
has comment: http://stackoverflow.com/comment/36134653
answers question: http://stackoverflow.com/q/23541267
type: Answer
has comment: http://stackoverflow.com/comment/36135853
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36136302

http://stackoverflow.com/comment/35970368
type: QuestionComment
score: 0
has text: Are you looking for [Random](http://docs.oracle.com/javase/7/docs/api/java/util/Random.html) ?
type: Comment
comment on: http://stackoverflow.com/q/23463126

http://stackoverflow.com/a/23511238
accepted answer of: http://stackoverflow.com/q/23511110
has comment: http://stackoverflow.com/comment/36060187
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/36060012
score: 6
has body: The error is because indexOf is expecting a String not a char so all you have to do is wrap it with String.valueOf sb.setCharAt(sb.indexOf(String.valueOf((sb.charAt(4)))), sb.charAt(0)); outputs just going nuts justjgoing nuts Modern IDEs should catch this compile time error while you type even offer the solution (in the case below IntelliJ):
answers question: http://stackoverflow.com/q/23511110
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36124551
type: QuestionComment
has text: Yes, because you're passing in a file name as if it were a URL. It is malformed. Where's the bug?
comment on: http://stackoverflow.com/q/23544883
score: 0
type: Comment

http://stackoverflow.com/q/23589478
linked to: http://stackoverflow.com/q/6381012
tagged with: javax.sound.sampled
has answer: http://stackoverflow.com/a/23624044
answer count: 1
score: 0
type: UnansweredQuestion
type: Question
has body: I want to create a program that plays one certain .wav file when a certain button is pressed. For example, JButton b1, b2, b3 plays "Music1.wav" , "Music2.wav" , and "Music3.wav" respectively, but only one wav file can only be played at a time. This is what I did, which has problems with stopping the earlier clip and causing two or more wav files to play simultaneously. ... //imports the important stuff public class WAVButtons extends JFrame implements ActionListener { private JButtons b1, b2, b3; private File[] sounds; public WAVButtons() { try { sounds = new File[] {new File("Music1.wav"), new File("Music2.wav"), new File("Music3.wav")}; }catch(Exception e) { } b1 = new JButton("play Music1"); b2 = new JButton("play Music2"); b3 = new JButton("play Music3"); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); ... //codes for GUI } public void actionPerformed(ActionEvent ae) { if(ae.getSource() == b1) { playMusic1(true); playMusic2(false); playMusic3(false); } else if(ae.getSource() == b2) { playMusic1(false); playMusic2(true); playMusic3(false); } else if(ae.getSource() == b3) { playMusic1(false); playMusic2(false); playMusic3(true); } } public void playMusic1(boolean action) { try { AudioInputStream stream = AudioSystem.getAudioInputStream(sounds[0]); AudioFormat format = stream.getFormat(); DataLine.Info info = new DataLine.Info(Clip.class, format); Clip clip = (Clip)AudioSystem.getLine(info); clip.open(stream); if(action) { clip.start(); clip.loop(Clip.LOOP_CONTINUOUSLY); } else clip.stop(); }catch (Exception e) { } } ... //playMusic2() and playMusic3() looks exactly the same as playMusic1(), except that the //parameter of AudioSystem.getAudioInputStream() is sounds[1] and sounds[2], respectively. }
tagged with: audio
has title: How to play .wav files one at a time?
tagged with: java

http://stackoverflow.com/q/23471604
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/23471998
type: Question
has answer: http://stackoverflow.com/a/23475679
has title: JEditorPane get position for character at line and column number
answer count: 2
downvote count: 0
favorite count: 0
tagged with: jeditorpane
type: UnansweredQuestion
tagged with: swing
has body: How to get the Position, for use with setCaret from a given line and column? The component has a single font and it is monospaced. Most other answers I've seen are for determining the line and column number for a given position. I'm looking for the reverse of this. I did see JTextComponent.viewToModel but couldn't get far. There has to be a quick way? :-)
has comment: http://stackoverflow.com/comment/35985608
score: 1

http://stackoverflow.com/comment/36060018
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23511143
has text: I'd use a `List` of `List` for simplicty
score: 0

http://stackoverflow.com/comment/36085180
comment on: http://stackoverflow.com/q/23523597
has text: I'm not a Java guy, but wouldn't `string.split()` be slower than a loop?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23456406
has comment: http://stackoverflow.com/comment/35957642
type: Answer
has comment: http://stackoverflow.com/comment/35957794
has comment: http://stackoverflow.com/comment/35957749
downvote count: 0
has comment: http://stackoverflow.com/comment/35957731
has comment: http://stackoverflow.com/comment/35957988
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35957611
answers question: http://stackoverflow.com/q/23456353
has body: The problem is this line: System.out.println(pref); You have not defined pref in this scope. The field pref is only defined in main method but cannot be read outside of it and therefore outside your main method the pref field has to be defined as well. (You may define it as static member field as well to reduce code duplication.)

http://stackoverflow.com/a/23588284
has comment: http://stackoverflow.com/comment/36204069
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36204054
has comment: http://stackoverflow.com/comment/36204080
has comment: http://stackoverflow.com/comment/36204082
type: Answer
score: 2
downvote count: 0
has body: The problem here is this: Connection conn = null; String url = "jdbc:mysql://localhost:3306/project"; String userid = "root"; String password = ""; pst=conn.prepareStatement(sql); You missed the important step of actually opening the connection, leaving conn null when you try and use it. Try adding the following, before you call conn.prepare... conn = DriverManager.getConnection(url, userid, password);
accepted answer of: http://stackoverflow.com/q/23588261
answers question: http://stackoverflow.com/q/23588261

http://stackoverflow.com/comment/36032350
score: 2
comment on: http://stackoverflow.com/a/23496309
has text: @Karna for a larger number of enum constants it would make sense, but in this case ***a map may actually be slower*** as you will have to box the int to Integer, get the hashcode, rehash, calculate a modulus and then access an array vs. a maximum of 4 comparisons and an array access if you use a plain for loop.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23470115
possible better answer: http://stackoverflow.com/a/23470172
upvote count: 2
tagged with: java
type: Question
tagged with: tostring
has answer: http://stackoverflow.com/a/23470217
tagged with: pojo
has answer: http://stackoverflow.com/a/23470234
tagged with: apache-stringutils
has body: Is it required to add toString() in all the POJO classes? Its kind of a very basic question but I am worried about writing a piece of code in each n every POJO classes. I have followed many java sources and I found a common things in those POJO classes- @Override public String toString() { return StringUtil.toDetailString(this); } Is it required for serialisation or helps in performance improvement or something else?
downvote count: 0
accepted answer: http://stackoverflow.com/a/23470234
has answer: http://stackoverflow.com/a/23470170
favorite count: 0
has title: toString() in POJO Class
has answer: http://stackoverflow.com/a/23470172
answer count: 4
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/36058381
comment on: http://stackoverflow.com/q/23510048
score: 0
type: QuestionComment
has text: I am using IE, but tried with chrome and firefox also. It gave me the same problem
type: Comment

http://stackoverflow.com/comment/110811256
comment on: http://stackoverflow.com/q/23522400
has text: You must provide a slash `/` after the `//host:port`. `jdbc:postgresql://localhost:5432/` - https://jdbc.postgresql.org/documentation/80/connect.html
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35995274
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23475960
type: QuestionComment
has text: we are doing cookie based authentication in other sub-system

http://stackoverflow.com/q/23582002
answer count: 2
has answer: http://stackoverflow.com/a/23582074
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/23582109
type: AnsweredQuestion
has title: How to extract variable from java to jquery?
tagged with: java
downvote count: 3
type: Question
has body: For example I've got some variable in java class, how to I acess it with jquery? If I had a scriplet, I would've done something like &lt;% SomeVariableClass var = SomeVariableClass.getInstance()%&gt; So, how do I do the same with jquery? var variable = ? Or do I need to call a method from servlet or something?
tagged with: jsp
tagged with: jquery
score: -1
accepted answer: http://stackoverflow.com/a/23582074
has answer: http://stackoverflow.com/a/23582109

http://stackoverflow.com/comment/35989479
type: AnswerComment
has text: Thanks for the answer, but unfortunately i do not know the majority of methods you wrote there. Can you direct me to a website or online tutorial from which i can learn them? I tried to look at the oracle tutorials but they are rather confusing.
type: Comment
comment on: http://stackoverflow.com/a/23473504
score: 0

http://stackoverflow.com/comment/100619425
comment on: http://stackoverflow.com/a/23466219
type: AnswerComment
score: 0
has text: element <argLine> is not allowed?
type: Comment

http://stackoverflow.com/a/23506059
score: 0
type: AcceptedAnswer
type: Answer
has body: The new keyword is needed when throwing an exception throw new InterruptedException("..."); but sleep will throw its own InterruptedException so there's no need to throw the exception explicitly try { Thread.sleep (4000); } catch (InterruptedException e) { ... } Read: Pausing Execution with Sleep
accepted answer of: http://stackoverflow.com/q/23506028
answers question: http://stackoverflow.com/q/23506028

http://stackoverflow.com/q/23458328
type: UnansweredQuestion
tagged with: regex
linked to: http://stackoverflow.com/q/15619629
upvote count: 0
tagged with: java
has title: Java regex search
type: Question
score: -2
has answer: http://stackoverflow.com/a/23458374
has comment: http://stackoverflow.com/comment/35961752
downvote count: 2
has body: Could anyone help me - I am taking preparation for my OCJP 6 exam. Here is an example: import java.util.regex.*; class Regex2 { public static void main(String[] args) { Pattern p = Pattern.compile(args[0]); Matcher m = p.matcher(args[1]); boolean b = false; while(b = m.find()) { System.out.print(m.start() + m.group()); } } } compile: javac Regex2.java run: java Regex2 "\d*" ab34ef output: 01234456 The last index is 5(f) so why in output there is 6?
has comment: http://stackoverflow.com/comment/35961541
duplicate of: http://stackoverflow.com/q/15619629
answer count: 1
favorite count: 0

http://stackoverflow.com/a/23485150
has body: Instead of this PhoneActivity.this.startActivity(i); Try this startActivity(i); You don't have any PhoneActivity in your code. Also add this permission in your manifest file
has comment: http://stackoverflow.com/comment/36011457
has comment: http://stackoverflow.com/comment/36011636
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23484994

http://stackoverflow.com/comment/36019210
score: 0
type: QuestionComment
type: Comment
has text: @Alexandre Santos I have alerady read it
comment on: http://stackoverflow.com/q/23489499

http://stackoverflow.com/comment/36140724
type: Comment
comment on: http://stackoverflow.com/a/23544583
score: 0
type: AnswerComment
has text: So you can modify the property `currentPage` the same way.

http://stackoverflow.com/q/23584694
has body: I'm using Leiningen to make a project in Clojure. I have to benchmark this project. I came to the understanding that I have to warm up my JVM. I already to ahead-of-time compilation, does this mean I do not have to warm up my JVM? I understand that calling function f for example 100 times will create a hotspot in the JIT. My benchmarking function load will run the code once with given parameters including a filepath parameter. At the moment I run my function load 1000 times with the same parameters but I pass it a different file path to store its results to. After these 1000 calls are done I execute the function once more with the correct file path. The problem is that my benchmark has side-effects (writing measurements to a file). So I would rather not execute it 1000 times before I do the real run once. At the moment I just give it a dummy file so it still writes to the file but I discard those results. Could somebody elaborate please what I have to pay attention to?
answer count: 2
upvote count: 2
has answer: http://stackoverflow.com/a/23584847
downvote count: 0
tagged with: clojure
tagged with: jvm
favorite count: 0
accepted answer: http://stackoverflow.com/a/23584831
has answer: http://stackoverflow.com/a/23584831
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23584847
tagged with: java
has title: JVM warmup with ahead-of-time compilation
type: Question

http://stackoverflow.com/a/23464572
answers question: http://stackoverflow.com/q/23464539
has body: In Java, fields declared in a subclass "shadow" but do not override fields bound in a superclass like methods do. Fields declared in the subclass exist separately from those in the superclass; you can access the superclass' fields via super.field (or by ((Ancestor) this).field for more distant superclasses). So, the two bounds that you see are really different bounds's - one from InternalNode and one from Node. From what I can tell, it's probably best in your case for you to remove the bounds declarations from LeafNode and InternalNode entirely, leaving it only in the Node class.
score: 0
type: Answer

http://stackoverflow.com/a/23458014
has body: Don't use a null layout. Swing was designed to be used with Layout Managers. The frame.setVisible(true) statement should be executed AFTER all the components have been added to the frame and its child panels.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23457419
downvote count: 0

http://stackoverflow.com/q/23498872
type: UnansweredQuestion
tagged with: functional-testing
has body: I've been building a Mule application for a while now and have just begun experimenting with writing JUnit tests for my flows. The flows I've built typically handle flat-file transformations and are structured similar to the below: <inbound endpoint> ... DO SOMETHING WITH THE FILE ... <outbound endpoint> My inbound/outbound endpoints are specific locations in the environments I'm deploying to and differ for each flow. The question I have is what's the best practice/approach in writing a test to inject a file into my flow and then check the output? Is it normal to create a test copy of the config file with dummy, vm endpoints and inject the file into that? Or is it more appropriate to go with a composite source like below and inject the file into the regular flow? Apologies for the potentially novice question, this is the first time I've worked with automated testing. <composite source> <inbound endpoint> <vm endpoint> <composite source> ... DO SOMETHING WITH THE FILE ... <outbound endpoint> <vm endpoint>
tagged with: java
has title: Mule - separate test config files or vm endpoints for functional testing?
has answer: http://stackoverflow.com/a/23499912
tagged with: mule-studio
type: Question
tagged with: mule
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23499747
tagged with: junit

http://stackoverflow.com/q/23528480
tagged with: javascript
type: UnansweredQuestion
score: 1
has body: I'm working on the design of a program using Play framework for Java. It's a website that requires users to log in and it needs to prevent a user from logging into an account that is already logged in. When a user logs in, the username is stored in the Cache (using memcached). When the user logs out, the username is disacarded from the Cache. If a login attempt is made for a username that exists in the Cache, the login attempt is rejected. For example, a user logs in with the username "joe". Someone from another computer attempts to log in with the username "joe" and it gets rejected because "joe" is already logged in. Simple enough, except when a user closes their browser tab, then they are locked out because their username still exists in the Cache. So, using javascript, I've captured the window.onbeforeunload event to redirect to a route that runs a Java method that clears the Cache. The problem is that window.onbeforeunload is fired when the user clicks a link or reloads the page. So, if the user reloads the page, they are logged out, or if they click on a link within the website, they are logged out. Is there a way to prevent that from happening? Edit: I am using Security.Authenticated to ensure people can't access the website unless they have a session in their cookie. I have a BaseController that extends Controller and all of my controllers extend BaseController (except the one that handles the login page), and the BaseController is annotated with: @Security.Authenticated(Secured.class) Secured ensures that when somebody tries to access the website, if they don't have a session, they are redirected to the login page. Once they log in, a cookie is created with the session and Secured will allow them to access the page.
has answer: http://stackoverflow.com/a/23539453
favorite count: 0
has title: Preventing multiple logins to a website in Play framework
type: Question
upvote count: 1
answer count: 1
tagged with: java
tagged with: playframework
has comment: http://stackoverflow.com/comment/36095154
downvote count: 0

http://stackoverflow.com/q/23530173
has answer: http://stackoverflow.com/a/27871675
tagged with: java
has answer: http://stackoverflow.com/a/57251912
has body: I am running a simple "HelloWorld" Program. I get this error in the command prompt: Could not find or load main class HelloWorld. I have set the CLASSPATH and PATH variable in the system. In the cmd prompt, I am running from the directory where I have saved HelloWorld program. I can see the class name and the file name are same and also .class file created in the same directory. What else could be the problem? My sample program looks like this: package org.tij.exercises; public class HelloWorld { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Hello World!!"); } }
linked to: http://stackoverflow.com/q/5757189
has answer: http://stackoverflow.com/a/23532044
has answer: http://stackoverflow.com/a/23530199
tagged with: environment-variables
downvote count: 0
has answer: http://stackoverflow.com/a/34213148
has title: "Could not find or load main class" Error while running java program using cmd prompt
favorite count: 0
has comment: http://stackoverflow.com/comment/36096870
has comment: http://stackoverflow.com/comment/36096671
has comment: http://stackoverflow.com/comment/36096394
has comment: http://stackoverflow.com/comment/36096756
has answer: http://stackoverflow.com/a/23574223
has answer: http://stackoverflow.com/a/46008499
has answer: http://stackoverflow.com/a/25893819
has answer: http://stackoverflow.com/a/27738069
tagged with: cmd
has comment: http://stackoverflow.com/comment/36096030
answer count: 15
upvote count: 34
has answer: http://stackoverflow.com/a/53093473
has comment: http://stackoverflow.com/comment/72405536
linked to: http://stackoverflow.com/q/18093928
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36096551
score: 34
duplicate of: http://stackoverflow.com/q/18093928
tagged with: classpath
has answer: http://stackoverflow.com/a/23574147
has answer: http://stackoverflow.com/a/46658677
type: Question
has answer: http://stackoverflow.com/a/51985350
has answer: http://stackoverflow.com/a/45074991
has answer: http://stackoverflow.com/a/39606406

http://stackoverflow.com/comment/36170142
type: AnswerComment
has text: @mrainman: again, this makes no sense. JTextFields don't "compare" anything. You're ignoring the real issue -- your event listener -- while concentrating on the wrong issue -- the JTextField.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23570157

http://stackoverflow.com/q/23494200
has answer: http://stackoverflow.com/a/23495857
possible better answer: http://stackoverflow.com/a/23506290
has comment: http://stackoverflow.com/comment/36029012
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23494239
tagged with: jodatime
score: 0
answer count: 3
has title: Convert date string to datetime object in Joda-Time?
has body: I have a date string similar to: "2014-04-10T00:00:00.000" So I need to convert this to a Joda-Time DateTime object. Here is my code : String datePattern = "yyyy-MM-dd'T'HH:mm:ss.SSS"; DateTimeFormatter dateFormatter = DateTimeFormat.forPattern(datePattern); currentCard.setStartDate("2014-04-10T00:00:00.000"); currentCard.setEndDate("2015-04-10T00:00:00.000"); DateTime startDateTime = dateFormatter.parseDateTime(currentCard.getStartDate()); DateTime endDateTime = dateFormatter.parseDateTime(currentCard.getEndDate()); if (startDateTime.isBeforeNow() &amp;&amp; endDateTime.isAfterNow()) { currentCard.setActive(true); } else { currentCard.setActive(false); } It tells me string is too short
tagged with: datetime
accepted answer: http://stackoverflow.com/a/23494239
has answer: http://stackoverflow.com/a/23506290
type: AnsweredQuestion

http://stackoverflow.com/a/23513932
downvote count: 0
has comment: http://stackoverflow.com/comment/82380521
type: Answer
upvote count: 3
score: 3
has body: The mvn eclipse:eclipse generates project and classpaths, yes. However, that was before there was a suitable eclipse plugin for the task. If your workspace includes m2e, you can simply use file->import->existing maven project to open it inside eclipse. But, if you already have created project files from mvn eclipse:eclipse it tends to not work properly. In that case try deleting all eclipse files (.classpath, .settings, .project) before importing it. If you really want to use mvn eclipse:eclipse on the commandline and it fails with version, you may have somethings in your setting that prevents it from reaching maven central (a local company proxy or similar). Try using mvn help:effective-settings or mvn help:effective-pom if you need to see them.
answers question: http://stackoverflow.com/q/23512174

http://stackoverflow.com/comment/36016941
score: 0
has text: The same happens. The loop continues if I just press Enter.
type: AnswerComment
comment on: http://stackoverflow.com/a/23487821
type: Comment

http://stackoverflow.com/comment/36062491
score: 0
comment on: http://stackoverflow.com/a/23486358
type: Comment
has text: according to this site my schema and JSON are valid.
type: AnswerComment

http://stackoverflow.com/comment/36026534
score: 0
type: Comment
has text: What is $1? What happens when replace with $1?
comment on: http://stackoverflow.com/a/23493755
type: AnswerComment

http://stackoverflow.com/comment/35972187
has text: If any of the answers solved your question (and I believe that both did), you should mark one answer as correct and the question as closed
score: 0
comment on: http://stackoverflow.com/q/23463625
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23588678
favorite count: 0
has title: NoClassDefFoundError ProcessingException while migrating from jersey 1.x to jersey 2.x ( 2.8 )
possible better answer: http://stackoverflow.com/a/34805892
has comment: http://stackoverflow.com/comment/36314608
has comment: http://stackoverflow.com/comment/36374292
has answer: http://stackoverflow.com/a/34805892
has comment: http://stackoverflow.com/comment/36314784
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36240357
tagged with: java
has answer: http://stackoverflow.com/a/23588893
type: Question
linked to: http://stackoverflow.com/q/23672354
score: 5
tagged with: jersey
has body: I developed a web service application which was working fine with jersey 1.x ( 1.16 ) I recently tried to migrate to latest stable jersey version 2.8 I deleted all jersey jar files of v1.16 then I downloaded jersey jars of v2.8 from the link - https://jersey.java.net/download.html As per documentation I came to know that, I should have latest servlet jar, servlet jar 2.5 or above, So I downloaded servlet-api-2.5.jar and added the same to /libs folder. I downloaded javax.ws.rs-api-2.0-m09.jar and added it to /libs I also added latest jettison v 1.3.3 to /libs But I am getting exception when I run on tomcat7 as follows What are the exact steps to migrate from jersey 1.x to 2.x ? What is missing here ? My Web.xml looks as follows <?xml version="1.0" encoding="UTF-8"?> com.tempWSJersey2.WebServices Temp REST Service org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages com.temp 1 Temp REST Service /* And the exception is - SEVERE: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/tempWSJersey2]] at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252) at java.util.concurrent.FutureTask.get(FutureTask.java:111) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Thread…
has comment: http://stackoverflow.com/comment/36283256
upvote count: 5
has comment: http://stackoverflow.com/comment/36230862
answer count: 2
accepted answer: http://stackoverflow.com/a/23588893
linked to: http://stackoverflow.com/q/17511268
tagged with: jersey-2.0
downvote count: 0
has comment: http://stackoverflow.com/comment/36333240
has comment: http://stackoverflow.com/comment/36230171
tagged with: tomcat

http://stackoverflow.com/comment/36210901
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23544044
type: Comment
has text: I think it requires Network connection specially for Google Map.

http://stackoverflow.com/q/23521160
linked to: http://stackoverflow.com/q/8568223
has comment: http://stackoverflow.com/comment/36078190
has body: I want to parse a string Thu Apr 03 07:53:53 BST 2014 to a Date object in java. I don't know how to handle the 'BST' part - i have tried this date = new SimpleDateFormat("E MMM dd HH:mm:ss yyyy", Locale.ENGLISH).parse(string); but getting Unparseable date: "Thu Apr 03 07:53:53 BST 2014"
type: Question
has title: String to Date parse java
tagged with: java
tagged with: date
has answer: http://stackoverflow.com/a/23521239
has comment: http://stackoverflow.com/comment/36078865
has answer: http://stackoverflow.com/a/23521572
has answer: http://stackoverflow.com/a/23521279
upvote count: 0
score: -2
favorite count: 0
answer count: 5
tagged with: datetime
has answer: http://stackoverflow.com/a/23521258
has comment: http://stackoverflow.com/comment/36080579
has answer: http://stackoverflow.com/a/23521208
has comment: http://stackoverflow.com/comment/139913682
type: UnansweredQuestion
downvote count: 2

bluej
tags question: http://stackoverflow.com/q/23580517
tags question: http://stackoverflow.com/q/23470510
tag name: bluej
tags question: http://stackoverflow.com/q/23541809
type: Tag

http://stackoverflow.com/comment/35984329
type: Comment
has text: Did you test my code? it is generated by NetBeans. I have tested it on Windows XP.
comment on: http://stackoverflow.com/a/23469809
type: AnswerComment
score: 0

http://stackoverflow.com/a/23457959
type: Answer
answers question: http://stackoverflow.com/q/23457376
downvote count: 1
has body: Consider calling pack() method Below is the complete code I experimented with: import java.awt.FlowLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; public class Test { public static void main(String[] args) { final JFrame frame = new JFrame(); frame.setLayout(new FlowLayout()); final JCheckBox chckbxNewCheckBox_1 = new JCheckBox("New Folder"); final JPanel panel_3 = new JPanel(); frame.add(panel_3); panel_3.add(chckbxNewCheckBox_1); final JTextField textField_3 = new JTextField(); panel_3.add(textField_3); textField_3.setColumns(20); textField_3.setVisible(false); //if a comment it in.. it never becomes visible chckbxNewCheckBox_1.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { if (chckbxNewCheckBox_1.isSelected()) { textField_3.setVisible(true); } else textField_3.setVisible(false); frame.pack(); } }); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/35960770
has comment: http://stackoverflow.com/comment/35960682
has comment: http://stackoverflow.com/comment/35960810

http://stackoverflow.com/a/23515659
type: Answer
answers question: http://stackoverflow.com/q/23515388
downvote count: 0
score: 1
has body: Create an Object class with all variables, create a List for this Object, add all objects in your JSONArray to the list, use the one you need. List&lt;YourObject&gt; objList = new ArrayList&lt;YourObject&gt;(); JSONArray a = new JSONArray(response); int size = a.length(); for (int i=0 ; i&lt;size ; i++){ JSONObject aa = a.getJSONObject(i); String id = aa.getString("imageid"); String userid = aa.getString("userid"); String imagepath = aa.getString("imagepath"); String filterid = aa.getString("filterid"); String dateadded = aa.getString("dateadded"); String publicText = aa.getString("public"); YourObject obj = new YourObject(id,userid,imagepath,filterid,dateadded,publicText); objList.add(obj); }
upvote count: 1

http://stackoverflow.com/comment/140150931
type: Comment
comment on: http://stackoverflow.com/a/79468960
has text: I don't think you understood my question, which I believe was quite clear
type: AnswerComment
score: 0

http://stackoverflow.com/comment/53231336
type: QuestionComment
comment on: http://stackoverflow.com/q/23469007
has text: You only mention 2 servers in your question but 3 in your comments. Are you using an arbiter node?
score: 0
type: Comment

http://stackoverflow.com/comment/36145229
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23556720
has text: @Ani Fichadia: you indirectly stumbled onto my solution. All I did was change my xml to match com.google.android.gms.maps.SupportMapFragment. Then boom it worked. :)
score: 0

http://stackoverflow.com/a/23592813
has comment: http://stackoverflow.com/comment/36212162
has comment: http://stackoverflow.com/comment/36212194
accepted answer of: http://stackoverflow.com/q/23592238
answers question: http://stackoverflow.com/q/23592238
has comment: http://stackoverflow.com/comment/36212389
type: AcceptedAnswer
has body: To get the current port that the ServerSocket is listening to, use getLocalPort(); http://download.java.net/jdk7/archive/b123/docs/api/java/net/ServerSocket.html#getLocalPort%28%29 getLocalPort public int getLocalPort() Returns the port number on which this socket is listening. If the socket was bound prior to being closed, then this method will continue to return the port number after the socket is closed. Edit: Just saw your edit. Are you trying to connect by explicitly referencing the IP and Port? If so, and it's still failing, your server machine might be running a firewall. I'd check for that first.
score: 0
type: Answer

http://stackoverflow.com/a/23593993
upvote count: 1
answers question: http://stackoverflow.com/q/23593697
downvote count: 0
has body: Your format pattern is incorrect, use lower case mm to represent minutes When you do not specify much details to the outdated Java date api, it considers the time since UNIX epoch (1st Jan 1970) Since you are assuming the date to be the same as the constant time parameters you provide and independent of the timezones, you can bring your current date comparable to the time since UNIX epoch: Staying close to your original code; DateFormat df = new SimpleDateFormat("HH:mm"); Date firstLessonInterval = df.parse("08:45"); Date currentTime = new Date(); // Format the current date comparable to UNIX epoch (only hold time params) String dateStr = df.format(currentTime.getTime()); // Parse the modified date string to a date object Date comDate = df.parse(dateStr); // Take the difference in millis long diff = firstLessonInterval.getTime() - comDate.getTime(); String s = String.valueOf(diff); // Print the number of minutes passed since System.out.println("Minutes {elapsed since/time to} 08:45 - " + Math.abs(diff) / 1000 / 60);
type: Answer
score: 1

http://stackoverflow.com/a/23456411
has comment: http://stackoverflow.com/comment/35957746
has comment: http://stackoverflow.com/comment/35957610
accepted answer of: http://stackoverflow.com/q/23456332
has body: What about radio1.getText()? This method is declared in javax.swing.AbstractButton. See the Java doc for more details: JRadioButton and AbstractButton.
upvote count: 2
answers question: http://stackoverflow.com/q/23456332
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35957839
has comment: http://stackoverflow.com/comment/35957964
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/36155933
has text: You have the plugin defined twice.
type: QuestionComment
comment on: http://stackoverflow.com/q/23562978
type: Comment
score: 2

http://stackoverflow.com/comment/76352756
type: Comment
score: 2
has text: @CMerrill The question no longer applies either, it is supported by IntelliJ. If it is not working, then report a bug. No plugin can solve it anymore.
type: AnswerComment
comment on: http://stackoverflow.com/a/23569625

http://stackoverflow.com/comment/36173259
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23571853
has text: You need to specify the complete path (including the filename) to the jar files in the `CLASSPATH`, not the folder name.
score: 0

http://stackoverflow.com/q/23481191
has body: I have a setup in my game where physics are updated in a separate thread with an implementation as follows Physics Processor (Physics Thread) public class PhysicsProcessor extends Runnable { private DynamicsWorld world; public PhysicsProcessor() { /* basic dynamics world setup with dvbt broadphase :P */ } public synchronized getDynamicsWorld() { return world; } @Override public void run() { /* update time */ //update phyics getDynamicsWorld().stepSimulation(/* delta time */); } } Example Object Creation In Main Thread myPhysicsProcessor.getDynamicsWorld.addRigidBody(/* some rigid body created here */); The problem is that when the game runs I occasionally get a null pointer exception in the separate thread on "stepSimulation", which was caused by setAabb in my dbvt broadphase. Does anyone have any suggestions on what I can do to prevent this exception, or how to work around it?
has answer: http://stackoverflow.com/a/23505334
has comment: http://stackoverflow.com/comment/36005777
has comment: http://stackoverflow.com/comment/36005572
tagged with: bulletphysics
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36004857
has title: JBullet NullPointer on step simulation in separate thread
tagged with: nullpointerexception
downvote count: 0
answer count: 1
favorite count: 0
tagged with: jbullet
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36005526
has comment: http://stackoverflow.com/comment/36005493
upvote count: 1

http://stackoverflow.com/comment/36245640
type: AnswerComment
has text: @Prakash The key to a good question on SO is to give ***all*** the relevant information in your question. None of the answers you have received so far solve your problem because you did not give enough details (in particular the fact that the `(..|..)` could be anywhere, not just at the beginning and that there could be nested brackets).
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23610123

http://stackoverflow.com/comment/36199408
comment on: http://stackoverflow.com/q/23501682
has text: Hi @Will What I am doing is the same as posted by Tichodroma muraria. But in my case this is returning a 403. Is is a configuration?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23548387
tagged with: integer
type: UnansweredQuestion
has title: Converting a hex (two's complement) to Java value
has comment: http://stackoverflow.com/comment/36129394
has comment: http://stackoverflow.com/comment/36129585
has comment: http://stackoverflow.com/comment/36129757
has body: I have this hex value: C9E5249A which is representing a Twos Complement signed 32-bit integer representation in C. How can I get its Java counterpart ?
tagged with: twos-complement
tagged with: java
has answer: http://stackoverflow.com/a/23548508
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36133575
has answer: http://stackoverflow.com/a/23548433
has comment: http://stackoverflow.com/comment/36129852
score: 0

http://stackoverflow.com/q/23522679
type: Question
has answer: http://stackoverflow.com/a/23522806
has comment: http://stackoverflow.com/comment/36081313
has answer: http://stackoverflow.com/a/23522790
favorite count: 0
has comment: http://stackoverflow.com/comment/36081285
possible better answer: http://stackoverflow.com/a/23522806
has title: How to get parent class of a variable in java?
has comment: http://stackoverflow.com/comment/36081259
has comment: http://stackoverflow.com/comment/36081226
answer count: 4
has body: Lets say I have a class a, and a class b. public class ClassA{ int a; ClassB b = new ClassB(); } public class ClassB{ int someInt; void someFunction(){ //Here I want to access the variable a of the current ClassA. } }` The code is pretty self explanatory. I can add the ClassA in the constructor, but i dont want to do that as ClassB will be created by the user. so...perhaps some help here?
downvote count: 2
has comment: http://stackoverflow.com/comment/36081297
upvote count: 1
has answer: http://stackoverflow.com/a/23522892
has comment: http://stackoverflow.com/comment/36081348
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36081406
has answer: http://stackoverflow.com/a/23522841
has comment: http://stackoverflow.com/comment/36081457
has comment: http://stackoverflow.com/comment/36081424
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/23522790

http://stackoverflow.com/comment/36165953
type: QuestionComment
score: 1
has text: http://www.gwtproject.org/javadoc/latest/com/google/gwt/core/shared/GwtIncompatible.html
type: Comment
comment on: http://stackoverflow.com/q/23567148

http://stackoverflow.com/a/23484637
answers question: http://stackoverflow.com/q/23482443
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
has body: From what it appears to be is the outside plugin NameTagAPI. I can say for sure it's that because of its massive amount of player packets it has to send, and the fact you call it onJoin makes it even more clear that's the issue.
score: 2
accepted answer of: http://stackoverflow.com/q/23482443

http://stackoverflow.com/comment/36193227
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23580581
type: AnswerComment
has text: It is impossible that the loop runs for an infinite number of iterations as deltaMs is finite and we reduce the value with each iteration. That said, you may still get a huge lag if updateImpl is relatively slow (usually rendering is the slower part, though). So perhaps for single player games, the best solution might be to combine both approaches.

http://stackoverflow.com/q/23576070
tagged with: java
type: Question
score: 0
has title: RMI Java application not working as expected
answer count: 1
accepted answer: http://stackoverflow.com/a/23576093
has body: I am reading about networking and java from this book. The problem is that I am trying to do an example listed on this book, it is on page 153 till page 159 (paragraph 5.4 Using RMI Meaningfully) . I made some changes, mostly where he uses the old Vector I replaced it with ArrayList. Also on Client side I made some minor changes like this: public static void main(String[] args) { try { // Obtain a reference to the object from the // registry and typecast it into the appropriate // type... String name = "//localhost/Service1"; Stp temp = (Stp) Naming.lookup(name); ArrayList&lt;Account&gt; acc = temp.getAccs(); System.out.println(acc); for (Account cnt : acc) { if ("george".equals(cnt.name)) { cnt.get(10); System.out.println(cnt); } } } catch (ConnectException conEx) { System.out.println("Unable to connect to server!"); System.exit(1); } catch (Exception ex) { ex.printStackTrace(); System.exit(1); } } It works just fine, or almost fine. When the get(int number) method is invoked from client (it is supposed to decrease the balance) ,it actually does what it is meant to do. The problem is that if I open another client from another cmd window or even if I run the same client again it doesn't further decrease the value of balance. If the balance is 100 and client runs the get(10) he will see 90. But if the client code runs again for another one get(10) , then, the balance doesn't updates and remains again 90. It should be 80. Thanks for any info on this!
has answer: http://stackoverflow.com/a/23576093
type: AnsweredQuestion
tagged with: rmi

http://stackoverflow.com/q/23549353
tagged with: java
has title: Specific configurations for different items using same table
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/36354945
has answer: http://stackoverflow.com/a/23765390
has answer: http://stackoverflow.com/a/23735822
possible better answer: http://stackoverflow.com/a/23735822
favorite count: 0
accepted answer: http://stackoverflow.com/a/23765390
answer count: 4
upvote count: 2
has answer: http://stackoverflow.com/a/23693076
has comment: http://stackoverflow.com/comment/36132180
downvote count: 1
type: Question
has body: So we have an ITEM, TV, LCD and PROJECTOR. We have DAO and Service object for TV, LCD and PROJECTOR that also are ITEM objects. Meaning that those tables all extends the ITEM table. You can access these items through an UI and an API service. Right now, I am in the need to put specific UI configurations that are not related at all with the API. Lets say that I need in the UI a configuration for each item to display or not display an image of the item on it, lets call it showImageFlag. This value can be modified from the Item's UI, this is a checkbox. I've been thinking about a few options here: Add a column SHOW_IMAGE_FLAG to the ITEM table and it's DAO and service object. On the service object put a @JSonIgnore flag so it is ignored on the API side, but we can use it normally in the UI. ------- My concern with this approach is that in the future we might need more configuration for these items or maybe others than tv, lcd and projector. So this will always will push us to add a new column to the table. Another concern is that we might be migrating all form post ui to use the REST API, so we are going to have to do something about that JsonIgnored property. A ITEM_CONFIG (id, item_id, configuration, value) table FKed to the ITEM.id with a key/value approach to save N configuration related to specific items. So on every web controller I will be passing a ItemConfig object with all configurations related to the requested ITEM. -------- My concern with this one, is how should I map this to the form (using spring mvc) and how should I persist when the configuration changes on the UI. Please free to comment and suggest any new option for this.
has answer: http://stackoverflow.com/a/23743859
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/23532786
has answer: http://stackoverflow.com/a/23533810
tagged with: java
has comment: http://stackoverflow.com/comment/36101763
tagged with: loops
has answer: http://stackoverflow.com/a/23532853
downvote count: 1
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36102186
has body: Im having some trouble with writing a multi-variable for loop. How would I write these for loops as one for loop. for (x1pos = 5; x1pos &lt;= 105; x1pos+=4) { for (x2pos = 105; x2pos &gt;= 5; x2pos-=4) { } }
favorite count: 0
type: Question
answer count: 2
has title: Multi-variable for loops
has comment: http://stackoverflow.com/comment/36100839
score: -1

http://stackoverflow.com/q/23503622
downvote count: 8
answer count: 2
has answer: http://stackoverflow.com/a/23503727
has comment: http://stackoverflow.com/comment/36045952
has body: I'm trying to create objects within a for loop at runtime. Here is the (incorrect) code: for(int i=1;i&lt;max;i++){ Object object(i); } I'd like it to create max number of Object objects with names object1, object2, etc. Is there any way to do this? I have been unable to find anything elsewhere online. Thanks for your help!
has comment: http://stackoverflow.com/comment/36045988
has comment: http://stackoverflow.com/comment/36046452
has comment: http://stackoverflow.com/comment/36045912
tagged with: java
has comment: http://stackoverflow.com/comment/36045901
possible better answer: http://stackoverflow.com/a/23503691
has answer: http://stackoverflow.com/a/23503691
accepted answer: http://stackoverflow.com/a/23503727
upvote count: 0
score: -8
has title: Java Creating Objects at Runtime in a For Loop
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36046328
has comment: http://stackoverflow.com/comment/36045899
has comment: http://stackoverflow.com/comment/36046607
favorite count: 0
has comment: http://stackoverflow.com/comment/36045981
type: Question

http://stackoverflow.com/a/23561557
score: 0
accepted answer of: http://stackoverflow.com/q/23557733
type: AcceptedAnswer
has body: If you want to have all elements from a Container (like JPanel or JTabbedPane, etc...) you need to collect them manually, because the getComponents() is only reading the direct children of the Container. You need to add the following function to the Sample class: public List&lt;Component&gt; getAllComponents(Container container) { Component[] components = container.getComponents(); List &lt;Component&gt; result = new ArrayList&lt;Component&gt;(); for (Component component : components) { result.add(component); if (component instanceof Container) { result.addAll(getAllComponents((Container) component)); } } return result; } You need to replace the following code: Component[] component =((ExampleTab1)obj).getContentPanel().getComponents(); with this code: List&lt;Component&gt; components = getAllComponents(((ExampleTab1)obj).getContentPanel()); and don't forget the null check for the getName() function, if you have components without name.
type: Answer
answers question: http://stackoverflow.com/q/23557733

http://stackoverflow.com/a/23612551
answers question: http://stackoverflow.com/q/23612220
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/36250697
has body: You have to define a new class atribute. It can be a String. Like this: public MyList{ private String record; .... } Then on each of your methods you update this atribute: record += "\n"+*the operation*; But if you want a better performance, you should use a StringBuffer instead of a String (see here). Was this the answer that you wanted?
has comment: http://stackoverflow.com/comment/36250052

http://stackoverflow.com/comment/36091838
score: 0
type: AnswerComment
type: Comment
has text: Thanks! I was totally not aware of that software.
comment on: http://stackoverflow.com/a/23526135

http://stackoverflow.com/q/23533083
has answer: http://stackoverflow.com/a/23533596
has comment: http://stackoverflow.com/comment/36102416
tagged with: scala
has comment: http://stackoverflow.com/comment/36102215
upvote count: 1
answer count: 1
has body: I'm writing some scalafx code, which needs to invoke a method from java: val txtEditor = new TextArea { text = "markdown here" } txtEditor.text.addListener(new ChangeListener[String] { override def stateChanged(e: ChangeEvent): Unit = ??? }) But it reports compilation error on the addListener parameter: Type mismatch, expected: ChangeListener[_ >: String], actual: ChangeListener with Object { def stateChange(e:ChangeEvent) Unit } And the addListener which is a java method: void addListener(ChangeListener&lt;? super T&gt; listener); How to fix it?
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/23533596
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36101955
downvote count: 0
has title: Invoke a java method which accepts `<? super T>` type parameter from scala code?
favorite count: 0
type: Question
tagged with: types
score: 1
tagged with: scalafx

http://stackoverflow.com/q/23600492
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/21881992
has comment: http://stackoverflow.com/comment/36248430
has comment: http://stackoverflow.com/comment/36229414
has comment: http://stackoverflow.com/comment/36231274
score: 0
has comment: http://stackoverflow.com/comment/36227287
has answer: http://stackoverflow.com/a/23611764
tagged with: android
tagged with: sqlite
has body: I am writing a function for as android application which can update sqlite database by importing the latest csv files. When the user click on the button, the program was supposed to delete the old table and create another new table according to the latest data. The app was able to write data when the button was first time pressed. However, error was found if data was already existed. 05-09 16:41:34.088: E/SQLiteDatabase(3056): Error inserting order_qty=1 tran_code=NS item_code=IC559 line_no=1 customer_ref_no="PO# 25192600" order_date=20130221 cust_code=099496 05-09 16:41:34.088: E/SQLiteDatabase(3056): android.database.sqlite.SQLiteConstraintException: columns order_date, cust_code, item_code, tran_code are not unique (code 19) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:782) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1469) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1339) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at test.andftpclient.MainActivity$2.onClick(MainActivity.java:118) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at android.view.View.performClick(View.java:4438) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at android.view.View$PerformClick.run(View.java:18422) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at android.os.Handler.handleCallback(Handler.java:733) 05-09 16:41:34.088: E/SQLiteDatabase(3056): at android.os.Handle…
has comment: http://stackoverflow.com/comment/36269086
has comment: http://stackoverflow.com/comment/36233360
has comment: http://stackoverflow.com/comment/36268966
possible better answer: http://stackoverflow.com/a/23611014
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23611764
has answer: http://stackoverflow.com/a/23611014
has title: getWritableDatabase does not work
tagged with: insert-update
tagged with: java
has comment: http://stackoverflow.com/comment/36245658
has comment: http://stackoverflow.com/comment/36229410
has comment: http://stackoverflow.com/comment/36227697

http://stackoverflow.com/comment/36090285
comment on: http://stackoverflow.com/q/23527030
has text: I don't think its efficient to start a new thread every second.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23545692
has title: Trying to place a JLabel over another with image
has comment: http://stackoverflow.com/comment/36124362
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36124334
score: 0
has comment: http://stackoverflow.com/comment/36125128
accepted answer: http://stackoverflow.com/a/23546673
tagged with: jlabel
has body: I know this question has been asked before. But mine is unique. My programing has a particular order and I'm having trouble with the JLabel with text. I need the text to remain in the center of the JFrame, but also above the image.I've tried a variety of options but nothing seems to work. Here is the relative coding: public class SceneOne { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub JFrame SceneOne= new JFrame(); SceneOne.setSize(1400,700); SceneOne.setTitle("The Car"); SceneOne.setVisible(true); SceneOne.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SceneOne.setLocation(500,300); ImageIcon image = new ImageIcon("/Users/computerscience2/Desktop/dark-forest-night-image.jpg"); JLabel imageLabel = new JLabel("", image, JLabel.CENTER); JPanel panel = new JPanel(new BorderLayout()); panel.add( imageLabel, BorderLayout.CENTER ); SceneOne.add(panel); SceneOne.setResizable(true); imageLabel.setVisible(true); SceneOne.pack(); Button Leave=new Button("Leave"); Button Stay= new Button("Stay"); Leave.setVisible(true); Stay.setVisible(true); JPanel Leavebutton =new JPanel (new GridBagLayout()); Leavebutton.setVisible(true); JPanel Staybutton=new JPanel (new GridBagLayout()); Staybutton.setVisible(true); Leavebutton.add(Leave); Staybutton.add(Stay); FlowLayout two = new FlowLayout(FlowLayout.LEFT); FlowLayout three=new FlowLayout(FlowLayout.RIGHT); Leavebutton.setLayout(two); Staybutton.setLayout(three); SceneOne.add(Leavebutton); SceneOne.add(Staybutton); JLabel label1 = new JLabel("Test"); SceneOne.add(label1); label1.setText("&lt;html&gt;&lt;font color='white'&gt; It was approximately 11:30 pm. The night sky was black not a single star piercing through the darkness" + "except the thick and powerful moonlight." +"&lt;br&gt;" + "You are alone leaving a costume party at a friend's place." + "It was rather boring and you decided to leave early."+"A stutter is heard and your"+ "&lt;br&gt;"+ "car begins to shake" + "Your headligh…
has comment: http://stackoverflow.com/comment/36124655
has answer: http://stackoverflow.com/a/23546673
type: AnsweredQuestion

http://stackoverflow.com/comment/36044986
has text: Thanks for looking at this. I was a bit puzzled by some feedback, which gave me the impression that people consider that behavior natural. I have updated my demo at http://svn.finmath.net/finmath%20experiments/trunk/src/net/finmath/experiments/concurrency/NestedParallelForEachTest.java and added a method "wrapInThread". If you wrap the inner loop using that method, the problem is gone (see the JavaDoc in that class). Do you like to try? My assumption is that this wrapping will actually do a trick on that test... but this is just a guess. (I will have a closer look later too).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23495249
type: AnswerComment

http://stackoverflow.com/comment/65781362
type: AnswerComment
comment on: http://stackoverflow.com/a/38843869
score: 0
has text: You don't need to repeat an already given answer. Stack Overflow is a Q&A site where everyone can cleanly vote each other on (dis)agreement/confirmation, not like an old fashioned discussion forum wherein everyone repeats each other into an undigestable/unsearchable mess upon (dis)agreement/confirmation.
type: Comment

http://stackoverflow.com/a/23454813
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/35954722
type: Answer
answers question: http://stackoverflow.com/q/23454745
has body: If you have initialized it when declaring, it would give you a precise message, e.g. "The final local variable x cannot be assigned. It must be blank and not using a compound assignment" final int x = 6; // code x = 4; But, in your example, the final variable might have been initialized somewhere after it is declared and the compiler doesn't keep track of consecutive statements, otherwise it would be named "runner" and it just has the information that final variable x should not be initialized twice.
score: 1

http://stackoverflow.com/q/23467866
tagged with: network-programming
answer count: 1
has body: i have made server and client app (separate jar files) the server can only send file(s) to the client(s), and the client(s) can only accept whatever file(s) sent by the server. My question is, why does my client app window won't close (when the close button is pressed) until the server is closed first ? here's my code : server side public sServerUI() { super("Server : "+System.getenv("COMPUTERNAME")); // mendapatkan nama komputer initComponents(); } public void startListener(){ Random randomGen = new Random(); int myPort = randomGen.nextInt(9999); try{ server = new ServerSocket(myPort);//Bebas portnya, tp nggk boleh sudah terpakai atau pakai random jg bisa btnListen.setEnabled(false); while(_key == null) { _key = JOptionPane.showInputDialog(this, "Input your Key : ", "Insert Key", JOptionPane.PLAIN_MESSAGE); } if(_key.equals("")) { _key = "Random"; txtMessage.setText(txtMessage.getText()+"Invalid key inputted, key automatically set to '"+_key+"'\n"); } else txtMessage.setText(txtMessage.getText()+"Key set to '"+_key+"'\n"); } catch (IOException e) {//Kalau sudah terpakai muncul error JOptionPane.showMessageDialog(this, "Could not listen at " + myPort); //Gagal, keluarin info } finally{ myPort = server.getLocalPort(); lblPort.setText("Port: "+myPort); System.out.println("Port: "+myPort); } _acceptClient.start(); } public void windowClosing(WindowEvent e){ try { server.close(); for (int i=0;i&lt;_numberOfClient;i++){ //socketIn[i].close(); _socketOut[i].close(); } } catch (IOException ex) { System.out.println("Error "+ex.getMessage()); } } class Accepter extends Thread{ @Override public void run(){ while (true){ try{ client[_numberOfClient] = server.accept(); _numberOfClient++; lblStatus.setText("Status: "+_numberOfClient+" client(s) connected"); Handler handleClient = new Handler(_numberOfClient-1); handleClient.start(); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Accept failed: " + e.getMessage()); } } } } class Handler extends Thread{ private int…
downvote count: 0
has title: Client window won't closed when connected to server
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
tagged with: sockets
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/25470574
type: Question
upvote count: 2

http://stackoverflow.com/q/23476317
has comment: http://stackoverflow.com/comment/36004506
has comment: http://stackoverflow.com/comment/35995077
has title: Multi-Module Gradle Build Issue - No resource found that matches the give name
has answer: http://stackoverflow.com/a/23480496
has comment: http://stackoverflow.com/comment/35995771
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36002213
favorite count: 0
has comment: http://stackoverflow.com/comment/35994753
has comment: http://stackoverflow.com/comment/36001086
has comment: http://stackoverflow.com/comment/36002557
upvote count: 2
has comment: http://stackoverflow.com/comment/35997828
tagged with: android
accepted answer: http://stackoverflow.com/a/23480496
score: 2
tagged with: build
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36003369
has body: I'm having a gradle build issue where I'm getting the error "No resource found that matches the give name ..." for a bunch of @string references in my layout files in the core module which is referencing string from the XML files in other modules. Here's my basic layout structure (this is an old Eclipse project that I'm trying to convert to gradle in Android Studio). Main Project Folder -google-play-services_lib -MainModule (this is the main module that references the other modules) -LibraryModule -ZXing There's currently nothing in my build.gradle at the main project level and my main settings.gradle only includes the following items: include ':LibraryModule' include ':google-play-services_lib' include ':MainModule' include ':ZXing' Here's the build.gradle for my main module that should run when the application is opened. buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' dependencies { compile fileTree(dir: 'libs', include: '*.jar') compile project(':LibraryModule') compile project(':ZXing') compile project(':google-play-services_lib') } android { compileSdkVersion 19 buildToolsVersion "19.0.3" sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/&lt;type&gt; // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src/&lt;type&gt;/... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } } All of the "No resource found..." messages t…
tagged with: gradle
type: Question

http://stackoverflow.com/q/23496165
score: 5
has answer: http://stackoverflow.com/a/23496329
has title: Initiating an enum as value
has body: I want to declare an enum variable as values. How can I achieve that? For Example: public enum CardSuit { SPADE(0), HEART(1), DIAMOND(2), CLUB(3); } I can declare like this: CardSuit s = CardSuit.SPADE; I want to declare like this too: CardSuit s = 1; What is the way of doing that? Is that even possible?
answer count: 3
accepted answer: http://stackoverflow.com/a/23496246
favorite count: 0
possible better answer: http://stackoverflow.com/a/23496309
has answer: http://stackoverflow.com/a/23496246
downvote count: 1
upvote count: 6
type: AnsweredQuestion
tagged with: enums
has answer: http://stackoverflow.com/a/23496309
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36032137

http://stackoverflow.com/q/23573327
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23574432
score: 1
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/36177168
has comment: http://stackoverflow.com/comment/36176605
tagged with: sql
answer count: 1
has title: ODBC Driver Manager 'invalid string or buffer length' error
downvote count: 0
has comment: http://stackoverflow.com/comment/36176457
favorite count: 0
has comment: http://stackoverflow.com/comment/36177910
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36177068
has body: I am connecting a database with my application. SELECT queries works fine that means that the connection is estabilished. When ever I use statement.execute(parameter) method, I can get the information that is saved at server but when ever I try to insert new data and use statement.executeUpdate(parameter) method it throws me a list of errors. Well, I am stuck on this issue from almost 3 days but found nothing helpful relevant to my problem. java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid string or buffer length at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source) at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source) at sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source) at sun.jdbc.odbc.JdbcOdbcConnection.buildTypeInfo(Unknown Source) at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source) at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at Database.Database.InitializeDatabase(Database.java:14) at Clients.Customer$2.actionPerformed(Customer.java:115) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Compon…

http://stackoverflow.com/comment/36247217
type: QuestionComment
comment on: http://stackoverflow.com/q/23609654
score: 1
has text: that is the problem bro there is no strack trace but where i remove this line it code works fine
type: Comment

unit-testing
tags question: http://stackoverflow.com/q/23545705
tags question: http://stackoverflow.com/q/23493749
tags question: http://stackoverflow.com/q/23477378
tags question: http://stackoverflow.com/q/23598147
tags question: http://stackoverflow.com/q/23548879
tags question: http://stackoverflow.com/q/23481352
tags question: http://stackoverflow.com/q/23586847
tags question: http://stackoverflow.com/q/23474790
tags question: http://stackoverflow.com/q/23503579
tags question: http://stackoverflow.com/q/23563615
tags question: http://stackoverflow.com/q/23456385
tags question: http://stackoverflow.com/q/23459518
tags question: http://stackoverflow.com/q/23567148
tags question: http://stackoverflow.com/q/23604528
tags question: http://stackoverflow.com/q/23566952
type: Tag
tags question: http://stackoverflow.com/q/23614605
tag name: unit-testing
tags question: http://stackoverflow.com/q/23460681
tags question: http://stackoverflow.com/q/23599915
tags question: http://stackoverflow.com/q/23605775
tags question: http://stackoverflow.com/q/23541494
tags question: http://stackoverflow.com/q/23522166
tags question: http://stackoverflow.com/q/23496538
tags question: http://stackoverflow.com/q/23523280

http://stackoverflow.com/comment/36063054
has text: when i execute with above mail sent with same number every 5 mins as it runs :(
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23512926
type: Comment

http://stackoverflow.com/q/23542944
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2614457
tagged with: highlight
tagged with: contextmenu
has comment: http://stackoverflow.com/comment/36120623
has body: I have two JTables both within the same BorderLayout (one placed in BorderLayout.WEST and the other placed in BorderLayout.EAST). The problem I have is that when selecting rows only the rows from the one to the west can get highlighted. The problem also seems to prevent me from accessing the east tables right-click menu. Is anyone able to identify what the problem may be?
tagged with: swing
has answer: http://stackoverflow.com/a/23547405
type: Question
tagged with: java
tagged with: jtable
score: 0
has title: Making rows in two JTables in a BorderLayout selectable?
answer count: 1
has comment: http://stackoverflow.com/comment/36119145

http://stackoverflow.com/q/23555461
has comment: http://stackoverflow.com/comment/36143030
has comment: http://stackoverflow.com/comment/36146882
tagged with: spring-security
has comment: http://stackoverflow.com/comment/36143033
has comment: http://stackoverflow.com/comment/36143582
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36143172
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36143060
has answer: http://stackoverflow.com/a/23556199
tagged with: spring
tagged with: spring-mvc
has body: I'm very new using the Spring Framework. I found a tutorial that showed me how to set up a simple login using Spring Security. It also included some code for the view: home.jsp and controller: HomeController.java they look like this: home.jsp: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> Home <a href=<c:url value="/j_spring_security_logout"/>>Logout <sec:authorize ifAnyGranted="ROLE_ADMIN"> Only admin can see this Admin Home </sec:authorize> Welcome! Logged in as: <c:out value= **"${CurrentUser}"** /> ! and HomeController.java package rd.controller; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller public class HomeController { @RequestMapping(value = "/home" , method = RequestMethod.GET) public String setUp(Model model){ **model.addAttribute("CurrentUser", SecurityContextHolder.getContext().getAuthentication().getName());** return "home"; } } From what I've gathered, the lines surrounded with ** are connected to make the attribute available for the jsp page to display. However there's something wrong with how I'm doing it and the website literally prints: Logged in as: ${CurrentUser}! I could use a logic check as well as an explanation of how Spring should be connecting the Controller and View. Also, any good Spring tutorial links are welcomed, Thanks!
has comment: http://stackoverflow.com/comment/36143385
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36143230
type: Question
has title: Spring MVC - Request Mapping
has comment: http://stackoverflow.com/comment/36142983

http://stackoverflow.com/q/23556162
tagged with: java
tagged with: hibernate
tagged with: struts2
type: Question
has comment: http://stackoverflow.com/comment/36144830
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has title: JDBCExceptionReporter - SQL Error: 17008, SQLState: 08003
has answer: http://stackoverflow.com/a/23560073
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36144354
type: UnansweredQuestion
tagged with: oracle11g
has comment: http://stackoverflow.com/comment/36155766
has body: I am getting below error while fetching records and it's sporadic, it gets fixed either by restarting the server or by itself after some time. I am using Struts 2, Oracle 11g, Hibernate 3. Error: 2014-05-06 13:38:51 WARN JDBCExceptionReporter:100 - SQL Error: 17002, SQLState: 08006 2014-05-06 13:38:51 ERROR JDBCExceptionReporter:101 - IO Error: Connection timed out 2014-05-06 13:38:51 ERROR Dispatcher:38 - Exception occurred during processing request: null java.lang.NullPointerException at com.tai.dao.UsersTaiImplDAO.listUser(UsersTaiImplDAO.java:37) at com.tai.web.UsersTaiAction.userLogin(UsersTaiAction.java:55) 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 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) at com.opensymphony.xwork2.DefaultActionInvocat…
score: 1

http://stackoverflow.com/comment/36146517
score: 0
type: Comment
has text: @SachinMhetre : You are welcome, Yes, you can set any JVM properties with `_JAVA_OPTIONS`, I set the heap size using `_JAVA_OPTIONS="-Xmx12G"`
comment on: http://stackoverflow.com/a/23557111
type: AnswerComment

http://stackoverflow.com/comment/36238821
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23606041
has text: @M.Deinum i added service and dao example
score: 0

http://stackoverflow.com/a/23498368
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23465387
has body: You should not import the servlet API but implementation of the API, for example the servlet container implementation you want on which you want to run your project : Tomcat, JBoss, Websphere, Glassfish.... E.g. for tomcat : org.apache.tomcat tomcat-servlet-api 7.0.30 provided

http://stackoverflow.com/comment/36195174
has text: What it variable `j`? If I use `i` instead of it, I keep getting ZZZ as plain text.
comment on: http://stackoverflow.com/a/23583171
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35985289
type: AnswerComment
comment on: http://stackoverflow.com/a/23458591
type: Comment
score: 2
has text: I think this is the problem. Default maximum size is 1MB. Your size is 1MB++. You can use doc = Jsoup.connect(url).maxBodySize(1200000).get();

http://stackoverflow.com/comment/36075970
has text: it works for "www.google.com", but not for only "google"..which should match as well, as I'd suppose?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23519331

http://stackoverflow.com/q/23487381
has answer: http://stackoverflow.com/a/50928730
has answer: http://stackoverflow.com/a/53145764
has comment: http://stackoverflow.com/comment/36015268
has comment: http://stackoverflow.com/comment/36018099
has answer: http://stackoverflow.com/a/50689439
upvote count: 15
has answer: http://stackoverflow.com/a/65620438
has comment: http://stackoverflow.com/comment/36015178
has answer: http://stackoverflow.com/a/58818932
has comment: http://stackoverflow.com/comment/36060253
answer count: 20
has comment: http://stackoverflow.com/comment/36074934
downvote count: 3
has answer: http://stackoverflow.com/a/50289266
has title: solve maximum product of three array elements without sorting
has body: There is a variety of answers for the MaxProductOfThree task on codility.com, most of them involving a sorting algorithm. The problem is: A non-empty zero-indexed array A consisting of N integers is given. The problem is to find the maximum product of 3 elements from given array. The length of the array is between 3 and 100,000 each element of array A is an integer within the range [−1,000..1,000] expected worst-case time complexity is O(N*log(N)); expected worst-case space complexity is O(1), beyond input storage (not counting the storage required for input arguments). Example: a[0] = -3; a[1] = 7; a[2] = 2; a[3] = 1; a[4] = 5; a[5] = 7; the max product is a[1]*a[4]*a[5] = 245 Is there a linear-time solution to this problem, besides the O(n log n) approach that involves sorting?
has answer: http://stackoverflow.com/a/23609035
has answer: http://stackoverflow.com/a/50689594
accepted answer: http://stackoverflow.com/a/23609035
has comment: http://stackoverflow.com/comment/36072327
has comment: http://stackoverflow.com/comment/36015448
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/69084780
has answer: http://stackoverflow.com/a/63754064
has comment: http://stackoverflow.com/comment/36016497
possible better answer: http://stackoverflow.com/a/53145764
has comment: http://stackoverflow.com/comment/36075907
tagged with: algorithm
has answer: http://stackoverflow.com/a/61578504
tagged with: java
tagged with: sorting
has comment: http://stackoverflow.com/comment/36034219
type: Question
score: 12
has answer: http://stackoverflow.com/a/60688760
has answer: http://stackoverflow.com/a/67466437
has comment: http://stackoverflow.com/comment/36075105
has answer: http://stackoverflow.com/a/64839378
has answer: http://stackoverflow.com/a/61604478
has answer: http://stackoverflow.com/a/46439228
has answer: http://stackoverflow.com/a/31825089
has answer: http://stackoverflow.com/a/64189207
has comment: http://stackoverflow.com/comment/36016607
favorite count: 0
has answer: http://stackoverflow.com/a/65177851
has comment: http://stackoverflow.com/comment/36077746
has comment: http://stackoverflow.com/comment/36038327
has answer: http://stackoverflow.com/a/56770186

http://stackoverflow.com/comment/35990633
comment on: http://stackoverflow.com/a/23474045
has text: @MikkelLøkke "never" is a strong word, especially when you don't know all the details of how the data is used. See it as "peace of mind vs. winning a few microseconds" in 99% of cases.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36118683
comment on: http://stackoverflow.com/a/23531826
type: Comment
has text: are you getting the same exception ?
score: 0
type: AnswerComment

http://stackoverflow.com/a/23534584
has body: The actual value a.compareTo(b) returns is meaningless. The only thing you can trust is that if it's positive a is "larger" than b, and if it's negative, a is "smaller". You can't count on its absolute value to determine the difference between the two. You could, however, just compare the unix time representation of both dates: TimeStamp due_date = ...; long dueDateMillis = due_date.getTime(); long t = System.currTimeMillis(); long threshold = 24L * 60L * 60L * 1000L; // One day in milliseconds if (dueDateMillis - t &lt;= threshold) { // Renew book }
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36104318
answers question: http://stackoverflow.com/q/23534403
upvote count: 1
has comment: http://stackoverflow.com/comment/36104196
has comment: http://stackoverflow.com/comment/36146015
has comment: http://stackoverflow.com/comment/36104355
has comment: http://stackoverflow.com/comment/36104091

http://stackoverflow.com/comment/36019805
comment on: http://stackoverflow.com/q/23489928
has text: Fairly new to this, still learning the Spring way of things
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/23590141
type: Answer
has body: I tested both. The first one doesn't work, but that's because all the slashes are there twice, so the replace method doesn't find the string. When I remove them, it works fine. You don't need to double the slashes, because they do nothing in particular in Java strings, but backslashes are used to escape special characters, so you need to espace those. But I can't tell you about the second one, since it works as expected.
answers question: http://stackoverflow.com/q/23590049
score: 0

http://stackoverflow.com/comment/36238352
type: QuestionComment
comment on: http://stackoverflow.com/q/23606041
score: 0
has text: Can you post some code that is manifesting the memory leak? Can be a lot of things.
type: Comment

http://stackoverflow.com/a/23562910
accepted answer of: http://stackoverflow.com/q/23503642
answers question: http://stackoverflow.com/q/23503642
has comment: http://stackoverflow.com/comment/87801939
upvote count: 41
has comment: http://stackoverflow.com/comment/58035137
type: Answer
has comment: http://stackoverflow.com/comment/136031245
score: 40
downvote count: 1
has comment: http://stackoverflow.com/comment/78492151
has comment: http://stackoverflow.com/comment/108944715
has body: Finally I managed to find a working solution and wrote my own method for replacing placeholders, preserving formatting: public static CharSequence getText(Context context, int id, Object... args) { for(int i = 0; i &lt; args.length; ++i) args[i] = args[i] instanceof String? TextUtils.htmlEncode((String)args[i]) : args[i]; return Html.fromHtml(String.format(Html.toHtml(new SpannedString(context.getText(id))), args)); } This approach does not require to escape HTML tags manually neither in a string being formatted nor in strings that replace placeholders.
type: AcceptedAnswer

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

http://stackoverflow.com/q/23562513
type: UnansweredQuestion
tagged with: regex
score: 2
downvote count: 0
has body: So here is the plan. Get the sourcecode from a weburl's html page e.g. https://stackoverflow.com Search through it with a pattern e.g. for links Get a hashmap/list of the results in the correct order of appearance In PHP very simple to make, but it seems to me impossible with native Java. How it would look like in PHP: <?php //the html code, maybe multilined $htmlCode = file_get_contents("https://stackoverflow.com"); $replacement = Array("\n", "\cr", "\r", "\c", "\t"); //to make it single lined like a long string $htmlCode = str_replace($replacement, "", $htmlCode); //Regex part $pattern = '#.*#siU'; preg_match_all($pattern, $htmlCode, $results, PREG_SET_ORDER); //Print it out echo " Results: ".print_r($results,true)." "; ?> Results would look like: Array = ( [0] = "http://abc.net", [1] = "http://test.com", ... ); How can I do the same in Java? (I already tried it my own with a way I thought how it could work, but it I think it's to overblown. Did it with JerichoHTMLParser.) Init.java package test.java.regex; import java.awt.*; import java.awt.event.*; import javax.swing.*; import net.htmlparser.jericho.*; import java.net.*; import java.io.*; import java.util.*; import java.util.regex.*; public class init extends JFrame { private JLabel lblKeyword; private JTextField keyword; private JButton exec; private JScrollPane sp; private JTextArea output; private Pattern pattern; private Matcher matcher; private static final String thePATTERN = "<a href=\"(http://[^\"]+)\".*"; public init(){ this.pattern = Pattern.compile(thePATTERN); this.setTitle("HTML Element Link Position"); this.setResizable(true); this.setLayout(new GridBagLayout()); GridBagConstraints gbc; this.lblKeyword = new JLabel("Search for:"); gbc=makeGBC(0, 0, 1, 1); gbc.anchor = GridBagConstraints.WEST; this.add(this.lblKeyword,gbc); this.keyword = new JTextField(); this.keyword.setText("test"); gbc=makeGBC(0, 1, 1, 1); gbc.fill=GridBagConstraints.HORIZONTAL; this.add(this.keyword, gbc); this.exec = new JButt…
type: Question
has answer: http://stackoverflow.com/a/23563216
tagged with: java
upvote count: 2
linked to: http://stackoverflow.com/q/1732348
has comment: http://stackoverflow.com/comment/36155062
has comment: http://stackoverflow.com/comment/36155394
answer count: 1
has title: Regex in Java PHP like output
favorite count: 0

http://stackoverflow.com/q/23595424
has answer: http://stackoverflow.com/a/23597509
has answer: http://stackoverflow.com/a/23596348
score: 3
downvote count: 0
tagged with: pivot
tagged with: java
type: Question
has body: I have a method which retrieve its values from a database. The query that I'm passing worked fine when i tried it in ms access. the error occurs in "results[rowCount][i] = rs.getString(i+1);" this is my full code for the method. private String[][] connectToDB2(String query) throws ClassNotFoundException{ String[][] results = null; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String db = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:/EACA_AgroVentures1.accdb"; conn = DriverManager.getConnection(db); stmt = conn.prepareStatement(query,ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); ResultSet rs = stmt.executeQuery(); ResultSetMetaData rsm = rs.getMetaData(); int columns = rsm.getColumnCount(); int rows = getRowCount(rs); if(query.contains("PIVOT") ){ System.out.println(query); rows=getRowCount2(query); }else if(query.contains("GROUP BY")){ rows = getRowCount(query); } //int rows = rs.getFetchSize(); int rowCount = 0; results = new String[rows][columns]; System.out.println(rows+" PIVOT "+columns); System.out.println("Entering While Loop"); do{ System.out.println(rowCount); if(rowCount == rows){ return results; }else{ for(int i = 0; i &lt; columns; i++){ System.out.println("Running While Loop"); rs.next(); results[rowCount][i] = rs.getString(i+1); System.out.println(rowCount+",,,,"+i+" = "+results[rowCount][i]); } rowCount++; } }while(rs.isAfterLast()==true); System.out.println("Exiting While Loop"); rs.getStatement().close(); conn.close(); } catch (SQLException ex) { Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); ex.printStackTrace(); } return results; } thank you in advance. EDIT: I've changed the ResultSet.TYPE_SCROLL_SENSITIVE into ResultSet.TYPE_FORWARD_ONLY then changed the do-while into a while. All results already show but with an arrayIndexOutOfBoundsException. How can I resolve this? Below is my updated code. private String[][] connectToDB2(String query) throws ClassNotFoundException{ String[]…
tagged with: for-loop
tagged with: sqlexception
upvote count: 3
answer count: 2
tagged with: ms-access
favorite count: 0
type: UnansweredQuestion
has title: resolving invalid cursor state in a for loop

spring
tags question: http://stackoverflow.com/q/23556819
tags question: http://stackoverflow.com/q/23576213
tags question: http://stackoverflow.com/q/23572401
tags question: http://stackoverflow.com/q/23520938
tags question: http://stackoverflow.com/q/23511123
tags question: http://stackoverflow.com/q/23551344
tags question: http://stackoverflow.com/q/23477348
tags question: http://stackoverflow.com/q/23516997
tags question: http://stackoverflow.com/q/23501796
tags question: http://stackoverflow.com/q/23496807
tags question: http://stackoverflow.com/q/23519125
tags question: http://stackoverflow.com/q/23497974
tags question: http://stackoverflow.com/q/23569521
tags question: http://stackoverflow.com/q/23595958
tags question: http://stackoverflow.com/q/23487672
tags question: http://stackoverflow.com/q/23512871
tags question: http://stackoverflow.com/q/23611019
tags question: http://stackoverflow.com/q/23514544
tags question: http://stackoverflow.com/q/23560877
tags question: http://stackoverflow.com/q/23494456
tags question: http://stackoverflow.com/q/23514787
tags question: http://stackoverflow.com/q/23561939
tags question: http://stackoverflow.com/q/23474788
tags question: http://stackoverflow.com/q/23454672
tags question: http://stackoverflow.com/q/23593980
tags question: http://stackoverflow.com/q/23504819
tags question: http://stackoverflow.com/q/23524733
tags question: http://stackoverflow.com/q/23546708
tags question: http://stackoverflow.com/q/23563363
tags question: http://stackoverflow.com/q/23458939
tags question: http://stackoverflow.com/q/23475960
tags question: http://stackoverflow.com/q/23536710
tags question: http://stackoverflow.com/q/23533230
tags question: http://stackoverflow.com/q/23454635
tags question: http://stackoverflow.com/q/23489946
tags question: http://stackoverflow.com/q/23594159
tags question: http://stackoverflow.com/q/23458993
tags question: http://stackoverflow.com/q/23478061
tags question: http://stackoverflow.com/q/23456383
tags question: http://stackoverflow.com/q/23556026
tags question: http://stackoverflow.com/q/23493578
tags question: http://stackoverflow.com/q/23538217
tags question: http://stackoverflow.com/q/23521502
tags question: http://stackoverflow.com/q/23468545
tags question: http://stackoverflow.com/q/23591481
tags question: http://stackoverflow.com/q/23578742
tags question: http://stackoverflow.com/q/23597021
tags question: http://stackoverflow.com/q/23469695
tags question: http://stackoverflow.com/q/23560563
tags question: http://stackoverflow.com/q/23497296
tags question: http://stackoverflow.com/q/23613992
tags question: http://stackoverflow.com/q/23574776
tags question: http://stackoverflow.com/q/23513580
tags question: http://stackoverflow.com/q/23574539
tags question: http://stackoverflow.com/q/23614014
type: Tag
tags question: http://stackoverflow.com/q/23600885
tags question: http://stackoverflow.com/q/23470726
tags question: http://stackoverflow.com/q/23532154
tags question: http://stackoverflow.com/q/23512485
tags question: http://stackoverflow.com/q/23493462
tags question: http://stackoverflow.com/q/23568384
tags question: http://stackoverflow.com/q/23533375
tags question: http://stackoverflow.com/q/23564173
tags question: http://stackoverflow.com/q/23534973
tags question: http://stackoverflow.com/q/23602591
tags question: http://stackoverflow.com/q/23533406
tags question: http://stackoverflow.com/q/23593254
tags question: http://stackoverflow.com/q/23461841
tags question: http://stackoverflow.com/q/23504322
tags question: http://stackoverflow.com/q/23460662
tags question: http://stackoverflow.com/q/23613264
tags question: http://stackoverflow.com/q/23549322
tags question: http://stackoverflow.com/q/23557245
tags question: http://stackoverflow.com/q/23520561
tags question: http://stackoverflow.com/q/23517075
tags question: http://stackoverflow.com/q/23610431
tags question: http://stackoverflow.com/q/23571793
tags question: http://stackoverflow.com/q/23565610
tags question: http://stackoverflow.com/q/23486170

http://stackoverflow.com/q/23453196
favorite count: 0
tagged with: fonts
has comment: http://stackoverflow.com/comment/36056575
has comment: http://stackoverflow.com/comment/36055586
upvote count: 1
has body: I'm trying to package my Java application so that other people can run it. I have no experience with this as I've always dealt with the applications through the IDE. I'm using a custom font and I use the code vectorFont = Font.createFont(Font.TRUETYPE_FONT, new File("Vectorb.ttf")); which does not work because in the JAR, the "filesystem" does not exist, or so I've been told. So I was suggested to replace new File() with getClass().getResourceAsStream("Vectorb.ttf") which works totally fine after I publish and run the JAR, but if I try to build and run the same code in IntelliJ, it throws an exception "Problem reading font data." I have also tried adding getClass().getClassLoader() to no avail. Please, what is the issue here, and how do I fix it? This is IntelliJ Community edition.
has title: Custom Fonts in Java - getResourceAsStream not working in IntelliJ IDEA but DOES work in JAR
tagged with: java
tagged with: inputstream
has comment: http://stackoverflow.com/comment/36048790
tagged with: intellij-idea
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
type: Question
tagged with: getresource

http://stackoverflow.com/q/23531157
score: 0
has title: Get notified when a method in a Singleton class is fired
upvote count: 1
tagged with: singleton
has comment: http://stackoverflow.com/comment/36099655
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: I have a singleton class within a jar file. Let's take the following class as an example. class Singleton{ private static Singleton instance; private Singleton(){} public static Singleton getInstance(){ if(instance == null) instance = new Singleton(); return instance; } public int addTwoNumbers(int num1, int num2){ return num1+num2; } Now I want to know whenever the addTwoNumbers method is fired, along with the parameters passed into it. Overriding the method is not an option since it is a in singleton. Also, since it's in a jar file, I couldn't modify it. Thus using observer pattern is also not an option. Is there any way I could possibly do this? Thanks.
has comment: http://stackoverflow.com/comment/36098246
has comment: http://stackoverflow.com/comment/36099513
tagged with: java
has comment: http://stackoverflow.com/comment/36101474
type: Question
has comment: http://stackoverflow.com/comment/36099535
has comment: http://stackoverflow.com/comment/36100077
has answer: http://stackoverflow.com/a/23532936

http://stackoverflow.com/q/23535012
possible better answer: http://stackoverflow.com/a/23535046
has answer: http://stackoverflow.com/a/23535046
type: AnsweredQuestion
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23535051
type: Question
tagged with: perl
answer count: 2
has title: java equivalent to the perl URI::QueryParam module
downvote count: 0
tagged with: url
has body: Is there an equivalent library for parsing url query params in java? In order to illustrate what i want i send a code example: use URI; use URI::QueryParam; $u = URI->new("http://www.google.com?a=b&c=d"); print $u->query,"\n"; # prints foo=1&foo=2&foo=3 for my $key ($u->query_param) { print "$key: ", join(", ", $u->query_param($key)), "\n"; } The output is: a=b&c=d a: b c: d I don't like to write my own functions of query fragment parsing.
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23535051

http://stackoverflow.com/comment/36198228
type: Comment
type: QuestionComment
score: 0
has text: can you post the stacktrace?
comment on: http://stackoverflow.com/q/23585170

http://stackoverflow.com/comment/35952782
has text: @user3011690 Then your code should work (although you'll have warnings).
comment on: http://stackoverflow.com/q/23453753
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23586994
has body: My question is How can I catch the arguments in the terminal using ant to run the main with these parameters, example: ant 1 2 3 4 5 public static void main(String[] args) { int[] meta = {0,0,0,0,0}; for(int i=1; i < 6; i++) { meta[i-1] = Integer.parseInt(args[i]); } } How can i do this, somebody help me pls C:? Here my build.xml <property name="src.dir" value="src"/> <property name="classes.dir" value="classes"/> <property name="jar.dir" value="jar"/> <property name="main-class" value="Board"/> <delete dir="${classes.dir}"/> <delete dir="${jar.dir}"/> <mkdir dir="${classes.dir}"/> <javac srcdir="${src.dir}" destdir="${classes.dir}"/> <mkdir dir="${jar.dir}"/> <attribute name="Main-Class" value="${main-class}"/> <java jar="${jar.dir}/${ant.project.name}.jar" fork="true"/>
tagged with: java
type: Question
tagged with: program-entry-point
tagged with: ant
linked to: http://stackoverflow.com/q/14309406
has title: pass line arguments to main from ant
accepted answer: http://stackoverflow.com/a/23587179
has comment: http://stackoverflow.com/comment/36201761
score: 0
answer count: 1
tagged with: arguments
has answer: http://stackoverflow.com/a/23587179
tagged with: terminal
type: AnsweredQuestion

http://stackoverflow.com/q/23468545
score: 8
has answer: http://stackoverflow.com/a/23487380
favorite count: 0
accepted answer: http://stackoverflow.com/a/23487380
has answer: http://stackoverflow.com/a/73375033
has comment: http://stackoverflow.com/comment/35979960
tagged with: spring
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: quartz-scheduler
has title: Issue with Quartz persistent jobs while using with Spring
has answer: http://stackoverflow.com/a/62881261
upvote count: 8
has comment: http://stackoverflow.com/comment/35980110
has body: I have configured a spring's method invoking job previously which is working fine. Now my requirement is to have this job as persistent which will run in a clustered environment. After configuring the quartz as clustered and persistence, application is throwing the following exception at deployment: java.io.NotSerializableException: Unable to serialize JobDataMap for insertion into database because the value of property 'methodInvoker' is not serializable: org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean I am using the following versions: Spring version 3.1.4.RELEASE Quartz version 2.1.7 Update: As per the documentation of MethodInvokingJobDetailFactoryBean: JobDetails created via this FactoryBean are not serializable. So, looking for some alternative approach to configure a persistent job in spring.
type: Question
possible better answer: http://stackoverflow.com/a/23469185
has answer: http://stackoverflow.com/a/23469185
answer count: 4

http://stackoverflow.com/q/23584971
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36198405
tagged with: environment
has body: Just started programming in Java, and I found some guides detailing how to set up a Path variable. One said to make a ёJAVA_HOMEё variable and reference it in the PATH variable like this: %JAVA_HOME%\bin and the other says to put the directory (with bin) in the PATH variable directly. Is there any difference (access rights)?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23585013
score: 0
answer count: 1
tagged with: system
has title: Setting up a system variable for Java

http://stackoverflow.com/comment/36070717
has text: so how do i use it within a method?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23516372

http://stackoverflow.com/comment/36031203
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23495944
has text: @Traubenfuchs I wouldnt say its a duplicate because on that question the batch file wont even run. As stated in my question I just need to stop my java program exiting once the batch file has been run. @Priyesh I have a big try/catch block around my code which should catch any error. However no error is thrown, the program just terminates as if i called `System.exit(0)` but I dont. And @ixe013 I have just tried it taking out the `start` command but the result is the same.

http://stackoverflow.com/q/23601294
tagged with: jframe
tagged with: swing
has body: I'm trying to understand the Scanner function, but I can't seem to understand it. I'm making a program to calculate the BMI (body mass index) and it's practically done, except that I can't make the calculation! Everything works fine except for when I click the "ok" button. Had to take away my code so my collegues won't copy my code, like they've made in the past, will be posting again after friday.
has answer: http://stackoverflow.com/a/23601443
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23601443
downvote count: 2
linked to: http://stackoverflow.com/q/17641301
tagged with: jtextfield
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36228412
possible better answer: http://stackoverflow.com/a/23601385
score: 0
has comment: http://stackoverflow.com/comment/36228376
duplicate of: http://stackoverflow.com/q/17641301
has answer: http://stackoverflow.com/a/23601385
has comment: http://stackoverflow.com/comment/36228312
favorite count: 0
has title: How to get text from JTextField?
has comment: http://stackoverflow.com/comment/36228368
upvote count: 2

http://stackoverflow.com/comment/36048790
type: Comment
score: 1
has text: Where do you have the Vectorb.ttf file stored? This is usually a problem with the file not being in the resources directory.
comment on: http://stackoverflow.com/q/23453196
type: QuestionComment

http://stackoverflow.com/comment/36102533
comment on: http://stackoverflow.com/q/23533061
has text: By A and B, I mean any session, on any JVM. Yes, optimistic locking will detect a conflicting change and throw an exception when that happens, wherever this change comes from.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36141134
comment on: http://stackoverflow.com/q/23506651
score: 0
has text: Serialized files are binary, not text. Don't use the .txt extension for them.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35957949
type: Comment
has text: I am not sure that I understand your problem, but you might want to set the visibility modifier of the array list to "protected" to make it visible for inheriting classes.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23456613

http://stackoverflow.com/comment/36003459
comment on: http://stackoverflow.com/q/23480684
score: 0
has text: And dont write integers with leading zero(es) unless you want them as octal.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36049292
has text: @FunctionR agreed. I don't think it deserved a downvote, to clarify. Also, including code helps visualize problems, so I am always for that although it isn't strictly necessary.
comment on: http://stackoverflow.com/q/23505330
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35979321
type: Comment
comment on: http://stackoverflow.com/q/23467987
has text: maybe what he meant is that he does not want a person to receive the same prize twice in a row? but i am not sure.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36117511
score: 0
type: Comment
type: QuestionComment
has text: yes yes how to do that
comment on: http://stackoverflow.com/q/23542026

http://stackoverflow.com/comment/36087279
comment on: http://stackoverflow.com/q/23503895
has text: hmm thats a good point but i don't like it :D, i would need a virtual key for this relation or? - {id:1, "A":1, "B":2}
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35993873
comment on: http://stackoverflow.com/a/23476007
has text: haha i tried! but its showing up as an error i figured it would be where i have the other strings listed
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23568156
type: Question
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23582910
has body: I'm working on a rather large (and buggy) JSF application, and the users often complain of issues that we have trouble reproducing. Is it possible to intercept the creation of all ActionEvents so that I can log their creation? If not, is there an automatic way (JSF or other) that I can improve the logging so that it spits out all user actions?
has comment: http://stackoverflow.com/comment/36166727
tagged with: jsf
has title: JSF Intercept and Log All ActionEvents
tagged with: java

http://stackoverflow.com/q/23538802
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36111831
tagged with: java
has comment: http://stackoverflow.com/comment/36112011
has comment: http://stackoverflow.com/comment/36112494
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23539432
has comment: http://stackoverflow.com/comment/36111230
has comment: http://stackoverflow.com/comment/36111744
score: 0
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/23539432
has body: import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class MainActivity extends Activity { Button btnShowLocation=null; // GPSTracker class GPSTracker gps; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btnShowLocation = (Button) findViewById(R.id.btnshowloc); // show location button click event btnShowLocation.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // create class object gps = new GPSTracker(MainActivity.this); // check if GPS enabled if(gps.canGetLocation()){ double latitude = gps.getLatitude(); double longitude = gps.getLongitude(); // \n is for new line Toast.makeText(getApplicationContext(), "Your Location is - \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show(); }else{ // can't get location // GPS or Network is not enabled // Ask user to enable GPS/network in settings gps.showSettingsAlert(); } } }); } This is My main activty claass package com.example.locateus; import android.app.AlertDialog; import android.app.Service; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.IBinder; import android.util.Log; public class GPSTracker extends Service implements LocationListener { private final Context mContext; // flag for GPS status boolean isGPSEnabled = false; // flag for network status boolean isNetworkEnabled = false; // flag for GPS status boolean canGetLocation = false; Location location; // location double latitude; // latitude double longitude; // longitude // The minimum distance to change Updates in meters private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters // The minimum …
has comment: http://stackoverflow.com/comment/36111507
has title: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo Application Crashes upon launch

http://stackoverflow.com/comment/36204557
has text: Possible duplicate of https://stackoverflow.com/questions/7338929/find-all-ways-to-sum-given-number-with-repetitions-allowed-from-given-set
comment on: http://stackoverflow.com/q/23588527
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23563798
tagged with: java
tagged with: set
type: Question
has body: Well here is my question, Can "HashSet Objects" have elements duplicated?? If I read the Set Interface definition, I see: A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element. As implied by its name, this interface models the mathematical set abstraction. And now we are going to write a simple example: Define class A: public class A { @Override public boolean equals(Object obj) { return true; } } Now execute this code; Set&lt;A&gt; set = new HashSet&lt;A&gt;(); set.add(new A()); set.add(new A()); System.out.println(set.toString()); And this is the result: [com.maths.graphs.A@b9e9a3, com.maths.graphs.A@18806f7] Why a class what implements Set Interface like HashSet contains elements duplicated? Thanks!!
has title: Understanding HashSet
has comment: http://stackoverflow.com/comment/36158017
tagged with: hashset
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/32496511
possible better answer: http://stackoverflow.com/a/23563851
has comment: http://stackoverflow.com/comment/36158043
favorite count: 0
has answer: http://stackoverflow.com/a/23563851
has answer: http://stackoverflow.com/a/23563840
accepted answer: http://stackoverflow.com/a/23563840
has comment: http://stackoverflow.com/comment/36158074
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/35988161
score: 0
has text: Have you done `mvn eclipse:eclipse` ? (If of course you use eclipse)
comment on: http://stackoverflow.com/q/23472950
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36012058
has text: Welcome to Stack Overflow! An actual [runnable example that demonstrates your problem](https://stackoverflow.com/help/mcve) would involve less guess work and better responses
score: 1
comment on: http://stackoverflow.com/q/23485530
type: Comment
type: QuestionComment

facebook-graph-api
tags question: http://stackoverflow.com/q/23524016
tag name: facebook-graph-api
tags question: http://stackoverflow.com/q/23565832
tags question: http://stackoverflow.com/q/23495438
tags question: http://stackoverflow.com/q/23579679
tags question: http://stackoverflow.com/q/23543822
type: Tag

http://stackoverflow.com/q/23606092
linked to: http://stackoverflow.com/q/21254093
tagged with: java
tagged with: hibernate
type: Question
score: 5
answer count: 1
favorite count: 0
tagged with: upgrade
has title: Hibernate Upgrade : StatisticsService()
upvote count: 5
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23606322
has body: I am upgrading hibernate from 3.6 to 4.3.5. After replacing the .jar files and some deprecated packages, classes &amp; also the Basic data types I am still getting some errors with the StatisticsService() &amp; in org.hibernate.jmx package. The errors are following: 1. error: package org.hibernate.jmx does not exist [javac] import org.hibernate.jmx.StatisticsService; 2. error: cannot find symbol [javac] StatisticsService stats = new StatisticsService(); // MBean implementation Is there any other method to implement this OR the package itself is deprecated ? What is the alternative way to resolve this error ? Thanks.

http://stackoverflow.com/q/23571432
duplicate of: http://stackoverflow.com/q/4059363
score: 0
accepted answer: http://stackoverflow.com/a/23571483
answer count: 5
has title: Linked lists non-contiguous memory
has body: I am having difficulty finding an answer to the following question from a past exam paper. I would appreciate an explanation. Linked lists use non-contiguous memory, what does this mean?
has answer: http://stackoverflow.com/a/23571627
has answer: http://stackoverflow.com/a/23571570
type: AnsweredQuestion
tagged with: linked-list
has answer: http://stackoverflow.com/a/23571669
possible better answer: http://stackoverflow.com/a/23571487
has comment: http://stackoverflow.com/comment/36172399
has answer: http://stackoverflow.com/a/23571483
type: Question
has answer: http://stackoverflow.com/a/23571487
has comment: http://stackoverflow.com/comment/95592067
linked to: http://stackoverflow.com/q/4059363
has comment: http://stackoverflow.com/comment/36172385
tagged with: java

http://stackoverflow.com/comment/36128295
type: QuestionComment
has text: I understood the context, but I'm not a big fan of your approach.. i.e. changing the session value via ajax. Can you give some more info? How does jquery get these values? Is it like an add button that add dynamic input fields or table cloumns?
comment on: http://stackoverflow.com/q/23544973
score: 0
type: Comment

http://stackoverflow.com/a/23538120
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/23490583
has comment: http://stackoverflow.com/comment/36110244
downvote count: 1
has body: Alright, since you have two kind of different answers I can show you the difference and when to use which. First off, what you want to do when you have multiple methods that you want to combine into one is that you want to find a common denominator. That is, something that all methods have in common. To find the common denominator(s) you examine the methods that you want to turn into one. public static boolean createMenu(SherlockActivity aActivity, Menu menu){ MenuInflater inflater = ((SherlockActivity) aActivity).getSupportMenuInflater(); inflater.inflate(R.menu.main_menu, menu); Intent i = new Intent((Context) aActivity, InstructionsActivity.class); i.putExtra("Flag", "firstInstructions"); menu.findItem(R.id.hearing_test).setIntent(i); menu.findItem(R.id.learn).setIntent(new Intent((Context) aActivity, LearnActivity.class)); menu.findItem(R.id.share).setIntent(new Intent((Context) aActivity, ShareActivity.class)); menu.findItem(R.id.locate).setIntent(new Intent((Context) aActivity, MapActivity.class)); menu.findItem(R.id.saved).setIntent(new Intent((Context) aActivity, SavedResultsActivity.class)); return true; } From this method there are two objects that are created from parameters; MenuInflater inflater and (Context)aActivity. The MenuInflater is accessed from a method in Activity and the Context is cast from an Activity. Thus, providing your new (combined) method with an Activity will provide the new method with enough information to be able to do what the four others have done. When you have found the common denominator(s) there are two cases: The parameters already have all common denominators The parameters does not have all common denominators Solution for the first case: You know that all your classes can access an Activity. Thus, you let your new method take one Activity and one Menu as parameter: public static boolean createMenu(Activity aActivity, Menu menu){ MenuInflater inflater = aActivity.getSupportMenuInflater(); inflater.inflate(R.menu.main_menu,…
type: Answer

http://stackoverflow.com/a/23518989
answers question: http://stackoverflow.com/q/23518936
has comment: http://stackoverflow.com/comment/36074284
has comment: http://stackoverflow.com/comment/36074920
has comment: http://stackoverflow.com/comment/36074534
has body: This will match "at least one word then 'price' then at least one word": (\\w+\\s+)+price(\\s+\\w+)+
has comment: http://stackoverflow.com/comment/36074261
type: Answer
upvote count: 4
score: 2
has comment: http://stackoverflow.com/comment/36074217
has comment: http://stackoverflow.com/comment/36074347
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36073928
downvote count: 2
accepted answer of: http://stackoverflow.com/q/23518936
has comment: http://stackoverflow.com/comment/36074590
has comment: http://stackoverflow.com/comment/36074439

http://stackoverflow.com/comment/36078301
score: 1
has text: That's an alternative, not a solution.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23521239

http://stackoverflow.com/comment/36308495
score: 2
has text: Wanted to comment on this earlier: Creating a "good" triangulation is **really** challenging. I had some promising results with the `Ruppert` class from http://www3.math.tu-berlin.de/jtem/numericalMethods/ , but it does not treat holes. I consider the "triangle" package that you mentioned as **THE** solution for triangulations (it's **really** good). But - it's implemented in a horrible, horrible "C"ish way, and can not even remotely be ported to java (never-ever ... horrible). Once I wrote a small wrapper for this lib with JNI, but it is not published yet and might still need some cleanups.
comment on: http://stackoverflow.com/q/23597434
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36065610
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23514594
has text: Why not just set the log level to the right level?
score: 0

http://stackoverflow.com/a/23547049
downvote count: 0
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/23546925
accepted answer of: http://stackoverflow.com/q/23546925
has comment: http://stackoverflow.com/comment/36126898
has comment: http://stackoverflow.com/comment/36126961
score: 5
has body: Move code. It's your only option. You need to identify code in x that depends on y or code in y that depends on x. If you can move the code to the other project, that might fix the problem. Otherwise, you may need to move code to a new project. I've had to do both.
type: AcceptedAnswer

http://stackoverflow.com/q/23488278
favorite count: 0
has comment: http://stackoverflow.com/comment/36018800
has answer: http://stackoverflow.com/a/23506274
upvote count: 2
has comment: http://stackoverflow.com/comment/36019392
type: UnansweredQuestion
tagged with: encryption
tagged with: android
downvote count: 1
tagged with: aes
has body: I have a problem of decrypting a text file which is encrypted through command line of openssl as: Key Geanaration: # openssl enc -aes-256-cbc -k secret -P -md sha1 salt=770AB8C12EF73A4E key=7EF9E708C05E1767C433E097A66A84AC1971E124E42BDB9D4F0967FF77642AA4 iv =EFFA2B9E2990BC6641E1E5D859D3CF37 File Encryption: # openssl enc -aes-256-cbc -K 7EF9E708C05E1767C433E097A66A84AC1971E124E42BDB9D4F0967FF77642AA4 -iv EFFA2B9E2990BC6641E1E5D859D3CF37 -in text.txt -out text22.enc But I have a code by which I can not able to decrypt the same as: public void decryptAES() throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IOException{ FileInputStream fis = new FileInputStream(Environment.getExternalStorageDirectory()+"/encrypted.txt"); FileOutputStream fos = new FileOutputStream(Environment.getExternalStorageDirectory()+"/decrypted.txt"); SecretKeySpec sks = new SecretKeySpec("your_key".getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC"); cipher.init(Cipher.DECRYPT_MODE, sks); CipherInputStream cis = new CipherInputStream(fis, cipher); int b; byte[] d = new byte[8]; while((b = cis.read(d)) != -1) { fos.write(d, 0, b); } fos.flush(); fos.close(); cis.close(); }
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36019260
type: Question
answer count: 1
has title: Decrypt a file which is encrypted by openssl in android

http://stackoverflow.com/a/23579107
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23578770
score: 2
has body: No, when session varialbles are catched in jsp page, it comes in "Object" data type. we have to parse them to String. For that we can use either .toString() method or we can cast it using String str=(String)session.getAttribute("session_name"); OR String str=(String)session.getAttribute("session_name"); For your code I suggest use sessionScope &lt;c:choose&gt; &lt;c:when test="${sessionScope.discountAdded == 'true'}"&gt; &lt;p align="center"&gt; All Discount(s) added successfully! &lt;/p&gt; &lt;/c:when&gt; &lt;c:when test="${sessionScope.discountAdded == 'false'}"&gt; &lt;p align="center"&gt; Error Found! No Discounts added! &lt;/p&gt; &lt;/c:when&gt;

http://stackoverflow.com/q/23467836
favorite count: 0
tagged with: equals
has title: Why does assertEquals(new Object[] {"abc"}, new Object[] {"abc"}); not fail?
has answer: http://stackoverflow.com/a/23467868
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23468069
upvote count: 3
has answer: http://stackoverflow.com/a/23468069
tagged with: java
has body: I'm following Kent Beck's Test Driven Development by Example. The relevant chapter can be found as <a href="http://books.google.co.uk/books?id=CUlsAQAAQBAJ&amp;lpg=PA69&amp;ots=Qzk1_b3SMU&amp;dq=public%20void%20testArrayEquals%28%29%20%7B%20assertEquals%28new%20Object%5B%5D%20%7B%22abc%22%7D,%20new%20Object%5B%5D%20%7B%22abc%22%7D%29;%20%7D%20test%20driven%20development&amp;pg=PA69#v=onepage&amp;q=public%20void%20testArrayEquals%28%29%20%7B%20assertEquals%28new%20Object%5B%5D%20%7B%22abc%22%7D,%20new%20Object%5B%5D%20%7B%22abc%22%7D%29;%20%7D%20test%20driven%20development&amp;f=false" rel="nofollow">a preview online here. Kent writes: Can we use a two-element array containing the two currencies as the key? Does Array.equals() check to see if the elements are equal? public void testArrayEquals() { assertEquals(new Object[] {"abc"}, new Object[] {"abc"}); } Nope. The test fails, so we have to create a real object for the key However when I run the test it passes. I thought that assertEquals would check Array.equals() which checks for the same object, rather than contents, therefore the test would fail, but it doesn't (at least not for me). On the other hand: System.out.println( new Object[]{"abc"}.equals(new Object[]{"abc"}) ); Prints false as expected... Eclipse tells me that assertEquals(Object[], Object[]) is now deprecated, but for the sake of understanding, why is the test passing for me now?
type: Question
score: 3
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23467868
tagged with: tdd
answer count: 2
tagged with: junit
downvote count: 0

http://stackoverflow.com/q/23476715
has answer: http://stackoverflow.com/a/23499389
type: UnansweredQuestion
tagged with: activemq-classic
type: Question
has body: I'm using Camel to route Activemq messages. Camel is boot with org.apache.camel.Main class like this: public class SDaemon { private org.apache.camel.Main main; public static void main(String[] args) throws Exception { SDaemon sDaemon = new SDaemon(); sDaemon.boot(); } public void boot() { try { main = new Main(); main.enableHangupSupport(); PooledConnectionFactory p = new PooledConnectionFactory(); p.setMaxConnections(8); p.setMaximumActiveSessionPerConnection(500); ActiveMQComponent comp1 = activeMQComponent("tcp://localhost:61616"); comp1.setUsePooledConnection(true); comp1.setConnectionFactory(p.getConnectionFactory()); ActiveMQComponent comp2 = activeMQComponent("tcp://192.168.10.103:61616"); comp2.setUsePooledConnection(true); comp2.setConnectionFactory(p.getConnectionFactory()); main.bind("activemq", comp1); //ToGet main.bind("activemq2", comp2); //ToInOut main.bind("activemqException", activeMQComponent("tcp://localhost:61616")); //OnException main.addRouteBuilder(new MyRouteBuilder()); System.out.println("Starting Camel(SDaemon). Use ctrl + c to terminate the JVM.\n"); main.run(); } catch (Exception e){ e.printStackTrace(); } } private static class MyRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { //... } } } problem: when I send Ctrl+C to shutdown the camel, it logs this warning: Unable to register shutdown hook due to JVM state Why? and how to fix this?
tagged with: java
tagged with: apache-camel
has comment: http://stackoverflow.com/comment/35995330
score: 0
answer count: 1
has title: Apache Camel: Unable to register shutdown hook due to JVM state

http://stackoverflow.com/comment/36161310
comment on: http://stackoverflow.com/a/23557757
type: Comment
score: 1
has text: I will add though that, since I'm using RESTEasy with the default Jackson JSON writer, might as well use ObjectMapper instead of gson - e.g: entityStream.write(new ObjectMapper().writeValueAsBytes(obj));
type: AnswerComment

http://stackoverflow.com/q/23538897
has title: Can we use jQuery to work with Java objects OR does it manipulate DOM model only?
tagged with: dom
tagged with: servlets
score: 0
answer count: 1
tagged with: jquery
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23539092
has body: I have a very complex scenario where i need to change the java objects(basically HashMap ) from jquery get Request and get the response and print that in the jsp. User can send number of request and get seperate response from servlet based on request and display the data. after every request i have to put the map in session and than in another request i get the same in session and do the updates and put it back in session. JqueryGet(parameter) to Java. Updating Hashmap according to parameter. Putting hashmap in session . ( session.setAttribute("map",map)) sending response back to Jsp in jquery and print results in jsp. Than another request send to Java . it will get the map from session session.getAttribute("map",map) and than update the map based on new request . Put the map again in session and so on....Than i have a submit button finally which will show the new data on the page and than update the server. Is this the right approach ? My functionality is working fine as of now in Dev environment. But i am worried whether i should use DOM. if i will use DOM it will be very complex since i have to manipulate much values of Hashmap based on request. Here is the jquery code : $.ajax({ url: '&lt;%=portalContext.createTemplateProcessURI()%&gt;' +'?s1='+ $("#networkBox1").val()+'&amp;box1=Box1&amp;tick=add&amp;val1='+ allvs+'&amp;s2='+ $("#networkBox2").val()+'&amp;box2=Box2&amp;val2='+ allvs, type: 'get', dataType: 'text', async: false, success: function(data) { Processbox(data); // This function displaying the result. } });
tagged with: java
type: Question
tagged with: http://stackoverflow.com/tag/json

javascript
tags question: http://stackoverflow.com/q/23498705
tags question: http://stackoverflow.com/q/23565935
tags question: http://stackoverflow.com/q/23482416
tags question: http://stackoverflow.com/q/23574529
tags question: http://stackoverflow.com/q/23517975
tags question: http://stackoverflow.com/q/23458290
tags question: http://stackoverflow.com/q/23566693
tags question: http://stackoverflow.com/q/23528480
tags question: http://stackoverflow.com/q/23536314
tags question: http://stackoverflow.com/q/23465375
tags question: http://stackoverflow.com/q/23610431
tag name: javascript
tags question: http://stackoverflow.com/q/23611935
tags question: http://stackoverflow.com/q/23549633
tags question: http://stackoverflow.com/q/23489119
tags question: http://stackoverflow.com/q/23535063
tags question: http://stackoverflow.com/q/23532648
tags question: http://stackoverflow.com/q/23470855
tags question: http://stackoverflow.com/q/23567148
tags question: http://stackoverflow.com/q/23521978
tags question: http://stackoverflow.com/q/23493181
tags question: http://stackoverflow.com/q/23513936
tags question: http://stackoverflow.com/q/23589068
tags question: http://stackoverflow.com/q/23473564
tags question: http://stackoverflow.com/q/23606176
tags question: http://stackoverflow.com/q/23558326
tags question: http://stackoverflow.com/q/23490269
type: Tag
tags question: http://stackoverflow.com/q/23557174
tags question: http://stackoverflow.com/q/23542534
tags question: http://stackoverflow.com/q/23567889
tags question: http://stackoverflow.com/q/23475557
tags question: http://stackoverflow.com/q/23544973
tags question: http://stackoverflow.com/q/23561997
tags question: http://stackoverflow.com/q/23584034
tags question: http://stackoverflow.com/q/23522010
tags question: http://stackoverflow.com/q/23471516
tags question: http://stackoverflow.com/q/23601169
tags question: http://stackoverflow.com/q/23549296
tags question: http://stackoverflow.com/q/23515095
tags question: http://stackoverflow.com/q/23467039
tags question: http://stackoverflow.com/q/23494223
tags question: http://stackoverflow.com/q/23511023
tags question: http://stackoverflow.com/q/23467823
tags question: http://stackoverflow.com/q/23580060
tags question: http://stackoverflow.com/q/23524301
tags question: http://stackoverflow.com/q/23491021
tags question: http://stackoverflow.com/q/23517921
tags question: http://stackoverflow.com/q/23513152
tags question: http://stackoverflow.com/q/23512802
tags question: http://stackoverflow.com/q/23466128
tags question: http://stackoverflow.com/q/23453876
tags question: http://stackoverflow.com/q/23487891
tags question: http://stackoverflow.com/q/23607310
tags question: http://stackoverflow.com/q/23541860
tags question: http://stackoverflow.com/q/23474373
tags question: http://stackoverflow.com/q/23612604
tags question: http://stackoverflow.com/q/23511783
tags question: http://stackoverflow.com/q/23613796
tags question: http://stackoverflow.com/q/23510048
tags question: http://stackoverflow.com/q/23520194
tags question: http://stackoverflow.com/q/23479180
tags question: http://stackoverflow.com/q/23464101
tags question: http://stackoverflow.com/q/23468653
tags question: http://stackoverflow.com/q/23474596
tags question: http://stackoverflow.com/q/23611227
tags question: http://stackoverflow.com/q/23558596

http://stackoverflow.com/comment/36236206
has text: @hpko - because there is a difference in variable names "w" and "weight". The compiler sees it. The "local" field is not shadowing the "instance level field"
type: Comment
comment on: http://stackoverflow.com/a/23605587
score: 0
type: AnswerComment

android-edittext
tags question: http://stackoverflow.com/q/23577420
tags question: http://stackoverflow.com/q/23597667
type: Tag
tags question: http://stackoverflow.com/q/23587453
tags question: http://stackoverflow.com/q/23513952
tags question: http://stackoverflow.com/q/23454588
tags question: http://stackoverflow.com/q/23503935
tags question: http://stackoverflow.com/q/23517572
tag name: android-edittext
tags question: http://stackoverflow.com/q/23465032
tags question: http://stackoverflow.com/q/23549343
tags question: http://stackoverflow.com/q/23539713

http://stackoverflow.com/comment/36034637
type: Comment
has text: i don't need limit in query. I need to write every one row in own array.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23497686

http://stackoverflow.com/q/23609520
has answer: http://stackoverflow.com/a/23610079
answer count: 2
tagged with: akka
score: 4
favorite count: 0
has body: In akka the poststop method is called when an actor is stopped. Also a watch can be configured on the supervisor so that when an actor is terminated a Terminated message is received within the supervisor. Is there any advantage of using the postStop instead of Terminated? The only difference I can see is that postStop is called(within actor) when an actor is stopped and Terminated is called(within supervisor) when actor is Terminated. When an actor is stopped is'nt it also terminated ?
has title: Difference between poststop and terminate in Akka?
upvote count: 4
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/23610079
tagged with: scala
accepted answer: http://stackoverflow.com/a/23610058
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23610058

http://stackoverflow.com/q/23455135
score: -1
answer count: 1
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23455172
has body: I have the Map, with a String keys and HashSet values: Set&lt;String&gt; values = new HashSet&lt;String&gt;(); values.add("values1"); values.add("values2"); Map&lt;String, Set&gt; maps = new HashMap&lt;String, Set&gt;(); maps.put("TestKey", values); I try to bring all the data in the format of the key values ​​values ​​//in one line But I'm getting: key [values, ​​values] Deduce elements I here so: for(Entry&lt;String, Set&gt; e : maps.entrySet()) { System.out.println(e.getKey() + " " + e.getValue()); } Please help me to fix output. UPD and if I want to write it all down in the file, what do I do? in the same format in one line.. this option does not work: FileWriter wr = null; PrintWriter pw; try { wr = new FileWriter(file.getAbsoluteFile(), true); pw = new PrintWriter(wr); for(Entry&lt;String, Set&lt;String&gt;&gt; e : my.entrySet()) { pw.print(e.getKey()); for(String s: e.getValue()) pw.print(" " + s); pw.println(); } } catch (IOException e1) { e1.printStackTrace(); }
has title: HashSet output of Map
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/23455172
tagged with: java
has comment: http://stackoverflow.com/comment/35955249
type: Question
has comment: http://stackoverflow.com/comment/35955237

http://stackoverflow.com/q/23462323
downvote count: 3
has body: I've searched high and low for the answer to this and can't see how I'm doing it wrong, I've tried several different ways of coding it but it always goes outside the range I'm looking for. (90 - 180 inclusive). Can anyone shed some light on the code below??? Random rnd = new Random(); int time = rnd.nextInt(91) + 90; Thanks for any support offered... /** * Randomly generates a number between 90-180 inclusive and sets the random number as an argument to a message-send for each of the * Runner objects in runnersList. */ public void runMarathon() { for (Runner r : runnersList) { Random rnd = new Random(); int time = rnd.nextInt(91) + 90; r.setTime(time); } }
linked to: http://stackoverflow.com/q/363681
type: Question
possible better answer: http://stackoverflow.com/a/23462452
has answer: http://stackoverflow.com/a/23462452
duplicate of: http://stackoverflow.com/q/363681
has comment: http://stackoverflow.com/comment/35969360
has title: Generating random numbers within a specific range
has answer: http://stackoverflow.com/a/23462426
tagged with: random
answer count: 2
has comment: http://stackoverflow.com/comment/35969321
upvote count: 0
favorite count: 0
score: -3
accepted answer: http://stackoverflow.com/a/23462426
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35968950
tagged with: java

http://stackoverflow.com/q/23573020
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23588861
has comment: http://stackoverflow.com/comment/36186130
score: 0
has answer: http://stackoverflow.com/a/23574199
answer count: 3
has title: Clip not playing sound a second time
tagged with: javasound
type: UnansweredQuestion
tagged with: audio
has body: I have a method that plays a sound. It works the first time, but in the second play I cannot hear the sound. First I have the AudioInputStream instantiated in the constructor: private AudioInputStream audio; public AudioTest() { try { audio = AudioSystem.getAudioInputStream(new File(PATH).getAbsoluteFile()); } catch (UnsupportedAudioFileException | IOException e) { } } And the method that plays the sound: private void play() { try { Clip clip = AudioSystem.getClip(); clip.open(audio); clip.setFramePosition(0); clip.start(); } catch (LineUnavailableException | IOException e) { } } The first time I hear the audio but not the second time. Why?
has answer: http://stackoverflow.com/a/23573385

http://stackoverflow.com/a/23582961
answers question: http://stackoverflow.com/q/23582883
has body: You should cal the method count and display the result in the main method. public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("Enter String"); String line = input.nextLine(); char p = 'a'; System.out.println("Character a occurs " + count(line, p) + " times "); }
type: Answer
score: 0

http://stackoverflow.com/a/23585269
has body: Simple answer is that it is not possible. JAX-RS is working on HTTP transport, which is based on the request-response paradigm. So the client needs to first initiate the connection, then server may send the response to him. If you want to have two systems which can call each other, then you must implement the services and the clients in both of them: System 1 System 2 Client 1 ------&gt; Service 2 Service 1 &lt;------ Client 2
type: Answer
accepted answer of: http://stackoverflow.com/q/23457290
answers question: http://stackoverflow.com/q/23457290
upvote count: 2
has comment: http://stackoverflow.com/comment/36206591
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36207127

http://stackoverflow.com/comment/46721985
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23584296
score: 0
has text: Related: [Ordered insertion in linkedHashSet, any performant way ?](http://stackoverflow.com/q/12826916)

http://stackoverflow.com/q/23492683
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36025541
has comment: http://stackoverflow.com/comment/124108969
has answer: http://stackoverflow.com/a/23493399
answer count: 2
has body: I have a scenario like this: I am trying to execute a command (df -h i.e command to find disk free space ) on a database server. I am trying to do so by using two JAR files i.e. jsch-0.1.51.jar and ganymed-ssh2-build210.jar . Now when there is any worng credentails entered , It causes the below exception com.jcraft.jsch.JSchException But when i try to catch that exception it says: Unreachable catch block for JSchException. This exception is never thrown from the try statement body and the program fails how can i catch this "com.jcraft.jsch.JSchException" exception.??? Any suggestion is welcomed. Thanks in advance. The full stacktrace is given below: Connect fails with the following exception: com.jcraft.jsch.JSchException: java.net.UnknownHostException: Select Option session is down com.jcraft.jsch.JSchException: session is down at com.jcraft.jsch.Session.openChannel(Session.java:752) at net.neoremind.sshxcute.core.SSHExec.exec(SSHExec.java:164) at org.nrift.SchMaint.controller.CheckSpaceServlet.doPost(CheckSpaceServlet.java:63) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
downvote count: 0
tagged with: jsch
has comment: http://stackoverflow.com/comment/36024540
has comment: http://stackoverflow.com/comment/36025441
favorite count: 0
has comment: http://stackoverflow.com/comment/36024531
has answer: http://stackoverflow.com/a/23494074
has title: How to catch exception caused by external JARs
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36024600
linked to: http://stackoverflow.com/q/2003419
has comment: http://stackoverflow.com/comment/36026737
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36024811

http://stackoverflow.com/comment/36040799
has text: This looks like the Java Class you are after: http://docs.oracle.com/javase/7/docs/api/java/security/interfaces/RSAPublicKey.html though instantiating one is a little trickier (and fully outlined in the answer I linked to)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23500790

http://stackoverflow.com/a/23599366
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/113508996
has comment: http://stackoverflow.com/comment/93730986
score: 6
type: Answer
accepted answer of: http://stackoverflow.com/q/23577576
answers question: http://stackoverflow.com/q/23577576
has body: FileLock isn't specified to prevent deletion. It's only specified to interact with other file locks, so you're already deep into platform-dependent behaviour. If RandomAccessFile somehow does what you want you may be stuck with it, but you can't rely on it. NB of course FileChannel.open() uses a FileDescriptor, handle, etc.
has comment: http://stackoverflow.com/comment/118392358
upvote count: 6
has comment: http://stackoverflow.com/comment/36268990

http://stackoverflow.com/q/23484387
accepted answer: http://stackoverflow.com/a/23489234
tagged with: ebean
tagged with: playframework-2.0
score: 0
tagged with: java
answer count: 1
has body: I am trying to use Play Framework with Ebean. I have quite simple Java class Subject: @Entity public class Subject extends Model { private static final long serialVersionUID = 1L; @Id public final int id; public String name; public Subject() { id = 0; } public Subject(int id, String name) { this.id = id; this.name = name; } } And also I have simple edit form (views.subjects.edit.scala.html): @(subjectForm: Form[models.entities.Subject], id: Int) @import helper._ @main("Subject") { @helper.form(action = routes.Subjects.save(id)) { @helper.inputText(subjectForm("name"),'_label -> "Name") Cancel } } Field id is not editable (it's primary key), that's why I don't like to show it in form input elements. So, when I saving edited Subject, I need to do something like public static Result save(int id) { Form<Subject> form = subjectForm.bindFromRequest(); if (form.hasErrors()) { flash("error", DATA_ERROR); return badRequest(edit.render(form, id)); } Subject subject = form.get(); if (id == 0) { // Add new record case subject.save(); } else { // Edit existing record case Subject old = Subject.find.byId(id); if (old == null) { return notFound(NOT_FOUND); } old.setName(subject.getName()); old.save(); flash("success", String.format("Subject %s, %d saved", old.getName(), old.getId())); } return redirect(routes.Subjects.index()); } I have only one question. Is there any ways to get Subject instance from subjectForm with correct (original) id? Make additional requests to database for updating record seems like not a good solution. But when I gettting instance from subjectForm id always 0.
has answer: http://stackoverflow.com/a/23489234
has title: Play + Ebean how to keep primary keys while editing record?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/13017411
type: Question

http://stackoverflow.com/a/23601117
score: 0
answers question: http://stackoverflow.com/q/23600478
has comment: http://stackoverflow.com/comment/36228810
has comment: http://stackoverflow.com/comment/36228112
accepted answer of: http://stackoverflow.com/q/23600478
has body: All the things you have did correctly, but missed one small thing within your onCreate() of DataHandler.java. @Override public void onCreate(SQLiteDatabase db) { try{ //db.execSQL("TABLE_CREATE"); // Here you passing `TABLE_CREATE` string instead of passing `TABLE_CREATE` variable's string. So kindly remove quotes surrounded by 'TABLE_CREATE' and try. db.execSQL(TABLE_CREATE); } catch(SQLException e) { e.printStackTrace(); } } And change this, public static final String TABLE_CREATE = "create table mytable (name text not null, email text not null);"; to public static final String TABLE_CREATE = "create table mytable (name text not null, email text not null)";
type: Answer
has comment: http://stackoverflow.com/comment/36228237
type: AcceptedAnswer

http://stackoverflow.com/comment/36025856
score: 0
has text: For that you can refer this question : [checking which check boxes are selected using JAVA ( a jsp)](http://stackoverflow.com/q/15775412/1686291)
type: AnswerComment
comment on: http://stackoverflow.com/a/23491734
type: Comment

http://stackoverflow.com/a/73375033
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23468545
has comment: http://stackoverflow.com/comment/129593420
has body: just add implements Serializable

http://stackoverflow.com/comment/36046607
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23503622
has text: @RichardTingle Yeah, this is what I didn't realize initially…thanks, that's exactly why I'm no longer trying to do this. Arrays it is!

http://stackoverflow.com/q/23526078
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36089441
linked to: http://stackoverflow.com/q/3342984
has body: I have this method on a bean: public boolean isLinkInDescriptionForCheckbox(final Service service) { logger.info("Testing if there is a link for {}", service); return Service.UK_ADDRESS_CORRECTION == service; } ...and this in my JSP: <c:if test="#{serviceUiDescriptions.isLinkInDescriptionForCheckbox(service)}"> My log tells me this: c.n.c.s.c.ServiceUiDescriptions - Testing if there is a link for null And YET this works fine: #{serviceUiDescriptions.getDescriptionForCheckbox(service)} ...which is the line just before the c:if tag So: In the line just before, service is not null, but in the test for the c:if line service is null. Here's the whole fragment <ui:repeat var="service" value="#{servicesBean.getAvailableServicesOfGroup(servicePresentationGroup)}"> #{serviceUiDescriptions.getDescriptionForCheckbox(service)} <c:if test="#{serviceUiDescriptions.isLinkInDescriptionForCheckbox(service)}"> <h:outputLink value="#{serviceUiDescriptions.getLinkInDescriptionForCheckbox(service)}" > #{serviceUiDescriptions.getLinkDescriptionInDescriptionForCheckbox(service)} </h:outputLink> </c:if> </ui:repeat> This is what I get - look no link:
has comment: http://stackoverflow.com/comment/36089555
linked to: http://stackoverflow.com/q/5611767
upvote count: 2
has answer: http://stackoverflow.com/a/23527676
has comment: http://stackoverflow.com/comment/36088360
has comment: http://stackoverflow.com/comment/36089524
type: AnsweredQuestion
tagged with: jsf
linked to: http://stackoverflow.com/q/15446632
has title: Why is service null in this call?
tagged with: java
has comment: http://stackoverflow.com/comment/36088198
type: Question
has comment: http://stackoverflow.com/comment/36089380
score: 2
accepted answer: http://stackoverflow.com/a/23527676
downvote count: 0

http://stackoverflow.com/a/23568054
answers question: http://stackoverflow.com/q/23567744
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36167588
has comment: http://stackoverflow.com/comment/36169051
accepted answer of: http://stackoverflow.com/q/23567744
type: Answer
has comment: http://stackoverflow.com/comment/36169330
has comment: http://stackoverflow.com/comment/36167353
has body: You can try the following and see - String regex = "(?&lt;!\")([,@#&lt;$%]{1})(\\w+)(?!\")"; String input = "hello \"@this\" is just a #test"; System.out.println(input); System.out.println(input.replaceAll(regex, "$0 $2")); Output is hello "@this" is just a #test hello "@this" is just a #test test
has comment: http://stackoverflow.com/comment/36183420
has comment: http://stackoverflow.com/comment/36183864
score: 0
has comment: http://stackoverflow.com/comment/36183467

http://stackoverflow.com/comment/36222917
comment on: http://stackoverflow.com/a/23598174
score: 0
type: AnswerComment
has text: For example when I move rabbit that has number 10, I don't want him to move for another x seconds, but I don't want to wait x seconds for rabbit number 11 to move. I don't know how would I use DelayQueue.
type: Comment

http://stackoverflow.com/q/23480130
answer count: 2
has body: My code will not clear the previous rectangle. I thought by using the getRect() and then using repaint() in my keyPressed() method, that would solve the problem. import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.geom.Rectangle2D; import javax.swing.Icon; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.geom.AffineTransform; import java.awt.geom.Arc2D; import java.awt.geom.PathIterator; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; public class Rectangle extends JFrame implements KeyListener{ private int height; private int width; private int x; private int y; private Graphics2D g2; public Rectangle(int width, int height,int x, int y) { this.height = height; this.width = width; this.x = x; this.y = y; JLabel label = new JLabel(); setSize(1000,1000); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setVisible(true); label.addKeyListener(this); label.setFocusable(true); label.setOpaque(true); label.addKeyListener(this); this.add(label); setVisible(true); label.requestFocusInWindow(); } public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DOWN) { g2.clearRect(x, y, width, height); repaint(); y = y + 5; repaint(); } if (e.getKeyCode() == KeyEvent.VK_LEFT) { g2.clearRect(x, y, width, height); repaint(); x = x - 5; repaint(); } if (e.getKeyCode() == KeyEvent.VK_UP) { g2.clearRect(x, y, width, height); repaint(); y = y - 5; repaint(); } if (e.getKeyCode() == KeyEvent.VK_RIGHT) { g2.clearRect(x, y, width, height); x = x + 5; repaint(); } } public void keyReleased(KeyEvent e) {} public void keyTyped(KeyEvent e) {} public void paint(Graphics g) { g2 = (Graphics2D) g; g2.drawRect(x, y, width, height); } } Test Method: public class Test { public …
tagged with: jframe
tagged with: swing
has answer: http://stackoverflow.com/a/23480276
has comment: http://stackoverflow.com/comment/36002683
has answer: http://stackoverflow.com/a/23480470
accepted answer: http://stackoverflow.com/a/23480470
type: AnsweredQuestion
tagged with: paint
tagged with: java
tagged with: keylistener
type: Question
possible better answer: http://stackoverflow.com/a/23480276
score: 0
has title: Drawn object doesn't clear previous rectangle after key is pressed

http://stackoverflow.com/comment/35957992
type: QuestionComment
score: 1
has text: "But MD5 output is in hex digits" - no, it's just binary data. You may happen to currently be converting it into hex, but you certainly don't have to.
comment on: http://stackoverflow.com/q/23456590
type: Comment

http://stackoverflow.com/q/23493512
has title: What intent to start upon button click and how to count score in basic math app?
has comment: http://stackoverflow.com/comment/36026072
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36026754
has comment: http://stackoverflow.com/comment/36026290
has body: I'm trying to create a very basic app where the user is supposed to provide a solution to a simple math problem. The math problem is for example 10+0= and the user is supposed to type in the sum of those two numbers. I'm stuck where the user has entered an answer and clicks the OK button. I know that I'm supposed to start some kind of intent here but I'm not sure what kind of intent? I want the app to be able to tell if the provided solution is the right or wrong answer to the math problem and, if right, add 1 to the current score (in the textview att the bottom) and display a new random math problem just like the one solved (or not solved). MathActivity.java public class MathActivity extends Activity { private MediaPlayer mp; @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_math); //Media player with toggle button final ToggleButton togglesound = (ToggleButton) findViewById(R.id.togglesound); mp = MediaPlayer.create(this, R.raw.sound); togglesound.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (togglesound.isChecked()) { mp.start(); } else { mp.pause(); } } }); //Two random integers adding up to the sum of 10 int min = 1; int max = 10; Random randomint = new Random(); int randomint1 = randomint.nextInt(max - min +1) + min; int randomint2 = 10 - randomint1; //Displays random problem in textview TextView displayrandomproblem = (TextView) findViewById(R.id.tvrandomproblem); displayrandomproblem.setText(randomint1 + " + " + randomint2 + " = "); //Fetches user answer and converts it to an integer EditText answer = (EditText)findViewById(R.id.editanswer); { if (answer.getText().toString().length() &gt; 0){ int answerInt = Integer.parseInt(answer.getText().toString()); } //Displaying a toast if no answer is provided else { Toast.makeText(getApplicationContext(), "Please enter your solution to the math problem!", Toast.LENGTH_SHORT).show(); } } //…
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/23493663
has comment: http://stackoverflow.com/comment/36026319

http://stackoverflow.com/comment/36256513
type: AnswerComment
type: Comment
score: 1
has text: Thank you for that :P. I was not even considering the possibility that an input array would turn out to be of size zero. But I realize now there's a small chance it is, given a particular input in the outer method.
comment on: http://stackoverflow.com/a/23607836

http://stackoverflow.com/comment/36056722
type: QuestionComment
comment on: http://stackoverflow.com/q/23509500
has text: I think that is an awful lot of code you are asking us to trawl through. Maybe try cutting it down to the init sections and input sections.
score: 1
type: Comment

http://stackoverflow.com/comment/36021801
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23487558
type: QuestionComment
has text: It hangs on read(buf) if the size of buf is more than the number of bytes that can be read. If your client sends 10 bytes then the server should not try to read 15 bytes from the stream. If the server does it will timeout if the client stays connected. If the client closes the connection right after 10 bytes sent then the server will immediately get the 10 bytes even if he asks 15 to read.

http://stackoverflow.com/comment/35987205
type: Comment
comment on: http://stackoverflow.com/a/23462561
type: AnswerComment
has text: I have been recently working with an app that was using audiorecord so I had to try to understand it as well as I could. Am I experienced with it? Who knows...?:D AudioRecord still gets kinda annoying for me sometimes:P. You can ask me if you have some serious blockers. If I have time for it, I will try to answer but I can't promise anything.
score: 0

http://stackoverflow.com/comment/35985598
type: QuestionComment
has text: So, it fails only with Chrome Driver?
score: 0
comment on: http://stackoverflow.com/q/23471340
type: Comment

http://stackoverflow.com/a/23657571
answers question: http://stackoverflow.com/q/23527679
has comment: http://stackoverflow.com/comment/58504055
has body: As the Javadoc says, Platform.exit() terminates the JavaFX Application Thread. http://docs.oracle.com/javase/8/javafx/api/javafx/application/Platform.html#exit-- Best is not to call Platform.exit() until you really want to shutdown JavaFX. After shutting JavaFX down you would have to restart it using the Application.launch() method. Better would be just to close the window, I guess. Note that with Platform.setImplicitExit(false); you can prevent JavaFX from shutting down even if all windows are closed.
downvote count: 0
has comment: http://stackoverflow.com/comment/36337840
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/36337535
score: 6

http://stackoverflow.com/comment/36253219
type: Comment
has text: Means that the class LoginDataBase has a constructor diferent than " = new LoginDataBase (this, "NAMEOFDATABASE", null, 1)" or does not have anyone. Make both have the same fields. P.D. Post LoginDataBase constructor
comment on: http://stackoverflow.com/a/23614257
type: AnswerComment
score: 0

http://stackoverflow.com/a/23479201
type: Answer
has comment: http://stackoverflow.com/comment/36013030
score: 0
answers question: http://stackoverflow.com/q/23478611
has body: There is no way you can get console output. You have to do everything before printing To Write our to a file do this. try{ FileWriter x = new FileWriter(new File("x.txt")); x.write("hello"); }catch(IOExecption e){ } That will write out hello to a file
has comment: http://stackoverflow.com/comment/36000856

http://stackoverflow.com/comment/35964543
score: 0
comment on: http://stackoverflow.com/q/23460024
type: Comment
type: QuestionComment
has text: Can any application, like an Internet browser, draw on the top 20 pixels of your display?

http://stackoverflow.com/comment/99536748
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/30591380
has text: `String` is not a container for binary data. You should have used a `byte[]`.
score: 0

http://stackoverflow.com/q/23508043
tagged with: uuid
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10950202
has comment: http://stackoverflow.com/comment/36100577
type: Question
linked to: http://stackoverflow.com/q/23532492
tagged with: java
tagged with: hibernate
tagged with: mysql
has title: UUID without slashes + Hibernate + MySQL
has comment: http://stackoverflow.com/comment/36054154
tagged with: jpa
score: 0
has body: I save UUID without slashes as varbinary(16) in MySql. I will like to use annotation to map this field in Hibernate. Am I able to do it? Please help. Here is my mapping: @Id @GeneratedValue(generator = "uuid") @GenericGenerator(name = "uuid", strategy = "uuid2") @Column(name = "PRODUCT_ID", unique = true) private String productId; Here is my insert: INSERT INTO `item` (`ID`, `TITLE`) VALUES ( UNHEX('f4e01440cfd011e39c1a0800200c9a66'), 'Apple' ); But id become something like ��%14@��%11��%1A%08%00 %0C�f in my code.

http://stackoverflow.com/comment/35994893
type: QuestionComment
has text: sorry forgot to post it..
comment on: http://stackoverflow.com/q/23476523
score: 0
type: Comment

http://stackoverflow.com/comment/36212550
has text: ...Is there anyway to do this without the implement?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23592859

http://stackoverflow.com/comment/36202397
comment on: http://stackoverflow.com/q/23587378
has text: @hexafraction, for the same reason I just mentioned to @RobertHarvey, I need to feed the values to a `JTable` renderer which needs to differentiate between percentages and dollar amounts for display purposes. So, is there an easy way to achieve that with encapsulation?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36128110
has text: @JigarJoshi Right.. but `new String()` won't help you much.
score: 0
comment on: http://stackoverflow.com/q/23547684
type: QuestionComment
type: Comment

performance
tags question: http://stackoverflow.com/q/23584712
tags question: http://stackoverflow.com/q/23530891
tags question: http://stackoverflow.com/q/23527252
tags question: http://stackoverflow.com/q/23550288
tags question: http://stackoverflow.com/q/23614847
tags question: http://stackoverflow.com/q/23495050
tags question: http://stackoverflow.com/q/23578190
tags question: http://stackoverflow.com/q/23573937
tags question: http://stackoverflow.com/q/23540287
tags question: http://stackoverflow.com/q/23538536
tags question: http://stackoverflow.com/q/23495326
tags question: http://stackoverflow.com/q/23604558
tags question: http://stackoverflow.com/q/23523407
tags question: http://stackoverflow.com/q/23491667
tags question: http://stackoverflow.com/q/23456752
tags question: http://stackoverflow.com/q/23509560
tags question: http://stackoverflow.com/q/23562029
tag name: performance
tags question: http://stackoverflow.com/q/23552134
tags question: http://stackoverflow.com/q/23602738
type: Tag
tags question: http://stackoverflow.com/q/23506651
tags question: http://stackoverflow.com/q/23544321
tags question: http://stackoverflow.com/q/23462075
tags question: http://stackoverflow.com/q/23485022

http://stackoverflow.com/q/23603227
upvote count: 1
accepted answer: http://stackoverflow.com/a/23603452
type: Question
has comment: http://stackoverflow.com/comment/36231957
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23603559
has answer: http://stackoverflow.com/a/23603559
answer count: 2
downvote count: 0
tagged with: sip
tagged with: voip
favorite count: 0
has answer: http://stackoverflow.com/a/23603452
tagged with: android
has title: When I return back to 1st Activity the onCreate() function of 2nd Activity is not called in 2nd time
has body: I have Two Activities Dial pad and phone. In dial Pad activity there is a edit box and buttons to dial the number and In the phone activity there are 5 lines to call.when u select the line 1 the dial activity is open and so on.The problem im facing is First time when i select any line from phone activity the onCreate function of dial activity is cal and when I return back to the phone activity and select other line the onCreate() function of the dial activity is not called. The onStart() function of the dial activity is cal and i want to cal the onCreate() function.plz help me to solve this problem. public class DialPad extends Activity { private TextView m_objStatus; private Button m_objBtnDial; int m_nLineNo = -1; boolean m_objContactFlag; public static Phone m_objPhone; private static String[] m_objPhoneNum = new String[VaxSIPUserAgent.TOTAL_LINE_COUNT]; public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); Phone.m_objDialPad = this; Intent intent = getIntent(); int nIntentExtraLineNo = intent.getIntExtra("LineNo", 1); m_nLineNo = nIntentExtraLineNo; final int [] aLineArray = new int[VaxSIPUserAgent.TOTAL_LINE_COUNT - 1]; int nIndex = 0; for (int nLineNo = 0; nLineNo &lt; VaxSIPUserAgent.TOTAL_LINE_COUNT; nLineNo++) { if(m_nLineNo == nLineNo) continue; aLineArray[nIndex] = nLineNo + 1; nIndex++; } String sLineStatus = VaxStatus.m_objVaxStatus.GetLineStatus(m_nLineNo); OnStatusPhone(sLineStatus); String sPhoneNo = intent.getStringExtra("PhoneNo"); if(sPhoneNo != null) { m_objPhoneNum[nIntentExtraLineNo] = sPhoneNo; } m_objEditDialscreen.setText(m_objPhoneNum[nIntentExtraLineNo]); } @Override protected void onStart() { UpdateDialBtn(); if(m_objContactFlag == false) m_objEditDialscreen.setText(m_objPhoneNum[m_nLineNo]); IncommingCallSlider.m_objCallSlider.SetActiveActivity(this, R.id.dialpad); IncommingCallRing.m_objIncommingCallRing.SetActiveActivity(this); DialCallTone.m_objDialCallTone.SetActiveAc…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36231974

http://stackoverflow.com/a/23490727
score: -1
answers question: http://stackoverflow.com/q/23490583
upvote count: 0
has comment: http://stackoverflow.com/comment/36021861
type: Answer
has body: You only need Context to create what you need in body of all of your methods. Extract the same comde in one method that takes Context as argument so you can call this method as many times as you need. public static boolean createMenu(Context context, Menu menu) { // Here is your code that use context } public static boolean whateverMethodYouWant(WhatEverClass smth, Menu menu) { // Get/cast or smth else to get Context from smth. Context context = castOrExtractContext(smth); return createMenu(context, menu); } In this case it's error free code, because you handle all stuff about WhatEverClass that user passes to you and he have no idea about what you perform inside your method.
downvote count: 1

http://stackoverflow.com/a/23534419
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36104867
has comment: http://stackoverflow.com/comment/36105595
has body: I assume you use StyledEditorKit. terminalArea.setText(dataToShow.toString()); The code just erases all you have and readd the text to the document. In fact in the document remove(0, docLength) is called and then insertString(theToStringResult) replaces all the styled. I would recomment to create a new Document instance, insert all the texts with styled using insertString() where you can pass your attributes (or call insertString() just once and the call multiple times setCharacterAttributes()). After the Document instance is ready just call terminalArea.setDocument(theDocumentInstance); rather than setText();
upvote count: 2
has comment: http://stackoverflow.com/comment/36109637
answers question: http://stackoverflow.com/q/23534184
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36110636
accepted answer of: http://stackoverflow.com/q/23534184
has comment: http://stackoverflow.com/comment/36109984
has comment: http://stackoverflow.com/comment/36104730
type: Answer

http://stackoverflow.com/q/23472830
has title: java CallableStatement print all parameters in procedure
has answer: http://stackoverflow.com/a/23472945
linked to: http://stackoverflow.com/q/4657349
type: UnansweredQuestion
has body: CallableStatement stmt = getSession().connection().prepareCall( "{call CRM_DAO.Search_Customers(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}"); setString(1, filter.getFirstname(), stmt); .... stmt.execute(); Can I somehow see all input parameters that I can execute this procedure in SQL and not manually check all partameters? I want to get back something like: call CRM_DAO.Search_Customers(1, 3, 'test',..
has comment: http://stackoverflow.com/comment/35988086
tagged with: java
has comment: http://stackoverflow.com/comment/35989660
has comment: http://stackoverflow.com/comment/35988125
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23472947
tagged with: jdbc

tomcat
tags question: http://stackoverflow.com/q/23534314
tags question: http://stackoverflow.com/q/23468645
tags question: http://stackoverflow.com/q/23496479
tags question: http://stackoverflow.com/q/23547543
tags question: http://stackoverflow.com/q/23503357
tags question: http://stackoverflow.com/q/23455198
tags question: http://stackoverflow.com/q/23553413
tags question: http://stackoverflow.com/q/23480328
tags question: http://stackoverflow.com/q/23493893
tags question: http://stackoverflow.com/q/23524949
tags question: http://stackoverflow.com/q/23460832
tags question: http://stackoverflow.com/q/23469193
tags question: http://stackoverflow.com/q/23497296
tags question: http://stackoverflow.com/q/23552134
tags question: http://stackoverflow.com/q/23534428
tags question: http://stackoverflow.com/q/23545305
tags question: http://stackoverflow.com/q/23557124
tags question: http://stackoverflow.com/q/23579028
tags question: http://stackoverflow.com/q/23484260
tags question: http://stackoverflow.com/q/23504765
tags question: http://stackoverflow.com/q/23602332
tags question: http://stackoverflow.com/q/23468653
tags question: http://stackoverflow.com/q/23462309
tags question: http://stackoverflow.com/q/23592340
tags question: http://stackoverflow.com/q/23454672
tags question: http://stackoverflow.com/q/23579258
tags question: http://stackoverflow.com/q/23590726
tags question: http://stackoverflow.com/q/23484911
tags question: http://stackoverflow.com/q/23477770
tags question: http://stackoverflow.com/q/23497566
tag name: tomcat
tags question: http://stackoverflow.com/q/23538066
tags question: http://stackoverflow.com/q/23610979
tags question: http://stackoverflow.com/q/23532073
tags question: http://stackoverflow.com/q/23507602
tags question: http://stackoverflow.com/q/23580509
tags question: http://stackoverflow.com/q/23579091
tags question: http://stackoverflow.com/q/23597776
tags question: http://stackoverflow.com/q/23545434
tags question: http://stackoverflow.com/q/23572460
tags question: http://stackoverflow.com/q/23499180
tags question: http://stackoverflow.com/q/23482290
tags question: http://stackoverflow.com/q/23561352
tags question: http://stackoverflow.com/q/23531713
tags question: http://stackoverflow.com/q/23605081
tags question: http://stackoverflow.com/q/23458051
tags question: http://stackoverflow.com/q/23584443
tags question: http://stackoverflow.com/q/23465637
tags question: http://stackoverflow.com/q/23559150
tags question: http://stackoverflow.com/q/23591752
tags question: http://stackoverflow.com/q/23491676
tags question: http://stackoverflow.com/q/23520459
tags question: http://stackoverflow.com/q/23515489
tags question: http://stackoverflow.com/q/23457963
tags question: http://stackoverflow.com/q/23609227
type: Tag
tags question: http://stackoverflow.com/q/23541532
tags question: http://stackoverflow.com/q/23481809
tags question: http://stackoverflow.com/q/23553046
tags question: http://stackoverflow.com/q/23472471
tags question: http://stackoverflow.com/q/23456295
tags question: http://stackoverflow.com/q/23574270
tags question: http://stackoverflow.com/q/23500822
tags question: http://stackoverflow.com/q/23549889
tags question: http://stackoverflow.com/q/23588678
tags question: http://stackoverflow.com/q/23571870
tags question: http://stackoverflow.com/q/23607919
tags question: http://stackoverflow.com/q/23520931
tags question: http://stackoverflow.com/q/23530654
tags question: http://stackoverflow.com/q/23482577
tags question: http://stackoverflow.com/q/23525512
tags question: http://stackoverflow.com/q/23487672
tags question: http://stackoverflow.com/q/23587875

http://stackoverflow.com/a/23537113
accepted answer of: http://stackoverflow.com/q/23536643
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/36111123
upvote count: 3
answers question: http://stackoverflow.com/q/23536643
has body: Jacoco is a coverage tool. It checks if every possible branch of the code has been covered. It doesn't complain that there is no else statement. What it complains about is that you've never executed the code with randomField being null. Maybe the rest of the code will break if randomField is null. Your tests aren't testing this possibility, and that's what jacoco is warning you about. Here's an example: String foo = null; if(randomfield != null) { foo = randomField; } System.out.println(foo.toLowerCase()); If you test the code with randomField being "hello", everything will go fine. But if randomField is null, then this will cause an undesired NullPointerException. That's a bug that would be detected by testing the code with a null randomField. Since you didn't do that, jacoco is complaining.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36108875

hashmap
tags question: http://stackoverflow.com/q/23554240
tags question: http://stackoverflow.com/q/23542117
tags question: http://stackoverflow.com/q/23561879
tags question: http://stackoverflow.com/q/23497337
tags question: http://stackoverflow.com/q/23488641
tags question: http://stackoverflow.com/q/23524773
tags question: http://stackoverflow.com/q/23583348
tags question: http://stackoverflow.com/q/23473567
tags question: http://stackoverflow.com/q/23586363
tags question: http://stackoverflow.com/q/23563343
tags question: http://stackoverflow.com/q/23573429
type: Tag
tags question: http://stackoverflow.com/q/23518887
tags question: http://stackoverflow.com/q/23471451
tags question: http://stackoverflow.com/q/23479446
tags question: http://stackoverflow.com/q/23469111
tags question: http://stackoverflow.com/q/23540722
tags question: http://stackoverflow.com/q/23551227
tags question: http://stackoverflow.com/q/23476052
tags question: http://stackoverflow.com/q/23610375
tags question: http://stackoverflow.com/q/23562308
tags question: http://stackoverflow.com/q/23594080
tags question: http://stackoverflow.com/q/23602304
tags question: http://stackoverflow.com/q/23471498
tags question: http://stackoverflow.com/q/23527163
tags question: http://stackoverflow.com/q/23468605
tags question: http://stackoverflow.com/q/23494959
tag name: hashmap
tags question: http://stackoverflow.com/q/23524178
tags question: http://stackoverflow.com/q/23583946
tags question: http://stackoverflow.com/q/23546426
tags question: http://stackoverflow.com/q/23497766
tags question: http://stackoverflow.com/q/23589020

dkpro-core
tag name: dkpro-core
tags question: http://stackoverflow.com/q/23504261
type: Tag

http://stackoverflow.com/comment/36127812
comment on: http://stackoverflow.com/a/23534920
has text: I'm unsure how the `data`in the model is updated though. As in I have to pass in the nested list in the creation of the object, but when I add more data to the database how would I update that list?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35998178
type: QuestionComment
comment on: http://stackoverflow.com/q/23478096
type: Comment
has text: That piece of code is constant (`O(1)`) because its execution time does not depend on the size of the input, however that is probably inside some amount of loops, looking at those will tell you the actual complexity.
score: 0

http://stackoverflow.com/comment/36092698
type: AnswerComment
comment on: http://stackoverflow.com/a/23527322
has text: I agree it certainly isnt as convenient. But for the majority of keywords that are most commonly used, once you read what they mean and use them a couple times, you probably will never forget what they mean or have to look them up again :). For example, I have never heard of "strictfp", and have no need to bother looking it up, because I have never encountered it.
type: Comment
score: 0

http://stackoverflow.com/a/23517281
score: 0
has body: Add null checks or it will go in infinite loop if(leftNode != null) isBinaryBST(leftNode) ; if(rightNode != null) isBinaryBST(rightNode) ; boolean leftIsOk = true; boolean rightIsOk = true; if(leftNode != null) leftIsOk = isLeftOK(leftNode , value); ; if(rightNode != null) rightIsOk = isRightOK(rightNode, value); return (leftIsOk &amp;&amp; rightIsOk);
type: Answer
answers question: http://stackoverflow.com/q/23517186
has comment: http://stackoverflow.com/comment/36070673

http://stackoverflow.com/comment/36226715
has text: Can you post the code you're using and the platform you're running on? I was able to set the value above and then get it back via a ValueEventListener using the latest Java client and Java 1.7 on OS X.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23592844
score: 0

http://stackoverflow.com/a/23593992
type: Answer
has body: The back button will change to the last activity. If the activity is finished, Android will create it again(I'm not very sure).So I think you can rewrite the back button.
answers question: http://stackoverflow.com/q/23593775
score: 0

http://stackoverflow.com/q/23477743
favorite count: 0
tagged with: web.xml
has body: What is the difference between these url mappings ? /servlet and /servlet/* and /* and *.do
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35998279
type: Question
linked to: http://stackoverflow.com/q/4377541
has title: What is the difference between these url mapping patterns?
tagged with: url-pattern
upvote count: 2
possible better answer: http://stackoverflow.com/a/23478807
answer count: 2
has answer: http://stackoverflow.com/a/23479115
accepted answer: http://stackoverflow.com/a/23479115
has answer: http://stackoverflow.com/a/23478807

http://stackoverflow.com/comment/36072279
has text: write the code in java script function as follows window.location.href = "/xxx.jsp";
comment on: http://stackoverflow.com/a/23518090
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23534146
has body: The question is how did you fill the combo box to begin with? I'm assuming the combo box isn't filled with integers. If you want to select by an offset you need to invoke setSelectedIndex not setSelectedItem.
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/36123420
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23528576
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23528576

http://stackoverflow.com/comment/36053916
type: Comment
type: QuestionComment
has text: it still not work after change to this.getApplicationContext().I have pasted logCat:
score: 0
comment on: http://stackoverflow.com/q/23499155

http://stackoverflow.com/comment/36241015
score: 1
type: Comment
type: QuestionComment
has text: this might help you http://stackoverflow.com/questions/14655014/jsp-error-contains-invalid-expression-failed-to-parse-the-expression
comment on: http://stackoverflow.com/q/23607919

http://stackoverflow.com/comment/35976714
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23459568
has text: @AndrewEisenberg I'm using Kepler SR 1, which I believe, is v4.3.1. I filed a bug report with the Eclipse team: https://bugs.eclipse.org/bugs/show_bug.cgi?id=434065. There was a related bug (referenced there), which will be fixed in 4.4. Not sure if this fix will also address the issue here.

http://stackoverflow.com/comment/36331053
score: 1
type: Comment
comment on: http://stackoverflow.com/a/23615646
has text: An important thing to note here is that `Collections.emptyList()` is an immutable empty list, hence it cannot be used as a replacement for the method the OP had.
type: AnswerComment

http://stackoverflow.com/a/23600124
type: Answer
has comment: http://stackoverflow.com/comment/36226372
has comment: http://stackoverflow.com/comment/36226453
downvote count: 0
has comment: http://stackoverflow.com/comment/36226276
accepted answer of: http://stackoverflow.com/q/23600044
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36226329
answers question: http://stackoverflow.com/q/23600044
score: 8
has comment: http://stackoverflow.com/comment/36226326
upvote count: 8
has body: You have the wrong antlr in your project. The one you need is this. I hope it helps :) antlr antlr 2.7.7 I also see that you are using a older version of hibernate. Latest one available is org.hibernate hibernate-core 4.3.5.Final Download latest hibernate jars

http://stackoverflow.com/comment/108319200
type: AnswerComment
has text: Oops, sorry, misread the question... my mistake. I deleted my comment.
type: Comment
comment on: http://stackoverflow.com/a/23605733
score: 0

http://stackoverflow.com/q/23509988
has comment: http://stackoverflow.com/comment/36058887
has title: HTTP Status 500 - Unable to compile class for JSP - Tomcat 7 - JDK and JRE - Ubuntu 14
upvote count: 1
has comment: http://stackoverflow.com/comment/36058701
has comment: http://stackoverflow.com/comment/36058983
favorite count: 0
type: UnansweredQuestion
tagged with: tomcat7
has comment: http://stackoverflow.com/comment/36057637
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36059962
type: Question
tagged with: jsp
has body: I am trying to run some code on Tomcat 7 on Ubuntu Server 14.04 - 64 bit (setup at the bottom). When I try and load the page or refresh I get either error: HTTP Status 500 - java.lang.ClassNotFoundException: org.apache.jsp.William2.web.deals_jsp Or HTTP Status 500 - Unable to compile class for JSP: I put the code on this virtual machine for you to see the error :) http://128.199.226.137:8080/William2/web/index.jsp I have installed tomcat using: sudo apt-get install Tomcat 7 JDK and JRE installed via : sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer Here is my code: &lt;%@page import="org.json.simple.JSONValue"%&gt; &lt;%@page import="org.json.JSONObject"%&gt; &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import="org.json.JSONArray,org.json.JSONException"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;%@page import="org.json.JSONArray"%&gt; &lt;%@ page language="java" %&gt; &lt;%@page import="java.util.StringTokenizer"%&gt; &lt;%@page import="java.io.FileReader"%&gt; &lt;%@page import="java.io.InputStreamReader"%&gt; &lt;%@page import="java.io.BufferedReader"%&gt; &lt;%@page import="java.io.File"%&gt; &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;meta charset="utf-8"&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;meta name="description" content=""&gt; &lt;meta name="author" content=""&gt; &lt;link rel="shortcut icon" href="http://getbootstrap.com/assets/ico/favicon.ico"&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Daily Deals&lt;/title&gt; &lt;!-- Bootstrap core CSS --&gt; &lt;link href="css/core.css" rel="stylesheet"&gt; &lt;!-- Custom styles for this t…
tagged with: ubuntu

http://stackoverflow.com/q/23539628
linked to: http://stackoverflow.com/q/6086079
has body: I need help in converting an If-case into a switch statement and I'm working on enums. An example of my enum is as below : private enum FruitsType{ Apple("Apple"), Orange("Orange"), Mango("Mango"); } And my method which contains If and Else-if Statements is as follows : private String getFruitsPrefMsg() { String message = getMessage(); if (message == null) { message = getOtherMessage(); } if(FruitsType.Apple.toString()) { //return something; } else if(FruitsType.Orange.toString()) { // return something; } else if(FruitsType.Mango.toString()) { // return something; } } Not considering the logic in the code as this is just an example of my code, Can someone please help me to convert this aforementioned if and else-if statements(including the check for null) into a simple switch case, I would need the most simplest code possible using swtich. I want to use switch here as this is the criteria and I have to use switch statement.
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23540223
has comment: http://stackoverflow.com/comment/36112948
has answer: http://stackoverflow.com/a/23540223
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36112942
downvote count: 9
tagged with: java
has title: Convert Java If-case to Switch
score: -9

http://stackoverflow.com/a/23567964
score: 1
downvote count: 0
type: Answer
has body: This line here indicates that you are overloading the node such that it is running our of java heap space: INFO [ScheduledTasks:1] 2014-05-09 15:02:06,068 GCInspector.java:116 - GC for ConcurrentMarkSweep: 21284 ms for 1 collections, 4226524688 used; max is 4242538496 You probably need to tune back some of the caches or memtables or something. If you take a heap dump you could figure out what is using all the memory.
upvote count: 1
answers question: http://stackoverflow.com/q/23560723

http://stackoverflow.com/q/23607524
tagged with: wso2
answer count: 0
tagged with: java
has title: How to send variable attribute Ids in XACML 3.0 Policy
type: Question
downvote count: 0
has body: I am creating a Policy in WSO2 Identity Server using WSO2 Management Console "Basic Policy Editor". I want to declare "resource-id" attribute as variable instead of a value. May I know how to declare that in "Basic Policy Editor " of WSO2 IS ?
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: wso2-identity-server

http://stackoverflow.com/q/23517075
upvote count: 1
has title: spring framework stuck on debug log level
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23521383
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36082424
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/21739578
accepted answer: http://stackoverflow.com/a/23521383
has comment: http://stackoverflow.com/comment/36072015
answer count: 1
has body: I'm trying to configure spring framework logging level via log4j.xml. My file looks like this: <?xml version="1.0" encoding="UTF-8" ?> <!-- <appender-ref ref="EMAIL_ASYNC" /> --> <appender-ref ref="CONSOLE"/> However, spring is logging debug info all over, here is a sample of catalina.out: 15:46:03.535 [http-bio-8080-exec-3] DEBUG o.s.s.w.u.m.AntPathRequestMatcher - Checking match of request : '/oauth/token'; against '/oauth/cache_approvals' 15:46:03.536 [http-bio-8080-exec-3] DEBUG o.s.s.w.u.m.AntPathRequestMatcher - Checking match of request : '/oauth/token'; against '/oauth/uncache_approvals' 15:46:03.536 [http-bio-8080-exec-3] DEBUG o.s.s.w.u.m.AntPathRequestMatcher - Checking match of request : '/oauth/token'; against '/oauth/token' 15:46:03.536 [http-bio-8080-exec-3] DEBUG o.s.security.web.FilterChainProxy - /oauth/token?grant_type=password&client_id=my-trusted-client-with-secret&client_secret=somesecret&username=seema&password=jrd@123456 at position 1 of 7 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter' Please note that i'm not that much of a spring expert so it might be something as simple as some missing dependencies in maven (slf4j or something). What i'm sure of is that log4j.xml is in the correct location and that it gets loaded from spring. EDIT: I added the debug flags as suggested by stephane and here is the output: delegate: false^M repositories:^M /WEB-INF/classes/^M ----------> Parent Classloader:^M org.apache.catalina.loader.StandardClassLoader@69fc49ef^M . log4j: Using URL [file:/var/lib/tomcat7/webapps/propspace-api/WEB-INF/classes/log4j.xml] for automatic log4j configuration. log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator log4j: System property is :null log4j: Standard DocumentBuilderFactory search succeded. log4j: DocumentBuilderFactory is: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl log4j: debug attribute= "null". log4j: Ignoring debug attribute. log4j: reset attr…
tagged with: log4j
favorite count: 0

http://stackoverflow.com/q/23565517
linked to: http://stackoverflow.com/q/2697783
has comment: http://stackoverflow.com/comment/36161780
has body: I have a controller that works, but I do not understand why it works. Here it is: @Controller @RequestMapping("/someUrl") public class MyController { @Autowired private SomeService someService; @RequestMapping(method = RequestMethod.GET) public String page() throws ApplicationException { return "page"; } @ModelAttribute("modelAttribute") public PageModel loadPageModel() throws ApplicationException { return someService.createPageModel(); } } Visiting "/someUrl" will get me to the view of the name "page", as it is expected. What is puzzling, is that despite the model attribute "modelAttribute", or an object of type "PageModel" is not referenced anywhere near the method page, the modelAttribute is still visible for the view. I am happy that this works, but I do not understand why. Any thoughts?
tagged with: spring
has answer: http://stackoverflow.com/a/23574209
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36161316
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23574209
has title: How is a @ModelAttribute injected without any explicit reference
type: Question
has answer: http://stackoverflow.com/a/23572131
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/23565995
has answer: http://stackoverflow.com/a/23565995

http://stackoverflow.com/comment/35953952
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23454418
has text: I am able to see the R file but problem is with mainactivity file@gahfy
type: Comment

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

http://stackoverflow.com/comment/36188139
type: Comment
type: AnswerComment
has text: Good job on clearing the errors.. Choose an answer that solved your problems or create your own answer and accept it...
comment on: http://stackoverflow.com/a/23566730
score: 0

http://stackoverflow.com/comment/36147055
type: QuestionComment
has text: Why can't you use `for (int i = 0; i < 5; i++)`?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23557842

http://stackoverflow.com/q/23506508
type: Question
has body: I'm trying to search old invoice data from invoice table. And when I search the invoices issued to same customer I want to set same color to the purchased item in same invoice ID. This is something I took from internet. As an example if I purchased 3 different item from same invoice ID I want to color red (or any color I'm suggesting) those rows in jtable. And one customer usually can buy items in at least 50 different invoices. So there are 50 different invoice IDs. So I'm hoping color should change in a mathematical order. I have searched internet related to this problem. Since I'm new to java I couldn't understand about it very well. new Upload
has comment: http://stackoverflow.com/comment/36051537
tagged with: jtable
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23507294
has answer: http://stackoverflow.com/a/23506825
tagged with: netbeans
tagged with: java
tagged with: mysql
tagged with: swing
has title: How to set same colors in jtable and set different colors to different result in java

http://stackoverflow.com/q/23504719
has answer: http://stackoverflow.com/a/23505732
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/88945013
tagged with: java
possible better answer: http://stackoverflow.com/a/23505732
has title: Simple JSP - Attribute invalid for tag according to TLD
upvote count: 2
answer count: 2
tagged with: jsp
has body: My project in eclipse - I get the error below when I run MyTagUser.jsp - HTTP Status 500 - /jsp/MyTagUser.jsp(14,0) Attribute subTitle invalid for tag Header according to TLD org.apache.jasper.JasperException: /jsp/MyTagUser.jsp(14,0) Attribute subTitle invalid for tag Header according to TLD org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)...etc. Snippet from Header.jsp - ${subTitle} Snippet from MyTagUser.jsp - <%@ taglib prefix="myTags" tagdir="/WEB-INF/tags"%> <myTags:Header subTitle="Java is the best !!!" /> JSP and Servlets.
favorite count: 0
has answer: http://stackoverflow.com/a/23506636
accepted answer: http://stackoverflow.com/a/23506636
score: 2
downvote count: 0
tagged with: jsp-tags
type: Question
tagged with: jakarta-ee

rms
tag name: rms
type: Tag
tags question: http://stackoverflow.com/q/23538145

http://stackoverflow.com/q/23484146
has title: iOS Packaging Error with Adobe Air 4.0 & FlashBuilder
tagged with: air
tagged with: osx-mavericks
tagged with: ios
has comment: http://stackoverflow.com/comment/36037739
has comment: http://stackoverflow.com/comment/36042110
score: 0
has comment: http://stackoverflow.com/comment/36048556
has body: I am trying to package an IOS Build using Air 4.0. I am currently running OSX 10.9.2. Any help would be greatly appreciated. Here is the Error: Error occurred while packaging the application: java.lang.Exception: ld: library not found for -lcrt1.o Compilation failed while executing : ld64 at com.adobe.flexide.multiplatform.ios.launching.IOSLaunchHandler.doPackage(IOSLaunchHandler .java:704) at com.adobe.flexide.multiplatform.ios.launching.IOSLaunchHandler.launch(IOSLaunchHandler.ja va:255) at com.adobe.flexide.launching.multiplatform.MultiPlatformLaunchDelegate.launch(MultiPlatfor mLaunchDelegate.java:184) at com.adobe.flexide.launching.AbstractFlexLaunchDelegate.launch(AbstractFlexLaunchDelegate. java:244) at com.adobe.flexide.launching.AbstractFlexLaunchDelegate.launch(AbstractFlexLaunchDelegate. java:134) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703) at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:928) at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1132) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) eclipse.buildId=M20110909-1335 java.version=1.6.0_65 java.vendor=Apple Inc. BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US Framework arguments: -keyring /Users/dariustam/.eclipse_keyring -showlocation Command-line arguments: -os macosx -ws cocoa -arch x86_64 -keyring /Users/dariustam/.eclipse_keyring -consoleLog -showlocation
type: UnansweredQuestion
tagged with: adobe
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/35991584
comment on: http://stackoverflow.com/q/23474059
type: QuestionComment
type: Comment
has text: @ElliottFrisch right now it only find url's on home page let say "abc.com" but there are many links present under those url's. how to get those links? is there any method to do this?
score: 0

http://stackoverflow.com/comment/36124994
score: 0
comment on: http://stackoverflow.com/q/23540869
type: Comment
type: QuestionComment
has text: you need to put string not simpletype

http://stackoverflow.com/comment/36414022
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23521871
has text: @marcin.kosiba,@CommonsWare: My main motive of calling Java methods from Javascript is to retrieve some values needed in the app during runtime(I can't store them in the device for some privacy issues). I have come across some approaches like: webView.loadUrl("javascript:console.log(functionThatReturnsSomething)"); webView.loadUrl("javascript:alert(functionThatReturnsSomething)"); And then using onJsAlert() or onConsoleMessage() webchromeclient methods to retrieve them. Are these approaches okay to handle security issues ?
type: AnswerComment

http://stackoverflow.com/a/23467834
accepted answer of: http://stackoverflow.com/q/23467658
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35979285
score: 0
has comment: http://stackoverflow.com/comment/35980103
type: Answer
has comment: http://stackoverflow.com/comment/35978979
answers question: http://stackoverflow.com/q/23467658
has body: Why there is the need for a client.policy file? The only time a client needs a .policy file is if it is running under a SecurityManager, and the only time it needs to do that in RMI is if you are using the RMI codebase feature to download class files to the client. It has nothing to do with access control by the server.

http://stackoverflow.com/a/23574199
answers question: http://stackoverflow.com/q/23573020
has comment: http://stackoverflow.com/comment/36209701
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36218279
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36218622
has body: Maybe try getting a new AudioInputStream every time before getting a Clip, in the beginning of your play() method? Meaning try to add this line in the beginning of the method: audio = AudioSystem.getAudioInputStream(new File(PATH).getAbsoluteFile());
has comment: http://stackoverflow.com/comment/36204830

http://stackoverflow.com/q/23576523
downvote count: 3
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
score: -2
has comment: http://stackoverflow.com/comment/36182473
has answer: http://stackoverflow.com/a/23576560
answer count: 1
has comment: http://stackoverflow.com/comment/36182485
favorite count: 0
type: UnansweredQuestion
has body: I have the following code- if (aa[0].equals("add")) { if (aa[1].equals("s")&amp;aa[3].equals("s")) { A= Double.parseDouble (UISAVE[Integer.parseInt(aa[2])]); B= Double.parseDouble (UISAVE[Integer.parseInt(aa[4])]); } if (aa[1].equals("s")&amp;!aa[3].equals("s")) { A= Double.parseDouble (UISAVE[Integer.parseInt(aa[2])]); if (aa[3].equals(null)) { aa[3]="0"; } B= Double.parseDouble (aa[3]); } if (!aa[1].equals("s")) { A= Double.parseDouble (aa[2]); B= Double.parseDouble (aa[3]); } out[count]=Double.toString(A+B); read(in, out, UISAVE); } and I get this error - Exception in thread "main" java.lang.NullPointerException at CMDL.shizzle.april2014.Write.read(Write.java:25) Now, as it says the error is apparently an if statement... if (aa[1].equals("s"(&amp;aa[3].equals("s")) { and I've tried most of what I can do and haven't found a solution yet. Thanks if you can help.
has title: NullPointerException error during if statement
tagged with: java

http://stackoverflow.com/comment/36210952
has text: Multipart request handling needs to be properly configured. Check Spring and / or Servlet API documentation on that topic. http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-multipart
comment on: http://stackoverflow.com/q/23592157
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36202343
type: QuestionComment
has text: Thanks @RobertRowntree (+1) - however, you are thinking of just the *client-side*. I'm talking about the server-side.
score: 0
comment on: http://stackoverflow.com/q/23579040
type: Comment

http://stackoverflow.com/a/23712794
type: Answer
has body: Just for the console.log(data) problem, may be $.ajax() function get confused with response type, try this: Ajax $.ajax({ url: 'Main', data: form.serialize(), type: 'post', dataType:'text/plain', success: function(data){ console.log(data); } }); Servlet response.setContentType("text/plain;charset=UTF-8");
answers question: http://stackoverflow.com/q/23485916
score: 0

http://stackoverflow.com/a/23622402
score: 1
has body: That is correct. The type parameters will be ignored. My typical approach is to define an Enum for all the event types, that the subscriber methods can check for to filter out events they are interested in. Unfortunately since it can get cumbersome to enumerate all the event types, this of course doesn't scale very well.
accepted answer of: http://stackoverflow.com/q/23582474
has comment: http://stackoverflow.com/comment/36285707
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23582474

http://stackoverflow.com/comment/70088541
comment on: http://stackoverflow.com/a/23588147
type: AnswerComment
score: 0
has text: highly relevant
type: Comment

http://stackoverflow.com/comment/36353071
type: AnswerComment
comment on: http://stackoverflow.com/a/23543112
type: Comment
score: 0
has text: Hi Alexis, Every now and then this issue reappears with IE. I found that if I cut and past the url into IE or start it from the url drop down then it works. Chrome works but is really, really slow! Regards, Glyn.

http://stackoverflow.com/comment/134698700
has text: Wow 3 hours later, thats it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/55334003
type: Comment

http://stackoverflow.com/q/23594994
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23595245
has body: It’s my first try with Maven and Jersey. I have read quite a lot articles about JSON. I want to know if my problem is solvable without JSON simple and GSON. When I visit localhost:8080/helloWorld/example1/example2/example3, I get something like this {"first": example1, "second": example2, "third":example3} Which is nice for a start but I want to get a response like this: { "firstMap": {"first": example1, "second": example2}, "secondMap":{"third": example3} } I tried to make responseWrapper class, but it returns { "firstMap": {"first": example1, "second": example2, "third": null}, "secondMap":{"first": null, "second": null, "third": example3} }. I don't want these nulls to be displayed. How can I do it? import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("sample") public class HelloWorldService { @Path("/helloWorld/{first}/{second}/{third}") @GET @Produces(MediaType.APPLICATION_JSON) public HelloWorld helloWorld(@PathParam("first") String first, @PathParam("second") String second, @PathParam("third") String third) { return new HelloWorld(first, second, third); } } And also: public class HelloWorld { private String first; private String second; private String third; public HelloWorld(String first, String second) { this.first = first; this.second = second; } public HelloWorld(String third, String third) { this.third = third; } public HelloWorld(){ } public HelloWorld(String first) { this.first= first; } public String getFirst() { return first; } public String getSecond(){ return second; } public String getThird(){ return third;
has answer: http://stackoverflow.com/a/23595545
type: Question
answer count: 3
has title: Returning custom JSON with RESTful Jersey
score: 0
has answer: http://stackoverflow.com/a/23595699
accepted answer: http://stackoverflow.com/a/23595699
possible better answer: http://stackoverflow.com/a/23595545
type: AnsweredQuestion

http://stackoverflow.com/q/23516137
favorite count: 0
type: UnansweredQuestion
tagged with: installation
has comment: http://stackoverflow.com/comment/36068750
has title: Launch4j - Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/19917960
has answer: http://stackoverflow.com/a/23516553
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36068388
has body: I used launch4j (http://launch4j.sourceforge.net/) software to create an executable of my application created in java netbeans. I did everything as I saw in a tutorial, just that when I run the exectutavel it creates in my application, it gives this error: The message shown below is: Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingException at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more Does anyone can help me solve this problem please. I've been searching but I can not solve. I apologize for this question but am new to java. Thank you all. Greetings
has answer: http://stackoverflow.com/a/23516239

http://stackoverflow.com/q/23582753
tagged with: collections
has comment: http://stackoverflow.com/comment/36206651
has body: I have been trying to build a functionality which will enable me filter data in Java collections. The end goal is to have somethings as follow. SomeBuilder(Collections) .groupby("Key") .filter("Key","Value") .sum() .getResult() ; The functionality mostly resembles to sql world but not fully. My problem is how to filter collections likeList&lt;HashMap&lt;String,Object&gt;? How can I apply groupby logic on such collections ? A snippet of code showing filtering of such collection will help a lot. If Guava can do this please give an example. Edit:- I have added an answer for this question but please suggest better ways of doing it. Hope this help others. For doing Sum ,Avg ,Count will update as I go ahead with my project.
tagged with: guava
has comment: http://stackoverflow.com/comment/36193597
tagged with: java
type: Question
score: 0
answer count: 1
has title: How to do Groupby , Sum, Avg ,Min, Max on java collections?
has comment: http://stackoverflow.com/comment/36206606
has answer: http://stackoverflow.com/a/23591746
has comment: http://stackoverflow.com/comment/36194913
has comment: http://stackoverflow.com/comment/36206704
type: UnansweredQuestion

http://stackoverflow.com/comment/36100293
comment on: http://stackoverflow.com/a/23521583
type: Comment
has text: @Shachar87 use a drawer in one Activity. extend all other activitiees from that activity.
type: AnswerComment
score: 0

jframe
tags question: http://stackoverflow.com/q/23554726
tags question: http://stackoverflow.com/q/23479355
tags question: http://stackoverflow.com/q/23576085
tags question: http://stackoverflow.com/q/23516236
tags question: http://stackoverflow.com/q/23458661
tags question: http://stackoverflow.com/q/23516980
tags question: http://stackoverflow.com/q/23480130
tags question: http://stackoverflow.com/q/23584375
tags question: http://stackoverflow.com/q/23531112
tag name: jframe
tags question: http://stackoverflow.com/q/23500961
tags question: http://stackoverflow.com/q/23551321
tags question: http://stackoverflow.com/q/23462784
tags question: http://stackoverflow.com/q/23526365
tags question: http://stackoverflow.com/q/23456627
tags question: http://stackoverflow.com/q/23479570
tags question: http://stackoverflow.com/q/23506137
tags question: http://stackoverflow.com/q/23456718
tags question: http://stackoverflow.com/q/23531632
tags question: http://stackoverflow.com/q/23508354
tags question: http://stackoverflow.com/q/23463522
tags question: http://stackoverflow.com/q/23601294
tags question: http://stackoverflow.com/q/23551254
tags question: http://stackoverflow.com/q/23485530
tags question: http://stackoverflow.com/q/23573169
tags question: http://stackoverflow.com/q/23555936
tags question: http://stackoverflow.com/q/23581759
tags question: http://stackoverflow.com/q/23549089
tags question: http://stackoverflow.com/q/23466809
tags question: http://stackoverflow.com/q/23592220
tags question: http://stackoverflow.com/q/23571207
tags question: http://stackoverflow.com/q/23580841
tags question: http://stackoverflow.com/q/23475182
tags question: http://stackoverflow.com/q/23561268
type: Tag
tags question: http://stackoverflow.com/q/23454631
tags question: http://stackoverflow.com/q/23505135
tags question: http://stackoverflow.com/q/23601163
tags question: http://stackoverflow.com/q/23555676
tags question: http://stackoverflow.com/q/23464970

http://stackoverflow.com/comment/36027634
type: AnswerComment
comment on: http://stackoverflow.com/a/23482661
has text: Clearly you don't. Clearly your policy file isn't being read. Clearly it isn't in the current directory, which means the current directory clearly isn't where you think it is. Clearly you haven't taken my advice to trace what it really is. Clearly you aren't taking too much notice of what you're being told here.
score: 0
type: Comment

http://stackoverflow.com/a/23487576
type: Answer
answers question: http://stackoverflow.com/q/23458939
has body: Put all jars inside the lib folder, don't select external jars from build path, you have to put your all requred jars inside WebContent\WEB-INF\lib
score: 0

http://stackoverflow.com/q/23457377
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23457393
tagged with: if-statement
score: -2
tagged with: java
downvote count: 3
type: Question
has body: I'm trying to us an if-else statement to check if they typed something specific in the TextField but it will never return true. How do I get this to work or is there a work around? String text = textField.getText(); if(text == "work"){ textArea.append("Text was " + text + newline); textArea.append("If you see this then it worked"); }else{ textArea.append(text + newline); } This will display "work" for me. For convenient purposeses I used the oracle tutorial to test this to see if my JTextField http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/components/TextDemoProject/src/components/TextDemo.java
has comment: http://stackoverflow.com/comment/35959507
answer count: 1
tagged with: string
has title: getText() from a JTextField returns more that what is there. using an if-else
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/23457393
favorite count: 0
upvote count: 1
tagged with: jtextfield

http://stackoverflow.com/q/23551676
has title: Spring aop didn't work
has comment: http://stackoverflow.com/comment/36140049
type: UnansweredQuestion
tagged with: spring
has body: I try to apply Spring aop in my Spring web project but it didn't work I put org.springframework.instrument.tomcat-3.0.4.RELEASE in lib folder of Tomcat 7; I have the following AspectJ files org.aspectj aspectjrt 1.6.9 org.aspectj aspectjweaver 1.6.9 Under META_INF I have context.xml and aop.xml files context.xml <Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader" useSystemClassLoaderAsParent="false" /> and aop.xml <include within="com.example.spring.*" /> <aspect name="org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect" /> <aspect name="org.springframework.transaction.aspectj.AnnotationTransactionAspect" /> in root-context.xml file <aop:aspectj-autoproxy/> <context:load-time-weaver/> this is my advice class @Component @Configurable @Aspect public class DummyAdvice { final Logger logger = LoggerFactory.getLogger(DummyAdvice.class); @Before("execution(* com.example.spring.ContactServiceImp.findAllByPage(..))") public void simpleBeforeAdvice(JoinPoint joinPoint) throws Throwable { logger.info("simpleBeforeAdvice is excuted before : " + joinPoint.getSignature().getName()); } } But when findAllByPage() is called nothing happens. Did I do any thing wrong ? Thanks for spending time on this question.
type: Question
tagged with: java
tagged with: aspectj
answer count: 1
has answer: http://stackoverflow.com/a/23553001
score: 0
tagged with: spring-aop

http://stackoverflow.com/a/23526112
accepted answer of: http://stackoverflow.com/q/23525747
answers question: http://stackoverflow.com/q/23525747
type: Answer
score: 2
upvote count: 2
has body: It seem that JAX-WS don't know how to convert the ObjectId object to a String. I don't know how you are using your documents, but I think that you can use a String instead of an ObjectId in your CompanyDoc object. Spring data will convert your String to an ObjectId when your inserting data and vice versa. public class CompanyDoc{ @Id private String id; private String companyName; //getter setter } More info from the documentation The following outlines what type conversion, if any, will be done on the property mapped to the _id document field when using the MappingMongoConverter, the default for MongoTemplate. An id property or field declared as a String in the Java class will be converted to and stored as an ObjectId if possible using a Spring Converter. Valid conversion rules are delegated to the Mongo Java driver. If it cannot be converted to an ObjectId, then the value will be stored as a string in the database. An id property or field declared as BigInteger in the Java class will be converted to and stored as an ObjectId using a Spring Converter.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23551659
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36139459
has comment: http://stackoverflow.com/comment/36136325
score: 0
answer count: 1
has title: ClassDefNotFoundException using FacebookSDK
tagged with: facebook-sdk-3.1
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23554028
has body: I am developing an app using FacebookSDK, now I'm integrating Facebook login to the my app. My problem is a NoClassDefFoundError at the initialization of my integration activity. There is the logcat output: 05-08 17:05:16.214: E/AndroidRuntime(23671): FATAL EXCEPTION: main 05-08 17:05:16.214: E/AndroidRuntime(23671): Process: com.tuntzme, PID: 23671 05-08 17:05:16.214: E/AndroidRuntime(23671): java.lang.NoClassDefFoundError: com.tuntzme.controller.fragments.IntegracaoFragment$1 05-08 17:05:16.214: E/AndroidRuntime(23671): at com.tuntzme.controller.fragments.IntegracaoFragment.(IntegracaoFragment.java:24) 05-08 17:05:16.214: E/AndroidRuntime(23671): at com.tuntzme.controller.activities.ActivityIntegracao.onCreate(ActivityIntegracao.java:21) 05-08 17:05:16.214: E/AndroidRuntime(23671): at android.app.Activity.performCreate(Activity.java:5248) 05-08 17:05:16.214: E/AndroidRuntime(23671): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110) 05-08 17:05:16.214: E/AndroidRuntime(23671): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2173) 05-08 17:05:16.214: E/AndroidRuntime(23671): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269) 05-08 17:05:16.214: E/AndroidRuntime(23671): at android.app.ActivityThread.access$800(ActivityThread.java:139) 05-08 17:05:16.214: E/AndroidRuntime(23671): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210) 05-08 17:05:16.214: E/AndroidRuntime(23671): at android.os.Handler.dispatchMessage(Handler.java:102) 05-08 17:05:16.214: E/AndroidRuntime(23671): at android.os.Looper.loop(Looper.java:136) 05-08 17:05:16.214: E/AndroidRuntime(23671): at android.app.ActivityThread.main(ActivityThread.java:5102) 05-08 17:05:16.214: E/AndroidRuntime(23671): at java.lang.reflect.Method.invokeNative(Native Method) 05-08 17:05:16.214: E/AndroidRuntime(23671): at java.lang.reflect.Method.invoke(Method.java:515) 05-08 17:05:16.214: E/AndroidRuntime(23671): at com.andro…

http://stackoverflow.com/comment/36165224
score: 0
comment on: http://stackoverflow.com/q/23565912
has text: The content isn't displayed before setContentView but the app does start an "empty activity" where the content gets loaded into.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36137714
comment on: http://stackoverflow.com/q/23552130
has text: i edited to make it more clear. I used the dimensions of the picture for bitmapwidth and bitmapheight.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23471546
has comment: http://stackoverflow.com/comment/35985695
answer count: 0
type: UnansweredQuestion
tagged with: package
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35985590
has title: linux deployment from windows Eclipse IDE
has comment: http://stackoverflow.com/comment/35985911
has body: I'm developing my java application in Eclipse under a windows environment, my target system is linux and when I compile it on the linux box I find that I need to remove the package com.myname.application; from each of my .java files. The Eclipse IDE requires them to be there otherwise it doesnt compile. How can I get around this as its a pain to remove all before compiling under linux. EDIT: When compiling under linux I get a "cannot find symbol" before I remove the code, removing it solves the problem Thanks
score: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/35985763
has comment: http://stackoverflow.com/comment/35985553

http://stackoverflow.com/comment/36114593
score: 0
type: Comment
has text: I was using Ehcache with Terracotta DSO, but the Querying touched the database every time, so my conclusion was it only works when you're receiving an object directly but not for querying (except for query cache, but it's not the right thing here since we have lots of transaction and the eviction is also expensive).
type: QuestionComment
comment on: http://stackoverflow.com/q/23540399

http://stackoverflow.com/a/23589238
upvote count: 3
answers question: http://stackoverflow.com/q/23588895
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The reason you see such code (I've seen a lot of it too, I admit), is that some programmers, especially those writing AWT and/or Swing code, tend to put tons of GUI logic into a single class. The reasons for this vary, but several common ones are: They've seen such code in examples while learning They're reluctant to use anonymous classes, or perhaps there's so much code in the event listener's methods that an anonymous class doesn't seem applicable They believe it's "easier" to understand the code, if the event handling of all child components is done directly in the parent container's methods They're afraid to have "too many classes" in the project (I'd like to find whoever started that misconception !) From my experience, a lot of GUI code looks like that. Is that a good way of programming ? ABSOLUTELY NOT ! Any methodology book you read will tell you the same. Such classes are breaking every possible principle of good design. The most basic example would be SRP (http://en.wikipedia.org/wiki/Single_responsibility_principle). Moreover, GUI classes that handle events as methods of the class, tend to blow out of proportion, and unfortunately, classes of several thousands of lines of code is something I've seen many times in different projects and companies. Don't fall into this trap. Keep your classes short, have a different class for each of the inner components, unless it's a regular component with a very simple initialization (in which case it would still be preferable to have a factory class do the initialization). Keep event handling in anonymous classes when there's very few lines of code in the handler, and in separate classes when there's more than a line or two of code. In short, GUI code is no different than other OO code, and should adhere to the same principles and methodologies.
accepted answer of: http://stackoverflow.com/q/23588895
score: 3

http://stackoverflow.com/comment/36152141
score: 0
type: Comment
type: QuestionComment
has text: please suggest any solution for this guys
comment on: http://stackoverflow.com/q/23542225

http://stackoverflow.com/comment/36020862
has text: It's exactly what you are looking for.
type: QuestionComment
comment on: http://stackoverflow.com/q/23490188
score: 0
type: Comment

http://stackoverflow.com/a/23603559
answers question: http://stackoverflow.com/q/23603227
upvote count: 4
downvote count: 0
score: 4
has body: onCreate is called when the Activity is created. Once you come back, onResume will be called. If you have some code that should run both on onCreate and onResume, you should put it in onResume, while onResume is always called, whether you are creating a new activity or you are coming back to an already running activity. See the activity life-cycle in this diagram:
type: Answer

http://stackoverflow.com/comment/36364960
has text: How can I use your do-while without using cursor?
comment on: http://stackoverflow.com/a/23539460
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23596896
has comment: http://stackoverflow.com/comment/36220413
tagged with: spring
possible better answer: http://stackoverflow.com/a/23596979
has body: I've followed some tutorial in order to set up a web application using spring, hibernate to run on tomcat. When trying to run my application I get the error "Connection cannot be null when 'hibernate.dialect' not set" My hibernate.cfg.xml is <?xml version='1.0' encoding='utf-8'?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/myproject root root </hibernate-configuration> My pom.xml 4.0.0 com.myproject.controller myproject 1.0-SNAPSHOT war myproject Webapp http://maven.apache.org <spring.version>3.1.1.RELEASE</spring.version> myproject-webapp org.apache.maven.plugins maven-compiler-plugin 3.1 ${jdk.version} ${jdk.version} net.leadware hibernate4-maven-plugin 1.0.1 repository.jboss.org-public JBoss repository https://repository.jboss.org/nexus/content/groups/public org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-webmvc-portlet ${spring.version} org.springframework spring-tx ${spring.version} org.springframework spring-expression ${spring.version} org.springframework spring-beans ${spring.version} org.springframework spring-aop ${spring.version} org.springframework spring-context ${spring.version} org.springframework spring-context-support ${spring.version} org.springframework spring-jdbc ${spring.version} org.springframework spring-orm ${spring.version} org.springframework spring-oxm ${spring.version} mysql mysql-connector-java 5.1.30 org.hibernate hibernate-core 4.2.7.Final org.hibernate hibernate-entitymanager 4.2.7.Final dom4j dom4j 1.6.1 commons-logging commons-logging 1.1.1 commons-collections commons-collections 3.2.1 antlr antlr 2.7.7 org.apache.tomcat tomcat-dbcp 7.0.52 log4j log4j 1.2.15 javax.mail mail javax.jms jms com.sun.jdmk jmxtools com.sun.jmx jmxri runtime javassist javassist 3.12.1.GA javax.servlet jstl 1.2 runtime taglibs standard 1.1.2 runtime commons-dbcp commons-dbcp 1.4 user-servlet.xml <…
has answer: http://stackoverflow.com/a/23596979
has comment: http://stackoverflow.com/comment/36259391
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23630550
has comment: http://stackoverflow.com/comment/36220618
has comment: http://stackoverflow.com/comment/36220281
tagged with: tomcat7
type: Question
has title: Connection cannot be null when 'hibernate.dialect' not set hibernate4 tomcat7
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36220586
accepted answer: http://stackoverflow.com/a/23630550
has comment: http://stackoverflow.com/comment/36220161
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36220179

http://stackoverflow.com/q/23460285
answer count: 0
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35966334
has comment: http://stackoverflow.com/comment/35966086
score: 0
has title: Instance Of Selected java file is always returning null -- eclipse plugin development
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/35965470
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35965254
has body: I want to get the instance of the Selected java file into eclipse. When I googled, I got the below code. IWorkbenchWindow window = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); if (window != null) { IStructuredSelection selection = (IStructuredSelection) window .getSelectionService().getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; Object obj = ssel.getFirstElement(); IFile file = (IFile) Platform.getAdapterManager().getAdapter(obj, IFile.class); if (file == null) { if (obj instanceof IAdaptable) { file = (IFile) ((IAdaptable) obj).getAdapter(IFile.class); } } if (file != null) { // do something } } } But this code is always returning null for file. Kindly help. It has got the correct values till obj. But it cannot make IFile object.

http://stackoverflow.com/comment/36156767
comment on: http://stackoverflow.com/q/23562293
score: 0
type: QuestionComment
type: Comment
has text: If it does, it should print some more information in another JTextArea... but it's not doing that last part at all at the moment, and for some reason, it's crashing.

http://stackoverflow.com/comment/35982564
comment on: http://stackoverflow.com/a/23469933
has text: apparently you do not need setters
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23536303
has comment: http://stackoverflow.com/comment/36107807
has comment: http://stackoverflow.com/comment/36107035
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23535913
has body: Be aware that instanceof should be used sparingly. If you find yourself writing code that uses instanceof, then investigate shifting the target code to a new member method in each subclass (which is usually where it belongs). In your code, both Boat and Speedboat could provide a method int getScore() that would remove the need for instanceOf. One place that it is invaluable is in exception handling. For instance: try { .. Access the database } catch (Exception ex) { if (ex instanceof SQLException) { .. Process the details of the database exception to log more detail } else { throw ex; }
has comment: http://stackoverflow.com/comment/36107644

http://stackoverflow.com/q/23460578
has title: Array out of bounds error android
favorite count: 0
has body: Hi I am new to andoid and keep getting the following error in my logcat but I can't find the problem in my java code. The app crashes after it goes round the array twice. I'm not sure where the array is out of bounds? Logcat error: 05-04 14:46:22.947 3086-3086/com.example.Finished_app E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.Finished_app, PID: 3086 java.lang.ArrayIndexOutOfBoundsException: length=6; index=6 at com.example.Finished_app.game1.onClick(game1.java:91) at android.view.View.performClick(View.java:4438) at android.view.View$PerformClick.run(View.java:18422) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Java code: public class game1 extends Activity implements View.OnClickListener { static Button next; static ImageView mainpic; static RadioGroup radioGroup; static RadioButton option1; static RadioButton option2; static RadioButton option3; static int[] mapPics = new int[]{R.drawable.america, R.drawable.england, R.drawable.australia, R.drawable.poland, R.drawable.sweden, R.drawable.spain}; static String[] answers = new String[]{"Spain", "Poland", "Sweden", "America", "England", "Australia"}; static int[] correctAnswer = new int[]{2, 1}; static int score = 0; static int i = 0; static int a = 0; static int b = 1; static int c = 2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.game1); next = (Button) findViewById(R.id.nextButton); mainpic = (ImageView) findViewById(R.id.imageView); mainpic.setImageResource(…
has answer: http://stackoverflow.com/a/23460623
type: UnansweredQuestion
tagged with: android
score: -3
downvote count: 4
tagged with: java
tagged with: indexoutofboundsexception
type: Question
tagged with: arrays
upvote count: 1
answer count: 1

http://stackoverflow.com/q/23494448
downvote count: 0
has title: How to get text and respond to enter press on JFormattedTextField
favorite count: 0
has body: I recently added a MaskFormatter to my JFormattedTextField class. Previously an ActionListener was responding to the code and getting the text using the .getText() method worked fine. With the new MaskFormatter getting the text returns " " and enter presses don't work (the ActionListener stopped responding to the box). Here is the entire JFormattedTextField class: package swing; import game.Main; import java.awt.Font; import javax.swing.JFormattedTextField; import javax.swing.text.MaskFormatter; import window.Listener; @SuppressWarnings("serial") public class TextField extends JFormattedTextField { public TextField(int size, String text) //TODO limit to number input and 3 character input only { super(createFormatter()); Font font = new Font("AGENCY FB", Font.BOLD, 30); this.setFont(font); this.setColumns(size); this.setSize(100, 100); this.setText(text); } private static MaskFormatter createFormatter() { MaskFormatter formatter = null; try { formatter = new MaskFormatter("###"); } catch (java.text.ParseException exc) { System.err.println("formatter is bad: " + exc.getMessage()); System.exit(-1); } return formatter; } }
has answer: http://stackoverflow.com/a/23497850
tagged with: jformattedtextfield
has answer: http://stackoverflow.com/a/23496155
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/23497850
type: AnsweredQuestion
tagged with: actionlistener
possible better answer: http://stackoverflow.com/a/23496155
score: 1
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/23534648
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: The VooDoo you want is composition. You can solve that using Visitor dessign pattern. But ther is some penalty when you are using it. Or you can create onther interface that will be used to invoke that a3 method. The case varry. The reason of question might be that your architecture is not consist and you trying to do something strange or your class perform to many things.
answers question: http://stackoverflow.com/q/23534423
has comment: http://stackoverflow.com/comment/36104258

http://stackoverflow.com/comment/35956819
score: 1
type: QuestionComment
type: Comment
has text: Look into `CardLayout` instead of setting panels visible. For the position, it is probably as simple as adding an `EmtpyBorder` to the panel in question. But for more help, post an MCVE as recommended by @peeskillet.
comment on: http://stackoverflow.com/q/23455667

exception
tags question: http://stackoverflow.com/q/23594574
tags question: http://stackoverflow.com/q/23611436
tags question: http://stackoverflow.com/q/23526362
tags question: http://stackoverflow.com/q/23494789
tags question: http://stackoverflow.com/q/23590129
tags question: http://stackoverflow.com/q/23513885
tags question: http://stackoverflow.com/q/23520883
tags question: http://stackoverflow.com/q/23574270
tags question: http://stackoverflow.com/q/23516285
tags question: http://stackoverflow.com/q/23607640
tags question: http://stackoverflow.com/q/23461305
tags question: http://stackoverflow.com/q/23505167
tags question: http://stackoverflow.com/q/23491143
tags question: http://stackoverflow.com/q/23584826
tags question: http://stackoverflow.com/q/23465239
tags question: http://stackoverflow.com/q/23567445
tags question: http://stackoverflow.com/q/23484654
type: Tag
tags question: http://stackoverflow.com/q/23544415
tags question: http://stackoverflow.com/q/23456742
tags question: http://stackoverflow.com/q/23589037
tags question: http://stackoverflow.com/q/23496640
tags question: http://stackoverflow.com/q/23513497
tags question: http://stackoverflow.com/q/23550336
tags question: http://stackoverflow.com/q/23583579
tags question: http://stackoverflow.com/q/23480682
tags question: http://stackoverflow.com/q/23612854
tags question: http://stackoverflow.com/q/23546530
tags question: http://stackoverflow.com/q/23545394
tags question: http://stackoverflow.com/q/23608159
tags question: http://stackoverflow.com/q/23478130
tags question: http://stackoverflow.com/q/23534439
tags question: http://stackoverflow.com/q/23507891
tags question: http://stackoverflow.com/q/23547257
tags question: http://stackoverflow.com/q/23567296
tags question: http://stackoverflow.com/q/23542225
tags question: http://stackoverflow.com/q/23506137
tags question: http://stackoverflow.com/q/23604964
tag name: exception
tags question: http://stackoverflow.com/q/23542571
tags question: http://stackoverflow.com/q/23528399
tags question: http://stackoverflow.com/q/23606933
tags question: http://stackoverflow.com/q/23586398
tags question: http://stackoverflow.com/q/23589683
tags question: http://stackoverflow.com/q/23507638
tags question: http://stackoverflow.com/q/23454428
tags question: http://stackoverflow.com/q/23512580
tags question: http://stackoverflow.com/q/23606908

http://stackoverflow.com/a/23494861
answers question: http://stackoverflow.com/q/23494617
type: Answer
has body: serialVersionId will help when object serialize and transport and run in some other enviornment mainly other jvm then serialVersionId will deseralize and check it competes the enviornment. so as long as you have same jvm you need not to worry. thats why eclipse provide 1L
upvote count: 2
score: 2
downvote count: 0

http://stackoverflow.com/q/23475623
has comment: http://stackoverflow.com/comment/35993187
linked to: http://stackoverflow.com/q/153724
upvote count: 2
score: 0
downvote count: 2
possible better answer: http://stackoverflow.com/a/23475739
duplicate of: http://stackoverflow.com/q/153724
has answer: http://stackoverflow.com/a/23475739
has comment: http://stackoverflow.com/comment/35993046
has answer: http://stackoverflow.com/a/23475673
has answer: http://stackoverflow.com/a/23476071
tagged with: java
answer count: 3
has title: How can I only show three digists of the double value
has comment: http://stackoverflow.com/comment/35993019
has comment: http://stackoverflow.com/comment/35993066
accepted answer: http://stackoverflow.com/a/23475673
has comment: http://stackoverflow.com/comment/35993105
has comment: http://stackoverflow.com/comment/35993201
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35993175
has comment: http://stackoverflow.com/comment/35993384
linked to: http://stackoverflow.com/q/3413448
type: Question
has comment: http://stackoverflow.com/comment/35993435
has body: I have double values like 0.0345333 or 1.0897777 and I want to convert them to 0.034 and 1.089 in Java? How can I do it? I want to convert the values, not print them since I need it for calculation. I find the following way but I am looking for simple way. double score=(tff* idf); DecimalFormat df = new DecimalFormat("#.###"); p.score=Double.parseDouble(df.format(score));
has comment: http://stackoverflow.com/comment/35993086
favorite count: 0

http://stackoverflow.com/comment/36183518
type: Comment
type: QuestionComment
has text: Test is not set in any scope. Try ${profile.test}. Profile is in session.
comment on: http://stackoverflow.com/q/23576929
score: 0

http://stackoverflow.com/comment/36001566
comment on: http://stackoverflow.com/q/23479755
has text: I can be wrong about, but this block may be the first code that a class runs, before the constructor. And, in this case, you do not wrote any, so it is empty.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36018229
comment on: http://stackoverflow.com/q/23489104
score: 0
type: Comment
type: QuestionComment
has text: Is the json valid? Can you show us the json?

image
tags question: http://stackoverflow.com/q/23515172
tags question: http://stackoverflow.com/q/23458549
tags question: http://stackoverflow.com/q/23588414
tags question: http://stackoverflow.com/q/23504482
tags question: http://stackoverflow.com/q/23515389
tags question: http://stackoverflow.com/q/23457419
tags question: http://stackoverflow.com/q/23521090
tags question: http://stackoverflow.com/q/23484233
tags question: http://stackoverflow.com/q/23500303
tags question: http://stackoverflow.com/q/23502556
tags question: http://stackoverflow.com/q/23516064
tags question: http://stackoverflow.com/q/23541092
tags question: http://stackoverflow.com/q/23590755
tags question: http://stackoverflow.com/q/23483440
tags question: http://stackoverflow.com/q/23505305
tags question: http://stackoverflow.com/q/23602144
tags question: http://stackoverflow.com/q/23615429
tags question: http://stackoverflow.com/q/23574802
tags question: http://stackoverflow.com/q/23463830
tags question: http://stackoverflow.com/q/23597104
tags question: http://stackoverflow.com/q/23517404
tags question: http://stackoverflow.com/q/23525006
tags question: http://stackoverflow.com/q/23599606
tags question: http://stackoverflow.com/q/23579396
tags question: http://stackoverflow.com/q/23455667
tags question: http://stackoverflow.com/q/23559115
tags question: http://stackoverflow.com/q/23496289
tags question: http://stackoverflow.com/q/23455237
tags question: http://stackoverflow.com/q/23489321
tags question: http://stackoverflow.com/q/23459899
tags question: http://stackoverflow.com/q/23467797
tag name: image
tags question: http://stackoverflow.com/q/23610007
tags question: http://stackoverflow.com/q/23598575
tags question: http://stackoverflow.com/q/23571836
tags question: http://stackoverflow.com/q/23592738
type: Tag
tags question: http://stackoverflow.com/q/23590652
tags question: http://stackoverflow.com/q/23597763
tags question: http://stackoverflow.com/q/23561122

http://stackoverflow.com/comment/36201329
type: Comment
comment on: http://stackoverflow.com/a/23586768
score: 0
type: AnswerComment
has text: I updated it the code above. thanks for your help, now i think it has to do with the scanner again

http://stackoverflow.com/q/23584898
has title: Java - Make a jCheckBox uncheckeable or vice-versa without disabling it
answer count: 1
favorite count: 0
upvote count: 2
tagged with: swing
has answer: http://stackoverflow.com/a/23585030
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jcheckbox
downvote count: 0
has comment: http://stackoverflow.com/comment/36197642
accepted answer: http://stackoverflow.com/a/23585030
has body: I am doing a project for my class and I have the following situation: It's a JDialog that receives an Object on the constructor to work with it. The Object 'Album' has two attribute that can be 0 or 1 according to a MySQL boolean. When the window gets initialized, it checks the status of that two attributes. If one of them is set to 1, the corresponding jCheckBox gets checked. Otherwise (case 0) it remains unchecked, and the same to the second attribute. What I want to get is to make the two jCheckBoxes uneditable without disabling them, that is, it remains looking as 'enabled' but if you click it won't happen anything, because I don't want them to look grey as disabled. I tried few things such as creating a Thread that keeps checking the checkboxes state, and if it's not the set on the Album attribute, it changes it to the correct state, but it doesn't work, you can check or uncheck both checkboxes as desired. What could I do? Here's what I have until right now. public class JDVerAlbum extends javax.swing.JDialog { /** * Creates new form JDVerAlbum */ Album a; /** * * @deprecated */ public JDVerAlbum(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); } public JDVerAlbum(java.awt.Frame parent, boolean modal, Album a) { super(parent, modal); this.a=a; initComponents(); inicializar(); } private void inicializar(){ Statement stm = Controlador.connect(); String s = null; try { ResultSet rs = stm.executeQuery("SELECT grupo.nombre from album, grupo where album.nombre='"+a.getName()+"' and album.idgrupo=grupo.id;"); rs.next(); s = rs.getString(1); } catch (SQLException ex) { Logger.getLogger(JDVerAlbum.class.getName()).log(Level.SEVERE, null, ex); } jLabelAlbum.setText(a.getName()+" - "+s); this.setTitle("Quaver Records - Ver álbum - "+jLabelAlbum.getText()); jTextFieldAño.setText(""+a.getReleaseYear()); jTextFieldTipo.setText(""+a.getType()); if(a.getPhysicalSales()==1){ jCheckBoxFisica.setSelected(true); } if(a.getDigitalSales()==1){ jCheckBo…
has comment: http://stackoverflow.com/comment/36197675

http://stackoverflow.com/comment/35984219
comment on: http://stackoverflow.com/a/23469846
has text: I just fix it by adding this on my web.xml : contextConfigLocation classpath:spring-config.xml
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23561107
accepted answer of: http://stackoverflow.com/q/23559159
score: 0
type: AcceptedAnswer
type: Answer
has body: Filters not create a response like servlet. A filter is an object that can transform a request or alter a response before it reaches to a servlet and can process response before it leaves to a servlet. A filter can intercept a servlet's invocation before the servlet is called . Can examine a request before a servlet is called. Can modify the request headers and request data by providing a customized version of the request object that wraps the real request. Can modify the response headers and response data by providing a customized version of the response object that wraps the real response. Intercept a servlet's invocation after the servlet is called.
answers question: http://stackoverflow.com/q/23559159

http://stackoverflow.com/comment/36100841
score: 0
has text: @madhu that is where it is going wrong, it is not deleting at all which makes me think that it is an ID error. And rat-a-tat-a-tat-ratatouille where am I comparing it to a string value? Also where would I implement rawQuery?
comment on: http://stackoverflow.com/q/23532446
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35997477
type: AnswerComment
score: 0
type: Comment
has text: @IcedDante you are right, the benefit is rather small. Basically just the setup of the pointer to the enclosing object.
comment on: http://stackoverflow.com/a/23477814

http://stackoverflow.com/a/23544044
answers question: http://stackoverflow.com/q/23543415
has comment: http://stackoverflow.com/comment/36200355
has body: How to add Google map for GWT into FormPanel? Here is the code. Simply call below line and the map is added in formPanel. GoogleMap gMap = GoogleMap.create(formPanel.getElement(), options); Some more configuration as defined below: gwt.xml: &lt;inherits name="com.google.maps.gwt.GoogleMaps" /&gt; &lt;script src="http://maps.google.com/maps/api/js?sensor=false" /&gt; gwt-maps.jar in build path of the project. Sample code: public void onModuleLoad() { FormPanel formPanel = new FormPanel(); formPanel.setWidth("500px"); formPanel.setHeight("650px"); RootPanel.get().add(formPanel); MapOptions options = MapOptions.create(); options.setZoom(6); options.setMapTypeId(MapTypeId.ROADMAP); options.setDraggable(true); options.setMapTypeControl(true); options.setScaleControl(true); options.setScrollwheel(true); GoogleMap gMap = GoogleMap.create(formPanel.getElement(), options); gMap.setCenter(LatLng.create(58.378679, -2.197266)); } screenshot:
upvote count: 2
has comment: http://stackoverflow.com/comment/36210901
type: Answer
has comment: http://stackoverflow.com/comment/36210791
accepted answer of: http://stackoverflow.com/q/23543415
has comment: http://stackoverflow.com/comment/36205163
has comment: http://stackoverflow.com/comment/36208725
has comment: http://stackoverflow.com/comment/36210848
score: 2
has comment: http://stackoverflow.com/comment/36198958
has comment: http://stackoverflow.com/comment/36211278
has comment: http://stackoverflow.com/comment/36200383
has comment: http://stackoverflow.com/comment/36210811
has comment: http://stackoverflow.com/comment/36199466
has comment: http://stackoverflow.com/comment/36274277
has comment: http://stackoverflow.com/comment/36208810
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36211347
has comment: http://stackoverflow.com/comment/36208595
has comment: http://stackoverflow.com/comment/36208854
has comment: http://stackoverflow.com/comment/36208552
has comment: http://stackoverflow.com/comment/36212137
has comment: http://stackoverflow.com/comment/36204591
has comment: http://stackoverflow.com/comment/36211237
has comment: http://stackoverflow.com/comment/36210821
downvote count: 0
has comment: http://stackoverflow.com/comment/36211996
has comment: http://stackoverflow.com/comment/36205111

http://stackoverflow.com/a/23593912
has comment: http://stackoverflow.com/comment/36215075
has comment: http://stackoverflow.com/comment/36214916
has comment: http://stackoverflow.com/comment/36214460
has comment: http://stackoverflow.com/comment/36214362
has comment: http://stackoverflow.com/comment/36215000
has body: The insert() call returns -1 if an error occurred. I think you should check it. And make sure you write the correct column name. I tried you code,works fine! 05-11 23:13:14.110: I/db update s=(30650): s= 1 ContentValues values = new ContentValues(); values.put(KEY_SET_LIMIT, 29); int s= db.update(TABLE_CATEGORIES, values, KEY_ID + " = ?", new String[] { String.valueOf(2) }); Log.i("db update s=", "s= " +s);
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36215055
has comment: http://stackoverflow.com/comment/36215282
has comment: http://stackoverflow.com/comment/36237426
type: Answer
accepted answer of: http://stackoverflow.com/q/23593805
score: 1
answers question: http://stackoverflow.com/q/23593805
upvote count: 1

http://stackoverflow.com/comment/36281091
has text: So the 't' parameter is null when it arrives in executeTask() at the server?
score: 0
comment on: http://stackoverflow.com/q/23614885
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23493920
has body: There are two main problems with your code: You cannot return more than one value from a method - if you need all three, you may want to embed them in a class, and return an object of that class's type When a method returns a variable, it doesn't just appear in your function - rather, you need to use a line such as Object o = foo(bar) to store your value and subsequently use it.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23493684

http://stackoverflow.com/q/23571101
has comment: http://stackoverflow.com/comment/36173850
has answer: http://stackoverflow.com/a/23655025
has comment: http://stackoverflow.com/comment/36176181
has body: Im trying to create a bean configuration file for my SettingsDto class: public class SettingsDto { private String administratorEmail; private String gatekeeperAddress; private String webRtcUrl; private String userGuideUrl; private String vmrFaqUrl; private String lyncGuideUrl; List<Map<String, String>> supportPhones; List<String> audioCalls; But Im having issues with how Im doing the supportPhones (List<Map<String, String>>) <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" 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-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/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"> <context:component-scan base-package="sandbox.spring" /> <util:list> +1 (000)000-0000 (000)000-0000 </util:list> <util:list> </util:list> <util:map id="supportPhonesMapping1"> <entry key="name" value="North America" /> <entry key="phone" value-ref="+1 111-1111" /> </util:map> <util:map id="supportPhonesMapping2"> <entry key="name" value="+11 111-1111" /> <entry key="phone" value-ref="International" /> </util:map> </beans> The error I get is Invalid content was found starting with element 'util:map'. No child element is expected at this point
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23572188
tagged with: javabeans
has answer: http://stackoverflow.com/a/23572188
type: Question
has comment: http://stackoverflow.com/comment/36299311
has comment: http://stackoverflow.com/comment/36173985
tagged with: spring
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23573601
has title: Spring bean configuration list
accepted answer: http://stackoverflow.com/a/23573601
tagged with: java

pipeline
type: Tag
tags question: http://stackoverflow.com/q/23530027
tag name: pipeline

http://stackoverflow.com/q/23467724
tagged with: cassandra
has comment: http://stackoverflow.com/comment/36110670
has title: cassandra - high concurrency read-write app problems
type: UnansweredQuestion
upvote count: 1
tagged with: kundera
tagged with: cassandra-2.0
score: 1
tagged with: java
type: Question
tagged with: jpa
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23521185
favorite count: 0
has body: I'm implementing an app, which is generating hundreds of thousands rows in 4 threads. Each thread opens a separate connection to cassandra. Every item of the table has a unique hash identifier (String), but the primary key is an uuid. The process of the item persisting is the following: 1) The item is created and its hash is computed. 2) Then a lookup for the hash is being executed in a second table, which pairs hashes accordingly to the item's uuids. 3) If a hash - uuid pair is found, a lookup for the items uuid is being executed (1st table again) and since the item has to exist (because a "hash - uuid" pair was found), the item is loaded from cassandra to JPA and it's updated afterwards. When no "hash - uuid" pair is found, a new item is created in the corresponding table and a new "hash - uuid" pair is saved as well. The data generation has two steps. The first step is running with empty tables and generates the first datasets. No errors happen there, because in the step nr. 3, a "hash - uuid" pair is never found, so no updates occur. In the second step, the whole algorithm runs again, but already on populated data tables. In this step, random errors occur while reading the data items byt their correspnding uuids (primary keys) - sometimes the server doesn't retun complete text data (proper JSON strings are stored in the table, but incomplete JSON strings are retrieved into the application). I'm completely sure, that my algorithm is correct, because the same algorithem worked with hibernate and mysql, even with postgresql (but since I need faster writes, I'm playing around with cassandra). I am using a macbook pro with 16 GB RAM, for the work with cassandra I use the Kundera library (supports JPA). As for cassandra, I have tried the datastax 2.0.4 version, and also the 2.0.7 version downloaded directly from the Apache site. There is no cluster, only one instance is running locally on my machine, on an external SSD drive. Kundera is using CQL v3. Has anybody an id…

http://stackoverflow.com/q/23529852
has title: Multiple files upload to Box fails with HTTP client error "connection still allocated"
has answer: http://stackoverflow.com/a/23626021
has answer: http://stackoverflow.com/a/23619587
has body: I'm running Box java SDK v3.0.5 (latest). In my app I implement synchronization with a remote user Box and when an user creates several files locally I should create them on Box side. My client created by following code: this.client = new BoxClient(key, clientSecret, hub, parser, config); With single file upload everything works well. But when several files submitted one by one in single thread and using this code: BoxFileUploadRequestObject obj = BoxFileUploadRequestObject.uploadFileRequestObject(parentId, name,data); obj.setLocalFileCreatedAt(created.getTime()); obj.put("created_at", formatDate(created)); return client.getFilesManager().uploadFile(obj); I face with following exception in my app: java.lang.IllegalStateException: Invalid use of SingleClientConnManager: connection still allocated. Make sure to release the connection before allocating another one. at org.apache.http.impl.conn.SingleClientConnManager.getConnection(SingleClientConnManager.java:216) ~[httpclient-4.1.2.jar:4.1.2] at org.apache.http.impl.conn.SingleClientConnManager$1.getConnection(SingleClientConnManager.java:190) ~[httpclient-4.1.2.jar:4.1.2] at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:401) ~[httpclient-4.1.2.jar:4.1.2] at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820) ~[httpclient-4.1.2.jar:4.1.2] at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754) ~[httpclient-4.1.2.jar:4.1.2] at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732) ~[httpclient-4.1.2.jar:4.1.2] at com.box.boxjavalibv2.BoxRESTClient.getResponse(BoxRESTClient.java:148) ~[boxjavalibv2-3.0.5.jar:na] at com.box.boxjavalibv2.BoxRESTClient.execute(BoxRESTClient.java:98) ~[boxjavalibv2-3.0.5.jar:na] at com.box.boxjavalibv2.BoxRESTClient.execute(BoxRESTClient.java:72) ~[boxjavalibv2-3.0.5.jar:na] at com.box.boxjavalibv2.resourcemanagers.AbstractBoxResourceManager.getResponseAndPars…
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/23619587
upvote count: 4
answer count: 2
accepted answer: http://stackoverflow.com/a/23626021
downvote count: 0
score: 4
favorite count: 0
tagged with: box-api
type: AnsweredQuestion

http://stackoverflow.com/a/23484820
type: Answer
upvote count: 7
score: 7
accepted answer of: http://stackoverflow.com/q/23484767
answers question: http://stackoverflow.com/q/23484767
type: AcceptedAnswer
downvote count: 0
has body: If a method in the base class can have an override, and the derived class has provided one, there is no way to force a call to the method of the base class. If the base class needs to call the functionality in the base class, it can put it into a separate method, and declare it final. Then it could make a decision between its own implementation and the derived implementation like this: public class Base { public Base() { } public void methodA() { System.out.println("Base: methodA"); // Call the derived method methodB(); // Call the base method methodB_impl(); } public final void methodB_impl() { System.out.println("Base: methodB"); } public void methodB() { methodB_impl(); } }

http://stackoverflow.com/q/23581197
accepted answer: http://stackoverflow.com/a/23581252
has body: I've asked this before but I can't seem to edit it, but now I have more of an idea on how to do it but it doesn't work. I have initialised a LabelledSlider and made the default value as int speedValue which is assigned to 1 in the constructor. final LabelledSlider speed = new LabelledSlider("Sim speed", 1, 7, speedValue); Upon loading the program the slider is 1, but when I call the action listener load which assigns the value 5 to speedValue, the slider still remains 1 and does not increase when I run the program. loadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { speedValue = 1; } }); Could anyone explain why nothing is happening and possibly provide a solution? I also have action listeners for saving slider values which works perfectly well. Thanks
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
tagged with: slider
answer count: 1
tagged with: user-interface
favorite count: 0
has title: How can I update a java LabelledSlider default value by assigning values to its variable?
tagged with: swing
has answer: http://stackoverflow.com/a/23581252

http://stackoverflow.com/q/23472175
has title: GSON: Deserializing Json with random class names
has comment: http://stackoverflow.com/comment/35987203
possible better answer: http://stackoverflow.com/a/23509255
accepted answer: http://stackoverflow.com/a/23473650
favorite count: 0
has body: I'm trying to use GSON to deserialize some Json to a nice, tidy object. Now, I have managed to get the Json to correctly map to some of the more obvious variables. However, while trying to map some of the Json I came across this: { "this_number": 1, "that_number": 12, "some_string": "String!", "list_of_objects": { "342356676784653234535345": { "random_double": "0.1235667456456", "magic": "29", "health": 1, "price": 7, "point": { "x": 2, "y": 70 } }, "2345263767467354": { "random_double": "0.1235667456456", "magic": "23", "health": 1, "price": 9, "point": { "x": 0, "y": 70 } } } } It was mapping nicely until I came to "list_of_objects". I can't for the life of me work out how to implement it. I think the main issue is that they are no longer static class names, they are randomized. Therefore it would be totally impractical (and impossible) to write something like: class 342356676784653234535345{ double random_double = 0.0; //etc } I've had a look around Stackoverflow, but the answers seem quite complex and many don't quite answer what I'm wanting to know. I have played around with the plain Object method used here, but I couldn't find any further information on its usage. I also keep finding references to mapping to generic types, but I don't quite understand what is going on. For example
has answer: http://stackoverflow.com/a/23509255
upvote count: 2
linked to: http://stackoverflow.com/q/6455303
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: gson
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23473650
downvote count: 0
linked to: http://stackoverflow.com/q/5796948

http://stackoverflow.com/comment/36108292
type: Comment
type: QuestionComment
has text: Put it in a variable? Furthermore, (1) if your matcher fails, you should probably be throwing `IllegalArgumentException`, and (2) you should precompile that pattern instead of using it inline and compiling on every call.
score: 0
comment on: http://stackoverflow.com/q/23537103

http://stackoverflow.com/q/23563240
tagged with: android
has body: I'm trying to set the height of a view in my application to a fraction of the total height of the user's screen. However, I can never seem to get it to quite work. Other solutions I've looked at for getting the height of the screen in pixels give a good approximate position, but the view position and height seem to vary from screen to screen. How do I go about this? Thanks for the help
tagged with: view
tagged with: pixel
has comment: http://stackoverflow.com/comment/36156544
tagged with: java
has comment: http://stackoverflow.com/comment/36156652
type: Question
has comment: http://stackoverflow.com/comment/36156512
has comment: http://stackoverflow.com/comment/36156669
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23563843
tagged with: height
has title: Programmatically set view height and position to fraction of screen size
has answer: http://stackoverflow.com/a/23564779
type: UnansweredQuestion

http://stackoverflow.com/a/23566947
type: Answer
has body: I have see something about thread, implements Runnable Forget that you ever saw that. That was a bad idea that ought to be deprecated. If you want to create an explicit thread in a java program, do it like this: Thread thread = new Thread(new Runnable() { @Override public void run() { ...code to be run in the thread goes here... } }); I'm not going to explain why in this space, but just trust me. It's a good habit to get into now. what does this do? ...invokeLater... The swing package creates a thread that responds to "events" (mouse clicks, key presses, etc.), and a lot of the code that you write for swing runs as "handlers" that are called by that thread. Sometimes, your handler wants to do something that is not allowed/does not make sense in the context in which it is called. I'm not a swing programmer, so I don't have a handy example, but the solution is to call invokeLater() EventQueue invokeLater(new Runnable() { @Override public void run() { ...code that you want to run "later"... } }); This will post a new event to the event queue, and when the event thread picks it off the queue, it will execute the run() method that you provided.
score: 0
answers question: http://stackoverflow.com/q/23559744

http://stackoverflow.com/comment/36026127
type: QuestionComment
comment on: http://stackoverflow.com/q/23491667
score: 1
has text: Yes, and as you might notice, the thread owning the lock acquired that lock at the very same method where the other threads are waiting for that lock. In other words, it looks like `AccessorInjector.prepare(…)` is a `static synchronized` method. And that’s the point of `synchronized`, only one thread can proceed, all others have to wait.
type: Comment

http://stackoverflow.com/comment/36243996
type: QuestionComment
type: Comment
has text: @owlstead Sorry I didn't watch my own question. Yes, Consumer, Producer and Logger are all actual classes in my design. Consumer consumes message that an upstream Producer-derived class gives it. The Consumer is optionally a thread with a queue. Logger is just a logging facility where any class can write to one file.
score: 0
comment on: http://stackoverflow.com/q/23575158

http://stackoverflow.com/comment/36011561
comment on: http://stackoverflow.com/q/23484994
score: 0
type: Comment
type: QuestionComment
has text: <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.CALL_PHONE"/> <uses-permission android:name="android.permission.SEND_SMS"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

http://stackoverflow.com/comment/36128590
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23547682
has text: did you try without ".java"?

http://stackoverflow.com/comment/36117182
score: 0
comment on: http://stackoverflow.com/q/23541809
type: Comment
type: QuestionComment
has text: @user3070387 Try replacing int l=name.length(); this line with int l= signature.length();

http://stackoverflow.com/q/23582248
type: AnsweredQuestion
has title: Access Fastlane
has answer: http://stackoverflow.com/a/23585376
type: Question
tagged with: java
has body: I am currently developing a Launcher for Nokia X. How do I integrate the FastLane feature of Nokia X onto it. I already do have a base for the Launcher, and already had been tested against Android 4.1.2 (16). By the way I've already checked here.
possible better answer: http://stackoverflow.com/a/23604855
tagged with: android-4.2-jelly-bean
answer count: 2
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/23604855
accepted answer: http://stackoverflow.com/a/23585376
tagged with: nokiax

http://stackoverflow.com/q/23472726
tagged with: weblogic
has comment: http://stackoverflow.com/comment/36022769
tagged with: java
has body: I get the following error when i add a JSF Page to my web project. If i try to add the JSF Page to Generic Project for example it will be added fine. Below is a snapshot of the error.
has comment: http://stackoverflow.com/comment/36022808
tagged with: jdeveloper
has title: Error:Initialization of the JSF runtime either failed or did not occurr when adding a JSF Page to Web Project in Jdeveloper
tagged with: jsf
answer count: 0
score: 0
type: UnansweredQuestion
tagged with: oracle-adf
type: Question

http://stackoverflow.com/a/23604411
upvote count: 2
has body: Use this instead: mSensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE); The problem is the code you used only works in a subclass of Context (e.g. Activity). Fragment is not a subclass of Context, so you have to get an object of that type in order to get the system service. Luckily, in a Fragment, you can easily get the container Activity with getActivity(). SENSOR_SERVICE is a constant that is defined in Context, so you have to write Context.SENSOR_SERVICE whenever you use it from outside a subclass of Context.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23604287
has comment: http://stackoverflow.com/comment/36234852

http://stackoverflow.com/comment/35961487
type: Comment
comment on: http://stackoverflow.com/a/23458244
score: 0
type: AnswerComment
has text: Oh my god you just made it! I've been more than 3 hours looking for something like this and all I have to do was make the PANEL transparent... Thank you SO MUCH !!

http://stackoverflow.com/a/23504551
has comment: http://stackoverflow.com/comment/36051908
has body: I'm pretty sure this isn't supported in the Java libraries. Most likely what you would have to do is to make an image file yourself - let's say a bitmap for simplicity's sake - and iterate over the pixels and set them yourself based on your image data, more or less making your own rendering engine. To clarify, that would mean that you'd have to save the user's input, and use that to build the image file, as well as the image on-screen. Here's a pseudo-code example of what I mean: ArrayList rules; //records the user's inputs used to make the image //e.g. "red line from pixel (3,5) -&gt; (5,8)" Image savedImage; //open an image file - make sure to set its dimensions to the //dimensions of the image on-screen for (x = 0 -&gt; savedImage.width) { for (y = 0 -&gt; savedImage.height) { for (r = 0 -&gt; rules.size()) { if (rules.get(r).affects(x,y)) //checking to see if this input { //affected this pixel savedImage.pixelAt(x,y).apply(rules.get(r)); //if so, apply the rule's //effect to this pixel } } } } I'm pretty sure that the Rules class and the Image class you'd have to make yourself, but they shouldn't be too difficult to make. Though I would like to point out that I am assuming that you wish to do this programmatically, such that the image is either saved automatically when the user is done or when the user tells the applet to save it.
type: Answer
has comment: http://stackoverflow.com/comment/36082187
answers question: http://stackoverflow.com/q/23504482
score: 0

http://stackoverflow.com/q/23472251
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/23472273
possible better answer: http://stackoverflow.com/a/23472308
has body: Suppose if i have this string Result="INDIA,,USA,SA,NA,,PAK"; from this Result string how can i remove , (cComma) symbol if i have more than one comma i need to replace with sigle comma.How can i do this? expected Result: "INDIA,USA,SA,NA,PAK";
has answer: http://stackoverflow.com/a/23472284
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/23472273
has comment: http://stackoverflow.com/comment/35986781
downvote count: 0
tagged with: string
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35986821
has title: Remove extra comma in comma-delimited string
upvote count: 2
has answer: http://stackoverflow.com/a/23472308

http://stackoverflow.com/comment/36020489
type: AnswerComment
has text: Can you please share the web.xml ?
type: Comment
comment on: http://stackoverflow.com/a/23489524
score: 0

http://stackoverflow.com/q/23604880
tagged with: http://stackoverflow.com/tag/zip
type: UnansweredQuestion
tagged with: excel
has answer: http://stackoverflow.com/a/23605463
tagged with: java
type: Question
has body: I am reading db records and creating in memory XSSFWorksbook. Once this is done, I am writing this workbook to zip output stream. The zip is created properly, but xlsx file isn't generated property. In place of excel it creats folders and files like _rel, worksheets, sharedStrings, styles and workbook.xml //Read records from db and create workbook public static XSSFWorkbook buildReportDocuement(int reportIndex, List&lt;Object&gt; result) throws IOException { XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet excelSheet = workbook.createSheet(REPORT_NAME_PREFIX); setExcelHeader(excelSheet); processActivityReportData(result, excelSheet); return workbook; } //reading worksbooks into bytearray and addign to in memory zip files public static ByteArrayOutputStream zipWorkbooks( List&lt;XSSFWorkbook&gt; workbooks) throws IOException { int workBookIndex = 1; ByteArrayOutputStream byteOutputStream = null; FileOutputStream outputStream = new FileOutputStream("Reports"); ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream); ZipEntry zipEntry = null; for (XSSFWorkbook current : workbooks) { zipEntry = new ZipEntry(REPORT_PREFIX + workBookIndex + EXCEL_EXTENSION); zipOutputStream.putNextEntry(zipEntry); byteOutputStream = new ByteArrayOutputStream(); current.write(byteOutputStream); if (byteOutputStream != null) { zipEntry.setSize(byteOutputStream.size()); zipOutputStream.write(byteOutputStream.toByteArray()); zipOutputStream.closeEntry(); } } zipOutputStream.close(); return byteOutputStream; } I am not supposed to write any of the files to file system. Please guid me.
tagged with: java-io
has title: Writing in memory XSSFWorkbooks to in memory zip
score: 0
answer count: 1

http://stackoverflow.com/comment/36193732
has text: @KleberMota try executing `USE horario` and then `SELECT 1` using that database.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23582801
score: 0

http://stackoverflow.com/comment/36231350
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23602862
has text: Anything from a `RequestBuilder` to `RCP` to a `RequestFactory` would work - you need to be more specific as to your use case and exactly what you are trying to do.

http://stackoverflow.com/comment/35981141
comment on: http://stackoverflow.com/q/23469099
score: 0
type: QuestionComment
type: Comment
has text: [this](http://stackoverflow.com/a/975173/2764279) may help you

http://stackoverflow.com/comment/35955506
type: Comment
type: QuestionComment
has text: I agree, my question is a duplicate of the one listed above.
comment on: http://stackoverflow.com/q/23455141
score: 0

http://stackoverflow.com/comment/36078266
comment on: http://stackoverflow.com/a/23520690
type: AnswerComment
score: 0
type: Comment
has text: Thanks for ur answer,doing that only let me create empty xml file, but now I know what I was doing wrong, it was stupid of me trying to write an xml without specifying the annoations

http://stackoverflow.com/a/23588483
has comment: http://stackoverflow.com/comment/36209714
has comment: http://stackoverflow.com/comment/36212091
has comment: http://stackoverflow.com/comment/36310634
type: Answer
has body: UPDATE M-WaJeEh's PostDelayed() method is pretty cool - and it's not hard to adapt that code to animations either. The reason my original code didn't work was because we didn't read over the APIs carefully enough. setAlpha(int) is depreciated in favor of setImageAlpha(int) setAlpha(float), however, is not. The difference is that setAlpha(int) and setImageAlpha(int) sets the alpha on the image, not the view, and setAlpha(float) sets the alpha on the actual view. This is a important distinction because while a image is inside a view, the image itself cannot be animated. Therefore, to get it to work - it should be: b1.setAlpha(0f); b1.animate().alpha(1f).setDuration(0).setStartDelay(1000).start(); Then I tried to write it so that a view would fade out, then fade in. Turns out that AnimationSet is pretty broken and doesn't animate AlphaAnimations when you have more than one of them (either that or I'm not understanding AnimationSet properly). It's a good thing PostDelayed() solves this problem. Here's an example: MainActivity.java public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final ImageView imageView = (ImageView) findViewById(R.id.image); imageView.animate().alpha(0f).setDuration(500); imageView.postDelayed(new Runnable(){ @Override public void run() { imageView.animate().alpha(1f).setDuration(500); } }, 3000); } }); } } We can also swap out the OnClickListener to something like this to switch between transparent and opaque on a click: button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ImageView imageView = (ImageView) findViewById(R.id.image); float alpha = imageView.getAlpha(); if (alpha == 0f) { imageView.animate().alpha(1f).setDuration(500);…
upvote count: 1
has comment: http://stackoverflow.com/comment/36261524
has comment: http://stackoverflow.com/comment/36210159
score: 1
answers question: http://stackoverflow.com/q/23588090
has comment: http://stackoverflow.com/comment/36220482
has comment: http://stackoverflow.com/comment/36225891
downvote count: 0

http://stackoverflow.com/q/23557765
tagged with: android
has body: I have an application made which draws a square on the screen. The user can move the square around, increase its width and height using his/her finger (touch events) etc etc. The user is also able to add any number of squares and move them separately. The app works fine for most of the part but sometimes it crashes and gives this below error 05-09 11:32:49.488: E/AndroidRuntime(24826): FATAL EXCEPTION: main 05-09 11:32:49.488: E/AndroidRuntime(24826): Process: com.example, PID: 24826 05-09 11:32:49.488: E/AndroidRuntime(24826): java.lang.OutOfMemoryError 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.graphics.Bitmap.nativeCreate(Native Method) 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.graphics.Bitmap.createBitmap(Bitmap.java:835) 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.graphics.Bitmap.createBitmap(Bitmap.java:812) 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.graphics.Bitmap.createBitmap(Bitmap.java:779) 05-09 11:32:49.488: E/AndroidRuntime(24826): at com.example.Square.isClicked(Square.java:478) 05-09 11:32:49.488: E/AndroidRuntime(24826): at com.example.EditBubbleView$2.onTouch(EditBubbleView.java:378) 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.View.dispatchTouchEvent(View.java:7731) 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2238) 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2216) 05-09 11:32:49.488: E/AndroidRuntime(24826): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) 05-09 11:32:49.488: E/Android…
has comment: http://stackoverflow.com/comment/36147113
possible better answer: http://stackoverflow.com/a/23558022
has answer: http://stackoverflow.com/a/23557790
accepted answer: http://stackoverflow.com/a/23557790
type: AnsweredQuestion
has title: App crashes with java.lang.OutOfMemoryError in android sometimes
tagged with: java
has comment: http://stackoverflow.com/comment/36147179
type: Question
has comment: http://stackoverflow.com/comment/36147185
has comment: http://stackoverflow.com/comment/36146998
has answer: http://stackoverflow.com/a/23558022
has comment: http://stackoverflow.com/comment/36146934
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36146943
has comment: http://stackoverflow.com/comment/36147134
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/36146931

http://stackoverflow.com/a/23579608
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/23557300
accepted answer of: http://stackoverflow.com/q/23557300
has body: It might be from the org.eclipse.jetty.websocket.WebSocket package. You can find the JAR here: http://mvnrepository.com/artifact/org.eclipse.jetty/jetty-websocket/8.1.0.RC5
score: 0

http://stackoverflow.com/comment/36209701
has text: @PhilFreihofner I implemented a program that makes up melodies and plays them. The notes were played by Clips. I reused the same Clips and resetted them everytime (like they're meant to), and it sounded unconsistent and really bad. Someone suggested I don't reuse the same Clips but get new ones each time, and now it works perfectly (yeah it's odd). So it's worth a try.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23574199

http://stackoverflow.com/q/23530882
tagged with: arraylist
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23531207
has answer: http://stackoverflow.com/a/23531034
has answer: http://stackoverflow.com/a/23531207
has title: java arraylist.add overwrites with last value
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36097477
linked to: http://stackoverflow.com/q/40480
accepted answer: http://stackoverflow.com/a/23531034
type: Question
has body: have this class public class ObjetoOS { private ArrayList&lt;String&gt; atribute = new ArrayList&lt;String&gt;(); public ObjetoOS (String a){ atribute.add(a); } public ObjetoOS (ArrayList&lt;String&gt; a){ atribute = a; } which i use like this public class TablaSimbolica { private static ArrayList&lt;ObjetoOS&gt; tableOS = null; public static void addAtributos(ArrayList&lt;String&gt; newOnes){ if (tableOS == null){ tableOS = new ArrayList&lt;ObjetoOS&gt;(); for (String s : newOnes){ ObjetoOS newObj = new ObjetoOS(s); tableOS.add(newObj); } } else{ ArrayList&lt;ObjetoOS&gt; aux = new ArrayList&lt;ObjetoOS&gt;(); for (ObjetoOS os : tableOS){ ArrayList&lt;String&gt; oldOnes = new ArrayList&lt;String&gt;(); oldOnes = os.getAtributo(); for (String s : newOnes){ oldOnes.add(s); ObjetoOS newObj = new ObjetoOS(oldOnes); aux.add(newObj); newObj = null; oldOnes.remove(s); } } tableOS = aux; } } so basically: addAtributos checks if the array its empty. if it is it just adds the strings, if its not, i have to combine it with the new ones, like a cartisan product thing. when adding new strings, although im creating a new array, and a new objectOS which y turn to null after adding it, the elements overwrite with the last one. for example, if i had strings "true" "false", and i have to add "female" "male", the output is: [TRUE, Female] [TRUE, Male] [TRUE, Male] [TRUE] [TRUE] [FALSE, Female] [TRUE] [TRUE] [FALSE, Male] [FALSE, Male] i cant figure out where im missing the point here. it gives me an error if i erase the static both from the ArrayList tablaOS or from the addAtributos method. EDIT: solved! i changed the object class making a new empty constructor and a method adding a string array with a for. the loop it ended up being for (String s : newOnes){ oldOnes.add(s); ObjetoOS nuevo = new ObjetoOS(); nuevo.addAtribute(oldOnes); aux.add(nuevo); oldOnes.remove(s);
has comment: http://stackoverflow.com/comment/36097393

http://stackoverflow.com/q/23612250
type: AnsweredQuestion
answer count: 5
has answer: http://stackoverflow.com/a/45542421
score: 6
linked to: http://stackoverflow.com/q/14527797
type: Question
tagged with: video
has answer: http://stackoverflow.com/a/23655971
linked to: http://stackoverflow.com/q/12671989
accepted answer: http://stackoverflow.com/a/23655971
tagged with: java
possible better answer: http://stackoverflow.com/a/34778548
has answer: http://stackoverflow.com/a/68039563
has body: I'm on Android 4.2 and calling MediaExtractor.setDataSource, and it sometimes throws an IOException of "failed to instantiate extractor". I've found where this is thrown from the C++ implementation, but it hasn't helped. Other people with the same problem and either no answer or an answer which doesn't help me are: android.media.MediaExtractor. Anyone got this beast to work? "Failed to instantiate extractor" exception media extractor show "failed to instantiate extractor" Failed to instantiate mediaextractor when using setDataSource() In a desperate attempt to figure this out I've written the smallest little app I could which demonstrates it: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public boolean doStuff(View view) { File f = getExternalFilesDir(null); File[] files = f.listFiles(); for (File file : files) { if (file.isFile()) { Log.e("Andy", "trying file [" + file.getName() + "]"); startExtractor(file); } } return true; } private void startExtractor(File f) { MediaExtractor extractor = new MediaExtractor(); try { extractor.setDataSource(f.getAbsolutePath()); } catch (IOException e) { Log.e("Andy", "splat " + e.getMessage()); } extractor.release(); } } The activity for this app has a single button, which calls "doStuff". The output looks like this: 05-12 15:27:42.639: E/Andy(18757): trying file [aaitn.mp4] 05-12 15:27:42.689: E/Andy(18757): splat Failed to instantiate extractor. 05-12 15:27:42.689: E/Andy(18757): trying file [unusual aspect.mp4] 05-12 15:27:42.709: E/Andy(18757): trying file [test.mp4] 05-12 15:27:55.039: E/Andy(18757): trying file [aaitn.mp4] 05-12 15:27:55.119: E/Andy(18757): trying file [unusual aspect.mp4] 05-12 15…
downvote count: 0
has comment: http://stackoverflow.com/comment/36252204
has title: MediaExtractor.setDataSource throws IOException "failed to instantiate extractor"
linked to: http://stackoverflow.com/q/17398111
has comment: http://stackoverflow.com/comment/41111338
has comment: http://stackoverflow.com/comment/36276080
tagged with: android
has answer: http://stackoverflow.com/a/34778548
tagged with: android-mediacodec
upvote count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/39055578

http://stackoverflow.com/comment/36007547
type: Comment
comment on: http://stackoverflow.com/a/23482933
has text: I need to separate variables for every animation and I don't see any other option.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36071230
comment on: http://stackoverflow.com/a/23513440
score: 1
type: AnswerComment
has text: You can use MongoDB management tool to see your database. I use it http://robomongo.org/
type: Comment

http://stackoverflow.com/a/23478867
has comment: http://stackoverflow.com/comment/36001067
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/36000367
has comment: http://stackoverflow.com/comment/35999622
has comment: http://stackoverflow.com/comment/35999893
has comment: http://stackoverflow.com/comment/35999781
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23478748
has comment: http://stackoverflow.com/comment/36000441
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23478748
has comment: http://stackoverflow.com/comment/35999735
has comment: http://stackoverflow.com/comment/35999814
type: Answer
has body: If you want to count the comparations, you should increment compsNo just after or before every line that contains an invocation to compareTo. In your code, you have two invocations to compareTo, and only one compsNo++.
has comment: http://stackoverflow.com/comment/35999935

http://stackoverflow.com/a/23606491
answers question: http://stackoverflow.com/q/23606008
type: Answer
has comment: http://stackoverflow.com/comment/36238715
has comment: http://stackoverflow.com/comment/36238035
has body: Define both toast_x and toast_y in tag of their own. 10 100 Now come to your java class and read them as strings and then convert them to integers. String xcostr = getString(R.string.toast_x); int xco = Integer.valueOf(xcostr); String ycostr = getString(R.string.toast_y); int yco = Integer.valueOf(ycostr);
score: 0

primefaces
tags question: http://stackoverflow.com/q/23610705
tags question: http://stackoverflow.com/q/23475884
tags question: http://stackoverflow.com/q/23484152
tags question: http://stackoverflow.com/q/23614941
tags question: http://stackoverflow.com/q/23611995
tags question: http://stackoverflow.com/q/23541330
tag name: primefaces
tags question: http://stackoverflow.com/q/23547208
tags question: http://stackoverflow.com/q/23504044
tags question: http://stackoverflow.com/q/23600568
tags question: http://stackoverflow.com/q/23489342
tags question: http://stackoverflow.com/q/23481970
type: Tag

http://stackoverflow.com/a/23555260
type: Answer
answers question: http://stackoverflow.com/q/23552845
has comment: http://stackoverflow.com/comment/49821399
has body: I have successfully applied mappings to an Elasticsearch index using the Java API like the following: XContentBuilder mapping = jsonBuilder() .startObject() .startObject("general") .startObject("properties") .startObject("message") .field("type", "string") .field("index", "not_analyzed") .endObject() .startObject("source") .field("type","string") .endObject() .endObject() .endObject() .endObject(); PutMappingResponse putMappingResponse = client.admin().indices() .preparePutMapping("test") .setType("general") .setSource(mapping) .execute().actionGet(); Hope this helps.
score: 20
upvote count: 20
downvote count: 0
has comment: http://stackoverflow.com/comment/44320856

http://stackoverflow.com/comment/35976197
has text: its depends on version.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23465287
type: Comment

http://stackoverflow.com/q/23577194
type: Question
has answer: http://stackoverflow.com/a/23577334
answer count: 2
upvote count: 1
has body: When you write your java code, you also write corresponding Javadoc (especially those that are right above each method). I am wondering if there is a way to get the Javadoc contents print out in the console. My reason for doing this is that I don't want to write help documentation twice. I've already written a good amount of information in my Javadoc, and I am really reluctant to write the same thing separately in another place. I don't think I've found anything on Google that is related to this question, but I wonder if anyone knows how to do so. I am thinking use this approach: use a scanner and read my java source code, and when it reads /**, it will start adding contents followed up to a string, and will stop adding content if it sees a */. Do you think this will be a good approach to implement? Why or why not?
tagged with: java
tagged with: javadoc
type: UnansweredQuestion
has title: Is it possible to print Javadoc in console? Or export Javadoc contents to a string?
downvote count: 0
score: 1
tagged with: console
favorite count: 0
has answer: http://stackoverflow.com/a/23577248

http://stackoverflow.com/comment/36236905
type: Comment
score: 1
has text: By the time of deployment, those resources will likely become an [tag:embedded-resource]. That being the case, the resource must be accessed by `URL` instead of `File`. See the [info page](http://stackoverflow.com/tags/embedded-resource/info) for the tag, for a way to form an `URL`.
comment on: http://stackoverflow.com/q/23605840
type: QuestionComment

http://stackoverflow.com/comment/36048158
has text: Thank you for answers. Unfortunatelly that is not what I need. I want to dim display based on events happening in my service. AFAIK, I can do this only by modifying the properties of the foreground app's window. Is there some solution ?
score: 0
comment on: http://stackoverflow.com/q/23504217
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23489635
downvote count: 0
type: Answer
has body: The second statement treated io as class, not package. That's why the error. You should read it carefully and use Java Naming conventions to properly name your classes. The correct usage of import statement if you want to use java.io package classes import java.io.*;
upvote count: 1
answers question: http://stackoverflow.com/q/23489568
score: 1

http://stackoverflow.com/q/23463830
has answer: http://stackoverflow.com/a/23470729
tagged with: image
type: Question
has title: Set Max Cache Size on Disk Android Universal Image Loader
upvote count: 1
tagged with: android
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23470729
type: AnsweredQuestion
has body: I am using Android Universal Image Loader in my project. I have 2500+ images in my project which need more than 80 MB disk space. Is there any way I can limit Disk cache size? https://github.com/nostra13/Android-Universal-Image-Loader
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/36417302
has text: if you look more closely you can see that it indeed contains a fault: <a:Action s:mustUnderstand="1" u:Id="_4"> http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/RetrieveMultipleOrganizationServiceFaultFault </a:Action>
comment on: http://stackoverflow.com/a/23663732
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35985077
comment on: http://stackoverflow.com/a/23470436
type: Comment
has text: I am not sure what you mean by adding GMT time. can you provide an usecase?
score: 0
type: AnswerComment

http://stackoverflow.com/q/23481887
has comment: http://stackoverflow.com/comment/36006282
accepted answer: http://stackoverflow.com/a/23488500
tagged with: filter
answer count: 3
has comment: http://stackoverflow.com/comment/36005760
tagged with: user-interface
downvote count: 0
favorite count: 0
has title: JFileChooser filtering files by name as you type
has comment: http://stackoverflow.com/comment/36015213
has answer: http://stackoverflow.com/a/23523421
score: 2
has body: I have figured out how to filter by file-type, but I cannot figure out how to filter out files as I type on my keyboard in the file-name textfield. If I have 1000 files in my directory and two of them start with the letter q then I expect that when I type the word q in my JFileChooser it will filter out all files that do not start with q and this should continue as I type and the best possible match should be selected. Is there no exemplar for this? It seems like every JFileChooser question and tutorial out there is only concerned with filtering by file-type and not by name.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23482685
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/23482685
tagged with: swing
tagged with: jfilechooser
type: Question
has answer: http://stackoverflow.com/a/23488500
has comment: http://stackoverflow.com/comment/36013589

http://stackoverflow.com/a/23520481
score: 11
has body: Spring will first create the bean instance, then inject the beans. You're trying to access to the injected bean when the current bean is created, thus the bean will be null. That's default behavior. If you want/need to execute any logic after creating the bean, use @PostConstruct decorated method, which is invoked after the bean has been created and all the dependencies injected. Here's a sample: @Service public class Searcher extends Thread implements ISearcher { @Autowired protected ISessionProvider sessionProvider; public Searcher() { //nothing should be here... } @PostConstruct public void init() { sessionProvider.doSomeStuff(); } }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36076955
type: Answer
upvote count: 11
accepted answer of: http://stackoverflow.com/q/23520008
answers question: http://stackoverflow.com/q/23520008
downvote count: 0

http://stackoverflow.com/a/23542256
answers question: http://stackoverflow.com/q/23541128
score: 0
type: AcceptedAnswer
type: Answer
has body: The correct way to write if else condition is as below if (condition1 &amp;&amp; condition2) { } else if (condition3 &amp;&amp; condition4) { } else { } And if my assumtions are correct below s how your code should be written as following; int x = Integer.parseInt(jTextField1.getText().toString()); // getText needs to be converted to String before parsing it to int. if (x&gt;=120 &amp;&amp; x&lt;200) { //in the if condition you need two &amp;&amp; not one &amp; JOptionPane.showMessageDialog(null, "select drum : PPJ upwards");//semicolon should be here }//putting semicolon here is wrong else if (x&gt;=230 &amp;&amp; x&lt;=300)//putting semicolon here is also wrong { JOptionPane.showMessageDialog(null,"select drum :RRf Upwards"); } else { JOptionPane.showMessageDialog(null,"incorrect entry"); }
accepted answer of: http://stackoverflow.com/q/23541128

http://stackoverflow.com/comment/36090432
score: 0
type: Comment
type: QuestionComment
has text: Java code, not like C, must live inside a class, without `public class CLASS-NAME { .. Code here .. }` it just won't compile.
comment on: http://stackoverflow.com/q/23526949

http://stackoverflow.com/a/23518161
type: Answer
answers question: http://stackoverflow.com/q/23517572
has body: It seems like you are trying to parse an empty String as a double. You should check with: if (edittext.getText().length &gt; 0)
score: 0

http://stackoverflow.com/comment/36200501
score: 0
type: AnswerComment
type: Comment
has text: @RymanHolmes, so that caused a downvote? :) Right?
comment on: http://stackoverflow.com/a/23585014

http://stackoverflow.com/comment/36087467
type: QuestionComment
comment on: http://stackoverflow.com/q/23467346
has text: Please can your share your code to analyze it?
score: 0
type: Comment

http://stackoverflow.com/a/23580619
has comment: http://stackoverflow.com/comment/36190265
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36190190
accepted answer of: http://stackoverflow.com/q/23580517
has comment: http://stackoverflow.com/comment/36189796
has comment: http://stackoverflow.com/comment/36190432
has comment: http://stackoverflow.com/comment/36189903
answers question: http://stackoverflow.com/q/23580517
type: Answer
has body: You didn't post the code of the class VariableSpace , so I assume its a kinde of a map which holds the value for each variable. In the constructor of Variable you are trying to parse the variable x name as an int which fails with a NumberFormatException because x does not represent an integer. What you want to do is actually retrieve the value from VariablStore int value = variablStore.getValue(variable); For that the instance of VariablStore needs to be accessible from the class Varaiable. At the moment it is local in the main method. EDIT After seeing the whole code, here are the changes you need: ILOAD class /** * ILOAD instruction gets the valiable name for later retrieving of the value * in {@link ILOAD#execute(Storage)} * * @param variable */ public ILOAD(final String variable) { this.variable = variable; } /** * retrieve the variable value using its name from the storage and push it on the stack */ public void execute(Storage storage) { storage.getStack().push(storage.getVariables().load(variable)); } Variable class String variable; /** * Constructor for objects of class Variable */ public Variable(final String variable) { this.variable = variable; } /** * Create a ILOAD instance and pass it the variable name. * ILOAD extends Instruction and overrides the method {@link Instruction#execute(Storage)} * which get as argument the {@link Storage} class and from which the value can be retrieved. */ public void generateCode(final Program program) { program.append(new ILOAD(variable)); }
has comment: http://stackoverflow.com/comment/36190143
has comment: http://stackoverflow.com/comment/36190109
downvote count: 0
has comment: http://stackoverflow.com/comment/36190415
has comment: http://stackoverflow.com/comment/36190218
has comment: http://stackoverflow.com/comment/36190014
has comment: http://stackoverflow.com/comment/36190353
has comment: http://stackoverflow.com/comment/36189679
score: 1
has comment: http://stackoverflow.com/comment/36189958

http://stackoverflow.com/comment/35965183
has text: Yes. Will add folder structure to original post.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23460060

http://stackoverflow.com/comment/36002016
comment on: http://stackoverflow.com/q/23479755
has text: @ArthurJulião:The link you have provided have nothing to do with enums it only concern about static initialization block.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23557136
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/36145889
has answer: http://stackoverflow.com/a/23558038
tagged with: java
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/5621338
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36163934
accepted answer: http://stackoverflow.com/a/23558038
score: 0
answer count: 2
tagged with: ms-access
has title: combobox not getting displayed
has answer: http://stackoverflow.com/a/23558256
has comment: http://stackoverflow.com/comment/36145953
has comment: http://stackoverflow.com/comment/36145943
has body: So, my requirement was to Display Records From Database Using JTable in Java. I referred the this link. But the error is that when I run it in Eclipse, I can't see the combobox as it should ideally appear. How to fix it ? import java.awt.*; import java.awt.event.*; import java.sql.*; import java.util.Vector; import javax.swing.*; import javax.swing.table.DefaultTableModel; public class DisplayEmpData extends JFrame implements ActionListener { JFrame frame1; JLabel l0, l1, l2; JComboBox c1; JButton b1; Connection con; ResultSet rs, rs1; Statement st, st1; PreparedStatement pst; String ids; static JTable table; String[] columnNames = {"User name", "Email", "Password", "Country"}; String from; DisplayEmpData() { l0 = new JLabel("Fatching Employee Information"); l0.setForeground(Color.red); l0.setFont(new Font("Serif", Font.BOLD, 20)); l1 = new JLabel("Select name"); b1 = new JButton("submit"); l0.setBounds(100, 50, 350, 40); l1.setBounds(75, 110, 75, 20); b1.setBounds(150, 150, 150, 20); b1.addActionListener(this); setTitle("Fetching Student Info From DataBase"); setLayout(null); setVisible(true); setSize(500, 500); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); add(l0); add(l1);; add(b1); try { String url="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + "C:\\users\\ppreeti\\emp_details.accdb"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection(url,"",""); /*con = DriverManager.getConnection("jdbc:oracle:thin:@mcndesktop07:1521:xe", "sandeep", "welcome");*/ st = con.createStatement(); rs = st.executeQuery("select uname from emp"); Vector v = new Vector(); while (rs.next()) { ids = rs.getString(1); v.add(ids); } c1 = new JComboBox(v); c1.setBounds(150, 110, 150, 20); add(c1); st.close(); rs.close(); } catch (Exception e) { } } public void actionPerformed(ActionEvent ae) { if (ae.getSource() == b1) { showTableData(); } } public void showTableData() { frame1 = new JFrame("Database Search Result"); frame1.setDefault…
possible better answer: http://stackoverflow.com/a/23558256

http://stackoverflow.com/q/23517937
has title: Avoiding complete path of folder and Image not been shown in browser
type: Question
has comment: http://stackoverflow.com/comment/36084598
has comment: http://stackoverflow.com/comment/36117539
has body: I am making a web application using jsp and servlets .But am facing two problem that i have no ides how to remove : Problem 1 : I am creating new folders in my WEB-INF folder .But what i want is that instead of giving full paths .I just provide relevant path Like : File tempfilesstore = new File("C:\\Users\\admin\\Desktop\\SharedCrpto1\\web\\RetrievedFiles\\"+fileid+"-"+personname); if(!tempfilesstore.exists()) tempfilesstore.mkdirs(); Can this full path be avoided as only path from web folder of the application is required. Problem 2 : I keep a image in this folder by performing some operation on original image being browsed by the client on browser. Now when i see the image in folder then it is present their But if i try to see the same image in browser it does not display the image .When i refresh my page for 3-4 times than sometimes it get displayed and sometimes after manually opening it by going to specified location.What can be reason for it ?Please help. Here is how am trying to get image on browser : &lt;img src="RetrievedFiles/&lt;%=path%&gt;/&lt;%=sharedfilee%&gt;" alt="Image Preview Not Availablee" width="300" height="300" /&gt; Here , String path=presentfileid+"-"+personname; String sharedfilee=rs.getString("FILE_NAME");
score: 0
answer count: 1
tagged with: jakarta-ee
tagged with: java
type: UnansweredQuestion
tagged with: servlets
has answer: http://stackoverflow.com/a/23550257
tagged with: jsp

http://stackoverflow.com/comment/36116523
comment on: http://stackoverflow.com/q/23541565
has text: Did you check this: http://stackoverflow.com/questions/10963765/system-console-nullpointerexception
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36177197
type: QuestionComment
has text: "was built without gradle for Android Studio" -- AFAIK, all Android Studio builds go through Gradle.
score: 0
comment on: http://stackoverflow.com/q/23573791
type: Comment

http://stackoverflow.com/q/23535196
has title: Does JasperReports allow dynamic font color?
type: Question
tagged with: jasper-reports
has body: I have in DB a textfield with HEX color property, for example: **Name, Color** John Doe, #FF0000 Albert Smith, #AF0FBA How can i pass these HEX values through jrxml to render font color properly? Conditional styling didn't match, because i have over 16 millions of colors.
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/23560496
downvote count: 0
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23560496
score: 1
upvote count: 1

http://stackoverflow.com/a/23463504
score: 2
upvote count: 2
has body: Do I have to add a mouse listener to find out what panel was clicked and then determine the button was pressed? No, don't use mouse listeners on buttons. Your ActionListener implementation is fine and getSource will give you the button which was pressed. To set the label to the text of the button, use jl.setText(src.getText()) inside actionPerformed. If you want the panel which the button is in, use getParent() of the button.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23463212

http://stackoverflow.com/q/23530372
tagged with: compilation
has answer: http://stackoverflow.com/a/23530396
accepted answer: http://stackoverflow.com/a/23530552
has answer: http://stackoverflow.com/a/23530404
score: 0
tagged with: unreachable-statement
possible better answer: http://stackoverflow.com/a/23530396
has comment: http://stackoverflow.com/comment/36096389
has answer: http://stackoverflow.com/a/23530513
has title: should a return statement be the last instruction within a code block?
favorite count: 0
has comment: http://stackoverflow.com/comment/36096403
tagged with: return
has body: I really need help understanding what does an unreachable statement actually means in Java. I have the following below and when I try to compile I get an unreachable statement error. I have looked at some of the similar questions about unreachable statements here on Stackoverflow, but none answer my question. I want to know based on how the return statements work why this version does not compile. public int refundBalance() { return balance; balance = 0; } I am asking this because similar questions in here don't give me an answer. I am guessing that return should be the last statement within a block of code, but I am not knowledgeable enough in Java to be certain about my conclusion. So, any clarification would be greatly appreciated.
answer count: 5
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23530552
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23530482

http://stackoverflow.com/a/23539368
type: Answer
answers question: http://stackoverflow.com/q/23538861
score: 0
has body: Something along these lines? int limit = 10; // Tokenize words String s1="This is my world. This has to be broken."; final String[] words = s1.split( " " ); // Apply word-wrapping final StringBuilder sb = new StringBuilder(); for( String word : words ) { if( sb.length() + word.length() > limit ) { // Next word wraps System.out.println( sb ); sb.setLength( 0 ); } else { // Otherwise add to current line if( sb.length() > 0 ) sb.append( ' ' ); } sb.append( word ); } // Handle final line System.out.println( sb );

http://stackoverflow.com/comment/36185347
comment on: http://stackoverflow.com/q/23578190
type: Comment
has text: Sorting 1000 integer elements is a piece of cake today. It'll happen in a tiny fraction of a second. The overhead of starting a new thread is probably about as expensive. Try it with 100 mio. elements.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35979571
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23462525
has text: so what about stocking lastUpdateDate and comparingto it, or you'll have to make the all update process async
type: AnswerComment

http://stackoverflow.com/q/23540869
has comment: http://stackoverflow.com/comment/36149607
has title: CXF is not generating enum mapping?
type: Question
has comment: http://stackoverflow.com/comment/36140763
answer count: 2
has comment: http://stackoverflow.com/comment/36115035
downvote count: 0
has comment: http://stackoverflow.com/comment/36148022
tagged with: wsdl
has comment: http://stackoverflow.com/comment/36117818
has comment: http://stackoverflow.com/comment/36150133
favorite count: 0
has comment: http://stackoverflow.com/comment/36115273
has comment: http://stackoverflow.com/comment/36150613
has body: I'm generating classes with CXF (wsdl2java) out of wsdl files, but one enum is instead mapped to a String only. If I open the generated class, this is the wsdl snippet: <enumeration value="AAA"/> <enumeration value="VVV"/> Why is the result a String, and not an Enum? This is the auto generated result: private String type; public String getType() { return type; } public void setType(String value) { this.type = value; } Update: custom binding file: <jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" jaxb:version="2.1"> <jaxb:bindings> <jaxb:bindings node="//xs:attribute[@name='Type']/xs:simpleType"> <jaxb:typesafeEnumClass ref="TestEnum" /> </jaxb:bindings> </jaxb:bindings> </jaxb:bindings>
type: UnansweredQuestion
tagged with: web-services
has comment: http://stackoverflow.com/comment/36124994
has answer: http://stackoverflow.com/a/41935803
score: 3
tagged with: enums
has comment: http://stackoverflow.com/comment/36150708
tagged with: cxf
has answer: http://stackoverflow.com/a/38030359
upvote count: 3
tagged with: java

http://stackoverflow.com/a/76971521
type: Answer
answers question: http://stackoverflow.com/q/23532966
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/139703179
has body: For me, simply restarting Netbeans worked. The paths were regenerated, with the correct value.
downvote count: 0

http://stackoverflow.com/comment/36228112
type: AnswerComment
comment on: http://stackoverflow.com/a/23601117
has text: Remove `;` at the end of `TABLE_CREATE`
type: Comment
score: 0

http://stackoverflow.com/q/23583951
tagged with: java
has answer: http://stackoverflow.com/a/25974437
type: Question
has title: how return array of image from rest web services
has answer: http://stackoverflow.com/a/32709040
score: 0
answer count: 2
has body: iam fresh in android,, want to return array of image from rest web services ,, i found this @GET @Produces("image/jpg") public Response getFullImage() throws IOException { File[]myFile = new File[2]; myFile[0]=new File("C:\\Program Files\\test.jpg"); myFile[1]=new File("C:\\Program Files\\test2.jpg"); BufferedImage image =ImageIO.read(myFile[0]) ; image =ImageIO.read(myFile[1]) ; ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write(image, "png", baos); byte[] imageData = baos.toByteArray(); return Response.ok(new ByteArrayInputStream(imageData)).build(); } but how store array of image into bufferimage in way which can recive in client side and separete between image thnx all
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36211156

http://stackoverflow.com/comment/36057682
score: 0
type: Comment
type: QuestionComment
has text: `compareTo` wants you, according to the documentation of `Comparable`, to *return* an int describing the ternary comparison result (less, equal, or greater than), don't confuse that.
comment on: http://stackoverflow.com/q/23509964

http://stackoverflow.com/a/23597949
answers question: http://stackoverflow.com/q/23589289
has comment: http://stackoverflow.com/comment/36308480
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
has body: Try to use parameters in all 3 cases. Then it should be more consistent. WHERE t.name =~ {regexp} params: {regexp: "(?i).*\\baaaaaaaa\\b.*"} It is the different escaping that happens when you use JSON vs. literal strings in Java, and the Cypher parser so either 2 or 3 different parsers at work each of them having its own understanding of escaping. In plain Java, afaik it is two backspaces for regexps.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23589289

http://stackoverflow.com/comment/36103857
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23534142
has text: @JBNizet - Thanks! very insightful your comments. I really appreciate that.
score: 0

http://stackoverflow.com/a/33743195
downvote count: 0
score: 23
upvote count: 23
answers question: http://stackoverflow.com/q/23538349
has body: One more thing. Look in pom.xml, tag &lt;packaging&gt;. If it sets in pom, Maven shouldn`t create class-files for you. Change it for appropriate package - jar, war ...
type: Answer

http://stackoverflow.com/a/23527195
answers question: http://stackoverflow.com/q/23526990
has body: There are a couple of things you need to fix here. As veteran android folks will tell you, changing views of fragment from activity is not a good thing to do. Think of activity as the 'mother' of fragments it creates. If the mother starts doing the homework of its children then what's the children gonna do then? Fragment's views should be handled from inside the fragment only not outside. Further more since the fragment may not be visible in screen so the android kernel would decide to destroy it and GC it. If you keep on holding references to its view then its gonna be a waste of memory and resources. But if you still wanna go that way then: Make sure your fragment is created and bound to the parent using a fragment transaction from a fragment manger. Save a reference to the fragment object in your activity object. make sure that the transaction is committed. This action will make android call the oCreateView of fragment and there you can inflate the fragment's main view. Immediately save the reference to the main fragment view in a class property variable. Subsequently later if you want to access the view of the fragment in your activity, call the getter for your view on the fragment's object in the activity and you are done. But i still urge you to let fragments do their own view handling and not to mix view handling between activity and fragments and also not in between two of more fragments. that's a big design no no.
accepted answer of: http://stackoverflow.com/q/23526990
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36091755
has comment: http://stackoverflow.com/comment/36090471
has comment: http://stackoverflow.com/comment/36090682
type: Answer
score: 1

http://stackoverflow.com/q/23534705
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24005441
has body: I am working on an android app. I want to update boot loader in IOIO-OTG board . So how to update boot loader?..So what is the procedure to update??
tagged with: java
has title: How to update boot loader in IOIO-OTG board
type: Question
answer count: 2
downvote count: 2
score: -2
tagged with: ioio
has answer: http://stackoverflow.com/a/24991680
tagged with: android

http://stackoverflow.com/comment/36233309
type: Comment
comment on: http://stackoverflow.com/a/23602398
has text: @Alivesi Don't be shy to ask for help after you tried your best. I edited my answer.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23479456
has comment: http://stackoverflow.com/comment/36000861
score: -2
tagged with: recursion
has comment: http://stackoverflow.com/comment/36000805
tagged with: linked-list
tagged with: java
downvote count: 2
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/36005758
has comment: http://stackoverflow.com/comment/36000767
has title: Recursive toString()
has comment: http://stackoverflow.com/comment/36000864
upvote count: 0
has answer: http://stackoverflow.com/a/23479525
answer count: 1
has body: I have a doubleLinkedList and need to implement a recursive toString() method without parameters. Here is what I have, and it throws a NullPointerException //Print forwards public String recursiveToString(){ return first.rTS(); } //Print backwards public String recursiveBackwardsString(){ return last.rBS(); } //Recursive helper in the node class public String rBS(){ if (this!=null) return info+" "+back.rBS(); return ""; } //Recursive helper in the node class public String rTS(){ if (this!=null) return info+" "+next.rTS(); return ""; }
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/23592336
score: 0
has answer: http://stackoverflow.com/a/23592362
answer count: 3
tagged with: button
has body: So, I have a Class called Math, that runs a small piece of code, and another class called GUI that holds a button and a text box. I need to make it so pressing the button runs the Math class. In the Math Class: public class Math { public static int com; public static void main (String[] args) { com = GUI.num1 * GUI.num2; GUI.TextBox3.setText(com); } } In the GUI class (It's jPanel, by the way): public class GUI extends javax.swing.JFrame { public static int num1; public static int num2; public GUI() { initComponents(); } private void Button1ActionPerformed(java.awt.event.ActionEvent evt) { num1 = Integer.parseInt(TextBox1.getText()); num1 = Integer.parseInt(TexBox2.getText()); Math.main (Sring[] );//This is the part the doesn't work } If you could help, that would be great, thanks!
has answer: http://stackoverflow.com/a/23592451
accepted answer: http://stackoverflow.com/a/23592451
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23592362
tagged with: java
has answer: http://stackoverflow.com/a/23593104
has title: jPanel button triggering another class in java
type: Question
tagged with: jpanel

http://stackoverflow.com/q/23479345
favorite count: 0
possible better answer: http://stackoverflow.com/a/23481020
has body: Currently my class looks like @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {DemographicAttributesManager.class}) public class DemographicAttributesManagerTest { @Autowired private DemographicAttributesManager demographicAttributesManager; @Test public void testGetGenders() throws Exception { final Map&lt;Integer, String&gt; genders = demographicAttributesManager.getGenders(); assertEquals(3, genders.size()); } } What I don't like? In every Test class I have to include @RunWith(SpringJUnit4ClassRunner.class) Is there a way to default it? so that every test runs with that class? I have to type @ContextConfiguration(loader = AnnotationConfigContextLoader.class, classes = {DemographicAttributesManager.class}) telling which classes to include and that it is annotation driven test. Is there a way to set default to package scanning for classes and default that I do not have to put AnnotationConfigContextLoader? Thanks
tagged with: spring
has answer: http://stackoverflow.com/a/23501888
upvote count: 3
tagged with: java
type: Question
tagged with: spring-test
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23501888
score: 3
answer count: 2
has answer: http://stackoverflow.com/a/23481020
downvote count: 0
has title: Spring test: How to default configuration to @AnnotationDriven?

http://stackoverflow.com/comment/36172674
has text: I am sure I am the one not getting something, and in the future I will not understand how that happened, but at the moment I am puzzled. These are the facts of the project that I am working on: 1. It is for some reason unknown to me working. 2. There is a PageModel object produced by the method loadPageModel, that is passed to the view via the method page() of the controller. 3. Yet the PageModel object is referenced nowhere in the definition of the method page().
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23565995

http://stackoverflow.com/q/23500790
has answer: http://stackoverflow.com/a/23501180
has comment: http://stackoverflow.com/comment/36060555
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36040735
type: Question
linked to: http://stackoverflow.com/q/5789685
has comment: http://stackoverflow.com/comment/36040749
has comment: http://stackoverflow.com/comment/36043880
has body: I want to cast an string to key type. BufferedReader br = new BufferedReader(new FileReader(publicKeyFile)); String publicKey = br.readLine();//(Key) keyIn.readObject(); br.close(); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.WRAP_MODE, publicKey); cipher.init(Cipher.WRAP_MODE, publicKey); needs publickey of a type with the interface Key. So how do I cast string to key?
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/12292389
has title: How to cast String to Key in java
has comment: http://stackoverflow.com/comment/36040799
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36040738
tagged with: cryptography

http://stackoverflow.com/comment/36074752
comment on: http://stackoverflow.com/q/23515095
score: 0
has text: JS or not JS what difference it makes? Build url with S2 tags and use it in ajax call.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36080802
type: Comment
comment on: http://stackoverflow.com/q/23522390
score: 0
has text: What do you mean you tried to return those types and weren't able to? What data type do you want to return?
type: QuestionComment

http://stackoverflow.com/comment/36169895
type: Comment
has text: Okey. Got your point :) thank you. But when i installed JAVA 6 on the application server, i didn't explicitly set its path to the PATH, but i see it is set there. Does it automatically happen?
comment on: http://stackoverflow.com/a/23525089
score: 0
type: AnswerComment

http://stackoverflow.com/a/23550963
downvote count: 0
has body: I finally get it. // This loop runs twice total for (int i=0; i &lt; nodes.getLength(); i++) { ... if (node.getNodeType() == Node.ELEMENT_NODE) { ... if (update_type.equals("JGRP")) { ... // This loop runs twice total for (int z=0; z &lt; cNodes.getLength(); z++) { ... if (cNode.getNodeType() == Node.ELEMENT_NODE) { ... System.out.println(g_name); } } } } } If your outer loop runs twice, that's 4 total times your inner loop runs. So it prints 4 total elements, each twice.
accepted answer of: http://stackoverflow.com/q/23550154
type: Answer
answers question: http://stackoverflow.com/q/23550154
score: 2
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/36115668
type: Comment
type: QuestionComment
has text: hmm cant it be created.?
score: 0
comment on: http://stackoverflow.com/q/23541008

http://stackoverflow.com/q/23523280
tagged with: android
has comment: http://stackoverflow.com/comment/36082486
has comment: http://stackoverflow.com/comment/36085057
answer count: 0
upvote count: 2
tagged with: java
has title: How do I do Android unit testing in IntelliJ?
has comment: http://stackoverflow.com/comment/36082402
has comment: http://stackoverflow.com/comment/36084780
tagged with: unit-testing
type: Question
has body: I am new to Android. I tried googling for a solution for how to do Unit testing for Android in IntelliJ and found http://confluence.jetbrains.com/display/IntelliJIDEA/Creating+Unit+Tests. What I am trying to achieve is I have begun to write a simple Twitter Client and would like to write some unit tests for it Initially when trying just to write a test class within src I got "Java.lang.RuntimeException - Stub!", and understand from looking at another SO post that this is because you cannot run a Unit test within the Android application itself (i.e. you need to create a test module). However, when I open IntelliJ 13 I can't see the option to create a test module. All I see if I go to New Project - Android is: Gradle: Android Module, Application Module, Empty Module, Library Module with no option to create a test module. Am I best off just choosing Empty Module and trying to create a test module from there?
score: 2
has comment: http://stackoverflow.com/comment/36084762
tagged with: intellij-idea
downvote count: 0
favorite count: 0
type: UnansweredQuestion

opennlp
type: Tag
tags question: http://stackoverflow.com/q/23511243
tags question: http://stackoverflow.com/q/23526638
tag name: opennlp

http://stackoverflow.com/comment/36139933
type: QuestionComment
comment on: http://stackoverflow.com/q/23487257
score: 0
has text: Hi apanizo, sorry I ignored your comment. I did not understand what it meant. I will investigate this further. Regards, Glyn.
type: Comment

http://stackoverflow.com/q/23567410
accepted answer: http://stackoverflow.com/a/23581449
favorite count: 0
tagged with: testng
has comment: http://stackoverflow.com/comment/36186380
type: AnsweredQuestion
downvote count: 0
has title: testng "groups" testing fails
has answer: http://stackoverflow.com/a/38389786
score: 1
tagged with: java
has body: i have a class Calc which implements two methods add(int a, int b) and div(int a, int b) and a test class of this class: import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class CalcTest { Calc c; @BeforeClass public void init() { c = new Calc(); } @Test(groups = "t1") public void addTest() { System.out.println("Testing add() method"); Assert.assertEquals(c.add(10, 5), 15); } @Test public void divTest() { System.out.println("Testing div() method"); Assert.assertEquals(c.div(10, 5), 2, 0); } @AfterClass public void free() { c = null; } } and i have a testing.xml file to suite tests: <include name="t1" /> <class name="CalcTest" /> I just had a first look at the groups in testng so i would like to try it, butif i run testing.xml file i'm getting nullPointerException at line: Assert.assertEquals(c.add(10, 5), 15); -if i remove the "groups" annotation from the test method it works fine, thanks
type: Question
has comment: http://stackoverflow.com/comment/36173842
answer count: 2
upvote count: 1
tagged with: maven-3
possible better answer: http://stackoverflow.com/a/38389786
has answer: http://stackoverflow.com/a/23581449

applet
tags question: http://stackoverflow.com/q/23512876
tags question: http://stackoverflow.com/q/23585107
tags question: http://stackoverflow.com/q/23539110
tags question: http://stackoverflow.com/q/23471516
tags question: http://stackoverflow.com/q/23591367
tags question: http://stackoverflow.com/q/23558313
tags question: http://stackoverflow.com/q/23563402
tags question: http://stackoverflow.com/q/23454540
tags question: http://stackoverflow.com/q/23504482
tags question: http://stackoverflow.com/q/23610454
type: Tag
tags question: http://stackoverflow.com/q/23602506
tag name: applet
tags question: http://stackoverflow.com/q/23491812
tags question: http://stackoverflow.com/q/23586941
tags question: http://stackoverflow.com/q/23581303
tags question: http://stackoverflow.com/q/23590755
tags question: http://stackoverflow.com/q/23552140
tags question: http://stackoverflow.com/q/23544033
tags question: http://stackoverflow.com/q/23568943
tags question: http://stackoverflow.com/q/23533649
tags question: http://stackoverflow.com/q/23596762
tags question: http://stackoverflow.com/q/23507473
tags question: http://stackoverflow.com/q/23609494
tags question: http://stackoverflow.com/q/23500530
tags question: http://stackoverflow.com/q/23500017
tags question: http://stackoverflow.com/q/23499077
tags question: http://stackoverflow.com/q/23504474
tags question: http://stackoverflow.com/q/23486643
tags question: http://stackoverflow.com/q/23575830
tags question: http://stackoverflow.com/q/23559006

http://stackoverflow.com/q/23531632
has comment: http://stackoverflow.com/comment/36098790
linked to: http://stackoverflow.com/q/11648696
answer count: 1
has comment: http://stackoverflow.com/comment/36098948
tagged with: jframe
has body: In my main class, I call a class that, upon instantiation, should display its JFrame window. However, that is not the case. I've had this class work before, when I ran the project through Eclipse. Now, running it through command line, it does not work :(. From my main method: PaintTitleMovie q = new PaintTitleMovie(); The Jframe class: public class PaintTitleMovie extends JPanel implements MouseListener { Image image; Font ConfettiFinal = new Font("Analog", 1, 20); // fail safe static JFrame frame = new JFrame(); public PaintTitleMovie() { image = Toolkit.getDefaultToolkit().createImage("src/Title2.gif"); try { Font Confetti = Font.createFont(Font.TRUETYPE_FONT, new File( "src/Fonts/Confetti.ttf")); ConfettiFinal = Confetti.deriveFont(1, 50); } catch (FontFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } addMouseListener(this); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); if (image != null) { g.drawImage(image, 0, 0, this); } // draw exit button g.setColor(Color.BLUE); g.fillRect(990, 50, 210, 100); g.setColor(Color.BLACK); g.fillRect(1000, 60, 190, 80); g.setColor(Color.WHITE); g.setFont(ConfettiFinal); g.drawString("Continue", 1000, 120); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { frame.add(new PaintTitleMovie()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1200, 800); frame.setUndecorated(true); frame.setLocationRelativeTo(null); frame.setVisible(true); SongTitle s = new SongTitle(); } }); } @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub int x = arg0.getX(); int y = arg0.getY(); if (x &gt;= 990 &amp;&amp; y &gt;= 50 &amp;&amp; y &lt;= 150) { this.setVisible(false); frame.dispose(); PaintMenu load = new PaintMenu(); // load paint menu } } }
has answer: http://stackoverflow.com/a/23531675
has title: JPanel Not Opening When Instantiated From Other Class
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: jpanel
type: Question
accepted answer: http://stackoverflow.com/a/23531675

http://stackoverflow.com/a/23600067
score: 4
accepted answer of: http://stackoverflow.com/q/23599956
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23599956
has body: This answer helped me getting it right How to really read text file from classpath in Java I changed my code then to inventoryPriceDetails = mapper.readValue(getClass().getResourceAsStream("/getInventoryAndPriceResponse.json"), new TypeReference&lt;List&lt;InventoryPriceDetail&gt;&gt;() {});
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/23540333
has comment: http://stackoverflow.com/comment/36115059
answers question: http://stackoverflow.com/q/23540169
has body: Try these: look for errors in your layout XML-files clean your project
score: 0
has comment: http://stackoverflow.com/comment/36114153
type: Answer

layout-inflater
tags question: http://stackoverflow.com/q/23569225
type: Tag
tag name: layout-inflater

http://stackoverflow.com/comment/40053380
type: Comment
comment on: http://stackoverflow.com/a/25320545
type: AnswerComment
score: 0
has text: I solved it by adding a build.gradle file into the `google-play-services_lib` folder. Looks like AS bases on this file to detect whether it's a valid module or not. Thanks anyway.

http://stackoverflow.com/q/23474059
answer count: 1
has comment: http://stackoverflow.com/comment/35990193
has comment: http://stackoverflow.com/comment/35993152
has comment: http://stackoverflow.com/comment/35992499
has title: How to find directories of all the links on a website using selenium?
has comment: http://stackoverflow.com/comment/35992937
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35991584
has answer: http://stackoverflow.com/a/23478460
has comment: http://stackoverflow.com/comment/35992884
tagged with: selenium-webdriver
has body: i am trying to find broken links by using driver.findElements(By.tagName("a")); but the problem is it only find links present on a home page. is there any way to find directory of all the links available on a webpage?
tagged with: selenium
has comment: http://stackoverflow.com/comment/35993310
linked to: http://stackoverflow.com/q/23414150
linked to: http://stackoverflow.com/q/23447074
has comment: http://stackoverflow.com/comment/35991807
type: Question
has comment: http://stackoverflow.com/comment/35992796
tagged with: java
linked to: http://stackoverflow.com/q/20399009
score: 0

http://stackoverflow.com/a/23516808
answers question: http://stackoverflow.com/q/23516236
has comment: http://stackoverflow.com/comment/36071240
has body: Maybe you should try to preview second JDialog as InternalXXXDialog of JDialog1 when button of JDialog1 is pressed. Look for explanation here. http://docs.oracle.com/javase/8/docs/api/javax/swing/JOptionPane.html#showInternalOptionDialog-java.awt.Component-java.lang.Object-java.lang.String-int-int-javax.swing.Icon-java.lang.Object:A-java.lang.Object-
downvote count: 0
has comment: http://stackoverflow.com/comment/36069660
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/23471028
has comment: http://stackoverflow.com/comment/35984560
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/35984614
tagged with: timer
has title: Making a stopwatch using timer for javafx
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/35987627
has answer: http://stackoverflow.com/a/23533807
type: UnansweredQuestion
tagged with: javafx
score: -4
has body: I actually have a video streaming application and I want to show the time for how much the two people have chatted with eachother. I have used Timer and TimerTask of java.util class but it gives error as "Not on FX application thread" which means I cant setText to a java fx component using swing thread. This is what I have tried so far:- int timerx=0 //global variable private void timer(){ /*SHOWING TIME PASSED*/ int x=0; Timer timer = new Timer(); TimerTask timerTask = new TimerTask() { @Override public void run() { System.out.println("working"); setTime(); } }; timer.schedule(timerTask, 50, 50); } And updating the javafx Label as:- private void setTime(){ timerx = timerx +1; Platform.runLater(new Runnable(){ public void run(){ time.setText(String.valueOf((timerx))); System.out.println(time.getText()); } }); } I think the main problem is javafx component not being able to update and be accessed from swing thread. I would be glad to get any kind of help. Thank you
has answer: http://stackoverflow.com/a/23476872
tagged with: java
has comment: http://stackoverflow.com/comment/36015022
type: Question

http://stackoverflow.com/comment/36025512
comment on: http://stackoverflow.com/q/23492493
has text: no it isnt cause the run methode dont know the variable a and l
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36141595
has text: @JeffScottBrown I think the -4 is because the OP could have easily found the answer in a reference or tutorial. The -1 is probably as MarsAtomic said; there's a big discussion going on about what to do about "low-quality" questions like this, and likely some people are trying to discourage others from answering them. It's not the way I think it should be handled.
comment on: http://stackoverflow.com/a/23554600
type: Comment
score: 1
type: AnswerComment

storage
tag name: storage
type: Tag
tags question: http://stackoverflow.com/q/23525442

http://stackoverflow.com/comment/36211339
score: 0
has text: @Braj yes this is the answer
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23592159

http://stackoverflow.com/comment/36196827
type: AnswerComment
comment on: http://stackoverflow.com/a/23574772
has text: So, I tried to import my texture via Slick Utils and It works, I will search for the sources and find what's different. I'll let you know.
type: Comment
score: 0

http://stackoverflow.com/q/23574510
accepted answer: http://stackoverflow.com/a/23574648
type: AnsweredQuestion
tagged with: java
has body: Im trying to do a query where I want to join the row_numbers RN and RN1 so as to remove the duplicate rows as shown BOLD in the result set. WITH CTE AS ( SELECT PrevEndDate = LAG(edate,1) OVER (PARTITION BY id ORDER BY id) , PrevStartDate = LAG(sdate,1) OVER (PARTITION BY id ORDER BY id) , p.id, p.edate , ROW_NUMBER() OVER (PARTITION BY p.id ORDER BY p.id) as RN1 FROM table p ) SELECT t.id, t.sdate, t.edate , (ROW_NUMBER() OVER (PARTITION BY t.id ORDER BY t.id)) AS RN , CTE.RN1 , CASE WHEN CTE.PrevEndDate > t.sdate THEN DATEDIFF(day,CTE.PrevStartDate,t.sdate) ELSE DATEDIFF(day,t.sdate,t.edate) END FROM table t INNER JOIN CTE ON CTE.id= t.id AND CTE.edate= t.edate --AND RN1 = RN Thanks in Advance!
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23574648
score: 0
has title: How to join 2 row_numbers

http://stackoverflow.com/comment/36329657
has text: Can you enable DEBUG logging in your project and test again? After testing, provide the complete log (probably, via [http://pastebin.com/](http://pastebin.com/). I have used your exact code (minus `UserRatingUpdate` and `updateUserRating(userId);` because I don't know what they do and used H2 instead of MySQL) in a standalone simple project and it works for me. I can see the transactions being created and committed and I have no errors.
score: 0
comment on: http://stackoverflow.com/q/23595345
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36012641
comment on: http://stackoverflow.com/a/23485728
has text: yeah i know, canvas??
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23570556
type: Answer
has body: Something like this should do it, public static boolean contains(int[] arr, int v) { // need a minimum of two elements to do the addition.. if (arr == null || arr.length { return false; } // Loop from 0 to 1 less then the length of the array for (int i = 0; i &lt; arr.length - 1; i++) { // check if the current element + the next element == value if (arr[i] + arr[i + 1] == v) { return true; } } return false; } public static void main(String[] args) { System.out.println(contains(new int[] { 5, 1, 2, 4 }, 7)); // false System.out.println(contains(new int[] { 5, 2, 4 }, 7)); // true } Output is false true
answers question: http://stackoverflow.com/q/23570473
score: 0

http://stackoverflow.com/q/23526362
tagged with: overriding
score: 10
has body: I have a problem when compiling my code, I'm trying to make a method of a class throw an personalized exception, given some conditions. But at the time of compiling I get the message: Overridden method does not throw exception Here's the class and exception declaration: public class UNGraph implements Graph Graph is an interface with all the methods of UNGraph in it (the method getId() doesn't have the throws declaration on that script) After the constructor I create the exception (inside the class UNGraph): public class NoSuchElementException extends Exception { public NoSuchElementException(String message){ super(message); } } Here is the method with the exception public int getId(....) throws NoSuchElementException { if (condition is met) { //Do method return variable; } else{ throw new NoSuchElementException (message); } } Obviously I don't want the method to throw an exception every time, just when the condition is not met; and when it's met, I want to return a variable.
tagged with: methods
upvote count: 10
type: Question
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/23526858
favorite count: 0
has answer: http://stackoverflow.com/a/23526510
tagged with: exception
possible better answer: http://stackoverflow.com/a/23526504
has answer: http://stackoverflow.com/a/23526504
has answer: http://stackoverflow.com/a/23526858
type: AnsweredQuestion
has title: overridden method does not throw exception
tagged with: java

http://stackoverflow.com/q/23581381
upvote count: 0
score: -2
accepted answer: http://stackoverflow.com/a/23581522
has body: I have a program that reads a file in order to sort the file alphabetically. So the output of the program is displayed in an ascending order (From A-Z if applies). However, I want my program to just output the first 100 words by ignoring the rest of it. Is there a Unix command that allows me to carry out this function? or do I have to implement a code/algorithm within my program in order to accomplish it?
tagged with: file-io
answer count: 1
favorite count: 0
downvote count: 2
has answer: http://stackoverflow.com/a/23581522
type: AnsweredQuestion
tagged with: java
has title: Displaying the First 100 Words Of a Program that Contains a File - Java
type: Question

http://stackoverflow.com/comment/36245018
has text: And just iterating through the HashMap isn't feasable?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23610375
score: 0

http://stackoverflow.com/a/23596738
answers question: http://stackoverflow.com/q/23595743
type: Answer
score: 0
has body: I would import ArrayUtils class from the Apache commons library. Why reinvent the wheel when it already exits. String[] a3 = ArrayUtils.addAll(a1, a2); Arrays.sort(a3);

http://stackoverflow.com/comment/36227697
type: QuestionComment
comment on: http://stackoverflow.com/q/23600492
has text: Thanks Meike.So how can I drop the table before never each time i need to update the database? When i call the getWritableDatabase function, the onCreate and onUpgrade function should be called. The drop sql statement was included in onUpgrade function. I don't why the old data is still existing.
score: 0
type: Comment

http://stackoverflow.com/q/23609494
tagged with: java
type: Question
tagged with: apache
downvote count: 0
tagged with: applet
has body: Java applet self-signed load corectly when call from explorer (file://...test.htm). When the same html file is called under apache, the applet load correctly the first time (after cleaning all caches). This is the log from the java console when applet load correctly : cache: Initialize resource manager: com.sun.deploy.cache.ResourceProviderImpl@f522e8 security: --- parseCommandLine converted : -Djava.net.preferIPv4Stack=true into: [-Djava.net.preferIPv4Stack=true] basic: Processus d'écoute de progression ajouté : sun.plugin.util.ProgressMonitorAdapter@1ad080f security: Expected Main URL: http://portail-rep/LanceAppli.jar basic: Plugin2ClassLoader.addURL parent called for http://portail-rep/LanceAppli.jar basic: Plugin2ClassLoader.addURL parent called for http://portail-rep/LanceAppli.jar network: Entrée de cache introuvable [URL : http://portail-rep/LanceAppli.jar, version : null] network: Connexion de http://portail-rep/LanceAppli.jar avec proxy=DIRECT network: Connexion de http://portail-rep:80/ avec proxy=DIRECT network: Téléchargement de la ressource : http://portail-rep/LanceAppli.jar Content-Length : 4 058 Content-Encoding : null network: URL http://portail-rep/LanceAppli.jar enregistrée dans le fichier C:\Users\damien\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\22\133a80d6-16383b84-temp security: La vérification de révocation de la liste noire est activée security: blacklist: Reconstruct cache security: blacklist: created: NEED_CREATE, lastModified: 1399896272579 security: blacklist: check contains qx2NE11fDtlcwJoPYN21GqqZVuP5NiFAD+fWu7Hqf1g=, state now NEED_CREATE security: blacklist: check raw C:\Users\damien\AppData\LocalLow\Sun\Java\Deployment\security\blacklist.dynamic, false security: blacklist: check raw C:\Program Files (x86)\Java\jre7\lib\security\blacklist, false security: blacklist: check raw C:\Users\damien\AppData\LocalLow\Sun\Java\Deployment\security\blacklist, false security: blacklist: save cache to C:\Users\damien\AppData\LocalLow\Sun\Java…
favorite count: 0
answer count: 0
type: UnansweredQuestion
has title: Java applet load once under apache
upvote count: 1
score: 1

http://stackoverflow.com/q/23594187
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23594240
has comment: http://stackoverflow.com/comment/36214769
type: UnansweredQuestion
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23594563
tagged with: mysql
score: -1
has comment: http://stackoverflow.com/comment/36215491
has body: I have been working with MySQL for some time now, and for some odd reason, whether in be some NPE in my code that I don't see, or just me mistyping, I am getting errors that I have not before static MySQL sql = Essentials.getinstance().sql; public static String TABLE_MAIN = "`PlayerStats`"; public static String TABLE_GROUP = "`Groups`"; public static String TABLE_BUILDNG = "`Build`"; public static String TABLE_ARCHERY = "`Archer`"; public static String TABLE_DIGGING = "`Dig`"; public static String TABLE_MINING = "`Mine`"; public static String TABLE_FARMING = "`Farm`"; public static String TABLE_WOODCUTTIN = "`Wood`"; public static String TABLE_FIGHTING = "`Combat`"; public static String KEY = "`Player`"; public static String LEVEL = "`Level`"; public static String XP = "`XP`"; public static String[] tables = new String[] { TABLE_MAIN, TABLE_ARCHERY, TABLE_BUILDNG, TABLE_DIGGING, TABLE_FARMING, TABLE_FIGHTING, TABLE_MINING, TABLE_WOODCUTTIN }; public PlayerStats() { this.start(); this.setName("RPG-Setup"); } @Override public void run() { for(String table : tables){ sql.updateSQL("CREATE TABLE IF NOT EXISTS " + table + "(" + KEY + " varchar(128), " + LEVEL + " bigint, " + XP + " bigint, PRIMARY KEY(" + KEY + "))"); } sql.updateSQL("CREATE TABLE IF NOT EXISTS `Groups` (`Player` varchar(128), `Group` varchar(64), PRIMARY KEY(`Player`))"); } The entire class is much longer, but this is what is throwing the error: sql.updateSQL("CREATE TABLE IF NOT EXISTS `Groups` (`Player` varchar(128), `Group` varchar(64), PRIMARY KEY(`Player`))"); What makes no sense is why. It's not throwing an NPE, but instead it throws this: [19:55:42 WARN]: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQ L server version for the right syntax to use near '' at line 1 Any ideas?
answer count: 2
has title: MySQL throwing an exception when creating a table, but only in Java?
tagged with: sql

http://stackoverflow.com/comment/36080413
comment on: http://stackoverflow.com/a/23522168
type: Comment
has text: Yes, precisely. I updated it with the changes I believe you should make.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36006250
has text: An alphanumeric string of 11 characters (or less) that uniquely identifies all combinations of email addresses + timestamps? Assuming by alphanumeric you mean A-Za-z0-9, there are only 52,036,560,683,837,093,888 possible 11 character strings, and there are a lot more possible email addresses.
comment on: http://stackoverflow.com/q/23482145
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23465975
type: Answer
score: 2
upvote count: 2
has body: I ran into similar problem before. Using system alert dialogs to avoid user going to home or out of the application was a good idea. I assume that you are trying to do the same. What I did was, run a background thread that will open up the activity (bring the activity to the front) of your application (if the application is not in front). Depending upon the need to enable or disable this functionality, you can pause the background thread and start when appropriate, which will save the battery :). Hope this helps.
answers question: http://stackoverflow.com/q/23465849
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23465849

http://stackoverflow.com/a/23487604
has body: This is called variable length arguments, you can send any number of parameters with the same datatype . Probably a question must be coming to your mind as "Can these functions be overloaded?" The Answere is yes. The example shows how VARGS works public class VarargsTest { // calculate average public static double average( double... numbers ) { double total = 0.0; // initialize total // calculate total using the enhanced for statement for ( double d : numbers ) total += d; return total / numbers.length; } // end method average public static void main( String args[] ) { double d1 = 10.0; double d2 = 20.0; double d3 = 30.0; double d4 = 40.0; System.out.printf( "d1 = %.1f\nd2 = %.1f\nd3 = %.1f\nd4 = %.1f\n\n", d1, d2, d3, d4 ); System.out.printf( "Average of d1 and d2 is %.1f\n", average( d1, d2 ) ); System.out.printf( "Average of d1, d2 and d3 is %.1f\n", average( d1, d2, d3 ) ); System.out.printf( "Average of d1, d2, d3 and d4 is %.1f\n", average( d1, d2, d3, d4 ) ); } // end main } // end class VarargsTest
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23487376

http://stackoverflow.com/q/23476427
tagged with: spring-java-config
has comment: http://stackoverflow.com/comment/36021324
has answer: http://stackoverflow.com/a/23490247
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/36045322
has answer: http://stackoverflow.com/a/23479175
downvote count: 0
has answer: http://stackoverflow.com/a/36045322
has comment: http://stackoverflow.com/comment/36006446
has title: Spring not able to locate JpaRepository
type: Question
has comment: http://stackoverflow.com/comment/35999095
accepted answer: http://stackoverflow.com/a/23490247
favorite count: 0
has answer: http://stackoverflow.com/a/57602809
has comment: http://stackoverflow.com/comment/36006171
score: 9
has comment: http://stackoverflow.com/comment/36006019
tagged with: spring
has comment: http://stackoverflow.com/comment/36006092
has comment: http://stackoverflow.com/comment/36006203
has body: Using JavaConfig I have a problem locating the @Repository Spring beans. The repository interface is defined like this: @Repository public interface UserRepository extends JpaRepository&lt;User, Long&gt; { User findByUsername(String username); } The configuration is defined like this: @Configuration @ComponentScan("com.example") @EnableAutoConfiguration @EnableJpaRepositories("com.example") public class SampleApplication extends SpringBootServletInitializer { ... the package structure looks like this: com.example configuration SampleApplication repository UserRepository In the log file I see that the Repository is found as a candidate for bean definition, but: ClassPathBeanDefinitionScanner | Ignored because not a concrete top-level class: Interesting fact if I move the SampleApplication class to the com.example package, everything starts to work. Any ideas what I'm missing?
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/36006313
upvote count: 9
tagged with: java
tagged with: spring-data

http://stackoverflow.com/comment/36062075
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23510648
has text: Of course your first example does not work. btn[0] is null. Initialize it properly and it will work.
score: 1

http://stackoverflow.com/a/23608926
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/23608866
has body: The problem is your loop: your loop variable name is i but you change the varStep variable instead of i so basically the loop variable never changes and thus the exit condition will never be true. I believe you want to step i with varStep, so change your loop to: for (int i = varStart; i&lt;varStop; i += varStep) // stuff inside loop
score: 2
downvote count: 0

http://stackoverflow.com/comment/36109972
has text: Spring version is 3.2.8.RELEASE
comment on: http://stackoverflow.com/q/23536710
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23514780
has comment: http://stackoverflow.com/comment/36078096
tagged with: java
has comment: http://stackoverflow.com/comment/36066507
has comment: http://stackoverflow.com/comment/36074467
has comment: http://stackoverflow.com/comment/36074496
type: Question
linked to: http://stackoverflow.com/q/23496255
has comment: http://stackoverflow.com/comment/36065917
has comment: http://stackoverflow.com/comment/36074109
has comment: http://stackoverflow.com/comment/36065912
tagged with: servlets
has body: I developed browser front end for displaying,editing and updating records from database. Previously I had different servlet for performing the Inserting, editing and Updating records. Now I want club all the servlets into a single servlet called "DisplayData" and I used hidden field respective in login.JSP form and in "edit.jsp" so that servlet can perform login operation or update operation based on the hidden parameter. The code works fine for the login operation which allows only registered users but when I try edit the record and update it, it shows the java.lang.Nullpointer exception. When I try to delete the record it shows the same error. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(true); HttpSession usersession = request.getSession(true); response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String query; Connection conn; Statement stmt; ResultSet res; DatabaseConnection dbconn; String username=""; String hiddenname = request.getParameter("hiddenname"); System.out.println(hiddenname); username = request.getParameter("username"); System.out.println(username); String password = request.getParameter("password"); System.out.println(password); usersession.setAttribute("uname", username); usersession.setAttribute("upass", password); Connection con = dbconnection.getCon(); System.out.println(con); PreparedStatement statemt = null; if (hiddenname.equals("login")) { try { statemt = con.prepareStatement("select User_name,Password from login_details where User_name = ? and Password = ?"); System.out.println(statemt); statemt.setString(1, username); statemt.setString(2, password); ResultSet rs = statemt.executeQuery(); if (rs.next() == false) { out.write("Invalid user name or password. Please press back button to login again"); } else { List lst=new ArrayList(); String login_name,login_password; try { login_name=(Strin…
has comment: http://stackoverflow.com/comment/36066857
upvote count: 1
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/36074706
favorite count: 0
has title: NullPointerException in java servlet while updating and deleting records
has answer: http://stackoverflow.com/a/23519375
accepted answer: http://stackoverflow.com/a/23519375
score: -3
downvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36074194

http://stackoverflow.com/a/23538831
type: Answer
has comment: http://stackoverflow.com/comment/36111333
has comment: http://stackoverflow.com/comment/36112735
has comment: http://stackoverflow.com/comment/36111671
has body: you are inserting int values with in quotes('') DB.Save_Update_Delete("insert into order (Add_Order_PID,Customer_idCustomer,Items_idItems,User_idUser,Color,Leather,s38,s39,s40,s41,s42,s43,s44,s45,s46,Total) values ('"+pid+"','"+Integer.parseInt(customerID.getText())+"','"+Integer.parseInt(ItemId)+"','"+Integer.parseInt(UserID.getText())+"','"+$Color+"','"+$Leather+"','"+$s38+"','"+$s39+"','"+$s40+"','"+$s41+"','"+$s42+"','"+$s43+"','"+$s44+"','"+$s45+"','"+$s46+"','"+Total+"')" ); Better use PreparedStatement and learn from it here
answers question: http://stackoverflow.com/q/23538791
score: 0
has comment: http://stackoverflow.com/comment/36113125

jboss6.x
tag name: jboss6.x
tags question: http://stackoverflow.com/q/23589749
type: Tag

http://stackoverflow.com/comment/36190030
score: 3
comment on: http://stackoverflow.com/q/23580780
has text: Note that man in the middle attacks are possible without at least authenticating one side. This means that you are not even attaining confidentiality of information. Unfortunately, if eavesdropping is possible then it is likely that man-in-the-middle is also possible, e.g. when using WiFi connections. IE fully anonymous TLS is useless except for testing purposes in my opinion. I would rather go for self signed certificates myself.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23535913
has answer: http://stackoverflow.com/a/23536039
accepted answer: http://stackoverflow.com/a/23536065
has comment: http://stackoverflow.com/comment/36106662
has comment: http://stackoverflow.com/comment/36106788
has comment: http://stackoverflow.com/comment/36106718
has answer: http://stackoverflow.com/a/23536303
has body: The output of the below snippet is 012, but kindly let me know how (b2 instanceof Toy) is getting true. kindly explain on this. interface Vessel { } interface Toy { } class Boat implements Vessel { } class Speedboat extends Boat implements Toy { } public class Tree { public static void main(String[] args) { String s = "0"; Boat b = new Boat(); Boat b2 = new Speedboat(); Speedboat s2 = new Speedboat(); if((b instanceof Vessel) &amp;&amp; (b2 instanceof Toy)) s += "1"; if((s2 instanceof Vessel) &amp;&amp; (s2 instanceof Toy)) s += "2"; System.out.println(s); } }
has comment: http://stackoverflow.com/comment/36111825
has comment: http://stackoverflow.com/comment/36106555
has answer: http://stackoverflow.com/a/23536035
type: AnsweredQuestion
has title: kindly explain java instanceof keyword in this snippet
has comment: http://stackoverflow.com/comment/36107222
possible better answer: http://stackoverflow.com/a/23536035
tagged with: java
linked to: http://stackoverflow.com/q/7313559
has comment: http://stackoverflow.com/comment/36106513
has comment: http://stackoverflow.com/comment/36106487
type: Question
has answer: http://stackoverflow.com/a/23536065
has comment: http://stackoverflow.com/comment/36106457
has answer: http://stackoverflow.com/a/23536083
score: 0
has answer: http://stackoverflow.com/a/23536049
answer count: 7
has answer: http://stackoverflow.com/a/23536041

http://stackoverflow.com/comment/36104525
type: AnswerComment
type: Comment
has text: how can i remove brackets [,] from result string
score: 0
comment on: http://stackoverflow.com/a/23534328

http://stackoverflow.com/a/24404601
score: 0
has body: Its due to the way table is created. In create table I'm using parallel to create the table with degree six. When I disabled it to no parallel, the issue I was facing was fixed. Its a bug with oracle version which was fixed in later versions. create table KP_GEOM_TBL parallel(degree 6) Once I executed below statement the issue was fixed and moreover now its taking just couple of mills to query the DB where as previously it was taking few seconds. ALTER TABLE KP_GEOM_TBL NOPARALLEL
answers question: http://stackoverflow.com/q/23512871
type: Answer

http://stackoverflow.com/comment/35974576
type: AnswerComment
has text: same problem, its not entering the if statement. why?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23465077

http://stackoverflow.com/comment/36054670
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23508319
has text: Do the characters have to appear before the number?
score: 0

http://stackoverflow.com/comment/35971826
type: Comment
has text: Hi Braj, I found that you need gwtupload-1.0.1.jar. I have downloaded this and used 'Add External JARS' to add it to the library. I have removed the old gwtupload-0.6.6.jar. I then recompiled and the compile work. However, now I have an error in my "MyCustomisedUploadServlet" as per above. Regards, Glyn.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23456302

http://stackoverflow.com/comment/36181191
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23575888
type: Comment
has text: http://stackoverflow.com/questions/2672645/casting-and-dynamic-vs-static-type-in-java/2672656#2672656

http://stackoverflow.com/comment/36100631
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23532652
score: 0
has text: @txtechelp, That was bad copying on my part... I somehow messed up on copying the code from my editor.

http://stackoverflow.com/comment/36001070
type: AnswerComment
comment on: http://stackoverflow.com/a/23474927
score: 0
type: Comment
has text: Hmm, might be something going on with missing normalization, but I haven't dug through all the math. Maybe instead of relying on the player's transform matrix to store the rotation, you can store it as a float angle and reapply it to the transform on each frame. I'll edit this.

http://stackoverflow.com/comment/39730736
type: QuestionComment
has text: possible duplicate of [Loop doesn't see changed value without a print statement](http://stackoverflow.com/questions/25425130/loop-doesnt-see-changed-value-without-a-print-statement)
score: 0
comment on: http://stackoverflow.com/q/23457411
type: Comment

http://stackoverflow.com/comment/36068377
has text: @Keppil agree on your question its only applicable for compare two same datatype arrays.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23516110

http://stackoverflow.com/comment/36108690
has text: It's a valid programming question as far as I can tell
comment on: http://stackoverflow.com/q/23537103
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23664744
accepted answer of: http://stackoverflow.com/q/23572401
upvote count: 1
score: 1
has body: I'm not sure if it helps but you can simplified WebInit by extendsAbstractAnnotationConfigDispatcherServletInitializer instead of implements WebApplicationInitializer. Otherwise Thymeleaf configuration seems ok to me (suppose it's called). I'm giving here working skeleton of config so you can experiment with it. WebApplicationInitializer public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return null; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return new Class[] { WebConfig.class }; } @Override protected String[] getServletMappings() { return new String[] { "/" }; } } WebConfig @Configuration @EnableWebMvc @ComponentScan("com.kreuzman") public class WebConfig { @Bean public ITemplateResolver templateResolver() { TemplateResolver resolver = new ServletContextTemplateResolver(); resolver.setPrefix("/templates/"); resolver.setSuffix(".html"); resolver.setTemplateMode("HTML5"); resolver.setCacheTTLMs(0l); return resolver; } @Bean public SpringTemplateEngine templateEngine() { SpringTemplateEngine engine = new SpringTemplateEngine(); engine.setTemplateResolver(templateResolver()); return engine; } @Bean public ViewResolver thymeleafViewResolver() { ThymeleafViewResolver viewResolver = new ThymeleafViewResolver(); viewResolver.setTemplateEngine(templateEngine()); viewResolver.setCharacterEncoding("UTF-8"); return viewResolver; } }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36396238
answers question: http://stackoverflow.com/q/23572401
type: Answer

http://stackoverflow.com/comment/36083299
type: QuestionComment
comment on: http://stackoverflow.com/q/23523407
has text: Can you profile the application to see what it is doing? The CPU profile for the machines should be quite different in sampling mode. That should tell you where it is spending more time.
score: 0
type: Comment

gwt
tags question: http://stackoverflow.com/q/23603234
tags question: http://stackoverflow.com/q/23543415
tags question: http://stackoverflow.com/q/23608159
tags question: http://stackoverflow.com/q/23587875
tags question: http://stackoverflow.com/q/23476345
tag name: gwt
tags question: http://stackoverflow.com/q/23467057
tags question: http://stackoverflow.com/q/23574529
tags question: http://stackoverflow.com/q/23488104
tags question: http://stackoverflow.com/q/23540577
tags question: http://stackoverflow.com/q/23602862
type: Tag
tags question: http://stackoverflow.com/q/23511248
tags question: http://stackoverflow.com/q/23608326
tags question: http://stackoverflow.com/q/23470297
tags question: http://stackoverflow.com/q/23459989
tags question: http://stackoverflow.com/q/23470855
tags question: http://stackoverflow.com/q/23484747
tags question: http://stackoverflow.com/q/23489526
tags question: http://stackoverflow.com/q/23566693
tags question: http://stackoverflow.com/q/23487982
tags question: http://stackoverflow.com/q/23515061
tags question: http://stackoverflow.com/q/23517326
tags question: http://stackoverflow.com/q/23497180
tags question: http://stackoverflow.com/q/23534183
tags question: http://stackoverflow.com/q/23596447
tags question: http://stackoverflow.com/q/23567148
tags question: http://stackoverflow.com/q/23513936
tags question: http://stackoverflow.com/q/23473564
tags question: http://stackoverflow.com/q/23509979
tags question: http://stackoverflow.com/q/23467346
tags question: http://stackoverflow.com/q/23479404
tags question: http://stackoverflow.com/q/23521608
tags question: http://stackoverflow.com/q/23455516
tags question: http://stackoverflow.com/q/23530416
tags question: http://stackoverflow.com/q/23487257
tags question: http://stackoverflow.com/q/23466549

http://stackoverflow.com/q/23547257
tagged with: exception
tagged with: internationalization
has title: How can I change the language of Spring exceptions
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/23547523
has body: I am working with a server in spanish and my Spring logged exceptions are translated to Spanish. That is a nice feature but I will prefer to have them in English because it makes easier to find answers in google (and Stackoverflow) How can I change thouse messages? In my Log4J config file? in the context file? Thanks
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23547523
type: Question

http://stackoverflow.com/comment/36207509
comment on: http://stackoverflow.com/a/23590225
type: Comment
has text: So what? BTW, it's not exactly the same, since mine doesn't recommend escaping the double quote, explains why the single quote must be escaped, suggests respecting naming conventions, and provides a link to the javadoc. If you're concerned that I borrowed your idea, I didn't. Actually, I commented about it before you posted your answer, in unknown's answer, in hope that he would fix his answer. But unknown didn't catch my comment, so I posted an answer while you were posting yours.
score: 1
type: AnswerComment

http://stackoverflow.com/a/23589624
has comment: http://stackoverflow.com/comment/36206240
score: 1
has body: http://commons.apache.org/proper/commons-logging/apidocs/org/apache/commons/logging/LogFactory.html#getFactory() See the link. It requires a commons-logging.properties do you have any file like that in classpath?
has comment: http://stackoverflow.com/comment/36206245
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23589530
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23589530
has comment: http://stackoverflow.com/comment/36206222
type: Answer

http://stackoverflow.com/comment/36087209
has text: It would really be preferable not to run an IDE such as Eclipse under an administrator account.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23525539

http://stackoverflow.com/comment/36091013
has text: @LuiggiMendoza You made a claim. There's no telling if your claim is correct or not, because there's no telling what the final code is going to do.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23527163
type: Comment

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/23571548
type: Tag
tags question: http://stackoverflow.com/q/23613079

http://stackoverflow.com/q/23563212
type: Question
has title: why output String passed not object
answer count: 2
has answer: http://stackoverflow.com/a/23563584
possible better answer: http://stackoverflow.com/a/23563584
has body: public class test { public static void main(String[] args) { magic(null); } public static void magic(String s) { System.out.println("String passed"); } public static void magic(Object o) { System.out.println("object passed"); } } why string passed printed not object passed.
has answer: http://stackoverflow.com/a/23563283
has comment: http://stackoverflow.com/comment/36156495
accepted answer: http://stackoverflow.com/a/23563283
downvote count: 1
linked to: http://stackoverflow.com/q/5806163
tagged with: string
favorite count: 0
upvote count: 4
tagged with: object
type: AnsweredQuestion
score: 3
tagged with: java

http://stackoverflow.com/comment/36237755
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23605057
has text: Well if you're wanting to send it in one message, you need to make sure you only call `writeUTF` once (per interaction). So for example your `analyzeSelection` method could return the string to write, and you could then append the menu onto that and call `writeUTF` once. Or you could change your protocol to have some string which basically means "I want input now".

http://stackoverflow.com/comment/36035997
comment on: http://stackoverflow.com/q/23498195
type: QuestionComment
has text: do whatever you need to do in the `onPostExecute` of the asynctask, that gets called when the task is finished
score: 0
type: Comment

http://stackoverflow.com/a/23610009
answers question: http://stackoverflow.com/q/23609660
has body: Take a look at using the Ant plugin.
type: Answer
score: 0

http://stackoverflow.com/comment/35974578
type: QuestionComment
has text: no...i am completely stucked plz help
score: 0
comment on: http://stackoverflow.com/q/23465295
type: Comment

http://stackoverflow.com/comment/36206416
has text: awesome! it worked when i made a new lib folder... i dont understand why i had to do that but thanks!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23589376
type: AnswerComment

http://stackoverflow.com/comment/36066782
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23515095
has text: See my answer to this question: http://stackoverflow.com/q/18822095/1700321.

http://stackoverflow.com/comment/36052082
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23506359
has text: I also just found a way to see each id and they're all being returned as 0 which makes me think that that is why they're not deleting. I don't see where it is creating the id incorrectly though.
score: 0

http://stackoverflow.com/comment/36156474
score: 0
type: Comment
type: QuestionComment
has text: @fge but then he won't see exceptions which where caught and not printed.
comment on: http://stackoverflow.com/q/23561555

http://stackoverflow.com/comment/36231985
score: 0
comment on: http://stackoverflow.com/q/23602973
type: QuestionComment
type: Comment
has text: I have got out of memory Error: Java heap space thats why i have written performance issue.

http://stackoverflow.com/q/23574234
score: 0
answer count: 1
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/23587343
has body: I need to learn Mockito for my current project and am struggling mightely. I might add that i've also never been taught anything on unit testing either (and very little in java for that mater, haha) so I seem to have to learn multiple things at once. I have spent awhile looking at a number of resources on Mockito but could still use some help. Below I have created a small example that I'm hoping someone can answer for me on creating a JUNIT for it in Mockito. public class Animal{ public numberOfTeeth(AnimalType animal){ if animalAlive(){ Teeth tooth= animal.getNumberOfTeeth(); if(tooth== null) { throw new ValidationException("Invalid Tooth"); } } } Please excuse the syntax errors, this is a quick made up example for learning. So lets say animalAlive() is a private method in the Animal Class and getNumberOfTeeth() is a public method in some other class. I assume one junit test one might make would be to test if the exception is thrown when it should? What would the best way to do this be? I would assume it involves mocking AnimalType and creating stubs(?) to control the two method calls inside the numberOfTeeth method? Does the Private method inside the Animal class throw a wrench in anything?
tagged with: mocking
type: AnsweredQuestion
tagged with: mockito
has title: Mockito- Need help learning from example
type: Question
accepted answer: http://stackoverflow.com/a/23587343
has comment: http://stackoverflow.com/comment/36203345

http://stackoverflow.com/comment/36041492
comment on: http://stackoverflow.com/q/23501353
has text: Isn't `b[i].replace(b[i], chars[i])` equivalent to `chars[i]`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36179028
comment on: http://stackoverflow.com/q/23574758
type: Comment
type: QuestionComment
has text: The code for the `Room` class will be helpful
score: 1

http://stackoverflow.com/q/23470145
has answer: http://stackoverflow.com/a/23470280
has answer: http://stackoverflow.com/a/23937980
score: 0
has comment: http://stackoverflow.com/comment/35983265
has comment: http://stackoverflow.com/comment/35983384
has answer: http://stackoverflow.com/a/23470263
has comment: http://stackoverflow.com/comment/35983417
has comment: http://stackoverflow.com/comment/35983054
type: UnansweredQuestion
tagged with: sortedmap
has comment: http://stackoverflow.com/comment/35983241
type: Question
has comment: http://stackoverflow.com/comment/35983022
has body: I have 2 arrays : The first one consists of names of persons . The second one gives me a count of number of names that have appeared in a page. Ex: Names=["James","Loiui","Mario","Peter"] count=[1,4,2,5] now I tried with this code give below : SortedMap&lt;Integer, String&gt; m = new TreeMap&lt;Integer, String&gt;(); for(int i = 0; i &lt; Names.size(); i++) m.put( count.get(i),Names.get(i)); But this doesnt work given there are repeating values of count . I figured out that the problem is with TreeMap as it stores only unique elements . Now to overcome problem of mine, are there any other valid solutions .
has title: Sorting a Array based on another array
has comment: http://stackoverflow.com/comment/35982897
tagged with: java
tagged with: treemap
answer count: 3
tagged with: arrays

http://stackoverflow.com/comment/36044431
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23502832
has text: Can you show in which line the exception occurs?

http://stackoverflow.com/comment/36140794
type: Comment
type: QuestionComment
score: 1
has text: Why not delete and reinsert an entry with a new key when you want to change the key?
comment on: http://stackoverflow.com/q/23554240

http://stackoverflow.com/q/23532615
has title: calling different class objects based on value of string
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/36100474
has comment: http://stackoverflow.com/comment/36100551
has answer: http://stackoverflow.com/a/23532657
has answer: http://stackoverflow.com/a/23532634
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36100482
score: -3
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36100544
tagged with: java
downvote count: 4
answer count: 2
tagged with: string
has body: I have a string (str) that holds the class name and want to call a method of that class based on the string value how do i achieve this? Ex. if str = "classA" i want call the method classA.domatrix() if str = "classB" then classB.domatrix()

http://stackoverflow.com/q/23475189
score: 12
tagged with: web-services
answer count: 1
has body: I have Java WebService code in my eclipse. I have used @WebService @Webmethod, @XmlElements, @XmlType, @XmlAccessorType Now I am generating wsdl using java2ws command from cxf framework. Here is the command F:\....\code\java2wsdl&gt;java2ws -o CustomerVxRR.wsdl -d &lt;myOutputDir&gt; -wsdl -cp &lt;myClassesFolder&gt; &lt;ServiceImpl class&gt; my wsdl file contqins agr0 as name which I do not want because when I am importing it to SoapUI. It is adding tag around the field. Here is wsdl part with arg0 &lt;xs:schema ..... &gt; &lt;xs:complexType name="myServiceMethodName"&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="arg0" type="tns:ServiceInputClassName"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="ServiceInputClassName"&gt; &lt;xs:sequence&gt; &lt;xs:element minOccurs="0" name="EmpID" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xz:schema&gt; Here is the request object which is generated in SOAPUI &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://customeroffer.manage.ws.hello.my.com/"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;cus:myServiceMethodName&gt; &lt;!--Optional:--&gt; &lt;arg0&gt; &lt;EmpID &gt;123456&lt;/EmpID&gt; &lt;/arg0&gt; &lt;/cus:myServiceMethodName&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; If I remove tag I get this response: &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Body&gt; &lt;soap:Fault&gt; &lt;faultcode&gt;soap:Client&lt;/faultcode&gt; &lt;faultstring&gt;Unmarshalling Error: unexpected element (uri:"", local:"EmpID"). Expected elements are &amp;lt;{}empid&gt;&lt;/faultstring&gt; &lt;/soap:Fault&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; I do not want to keep arg0 in the request XML
tagged with: java
accepted answer: http://stackoverflow.com/a/23492481
tagged with: jax-ws
tagged with: java2wsdl
upvote count: 12
downvote count: 0
has title: Getting rid of <arg0>
type: Question
type: AnsweredQuestion
tagged with: wsdl
has answer: http://stackoverflow.com/a/23492481
favorite count: 0

http://stackoverflow.com/q/23490151
tagged with: instanceof
possible better answer: http://stackoverflow.com/a/23490399
has body: public class Parent { .... } public class Child1 extends Parent { .... public void foo() { .... } } public class Child2 extends Parent { .... public void foo() { .... } } Here method foo() only exists in the Child classes and can not be added to the Parent class (not even abstract method). In this situation, when I want to call the foo() method on obj which is Parent class's reference, then I need to use intanceof with multiple if..else, that I want to avoid. Parent obj = ...// Object of one of the child classes obj.foo(); EDIT: I need to use type of obj as Parent only. Otherwise, I will not be able to call methods on obj which exists in Parent class. My Solution: The approach that I am thinking is to define an interface to say FooInterface with foo() method and let all the child classes implement it, then I could just type cast the obj to that interface and call foo() method like this: if(obj instanceof FooInterface){ ((FooInterface)obj).foo(); } Is there a better approach? Or any improvement to this one?
has comment: http://stackoverflow.com/comment/36020206
answer count: 5
has comment: http://stackoverflow.com/comment/36021390
has answer: http://stackoverflow.com/a/23730145
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23730145
tagged with: class-design
has comment: http://stackoverflow.com/comment/36031166
tagged with: java
has answer: http://stackoverflow.com/a/23490319
has answer: http://stackoverflow.com/a/23495617
type: Question
has answer: http://stackoverflow.com/a/23490399
tagged with: oop
score: 7
has comment: http://stackoverflow.com/comment/36020785
has title: Calling method that exists in child classes but not in parent class
has answer: http://stackoverflow.com/a/23490325
upvote count: 7
downvote count: 0
favorite count: 0

struts2
tags question: http://stackoverflow.com/q/23533541
tags question: http://stackoverflow.com/q/23515095
tags question: http://stackoverflow.com/q/23470928
tags question: http://stackoverflow.com/q/23613597
tags question: http://stackoverflow.com/q/23601161
tags question: http://stackoverflow.com/q/23596367
tags question: http://stackoverflow.com/q/23470726
tags question: http://stackoverflow.com/q/23557562
tags question: http://stackoverflow.com/q/23522178
tag name: struts2
tags question: http://stackoverflow.com/q/23466710
tags question: http://stackoverflow.com/q/23491738
tags question: http://stackoverflow.com/q/23462309
tags question: http://stackoverflow.com/q/23513324
tags question: http://stackoverflow.com/q/23482799
tags question: http://stackoverflow.com/q/23604738
tags question: http://stackoverflow.com/q/23522170
tags question: http://stackoverflow.com/q/23571250
tags question: http://stackoverflow.com/q/23529462
tags question: http://stackoverflow.com/q/23587046
tags question: http://stackoverflow.com/q/23595071
tags question: http://stackoverflow.com/q/23499685
tags question: http://stackoverflow.com/q/23470075
tags question: http://stackoverflow.com/q/23511138
tags question: http://stackoverflow.com/q/23615437
type: Tag
tags question: http://stackoverflow.com/q/23556162
tags question: http://stackoverflow.com/q/23614475

http://stackoverflow.com/comment/36209074
score: 0
has text: possible duplicate of http://stackoverflow.com/questions/6343166/android-os-networkonmainthreadexception?lq=1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23591033

http://stackoverflow.com/comment/70672347
type: Comment
comment on: http://stackoverflow.com/a/25620315
type: AnswerComment
score: 0
has text: With Specs2, use `testOptions += Tests.Argument(TestFrameworks.Specs2, "failtrace")`

http://stackoverflow.com/a/23510888
upvote count: 7
answers question: http://stackoverflow.com/q/23510079
has body: The Spring Framework is a core of all other Spring IO projects Of course Spring Boot is based on Spring Framework, too, and provides the extension convention over configuration model, if say it in two words. And I'd say it won't hurt to use Boot for all your applications and don't just rely on Spring Framework. Anyway I'm not sure that for your applications it will just enough to use Inversion of Control. I guess you are going to use other Enterprise features, like Security, MVC, JPA, Hadoop etc. And Boot allows to simplify the configurations for most of them. All other useful info you can find on Spring IO
type: AcceptedAnswer
downvote count: 0
score: 7
type: Answer
accepted answer of: http://stackoverflow.com/q/23510079

http://stackoverflow.com/q/23453163
type: UnansweredQuestion
tagged with: solr
tagged with: java
has title: Solr Query Execution
type: Question
score: 0
answer count: 1
tagged with: full-text-search
tagged with: field
has body: How will a query like below will get executed, In which order I understand that when this query is executed fields mentioned in fieldList will be returned. What I don't understand is how the "samplestring1" and "samplestring2" will get searched with the query fields specified I think I will be able to understand how the search happens if this can be illustrated in SQL ( Just to understand what happens behind the scene) Following is the query. Please have a look at it and let me know how this works internally. query=samplestring1 AND samplestring2 defType: edismax queryFields: Exact_Field1^1.0 Exact_Field2^0.9 Field1^0.8 Field2^0.7 fieldList: Column1, Column2 resultRows: 10 startRow: 0 P.S samplestring1 AND samplestring2 are some test strings in the query Sample of Schema for fields <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.NGramFilterFactory" minGramSize="5" maxGramSize="10"/> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <field name="Field1" compressed="true" type="sampletype1" multiValued="false" indexed="true" stored="true" required="true" omitNorms="true"/> <field name="Field2" compressed="true" type="sampletype1" multiValued="false" indexed="true" stored="true" required="true" omitNorms="true"/> <field name="Exact_Field1" omitPositions="true" termVectors="false" omitTermFreqAndPositions="true" compressed="true" type="sampletype2" multiValued="false" indexed="true" stored="true" required="true" omitNorms="true"/> <field name="Exact_Field2" omitPositions="true" termVectors="false" omitTermFreqAndPositions="true" compressed="true" type="sampletype2" multiValued="false" indexed="true" stored="true" required="false" omitNorms="true"/> <copyField source="Field1" dest="Exact_Field1"/> <copyField source="Field2" dest="Exact_Field2"/>
tagged with: edismax
has answer: http://stackoverflow.com/a/23483682

http://stackoverflow.com/a/23478055
has comment: http://stackoverflow.com/comment/36000353
score: 1
has comment: http://stackoverflow.com/comment/36001021
downvote count: 0
has comment: http://stackoverflow.com/comment/35998217
has comment: http://stackoverflow.com/comment/36000528
answers question: http://stackoverflow.com/q/23476145
type: Answer
has comment: http://stackoverflow.com/comment/36001369
has comment: http://stackoverflow.com/comment/36000801
has body: Likely because the JVM doesn't have a SecurityManager configured. Without a SecurityManager configured there will be no AccessController call made. http://docs.oracle.com/javase/8/docs/technotes/guides/security/spec/security-spec.doc6.html#a19349
upvote count: 1

http://stackoverflow.com/q/23466549
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35976774
has comment: http://stackoverflow.com/comment/35977026
has comment: http://stackoverflow.com/comment/35976790
score: 0
has comment: http://stackoverflow.com/comment/35976665
answer count: 1
has body: I loaded an html using frame.setUrl(PATH); It works properly but I want to show it centered horizontally, there are no methods on the frame object that is similar to .setHorizontalAlignment of panel widgets. How can I center elements in GWT frames? I am using Eclipse as IDE with GWT Plugin. EDIT: I am using com.google.gwt.user.client.ui.Frame;
has answer: http://stackoverflow.com/a/23466644
has title: How do I center an element loaded in frame in Java GWT?
tagged with: gwt
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35977004
tagged with: java
accepted answer: http://stackoverflow.com/a/23466644

http://stackoverflow.com/comment/36160033
has text: Because they are not set in the env. They might have put the java dir directly in the path.
type: Comment
comment on: http://stackoverflow.com/a/23525089
score: 0
type: AnswerComment

http://stackoverflow.com/q/23602309
has title: How to take the first and last value from an arraylist inside an arraylist of arrylist using java
has comment: http://stackoverflow.com/comment/36232358
has comment: http://stackoverflow.com/comment/36230324
tagged with: java
has comment: http://stackoverflow.com/comment/36231528
accepted answer: http://stackoverflow.com/a/23603069
has body: How to take the first and last value from an arraylist inside an arraylist of arrylist and check the adjacent values of other arraylist values in java? for example: This is my arraylist of arraylist [[1,0],[2,0],[3,3],[1,0,0]] This arraylist size can be any thing not consatant and the values indside this arraylist will varies. What I need here is [1,0] from this value it should take the first value and last value and need to check with all the other values from the arraylist of arraylist. If the adjacent values are same then it should store in a different place and need to display it. I need a output like this: group :0 1,0 1,0,0 group:1 2,0 group:3 3,3 If the first and last values are same it should go to one group and remaining different group and it need to display all the values. This is the code I tried but i am very new to java. so my code is not that good .please help me to find this output. for (int a = 0; a &lt; pattrn.size(); a++) { // System.out.println(pat.size()); first = pattrn.get(a); break; } System.out.println(first); String temp = first.toString().replace("[", "").replace("]", ""); System.out.println(temp); StringTokenizer firstvar = new StringTokenizer(temp, ", "); firstvalue = firstvar.nextToken(); System.out.println("first value.." + firstvalue); while (firstvar.hasMoreTokens()) { lastvalue = firstvar.nextToken(); System.out.println("last value.." + lastvalue); } using this code I am not able to find this output.
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23602567
tagged with: arraylist
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23602567
favorite count: 0
has answer: http://stackoverflow.com/a/23603069
type: Question
upvote count: 2
answer count: 2

http://stackoverflow.com/comment/36104615
has text: `maven-assembly-plugin` indeed seems to be a way to go. I've similar project structure to the one you described and although I will have to do some polishing, it already produces roughly what I needed in the first place.
type: Comment
comment on: http://stackoverflow.com/a/23534250
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36093688
comment on: http://stackoverflow.com/a/23516712
has text: i can't drop any tables as i must add this feature to an existing DB
type: Comment
score: 0
type: AnswerComment

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/23497324
type: Tag
tags question: http://stackoverflow.com/q/23553094

http://stackoverflow.com/comment/36112023
comment on: http://stackoverflow.com/q/23539174
type: QuestionComment
has text: Good questions! But I can't answer them. What would be the easiest way to find out whether the JVM heap being paged to disk? I could probably tweak the survivor ratio, but how would you tweak it and why?
score: 0
type: Comment

spring-test
tags question: http://stackoverflow.com/q/23479345
tag name: spring-test
type: Tag
tags question: http://stackoverflow.com/q/23489445

http://stackoverflow.com/a/36260245
has body: Make sure that you have entered correct package names in your classes.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23459741
score: 4
upvote count: 4

http://stackoverflow.com/a/23476453
score: 2
downvote count: 0
has body: Use shared preference like this like this private static String KEY_FIRST_RUN = ""; private SharedPreferences sharedPreferences; private SharedPreferences.Editor editor; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); sharedPreferences = getPreferences(MODE_PRIVATE); if (!sharedPreferences.contains("KEY_FIRST_RUN")) { KEY_FIRST_RUN = "something"; Log.d("First", "First run!"); } else { Log.d("Second...", "Second run...!"); } editor = sharedPreferences.edit(); editor.putString("KEY_FIRST_RUN", KEY_FIRST_RUN); editor.commit(); }
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35994555
has comment: http://stackoverflow.com/comment/36027238
has comment: http://stackoverflow.com/comment/35994816
has comment: http://stackoverflow.com/comment/35994606
answers question: http://stackoverflow.com/q/23476387
has comment: http://stackoverflow.com/comment/36026630

http://stackoverflow.com/comment/36067999
type: Comment
comment on: http://stackoverflow.com/a/23498778
has text: i am new to this...i want to send coordinate to other side..can u share some demo code to do this
type: AnswerComment
score: 0

http://stackoverflow.com/q/23473891
has title: How to add jBrowser to the frame after the start?
type: UnansweredQuestion
score: 0
tagged with: swing
has body: I have a Starter class, which runs my application: public class Starter { public static Panel createContent() { Panel contentPane = new Panel(); final JWebBrowser webBrowser = new JWebBrowser(); webBrowser.navigate("http://orientalcraft.org/"); webBrowser.setBarsVisible(false); webBrowser.setStatusBarVisible(false); contentPane.add(webBrowser); return contentPane; } public static void main(String[] args) throws IOException, Exception { Frame.go(); NativeInterface.open(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Frame frame = Frame.mainFrame; //mainFrame - instance of Frame frame.getContentPane().add(createContent(), BorderLayout.CENTER); } }); NativeInterface.runEventPump(); } } And when I trying to add jBrowser to the Frame, I see nothing about jBrowser.. But I can see in a console this: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:196) at java.net.SocketInputStream.read(SocketInputStream.java:196) at java.net.SocketInputStream.read(SocketInputStream.java:122) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read(BufferedInputStream.java:254) at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2293) at java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInputStream.java:2586) at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2596) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1318) at java.io.ObjectInputStream.readUnshared(ObjectInputStream.java:460) at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface.readMessageFromChannel(OutProcessSocketsMessagingInterface.java:116) at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface$2.run(MessagingInterface.java:392) Please, help me to add a jBrowser to existing jFrame..
tagged with: java
has answer: http://stackoverflow.com/a/23475326
type: Question
tagged with: djnativeswing
answer count: 1

http://stackoverflow.com/comment/36137791
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23552329
has text: export CLASSPATH=<path>
type: Comment

http://stackoverflow.com/q/23602239
type: Question
tagged with: instantiation
has answer: http://stackoverflow.com/a/23602277
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23602342
tagged with: java
has comment: http://stackoverflow.com/comment/36231770
has answer: http://stackoverflow.com/a/23602710
score: -1
answer count: 6
has answer: http://stackoverflow.com/a/23602449
has comment: http://stackoverflow.com/comment/36231752
has answer: http://stackoverflow.com/a/23602283
favorite count: 0
has answer: http://stackoverflow.com/a/23602402
accepted answer: http://stackoverflow.com/a/23602402
tagged with: interface
has comment: http://stackoverflow.com/comment/36229989
upvote count: 0
has comment: http://stackoverflow.com/comment/36229995
tagged with: constructor
has body: I have a program code like this. My Interface is public interface MyInterface { public void m1(String name); public void m2(int num); } I have a class that implements above Interface. public class World implements MyInterface { public void m1(String name) { System.out.println(name); } public void m2(int num){ System.out.println("Number is: "+num); } public static void main(String args[]) { MyInterface ob1 = new World(); //How it is instantiated MyInterface ob2 = new World(); //How this one too is instantiated ob1.m1("Jaguar"); ob2.m2(5); } }
has title: Can I Instantiate an object of an Interface by the constructor of a class
downvote count: 1
possible better answer: http://stackoverflow.com/a/23602283

http://stackoverflow.com/a/23468395
has body: You want to create an interface and let the "with code"-version implement that interface. public interface IMyClass { public String getSpecialVersion(); } Implementation: public class MyClass implements IMyClass { public String name; public MyClass(String name) { this.name = name; } @Override public String getSpecialVersion() { return name + name; } } You cannot define constructors in interfaces (and defining fields in interfaces is kind of unconventional) tho, so you might want to look at abstract classes for that, too: public abstract class AbstractMyClass { public String name; public AbstractMyClass(String name) { this.name = name; } public abstract String getSpecialVersion(); } This class can be extended by a concrete class to add the method body: public class MyClass extends AbstractMyClass { public MyClass(String name) { super(name); } @Override public String getSpecialVersion() { return name + name; } }
accepted answer of: http://stackoverflow.com/q/23468349
has comment: http://stackoverflow.com/comment/35982930
has comment: http://stackoverflow.com/comment/35980283
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23468349

http://stackoverflow.com/comment/36130931
has text: This is not standard `Jersey` behaviour. Are you able to post a simple use case demonstrating this that we can test?
type: QuestionComment
comment on: http://stackoverflow.com/q/23501682
type: Comment
score: 0

http://stackoverflow.com/comment/36279163
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23514436
has text: any Help!!!Is the question not posted properly? information not enough.Please let me know.I wish to resolve this.

http://stackoverflow.com/q/23576651
has comment: http://stackoverflow.com/comment/36182743
has answer: http://stackoverflow.com/a/23576682
tagged with: random
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36182728
possible better answer: http://stackoverflow.com/a/26278008
type: Question
has answer: http://stackoverflow.com/a/26278008
has body: I am wondering why the code below, using the Mersenne Twister (in java), always gives the same 99 numbers no matter how many times I run it. In essence it isn't random? MersenneTwister mt = new MersenneTwister(); for(int i = 0; i&lt;=99; i++ ) { System.out.println("Next "+mt.nextDouble()); }
accepted answer: http://stackoverflow.com/a/23576682
tagged with: mersenne-twister
answer count: 2
upvote count: 1
has title: MersenneTwister is not giving random numbers?
tagged with: java

http://stackoverflow.com/comment/36138280
type: AnswerComment
has text: @jlr I think there is no issue of using logger in configuration file. JavaDoc is talking about the `Category.getInstance()` as deprecated form. If you found any reference about the configuration then please share. Thanks a lot again.
type: Comment
comment on: http://stackoverflow.com/a/23551430
score: 1

http://stackoverflow.com/a/23470491
upvote count: 1
has comment: http://stackoverflow.com/comment/35983470
type: Answer
answers question: http://stackoverflow.com/q/23469099
has body: Class2 is an inner class which means that it needs to be tied to an Class1 object. Then objects of Class2 can access the fields of the bound object at all times: public class Class1 { private String name = "class1"; public static void main(String[] args) { Class1 a = new Class1(); Class2 c = a.new Class2(); c.show(); } class Class2 { public void show() { System.out.println("helloworld: "+name); //accessing the name field of a without needing the variable } } } or you need to make Class2 static so it doesn't need the Class1 instance. public class Class1 { public static void main(String[] args) { Class2 c = new Class2(); c.show(); } static class Class2 { public void show() { System.out.println("helloworld"); } } }
has comment: http://stackoverflow.com/comment/35983469
downvote count: 0
score: 1

http://stackoverflow.com/comment/36014536
type: Comment
type: QuestionComment
has text: use series.equals("fibonacci") to compare strings.
score: 1
comment on: http://stackoverflow.com/q/23486967

http://stackoverflow.com/a/23494239
type: AcceptedAnswer
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/36029874
accepted answer of: http://stackoverflow.com/q/23494200
answers question: http://stackoverflow.com/q/23494200
has comment: http://stackoverflow.com/comment/36029073
score: 3
downvote count: 0
has body: I believe the correct syntax for the date pattern is "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'". That way the Z is literally used.

http://stackoverflow.com/q/23553764
has title: Having problems when starting new activity (Android)
type: UnansweredQuestion
type: Question
has body: Edit MainActivity.class: package com.rafapps.carteiradeaes.app; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public void startCalculadorasActivity(View view) { Intent intent = new Intent(this, calculadorasActivity.class); startActivity(intent); } } activity_main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" android:orientation="vertical" tools:context="com.rafapps.carteiradeaes.app.MainActivity" android:background="#F2F2F2"> <ImageView android:layout_width="wrap_content" android:id="@+id/icon_mercado" android:layout_height="wrap_content" android:src="@drawable/icon_mercado" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:gravity="center"/> <TextView android:id="@+id/title_mercado" android:layout_width="wrap_content" andr…
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23553876
has comment: http://stackoverflow.com/comment/36140017
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/q/23455531
type: UnansweredQuestion
has title: Problems in thread with unlimited loop
has comment: http://stackoverflow.com/comment/35955940
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/23455618
has body: This is a part of my program. Thread rcv_thread = new Thread(new Runnable() { @Override public void run() { // TODO Auto-generated method stub System.out.println("getmsg"); while (true) { /*try { Thread.sleep(0); } catch (InterruptedException e) { e.printStackTrace(); }*/ if (!getmsg.isEmpty() &amp;&amp; socket.isConnected()) { System.out.println("handle"); getmsg_ = getmsg.get(0).split(";"); if (socket.getInetAddress().toString() .equals("/" + getmsg_[0])) { PW.println(getmsg_[2] + " sent from" + getmsg_[1]); getmsg.remove(0); } } } } }); rcv_thread.start(); It is really so strange.The program never runs in the range of while(true){} while I comment the range of try{}catch{} But if I cancel the comment in the range of try{}catch{} The loop will successfully runs and runs in the range of while(true){} This is my problem. Sorry for my poor English.
type: Question
linked to: http://stackoverflow.com/q/25425130
has comment: http://stackoverflow.com/comment/39730658
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35956008

http://stackoverflow.com/q/23602506
score: 0
has answer: http://stackoverflow.com/a/23602549
answer count: 1
has body: this is a telephone keypad applet..... I am having issues with my applet it seems to be printing the the whole array up to the chosen number I would like it only to print the chosen number like what happens on a cell phone when you dial a number. Can anyone see where I went wrong? Thanks in advanced! import java.awt.*; import java.awt.event.*; public class Telephone extends Frame implements ActionListener { Button keys[]; Panel keypad; TextField lcd; Label value; boolean foundKey; public Telephone() { lcd =new TextField(20); lcd.setEditable(false); keypad= new Panel (); keys= new Button[13]; //construct and assign captions to the buttons for (int i=0; i&lt;=9; i++) keys[i] = new Button(String.valueOf(i)); keys[10] =new Button ("*"); keys[11] =new Button ("0"); keys[12] =new Button ("#"); setBackground(Color.magenta); setLayout(new BorderLayout()); keypad.setLayout(new GridLayout(4,3,10,10)); //add keys for(int i=1; i&lt;=3; i++)//1,2,3 keypad.add(keys[i]); for (int i=4; i&lt;=6; i++)//4,5,6 keypad.add(keys[i]); for (int i=7; i&lt;=9; i++)//7,8,9 keypad.add(keys[i]); keypad.add(keys[10]); keypad.add(keys[11]); keypad.add(keys[12]); for (int i=0; i&lt;keys.length; i++) keys[i].addActionListener(this); //add componets to display add(lcd, BorderLayout.NORTH); add(keypad,BorderLayout.CENTER); //add() addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } } ); }//constructor ends public void actionPerformed(ActionEvent e) { foundKey = false; for (int i=0; i&lt;keys.length &amp;&amp;!foundKey;i++) { if(e.getSource() == keys[i]) foundKey=true; //switch(i) //{ // case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12: lcd.setText(lcd.getText()+ keys[i].getLabel()); // break; // }//end switch }//end for }//end actionPerformed public static void main(String args[]) { Telephone f = new Telephone(); f.setTitle("Telephone Application"); f.setBounds(50,130,250,300); f.setVisible(true); } }//class…
has title: Prints whole array not single value in Java Applet
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23602549
tagged with: arrays
tagged with: applet

http://stackoverflow.com/comment/36215075
comment on: http://stackoverflow.com/a/23593912
has text: you should the use the KEY_ID in db, not the ID from Spinner
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36124732
type: Comment
score: 1
has text: Also, in Java, the Integer class is Serializable.
comment on: http://stackoverflow.com/a/23545792
type: AnswerComment

http://stackoverflow.com/a/63832290
has body: The exact error message in my case was this one: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.14.RELEASE:repackage invalid entry size (expected 1 but got 0 bytes) I was about to create an empty clean Spring Boot project and wanted to build it, to see if everything was good. I found out that error was caused by the presence of en empty application.properties file. It was created but there was no any text in it. After I added a property (example, server.port: 19999), the project was built successfully.
score: 0
answers question: http://stackoverflow.com/q/23488093
type: Answer

http://stackoverflow.com/a/23495797
score: 0
has comment: http://stackoverflow.com/comment/36056192
has comment: http://stackoverflow.com/comment/36042727
type: Answer
has comment: http://stackoverflow.com/comment/36063297
has body: If you know that your image was originally a PNG, you can just save the result of getOriginalData() to a file. Otherwise, you can build a BufferedImage first: byte[] data = image.getOriginalData(); BufferedImage bi = ImageIO.read(new ByteArrayInputStream(data)); ImageIO.write(bi, "PNG", file);
answers question: http://stackoverflow.com/q/23495469

database
tags question: http://stackoverflow.com/q/23541627
tags question: http://stackoverflow.com/q/23455570
tags question: http://stackoverflow.com/q/23468182
tags question: http://stackoverflow.com/q/23544726
tags question: http://stackoverflow.com/q/23471866
tags question: http://stackoverflow.com/q/23501244
tags question: http://stackoverflow.com/q/23455101
tags question: http://stackoverflow.com/q/23527001
tags question: http://stackoverflow.com/q/23573061
tags question: http://stackoverflow.com/q/23553368
tags question: http://stackoverflow.com/q/23587897
tags question: http://stackoverflow.com/q/23566478
type: Tag
tags question: http://stackoverflow.com/q/23593805
tags question: http://stackoverflow.com/q/23545657
tags question: http://stackoverflow.com/q/23516452
tags question: http://stackoverflow.com/q/23532446
tags question: http://stackoverflow.com/q/23456524
tags question: http://stackoverflow.com/q/23539481
tags question: http://stackoverflow.com/q/23537080
tags question: http://stackoverflow.com/q/23469373
tags question: http://stackoverflow.com/q/23535988
tags question: http://stackoverflow.com/q/23513299
tags question: http://stackoverflow.com/q/23573327
tags question: http://stackoverflow.com/q/23559639
tags question: http://stackoverflow.com/q/23599479
tags question: http://stackoverflow.com/q/23573770
tags question: http://stackoverflow.com/q/23466288
tags question: http://stackoverflow.com/q/23531704
tag name: database
tags question: http://stackoverflow.com/q/23508719
tags question: http://stackoverflow.com/q/23486188
tags question: http://stackoverflow.com/q/23572363
tags question: http://stackoverflow.com/q/23552262
tags question: http://stackoverflow.com/q/23594656
tags question: http://stackoverflow.com/q/23584846
tags question: http://stackoverflow.com/q/23456520
tags question: http://stackoverflow.com/q/23477462
tags question: http://stackoverflow.com/q/23550156
tags question: http://stackoverflow.com/q/23550095
tags question: http://stackoverflow.com/q/23513564
tags question: http://stackoverflow.com/q/23565931
tags question: http://stackoverflow.com/q/23475696
tags question: http://stackoverflow.com/q/23468018
tags question: http://stackoverflow.com/q/23502167
tags question: http://stackoverflow.com/q/23467531
tags question: http://stackoverflow.com/q/23590116
tags question: http://stackoverflow.com/q/23613994
tags question: http://stackoverflow.com/q/23567071
tags question: http://stackoverflow.com/q/23461209

http://stackoverflow.com/comment/36035153
score: 0
type: Comment
type: QuestionComment
has text: The menu xml file contains an element with id `action_search`? Clean & Build project?
comment on: http://stackoverflow.com/q/23498033

http://stackoverflow.com/q/23465270
has comment: http://stackoverflow.com/comment/36014657
upvote count: 1
has title: <rich:popupPanel buttons not working in JSF Project
answer count: 1
favorite count: 0
tagged with: richfaces
has comment: http://stackoverflow.com/comment/35991890
has comment: http://stackoverflow.com/comment/36031902
has comment: http://stackoverflow.com/comment/36014623
tagged with: spring
has comment: http://stackoverflow.com/comment/35993237
accepted answer: http://stackoverflow.com/a/23540324
has body: In my JSF+Spring project i tried to add form and get values from popup window.but when buttons clicked then no debug point goes to relevant controller &amp; also function not worked. here shows my .xhtml file please refer that and advice me to sort out this issue thanks all... &lt;h:outputLink value="#" id="ll"&gt; &lt;rich:componentControl event="click" operation="show" target="lp"&gt; &lt;a4j:param name="event" value="event" noEscape="true" /&gt; &lt;rich:hashParam&gt; &lt;a4j:param noEscape="true" name="top" value="200" /&gt; &lt;a4j:param noEscape="true" name="left" value="200" /&gt; &lt;/rich:hashParam&gt; &lt;/rich:componentControl&gt; Tag SAM &lt;/h:outputLink&gt; &lt;rich:popupPanel id="lp" modal="false" height="300" width="500" autosized="false" resizeable="true"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="SAM Selector" /&gt; &lt;/f:facet&gt; &lt;a4j:commandButton value="Load SAM" action="#{pOSController.loadSamPosTagging()}" render=" #{rich:clientId('dataTableSamView')}" /&gt; &lt;a4j:commandButton value="Save Tagging" action="#{pOSController.saveSamPosTagging()}" render=" #{rich:clientId('dataTableSamView')}" /&gt; &lt;rich:dataTable style="width:80%;" rows="10" value="#{pOSController.selectedSamBeans}" var="samView" id="dataTableSamView"&gt; &lt;rich:column style="height:25px;"&gt; &lt;f:facet name="header" /&gt; &lt;h:selectBooleanCheckbox value="#{samView.selected}"&gt; &lt;f:selectItem itemValue="true" itemLabel="" /&gt; &lt;a4j:ajax immediate="true" execute="@this" /&gt; &lt;/h:selectBooleanCheckbox&gt; &lt;/rich:column&gt; &lt;rich:column&gt; &lt;f:facet name="header"&gt;SAM UID&lt;/f:facet&gt; &lt;h:outputText value="#{samView.samUid}" /&gt; &lt;/rich:column&gt; &lt;rich:column&gt; &lt;f:facet name="header"&gt;SAM DID&lt;/f:facet&gt; &lt;h:outputText value="#{samView.samDid}" /&gt; &lt;/rich:column&gt; &lt;rich:column&gt; &lt;f:facet name="header"&gt;Expire Date&lt;/f:facet&gt; &lt;h:outputText value="#{samView.expireDate}" /&gt; &lt;…
type: AnsweredQuestion
tagged with: jsf
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36113485
has answer: http://stackoverflow.com/a/23540324
type: Question

http://stackoverflow.com/a/23606450
has comment: http://stackoverflow.com/comment/36240461
accepted answer of: http://stackoverflow.com/q/23606360
answers question: http://stackoverflow.com/q/23606360
has body: You can create a subclass of Application and store the object there. Here's an example.
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36284460

http://stackoverflow.com/a/23612330
score: 7
answers question: http://stackoverflow.com/q/23612135
has body: This is your issue: MathContext mc = new MathContext(2, RoundingMode.HALF_UP); your are rounding the division to 2 decimal places. Use MathContext mc = new MathContext(15, RoundingMode.HALF_UP); instead (for example) and you should get something closer to the expected result. You can see the difference with: System.out.println(speed.divide(lightsSpeed,new MathContext(2, RoundingMode.HALF_UP))); System.out.println(speed.divide(lightsSpeed,new MathContext(15, RoundingMode.HALF_UP))); which prints: 0.45 0.445037630156818
downvote count: 0
type: Answer
upvote count: 7

http://stackoverflow.com/a/23525309
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23525209
has body: Here are my thoughts: I would not guess about a memory leak. The only reliable way to figure it out is to profile your code. Be a scientist - get data. Use Visual VM with all the plugins installed. It's a great tool and free. I would not do a database connection this way. Connections are not thread safe. A single connection doesn't feel very scalable, either. Better to have a connection pool that you check in and out in the narrowest scope possible. You don't show any of the database code, but you need to close all Statement, Connection, and ResultSet instances in a finally block in the scope of the method that creates them. Each one should be closed in an individual try/catch block. This will show up as a problem beyond memory leaks in your crawler: Your database server will eventually run out of cursors. It's a problem both for the client and the database server if you fail to clean up properly. Different threads should NOT be sharing a single connection. This will lead to grief. Set up a connection pool and then profile. You might be surprised at where the leak shows up.
has comment: http://stackoverflow.com/comment/36086571
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23525209
type: Answer

http://stackoverflow.com/comment/36084385
has text: @ZongZhengLi Yes, and how would i get it so i can iterate through each zone in the zones list of the config.yml file.
score: 0
comment on: http://stackoverflow.com/q/23524243
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36012680
has text: Exception in thread "main" java.lang.NullPointerException at Driver.main(Driver.java:13)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23485842

http://stackoverflow.com/a/28060682
type: Answer
score: 13
upvote count: 13
downvote count: 0
answers question: http://stackoverflow.com/q/23526644
has body: This may be close to what you were looking for: @Override public void configure(HttpSecurity http) throws Exception { http.requestMatcher(new OAuthRequestedMatcher()) .authorizeRequests() .anyRequest().authenticated(); } private static class OAuthRequestedMatcher implements RequestMatcher { @Override public boolean matches(HttpServletRequest request) { String auth = request.getHeader("Authorization"); // Determine if the client request contained an OAuth Authorization return (auth != null) &amp;&amp; auth.startsWith("Bearer"); } } The only thing this doesn't provide is a way to "fall back" if the authentication isn't successful. To me, this approach makes sense. If a User is directly providing authentication to the request via Basic auth, then OAuth is not necessary. If the Client is the one acting, then we need this filter to step in and make sure the request is properly authenticated.

http://stackoverflow.com/q/23556561
type: UnansweredQuestion
score: -4
upvote count: 1
has title: What is the long code for array[random]++
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/36144896
type: Question
tagged with: random
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/36144968
favorite count: 0
has answer: http://stackoverflow.com/a/23556594
tagged with: increment
has body: What is the long code for freq[1+dice.nextInt(6)]++; Since a++ is a=a+1 then array[random]++ is ? Here is my code... Random dice = new Random(); int freq[] = new int[7]; for(int roll=0;roll&lt;1000;roll++){ ++freq[1+dice.nextInt(6)]; } System.out.println("Face\tFrequency"); for(int face=1;face&lt;freq.length;face++){ System.out.println(face + "\t" + freq[face]); } The sum of Frequency should be exactly 1000.

http://stackoverflow.com/comment/36051733
comment on: http://stackoverflow.com/q/23506651
type: Comment
type: QuestionComment
score: 1
has text: Did you expect that deserializing the class would be faster than constructing the object in memory? ...No.

http://stackoverflow.com/comment/36131815
score: 0
type: Comment
type: QuestionComment
has text: Why do you care if `getInstance()` is stubbed or not?
comment on: http://stackoverflow.com/q/23549482

http://stackoverflow.com/comment/36453270
has text: Thank you I have solved it by add the jar files directly instead of add the dictionary that includes these jar files.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23588751
type: AnswerComment

http://stackoverflow.com/comment/36222420
comment on: http://stackoverflow.com/q/23598003
type: Comment
type: QuestionComment
has text: @CommonsWare OK - got it. I do see them, but the red x's are giving only the information (and I am using Eclipse), that simply says "R cannot be resolved to a variable"
score: 0

http://stackoverflow.com/comment/36234485
type: QuestionComment
comment on: http://stackoverflow.com/q/23604648
score: 0
has text: read about explicit intents @ http://developer.android.com/guide/components/intents-filters.html
type: Comment

http://stackoverflow.com/a/23608927
answers question: http://stackoverflow.com/q/23604769
has body: OK I have found the way. I used the property in servlet declaration and it works fine. Here is the snippet from web.xml: angular /static/index.html angular /static/overview
type: Answer
score: 0

http://stackoverflow.com/q/23479666
favorite count: 0
upvote count: 8
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23479831
tagged with: swing
has title: Creating a simple custom JComponent in Java?
has answer: http://stackoverflow.com/a/23480259
has answer: http://stackoverflow.com/a/23479809
score: 7
tagged with: java
tagged with: jcomponent
downvote count: 1
type: Question
answer count: 3
has body: I want to start building my own customized JComponent's for a project at work. I have a simple example below that should just create a ball on the screen. (I found most of it on the internet) but it does provide a decent starting point. My question is why does this code not show the ball in my form? What have I done wrong? Also what would be all of the basic methods that SHOULD be provided for a custom JComponent? Code: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.GridBagLayout; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; public class testBall { public static void main(String[] args) { new testBall(); } public testBall() { JPanel testPane = new JPanel(); testPane.setBackground(Color.white); testPane.setLayout(new GridBagLayout()); testPane.add(new MyBall(30,30,10)); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(testPane); frame.pack(); frame.setSize(500, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); } } class MyBall extends JComponent { private static final long serialVersionUID = 1L; public MyBall() { } public MyBall(int x, int y, int diameter) { super(); this.setLocation(x, y); this.setSize(diameter, diameter); } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.red); g.fillOval(0, 0, 100, 100); } } Where I could find a list of all of the methods that should be overridden in a JComponent class? (I know there are ones that should always be included in JComponent.) If I make an instance of this component in a class and need to change the color of the circle would I just call there repaint() method from that class?
tagged with: preferredsize
tagged with: paintcomponent

keystroke
type: Tag
tag name: keystroke
tags question: http://stackoverflow.com/q/23573097

http://stackoverflow.com/comment/36071268
type: QuestionComment
type: Comment
has text: I just downgraded from guice 4beta4 to guice 3 and the same error occurs.
comment on: http://stackoverflow.com/q/23503484
score: 0

http://stackoverflow.com/comment/36121437
has text: I'd be a little surprised if an InputStream sourced from the network supports rewinding.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23543475
type: Comment

http://stackoverflow.com/q/23491255
has body: Well, i'm trying to read a string with scanner in the same line. For exapme ,i want to read: Monday 12 December 2013 and this needs to be put in a String variable so as to help me print it. In my code there is this: sale.setDate(sc.next()); with the command sc.next() i can't put a date in the form i mentioned but only in a form like: mmddyy or mm/dd/yyyy How can i read a whole string like "Monday 12 December 2013 " ? There is a confusion for me about sc.next sc.nextLine etc..
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23491442
has answer: http://stackoverflow.com/a/23491400
has answer: http://stackoverflow.com/a/62816800
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/52654947
type: Question
has title: Read date in Java with Scanner
has comment: http://stackoverflow.com/comment/36022193
downvote count: 0
has comment: http://stackoverflow.com/comment/36022207
has answer: http://stackoverflow.com/a/42083313
answer count: 7
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/42084829
has answer: http://stackoverflow.com/a/23491434
tagged with: java.util.scanner

http://stackoverflow.com/a/24221779
answers question: http://stackoverflow.com/q/23564525
type: Answer
score: 0
has body: Using this dependency statement I was able to resolve the problem. &lt;dependency org="org.springframework" name="spring-tx" rev="3.2.9.RELEASE" transitive="false" conf="compile-&gt;default;runtime-&gt;default;"/&gt;

http://stackoverflow.com/comment/88932496
score: 0
type: Comment
comment on: http://stackoverflow.com/a/32355665
has text: @ttati Thanks!! Could you please add the versions of the dependencies?
type: AnswerComment

http://stackoverflow.com/a/23477143
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23476303
answers question: http://stackoverflow.com/q/23476303
has body: Simple Solution :- In each of the flow place a logger with a value #[flow.name] ... This will help to detect which flow has been executed ... for example :- place a logger &lt;logger message="Flow name:- #[flow.name]" level="INFO" doc:name="Logger"/&gt; will get the flow name in console .. you can use this logger in any flow to get the name ... you can use this Mule expression #[flow.name] to get the name of the flow

http://stackoverflow.com/comment/36087930
has text: Create a model which can be shared between the view and controller
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23524737

http://stackoverflow.com/a/23456784
has comment: http://stackoverflow.com/comment/35958476
has body: The best way is probably to use ImageIO to read the Image from the jar. Image image = ImageIO.read(this.getClass().getResource("/me/spedwards/program/Icon.ico")); setIconImage(image);
type: Answer
has comment: http://stackoverflow.com/comment/35958519
has comment: http://stackoverflow.com/comment/35959014
has comment: http://stackoverflow.com/comment/56810859
has comment: http://stackoverflow.com/comment/35958751
answers question: http://stackoverflow.com/q/23456627
score: 4
has comment: http://stackoverflow.com/comment/35959041
has comment: http://stackoverflow.com/comment/35958357
upvote count: 4
has comment: http://stackoverflow.com/comment/35958432
downvote count: 0
has comment: http://stackoverflow.com/comment/35958210
has comment: http://stackoverflow.com/comment/35958308

http://stackoverflow.com/q/23464902
has comment: http://stackoverflow.com/comment/35977549
has comment: http://stackoverflow.com/comment/35974461
has answer: http://stackoverflow.com/a/23464966
has answer: http://stackoverflow.com/a/23514280
score: 0
answer count: 2
has title: How do I create and run an executable jar with maven that has external dependencies?
tagged with: executable-jar
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/574594
tagged with: maven
has comment: http://stackoverflow.com/comment/35973962
has body: I have a jar plugin but it's not running because it isn't including the external dependencies in the jar. I can't seem to figure out how to include these dependencies, I seem to be finding a bunch of different solutions that conflict with each other for some reason. I ideally would like it to run on systems without the need for any special maven commands.
type: Question

http://stackoverflow.com/comment/36087813
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23523820
has text: @demongolem I and many, if not most, high rep users are probably just going to stop answering questions if these questions are permitted. See several discussions on meta.stackoverflow.com

http://stackoverflow.com/comment/36204054
type: AnswerComment
comment on: http://stackoverflow.com/a/23588284
type: Comment
score: 0
has text: Now it says… "com.mysql.jbdc.exceptions.jbdc4.MySQLSyntaxErrorException: You have an error in you SQL syntax;check the manual that corresponds to your MySQL server version for the right syntax to use near’=’1 at line1."

http://stackoverflow.com/comment/36153803
type: Comment
has text: @user3590830 yes. You've got a bug in code not shown.
comment on: http://stackoverflow.com/a/23555286
score: 0
type: AnswerComment

http://stackoverflow.com/q/23583391
has comment: http://stackoverflow.com/comment/36219798
upvote count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/36212728
has comment: http://stackoverflow.com/comment/36219638
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36219666
has comment: http://stackoverflow.com/comment/36212742
score: 3
has comment: http://stackoverflow.com/comment/36219713
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36219471
has body: I have set up a project using Hibernate through JPA -- i.e. I am defining a persistence unit and working through the EntityManager (e.g. using EntityManager's find() method). I have annotated entity A and B like this: @Entity class A { @Id @Column private Integer id; @ManyToOne(fetch=FetchType.EAGER, optional = false) @Fetch(FetchMode.JOIN) @JoinColumn(name="b_id") private B bInstance; ... } @Entity class B { @Id @Column(name = "b_id") private Integer id; ... @OneToMany(fetch = FetchType.LAZY, mappedBy = "bInstance") private Set&lt;A&gt; As = new HashSet&lt;A&gt;(); } Now when I call findById(Integer id) to get an A element, I am still getting two select queries instead of a single one with an inner join to the B table. I know @Fetch is a Hibernate annotation so I'm losing JPA's standard, but shouldn't it be working yet? For the record, this is my findById method in my Gneric Dao: public E findById(Class&lt;E&gt; persistentClass, ID primaryKey) { validateFindById(persistentClass, primaryKey); disableFilter(persistentClass); return (E) getEntityManager().find(persistentClass, primaryKey); }
type: Question
tagged with: jpa
downvote count: 0
has title: Hibernate ignoring fetch annotation through JPA
has comment: http://stackoverflow.com/comment/36219492

http://stackoverflow.com/a/23528134
answers question: http://stackoverflow.com/q/23528015
score: 0
has body: The way of searching for an object in an array list is with the indexOf method. Example: int x = myAList.indexOf(myObject) It returns the position of myObject in the ArrayList or -1 if it's not there.
type: Answer

http://stackoverflow.com/a/23541161
type: Answer
has body: You need to firm up your requirements. Currently all you have told us is that APR-JUN 2010 should translate to the last day of June. But what about FEB-JUN 2010? Should that also translate to the last day of June? Or should it throw a parse exception due to not being a full quarter? What about JUL-JUN 2010, where the second month is before the first? What about MAY-JUL 2010 -- three months but perhaps your definition of "quarter" requires starts of January, April, July, October. Once you have your own requirements down, you can get to work on the conversion. It's unlikely that an existing DateFormat implementation will do this exact task for you. You're likely to need to parse the string in your own code. If the only legal options are JAN-MAR, APR-JUN, JUL-SEP, OCT-DEC, then you just have a five-way switch statement to set the month and day on a Calendar object (the fifth way being a default: case that throws an exception. If your requirement is more complex, then your code will need to be more complex. Breaking the string into parts using a regex would be a good first step. Pattern patt = Pattern.compile("(.{3})-(.{3}) (\d+)"); Matcher matcher = patt.matcher(qaurterString); if(! matcher.find() || m.groupCount() != 3) { throw new ParseException(...) } String fromMonth = matcher.group(1); String toMonth = matcher.group(2); int year = Integer.parseInt(matcher.group(3)); I think you'll have to write parsing code from scratch, whatever you do. The neatest end result would for you to create a class that implements DateFormat.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23540697
score: 3
answers question: http://stackoverflow.com/q/23540697
has comment: http://stackoverflow.com/comment/41311283
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36183374
score: 1
comment on: http://stackoverflow.com/a/23576927
has text: That is correct, if you add Integer, you get Integer; if you add Node then you get Node, and so on...
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23463253
accepted answer: http://stackoverflow.com/a/23463899
upvote count: 2
type: AnsweredQuestion
score: 2
has body: I have a problem, well when I save my object to the DB it works fine, but when i want to retrieve it from the DB doesn't work, I'm using selectItemsConverter by Omnifaces I have my Object "Modelo" which has two other objects inside, which are "Marca" and "Gama" These are my Java entities (the toString() is for Omnifaces): Modelo: private Marca marca; private Gama gama; getters and setters... @Override public String toString() { return String.format("%s[codigo=%d]", getClass().getSimpleName(), getCodigo()); } Marca: getters and setters... @Override public String toString() { return String.format("%s[codigo=%d]", getClass().getSimpleName(), getCodigo()); } Gama: getters and setters... @Override public String toString() { return String.format("%s[codigo=%d]", getClass().getSimpleName(), getCodigo()); } Well and this is my managedBean ModeloBean @ManagedBean @ViewScoped public class ModeloBean { private Modelo modelo = new Modelo(); getters and setters ... //This is for call the DB to retrieve the value, and works fine, but i cant show the preselected value to the xhtml public void leer(Modelo mo) throws Exception { ModeloDAO dao = new ModeloDAO(); try { this.init(); this.modelo = dao.leer(mo); } catch (Exception e) { throw e; } finally { dao = null; } } This is my xhtml Page I have a dialog which I used it for save and update an object <p:dialog id="dlgDatos" widgetVar="wdlgDatos" modal="true" appendToBody="true" header="#{modeloBean.accion}" draggable="false" resizable="false"> <h:form> <h:panelGrid columns="2"> <p:outputLabel value="Marca" /> <p:selectOneMenu value="#{modeloBean.modelo.marca}" converter="omnifaces.SelectItemsConverter" filter="true" filterMatchMode="startsWith" required="true"> <f:selectItem itemLabel="Seleccione" itemValue="#{null}" noSelectionOption="true" /> <f:selectItems value="#{marcaBean.lstMarcasVigentes}" var="marca" itemLabel="#{marca.nombre}" itemValue="#{marca}" /> </p:selectOneMenu> <p:outputLabel value="Gama" /> <p:selectOneMenu value="…
has title: SelectItemsConverter Omnifaces preselected object value?
tagged with: java
tagged with: omnifaces
type: Question
tagged with: jsf-2
has answer: http://stackoverflow.com/a/23463899
downvote count: 0
tagged with: selectonemenu
tagged with: converters
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36077758
score: 0
has text: Code added. I tried btpka3 answere. Where I can find the pom.xml file?
comment on: http://stackoverflow.com/q/23517244
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36250828
type: QuestionComment
score: 0
has text: @chrylis where did you see that?
type: Comment
comment on: http://stackoverflow.com/q/23612084

http://stackoverflow.com/q/23495260
type: UnansweredQuestion
tagged with: web-services
has title: jax-ws why does the method call not work?
tagged with: java
tagged with: jax-ws
type: Question
has body: HI I got the problem that my code is not working but also does not throw an exception or anything else. The program just keeps stuck and nothing is happening. The code sample comes here and can be tested by anyone. you get the classes with "wsimport -keep -extension http://ars-fiverx.de:8445/WsEchoService.svc?wsdl" URL url = new URL("http://ars-fiverx.de:8445/WsEchoService.svc?wsdl"); QName qname = new QName("http://tempuri.org/", "WsEchoService"); Service service = Service.create(url, qname); IWsEchoService iWsEchoService = service.getPort(IWsEchoService.class); System.out.println(iWsEchoService.echo()); I'm absolutely out of ideas and I don't know what to do... hope that someone can help...
has comment: http://stackoverflow.com/comment/36030836
score: 0
has comment: http://stackoverflow.com/comment/36032251
tagged with: soap
tagged with: soap-client
answer count: 0

http://stackoverflow.com/q/23561104
has comment: http://stackoverflow.com/comment/36162771
downvote count: 1
answer count: 7
has answer: http://stackoverflow.com/a/59107971
upvote count: 40
has answer: http://stackoverflow.com/a/30591269
favorite count: 0
score: 39
has answer: http://stackoverflow.com/a/50275722
has title: How to encrypt and decrypt String with my passphrase in Java (Pc not mobile platform)?
has body: I want to encrypt a string and then put it on a file. Also want to decrypt it when I want. I don’t need very strong security. I just want to make it harder to get my data others. I tried several ways. Here are these. Md5 Encryption: How to hash a string in Android? public static final String md5(final String toEncrypt) { try { final MessageDigest digest = MessageDigest.getInstance("md5"); digest.update(toEncrypt.getBytes()); final byte[] bytes = digest.digest(); final StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; bytes.length; i++) { sb.append(String.format("%02X", bytes[i])); } return sb.toString().toLowerCase(); } catch (Exception exc) { return ""; // Impossibru! } } I tried this function and able to encrypt a string but I can’t decrypt data from it. So it is not the solution. DES Encryption: Encrypt and decrypt a String in java Here passphrase is Auto generated. Is always passphrase will same on all time? Then where is my security. So it is not my solution too. AES Encryption: How do I encrypt/decrypt a string with another string as a password? I also tried Aes from this link. Here key is also auto generated? Is there any other way?
has answer: http://stackoverflow.com/a/30591380
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/107548619
tagged with: encryption
has answer: http://stackoverflow.com/a/32583766
linked to: http://stackoverflow.com/q/7762771
linked to: http://stackoverflow.com/q/3934331
tagged with: java
has answer: http://stackoverflow.com/a/39974198
linked to: http://stackoverflow.com/q/4551263
type: Question
duplicate of: http://stackoverflow.com/q/992019
linked to: http://stackoverflow.com/q/3954611
linked to: http://stackoverflow.com/q/4487525
linked to: http://stackoverflow.com/q/992019
has answer: http://stackoverflow.com/a/59446141

http://stackoverflow.com/q/23506429
has answer: http://stackoverflow.com/a/69067167
tagged with: java
has answer: http://stackoverflow.com/a/58207467
has title: How to read multiple Integer values from a single line of input in Java?
has answer: http://stackoverflow.com/a/23506457
has answer: http://stackoverflow.com/a/68956705
has answer: http://stackoverflow.com/a/36946489
has answer: http://stackoverflow.com/a/55943178
has answer: http://stackoverflow.com/a/25173354
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/70235749
has answer: http://stackoverflow.com/a/37428954
has body: I am working on a program and I want to allow a user to enter multiple integers when prompted. I have tried to use a scanner but I found that it only stores the first integer entered by the user. For example: Enter multiple integers: 1 3 5 The scanner will only get the first integer 1. Is it possible to get all 3 different integers from one line and be able to use them later? These integers are the positions of data in a linked list I need to manipulate based on the users input. I cannot post my source code, but I wanted to know if this is possible.
has answer: http://stackoverflow.com/a/48639407
has answer: http://stackoverflow.com/a/23507185
has answer: http://stackoverflow.com/a/53606421
has answer: http://stackoverflow.com/a/23506484
favorite count: 0
has answer: http://stackoverflow.com/a/48114659
score: 40
has answer: http://stackoverflow.com/a/53902103
has answer: http://stackoverflow.com/a/23506492
has answer: http://stackoverflow.com/a/41055530
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/36051718
type: Question
has answer: http://stackoverflow.com/a/71383426
has answer: http://stackoverflow.com/a/54025034
tagged with: input
has answer: http://stackoverflow.com/a/26654259
answer count: 21
upvote count: 40
has comment: http://stackoverflow.com/comment/36051360
has answer: http://stackoverflow.com/a/56748749

http://stackoverflow.com/a/23465415
answers question: http://stackoverflow.com/q/23462547
score: 0
type: Answer
has body: Go to File -> Switch Workspace -> Other. Follow the prompts. The Eclipse UI is complex.

http://stackoverflow.com/comment/36201945
has text: For an entry (r,c) of a matrix, you can say: When `r==c` then the entry is on the diagonal, and when `r==(size-1-c)` then the entry is on the other diagonal.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23587157
type: Comment

http://stackoverflow.com/comment/36233776
has text: If you leave matchSender out?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23603880

http://stackoverflow.com/comment/36018654
type: Comment
comment on: http://stackoverflow.com/a/23473966
type: AnswerComment
score: 1
has text: Did you add BOTH the `games` and `appstate` ID entries to the manifest? What error are you getting in logcat (maybe edit your question above and add it)?

http://stackoverflow.com/a/42083313
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23491255
type: Answer
has body: Even i faced the same issue but after that able to resolve with below mentioned code. Hope it helps. import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Scanner; public class Datinput { public static void main(String args[]) { int n; ArrayList&lt;String&gt; al = new ArrayList&lt;String&gt;(); Scanner in = new Scanner(System.in); n = in.nextInt(); String da[] = new String[n]; SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); sdf.setLenient(false); Date date[] = new Date[n]; in.nextLine(); for (int i = 0; i &lt; da.length; i++) { da[i] = in.nextLine(); } for (int i = 0; i &lt; da.length; i++) { try { date[i] = sdf.parse(da[i]); } catch (ParseException e) { e.printStackTrace(); } } in.close(); } }

http://stackoverflow.com/comment/36110231
score: 0
type: AnswerComment
has text: if i have to perform script i could have done it using servlets ,that will be an equivalnet efforts ..to hit on servlet and check for a variable in db such that its updated or not .but i need somthing efficiet not eazy one.
type: Comment
comment on: http://stackoverflow.com/a/23538150

http://stackoverflow.com/a/23512338
score: 0
has body: Read about this problem: https://code.google.com/p/selenium/issues/detail?id=3000 #56, #57 are helpful comments... "you may try increasing the default maximum number of ephemeral TCP ports as written here: http://support.microsoft.com/kb/196271/en-us"
type: Answer
answers question: http://stackoverflow.com/q/23510836

http://stackoverflow.com/comment/36148322
type: QuestionComment
comment on: http://stackoverflow.com/q/23556772
has text: I just gave an example of JSon object stream. Format may not be correct. What I need is parsing a stream of objects which is not in the format of json array.
score: 0
type: Comment

http://stackoverflow.com/comment/38499705
has text: Thank you for this hint. I had a `java.lang.IllegalStateException: Cannot convert value of type [org.hibernate.internal.SessionFactoryImpl] to required type [org.hibernate.SessionFactory] for property 'sessionFactory': no matching editors or conversion strategy found` after upgrading from hibernate 4.0.1 to 4.3.5. The reason was the usage of the statistics service.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23606322
type: Comment

http://stackoverflow.com/comment/36133013
type: QuestionComment
has text: Open the build file and see if the path, `/usr/lib/jvm/java-6-openjdk-amd64/`, is hardcoded in the file. I would expect it use something like `$JAVA_HOME/lib/tools.jar`. Also, verify if `echo $JAVA_HOME` gives you the correct path.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23550283

http://stackoverflow.com/comment/36163491
score: 0
comment on: http://stackoverflow.com/q/23565170
type: Comment
type: QuestionComment
has text: Yeah, my bad. It's kind of easy to call it a thread, since my perception of Thread/Runnable is like equal to each other, but they in fact are not (Thread implements Runnable, but not the other way around). Thanks for pointing this out though.

http://stackoverflow.com/a/23541301
upvote count: 1
has comment: http://stackoverflow.com/comment/36116186
answers question: http://stackoverflow.com/q/23541092
score: -1
has comment: http://stackoverflow.com/comment/36118838
has comment: http://stackoverflow.com/comment/36116247
has comment: http://stackoverflow.com/comment/36116052
downvote count: 2
type: Answer
has body: There are two options.... 1)Either make res a "source folder" . You will know this if you are using Eclipse. Then you can use like ImageIO.read(new File("res/icon.jpg")); 2) If res is a normal folder, you will have to use. In this case res will be considered as a package ImageIO.read(new File("src/res/icon.jpg"));
has comment: http://stackoverflow.com/comment/36118468

http://stackoverflow.com/comment/36211413
comment on: http://stackoverflow.com/a/23591925
type: AnswerComment
has text: java.lang.NullPointerException at mypackage.Hospital.SearchPatient(Hospital.java:118) at controller.NewServlet.processRequest(NewServlet.java:45) at controller.NewServlet.doGet(NewServlet.java:78) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
type: Comment
score: 0

http://stackoverflow.com/comment/36216625
comment on: http://stackoverflow.com/a/23586012
type: AnswerComment
score: 0
type: Comment
has text: thank you very much! i realise that you got the M and S matrix counters -1 but here: int q = m[i-1][k-1] + m[k][j-1] + p[i - 2] * p[k-1] * p[j-1]; the array P should stay i-1, k and j. i got it working thou thx very much!

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/23588895
type: Tag

http://stackoverflow.com/comment/36000128
type: Comment
has text: That's not absolutely necessary (or even advisable). If the application is a part of a deployed web application then ensure the JAR is deployed to `WEB-INF/classes`
type: AnswerComment
comment on: http://stackoverflow.com/a/23478518
score: 0

http://stackoverflow.com/a/23480249
type: Answer
upvote count: 2
has body: Make sure that you have a JDK defined under: File -> Project Structure -> SDKs And that you project is associated with the SDK/JDK here: File -> Project Structure -> Project -> "Project SDK"
answers question: http://stackoverflow.com/q/23480119
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36002469

jpanel
tags question: http://stackoverflow.com/q/23592336
tags question: http://stackoverflow.com/q/23601267
tags question: http://stackoverflow.com/q/23524737
tags question: http://stackoverflow.com/q/23590450
tags question: http://stackoverflow.com/q/23557733
tags question: http://stackoverflow.com/q/23531652
tags question: http://stackoverflow.com/q/23554176
tags question: http://stackoverflow.com/q/23585423
tags question: http://stackoverflow.com/q/23458687
type: Tag
tags question: http://stackoverflow.com/q/23555676
tags question: http://stackoverflow.com/q/23479615
tags question: http://stackoverflow.com/q/23479570
tags question: http://stackoverflow.com/q/23459290
tags question: http://stackoverflow.com/q/23479355
tags question: http://stackoverflow.com/q/23531632
tags question: http://stackoverflow.com/q/23589396
tags question: http://stackoverflow.com/q/23523154
tags question: http://stackoverflow.com/q/23516980
tags question: http://stackoverflow.com/q/23531112
tags question: http://stackoverflow.com/q/23541267
tags question: http://stackoverflow.com/q/23597366
tags question: http://stackoverflow.com/q/23576889
tags question: http://stackoverflow.com/q/23500961
tags question: http://stackoverflow.com/q/23505528
tags question: http://stackoverflow.com/q/23600964
tags question: http://stackoverflow.com/q/23552310
tags question: http://stackoverflow.com/q/23506137
tags question: http://stackoverflow.com/q/23595073
tags question: http://stackoverflow.com/q/23484827
tags question: http://stackoverflow.com/q/23584863
tags question: http://stackoverflow.com/q/23507512
tags question: http://stackoverflow.com/q/23455667
tag name: jpanel
tags question: http://stackoverflow.com/q/23573671
tags question: http://stackoverflow.com/q/23496289
tags question: http://stackoverflow.com/q/23485530
tags question: http://stackoverflow.com/q/23551472
tags question: http://stackoverflow.com/q/23477974
tags question: http://stackoverflow.com/q/23547922
tags question: http://stackoverflow.com/q/23573169
tags question: http://stackoverflow.com/q/23461643
tags question: http://stackoverflow.com/q/23476355

http://stackoverflow.com/comment/35991884
has text: possible duplicate of [Variable might not have been initialized error](http://stackoverflow.com/questions/2448843/variable-might-not-have-been-initialized-error)
type: Comment
comment on: http://stackoverflow.com/q/23474957
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36231767
type: AnswerComment
score: 0
has text: Suppose you are making 100 RPC calls with different type of AsyncCallbacks then you have to override `onFailure()` method for all the calls but by extending single class `MyAsyncCallback` that I provided in my post will responsible for `onFailure()` method, you don'tn need to implement `onFailure()` for all 100 RPC calls of different type of AsyncCallbacks. I hope you got it now. I summarize it again **single `onFailure()` method for all the RPC calls for whole application.**
type: Comment
comment on: http://stackoverflow.com/a/23589125

http://stackoverflow.com/q/23536854
has body: I've tried to upgrade Spring version from 3.1.2 to 3.2.8 on the WebSphere 8.5, but I've got the error: CWNEN0047W: Resource annotations on the fields of the org.springframework.web.servlet.DispatcherServlet class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.springframework.web.context.WebApplicationContext The jar spring-web-3.2.8.RELEASE.jar is present in the WAR/WEB-INF/lib directory. The archive is not damaged, the WebApplicationContext class is present there. Everything looks like before, only the spring version is higher. Everything is working with Spring 3.1.2 with the same maven build configuration and EAR descriptors! But after changing Spring version (and nothing more), the mentioned error occurs. Is there anything special that must be done when upgrading Spring version on Websphere? Or it's just a kind of incompatibility? That call comes somewhere from JmxMBeanServer. It comes in the web application initialization phase, when the EAR is deployed/updated from IBM RAD. Full stack trace included: [5/8/14 10:12:42:866 CEST] 0000004b InjectionProc W CWNEN0047W: Resource annotations on the fields of the org.springframework.web.servlet.DispatcherServlet class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.springframework.web.context.WebApplicationContext at java.lang.J9VMInternals.verifyImpl(Native Method) at java.lang.J9VMInternals.verify(J9VMInternals.java:93) at java.lang.J9VMInternals.verify(J9VMInternals.java:91) at java.lang.J9VMInternals.prepare(J9VMInternals.java:490) at java.lang.Class.getDeclaredFields(Class.java:605) at com.ibm.wsspi.injectionengine.InjectionProcessor.getAllDeclaredFields(InjectionProcessor.java:554) at com.ibm.wsspi.injectionengine.InjectionProcessor.processAllAnnotations(InjectionProcessor.java:722) at com.ibm.wsspi.injectionengine.InjectionProcessorContextImpl.processAllAnnotations(Injection…
has answer: http://stackoverflow.com/a/23537223
upvote count: 2
type: UnansweredQuestion
tagged with: spring
score: 2
tagged with: java
type: Question
tagged with: websphere
downvote count: 0
tagged with: websphere-8
has title: Upgrade to Spring 3.2 on Websphere 8.5 error: Resource annotations on DispatcherServlet will be ignored
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36193485
score: 0
type: Comment
has text: You really only need to start with the Swing tutorial on [Custom Painting](http://docs.oracle.com/javase/tutorial/uiswing/painting/index.html) for the basics, (such as also overriding the getPreferredSize() to return the size of the panel). The other tutorial is more technical and won't help with this issue.
comment on: http://stackoverflow.com/a/23582406
type: AnswerComment

http://stackoverflow.com/q/23579929
has comment: http://stackoverflow.com/comment/36188431
type: Question
has comment: http://stackoverflow.com/comment/36188485
upvote count: 0
score: -2
has body: I am looking for a method to export the execution time of a programm to matlab. I worked with copy/paste method so far ^^ I don't have any experience concerning file interactions with anything else than the console output. So thanks for detailed answers. So what I imagine to do is storing the results in some matlab-compatible file but any other ideas are welcome. The aim is basically to convert a java array to a matlab matrix. I am using Eclipse. Thanks for any help
accepted answer: http://stackoverflow.com/a/23580314
favorite count: 0
tagged with: type-conversion
answer count: 1
has comment: http://stackoverflow.com/comment/36188271
downvote count: 2
tagged with: file
has title: exporting java runtimes to matlab
tagged with: matlab
has answer: http://stackoverflow.com/a/23580314
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/57363652
has text: @AlexR Enumeration<String> e = props.getNames(); gives an error. getNames() gives a `cannot find symbol`
comment on: http://stackoverflow.com/a/23510498
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36138710
comment on: http://stackoverflow.com/q/23552345
type: QuestionComment
has text: @user3615601: yes you can do this. Again, the devil's in the details -- are you using the right references? Again, consider creating and posting a minimal example.
score: 0
type: Comment

http://stackoverflow.com/a/23597234
has comment: http://stackoverflow.com/comment/36220852
has comment: http://stackoverflow.com/comment/36220920
has body: Try this: Scanner input = new Scanner(System.in); int num = input.nextInt();
answers question: http://stackoverflow.com/q/23597210
score: 0
type: Answer

http://stackoverflow.com/comment/36210441
has text: So it means its mandatory to enable second level cache to use query cache. Can't query cache be used without second level cache?
comment on: http://stackoverflow.com/a/23591552
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/24081365
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23469824
type: Answer
has body: This issue was due to the Hibernate3.jar in my lib. Once I replaced it, everything worked well.
accepted answer of: http://stackoverflow.com/q/23469824
score: 0

http://stackoverflow.com/comment/36229397
type: QuestionComment
comment on: http://stackoverflow.com/q/23601746
score: 0
type: Comment
has text: @Vince Emigh I am sorry, I forgot to put the complete question. I have edited the question and have put the complete question now. Here middle indexing is at 2 for the value 3 from the left side for my question above.

http://stackoverflow.com/comment/36131250
has text: Where is the Sites factory method in you ObjectFactory class? You either remove it or your XSD does not correspond with provided XML.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23537108

http://stackoverflow.com/comment/36047310
comment on: http://stackoverflow.com/a/23504332
type: AnswerComment
type: Comment
score: 4
has text: `Integer` (and all other non-fp `Number` implementations) uses [Flyweight pattern](http://stackoverflow.com/a/2707195) for values between -128 en 127. Try a number outside this range :)

http://stackoverflow.com/q/23492804
type: Question
tagged with: debugging
tagged with: intellij-idea
tagged with: jpa
downvote count: 0
has body: We have Maven projects with Eclipselink 2.5.1 integration. Unit tests using IntelliJ stop working for me with error: Error:java: error: Annotation processor 'org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor' not found But it worked for me with Eclipselink 2.3 and still working using maven commands. May be somebody have solution for this issue?
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: IntelliJ Idea: org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor not found
tagged with: maven
score: 1
has comment: http://stackoverflow.com/comment/36031525
tagged with: java

http://stackoverflow.com/comment/35954074
has text: All right, take a look at my updated solution. Sorry for missing that the first time around. Basically I moved the part where I removed the question mark to another `Pattern` that is applied after duplicates are removed.
comment on: http://stackoverflow.com/a/23454047
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23564151
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23564041
upvote count: 1
type: Answer
has body: Not only PrintWriter can't do that. All other Writers and OutputStreams can't do it either. Not even random access channels can do it (on its own). This is because "a line" does not have a specific length. And in addition, if you want to insert something, you would have to move everything else that comes after it. What you can do is to re-position a stream and overwrite that what is there.

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/23465255
type: Tag
tags question: http://stackoverflow.com/q/23549020

http://stackoverflow.com/q/23601161
has answer: http://stackoverflow.com/a/23604243
accepted answer: http://stackoverflow.com/a/23604243
favorite count: 0
has title: How to use Struts 2 token in JQuery Ajax?
tagged with: ajax
has body: How to use Struts2 token in jQuery Ajax? Here is my sample code but it returns empty value. &lt;body&gt; &lt;s:token /&gt; &lt;script&gt; var strutsToken = "&lt;s:property value="#session['struts.tokens.token']" /&gt;"; var token = { "struts.token.name": "token", "token": strutsToken }; alert(token.token); &lt;/script&gt; &lt;s:if test="hasActionErrors()"&gt; &lt;s:actionerror /&gt; &lt;/s:if&gt; &lt;br&gt; &lt;s:form action="UpdateUser"&gt; &lt;s:textfield name="name" label="User Name"&gt;&lt;/s:textfield&gt; &lt;s:textfield name="address" label="Address"&gt;&lt;/s:textfield&gt; &lt;s:submit name="submit" value="Update"&gt;&lt;/s:submit&gt; &lt;s:token /&gt; &lt;/s:form&gt;
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/23515095
linked to: http://stackoverflow.com/q/18822095
type: Question
score: 3
tagged with: java
tagged with: struts2
upvote count: 3
has comment: http://stackoverflow.com/comment/36234269
answer count: 1
tagged with: jsp
tagged with: jquery

http://stackoverflow.com/q/23543232
type: UnansweredQuestion
tagged with: android
score: 3
answer count: 0
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36119599
tagged with: webview
type: Question
has body: I have an application that uses webviews. When I programmatically add margins to the layout the webview is in, it cuts off the bottom of the webview. I've only noticed it when the phone is in landscape, but everything I try doesn't work, if I add padding to the webview it does nothing, If I add padding the the layout the webview is inside, it adds the padding but the still cuts the webview off! XML: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout android:id="@+id/more_info" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/transparent_black" &gt; &lt;Button android:id="@+id/test" android:layout_width="300dp" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_centerHorizontal="true" android:layout_marginTop="20dp" android:onClick="onClickHandler" android:text="@string/start_test" /&gt; &lt;WebView android:id="@+id/top_content" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/test" /&gt; &lt;WebView android:id="@+id/bottom_content" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/top_content" /&gt; &lt;/RelativeLayout&gt; Side Margins: public int getWebViewMargin() { int screenWidth = getScreenWidth(); int sideMargin = 0; int orientation = ((Activity) context).getResources().getConfiguration().orientation; ((Activity) context).getResources().getConfiguration(); int landscape = Configuration.ORIENTATION_LANDSCAPE; if (GetScreenLayout() == ScreenSize.Xlarge){ sideMargin = screenWidth / 8; } else if (GetScreenLayout() == ScreenSize.Large &amp;&amp; orientation == landscape){ sideMargin = screenWidth / 9; } return sideMargin; } Height Margins: public void setMarginHeight(final int marginHeight, int id) { RelativeLayout buttonHolder = (RelativeLayout) ((Activity) context) .findViewById(id); RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams( RelativeLayout.Layou…
has comment: http://stackoverflow.com/comment/57493346
has comment: http://stackoverflow.com/comment/36120108
linked to: http://stackoverflow.com/q/8012936
downvote count: 0
favorite count: 0
has title: Android WebView cuts off at bottom of screen

http://stackoverflow.com/comment/127247877
type: QuestionComment
has text: Have you found a solution? :) i am looking for the same solution 8 years later. My target is to automatically fillup a EditText and click a button.
comment on: http://stackoverflow.com/q/23504217
score: 0
type: Comment

http://stackoverflow.com/a/23532391
answers question: http://stackoverflow.com/q/23532122
type: AcceptedAnswer
downvote count: 0
has body: If I understand correctly you want to throw your exception when none of the tokens you are looking for are found. This modification of what you had will properly find the tokens you are looking for and throw an exception if the input string did not contain any of the tokens. Matcher base = Pattern.compile("\\bred\\b|\\bgreen\\b|\\bblue\\b|[+()]{1}").matcher(input.trim()); while (!base.hitEnd()) { if (base.find()) { String s = base.group(); System.out.println("Found: " + s); output += String.format(" %s", s); } } if (output.isEmpty()) { throw new IllegalArgumentException("Invalid input no matching tokens found! " + base.toString()); } I updated a few things in your regex. I added \\b for word boundaries around red, green, blue and I combined the +() into a character group. The character group will match exactly 1 of any of the characters within the [].
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23532122

http://stackoverflow.com/comment/36156369
has text: I don't think it's possible with Java's implementation, but it's possible with [PCRE flavour regex](http://regex101.com/r/iQ5pW7).
score: 1
comment on: http://stackoverflow.com/q/23562748
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23499155
has title: Android getContentResolver NullPointerException
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36038044
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36053916
has body: I am new in Android. When getContentResolver() function is called I always get NullPointerException. I don't know why. Code is below: @EActivity(R.layout.activity_job_details) @OptionsMenu(R.menu.main) public class JobDetailsActivity extends ActionBarActivity { @Extra Job jobObject; @ViewById ListView lwPickups; PickupAdapter adapter; @AfterViews public void afterViews() { initActionBar(); adapter = new PickupAdapter(JobDetailsActivity.this, R.layout.row_pickup, R.id.twPickup, jobObject.getPickups()); lwPickups.setAdapter(adapter); } private void initActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(jobObject.getDesc()); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); } Then I tried to run query event in the same class: boolean result=queryEvent("123",JobDetailsActivity.this); @SuppressLint("NewApi") public boolean queryEvent(String event_id,Context context) { String[] projection= new String[]{Events.TITLE}; ContentResolver contentResolver=context.getContentResolver(); // NullPointerException Cursor calCursor=contentResolver.query(Events.CONTENT_URI, projection, Events._ID+"="+event_id, null, null); if(calCursor.moveToFirst()){ do{ String id = calCursor.getString(0); if(id==event_id){ return true; } }while(calCursor.moveToNext()); } return false; } } Could some one help?Does it cause of can't access getContentResolver() before the Activity is created? If it does,in this case,where should I put getContentResolver() as I use @EActivity(R.layout.activity_job_details)? Thanks
has comment: http://stackoverflow.com/comment/36053969
has comment: http://stackoverflow.com/comment/36053957
answer count: 0

http://stackoverflow.com/comment/36217020
has text: First what have your tried?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23595305

http://stackoverflow.com/comment/36236188
has text: Oh my, I see where your problem is. You want to try an get input from the `Scanner`, is that it? And then get that input to a component?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23604846

http://stackoverflow.com/q/23535346
has answer: http://stackoverflow.com/a/23535419
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23535531
has body: I want to compare the elements in the same List (The List "list) and if they are the same print out a line, I'm fairly new to programming and I dont yet completely understand the difference between List and an array and when you use them. Someone kindly suggested the code below and although it compliles nothing is being printed out. Since there are two pairs in my array I would expect something to print out at least once. Any help would be most appreciated thanks! List&lt;Double&gt; list = new ArrayList&lt;Double&gt;(); while (search.find()){ list.add(Double.parseDouble(search.group(1))); } for(int i= 0 ; i &lt; list.size()-1; i++){ //System.out.println(list.get(i)); // Successfully prints out all doubles in the SHADING:BUILDING:DETAILED class for(int k = i+1 ; k &lt; list.size() ; k++){ if(list.get(i) == list.get(k)){ System.out.println(i + "and" + k + "are pairs"); } } } } }
has title: Comparing elements in the same List Java
has answer: http://stackoverflow.com/a/42791006
possible better answer: http://stackoverflow.com/a/23535464
tagged with: arraylist
has answer: http://stackoverflow.com/a/23535531
has comment: http://stackoverflow.com/comment/36105448
favorite count: 0
has answer: http://stackoverflow.com/a/23535464
answer count: 4
score: 2
type: AnsweredQuestion
tagged with: list
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/36106290
has text: @DavidMichaelGang, take a look on answer given by fge and my comment to his answer. This gives you complete solution.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23535046
type: AnswerComment

http://stackoverflow.com/q/23581455
score: -2
tagged with: java
downvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/23581521
favorite count: 0
has answer: http://stackoverflow.com/a/23581545
has answer: http://stackoverflow.com/a/23581521
tagged with: android
tagged with: textview
has title: passing and setting TextView from another class
type: AnsweredQuestion
upvote count: 0
possible better answer: http://stackoverflow.com/a/23581545
has body: I have a text view in my android activity, and I want to pass it to a function in another java class and modify its text. But it throws me an exception. I read that I need to run it on a UI thread or send to context variable, but I'm a bit confused and I couldn't manage to do it. That's my code: Java timer class public class CountdownTimer { static int duration; static Timer timer; public static void startTimer(final TextView TVtime) { duration = 10; timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { TVtime.setText(setDuration()); } }, 1000, 1000); } private static String setDuration(){ if(duration == 1) timer.cancel(); return String.valueOf(--duration); } } Android activity: TVtime = (TextView) findViewById(R.id.textView_displayTime); CountdownTimer.startTimer(TVtime);
type: Question
linked to: http://stackoverflow.com/q/12618038

http://stackoverflow.com/q/23465951
favorite count: 0
has title: When should a method return a Promise instead of actual result in Play Framework?
has comment: http://stackoverflow.com/comment/35975706
upvote count: 10
tagged with: playframework-2.2
has body: I'm relatively new to Play Framework. The current project I'm working on has tons of Promises returned by the service layer components all the way down to controllers. I wonder if that's the best practice. In my opinion, using Promises really clutters up the sources. And I have to make use of final modifiers too frequently just to make local variables, parameters, and class members accessible to anonymous Function I need to create for these Promises. It even affects the way I create my unit test cases. It feels ugly honestly and there's simply too much lines of code than necessary. I'm not even sure if we're doing it right, I feel like we're overusing Promises. I'm using Java by the way. So, when should I use a Promise, when should I return a Promise, and when should I not use a Promise? Should all our services and interfaces return a Promise? Is there any better way of doing this? In plain English please.
possible better answer: http://stackoverflow.com/a/37308769
type: AnsweredQuestion
tagged with: playframework-2.0
downvote count: 0
tagged with: java
score: 10
accepted answer: http://stackoverflow.com/a/23466998
type: Question
answer count: 2
tagged with: playframework
has answer: http://stackoverflow.com/a/23466998
has answer: http://stackoverflow.com/a/37308769

http://stackoverflow.com/q/23462922
has answer: http://stackoverflow.com/a/23466843
has comment: http://stackoverflow.com/comment/35976958
type: UnansweredQuestion
tagged with: android
has title: How to show SQLite data in ListView in android? search business app
score: 0
tagged with: java
type: Question
tagged with: listview
tagged with: android-listview
has body: I'm new to java programming and this website. it's my 2nd program but I'm stuck with getting SQLite data to display in ListView items. My program is showing range of business and then display selected business in detail, sorry I can't post photos. I'll have to describe it.... First, ListView Business Lists: 2 cells in each ListView item. Left cell has business photos, right cell has 3 info: Business name(as in bold, larger text), address(in smaller text, optional) and Rating(in 5 stars) Second, Selected business in detail: Display selected business in detail full page. Top Left cell is photo, top right cell has the same info as ListView, and it shows Description, contact info and map under the top cells. I want to have Business name and Address and rating in the listView and the data must be from SQLite. How do I do it? Please help me. Thanks in advance!!! I have tried the following code but it didn't work. public class ListViewItems extends Activity { TextView textViewHotClubs; Button btnSortAtoZ; Button btnSortTopRated; Button btnNearU; ListView listView1; ArrayList&lt;Integer&gt; images = new ArrayList&lt;Integer&gt;(); ArrayList&lt;String&gt;strArray=new ArrayList&lt;String&gt;(); ArrayList&lt;Object&gt; ObjectArray = new ArrayList&lt;Object&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_view_items); listView1=(ListView)findViewById(R.id.listView1); textViewHotClubs=(TextView)findViewById(R.id.textViewHotClubs); btnNearU=(Button)findViewById(R.id.btnNearU); btnSortAtoZ=(Button)findViewById(R.id.btnSortAtoZ); btnSortTopRated=(Button)findViewById(R.id.btnSortTopRated); listView1.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub String getText=strArray.get(arg2); if(getText=="Code") { Intent i=new Intent(ListViewItems.this, CodeClub.class); …
tagged with: sqlite
answer count: 1

http://stackoverflow.com/q/23611684
has comment: http://stackoverflow.com/comment/36248232
downvote count: 3
accepted answer: http://stackoverflow.com/a/23611780
answer count: 1
has title: Why is a compiled java bytecode file called a class file?
has comment: http://stackoverflow.com/comment/36247986
favorite count: 0
has answer: http://stackoverflow.com/a/23611780
has comment: http://stackoverflow.com/comment/36247632
score: 0
has comment: http://stackoverflow.com/comment/36247729
has comment: http://stackoverflow.com/comment/36247679
upvote count: 3
has body: I started off learning java for object oriented programming , then I started learning C#, ASP.NET MVC. Now I am revisiting Java again just for fun. In C#, source files have the .cs extension and CIL code has the .exe extension. This makes sense to me. An "exe" extension is intuitive to me if I want to execute it that file. So java has the .java extension for source code, but why is the extension for java bytecode called .class ?
has comment: http://stackoverflow.com/comment/36248719
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36247789
tagged with: java
has comment: http://stackoverflow.com/comment/36248788

http://stackoverflow.com/a/23489917
score: 3
upvote count: 3
has body: The HashSet in your first example is a field of the Servlet, which will be initialized only once (as the Servlet will also be initialized once). Every request will be handled by this one instance of your Servlet, therefore there is the problem with the thread-unsafeness mentioned by your example. A HashSet is not designed to be used as a shared ressource so there may be problems like trying to add values while another thread is still iterating the Set. This is why you need some kind of synchronized Set as mentioned in your own solution.
downvote count: 0
answers question: http://stackoverflow.com/q/23489851
type: Answer

http://stackoverflow.com/a/23495105
has body: I would declare tab as an array of chars: private char[] tab; you could then split the word like this: tab = mot.toCharArray(); a char can always be converted into a String when needed: String s = Character.toString(ch);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23494928

http://stackoverflow.com/comment/36205928
type: QuestionComment
type: Comment
has text: Can you list the results of your print statements?
comment on: http://stackoverflow.com/q/23589412
score: 0

http://stackoverflow.com/comment/36134781
comment on: http://stackoverflow.com/a/23550755
type: AnswerComment
type: Comment
score: 1
has text: @BrunoReis I this case I am really sorry :) i have also edited the answer with links to the escape analysis and so on ...

http://stackoverflow.com/q/23459584
answer count: 1
downvote count: 0
tagged with: jsp
favorite count: 0
tagged with: google-app-engine
has body: Hi I am facing a error named "The method print(boolean) in the type JspWriter is not applicable for the arguments (void) " with my JSP code in GAE. In line :&lt;%= request.getSession(true).setAttribute("state","firstNumber") %&gt; Here is the code: ` &lt;c:when test='${param.event == "NewCall"}'&gt; &lt;% Response resp1=new Response(); CollectDtmf cd= new CollectDtmf(); cd.addPlayText("Welcome. Please enter the first number. Terminate with #"); resp1.addCollectDtmf(cd); %&gt; &lt;%= request.getSession(true).setAttribute("state","firstNumber") %&gt; &lt;% out.println(resp1.getXML()); %&gt; &lt;/c:when&gt; ` Please tell what am I doing wrong here. Thanks
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has title: The method print(boolean) in the type JspWriter is not applicable for the arguments (void)
has answer: http://stackoverflow.com/a/23460145
tagged with: session
accepted answer: http://stackoverflow.com/a/23460145

http://stackoverflow.com/comment/36049335
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23505418
score: 0
has text: So what's the problem? Are you getting an error?

http://stackoverflow.com/a/23534907
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/23534851
has body: If you write '0' as leading it indicate Octal
downvote count: 0

http://stackoverflow.com/comment/36115901
type: AnswerComment
type: Comment
has text: @fge, Re "`URLDecoder` is for form data, not URI query string components", That's wrong. It's not for (all) forms, and it is for query strings. It's used to parse `application/x-www-form-urlencoded` strings, which is used by query strings and by some (but not all) forms.
comment on: http://stackoverflow.com/a/23535051
score: 0

http://stackoverflow.com/comment/36187791
type: Comment
comment on: http://stackoverflow.com/a/23579642
has text: when i try to do the foreach you provided, it tells me foreach is not applicable for split[0] (java.lang.String)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35977636
type: Comment
comment on: http://stackoverflow.com/a/23466824
score: 0
type: AnswerComment
has text: @Christopher Wirt then you can loop inside arrays of Window/Frames and to get all JCompoents, its value, setting without reflection, use instanceof

http://stackoverflow.com/comment/35982845
score: 0
has text: its not duplicate i also want to modify the csv file after reading it and then store it in the database.
comment on: http://stackoverflow.com/q/23468816
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36137278
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23552414
has text: I do try to compile it, as stated in the original question.
score: 0

http://stackoverflow.com/a/23591071
answers question: http://stackoverflow.com/q/23590982
has comment: http://stackoverflow.com/comment/36221892
has comment: http://stackoverflow.com/comment/36221834
has comment: http://stackoverflow.com/comment/36229979
type: Answer
has comment: http://stackoverflow.com/comment/36209274
has comment: http://stackoverflow.com/comment/36208996
has comment: http://stackoverflow.com/comment/36215353
has comment: http://stackoverflow.com/comment/36223718
has comment: http://stackoverflow.com/comment/36209106
has comment: http://stackoverflow.com/comment/36209174
has body: Okay, so assuming you have the list with all the words set up, here is some pseudocode to guide you forwards. for every string in set check if word is of specified length if true: add word to set if false: do nothing String api might have some useful methods for this, especially for determining the length of the string.. :) About the latter part of your question, it is somewhat hard to answer how to access things in another class without more code to see how it is set up. Generally, you use a getter method to retrieve the field.
has comment: http://stackoverflow.com/comment/36209269
has comment: http://stackoverflow.com/comment/36208973
score: 0
has comment: http://stackoverflow.com/comment/36209256

http://stackoverflow.com/comment/36004402
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23481220
type: Comment
has text: rotation also doesn't update the rectangle's area, it updated the graphics (and left a "fantom" rectangle area), but then how can I determine if some point is inside of rotated rect?

http://stackoverflow.com/q/23609955
has comment: http://stackoverflow.com/comment/36278018
type: UnansweredQuestion
has body: I want to monitor a jar file running in a Windows Server.Currently i am executing jar file in command line.NsClient is installed in windows server.Can anyone help on this
type: Question
has answer: http://stackoverflow.com/a/23675431
has comment: http://stackoverflow.com/comment/36247867
tagged with: java
tagged with: nagios
has title: How to monitor jar file running in Windows Server using Nagios
score: 0
answer count: 1
tagged with: jar
tagged with: server-monitoring
tagged with: jvm

http://stackoverflow.com/q/23582900
has answer: http://stackoverflow.com/a/43960834
score: -1
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/23583151
tagged with: recursion
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36193781
answer count: 4
has body: i need a litle bit help. i need to write this method recursively: public static int howManyChar (String s, char c) and without using the substring method and loops.. any ideas? i am stuck at this point. public static int howManyChar (String s, char c) { int count = 0; int lastChar = s.length()-1; if (s.length()== 0) return 0; if (s.charAt(lastChar) == c) { count++; } i have succeeded using the substring method: int count =0; if (s.charAt(0)==c) count++; if (s.length()&gt;1) { count+=howManyChar(s.substring(1), c); } return count; but i want to write the code without using substring.
has answer: http://stackoverflow.com/a/23583061
has answer: http://stackoverflow.com/a/23583314
type: Question
has title: Recursively counting chars in java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36193731
possible better answer: http://stackoverflow.com/a/43960834
accepted answer: http://stackoverflow.com/a/23583061

http://stackoverflow.com/a/23505892
answers question: http://stackoverflow.com/q/23505800
has body: Create a new logical class, not a GUI class, for your Ball, one that does not extend a JPanel or any Swing component, but rather one that has the logic behind the Ball as well as perhaps a rendering method that accepts a Graphics or Graphics2D object. Then give your drawing JPanel class an ArrayList of these Ball objects, move them in your game loop -- note that I would prefer using a Swing Timer and not a background thread, and then in your JPanel's paintComponent method iterate through the ArrayList of Balls, drawing each Ball by calling its rendering method. As an aside: all your class names should begin with an upper case letter, and all identifiers other than constants should use camel case, so your mainpanel class should be named MainPanel. I've edited your code prettify the code formatting and have made this change for you. Aside number 2: your current code has code logic inside of paintComponent. Don't do that as that will mess you up. You don't have full control over when or even if paintComponent will be called.
has comment: http://stackoverflow.com/comment/36053619
has comment: http://stackoverflow.com/comment/36053410
type: Answer
accepted answer of: http://stackoverflow.com/q/23505800
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/35996437
type: Comment
has text: share the bean configuration
type: QuestionComment
comment on: http://stackoverflow.com/q/23477348
score: 0

http://stackoverflow.com/comment/36297244
comment on: http://stackoverflow.com/q/23541494
type: Comment
type: QuestionComment
score: 0
has text: yes, I used Gradle, finally I could test some classes by mocking with Mockito.

http://stackoverflow.com/q/23531261
answer count: 3
tagged with: sql
has comment: http://stackoverflow.com/comment/36098280
favorite count: 0
has comment: http://stackoverflow.com/comment/36098453
upvote count: 2
has answer: http://stackoverflow.com/a/23531383
tagged with: jdbc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36098569
has comment: http://stackoverflow.com/comment/36098497
accepted answer: http://stackoverflow.com/a/23531383
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36098401
possible better answer: http://stackoverflow.com/a/23531288
has comment: http://stackoverflow.com/comment/36098375
type: Question
has answer: http://stackoverflow.com/a/23531288
linked to: http://stackoverflow.com/q/23526654
has title: Java - How to format an SQL statement without getting hit by Java's String immutability?
has body: For example I want to create the following SQL SELECT statement for readability in JDBC: ResultSet result = statement.executeQuery( "SELECT " + "table1.*, " + "table2.someColumn " + "FROM " + "table1 " + "LEFT JOIN " + "table2 " + "ON " + "table1.column1 = table2.column2 " + "WHERE " + "date &gt; today"); Basically by formatting the SQL command, especially longer ones, it makes it easier to read when coding. The downside is that each line is an instance of an immutable String and this will have a performance and memory penalty. Yes I could use StringBuffer but this makes the SQL code once again unreadable, the same as if I had one big long SQL line. And yes in this case the cost is only once, but in some cases I have parameters that need to be included. Adding "?" is great, and again minimizes the String immutable issue, but in some cases the SQL command is generated dynamically and this will result in slightly different SQL commands (where parameters are not possible). Is there a way to write this code within Java and keep the code formatted without paying the String immutability penalty (and without using StringBuffer). Note: I also can't write it to a file because of other reasons which I won't go into here.
has answer: http://stackoverflow.com/a/23531343
score: 0
has comment: http://stackoverflow.com/comment/36098321

selection-sort
tags question: http://stackoverflow.com/q/23551369
type: Tag
tag name: selection-sort

http://stackoverflow.com/comment/75354422
type: AnswerComment
type: Comment
has text: Btw, it took me a while to get to the 'final' solution. Combine this answer with https://stackoverflow.com/questions/41547008/unknown-name-update-sheet-properties for a 'full solution'. Keep in mind that in the google API, camel case and underscore notation are equivalent.
comment on: http://stackoverflow.com/a/38839341
score: 0

http://stackoverflow.com/comment/36183243
has text: It will return the instance... but just checking... what do you consider a value?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23576927

http://stackoverflow.com/comment/35984270
type: AnswerComment
comment on: http://stackoverflow.com/a/23470482
has text: I just fix it by adding this on my web.xml : contextConfigLocation classpath:spring-config.xml
type: Comment
score: 0

http://stackoverflow.com/a/23519107
has body: We have a design principle called Code to interfaces never with concrete implementations Here Queue is an Interface which can hold implementation class Advantages over above principle 1.Switching between multiple implementations become easy in future So it is always recommonded to code to interface instead of concrete implementations 2.If we won't use above principle we loose key Object oriented concept polymorphism.
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23519011

http://stackoverflow.com/comment/35986537
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23467987
has text: Thanks so much @MH09. How can i display them like Mg Mg>>>________ Su Su>>>_________ Zaw Zaw>>>_______ Kyaw Kyaw>>>_______ Mya Mya>>>__________
score: 0

http://stackoverflow.com/q/23544361
downvote count: 5
has comment: http://stackoverflow.com/comment/36121808
tagged with: illegalargumentexception
answer count: 3
has answer: http://stackoverflow.com/a/23544493
accepted answer: http://stackoverflow.com/a/23544493
tagged with: throw
has title: Throwing exceptions syntax java
favorite count: 0
possible better answer: http://stackoverflow.com/a/23544417
has answer: http://stackoverflow.com/a/23544442
has body: I'm having a hard time figuring out how to throw and catch exceptions. I Think I have the general syntax right, at least according to the book that I'm using, but I keep getting errors. Can anyone help me out with the syntax? public Movie( String title, int yearReleased, double rating){ try{ if (rating &lt; 4.1 &amp;&amp; rating &gt;= 0.0) this.rating = rating; else throw new IllegalArgumentException; catch (IllegalArgumentException e){ System.out.println("This rating is invalid"); } }
has comment: http://stackoverflow.com/comment/36121664
type: AnsweredQuestion
upvote count: 0
score: -5
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23544417

http://stackoverflow.com/comment/36237374
comment on: http://stackoverflow.com/a/23605863
type: AnswerComment
score: 0
type: Comment
has text: @ Fox in socks , I did as u said. But then I get a run time error saying "The Application VolumeBtn (process com.example.volumebtn) has stopped unexpectedly.please try again. " Sometimes the way I have implemented onCreate method may wrong. So , can u propose an alternative way to implement the onCreate method except the way I have implemented it.

http://stackoverflow.com/comment/36095385
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23529760
has text: Thanks :) Im still getting an inputmismatchexception... im hoping the rest of my code works

http://stackoverflow.com/a/23577932
type: Answer
answers question: http://stackoverflow.com/q/23577844
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36184860
downvote count: 0
has comment: http://stackoverflow.com/comment/36184875
has body: One way; Create an instance variable of type List: List&lt;String&gt; myList = new ArrayList&lt;String&gt;(); Replace System.out.println(soFar); with myList.add(soFar); Probably in the end convert your list to an array: String[] arr = (String[]) myList.toArray();

http://stackoverflow.com/comment/36206437
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23589729
score: 0
has text: What is the point in testing making `charArrays` equal to every string in `gf`?

http://stackoverflow.com/q/23507473
type: Question
has answer: http://stackoverflow.com/a/23510945
tagged with: java
has body: I'm fairly new to Java, been taking it as a challenge course at my school, and I'm working on a chemistry-related "applet" (not sure if this is the right word for it) for one of my teachers. Right now, it runs just fine using Eclipse. I'm not sure how to make this a "clickable" application where I can open it from the desktop. Keep in mind java is the only computer language I know! Thank you for your patience and I apologize for my inexperience. P.S. I've extended JApplet with an init() and paint(Graphics g) method
has title: How to create a Java desktop application?
score: 0
has answer: http://stackoverflow.com/a/23507500
answer count: 2
tagged with: desktop-application
tagged with: applet
tagged with: japplet
has comment: http://stackoverflow.com/comment/36053270
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/comment/36203809
comment on: http://stackoverflow.com/q/23587821
type: Comment
score: 1
type: QuestionComment
has text: How is "I created a method where I obtain a decimal value from an hexadecimal , and convert it to a binary value" incorrect? It contrasts the three systems. It means exactly the same as, and is equal in clarity to "I created a method where I obtain a base-10 value from a base-16 value, and convert it to a base-2 value".

http://stackoverflow.com/comment/36090969
type: AnswerComment
has text: If you're going to represent times as strings (no, no no!) at a minimum follow standard conventions like separating hours and minutes by a `:`...
comment on: http://stackoverflow.com/a/23527119
score: 0
type: Comment

http://stackoverflow.com/comment/36444125
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23596527
type: Comment
has text: I have done this by using wait and notifyAll to stop and resume threads.

http://stackoverflow.com/comment/36194471
type: Comment
has text: From experience,use the former. Let the compiler do the optimizations for you.
comment on: http://stackoverflow.com/q/23583228
score: 0
type: QuestionComment

http://stackoverflow.com/a/23601443
has comment: http://stackoverflow.com/comment/36228825
upvote count: 3
has comment: http://stackoverflow.com/comment/36229962
score: 3
has comment: http://stackoverflow.com/comment/36228765
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36229567
downvote count: 0
has comment: http://stackoverflow.com/comment/36229700
has comment: http://stackoverflow.com/comment/36229741
has comment: http://stackoverflow.com/comment/36228639
type: Answer
accepted answer of: http://stackoverflow.com/q/23601294
has body: first thing there is no poblem with Scanner things and its not required when we use GUI. its useful only for console input/output. so when you get text it will be in string format so parse it to double like String val = txt1.getText(); double valueDouble = Double.parseDouble(val); and handle the parse exception using try/catch so replace the piece of code below Scanner dado1 = new Scanner(txt1.getText()); System.out.println(dado1); if(dado1.hasNextDouble()){ tamanho = dado1.nextDouble(); } Scanner dado2 = new Scanner(txt2.getText()); if(dado2.hasNextDouble()){ peso = dado2.nextDouble(); } to String t1 = txt1.getText(); if(!"".equals(t1)) tamanho = Double.parseDouble(t1); String t2 = txt2.getText(); if(!"".equals(t2)) peso = Double.parseDouble(t2); i tried to run your program but i got the exception saying -> container does not have parent attribute. so what i did is i have added a parent container inside your ok button action listener and it works well. container to be added is final JDesktopPane desk = new JDesktopPane(); setContentPane(desk); to your JOptionPane.showInternalMessageDialog(desk,"Seu IMC é:"+ (result/ peso)); but you have passed null as the first argement. so it should become like below ok.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent evt){ String t1 = txt1.getText(); if(!"".equals(t1)) tamanho = Double.parseDouble(t1); String t2 = txt2.getText(); if(!"".equals(t2)) peso = Double.parseDouble(t2); result = tamanho*tamanho; if (ok != null){ System.out.println(result); System.out.println(peso); final JDesktopPane desk = new JDesktopPane(); setContentPane(desk); JOptionPane.showInternalMessageDialog(desk,"Seu IMC é:"+ (result/ peso)); } } });
answers question: http://stackoverflow.com/q/23601294
has comment: http://stackoverflow.com/comment/36228651
has comment: http://stackoverflow.com/comment/36229429

http://stackoverflow.com/q/23591501
has comment: http://stackoverflow.com/comment/36209758
has body: We have multiple tag input in JS ( picture ) I wanted to know is there any default Java Swing facility to do it within JTextField or JTextArea. Is there any custom look-and-feel library or plugin to do so ? Thanks a lot !
has comment: http://stackoverflow.com/comment/36211971
answer count: 1
downvote count: 0
score: 4
favorite count: 0
tagged with: textfield
type: UnansweredQuestion
tagged with: look-and-feel
tagged with: swing
has answer: http://stackoverflow.com/a/23594495
has title: Tag Input in Java Swing
has comment: http://stackoverflow.com/comment/36210053
tagged with: java
tagged with: tags
has comment: http://stackoverflow.com/comment/36211925
type: Question
upvote count: 4

http://stackoverflow.com/comment/36181911
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23576212
has text: Yeah as I said I am only learning and missed most of File IO classes so I've had to learn most of it myself and obviously missed a few crucial parts. Are you saying I can write the whole arrayList with writeObject?
score: 0

http://stackoverflow.com/a/23742598
downvote count: 0
score: 7
accepted answer of: http://stackoverflow.com/q/23597836
has body: If your command Handler implements IElementUpdater the updateElement method will be called whenever the command is run. The UIElement parameter of updateElement has setIcon and setTooltip methods.
answers question: http://stackoverflow.com/q/23597836
has comment: http://stackoverflow.com/comment/55758844
has comment: http://stackoverflow.com/comment/36529957
has comment: http://stackoverflow.com/comment/55758166
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/55758934
has comment: http://stackoverflow.com/comment/96357285
type: Answer

http://stackoverflow.com/a/23610503
downvote count: 0
score: 1
type: Answer
has body: Your httpclient instance cannot be closed until the request is complete. While I am not certain, I would suggest // ONCE CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault(); httpclient.start(); // for every fire and forget request HttpGet request = new HttpGet(url); httpclient.execute(request, null);` keep your client alive between requests, so no calling close (reuse the instance instead)
upvote count: 1
has comment: http://stackoverflow.com/comment/44443332
answers question: http://stackoverflow.com/q/23609954

http://stackoverflow.com/comment/36177216
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23572401
has text: Is there a stack trace to speak of? Also, can you put `System.out.println()'s in your `ThymeleafConfig` methods to make sure they are running. Are all your Thymeleaf templates in WEB-INF/views?
score: 0

http://stackoverflow.com/comment/36140992
comment on: http://stackoverflow.com/q/23554240
has text: @AlienOnEarth Could you write something more about how indices change in your application?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23549633
has answer: http://stackoverflow.com/a/23549736
tagged with: java
has comment: http://stackoverflow.com/comment/36133163
type: Question
has body: I have an Ajax call that sends some JSON to be instered into the db. However when the ajax is fired it will just refresh the page and nothing is inserted. No error message is displayed. The Ajax method function send_track(track) { var mainpath = "&lt;%=request.getContextPath()%&gt;"; var json = JSON.stringify(track); var url = mainpath + '/API/Track/Update'; $.ajax({ type: "PUT", contentType: 'application/json; charset=utf-8', url: url, data: json, statusCode: { 200 : function() { $('#messagePlaceholder').html('&lt;div class="alert alert-success alert-dismissable"&gt;' + '&lt;button type="button" class="close" data-dismiss="alert" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;' + '&lt;strong&gt;&lt;fmt:message key="error.success" /&gt;: &lt;/strong&gt;&lt;fmt:message key="error.track.saved" /&gt;&lt;/div&gt;'); }, 400 : function() { $('#messagePlaceholder').html('&lt;div class="alert alert-danger alert-dismissable"&gt;' + '&lt;button type="button" class="close" data-dismiss="alert" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;' + '&lt;strong&gt;&lt;fmt:message key="error.error" /&gt;: &lt;/strong&gt;&lt;fmt:message key="error.track.notsaved" /&gt;&lt;/div&gt;'); } } }); } The Create method @PUT @Path("/Create") @Consumes(MediaType.APPLICATION_JSON) public Response Create(@Context HttpServletRequest request, TrackVM track) { try { HttpSession s = request.getSession(); if (s.getAttribute("User") == null) { throw new Exception("Not logged in"); } User u = (User) s.getAttribute("User"); track.setUserID(u.getID()); int trackID = _trackDao.AddTrack(track.Convert()); if (!AddTiles(track.getTiles(), trackID)) { _trackDao.DeleteTrack(trackID); throw new Exception("Tiles not added"); } return Response.status(Response.Status.OK).build(); } catch (Exception e) { return Response.status(Response.Status.BAD_REQUEST).build(); } } When I put a breakpoint inside the Create method and run this in debug mode it will insert the data into db. EDIT The button wich starts the event &l…
has title: Ajax call fail and reloads page
has comment: http://stackoverflow.com/comment/36131806
tagged with: javascript
tagged with: jquery
tagged with: ajax
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36131807

http://stackoverflow.com/q/23454672
linked to: http://stackoverflow.com/q/8487048
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23482079
has comment: http://stackoverflow.com/comment/35955330
downvote count: 1
has comment: http://stackoverflow.com/comment/35955681
type: Question
has body: I am new to Spring 3 MVC and was trying out form validation using the Java validation API and the Hibernate Validator implementation JARs. I am using Tomcat 6 for my application. Below is the pom.xml: <spring.version>3.1.1.RELEASE</spring.version> <jdk.version>1.6</jdk.version> org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} cglib cglib 2.2.2 javax.servlet jstl 1.2 javax.servlet javax.servlet-api 3.0.1 junit junit 3.8.1 test javax.validation validation-api 1.1.0.Final org.hibernate hibernate-validator 5.0.1.Final Below is the model class Employee.java: @Size(min=2,max=30) private String name; @NotEmpty @Email private String email; @NotNull @Min(18) @Max(35) private Integer age; @Size(min=10) private String phone; // Getters and Setters Below is the JSP containing the form: <form:form method="post" commandName="empl" action="validate"> Name: <form:input path="name" id="nameInput"/> <form:errors path="name"></form:errors> Age: <form:input path="age" id="ageInput"/> <form:errors path="age"></form:errors> Phone: <form:input path="phone" id="phoneInput"/> <form:errors path="phone"></form:errors> Email: <form:input path="email" id="emailInput"/> <form:errors path="email"></form:errors> <%-- Birthday: <form:input path="birthday" id="birthdayInput" placeholder="MM/DD/YYYY"/> <form:errors path="birthday"></form:errors> Birthday: <form:select id="genderInput" path="" items="${gender }"> </form:select> <form:errors path="birthday"></form:errors> --%> </form:form> When I click the submit button I am getting the error. Even the Controller handler method is not invoked and the below error is thrown: java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance()Ljavax/el/ExpressionFactory; org.hibernate.validator.internal.engine.messageinterpolation.InterpolationTerm.<clinit>(InterpolationTerm.java:60) org.hibernate.validator.messageinterpolation.ResourceBundleMessageInter…
answer count: 2
accepted answer: http://stackoverflow.com/a/23482079
tagged with: tomcat
favorite count: 0
has title: Spring 3 + Tomcat 6 : Form validation exception - java.lang.NoSuchMethodError: javax.el.ExpressionFactory.newInstance()Ljavax/el/ExpressionFactory;
tagged with: maven
tagged with: spring
possible better answer: http://stackoverflow.com/a/23548806
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23548806
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/q/23612381
tagged with: java
tagged with: servlets
has answer: http://stackoverflow.com/a/34882033
answer count: 2
has title: Apache File upload, FileItemIterator is empty
has body: I want a simple image capture/upload on mobile devices. For the actual file upload, i use Apache Commons. Now I encountered the same problem as described here: Apache commons fileupload FileItemIterator hasNext() returns false, but I can't find out where the request might have been consumed before my post method. I tested it on my development machine, when i put in any file (image or not), the iterator is simpy empty. Here is everything I have, I marked the actual file upload code so you don't have to sift through everything. Thanks for the help! @WebServlet("/scanner") public class MyServiceServlet extends HttpServlet { private static final long serialVersionUID = 1L; private static final int maxFileSize = 50 * 1024; private static final int maxMemSize = 4 * 1024; private static final String saveFolder = "/"; private final String repoFolder; private final DiskFileItemFactory factory; public MyServiceServlet() { final String os = System.getProperty("os.name"); if (os.contains("Windows")) repoFolder = "C:\\temp"; else repoFolder = "/tmp"; factory = new DiskFileItemFactory(); factory.setSizeThreshold(maxMemSize); // Location to save data that is larger than maxMemSize. factory.setRepository(new File(this.repoFolder)); } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("get"); request.getRequestDispatcher("MyService/start.html").forward(request, response); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("Post"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println(" "); out.println(" "); out.println(" MyService "); out.println(" "); out.println(" "); if (!ServletFileUpload.isMultipartContent(request)) { out.println(" Nothing uploaded "); } else { // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factor…
linked to: http://stackoverflow.com/q/3184917
has answer: http://stackoverflow.com/a/23612715
score: 0
type: UnansweredQuestion
type: Question
tagged with: apache-commons

http://stackoverflow.com/q/23613079
has body: I create this post because i can't solve this problem. My idea its a Fragment activity that on the top has a fragment that is a map and on the bottom has a view pager that allows user to swipe through fragments with information. Main Activity (Fragment Activity) public class RestaurantDetails extends FragmentActivity { private static final String TAG = "ImageGridActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.restaurantinfo); inicialize(); /* Adding fragment in a relativelayout */ if (getSupportFragmentManager().findFragmentByTag(TAG) == null) { final FragmentTransaction ft = getSupportFragmentManager() .beginTransaction(); ft.add(R.id.fragment_container, new MapFragment(), TAG); ft.commit(); } /* Pager on bottom */ mPager.setCurrentItem(getIntent().getExtras().getInt("idRest")); } Layout Main Activity <android.support.v4.view.ViewPager android:id="@+id/pagerDetails" android:layout_width="match_parent" android:layout_height="match_parent" /> Map Fragment public class MapFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); context = getActivity(); mapLayout = (RelativeLayout) inflater.inflate(R.layout.ipmaps, container, false); locationImage = (ImageView) mapLayout .findViewById(R.id.ipmaps_my_location_img_view); setupIpMapsGenericResources(); return locationImage; } } Map Layout <ImageView android:id="@+id/ipmaps_my_location_img_view" android:src="@drawable/compasso" android:layout_width="40dip" android:layout_height="40dip" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginRight="15dip" android:layout_marginTop="15dip" /> I also have tried instead of adding the fragment in a Relative Layout add him on a element but with no success. I am desperated for help. After the program run the method o…
answer count: 1
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23613214
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
downvote count: 1
type: Question
tagged with: android-layout
has title: The specified child already has a parent. You must call removeView() on the child's parent first (Activity with fragment and ViewPager)
tagged with: android-viewpager
score: -1
has answer: http://stackoverflow.com/a/23613214
upvote count: 0

http://stackoverflow.com/comment/35972324
comment on: http://stackoverflow.com/a/23463855
type: AnswerComment
has text: all i want is an example of it getting x and y coordinates and printing them could you do that?
score: 0
type: Comment

http://stackoverflow.com/q/23609703
type: Question
has answer: http://stackoverflow.com/a/23609904
has answer: http://stackoverflow.com/a/23609936
has comment: http://stackoverflow.com/comment/36243793
linked to: http://stackoverflow.com/q/23623651
has body: I want to use regular expression to split this string: String filter = "(go|add)addition|(sub)subtraction|(mul|into)multiplication|adding(add|go)values|(add|go)(go)(into)multiplication|"; I want to split it by | except when the pipe appears within brackets in which case they should be ignored, i.e. I am excepting an output like this: (go|add)addition (sub)subtraction (mul|into)multiplication adding(add|go)values (add|go)(go)(into)multiplication Updated And then i want to move the words within the brackets at the start to the end. Something like this.. addition(go|add) subtraction(sub) multiplication(mul|into) adding(add|go)values multiplication(add|go)(go)(into) I have tried this regular expression: Splitting of string for `whitespace` &amp; `and` but they have used quotes and I have not been able to make it work for brackets.
linked to: http://stackoverflow.com/q/22678833
has answer: http://stackoverflow.com/a/23609865
has comment: http://stackoverflow.com/comment/36243777
has title: how to split a string by "|"
upvote count: 4
has comment: http://stackoverflow.com/comment/36243993
accepted answer: http://stackoverflow.com/a/23610123
has comment: http://stackoverflow.com/comment/36243861
favorite count: 0
has answer: http://stackoverflow.com/a/23610123
tagged with: android
tagged with: regex
has comment: http://stackoverflow.com/comment/36243782
possible better answer: http://stackoverflow.com/a/23609865
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36243911
score: 1
has comment: http://stackoverflow.com/comment/36243841
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36243827

http://stackoverflow.com/comment/132195924
type: AnswerComment
has text: Use the full `Etc/UTC` instead of just `UTC` because three-letter time zone abbreviations are considered deprecated since they can cause [confusion](https://errorprone.info/bugpattern/ThreeLetterTimeZoneID).
type: Comment
comment on: http://stackoverflow.com/a/23466219
score: 0

http://stackoverflow.com/q/23500822
score: 2
has title: javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated in Tomcat with Apache HttpClient
tagged with: java
type: Question
downvote count: 0
tagged with: tomcat
has body: When trying to use Apache HttpClient 4.x on OpenJDK 1.7.0 on Ubuntu inside Tomcat, I get an javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated exception. When using the same JDK with an basic HTTPS connection like url = new URL(https_url); HttpsURLConnection con = (HttpsURLConnection)url.openConnection(); it works and I get an connection and can read the content. I have followed dozens of answers on stackoverflow, googled for some days and all suggest to import the cert into the keystore. I've done this, the problem persists. And it sounds strange to be my problem, as the basic connection with HttpsURLConnection works, but with HttpClient 4.x it doesn't.
has comment: http://stackoverflow.com/comment/36043544
answer count: 1
tagged with: apache-commons-httpclient
favorite count: 0
has comment: http://stackoverflow.com/comment/36055052
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23508599

http://stackoverflow.com/comment/36102437
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23533617
score: 0
has text: thanks for reply but now its not showing error but in view.jsp page i can see header but no data while inserted in databases its work but i can't see the data .is there any thing other than wrong??

http://stackoverflow.com/q/23615429
type: Question
upvote count: 2
answer count: 1
has body: This is my first post in this forum so excuse me in advance if I make a mistake in formatting or posting etiquette here. I am fairly new to programming in Java Swing and I've been trying to create simple tower defense game for a personal project yet I'm running into trouble with drawing images onto my application. I've looked around in many of the java tutorials both on this forum and on Oracle but I've never been able to find a solution that helped fix this so I'm resorting to asking for myself. public static void main(String[] args) { new DotO(); } public DotO() { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } private void createAndShowGUI() { backgroundPanel = new JPanel(); setBorder(BorderFactory.createLineBorder(Color.black)); loadBackground(); setBackground(Color.white); //1. Create the frame. JFrame frame = new JFrame("Defense Of The Origin"); //2. Optional: What happens when the frame closes? frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //4. Size the frame. frame.setSize(SIZEX, SIZEY); //5. Show it. frame.setVisible(true); //3. Add Background Panel frame.add(backgroundPanel); } private void loadBackground() { String fileName = "resources/Background.jpg"; try { URL url = getClass().getResource(fileName); backgroundImage = ImageIO.read(url); } catch(MalformedURLException mue) { System.out.println("url: " + mue.getMessage()); } catch(IOException ioe) { System.out.println("read: " + ioe.getMessage()); } } @Override protected void paintComponent(Graphics g) { System.out.println("painted"); super.paintComponent(g); int w = getWidth(); int h = getHeight(); g.drawImage(backgroundImage, 0, 0, w, h, this); System.out.println("it's working"); } The frame does open with no trouble at the preferred size but nothing is drawn on the frame. All I see is a gray space and when I put a System.out.print inside the paintComponent method, it doesn't show in the console so I know the application never actually runs the paintCom…
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/36255163
favorite count: 0
accepted answer: http://stackoverflow.com/a/23615629
has title: Java Swing Drawing (Trouble with PaintComponent)
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23615629
has comment: http://stackoverflow.com/comment/36255468
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36255436
tagged with: java
has comment: http://stackoverflow.com/comment/36255142
tagged with: image

http://stackoverflow.com/comment/36198254
type: Comment
type: QuestionComment
has text: I'm using Hibernate. For every table in the database a class is created.
score: 0
comment on: http://stackoverflow.com/q/23585082

infinite-loop
tags question: http://stackoverflow.com/q/23535974
type: Tag
tag name: infinite-loop
tags question: http://stackoverflow.com/q/23599651

http://stackoverflow.com/comment/35997578
has text: @BoristheSpider My apologies, I was doing the mental math wrong and your suggestion is valid, I made an attempt at a similar method in an edit.
comment on: http://stackoverflow.com/a/23474495
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/23550622
type: Answer
has body: It tells you right at the top of the stacktrace: ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet: file [C:\Users\dell\Documents\NetBeansProjects\WebApplication1\build\web\WEB-INF\classes\com\webApp\controller\FormController.class It looks like you've compiled your classes with, perhaps, java 8, and you're running it on a lower jdk.
has comment: http://stackoverflow.com/comment/36207719
score: 2
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/36293419
answers question: http://stackoverflow.com/q/23548431

http://stackoverflow.com/a/23581820
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23581611
score: 12
answers question: http://stackoverflow.com/q/23581611
type: Answer
has body: This is covered by JLS 11.2.2 (emphasis mine): A throw statement whose thrown expression is a final or effectively final exception parameter of a catch clause C can throw an exception class E iff: E is an exception class that the try block of the try statement which declares C can throw; and E is assignment compatible with any of C's catchable exception classes; and (...) In other words, E, the type referenced in the doc, is the type that can be thrown, not the type of the catch clause parameter that catches it (the catchable exception class). It just has to be assignment compatible to the catch clause parameter, but the parameter's type is not used in analysis. This is why the go out of their way to say a final or effectively final exception parameter--if t in your example were reassigned, the analysis would go out the window.
upvote count: 12

http://stackoverflow.com/q/23598066
type: Question
accepted answer: http://stackoverflow.com/a/23599026
tagged with: algorithm
has answer: http://stackoverflow.com/a/23598782
has comment: http://stackoverflow.com/comment/36222394
tagged with: java
has body: So i wrote a simulation of rabbits and wolves, and I have a single thread that in its run iterates for all animals in for loops - one for rabbits and one for wolves. So: public void run(){ while(rabbitNumber!=0){ for(int i=0; i&lt;rabbitsNumber; i++){ doRabbitMove();} for(int i=0; i&lt;wolvesNumber; i++){ doWofMove();} } } Now, I need a pause after each wolf and rabbit move - but not for a whole thread, just for that one i'th animal. I can't put just sleep after doWolfMove/doRabbitMove as it will stop the iteration on everything. Is there any way I can make it work? I don't want to use single thread for each animal.
tagged with: sleep
possible better answer: http://stackoverflow.com/a/23598174
has answer: http://stackoverflow.com/a/23599026
upvote count: 1
downvote count: 0
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/23606354
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23598174
score: 1
tagged with: multithreading
has answer: http://stackoverflow.com/a/23598785
has title: Sleep() in for loop

http://stackoverflow.com/q/23495442
type: Question
accepted answer: http://stackoverflow.com/a/28738806
has answer: http://stackoverflow.com/a/28738806
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/19345798
favorite count: 0
tagged with: scala
tagged with: android
type: AnsweredQuestion
downvote count: 0
has body: In java, using android-19, this works fine: import android.speech.tts.TextToSpeech.Engine; But in scala: import android.speech.tts.TextToSpeech.Engine ^ error: value Engine is not a member of object android.speech.tts.TextToSpeech This is weird because I can import EngineInfo without problems, but it does not recognize the class Engine, although it is clearly in the android.jar Any fix or workaround? Is this a scala issue? I'm developping on Eclipse 3.7 using AndroidProguardScala v51 and Scala IDE version 3.0.1 EDIT The context in which I am using this is for example the following: if(resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { mTts = new TextToSpeech(this, mTtsListener) }
score: 1
tagged with: java
tagged with: text-to-speech
tagged with: eclipse
has title: value Engine is not a member of object android.speech.tts.TextToSpeech

http://stackoverflow.com/a/23460673
type: Answer
answers question: http://stackoverflow.com/q/23460561
has body: toString() method is a method available in Object class. any class in java if its not extending any parent class then it will have internally Object class as parent. and toString() method is non final in Object class so it means we can override the toString() method in any of the subclass. and return type of overridden methods should be same if its built in type and it should be same or parent if its custom object. so in our case of toString() its return type is String so nobody can replace String for return type. hence changing it will give compile time error. so to achieve your scenario you can do as below in the worst case @Override public String toString() { System.out.println("your string"); return super.toString(); } and call this method using object of this class, if class name is A then A a = new A(); a.toString(); will automatically print the content on console using its body.
score: 0

http://stackoverflow.com/comment/36030919
type: Comment
comment on: http://stackoverflow.com/a/23494967
has text: Do you know of any examples of this, as obviously I am very stuck on the above
score: 0
type: AnswerComment

http://stackoverflow.com/a/23585491
answers question: http://stackoverflow.com/q/23583625
downvote count: 0
has comment: http://stackoverflow.com/comment/36199549
upvote count: 8
has comment: http://stackoverflow.com/comment/36214479
type: Answer
has comment: http://stackoverflow.com/comment/36213996
has comment: http://stackoverflow.com/comment/36213191
has comment: http://stackoverflow.com/comment/36212286
has comment: http://stackoverflow.com/comment/36214407
has body: Your problem is not about mismatched benchmarks, but rather the build misconfiguration which prevented JMH to generate and compile the synthetic benchmark code for you. You have to let annotation processors to run, and let the rest of the build to pack the generated source and resources into the complete bundle, even if you are to use API afterwards. The project produced by Maven archetype does just that. There is also the Ant sample which does specify exactly what should happen with other build systems. If you want to to that with Gradle, try this. P.S. In JMH, META-INF/MicroBenchmarks is an internal API, and it may change without notice. No surprises you are not able to use it.
has comment: http://stackoverflow.com/comment/36213627
score: 8
has comment: http://stackoverflow.com/comment/36212378
has comment: http://stackoverflow.com/comment/36213393
has comment: http://stackoverflow.com/comment/36213276
has comment: http://stackoverflow.com/comment/36214557

http://stackoverflow.com/a/23550815
has comment: http://stackoverflow.com/comment/36134078
has body: I'm not exactly sure about what you want to do, but, if shoot[0] and shoot[1] do represent the x and y of the shooting location as I'm suspecting, then maybe it's as simple as the following : When you've checked if the location is in reliable bounds, then either you set ships to a different state, at said location : ships[shoot[0]][shoot[1]] = HIT; // or MISSED if there was no ship here or you use an entire new array to record the shootings (I think it was what you intended) : hasAlreadyShot[shoot[0]][shoot[1]] = true; depending of your programming style and choices. Then, whenever the player chooses a new target, you can check if it has not already been a previous choice.
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23550200
score: 1

http://stackoverflow.com/comment/37138537
comment on: http://stackoverflow.com/q/23562122
type: QuestionComment
score: 0
has text: What name are you passing into the readFile method?
type: Comment

http://stackoverflow.com/comment/36163029
type: Comment
type: QuestionComment
has text: radio buttons are designed to select only one. use check boxes for multiple section.
comment on: http://stackoverflow.com/q/23566420
score: 0

http://stackoverflow.com/a/23481659
score: 4
type: Answer
has body: Please try this @SuppressWarnings("unchecked") public Concept findConceptById(BigInteger id) { Query query = this.em.createQuery("from Concept conc WHERE conc.conceptPK.id = :cid order by conc.conceptPK.effectiveTime desc"); query.setParameter("cid", id); return (Concept) query.getSingleResult(); } Make sure conceptPK has getter and setter methods in Concept class.
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/23480307

http://stackoverflow.com/q/23558448
tagged with: android
answer count: 1
has title: Set Spinner based on the other Spinner
has comment: http://stackoverflow.com/comment/36148741
has comment: http://stackoverflow.com/comment/83786364
has comment: http://stackoverflow.com/comment/36148280
has answer: http://stackoverflow.com/a/23558914
has comment: http://stackoverflow.com/comment/36148308
type: AnsweredQuestion
tagged with: java
has body: I'm making an App for android. I have 2 spinners, and when I select one item in my 1st spinner(simpleSpinner) it ofc needs to show it(I have done that) but when I select one from my 2nd spinner(multiSpinner) I want my simpleSpinner to go back to the first item in the spinner. And the other way around, when I select one in my simpleSpinner I want my multiSpinner to show the first item in my simpleSpinner. How do I do that? final ArrayAdapter&lt;String&gt; ar1 = new ArrayAdapter&lt;String&gt;(this, R.layout.my_spinner, arrSimple); final ArrayAdapter&lt;String&gt; ar2 = new ArrayAdapter&lt;String&gt;(this, R.layout.my_spinner, arrMulti); spSimple.setAdapter(ar1); spMulti.setAdapter(ar2); AdapterView.OnItemSelectedListener simpleListen = new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { String simpleText = spSimple.getSelectedItem().toString(); if("Rouge".equals(simpleText)){ spMulti.setSelection(0); } } @Override public void onNothingSelected(AdapterView&lt;?&gt; parent) { } }; AdapterView.OnItemSelectedListener multiListen = new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id) { String multiText = spMulti.getSelectedItem().toString(); if("Plein".equals(multiText)){ spSimple.setSelection(0); } } @Override public void onNothingSelected(AdapterView&lt;?&gt; parent) { } }; spSimple.setOnItemSelectedListener(simpleListen); spMulti.setOnItemSelectedListener(multiListen); The code works now! Thanks to @BlackPanther
accepted answer: http://stackoverflow.com/a/23558914
type: Question
has comment: http://stackoverflow.com/comment/36148638
tagged with: android-spinner
score: 0

http://stackoverflow.com/a/38642934
answers question: http://stackoverflow.com/q/23608587
type: Answer
has body: The issue has been fixed in new version of BeanUtils-1.9 https://issues.apache.org/jira/browse/BEANUTILS-454
score: 0

http://stackoverflow.com/comment/35983321
score: 0
type: AnswerComment
type: Comment
has text: I already do it, I tried many paths but it's just does not work, I think i should define my spring-config.xml in my web.xml.
comment on: http://stackoverflow.com/a/23470249

http://stackoverflow.com/a/29162610
has comment: http://stackoverflow.com/comment/48894905
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/23468429
upvote count: 0
score: -1
has body: I usse MOXy instead of Jackson in WAS v8.0.0.x. To override Jackson, I implement my Application class as so: @Named @ApplicationScoped @ApplicationPath("/resources/") public class WinkApplication extends Application implements Serializable { private static final long serialVersionUID = 1L; @Override public Set<Class<?>> getClasses() { Set<Class<?>> classes = new HashSet<Class<?>>(); classes.add(WinkResource.class); classes.add(WinkMOXyJsonProvider.class); classes.add(WinkResponseException.class); classes.add(WinkResponseExceptionMapper.class); return classes; } } However, I've noticed that WAS seems to ignore following annotation: @ApplicationPath("/resources/") So, I've resorted to using web.xml: JAX-RS Tools Generated - Do not modify JAX-RS Servlet com.ibm.websphere.jaxrs.server.IBMRestServlet javax.ws.rs.Application com.company.team.project.webservices.config.WinkApplication 1 true false JAX-RS Servlet /resources/* The point is, since WAS or Wink seems to ignore the Application implementation when using the ApplicationPath annotation, Wink loads the default Application class, which uses Jackson by default. And yes, I've read documentation and even watched IBM videos online that mention that @ApplicationPath allows you to avoid XML config, however this problem seems to be a bug. UPDATE: An alternative approach could be what David Blevins has mentioned in another SO post. Check out the section Using JAX-RS

http://stackoverflow.com/comment/36111744
score: 0
type: QuestionComment
type: Comment
has text: This is the error shown at the logCat..........05-08 12:23:26.280: D/AndroidRuntime(1583): Shutting down VM 05-08 12:23:26.300: W/dalvikvm(1583): threadid=1: thread exiting with uncaught exception (group=0x400205a0) 05-08 12:23:26.310: E/AndroidRuntime(1583): FATAL EXCEPTION: main 05-08 12:23:26.310: E/AndroidRuntime(1583): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.locateus/com.example.gpstracking.MainActivity}:
comment on: http://stackoverflow.com/q/23538802

http://stackoverflow.com/comment/36134482
has text: I knew the answer was one the way. +1'ed. :)
comment on: http://stackoverflow.com/a/23551054
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23594451
downvote count: 0
has comment: http://stackoverflow.com/comment/36217313
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/23594203
has body: Creating a Thread takes some time (compared to other operations it is expensive). Instead of creating a new Thread for every cell you could use a ThreadPool and re-use existing(finished) threads. This reduces the time spend for creating new threads. But still you are in a very low execution time per thread scenario where setting up the threads takes more time than running it sequential. private static void multiplyMatrixConcurent() { result_concurent =new Matrix(rows, columns); ExecutorService executor = Executors.newFixedThreadPool(4); for (int i = 0; i &lt; cell; i++) { Runnable worker = new MatrixMultiplicationThread(i); executor.execute(worker); } executor.shutdown(); }

http://stackoverflow.com/comment/36192094
comment on: http://stackoverflow.com/q/23581912
has text: By the way, your code with its getParent().getParent()... etc looks to be very fragile. I'd look for a more robust way of getting my references.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/36025684
type: Comment
has text: 1 What means "not sending the data to the servlet for thumbnail filed"? It is an input field and declared between form field, so must be sent after submitting. 2 I tried to do the same with the text type of input tag and got the same result.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23491845

http://stackoverflow.com/comment/35960896
type: QuestionComment
score: 1
has text: Also, in the `onTabSelectd()` callback use the `FragmentTransaction` passed in and don't create your own transaction like you currently do. Don't commit the passed in `FragmentTransaction` either.
type: Comment
comment on: http://stackoverflow.com/q/23457741

http://stackoverflow.com/comment/36142236
type: AnswerComment
score: 0
has text: Weird, could the crash be due to some other code? I can run it just fine.
type: Comment
comment on: http://stackoverflow.com/a/23534121

http://stackoverflow.com/comment/36110551
has text: Thanks for comment, will indeed becareful with spacing
comment on: http://stackoverflow.com/a/23538010
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35980123
has text: Yeah, checks are not going to make it work. They might just give you a hint on why it is not working. Have you tried Files.move ? http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#move%28java.nio.file.Path,%20java.nio.file.Path,%20java.nio.file.CopyOption...%29
comment on: http://stackoverflow.com/q/23468477
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36181280
type: AnswerComment
type: Comment
has text: @ChristopheD Nobody said anything about the the scoping rules being different. Of course they aren't. This code is wrong on all Java versions, unless there is a sleep in the '...'.
comment on: http://stackoverflow.com/a/23575697
score: 0

http://stackoverflow.com/q/23541860
has answer: http://stackoverflow.com/a/23542160
score: 0
tagged with: http://stackoverflow.com/tag/html
tagged with: css
has answer: http://stackoverflow.com/a/23542075
type: UnansweredQuestion
has body: I have a form having some hidden fields and when I submit form I need to forward that data to a page which is iFrame, I am not able to figure out it. That iFrame is just another form. It need not pop up just flow in same page.
tagged with: java
has title: how to forward Form data to iFrame containing another form?
type: Question
answer count: 2
tagged with: javascript

http://stackoverflow.com/comment/36197877
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23584847
has text: OK, fair enough, @myfreeweb.
score: 0

http://stackoverflow.com/comment/36156725
score: 0
has text: How would you know which phone number to return if there is more than one Sanjay? Until you mentioned that requirement, everything you've discussed is just very basic map usage (e.g. `Map<String, Collection<String>>` where the key is the name and the value is the phone numbers).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23563343

http://stackoverflow.com/q/23537978
type: AnsweredQuestion
tagged with: restlet-2.0
has answer: http://stackoverflow.com/a/23538773
accepted answer: http://stackoverflow.com/a/23538773
tagged with: java
tagged with: libraries
has title: Restlet framework - Edit agent.properties file
type: Question
tagged with: restlet
score: 0
answer count: 1
has body: I'm using the ClientInfo class from RESTlet to get the user agent from the browser used by the client. It works fine but it is kind of out-dated (the new Opera is detected as Chrome, and so on...) so I want manually insert my templates to the agent.properties file. The problem is I don't know where the agent.properties file is. I just have the jar file from RESTlet. From the link above, it says: Restlet users has the ability to define their own way to extract data from the "user-agent" header. It is based on a list of templates declared in a file called "agent.properties" and located in the classpath in the sub directory "org/restlet/data". Anyone knows where is that agent.properties file?

http://stackoverflow.com/comment/36148612
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23558612
has text: At the top of your script, add the following: `exec 2>/tmp/logfile; set -x` -- then reproduce the bug, and look at the contents of `/tmp/logfile`.
score: 0

http://stackoverflow.com/a/23505032
type: Answer
has body: First up, be a little wary of using the very low level HSMF classes if you're not following the Apache POI Dev List. There have been some updates to HSMF fairly recently to start adding support for fixed-length properties, and more are needed. Generally the high level classes will have a pretty stable API (even with the scratchpad warnings), which the lower level ones can (and sometimes do) change as new support gets added. If you're not on the dev list, this might be a shock... Next up - working out what stuff is. This is where the HSMF Dev Tools come in. The simple TypesLister will let you check all the types that POI knows about (slightly more than it supports), while HSMFDump will do it's best to decode the file for you. If your chunk is of any kind of known type, between those two you can hopefully work out what it is and what it contains Finally - getting all properties. As alluded to above, Apache POI used to only support variable length properties in .msg files. That has partly been corrected, with some fixed length support in there too, but more work is needed. Volunteers welcomed on the Dev List! MAPIMessage will give you all the common bits, but will also give you access to the different Chunk Groups. (A given message will be spread across a few different chunks, such as the main one, recipient ones, attachment ones etc). From there, you can get all the properties, along with the PropertiesChunk which gives access to the fixed length properties.
score: 0
answers question: http://stackoverflow.com/q/23495774

http://stackoverflow.com/comment/36078259
has text: @EJP, not technically true: A thread can be interrupted at _any_ time. When it is interrupted it sets a flag (always) and it throws an InterruptedException _iff_ it was blocked in a wait-like method call. If you want to use interruption to get the attention of a long-running thread, then the thread must periodically check the flag. The purpose of the exception is only to give the thread a _chance_ to check the flag if it happens to be sleeping at the time.
type: Comment
comment on: http://stackoverflow.com/a/23516405
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36512773
comment on: http://stackoverflow.com/a/23733248
type: AnswerComment
type: Comment
score: 0
has text: Thanks for your effort. I'll try to return to the issue in the near future. I use selectors, but even if I disable (remove) the completely, the issue still persists.

http://stackoverflow.com/q/23485295
answer count: 1
tagged with: spring-batch
tagged with: mapper
tagged with: parameters
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has title: Access job parameter from mapper in spring batch
type: Question
has answer: http://stackoverflow.com/a/23485561
accepted answer: http://stackoverflow.com/a/23485561
score: 0
has body: I am trying to access a job parameter from a mapper file. The following in part of my xml code : <chunk reader="sDItemReader" writer="sDItemWriter" processor="sDItemProcessor" commit-interval="1" /> <listener ref="jobFailureListener"/> <beans:bean id="sDJobParametersValidator" class="com.cv.cib.common.gfmas.aob.s.d.SDJobParametersValidator"> <beans:property name="fileParameterName" value="${filetojob.fileParameterName}"/> </beans:bean> <beans:bean id="sDItemReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step"> <beans:property name="resource" value="file:#{jobParameters['input.file.name']}" /> <beans:property name="lineMapper" ref="sDLineMapper" /> </beans:bean> <beans:bean id="sDLineMapper" class="org.springframework.batch.item.file.mapping.PatternMatchingCompositeLineMapper"> <beans:property name="tokenizers"> <beans:map> <beans:entry key="01*" value-ref="header" /> <beans:entry key="02*" value-ref="details" /> </beans:map> </beans:property> <beans:property name="fieldSetMappers"> <beans:map> <beans:entry key="01*" value-ref="sDHeaderLineMapper" /> <beans:entry key="02*" value-ref="sDDetailsLineMapper" /> </beans:map> </beans:property> </beans:bean> <beans:bean id="sDHeaderLineMapper" class="com.cv.cib.common.gfmas.aob.s.d.SDHeaderFieldSetMapper" /> <beans:bean id="sDDetailsLineMapper" class="com.cv.cib.common.gfmas.aob.s.d.SDDetailsFieldSetMapper" /> I can access the file name in SDJobParametersValidator.java and do my validation here. However, I would like to access the file name in SDHeaderFieldSetMapper.java also, Google long time but yet cant get the solution. Any ideas on this? The following is part of my code in SDJobParametersValidator.java to get the file name : public void validate(JobParameters parameters) throws JobParametersInvalidException { //some other code here final String name = parameters.getString( fileParameterName ); File file = new File( name ); logger.debug( file.getName( ) ); //some other code here }

http://stackoverflow.com/comment/35960259
type: QuestionComment
has text: I pulled your code into Eclipse and got it to run. The images are online. Dude, your images are huge for a 1 - 100 guessing game. Get them down to 640 x 480 so they will fit on most people's screens. Your code was arranged in a way so unfamiliar to me, a Swing developer, that I would have to rewrite your code from the beginning. Oh, and the white on gray labels? Have you ever heard of contrast?
comment on: http://stackoverflow.com/q/23455667
score: 0
type: Comment

http://stackoverflow.com/a/23517374
has body: It's the job of the developer to create the setters and getters for the java objects. Assuming you have a field private Set&lt;Stock&gt; stockDailyRecord; Normally you would create a pair: public Set&lt;Stock&gt; getStockDailyRecord(); public void setStockDailyRecord( Set&lt;Stock&gt; newRecordSet); And then you would also normally create a convenience method public void addDailyRecord( Stock newRecord) { this.getStockDailyRecord().add(newRecord); } Hint: most IDEs will create the getter/setters for you after you define the fields.
type: Answer
answers question: http://stackoverflow.com/q/23516452
has comment: http://stackoverflow.com/comment/36072437
has comment: http://stackoverflow.com/comment/36071413
accepted answer of: http://stackoverflow.com/q/23516452
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/23590748
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I am working on a project where I add the column names from mysql into jTable. I want that when a name is added, the column should adjust its size according to the length of column name. I will make myself clearer, but first heres the existing code: jTextArea1.setText(null); tableModel.setColumnCount(0); colwidth = 0; try { Class.forName("java.sql.DriverManager"); con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:" + GlobalParams.portvar + "/" + (String) jList1.getSelectedValue(), "" + GlobalParams.uservar, "" + GlobalParams.passvar); Statement stmnt = (Statement) con.createStatement(); String query1 = "Use " + GlobalParams.dbvar; stmnt.executeQuery(query1); String query2 = "desc " + (String) jList2.getSelectedValue(); ResultSet rs = stmnt.executeQuery(query2); while (rs.next()) { fieldo = rs.getString("Field"); jTextArea1.append(fieldo + "\n"); } Scanner scanner = new Scanner(jTextArea1.getText()); timeget(); jTextArea4.append(now + ": " + "/ Scanning Available feeds from table '" + (String) jList2.getSelectedValue() + "' / \n"); timeget(); jTextArea4.append(now + ": " + "/ Getting feeds from table '" + (String) jList2.getSelectedValue() + "' / \n \n"); if (scanner.hasNextLine()) { scanner.nextLine(); while (scanner.hasNextLine()) { String line = scanner.nextLine(); tableModel.addColumn(line); jTable1.getColumnModel().getColumn(colwidth).setWidth(line.length()); colwidth++; int end = jTextArea1.getLineEndOffset(0); jTextArea1.replaceRange("", 0, end); } } } catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); } "colwidth" is a public static int and "fieldo" is a public static String. What i want is, for ex.-> the string to be made into column is "asdadsasd123". I want that the column should adjust its width according to length of this string. I have set the auto resize of table to off. The table is enclosed in a scollpane. The layout of frame is Free Design. I also did find the thread here-> Auto resizing the JTable column…
linked to: http://stackoverflow.com/q/17627431
type: Question
has comment: http://stackoverflow.com/comment/36214330
accepted answer: http://stackoverflow.com/a/23594590
tagged with: jtable
has comment: http://stackoverflow.com/comment/36214675
has answer: http://stackoverflow.com/a/23594590
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36214204
has title: Real Time jTable column resizing
has comment: http://stackoverflow.com/comment/36212119
favorite count: 0
tagged with: jtableheader
tagged with: swing
tagged with: tablecellrenderer

http://stackoverflow.com/q/23542807
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/38597348
favorite count: 0
has title: Oracle Data Change Notification Timeout and Workflow
type: UnansweredQuestion
tagged with: oracle-database
has answer: http://stackoverflow.com/a/38568863
has body: Good time! We have the Oracle DCN feature configured in our java application. Everything works fine, but there are some troubles on the application's shutdown. If the application is down unexpectedly (for example a tomcat process is killed via the kill -9 command), DCN subscribers are left hanged in a DB (select * from user_change_notification_regs;). Also, I can see that every subscriber has a 4294967295-second timeout. So could somebody, please, suggest: 1. how to set the timeout for a subscriber; 2. why subscribers are left hanged even after all JDBC connections are down. Well, if there is no correspondence between a JDBC connection and a DCN subscription, how oracle would send DCN to a java application when the last one would eventually be up (are there any ping operations from Oracle to an application, or it is something like a durable subscription in JMS)? UPDATE: I've found an answer for the first point. There is the OracleConnection.NTF_TIMEOUT parameter that could be set for a DatabaseChangeRegistration: Properties properties = new Properties(); properties.setProperty(OracleConnection.DCN_NOTIFY_ROWIDS, "true"); properties.setProperty(OracleConnection.DCN_BEST_EFFORT, "true"); properties.setProperty(OracleConnection.NTF_TIMEOUT, "3600"); DatabaseChangeRegistration databaseChangeRegistration = oracleConnection.registerDatabaseChangeNotification(properties);
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/35979671
has text: there's no error, i want to change text by pressing button, if text is visible invisible, and vice versa
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23468302
type: Comment

http://stackoverflow.com/q/23466503
has comment: http://stackoverflow.com/comment/35976528
has answer: http://stackoverflow.com/a/23466714
type: Question
score: 0
has answer: http://stackoverflow.com/a/23466747
accepted answer: http://stackoverflow.com/a/23466714
has comment: http://stackoverflow.com/comment/35976883
tagged with: data-structures
favorite count: 0
answer count: 3
has body: I have gone through Java Collections elements- List, Set and Maps. According to my research, I found: Are my findings correct or not? Actually I wanted to know about the performance issues of these collections. What would be the performance if I have to add, retrieve and search data in each collections?
has comment: http://stackoverflow.com/comment/35976589
has comment: http://stackoverflow.com/comment/35976853
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/35976587
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35977209
possible better answer: http://stackoverflow.com/a/23466658
linked to: http://stackoverflow.com/q/2889777
has comment: http://stackoverflow.com/comment/35976926
has answer: http://stackoverflow.com/a/23466658
linked to: http://stackoverflow.com/q/12998568
tagged with: java
has title: Confusion about data structures- List, Set and Map
has comment: http://stackoverflow.com/comment/35976873

http://stackoverflow.com/a/23549207
upvote count: 6
has comment: http://stackoverflow.com/comment/36130888
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23548473
accepted answer of: http://stackoverflow.com/q/23548473
type: Answer
downvote count: 0
has body: You can not find all intersection points of n circles in the plane in O(n log n) time because every pair of circles can have up to two distinct intersection points and therefore n circles can have up to n² - n distinct intersection points and hence they can not be enumerated in O(n log n) time. One way to obtain the maximum number of n² - n intersection points is to place the centers of n circles of equal radius r at mutually different points of a line of length l &lt; 2r.
has comment: http://stackoverflow.com/comment/36138459
score: 6

http://stackoverflow.com/q/23506946
score: 0
answer count: 1
tagged with: junit
has title: determine the directory where test cases should be run on it
type: UnansweredQuestion
has body: My program gets as input a jar file and a directory contains Java source code. The jar file contains test cases that should be run on the input java source codes. If I define java input directory as source folder, then I can load test cases and run them as below: URLClassLoader clsLoader = URLClassLoader.newInstance(new URL[] {new URL("file:/D:/workspace/tests.jar")}); //the name of my test case class that I want to load Class cls = clsLoader.loadClass("temp.testMulDiv"); Result result = new JUnitCore().run(cls); for (Failure failure : result.getFailures()) System.out.println(failure.toString()); However, while I put the source code as an input directory, then test cases can not find the code. I know that I should in someway tell test cases to search for source code in the input directory, but I do not know how to do that. Any suggestion? I also check this piece of code, but still I have the above problem. While I can load the method that I want to run, but in this case "Class.forName" can not find the class ("temp.testMulDiv") and I get "ClassNotFoundException" error. URLClassLoader clsLoader = URLClassLoader.newInstance(new URL[] {new URL("file:/D:/workspace/tests.jar")}); //the name my test case class that I want to load Class cls = clsLoader.loadClass("temp.testMulDiv"); Method[] methods = cls.getDeclaredMethods(); // I want to run only the first method Request request = Request.method(Class.forName(cls.getName()), methods[0].getName()); Result result = new JUnitCore().run(request); for (Failure failure : result.getFailures()) System.out.println(failure.toString()); } Any suggestion, how can I run test cases on an input directory (and not a source folder)? How programmatically can I do that?
has answer: http://stackoverflow.com/a/23508480
tagged with: java
tagged with: testcase
type: Question

http://stackoverflow.com/comment/36095707
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23529091
type: Comment
has text: The OP reads the variable from somewhere - he can't just redefine it.

http://stackoverflow.com/a/23554878
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/23554337
type: Answer
has comment: http://stackoverflow.com/comment/36146852
has body: According to this, the syntax that you're looking for was added in SQLite 3.8.3 But according to this, KitKat uses 3.7.11 So, it's just not supported yet on Android.
has comment: http://stackoverflow.com/comment/36164112
score: 5

http://stackoverflow.com/comment/36008189
comment on: http://stackoverflow.com/q/23483332
has text: Use [`PriorityQueue`](http://docs.oracle.com/javase/7/docs/api/java/util/PriorityQueue.html) instead.
type: QuestionComment
type: Comment
score: 4

http://stackoverflow.com/a/23607211
answers question: http://stackoverflow.com/q/23607128
accepted answer of: http://stackoverflow.com/q/23607128
type: Answer
upvote count: 3
has body: Your DrawingPanel is an inner class in MainActivity so it must be declared as static so it can be constructed without the outer class object.
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23549993
has comment: http://stackoverflow.com/comment/36133152
type: Question
linked to: http://stackoverflow.com/q/4704747
has comment: http://stackoverflow.com/comment/36135371
has body: I have a class called SuperMedia that implements Parcelable. One of the fields of the class is an ArrayList children. When I create a Bundle and try to pass a "SuperMedia" object from one activity to another, all the fields get passed fine with the exception of the ArrayList "children" which just shows up as being empty every time. In my first Activity I do: Bundle a = new Bundle(); a.putParcelable("media",media); //media is an object of type "SuperMedia" and all the "children" have been initialized and added to the array final Intent i = new Intent("com.tv.video.subcategories"); i.putExtra("subcategories", a); On my Second Activity I do: Intent i = getIntent(); Bundle secondBun = i.getBundleExtra("subcategories"); SuperMedia media = secondBun.getParcelable("media"); //For some reason the ArrayList"children" field shows up as empty. Im not sure why this is happening. If anybody can guide me on the right path that would be greatly appreciated. Below is my SuperMedia class btw. public class SuperMedia implements Parcelable{ public URI mthumb; public String mTitle; public ArrayList&lt;SuperMedia&gt; children = new ArrayList(); public SuperMedia(URI thumb, String title) { this.mthumb = thumb; this.mTitle = title; } @Override public void writeToParcel(Parcel dest, int flags) { // TODO Auto-generated method stub dest.writeString(mTitle); dest.writeString(mthumb.toString()); dest.writeTypedList(children); } public static final Parcelable.Creator&lt;SuperMedia&gt; CREATOR = new Parcelable.Creator&lt;SuperMedia&gt;() { public SuperMedia createFromParcel(Parcel in) { return new SuperMedia(in); } public SuperMedia[] newArray(int size) { return new SuperMedia[size]; } }; private SuperMedia(Parcel in) { mTitle = in.readString(); try { mthumb = new URI(in.readString()); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } in.readTypedList(children, SuperMedia.CREATOR); } public SuperMedia(){ } }
has comment: http://stackoverflow.com/comment/36138950
has answer: http://stackoverflow.com/a/23550314
has answer: http://stackoverflow.com/a/23550215
has comment: http://stackoverflow.com/comment/36132666
has comment: http://stackoverflow.com/comment/36136830
tagged with: parcelable
tagged with: arraylist
answer count: 2
possible better answer: http://stackoverflow.com/a/23550314
has comment: http://stackoverflow.com/comment/36133068
has comment: http://stackoverflow.com/comment/36132733
has comment: http://stackoverflow.com/comment/36133338
has comment: http://stackoverflow.com/comment/36132796
has title: Reading ArrayList in Parcelable
tagged with: android
accepted answer: http://stackoverflow.com/a/23550215
has comment: http://stackoverflow.com/comment/36135330
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/q/23586950
type: Question
accepted answer: http://stackoverflow.com/a/23587035
has comment: http://stackoverflow.com/comment/36201646
tagged with: arrays
has comment: http://stackoverflow.com/comment/36201580
score: 0
has body: I'm pretty new to Java and I'm having trouble with arrays. Here's the code I have right now. String english = "hip-hop"; String[] words = english.split ("[\\s+]|(?&lt;=-)|(?=-)"); String[] latin = new String [words.length]; String phrase = ""; for (int i = 0 ; i &lt; words.length ; i++) { int k; k = words.length - 1; latin [i] = words [i]; //stays the same if ((words [i].charAt (0) == '-') || (words [k].equals("-") == true)) //PROBLEM RIGHT HERE { phrase = phrase + latin [i]; //add latin to previous phrase } else { phrase = phrase + " " + latin [i]; //add latin to previous phrase } } System.out.println (phrase); So the output for this program is : hip- hop The correct output should be: hip-hop I know it may seem pointless to break hip-hop and then recombine it, but it's a small thing i need to get right for the pig latin translator I am creating. The code here compiles correctly. I created the int k so that if the previous word in the array is equal to "-", then when latin is added to the phrase, no space will be present. Any help is greatly appreciated, thanks.
answer count: 1
type: AnsweredQuestion
tagged with: java
has title: Referring to the previous string in an array of strings
has answer: http://stackoverflow.com/a/23587035

http://stackoverflow.com/a/23549282
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23549174
has comment: http://stackoverflow.com/comment/36131868
upvote count: 1
has comment: http://stackoverflow.com/comment/36131108
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36131627
has body: Please keep in mind, that getLastKnownLocation can sometimes return null (for example, if provider is currently disabled or there is no last known location), so you should always check the result of this method: Location location = locManager.getLastKnownLocation(provider); if (location == null){ //handle this case //return location with some default coordinates, for example } return location;
answers question: http://stackoverflow.com/q/23549174
has comment: http://stackoverflow.com/comment/36131437

http://stackoverflow.com/comment/36087569
type: Comment
comment on: http://stackoverflow.com/a/23525539
score: 0
has text: Thank you @N8sBug! Running it as an administrator cleared up all erros I had, hopefully I don't run into any in the future. Any idea why this is an issue on my laptop, running windows 8, while my home PC which also runs windows 8, seemed to work fine? Thanks so much for the help, frustrating that I spent three hours looking at downloads at paths last night when all that was needed to fix it was two right clicks... Haha
type: AnswerComment

http://stackoverflow.com/q/23517404
type: UnansweredQuestion
type: Question
has title: GridView with vertical images and autofit
has comment: http://stackoverflow.com/comment/36071162
tagged with: android-layout
tagged with: java
tagged with: image
tagged with: android-gridview
has body: How to fill a GridView with vertical images (rectangles), keep the gridview autofit so that it choose the good number of columns by itself. here is my grid view and the cell : &lt;GridView android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" android:gravity="center" android:horizontalSpacing="@dimen/margin_medium" android:numColumns="auto_fit" android:overScrollMode="never" android:paddingLeft="@dimen/margin_large" &lt;!-- 16dp --&gt; android:paddingRight="@dimen/margin_large" android:paddingTop="@dimen/margin_large" android:scrollbars="none" android:stretchMode="columnWidth" android:verticalSpacing="@dimen/margin_medium" &gt; &lt;!-- 8dp --&gt; &lt;/GridView&gt; The Cell &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="@dimen/grid_cell_width" &lt;!-- 359dp --&gt; android:layout_height="@dimen/grid_cell_height" &lt;!-- 600dp --&gt; android:background="@drawable/selector_list_simple" android:padding="@dimen/margin_small" &gt; &lt;!-- 4dp --&gt; &lt;ImageView android:id="@+id/cell_allzic_image" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:scaleType="centerInside" &gt; &lt;/ImageView&gt; &lt;ProgressBar android:id="@+id/cell_allzic_loading" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:indeterminate="true" android:indeterminateDrawable="@drawable/progress_bar_custom" android:visibility="gone" /&gt; &lt;/RelativeLayout&gt;
has comment: http://stackoverflow.com/comment/36071086
tagged with: android
linked to: http://stackoverflow.com/q/22701363
has comment: http://stackoverflow.com/comment/36071792
answer count: 0
score: 0

http://stackoverflow.com/comment/36285973
comment on: http://stackoverflow.com/a/23625059
has text: Thanks @Roland Kuhn (+1) - so is it that the real advantage to integrating Netty with Akka is to provide network access to Actor clusters/groups? Meaning, if I have a cluster of Actors doing some arbitrary task, `Task1`, and perhaps I want to make them available to some client application, I could use Netty to connect the client to the Actor cluster? Is that a fair assessment? Thanks again!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23539444
accepted answer: http://stackoverflow.com/a/23540608
has title: Decrypting data in Java from PHP mcrypt using Rijndael_256(AES)
has body: For a few days i have been trying to get the encrypted data from a PHP service to my android application. I want to use Rijndael 256 bit encryption. Encrypting and decrypting a string in PHP works fine. What i do is i send the data from php to android in the following structure = (initialization vector + hash(md5) + encrypted data). In Java i split the received string in 3 compartments. But what i get in java is a error message telling: IV must be 16 bytes long. I checked all over the internet trying to find a solution to this problem. Some suggested not using mcrypt in php while others said to use a 128 algorithm variant. Using 128 bit in PHP breaks the encryption. Below i have 2 examples to perhaps clarify the problem further. I appreciate your help. PHP CODE encryption / decryption: function encrypt_data($data,$privk) { // Random number for feeding into AES encyption algorithm $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC), MCRYPT_RAND); // Check if decrypted properly $hash = md5($data); // Encrypt the data using the privk and the iv $encrypted = trim(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $privk, trim($data), MCRYPT_MODE_CBC, $iv)); $encode = base64_encode($encrypted); $base64_iv = base64_encode($iv); return $base64_iv.$hash.'='.$encode; } function decrypt_data($data,$privk) { // Split data into 3 variables: iv,hash,encdata $arr = explode('=',$data,3); $iv = base64_decode($arr[0]); $hash = $arr[1]; $encdata = base64_decode($arr[2]); // Decrypt using the 3 variables $decrypted = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $privk, trim($encdata), MCRYPT_MODE_CBC, $iv)); // Check integrity of decrypted data $hdec = md5($decrypted); if ($hdec == $hash) { return $decrypted; } else { return false; } } JAVA decryption: public String decryptJson(String data) { String[] split= data.trim().split("="); byte[] iv = Base64.decode(split[0],3); String hash = split[1]; byte[] encd = Base64.decode(split[2],0); String skey = "secretkeyfromdatabase"; byt…
linked to: http://stackoverflow.com/q/12895031
favorite count: 0
tagged with: mcrypt
tagged with: php
possible better answer: http://stackoverflow.com/a/23539720
tagged with: aes
has comment: http://stackoverflow.com/comment/36112779
has answer: http://stackoverflow.com/a/23539720
score: 0
has answer: http://stackoverflow.com/a/23540608
tagged with: encryption
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36112630
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/q/23524243
type: Question
answer count: 2
has body: I am creating a bukkit plugin that requires more of a customization level than most plugins. My configuration files will be in this format: zones: zone: string: string zone: string: string2 I need to be able to get each value in each list. For instance; i have (X) number of zones based upon how many lists are in the zones: list. I know i can get the value of a list like this: this.getConfig().getString("zones.zone.string"); But in this case, i have two zone lists. I have tried using this method, but could not get it to work (JUST an Explanation) foreach(zone in zones) { // Get each value in the list } How would i get all the zones in the zones list? EDIT I am needing to iterate through each zone and get its inner values. But i am not sure how to do it with Bukkit's API.
has title: Saving a List of Lists in Java?
tagged with: minecraft
score: -1
has comment: http://stackoverflow.com/comment/36084606
has comment: http://stackoverflow.com/comment/36084385
has comment: http://stackoverflow.com/comment/36084346
favorite count: 0
possible better answer: http://stackoverflow.com/a/23524376
downvote count: 2
has answer: http://stackoverflow.com/a/23526257
upvote count: 1
has answer: http://stackoverflow.com/a/23524376
has comment: http://stackoverflow.com/comment/36084305
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36084544
accepted answer: http://stackoverflow.com/a/23526257
has comment: http://stackoverflow.com/comment/36084367
tagged with: java
tagged with: bukkit

http://stackoverflow.com/comment/36113447
type: Comment
has text: MarkLogic is very fast with searching. It supports dateTime range indexes by default, and can return top 20 ordered by date in sub-sec even for millions of documents.
score: 0
comment on: http://stackoverflow.com/a/23518308
type: AnswerComment

encryption
tags question: http://stackoverflow.com/q/23493831
tags question: http://stackoverflow.com/q/23547224
tags question: http://stackoverflow.com/q/23607188
tags question: http://stackoverflow.com/q/23605775
tags question: http://stackoverflow.com/q/23501353
tags question: http://stackoverflow.com/q/23502395
tag name: encryption
tags question: http://stackoverflow.com/q/23491366
tags question: http://stackoverflow.com/q/23529733
tags question: http://stackoverflow.com/q/23555094
tags question: http://stackoverflow.com/q/23582694
tags question: http://stackoverflow.com/q/23516511
tags question: http://stackoverflow.com/q/23580780
tags question: http://stackoverflow.com/q/23539444
tags question: http://stackoverflow.com/q/23477062
tags question: http://stackoverflow.com/q/23611227
tags question: http://stackoverflow.com/q/23597984
tags question: http://stackoverflow.com/q/23516961
tags question: http://stackoverflow.com/q/23525610
tags question: http://stackoverflow.com/q/23511758
tags question: http://stackoverflow.com/q/23488278
tags question: http://stackoverflow.com/q/23491143
tags question: http://stackoverflow.com/q/23520825
type: Tag
tags question: http://stackoverflow.com/q/23454761
tags question: http://stackoverflow.com/q/23561104

http://stackoverflow.com/comment/36063241
comment on: http://stackoverflow.com/a/23513212
type: AnswerComment
score: 0
type: Comment
has text: Added a `@Value` injection sample

http://stackoverflow.com/a/23476672
accepted answer of: http://stackoverflow.com/q/23476355
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23476355
upvote count: 2
type: Answer
score: 2
has body: frame.setVisible(true); The above statement must be executed AFTER all the components have been added to the frame and its child panels. When I expanded the frame width-wise just a little bit, the panels showed up, When the frame is resized, the layout manager is invoked so the components can be postioned and painted properly.

http://stackoverflow.com/q/23452957
tagged with: centos
score: 0
has answer: http://stackoverflow.com/a/23453255
linked to: http://stackoverflow.com/q/28271111
has title: Unable Create Directory in CentOS using Java
duplicate of: http://stackoverflow.com/q/28271111
type: UnansweredQuestion
tagged with: tomcat7
tagged with: java
has answer: http://stackoverflow.com/a/23452988
type: Question
answer count: 2
has body: I'm creating a Web Application using Java Servlets. I used JDK7, Tomcat7. I was perfectly working till I hosted local site in windows. But when I migrated to CentOS directory is Not creating. File outputFile = new File("/Data/"); try{ if(!outputFile.exists()){ if(!outputFile.mkdir()){ throw new UnableToCreateFolderException(); }else{ outputFile = new File("/Data/" + user); if(!outputFile.mkdir()){ throw new UnableToCreateFolderException(); } } }else{ outputFile = new File("/Data/" + user); if(!outputFile.exists()){ if(!outputFile.mkdir()){ throw new UnableToCreateFolderException(); } } } This is the code I used in Windows. And I tried to create "/Data" directory and give full access to user and then I tried to run it.
has comment: http://stackoverflow.com/comment/35951169
tagged with: jsp

http://stackoverflow.com/a/23480500
has body: You can use a "diff tool" to generate a nicely readable report of differences for you. See some examples here: http://www.git-tower.com/blog/diff-tools-mac/
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23480121

http://stackoverflow.com/a/23464683
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23464654
upvote count: 1
type: Answer
has body: Maybe start with a BorderLayout for the main layout. Then you can add components to the PAGE_START (NORTH), LINE_START (WEST) and CENTER and PAGE_END (SOUTH). Check out the section from the Swing tutorial on Using Layout Manager, for more information and examples. Of course you would also use panels when you want to display multiple components in a single area. So your buttons would first be added to panels. Also, follow standard naming conventions. Variable names should NOT start with an upper case character( ie. BodyArea, TitleText). You got variable like (panel, list) correct so be consistent.

http://stackoverflow.com/comment/36072197
has text: it still gave the same error no matter where i placed.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23516372
type: Comment

http://stackoverflow.com/comment/36234025
type: Comment
comment on: http://stackoverflow.com/q/23604392
type: QuestionComment
score: 0
has text: [`String#replace()`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replace(char,char) )? [`String#indexOf()`](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#indexOf(int))? Hello?

http://stackoverflow.com/comment/36029807
type: QuestionComment
comment on: http://stackoverflow.com/q/23495415
score: 3
has text: Lambdas are just another way of writing the same thing. It is just some piece of code that can be run, exactly like a Runnable that you would pass. I does not affect the way they are executed. Maybe I just don't understand your question.
type: Comment

http://stackoverflow.com/a/23608542
has comment: http://stackoverflow.com/comment/56718651
type: Answer
answers question: http://stackoverflow.com/q/23601380
has body: You can do that using NullWritable class. public class DLines { public static class TokenCounterMapper extends Mapper&lt;Object, Text, Text, IntWritable&gt; { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); @Override public void map(Object key, Text value, Context context) throws IOException, InterruptedException { String line=value.toString(); context.write(value, one); } } public static class TokenCounterReducer extends Reducer&lt;Text, IntWritable, Text, NullWritable&gt; { NullWritable out = NullWritable.get(); @Override public void reduce(Text key, Iterable&lt;IntWritable&gt; values, Context context)throws IOException, InterruptedException { int sum = 0; for (IntWritable value : values) { sum += value.get(); } if (sum&lt;2) { context.write(key,out); } } } Driver code job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(IntWritable.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(NullWritable.class); Hope this answers your question.
score: 0
has comment: http://stackoverflow.com/comment/56710329

http://stackoverflow.com/comment/35998362
has text: Use a proper micro benchmark tool (for example jmh) and start writing tests. FYI most operations in your list will run in one or two cpu cycles, except the array allocation which needs to zero out 10000 ints.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23477675

http://stackoverflow.com/q/23575192
accepted answer: http://stackoverflow.com/a/23599245
upvote count: 1
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/23599245
has comment: http://stackoverflow.com/comment/36180894
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: gestures
type: Question
answer count: 1
has title: Gesture for the letter i not accepted
has body: I'm developing an android app that displays a letter that the user has to draw. The user then inputs a gesture and if the gesture name matches/mismatches the letter name then a dialog pops up saying either correct or incorrect, offering the user the chance to move on or try again. I created the gestures library for this app with a modified version of gestures builder and everything is working properly except on the letters i and j. The problem seems to be the dot on top of each of these letters. The incorrect message won't even pop up. Is there anyway to get an app to accept a gesture that has two seperate parts? EDIT: When I leave out the dot at the top the letter is processed as it should be.

http://stackoverflow.com/q/23455222
favorite count: 0
has title: Implement multitenancy using generated endpoints and gae
tagged with: google-app-engine
tagged with: android
has body: i am trying to develop android app with backend using app engine.I already generated endpoints,now i need multitenancy in my app.Here documentation about multitenancy But i have generated endpoints,not servlet as shown above.How can i implement multitenancy with endpoints?
has comment: http://stackoverflow.com/comment/35955660
has answer: http://stackoverflow.com/a/35824992
accepted answer: http://stackoverflow.com/a/23455386
type: AnsweredQuestion
tagged with: multi-tenant
score: 1
upvote count: 1
possible better answer: http://stackoverflow.com/a/35824992
type: Question
has comment: http://stackoverflow.com/comment/48655577
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/23455386
tagged with: google-cloud-datastore
downvote count: 0

http://stackoverflow.com/comment/36250197
has text: Your possible solution is coming close. When removing the isEventDispatchThread (with it doesn't work, also freezing) but using the runnable, and adding a JOptionPane in the while I clearly see it waiting because the JOptionPane keeps popping up (my gui also draws) BUT without the JOptionPane nothing draws and it stays unresponsive. Any explanation for this?
type: AnswerComment
comment on: http://stackoverflow.com/a/23612109
score: 0
type: Comment

http://stackoverflow.com/a/23507680
score: 2
has body: This is actually correct because you are filtering your list and only considering elements that satisfy the lambda expression number -> number == 7. So only one of the elements in your list gets through.
downvote count: 0
answers question: http://stackoverflow.com/q/23507660
upvote count: 2
type: Answer

http://stackoverflow.com/a/23459865
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23458993
answers question: http://stackoverflow.com/q/23458993
score: 2
has body: Edit: The easiest way is @ComponentScan(lazyInit = true, basePackages=...). Previous answer: There is http://docs.spring.io/spring/docs/3.0.x/javadoc-api/org/springframework/aop/target/LazyInitTargetSource.html A bean wrapped with LazyInitTargetSource will not be created until the first actual usage. How to nicely wrap most of your beans with this wrapper? One possible way is to create your own BeanFactoryPostProcessor...
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/23535531
has body: The way you have coded the comparation repeats itself. Besides, that is not the correct way you access an element in a list, I'm afraid. For example, lets say you have the i = 0 (value 2.0 for example) and k = 2 (value 5.2), but later you have i = 2 (5.2) and k = 0 (2.0), which is the same. I suggest you the following, which avoids this repetition. for (int i = 0; i &lt; list.size()-1; i++) for (int k = i+1; k &lt; list.size(); k++) if(list.get(i) == list.get(k)) System.out.println(i + " and "+ k +" are pairs"); Of course, you have to make sure that the list's size is bigger than 1, otherwise it will throw OutOfBoundsException. Hope this helps ^^ EDIT #2 Try and use the following if, it contains a null-safe equals: if(Objects.equals(list.get(i), list.get(k)))
score: 8
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36106933
downvote count: 0
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/36106969
has comment: http://stackoverflow.com/comment/36107228
accepted answer of: http://stackoverflow.com/q/23535346
has comment: http://stackoverflow.com/comment/36107091
answers question: http://stackoverflow.com/q/23535346

http://stackoverflow.com/q/23509598
score: 0
has body: I have this code which I want to indent: int[] myArray = { 1, 2, 3, 4, 5, 6 }; int theInt = 1; String someString = "Hello"; double aDouble = 3.0; I want the above code to be column indented, like this: int[] myArray = { 1, 2, 3, 4, 5, 6 }; int theInt = 1; String someString = "Hello"; double aDouble = 3.0; I have tried different options in: Windows &gt; Preferences &gt; Java &gt; Code Style &gt; Formatter but I was unable to find the settings for above. The = should be placed in center with respect to alignment Thanks for replying.
has answer: http://stackoverflow.com/a/23509810
accepted answer: http://stackoverflow.com/a/23509810
has comment: http://stackoverflow.com/comment/36056927
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36056994
tagged with: java
possible better answer: http://stackoverflow.com/a/23509778
has comment: http://stackoverflow.com/comment/36057014
tagged with: eclipse
has answer: http://stackoverflow.com/a/23509778
type: Question
answer count: 2
has title: How to indent java code assignment of variables in eclipse

http://stackoverflow.com/comment/36229580
type: Comment
comment on: http://stackoverflow.com/a/23583409
type: AnswerComment
score: 0
has text: Thanks for the informations. I thought that the question about having one upload for more then one client is a stupid question but it seems like this really exists^^ Its interesting to know. For the latency problem: I don't think that my game, if i am even able to make it, will run online. I am thinking more about Lan, where latency problems don't exist that much. Thanks a lot!

http://stackoverflow.com/q/23590049
has answer: http://stackoverflow.com/a/23590141
has comment: http://stackoverflow.com/comment/36207029
has comment: http://stackoverflow.com/comment/36207021
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/36206956
has comment: http://stackoverflow.com/comment/36207354
upvote count: 0
has body: Its should be very simple. I have this String: ins113457MessageResponse xmlns="httptt://www.ins113457.org/ins113457/" I wnat to replace part of the string - i use: reponse_str = new String(response).replace(" xmlns=\"httptt:////www.ins113457.org//ins113457//\"", ""); reponse_str = new String(response).replace(" xmlns=\"httptt://www.ins113457.org/ins113457/\"", ""); But both dont work! Expected output is ins113457MessageResponse What may be the problem?
has title: Replace substring not doing the work
has answer: http://stackoverflow.com/a/23590126
accepted answer: http://stackoverflow.com/a/23590126
has comment: http://stackoverflow.com/comment/36206966
type: AnsweredQuestion
score: -2
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/23590141
has comment: http://stackoverflow.com/comment/36207017
answer count: 2
downvote count: 2

http://stackoverflow.com/comment/36176181
score: 0
comment on: http://stackoverflow.com/q/23571101
type: Comment
type: QuestionComment
has text: I have tried a few different variations, including implementations with just giving the schema location for 'beans' but still the same issue. as well as updating 'bean' to 3.0

http://stackoverflow.com/a/23498741
has body: Ok I found the solution ... I think I forgot to remove my gloves before starting code ... I put styleCss instead of styleClass ...
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23498619
score: 0
answers question: http://stackoverflow.com/q/23498619
type: Answer

http://stackoverflow.com/comment/36227762
score: 1
comment on: http://stackoverflow.com/q/23600913
type: Comment
type: QuestionComment
has text: You shouldn't be saving all this in static variables; use instance variables instead and just autowire everything.

http://stackoverflow.com/comment/36100064
type: QuestionComment
has text: I am using storm v. 0.9.0.1, and was referring to this reference (http://nathanmarz.github.io/storm/doc/backtype/storm/topology/TopologyBuilder.html), when checking parameters. Judging from line 138 of this code base (https://github.com/apache/incubator-storm/blob/master/storm-core/src/jvm/backtype/storm/topology/TopologyBuilder.java), it seems that documentation is not out of date.
comment on: http://stackoverflow.com/q/23532063
score: 0
type: Comment

http://stackoverflow.com/comment/36133553
comment on: http://stackoverflow.com/a/23540715
type: Comment
has text: `invokeLater` simply queues up the `Runnable` so that it is executed by the AWT thread (the thread that manages UI updates) instead of the current thread (which is not the AWT thread). So if you have anything that takes a long time to execute, don't put it inside `invokeLater` otherwise you will get the AWT stuck and your UI will become unresponsive.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23517921
tagged with: jsp
tagged with: javascript
has answer: http://stackoverflow.com/a/23518132
answer count: 6
has answer: http://stackoverflow.com/a/47453448
has comment: http://stackoverflow.com/comment/36071950
has answer: http://stackoverflow.com/a/23518170
has answer: http://stackoverflow.com/a/23518090
has comment: http://stackoverflow.com/comment/36071839
has comment: http://stackoverflow.com/comment/36072179
favorite count: 0
upvote count: 5
has title: Can we redirect one jsp page to another jsp page
tagged with: jsp-tags
has body: I want to open a jsp page without accessing my servlete code. i.e. I neither have to input my url in (action="url") my jsp code nor have to access my Servlete code. &lt;form id="main" method="post" name="main" action="dpRegPost" onsubmit="return validate();"&gt; Can anyone help me in this?
possible better answer: http://stackoverflow.com/a/23518132
has comment: http://stackoverflow.com/comment/36072065
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29502567
tagged with: java
has answer: http://stackoverflow.com/a/23518362
accepted answer: http://stackoverflow.com/a/23518362
type: Question
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/36072126

http://stackoverflow.com/comment/36250052
comment on: http://stackoverflow.com/a/23612551
has text: This is the problem ---Create a custom list backed by an integer array that accepts strings as its values. Additionally the list must keep a record of all the operations and be able to return this information upon request.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/36046353
has text: Can you explain this: your real hostname maps to your real host address. I have two entities under the ipv4 configuarain in /etc/hosts 127.0.0.1 localhost 127.0.1.1 my-username Is this right? "Some Linux distributions are known to have this back to front." is this what i have? I tried to change 127.0.1.1 to my 192.168.x.x address and it did not work:/
type: AnswerComment
comment on: http://stackoverflow.com/a/23485296
type: Comment
score: 1

http://stackoverflow.com/comment/36145285
type: QuestionComment
has text: @Bhesh I was trying that as well, but then i get more problems with opreations like card.next etc, i suppose i would have to redo everything in the list without the E part or something. Was hoping there was an easier way to convert from Element<Card> to card or something
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23556477

http://stackoverflow.com/a/34739483
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/83918221
answers question: http://stackoverflow.com/q/23469061
upvote count: 1
has body: I tried many things but didnt worked. Then I tried using sudo rstudio and then install.packages('rJava') Its working. Coool
type: Answer

http://stackoverflow.com/a/23462387
has comment: http://stackoverflow.com/comment/35970751
has comment: http://stackoverflow.com/comment/35969888
type: Answer
has comment: http://stackoverflow.com/comment/35969635
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23462309
has body: Add the JBoss Logging jar to your classpath. If you use Maven, it will add this and any other required jars to the classpath org.hibernate hibernate-core 4.3.5.Final
has comment: http://stackoverflow.com/comment/35969626
upvote count: 1

http://stackoverflow.com/q/23583967
type: UnansweredQuestion
tagged with: android
upvote count: 1
answer count: 0
score: 1
tagged with: java
type: Question
has title: Android DownloadManager doesn't change status
has body: for the last few days i'm messing around with DownloadManager in my app. It kinda works, but have some issues. It downloads file fine, but when I try to open file, it say "Can't open file". Here is download manager code from my app: Uri source = Uri.parse(url); DownloadManager.Request request = new DownloadManager.Request( source); //Set title and get name file download //Replace %20 from filename with spaces request.setDescription("Downloading..."); String split[] = url.split("/"); String filename1 = split[split.length - 1]; String filename2 = filename1.replace("%20", " "); request.setTitle(filename2); //Set path for save download file request.setDestinationInExternalPublicDir( Environment.DIRECTORY_DOWNLOADS, filename2); //Show notification in notification bar after download request.setNotificationVisibility( DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); manager.enqueue(request); Thath everyone would understand easier, here is some screenshots with the issue: As you can see, it downloads file: https://i.sstatic.net/FaPVG.png File is downloaded successfully: https://i.sstatic.net/aKU0m.png However, when I enter "Downloads" it still shows, that the file is still in "Downloading..." state. And when I try to open it, it says "Can't Open file" https://i.sstatic.net/xYvw3.png https://i.sstatic.net/1mVQn.png And if I enter Downloads directory with "File Manager", I can see it has been completely downloaded, and If i try to open it, it opens just fine. Maybe anyone knows how to fix it? or where should I look for an error? P.S. Sorry if its not so clear, but English isn't my native language. ArnoldasM
downvote count: 0
favorite count: 0
tagged with: android-download-manager

http://stackoverflow.com/comment/36104578
has text: You'll still need to escape the quotes.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23534380

http://stackoverflow.com/a/26162566
has body: try to write the ObjectNode as a String : // your code final ObjectNode payload = getObjectMapper().createObjectNode(); payload.put("startDate", DateTime.now().toString()); payload.put("endDate", DateTime.now().plusDays(30).toString()); payload.put("networkId", 0); // the solution String entity = getObjectMapper().writeValueAsString(payload); final Response response = builder.accept(MediaType.APPLICATION_JSON).post(Entity.entity(entity, MediaType.APPLICATION_JSON));
score: 1
answers question: http://stackoverflow.com/q/23601842
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/32592588
has body: setPreferredSize works nice fine in combination with setScaleToFit. At least it worked for me. import java.awt.*; import java.net.*; import java.io.*; import javax.swing.*; import com.kitfox.svg.*; import com.kitfox.svg.app.beans.*; class IconPanel extends JPanel { final SVGIcon icon; public IconPanel(String name, int scalex, int scaley) { icon = new SVGIcon(); icon.setSvgURI(new SVGUniverse().loadSVG(getClass().getResource(name))); icon.setPreferredSize(new Dimension(scalex, scaley)); icon.setScaleToFit(true); icon.setAntiAlias(true);} public void paintComponent(Graphics g) { icon.paintIcon(this, g, 0, 0); icon.isScaleToFit();}} public static void main(String[] args){ JFrame frame=new JFrame(); JPanel p=new JPanel(); frame.setSize(800, 600); frame.setLayout(new BorderLayout()); IconPanel icon=new IconPanel("cell.svg",1000,1000); frame.add(icon,BorderLayout.CENTER); frame.setVisible(false); frame.add(p,BorderLayout.PAGE_START); JButton button=new JButton(); p.add(button); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.show(); } }
score: 1
has comment: http://stackoverflow.com/comment/53088360
answers question: http://stackoverflow.com/q/23558397
has comment: http://stackoverflow.com/comment/53100749
upvote count: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/53437826
has comment: http://stackoverflow.com/comment/53042377

http://stackoverflow.com/q/23557845
tagged with: binary-search-tree
has answer: http://stackoverflow.com/a/23557900
has body: Problem Description: (language is java) Given an input array representing a preorder traversal of a binary search tree, output a postorder traversal of the BST. Catch : No construction of BST nodes. No recursions. O(n) running time. I have tried figuring it out for hours, but still have no clues. The hardest part is without using the tree node struct. Anyone have ideas?
type: UnansweredQuestion
has title: Output Post-Order Binary Search Tree from Given Pre-Order input without constructing tree or using recursions
tagged with: java
tagged with: postorder
type: Question
answer count: 1
score: 0
tagged with: preorder

http://stackoverflow.com/a/23485964
type: Answer
has body: o...my... god... the tutorial is broken. i had to go hunt down the github code to figure it out: you have to use &lt;web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"&gt; in the xml.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23485722
upvote count: 1

http://stackoverflow.com/q/23512695
has title: Liferay Spring set autocommit false
tagged with: java
tagged with: hibernate
type: Question
score: 0
tagged with: liferay
answer count: 1
tagged with: persistence
has body: Is there a way to turn off the autocommit for Spring in Liferay 6 running in Glassfish for all entities? I need this for keeping a copy of the old model for auditing purposes. I tried autocommit=false in the JDBC url and setting the hibernate.connection.autocommit=false in the portal-ext.properties public &lt;T extends BaseModel&lt;T&gt;&gt; T auditUpdate(final T model, final BasePersistence&lt;T&gt; persistence) T oldModel = null; try { oldModel = persistence.findByPrimaryKey(model.getPrimaryKeyObj()); } catch (final NoSuchModelException ignored) { // This is an insert } moreover oldModel == model returns true
tagged with: spring
has answer: http://stackoverflow.com/a/23513313
type: UnansweredQuestion

http://stackoverflow.com/comment/36084156
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23524001
has text: @Adri1du40 I tried what you suggested and it's still not working.
score: 0

http://stackoverflow.com/a/23515906
type: Answer
answers question: http://stackoverflow.com/q/23501682
score: 0
has body: I can not reproduce your problem. Calling this resource returns a 500: @GET @Path("/npe") public Response triggerNpe() { String npe = null; npe.length(); return Response.ok().build(); } Response: HTTP Status 500 - Internal Server Error javax.servlet.ServletException: java.lang.NullPointerException I am using Glassfish 4 with standard libraries.
has comment: http://stackoverflow.com/comment/36129665

http://stackoverflow.com/a/23724658
has body: Thanks. i i fixed it. I also had a problem with the activity not been declared in the manifest file which i have done. Now everything works fine..
answers question: http://stackoverflow.com/q/23517853
type: Answer
score: 0

http://stackoverflow.com/a/23486885
has comment: http://stackoverflow.com/comment/36014448
type: Answer
has comment: http://stackoverflow.com/comment/36014412
accepted answer of: http://stackoverflow.com/q/23486847
score: 2
has comment: http://stackoverflow.com/comment/36014696
has body: Don't close the Statement. Scenario is like this first close resultset then statement. Write you code like this: public static Boolean recordsExist(String string, Connection c) { try { String[] query = string.split("\\*"); String sql = "select count(*) as total" + query[1]; Statement s = c.createStatement(); ResultSet resultset = queryDB(sql, c, s); resultset.next(); int count = resultset.getInt(1); Log.debug(Integer.toString(count)); resultset.close(); s.close(); if (count &gt; 0) { Log.debug("recordsExist returning true"); return true; } else { Log.debug("recordsExist returning false"); return false; } } catch (Exception e) { Log.debug(e.getMessage()); return false; } } public static ResultSet queryDB(String sql, Connection c, Statement s ) throws SQLException { Log.debug(sql); ResultSet resultset = s.executeQuery(sql); return resultset; }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36014576
has comment: http://stackoverflow.com/comment/36015012
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/23486847

http://stackoverflow.com/q/23511045
downvote count: 0
has body: I have viewpager in my main activity and i need set timer to it to automatically change slide . I need set defult size and position to my image ( any resolution) for any screen to show one third of my top screen like this Preview. Mainactivity.java public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Image slide show ViewPager viewPager = (ViewPager) findViewById(R.id.view_pager); ImageAdapter adapter = new ImageAdapter(this); viewPager.setAdapter(adapter); // End Image slide show } ImageAdapter.java package com.example.gallery; import android.content.Context; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; public class ImageAdapter extends PagerAdapter { Context context; private int[] GalImages = new int[] { R.drawable.one, R.drawable.two, R.drawable.three }; ImageAdapter(Context context){ this.context=context; } @Override public int getCount() { return GalImages.length; } @Override public boolean isViewFromObject(View view, Object object) { return view == ((ImageView) object); } @Override public Object instantiateItem(ViewGroup container, int position) { ImageView imageView = new ImageView(context); int padding = context.getResources().getDimensionPixelSize(R.dimen.padding_medium); imageView.setPadding(padding, padding, padding, padding); imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE); imageView.setImageResource(GalImages[position]); ((ViewPager) container).addView(imageView, 0); return imageView; } @Override public void destroyItem(ViewGroup container, int position, Object object) { ((ViewPager) container).removeView((ImageView) object); } }
has answer: http://stackoverflow.com/a/23558053
tagged with: slider
tagged with: android
answer count: 1
favorite count: 0
has title: Add timer and set size to viewpager
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23558053
score: 1
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/36122541
type: AnswerComment
comment on: http://stackoverflow.com/a/23540410
has text: I somehow have a strong notion that the error lies due to syntax rules of Access Database..but not sure where lies the error. The ResultSet rs = st.executeQuery(); statement never seems to execute
type: Comment
score: 0

http://stackoverflow.com/a/23631998
has body: Looking at your XML file, I still believe that there is something going wrong in your project. This minimal example does not reproduce the problem on a Nexus 7 2013 4.4.2 (minSDK=8, targetSDK=19): Taking your XML and removing backgrounds / textcolors does not reproduce it either: Lastly, I'm noticing android:textColor="button_gamemainmenu_text", which is not default Android behavior and suggests that you're handling text color in your own way. I strongly believe that removing this custom behavior will solve the problem.
type: Answer
has comment: http://stackoverflow.com/comment/36287031
has comment: http://stackoverflow.com/comment/36430200
has comment: http://stackoverflow.com/comment/36451527
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23588733
has comment: http://stackoverflow.com/comment/36451627
has comment: http://stackoverflow.com/comment/36287203
has comment: http://stackoverflow.com/comment/36420660
answers question: http://stackoverflow.com/q/23588733
score: 6
has comment: http://stackoverflow.com/comment/36287030
has comment: http://stackoverflow.com/comment/36287155
has comment: http://stackoverflow.com/comment/36286826
has comment: http://stackoverflow.com/comment/36287070
has comment: http://stackoverflow.com/comment/36512741
has comment: http://stackoverflow.com/comment/36287498
has comment: http://stackoverflow.com/comment/36288167
has comment: http://stackoverflow.com/comment/36287822
has comment: http://stackoverflow.com/comment/36287262
has comment: http://stackoverflow.com/comment/36426414
has comment: http://stackoverflow.com/comment/36426952
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36480306
downvote count: 0

http://stackoverflow.com/comment/36154101
type: QuestionComment
has text: `myString` is not the correct string. you need to escape the `"` character.
comment on: http://stackoverflow.com/q/23561872
score: 1
type: Comment

http://stackoverflow.com/a/23578703
score: 1
downvote count: 0
has body: Scanner.nextLine() returns a single line so splitting by '\n' will always give a single element array, e.g.: timetable.nextLine().split("\n"); // e.g., "1,2,3,4,5" =&gt; ["1,2,3,4,5"] Try splitting by the ',' instead, e.g.: timetable.nextLine().split(","); // e.g., "1,2,3,4,5" =&gt; ["1", "2", "3", "4", "5"] NOTE: If you are intending for the array to contain individual lines, then check out this SO post. Scanner s = new Scanner(new File(filename)); List&lt;String&gt; lines = new ArrayList&lt;String&gt;(); // A List can be dynamically resized while(s.hasNextLine()) lines.add(s.nextLine()); // Store each line in the list String[] arr = lines.toArray(new String[0]); // If you really need an Array, use this
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23578657

http://stackoverflow.com/a/23492481
accepted answer of: http://stackoverflow.com/q/23475189
score: 23
upvote count: 23
has body: I just fixed it after some research of my own code. The only thing which is required to change &lt;arg0&gt; is that we need to used @WebParam annotation to declare custome name instead of "arg0". For example: my service name is getEmpDetail and EmpID is the input parameter to the service then here is the declaration required in the service impl class: public Emp getEmpDetail(@WebParam(name="EmpDetail") String EmpId) after generatingfrom WSDL the request XML will look like below &lt;ns:getEmpDetail&gt; &lt;EmpDetail&gt; &lt;EmdID&gt;?&lt;/EmpID&gt; &lt;/EmpDetail&gt; &lt;ns:getEmpDetail&gt;
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23475189
type: Answer
has comment: http://stackoverflow.com/comment/83995206

http://stackoverflow.com/a/23515013
has body: One alternative way to convert your ArrayLists into Vectors could be to create your own org.you.Vector that extends java.util.ArrayList. Then, as you pointed out that you are able to manipulate the imports, just replace org.you.Vector with java.util.Vector.
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36066353
answers question: http://stackoverflow.com/q/23495772
downvote count: 0

http://stackoverflow.com/comment/115847072
has text: It's a rhetorical question by the way. *Obviously* you want `.equals` in this case.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23589523
type: AnswerComment

http://stackoverflow.com/comment/43090556
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23544883
has text: A URL can be a filename, see RFC 1630 and RFC 1738. The bug is that getFile() and getPath() return invalid formats for Filenames and Paths.
score: 0

http://stackoverflow.com/a/23598551
type: AcceptedAnswer
downvote count: 1
has body: Try changing System.out.print("What is your name ")? to: System.out.println("What is your name?"); This should work, as you have a ? instead of a ;.
type: Answer
accepted answer of: http://stackoverflow.com/q/23598500
answers question: http://stackoverflow.com/q/23598500
score: 1
upvote count: 2

http://stackoverflow.com/comment/36119026
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23542781
has text: `jArray` may be `null`. Please double check!

http://stackoverflow.com/a/23607899
type: Answer
upvote count: 9
answers question: http://stackoverflow.com/q/23601842
score: 9
downvote count: 0
has comment: http://stackoverflow.com/comment/42140076
has body: If you ok using Jackson 1.x, then you need to the following 3 things. 1. Add Jersey Jackson to your pom.xml: org.glassfish.jersey.media jersey-media-json-jackson 2.8 2. Create a ContextResolver: @Provider public class ObjectMapperProvider implements ContextResolver<ObjectMapper> { final ObjectMapper defaultObjectMapper; public ObjectMapperProvider() { defaultObjectMapper = getObjectMapper(); } @Override public ObjectMapper getContext(Class<?> type) { return defaultObjectMapper; } public static ObjectMapper getObjectMapper() { return new ObjectMapper() .configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false /* force ISO8601 */) .configure(SerializationConfig.Feature.WRITE_ENUMS_USING_TO_STRING, true) .configure(DeserializationConfig.Feature.READ_ENUMS_USING_TO_STRING, true) .setSerializationInclusion(JsonSerialize.Inclusion.ALWAYS); } } 3. Register providers with ClientBuilder: final Client client = ClientBuilder.newBuilder() .register(ObjectMapperProvider.class) .register(JacksonFeature.class) .build(); final WebTarget target = client.target(url).path("inventorySummary"); final ObjectNode payload = ObjectMapperProvider.getObjectMapper().createObjectNode(); payload.put("startDate", DateTime.now().toString()); payload.put("endDate", DateTime.now().plusDays(30).toString()); payload.put("networkId", 0); final Response response = target.request(MediaType.APPLICATION_JSON) .post(Entity.json(payload)); assertStatus(Response.Status.OK.getStatusCode(), response);

http://stackoverflow.com/q/23492985
has answer: http://stackoverflow.com/a/23500390
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36028712
has body: I would like to learn clojure and installed it via Leiningen. Startup fails [see below]. Question: how can I start Clojure? Details: Xubuntu 14.04 LTS 64, java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64. Message at startup: henk@henk-System-Product-Name:~$ lein repl nREPL server started on port 46904 on host 127.0.0.1 REPL-y 0.3.0 Clojure 1.5.1 Docs: (doc function-name-here) (find-doc "part-of-name-here") Source: (source function-name-here) Javadoc: (javadoc java-object-or-class-here) Exit: Control+D or (exit) or (quit) Results: Stored in vars *1, *2, *3, an exception in *e user=&gt; Exception in thread "Thread-4" java.io.FileNotFoundException: /home/henk/.lein /repl-port (Permission denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:221) at clojure.java.io$fn__8640.invoke(io.clj:234) at clojure.java.io$fn__8564$G__8540__8571.invoke(io.clj:73) at clojure.java.io$fn__8614.invoke(io.clj:170) at clojure.java.io$fn__8590$G__8544__8597.invoke(io.clj:73) at clojure.java.io$writer.doInvoke(io.clj:123) at clojure.lang.RestFn.invoke(RestFn.java:410) at clojure.lang.AFn.applyToHelper(AFn.java:161) at clojure.lang.RestFn.applyTo(RestFn.java:132) at clojure.core$apply.invoke(core.clj:619) at clojure.core$spit.doInvoke(core.clj:6291) at clojure.lang.RestFn.invoke(RestFn.java:425) at user$eval540.invoke(NO_SOURCE_FILE:0) at clojure.lang.Compiler.eval(Compiler.java:6619) at clojure.lang.Compiler.eval(Compiler.java:6609) at clojure.lang.Compiler.eval(Compiler.java:6582) at clojure.core$eval.invoke(core.clj:2852) at leiningen.core.eval$fn__3577.invoke(eval.clj:304) at clojure.lang.MultiFn.invoke(MultiFn.java:231) at leiningen.core.eval$eval_in_project.invoke(eval.clj:326) at clojure.lang.AFn.applyToHelper(AFn.java:167) at clojure.lang.AFn.applyTo(AFn.java:151) at clojure.core$apply.invoke(core.clj:619) at leiningen.repl$server$fn__7443.invoke(repl.clj:201) at clojure.lang.AFn.applyToHelper(AFn.ja…
tagged with: startup
type: Question
has title: Clojure installation: starting Clojure fails
tagged with: java
accepted answer: http://stackoverflow.com/a/23500390
score: 0
has comment: http://stackoverflow.com/comment/36029286
answer count: 1
has comment: http://stackoverflow.com/comment/36035089
tagged with: clojure
has comment: http://stackoverflow.com/comment/36031674

http://stackoverflow.com/comment/36008733
type: QuestionComment
has text: no i'm not closing them here, ill try to close them and see if that helps. Thanks
comment on: http://stackoverflow.com/q/23483545
score: 0
type: Comment

http://stackoverflow.com/q/23559862
has answer: http://stackoverflow.com/a/23559951
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: bigdecimal
accepted answer: http://stackoverflow.com/a/23559951
has title: How to get a very high precision for a too large number and for a too small number in Java?
has comment: http://stackoverflow.com/comment/36150688
downvote count: 0
answer count: 1
favorite count: 0
has body: I am going to make calculations that contain either large or small numbers and result in either a very large or a very small number. What I am care about now is how to get things go as precise as possible. When I try this calculation on Google calculator 1000^10 = 1e+30 Which can be read as 1000,000,000,000,000,000,000,000,000,000 When I try the same calculations using BigDecimal, I got a different result! BigDecimal bigNumber = new BigDecimal(Math.pow(1000, 10)); System.out.println(bigNumber); 1000,000,000,000,000,019,884,624,838,656 I am happy that it gives me the full range of numbers without using the scientific notation but it gives some extra rubbish numbers at the end. Note that I am not confined to BigDecimal. I am care about precision in anyway. So, How to get a very high precision for a too large number and for a too small number in Java?
tagged with: largenumber
tagged with: precision
tagged with: biginteger
upvote count: 3
has comment: http://stackoverflow.com/comment/36150744
type: Question

http://stackoverflow.com/a/23606335
has comment: http://stackoverflow.com/comment/36238073
has comment: http://stackoverflow.com/comment/36238603
upvote count: 2
has comment: http://stackoverflow.com/comment/36238032
type: Answer
has body: You are getting an error from your SQL driver, in this case presumably an Oracle one. Please have a look at the Oracle Tips of Burleson Consulting regarding ORA-17002 (not affiliated). In case this does not help, please see also Chrostph Jahn's tipp about the same error. What the ORA-17002 basically means is that the listener can not be reached. This might be due to a wrong or incomplete hostname (try the fully qualified name of the host). Make sure that you are using the correct service name, port and hostname. Sometimes this error occurs due to the fact that you are using a hostname different to that which the listener is told to listen on. Bottom line: check that you are using exactly the same hostname, port and service name that your listener is configured to. Without more information (read: the stack trace) it is impossible to be more specific.
has comment: http://stackoverflow.com/comment/36286271
answers question: http://stackoverflow.com/q/23606088
score: 1
has comment: http://stackoverflow.com/comment/36270634
downvote count: 1

http://stackoverflow.com/comment/36003000
has text: I think I can also come up with some magic with `volatile` variable and memory `fences` that can provide visibility guarantees for the operation, but not atomicity. Anyway, glad to help as always.
comment on: http://stackoverflow.com/a/23480465
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23482661
accepted answer of: http://stackoverflow.com/q/23482448
has comment: http://stackoverflow.com/comment/36041974
has comment: http://stackoverflow.com/comment/36027634
has comment: http://stackoverflow.com/comment/36012653
answers question: http://stackoverflow.com/q/23482448
has comment: http://stackoverflow.com/comment/36026700
has comment: http://stackoverflow.com/comment/36067833
has comment: http://stackoverflow.com/comment/36015640
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36017770
downvote count: 0
has comment: http://stackoverflow.com/comment/36050151
type: Answer
has comment: http://stackoverflow.com/comment/36060035
has body: Obviously the file isn't being found. As you've only specified it as "client.policy", it needs to be in the current working directory when the program is launched. If you run it with -Djava.security.debug=access,failure you will get a very complete trace of security manager failures, including the security domain in effect at the time and the .policy file it was configured from.
has comment: http://stackoverflow.com/comment/36007472
score: 1
upvote count: 1

http://stackoverflow.com/comment/36003650
type: AnswerComment
type: Comment
has text: Right, the exceptions thrown now, are: com.google.api.ads.common.lib.exception.OAuthException AND com.google.api.ads.common.lib.exception.ValidationException I can catch only these two exception instead of Exception. We do have custom Exception as well, the thing is that I did not want to change the signature of all methods calling method1() to throw any other exception instead of IOException.
comment on: http://stackoverflow.com/a/23480888
score: 0

http://stackoverflow.com/a/23528640
has body: The third case in your if/else will never be entered because of the previous case's &lt;=. There's not really an upper bound on potential salary so it's hard to answer, but they have the potential to make base + 21.6% it looks like. So I'd make a function that took the sales and then provided the base + 21.6% of that. The CompensationTable() and PayCalculator() functions are confusing (should not be capitalized either). It looks like you were trying to make CompensationCalculator() into your potential function, but returned 0 instead of a value.
score: 0
answers question: http://stackoverflow.com/q/23528503
type: Answer

http://stackoverflow.com/comment/36160736
type: QuestionComment
comment on: http://stackoverflow.com/q/23565230
score: 3
has text: Please don't use `StringBuffer`, it was replaced by `StringBuilder` ten years ago.
type: Comment

http://stackoverflow.com/comment/36185072
has text: i have tried this && and this have solved the problem .thanks zicow56
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23578024

http://stackoverflow.com/q/23475403
accepted answer: http://stackoverflow.com/a/23475535
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23475535
has title: Java: How to declare a List using a Class object as parameter?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35992642
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35993205
favorite count: 0
has body: I'm looking to invoke by reflection a method that returns List&lt;X&gt;. However, I do not have the class definition for X, so I can only get the type by reflection. What's the proper syntax for declaring List&lt;X&gt;, where X is a Class object?

http://stackoverflow.com/comment/35971488
type: Comment
comment on: http://stackoverflow.com/a/23463456
type: AnswerComment
has text: You need to add get methods in the super class, and set them to return what they have to return (e.g. `public int getWidth(){return this.width;}public int getX(){return this.x;}` ) and use them to retrieve the field value instead of accessing the field directly
score: 0

http://stackoverflow.com/comment/36144981
comment on: http://stackoverflow.com/a/23556594
type: AnswerComment
has text: Thank you for reply but what I mean is like this... a++; is a=a+1;
type: Comment
score: 0

http://stackoverflow.com/q/23586106
score: 0
tagged with: file-io
tagged with: initialization
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23586156
answer count: 4
has body: I'm having trouble with a file initiation. Basically, I want my problem to randomly choose a file. This is the code I have currently: public void doFile () throws FileNotFoundException { File one = new File ("RJOpening.txt"); File two = new File ("RJBalcony.txt"); File choice; int n = (int)(Math.random() * 2); switch (n) { case 1: choice = one; break; case 2: choice = two; break; default: break; } Scanner input = new Scanner (choice); The above gives me a compiler error on the Scanner input line, saying that variable "choice" was not initialized. I tried doing File choice = new File (), but obviously that doesn't work. Any suggestions?
has answer: http://stackoverflow.com/a/23586179
tagged with: java
has answer: http://stackoverflow.com/a/23586183
has comment: http://stackoverflow.com/comment/36199874
tagged with: switch-statement
type: Question
has answer: http://stackoverflow.com/a/23586173
has title: Initializing new file in a switch statement

makefile
tags question: http://stackoverflow.com/q/23612450
type: Tag
tag name: makefile

http://stackoverflow.com/comment/67898086
has text: Another observation. As the accepted answer points out, the number of intersections in the worst case is O(n^2), so O((n+s)log n) is O(n^2 log n) in the worst case, which is worse than the O(n^2) method of comparing each circle pair. Unless there are some constraints on the circles that bound s, an O((n+s) log n) algorithm has no clear advantage over an O(n^2) one. Something better like O(n log n + s) as suggested by @mic_e is needed.
comment on: http://stackoverflow.com/q/23548473
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23494418
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23494344
answers question: http://stackoverflow.com/q/23494344
has body: It's a semantic difference, you won't see any real performance change in your code as a result of assigning a method return value to a local variable. Lists, Sets, Map entry sets, arrays are all iterable in the for-each loop, so they are all fine and result in you not having to know the return collection type.
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/36090616
type: Comment
has text: @EdwinDalorzo Sure you can. Just have to block correctly.
comment on: http://stackoverflow.com/q/23527350
score: 0
type: QuestionComment

http://stackoverflow.com/a/23586633
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23573614
type: Answer
has body: I'm not sure if this is causing the null pointer exception, but you need to update the text area on the FX Application Thread. You should replace updateTextArea(); with Platform.runLater(() -&gt; updateTextArea()); or, if you are still using Java 7, Platform.runLater(new Runnable() { @Override public void run() { updateTextArea(); } });
upvote count: 5
answers question: http://stackoverflow.com/q/23573614
score: 5
type: AcceptedAnswer

http://stackoverflow.com/q/23519223
upvote count: 2
tagged with: http://stackoverflow.com/tag/html
has title: Changing part of the html page without refreshing whole page
has comment: http://stackoverflow.com/comment/36158531
has comment: http://stackoverflow.com/comment/36166226
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23592595
type: Question
has comment: http://stackoverflow.com/comment/36116730
answer count: 2
has comment: http://stackoverflow.com/comment/36116390
tagged with: jquery
has body: I have a html page and a java application with Thymeleaf templating engine and I'm looking for a tutorial to make a request to the server and render only part of the page based on response. At this moment, I have some buttons having a link of the same page with a different parameter, my div is created based on attribute articleList (which I receive from the server based on button_id) HTML: button 1 button 2 Article Java: public class NodController implements IGTVGController { public void process( final HttpServletRequest request, final HttpServletResponse response, final ServletContext servletContext, final TemplateEngine templateEngine) throws Exception { final WebContext ctx = new WebContext(request, response, servletContext, request.getLocale()); Integer button_id = Integer.valueOf(request.getParameter("button_id")); List<String> articleList = getArticleList(button_id); request.getSession().setAttribute("articleList",articleList); templateEngine.process("/index", ctx, response.getWriter()); } I want my buttons to process my index controller and only change the div with the articles and not refresh the entire page. I have tried using ajax but I didn't find code examples for server-side that I could understand, so I don't know how to process the request and I don't know how to use servlets. Also I didn't manage to send any request to my current controller. I have also found in thymeleaf api this method: public final void process(String templateName, IContext context, IFragmentSpec fragmentSpec, Writer writer) where IFragmentSpec should "select a fragment of a template to be processed (once read and parsed), discarding the rest of the template" but I couldn't find more information about it as how to use it or if it is what I'm looking for.
tagged with: thymeleaf
accepted answer: http://stackoverflow.com/a/23592595
has comment: http://stackoverflow.com/comment/36074491
downvote count: 0
has comment: http://stackoverflow.com/comment/36124087
possible better answer: http://stackoverflow.com/a/23594105
favorite count: 0
tagged with: ajax
has answer: http://stackoverflow.com/a/23594105

http://stackoverflow.com/comment/36033640
comment on: http://stackoverflow.com/q/23496839
has text: @broncoAbierto The first servlet(HelloWorld) has two URL mappings, one in the annotation and another in the web.xml. The second's URL is not defined in the web.xml
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35972899
score: 0
type: Comment
type: QuestionComment
has text: Because b.g() will call client methods?
comment on: http://stackoverflow.com/q/23463595

webchromeclient
tag name: webchromeclient
tags question: http://stackoverflow.com/q/23496838
tags question: http://stackoverflow.com/q/23567735
tags question: http://stackoverflow.com/q/23498523
type: Tag

http://stackoverflow.com/comment/36043767
comment on: http://stackoverflow.com/a/23502505
score: 0
type: AnswerComment
type: Comment
has text: please help me a bit more here. I am kind of newbie in java so i will have to ask you to explain a bit better. Thanks

http://stackoverflow.com/comment/35972215
type: QuestionComment
comment on: http://stackoverflow.com/q/23463802
has text: My advice - write a test first then write code until the test passes. Or since you already written code write a junit test to find your error. -- and yes, brace all of your conditionals
score: 0
type: Comment

http://stackoverflow.com/comment/36010321
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23483884
has text: @user3590149 It was not clear to me that the first block *was* a Multimap. I have reformatted your question in a way that makes sense to me, please look over it and make sure it's still what you're looking for, I'll update my answer.
score: 0

http://stackoverflow.com/comment/36078177
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23504827
has text: Alright... I've seen that before, but some parts of me were hoping you'd have a nicer solution somewhere ;) But what counts in the end is that that solved the problem :) I'll dive into the dependencies of the bundles a bit deeper sometimes to maybe clean up that package mess a bit, but at least it works for a start, so thanks a lot! --- Before I forget, your bundle looks really cool! I can't use it for my project because of policy restrictions, but I'm sure it would help a lot of people out there.
type: AnswerComment

http://stackoverflow.com/a/23566771
accepted answer of: http://stackoverflow.com/q/23566506
answers question: http://stackoverflow.com/q/23566506
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: The javadocs state Splits this string around matches of the given regular expression. This method works as if by invoking the two-argument split method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array. The expression .*[\d].* matches the whole String, i.e a1b2c3 is what to split around, so only two empty strings remain, which can be saved to the array, which this method does not do because of the limit 0 String sarr[]=s.split(&quot;.*[\\d].*&quot;, -1); shows those two empty strings S: S: 2 You could test the match by printing System.out.println(s.matches(&quot;.*[\\d].*&quot;)); the output is true. The expression \d matches 1, 2 and 3, so splits are done around, which results in [a, b, c]

http://stackoverflow.com/a/23464256
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23464149
answers question: http://stackoverflow.com/q/23464149
has body: No, but if you use Integer.valueOf(), Long.valueOf(), etc you may get single cached values. Not the same thing.
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/55938109
downvote count: 0

http://stackoverflow.com/a/23582801
answers question: http://stackoverflow.com/q/23582761
accepted answer of: http://stackoverflow.com/q/23582761
has comment: http://stackoverflow.com/comment/36193715
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36193732
score: 0
type: Answer
has body: the variable result is always receiving the value 0, what cause the non execution of code inside the if. From Statement#executeUpdate javadoc: Returns: either (1) the row count for SQL Data Manipulation Language (DML) statements or (2) 0 for SQL statements that return nothing In your case, you're executing a DDL statement that returns nothing, so your output will always be 0. This doesn't mean the statement didn't get executed, it is just how the underlying implementation should behave (and it's ok). By the way, in JDBC, you should not append semicolon to your SQL statements, so remove the semicolon at the end of your statement: //no semicolon at the end int result = stmt.executeUpdate("CREATE DATABASE horario WITH OWNER "+ usuario);

http://stackoverflow.com/a/23542139
answers question: http://stackoverflow.com/q/23541734
has body: It is the heap that is filling up, so it doesn't have to do with physical memory or swap. The question is, why does the JVM behave differently on the two OS? Regardless, something seems to be interfering with garbage collection, most likely, you are instantiating many objects and holding references to them. In a Swing app, this often has to do with listeners that are not removed. Look through your code for places where you are repeatedly instantiating objects. Ensure all references associated with them are set to null when they are no longer used. Even better, look at ways to instantiate once and then reuse the instance, possibly by turning visibility on and off.
score: 0
type: Answer

http://stackoverflow.com/comment/36002879
type: Comment
has text: I don't want to use locks or synchronized block/method for that matter. Anyway the wrapper class seems good alternative(instead of methods which block the threads).
type: AnswerComment
comment on: http://stackoverflow.com/a/23480465
score: 0

http://stackoverflow.com/q/23487804
has title: How to add property tag inside target tag in build.xml in ant
accepted answer: http://stackoverflow.com/a/31376630
tagged with: android
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23489673
has comment: http://stackoverflow.com/comment/50731768
has answer: http://stackoverflow.com/a/23489673
has comment: http://stackoverflow.com/comment/50731798
type: Question
linked to: http://stackoverflow.com/q/3082048
tagged with: ant
has answer: http://stackoverflow.com/a/31376630
score: 4
upvote count: 4
has body: i have the same source code for 5 projects and i want to build each project with the same build file in ANT. i want to build the code using the name of each project.
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36124556
comment on: http://stackoverflow.com/a/23545636
type: Comment
score: 0
type: AnswerComment
has text: Yes that would be it. Thanks for your Answer, but it has already been answered.

http://stackoverflow.com/comment/36011773
type: Comment
comment on: http://stackoverflow.com/q/23485160
type: QuestionComment
has text: Remember to only synchronize on `final` references to objects. synchronizing on a changing reference doesn't do what you think it might ;)
score: 0

http://stackoverflow.com/q/23467039
tagged with: java
tagged with: groovy
answer count: 1
downvote count: 0
tagged with: javascript
has title: Groovy calcaution is same as javascript?
favorite count: 0
has answer: http://stackoverflow.com/a/23467431
type: UnansweredQuestion
upvote count: 1
type: Question
has body: What was wrong Groovy calculation in my program? public class GroovyRunner { public static void main(String[] args) throws Exception { new GroovyShell().parse(new File("hello.groovy")).invokeMethod("show", null); } } hello.groovy def show() { float a = 0.1; float c = 0.1; float d = 0.2; if(a + c == d) { println "Equal" } else { println "Not Equal" } } The result is `Equal` When I change the value of c and d variable as below. The result is Not Equal hello.groovy def show() { float a = 0.1; float c = 0.2; float d = 0.3; if(a + c == d) { println "Equal" } else { println "Not Equal" } } I decided to use Groovy as I would like to avoid the floating point calculation of Javascript engine. Groovy calculation is as Javascript?
has comment: http://stackoverflow.com/comment/35977688
score: 1

http://stackoverflow.com/comment/36127909
has text: do you need the `'.'`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23547488

http://stackoverflow.com/q/23538145
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23538984
tagged with: java
tagged with: rms
has comment: http://stackoverflow.com/comment/135552992
type: Question
has comment: http://stackoverflow.com/comment/36110517
has comment: http://stackoverflow.com/comment/36110675
has comment: http://stackoverflow.com/comment/36110803
has comment: http://stackoverflow.com/comment/36111111
score: 0
has body: I am making this J2ME application but I am having some problem when I am trying to save I thinks that it save properly but I am not sure....but when I retrieve it gives null This is how I am storing them PAR par = new PAR(oldMonPay, newMonPay, oldInterest); par.setOldMPay(oldMonPay); par.setNewMPay(newMonPay); par.setOldInt(oldInterest); And this is how I saving and retrieving public static byte[] parseObjPAR(PAR p) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream out; try { out = new DataOutputStream(baos); out.writeUTF(p.getNewMPay()); out.writeUTF(p.getOldInt()); out.writeUTF(p.getOldMPay()); } catch (IOException e) { } return baos.toByteArray(); } public static PAR parseByteArrPAR(byte[] b) { PAR p = null; ByteArrayInputStream bais; DataInputStream in; if (b != null) { try { bais = new ByteArrayInputStream(b); in = new DataInputStream(bais); p = new PAR( in.readUTF(), in.readUTF(), in.readUTF()); } catch (IOException e) { } } return p; } This is how I displaying the retrieved information, there is another problem this thing is not showing all the data but is only showing the 3 records. I think the first 3. public void populatePAResult(PAR[] p) { try { for (int i = 0; i &lt; p.length; i++) { String oldMP = p[i].getOldMPay(); String newMP = p[i].getNewMPay(); String oldI = p[i].getOldInt(); result1.append("Day : " + oldMP, null); result1.append("Time : " + oldI, null); result1.append("Technology : " + newMP, null); } } catch (Exception e) { } }
has comment: http://stackoverflow.com/comment/36111372
answer count: 1
has comment: http://stackoverflow.com/comment/36110575
tagged with: java-me
has title: Unable to save and retrieve using ByteAarrayOutputStream
has comment: http://stackoverflow.com/comment/36110842

http://stackoverflow.com/a/31436535
score: 14
has body: The most clean solution since spring 4.2 RC3 is using the new createDispatcherServlet hook within the class extending AbstractDispatcherServletInitializer (or indirectly through extending AbstractAnnotationConfigDispatcherServletInitializer) like this: public class WebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return null; } /* ... */ @Override protected DispatcherServlet createDispatcherServlet(WebApplicationContext servletAppContext) { final DispatcherServlet dispatcherServlet = super.createDispatcherServlet(servletAppContext); dispatcherServlet.setThrowExceptionIfNoHandlerFound(true); return dispatcherServlet; } } Then you can use a global @ControllerAdvice (a class that is annotated with @ControllerAdvice) as described in the reference docs. Within the advice you can handle the NoHandlerFoundException with an @ExceptionHandler as described here. This could look something like this: @ControllerAdvice public class NoHandlerFoundControllerAdvice { @ExceptionHandler(NoHandlerFoundException.class) public ResponseEntity&lt;String&gt; handleNoHandlerFoundException(NoHandlerFoundException ex) { // prepare responseEntity return responseEntity; } }
answers question: http://stackoverflow.com/q/23574869
downvote count: 0
has comment: http://stackoverflow.com/comment/68366182
has comment: http://stackoverflow.com/comment/74016000
type: Answer
has comment: http://stackoverflow.com/comment/74031956
upvote count: 14

http://stackoverflow.com/comment/36228786
score: 0
type: Comment
type: QuestionComment
has text: That doesn't look like a valid `file:` URI to me..
comment on: http://stackoverflow.com/q/23599726

http://stackoverflow.com/q/23496640
tagged with: android
has title: Exception in HttpResponse execute in android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36032809
type: Question
accepted answer: http://stackoverflow.com/a/23496821
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23496821
has comment: http://stackoverflow.com/comment/36032435
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36032512
has body: I'm stuck for hours with an Exception from HttpRequest method and I'm really tired of this. Did a google research, but i can't find any answer to fix it. I need to do a http request to get data from database via PHP scripts. Everything is going well, when I call method for all lines from table with params: url - "http://android-connection.cba.pl/get_all_notes.php" method - "GET" List - empty list But it spits out an Exception when i trying to get specify id line with parameters: url - "http://android-connection.cba.pl/get_note.php" method - "GET" List - [noteid=1] I call it from doInBackground method in class, which extends AsyncTask. There is this problematic method, if you could help me with this.. thanks! public JSONObject makeHttpRequest(String url, String method, List&lt;NameValuePair&gt; params) { // Making HTTP request try { // check for request method if(method == "POST"){ // request method is POST // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); }else if(method == "GET"){ // request method is GET DefaultHttpClient httpClient = new DefaultHttpClient(); String paramString = URLEncodedUtils.format(params, "utf-8"); url += "?" + paramString; HttpGet httpGet = new HttpGet(url); Log.e("URL", url); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line = reader.readLine()) != null) { sb.append(l…
tagged with: http-request
tagged with: exception

http://stackoverflow.com/comment/36130569
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23548825
has text: Is `<mvc:annotation-driven />` in your dispatcher servlet?
score: 0

http://stackoverflow.com/a/65205215
type: Answer
answers question: http://stackoverflow.com/q/23560723
has body: Just a followup as to why you are seeing the StatusLogger entries. Status logger dumps out some key metrics during specific times of 'stress' on Cassandra. As Zanson pointed out you are specifically seeing this due to garbage collection runs. By default, there is a config entry called gc_log_threshold_in_ms which defaults to 200ms(adjustable in the config), any garbage collection &gt;200ms will log the status logger entries you are seeing. Additionally, there is another config entry called gc_warn_threshhold_in_ms which will log those entries at the WARN log level instead of INFO if the garbage collection runs are &gt;1000ms (by default, also adjustable).
score: 0

http://stackoverflow.com/q/23453859
tagged with: output
type: Question
has answer: http://stackoverflow.com/a/23454171
has answer: http://stackoverflow.com/a/23454047
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23454047
has body: I have some raw output that I want to clean up and make presentable but right now I go about it in a very ugly and cumbersome way, I wonder if anyone might know a clean and elegant way in which to perform the same operation. int size = charOutput.size(); for (int i = size - 1; i &gt;= 1; i--) { if(charOutput.get(i).compareTo(charOutput.get(i - 1)) == 0) { charOutput.remove(i); } } for(int x = 0; x &lt; charOutput.size(); x++) { if(charOutput.get(x) == '?') { charOutput.remove(x); } } String firstOne = Arrays.toString(charOutput.toArray()); String secondOne = firstOne.replaceAll(",",""); String thirdOne = secondOne.substring(1, secondOne.length() - 1); String output = thirdOne.replaceAll(" ",""); return output;
score: 0
answer count: 3
has title: Simplify & condense multiple editorial operations on an array. Java
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23453869
tagged with: java
has answer: http://stackoverflow.com/a/23453869
tagged with: formatting

gmail
type: Tag
tags question: http://stackoverflow.com/q/23453999
tag name: gmail

http://stackoverflow.com/comment/36035352
comment on: http://stackoverflow.com/q/23497846
score: 0
type: Comment
type: QuestionComment
has text: Then you were talking about a String representation of the date...

http://stackoverflow.com/q/23586847
accepted answer: http://stackoverflow.com/a/23586872
possible better answer: http://stackoverflow.com/a/23586874
has comment: http://stackoverflow.com/comment/36207239
has title: JUnit assertSame return true with two objects
has answer: http://stackoverflow.com/a/23586874
has comment: http://stackoverflow.com/comment/36201298
type: AnsweredQuestion
tagged with: java
tagged with: unit-testing
has body: Why is the following code giving me an error, I'm so confused. @Test public void testUsers() { User user1 = new User("a"); User user2 = new User("a"); assertSame(user1, user2); } This is the error I am receiving at the moment: expected same:&lt;xxx.xxx.User@615fd9fd&gt; was not:&lt;xxx.xxx.User@5be0a2fc&gt; java.lang.AssertionError I understand they are difference instances of the same object, but why this error?
type: Question
has answer: http://stackoverflow.com/a/23586872
answer count: 2
score: 0
tagged with: junit

http://stackoverflow.com/comment/72850548
type: Comment
score: 0
type: AnswerComment
has text: why phonenumber is of type String?
comment on: http://stackoverflow.com/a/23563515

http://stackoverflow.com/comment/123163714
score: 0
type: Comment
has text: Sorry, I think I down voted this by accident.
comment on: http://stackoverflow.com/a/23514417
type: AnswerComment

http://stackoverflow.com/a/23466264
has body: Remove static from here public static void testPopEmptyStack() { ...
has comment: http://stackoverflow.com/comment/35976691
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35976320
has comment: http://stackoverflow.com/comment/35976745
type: Answer
accepted answer of: http://stackoverflow.com/q/23466162
has comment: http://stackoverflow.com/comment/35976486
score: 2
has comment: http://stackoverflow.com/comment/35977088
answers question: http://stackoverflow.com/q/23466162
downvote count: 0
has comment: http://stackoverflow.com/comment/35976658
has comment: http://stackoverflow.com/comment/35977118

http://stackoverflow.com/comment/36003881
score: 0
type: Comment
type: QuestionComment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/52062/discussion-between-alexey-malev-and-codemed)
comment on: http://stackoverflow.com/q/23480307

http://stackoverflow.com/comment/36711030
type: QuestionComment
comment on: http://stackoverflow.com/q/23495222
has text: You mean you want to set all pages to application/xhtml+xml automatically without having to do it for each file manually?
score: 0
type: Comment

http://stackoverflow.com/a/73859398
answers question: http://stackoverflow.com/q/23604540
downvote count: 0
upvote count: 2
type: Answer
has body: @RunWith(SpringRunner.class) @ContextConfiguration(classes = {LocalValidatorFactoryBean.class, ...}) @SpringBootTest public class TestClass{ @Autowired private Validator validator; @Test public void testValidator(){ ...logic... validator.validate(...); } } Recently ran into this issue (9/26/2023). My goal was to create a unit test where I test out the validation annotations I have on some POJOs. My validation includes the use of custom Constraint Validation Annotations as well as javax.validation annotations. Since my goal was to actually just run some validation tests against various inputs I didn't want these validation classes mocked out. I actually needed them in the test context. By default, Spring won't run the typical application boot up process where component scanning is performed and the application context is resolved. You can include the @SpringBootTest annotation test if you want that process to be performed. But this should only be done sparingly because you are essentially starting the entire application, which for my use case was not necessary. My situation is a little special in that I have some wrapper and base classes my company likes us to use. One of them implements the Spring Validator interface and also Autowires the validator interface. This was problematic as the class would call ValidationUtils.invoke(validator, target, errors) in its own overridden validate method, but since this was the only implementation of the Validator interface present in the context, it would map what was supposed to be the default validator to itself resulting in a stack overflow exception when calling the validate method of the base wrapper class. In production, the autowired dependency to a validator resolves to the default implementation, LocalValidatorFactoryBean. So in short, this needs to be added to the context. When using the ContextConfiguration annotation and the SpringBootTest annotation, we are specifying the classes to be added to the application conte…
score: 2

http://stackoverflow.com/comment/35975331
has text: Thank you. I changed it and it compiles and runs without error.
type: AnswerComment
comment on: http://stackoverflow.com/a/23465733
score: 0
type: Comment

http://stackoverflow.com/comment/35981806
comment on: http://stackoverflow.com/q/23469583
type: QuestionComment
has text: where do you catch `ConcurrentModificationException`, show stacktrace.
score: 0
type: Comment

http://stackoverflow.com/comment/36049522
score: 0
type: AnswerComment
has text: I am getting a null pointer exception. I think it has to do smthn with file path. What is the right way for that?
type: Comment
comment on: http://stackoverflow.com/a/23505396

http://stackoverflow.com/q/23531558
has comment: http://stackoverflow.com/comment/47823572
tagged with: java
has answer: http://stackoverflow.com/a/29969056
has comment: http://stackoverflow.com/comment/47823932
tagged with: reusability
has comment: http://stackoverflow.com/comment/47823810
has answer: http://stackoverflow.com/a/29849004
type: Question
has comment: http://stackoverflow.com/comment/36099279
has comment: http://stackoverflow.com/comment/47858025
tagged with: shutdown
has comment: http://stackoverflow.com/comment/36099396
has comment: http://stackoverflow.com/comment/47823014
has answer: http://stackoverflow.com/a/29888210
downvote count: 0
has body: I have a Java application with JMX monitoring enabled like this: -Dcom.sun.management.jmxremote.port=9999 \ // some other properties omitted But when I try to restart the application, sometime I got an error says the JMX port number is already in use. This is not acceptable. So I want to set the SO_REUSEADDR to true for the underlying socket to avoid this error but found no related JMX properties. Any idea?
score: 13
has title: Allow restarting Java application with JMX monitoring enabled immediately
has comment: http://stackoverflow.com/comment/36098774
tagged with: restart
has answer: http://stackoverflow.com/a/29929254
favorite count: 0
linked to: http://stackoverflow.com/q/3229860
has answer: http://stackoverflow.com/a/29987515
answer count: 5
type: UnansweredQuestion
tagged with: jmx
upvote count: 13
has comment: http://stackoverflow.com/comment/47823422
has comment: http://stackoverflow.com/comment/47822919
has comment: http://stackoverflow.com/comment/36099117

http://stackoverflow.com/comment/36053386
has text: actually, just adding an if (convertView == null){itemView = <inflate view>}Else{itemView = convertView} seems to do the trick. Not sure what Android does to cache views (a pool, perhaps?) but it seems to work if you let it. Thanks for the hint!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23507538

http://stackoverflow.com/comment/36227894
has text: try this,not sure if it will work `<%! String i = (String)${cForm.cId}; %> `
score: 0
comment on: http://stackoverflow.com/q/23601046
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35978456
score: 2
comment on: http://stackoverflow.com/q/23467700
has text: Please, post a [MCVE](http://stackoverflow.com/help/mcve).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/116269624
type: AnswerComment
comment on: http://stackoverflow.com/a/65761121
has text: can you please comment your code and explain your answer ?
type: Comment
score: 2

http://stackoverflow.com/q/23513647
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has title: Share item in actionbar using contextual actionbar
has answer: http://stackoverflow.com/a/23517343
answer count: 1
downvote count: 0
tagged with: share
favorite count: 0
accepted answer: http://stackoverflow.com/a/23517343
has body: For the first time i use the contextual actionbar. When i click in the item of my ListView i want have the possibility to share that item in some way (whatsapp/mail/gmail/drive etc etc..). I'm trying in with this method but no works: the menu layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/shareButton" android:actionProviderClass="android.widget.ShareActionProvider" android:title="@string/share" android:showAsAction="always"/&gt; &lt;/menu&gt; The contextual actionbar class: public class CABMode implements ActionMode.Callback { private ShareActionProvider mshare; @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.getMenuInflater().inflate(R.menu.cab, menu); return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { // don't need to do anything return false; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { mshare = (ShareActionProvider) item.getActionProvider(); mshare.setShareIntent(Share()); return true; } @Override public void onDestroyActionMode(ActionMode mode) { Mode = null; } public Intent Share() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, "Share"); return intent; } } Well, the contextual actionbar it opens well when i do an long click, but the share button in the actionbar doesn't work. When i say "not works" i mean that seems not clickable. Nothing works when i click over the item. Nothing appears. What i want it's open the multiple share ways. Thanks
tagged with: contextual-action-bar
tagged with: android
upvote count: 1

http://stackoverflow.com/a/23557821
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23557786
downvote count: 0
score: 1
has body: Parse the date using a SimpleDateFormat into a Date object Use a Calendar object to subtract 14 days from that date Format the resulting date using the same SimpleDateFormat

http://stackoverflow.com/q/23507657
tagged with: java
has comment: http://stackoverflow.com/comment/36053468
answer count: 1
has body: I'd like to seed a secure random generator myself using bytes, e.g.: SecureRandom sha1prng = SecureRandom.getInstance("SHA1PRNG"); sha1prng.setSeed(new byte[] { 2, -4, 127, -54 }); System.out.println(sha1prng.nextLong()); I found a number of examples on the net, and most of them use a byte array of length 20. So, my question is how long should this array actually be? Is there any recommendation naming a lower and an upper limit? Would it make it more unpredictable if I used for instance 1000 bytes rather than just 20? Cheers, Andy
has answer: http://stackoverflow.com/a/23599417
score: 0
has comment: http://stackoverflow.com/comment/36056834
tagged with: jce
has title: SecureRandom.setSeed(byte[])
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/36023989
has text: @Datenshi I don't understand your update. If `readLine()` works without a timeout, so will `read().` You still haven't posted the code I asked for, and until you do your question isn't answerable.
comment on: http://stackoverflow.com/q/23487558
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23461978
has body: I have downloaded the ADT bundle from Google to develop Android applications. Also I have installed Java with JDK 8u5 for MacOSX 64 bits. When I try to open Eclipse by clicking over Eclipse icon, it shows a dialog saying it's necessary to install a Java 6 version. Is it possible to execute Eclipse (and other java applications) with Java 8? If yes, How can I do it? (I have seen solutions for JDK 7 but not for JDK 8) Many thanks and kind regards
tagged with: macos
has comment: http://stackoverflow.com/comment/35968348
tagged with: eclipse-adt
tagged with: java-8
answer count: 1
accepted answer: http://stackoverflow.com/a/23462054
has comment: http://stackoverflow.com/comment/35968508
score: 0
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/22518586
has title: How can I run Eclipse in OS X with JDK 1.8?
has answer: http://stackoverflow.com/a/23462054
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/23600097
answer count: 0
tagged with: java
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/36227736
has body: Currently I'm trying to loop through an array in order to switch around the values based on other certain values. I understand there are probably better ways to sort or rearrange an array, but i'd like to do it this way just as a method of learning it. This is my multidimensional array public static String[][] people = new String[][] { { "John", "blah", "120", "4" }, { "Amy ", "blah", "99", "4" }, { "Sophie", "blah", "100", "4" }, { "Sarah", "blah", "98", "4" }, { "Claire", "blah", "101", "4" }, { "Rob", "blah", "105", "3" }, { "Steve ", "blah", "85", "3" }, { "Della", "blah", "102", "3" }, { "Ron", "blah", "95", "3" }, { "Bob", "blah", "102", "3" }, }; and this is the method that should rearrange those records and put them into a String to display in the Dialog box public static void main(String[] args) { String table = ""; table = " <table'>"; int ranking = 0; int m = 1; for (int i = 0; i < people.length; i++) { if (i + 1 < people.length && people[i][3].equals(people[i + 1][3])) { if ((Double.parseDouble(people[i][2])) > (Double.parseDouble(people[i + 1][2]))) { String first1 = people[i][0]; String first2 = people[i][1]; String first3 = people[i][2]; String first4 = people[i][3]; String second1 = people[i + 1][0]; String second2 = people[i + 1][1]; String second3 = people[i + 1][2]; String second4 = people[i + 1][3]; System.out.println(first3); System.out.println(second3); System.out.println("time to switch lol"); people[i][0] = second1; people[i][1] = second2; people[i][2] = second3; people[i][3] = second4; people[i + 1][0] = first1; people[i + 1][1] = first2; people[i + 1][2] = first3; people[i + 1][3] = first4; // array[i][2] = temp2; // array[m][2] = temp1; System.out.println(i); System.out.println(i + 1); // break; } m++; } } for (int i = 0; i < people.length; i++) { table += " " + ranking + " "; table += " " + people[i][0] + " "; table += " " + people[i][2] + " "; table += " " + people[i][3] + " "; ranking++; } JOptionPane.showMessageDialog(null, table); //s…
score: 0
has comment: http://stackoverflow.com/comment/36240599
tagged with: arrays
has title: loop wont switch around all fo the values in an array
has comment: http://stackoverflow.com/comment/36226245
type: UnansweredQuestion

http://stackoverflow.com/comment/36349707
type: Comment
has text: Thanks for the answer, I'll try it later. Seems to be a great solution. Could you provide a little snippet or more explanation about that relative get()/set() method?
type: AnswerComment
comment on: http://stackoverflow.com/a/23647500
score: 0

http://stackoverflow.com/q/23600143
tagged with: stack
tagged with: java
has title: pop()ing stacks doesn't seem to be erasing the values
has body: This program is supposed to read the values of the string input and return a result. However, when I use System.out.println(Arrays.toString(stack.toArray())); to check what the stack looks like at the end, or even during the program, I noticed that the pop() method foe the stack doesn't seem to be removing the elements it's returning. I'm probably doing something horribly wrong, but I haven't been able to figure it out. I'd really appreciate any insight ! // Test example : (((1+1)+1)+1) import java.util.*; public class Task2 { public static void main(String[] args) //run Start() method { System.out.print("Enter an expression, or press Enter to quit: "); Stack&lt;String&gt; stack = new Stack&lt;String&gt;(); Scanner scanner = new Scanner(System.in); String n = scanner.nextLine(); if(!n.isEmpty()) { for(int i = 0 ; i &lt; n.length() ; i++) { if(!(n.charAt(i) == ')')) { stack.push(n.charAt(i) + ""); } else { int two = Integer.parseInt(stack.pop()); char op = (stack.pop()).charAt(0); int one = Integer.parseInt(stack.pop()); switch(op) { case '+':{stack.push((one + two) + "");} case '-':{stack.push((one - two) + "");} case '*':{stack.push((one * two) + "");} case '/':{stack.push((one / two) + "");} } } } } else { System.out.print("\ngoodbye"); System.exit(0); } } } Sorry for the lack of comments, and thanks !
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23600585
type: Question
accepted answer: http://stackoverflow.com/a/23600585
score: 0
answer count: 1

http://stackoverflow.com/comment/36276200
type: Comment
type: AnswerComment
has text: @Xaero182 Of course this is also an important issue. However, I consider this as part of the points that I mentioned referring to the comment *"Changes in this object will be visible in the returned list."*. This means that the caller *has* to assume that the list may change concurrently while iterating over it. However, I'll point out this particular issue more clearly.
comment on: http://stackoverflow.com/a/23608636
score: 0

http://stackoverflow.com/a/23608434
answers question: http://stackoverflow.com/q/23608358
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36242406
has comment: http://stackoverflow.com/comment/36242384
has body: You can use Scanner class to read in your file line by line and you can have something like this: Scanner s = new Scanner(new File("test")); if(s.hasNextLine()){ jtextfield1.setText(s.nextLine()); } Hope this helps.

http://stackoverflow.com/q/23477675
has title: Java: time complexity of basic operations
has comment: http://stackoverflow.com/comment/35998362
upvote count: 0
has body: I'm going to make some investigations about dividing large arrays/matrix computations among multiple threads. But I need to know the relative time complexity of Java basic operations. For instance: int a = 23498234; int b = -34234; int[] array = new int[10000]; int c = a + b; // 1 int c = array[234]; // 2 String 1 (summary of two integers) is 10+ times faster than string 2 (memory access) or (i &amp; 1) == 0 is 10+ faster than i % 2 == 0. Question: Can you supppose time relations between next operations: +, * and / operands (suppose on Integer type) memory access starting new thread
answer count: 1
has answer: http://stackoverflow.com/a/23477831
has comment: http://stackoverflow.com/comment/35997975
accepted answer: http://stackoverflow.com/a/23477831
has comment: http://stackoverflow.com/comment/35997494
favorite count: 0
type: AnsweredQuestion
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/35997132
type: Question
score: -1
has comment: http://stackoverflow.com/comment/35997431
has comment: http://stackoverflow.com/comment/35998052

http://stackoverflow.com/comment/35953386
comment on: http://stackoverflow.com/a/23453869
score: 0
type: Comment
has text: @ZouZou Wow, that's really fantastic! so... essential! :)
type: AnswerComment

http://stackoverflow.com/comment/36274277
comment on: http://stackoverflow.com/a/23544044
type: Comment
has text: Have tried in a sample project, but also failed as above updated. And in my project, situation become more worse..
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36292086
has text: Hi SiKing..the html part is holding 2 div s from which i have posted the div part that i wanted to use to trace the element.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23620424

http://stackoverflow.com/comment/36053749
has text: Welcome to SO. Please read the [FAQ] and [Ask]. You are expected to attempt a solution to the homework problem yourself and show what you have done _before_ asking for help. SO is not a "do my homework for me" site. If you have no idea where to start, you should be talking to your teacher.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23507829
score: 0

http://stackoverflow.com/comment/36122288
type: Comment
has text: Thanks bizclop, is there any way to avoid new obeject creation (for >128)?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23544426

http://stackoverflow.com/comment/36067083
has text: @Gimby will 32 jre interfere with 64 jdk?
comment on: http://stackoverflow.com/q/23515239
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36094999
has text: Also, not sure if it matters, but I am importing my application context into my integration test using the following: @ContextConfiguration(locations = {"/com/my/app/context/appContext.xml"})
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23527130
score: 0

http://stackoverflow.com/q/23595138
favorite count: 0
has comment: http://stackoverflow.com/comment/36216740
possible better answer: http://stackoverflow.com/a/23595389
tagged with: android
has answer: http://stackoverflow.com/a/23595389
has body: I have a button and TextView. In the TextView I'm showing a value of a float number, with two digits after the dot. The button is taking by each press a 0.01 from the current float number (which is being shown at the TextView). In order to do so I've used the next code - float hightCurrent = Float.parseFloat(hightNum.getText().toString()); hightCurrent -= 0.01; DecimalFormat myFormatter = new DecimalFormat("##0.00"); myFormatter.format(hightCurrent); if(myFormatter.equals("1.10")){ Log.d("GOT", "Got in"); }else{ } hightNum.setText((myFormatter.format(hightCurrent))); NOw as you can see I have an if statement. What I want to know is when the value is 1.10. The thing is that when the value that being shown is 1.10 it sure don't get into the if statement. So how can I make this code work? how can I know when the value is 1.10? Thanks for any kind of help
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36216716
tagged with: java
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36217109
type: Question
has title: Android/Java - How to know what's the current value of DecimalFormat
has answer: http://stackoverflow.com/a/23595169
has comment: http://stackoverflow.com/comment/36216703
accepted answer: http://stackoverflow.com/a/23595169
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36216620
has comment: http://stackoverflow.com/comment/36216838
has comment: http://stackoverflow.com/comment/36217096

http://stackoverflow.com/comment/36064291
type: QuestionComment
has text: @NikosDim ah right I misread. In that case see the posted answer
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23513506

http://stackoverflow.com/comment/36039237
type: Comment
type: QuestionComment
has text: What line caused the error?
comment on: http://stackoverflow.com/q/23500155
score: 0

gridview
tags question: http://stackoverflow.com/q/23578083
tags question: http://stackoverflow.com/q/23536554
tag name: gridview
tags question: http://stackoverflow.com/q/23574036
type: Tag
tags question: http://stackoverflow.com/q/23535410
tags question: http://stackoverflow.com/q/23592999
tags question: http://stackoverflow.com/q/23526307

http://stackoverflow.com/comment/36019809
comment on: http://stackoverflow.com/q/23489928
has text: Please add the description to your question instead of the comment.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23592161
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23592343
has title: Java: Accept input as string or int
has answer: http://stackoverflow.com/a/23592274
type: Question
has answer: http://stackoverflow.com/a/23592387
accepted answer: http://stackoverflow.com/a/23592303
tagged with: class
has body: I am trying to make a simple even or odd program. I want it to keep running until the user enters in 'q'. But I am having trouble accepting 'q' as a String. import java.util.Scanner; class EvenOrOdd { public static void main(String[] args) { Scanner myScanner = new Scanner(System.in); System.out.println("Welcome to my program that checks if a number is even or odd."); while (true) { System.out.println(); System.out.print("Please type number in a number ['q' to quit]: "); int number; String quit; try { number = myScanner.nextInt(); } finally { quit = myScanner.nextLine(); } if (quit.equals("q")) { break; } else if (number % 2 == 0) { System.out.println(number + " is Even."); } else { System.out.println(number + " is Odd."); } } } } The program works fine when I enter numbers, but when I enter 'q', the console throws an error: Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Unknown Source) at java.util.Scanner.next(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at java.util.Scanner.nextInt(Unknown Source) at EvenOrOdd.main(EvenOrOdd.java:19) I know this may be easy for many of you, but I have just picked up a java book and am trying to finish the task. Any help would be greatly appreciated!
has comment: http://stackoverflow.com/comment/36210961
answer count: 7
possible better answer: http://stackoverflow.com/a/23592280
has answer: http://stackoverflow.com/a/23592364
has answer: http://stackoverflow.com/a/23592280
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/36210935
has answer: http://stackoverflow.com/a/23592314
has answer: http://stackoverflow.com/a/23592303

http://stackoverflow.com/a/69084780
downvote count: 0
has comment: http://stackoverflow.com/comment/122099968
upvote count: 2
answers question: http://stackoverflow.com/q/23487381
has body: Python solution - 100% def solution(A): A.sort() return max(A[0] * A[1] * A[-1] , A[-3] * A[-2] * A[-1])
has comment: http://stackoverflow.com/comment/122117290
type: Answer
score: 2

http://stackoverflow.com/q/23486707
tagged with: testing
score: 3
tagged with: java
has title: How evil is it to use reflection to break encapsulation when testing?
answer count: 2
has comment: http://stackoverflow.com/comment/36014216
downvote count: 0
has answer: http://stackoverflow.com/a/23486802
has comment: http://stackoverflow.com/comment/36014291
has body: I'm testing 3 new classes that make 3 collections of objects that are serialized to a database. 1 of the classes has a hard coded array of strings. The 3 collections end up the same size as the array of strings and each object in the collection gets a name/tag based on string in the array. One of my tests is an end-to-end test that will try to make all three collections. I would like to have access to the array of strings for testing but it's private. I see three possible ways to deal with this: Make it protected &lt;- Office policy is to NOT modify code design for the sake of testing. Copy array to test class &lt;- Now array changes must be maintained in two locations. Ow. Use reflection to peek at privates &lt;- This works but is it more or less evil than the alternatives? Can you think of a fourth way? Is there a good reason to not use reflection for this?
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6913325
has comment: http://stackoverflow.com/comment/36015231
tagged with: reflection
has answer: http://stackoverflow.com/a/23487478
upvote count: 3
has comment: http://stackoverflow.com/comment/36014199
linked to: http://stackoverflow.com/q/34571
type: Question

http://stackoverflow.com/q/23496119
upvote count: 3
tagged with: file
tagged with: java
type: UnansweredQuestion
has title: Android getAssets.open() vs Java File method, log printing String issues
answer count: 0
downvote count: 0
favorite count: 0
type: Question
tagged with: binaryfiles
score: 3
tagged with: android
has body: I am parsing a binary file. I didn't face any problem while doing it in java, File file= new File("c:/xyz.bin"); DataInputStream di= new DataInputStream(new FileInputStream(file)); BufferedInputStream bin= new BufferedInputStream(dataIStream); byte[] byteArray= new byte[bin.available()]; bin.read(byteArray); And I am parsing the "byteArray" according to my needs using my parserClass. Assigning the sub-bytes to different byte array members of the class "someClass", and while printing Using custom Converter to convert byte array to String. System.out.println("Name: "+Converter.String( someClass.getFileName())); System.out.println("Num: "+someClass.getInteger()); Name: FILENAME Num: 2 Everything is working fine. But when I tried it in Android: String fileName= "xyz.bin"; InputStream in= getAssets().open(fileName); BufferedInputStream bin= new BufferedInputStream(new DataInputStream(in)); byte[] byteArray= new byte[bin.available()]; bin.read(byteArray); I am using the same parser. I am facing problem in getting the values and printing it in the log like.. String name = Converter.String(someClass.getFileName()) Log.i("File name: ", name); Log.i("Number: ", String.valueOf(someClass.getInteger())); This is from the log that I am getting File name: ���������������� Number: 0 Is it because getAssets.open() treats a binary file differently? I don't see what went wrong. The only difference betwwen the two codes is, in java I am using "File" and in Android I am using "getAssets.open()" methods.

http://stackoverflow.com/q/23526493
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/23526631
has comment: http://stackoverflow.com/comment/36090050
has comment: http://stackoverflow.com/comment/36088714
tagged with: java
has answer: http://stackoverflow.com/a/23526629
answer count: 4
has comment: http://stackoverflow.com/comment/36088881
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23526631
downvote count: 0
possible better answer: http://stackoverflow.com/a/23526629
has answer: http://stackoverflow.com/a/23526626
has body: The first code is shown below: String s = "hello"; The second code is shown below: String s = new String("hello"); Question: Are the two codes invoking the same constructor of String(char[])? String has a private final field char value[]. Why is it set to a final field? Such we will create a new String every time we invoke change the value of string. What is the purpose to set the field char value[] to final?
has title: How does String invoke constructors?
type: Question
score: 3
linked to: http://stackoverflow.com/q/23505952
has answer: http://stackoverflow.com/a/23526739

http://stackoverflow.com/comment/36183394
comment on: http://stackoverflow.com/q/23577005
type: Comment
has text: Your question could be improved. In the future, please show how you call the method, and show exactly what returns. Why make people guess? You've gotten the correct answer this time from Makato, but in the future you likely won't be so lucky unless your question is better, is more complete.
score: 0
type: QuestionComment

http://stackoverflow.com/q/23471140
has body: I recently looked up what is the difference between ++i and i++ and found that apparently it doesn't matter in for loops but it does in this case: int i = 3; int a = i++; // a = 3, i = 4 int b = ++a; // b = 4, a = 4 Does it work the same for --i and i--? I am wondering because I have come across the following exercise: // pops the first non-null element in a stack public E popFirstNonNull() throws EmptyStackException { while ( (top &gt;= 0) &amp;&amp; ( S[top] == null ) ) { top--; } if ( top &gt;= 0 ) { E topNonNull = S[top]; S[top--] = null; //for garbage collection return topNonNull; } else { throw new EmptyStackException(); } } If ++i / i++ and --i / i-- behave the same shouldn't this line: S[top--]=null; be changed to: S[--top]=null
tagged with: for-loop
has comment: http://stackoverflow.com/comment/35985019
has comment: http://stackoverflow.com/comment/35984748
score: 0
accepted answer: http://stackoverflow.com/a/23471204
has title: Does --i and i-- behave the same way as ++i and i++?
possible better answer: http://stackoverflow.com/a/23471225
has answer: http://stackoverflow.com/a/23471194
favorite count: 0
has answer: http://stackoverflow.com/a/23471225
has comment: http://stackoverflow.com/comment/35984806
answer count: 4
has comment: http://stackoverflow.com/comment/35984857
type: AnsweredQuestion
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/23471204
has answer: http://stackoverflow.com/a/23471249
tagged with: loops
upvote count: 1
downvote count: 1
type: Question

http://stackoverflow.com/q/23531841
has title: Spring MVC - Web Application Design Common Practice
has comment: http://stackoverflow.com/comment/36099424
score: 0
has answer: http://stackoverflow.com/a/23531917
accepted answer: http://stackoverflow.com/a/23531917
tagged with: spring
has comment: http://stackoverflow.com/comment/36108141
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36108230
has comment: http://stackoverflow.com/comment/36099325
has body: Is this common? com.myproject.web.forms com.myproject.web.controllers com.myproject.core.dto com.myproject.core.service In UserController, form is converted to dto, then passed on to the service. In my case, I would have UserDto and UserForm. Both are almost about exactly the same. What is Form really used for?
type: Question
answer count: 1

http://stackoverflow.com/a/23562393
answers question: http://stackoverflow.com/q/23561982
has body: In executeUpdateAudit you prepare the statement once using the first ID seen: if(updateAuditPreparedStatement == null) { updateAuditPreparedStatement = connection.prepareStatement( new String("UPDATE AUDIT SET SENT = ? WHERE AUDIT_ID = " + id)); } updateAuditPreparedStatement.setTimestamp(1, new java.sql.Timestamp(sent.getDate()); In the second call the ID from the first call is still being used, since it's effectively hard-coded in the SQL. You should be using a parameter for the ID as well: if(updateAuditPreparedStatement == null) { updateAuditPreparedStatement = connection.prepareStatement( new String("UPDATE AUDIT SET SENT = ? WHERE AUDIT_ID = ?")); } updateAuditPreparedStatement.setTimestamp(1, new java.sql.Timestamp(sent.getDate()); updateAuditPreparedStatement.setInt(2, id); Not sure why you're using new String explicitly everywhere; it would be a little simpler as: if(updateAuditPreparedStatement == null) { updateAuditPreparedStatement = connection.prepareStatement( "UPDATE AUDIT SET SENT = ? WHERE AUDIT_ID = ?"); } updateAuditPreparedStatement.setTimestamp(1, new java.sql.Timestamp(sent.getDate()); updateAuditPreparedStatement.setInt(2, id); This is nothing to do with your ORA-01000, but this seems to be the main thrust of this question - you shouldn't really ask about two things at once, particularly if they aren't directly related...
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/23573601
accepted answer of: http://stackoverflow.com/q/23571101
has comment: http://stackoverflow.com/comment/36305114
answers question: http://stackoverflow.com/q/23571101
type: Answer
has comment: http://stackoverflow.com/comment/36344087
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36299341
has body: You cannot set value to util:map that way. value can only take a string. Define a util:map separately, then use ref to reference it. For example: &lt;util:map id="myMap"&gt; &lt;entry key="name" value="..." /&gt; &lt;/util:map&gt; &lt;util:list&gt; &lt;ref bean="myMap"/&gt; &lt;/util:list&gt; Also, value-ref should reference another bean - currently you have it as a string literal value, which you can simply use value for.
has comment: http://stackoverflow.com/comment/36304124
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23477370
has comment: http://stackoverflow.com/comment/35997099
has body: I agree with jgitter about the Strategy and Factory pattern. I'm posting an example. public interface Algorithm { public String execute(String input); } public class SomeAlgorithm implements Algorithm { public String execute(String input) { ///... Algorithm here } } public class AnotherAlgorithm implements Algorithm { public String execute(String input) { ///... Algorithm here } } public abstract class AlgorithmFactory { public static Algorithm createRandomAlgorithm() { //Create a new Random object Random randomEngine = new Random(); //Retrieve a number from 0 (inclusive) to 2 (exclusive) int randomNumber = randomEngine.nextInt(2); //Select which implementation to use according to the random number switch(randomNumber) { case 0: return new SomeAlgorithm(); case 1: return new AnotherAlgorithm(); } //This will most likely never get called, but a return value is mandatory return null; } } Then, you would retrieve and execute the algorithm like this: String encryption = AlgorithmFactory.createRandomAlgorithm().execute(input); Please note that the factory is abstract and has a static method, which is not how I would approach this, but it will help you out in your problem nice and easily.
type: Answer
has comment: http://stackoverflow.com/comment/35998719
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23477062
has comment: http://stackoverflow.com/comment/35997827
upvote count: 2

http://stackoverflow.com/a/23507681
has comment: http://stackoverflow.com/comment/36053538
score: 1
has comment: http://stackoverflow.com/comment/36053514
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36053486
accepted answer of: http://stackoverflow.com/q/23507451
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23507451
downvote count: 0
has body: To better illustrate the Random choice solution: import java.util.Random; Random rand = new Random(); int percentage = 25; //Set this to whatever percentage you want. public void onCreatureSpawn(CreatureSpawnEvent e) { //This will generate a number between 0 and 99 (inclusive) int generatedNumber = rand.nextInt(100); //If the generated number is smaller than the percentage you chose, you have "success". if(generatedNumber &lt; percentage){ addCharacteristic(creature, characteristic); }else{ //Do whatever you need to normally. } }

http://stackoverflow.com/a/23585359
has body: by default each object reference we write ,it internally calls its own toString method. if its not defined then it will call its immediate parent's toString() method. but if you want to call parent's toString() method using child reference variable then define toString in child and call parent's toString and append its own definition. example class Parent { @Override public String toString() { return "Parent"; } } class Child { @Override public String toString() { return super.toString() + " " + "child"; } } Child child = new Child(); System.out.println(child); // prints parent child
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23585257
type: Answer
downvote count: 0

http://stackoverflow.com/a/23587531
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23587519
answers question: http://stackoverflow.com/q/23587519
has body: Using Junit, I test every single Unicode character, from \u0000 to \uffff. @Test public void testReplaceBlanks(){ char input = 0; char escape = '\u0000'; for(char i = 0; i &lt;= 65535; ++i){ input = (char) (escape + i); System.out.print(input); System.out.print(" "); if( i % 80 == 0){ System.out.println(); } String test = new String(Character.toString(input)); assertTrue(!"".equals(test.replaceAll("", ""))); if(i == 65535) break; } } I don't find a single instance where that line of code does anything useful. Since I've spotted this issue a couple more times on the internet, here's a more robust test case: Major problem here, this line of code is a NO-OP. value = value.replaceAll(“”, “”); Consider the following test case: public static void println(String s) { System.out.println(s); } @Test public void testNullStripWithEmptyString() { String input = "foo" + '\0'; String input2 = "foo"; println(input); println("input:"); printBytes(input.getBytes()); println("input2:"); printBytes(input2.getBytes()); String testValue = input.replaceAll("", ""); println("testValue:"); printBytes(testValue.getBytes()); String testvalue2 = input2.replaceAll("",""); println("testvalue2"); printBytes(testvalue2.getBytes()); assertFalse(input.equals(input2)); assertFalse(testValue.equals(testvalue2)); } This test case demonstrates first, that in the byte representations of the two input strings, that the null byte appears in the first, but not in the second. We then proceed to call *.replaceAll(“”,””); and store the values into two new variables, testValue and testvalue2. This then leads to the first assert, which asserts that the two values should not be equal calling the normal String equals method. This is trivally true, because we DO have a nonprinting null byte appended to the string. However, the nail in the coffin is in demonstrating that this condition still holds after calling *.replaceAll(“”,””); on the two testValue strings. The only way to prevent non-printing or NULL bytes wou…

http://stackoverflow.com/a/23501153
answers question: http://stackoverflow.com/q/23499995
has comment: http://stackoverflow.com/comment/36076112
has body: You need to add @ModelAttribute("empl") right before @Valid, in order for Spring MVC to be able to know that it should populate the model object with the inputs of the form with commandName="empl" Your controller method should look like public String validateForm(@ModelAttribute("empl") @Valid Employee empl, BindingResult result, ModelMap m) When you are trying to display errors in a form Spring MVC needs to have a reference to the offending model. So when you changed your code and added new Employee() there where no errors on that object. This SO post has a good explanation of what @ModelAttribute does as does this and this blog post
accepted answer of: http://stackoverflow.com/q/23499995
has comment: http://stackoverflow.com/comment/36053083
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/36059089
has comment: http://stackoverflow.com/comment/36081719
has comment: http://stackoverflow.com/comment/36052707
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23513290
answers question: http://stackoverflow.com/q/23513238
score: 1
has comment: http://stackoverflow.com/comment/36065102
downvote count: 0
upvote count: 1
type: Answer
has body: You need a Context to display Dialog. and remove extends Activity from DisplayAlert. try this way pass context to single argument constructor DisplayAlert ob =new DisplayAlert(MainActivity.this); and create constructor like Context context; public DisplayAlert(Context context) { this.context = context; } and used this context to create AlertDialog new AlertDialog.Builder(context).setTitle("SEND MESSAGE")....

http://stackoverflow.com/a/23533851
has comment: http://stackoverflow.com/comment/36103530
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36103065
has body: try { DateFormat gmtFormat = new SimpleDateFormat(); TimeZone estTime = TimeZone.getTimeZone("EST"); gmtFormat.setTimeZone(estTime); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); System.out.println("EST Time: " + gmtFormat.format(sdf.parse("20140508063630"))); } catch (ParseException e) { e.printStackTrace(); }
accepted answer of: http://stackoverflow.com/q/23533746
has comment: http://stackoverflow.com/comment/36103391
answers question: http://stackoverflow.com/q/23533746
type: Answer
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/36103158
has comment: http://stackoverflow.com/comment/36104007

http://stackoverflow.com/a/23605674
has comment: http://stackoverflow.com/comment/36236864
has comment: http://stackoverflow.com/comment/36236725
accepted answer of: http://stackoverflow.com/q/23605515
has comment: http://stackoverflow.com/comment/36237887
score: 0
has comment: http://stackoverflow.com/comment/36239216
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36238705
has body: It's because of this line: age = age + 1; //it's overwriting age parameter and not accessing age instance variable If it was like that it would modify the age instance variable this.age = age + 1;
answers question: http://stackoverflow.com/q/23605515
has comment: http://stackoverflow.com/comment/36237072
type: Answer
has comment: http://stackoverflow.com/comment/36237680
has comment: http://stackoverflow.com/comment/36236399
has comment: http://stackoverflow.com/comment/36236457

http://stackoverflow.com/q/23611934
possible better answer: http://stackoverflow.com/a/23612677
answer count: 2
has answer: http://stackoverflow.com/a/23612677
accepted answer: http://stackoverflow.com/a/23625160
linked to: http://stackoverflow.com/q/7908193
favorite count: 0
has comment: http://stackoverflow.com/comment/36251813
has comment: http://stackoverflow.com/comment/36252035
has body: I have found a piece of code for Android(Java) which searches sd-card for a given file name(string) in case that the file exists in sd-card it works fine but if there's no file with that name it will throw null pointer exception. Can anyone help me please? or give me another alternative? here's the code: public File findFile(File dir, String name) { File[] children = dir.listFiles(); for(File child : children) {//the exception is thrown here! if(child.isDirectory()) { File found = findFile(child, name); if(found != null) return found; } else { if(name.equals(child.getName())) return child; } } return null; } Here's the logcat results: threadid=1: thread exiting with uncaught exception (group=0x400205a0) FATAL EXCEPTION: main java.lang.NullPointerException at ir.zinutech.ssn.Settings.findFile(Settings.java:93)//&gt;&gt; which is "for(File child : children) { " at ir.zinutech.ssn.Settings.findFile(Settings.java:95)//&gt;&gt; which is "File found = findFile(child, name);//the exception is thrown here!" at ir.zinutech.ssn.Settings.onClick(Settings.java:69) at android.view.View.performClick(View.java:2532) at android.view.View$PerformClick.run(View.java:9293)`end`
has title: search function for files
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36251978
has comment: http://stackoverflow.com/comment/36251871
has answer: http://stackoverflow.com/a/23625160
downvote count: 2
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36248246
tagged with: java
score: -1

http://stackoverflow.com/comment/36248171
comment on: http://stackoverflow.com/a/23611597
type: Comment
has text: Thanks for your answer @Jorge_B, I certainly tried it successfully but I'd prefer to rely on db server (not the bean container) setting the appropriate timestamp.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23498018
has comment: http://stackoverflow.com/comment/36035161
has body: I'm trying to write Java code to find the source code file in a directory. I will compile the file and then place it in some other directory and the program has to find the file, now I think I am doing right but it is still giving File not Found every time I run it. import java.util.*; import java.io.*; import javax.swing.*; import java.awt.*; public class myframe extends JFrame{ public static void main(String args[]) throws IOException { myframe g=new myframe(); MyPanel mp=new MyPanel(); g.add(mp); mp.setSize(1000,1000); g.setLayout(new BorderLayout()); g.setSize(500,500); g.setVisible(true); g.setDefaultCloseOperation(EXIT_ON_CLOSE); } } class MyPanel extends JPanel { File ff,ff2; JTextArea ta; JTextField jt; JScrollPane jsp; String[] names; File ff3; FileInputStream fis; String t; String s; static int flag=0; MyPanel() throws IOException { myframe mf= new myframe(); setLayout(new BorderLayout()); ta= new JTextArea(); jt=new JTextField(); add(ta,"Center"); add(jt,"North"); jsp= new JScrollPane(ta); add(jsp); File r =new File("C:/"); t=mf.getClass().getName(); String g=".java"; String s= t+g; System.out.println(""+s); File[] array=r.listFiles(); System.out.println("hey"); if(array !=null){ //RecursiveFileList rfl = new RecursiveFileList(); fileList((r)); System.out.println("hey"); } else jt.setText("Directory is empty"); } public void fileList( File dir) throws IOException,NullPointerException{ // fnames = dir.listFiles(); // for(int i=0; i&lt;fnames.length; i++){ // fnames[i].listFiles(); if(dir.isFile()){ //System.out.println("hey"); if((dir.getName()).equals(s)){ flag=1; System.out.println("hey"); jt.setText(""+dir.getAbsolutePath()); fis= new FileInputStream(dir); byte[] b= new byte[(int)dir.length()]; fis.read(b); for(int j=0;j&lt;b.length;j++) { ta.append(""+(char)b[j]); } return; } } else if (dir.isDirectory()){ File[] fnames=dir.listFiles(); if (fnames !=null){ for(File f4:fnames){ if(f4!=null){ fileList(f4); if(flag==1){ System.out.println("hey"); return; …
type: Question
has comment: http://stackoverflow.com/comment/36035380
has comment: http://stackoverflow.com/comment/36035555
score: 0
tagged with: file-io
answer count: 1
has comment: http://stackoverflow.com/comment/36035449
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36035057
has title: Find source file that contains the current code
has answer: http://stackoverflow.com/a/23498413
tagged with: java

http://stackoverflow.com/comment/36238928
type: Comment
comment on: http://stackoverflow.com/a/23591601
has text: From JDialog javadoc: "Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. That is, the resources for these Components will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable." So it disposes of window resources; it isn't going to know anything about chess pieces. I think, somewhere, you have an array or something that contains references to pieces, indicating where they are on the board; clear that. You can allocate a new one, if you object to a number of null assignments.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36108341
has text: I think, it should be `List<Double>list=...`
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/23536508
type: Comment

http://stackoverflow.com/q/23509903
has comment: http://stackoverflow.com/comment/36060075
has comment: http://stackoverflow.com/comment/36057531
tagged with: java
tagged with: servlets
score: 0
has answer: http://stackoverflow.com/a/23510002
has comment: http://stackoverflow.com/comment/36069360
answer count: 1
has title: Call a servlet program when SQL trigger occurs
has body: Is there a way in which I can call a servlet program when an update occurs to the database or at a specific time or when a sql trigger occurs. Any library or reference would be useful. Thanks in advance
tagged with: sql
has comment: http://stackoverflow.com/comment/36067006
type: UnansweredQuestion
type: Question

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/23476145
tags question: http://stackoverflow.com/q/23482448

http://stackoverflow.com/comment/36042263
score: 0
type: AnswerComment
type: Comment
has text: First, thank you very much for your answer! I found that changing "(int)red(iP)" into "iP >> 16 & 0xFF" pass me through that error... only pass, whether it works or not I don't know, because now the error moves to the same problem, but with the brightness() method...
comment on: http://stackoverflow.com/a/23501325

http://stackoverflow.com/q/23502832
has comment: http://stackoverflow.com/comment/36044503
has answer: http://stackoverflow.com/a/23503226
tagged with: java
has answer: http://stackoverflow.com/a/23503792
score: -1
tagged with: concurrency
tagged with: servlets
possible better answer: http://stackoverflow.com/a/23503226
tagged with: java.util.concurrent
has comment: http://stackoverflow.com/comment/36044823
answer count: 2
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36044914
has comment: http://stackoverflow.com/comment/36044841
linked to: http://stackoverflow.com/q/3988788
has title: java.util.ConcurrentModificationException while adding elements?
favorite count: 0
has comment: http://stackoverflow.com/comment/36044978
has comment: http://stackoverflow.com/comment/36044972
type: AnsweredQuestion
tagged with: multithreading
has body: I have a servlet which uses a service to parse a YAML file. but when I put some user traffic on my servlet I get: SEVERE: Servlet.service() for servlet [SitesController] in context with path [] threw exception [java.util.ConcurrentModificationException] with root cause java.util.ConcurrentModificationException at java.util.ArrayList$SubList.checkForComodification(ArrayList.java:1129) at java.util.ArrayList$SubList.listIterator(ArrayList.java:1009) ... at com.example.UrlRedirectEngin.redirectoToRespectiveSubDomain(UrlRedirectEngin.java:250) I am not sure if the exception is from parsing the YAML file or not. However the exception is pointing to the line below which I render the page line 250: request.getRequestDispatcher(JSP_PAGE).forward(request, response); I just want to know if ConcurrentModificationException can also happens while adding elements to a Map? If yes how can I handle this issue. Thanks.
has comment: http://stackoverflow.com/comment/36044431
accepted answer: http://stackoverflow.com/a/23503792
has comment: http://stackoverflow.com/comment/36044591
type: Question

http://stackoverflow.com/comment/36055664
score: 0
type: AnswerComment
type: Comment
has text: It's actually not that strange at all. Java has what's called a just-in-time compiler (JIT compiler) that monitors the code you run. If it detects some "hot" code (code that takes up a lot of CPU time or is run frequently), it recompiles the Java bytecode down to native code. This almost always results in speedups compared to Java bytecode. The reasoning behind a warmup period was to get the JVM to recompile all the code you wanted to test, removing the when-is-the-JIT-going-to-activate factor from the benchmark.
comment on: http://stackoverflow.com/a/23508826

swt
tags question: http://stackoverflow.com/q/23566248
tags question: http://stackoverflow.com/q/23505083
tags question: http://stackoverflow.com/q/23465818
tags question: http://stackoverflow.com/q/23583574
tags question: http://stackoverflow.com/q/23492654
tags question: http://stackoverflow.com/q/23538289
tags question: http://stackoverflow.com/q/23540456
tags question: http://stackoverflow.com/q/23514270
tags question: http://stackoverflow.com/q/23559157
tags question: http://stackoverflow.com/q/23468905
tags question: http://stackoverflow.com/q/23537363
tags question: http://stackoverflow.com/q/23513804
tags question: http://stackoverflow.com/q/23598915
type: Tag
tags question: http://stackoverflow.com/q/23455654
tags question: http://stackoverflow.com/q/23454221
tags question: http://stackoverflow.com/q/23575378
tags question: http://stackoverflow.com/q/23495420
tags question: http://stackoverflow.com/q/23517873
tag name: swt
tags question: http://stackoverflow.com/q/23506984
tags question: http://stackoverflow.com/q/23502556
tags question: http://stackoverflow.com/q/23488222

sensors
type: Tag
tags question: http://stackoverflow.com/q/23525968
tag name: sensors
tags question: http://stackoverflow.com/q/23567071

http://stackoverflow.com/comment/35978555
comment on: http://stackoverflow.com/q/23466744
has text: @EJP, Looks like one user with two accounts?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23474105
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23470377
accepted answer of: http://stackoverflow.com/q/23470377
has body: A few notes about your code: First... please don't use mysql_query anymore. Use mysqli_query or PDO. In newer PHP versions mysql_xxx is deprecated and you should use the alternative. Second... your code is very susceptible to attack. When you use a POST or GET variable you should check if it does not contain harmful code. If your MAX_ID could only be a number i would suggest the following (note the intval-part): $maxId = 0; if (isset($_POST['MAX_ID'])) $maxId = intval($_POST['MAX_ID']); It also checks if MAX_ID is not set (if so your $max_id is 0) and $maxId could only result in a number. And last... because with above $maxId could only result in a number you don't need the mysql_real_escape_string. So this would be enough: $sql = "SELECT * FROM News where Nid > ".$maxId; (please note the warning at the top of the manual of this function about mysql_xxx being deprecated).
type: AcceptedAnswer

http://stackoverflow.com/comment/36240510
type: Comment
type: QuestionComment
has text: Is there an example of creating a custom MoveListFactory besides [the one in the docs](http://docs.jboss.org/drools/release/latest/optaplanner-docs/html_single/index.html#moveListFactory)? I didn't manage creating a new CompositeMove yet because I don't know how to create a new ChangeMove. What should `variableDescriptor` and `toPlanningValue` be? Or do I have to create a new move even if I just need a CompositeMove of ChangeMoves?
comment on: http://stackoverflow.com/q/23571731
score: 0

http://stackoverflow.com/q/23525903
accepted answer: http://stackoverflow.com/a/23546455
has body: I have the problem if the mySQL Server kills the session after 500 sec "sleeping-time", that the next request isn't successful. The same problem occurs after maybe 700 sec if the mySQL Server doesn't closes the sleeping connection. What can I do? Following the properties of my persistence.xml &lt;property name="eclipselink.query-results-cache" value="false" /&gt; &lt;property name="eclipselink.cache.size.default" value="0" /&gt; &lt;property name="eclipselink.cache.type.default" value="None" /&gt; &lt;property name="eclipselink.cache.alwaysRefresh.default" value="true" /&gt; &lt;property name="eclipselink.jdbc.read-connections.max" value="10" /&gt; &lt;property name="eclipselink.jdbc.cache-statements" value="true" /&gt; &lt;property name="eclipselink.jdbc.read-connections.shared" value="true" /&gt; And the transactiontype is RESOURCE_LOCAL if it's important to know.
downvote count: 1
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/36102727
has comment: http://stackoverflow.com/comment/36123195
tagged with: eclipselink
linked to: http://stackoverflow.com/q/11718381
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/12220860
upvote count: 8
linked to: http://stackoverflow.com/q/9880365
has comment: http://stackoverflow.com/comment/38776716
tagged with: jdbc
type: AnsweredQuestion
has title: How to reconnect lost connections with EclipseLink?
linked to: http://stackoverflow.com/q/5289075
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/23546455
tagged with: mysql

http://stackoverflow.com/a/23581976
answers question: http://stackoverflow.com/q/23581937
score: 6
has comment: http://stackoverflow.com/comment/36192022
downvote count: 0
has body: Because otherwise you could not compile a program with cyclic dependencies between classes, such as public class Parent { Child[] children; } public class Child { Parent parent; } which would be quite annoying, would it not?
type: Answer
upvote count: 6

http://stackoverflow.com/q/23577652
tagged with: oozie
has answer: http://stackoverflow.com/a/23578828
answer count: 3
tagged with: hue
downvote count: 0
favorite count: 0
has title: Not able to run oozie workflow with java action
score: 5
has answer: http://stackoverflow.com/a/26473480
has answer: http://stackoverflow.com/a/23593975
type: AnsweredQuestion
has body: I am submitting a oozie workflow, I designed in Hue and it contains a few java actions. Hue submits and attempts to execute the oozie workflow, I always get the following error. Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.JavaMain], main() threw exception, begin &gt; end in range (begin, end) Caused by java.lang.IllegalArgumentException: begin &gt; end in range (begin, end): (1399708804155, 1399694415805) I have no clue as to what it means and what I am supposed to do about it. From the error message, I am able to infer that the submission time of the workflow happens later than the completion time. But I don't know what is causing this and what I need to do to fix this. Any inputs on this will be helpful.
tagged with: java
type: Question
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/26473480
upvote count: 5
possible better answer: http://stackoverflow.com/a/23578828

http://stackoverflow.com/a/23535910
score: 0
type: Answer
has body: split is a destructive process so you would need to find the index of the first numeric digit and use substrings to get your result. This would also probably be faster than using a regex since those have a lot more heuristics behind them int split = string.length(); for(int i = 0; i &lt; string.length(); i ++) { if (Character.isDigit(string.charAt(i)) { split = i; break; } } String[] parts = new String[2]; parts[0] = string.substring(0, split); parts[1] = string.substring(split);
has comment: http://stackoverflow.com/comment/36106579
answers question: http://stackoverflow.com/q/23535723
has comment: http://stackoverflow.com/comment/36106517

http://stackoverflow.com/comment/36248686
type: QuestionComment
has text: (If you're looking to have your **working** code reviewed / improved, this question would probably be better suited on [codereview.se].)
comment on: http://stackoverflow.com/q/23611400
score: 0
type: Comment

http://stackoverflow.com/q/23480682
tagged with: java
has comment: http://stackoverflow.com/comment/36003357
has body: I have method1() which is called from lots of other methods throughout the code. This is the signature of the method: public void method1(final Properties properties) throws IOException {} All methods calling this method also throw IOException. The actual code in method1() changed, so now instead of IOException it throws some other exceptions that extend Exception and not IOException anymore. I don’t want to change the signature of all methods calling method1(). Is it ok to create IOException and still throw IOException from method1() and hence the methods calling method1()? Something like below: Try { // code } catch (Exception e) { throw new IOException(e.getCause()); }
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36004872
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23480788
has comment: http://stackoverflow.com/comment/36003897
has answer: http://stackoverflow.com/a/23480788
type: Question
tagged with: exception
accepted answer: http://stackoverflow.com/a/23480768
has comment: http://stackoverflow.com/comment/36003237
has comment: http://stackoverflow.com/comment/36004486
upvote count: 2
has answer: http://stackoverflow.com/a/23480768
answer count: 3
tagged with: ioexception
has answer: http://stackoverflow.com/a/23480888
has title: Throw IOException instead of Exception

http://stackoverflow.com/comment/36275474
type: Comment
comment on: http://stackoverflow.com/q/23566564
type: QuestionComment
score: 0
has text: Great to hear that it works - added an answer :)

http://stackoverflow.com/comment/36017562
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23488243
has text: As a rule of thumb, primitives take less memory than objects.

http://stackoverflow.com/q/23594213
favorite count: 0
upvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/23595582
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: http
type: Question
has title: adding HttpParams to HttpClient return server error (400) in android
accepted answer: http://stackoverflow.com/a/23595582
tagged with: httpclient
downvote count: 0
answer count: 1
has body: i simply to understand how but this are the fact httpClient = new DefaultHttpClient(); work fine . but this : HttpParams httpParameters = new BasicHttpParams(); httpClient = new DefaultHttpClient(httpParameters); returned server error (400) how could it be ? i didn't changed anything but adding empty params .... i also check the fields of the httpClient and i didnt saw anything diffrent

http://stackoverflow.com/a/40249360
score: 0
has comment: http://stackoverflow.com/comment/67762042
answers question: http://stackoverflow.com/q/23598360
has body: Had same issue and solve it by adding the rounding mode Unnecessary: @Test(dataProvider = "moneyValueProvider") public void testMoneyFromFloat(String currency, Float value) { CurrencyUnit cu = CurrencyUnit.of(currency); //Double dVal = Double.valueOf(value.toString()); BigDecimal bigDecimal = new BigDecimal(value.toString()); Money money = Money.of(cu, bigDecimal, RoundingMode.UNNECESSARY); Assert.assertNotNull(money); Assert.assertEquals(bigDecimal.doubleValue(), money.getAmount().doubleValue()); } @DataProvider public static Object[][] moneyValueProvider() { return new Object[][] { {"GBP", 22.5f}, {"GBP", 57.8f}, {"JPY", 15000.0f} };
type: Answer
has comment: http://stackoverflow.com/comment/67761789
has comment: http://stackoverflow.com/comment/67761441
has comment: http://stackoverflow.com/comment/67761405

http://stackoverflow.com/comment/36080020
type: Comment
has text: @Squonk i understand your point i too have seen a lot of similar posts. Well i thought i would be duplicating since i could have posted a link and voted to close the question as duplicate. May be a lint warning would help.
comment on: http://stackoverflow.com/a/23521583
score: 0
type: AnswerComment

http://stackoverflow.com/q/23567744
score: 0
has body: I have been writing a web application functioning over keyword search. If the keyword contains special character(,@#&lt;$% etc) i want to break the keyword into two, with and without special characters. For example @apple, should be spitted into @apple and apple. But this should be done only if the string is not enclosed within double quotes. For the keyword, hello "@this" is just a #test i am expecting hello "@this" is just a #test test Is there any way to achieve this?
tagged with: regex
possible better answer: http://stackoverflow.com/a/23568847
accepted answer: http://stackoverflow.com/a/23568054
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23568054
tagged with: java
has answer: http://stackoverflow.com/a/23568847
type: Question
has title: Split strings having special characters, also without double quotes
answer count: 2
tagged with: string

http://stackoverflow.com/comment/36229365
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23537285
score: 1
has text: If you just want the row count, your SQL should be SELECT COUNT(*) FROM table. This returns just the row count.

http://stackoverflow.com/q/23533375
tagged with: java
has answer: http://stackoverflow.com/a/23534091
type: Question
accepted answer: http://stackoverflow.com/a/23534091
has body: First of all, I am a newbie to Spring security and Intellij IDEA. I have created a starter Spring Security Project in Intellij IDEA which uses the Spring version 3.2 and security version 3.1. I am getting the following error in web.xml. org.springframework.web.filter.DelegatingFilterProxy' is not assignable to 'javax.servlet.Filter' Here is my web.xml snippet. springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* Could someone please tell me what the issue is ? I searched in google and was not able to find the solution.
score: 0
tagged with: intellij-idea
answer count: 1
has title: DelegatingFilterProxy is not assignable to javax.servlet.Filter ERROR in IntelliJ starter project
tagged with: spring-security
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/a/23606414
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: There where some quote/comma hickups and it should be exevcuteUpdate. However it is important to use a PreparedStatement: easier on the SQL string, escapes special chars in the strings (like apostrophe) you can used typed parameters, like BigDecimal below security SQL injection I used the try-with-resources syntax to close the stmt. String instId = req.getParameter("instId"); String cartId = req.getParameter("cartId"); String desc = req.getParameter("desc"); String cost = req.getParameter("cost"); BigDecimal amount = new BigDecimal(req.getParameter("amount")); String currency = req.getParameter("currency"); String name = req.getParameter("name"); String transId = req.getParameter("transId"); String transStatus = req.getParameter("transStatus"); String transTime = req.getParameter("transTime"); String cardType = req.getParameter("cardType"); Connection conn = null; Statement stmt = null; PrintWriter out = res.getWriter(); try { conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/orders", "root", "root"); String sqlStr = "insert into orderdetails " + "values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; try (PreparedStatement stmt = conn.prepareStatement(sqlStr)) { stmt.setString(1, transId); stmt.setString(2, instId); stmt.setString(3, cartId); stmt.setString(4, desc); stmt.setString(5, cost); stmt.setBigDecimal(6, amount); stmt.setString(7, currency); stmt.setString(8, name); stmt.setString(9, transStatus); stmt.setString(10, transTime); stmt.setString(11, cardType); int updateCount = stmt.executeUpdate(); out.println(" Query Response "); out.println(" Thank you for your query. " + updateCount + " record(s) updated. "); out.println(" You query is: " + sqlStr + " "); // Echo for debugging for (Enumeration<String> en = req.getParameterNames(); en.hasMoreElements();) { String paramName = en.nextElement(); String paramValue = req.getParameter(paramName); out.println(" " + paramName + ": " + paramValue + " "); // Echo for debugging } } // Does stmt.close() } catch (SQL…
accepted answer of: http://stackoverflow.com/q/23605662
type: Answer
answers question: http://stackoverflow.com/q/23605662
score: 1

http://stackoverflow.com/q/23521925
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/36081098
score: 0
has comment: http://stackoverflow.com/comment/36084494
has comment: http://stackoverflow.com/comment/36084457
has title: How to paint an image in Jtable with Mysql
type: UnansweredQuestion
answer count: 0
has body: Hello I would like to print data from mysql query to my Jtable, I knw how to print the conventional data(String), but do not know how to do it with pictures. What I need is print the picture in the first cell of the table. public void SearchMovie() throws SQLException { try { Connection con = null; ResultSet rs = null; Statement st = null; String Genre = ComboGenero.getSelectedItem().toString(); String Era = ComboEra.getSelectedItem().toString(); String Clsssification = ComboClasification.getSelectedItem().toString(); String sql = "select Foto,Title,Year,Country ,Rating from movie where Genre ='" + Genre + "'"; Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost/whichmovie", "Asis", "dekrayat24"); st = con.createStatement(); rs = st.executeQuery(sql); DefaultTableModel model = new DefaultTableModel(); this.jTable1.setModel(model); jTable1.setDefaultRenderer(Object.class,new IconCellRenderer()); jTable1.setRowHeight(40); ResultSetMetaData rsMD = rs.getMetaData(); int numcolumnas = rsMD.getColumnCount(); for (int x = 1; x &lt;= numcolumnas; x++) { model.addColumn(rsMD.getColumnLabel(x)); } while (rs.next()) { Object[] fila = new Object[numcolumnas]; for (int i = 0; i &lt; numcolumnas; i++) { fila[i] = rs.getObject(i + 1); ResultadosLabel.setText(numcolumnas + "Movies found"); } model.addRow(fila); } rs.close(); st.close(); con.close(); } catch (ClassNotFoundException ex) { System.out.println(ex.getMessage()); } } Thanks .
has comment: http://stackoverflow.com/comment/36079990
tagged with: java
has comment: http://stackoverflow.com/comment/36080573
linked to: http://stackoverflow.com/q/11527477
tagged with: mysql

http://stackoverflow.com/a/56005426
type: Answer
has body: To avoid this kind of error you can use HttpUrlConnection (java.net.HttpUrlConnection) for both http and https url HttpsUrlConnection only add extra methods that "can be used" for https connection but you probably won't use these methods. Both HttpsUrlConnection and HttpUrlConnection derives from UrlConnection which contains methods that permit to read the response like getInputStream(). HttpsUrlConnection derives from HttpUrlConnection which derived from UrlConnection. java.net.HttpUrlConnection just add methods relative to http protocol (these methods apply to https) https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html https://docs.oracle.com/javase/8/docs/api/javax/net/ssl/HttpsURLConnection.html Thus you can do this : URL url = new URL(urlString); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); As well you can do this and obtain the same result, the connection will be the same : URL url = new URL(urlString); HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); con.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
downvote count: 0
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23517139

http://stackoverflow.com/comment/36220438
has text: check wikipedia for better algorithms
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23597024
type: QuestionComment

http://stackoverflow.com/q/23506651
has comment: http://stackoverflow.com/comment/36141134
answer count: 3
has answer: http://stackoverflow.com/a/46006308
tagged with: full-text-search
has body: Hello I am trying to implement vector space model in java. I indexed around 1000 documents using td-idf , and I use this index to search through the documents. I figured the constructor of the class which which I used for indexing was taking too much of time ,so I decided to serialize and write the object once created to a text file say indexedFiles.txt So now I read the text file everytime I want to search into the collection like this fileInputStream = new FileInputStream("indexedFiles.txt"); ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream); VSM vsm = (VSM) objectInputStream.readObject();//This statement take the most time , objectInputStream.close(); But the readObject and casting statement takes approximately the same time as the original constructor . Why is this happening? ,The reason I did this was I wanted to do the indexing offline so the searching would be quick
favorite count: 0
has comment: http://stackoverflow.com/comment/36051788
has comment: http://stackoverflow.com/comment/36051733
tagged with: serialization
has title: Why is InputStream.readObject taking so much of time reading the serialized Object
possible better answer: http://stackoverflow.com/a/23507403
has comment: http://stackoverflow.com/comment/36051750
has answer: http://stackoverflow.com/a/23507403
score: 2
type: AnsweredQuestion
tagged with: performance
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23554532
accepted answer: http://stackoverflow.com/a/23554532
type: Question
upvote count: 2

http://stackoverflow.com/comment/36176139
has text: You're not providing any information anybody could use to help.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23570907

http://stackoverflow.com/comment/36234784
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23539174
has text: `finalize` is one of the [usual suspects](http://stackoverflow.com/questions/2860121). In short: It's single theaded, forces to GC the object twice, and is a PITA anyway. You can either decompile the bytecode and grep or simply [load all classes](http://code.google.com/p/guava-libraries/wiki/ReflectionExplained#ClassPath) and use reflection to find the method.
score: 0

http://stackoverflow.com/q/23473052
has answer: http://stackoverflow.com/a/23474843
tagged with: batch-file
answer count: 1
favorite count: 0
tagged with: windows
accepted answer: http://stackoverflow.com/a/23474843
type: AnsweredQuestion
has body: I am trying to run a simple java application as windows service. This is my main class file. I am trying to print time for every five seconds and stop after one minute. The Package name is samPack. package samPack; import java.util.Date; public class Time { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Thread thread = new Thread() { public void run() { long start = System.currentTimeMillis(); long end = start + 60*1000; while (System.currentTimeMillis() &lt; end){ //System.out.println("Hello World"); Date date = new Date(); System.out.println("Ram Test ---- &gt; "+date.toString()); try { Thread.sleep(5000); // 1 second } catch (Exception e) { e.printStackTrace(); } } } }; thread.start(); } } To make it a windows service I have downloaded the Tanuki Software’s Java Service Wrapper. and unzip the folder on desktop. I have created a runnable jar file for the above code and pasted it in bin folder of Java service Wrapper and also in the lib folder. The DemoApp.bat fail in bin folder I have changed it to run.bat and then in that file I have changed variable WRAPPER_CONF_DEFAULT to ../conf/wrapper.conf. IN the Wrapper.conf file these are the changes I made # Java Main class. This class must implement the WrapperListener interface # or guarantee that the WrapperManager class is initialized. Helper # classes are provided to do this for you. See the Integration section # of the documentation for details. wrapper.java.mainclass=samPack.Time # Java Classpath (include wrapper.jar) Add class path elements as wrapper.java.classpath.1=../lib/wrappertest.jar wrapper.java.classpath.2=../lib/wrapper.jar wrapper.java.classpath.3=../lib/sam.jar # Name of the service wrapper.name=samtestservice # Display name of the service wrapper.displayname=Sam Test Service # Description of the service wrapper.description=Sam Test Service Decs # Mode in which the service is installed. AUTO_START, DELAY_START or DEMAND_START wrapper.ntservice.starttyp…
upvote count: 2
score: 1
tagged with: java
downvote count: 1
has title: Unable to run a java application as windows service
type: Question
tagged with: java-service-wrapper

http://stackoverflow.com/comment/36119645
comment on: http://stackoverflow.com/q/23541692
score: 0
has text: and yes, it could be easily spotted using a debugger, but again this would apply to many questions on SO. Imho, one of the first things people should learn during programming courses is how to properly use a debugger... sadly, this is hardly ever part of any curriculum.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35966639
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23459741
score: 0
has text: Hi Karibasappa, thanks for your advice. The thing is that I can't even get to that part of my code. The error I am referring to is a compile time error. I posted more details about what happens when I try to run in an edit above.

http://stackoverflow.com/comment/36002658
score: 0
type: Comment
type: QuestionComment
has text: @Nate I was pretty sure of that ^^
comment on: http://stackoverflow.com/q/23474984

http://stackoverflow.com/comment/36228097
comment on: http://stackoverflow.com/q/23588414
score: 0
has text: Rotbot is a class inside java.awt package, more detail here http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23518887
tagged with: dictionary
tagged with: collections
answer count: 1
has title: Efficient HashMap traversing
tagged with: java
accepted answer: http://stackoverflow.com/a/23518919
tagged with: hashmap
has body: I was doing my dev work and wondered which one of these could be better option in terms of code practice , memory and time efficiency ? public static void printtHashmap(Map&lt;?,?&gt; hm) { for(Object key : hm.keySet()) { System.out.println(key+" "+hm.get(key)); } } public static void printHashMapByEntry(Map&lt;?,?&gt; hm) { for(Map.Entry&lt;?,?&gt; entry: hm.entrySet()) { System.out.println(entry.getKey()+" "+entry.getValue()); }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23518919
score: -1
favorite count: 0
type: Question
downvote count: 2
upvote count: 1

http://stackoverflow.com/comment/36226354
has text: @Renox: [Java Links](http://stackoverflow.com/tags/java/info), [The Java Tutorials](http://docs.oracle.com/javase/tutorial/), [The Really Big Index](http://docs.oracle.com/javase/tutorial/reallybigindex.html), [Defining Methods](http://docs.oracle.com/javase/tutorial/java/javaOO/methods.html).
type: Comment
comment on: http://stackoverflow.com/a/23599688
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36127564
has text: Nick - if you'd like to give me a 'baby steps' answer happy to upvote and accept :)
type: QuestionComment
comment on: http://stackoverflow.com/q/23547229
score: 0
type: Comment

http://stackoverflow.com/q/23605898
has answer: http://stackoverflow.com/a/23606675
tagged with: java
type: Question
has body: We're using Elasticsearch as database and based upon a definition I'm creating a type mapping. This mapping is basically a JSON object which gets built with the XContentBuilder of elasticsearch Java-API. In my scala file I've defined an Enumeration object that holds the possible elasticsearch data-types like this: object TypeMapping extends Enumeration { val StringType = DataType("string") val FloatType = DataType("float") ... val GeoShapeType = DataType("geo_shape") val AttachmentType = DataType("attachment") final case class DataType(esType: String) extends Val { override def toString: String = esType } } Now when I use this in the creation of the mapping JSON like this: val builder = jsonBuilder.startObject("name").field("type", StringType).endObject the scala compiler can nicely resolves all the methods to call; no errors or warnings. The method field is overloaded, each receiving a String parameter name and a parameter value. These values can be specific (String, int, int[], etc.) or vararg (String..., int..., etc.) but there's also an Object variant for both specific and vararg calls. Now I would expect that the scala compiler would choose the field(String name, Object value) in the case I'm describing here, but to my suprise I find that the field(String name, Object... value) is being called. I do not understand why this is happening. Can anybody explain this to me?
downvote count: 0
answer count: 1
tagged with: elasticsearch
has comment: http://stackoverflow.com/comment/36243186
tagged with: variadic-functions
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: scala
has title: Why does scalac take the Java vararg method instead of the single argument
has comment: http://stackoverflow.com/comment/36243769
has comment: http://stackoverflow.com/comment/36243876
score: 2

http://stackoverflow.com/a/23533047
has comment: http://stackoverflow.com/comment/36101704
has comment: http://stackoverflow.com/comment/36101937
answers question: http://stackoverflow.com/q/23532811
has comment: http://stackoverflow.com/comment/36102374
has comment: http://stackoverflow.com/comment/36101550
has comment: http://stackoverflow.com/comment/36102272
score: 0
has comment: http://stackoverflow.com/comment/36101686
has comment: http://stackoverflow.com/comment/36101979
has body: here in this case you have to use SINGLETON CLASS.from your first screen you have to set the creditiontials then you have yo get them at any screen.you can use the below code: public class DataHolderClass { private static DataHolderClass dataObject = null; private DataHolderClass() { // left blank intentionally } public static DataHolderClass getInstance() { if (dataObject == null) dataObject = new DataHolderClass(); return dataObject; } private int server_port; private String server_ip; public String get_server_port() { return server_port; } public void set_server_port(String server_port) { this._server_port = server_port; } public String get_server_ip() { return server_ip; } public void set_server_ip(String server_ip) { this.server_ip= server_ip; } } now in your activity you have to set the values like below: DataHolderClass.getInstance().set_server_port("8020"); DataHolderClass.getInstance().set_server_ip("192.168.1.36"); now to get the values use below code: String a = DataHolderClass.getInstance().get_server_port(); String b = DataHolderClass.getInstance().get_server_ip();
has comment: http://stackoverflow.com/comment/36101323
has comment: http://stackoverflow.com/comment/36101389
type: Answer

http://stackoverflow.com/a/23516405
has comment: http://stackoverflow.com/comment/36069005
downvote count: 1
has comment: http://stackoverflow.com/comment/36078259
type: Answer
score: 2
has body: Threads only get interrupted during interruptible operations, for example Thread.sleep(), Thread.wait(), and some I/O calls (not all).
answers question: http://stackoverflow.com/q/23516213
upvote count: 3

http://stackoverflow.com/comment/35969508
score: 1
comment on: http://stackoverflow.com/q/23462382
type: Comment
has text: Just tried with both Eclipse and `javac 1.8.0`, got `wtf` for both
type: QuestionComment

http://stackoverflow.com/q/23580814
has body: I don't know if the tittle is clear, but I am going to try to make myself as clear as possible. This is my scenario, I have a class called User: @Entity(name="User_table") public class User { @Id @GeneratedValue int userId; String userName; String userMessage; // public User(String userName, String userMessage) // { // this.userName= userName; // this.userMessage = userMessage; // } // public User(){} public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserMessage() { return userMessage; } public void setUserMessage(String userMessage) { this.userMessage = userMessage; } } Related to that table: mysql&gt; select * from User_table; +--------+-------------+ | userId | | userName | +--------+------------- | 71 | | Dani | | 72 | | Dani | +--------++------------ 2 rows in set (0.00 sec) And what I want is to select all the objects from User_table, where userName = Dani. So, what I do is this: public List&lt;Object&gt; HotelesNombre(String name) { int i = 0; User user = null; SessionFactory sf = open(); Session ss = sf.openSession(); ss.beginTransaction(); Query query = ss.createQuery("select userId, userName from User_table where userName = :id "); query.setParameter("id", name); List&lt;Object&gt; list = query.list(); if (list.size() != 0) { ss.getTransaction().commit(); ss.close(); return list; } else { ss.getTransaction().commit(); ss.close(); return null; } } As you can see, I use List instead of List because I am selecting a part of the object User (not the whole) and List wouldn't work. So, for testing, in the main class I have: public class HibernateMain { /** * @param args */ public static void main(String[] args) { int status; int i=0; Manager manager = new Manager(); status = manager.creaUsuario("Dani", "pollo"); //User user = manager.buscaHotel(71); List&lt;Object&gt; list = m…
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23580873
tagged with: java
tagged with: hibernate
tagged with: jpa
has title: Hibernate List<Object[]> to especific object
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23580873

http://stackoverflow.com/comment/36138112
comment on: http://stackoverflow.com/q/23552854
has text: @JonSkeet with the old point , i mean the instance of leaf created before calling the doSomething() method.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36220010
comment on: http://stackoverflow.com/a/23596498
score: 0
type: Comment
has text: but i need 2 values. Here is a Picture http://www.pic-upload.de/view-23169548/app.jpg.html i need to say the First list the name and the second list the among of gramms.
type: AnswerComment

maven-resources-plugin
tags question: http://stackoverflow.com/q/23477450
type: Tag
tags question: http://stackoverflow.com/q/23515701
tags question: http://stackoverflow.com/q/23476452
tag name: maven-resources-plugin

http://stackoverflow.com/a/23488615
has comment: http://stackoverflow.com/comment/36017895
upvote count: 1
answers question: http://stackoverflow.com/q/23488221
downvote count: 1
has comment: http://stackoverflow.com/comment/37200976
has body: Set the cell type like : HSSFRow row = sheet.createRow(sheet.getLastRowNum()); HSSFCell cell = row.createCell(0); cell.setCellType(Cell.CELL_TYPE_STRING); cell.setCellType(Cell.CELL_TYPE_NUMERIC); For alphanumeric and Character cell type will be Cell.CELL_TYPE_STRING for number, cell type will be CELL_TYPE_NUMERIC You can get more on cell type from Cell and HSSFCell documentation.
score: 0
has comment: http://stackoverflow.com/comment/36019509
has comment: http://stackoverflow.com/comment/36017762
has comment: http://stackoverflow.com/comment/36017383
has comment: http://stackoverflow.com/comment/36968710
type: Answer
has comment: http://stackoverflow.com/comment/36017807
has comment: http://stackoverflow.com/comment/36019615
has comment: http://stackoverflow.com/comment/36017818
has comment: http://stackoverflow.com/comment/36017774
has comment: http://stackoverflow.com/comment/37200149

http://stackoverflow.com/comment/35983607
has text: @TDMaster Lol I'm so stupid xD Thank you, it worked fine :)
score: 0
comment on: http://stackoverflow.com/q/23470476
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23519709
answer count: 2
has answer: http://stackoverflow.com/a/23536057
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: securesocial
tagged with: java
accepted answer: http://stackoverflow.com/a/23542837
type: Question
possible better answer: http://stackoverflow.com/a/23536057
has title: SecureSocial: How to modify the signup system (UsernamePasswordProvider)?
has body: I'm implementing a signup system by using UsernamePasswordProvider. I want a user to be able to signup directly instead of firstly putting his/her email and waiting for a token. Moreover, I want to modify the signup form by adding/deleting some input fields. However, I can't find any document mentioned how to achieve these requirements. Any help would be appreciated.
has answer: http://stackoverflow.com/a/23542837
score: 0

http://stackoverflow.com/comment/36122739
comment on: http://stackoverflow.com/q/23543482
score: 0
has text: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> tooling tooling propertyFileLocation conf/system.properties contextConfigLocation /META-INF/application-context.xml
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23583625
upvote count: 9
type: UnansweredQuestion
has body: jmh 0.6. I have jmh-core, jmh-generator-annprocess, jmh-generator-reflection as dependencies. First, documentation is poor, unfortunately. For one, I use gradle, not maven, so using the maven archetype is not an option. Second, I want to use the Java API, not the command line. My very simple code is that: public final class TestBenchmark { private static final int COUNT = 100_000; private static final List&lt;Integer&gt; LIST = new ArrayList&lt;&gt;(); static { for (int i = 0; i &lt; COUNT; i++) LIST.add(i); } @GenerateMicroBenchmark public void foreachLoop() { int dummy; for (final int i: LIST) dummy = i; } @GenerateMicroBenchmark public void forLoop() { int dummy; final int size = LIST.size(); for (int i = 0; i &lt; size; i++) dummy = LIST.get(i); } public static void main(final String... args) throws RunnerException { final Options options = new OptionsBuilder() .forks(1) .warmupIterations(1) .measurementIterations(20) .verbosity(VerboseMode.EXTRA) .build(); new Runner(options).run(); } } As I have no .include(), it means .* as a regex therefore all benchmarks. This is the only class I have in my project. But no: "no benchmarks found". So, as a last resort I tried and created the META-INF/MicroBenchmarks file as suggested in other places; content, the name of the class: com.github.parboiled1.grappa.TestBenchmark but it doesn't work either: Exception in thread "main" java.lang.IllegalStateException: Mismatched format for the line: com.github.parboiled1.grappa.TestBenchmark and the format of this file is, of course, not documented. But I don't want to use this file to start with; I want to specify the list of classes to run. How do I do that?
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23791817
score: 9
type: Question
has title: How do you specify the JMH microbenchmarks test to run WITHOUT using a resource file?
answer count: 2
tagged with: jmh
has answer: http://stackoverflow.com/a/23585491
favorite count: 0

http://stackoverflow.com/q/23543822
tagged with: java
type: Question
answer count: 2
has title: Facebook friend picker SDK sample not working Android
has answer: http://stackoverflow.com/a/25596238
has body: Please help me to get the facebook friends from my profile using 3.14 SDK. There is no error in the code but the problem is getting empty list while fetching friends in my profile. I am getting the error in logcat saying . 05-08 16:18:49.252: E/ActivityThread(25644): Failed to find provider info for com.facebook.orca.provider.PlatformProvider 05-08 16:42:20.453: I/QCNEA(28696): |NIMS| getaddrinfo: hostname graph.facebook.com servname NULL numeric 4 appname 05-08 16:51:32.482: D/Request(31861): Warning: Sessionless Request needs token but missing either application ID or client token Also i am producing the complete code for your reference below FriendPickerApplication.java* package com.facebook.samples.friendpicker; import android.app.Application; import com.facebook.model.GraphUser; import java.util.List; // We use a custom Application class to store our minimal state data (which users have been selected). // A real-world application will likely require a more robust data model. public class FriendPickerApplication extends Application { private List<GraphUser> selectedUsers; public List<GraphUser> getSelectedUsers() { return selectedUsers; } public void setSelectedUsers(List<GraphUser> selectedUsers) { this.selectedUsers = selectedUsers; } } FriendPickerSampleActivity.java package com.facebook.samples.friendpicker; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.facebook.AppEventsLogger; import com.facebook.Session.NewPermissionsRequest; import com.facebook.SessionState; import com.facebook.UiLifecycleHelper; import com.facebook.model.GraphUser; import com.facebook.Session; import java.util.ArrayList; import java.util.Collection; import java.util.List; public class FriendPickerSampleActivity extends FragmentAct…
score: 4
favorite count: 0
tagged with: sdk
tagged with: android
upvote count: 4
tagged with: facebook-graph-api
downvote count: 0
type: UnansweredQuestion
tagged with: facebook
has comment: http://stackoverflow.com/comment/36145385
has answer: http://stackoverflow.com/a/23606183

http://stackoverflow.com/comment/36206076
has text: Hi JoinK, Thank you. I have entered my revised code above. Is this correct /what you meant please? Regards, Glyn.
type: AnswerComment
comment on: http://stackoverflow.com/a/23587962
score: 0
type: Comment

http://stackoverflow.com/comment/36272443
score: 0
has text: Currently i am not able to access the logs, as the server machine is in hold of another person, I will post the logs ASAP.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23609227

http://stackoverflow.com/comment/36070422
type: QuestionComment
comment on: http://stackoverflow.com/q/23517186
has text: The code seems to be correct. Are you sure to set both children of each node to `null` when creating it?
score: 0
type: Comment

http://stackoverflow.com/a/23562000
has comment: http://stackoverflow.com/comment/36154365
type: Answer
has comment: http://stackoverflow.com/comment/36154577
score: 2
has comment: http://stackoverflow.com/comment/36154545
downvote count: 0
has body: if i call foo() ,new instance of Chassis is created as a parameter an engine object,and the reference of the new object created also remains outside method right? for example: if i call method print() after calling foo() it will print the memory address of the new object Chassis created? Yes as far as both method will be invoked on the same instance of Car, You can try that. chassis is an instance field of Car class, and inside foo() method, you are creating an instance of Chassis and assign it to instance field chassis if i call doSomething() a new Engine is created and immediately i call setEngine, and in this case, the engine "pointer" of the class car points to the new instance I created: The old engine "pointer" is carbage collected And now the reference is the new instance created and if I call back foo, a new chassis is created with a new instance of the engine? Bit correction there, reference are not Garbage Collected, only object are Garbage Collected. When you assign a object to a reference, the previous object will be GGed, if it doesn't have any live reference.
has comment: http://stackoverflow.com/comment/36154947
upvote count: 2
has comment: http://stackoverflow.com/comment/36154819
accepted answer of: http://stackoverflow.com/q/23561958
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23561958
has comment: http://stackoverflow.com/comment/36154727

http://stackoverflow.com/q/23470278
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/23471042
has answer: http://stackoverflow.com/a/23470327
possible better answer: http://stackoverflow.com/a/23471042
accepted answer: http://stackoverflow.com/a/23470327
answer count: 3
tagged with: jdbc
has answer: http://stackoverflow.com/a/23470291
has title: Does calling close on a ResultSet reference close the another reference referring to the same ResultSet?
type: AnsweredQuestion
has body: I have a Servlet, which uses a static utility method that returns a ResultSet. In my Servlet code I have ResultSet rs = SimpleSearch.searchByName(request); In my searchByName method, I have the following code(Not full Code); try { preparedStatement = connection.prepareStatement(str); preparedStatement.setDate(1, firstSQLDOB); preparedStatement.setDate(2, secondSQLDOB); rs = preparedStatement.executeQuery(); resultSet = rs; } catch (SQLException ex) { ex.printStackTrace(); } finally { try { if (rs != null) { rs.close(); } } catch (Exception ex) { ex.printStackTrace(); } try { if (preparedStatement != null) { preparedStatement.close(); } } catch (Exception ex) { ex.printStackTrace(); } try { if (connection != null) { connection.close(); } } catch (Exception ex) { ex.printStackTrace(); } } return resultSet; Does closing rs also close resultSet?
score: 0
tagged with: java

http://stackoverflow.com/q/23524949
upvote count: 1
tagged with: jakarta-ee
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23525089
type: Question
possible better answer: http://stackoverflow.com/a/23524992
answer count: 2
has answer: http://stackoverflow.com/a/23524992
tagged with: apache
downvote count: 0
tagged with: tomcat
has body: I have installed JAVA 1.6 on Redhat Linux 4 and wanted to function it with tomcat 5.5 but i am facing the below issue: When I am stopping the tomcat server it is taking JAVA 1.6 , but when I am bringing it up , it is taking JAVA 1.5(this one is pre-installed and currently working). I am not understanding where i am missing. Please help me on this. I am really naive but hope to understand these things through you. Points: Server has already installed JAVA 1.5 which is currently working. I want to change the JAVA to 1.6 from 1.5 JAVA 6 has been installed in the directory --> /usr/java/jdk1.6.0_25/ I have only changed tomcat start up file JAVA_HOME variable to export JAVA_HOME=/usr/java/jdk1.6.0_25/ when i am stopping the server, it shows, Using JRE_HOME: /usr/java/jdk1.6.0_25/ When I am starting the tomcat server, it shows, Using JRE_HOME: /apps/UTCinet-WK/jdk1.5.0_03 many thanks in advance java -version java version "1.6.0_25" Java(TM) SE Runtime Environment (build 1.6.0_25-b06) Java HotSpot(TM) Server VM (build 20.0-b11, mixed mode) and when i stop the server, it shows: Using CATALINA_BASE: /apps/xxxx/tomcat/xxx/xxxx Using CATALINA_HOME: /apps/xxxx/jakarta-tomcat-5.5.9 Using CATALINA_TMPDIR: /apps/xxxx/tomcat/xxxx/xxxx/temp Using JRE_HOME: /usr/java/jdk1.6.0_25/ Confirming shutdown completion - 5 xxxxonds.. and when i start the server, it shows: Setting environment (DEV) from hostname. at /apps/xxxx/scripts/get_env.pl line 18. Using CATALINA_BASE: /apps/xxxx/tomcat/xxxx/xxxx Using CATALINA_HOME: /apps/xxxx/jakarta-tomcat-5.5.9 Using CATALINA_TMPDIR: /apps/xxxx/tomcat/xxxx/xxxx/temp Using JRE_HOME: /apps/xxxx/jdk1.5.0_03
favorite count: 0
has title: When tomcat starts up, it takes wrong JAVA version that is 1.5 instead of 1.6
accepted answer: http://stackoverflow.com/a/23525089

http://stackoverflow.com/q/23543691
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: Task: execute groovy script with Groovy sandbox: http://groovy.codehaus.org/api/overview-summary.html http://groovy-sandbox.kohsuke.org/ Groovy Script to execute: query.reverse(); // QUERY is a some string that should be reversed File "GroovyScriptSandbox.groovy" should get two parameters(script and values for this script): package test.my.groovy.sandbox import org.codehaus.groovy.control.CompilerConfiguration import org.codehaus.groovy.control.customizers.ImportCustomizer import org.codehaus.groovy.control.customizers.SecureASTCustomizer import org.springframework.stereotype.Component @Component class GroovyScriptSandbox { def config def shell public String runScript(final String script, final String query) { final ImportCustomizer imports = new ImportCustomizer() .addStarImports('groovyx.net.http') .addStaticStars('groovyx.net.http.ContentType', 'groovyx.net.http.Method') config = new CompilerConfiguration() config.addCompilationCustomizers(imports) def newScript = "{ query -&gt; " + script + "}" shell = new GroovyShell(config) def clos = shell.evaluate(newScript) return clos.call(query) } } Java method that executes "GroovyScriptSandbox.groovy": @Resource private GroovyScriptSandbox groovyScriptSandbox; @RequestMapping(value = "/run", method = RequestMethod.POST) @ResponseBody public String runScript(@RequestParam("script") final String script, @RequestParam("query") final String query) { return groovyScriptSandbox.runScript(script, query); } In that case all works fine: Java controller getting script parameter equal "query.reverse()" and query parameter equals "0123" Groovy file executes script "query.reverse()" in sandbox where query equals "0123" Result equals "3210" Question: I'm trying to replace "GroovyScriptSandbox.groovy" file with "GroovyScriptSandbox.java" and I don't know how to write the same groovy code in Java.
has answer: http://stackoverflow.com/a/23583153
upvote count: 3
tagged with: java
tagged with: sandbox
type: Question
has title: Groovy sandbox and Java: execute Groovy script
downvote count: 0
tagged with: groovy
score: 3

http://stackoverflow.com/comment/36087407
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23503895
has text: you mean a link to A/B?

joystick
type: Tag
tag name: joystick
tags question: http://stackoverflow.com/q/23591690

http://stackoverflow.com/a/23782956
has comment: http://stackoverflow.com/comment/36577533
has comment: http://stackoverflow.com/comment/36595930
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36578003
has comment: http://stackoverflow.com/comment/36590033
type: Answer
accepted answer of: http://stackoverflow.com/q/23592839
has comment: http://stackoverflow.com/comment/36577823
score: 2
downvote count: 0
has body: The exception is throw because your application can't find the Renjin ScriptEngine. You have provided renjin-studio as a library, but you need the renjin-script-engine library which is available from http://build.bedatadriven.com/job/renjin/lastSuccessfulBuild/org.renjin$renjin-script-engine/ (use the JAR with dependencies). Unfortunately ScriptEngineManager.getEngineByName() only returns null if it can't find the engine so you can add the following check to ensure that the engine has loaded: // check if the engine has loaded correctly: if(engine == null) { throw new RuntimeException("Renjin Script Engine not found on the classpath."); } Also note: it is called Renjin, not Rengin!
answers question: http://stackoverflow.com/q/23592839
has comment: http://stackoverflow.com/comment/36595503

http://stackoverflow.com/q/23454761
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23454890
answer count: 1
favorite count: 0
score: 0
tagged with: android
has title: PBEKeySpec not generating desired output key length
accepted answer: http://stackoverflow.com/a/23454890
has body: I'm using the following code, in order to generate a hash for a provided password: public static SecretKey generateKey( String passphraseOrPin ) throws NoSuchAlgorithmException, InvalidKeySpecException { final int iterations = 10000; // Generate a 256-bit key final int outputKeyLength = 256; char[] chars = new char[passphraseOrPin.length()]; passphraseOrPin.getChars( 0, passphraseOrPin.length(), chars, 0 ); byte[] salt = "thisSaltIsInClient".getBytes(); SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance( "PBKDF2WithHmacSHA1" ); KeySpec keySpec = new PBEKeySpec( chars, salt, iterations, outputKeyLength ); return secretKeyFactory.generateSecret( keySpec ); } So when I get bytes from the generated password, and cast them to a String: String passwordEncrypted = Base64.encodeToString( bytesPass, Base64.DEFAULT ); The output is something like: yo2NDJ96VYadiP2jpzL3p+LW0b4qkdWS++WqAm0W9d8= Shouldn't it be longer?
tagged with: encryption

http://stackoverflow.com/q/23558961
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/36149638
tagged with: amazon-ec2
has comment: http://stackoverflow.com/comment/36149591
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36149054
has body: I have an instance of amazon ec2, and I have a java project in it. I'm loging in with putty and I'm looking for a way to update the code I'm writing in that project. For now, I'm writing in eclipse on my computer and transfer the whole project every time I change something. The editor ec2 offers is not a good one to work with. Is there a way to work directly on that project with eclipse or another good editor like notepad++ ?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23559297
has title: I need a comfortable way to work on my server class in ec2 instance
tagged with: java

http://stackoverflow.com/comment/36149452
score: 0
has text: @skiwi I agree with you there, if you're going to use this method you might as well use the oldest version of java possible
type: Comment
comment on: http://stackoverflow.com/a/23546566
type: AnswerComment

http://stackoverflow.com/a/23561875
upvote count: 2
has body: Remove group expression $F{count} from &lt;groupExpression&gt;&lt;![CDATA[$F{count}]]&gt;&lt;/groupExpression&gt; If this does not work then remove the whole group expression line from both main and subreport.
has comment: http://stackoverflow.com/comment/36154505
has comment: http://stackoverflow.com/comment/36154669
accepted answer of: http://stackoverflow.com/q/23561049
has comment: http://stackoverflow.com/comment/36154734
answers question: http://stackoverflow.com/q/23561049
has comment: http://stackoverflow.com/comment/36154362
score: 2
has comment: http://stackoverflow.com/comment/36154586
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36155549
has comment: http://stackoverflow.com/comment/36155310
has comment: http://stackoverflow.com/comment/36156739
has comment: http://stackoverflow.com/comment/36155368
type: Answer

http://stackoverflow.com/comment/36040378
comment on: http://stackoverflow.com/q/23500709
has text: You know, you can use http://www.ideone.com/ to test in case you don't have an IDE next to you.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23568302
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/23568408
has body: Consider the following code snippet for reading a file in Java/Android: FileInputStream fis = openFileInput("myfile.txt"); BufferedInputStream bis = new BufferedInputStream(fis); StringBuffer b = new StringBuffer(); while (bis.available()!=0) { char c = (char) bis.read(); b.append(c); } bis.close(); fis.close(); I am talking about available() method in the condition of while loop. I looked the API documentation for that method and I have the following questions: How the iteration inside the the while loop is happening, i.e. how is the file pointer moving to another chunk of data during each iteration of while loop? This is not specified in the API documentation. How can I figure out which method of which class should I use to accomplish a task?
type: Question
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/36166793
has answer: http://stackoverflow.com/a/23568442
has comment: http://stackoverflow.com/comment/36166646
has comment: http://stackoverflow.com/comment/36166585
favorite count: 0
has title: I cannot understand API docs for Java/Android?
type: UnansweredQuestion
tagged with: android
downvote count: 2

http://stackoverflow.com/q/23605955
has answer: http://stackoverflow.com/a/23606111
has comment: http://stackoverflow.com/comment/36237117
favorite count: 0
linked to: http://stackoverflow.com/q/18644579
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23606123
duplicate of: http://stackoverflow.com/q/18644579
has answer: http://stackoverflow.com/a/23606583
answer count: 4
has comment: http://stackoverflow.com/comment/36238001
tagged with: java
downvote count: 3
upvote count: 1
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/36237457
score: -2
has answer: http://stackoverflow.com/a/23606005
has body: I have two hashmaps and I just want to compare their keys as well as their values with each other. Student stu1=new Student(1, "student_1_Name"); Student stu2=new Student(2, "student_2_Name"); Map&lt;Integer, Student&gt; map1= new Hashmap&lt;Integer, Student&gt;(); Map&lt;Integer, Student&gt; map2= new Hashmap&lt;Integer, Student&gt;(); map1.put(1, stu1); map2.put(2, stu2); System.out.println("is there any diff.==="+map1.entrySet().equals(map2.entrySet())); As much I know: map.keySet() : gives keys of map map.values() : gives values of map map.entrySet() : gives both keys and values. The above code snippet always gives me false. I just want to compare the values and keys of two maps. Please let me know how I can compare two maps?
has title: How to compare entrySet of two maps

url
tags question: http://stackoverflow.com/q/23486247
tags question: http://stackoverflow.com/q/23604612
tag name: url
tags question: http://stackoverflow.com/q/23522881
tags question: http://stackoverflow.com/q/23615455
tags question: http://stackoverflow.com/q/23535012
tags question: http://stackoverflow.com/q/23547134
tags question: http://stackoverflow.com/q/23518734
tags question: http://stackoverflow.com/q/23486277
tags question: http://stackoverflow.com/q/23574892
tags question: http://stackoverflow.com/q/23514307
tags question: http://stackoverflow.com/q/23461489
tags question: http://stackoverflow.com/q/23550074
tags question: http://stackoverflow.com/q/23582338
type: Tag
tags question: http://stackoverflow.com/q/23600386

http://stackoverflow.com/a/23462842
score: 0
answers question: http://stackoverflow.com/q/23462674
type: Answer
has body: Try adding the information of color to the Listen class: create a constructor that accepts a Color or String that holds the color information per Listen instance. Then, where you call panel1.setBackground(), use the color information you have stored to specify the color there. Perhaps something like this: class Listen implements ActionListener { Color myColor; public Listen (Color newColor) { myColor = newColor; } public void actionPerformed (ActionEvent e) { panel1.setBackground(myColor); } } Then in your Collection class, Listen react = new Listen(); becomes Listen react = new Listen(hashmap.get("Salmon")); and thus, when your button is clicked, the panel turns black. I suppose that you would have to redesign your HashMap system, which I think is great, but it will have to map Strings to Colors. You could use the Color constructor that take red, blue, and green values that can specify specific colors. Your salmon color, for example, would be FA = 250, 80 = 128, 72 = 114, so hashmap.put("Salmon", new Color(250, 128, 114)); If you have any questions, let me know!

http://stackoverflow.com/a/23540068
has comment: http://stackoverflow.com/comment/36124884
score: 3
answers question: http://stackoverflow.com/q/23539854
has comment: http://stackoverflow.com/comment/36124854
has comment: http://stackoverflow.com/comment/36123283
has body: You need to call release on the ByteBuf rather than clear in your finally block, otherwise the reference counted buffer is not de-allocated properly.
upvote count: 3
type: Answer
downvote count: 0

java-8
tags question: http://stackoverflow.com/q/23513165
tags question: http://stackoverflow.com/q/23581058
tags question: http://stackoverflow.com/q/23489993
tags question: http://stackoverflow.com/q/23590613
tags question: http://stackoverflow.com/q/23596530
tags question: http://stackoverflow.com/q/23575067
tags question: http://stackoverflow.com/q/23494510
tags question: http://stackoverflow.com/q/23454952
tags question: http://stackoverflow.com/q/23495415
tags question: http://stackoverflow.com/q/23507660
tags question: http://stackoverflow.com/q/23538422
tags question: http://stackoverflow.com/q/23453568
tags question: http://stackoverflow.com/q/23488721
tags question: http://stackoverflow.com/q/23487272
tags question: http://stackoverflow.com/q/23520703
tags question: http://stackoverflow.com/q/23563728
tags question: http://stackoverflow.com/q/23595136
tags question: http://stackoverflow.com/q/23466218
tags question: http://stackoverflow.com/q/23526115
tags question: http://stackoverflow.com/q/23502998
tags question: http://stackoverflow.com/q/23564103
tags question: http://stackoverflow.com/q/23573274
tags question: http://stackoverflow.com/q/23548589
tags question: http://stackoverflow.com/q/23510994
tags question: http://stackoverflow.com/q/23572318
tag name: java-8
tags question: http://stackoverflow.com/q/23523946
tags question: http://stackoverflow.com/q/23533345
tags question: http://stackoverflow.com/q/23580826
tags question: http://stackoverflow.com/q/23540387
tags question: http://stackoverflow.com/q/23470720
tags question: http://stackoverflow.com/q/23461978
tags question: http://stackoverflow.com/q/23455836
tags question: http://stackoverflow.com/q/23552912
type: Tag
tags question: http://stackoverflow.com/q/23541532
tags question: http://stackoverflow.com/q/23512819
tags question: http://stackoverflow.com/q/23453287
tags question: http://stackoverflow.com/q/23603304
tags question: http://stackoverflow.com/q/23462209
tags question: http://stackoverflow.com/q/23546393
tags question: http://stackoverflow.com/q/23554413
tags question: http://stackoverflow.com/q/23540817

dblink
tags question: http://stackoverflow.com/q/23485663
type: Tag
tag name: dblink

http://stackoverflow.com/a/23560023
has body: The @Controller is used specifically used in SpringMVC and indicates that the annotated class has the role of a controller, and this in turn allows the Spring DispatcherServlet to identify potential handlers for requests to the particular service. When the DispatcherServlet receives a request, it delegates it to the appropriate controller, based on its @RequestMapping and @Controller values. @Component indicates that the class itself should be managed by the Spring container. Both are similiar in the fact they are discovered by the classpath scanning.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23555106

http://stackoverflow.com/comment/36211202
score: 0
comment on: http://stackoverflow.com/q/23592271
type: QuestionComment
type: Comment
has text: use set/getDocument (model for JTextComponents)

http://stackoverflow.com/a/23549068
has comment: http://stackoverflow.com/comment/36130890
has comment: http://stackoverflow.com/comment/36135017
has comment: http://stackoverflow.com/comment/36130847
has comment: http://stackoverflow.com/comment/36130881
answers question: http://stackoverflow.com/q/23549002
score: 0
type: Answer
has body: try this MyObject obj = new MyObject(); WeakReference&lt;MyObject&gt; weak = new WeakReference&lt;&gt;(obj); obj = null; System.gc(); Thread.sleep(100); if (weak.get() == null) { System.out.println("OK."); } else { System.out.println("STILL ALIVE!!"); } or this MyObject obj = new MyObject(); ReferenceQueue q = new ReferenceQueue(); WeakReference&lt;MyObject&gt; weak = new WeakReference&lt;&gt;(obj, q); obj = null; System.gc(); q.remove(); if (weak.get() == null) { System.out.println("OK."); } else { System.out.println("STILL ALIVE!!"); }

http://stackoverflow.com/comment/36157067
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23563469
has text: I use an IDE and it ensures that my code is re-compiled as needed without me even having to save the files. Just type code and run it.

http://stackoverflow.com/a/23601619
accepted answer of: http://stackoverflow.com/q/23601363
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23601363
has body: Inside the JVM, methods with different return types are distinct. After type erasure, FooBarEntity.getEntity() has return type Object. Calls via the interface will look specifically for a method with return type Object, hence why your implementation must return Object. Normally, your Java compiler will create bridge methods that forward the result of the concrete method as the erased type, but apparently Javassist doesn't do this for you (I haven't used Javassist so I'm not sure). For more on how bridge methods are used to implement type erasure, see the official Java Tutorials topic on bridge methods.
has comment: http://stackoverflow.com/comment/36271831
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36211237
type: Comment
comment on: http://stackoverflow.com/a/23544044
type: AnswerComment
score: 0
has text: Understood, will further try with network connection. I have tried the sample code in a new Google web application project, but got some error, may because I do the wrong setting of application project.

http://stackoverflow.com/a/23493781
answers question: http://stackoverflow.com/q/23493578
has comment: http://stackoverflow.com/comment/36026751
has comment: http://stackoverflow.com/comment/36026607
has body: Use Task scheduling using cron expression from properties file @Scheduled(cron = "${cronTrigger.expression}") public void runDynamic() { //doing my stuff } Config in XML File: &lt;bean id="cronTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean"&gt; &lt;property name="jobDetail" ref="exampleJob" /&gt; &lt;!-- run every morning at 6 AM --&gt; &lt;property name="expression" value="0 0 6 * * ?" /&gt; &lt;/bean&gt; This link1 and doc might help you You can also create the Tash Scheduler dynamically(programatically) as explained here
score: 0
type: Answer

http://stackoverflow.com/comment/36190751
has text: I tried your example but it still output the same error:Cannot run program "mvn": CreateProcess error=2
comment on: http://stackoverflow.com/a/23579813
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23510292
type: Question
has body: It's a requirement of my school assignment that I use "this" in the following program. However, I can't quite figure out where I could put this. I keep getting a "non-static variable this cannot be referenced from a static context" error. import java.util.Scanner; public class PrimeNumber { public static void main(String args[]) { System.out.println("Enter the upper limit for the prime numbers computation: "); int upperLimit = new Scanner(System.in).nextInt(); int count = 0; for(int number = 2; number&lt;=upperLimit; number++) { if(isPrime(number)) { System.out.println(number); count++; } } System.out.println("Number of primes generated: " + count); } public static boolean isPrime(int number) { for(int i=2; i&lt;number; i++) { if(number%i == 0) { return false; } } return true; } }
has comment: http://stackoverflow.com/comment/36058078
linked to: http://stackoverflow.com/q/413898
score: 0
has answer: http://stackoverflow.com/a/23510521
tagged with: java
answer count: 3
has answer: http://stackoverflow.com/a/23510382
has title: How do I implement "this" into my Java program?
has answer: http://stackoverflow.com/a/23510389
type: UnansweredQuestion

http://stackoverflow.com/a/41279135
answers question: http://stackoverflow.com/q/23575593
type: Answer
has body: Use two natives queries String deleteTable2 = "DELETE CORE_WAC.ASSET_PROJECT_PROPOSAL_INFO act where RESOURCE_ID IN (:resourceIdsList)"; Query qDeleteTable2 = getEntityManager().createNativeQuery(deleteTable2); qDeleteTable2.setParameter("resourceIdsList", resourceIdsList); qDeleteTable2.executeUpdate(); String deleteTable1 = "DELETE CORE_WAC.ASSET_PROJECT_INFO act where RESOURCE_ID IN (:resourceIdsList)"; Query qDeleteTable1 = getEntityManager().createNativeQuery(deleteTable1); qDeleteTable1.setParameter("resourceIdsList", resourceIdsList); qDeleteTable1.executeUpdate();
score: 0

http://stackoverflow.com/comment/36149187
score: 0
type: Comment
type: QuestionComment
has text: @Marko13, face palm you are 100% correct, going with the solution answered could you not also create a Facade (Purely in the case you have no access to modify source) , then use a facade factory to return the correct wrapper instance. That way you do all the oo plumbing.
comment on: http://stackoverflow.com/q/23549262

http://stackoverflow.com/a/23534881
type: Answer
accepted answer of: http://stackoverflow.com/q/23534851
answers question: http://stackoverflow.com/q/23534851
type: AcceptedAnswer
downvote count: 0
has body: Literal integer types starting at 0 are interpreted as octal base. Octal base doesn't allow 8, only digits from 0 to 7.
score: 8
upvote count: 8

http://stackoverflow.com/comment/36086683
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23518308
has text: I think eventually I'll have a lot of documents for each user. Won't it be too slow to calculate the newest 20 each time I need to get them? I was looking at dedicated directories only because of this. But maybe you're right and it's just a preliminary optimization...

http://stackoverflow.com/comment/36013084
comment on: http://stackoverflow.com/a/23479193
score: 0
type: AnswerComment
type: Comment
has text: That is not true. Just add Jackson 2+ to the classpath and a `MappingJackson2HttpMessageConverter` will be added automatically to the `RequestMappingHandlerAdapter`. It could not be any simpler.

http://stackoverflow.com/comment/35974296
comment on: http://stackoverflow.com/q/23464968
score: 0
type: Comment
type: QuestionComment
has text: You could do this by passing the values of email & pass to the servlet & display as a html page.

http://stackoverflow.com/comment/36054657
type: AnswerComment
has text: This reads the JAR file twice, and loads the entire contents of the JAR file into memory. It isn't actually necessary to waste time and space on this epic scale.
type: Comment
comment on: http://stackoverflow.com/a/23508310
score: 0

http://stackoverflow.com/comment/36006231
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23482184
type: Comment
has text: check that the line reads s[i] = (i >= v.length ? 0 : v[i]) + (i >= w.length ? 0 : w[i]); and not s[i] = (i >= v.length ? 0 : v[i]) + (i >= w.length ? 0 : v[i]);

http://stackoverflow.com/comment/36164871
type: Comment
has text: possible duplicate of [EventQueue.invokeLater vs Thread.start](http://stackoverflow.com/questions/23271351/eventqueue-invokelater-vs-thread-start)
type: QuestionComment
comment on: http://stackoverflow.com/q/23559744
score: 0

http://stackoverflow.com/q/23596911
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23597042
tagged with: java
tagged with: output
downvote count: 1
accepted answer: http://stackoverflow.com/a/23597042
type: Question
has body: I seem to be having an issue with regards to my output from a Constructor that I have prepared. As I am learning Java, I am attempting to familiarize myself with Constructors and their importance. All I want to do is output a car type. Here is my code: public class Car { public String cm; public int hp; public String col; public String vtype; public String intr; public int ts; Car(String carMake, int horsePower, String colour, String vehicleType, String interior, int topSpeed){ carMake = cm; horsePower = hp; colour = col; vehicleType = vtype; interior = intr; topSpeed = ts; } public static void main (String [] args){ Car carA = new Car("BMW", 2000, "Black", "1 Series", "Leather", 155); System.out.println("This is your car: " + carA); } } However, my output is this: This is your car: Car@5db2381b Can someone please point out why the output is like this? Many thanks.
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23596966
favorite count: 0
tagged with: constructor
has title: Constructor with incorrect output?
upvote count: 1
possible better answer: http://stackoverflow.com/a/23596934
has answer: http://stackoverflow.com/a/23596934

http://stackoverflow.com/comment/35976286
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23466313
type: Comment
has text: i know that how to compare but i dont know where i am wrong

http://stackoverflow.com/a/23778038
accepted answer of: http://stackoverflow.com/q/23610308
type: Answer
has body: It just seems that the page returns only 4 images. So I added start=number. Therefore I send multiple requests.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23610308
score: 0

http://stackoverflow.com/a/29807893
accepted answer of: http://stackoverflow.com/q/23547885
answers question: http://stackoverflow.com/q/23547885
type: Answer
downvote count: 0
score: 1
has body: I know after one year probably the answer won't be useful for you, but maybe can help other people who is struggling with spring-data-neo4j, like myself these days (see question) Just point two things you need to change: 1) Following the spring-data repository naming conventions, the name of the implementation of your custom repository has to be EntityRepsitoryImpl (although the default sufix Impl can be changed by configuration). So, you need to change MyTypeRepositoryExtensionImpl for MyTypeRepositoryImpl 2) You don't need to change the neo4j:repositories package. org.example.repository is fine. Don't use org.springframework.data.neo4j 3) Concerning the dependencies needed, if you don't change the package repository as mentioned in the point 2, is enough with the basics: org.springframework.data.spring-data-neo4j javax.validation.validation-api com.sun.jersey.jersey-client I agree with you that spring-data-neo4j repository composition is a bit confusing and there are very few good examples online... So, finally I've decided to create a sample project on GitHub, with a basic example showing how we can do that. Hope it help other people in the future. See on GitHub: neo4jCustomRepository
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/23582894
has comment: http://stackoverflow.com/comment/36250546
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36330206
type: Question
tagged with: openpgp
has title: OpenPgp encryption using Bouncycastle very slow on Unix
has comment: http://stackoverflow.com/comment/36333200
answer count: 1
downvote count: 0
has body: I am sign and encrypt a text file of 12 GB using (bcpg-jdk16-145.jar , bcprov-jdk16-145.jar) jar files. File will be encrypted and signed approximately 18 minutes in Windows Vista , jdk 1.6. But when I try to encrypt it on LINUX/UNIX system process will become very slow I takes 1 to 1:30 hours. Kindly suggest. Code for signing file is as below : private static void signFile(String fileName, InputStream keyIn, OutputStream out, char[] pass, boolean armor, int bufferSize) throws IOException, NoSuchAlgorithmException, NoSuchProviderException, PGPException, SignatureException { if (armor) { out = new ArmoredOutputStream(out); } PGPSecretKey pgpSec = readSecretKey(keyIn); PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(pass, "BC"); PGPSignatureGenerator sGen = new PGPSignatureGenerator(pgpSec .getPublicKey().getAlgorithm(), PGPUtil.SHA1, "BC"); sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey); Iterator it = pgpSec.getPublicKey().getUserIDs(); if (it.hasNext()) { PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator(); spGen.setSignerUserID(false, (String) it.next()); sGen.setHashedSubpackets(spGen.generate()); } PGPCompressedDataGenerator cGen = new PGPCompressedDataGenerator( PGPCompressedData.ZLIB); BCPGOutputStream bOut = new BCPGOutputStream(cGen.open(out)); sGen.generateOnePassVersion(false).encode(bOut); File file = new File(fileName); PGPLiteralDataGenerator lGen = new PGPLiteralDataGenerator(); OutputStream lOut = lGen.open(bOut, PGPLiteralData.BINARY, file); FileInputStream fIn = new FileInputStream(file); byte[] byteArray = new byte[bufferSize]; while (fIn.read(byteArray) &gt;= 0) { lOut.write(byteArray); sGen.update(byteArray); } lGen.close(); sGen.generate().encode(bOut); cGen.close(); out.close(); }
favorite count: 0
has answer: http://stackoverflow.com/a/23706250
tagged with: bouncycastle
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36208715
has comment: http://stackoverflow.com/comment/36193965
has comment: http://stackoverflow.com/comment/36394505
linked to: http://stackoverflow.com/q/13923247
has comment: http://stackoverflow.com/comment/36194047

http://stackoverflow.com/q/23511429
type: Question
has comment: http://stackoverflow.com/comment/36146795
has comment: http://stackoverflow.com/comment/36060906
has title: Android application crashing (IllegalArgumentException)
tagged with: illegalargumentexception
score: 0
has comment: http://stackoverflow.com/comment/36060139
has body: My Android application crashes suddenly. I am not able to trace the problem. I have many custom views wherein I recycle the imageviews on detachwindow, and each instance of custom view have an Handler object. This is my call stack; please help me find the problem. Thread [&lt;1&gt; main] (Suspended (exception IllegalArgumentException)) &lt;VM does not provide monitor information&gt; Choreographer.doCallbacks(int, long) line: 594 Choreographer.doFrame(long, int) line: 561 Choreographer$FrameDisplayEventReceiver.run() line: 777 Handler.handleCallback(Message) line: 725 Choreographer$FrameHandler(Handler).dispatchMessage(Message) line: 92 Looper.loop() line: 176 ActivityThread.main(String[]) line: 5317 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 511 ZygoteInit$MethodAndArgsCaller.run() line: 1102 ZygoteInit.main(String[]) line: 869 NativeStart.main(String[]) line: not available [native method]
answer count: 0
type: UnansweredQuestion
tagged with: android
tagged with: java

http://stackoverflow.com/comment/36145195
comment on: http://stackoverflow.com/q/23554127
score: 0
type: Comment
type: QuestionComment
has text: The reason I tried that way was because I had cast problem if builder in child feature do not extend builder in parent builder. This happened when I called constructor (Builder) ( innerClass.getConstructor(StudentModel.class).newInstance(studentModel)); I managed to make it work after your suggestion, but I had to change build method in Builder to be static, so I called innerClass.getMethod("build",StudentModel.class).invoke(null, studentModel);

http://stackoverflow.com/comment/36004328
type: Comment
comment on: http://stackoverflow.com/a/23481220
has text: As I tried, Matrix transforms only graphics, physical area of rectangle remains the same, and I didnt find a Contrains() method (exept Rect.Contains()) to check if point is inside of new Rectangle.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36210125
has text: ... however, the original problem may be related to the fact that you are not inserting new control points, as indicated by this well-known "pyramid scheme" that you'll find on all websited that pretend to explain the deBoor algorithm.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23571078
type: Comment

http://stackoverflow.com/comment/55821896
has text: Related to: [how to make transparent scene and stage in javafx?](http://stackoverflow.com/questions/34033119/how-to-make-transparent-scene-and-stage-in-javafx)
comment on: http://stackoverflow.com/q/23576796
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/34499577
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23493684
has body: First you need to check what is the return type of sortFile(args[0]) method and store the return value in the same data type(Any method can return only one value or Object at a time but that returned Object can hold multiples value within it.).So use appropriate data structure(like Array, List..etc as return type) or any other Object to store these three values and return from that sortFile(args[0]) function. Finally pass that variable in your next method call getFRE(returnedObject).

http://stackoverflow.com/comment/36171470
type: AnswerComment
has text: -@Dmitri: Thanks for the detailed answer. However, somehow it is not working on my end. I added more details to the question. Please take a look. I have also pasted my jmeter.properties to pastebin. The link is in the question. Additionally, I tried `org.apache.jorphan.logging.LoggingManager`, but gradle cannot resolve a dependency for jorphan, so this solution won't work for me as I want to keep gradle.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23560191

http://stackoverflow.com/comment/36068816
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23516239
has text: One way is, from you Eclipse project right click > Properties > java Build path. And in Libraries tab click Add external jars and add this jar from your hard disk location.
score: 0

http://stackoverflow.com/comment/36207176
has text: why convert xml to json you can parse the xml itself
comment on: http://stackoverflow.com/q/23590129
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35977860
has text: *"I don't recognize the utility that you are using to display the processes. If this was top -H output, I'd understand it ..."* The filename of the picture, when I downloaded it from the shortening service, was `htop_java_helloworld.png`, which is suggestive... :-)
comment on: http://stackoverflow.com/a/23467037
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23511824
type: AnsweredQuestion
tagged with: abstracttablemodel
linked to: http://stackoverflow.com/q/2064427
score: 1
has body: I am newbie in JTable, maybe I don't understand something. Let's suppose I have ArrayList of 1000 Students (id, name, surname, age). And I want to show all students in JTable. As far as I understood I must create StudentTableModel that extends AbstractTableModel and set StudentTableModel to JTable. Therefore we can consider StudentTableModel as an "adapter" between our ArrayList and the table. On the internet I found such example implementation of getValueAt: public Object getValueAt(int row, int col) { Student student = arrayList.get(row); switch (col) { case 0: return student.getId(); case 1: return student.getName(); case 2: return student.getSurname(); case 3: return student.getAge(); } } The problem is that having 1000 students (rows) and 4 field (columns) we will run this switch 4000 times. Please explain what I do wrong or tell about a better solution.
tagged with: java
has title: AbstractTableModel getValueAt perfomance
tagged with: swing
has answer: http://stackoverflow.com/a/23526915
type: Question
has comment: http://stackoverflow.com/comment/36080202
has comment: http://stackoverflow.com/comment/36061186
has answer: http://stackoverflow.com/a/23512179
tagged with: jtable
linked to: http://stackoverflow.com/q/9132987
answer count: 2
has comment: http://stackoverflow.com/comment/36060804
upvote count: 1
has comment: http://stackoverflow.com/comment/36060802
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36060730
linked to: http://stackoverflow.com/q/7774960
linked to: http://stackoverflow.com/q/13915081
accepted answer: http://stackoverflow.com/a/23526915
possible better answer: http://stackoverflow.com/a/23512179

http://stackoverflow.com/comment/36196026
has text: @LuiggiMendoza, any other alternative for that ??
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23584034
score: 0

http://stackoverflow.com/comment/36016497
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23487381
has text: @DanutClapa If you already have the answer, why did you post the question on SO?
score: 0

deserialization
type: Tag
tags question: http://stackoverflow.com/q/23523434
tags question: http://stackoverflow.com/q/23556772
tag name: deserialization
tags question: http://stackoverflow.com/q/23500436
tags question: http://stackoverflow.com/q/23517120

http://stackoverflow.com/a/23507927
downvote count: 0
has body: There are two possibilities that I can think of: It's an oversight Both calls to close() can throw an exception. If the first one throws an exception, the second one would be skipped - unless of course the first one was wrapped in its own try/catch block. The second one doesn't need a try/catch block since if it fails, there is no subsequent code that will be skipped In the "real world", I would say that the answer is #1. The reason I would think #2 to be unlikely is that there is usually some other code that you will want to execute, even if you can't close some stream. This would be especially true had the catch blocks not caught an exception (or re-threw a different exception) since a fresh exception in the finally block would replace the original exception and you would never know that it had happened. Update As another answer has pointed out, PrintWriter.close() does not in fact throw an IOException, even though the parent interface Writer does declare that close() can throw an IOException. So that may be a better explanation.
upvote count: 3
answers question: http://stackoverflow.com/q/23507891
type: Answer
accepted answer of: http://stackoverflow.com/q/23507891
score: 3
type: AcceptedAnswer

http://stackoverflow.com/q/23609969
upvote count: 3
type: UnansweredQuestion
type: Question
score: 3
tagged with: jndi
tagged with: java
tagged with: active-directory
has title: javax.naming.initialcontext is a restricted class google app engine
has body: I try to connect to an ldap server using "javax.naming" my application is deployed on app engine public static DirContext connect(String ldapHote , String port, String distinguishedName ,String password ,String authentication) throws NamingException { DirContext context; Hashtable env; env = new Hashtable(11); env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://"+ldapHote+":"+port+""); env.put(Context.SECURITY_PRINCIPAL, distinguishedName); env.put(Context.SECURITY_CREDENTIALS,password ); env.put(Context.SECURITY_AUTHENTICATION, "simple"); context = new InitialDirContext(env); System.out.println("OK"); return context; } but I have this error, javax.naming.InitialContext is a restricted class. I wonder if there is a solution or there is another way to connect
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/57020890
tagged with: ldap
tagged with: google-app-engine
linked to: http://stackoverflow.com/q/12298891
has comment: http://stackoverflow.com/comment/36254889
has answer: http://stackoverflow.com/a/23617849

http://stackoverflow.com/q/23580319
has comment: http://stackoverflow.com/comment/36294804
has body: I'm developing an algorithm that needs to run two sequential mapreduce jobs, where the second one takes in input the input and the output of the first one at the same time. I found four ways to do it and I want to know witch of these is the most efficient or if there are other methods. Distributed Cache Merging all the reducer output into a single file and loading it on Distributed Cache FileSystem fs = FileSystem.get(confi); Path pt = new Path(output.toString() + "/out.txt"); try{ FileStatus[] status = fs.listStatus(output); BufferedWriter brOut=new BufferedWriter(new OutputStreamWriter(fs.create(pt,true))); for (int i=0;i&lt;status.length;i++){ BufferedReader brIn=new BufferedReader(new InputStreamReader(fs.open(status[i].getPath()))); String line; line=brIn.readLine(); while (line != null){ brOut.write(line + "\n"); line=brIn.readLine(); } } brOut.close(); }catch(Exception e){ e.printStackTrace(); } job.addCacheFile(pt.toUri()); Adding it as a resource to the configuration class As before I merge the output saving it on a String and than: Configuration conf = new Configuration(); conf.setStrings("input2ndjob", outputFromReducer); Job job = Job.getInstance(conf,"Second Job"); Reading from hdfs The second map reads the output files of first reducers directly from hdfs Passing two values as input I have found on this webpage this pseudocode where it seems that they are passing two arguments as input to the second mapper but I don't know how to do that. map(key, value): // value is the candidate itemsets and a chunk of the full dataset Count occurrences of itemsets in the chunk. for itemset in itemsets: emit(itemset, supp(itemset)) reduce(key, values): result = 0 for value in values: result += value if result &gt;= s: emit(key, result)
tagged with: mapper
has comment: http://stackoverflow.com/comment/36339382
has title: Multiple inputs on a single mapper in hadoop
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36383662
has comment: http://stackoverflow.com/comment/36274153
type: Question
has comment: http://stackoverflow.com/comment/36303622
tagged with: reduce
has comment: http://stackoverflow.com/comment/36262707
tagged with: mapreduce
tagged with: hadoop
score: 0
has comment: http://stackoverflow.com/comment/36302746

http://stackoverflow.com/comment/36091702
comment on: http://stackoverflow.com/q/23520938
type: Comment
type: QuestionComment
has text: Where are your transaction boundaries?
score: 0

http://stackoverflow.com/a/23469358
score: 1
has body: If matches is empty then matches.get(0).toString(); will give an ArrayIndexOutOfBoundsException. Better check like if(matches.size()&gt;0) String vid0 = matches.get(0).toString();
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23469295
type: Answer

http://stackoverflow.com/a/23532558
accepted answer of: http://stackoverflow.com/q/23466951
downvote count: 0
answers question: http://stackoverflow.com/q/23466951
has comment: http://stackoverflow.com/comment/42600958
score: 37
has comment: http://stackoverflow.com/comment/43004042
has body: Finally able to fix the issue, the issue is with the way SessionFactory is getting created. For a starter, official document is the first place to go and I must say that Hibernate official documentation seems to be not update with latest version changes. Fix is to apply the configuration settings to StandardServiceRegistryBuilder instance. // Create the SessionFactory from hibernate.cfg.xml Configuration configuration = new Configuration(); configuration.configure("hibernate.cfg.xml"); ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder() .applySettings(configuration.getProperties()).build(); SessionFactory sessionFactory = configuration .buildSessionFactory(serviceRegistry); Please refer my blog post here for more details.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/64278184
upvote count: 37
type: Answer
has comment: http://stackoverflow.com/comment/42019285

http://stackoverflow.com/comment/36196776
type: Comment
comment on: http://stackoverflow.com/a/23584341
type: AnswerComment
has text: It works! OMG thank you! You gave me the full explanation and answer. Thanks again.\
score: 0

http://stackoverflow.com/comment/36183505
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23577060
has text: @AleZalazar So if i use from java.util.LinkedList: LinkedList<Card> cards = new DoubleLinkedList<Card>(); then add an binch of Card in there, How can say find the Next/previous Card of a specific card like static card newCard = new Card(1); by newCard.next etc?
score: 0

http://stackoverflow.com/comment/35976336
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23466170
score: 1
has text: Possibly related: http://stackoverflow.com/questions/7488643/java-how-to-convert-comma-separated-string-to-arraylist

http://stackoverflow.com/q/23508792
has answer: http://stackoverflow.com/a/23508883
has answer: http://stackoverflow.com/a/23508809
tagged with: java
downvote count: 1
type: Question
has body: Does sorted array equal best case for a sorting algorithm? I don't know for sure. Let's assume the array is sorted in ascending order. Also, I'm not entire sure of the reasoning behind the time complexity for these sort algorithms: Mergesort on sorted array = O(nlog2(n)), can I assume that it doesn't matter if it is sorted or not it will always be O(nlog2(n))? Bubble sort on sorted array = O(n), because it just traverses through the array once? Quicksort on sorted array = O(nlog2(n))? I'm not sure how to explain this, though.
has title: Time complexity for a sorted array
upvote count: 0
score: -1
answer count: 3
has answer: http://stackoverflow.com/a/23508820
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23493757
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23493526
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23493526
has body: deriveFont specifys the font style rather than the size so the loaded font retains its default size of 0 Font font = tempFont.deriveFont(48); You want the overloaded version of the method Font font = tempFont.deriveFont(48f); ^

http://stackoverflow.com/comment/36170105
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23570073
type: Comment
has text: "case insensitive to whitespaces" is quite a bit unclear. Do you want the JTextField to convert all letters to upper or lower case? Do you want it to not display any whitespace? If so, look into using either a DocumentFilter or a JFormattedTextField. If you only care about how the program processes the text on event, then the question has nothing to do with JTextField and all to do with how you write your event listener. Please clarify.

http://stackoverflow.com/comment/36052636
comment on: http://stackoverflow.com/q/23496108
score: 0
type: Comment
type: QuestionComment
has text: @Rogério Thanks! Re Really!? Yes, I'm trying to use JMockit on Android. How can I use mock on the Dalvik VM?

http://stackoverflow.com/comment/36149966
type: Comment
comment on: http://stackoverflow.com/a/23502287
has text: It should work out of box, you checkout the sources, import them as a project into Eclipse and compile them. Try again and don't do anything yourself. Provide more information on what you have done and what issue do you face.
score: 0
type: AnswerComment

debugging
tags question: http://stackoverflow.com/q/23535318
tag name: debugging
tags question: http://stackoverflow.com/q/23588371
tags question: http://stackoverflow.com/q/23492804
type: Tag
tags question: http://stackoverflow.com/q/23489297
tags question: http://stackoverflow.com/q/23525545
tags question: http://stackoverflow.com/q/23492452
tags question: http://stackoverflow.com/q/23577076

http://stackoverflow.com/comment/36254159
has text: should I use this e.preventDefault();
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23607240

http://stackoverflow.com/q/23605775
tagged with: encryption
has comment: http://stackoverflow.com/comment/36241182
upvote count: 1
tagged with: unit-testing
type: Question
has body: I have developed an application using sunpkcs11 and bouncycastle libraries for encrypting, signing, decryption and verifying a cmsMessage. I am using a Nexus smart card reader for keeping my private key and cryptography functions. My code is working fine, however I need to test my code for every possible scenarios which my users may encounter. I want to test the functions inside the wrapper dll which is used in pkcs11 config file (in my case it is Personal.dll for Nexus smart card). How can I do it? I mean in my code I call some methods like getInstance(), getContent(),... and these functions belong to sunpkcs11 and bouncycastle libraries, so if I want to generate a unit test, should I write my tests around these functions? EDIT1: The Prsonal.dll has been changed in this project by some other developers and I do not have access to its source code. I want to check the correct functionality with unit testing.
has title: Unit testing: SUNPKCS11 config dll functions
tagged with: java
downvote count: 0
has comment: http://stackoverflow.com/comment/36241542
score: 1
favorite count: 0
tagged with: security
tagged with: bouncycastle
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/36090171
score: 0
type: Comment
type: QuestionComment
has text: It is thread safe, but the `map` would be lost unless it is saved into session scope or somewhere else.
comment on: http://stackoverflow.com/q/23527163

http://stackoverflow.com/q/23554213
has comment: http://stackoverflow.com/comment/36140652
has comment: http://stackoverflow.com/comment/36140685
tagged with: jcombobox
type: Question
linked to: http://stackoverflow.com/q/18830098
has body: The main idea is, that the Combo box should show colors in the selection area instead of the normal String. This is the code i've made so far. import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Colors extends JFrame implements ActionListener { private JComboBox combo; private JPanel panel; private final Color[] content = {Color.red, Color.blue, Color.green, Color.black, Color.yellow}; public Colors() { super("Colors"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocation(500, 150); setSize(250, 100); setResizable(false); Container c = getContentPane(); c.setLayout(new FlowLayout()); panel = new JPanel(); c.add(panel); getCombo(); } private void getCombo() { combo = new JComboBox(content); combo.setSelectedIndex(4); combo.addActionListener(this); panel.add(combo); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == combo) { int choose = combo.getSelectedIndex(); if (choose == 0) { panel.setBackground(content[0]); } else if (choose == 1) { panel.setBackground(content[1]); } else if (choose == 2) { panel.setBackground(content[2]); } else if (choose == 3) { panel.setBackground(content[3]); } else if (choose == 4) { panel.setBackground(content[4]); } else if (choose == 5) { panel.setBackground(content[5]); } } } public static void main(String[] args) { Colors run = new Colors(); run.setVisible(true); } } This just show awt reference and the GBR number, I want the colors to be shown in the Combo box
score: 0
tagged with: java
has title: How can i display colors in a JComboBox?
has comment: http://stackoverflow.com/comment/36140969
answer count: 0
type: UnansweredQuestion
tagged with: colors

http://stackoverflow.com/comment/36024758
type: QuestionComment
comment on: http://stackoverflow.com/q/23492764
type: Comment
has text: "Syntax error on token ";", { expected after this token"
score: 0

rfc1123
type: Tag
tag name: rfc1123
tags question: http://stackoverflow.com/q/23538341

http://stackoverflow.com/comment/36203633
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23587821
has text: I clarified it in the title
type: Comment

http://stackoverflow.com/comment/41349104
type: AnswerComment
has text: Do you have any variable in the failing POM file where the variable is not defined in the same POM file? If yes, this can be the issue.
type: Comment
comment on: http://stackoverflow.com/a/26005201
score: 0

http://stackoverflow.com/comment/36094167
comment on: http://stackoverflow.com/a/23515714
has text: Are you sure there no other relationships between the DB tables, other then that one?
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/23566587
has comment: http://stackoverflow.com/comment/36198902
accepted answer of: http://stackoverflow.com/q/23566397
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23566397
has comment: http://stackoverflow.com/comment/36196389
has comment: http://stackoverflow.com/comment/36173205
type: Answer
has comment: http://stackoverflow.com/comment/36179357
has comment: http://stackoverflow.com/comment/36188512
downvote count: 0
has comment: http://stackoverflow.com/comment/36189183
has body: You need to complete the iteration as well as the insertion. Assuming you are implementing a linked list and you have a public next attribute at you ListElement class. public boolean insert(Person p){ ListElement element = new StackElement(p); boolean inserted = false; if(head == null){ head = element; size = size + 1; inserted = true; return inserted; } ListElement temp = head; ListElement prev = null; while(temp != null){ if(temp.compareTo(element) &lt; 0) { if(prev != null) prev.next = element; //Keep the chain connected element.next = temp; //Insert you element before temp inserted = true; break; } prev = temp; temp = temp.next; } } if(!inserted &amp;&amp; temp == null &amp;&amp; prev != null) { //You may want to insert it at the end of the list if no upper element is found. prev.next = element; //Put it at the end. inserted = true; } if(inserted) size = size + 1; return inserted; //This should be true in any case but I left it for the case you want to avoid inserting the element at the end if its place is not found. } ListElement.next could also be a private or protected attribute and be accessed through a getter like getNext(). I think you shouldn't return the inserted value since if the element can't be place before any other it should be placed at the end of the list and therefore always being inserted. That is, this code is a better implementation of a sorted list: public void insert(Person p){ ListElement element = new StackElement(p); if(head == null){ head = element; size = size + 1; return; } ListElement temp = head; ListElement prev = null; boolean inserted = false; while(temp != null){ if(temp.compareTo(element) &lt; 0) { if(prev != null) prev.next = element; //Keep the chain connected element.next = temp; //Insert you element before temp inserted = true; temp = null; } else { prev = temp; temp = temp.next; } } } if(!inserted &amp;&amp; prev != null) { prev.next = element; //Put it at the end. } size = size + 1; } Concerning your delete method, I thin…
has comment: http://stackoverflow.com/comment/36187318
score: 1
has comment: http://stackoverflow.com/comment/36172745

http://stackoverflow.com/comment/35975691
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23465956
has text: Post some code whatever you tried.

http://stackoverflow.com/comment/46520563
comment on: http://stackoverflow.com/a/29124997
type: AnswerComment
score: 0
type: Comment
has text: after i added the jdbc to my classpath .. and even the variables were recognised, i deployed the war file and i got the error that jdbc was not found, after trying to put them in web inf lib (still wouldn't work) I added the mysql-connector-java-5.1.30-bin.jar file to my tomcat server that was running my web app and solved my problem jdbc was found

http://stackoverflow.com/q/23485622
has body: I'm pulling my hair out. I've spent a few hours now on this. Here is what I am doing. I have an image that is an actor. I can move this image to wherever I want. That works fine. I added a Slider so I can also resize this image. This is where the problem sets in. Once I resize it, I can still move it, but it is no longer where my finger is. It is, if it shrunk in size, to the NE. If it increased, it is to the SE. (of my finger). Anyways, I have no idea what is causing this. I spent an hour just writing different equations for adjusting per size, but nothing is working. Also, the world bounds become incorrect too. I shouldn't be allowed to move the actor/image outside of the screen. I do a simple check. (actor.getX() &lt;= 0). I feel like I should note that before resizing, everything works fine. Anyways, the bounds check was simple, right? Well, if I make my image smaller, it gets stopped before it reaches the edge. If I make it larger, it can enter the edge a bit. The same for the opposite side, except that this time if its larger, it gets stopped before it reaches, and if its smaller, it can go in a bit. Here, let me show you some code... My Table for the Slider: private Table buildSlidersLayer() { Table layer = new Table(); layer.right().top(); Label label = new Label("A Button Size", skinLibgdx); layer.add(label); layer.row(); sldSize = new Slider(0.0f, 1.0f, 0.01f, false, skinLibgdx); layer.add(sldSize); sldSize.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { sldSizeVal = sldSize.getValue(); divFacAButton = ((((1.0f - sldSizeVal) - 0.01f) * (2.0f - 0.7f)) / (0.99f - 0.01f)) + 0.7f; aButton.setSize(120 / divFacAButton, 120 / divFacAButton); } }); // sldSize.setPosition(60, 60); return layer; } My divFacAButton is between a range of 0.7 and 2.0(aprrox.). I divide 120 by these to get the size. Now, this is how I move my image: aButton = new Image(skinCydeonWorld, "a-button"); layer.addActor(aButton); aButton.setSi…
type: Question
type: AnsweredQuestion
tagged with: libgdx
tagged with: math
upvote count: 2
has comment: http://stackoverflow.com/comment/36017585
answer count: 1
accepted answer: http://stackoverflow.com/a/23504644
favorite count: 0
tagged with: drag-and-drop
has title: Libgdx - Actor's position is incorrect
has answer: http://stackoverflow.com/a/23504644
tagged with: input
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/36057531
type: QuestionComment
type: Comment
has text: Please tag the RDBMS which you are using, as the answer may likely be sql platform-dependent.
comment on: http://stackoverflow.com/q/23509903
score: 0

http://stackoverflow.com/comment/36194277
type: AnswerComment
has text: ur code wont work... it has last sysout line outside any method, so it wont compile itself...other than that u r trying to print count variable, which is not defined...
type: Comment
comment on: http://stackoverflow.com/a/23583014
score: 0

http://stackoverflow.com/a/23595765
score: 13
upvote count: 13
has comment: http://stackoverflow.com/comment/36217952
type: Answer
has body: set.iterator().next() Do so only if you are sure there is an element in the set. Otherwise next() will throw an exception.
downvote count: 0
answers question: http://stackoverflow.com/q/23595749

http://stackoverflow.com/comment/35970104
has text: I have tried many such workarounds, sort of uninstalling and reinstalling IntelliJ.
comment on: http://stackoverflow.com/q/23462940
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23548372
downvote count: 0
score: 1
tagged with: java
has title: java class property binding to swing component
type: Question
tagged with: binding
upvote count: 1
answer count: 1
has body: I'm coming from .net world, but I have to make a small GUI application in Java. I would like to achieve that I have a class with some properties and I want to bind the properties to swing components (textfield, combo box) on a JDialog, JFrame. There are many threads in the net talking about this, but I was not able to achieve the stuff to be working on my case. I have a class with a property PropertyChangeSupport, and addPropertyChangeListener and removePropertyChangeListener methods. In the GUI I could bind the JTextField text attribute to the class instance property. the JDialog is implementing the PropertyChangeListener but if I write something to the text box nothing is updating in the class property. Can you point me a complete tutorial about this issue? thanks!
favorite count: 0
has answer: http://stackoverflow.com/a/23549857
accepted answer: http://stackoverflow.com/a/23549857
tagged with: swing
has comment: http://stackoverflow.com/comment/36133605
type: AnsweredQuestion

http://stackoverflow.com/q/23545851
tagged with: cxf
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/37279899
accepted answer: http://stackoverflow.com/a/23663732
has comment: http://stackoverflow.com/comment/37566307
tagged with: kerberos
tagged with: dynamics-crm-2011
has comment: http://stackoverflow.com/comment/36472857
possible better answer: http://stackoverflow.com/a/23617579
downvote count: 0
has answer: http://stackoverflow.com/a/23617579
has comment: http://stackoverflow.com/comment/37566014
type: Question
type: AnsweredQuestion
score: 3
has title: Calling Microsoft CRM 2011 On-premise web service with CXF
tagged with: ws-security
favorite count: 0
has answer: http://stackoverflow.com/a/23663732
answer count: 2
has body: I am attempting to integrate a Java application with our on-premise Microsoft CRM 2011 using its native web-services. My offset is the description in this blog post and my code does not differ much, but I am now stuck with a org.apache.ws.security.WSSecurityException: The signature or decryption was invalid I am able to retrieve both TGT and service ticket from Active Directory and gets a Krb5Context created before the web-service is called and CXF fails on the response - which appears to be an error, but as it cannot be decrypted, it is not helpful in diagnosing the problem. (The full stack-trace and SOAP-response is included below.) I am using CXF version 2.7.11, although I have also tried a number of other versions to see if that made any difference. My biggest concern is probably, whether the Kerberos configuration is correct, as it is hard to find good documentation of the requirements for this. My code: System.setProperty("java.security.auth.login.config", "crm-integration/src/main/resources/login.conf"); System.setProperty("java.security.krb5.conf", "crm-integration/src/main/resources/krb5.conf"); OrganizationService service = new OrganizationService(new URL("http://192.168.20.88/XRMServices/2011/Organization.svc?singleWsdl")); IOrganizationService port = service.getPort(IOrganizationService.class); Client client = ClientProxy.getClient(port); Bus bus = ((EndpointImpl) client.getEndpoint()).getBus(); bus.getProperties().put("soap.no.validate.parts", true); PolicyInterceptorProviderRegistry policyInterceptorProviderRegistry = bus.getExtension(PolicyInterceptorProviderRegistry.class); policyInterceptorProviderRegistry.register(new XRMAuthPolicyProvider()); HTTPConduit http = (HTTPConduit) client.getConduit(); HTTPClientPolicy httpClientPolicy = http.getClient(); httpClientPolicy.setAllowChunking(false); //Enable logging - remove when solution is working System.setProperty("sun.security.krb5.debug", "true"); client.getInInterceptors().add(new LoggingInIntercepto…

http://stackoverflow.com/q/23613495
type: Question
has comment: http://stackoverflow.com/comment/36251392
upvote count: 0
has comment: http://stackoverflow.com/comment/36251141
has comment: http://stackoverflow.com/comment/36251167
has comment: http://stackoverflow.com/comment/36251351
has comment: http://stackoverflow.com/comment/36251084
has comment: http://stackoverflow.com/comment/36251099
answer count: 1
has title: Java program does not run and throws an error about classes
has answer: http://stackoverflow.com/a/23613526
favorite count: 0
has comment: http://stackoverflow.com/comment/36251142
has comment: http://stackoverflow.com/comment/36251095
accepted answer: http://stackoverflow.com/a/23613526
has comment: http://stackoverflow.com/comment/36251039
score: -3
has comment: http://stackoverflow.com/comment/36251057
has comment: http://stackoverflow.com/comment/36251327
has comment: http://stackoverflow.com/comment/36251459
has comment: http://stackoverflow.com/comment/36251418
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36251216
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36251042
has body: So I want to run my just compiled Start.class file that I compiled from Start.java. The problem is that it will throw this error: java Start Exception in thread "main" java.lang.NoClassDefFoundError: Start (wrong name: files/Start) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482) I have written the program in Eclipse and I want to run it from a Terminal. What is the problem here? New error: java files.Start http://mirror.symnds.com/software/Apache/tomcat/tomcat-7/v7.0.53/bin/apache-tomcat-7.0.53.zip Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/io/IOUtils at files.Start.main(Start.java:93) Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.IOUtils 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) ... 1 more
has comment: http://stackoverflow.com/comment/36251284

http://stackoverflow.com/comment/36155609
has text: @ArtjomB. Yup, that's exaclty what I meant with "translate a Set to an ad-hoc List".
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23562594

http://stackoverflow.com/a/23552431
type: Answer
has body: There is something wrong in your approach. You shouldn't hold all your application waiting for server. If I understand, some data from server is required before client is initialized. Maybe you should put them in your host page? Or move initialization of presenters to other methods and execute these methods by events.
answers question: http://stackoverflow.com/q/23540577
score: 0

http://stackoverflow.com/q/23570607
type: UnansweredQuestion
tagged with: mahout
upvote count: 1
tagged with: collaborative-filtering
score: 1
tagged with: java
tagged with: eclipse
has title: Mahout returning same results in sequentials runs
type: Question
downvote count: 0
favorite count: 0
answer count: 0
has body: I'm trying an Apache Mahout example using the code bellow. Everything works fine except that each time I change the userId value I need to run the class twice so that new values are returned. What I mean by that, is that every time I run it, the previous run output is showed, even with a different userId and that user recommendations. I've tried not using the cache recommender but that hasn't worked either. I'm using Eclipse IDE and the code of the class is the following: DataModel model = new FileDataModel(new File("database.csv")); UserSimilarity userSimilarity = new LogLikelihoodSimilarity(model); System.out.println("Method: " + userSimilarity.getClass().getName().substring(userSimilarity.getClass().getName().lastIndexOf(".") + 1)); int neighborhood= 25; System.out.println("Neighborhood: " + neighborhood); UserNeighborhood neighborhood = new NearestNUserNeighborhood(neighborhood, userSimilarity, model); Recommender recommender = new GenericUserBasedRecommender(model, neighborhood, userSimilarity); Recommender cachingRecommender = new CachingRecommender(recommender); int userId = 1234; System.out.println("User ID: " + userId); List&lt;RecommendedItem&gt; recommendations = cachingRecommender.recommend(userId, 15); System.out.println("Recomendations:"); for (RecommendedItem r : recommendations) { System.out.println(r.getItemID() + " " + r.getValue()); }

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/23513118
tags question: http://stackoverflow.com/q/23596457
tag name: android-gridview
tags question: http://stackoverflow.com/q/23517404

http://stackoverflow.com/comment/36280136
comment on: http://stackoverflow.com/a/23626131
has text: where are you writing your callout
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36138095
type: Comment
has text: Same problem though. The static initializer runs as soon as your class is loaded, which is probably well before the spring application context has had time to load -- however it's booted.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23550291

key-bindings
tags question: http://stackoverflow.com/q/23486827
tag name: key-bindings
tags question: http://stackoverflow.com/q/23468884
tags question: http://stackoverflow.com/q/23467239
type: Tag

http://stackoverflow.com/comment/36092301
type: Comment
comment on: http://stackoverflow.com/q/23527955
type: QuestionComment
has text: that didn't work when I tried to add an if statement to check for next int to each of line 2, 3 ,4.
score: 0

http://stackoverflow.com/comment/58493063
score: 0
type: Comment
has text: Why are you responding to my resolved question from year and a half ago and what is more you just copied the answer which already was marked as correct?
comment on: http://stackoverflow.com/a/35390563
type: AnswerComment

http://stackoverflow.com/comment/36252007
score: 0
has text: What exactly is your question ? The code you posted does what you said in title. Terminates when you read all data from the input. Use more words please.
type: Comment
comment on: http://stackoverflow.com/q/23613383
type: QuestionComment

http://stackoverflow.com/comment/35984273
type: Comment
type: QuestionComment
has text: Also the method to set the command list is `command(...)` not `setCommand(...)`
comment on: http://stackoverflow.com/q/23468347
score: 0

http://stackoverflow.com/a/23620579
answers question: http://stackoverflow.com/q/23612593
type: Answer
accepted answer of: http://stackoverflow.com/q/23612593
has comment: http://stackoverflow.com/comment/36265466
has body: Well, I hope you can still recognize some of the code :) import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; final class JceSha1Test { public static void main(final String ... args) { final String strHashInput = "JAO21V279RSNHYGX23L0"; final byte[] strHash = hashPassword(strHashInput); System.out.println("strHash: " + toHex(strHash)); final ByteBuffer strHashBuffer = ByteBuffer.wrap(strHash); strHashBuffer.order(ByteOrder.LITTLE_ENDIAN); final long test = strHashBuffer.getLong(); System.out.println(test); } public static byte[] hashPassword(final String password) { final byte[] encodedPassword = password.getBytes(StandardCharsets.UTF_8); final MessageDigest algorithm; try { algorithm = MessageDigest.getInstance("SHA-1"); } catch (final NoSuchAlgorithmException e) { throw new IllegalStateException(e); } return algorithm.digest(encodedPassword); } public static String toHex(final byte[] data) { final StringBuilder sb = new StringBuilder(data.length * 2); for (int i = 0; i &lt; data.length; i++) { sb.append(String.format("%02X", data[i])); } return sb.toString(); } }
upvote count: 1
has comment: http://stackoverflow.com/comment/36352895
score: 1
has comment: http://stackoverflow.com/comment/36346393
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36168930
comment on: http://stackoverflow.com/q/23569576
score: 1
has text: @Lighthat Eh, no, that's not correct.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23541296
tagged with: lucene
score: 0
has body: I am using Lucene to count words (see example bellow). My question is how can I set my own filters in Lucene? For example to add my custom StopFilter, ShingleFilter, etc. I suppose that some token stream filter(s) is already being used since Hello, hello and HELLO are converted to "hello". public class CountWordsExample { public static void main(String[] args) throws IOException { RAMDirectory directory = new RAMDirectory(); IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig( Version.LUCENE_47, new StandardAnalyzer(Version.LUCENE_47))); Document document = new Document(); document.add(new TextField("foo", "Hello hello how are you", Store.YES)); document.add(new TextField("foo", "hello how are you", Store.YES)); document.add(new TextField("foo", "HELLO", Store.YES)); writer.addDocument(document); writer.commit(); writer.close(true); // ShingleFilter shingle = new ShingleFilter(input); IndexReader indexReader = DirectoryReader.open(directory); Bits liveDocs = MultiFields.getLiveDocs(indexReader); Fields fields = MultiFields.getFields(indexReader); for (String field : fields) { TermsEnum termEnum = MultiFields.getTerms(indexReader, field) .iterator(null); BytesRef bytesRef; while ((bytesRef = termEnum.next()) != null) { if (termEnum.seekExact(bytesRef)) { DocsEnum docsEnum = termEnum.docs(liveDocs, null); if (docsEnum != null) { int doc; while ((doc = docsEnum.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) { System.out .println(bytesRef.utf8ToString() + " in doc " + doc + ": " + docsEnum.freq()); } } } } } for (String field : fields) { TermsEnum termEnum = MultiFields.getTerms(indexReader, field) .iterator(null); BytesRef bytesRef; while ((bytesRef = termEnum.next()) != null) { int freq = indexReader.docFreq(new Term(field, bytesRef)); System.out.println(bytesRef.utf8ToString() + " in " + freq + " documents"); } } } } Output: hello in doc 0: 4 how in doc 0: 2 you in doc 0: 2 hello in 1 documents how in 1 documents you in 1 documents
has title: Lucene Customize TokenStream
type: UnansweredQuestion
tagged with: text
tagged with: java
tagged with: analysis
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23542668

http://stackoverflow.com/comment/36018897
score: 0
has text: What is your code doing wrong ? What is the list of random numbers generated by your code ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23489518

http://stackoverflow.com/q/23488222
has comment: http://stackoverflow.com/comment/36021107
accepted answer: http://stackoverflow.com/a/23490895
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36020647
tagged with: java
tagged with: swt
tagged with: windowbuilder
type: Question
tagged with: eclipse
has body: I installed WindowBuilder to Eclipse and created program that consist of one class. This class is generated directly by WinowsBuilder and only contains one empty window. I can run this program on eclipse. I exported program to jar file, but it throws error when i try to launch it. Error says that "The Java JAR "gui.jar" could not be launched." Tried to follow this tutorial http://wiki.eclipse.org/FAQ_How_do_I_create_an_executable_JAR_file_for_a_stand-alone_SWT_program%3F but it still not working. update: when launching jar file via terminal i got following error: Exception in thread "main" java.lang.NoClassDefFoundError: swing2swt/layout/BorderLayout at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2531) at java.lang.Class.getMethod0(Class.java:2774) at java.lang.Class.getMethod(Class.java:1663) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) Caused by: java.lang.ClassNotFoundException: swing2swt.layout.BorderLayout 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) ... 6 more How should I export SWT application as stand alone jar?
has comment: http://stackoverflow.com/comment/36017749
has answer: http://stackoverflow.com/a/23490895
score: 0
has title: export SWT app as jar file
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/36021279
has comment: http://stackoverflow.com/comment/36019897
has comment: http://stackoverflow.com/comment/36021066

http://stackoverflow.com/q/23518206
favorite count: 0
tagged with: spring-webflow
type: UnansweredQuestion
has title: Lower the size of a Webflow persistance-context using a read-only second level cache
tagged with: spring
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
has body: I'm trying to improve the performance of a Java 7,Spring 3.1,Webflow 3.1,Hibernate 3.6 application. The main issue is for each user there Web-flow persistance-context is very large and the application runs out of RAM quickly. Most of the data in the context is read only entity data, static data like labels, lists etc ... that can be shared across these Web-flow persistance-contexts. After reading a number of posts on caching and performance I believe the best approach is to use a second level cache and mark these objects as read only. This will share these objects across each persistance-context. However my question is when these objects are loaded from the shared cache does the Web-flow persistance-context share a reference to a global ready-only entity or will there be a copy of this read-only entity in each Web-flow persistance-context i.e the look up will be faster but the size of the contexts will stay the same? Thanks
upvote count: 1
type: Question
tagged with: caching
downvote count: 0

http://stackoverflow.com/q/23610415
tagged with: audio-processing
upvote count: 2
has title: Time delay of sound files using cross correlation
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23610825
tagged with: signal-processing
type: Question
has body: I'm trying to speed up my algorithm of time delay estimation between two sound files in Java. My idea was to use cross correlation and search for the highest value which gives me the amount of samples that are delayed. I've done this and its working just fine. I created some sample files and then calculated the time delay. The result is pretty good. The problem is, that the algorithm takes a lot of time because of the large amount of operations. Is there any way to speed this up? /** * Input vector for signal x1 (reference). */ private double[] x1; /** * Input vector for signal x2 (test). */ private double[] x2; /** * Execute the cross correlation between signal x1 and x2 and calculate the time delay. */ public void execCorrelation() { // define the size of the resulting correlation field int corrSize = 2*x1.length; // create correlation vector out = new double[corrSize]; // shift variable int shift = x1.length; double val; int maxIndex = 0; double maxVal = 0; // we have push the signal from the left to the right for(int i=0;i&lt;corrSize;i++) { val = 0; // multiply sample by sample and sum up for(int k=0;k&lt;x1.length;k++) { // x2 has reached his end - abort if((k+shift) &gt; (x2.length -1)) { break; } // x2 has not started yet - continue if((k+shift) &lt; 0) { continue; } // multiply sample with sample and sum up val += x1[k] * x2[k+shift]; //System.out.print("x1["+k+"] * x2["+(k+tmp_tau)+"] + "); } //System.out.println(); // save the sample out[i] = val; shift--; // save highest correlation index if(out[i] &gt; maxVal) { maxVal = out[i]; maxIndex = i; } } // set the delay this.delay = maxIndex - x1.length; }
has comment: http://stackoverflow.com/comment/36249144
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36247288
tagged with: cross-correlation
has comment: http://stackoverflow.com/comment/36247310
has answer: http://stackoverflow.com/a/23610825

http://stackoverflow.com/comment/36145878
has text: Start putting back lines until it breaks again...
comment on: http://stackoverflow.com/q/23556371
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23477232
has comment: http://stackoverflow.com/comment/35996262
answers question: http://stackoverflow.com/q/23477153
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35996622
upvote count: 1
has body: YOu declare incorrectAnswers, you assign incorrectAnswers. But then you do nothing with it. If it merely holds a value, but nothing else cares, the Java compiler will do exactly what it should - tell you that its not used and will likely not bother to generate code for it.
type: Answer

http://stackoverflow.com/comment/36052282
type: AnswerComment
score: 0
type: Comment
has text: This [sample](https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-flyway) has autoconfig for everything and it works (with 1.1.0, but I'm sure something siumilar would have to work for 1.0.x).
comment on: http://stackoverflow.com/a/23467458

http://stackoverflow.com/q/23595463
has comment: http://stackoverflow.com/comment/36220426
score: 1
tagged with: ibm-was
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42224104
tagged with: eclipse-marketplace
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42231700
tagged with: websphere-8
favorite count: 0
has comment: http://stackoverflow.com/comment/41881035
has body: I have Eclipse Kepler running on my computer. After I installed IBM Websphere 8.5 plug-in from the marketplace and restarted my Kepler, I'm not able to re-open the marketplace. A progress bar is being displayed that says "Retrieving data from http://marketplace.eclipse.org" for 30 minutes plus. When I uninstall the plug-in, the marketplace works fine. Why is this happening? Can anyone help me out in figuring? Appreciate your help. PS : there is no issue while accessing the link from a browser. Thanks, Madhu. UPDATE The below error is logged when clicking on "Install new software" exception !STACK 1 org.eclipse.equinox.p2.core.ProvisionException: Unable to read repository at http://download.eclipse.org/webtools/repository/kepler/compositeContent.xml. at org.eclipse.equinox.internal.p2.repository.CacheManager.createCache(CacheManager.java:192) at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory.getLocalFile(CompositeMetadataRepositoryFactory.java:73) at org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepositoryFactory.load(CompositeMetadataRepositoryFactory.java:98) at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.factoryLoad(MetadataRepositoryManager.java:57) at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:768) at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.loadRepository(AbstractRepositoryManager.java:668) at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:96) at org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager.loadRepository(MetadataRepositoryManager.java:92) at org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob.doLoad(LoadMetadataRepositoryJob.java:117) at org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob.runModal(LoadMetadataRepositoryJob.java:102) at org.ecl…
type: UnansweredQuestion
has title: Eclipse marketplace not working after installing WAS 8.5 plug-in
has answer: http://stackoverflow.com/a/26635359
upvote count: 1
has comment: http://stackoverflow.com/comment/37573646
has comment: http://stackoverflow.com/comment/36217736

http://stackoverflow.com/q/23560547
type: Question
has comment: http://stackoverflow.com/comment/36155108
score: 0
has title: Internal Frame Listener not working
has comment: http://stackoverflow.com/comment/36152750
has comment: http://stackoverflow.com/comment/36166546
has body: The following code below shows an internal frame listener for the Gui class. The internal frame listener should either set the save (JMenuItem) as enable or disabled but it does nothing. I don't know where the problem is. I have tried a couple of things but nothing works. Here is the code: public class Gui implements InternalFrameListener, ActionListener{ MyInternalFrame frame; JMenuItem save; public Gui( JDesktopPane desktop, final JMenuItem save) { // TODO Auto-generated constructor stub frame = new MyInternalFrame(title, img); this.save = save; frame.setVisible(true); desktop.add(frame); try { frame.setSelected(true); } catch (java.beans.PropertyVetoException e) { } frame.addInternalFrameListener(this); // options(name, desktop); } class MyInternalFrame extends JInternalFrame { static final int xPosition = 30, yPosition = 30; public MyInternalFrame(String title, ImagePlus img) { super(title, true,true, true, true); setSize(img.getHeight(), img.getWidth()); // Set the window's location. setLocation(xPosition * openFrameCount, yPosition * openFrameCount); } } public void actionPerformed(ActionEvent e){ frame.addInternalFrameListener(this); System.out.println("beingg called"); } @Override public void internalFrameActivated(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(true); } @Override public void internalFrameClosed(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(false); } @Override public void internalFrameClosing(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(false); } @Override public void internalFrameDeactivated(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(false); } @Override public void internalFrameDeiconified(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(true); } @Override public void internalFrameIconified(InternalFrameEvent arg0) { // TODO Auto-generated method stub save.setEnabled(false); } @Overri…
tagged with: user-interface
answer count: 1
tagged with: jinternalframe
favorite count: 0
has answer: http://stackoverflow.com/a/23571304
accepted answer: http://stackoverflow.com/a/23571304
has comment: http://stackoverflow.com/comment/36162723
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1

http://stackoverflow.com/q/23501042
has body: I have a long list of Code Templates in NetBeans and I want to sort them somehow because I don't remember all of them. The abbreviation for my code templates is: user_template, something like this: alpha_sop wich does: System.out.println(${cursor}); Also another one: alpha_psvm public static void main(String[] args) { ${cursor} } And many many more... Is there a way that after I write alpha_ and press ctrl+space a list of all available templates that contain alpha_ dropdown in a list? Id kinda like to select from my own list... Something like: alpha_ ctrl+space *Dropdown* alpha_psvm (with description of code) alpha_sop (with description of code)
type: AnsweredQuestion
tagged with: netbeans
possible better answer: http://stackoverflow.com/a/23501614
has answer: http://stackoverflow.com/a/23501614
tagged with: java
has answer: http://stackoverflow.com/a/52493130
type: Question
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23514461
has title: Netbeans Code assistance on code templates
accepted answer: http://stackoverflow.com/a/23514461

http://stackoverflow.com/comment/36241677
type: Comment
comment on: http://stackoverflow.com/q/23608537
score: 0
type: QuestionComment
has text: For what input are you getting the wrong result? What result do you get and what should it be? Please don't make us guess.

http://stackoverflow.com/comment/36062551
score: 0
type: AnswerComment
type: Comment
has text: No, my design wouldn't need new instances, because a new Thread is created, but that all threads use the same instance of Worker.
comment on: http://stackoverflow.com/a/23512515

http://stackoverflow.com/comment/36041231
type: AnswerComment
score: 0
type: Comment
has text: I'm not disagreeing with anything here. Those are the preferred ways of handling something such as this. However, OP was ultimately misunderstanding threads, not sockets. Probably best to understand how threads work before trying to use higher-level constructs that abstract threads away ;)
comment on: http://stackoverflow.com/a/23500990

http://stackoverflow.com/comment/36229053
score: 1
type: Comment
has text: can you provide the full stacktrace?
type: QuestionComment
comment on: http://stackoverflow.com/q/23601690

http://stackoverflow.com/q/23494084
has title: How to access a class whose .java file has no package statement?
has comment: http://stackoverflow.com/comment/36027959
has answer: http://stackoverflow.com/a/32564807
upvote count: 3
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/283816
has comment: http://stackoverflow.com/comment/36027410
tagged with: import
type: Question
has comment: http://stackoverflow.com/comment/36027171
score: 3
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36027532
has comment: http://stackoverflow.com/comment/36027704
favorite count: 0
linked to: http://stackoverflow.com/q/2193226
has body: I'm just curious about something. Say I have the following environment: Folder structure - projects \ prj1 \ src \ pkgs \ main (contains Main.java) \ test (contains TestClass.java) Main.java - package pkgs.main; import pkgs.test.TestClass; class Main { public static void main(String[] args) { TestClass tc; } } Java shell based compilation commmands - javac -d ..\cls -sourcepath ..\src ..\src\pkgs\main\Main.java java -classpath ..\cls pkgs.main.Main If I then make a .java code file called Default.java, that doesn't have a package statement - public class Default {} and place this file in the src folder, how can a class file such as Main.java access this Default class? I tried using the following import statements, but neither worked, causing compilation errors: Main.java - package pkgs.main; // import Default; (causes many compilation error messages) // import .Default; (causes "identifier expected" compilation error) I also moved the Default.java file from the src folder, in to the same folder that contained Main.java, but that didn't work either. I appreciate that this whole idea seems like bad design, but I'm only doing it in order to learn a bit more about how the package and import statements work, alongside the project folder structure. Thanks.
tagged with: package
has comment: http://stackoverflow.com/comment/36027376

http://stackoverflow.com/comment/36254911
type: Comment
has text: I don't have a web.xml file. I did not think I needed one since I was using Annotations. The Application class is the UserInfo class in the original post (unless I am mis-understanding your request). Do I need the web.xml file?
score: 0
comment on: http://stackoverflow.com/q/23614238
type: QuestionComment

http://stackoverflow.com/comment/36194849
comment on: http://stackoverflow.com/a/23574772
type: AnswerComment
score: 0
type: Comment
has text: It change nothing .. The result is the same, I really don't understand :/

http://stackoverflow.com/q/23463951
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/35972292
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/35972311
score: 0
favorite count: 0
type: UnansweredQuestion
tagged with: animation
has comment: http://stackoverflow.com/comment/36034902
has comment: http://stackoverflow.com/comment/35972206
has title: Snake body appears as a straight line
answer count: 0
has body: I am making a snake game; snake moves behind the cursor. The snake movement is working perfectly but its body appears as a line of circle. Where as the circles are supposed to appear in there own boxes.I debugged the program and tried to figure out the problem, but after getting the values of x positions and y positions of every circle i m confused because it shows a gap of 20 pixels(size of circle) in btw every circle, so it should show them in their own boxes but its not. I can't figure out where is the problem, and this is my code of class which draws snake and moves it: `import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import javax.swing.JFrame; import javax.swing.JPanel; public class Game extends JPanel implements MouseMotionListener { int x_Cur; int y_Cur; int dots; int delta_x, delta_y; double angle; double x_inc, y_inc; double speed = 5.0; int max_points = (600 * 600); final int x_positions[] = new int[max_points]; final int y_positions[] = new int[max_points]; public Game() { addMouseMotionListener(this); setFocusable(true); setPreferredSize(new Dimension(600, 600)); setVisible(true); first_Snake(); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.green); for (int z = 0; z &lt; dots; z++) { if (z == 0) { g.setColor(Color.yellow); g.fillOval(x_positions[z], y_positions[z], 20, 20); } else { g.setColor(Color.green); g.fillOval(x_positions[z], y_positions[z], 20, 20); } System.out.println("xs"+z+"="+x_positions[z]+"\n"+"ys"+z+"="+y_positions[z]); } try { Thread.sleep(10); } catch (Exception e) { } delta_x = x_Cur - x_positions[0]; delta_y = y_Cur - y_positions[0]; angle = Math.atan2(delta_y, delta_x); double speed = Math.sqrt(delta_x * delta_x + del…
tagged with: java

http://stackoverflow.com/q/23511786
has answer: http://stackoverflow.com/a/23511842
type: AnsweredQuestion
has title: Not able to add the values to the list
accepted answer: http://stackoverflow.com/a/23512144
has answer: http://stackoverflow.com/a/23511974
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/23511844
has body: Hi i am trying to add the values to list as show in below code. i am getting error. for (String n2 : number ) { List&lt;String&gt; ARRAY = new ArrayList&lt;String&gt;(); if (!ARRAY.contains(number)) { ARRAY.add(number); }} But getting error while adding the number in to list. error java:271: error: no suitable method found for add(List&lt;String&gt; ARRAY.add(number); ^ method List.add(int,String) is not applicable (actual and formal argument lists differ in length) method List.add(String) is not applicable (actual argument List&lt;String&gt; cannot be converted to String by method invo if i use like below for (String n2 : number ) { List&lt;String&gt; ARRAY = new ArrayList&lt;String&gt;(); if (!ARRAY.contains(n2)) { Email(n2); ARRAY.add(n2); } } if i am using above. Though already email sent with value n2 again it is sending again. For first it has to sent but for second time since it is already in array it should not sent right?
possible better answer: http://stackoverflow.com/a/23511857
has comment: http://stackoverflow.com/comment/36063586
has answer: http://stackoverflow.com/a/23511857
answer count: 6
has answer: http://stackoverflow.com/a/23544615
score: 0
tagged with: java
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23512144

http://stackoverflow.com/q/23504819
has comment: http://stackoverflow.com/comment/41233348
has answer: http://stackoverflow.com/a/63431569
has answer: http://stackoverflow.com/a/77350705
has comment: http://stackoverflow.com/comment/36053433
has answer: http://stackoverflow.com/a/42689331
tagged with: java
has comment: http://stackoverflow.com/comment/36193071
linked to: http://stackoverflow.com/q/859111
has comment: http://stackoverflow.com/comment/36075550
type: Question
score: 81
has answer: http://stackoverflow.com/a/75719404
has answer: http://stackoverflow.com/a/58291331
has answer: http://stackoverflow.com/a/28055699
upvote count: 82
has answer: http://stackoverflow.com/a/24491820
answer count: 13
tagged with: self-signed
has answer: http://stackoverflow.com/a/33619237
has answer: http://stackoverflow.com/a/71905635
has answer: http://stackoverflow.com/a/23506093
has answer: http://stackoverflow.com/a/74489654
has comment: http://stackoverflow.com/comment/105426510
has answer: http://stackoverflow.com/a/61461406
favorite count: 0
linked to: http://stackoverflow.com/q/18476073
has body: I am trying to write an integration test where our test launches an embedded HTTPS server using Simple. I created a self-signed certificate using keytool and am able to access the server using a browser (specifically Chrome, and I do get a warning about the self-signed certificate). However, when I try to connect using Spring RestTemplate, I get a ResourceAccessException: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://localhost:8088":sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:557) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:502) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:444) at net.initech.DummySslServer.shouldConnect(DummySslServer.java:119) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 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.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunne…
linked to: http://stackoverflow.com/q/4072585
tagged with: resttemplate
accepted answer: http://stackoverflow.com/a/24491820
tagged with: spring
has answer: http://stackoverflow.com/a/57765746
downvote count: 1
type: AnsweredQuestion
has title: How to disable SSL certificate checking with Spring RestTemplate?
possible better answer: http://stackoverflow.com/a/42689331

http://stackoverflow.com/comment/36109662
type: Comment
type: QuestionComment
has text: ok, sry my bad i tought that the second argument was the exit condition but i think i just expressed it wrongly.
score: 0
comment on: http://stackoverflow.com/q/23537824

http://stackoverflow.com/a/23552046
score: 2
accepted answer of: http://stackoverflow.com/q/23550241
upvote count: 2
has comment: http://stackoverflow.com/comment/36242297
has body: When you implement bodyCall(Node[], int, RuleContext) or headAction(Node[], int, RuleContext) as part of implementing a Builtin, you are given an array of arguments that represents the arguments to to the builtin. In a rule, you can hand any number of variables to the the builtin (not only one). It loosely seems like (and you can correct me if I am misinterpreting your question) that you are looking to work over some class expression in order to get the data that you need. If your overall goal is to operate on 'a class of data', then there are multiple ways to achieve this. (easiest) Formulate your class expression as statements within the body of the rule. This will ensure that your builtin is passed only individuals of the appropriate class. Chaining together multiple preconditions can allow you to only operate on certain individuals (a 'class of data'). (potentially nontrivial) If you intend to have your builtin operate on a class, use the RuleContext passed to your bodyCall(...) or headAction(...) in order to find individuals that satisfy your class expression (by calling RuleContext#find(...) or some other method). As an example, let's say that we wanted to act on each member of the class urn:ex:Question. In the first solution, we'd formulate a rule similar to the following: [eachIndividual: (?x rdf:type urn:ex:Question) -&gt; builtin(?x)] This would ensure that we'd operate on every single instance of urn:ex:Question. An example of the second solution would be to pass the class expression to your builtin directly. Your question does not indicate how you would identify the class in question, so I will arbitrarily assume that you are interested in classes which are rdfs:subClassOf urn:ex:Question. [eachSubclass: (x? rdfs:subClassof urn:ex:Question) -&gt; builtin(?x)] In this case, you would need to somehow operate on your 'class of data' within your builtin. As mentioned previously, you could potentially use the RuleContext to do so. EDIT Let us assume that you …
has comment: http://stackoverflow.com/comment/36243434
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23550241

http://stackoverflow.com/comment/36139227
score: 0
type: Comment
has text: Setting sprites origin to the screens origin won't actually set sprites origin in the middle. Instead it would probably set it somewhere out of screen (just guessing I don't know the size of the sprite or the screen). You are missing a point here. I will edit my answer.
comment on: http://stackoverflow.com/a/23551072
type: AnswerComment

http://stackoverflow.com/comment/36100338
type: QuestionComment
comment on: http://stackoverflow.com/q/23532446
score: 0
has text: Are you sure that habit row got deleted from the table? please get the number of rows in the table before and after deletion and compare it.
type: Comment

http://stackoverflow.com/comment/36124798
score: 1
type: Comment
comment on: http://stackoverflow.com/q/23545352
type: QuestionComment
has text: I see (and also in the API documentation, not only the EclipseLink docs), pardon my ignorance. I have no further suggestions other than "you're using an up to date version of EclipseLink right?", so I'll just slither back into the shadows.

http://stackoverflow.com/q/23504236
has title: Java based configuration for Spring imap-idle-channel-adapter
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23504465
tagged with: spring
tagged with: spring-integration
tagged with: java
type: Question
has body: I try to find answer in google. It wasn't successful. Is it possible to configure imap-idle-channel-adapter using Spring java based configuration. I want to get inbox messages for current authenticated in application user. It means I can't hardcode username and password for store-uri.
score: 0
tagged with: jakarta-mail

http://stackoverflow.com/q/23555006
has body: I'm writing a basic notepad application on Swing. I have a Java Swing Menu. It's basically a JMenuBar with JMenus in it. One of the menus is a "Format"-menu with a "Font size" menu inside it(See image). The "font size" menu is supposed to have a list of numbers where I can choose the font size. But I can't seem to find a good solution for this. I've tried using JComboBox and JList, but I need the GUI looking like it does in the image. In other words, it can't be a collapsed-dropdown menu, nor can it be in it's own window. Anyone have any suggestions as to how I can do this? EDIT: Important to take notice of is that I need the values sent to an ActionListener. What you see in the image are just normal JMenuItems. But for me to send the int-values of each JMenuItem to an ActionListener I would need 3 different ActionListeners. And they would need to be hard coded.
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/23556804
downvote count: 1
tagged with: jmenuitem
type: Question
tagged with: actionlistener
upvote count: 2
answer count: 2
has title: How to code Java Swing menu list?
possible better answer: http://stackoverflow.com/a/23556804
accepted answer: http://stackoverflow.com/a/23555023
favorite count: 0
tagged with: jmenu
has answer: http://stackoverflow.com/a/23555023

http://stackoverflow.com/comment/108314399
has text: @sleske You say: "...OP's code does not use withZone…" But the code presented by OP does use `withZone(…)`, see above. So the mentioned JDK-bug still matches the problem of not really setting the zone in those early JDK-versions. Anyway, the other big problems are: Usage of `ZonedDateTime.parse(…)` instead of `LocalDate.parse(…)` and the lack of clock-time-pattern part (if insisting on `ZonedDateTime.parse(…)`).
type: Comment
comment on: http://stackoverflow.com/a/23605733
type: AnswerComment
score: 0

http://stackoverflow.com/q/23572026
has comment: http://stackoverflow.com/comment/36173723
has comment: http://stackoverflow.com/comment/36173911
answer count: 1
has title: Table and Models in Swing
has comment: http://stackoverflow.com/comment/36173964
has body: The problem I have is that one of the screens of my system shows (graphically) a table with data from a person (ID, Name, Address, Phone,...). To handle this table, I made own model, a class that extends Abstract Table Model. Now, when the user chooses a person and squeezes a (delete) button, I have to know who this person is, and remove it from the database. So I need a message like "getPersona" (or something similar) then I tell a database manager the person I want to delete. The problem is that, thinking about the right design, I doubt who should give me the information I need: the table, using a message like "getSelectedRow"; or the model, using a message like "getPersonSelected".
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/23572151
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36173847

http://stackoverflow.com/comment/36217166
comment on: http://stackoverflow.com/q/23595071
has text: But when I generate the xml from the object, I receive an error. I would like to have them null, so I don't have them in my xml.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/132472003
score: 1
has text: @wilmol directly from [the book’s description on Amazon](https://www.amazon.de/dp/1617293563): “*Raoul-Gabriel Urma is CEO of Cambridge Spark. Mario Fusco is a senior software engineer at Red Hat. Alan Mycroft is a University of Cambridge computer science professor*” Where did you get the story from that either of them was a JDK developer?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23464794

http://stackoverflow.com/comment/36193329
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23580782
has text: I saw this in another application and so I took it from there. Unfortunately it's still not working even with your implementation. Is it right that `onServiceConnected` and `onBind` are called when `bindSerivce`is called?

http://stackoverflow.com/comment/36305114
has text: yes you should declare util:map outside of your `SettingsBean`
type: Comment
comment on: http://stackoverflow.com/a/23573601
score: 1
type: AnswerComment

http://stackoverflow.com/a/23592056
answers question: http://stackoverflow.com/q/23590755
type: Answer
has comment: http://stackoverflow.com/comment/36210851
has comment: http://stackoverflow.com/comment/36210757
score: 0
has body: You must start by understanding that an Applet, unless signed, may not read from the file system. It must use either classpath resources or things fetched from the same place it was fetched from. You have to decide which of these applies to you. If the image is a fixed image, you can put it in your classpath as a resource, and use Class.getResourceAsStream. If it's a different image every time, you'll have to use HTTP.
has comment: http://stackoverflow.com/comment/36211499

http://stackoverflow.com/a/40555272
answers question: http://stackoverflow.com/q/23512544
has body: I know this question is old, but I came upon it looking for an answer for a different situation. I think for your situation you could use inheritance for the forms and then use two controller methods: The forms would look like this: public class RegistrationForm { // Common fields go here. } public class UserRegistrationForm extends RegistrationForm { @NotNull private String firstName; @NotNull private String lastName; // getters / setters ... } public class CompanyRegistrationForm extends RegistrationForm { @NotNull private String companyName; // getters / setters ... } The controller methods would look like this: @RequestMapping(method = RequestMethod.POST, params = "isCompany=false") public void onRequest( @ModelAttribute("registerForm") @Valid UserRegistrationForm form, BindingResult result) { if (!result.hasErrors()) { // process registration } } @RequestMapping(method = RequestMethod.POST, params = "isCompany=true") public void onRequest( @ModelAttribute("registerForm") @Valid CompanyRegistrationForm form, BindingResult result) { if (!result.hasErrors()) { // process registration } } Notice that the @RequestMapping annotations include a params attribute so the value of the isCompany parameter determines which method is called. Also notice that the @Valid annotation is place on the form parameter. Finally, no groups are needed in this case.
score: 0
type: Answer

http://stackoverflow.com/q/23521721
has title: Tessart4j on unix machine
type: UnansweredQuestion
tagged with: unix
tagged with: ghostscript
favorite count: 0
type: Question
score: -2
tagged with: tesseract
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/23541766
answer count: 1
has body: I am using tess4j.jar to extract text from scanned PDF file (OCR files) in my java application.It is working fine with gsdll32.dll,liblept168.dll,libtesseract302.dll on windows machine. Now i have to deploy my java application on windows machine ,there i can't depend on .dll files . Is there any way to workout tess4j on unix machine.
upvote count: 0

http://stackoverflow.com/comment/36163066
score: 0
type: AnswerComment
has text: the sqlite being already implemented, I don't think switching to sharedprefs now would really be the best thing to do.
comment on: http://stackoverflow.com/a/23566356
type: Comment

http://stackoverflow.com/q/23524723
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36085676
tagged with: request
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/51969065
type: Question
tagged with: restful-url
has body: I am new to annotation and exploring out things. In my sample program .. a simple hello world using annotations in spring 4.0. This is the controller file code I have two annotated RequestMapping entries i.e one at class level and another at method level : package com.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; @Controller @RequestMapping(value = "/Hybrid") public class HybridController { @RequestMapping(value = "/test", method = RequestMethod.GET) public String getDemo(String name) { System.out.println("/MVC/Demo"); return "helloworld" ; } } If i put only the class level @RequestMapping it works with this url connecting to .../SpringRS/Hybrid or just only the method level to connect using .../SpringRS/test it works perfectly and displays me the helloworld.jsp. But when i try to put class and method request mapping together and invoke using this url : .../SpringRS/Hybrid/test, it don't work. Could some one explain what i need to make it work?. View resolver mapping: <context:component-scan base-package="com" /> <mvc:annotation-driven /> WEB-INF/views/ .jsp
has title: Spring 4.0 MVC RequestMapping at class and method level
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/28935044
linked to: http://stackoverflow.com/q/11203907

http://stackoverflow.com/a/23547735
type: Answer
has comment: http://stackoverflow.com/comment/36149650
score: 2
accepted answer of: http://stackoverflow.com/q/23536856
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23536856
downvote count: 0
has body: Unlike most regular android apps, Glassware typically launches a Service (which runs in the background) rather then an activity (which is a foreground task). Is is because a lot of the time you will want to interact with the timeline (i.e. add live cards etc) rather than take over the whole screen with an activity (or an immersion in Glass speak). In your manifest you are launching MainService with a voice command, but your code is in MainActivity. If you put your code to start the thread in the onStartCommand method of MainService that should start as soon as the app is launched from the menu/voice command. I hope that makes things clearer.
upvote count: 2

http://stackoverflow.com/comment/36189458
has text: As I said to your "colleague", it is absolutely correct what you are saying but the only classes I can change are ILOAD and Variable. I tried to say that variable has to be an int but then BlueJ says to me that String is required. I try to change in String and says that int are required.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23580561
type: AnswerComment

http://stackoverflow.com/comment/36031253
has text: http://stackoverflow.com/questions/306806/hibernate-automatically-creating-updating-the-db-tables-based-on-entity-classes
score: 0
comment on: http://stackoverflow.com/q/23495990
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23522747
has comment: http://stackoverflow.com/comment/36088638
has comment: http://stackoverflow.com/comment/36149360
type: Answer
has body: First of all, Java serialization isn't intended for object persistence, as the problem you are having highlights. There is however a workaround (which will get you going in the short term) - add a serialVersionUID to your class and do not change when you modify the class in ways that effect its serialized form. This is, imho, an abuse of the serialVersionUID but will fix your problem allowing you to add and remove fields at the expense that your system may become brittle if different JVMs use different versions of your class (there's ways to deal with this other than incrementing the serialVersionUID detailed in the link in @EJP's answer) as fields are set to default values meaning while your system may not throw exceptions when the results are not what the user expected and you have a subtle bug that's much harder to find than a serialization error. All classes get a serialVersionUID - one is generated by the serialization runtime if you haven't declared one. By declaring a serialVersionUID you're telling the serialization runtime, don't generate one because you know the serialized form of the classes is compatible with one built earlier, for example if you added a toString method after the initial compilation that required a rebuild or have taken steps to ensure different versions serialize correctly (again, the link in @EJP's answer).
score: 2
has comment: http://stackoverflow.com/comment/36108508
downvote count: 0
answers question: http://stackoverflow.com/q/23522228
has comment: http://stackoverflow.com/comment/36153421
has comment: http://stackoverflow.com/comment/36147193
has comment: http://stackoverflow.com/comment/36147986
has comment: http://stackoverflow.com/comment/36148461
upvote count: 2
has comment: http://stackoverflow.com/comment/36147420
has comment: http://stackoverflow.com/comment/36151357
has comment: http://stackoverflow.com/comment/36141040

http://stackoverflow.com/q/23572495
type: Question
score: -1
has title: adding to database error
has comment: http://stackoverflow.com/comment/36174623
tagged with: swing
answer count: 1
downvote count: 1
has body: I've create a database and I'm adding records from GUI. I also created a delete button. Once I delete a record and try to add a new one it gives me this error java.sql.SQLException: Incorrect integervalue:'javax.swing.JTextField[jTextField16,413,390,19x28,layout=javax.swing.plaf.basic.BasicTextUI$UpdateHandler,alignmentX=0.0,alignme' for column path at row1
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23572537
upvote count: 0
favorite count: 0

class
tags question: http://stackoverflow.com/q/23528559
tags question: http://stackoverflow.com/q/23502167
tags question: http://stackoverflow.com/q/23547684
tags question: http://stackoverflow.com/q/23555573
tags question: http://stackoverflow.com/q/23578189
tags question: http://stackoverflow.com/q/23477117
tags question: http://stackoverflow.com/q/23516262
tags question: http://stackoverflow.com/q/23577991
tags question: http://stackoverflow.com/q/23470490
tags question: http://stackoverflow.com/q/23502991
tags question: http://stackoverflow.com/q/23587213
tags question: http://stackoverflow.com/q/23521857
tags question: http://stackoverflow.com/q/23596368
tags question: http://stackoverflow.com/q/23528708
tags question: http://stackoverflow.com/q/23586308
tags question: http://stackoverflow.com/q/23535133
tags question: http://stackoverflow.com/q/23555129
tags question: http://stackoverflow.com/q/23555506
tags question: http://stackoverflow.com/q/23544210
tags question: http://stackoverflow.com/q/23518235
tags question: http://stackoverflow.com/q/23590101
type: Tag
tags question: http://stackoverflow.com/q/23496204
tags question: http://stackoverflow.com/q/23512102
tags question: http://stackoverflow.com/q/23534528
tags question: http://stackoverflow.com/q/23554455
tags question: http://stackoverflow.com/q/23583460
tags question: http://stackoverflow.com/q/23515914
tags question: http://stackoverflow.com/q/23516092
tags question: http://stackoverflow.com/q/23469099
tags question: http://stackoverflow.com/q/23473997
tags question: http://stackoverflow.com/q/23550456
tags question: http://stackoverflow.com/q/23507380
tags question: http://stackoverflow.com/q/23580276
tags question: http://stackoverflow.com/q/23585257
tags question: http://stackoverflow.com/q/23543595
tags question: http://stackoverflow.com/q/23470510
tags question: http://stackoverflow.com/q/23566397
tags question: http://stackoverflow.com/q/23534142
tags question: http://stackoverflow.com/q/23611122
tags question: http://stackoverflow.com/q/23598783
tags question: http://stackoverflow.com/q/23553108
tag name: class
tags question: http://stackoverflow.com/q/23508190
tags question: http://stackoverflow.com/q/23560146
tags question: http://stackoverflow.com/q/23570177
tags question: http://stackoverflow.com/q/23483903
tags question: http://stackoverflow.com/q/23592161
tags question: http://stackoverflow.com/q/23561871
tags question: http://stackoverflow.com/q/23460554
tags question: http://stackoverflow.com/q/23498514
tags question: http://stackoverflow.com/q/23585462
tags question: http://stackoverflow.com/q/23593868
tags question: http://stackoverflow.com/q/23496284
tags question: http://stackoverflow.com/q/23531969
tags question: http://stackoverflow.com/q/23519011
tags question: http://stackoverflow.com/q/23521502
tags question: http://stackoverflow.com/q/23460851
tags question: http://stackoverflow.com/q/23544288
tags question: http://stackoverflow.com/q/23494928

servlets
tags question: http://stackoverflow.com/q/23458939
tags question: http://stackoverflow.com/q/23615091
tags question: http://stackoverflow.com/q/23496839
tags question: http://stackoverflow.com/q/23590320
tags question: http://stackoverflow.com/q/23485338
tags question: http://stackoverflow.com/q/23597008
tags question: http://stackoverflow.com/q/23509903
tags question: http://stackoverflow.com/q/23492960
tags question: http://stackoverflow.com/q/23548823
tags question: http://stackoverflow.com/q/23494021
tags question: http://stackoverflow.com/q/23605720
tags question: http://stackoverflow.com/q/23501836
tags question: http://stackoverflow.com/q/23494026
tags question: http://stackoverflow.com/q/23465387
tags question: http://stackoverflow.com/q/23537325
tags question: http://stackoverflow.com/q/23549937
tags question: http://stackoverflow.com/q/23538066
tags question: http://stackoverflow.com/q/23540173
tags question: http://stackoverflow.com/q/23576608
tags question: http://stackoverflow.com/q/23487034
tags question: http://stackoverflow.com/q/23528540
tags question: http://stackoverflow.com/q/23499077
tags question: http://stackoverflow.com/q/23482202
tags question: http://stackoverflow.com/q/23488993
tags question: http://stackoverflow.com/q/23613071
tags question: http://stackoverflow.com/q/23514780
tags question: http://stackoverflow.com/q/23585082
tags question: http://stackoverflow.com/q/23589250
tags question: http://stackoverflow.com/q/23524900
tags question: http://stackoverflow.com/q/23538897
tags question: http://stackoverflow.com/q/23595928
tags question: http://stackoverflow.com/q/23606951
tags question: http://stackoverflow.com/q/23473693
tags question: http://stackoverflow.com/q/23473262
tags question: http://stackoverflow.com/q/23521978
tags question: http://stackoverflow.com/q/23513815
tags question: http://stackoverflow.com/q/23473931
tags question: http://stackoverflow.com/q/23455964
tags question: http://stackoverflow.com/q/23490147
tags question: http://stackoverflow.com/q/23489851
tags question: http://stackoverflow.com/q/23540215
tags question: http://stackoverflow.com/q/23615261
tags question: http://stackoverflow.com/q/23513439
tags question: http://stackoverflow.com/q/23569036
tags question: http://stackoverflow.com/q/23491515
tags question: http://stackoverflow.com/q/23473525
tags question: http://stackoverflow.com/q/23570796
tags question: http://stackoverflow.com/q/23536314
tags question: http://stackoverflow.com/q/23556156
tags question: http://stackoverflow.com/q/23571617
tags question: http://stackoverflow.com/q/23585170
tags question: http://stackoverflow.com/q/23559159
tags question: http://stackoverflow.com/q/23533541
tags question: http://stackoverflow.com/q/23495377
tags question: http://stackoverflow.com/q/23582669
tags question: http://stackoverflow.com/q/23468219
tags question: http://stackoverflow.com/q/23521195
tags question: http://stackoverflow.com/q/23540722
tags question: http://stackoverflow.com/q/23543798
tags question: http://stackoverflow.com/q/23493164
tags question: http://stackoverflow.com/q/23537424
tags question: http://stackoverflow.com/q/23614721
tags question: http://stackoverflow.com/q/23484007
tags question: http://stackoverflow.com/q/23489228
tags question: http://stackoverflow.com/q/23538914
tags question: http://stackoverflow.com/q/23548129
tags question: http://stackoverflow.com/q/23587403
tags question: http://stackoverflow.com/q/23591096
tags question: http://stackoverflow.com/q/23488101
tags question: http://stackoverflow.com/q/23458549
tags question: http://stackoverflow.com/q/23488666
tags question: http://stackoverflow.com/q/23610651
tags question: http://stackoverflow.com/q/23520931
tags question: http://stackoverflow.com/q/23606176
tags question: http://stackoverflow.com/q/23562928
tags question: http://stackoverflow.com/q/23457963
tags question: http://stackoverflow.com/q/23476584
tags question: http://stackoverflow.com/q/23538620
tags question: http://stackoverflow.com/q/23570014
tags question: http://stackoverflow.com/q/23518790

http://stackoverflow.com/q/23487449
possible better answer: http://stackoverflow.com/a/23487820
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36016009
has answer: http://stackoverflow.com/a/23487820
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/36015285
has title: App not working on any device
has comment: http://stackoverflow.com/comment/36015274
accepted answer: http://stackoverflow.com/a/23492809
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/36015373
has comment: http://stackoverflow.com/comment/36021990
has body: I made an android app for a client. It works on my device and a friend's device but does not work on any other device. The app starts with an activity called Spalsh.java and then passes an intent for Login.java. I've attached the Stacktrace, Splash.java, Login.java, Splash.xml, Login.xml and the Manifest for the app. Please help me as I'm unable to locate the issue. The entire source can be found here. StackTrace 05-02 23:44:24.855: D/OpenGLRenderer(30724): Enabling debug mode 0 05-02 23:44:24.925: W/OpenGLRenderer(30724): Bitmap too large to be uploaded into a texture (1620x2880, max=2048x2048) 05-02 23:44:26.887: D/dalvikvm(30724): GC_FOR_ALLOC freed 11035K, 28% free 33444K/46000K, paused 18ms, total 18ms 05-02 23:44:26.897: I/dalvikvm-heap(30724): Grow heap (frag case) to 42.031MB for 8294416-byte allocation 05-02 23:44:26.917: D/dalvikvm(30724): GC_CONCURRENT freed 2K, 10% free 41541K/46000K, paused 2ms+3ms, total 20ms 05-02 23:44:26.917: D/dalvikvm(30724): WAIT_FOR_CONCURRENT_GC blocked 15ms 05-02 23:44:26.987: E/dalvikvm(30724): adjustAdaptiveCoef max=4194304, min=1048576, ut=568 05-02 23:44:26.997: D/dalvikvm(30724): GC_FOR_ALLOC freed <1K, 10% free 41541K/46000K, paused 18ms, total 18ms 05-02 23:44:26.997: I/dalvikvm-heap(30724): Forcing collection of SoftReferences for 18662416-byte allocation 05-02 23:44:27.017: E/dalvikvm(30724): adjustAdaptiveCoef max=6291456, min=1572864, ut=368 05-02 23:44:27.017: D/dalvikvm(30724): GC_BEFORE_OOM freed 10K, 10% free 41531K/46000K, paused 28ms, total 28ms 05-02 23:44:27.017: E/dalvikvm-heap(30724): Out of memory on a 18662416-byte allocation. 05-02 23:44:27.017: I/dalvikvm(30724): "main" prio=5 tid=1 RUNNABLE 05-02 23:44:27.017: I/dalvikvm(30724): | group="main" sCount=0 dsCount=0 obj=0x40fd19a0 self=0x40f58b80 05-02 23:44:27.017: I/dalvikvm(30724): | sysTid=30724 nice=-19 sched=0/0 cgrp=apps handle=1074533852 05-02 23:44:27.017: I/dalvikvm(30724): | state=R schedstat=( 0 0 0 ) utm=67 stm=19 core=0 05-02 23:44:27.017: I…
has comment: http://stackoverflow.com/comment/36022066
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36024423
tagged with: java
downvote count: 2
type: Question
has answer: http://stackoverflow.com/a/23492809
score: -2

http://stackoverflow.com/comment/35991626
has text: You don't need a subquery then. Just sort the results properly and use `setMaxResults(1)`
type: Comment
comment on: http://stackoverflow.com/q/23465522
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36029206
has text: how can we create line borders between the cells == search for AbstractBorder
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23495012
score: 0

http://stackoverflow.com/q/23469033
score: 0
has answer: http://stackoverflow.com/a/23469649
has title: Java - get all executed methods
linked to: http://stackoverflow.com/q/1069066
has comment: http://stackoverflow.com/comment/35981879
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36017853
has answer: http://stackoverflow.com/a/23469531
tagged with: java
has comment: http://stackoverflow.com/comment/35982362
tagged with: methods
has comment: http://stackoverflow.com/comment/35980911
type: Question
has comment: http://stackoverflow.com/comment/35981309
has body: Is there a way to get a list of all executed methods of a program with a certain input? For example: public static void main(String[] args) { Car c1 = new Car("c1"); c1.drive(); if(args.length &gt; 2) { Car c2 = new Car("c2"); c2.drive(); } } public class Car() { String name; public Car(String name) { this.name = name; } public void drive(); { System.out.println(name + " is driving!"); } } Now I'd like to get the executed methods with the input "1 2 3" (c1 and c2 will be created). So a list that looks like this: void main(String[] args); public Car(String name); void drive(); void println(String input); public Car(String name); void drive(); void println(String input); Maybe even more methods will be listed because of the "+" in println or something else. Does anyone know how to create such a list automatically? And if that is too easy for someone, it would also be great to filter the listed methods in such a way that only methods will be listed that were created by the programer and not methods that were used but not created, like println (I hope you know what I mean). The list would then look like this: void main(String[] args); public Car(String name); void drive(); public Car(String name); void drive();
answer count: 2
has comment: http://stackoverflow.com/comment/35981852
has comment: http://stackoverflow.com/comment/35981228

http://stackoverflow.com/q/23515095
tagged with: javascript
has title: Struts2 token interceptor: CSRF protection
linked to: http://stackoverflow.com/q/17093862
favorite count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/36066556
has comment: http://stackoverflow.com/comment/36066945
has comment: http://stackoverflow.com/comment/36066620
tagged with: csrf-protection
has comment: http://stackoverflow.com/comment/36066429
score: 8
has comment: http://stackoverflow.com/comment/36074752
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36066523
has answer: http://stackoverflow.com/a/23518147
has comment: http://stackoverflow.com/comment/36066739
linked to: http://stackoverflow.com/q/18822095
type: Question
has comment: http://stackoverflow.com/comment/36070324
has comment: http://stackoverflow.com/comment/36068536
has body: I am trying to protect my web application from CSRF attacks by using struts token interceptor. The problem I am facing right now is our JSP pages makes more than one call to server (While JSP is converted to JS a struts token is added to JS.But in this JS there are multiple Ajax request. I hope I am making myself clear.), because of token interceptor only first request to the server is getting validated. Other requests are getting invalidated because struts token is reset after each validation. Is there a way I stop Struts from resetting the token every time it validates? IS there any other solutions to handle this in struts interceptor. I am also looking at tomcatcsrfprotection module, I guess I will end up with same problem here also. managepage.jsp: <s:token /> Struts.xml: <interceptor-ref name="csrf-protection" /> /pages/manageUserAccount.jsp I have just added minimum code so that understanding it will be easier.
tagged with: java
tagged with: struts2
accepted answer: http://stackoverflow.com/a/23518147
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36070969
tagged with: jsp
has comment: http://stackoverflow.com/comment/36066782

http://stackoverflow.com/q/23536554
tagged with: android-fragments
has answer: http://stackoverflow.com/a/23537591
has comment: http://stackoverflow.com/comment/36108588
tagged with: android-fragmentactivity
score: 0
accepted answer: http://stackoverflow.com/a/23537591
has comment: http://stackoverflow.com/comment/36108556
answer count: 1
has comment: http://stackoverflow.com/comment/36108633
tagged with: android
has body: i am not able to populate the imageview textview inside gridview using fragments. It is showing blank intead of gridview populating in my project can please anyone see the code below and let me know what i have to change And the populating the image and text is from the mysql database dynamically public class StoreHomeFragment extends Fragment { final ArrayList&lt;HashMap&lt;String, String&gt;&gt; MyArrList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.store_home, container, false); final GridView gridView1 = (GridView)rootView.findViewById(R.id.store_home_gridview); gridView1.setAdapter(new ImageAdapter(rootView.getContext(), MyArrList)); return rootView; } //Activity is created @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); String url = "http://192.168.1.132/Android/App/good.php"; //url where i am using select query and retrieving it from database try { JSONArray data = new JSONArray(getJSONUrl(url)); HashMap&lt;String, String&gt; map; for(int i = 0; i &lt; data.length(); i++){ JSONObject c = data.getJSONObject(i);//retrieving from db map = new HashMap&lt;String, String&gt;(); map.put("name", c.getString("name")); map.put("artist", c.getString("artist")); map.put("price", c.getString("price")); map.put("image", c.getString("image")); MyArrList.add(map); } //gridView1.setAdapter(new ImageAdapter(this,MyArrList)); } catch (JSONException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } //I have used imageAdapter class ImageAdapter extends BaseAdapter { private Context context; public ImageView imageView; private ArrayList&lt;HashMap&lt;String, String&gt;&gt; MyArr = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); public ImageAdapter(Context c,ArrayList&lt;HashMap&lt;String, String&gt;&gt; list) { context = c; M…
has comment: http://stackoverflow.com/comment/36108564
type: AnsweredQuestion
tagged with: gridview
has title: I am not able to get the gridview populated with textview in Android Fragment
has comment: http://stackoverflow.com/comment/36108463
tagged with: java
type: Question

http://stackoverflow.com/comment/36029698
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23495050
score: 0
has text: It depends on the context you are developing this. You need permissions to execute operations such as reading the size of a remote disk.In case you have no remote services (such as remote disk fully shared and accessible from the local machine) available you have to put your code in a remove java server and query it with a java client on your local machine.

http://stackoverflow.com/q/23614086
type: UnansweredQuestion
has body: I am trying to create a java application that will be running for long periods of time. In this java application there will be a package where multiple number of java files will be there. The name of the classes will be same to the name of the java files. And all the classes will contain 2-3 functions(fixed name of functions for each class) but their definition will be changed from one java file to another. So how can I do this? One solution which I have already have is using java reflection. But I don't want to implement it using java reflection. I do have a constraint regarding this,in my project. Kindly help me out. Provide your valuable comment.
has comment: http://stackoverflow.com/comment/36253075
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/36271250
tagged with: java
has answer: http://stackoverflow.com/a/23615493
has comment: http://stackoverflow.com/comment/36252329
has comment: http://stackoverflow.com/comment/36252512
type: Question
answer count: 1
score: 0
has title: How to execute functions of multiple classes dynamically from a package which contains multiple java source files?
has comment: http://stackoverflow.com/comment/36252994
tagged with: android
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/36253221

http://stackoverflow.com/q/23456488
linked to: http://stackoverflow.com/q/23512547
has answer: http://stackoverflow.com/a/34862369
has answer: http://stackoverflow.com/a/25439583
linked to: http://stackoverflow.com/q/24233632
downvote count: 1
has answer: http://stackoverflow.com/a/44539449
has answer: http://stackoverflow.com/a/35135972
has title: How to use OKHTTP to make a post request?
has body: I read some examples which are posting jsons to the server. some one says : OkHttp is an implementation of the HttpUrlConnection interface provided by Java. It provides an input stream for writing content and doesn't know (or care) about what format that content is. Now I want to make a normal post to the URL with params of name and password. It means I need to do encode the name and value pair into stream by myself?
has answer: http://stackoverflow.com/a/66369214
tagged with: java
has answer: http://stackoverflow.com/a/23456934
has answer: http://stackoverflow.com/a/40071218
has answer: http://stackoverflow.com/a/54838508
possible better answer: http://stackoverflow.com/a/35135972
has answer: http://stackoverflow.com/a/50522114
has answer: http://stackoverflow.com/a/34456006
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29795501
has answer: http://stackoverflow.com/a/38525917
type: Question
accepted answer: http://stackoverflow.com/a/40071218
has answer: http://stackoverflow.com/a/71929553
tagged with: okhttp
has answer: http://stackoverflow.com/a/38525982
answer count: 15
favorite count: 0
linked to: http://stackoverflow.com/q/29795931
has comment: http://stackoverflow.com/comment/58303328
upvote count: 114
has answer: http://stackoverflow.com/a/47215023
has comment: http://stackoverflow.com/comment/51423065
score: 113
has comment: http://stackoverflow.com/comment/65579026

http://stackoverflow.com/q/23514301
has answer: http://stackoverflow.com/a/25000282
has title: generating the API metadata for your Cloud Endpoints classes failed
has answer: http://stackoverflow.com/a/40226951
answer count: 2
possible better answer: http://stackoverflow.com/a/40226951
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25000282
tagged with: google-app-engine
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
has body: I'm using the Google App Engine plugin for Eclipse (4.2) and Google App Engine SDK 1.9.2 So the project consists of a server side application (backend) and an Android app (frontend). I incidentally checked the "uses Google App Engine" within the project properties page of the frontend. Since I unchecked that again, I can't compile the Android app - getting the error below. Any idea how to solve that without deleting my project? There was a problem generating the API metadata for your Cloud Endpoints classes: Project Notes is not a web-app project
type: Question

http://stackoverflow.com/q/23597212
downvote count: 1
has comment: http://stackoverflow.com/comment/36220777
favorite count: 0
has comment: http://stackoverflow.com/comment/36220797
type: AnsweredQuestion
upvote count: 0
tagged with: syntax
tagged with: java
has comment: http://stackoverflow.com/comment/36220961
score: -1
type: Question
has comment: http://stackoverflow.com/comment/36220965
has title: Java Int array passing complication
accepted answer: http://stackoverflow.com/a/23597288
answer count: 1
tagged with: arrays
tagged with: int
has body: This is an interesting bit a code and upon testing I can't figure out why this is happening except for a potential error during printing. Maybe someone here can enlighten me. I'm looking to make a simple array representing memory allocation. The array is going to be a 10 bit array in this example (passing ten as a paramater). Since no memory is allocated I will be making the 10 a negative ten. The code below wills simply initialize the int array as length 10. Afterwords I will set the 0 value to -10 and the last value as -10 as well. this.mem = new int [memsize]; int memory = -1 * memsize; this.mem [0] = memory; this.mem [mem.length-1] = memory; for (int x= 0; x &lt; mem.length - 1 ; x++){ System.out.print(mem[x] + " , " ); } This to me makes perfect sense, however it prints out the following result. -10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 my only hint is a potential error during system.out.print because it never reaches the comma while printing. However, no errors are thrown and I set the value to negative 10...not 1. Anyone know why this could happen? I ran it again and can't understand the values -10 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 help please
has answer: http://stackoverflow.com/a/23597288

http://stackoverflow.com/comment/36065674
score: 0
has text: My plan was to try tracking it down in more detail and then opening an issue in the Groovy issue tracker. Thinking about it, however, I think the script is already not a bad initial test case. Meanwhile I set up an issue for uimaFIT: [UIMA-3808](https://issues.apache.org/jira/browse/UIMA-3808)
type: Comment
comment on: http://stackoverflow.com/a/23510374
type: AnswerComment

http://stackoverflow.com/q/23471937
type: Question
has title: HTTPUnit Tests for Authorization
downvote count: 0
has body: I am using HTTP Unit for testing my authorization framework. I have problems when I try to test the cases after the Log-in, because the tests always check the first returned status codes. When someone who is not authenticated tries to access a protected resource, the first status code is 401, he has the chance to provide his credentials and after log-in the status code is 200. How can I program the test to perform the authentication and wait for the last status code? This is how I did it until now. It failes, because the first status code is 401 and not 200. Is there a keep alive option? @Test public void testReqRestrictedResourceWithValidRole() throws Exception { // Request a protected page with valid credentials and valid role // protectedUrl requires role ADMIN // user has role ADMIN String username = "user"; String password = "password"; String decUserPass = username + ":" + password; String base64encUserPass = DatatypeConverter.printBase64Binary(decUserPass.getBytes()); webClient.addRequestHeader("Authorization", "Basic " + base64encUserPass); Page page = webClient.getPage(protectedUrl); int statuscode = page.getWebResponse().getStatusCode(); assertEquals(statuscode, 200, "Wrong statuscode."); } Thanks!
tagged with: authorization
has comment: http://stackoverflow.com/comment/40718606
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: http-unit
tagged with: testing
score: 1
tagged with: java

http://stackoverflow.com/comment/36079707
has text: Because a List is not an ArrayList, it could be a LinkedList. You can only assign a subtype to a supertype, not a supertype to a subtype as you are trying to do here.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23521908

http://stackoverflow.com/a/23480275
has body: Primitives are compared with ==. Objects are compared with equals() (otherwise you check that both variables point to the exact same object). So, either you use a.longValue() == b.longValue() or you use a.equals(b); Both are equivalent (except the first one will throw an exception id b is null).
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23480150
score: 1

http://stackoverflow.com/q/23566420
has body: how can i check is 2 jRadio button are selected and then show a new frame showing the new operation in the new frame ,the problem in my code is that is show the question 1 even if non of radio button is selected the program should check id addition and easy are selected and when click start test should show new frame this is my main code package javaapplication78; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class javaapplication78{ JFrame f1; JPanel panel1,panel2,panel3,panel4; JButton b1,b2; JLabel label_1,label_2; JRadioButton radio_1,radio_2,radio_3,radio_4,radio_5,radio_6,radio_7; javaapplication78(){ JFrame f1 = new JFrame ("MathTest - Main Menu"); f1.setVisible(true); f1.setSize(300,400); f1.setLayout(new GridLayout(0,1)); f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel1 = new JPanel(new GridLayout(0, 2)); panel1.setBorder(BorderFactory.createLineBorder(Color.black, 1)); panel1.add(new JLabel("Select a test type")); panel1.add(radio_1=new JRadioButton("Addition")); panel1.add(new JLabel("")); panel1.add(radio_2=new JRadioButton("Substraction")); panel1.add(new JLabel("")); panel1.add(radio_3=new JRadioButton("Multiplication")); panel1.add(new JLabel("")); panel1.add(radio_4=new JRadioButton("Division")); panel2 = new JPanel(new GridLayout(0, 2)); panel2.setBorder(BorderFactory.createLineBorder(Color.black, 1)); panel2.add(new JLabel("select a diffculty level")); panel2.add(radio_5=new JRadioButton("easy ")); panel2.add(new JLabel("")); panel2.add(radio_6=new JRadioButton("moderate")); panel2.add(new JLabel("")); panel2.add(radio_7=new JRadioButton("hard")); panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); panel3.add(new JLabel("")); JButton b1 = new JButton("Start test"); panel3.add(b1); b1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { new javaapplication79(); } }); panel4 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); …
tagged with: oop
tagged with: java
downvote count: 2
type: Question
score: -2
has comment: http://stackoverflow.com/comment/36163116
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23566542
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36163029
tagged with: jradiobutton
has title: how to check if 2 Jradiobutton are selected?

http://stackoverflow.com/comment/35956036
has text: is your textview inside the listview or outside of it ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23455501
score: 0

http://stackoverflow.com/comment/36104762
score: 0
has text: I think the position is not working because if that particular element found at `td[1]` it would not consider `td[2]`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23490326

http://stackoverflow.com/q/23573748
tagged with: java
has body: I am currently writing some code that is supposed to solve a sudoku puzzle for an assignment. The code I currently have written should be isolating the row and column where we need to insert a value, and then testing values 1-9 to see which ones already appear in either the row or the column. The problem is, the binary search is not detecting some numbers and I do not know why. Here is my code. All you need to no is that A.grid is an array containing the unsolved puzzle, and the set value method is one that I have written to plug a value into the array with the fromat setValue(xLocation, yLocation, value) int currentVal = 0; int j; int [] currentRow = new int [9]; int [] currentCol = new int [9]; for (i = 0; i&lt;9 ; i++) { for (j = 0; j&lt;9 ; j++){ currentVal=A.grid[i][j]; boolean keepGoing = true; int newVal=1; if (currentVal==0) { for( int k = 0; k &lt; 9; k++) {currentCol[k] = A.grid[k][j]; } currentRow = A.grid[i]; log(Arrays.toString(currentRow)); log(Arrays.toString(currentCol)); log(""); while (keepGoing) { int indexRow=Arrays.binarySearch(currentRow, newVal); int indexCol=Arrays.binarySearch(currentCol, newVal); log(indexRow); log(indexCol); log(""); if (indexRow&lt;0 &amp;&amp; indexCol&lt;0) { keepGoing = false; } newVal++; } A.setValue(j, i, newVal-1); Thanks!
tagged with: search
answer count: 1
score: 0
tagged with: binary
type: UnansweredQuestion
has title: Problems using Binary Search
type: Question
has answer: http://stackoverflow.com/a/23574739

http://stackoverflow.com/a/23505440
has comment: http://stackoverflow.com/comment/36050022
has body: Here is the method to re-size the Image. Fit it in your code. public BufferedImage resizeImage(Image originalImage, int newD) throws IOException { BufferedImage resizedImage = new BufferedImage(newD, newD, BufferedImage.TYPE_INT_ARGB); Graphics2D g = resizedImage.createGraphics(); g.drawImage(originalImage, 0, 0, newD, newD, null); g.dispose(); return resizedImage; } --EDIT-- Favor Composition over Inheritance. Don't extend any class until and unless you are overriding the existing logic. complete sample code: class drawRect { private Image image; private JLabel label; public JLabel getLabel() { return label; } public drawRect() { try { label = new JLabel(); image = ImageIO.read(new File("resources/1.png")); } catch (IOException e) { e.printStackTrace(); } setD(10); } public void setD(int newD) { int d = (newD &gt;= 0 ? newD : 10); try { label.setIcon(new ImageIcon(resizeImage(image, d))); } catch (IOException e) { e.printStackTrace(); } } private BufferedImage resizeImage(Image originalImage, int newD) throws IOException { BufferedImage resizedImage = new BufferedImage(newD, newD, BufferedImage.TYPE_INT_ARGB); Graphics2D g = resizedImage.createGraphics(); g.drawImage(originalImage, 0, 0, newD, newD, label); g.dispose(); return resizedImage; } }
has comment: http://stackoverflow.com/comment/36050511
has comment: http://stackoverflow.com/comment/36050174
accepted answer of: http://stackoverflow.com/q/23505305
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36049943
has comment: http://stackoverflow.com/comment/36050069
answers question: http://stackoverflow.com/q/23505305
has comment: http://stackoverflow.com/comment/36050485
type: Answer
has comment: http://stackoverflow.com/comment/36050346
has comment: http://stackoverflow.com/comment/36050101
score: 2
has comment: http://stackoverflow.com/comment/36049327
upvote count: 2
has comment: http://stackoverflow.com/comment/36049963
has comment: http://stackoverflow.com/comment/36049450

http://stackoverflow.com/comment/36175892
type: QuestionComment
comment on: http://stackoverflow.com/q/23573169
has text: I don't know if it will solve your problem, but you shouldn't be calling dispose() on a Graphics object that was provided to you by swing as you are currently doing in the paintComponent() method.
score: 0
type: Comment

http://stackoverflow.com/comment/36223820
type: Comment
type: QuestionComment
has text: The real problem is an NPE thrown `at org.springframework.beans.PropertyEditorRegistrySupport.<clinit>`; ie in this class' static initializer. Misconfiguration somewhere? The problem is that there is no message associated to that NPE so it's hard to tell what happens there.
comment on: http://stackoverflow.com/q/23598748
score: 0

http://stackoverflow.com/comment/36035466
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23495772
has text: I ask myself the same. The answer is JADE http://jade.tilab.com/. To ease your mind, I made a tool that is based on JADE and I use ArrayList. For compatibility purposes, though, I need to convert my ArrayLists to JADE-friendly Vectors...
type: Comment

http://stackoverflow.com/comment/36124362
has text: 1. Don't mix Swing and AWT components (`Button` is AWT). 2. _Please_ use Java naming convention, if not for yourself, then for us, so it easier to read. Variables begin with lower case letters 3. Use proper indentation, also, so it's easier to read
comment on: http://stackoverflow.com/q/23545692
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/23462359
has body: Store all the lines you would like to save in a String and close the scanner. Create a printwriter, print the string to the file and close it. Example code: File file = new File("yourTextFile.txt"); Scanner in = new Scanner(file); String saveThisToFile = ""; while (in.hasNext()) { String temp = in.nextLine(); if (condition to be true if you whant to keep this line) { saveThisToFile += temp + "\n"; } } in.close(); PrintWriter printWriter = new PrintWriter(file); printWriter.print(saveThisToFile); printWriter.close();
answers question: http://stackoverflow.com/q/23462077
type: Answer
score: 0

http://stackoverflow.com/q/23544094
score: 0
has body: I'm studying Spring java configuration now and I want to show an image in my .jsp page. I've searched a lot. This question is popular but still no answers helped me. Image still doesn't appear. I would be really glad is someone could help me. My directory tree: -src --main ---java ----com -----app ------controller -------MainController.java ------springconfig -------WebConfig.java --webapp ---resources ----images -----11706.jpg ----styles ---WEB-INF ----view -----home.jsp ----web.xml ---index.jsp MainController.java @Controller @RequestMapping("/home") public class MainController { @RequestMapping(method = RequestMethod.GET) public String loadHomePage(Model m) { m.addAttribute("name", "CodeTutr"); return "home"; } } WebConfig.java @Configuration @EnableWebMvc @ComponentScan(basePackages = "com.app.controller") public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); } @Bean public InternalResourceViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/view/"); resolver.setSuffix(".jsp"); return resolver; } } home.jsp Sample Application Hello, ${name}!!! web.xml sample org.springframework.web.servlet.DispatcherServlet contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext contextConfigLocation com.app.springconfig sample / Sorry for so many code snippets. Hope it'll help solving the problem
tagged with: spring
accepted answer: http://stackoverflow.com/a/23544566
has answer: http://stackoverflow.com/a/23544375
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23544566
type: Question
answer count: 2
tagged with: jsp
possible better answer: http://stackoverflow.com/a/23544375
has title: Show image in JSP (Spring 3 java configuration)

http://stackoverflow.com/comment/36251978
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23611934
has text: again, you exception does not match the code. the lines 93 and 94 should be one after the other, but in your code there is `if(child.isDirectory()) {` is between, suggesting that you are not actually testing `isDirectory`, which does explain the crash. Please post consistent code and stacktrace.
score: 0

http://stackoverflow.com/q/23527900
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/23527925
type: Question
has body: In an example in class we were given this method as part of a bigger problem: public boolean isWinner() { return ((points == 4) || (score == 4)); } My impression of boolean type methods was that they HAVE to return true/false like "return true;" In this example there is no where indicating whether it is returning true/false so if points == 4 does it return true? and if score ==4 does it return false? or is it if either are true then the entire return statement is true?
downvote count: 2
accepted answer: http://stackoverflow.com/a/23527934
upvote count: 1
has answer: http://stackoverflow.com/a/23528001
has answer: http://stackoverflow.com/a/23528111
answer count: 6
tagged with: java
has answer: http://stackoverflow.com/a/23527980
possible better answer: http://stackoverflow.com/a/23528001
has comment: http://stackoverflow.com/comment/36091620
has comment: http://stackoverflow.com/comment/36092713
has comment: http://stackoverflow.com/comment/36091591
has answer: http://stackoverflow.com/a/23527934
has title: java boolean method not returning true/false?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23528125

http://stackoverflow.com/comment/36134166
type: Comment
type: QuestionComment
has text: If your underlying JVM is Java 7, use `Files.createDirectory()` instead; also, try and see what `file.encoding` is set to in the JVM.
score: 1
comment on: http://stackoverflow.com/q/23550881

http://stackoverflow.com/a/25794656
accepted answer of: http://stackoverflow.com/q/23525617
type: Answer
answers question: http://stackoverflow.com/q/23525617
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: As I said as a comment above: I cleaned up EVERYTHING and ran just release:prepare by itself and it succeeded without issue. Perhaps this is a bug where running release:prepare and release:perform together will cause this I have not run into this issue since running these commands separately.

http://stackoverflow.com/q/23485072
has answer: http://stackoverflow.com/a/23485641
score: -3
has comment: http://stackoverflow.com/comment/36011337
has comment: http://stackoverflow.com/comment/36011437
possible better answer: http://stackoverflow.com/a/23485354
type: AnsweredQuestion
tagged with: java
downvote count: 3
type: Question
has title: Displaying result in EditText
answer count: 2
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23485354
has body: MainActivity package com.elitiv.myapplication2.app; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.TextView; public class MainActivity extends ActionBarActivity { private EditText Result; private Double NumberYear; private Double NumberCapacity; private String Operation; private Double NumberResult; private EditText editYear; private EditText editCapacity; private Button calc; private RadioButton radioD; private RadioButton radioB; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView Year = (TextView)findViewById(R.id.Year); TextView Capacity = (TextView)findViewById(R.id.Capacity); editYear = (EditText)findViewById(R.id.editYear); editCapacity = (EditText)findViewById(R.id.editCapacity); final EditText Result = (EditText)findViewById(R.id.Result); Button calc =(Button)findViewById(R.id.calc); final RadioButton radioD = (RadioButton)findViewById(R.id.radioD); final RadioButton radioB = (RadioButton)findViewById(R.id.radioB); } public void Operation(){ Double result; //Benzin if(NumberCapacity &gt;0 &amp;&amp;NumberCapacity &lt;1000) { if (Operation.equals(2004)) { result = NumberCapacity * 0.52; Result.setText(String.valueOf(result)); } if (Operation.equals("2005")) { result = NumberCapacity * 0.50; Result.setText(String.valueOf(result)); } if (Operation.equals("2006")) { result = NumberCapacity * 0.47; Result.setText(String.valueOf(result)); } if (Operation.equals("2007")) { result = NumberCapacity * 0.44; } if (Operation.equals("2009")) { result = NumberCapacity * 0.43; } if (Operation.equals("2011")) { result = NumberCapacity * 0.42; } if (Operation.equals("2013")) { result = NumberCapacity * 0.40; } } if(NumberCapacity &gt;1001 &amp;&amp;NumberCapacity &lt;1500){ if (Operation.equals("2004")) { resu…
tagged with: android
accepted answer: http://stackoverflow.com/a/23485641
tagged with: android-studio

spring-mvc
tags question: http://stackoverflow.com/q/23572401
tags question: http://stackoverflow.com/q/23497775
tags question: http://stackoverflow.com/q/23477348
tags question: http://stackoverflow.com/q/23501796
tags question: http://stackoverflow.com/q/23519125
tags question: http://stackoverflow.com/q/23497974
tags question: http://stackoverflow.com/q/23595958
tags question: http://stackoverflow.com/q/23456239
tags question: http://stackoverflow.com/q/23514544
tags question: http://stackoverflow.com/q/23514787
tags question: http://stackoverflow.com/q/23474788
tags question: http://stackoverflow.com/q/23454672
tags question: http://stackoverflow.com/q/23483390
tags question: http://stackoverflow.com/q/23559874
tags question: http://stackoverflow.com/q/23564835
tags question: http://stackoverflow.com/q/23536710
tags question: http://stackoverflow.com/q/23524723
tags question: http://stackoverflow.com/q/23454635
tags question: http://stackoverflow.com/q/23594159
tags question: http://stackoverflow.com/q/23576929
tags question: http://stackoverflow.com/q/23456383
tags question: http://stackoverflow.com/q/23591481
tags question: http://stackoverflow.com/q/23578742
tags question: http://stackoverflow.com/q/23512485
tags question: http://stackoverflow.com/q/23493462
tags question: http://stackoverflow.com/q/23568384
tags question: http://stackoverflow.com/q/23460662
tags question: http://stackoverflow.com/q/23613264
tags question: http://stackoverflow.com/q/23520561
tags question: http://stackoverflow.com/q/23607872
tags question: http://stackoverflow.com/q/23527130
tags question: http://stackoverflow.com/q/23527833
tags question: http://stackoverflow.com/q/23597776
tags question: http://stackoverflow.com/q/23539893
tags question: http://stackoverflow.com/q/23463808
tags question: http://stackoverflow.com/q/23567438
tags question: http://stackoverflow.com/q/23571378
tags question: http://stackoverflow.com/q/23611611
tags question: http://stackoverflow.com/q/23548645
tags question: http://stackoverflow.com/q/23455680
tag name: spring-mvc
tags question: http://stackoverflow.com/q/23582534
tags question: http://stackoverflow.com/q/23567383
tags question: http://stackoverflow.com/q/23607729
tags question: http://stackoverflow.com/q/23581176
tags question: http://stackoverflow.com/q/23589639
tags question: http://stackoverflow.com/q/23581619
tags question: http://stackoverflow.com/q/23599506
tags question: http://stackoverflow.com/q/23596574
tags question: http://stackoverflow.com/q/23508277
tags question: http://stackoverflow.com/q/23568253
tags question: http://stackoverflow.com/q/23548431
tags question: http://stackoverflow.com/q/23519685
type: Tag
tags question: http://stackoverflow.com/q/23479404
tags question: http://stackoverflow.com/q/23512544
tags question: http://stackoverflow.com/q/23482439
tags question: http://stackoverflow.com/q/23555461
tags question: http://stackoverflow.com/q/23580509
tags question: http://stackoverflow.com/q/23557942
tags question: http://stackoverflow.com/q/23503910
tags question: http://stackoverflow.com/q/23608213
tags question: http://stackoverflow.com/q/23495377
tags question: http://stackoverflow.com/q/23491595
tags question: http://stackoverflow.com/q/23574442
tags question: http://stackoverflow.com/q/23483905
tags question: http://stackoverflow.com/q/23457084
tags question: http://stackoverflow.com/q/23481300
tags question: http://stackoverflow.com/q/23510417
tags question: http://stackoverflow.com/q/23538914
tags question: http://stackoverflow.com/q/23531841
tags question: http://stackoverflow.com/q/23603345
tags question: http://stackoverflow.com/q/23613215
tags question: http://stackoverflow.com/q/23476584
tags question: http://stackoverflow.com/q/23453556
tags question: http://stackoverflow.com/q/23460060
tags question: http://stackoverflow.com/q/23455175
tags question: http://stackoverflow.com/q/23475667
tags question: http://stackoverflow.com/q/23565517
tags question: http://stackoverflow.com/q/23569213

http://stackoverflow.com/a/23613109
has comment: http://stackoverflow.com/comment/36250535
has body: Use a Map. That ties the double to the string, and when you sort based on the double, you always get the right day. You can then sort the key set of the Map however you like, though for double, you are best using a TreeSet and Doubles natural ordering. The nice thing about a Map is that it makes your code more logical, as the doubles and the days really go together conceptually, so they should be stored together in a single data structure, and that will make your code easier to understand.
score: 0
answers question: http://stackoverflow.com/q/23612853
type: Answer
has comment: http://stackoverflow.com/comment/36251400

http://stackoverflow.com/a/23547050
accepted answer of: http://stackoverflow.com/q/23546003
answers question: http://stackoverflow.com/q/23546003
type: AcceptedAnswer
downvote count: 0
has body: I use oauth, oauth2 and openid to authenticate my user on my GAE python application, is not verry simple to implement but is verry useful and simple for the visitor. In first you can use the oauth 2.0 playground to try and play with oauth: https://developers.google.com/oauthplayground/ YES! In a cookies. To protect your users I recommend to use Cloudflare pro to get an https url with your domain name. The cost is very low compared to buy a certificate and you have in more many services to speedup your application. In python you can define the life time, in JAVA I suppose is the same. The token is valid for a lifetime and for a specific domain. See point 4. You can request an update token. I don't know.Test that with Playground tools. I don't understand your question. If your application need to request data from the provider and the token is expired you need to use the refresh key to request a new token. For information but for Python, I invite you to see this library: https://github.com/scotch/engineauth
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/36127125
comment on: http://stackoverflow.com/a/23530855
score: 0
type: AnswerComment
has text: Then you can create object of that class of yours and init it in constructor like MyClass = this; than use MyClass.findChampion();
type: Comment

http://stackoverflow.com/comment/36192717
type: Comment
type: QuestionComment
has text: Thanks but I am unable to get profile as well. using ${profile}
comment on: http://stackoverflow.com/q/23576929
score: 0

http://stackoverflow.com/comment/36010369
has text: I have scanned through all my codes and confirmed that I never used int arrays.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23484359
score: 0

http://stackoverflow.com/a/23569374
has body: This is my way to work around. @Inject private void initDao(DataSource dataSource, @Named("jdbc.url") String url) throws SQLException { setConnectionSource(new DataSourceConnectionSource(dataSource, url)); DatabaseTableConfig&lt;T&gt; config = DatabaseTableConfig.fromClass(getConnectionSource(), dataClass); config.setTableName(getTableName()); setTableConfig(config); initialize(); } private String getTableName() { Table table = dataClass.getAnnotation(Table.class); if (table == null || Strings.isNullOrEmpty(table.name())) return DatabaseTableConfig.extractTableName(dataClass); return table.name(); }
score: 0
answers question: http://stackoverflow.com/q/23567960
type: Answer

http://stackoverflow.com/comment/36127201
score: 0
has text: @user2357112 I'm looking specifically at the Oracle JDK.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23532897

http://stackoverflow.com/a/23570219
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23570177
answers question: http://stackoverflow.com/q/23570177
type: Answer
upvote count: 3
score: 3
has body: You could use an upper bound generic wildcard Class&lt;? extends SearchForm&gt;

http://stackoverflow.com/q/23573326
tagged with: java-ws
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36176286
has body: I want to know how to return all values of a array variable which are assigned in for loop. In the method below, I am assigning values to an Output array. Now I want to display all the value in the Output array as return argument. Because of scope level, I am getting the last value. Right now I am able to return one the last value because of the scope issue. public static String[] getMBeanAppsStatus(String host, String port, String container, String filter, String usr, String pwd) { String Output[] = new String[3]; int mbeanAppsIdx = 0; int LVar = mbeanAppsIdx; try { Object[] connections = connectMethd(host, port, container, filter, usr, pwd); MBeanServerConnection serverConn = (MBeanServerConnection)connections[0]; System.out.println("serverConn from array variable in getMBeanAppsStatus" + serverConn); /* retrieve mbean apps matching given filter */ ObjectName mbeanDomainName = new ObjectName(filter); Set mbeanAppNames = serverConn.queryNames(mbeanDomainName, null); /* pattern to extract mbean application names */ Pattern mbeanAppPat = Pattern.compile("name=", Pattern.CASE_INSENSITIVE); /* mbean application name */ ObjectName mbeanApp = null; /* retrieve mbean apps count */ Iterator i; for (i = mbeanAppNames.iterator(); i.hasNext(); ) { mbeanAppsIdx++; System.out.println("Populating MBean App #" + mbeanAppsIdx + "details..."); /* retrieve mbean app name and status */ mbeanApp = (ObjectName)i.next(); String mbeanAppFQDN = mbeanApp.toString(); String mbeanAppName = mbeanAppPat.split(mbeanAppFQDN)[1]; Boolean mbeanAppRunning = Boolean.valueOf(serverConn.getAttribute(mbeanApp, "Running").toString()); String mbeanAppStatus = "DISABLED"; if (mbeanAppRunning.booleanValue()) mbeanAppStatus = "ENABLED"; Output[0] = mbeanAppName; Output[1] = mbeanAppFQDN; Output[2] = mbeanAppStatus; System.out.println("getMBeanAppsStatus output " + "mbeanAppName " + mbeanAppName + " mbeanAppFQDN " + mbeanAppFQDN + " mbeanAppStatus : " + mbeanAppStatus); } } catch (MalformedObjectNameExceptio…
has comment: http://stackoverflow.com/comment/36176302
favorite count: 0
has comment: http://stackoverflow.com/comment/36176713
has comment: http://stackoverflow.com/comment/36177075
type: AnsweredQuestion
upvote count: 0
tagged with: java
score: -1
has title: Access Array value of side scope in Java
has answer: http://stackoverflow.com/a/23574501
accepted answer: http://stackoverflow.com/a/23574501
type: Question
has comment: http://stackoverflow.com/comment/36177288
has comment: http://stackoverflow.com/comment/36176853

http://stackoverflow.com/q/23530554
tagged with: bit
upvote count: 1
score: 1
tagged with: java
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/36096807
tagged with: bytebuffer
has comment: http://stackoverflow.com/comment/36096852
has body: I need to write a method which reads a variable number of bits from a ByteBuffer and converts those bytes into a primitive int or long (if more than 32 bits). I am not very proficient at working with bits, but I did look at some code examples and answers to similar(ish) questions and here is the best that I could come up with (bb refers to an internal ByteBuffer): public int readBits(int number) { int initialPosition = bb.position(); int value = 0; int remaining = number; int position = bb.position(); while (remaining &gt; 0) { int index = (position &gt;&gt; 3); int bit = (position &amp; 7); int bitsLeft = Math.min(8 - bit, remaining); int nibble = (bb.get(index) &gt;&gt; (bit &amp; BIT_MASKS[bitsLeft])); value |= nibble &lt;&lt; (number - remaining); position += bitsLeft; remaining -= bitsLeft; } bb.position(initialPosition + ((position - initialPosition) &gt;&gt; 3)); return value; } The BIT_MASKS array is defined as following: private static final int[] BIT_MASKS = new int[] { 0, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff }; I tested this method using this test code: public static void main(String[] args) { int nm = 4; BitSet bs = new BitSet(nm); bs.set(2); bs.set(3); BitBuffer bb = new BitBuffer(ByteBuffer.wrap(bs.toByteArray())); System.out.println(bb.readBits(nm)); } I expected a value of 6, but it prints 12 and I'm not sure why. I would appreciate some help with this. Thanks.
favorite count: 0
has comment: http://stackoverflow.com/comment/36096776
answer count: 0
type: UnansweredQuestion
has title: Java: reading a variable number of bits and converting to an integer

http://stackoverflow.com/q/23591230
has comment: http://stackoverflow.com/comment/36209384
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36209327
downvote count: 0
answer count: 0
has body: I realise that this question has been asked a couple times and I have changed my code to use xmlns:app="http://schemas.android.com/apk/res-auto" already but it still doesn't work for me. This is what it's shown in my Android Studio. However, once I deployed the app to my mobile I see no items but everything is in the overflow instead. Here's my code @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.app.MainActivity" &gt; &lt;item android:id="@+id/action_search" android:title="@string/keepr_search" android:icon="@drawable/abc_ic_search" app:showAsAction="always|collapseActionView" app:actionViewClass="android.support.v7.widget.SearchView" /&gt; &lt;item android:id="@+id/twitter_login" android:title="@string/twitter_login" android:orderInCategory="100" app:showAsAction="never" /&gt; &lt;/menu&gt;
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36209284
has comment: http://stackoverflow.com/comment/36209305
has comment: http://stackoverflow.com/comment/36209688
has comment: http://stackoverflow.com/comment/36209368
upvote count: 1
has title: Android AppCompat not showing search icon bar only showing overflow
favorite count: 0

http://stackoverflow.com/comment/36229516
type: Comment
has text: Yes, but I don't know why if I put this parameter it's not working. because dto is an instance of CreateFile for example and it's not working with CreateFile.class parameter in the GetConstructor()
comment on: http://stackoverflow.com/a/23598813
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35968343
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23462017
has text: You should create only one `Scanner` instance and use its `next` method to get the input.
score: 0

http://stackoverflow.com/q/23531088
has body: The purpose of this was to ensure that the user does not receive any mismatch errors. Every time they enter a String by accident, I want the program to say "Sorry, please choose exercises from above" and give them the option to type an answer again without crashing. Currently, if the user types in a string, the loop skips the if statement and continues onto the else statement for ever until you manually terminate it. int program = 0; System.out.println("Enter 1 for Vocabularly exsersises, 2 for Grammer Exercises and 3 for other"); while (input.hasNext()) { if (input.hasNextInt()) program = input.nextInt() ; else System.out.println("Sorry, please choose exercises from above"); }
has title: While Loop is skipping Satements
tagged with: java.util.scanner
score: 0
tagged with: java
answer count: 2
tagged with: if-statement
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23531115
tagged with: while-loop
has answer: http://stackoverflow.com/a/23531952
type: Question
has comment: http://stackoverflow.com/comment/36098029

http://stackoverflow.com/a/23514481
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23512915
score: 3
has body: Drools is a Java application, and there is no port that would enable you to re-use DRL in a .NET application. If you want to re-use your knowledge base, then you should expose it as a web service and call that from your .NET application.
downvote count: 0

http://stackoverflow.com/a/23568633
has body: When you use nextDouble(), you are asking the scanner object to accept only valid Double inputs. If you want to accept strings, just use next(). Change the lines as shown below. System.out.println("Insert num: "); prvi = sk.next(); System.out.println("Insert 2nd num: "); drugi = sk.next();
answers question: http://stackoverflow.com/q/23568579
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23568579
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/comment/36145863
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23557035
has text: its not about the build.xml. I am asking about the first message: Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true

http://stackoverflow.com/comment/36251493
comment on: http://stackoverflow.com/q/23613564
has text: so you mean you got a time gap ? latency ?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36070586
type: Comment
comment on: http://stackoverflow.com/a/23504087
score: 0
type: AnswerComment
has text: Okay, but the thing is I want to run the RSAKeyGenerator as a java program through the servlet...

http://stackoverflow.com/a/23517212
score: 0
has body: on this line arrayTest2(dataStorage); You are passing parameter to method, that has one argument "dataStorage", but you don't declare it.
type: Answer
answers question: http://stackoverflow.com/q/23517126

http://stackoverflow.com/comment/36144619
has text: No, I'm looking for where XML string constants for things like `android:layout_gravity` are stored, and constants for the value associated with gravity (`center`, `left`, `right`, etc.)
comment on: http://stackoverflow.com/a/23556359
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36207112
type: QuestionComment
type: Comment
has text: try "INSERT INTO Workers VALUES ("+num+", "+fName+", "+lName+", "+jTitle+")"
comment on: http://stackoverflow.com/q/23590116
score: 0

http://stackoverflow.com/comment/36238484
type: AnswerComment
type: Comment
has text: [This might help](http://stackoverflow.com/questions/7183252/what-can-i-do-with-could-not-parse-configuration-error-from-hibernate)
comment on: http://stackoverflow.com/a/23605899
score: 0

http://stackoverflow.com/q/23510466
answer count: 2
tagged with: jpa
tagged with: serialization
type: UnansweredQuestion
has title: Serializing JPA Entity - saving only IDs for fetched entities
has body: There are two entities: User and Employee. User has field with type Employee. @Entity @Table(name="user") public class User extends AuditableEntity { Long idUser; String username; String password; Employee employee; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long getIdUser() { return idUser; } public void setIdUser(Long idUser) { this.idUser = idUser; } @Column(name = "username") public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } @Column(name = "password") public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @ManyToOne @JoinColumn(name = "idemployee") public Employee getEmployee() { return employee; } public void setEmployee(Employee employee) { this.employee = employee; } } And @Entity @Table(name = "employee") public class Employee extends AuditableEntity { Long idEmployee; String surname; String name; String patronymic; Date birthdate; @Id @GeneratedValue (strategy=GenerationType.IDENTITY) @Column(name = "idemployee") public Long getIdEmployee() { return idEmployee; } public void setIdEmployee(Long idEmployee) { this.idEmployee = idEmployee; } @Column(name = "surname") public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } @Column(name = "name") public String getName() { return name; } public void setName(String name) { this.name = name; } @Column(name = "patronymic") public String getPatronymic() { return patronymic; } public void setPatronymic(String patronymic) { this.patronymic = patronymic; } @JsonFormat(pattern = "dd.MM.yyyy") @Column(name = "birthday") public Date getBirthdate() { return birthdate; } public void setBirthdate(Date birthdate) { this.birthdate = birthdate; } } I need to serialize User to XML/JSON. I'm using JAXB but it's serializing Employee too: <User> 15 user15 password15 23 Smith John H. 01.01.1970 <User> I need in result someth…
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/23510769
has answer: http://stackoverflow.com/a/23524361
type: Question
score: 0

http://stackoverflow.com/q/23587453
tagged with: android
tagged with: animation
has answer: http://stackoverflow.com/a/23587527
type: AnsweredQuestion
tagged with: android-edittext
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23587527
has body: ) I have an EditText on which I start a background animation, like this (Android): EditText1.setBackgroundResource(R.drawable.blinker); EditText1.getBackground().start(); Now I have an ArrayList with lets say 10 EditTexts. Next I say: Let the first 4 blinking. So I start my animation like above in a loop or method or whatever. Next I wanna stop these animations with a method like allAnimationsStop(). So each animation which is running should stop. I could use a loop which execute stop() for every EditText. The problem is e.g. EditText5 didn't get an animation as a background because I set it just for the first 4. So at this point I get an error. My question is how can I check that on a EditText an animation or just picture is applied? Thank you:-)
score: 0
answer count: 1
has title: How to stop an unknown amount of animations?

http://stackoverflow.com/q/23561868
favorite count: 0
has comment: http://stackoverflow.com/comment/36154335
type: UnansweredQuestion
tagged with: java
tagged with: mysql
upvote count: 1
downvote count: 1
tagged with: prepared-statement
has answer: http://stackoverflow.com/a/23563647
type: Question
has comment: http://stackoverflow.com/comment/36154043
score: 0
has body: I have eleven fields which I want to insert in the database. The error that shows is that my 12 parameter is undefined which is ps.executeUpdate(). What should I do? My insert method is as follows. public void update(User user){ try{ Connection conn = DbUtils.getConnection(); PreparedStatement ps = conn.prepareStatement("UPDATE db.db set id = ?,username = ?,password = ?,firstname = ?, lastname = ?, fathersname =?, gender = ?, email = ?,address =? , phnno = ?, courses = ?" + "WHERE id =?"); ps.setInt(1, user.getId()); ps.setString(2, user.getName()); ps.setString(3, user.getPwd()); ps.setString(4, user.getFname()); ps.setString(5, user.getLname()); ps.setString(6, user.getFathername()); ps.setString(7, user.getAddress()); ps.setString(8, user.getEmail()); ps.setString(9, user.getGender()); ps.setString(10, user.getPhno()); ps.setString(11, user.getCradio()); ps.execute(); }catch(Exception e){ e.printStackTrace(); } `
has title: PreparedStatement error: Parameter 12 undefined
answer count: 1
has comment: http://stackoverflow.com/comment/36154210

http://stackoverflow.com/a/23500990
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/36041141
has comment: http://stackoverflow.com/comment/36041067
has comment: http://stackoverflow.com/comment/36041124
has comment: http://stackoverflow.com/comment/36040979
score: 3
has comment: http://stackoverflow.com/comment/36041038
has comment: http://stackoverflow.com/comment/36041231
downvote count: 0
answers question: http://stackoverflow.com/q/23500880
has body: Some suggestions never extend a Thread as it's a good way to confuse yourself. Never nest a Thread inside another Thread unless you really like confusion. if you want to run a thread for each socket, then create a new thread for each socket in the loop. Try the following (Note: You can add IOException handling code) class SocketAcceptor implements Runnable { public void run() { while(true) { Socket s=socket.accept(); SocketHandler sh = new SocketHandler(s); new Thread(sh).start(); } } } class SocketHandler implements Runnable { final Socket s; SocketHandler(Socket s) { this.s = s; } public void run() { System.out.println("New connection " + s); s.close(); } } A better solution would be to use a Thread pool. e.g. An ExecutorService, but I would get this working first.
has comment: http://stackoverflow.com/comment/36040895

http://stackoverflow.com/a/74533172
has body: Using the function and predicate you will easily get the output List ls = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9,-12); List<Double> collect3 = ls.stream().filter(ele ->ele%2==0).map(ele -> Math.pow(ele, 2)).collect(Collectors.toList()); System.out.println("Square of even elements =" + collect3); O/p- Square of even elements =[4.0, 16.0, 36.0, 64.0, 144.0]
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23520703

http://stackoverflow.com/comment/36019009
type: QuestionComment
comment on: http://stackoverflow.com/q/23489448
has text: and i always have to remove the @Override function?
score: 0
type: Comment

http://stackoverflow.com/comment/66928297
type: Comment
comment on: http://stackoverflow.com/a/23557041
has text: Why is this the correct answer? This will disable the whole Jlist, not multiple selection.
type: AnswerComment
score: 3

http://stackoverflow.com/a/23573250
has comment: http://stackoverflow.com/comment/36175956
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23573195
has comment: http://stackoverflow.com/comment/36176075
has body: Assuming that you wrote the code for LinkedListNode, you should know wether or not is Iterable, and thus be able to loop through it with a for-each loop like that. As it stands, you should traverse the nodes either recursively or in an iterative manner, by using some form of "next" pointers that is held within each node, and in essence do a linear search through the links until you find the data you are looking for, or return null. Here's a link for some help on implementing a linked list: http://www.danielacton.com/Data-Structures/Linked-List/Java/

http://stackoverflow.com/comment/36019335
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23489362
score: 0
has text: Thaks Mr Pandey. It showed me some number of hours to prepare for the exam but I want to know if there is any book for upgrade exam or not..

http://stackoverflow.com/q/23555613
has body: I am relatively new to java and I have to create a pig latin translator for a phrase. Here's the code I have right now so that I can split the phrase that the user would enter. Sorry for the improper formatting. String english = "Queen of all reptiles"; String[] words = english.split ("\\s+"); for (int i = 0 ; i &lt; words.length ; i++) { System.out.println (words [i]); } The output for this code is: Queen of all reptiles However, I would like to split the String english by spaces and special characters so that if String english = "Queen. of reptiles." it would output: Queen . of reptiles . I attempted to do this: String[] words = english.split ("[^a-zA-Z0-9]", ""); but it does not work.
tagged with: string
has answer: http://stackoverflow.com/a/23555736
favorite count: 0
type: Question
tagged with: regex
has title: Java: Split a string by special characters and spaces
score: 0
answer count: 3
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23555930
has comment: http://stackoverflow.com/comment/36143387
tagged with: java
linked to: http://stackoverflow.com/q/2206378
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23555669

http://stackoverflow.com/q/23609370
has comment: http://stackoverflow.com/comment/36244482
tagged with: maven
has comment: http://stackoverflow.com/comment/36280647
has title: UIMA Ruta with Maven
tagged with: uima
upvote count: 2
tagged with: ruta
tagged with: java
has comment: http://stackoverflow.com/comment/36279932
has comment: http://stackoverflow.com/comment/36278441
has comment: http://stackoverflow.com/comment/36280662
type: UnansweredQuestion
has body: I am beginner in UIMA Ruta. I followed this to use Ruta with Maven. I understood this but I want to do few more things. Below is my simple test case to run this example /** * Test Annotators on default input to ascertain their proper functioning. * */ public class TestAnnotator { /** * UIMA type holding dates. */ public static final String DATE_TYPE = "uima.ruta.example.TestAnnotator.DateValue"; /** * UIMA type holding Eight Digit Numbers. */ public static final String EIGHT_DIGIT_TYPE = "uima.ruta.example.TestAnnotator.EightDigit"; /** * UIMA type holding Number block. */ public static final String NUMBER_VALUE_BLOCK = "uima.ruta.example.TestAnnotator.NumberValueBlock"; /** * */ public static final String NUM = "org.apache.uima.ruta.type.NUM"; /** * Text to process. */ public static final String TEXT = "I will be out of office from September 2nd, 2013 to September 20th, 2013.\n" + "Dates like 9/2/2013 and 9/20/13 are also recognized. Eight Digit Number 99192293 and Nine digit Number 113993910" + " 900839806 916 268 1069 290 <OcrConfidence />"; /** * Engine instance used for UIMA analysis */ private AnalysisEngine engine; /** * CAS instance used for analysis */ private CAS cas; /** * Sets Annotator Engine * * @throws Exception */ @Before public void setup() throws Exception { System.out.println("Starting Analysis Engine"); engine = AnalysisEngineFactory .createEngine("com.demo.extraction.uima.annotators.TestAnnotatorEngine"); cas = engine.newCAS(); cas.setDocumentText(TEXT); engine.process(cas); } /** * Tests the input * * @throws Exception */ @Test public void test() throws Exception { System.out.println("Extracting date from"); System.out.println(TEXT); for (AnnotationFS date : CasUtil.select(cas, cas.getTypeSystem() .getType(DATE_TYPE))) { System.out.println("Found: " + date.getCoveredText()); } System.out.println("Extracting Number Block from"); System.out.println(TEXT); for (AnnotationFS number : CasUtil.select(cas, cas.getTypeSystem() .getType(NUM))) { System.…
has comment: http://stackoverflow.com/comment/36280552
score: 2
answer count: 0
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36275687
type: Question
has comment: http://stackoverflow.com/comment/36275703

http://stackoverflow.com/a/23550497
has comment: http://stackoverflow.com/comment/36188972
has comment: http://stackoverflow.com/comment/36133937
type: Answer
has body: You asume the height needs to resize the most(look at your height/1080). I might be that the width has to resize the most. I use this to scale them: //Calculate what scale is needed double xFactor = (double)image.Width/(double)ScreenWidth; double yFactor = (double)image.Height/(double)ScreenHeight; double factor = xFactor; if(yFactor&gt;xFactor){ factor = yFactor; } int imageWidth = Convert.ToInt32(im.Width / factor); int imageHeight = Convert.ToInt32(im.Height / factor); Note: this is written in C#. It needs some changes to work. Note2: this makes sure the image will be full screen.(as much as possible, because it is scalled)
has comment: http://stackoverflow.com/comment/36133695
has comment: http://stackoverflow.com/comment/36133516
has comment: http://stackoverflow.com/comment/36133821
answers question: http://stackoverflow.com/q/23550357
score: 0

powermock
tags question: http://stackoverflow.com/q/23573694
tag name: powermock
tags question: http://stackoverflow.com/q/23610385
type: Tag
tags question: http://stackoverflow.com/q/23604528

typeconverter
type: Tag
tags question: http://stackoverflow.com/q/23526949
tag name: typeconverter

http://stackoverflow.com/comment/36111419
comment on: http://stackoverflow.com/a/23538636
has text: the one Tedil mentioned
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23593218
has body: Java by default doesn't generate any executable file. It generates jar packages that are platform independent. The jar can be executed through the Java Virtual Machine (JVM), which is java.exe in Windows. This is the main software to execute Java applications. If you want/need to execute any Java application in your PC or device, it must have a JVM (distributed under the name Java Runtime Environment or JRE) installed and configured. If you want to go further and develop your own applications using Java, you will need to also install a Java Development Kit (JDK), note that every JDK already ships a JRE installation. The fact your application has an additional exe file for Windows is that this exe will execute the JVM and the jar for you, and probably add some parameters to the JVM for the Java application execution. There are some applications called Java Executable Wrappers. These can wrap your Java application (jar) and convert it into an exe, but note that even these applications will start a JVM process for you behind the scenes (usually executing java -cp &lt;path&gt;:. the.desired.package.MainClass along with a set of JVM parameters), and some of them will fire the JVM download in case it is not properly installed. You can find more info about this here: Compiling a java program into an executable How can I convert my Java program to an .exe file? TL;DR You need a Java Virtual Machine (JVM, JRE) to execute a Java application, regardless the device you're using. Here's the link to download the latest Java JRE 8 version
has comment: http://stackoverflow.com/comment/36213242
has comment: http://stackoverflow.com/comment/36213000
has comment: http://stackoverflow.com/comment/36213329
has comment: http://stackoverflow.com/comment/36212944
score: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/36213383
has comment: http://stackoverflow.com/comment/36213108
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36213265
accepted answer of: http://stackoverflow.com/q/23593167
answers question: http://stackoverflow.com/q/23593167
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/36212975

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/23489555
tags question: http://stackoverflow.com/q/23608326
tag name: google-oauth

http://stackoverflow.com/q/23506418
has answer: http://stackoverflow.com/a/23506606
has answer: http://stackoverflow.com/a/23506886
answer count: 5
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36051341
has comment: http://stackoverflow.com/comment/36051316
has title: if statement string always prints
type: Question
has answer: http://stackoverflow.com/a/23506462
has body: do{ System.out.println("Would you like to enter another number? (y/n)"); restart = console.next().charAt(0); if (!(restart=='y')||!(restart=='n')||!(restart=='N')||!(restart=='Y')) { System.out.println("You entered something other than the letters (y) or (n)."); } else if (restart=='n'||restart=='N') {System.out.println("Goodbye.");} } while (!(restart=='y')||!(restart=='n')||!(restart=='N')||!(restart=='Y'));} while (restart=='y'||restart=='Y');}} I want the user to enter upper or lower case y or n and if its y then restart the program which worked fine before i started to add something to catch anything that wasnt a y or n. I want upper or lower case n to display goodbye and nothing happen and anything other than y or n to ask again to enter y or n until it gets the corect input and instead it always displays the you entered something other than... message and repeatedly asks if ud like to enter another number
has answer: http://stackoverflow.com/a/23507147
score: 0
has answer: http://stackoverflow.com/a/23506451

http://stackoverflow.com/q/23471136
favorite count: 0
type: UnansweredQuestion
tagged with: apache-pig
has body: I want to use the PigServer java class to run pig scripts on a remote hadoop cluster. At the moment I am using the cloudera cdh4.4.0 distribution for testing pusposes. I'm running my java program from within the cloudera VM. The directory with the hadoop config files is included in the classpath. When I run the same script in map reduce mode in shell it works just fine. Thanks in advance for your answer. The java code: Properties props = new Properties(); props.setProperty("fs.default.name", "hdfs://localhost.localdomain:8020"); props.setProperty("mapred.job.tracker", "localhost.localdomain:8021"); PigServer pigServer = new PigServer(ExecType.MAPREDUCE, props); pigServer.registerQuery("batting = load './Batting.csv' using PigStorage(',');"); pigServer.registerQuery("runs_raw = FOREACH batting GENERATE $0 as playerID, $1 as year, $8 as runs;"); pigServer.registerQuery("runs = FILTER runs_raw BY runs > 0;"); pigServer.registerQuery("grp_data = GROUP runs by (year);"); pigServer.registerQuery("max_runs = FOREACH grp_data GENERATE group as grp, MAX(runs.runs) as max_runs;"); pigServer.registerQuery("join_max_run = JOIN max_runs by ($0, max_runs), runs by (year,runs);"); pigServer.registerQuery("join_data = FOREACH join_max_run GENERATE $0 as year, $2 as playerID, $1 as runs;"); pigServer.store("join_data", "join_data"); I also added the following maven dependency org.apache.hadoop hadoop-client 2.2.0 Upon running my java program I'm getting the following stacktrace: log4j:WARN No appenders could be found for logger (org.apache.hadoop.conf.Configuration.deprecation). 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.apache.pig.impl.logicalLayer.FrontendException: ERROR 1000: Error during parsing. Unable to check name hdfs://localhost.localdomain:8020/user/cloudera* at org.apache.pig.PigServer$Graph.parseQuery(PigServer.java:1608) at org.apache.pig.Pig…
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: hadoop
tagged with: cloudera
has title: Using PigServer to run mapreduce jobs
upvote count: 1

http://stackoverflow.com/comment/35999095
comment on: http://stackoverflow.com/q/23476427
has text: Although it's almost certainly not related, you do not need the `@Repository` annotation on `UserRepository`. Spring Data creates repositories that extend CrudRepository and are within the packages you have stated in your configuration
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/36178298
comment on: http://stackoverflow.com/a/23567594
score: 0
type: AnswerComment
has text: michael.hor257k, I would like to tinker as less as possible to not at all with the data.xml
type: Comment

http://stackoverflow.com/q/23531951
type: Question
score: 3
tagged with: android
favorite count: 0
has body: I'm writing an Android messaging application, and 1 class is calling another class, and I wish for the calling class to wait for the callee class to complete before carrying on. Caller Class (MessageManagement) code snippet is as follows: private static Messenger myMessenger; try { Message msg = Message.obtain(); msg.arg1 = constructedMessage.length(); msg.arg2 = -1; msg.obj = constructedMessage; Log.d(TAG, "Calling myMessenger.send()"); myMessenger.send(msg); Log.d(TAG, "Sent"); } catch (Exception e) { e.printStackTrace(); } // Wait here until myMessenger completes its task doOtherStuff(); Right now, doOtherStuff() starts and finishes before myMessenger starts. I need myMessenger to complete before doOtherStuff() starts. I've read about wait() and notify() but I'm not sure how to implement it here, or whether it's the right choice. Some background about the flow of the program. It's basically a messaging app that I inherited, so I'm not exactly sure of its framework. From what I can tell tracing the flow of the code: When an SMS message is received, the SMS receiver BroadcastReceiver(SmsReceiver) handles it, getting the sender address and message body, then calling a SMS handler service(HandleSmsService), which then calls the caller class in a runnable with the following code: HandleSmsService public class HandleSmsService extends Service { private String message; private MessageManagement messageManager; private Handler timeoutHandler = new Handler(); @Override public void onStart(Intent intent, intent startid) { message = intent.getExtras().getString("message"); messageManager = new MessageManagement(this); timeoutHandler.postDelayed(runnable, 10); } private Runnable runnable = new Runnable() { @Override public void run() { try { messageManager.handleMessage(message); stopSelf(); } catch (Exception e) { e.printStackTrace(); } } }; MessageManagement is my caller class, and MessageManagement.handleMessage() is the top most code snippet presented earlier. The Messag…
answer count: 2
has answer: http://stackoverflow.com/a/23532420
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/23532326
downvote count: 0
tagged with: wait
type: UnansweredQuestion
tagged with: notify
has title: How to make an Android class wait until another class completes its task?

http://stackoverflow.com/comment/36180267
type: Comment
type: QuestionComment
has text: For a Sudoku board use a 3x3 `Gridlayout`.
score: 0
comment on: http://stackoverflow.com/q/23575116

http://stackoverflow.com/q/23535365
has answer: http://stackoverflow.com/a/23538202
linked to: http://stackoverflow.com/q/8287584
tagged with: java
linked to: http://stackoverflow.com/q/23469730
linked to: http://stackoverflow.com/q/23184333
type: Question
tagged with: aspectj
has title: How to avoid titlebar of activity loading before actual activity loads and make it load with the activity load using java code?
linked to: http://stackoverflow.com/q/21914482
score: 0
has comment: http://stackoverflow.com/comment/36105756
has body: . I am doing reverse-engineering of applications.While reverse-engineering an app i needed to change the titles of each activities in an app that i got .I have a problem regarding activity titlebar. Actually the developers of this app have set many of the titles from androidManifest.xml file using &lt;activity android:name="com.example.dmo.MainActivity" android:label="first"&gt;&lt;/Activity&gt; I changed the title of each activity by putting setTitle(" say abc"); in onCreate() of each activity and title is successfully changed, But problem is that while loading activity it shows the titlebar with the title from androidManifest.xml file i.e. android:label="first". This title appears for some miliseconds (time increases if activity takes more tome to load), and then when my activity loads completely, title changes to the text i passed in setTitle() in onCreate(). This is somewhat similar to my problem. I am not able to find solution since i have a strict restrictions that i can not make changes in any of the .xml fiels in an applicaion. I only allowed to change the java code and add some new java code if necessary. I searched a lot but all solutions i found suggested changes in xml files; and some other solutions those suggested using code did not worked. So is there any solution that does not require manual hard code xml changes directly. Changing xml using code is acceptable but not hard code changes like editing their original manifest file to :`&lt;activity android:name="com.example.dmo.MainActivity" android:label="say abc"&gt;&lt;/Activity&gt;` Any AspectJ solution is also acceptable(i.e. some pointcut to some method that can do the work for me), if someone knows for the same. I also want to know that, which class or api is responsible to load title bar before activity loads? ,so that if possible i can make changes in that . Any help would be very appreciable . .Thank u in advance . .
answer count: 1
tagged with: android-activity
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36109072

http://stackoverflow.com/comment/36097445
type: QuestionComment
has text: Once you read in a line, split that line on the ' ' character.
type: Comment
comment on: http://stackoverflow.com/q/23530897
score: 0

jtextpane
tags question: http://stackoverflow.com/q/23588880
tag name: jtextpane
tags question: http://stackoverflow.com/q/23608144
type: Tag
tags question: http://stackoverflow.com/q/23534184
tags question: http://stackoverflow.com/q/23593392

http://stackoverflow.com/comment/36131827
comment on: http://stackoverflow.com/a/23549546
type: AnswerComment
has text: yes `List<LinkedList<MyEntry<k, v>>>` is an interface.
score: 0
type: Comment

http://stackoverflow.com/q/23556822
answer count: 1
has comment: http://stackoverflow.com/comment/36145992
tagged with: java
accepted answer: http://stackoverflow.com/a/23557476
has body: Ive written some code that creates an XML file from my System Properties in java. It works exactly how I want it to but I really (really) dont like how I ended up just using like 5 if statements to get it to work since I noticed none of the properties go beyond 4 delimited substrings anyways. Id much prefer using an iterator and some kind of hasNext() method to continue appending onto elements until the end of the string but I couldn't work anything out. I couldn't find a way to append the newest tag onto the last one in a loop/ add the value to the end of the elements. This is what I currently have as a quick fix to get the program running. Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("JAVA"); doc.appendChild(rootElement); Iterator it = hm.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); String keyString = (String)entry.getKey(); String val = (String)entry.getValue(); java.util.List&lt;String&gt; sa = Arrays.asList(keyString.split("\\.")); Iterator ait = sa.iterator(); Element tag = doc.createElement((String) ait.next()); rootElement.appendChild(tag); Element tag2 = null; Element tag3 = null; Element tag4 = null; Element tag5 = null; while(ait.hasNext()) { if(ait.hasNext()) { tag2 = doc.createElement((String)ait.next()); tag.appendChild(tag2); if(!ait.hasNext()) tag2.appendChild(doc.createTextNode(val)); } if(ait.hasNext()) { tag3=doc.createElement((String)ait.next()); tag2.appendChild(tag3); if(!ait.hasNext()) tag3.appendChild(doc.createTextNode(val)); } if(ait.hasNext()) { tag4=doc.createElement((String)ait.next()); tag3.appendChild(tag4); if(!ait.hasNext()) tag4.appendChild(doc.createTextNode(val)); } if(ait.hasNext()) { tag5=doc.createElement((String)ait.next()); tag5.appendChild(tag5); if(!ait.hasNext()) tag5.appendChild(doc.createTextNode(val)); } } } Transformer transformer = null; TransformerFactory transformerFactory = TransformerFactory.newInstance(); try { DOMSource source = new DO…
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/23557476
tagged with: http://stackoverflow.com/tag/xml
score: 0
has title: Trying to build XML file with iterator in java

http://stackoverflow.com/q/23600633
has title: How do you grab all of the entries of a JList?
tagged with: user-interface
answer count: 1
has body: I have the following objects accessible (plus many others which don't seem to be relevant to the question at this time). Objects: listModel = new DefaultListModel(); inputField = new JTextField(10); addButton = new JButton("+"); usernameList = new JList(listModel) The ActionListener for the 'addButton': public void actionPerformed(ActionEvent e) { System.out.println("addButton clicked!"); Variables.username = inputField.getText(); System.out.println("Username now: " + Variables.username); listModel.addElement(Variables.username); inputField.setText(null); } At the moment, the 'addButton' grabs the input from the JTextField (inputField) and adds it to the listModel, and updates the JList (usernameList) with the new string. What I need to do now is take each element and either add each element to a different element within a pre-declared string array. How would I accomplish grabbing all of the elements passed to the JList?
type: UnansweredQuestion
tagged with: java
score: 0
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/23600683

http://stackoverflow.com/comment/36330153
comment on: http://stackoverflow.com/a/23611537
has text: please elaborate , i didn't get you.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23562431
tagged with: scope
accepted answer: http://stackoverflow.com/a/23563394
answer count: 1
downvote count: 0
tagged with: variables
favorite count: 0
has title: java. redeclare class field within class initializer and local variable within method nested block(framed braces) differences
type: AnsweredQuestion
score: 1
tagged with: java
has body: I prepare for scjp exam and noticed surprising behaviour for me. public class Test { int k; { int k; // it is valid variant } public static void main(String[] args) { int kk; { int kk; // NOT VALID.java: variable kk is already defined in method main(java.lang.String[]) } } public void method (int var){ int var;//NOT VALID.java: variable var is already defined in method method(int) } } Always in my mind I kept following rule: I thought that all three variants is possible and inner definition would overlap external. example shows that it is wrong rule. Please clarify this situations and explain common rule for familiar situations. P.S. public class Test { int k; { int k; { int k; //java: variable k is already defined in instance initializer of class Test } } }
upvote count: 1
tagged with: methods
type: Question
tagged with: redeclare
has answer: http://stackoverflow.com/a/23563394

http://stackoverflow.com/comment/36187663
comment on: http://stackoverflow.com/a/23578151
type: Comment
has text: did you try `view.findViewById()` instead of `v.findViewById()`;? you need change `view` to final
type: AnswerComment
score: 0

http://stackoverflow.com/q/23472852
has answer: http://stackoverflow.com/a/23472971
has comment: http://stackoverflow.com/comment/35988252
answer count: 4
has title: Java Evaluate the least number out of many variables
has body: I have four variables that I will not know until I call on the function but I need to determine out of the four variables which one is the least. Is there quick way to to do this without a lot of if else statements or is that the only way? If there equal then that needs to be returned to. int TOP, BOTTOM, LEFT, RIGHT; String MIN; min(TOP, BOTTOM, LEFT, RIGHT) { FOUND MINNUM; return MINSTRING; } I realized that if there are multiple equal values that I need to return consistently the same equal value and the only way I can return it consistently if I return the string of the direction that is equal that is choosen to be min. Then I can check the string rather the integer to be more accurate.
upvote count: 2
accepted answer: http://stackoverflow.com/a/23472915
has comment: http://stackoverflow.com/comment/35987928
has answer: http://stackoverflow.com/a/23472960
possible better answer: http://stackoverflow.com/a/23472991
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35987964
has answer: http://stackoverflow.com/a/23472915
tagged with: java
has comment: http://stackoverflow.com/comment/36196911
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/35987966
has answer: http://stackoverflow.com/a/23472991
favorite count: 0
has comment: http://stackoverflow.com/comment/35987930

http://stackoverflow.com/a/23538045
answers question: http://stackoverflow.com/q/23537938
type: Answer
has body: While generating query keep one thing in mind that to run first it in sql shell or tool then implement in your code with proper spacing and string manipulation. sql = "SELECT DISTINCT bus_stops.stopID, street1, street2 FROM bus_stops INNER JOIN scheduled_stops ON bus_stops.stopID = scheduled_stops.stopID"+ " WHERE scheduled_stops.routeNumber = '"+route+"' "+ " AND scheduled_stops.direction = '"+dir+"' "+ " AND scheduled_stops.stopTime &gt; (SELECT stopTime FROM scheduled_stops WHERE scheduled_stops.stopID = '"+stop1+"' ORDER BY scheduled_stops.stopTime asc limit 1)"+ " AND scheduled_stops.stopTime &lt; (SELECT stopTime FROM scheduled_stops WHERE scheduled_stops.stopID = '"+stop2+"' ORDER BY scheduled_stops.stopTime asc limit 1)";
accepted answer of: http://stackoverflow.com/q/23537938
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/36169526
has text: [Strongly related](https://www.google.com/search?q=networkonmainthreadexception&oq=NetworkOnMain&aqs=chrome.1.69i57j0l5.6273j0j8&sourceid=chrome&es_sm=122&ie=UTF-8)
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/23569897

http://stackoverflow.com/a/23543709
upvote count: 1
answers question: http://stackoverflow.com/q/23543584
has body: You've lots of problems with that code including: You're creating a new Scanner object with each iteration of your while loop -- don't do that. Create the object once before the loop. You're continually creating new Timers and TimerTasks, with the implicit assumption that each new one will somehow change the previous one, and this simply won't happen. Your if/else clause is unnecessary since both code blocks are identical. You create all Timers and TimerTasks locally with limited scope, preventing code elsewhere in your class from being able to access it and attempt to change its state. You're asking a somewhat ambiguous question And are asking others to provide code for you, something we don't do for homework assignments.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36121509
type: Answer

http://stackoverflow.com/comment/93905307
score: 0
type: QuestionComment
type: Comment
has text: "_I get 8310 km even when I shake the mobile._", what does it mean?
comment on: http://stackoverflow.com/q/23490952

http://stackoverflow.com/a/23597712
downvote count: 0
score: 1
upvote count: 1
has body: Missing Date Portion As the other correct answers said, you are using the java.util.Date class which is a date-time class holding both a date portion and a time portion. LocalTime If you truly care about only time of day, with no date and no time zone, then use the LocalTime class found in both the Joda-Time library and the new java.tome package in Java 8. By the way the old java.util.Date and .Calendar classes are notoriously troublesome and should be avoided. Joda-Time Here is some code with date-time and time zone. Using the Joda-Time 2.3 library… DateTimeZone timeZone = DateTimeZone.forID( "Europe/Warsaw" ); DateTime dateTime = new DateTime( 2014, 1, 2, 8, 45, 0, timeZone ); DateTime now = new DateTime( 2014, 1, 2, 8, 30, 0, timeZone ); // Or DateTime.now( timeZone ) Duration duration = new Duration( dateTime, now ); // or use Period or Interval. Joda-Time offers intelligent classes and methods of working with a span of time (a Period, Interval, or Duration). For example look at the Minutes class. But if all you need is millseconds, here you go. long millis = duration.getMillis();
answers question: http://stackoverflow.com/q/23593697
type: Answer

http://stackoverflow.com/q/23496108
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36037152
has body: I got an error below when I try to change from Calendar class to a mock class by using jmockit(version1.8). Doen anyone know how to fix it ? Any help will be appreciated. Thanks, CalendarMock.java import java.util.Calendar; import java.util.GregorianCalendar; import mockit.*; public final class CalendarMock extends MockUp&lt;Calendar&gt; { @Mock public static Long getInstance() { return new GregorianCalendar(2000, 0, 1, 0, 0, 0).getTimeInMillis(); } } DummyTest.java public void testDummy() throws Exception { new CalendarMock(); } Error Log java.lang.VerifyError: mockit/internal/startup/Startup at mockit.MockUp.&lt;clinit&gt;(MockUp.java:85) at com.hoge.testDummy(DummyTest.java:) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
tagged with: java
tagged with: jmock
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36080100
has answer: http://stackoverflow.com/a/53954168
tagged with: jmockit
has comment: http://stackoverflow.com/comment/36052636
has answer: http://stackoverflow.com/a/26440669
score: 0
has title: Android + jmockit: java.lang.VerifyError: mockit/internal/startup/Startup
tagged with: android
tagged with: junit

http://stackoverflow.com/q/23475818
accepted answer: http://stackoverflow.com/a/23477033
type: Question
tagged with: java
has body: I need to save data from TextView to and SQLite database in HTML format. I'm using this code to convert text from TextView to HTML-formatted string: public static String htmlToString(TextView textview) { SpannableString contentText = (SpannableString) textview.getText(); return Html.toHtml(contentText).toString(); } However, I get this error: 05-05 17:01:37.033: E/AndroidRuntime(14295): java.lang.ClassCastException: android.text.SpannableStringBuilder cannot be cast to android.text.SpannableString How can I fix this?
score: 2
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23477033
favorite count: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion
upvote count: 2
has title: SpannableStringBuilder cannot be cast to android.text.SpannableString

http://stackoverflow.com/q/23477062
has comment: http://stackoverflow.com/comment/35995870
has comment: http://stackoverflow.com/comment/36013779
has answer: http://stackoverflow.com/a/23477151
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/35996127
type: Question
has answer: http://stackoverflow.com/a/23477370
has comment: http://stackoverflow.com/comment/35996666
tagged with: algorithm
has comment: http://stackoverflow.com/comment/35996006
tagged with: java
has title: How do I get my program to do random methods?
tagged with: methods
has comment: http://stackoverflow.com/comment/36000021
answer count: 2
has comment: http://stackoverflow.com/comment/36016208
tagged with: user-interface
has body: I'm working on a project for the google science fair. I'm making an application which takes two numbers (Barcode and Serial Number) and changes them into two different numbers using various algorithms( i.e, Like Fisher-Yates shuffle). My code looks something like this : enter code here public static void main(String[] args) { reverseNum b = new reverseNum(); addOne c= new addOne(); plusThree f= new plusThree(); plusNine i = new plusNine(); plusTwo l = new plusTwo(); minusTwo p = new minusTwo(); plusOne r= new plusOne(); plusFour u= new plusFour(); threeTwo x= new threeTwo(); intoTwo ab= new intoTwo(); plusFive bc = new plusFive(); intoSix cd= new intoSix(); twoOne de = new twoOne() ; plusSeven ef= new plusSeven(); plusEight fg= new plusEight(); minOne gh = new minOne(); intoSeven hi = new intoSeven(); intoEight ij = new intoEight(); intoNine jk = new intoNine(); intOne kl = new intOne(); intoFour lm = new intoFour(); // TODO code application logic here Scanner user_input = new Scanner( System.in ); String a ; System.out.println("Enter the Barcode:"); a = user_input.next(); System.out.println("Encrypted Barcode:"+ blah.randomMethod(a)); //Random method from the above given methods should modify this. String z; System.out.println("Enter the Serial Number:"); z= user_input.next(); System.out.println("Encrypted Serial Number:" + blah.randomMethod(z) ); //Random method from the above given methods should modify this } } My main objective is to modify the two given numbers with the above mentioned methods(algorithms).I want a random method from the given list to modify the given numbers each time the user runs the program. I also need to put this all into a GUI. Please help.
has comment: http://stackoverflow.com/comment/36081668
has comment: http://stackoverflow.com/comment/35997410
has comment: http://stackoverflow.com/comment/36078429
score: 0

http://stackoverflow.com/a/23520060
has comment: http://stackoverflow.com/comment/36078845
has comment: http://stackoverflow.com/comment/36076051
answers question: http://stackoverflow.com/q/23519848
upvote count: 5
has comment: http://stackoverflow.com/comment/36079079
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36076097
accepted answer of: http://stackoverflow.com/q/23519848
type: Answer
has body: You are correct that it only appears in the "last card it was added to", but that has nothing to do with CardLayout, that has to do with the fact each component can only be in one parent. From the Javadoc for java.awt.Container.addImpl(Component comp, Object constraints, int index): If the component is not an ancestor of this container and has a non-null parent, it is removed from its current parent before it is added to this container.
has comment: http://stackoverflow.com/comment/36079229

http://stackoverflow.com/comment/36127607
score: 0
type: Comment
type: QuestionComment
has text: I think this should work if you place a `GO` after the `TABLE` creation and after each `PROC` creation
comment on: http://stackoverflow.com/q/23547233

http://stackoverflow.com/comment/36222083
type: QuestionComment
type: Comment
has text: possible duplicate of [Java - use of volatile only makes sense in multiprocessor systems?](http://stackoverflow.com/questions/4606895/java-use-of-volatile-only-makes-sense-in-multiprocessor-systems)
comment on: http://stackoverflow.com/q/23593061
score: 0

http://stackoverflow.com/a/44118296
type: Answer
upvote count: 42
has comment: http://stackoverflow.com/comment/104523337
has body: This was a Tomcat bug that resurfaced again with the Java 9 bytecode. The exact versions which fix this (for both Java 8/9 bytecode) are: trunk for 9.0.0.M18 onwards 8.5.x for 8.5.12 onwards 8.0.x for 8.0.42 onwards 7.0.x for 7.0.76 onwards
answers question: http://stackoverflow.com/q/23541532
has comment: http://stackoverflow.com/comment/81090497
has comment: http://stackoverflow.com/comment/93415736
downvote count: 0
score: 42

http://stackoverflow.com/q/23524351
score: 0
has body: I am using CustomTabbedPane in my class to show different panels within one frame. It works fine as far as functionality is concerned. I want my program to be elegant so I don't want a tab to show up, when a user click the button, that is already open. I have searched it for like more than 3 hours but didn't find anything similar to my problem. Below is my code snippet of action-listener for adding product. addProduct.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent arg0) { Product obj=new Product(); //if(isTabPresent()){ obj.start(); mainPane.addTab("Add Product",obj); mainPane.setSelectedComponent(obj); //} } }); I have also made a method isTabPresent() to check whether the tab is available in the mainPane(CustomTabbedPane) or not. I have commented isTabPresent() because it is not working the way I want. public boolean isTabPresent(Object tab){ for(int i=0;i&lt;mainPane.getTabCount();i++) if(mainPane.getComponentAt(i).equals(tab)) return true; return false; } This is what I have tried to get my job done but its not working. Any help or any better suggestion would be appreciated. Thanks a lot!
type: UnansweredQuestion
tagged with: swing
answer count: 0
has comment: http://stackoverflow.com/comment/36084938
tagged with: java
has comment: http://stackoverflow.com/comment/36084602
type: Question
has title: CustomTabbedPane: stop opening of tabs that are already open
has comment: http://stackoverflow.com/comment/36087742

http://stackoverflow.com/comment/36407202
has text: It should hold a GUI component to visualize the incoming post request of a resource. I'll try ServletContextListener, thanks.
comment on: http://stackoverflow.com/q/23608045
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23546761
has answer: http://stackoverflow.com/a/23547545
has comment: http://stackoverflow.com/comment/36130289
score: 0
has title: How to convert an ASCII string to base64 in XSL without extensions?
has comment: http://stackoverflow.com/comment/36128185
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/23547545
type: AnsweredQuestion
tagged with: java
tagged with: xslt-2.0
type: Question
has body: Using Java extensions, converting an ASCII string to base64 in XSL is simple. But bug JDK-8004476 prevents extension from working if your application is launched via webstart. Is there any other mechanism that can convert to base64 that I could implement in XSL?

http://stackoverflow.com/a/23508704
has comment: http://stackoverflow.com/comment/36056240
has body: Instead of removing value from sharedpreference you can just edit value of sharedpreference with null value. public void logoutUser() { editor.putBoolean(IS_LOGIN, false); editor.putBoolean(KEY_DEVICEREGISTERED, false); editor.putString(KEY_EMAILID, null); editor.putString(KEY_USERSNAME, null); editor.commit(); } i think this will work..
answers question: http://stackoverflow.com/q/23508550
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36056613
has comment: http://stackoverflow.com/comment/36056871
score: 1
has comment: http://stackoverflow.com/comment/36056912
has comment: http://stackoverflow.com/comment/36055484

http://stackoverflow.com/comment/99605335
type: Comment
score: 1
comment on: http://stackoverflow.com/q/23596530
has text: I have discussed the theory behind `java.time` at length here: https://stackoverflow.com/a/56508200/145989
type: QuestionComment

http://stackoverflow.com/comment/35975019
score: 0
type: Comment
has text: Not usually a good idea to give your class the same name as the API class that you're using inside it. Your problem here is that the compiler thinks you want your _own_ class, at `new TreeSet<String>`, and is complaining that _your_ class is not a generic, unlike `java.util.TreeSet`.
type: QuestionComment
comment on: http://stackoverflow.com/q/23465463

http://stackoverflow.com/comment/35980633
score: 0
type: Comment
type: QuestionComment
has text: what is the exact error you are getting? call f.show() to display your frame.
comment on: http://stackoverflow.com/q/23468884

http://stackoverflow.com/comment/36001694
score: 1
type: Comment
type: QuestionComment
has text: Try replacing `.trim()` by `.replaceAll("[^\\d]","")` and run again.
comment on: http://stackoverflow.com/q/23479829

http://stackoverflow.com/comment/36142318
has text: If you didn't override equals() and hashCode(), then 2 instances of Site, even if all their fields are equal, will be different. Read the javadoc of Object.equals() and Object.hashCode(), make sure to understand what they do and what their contract is, and override them. Also note that using public fields is bad practice, and using a mutable class as a Map key is dangerous.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23555029
score: 3

http://stackoverflow.com/q/23474905
tagged with: java
has comment: http://stackoverflow.com/comment/35991842
downvote count: 3
has comment: http://stackoverflow.com/comment/35992237
answer count: 1
linked to: http://stackoverflow.com/q/457276
has answer: http://stackoverflow.com/a/23548538
has title: Share object reference between different JUnit tests
has body: I have a couple of JUnit tests which need a reference for a expensive resource (a WALA class hierachie), which needs about 30s to be created. I would like to share this reference in my whole test suite. I thought about a static member in a base class which is laziely initiated with a @BeforeClass method. After test is run the JVM should be determined anyway. Is there any other way to accomplish this? Or any other best practice?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35991896
tagged with: junit
has comment: http://stackoverflow.com/comment/35991948
favorite count: 0
has comment: http://stackoverflow.com/comment/35991724
has comment: http://stackoverflow.com/comment/35991758
upvote count: 8
type: Question
linked to: http://stackoverflow.com/q/153427
accepted answer: http://stackoverflow.com/a/23548538
score: 5
linked to: http://stackoverflow.com/q/1921515
has comment: http://stackoverflow.com/comment/35991840

http://stackoverflow.com/comment/36143512
comment on: http://stackoverflow.com/q/23555500
type: Comment
type: QuestionComment
has text: Do the message or name fields contain html?
score: 0

http://stackoverflow.com/comment/36108407
type: QuestionComment
comment on: http://stackoverflow.com/q/23536856
type: Comment
score: 0
has text: So you want to start a thread when your app starts, but are saying this code merely starts a thread when the user opens the app. Is there a typo in here? sounds like exactly what you want.

http://stackoverflow.com/q/23473262
has answer: http://stackoverflow.com/a/48435788
tagged with: java
type: Question
has body: This is my index file &lt;form action="DataImport" method="post&gt;" &lt;input name="filename" type="file" size="20"&gt; &lt;input type="submit" value="Import"&gt; DataImport.java(Servlet) public class DataImport extends HttpServlet { private static final long serialVersionUID = 1L; public DataImport() { } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } @SuppressWarnings("rawtypes") protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String file = request.getParameter("file"); String fileName1=""+file+""; ArrayList dataHolder = read.readExcelFile(fileName1); Connection con = EmployeeDao1.con11(); System.out.println("Connection :"+con); @SuppressWarnings("unused") Statement sql_statement = con.createStatement(); String jdbc_insert_sql = "INSERT INTO emp4" + "(Id,name,salary) VALUES" + "(?,?,?)"; PreparedStatement ps = con.prepareStatement(jdbc_insert_sql); int count=0; ArrayList cellStoreArrayList=null; for(int i=1;i&lt;dataHolder.size();i++) { cellStoreArrayList=(ArrayList)dataHolder.get(i); ps.setString(1,((HSSFCell)cellStoreArrayList.get(0)).toString()); ps.setString(2,((HSSFCell)cellStoreArrayList.get(1)).toString()); ps.setString(3,((HSSFCell)cellStoreArrayList.get(2)).toString()); count= ps.executeUpdate(); } if(count&gt;0) { for (int j=1;j &lt; dataHolder.size(); j++) { cellStoreArrayList=(ArrayList)dataHolder.get(j); System.out.println(((HSSFCell)cellStoreArrayList.get(0)).toString()); System.out.println(((HSSFCell)cellStoreArrayList.get(1)).toString()); System.out.println(((HSSFCell)cellStoreArrayList.get(2)).toString()); } } } catch(Exception e) { e.printStackTrace(); } } } this my read.java class to read the excel file public class read { @SuppressWarnings({"unchecked", "rawtypes"}) public static ArrayList readExcelFile(String fileName) { ArrayList cellArrayLisstHolder = new ArrayList(); try { POIFSFileSystem fs =…
tagged with: jsp
tagged with: servlets
score: 0
answer count: 3
has title: Import excel data and store it in database using jsp
has answer: http://stackoverflow.com/a/49908775
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23473353

http://stackoverflow.com/comment/35968459
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/23461478
has text: This can be vectorised in R. Take a look at ?rmultinom and ?replicate. For example: colSums(replicate(repeatcount, c(rmultinom(1, n, probabilities)) * 1:6)) gives you a vector of length repeatcount, where each element is a sum of n die-roll outcomes. It takes less than a second for n = 50 and repeatcount = 100000. You could then do a logical comparison of the vector against x, which could be a scalar or a vector of length n. Take the mean of that logical outcome and you have your proportion.
type: Comment

http://stackoverflow.com/a/23465262
has body: You can throw an EmptyStackException: throw new EmptyStackException(); Edit: In this page from Java Docs, there is an example of the pop() method and the exception mentioned before.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23465239
score: 4
answers question: http://stackoverflow.com/q/23465239

http://stackoverflow.com/q/23514141
has comment: http://stackoverflow.com/comment/36071487
tagged with: oop
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/36064833
type: UnansweredQuestion
has body: In java, does polymorphism only stands for a child object being referred by a parent reference? for example: if cat &amp; dog extends Animal, Animal a = new Dog(); //polymorphism happens here Animal b = new Cat(); //here too. Is this the only kind of polymorphism in java? (whether the usage is in collections or simply as in the example). This may be a novice question, but i am hoping, there is more to this scene &amp; experienced minds can share their thoughts. Thanks.
has answer: http://stackoverflow.com/a/23514691
tagged with: polymorphism
has comment: http://stackoverflow.com/comment/36071423
linked to: http://stackoverflow.com/q/1031273
type: Question
has comment: http://stackoverflow.com/comment/36065031
has title: Is referencing a child with parent, alone polymorphism in Java?

http://stackoverflow.com/a/23543500
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/23543459
answers question: http://stackoverflow.com/q/23543459
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: Simple solution: use a CardLayout to help you swap JPanels. Place a JPanel that uses CardLayout in the BorderLayout.SOUTH position, say called cardHolderPanel. Add the three "card" JPanels into the cardHolderPanel using unique String constants. Swap the cards by calling show(cardHolderPanel, APPROPRIATE_STRING_CONSTANT) on your CardLayout. Tutorial: http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html

http://stackoverflow.com/q/23553073
tagged with: arrays
downvote count: 0
has title: Grouping an array of integers that skip numbers in Java
favorite count: 0
has answer: http://stackoverflow.com/a/23553619
linked to: http://stackoverflow.com/q/23070332
has comment: http://stackoverflow.com/comment/36141825
has comment: http://stackoverflow.com/comment/36138660
answer count: 4
has comment: http://stackoverflow.com/comment/36138563
has comment: http://stackoverflow.com/comment/36356180
has comment: http://stackoverflow.com/comment/36166979
has comment: http://stackoverflow.com/comment/36138689
accepted answer: http://stackoverflow.com/a/23553619
upvote count: 1
has answer: http://stackoverflow.com/a/23553282
possible better answer: http://stackoverflow.com/a/23553574
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36138699
has answer: http://stackoverflow.com/a/23553574
has body: Say I have the following int array: [1,2,3,6,7, 8, 9,20, 22] I'd like to be able to display to the user the following based off the above array: Numbers 1 through 3, 6 through 9, 20, 22 How could I go about doing this? Essentially checking if the number previous equals the current number - 1? Guess I just answered my own question, but any shortcuts/pointers would be welcome. Note: only dealing with integers, nothing negative (wouldn't be an integer would it).
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23553355
type: Question

http://stackoverflow.com/comment/36267276
type: Comment
has text: though I read the article I didn't understand clearly how exceptions work.I'll have to read it again.Thanks for the answers
comment on: http://stackoverflow.com/a/23589814
type: AnswerComment
score: 0

http://stackoverflow.com/q/23599484
has answer: http://stackoverflow.com/a/23599503
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23599514
tagged with: java
tagged with: substring
has answer: http://stackoverflow.com/a/64328929
upvote count: 2
has answer: http://stackoverflow.com/a/23599498
favorite count: 0
tagged with: arraylist
answer count: 5
possible better answer: http://stackoverflow.com/a/23599498
has title: String is to Substring, as ArrayList is to?
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23599497
accepted answer: http://stackoverflow.com/a/23599497
has comment: http://stackoverflow.com/comment/36224987
has body: In Java, and many other languages, one can grab a subsection of a string by saying something like String.substring(begin, end). My question is, Does there exist a built-in capability to do the same with Lists in Java that returns a sublist from the original?
type: Question

http://stackoverflow.com/comment/36207981
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23589412
score: 0
has text: @Seelenvirtuose It might indeed, but it agrees with his present code. If it's not what he wants, let him fix it.

http://stackoverflow.com/a/43149194
has body: I do not think that Optional is a general substitute for methods that potentially return null values. The basic idea is: The absence of a value does not mean that it potentially is available in the future. It's a difference between findById(-1) and findById(67). The main information of Optionals for the caller is that he may not count on the value given but it may be available at some time. Maybe it will disappear again and comes back later one more time. It's like an on/off switch. You have the "option" to switch the light on or off. But you have no option if you do not have a light to switch on. So I find it too messy to introduce Optionals everywhere where previously null was potentially returned. I will still use null, but only in restricted areas like the root of a tree, lazy initialization and explicit find-methods.
upvote count: 2
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23454952
score: 1

http://stackoverflow.com/comment/36135133
has text: If you are really sure that it works then it must a custom classloader in case of the actual application. It's obvious that it's not the same classloader that you have when you run your tests. IMHO, I think it will be better for you to read up a bit on how the resources in classpath are read generally using class and classloader generally and use that instead because that would be portable.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23551166

http://stackoverflow.com/comment/36174451
type: Comment
type: QuestionComment
has text: Have you confirmed that the image you download each time is different? Based on your code there is nothing wrong. Try this: download and display the image in a single program (there is a constructor for ImageIcon taking an image, give it the one you create in your first sample). That way you will know if there is some cache mechanism preventing the refresh.
comment on: http://stackoverflow.com/q/23571836
score: 0

http://stackoverflow.com/q/23469784
downvote count: 1
answer count: 7
has answer: http://stackoverflow.com/a/23469897
accepted answer: http://stackoverflow.com/a/26371693
score: 38
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/36719103
has answer: http://stackoverflow.com/a/23469933
has body: i got a deserialization problem: This is my class: public class Response { private Object ResObj; private int ResInt; public Object getResObj() { return ResObj; } public int getResInt() { return ResInt; } } the JSON i want to deserialize is: {"ResObj":{"ClientNum":"12345","ServerNum":"78945","IdNum":"020252"},"ResInt":0} I get this exception: Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "ResObj" , not marked as ignorable (0 known properties: ]) at [Source: java.io.StringReader@1f758500; line: 1, column: 20] (through reference chain: ["ResObj"]) I don't want to add: @JsonIgnoreProperties(ignoreUnknown = true) because I want to get the ResObj... if I add the annotation, it pass but it will set it as null .. which I don't want.
has title: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field
possible better answer: http://stackoverflow.com/a/23469933
tagged with: jackson
has answer: http://stackoverflow.com/a/70279293
upvote count: 39
has answer: http://stackoverflow.com/a/42815663
has answer: http://stackoverflow.com/a/26371693
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7854030
favorite count: 0
has answer: http://stackoverflow.com/a/53953961
type: Question

http://stackoverflow.com/comment/35973156
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23464237
has text: Regarding edit, why not use [writeLong](http://docs.oracle.com/javase/7/docs/api/java/io/DataOutputStream.html#writeLong%28long%29) of DataOutputStream?

http://stackoverflow.com/q/23597898
has comment: http://stackoverflow.com/comment/36258501
has comment: http://stackoverflow.com/comment/36336661
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36222342
has body: I use maven and have a textfile in a sourcefolder called src/main/resources when I try to load a file from within the folder on my local system it works well BufferedReader reader = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream("/stopwords_german.txt"))); but as soon as I export the project as Runnable Jar in Eclipse and start the jar on my Server I get a Nullpointer exception Exception in thread "main" java.lang.reflect.InvocationTargetException 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:622) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58) Caused by: java.lang.NullPointerException at java.io.Reader.<init>(Reader.java:78) at java.io.InputStreamReader.<init>(InputStreamReader.java:72) at de.test.dataminer.helper.FilterText.initStopwords(FilterText.java:43) It's the line with the BufferedReader. I saw very similar questions here but nothing worked out so for that I tested to fix it (like to try with classloader). Anyone a pointer? /home/johnny/workspace/dataminer/src/main/resources
tagged with: eclipse
has title: Java jar didn't find file inside maven resource folder
upvote count: 1
tagged with: invocationtargetexception
answer count: 1
linked to: http://stackoverflow.com/q/676250
favorite count: 0
has answer: http://stackoverflow.com/a/23598224
tagged with: nullpointerexception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36222369
tagged with: maven
has comment: http://stackoverflow.com/comment/36223503

http://stackoverflow.com/a/23592752
answers question: http://stackoverflow.com/q/23592300
type: Answer
has body: You need to run any long-running bits of code, such as your while (true) loop in a background thread, else you risk tying up the Swing event thread, freezing your application. For example, your code could look something like: // implement Runnable so it can be run in a background thread public class MultiServer2 implements Runnable { public static final int PORT_NUMBER = 2222; private static final int THREAD_POOL_COUNT = 20; private List&lt;MultiClientHandler&gt; clientList = new ArrayList&lt;&gt;(); private ServerSocket serverSocket; private ExecutorService clientExecutor = Executors.newFixedThreadPool(THREAD_POOL_COUNT); public MultiServer2() throws IOException { serverSocket = new ServerSocket(PORT_NUMBER); } @Override public void run() { // do this in the run method so that it runs in a background thread while (true) { try { Socket clientSocket = serverSocket.accept(); // MultiClient2 also implements Runnable MultiClientHandler client = new MultiClientHandler(clientSocket); clientList.add(client); // and each socket's code needs to be run in its own thread clientExecutor.execute(client); } catch (IOException e) { // TODO notify someone of problem! e.printStackTrace(); } } } with a main method that looks something like: public static void main(String[] args) { try { MultiServer2 multiServer = new MultiServer2(); new Thread(multiServer).start(); // this runs the runnable } catch (IOException e) { e.printStackTrace(); } }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23592300
score: 0

http://stackoverflow.com/q/23517873
has body: I created TableViewer in that I'm setting table item text as following. item.setText(0, String.valueOf((char) 255)); After running the program there is nothing displaying for above. If I create org.eclipse.swt.widgets.Text or org.eclipse.swt.widgets.StyledText and set that value then I'm getting ÿ StyledText styledText = new StyledText(shell, SWT.BORDER); styledText.setText("Hello " + String.valueOf((char) 255)); I tried to set StyledCellLabelProvider but still no value is showing for String.valueOf((char) 255) I tried to run the application with -Dfile.encoding=utf-8 option but no help. What I'm missing here?, why table not displaying UTF-8 char
has comment: http://stackoverflow.com/comment/36071946
tagged with: encoding
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36072030
tagged with: utf-8
has title: UTF-8 Char are not displaying in TableViewer SWT
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: swt
type: Question
has comment: http://stackoverflow.com/comment/36072155
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/36176677
comment on: http://stackoverflow.com/a/23572391
type: Comment
has text: @user3621683 I'm not sure what you are trying to tell me here, or how it relates to the question.
type: AnswerComment
score: 0

android-scrollview
type: Tag
tag name: android-scrollview
tags question: http://stackoverflow.com/q/23459847

http://stackoverflow.com/a/23533148
has comment: http://stackoverflow.com/comment/36114796
has comment: http://stackoverflow.com/comment/36102073
answers question: http://stackoverflow.com/q/23532781
type: Answer
upvote count: 4
downvote count: 0
has body: Break the problem in small steps. Loops for printing correct rectangle without patterns for (int i = 0; i &lt; 5; i++) { for (int j = 0; j &lt; 9; j++) { System.out.print("-"); } System.out.println(); } This would give following output. --------- --------- --------- --------- --------- Create pattern using if condition. for (int i = 0; i &lt; 5; i++) { for (int j = 0; j &lt; 9; j++) { if ((j - i) % 2 == 0) { // Condition for alternate stars System.out.print("*"); } else { System.out.print("-"); } } System.out.println(); } This would give following output. *-*-*-*-* -*-*-*-*- *-*-*-*-* -*-*-*-*- *-*-*-*-* Restrict pattern inside the triangular shape. for (int i = 0; i &lt; 5; i++) { for (int j = 0; j &lt; 9; j++) { if (i + j &gt; 3 &amp;&amp; j - i &lt; 5) { // Equations of straight lines in triangle if ((j - i) % 2 == 0) { // Condition for alternate stars System.out.print("*"); } else { System.out.print("-"); } } else { System.out.print("-"); } } System.out.println(); } This would give following output. ----*---- ---*-*--- --*-*-*-- -*-*-*-*- *-*-*-*-* Refactor for condensed conditions for (int i = 0; i &lt; 5; i++) { for (int j = 0; j &lt; 9; j++) { if (i + j &gt; 3 &amp;&amp; j - i &lt; 5 &amp;&amp; (j - i) % 2 == 0) { System.out.print("*"); } else { System.out.print("-"); } } System.out.println(); } This would give following output. ----*---- ---*-*--- --*-*-*-- -*-*-*-*- *-*-*-*-* Hope this helps. Good luck.
score: 4

http://stackoverflow.com/comment/36158318
comment on: http://stackoverflow.com/a/23563481
type: AnswerComment
type: Comment
has text: Yes that would be an option, but I'd like to prevent having to give any cmd args when starting. Especially as spring boot claims to support this...
score: 3

http://stackoverflow.com/a/23482271
type: Answer
answers question: http://stackoverflow.com/q/23481996
has body: If you want to count sum of two arrays, just count sum of the first, then count sum of the second and finally sum of these two numbers. int sum1 = 0; for (int i : v) sum1 += i; int sum2 = 0: for (int i : w) sum2 += i; int result = sum1 + sum2; Hope this helps.
score: 0
has comment: http://stackoverflow.com/comment/36006336

http://stackoverflow.com/comment/36245557
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23606038
has text: Not exactly. I want to resize the window height when window width is resized, in order to maintain the aspect ratio of the window. Camera is updated later, when window has been resized.
score: 0

http://stackoverflow.com/a/23551031
type: Answer
answers question: http://stackoverflow.com/q/23550985
score: 9
upvote count: 9
has body: An "if" is not a loop. Just use the break inside the "if" and it will break out of the "while". If you ever need to use genuine nested loops, Java has the concept of a labeled break. You can put a label before a loop, and then use the name of the label is the argument to break. It will break outside of the labeled loop.
downvote count: 0

http://stackoverflow.com/comment/52596166
score: 1
has text: This has more details. http://stackoverflow.com/questions/25356781/spring-boot-remove-whitelabel-error-page
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23584691

http://stackoverflow.com/comment/36251459
comment on: http://stackoverflow.com/q/23613495
has text: Now you have a problem seeing the library. I would suggest just getting on google and see what you can figure out yourself and then come back to stacked overflow to ask questions are what you find.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35992655
type: QuestionComment
comment on: http://stackoverflow.com/q/23475263
has text: More or less, the method will be... if ( input.indexOf( seed ) > 0 ){ input = input.subString( 0,input.indexOf( seed ) ) + seed + input.subString( input.indexOf( seed ) + seed.length, input.length ); }
score: 0
type: Comment

http://stackoverflow.com/q/23563469
tagged with: classpath
accepted answer: http://stackoverflow.com/a/23563544
type: Question
downvote count: 0
answer count: 1
has body: I am experimenting with the javac command line options, in order to learn about the -sourcepath and -classpath options. When I run javac, having tried four different command line options for it, I am unable to obtain a recompiled .class file. Here is my folder structure. Please note that due to testing, the Test.java file is located inside the "bat" folder, which is an admittedly odd location. projects \ prj1 \ bat \ bat.bat Test.java Test.class &lt;--- unable to obtain recompiled file. src \ Main.java Main.class The contents of my two .java test files are: // Main.java, located in the src folder class Main { public static void main(String[] args) { new Test(); } } // Test.java, located in the bat folder class Test {} Regarding the execution of javac at the command prompt, here are four options that I have tried. I've run these commands from a batch file called bat.bat, which is located inside the "bat" folder. javac ..\src\Main.java (no sourcepath, no cp) javac -sourcepath . ..\src\Main.java (sourcepath) javac -cp . ..\src\Main.java (cp) javac -sourcepath . -cp . ..\src\Main.java (sourcepath, cp) In all of these javac commands above, I am unable to obtain a recompiled .class file, for the Test.java file. Is this because I have not edited the Test.java file, since initially compiling it? Please note that I have no CLASSPATH environment variable set. Thanks.
tagged with: javac
favorite count: 0
has title: Unable to get javac to automatically recompile a source file
has answer: http://stackoverflow.com/a/23563544
has comment: http://stackoverflow.com/comment/36157067
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/36078626
type: AnswerComment
comment on: http://stackoverflow.com/a/23521094
score: 0
type: Comment
has text: Your server is running Elasticsearch version 1.1.0 (it is the `"number": "1.1.0"` entry) in the response from your curl request you posted in the question.

http://stackoverflow.com/comment/36221174
type: QuestionComment
type: Comment
has text: I want to find the word print in a char array because indexof(str) will only return me the first word that starts with print, I want all of them. For example in the text "asdhfuhadsufh print adhfuhadfuj print" there are two variables that is equal to "print"! :)
score: 0
comment on: http://stackoverflow.com/q/23592271

http://stackoverflow.com/comment/36253188
type: AnswerComment
comment on: http://stackoverflow.com/a/23602416
type: Comment
score: 0
has text: OK. Then try your best using HttpURLConnection. There are many tutorials out there.

http://stackoverflow.com/q/23533695
has comment: http://stackoverflow.com/comment/36102606
has title: Convert bytes[] to 'File' in Java
linked to: http://stackoverflow.com/q/4350084
favorite count: 0
accepted answer: http://stackoverflow.com/a/23533769
has comment: http://stackoverflow.com/comment/36102459
answer count: 3
tagged with: byte
duplicate of: http://stackoverflow.com/q/4350084
has comment: http://stackoverflow.com/comment/36102474
possible better answer: http://stackoverflow.com/a/23534329
has answer: http://stackoverflow.com/a/23534329
has comment: http://stackoverflow.com/comment/36102449
has comment: http://stackoverflow.com/comment/36102654
tagged with: file
has comment: http://stackoverflow.com/comment/36103023
has comment: http://stackoverflow.com/comment/36102466
has answer: http://stackoverflow.com/a/23533969
upvote count: 13
type: AnsweredQuestion
has body: I have an array of bytes bytes[] doc How can I create an instance of new File from those bytes?
has answer: http://stackoverflow.com/a/23533769
tagged with: java
has comment: http://stackoverflow.com/comment/36103275
has comment: http://stackoverflow.com/comment/36136384
score: 9
type: Question
downvote count: 4

http://stackoverflow.com/comment/36056920
has text: thanks. but i want to know if i use brace it force garbage collector to delete my object or not.and what happened behind.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23509243

http://stackoverflow.com/a/23485051
has body: An interesting question. This is just my view on the topic, so take everything with a grain of salt. I have occasionally deployed and managed applications using both servlet containers and embedded servers. I'm sure there are still many good reasons for using servlet containers but I will try to just focus on why they are less popular today. Short version: Servlet containers are great to manage multiple applications on a single host but don't seem very useful to manage just one single application. With cloud environments, a single application per virtual machine seems preferable and more common. Modern frameworks want to be cloud compatible, therefore the shift to embedded servers. So I think cloud services are the main reason for abandoning servlet containers. Just like servlet containers let you manage applications, cloud services let you manage virtual machines, instances, data storage and much more. This sounds more complicated, but with cloud environments, there has been a shift to single app machines. This means you can often treat the whole machine like it is the application. Each application runs on a machine with appropriate size. Cloud instances can pop up and vanish at any time which is great for scaling. If an application needs more resources, you create more instances. Dedicated servers on the other hand usually are powerful but with a fixed size, so you run multiple applications on a single machine to maximize the use of resources. Managing dozens of application - each with their own configurations, web servers, routes and connections etc. - is not fun, so using a servlet container helps you to keep everything manageable and yourself sane. It is harder to scale though. Servlet containers in the cloud don't seem very useful. They would have to be set up for each tiny instance, without providing much value since they only manage a single application. Also, clouds are cool and non-cloud stuff is boring (if we still believe the hype). Many frameworks try t…
has comment: http://stackoverflow.com/comment/36047182
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23478013
type: Answer
accepted answer of: http://stackoverflow.com/q/23478013
score: 85
has comment: http://stackoverflow.com/comment/126967231
upvote count: 86
has comment: http://stackoverflow.com/comment/36077750
downvote count: 1

http://stackoverflow.com/q/23561747
tagged with: expandablelistview
has answer: http://stackoverflow.com/a/23562314
tagged with: java
type: Question
score: 0
has body: Hello i would like to start an activity and also a list view from another activity but i can't understand how to do it. This is the Expandable adapter public class MyExpandableAdapter extends BaseExpandableListAdapter { @SuppressWarnings("unused") private Activity activity; private ArrayList&lt;Object&gt; childtems; private LayoutInflater inflater; private ArrayList&lt;String&gt; parentItems, child; // constructor public MyExpandableAdapter(ArrayList&lt;String&gt; parents, ArrayList&lt;Object&gt; childern) { this.parentItems = parents; this.childtems = childern; } public void setInflater(LayoutInflater inflater, Activity activity) { this.inflater = inflater; this.activity = activity; } // method getChildView is called automatically for each child view. // Implement this method as per your requirement @SuppressWarnings("unchecked") @Override public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { child = (ArrayList&lt;String&gt;) childtems.get(groupPosition); TextView textView = null; if (convertView == null) { convertView = inflater.inflate(R.layout.child_view, null); } // get the textView reference and set the value textView = (TextView) convertView.findViewById(R.id.textViewChild); textView.setText(child.get(childPosition)); // set the ClickListener to handle the click event on child item /* convertView.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Toast.makeText(activity, child.get(childPosition), Toast.LENGTH_SHORT).show(); } }); */ return convertView; } // method getGroupView is called automatically for each parent item // Implement this method as per your requirement @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.parent_view, null); } ((CheckedTextView) convertView).setText(parentItems.get(groupPosition)); ((CheckedTextV…
has title: Start activity with ExpandableListView from another activity
tagged with: android
has comment: http://stackoverflow.com/comment/36165512
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/23609482
has body: I do NOT know much about Java. At this time, I'm trying to write a basic unit test using JUnit. My unit test runs fine from IntelliJ. However, I'm trying to run my test from the console window. In an attempt to do that, I'm executing the following: java -cp /Applications/IntelliJ\ IDEA\ 13\ CE.app/lib/junit.jar org.junit.runner.JUnitCore com.myCompany.core.app.MyIntegrationTests When I execute this, I get an error that says: JUnit version 4.10 Could not find class: com.myCompany.core.app.MyIntegrationTests I don't understand. I'm starting from the root directory of my app. My .class file is located at /root/target/classes/com/myCompany/core/app/MyIntegrationTests.class. So, from the root I tried running: java -cp /Applications/IntelliJ\ IDEA\ 13\ CE.app/lib/junit.jar org.junit.runner.JUnitCore target/classes/com/myCompany/core/app/MyIntegrationTests.class I ended up getting a similar "Could not find class" error. What am I doing wrong? Why won't my unit tests run from the console, yet they run from within IntelliJ just fine? Thank you!
answer count: 0
favorite count: 0
duplicate of: http://stackoverflow.com/q/17397735
type: Question
has comment: http://stackoverflow.com/comment/36243723
score: 0
has title: JUnit - Could not find class when trying to test
upvote count: 1
downvote count: 1
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36243654
has comment: http://stackoverflow.com/comment/36243181
linked to: http://stackoverflow.com/q/17397735
tagged with: junit

http://stackoverflow.com/comment/36114544
has text: Thank you very much for help of all you guys :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23540441
type: Comment

http://stackoverflow.com/q/23555094
tagged with: java
has answer: http://stackoverflow.com/a/23563472
answer count: 2
downvote count: 0
has body: My application is a web (Hibernate, Spring) no mobile clients. I need to go for an AES algorithm with 256 key size to secure the financial sensitive data in back end table. I am new to cryptography. Other than Java Cryptography Architecture there are other providers like Bouncy Castle. Considering only AES. In the Java Cryptography API I see the support. To address what nature of requirements should I consider other providers like Bouncy Castle or Jasypt? What is the limitation in standard Java Cryptography?
favorite count: 0
has title: In what scenarios would I use non-default Java crypto providers?
accepted answer: http://stackoverflow.com/a/23563472
tagged with: cryptography
has answer: http://stackoverflow.com/a/23555207
tagged with: aes
tagged with: bouncycastle
upvote count: 3
possible better answer: http://stackoverflow.com/a/23555207
tagged with: encryption
type: Question
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/36003045
has text: The classes have a different behavior and a different API.
comment on: http://stackoverflow.com/q/23480485
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23595997
has body: All of your If.. else condition needs to be modified. == can only be used to compare literal values in java, literal values means int, double, float, etc. But String is an object and object can not be compared using ==. If you compare objects using == it will try to compare the references values to those objects, which will hardly be equal in your case. When using String object equals() method is used to compare it. If you are using java 7 then you can also you switch case for Strings. But for now I am giving you example of using equals() method for your code. Change your ActionPerformed method to following. public void actionPerformed(ActionEvent e) { String arg = e.getActionCommand(); //user clicks the sort by combo box if(e.getSource() == fieldCombo) { switch(fieldCombo.getSelectedIndex()) { case 0: sort(title); break; case 1: sort(studio); break; case 2: sort(year); break; }//end swictch } //end if //user clicks exit on file menu if (arg.equals("Exit")) System.exit(0); //user clicks insert new dvd on edit menu if (arg.equals("insert")) { String newTitle = JOptionPane.showInputDialog(null, "Please enter the moive's title"); String newStudio = JOptionPane.showInputDialog(null, "Please enter the studio for" + newTitle); String newYear = JOptionPane.showInputDialog(null, "Please enter the year for " + newTitle); //Enlarge arrays title = enlargeArray(title); studio = enlargeArray(studio); year = enlargeArray(year); //add to arrys title[title.length-1] = newTitle; studio[studio.length-1] = newStudio; year[year.length-1] = newYear; //call to sort method sort(title); fieldCombo.setSelectedIndex(0); }//end if //user clicks title on search submeu if(arg.equals("title")) search(arg,title); //user clicks title on studio submeu if(arg.equals("studio")) search(arg,studio); //user clicks title on year submeu if(arg.equals("year")) search(arg,year); }//end of actionPerfomed method
downvote count: 0
answers question: http://stackoverflow.com/q/23595832
score: 1
has comment: http://stackoverflow.com/comment/36218781
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23595832

http://stackoverflow.com/comment/36274752
has text: `/home/..` is the same as root folder `/`, while your checkout command designates `hamcrest-read-only` as the checkout target. You should recheck the location where you checked out the repo and pass the correct location into Java code. And, if you really managed to checkout into `/` on *nix system, you will have all kinds of problems.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23611255

http://stackoverflow.com/comment/36147431
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23557628
type: Comment
has text: THank you very much for the information. But i would need array of an array cause my object would be like addAnimal = { { dogs }, { cat}, { lions },{ tigers } }; i think i would definitely need array of an array

http://stackoverflow.com/comment/35954000
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23454477
has text: 'Using AsyncTask for a single task is not a good solution' - What??? If you make a single HTTP request or make a single DB query then using asyncTask is not good?
type: AnswerComment

http://stackoverflow.com/comment/36170145
score: 0
type: QuestionComment
type: Comment
has text: Sounds like maybe you're calling render twice before clearing the screen giving a trailing effect. If I'm right, when your sprite moves faster, you'll see more blurring on the edges. Could you post a simple example demonstrating your issue?
comment on: http://stackoverflow.com/q/23570314

http://stackoverflow.com/a/23590421
has comment: http://stackoverflow.com/comment/36207767
downvote count: 1
has comment: http://stackoverflow.com/comment/36209005
score: -1
has body: You can go for load-on-startup tells the servlet container to load the specified resource at server startup yourServletName yourServletClass 0
has comment: http://stackoverflow.com/comment/36208336
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23590378
has comment: http://stackoverflow.com/comment/36208425

concurrency
tags question: http://stackoverflow.com/q/23604055
tag name: concurrency
tags question: http://stackoverflow.com/q/23599668
tags question: http://stackoverflow.com/q/23525138
tags question: http://stackoverflow.com/q/23573312
tags question: http://stackoverflow.com/q/23471053
tags question: http://stackoverflow.com/q/23572940
tags question: http://stackoverflow.com/q/23488545
tags question: http://stackoverflow.com/q/23529087
tags question: http://stackoverflow.com/q/23594203
tags question: http://stackoverflow.com/q/23487272
tags question: http://stackoverflow.com/q/23611085
tags question: http://stackoverflow.com/q/23584712
tags question: http://stackoverflow.com/q/23470842
tags question: http://stackoverflow.com/q/23473208
tags question: http://stackoverflow.com/q/23461565
tags question: http://stackoverflow.com/q/23485089
tags question: http://stackoverflow.com/q/23603304
tags question: http://stackoverflow.com/q/23501079
tags question: http://stackoverflow.com/q/23489993
tags question: http://stackoverflow.com/q/23590808
tags question: http://stackoverflow.com/q/23564104
type: Tag
tags question: http://stackoverflow.com/q/23593061
tags question: http://stackoverflow.com/q/23577470
tags question: http://stackoverflow.com/q/23527350
tags question: http://stackoverflow.com/q/23459807
tags question: http://stackoverflow.com/q/23502832

jsp
tags question: http://stackoverflow.com/q/23579087
tags question: http://stackoverflow.com/q/23576893
tags question: http://stackoverflow.com/q/23606951
tags question: http://stackoverflow.com/q/23485338
tags question: http://stackoverflow.com/q/23596931
tags question: http://stackoverflow.com/q/23598863
tags question: http://stackoverflow.com/q/23458290
tags question: http://stackoverflow.com/q/23504719
tags question: http://stackoverflow.com/q/23455964
tags question: http://stackoverflow.com/q/23556291
tags question: http://stackoverflow.com/q/23605720
tags question: http://stackoverflow.com/q/23474384
tags question: http://stackoverflow.com/q/23591752
tags question: http://stackoverflow.com/q/23470075
tags question: http://stackoverflow.com/q/23540215
tags question: http://stackoverflow.com/q/23582002
tags question: http://stackoverflow.com/q/23615261
tags question: http://stackoverflow.com/q/23537325
tags question: http://stackoverflow.com/q/23569036
tags question: http://stackoverflow.com/q/23548368
tags question: http://stackoverflow.com/q/23511138
tags question: http://stackoverflow.com/q/23491515
tags question: http://stackoverflow.com/q/23589253
tags question: http://stackoverflow.com/q/23473525
tags question: http://stackoverflow.com/q/23498019
tags question: http://stackoverflow.com/q/23526955
tags question: http://stackoverflow.com/q/23615437
tags question: http://stackoverflow.com/q/23570796
tags question: http://stackoverflow.com/q/23536314
tags question: http://stackoverflow.com/q/23571617
tags question: http://stackoverflow.com/q/23578770
tags question: http://stackoverflow.com/q/23524507
tags question: http://stackoverflow.com/q/23614475
tags question: http://stackoverflow.com/q/23533541
tags question: http://stackoverflow.com/q/23522010
tags question: http://stackoverflow.com/q/23574270
tags question: http://stackoverflow.com/q/23574995
tags question: http://stackoverflow.com/q/23543798
tags question: http://stackoverflow.com/q/23493164
tags question: http://stackoverflow.com/q/23483905
tags question: http://stackoverflow.com/q/23603422
tags question: http://stackoverflow.com/q/23532648
tags question: http://stackoverflow.com/q/23481300
tags question: http://stackoverflow.com/q/23473262
tags question: http://stackoverflow.com/q/23489228
tags question: http://stackoverflow.com/q/23548129
tags question: http://stackoverflow.com/q/23491086
tags question: http://stackoverflow.com/q/23458549
tags question: http://stackoverflow.com/q/23465637
tags question: http://stackoverflow.com/q/23551263
tags question: http://stackoverflow.com/q/23607919
tags question: http://stackoverflow.com/q/23544336
tags question: http://stackoverflow.com/q/23497402
tags question: http://stackoverflow.com/q/23497024
tags question: http://stackoverflow.com/q/23509988
tags question: http://stackoverflow.com/q/23595569
tags question: http://stackoverflow.com/q/23521375
tags question: http://stackoverflow.com/q/23527810
tags question: http://stackoverflow.com/q/23506994
tags question: http://stackoverflow.com/q/23596843
type: Tag
tags question: http://stackoverflow.com/q/23505075
tags question: http://stackoverflow.com/q/23602715
tags question: http://stackoverflow.com/q/23538620
tags question: http://stackoverflow.com/q/23546238
tags question: http://stackoverflow.com/q/23609874
tags question: http://stackoverflow.com/q/23542535
tags question: http://stackoverflow.com/q/23518790
tags question: http://stackoverflow.com/q/23496255
tags question: http://stackoverflow.com/q/23569846
tags question: http://stackoverflow.com/q/23585601
tags question: http://stackoverflow.com/q/23569531
tags question: http://stackoverflow.com/q/23456295
tags question: http://stackoverflow.com/q/23544094
tags question: http://stackoverflow.com/q/23563382
tags question: http://stackoverflow.com/q/23601161
tags question: http://stackoverflow.com/q/23544973
tags question: http://stackoverflow.com/q/23561997
tags question: http://stackoverflow.com/q/23512802
tags question: http://stackoverflow.com/q/23584034

http://stackoverflow.com/q/23576621
has comment: http://stackoverflow.com/comment/65054786
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36198185
has answer: http://stackoverflow.com/a/23589354
upvote count: 1
accepted answer: http://stackoverflow.com/a/23589354
tagged with: xbee
favorite count: 0
possible better answer: http://stackoverflow.com/a/28822737
has body: I have two XBee Series 2 setup in mode API 2. One is setup as a controller and the other is setup as an end node. The end node is connected to an arduino and as of right now is just taking the value of an analog sensor and sending it out. As of right now everything works when I am running the XBees through the X-ctu. In the new version, I add the controller module (on a USB explorer). I then click the middle button on the device that searches for other network devices. I then click the Console mode. Once I click the connect button I immediately start receiving the "Receive Packet". After looking at the frame details everything is in order. The moment I attempt to use the xbee-api java library or the python-xbee library is when I start hitting issues. The code that I am using is completely copy pasted from the examples (they seem perfectly reasonable to work). Here is an example of the python code (Its COM3 on Windows and /dev/ttyUSB1. Both OSes have the same problem.) from xbee import XBee import serial s = serial.Serial('COM3', 9600) xbee = XBee(s) while True: try: response = xbee.wait_read_frame() print(response) except KeyboardInterrupt: break s.close() The applications hangs on xbee.wait_read_frame(). The java code works the same way when I call Xbee.open() when the code eventually gets to the line "sendAtCommand(new AtCommand("AP"));" (or using the sendSynchronous alternative). The method times out and throws an exception. At this point, I have no idea where to go next. Works inside XCTU, but not any of the APIs. Is there something more that I need to do before the wait_read_frame to link the two together? (I assume not because they have the same pan id. In fact all settings other than the firmware is the same) Thanks for any help!
tagged with: python
has answer: http://stackoverflow.com/a/28822737
has comment: http://stackoverflow.com/comment/36198508
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: XBee Series 2 hangs and times out when attempting to receive packets
tagged with: arduino
has comment: http://stackoverflow.com/comment/36193364
has comment: http://stackoverflow.com/comment/36198952

http://stackoverflow.com/comment/36218774
has text: Marco - It just states that the methods are undefined. Nidheesh, what my intent is to allow them to add as many textviews as they want (I will later attempt to get it where they can remove them if they want)
comment on: http://stackoverflow.com/q/23596036
score: 0
type: Comment
type: QuestionComment

apache-camel
tags question: http://stackoverflow.com/q/23608727
tags question: http://stackoverflow.com/q/23601471
tags question: http://stackoverflow.com/q/23550743
tags question: http://stackoverflow.com/q/23476715
tag name: apache-camel
tags question: http://stackoverflow.com/q/23453284
type: Tag
tags question: http://stackoverflow.com/q/23530027

http://stackoverflow.com/q/23459624
has comment: http://stackoverflow.com/comment/35963881
tagged with: swing
has comment: http://stackoverflow.com/comment/35963793
type: AnsweredQuestion
has title: Textarea maximalsize in Borderlayout
tagged with: java
has answer: http://stackoverflow.com/a/23459919
has comment: http://stackoverflow.com/comment/35963958
type: Question
accepted answer: http://stackoverflow.com/a/23459919
tagged with: layout
score: 2
has body: I have a simple problem but I found no good solution for it. I have a JFrame with components at SOUTH, NORTH, EAST, and CENTER. On CENTER is my problem. On center I have a JPanel with a Borderlayout and 2 JTextAreas (one on NORTH, one int the CENTER). I want that the first panel begins always on top of the panel and stretch maximum (if needed) to the middle of the panel, not more. The second area should begin at the end of the first area. If one of both text areas is to big, there should appear a JScrollPane. What is the best Way to realize that? Should I use a other layout for the panel? Here is my little execute example for it: public class myGUI { public static void main(String[] args) { new myGUI(); } public myGUI() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 400); //Add Content at South, West and North.... JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BorderLayout()); centerPanel.add(new JScrollPane(new JTextArea("AREA")), BorderLayout.NORTH); centerPanel.add(new JScrollPane(new JTextArea("AREA2")), BorderLayout.CENTER); frame.add(centerPanel); frame.setVisible(true); } } Possible scenarios of the center panel: SOLUTION with help from @Hovercraft Full Of Eels public class MyGUI { public static void main(String[] args) { new MyGUI(); } private static GridBagConstraints constraint = new GridBagConstraints(); public MyGUI() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 400); frame.add(new JLabel("NORTH!"), BorderLayout.NORTH); frame.add(new JLabel("EAST!"), BorderLayout.EAST); frame.add(new JLabel("SOUTH!"), BorderLayout.SOUTH); JPanel centerPanel = new JPanel(); centerPanel.setLayout(new GridBagLayout()); changeConstraint(0,0); JTextArea text1 = createTextArea("11111111111111"); centerPanel.add(text1, constraint); changeConstraint(0,1); JTextArea text2 = createTextArea("2222222222222"); centerPanel.add(text2, constraint); JScrollPan…
answer count: 1
downvote count: 0
tagged with: layout-manager
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/23486547
type: AnsweredQuestion
tagged with: java
has body: I've recently started learning to use myBatis.I am now facing such a scenario, I need to constantly fetch a new list of Objects through WebService, then for this list, I need to insert/update each object into the oracle DB table through myBatis. The tricky part is, I cannot simply do a batch insert every time, because some of the objects might already exist in DB, for these records, I need to update the fields of them instead of a new insertion. My current solution might be very stupid, using Java, build the list of Object from webservice, loop through each of them, do a myBatis select, if it is not a null(already exists in the db), then do a myBatis update; otherwise, do a myBatis insert for this new object. The function is achieved. But my technical lead says it is very low-efficient, since doing a for loop using Java and insert/update one by one will consume a lot of system resource. He advised me to do batch insert using myBatis by passing a list of objects in. Batch insertion in myBatis is straightforward, however, since I am not purely inserting(for existing records I need to do update), I don't think batch insert is appropriate here. I've googled a while for this, and realized maybe I will need to use "merge" instead of "insert" (for Oracle). The examples I googled out for merge in myBatis is only for one object, not in a batch. Thus I want to find out whether experts could offer me some examples on how to do a batch-merge in MyBatis( The correct way to write a Mapper)?
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/29264696
tagged with: mybatis
score: 22
favorite count: 0
answer count: 3
tagged with: oracle-database
tagged with: sql
linked to: http://stackoverflow.com/q/17928799
has answer: http://stackoverflow.com/a/62994787
has title: MyBatis Batch Insert/Update For Oracle
upvote count: 22
has answer: http://stackoverflow.com/a/23486709
accepted answer: http://stackoverflow.com/a/23486709
possible better answer: http://stackoverflow.com/a/29264696

http://stackoverflow.com/q/23490873
tagged with: selenium
has title: How to call a method from property file using Java and Selenium WebDriver?
tagged with: selenium-webdriver
tagged with: java
has body: Currently Working on Selenium WebDriver and code I'm writing in Java. I have created a MasterScript called Master.java which is the main script and it looks like this: package test; import org.openqa.selenium.WebDriver; public class MasterScript { public static void main(String[] args) throws Exception { //***************************************************** // Calling Methods //***************************************************** LoginOneReports utilObj = new LoginOneReports (); WebDriver driver; driver=utilObj.setUp(); if(utilObj.Login()){ System.out.println("Login sucessfully completed"); } else { System.out.println("Login failed"); System.exit(0); } NewPR utilObj1 = new NewPR(driver); // instead of calling one PR it need to pick from the property file and it need to select the KPI in UI if(utilObj1.test()){ System.out.println("NewPR KPI page has opened"); } else { System.out.println("NewPR KPI not able to open"); } FilterSection utilObj2 =new FilterSection(driver); utilObj2.FilterMatching(); } } Put this dynamic values in the property file where each and every time it need to go to the property file and fetch the value, based on the value the related java file need to called.
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23494271
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35969725
score: 0
has text: Let's put away the syntax for a moment and get a piece of paper. Write out what it is that you're trying to sort (be specific; use the fields instead of the actual objects). Determine how you're going to sort these values (you can do hand-written implementations of bubble sort or mergesort to accomplish this).
comment on: http://stackoverflow.com/q/23462722
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36223252
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23598180
has text: try with `text/json` maybe

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/23541721
tags question: http://stackoverflow.com/q/23531704
type: Tag
tags question: http://stackoverflow.com/q/23550385
tags question: http://stackoverflow.com/q/23523526

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/23529359
tags question: http://stackoverflow.com/q/23484146
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/23576718
tags question: http://stackoverflow.com/q/23598418

http://stackoverflow.com/q/23576427
has comment: http://stackoverflow.com/comment/36187887
tagged with: admob
type: Question
tagged with: google-play-services
has comment: http://stackoverflow.com/comment/36393990
has body: NOTE: Am using the new GooglePlayServices AdMob at version 4.4 When "onCreate" is call I create the content view like so: ContentView = new FrameLayout(this); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); addContentView(ContentView, params); When I set my AdView gravity, I do it like so: FrameLayout.LayoutParams viewParams = new FrameLayout.LayoutParams(320, 50, Gravity.BOTTOM | Gravity.LEFT); adView.setLayoutParams(viewParams); Any ideas whats wrong?
answer count: 1
has answer: http://stackoverflow.com/a/23612316
tagged with: android
accepted answer: http://stackoverflow.com/a/23612316
has title: AdMob v4.4 BOTTOM LEFT gravity does NOT work
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/q/23509560
answer count: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
score: 2
tagged with: performance
downvote count: 0
tagged with: java
type: Question
has title: Java efficient way to have multiple identical ArrayList elements
tagged with: libgdx
upvote count: 2
tagged with: arraylist
has body: I am writing an game in java with Libgdx and have a question about how to have multiple instances of the same object in an ArrayList without abusing the garbage collector. this is the code of my main game state. I am still really new, so I assume my coding habits are downright awful: package com.frog.game; import java.util.ArrayList; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; import com.badlogic.gdx.math.MathUtils; import com.frog.entities.Frog; import com.frog.entities.Grass; import com.frog.entities.LilyPad; import com.frog.gamestates.GameState; import com.frog.managers.GameStateManager; import com.frog.managers.Jukebox; import com.frog.managers.Save; import com.frog.managers.SimpleDirectionGestureDetector; import com.frog.managers.SpeedManager; import com.frog.game.Game; public class PlayState extends GameState { private SpriteBatch sb; private Frog frog; private BitmapFont font; private ArrayList&lt;LilyPad&gt; lilypads; private Grass grass; private float hopY; public boolean tmp; private SpeedManager speedManager; private float speed; private float[] placement; public PlayState(GameStateManager gsm) { super(gsm); } @SuppressWarnings("deprecation") public void init() { speedManager = new SpeedManager(); lilypads = new ArrayList&lt;LilyPad&gt;(); sb = new SpriteBatch(); frog = new Frog(); frog.init(); grass = new Grass(); grass.init(); hopY = Game.SIZE * 0.8f; placement = new float[] { 0, Game.SIZE, Game.SIZE * 2 }; addPad(); FreeTypeFontGenerator gen = new FreeTypeFontGenerator( Gdx.files.internal("PressStart2P-Regular.ttf") ); font = gen.generateFont((Game.WIDTH / 10)); gen.dispose(); Gdx.input.setInputProcessor(new SimpleDirectionGestureDetector(new SimpleDirectionGestureDetector.DirectionListener() { @Override public void onUp() { // TODO Auto-generated method stub } @Override public void onRight() { frog.mo…
has answer: http://stackoverflow.com/a/23510069
accepted answer: http://stackoverflow.com/a/23510069

http://stackoverflow.com/comment/36132666
score: 0
type: QuestionComment
type: Comment
has text: `children` contains instance of `SuperMedia`? or are there descendants of it?
comment on: http://stackoverflow.com/q/23549993

http://stackoverflow.com/q/23527856
favorite count: 0
has title: Hibernate cache and MySql query cache
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has body: Caching is all about application performance optimization and it sits between your application and the database to avoid the number of database hits as many as possible to give a better performance for performance critical applications. I have ability to use Hibernate cache and MySql query cache. What mechanism should i choose ? Or may be i should use both of them to rich maximum performance (and maximum RAM usage :D) ?
tagged with: mysql
tagged with: caching
type: Question
has comment: http://stackoverflow.com/comment/36091704
upvote count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/36091587
has answer: http://stackoverflow.com/a/23528697
accepted answer: http://stackoverflow.com/a/23528697
answer count: 1
has comment: http://stackoverflow.com/comment/36091676

layout
tags question: http://stackoverflow.com/q/23535711
tag name: layout
tags question: http://stackoverflow.com/q/23480391
tags question: http://stackoverflow.com/q/23537363
tags question: http://stackoverflow.com/q/23575116
tags question: http://stackoverflow.com/q/23529245
tags question: http://stackoverflow.com/q/23537589
tags question: http://stackoverflow.com/q/23465375
tags question: http://stackoverflow.com/q/23590652
tags question: http://stackoverflow.com/q/23493732
tags question: http://stackoverflow.com/q/23464654
tags question: http://stackoverflow.com/q/23589525
tags question: http://stackoverflow.com/q/23546869
type: Tag
tags question: http://stackoverflow.com/q/23482840
tags question: http://stackoverflow.com/q/23555992
tags question: http://stackoverflow.com/q/23512691
tags question: http://stackoverflow.com/q/23459624

http://stackoverflow.com/comment/36263247
comment on: http://stackoverflow.com/q/23611362
type: Comment
type: QuestionComment
has text: You could use docx4j's https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/FieldsMailMerge.java on docx files; if you want to process legacy binary doc files, convert them to docx first.
score: 0

http://stackoverflow.com/comment/36100309
has text: what is your line no 45 in ActionFragment?? in onCreateView
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23531763
type: QuestionComment

http://stackoverflow.com/a/23622862
answers question: http://stackoverflow.com/q/23615261
has comment: http://stackoverflow.com/comment/36271002
has comment: http://stackoverflow.com/comment/36270844
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36270819
has comment: http://stackoverflow.com/comment/36271169
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36270799
has comment: http://stackoverflow.com/comment/36270877
has comment: http://stackoverflow.com/comment/36271180
has comment: http://stackoverflow.com/comment/36272801
accepted answer of: http://stackoverflow.com/q/23615261
has body: Create an instance variable in your jsp and increment it each time. &lt;%! int i = 0;%&gt; It makes i stay around after execution. Each time you run the page, the last value of i stays in memory. for getting one particular question: &lt;% List list = fetchyourlisthere(); // check its size if(i&lt;list.size()) { list.get(i); // this will return you the object for that particular question. // now increment i i++; } %&gt; so each time the page loads, you will have new question from the list.
has comment: http://stackoverflow.com/comment/36273098

http://stackoverflow.com/comment/36076199
comment on: http://stackoverflow.com/q/23520149
type: Comment
type: QuestionComment
has text: The problem with your protocol is that the reader doesn't know what type of data you sent. I suggest using String only to start with as it would be simpler.
score: 0

http://stackoverflow.com/q/23478844
tagged with: jodatime
has answer: http://stackoverflow.com/a/23478932
downvote count: 0
has comment: http://stackoverflow.com/comment/36000039
duplicate of: http://stackoverflow.com/q/5879546
has comment: http://stackoverflow.com/comment/35999892
upvote count: 1
answer count: 1
favorite count: 0
has body: I am trying to parse the following date: May 5 18:44:44 from a syslog entry. Note that after 'May' there are 2 spaces: one as separator and the other as omitted zero from the day of month. The following code fails with java.lang.IllegalArgumentException: Invalid format: "May 5 18:44:44" is malformed at " 5 18:44:44" String input = "May 5 18:44:44"; DateTimeFormatter formatter = DateTimeFormat.forPattern("MMM d HH:mm:ss") .withLocale(Locale.US); DateTime dt = formatter.parseDateTime(input); Apparently the parser does not grok the 2nd space. And it also works when I "manually" remove that 2nd space. Does anyone have an idea on how to solve this either with joda time or standard java DateFormat?
type: UnansweredQuestion
has title: Lenient date parsing for syslog messages
linked to: http://stackoverflow.com/q/19565755
linked to: http://stackoverflow.com/q/5879546
score: 1
tagged with: java
type: Question

http://stackoverflow.com/a/23579262
has body: Does your task check the isCancelled() in your doInBackground() function? AsyncTask's are meant to run quickly (i.e. computationally short tasks) in the background and post results to the UI thread. This means that when you make a call to asyncTask.cancel(true);, instead of onPostExecute being invoked on the UI thread, onCancelled is invoked on the UI thread. Since the 'cancelling' is invoked on the UI thread, if your thread is in a tight loop and doesn't make any checks to any global variables or cancel requests (like checking isCancelled), it might take a 'bit of time' for the underlying API to clean up your thread (properly end/cancel it without your thread ending itself), that 'bit of time' is the UI 'pause' you experience. To alleviate this, in your doInBackground function, just make a check for the isCancelled function: // simple example function: protected Void doInBackground (Void... params) { for(int i=0; i &lt; 65535; ++i) { if (isCancelled()) { break; } // exit loop on cancel request } return null; } In this AsyncTask if we then call asyncTask.cancel(true);, the loop will break on the next check of isCancelled and the UI thread can continue vs. waiting for the loop to finish it's iterations (thus 'pausing' the UI until the thread has completed). Hope that can help.
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23577493

http://stackoverflow.com/q/23485022
has body: The following is a text-book quick sort implementation in Scala. When comparing the execution time of quickSortRecursive to java.util.Arrays.sort(), I found java.util.Arrays.sort to be an order of magnitude faster on large arrays. Can someone hint on the reason for this difference in performance? def quickSortRecursive(list: Array[Int])(low: Int=0, high: Int=list.length-1): Unit = { if (low&lt;high) { swap(list,Random.nextInt(high),high) val pivot = partition(list, low, high) quickSortRecursive(list)(low, pivot-1) quickSortRecursive(list)(pivot+1, high) } } private def partition(list: Array[Int], low: Int, high: Int): Int = { val pivot = list(high) var lowhigh = low for (i &lt;- low until high) { if (list(i) &lt; pivot) { swap(list, lowhigh, i); lowhigh += 1; } } swap(list, lowhigh, high); lowhigh } private def swap(list: Array[Int], i: Int, j: Int): Unit = { val tmp = list(i) list(i) = list(j) list(j) = tmp }
type: UnansweredQuestion
tagged with: scala
has comment: http://stackoverflow.com/comment/36011569
has comment: http://stackoverflow.com/comment/36011303
tagged with: quicksort
linked to: http://stackoverflow.com/q/4018332
tagged with: performance
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36011372
has comment: http://stackoverflow.com/comment/36011221
type: Question
has comment: http://stackoverflow.com/comment/36056193
has comment: http://stackoverflow.com/comment/36056268
has comment: http://stackoverflow.com/comment/36011533
has answer: http://stackoverflow.com/a/23488607
tagged with: optimization
has comment: http://stackoverflow.com/comment/36017629
has title: Quick Sort in Scala vs. java.util.Arrays.sort
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36169503
score: 0
type: Comment
type: AnswerComment
has text: @JasonSperske it is not necessary from this code snippet.
comment on: http://stackoverflow.com/a/23569981

certificate
tags question: http://stackoverflow.com/q/23473355
type: Tag
tag name: certificate

http://stackoverflow.com/comment/36148194
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Is it possible to dynamically define column names in Hibernate / JPA?](http://stackoverflow.com/questions/3617687/is-it-possible-to-dynamically-define-column-names-in-hibernate-jpa)
comment on: http://stackoverflow.com/q/23558435

http://stackoverflow.com/q/23466294
tagged with: java
has title: Use of .project and .classpath files
type: UnansweredQuestion
tagged with: eclipse
tagged with: .class-file
has body: I have some doubts regarding the files .classpath and .project. I'm using eclipse IDE. I created a project. In that project is see that two files are created. They are .classpath .project. Following questions I have: Can I know what are the main differences between these two files(.classpath &amp; .project)? What is the main purpose of .project file? Can i use .project file in place of .classpath file? Whether .project file is created in all java IDE's? Any help is highly appreciated
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35976296
type: Question
has comment: http://stackoverflow.com/comment/35976242
score: -2
linked to: http://stackoverflow.com/q/7186676
downvote count: 2
answer count: 1
duplicate of: http://stackoverflow.com/q/7186676
has answer: http://stackoverflow.com/a/23466350

http://stackoverflow.com/comment/36012247
has text: Yes that also my mistake sir. so means you have down voted !!
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23485550

http://stackoverflow.com/comment/36023166
score: 1
has text: [this](http://developer.android.com/training/articles/memory.html) and [this](http://developer.android.com/tools/debugging/debugging-memory.html) are very useful.
comment on: http://stackoverflow.com/a/23491725
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23517543
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36071127
accepted answer of: http://stackoverflow.com/q/23516236
type: Answer
score: 2
has body: Well,since you insist on asking for code,I had make a simple example for you,hope it help! package com.learningjava; import java.awt.BorderLayout; import java.awt.GridLayout; 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; /** * a simple demo to using two dialog * */ public class DialogFrameDemo extends JFrame{ public static void main(String[] args) { DialogFrameDemo frame = new DialogFrameDemo(); frame.setSize(400, 400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public DialogFrameDemo() { super("Dialog Demo"); //prepare button in frame JButton btnInFrame = new JButton("Click to open a Dialog"); JPanel framePanel = new JPanel(); framePanel.add(btnInFrame); this.add(framePanel,BorderLayout.NORTH); btnInFrame.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { // generate dialog one dialogOne = new JDialog(DialogFrameDemo.this,"Dialog one",false); JPanel dialogPanel = new JPanel(); dialogPanel.setLayout(new GridLayout(3,1)); //prepare button in dialog one JButton btnInDialogOne = new JButton("Click to open another Dialog"); btnInDialogOne.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { //generate dialog second JDialog dialogTwo = new JDialog(dialogOne,"Dialog Two",true); JPanel dialogPanel = new JPanel(); dialogPanel.setLayout(new GridLayout(3,1)); dialogPanel.add(new JLabel("Dialog Two")); dialogPanel.add(new JLabel("Lable 21")); dialogPanel.add(new JLabel("Lable 22")); dialogTwo.setContentPane(dialogPanel); dialogTwo.pack(); dialogTwo.setVisible(true); dialogTwo.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); } }); dialogPanel.add(btnInDialogOne); dialogPanel.add(new JLabel("Lable 11")); dialogPanel.add(new JLabel("Lable 12")); dialogOne.setContentPane(dialogPanel); dialogOne.p…
upvote count: 2
answers question: http://stackoverflow.com/q/23516236

http://stackoverflow.com/comment/63245289
score: 0
type: AnswerComment
has text: This solution works great, but how to control the behaviour in case of Facebook? For example i want to handle the facebook share manually, but it is still showing the facebook share dialog.
type: Comment
comment on: http://stackoverflow.com/a/23495696

http://stackoverflow.com/comment/35972736
has text: Right, but what about things like: `Integer a = 5;` which I think would work. It seems that this is simply a shorthand for `new` and therefore they are not equal.
comment on: http://stackoverflow.com/q/23464149
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36044538
type: AnswerComment
comment on: http://stackoverflow.com/a/23500273
type: Comment
has text: Strictly speaking this isn't quite a functional approach, since an `IteratorFunctor` changes its own state when you use `next()` on the underlying `Iterator` by calling `map`. A better way would be to use something that doesn't change when you iterate over it (e.g. an array, a `List`, etc.).
score: 0

http://stackoverflow.com/comment/36176246
has text: I am unfamiliar with how to accomplish this. Would I keep a timer in the call() method of the callable?
comment on: http://stackoverflow.com/a/23573185
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36163023
score: 0
type: QuestionComment
has text: I maintain an open-source project on SourceForge that has a built-in-function for matrix mult. You can use it as is or roll your own. See here: http://sourceforge.net/projects/tymeacdse/
type: Comment
comment on: http://stackoverflow.com/q/23552930

http://stackoverflow.com/comment/36237590
comment on: http://stackoverflow.com/a/23606214
type: Comment
has text: yes missing braces in one problem another one is registerReceiver need two argument one broadcast receiver second intent filter in that case broadcast receiver parameter is missing.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23476378
downvote count: 0
favorite count: 0
has title: Unable to get a correct relative path between two files, only when one path is a file and the other a directory, is this normal expected behavior?
has answer: http://stackoverflow.com/a/23476549
upvote count: 1
type: Question
has body: Edit: I was looking at this ../ differently and was attaching ../ mentally with an idea of a directory path with a directory slash already (so directory name + / + ../) , which would point one directory too far back, but now I see that with directory name + ../ is actually correct in this case. I'm unable to get a correct relative path between two files, only when one path is a file and the other a directory, is this normal expected behavior with Path.relativize(Path)? JavaDocs mention that it works with Path objects, but nothing more specific than that. Here's my example code (running on Windows), which contains comments on what I expected the output to be: import java.nio.file.Path; import java.nio.file.Paths; public class PathsTest { public static void main(String[] args) { Path pathA = Paths.get("C:\\a\\b\\1.txt"); System.out.println(pathA); Path pathB = Paths.get("C:\\a\\b\\2.txt"); System.out.println(pathB); Path relativePathBetween = pathA.relativize(pathB); System.out.println("rel: " + relativePathBetween); // Outputs "..\2.txt" (for the last print here) // Expected: "2.txt" pathA = Paths.get("C:\\a\\b\\1.txt"); pathA = pathA.getParent(); // Obtaining parent here, so C:\a\b System.out.println(pathA); pathB = Paths.get("C:\\a\\b\\2.txt"); System.out.println(pathB); relativePathBetween = pathA.relativize(pathB); System.out.println("rel: " + relativePathBetween); // Outputs: "2.txt" // Expected: "2.txt" // So why does pathA have to be a directory and not a file? // Javadocs don't seem to mention that. } } And here's the entire output from the program: C:\a\b\1.txt C:\a\b\2.txt rel: ..\2.txt C:\a\b C:\a\b\2.txt rel: 2.txt
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23476549
score: 1
tagged with: java
tagged with: nio
tagged with: java-7
answer count: 1

http://stackoverflow.com/q/23500155
linked to: http://stackoverflow.com/q/5554734
has body: I was trying to do a sorting class of matrices entries and I first put them into an array double[][] A ={{0,70,9},{1,3,4}}; double[] vektori_per_sortim=new double[A.length*A[0].length]; int k=0; for(int i=0; i!=A.length; i++) { for(int j=0; j!=A[0].length; j++) { vektori_per_sortim[k]=A[i][j]; k++; } } and then I tried to put them into the matrices again int r=0; while(r!=vektori_per_sortim.length) { for(int i=0; i!=vektori_per_sortim.length/A.length; i++) { for(int j=0; j!=vektori_per_sortim.length/A[0].length; j++) { A[i][j]=vektori_per_sortim[r]; r++; } } } but I get an error java.lang.ArrayIndexOutOfBoundsException: 2 Can you please help me out with this? Thank you very much.
possible better answer: http://stackoverflow.com/a/23500343
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23500330
accepted answer: http://stackoverflow.com/a/23500330
has comment: http://stackoverflow.com/comment/36039237
has comment: http://stackoverflow.com/comment/36039146
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/36039266
has comment: http://stackoverflow.com/comment/36039319
has comment: http://stackoverflow.com/comment/36039322
has answer: http://stackoverflow.com/a/23500343
linked to: http://stackoverflow.com/q/27455859
has title: Java Array Index Out of Bound Exception 2
type: Question
answer count: 2
tagged with: arrays
score: -1
duplicate of: http://stackoverflow.com/q/5554734
has comment: http://stackoverflow.com/comment/36039157
downvote count: 2
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/23607385
type: UnansweredQuestion
tagged with: sockets
has title: OutputStream does not throw IOException although LAN-cable is not plugged
tagged with: ioexception
score: 0
tagged with: tcp
tagged with: java
has answer: http://stackoverflow.com/a/23615444
type: Question
has body: I established a TCP Connection with Java. The Server sends an "ALIVE"-Message to the Client every second to detect a broken connection. but when I plug of the LAN-cable the IOException is thrown exactly after 23seconds, and not immediately after the send attempt. My code to send looks like that // out is an OutputStream try { out.write(String.format("%s\r\n", encryptedCommand).getBytes(Charset.forName("UTF-8"))); } catch (IOException e) { fireConnectionClosed(); } I'm pretty sure that this was working already, but now it doesn't any more
answer count: 1
tagged with: outputstream

http://stackoverflow.com/a/23458275
upvote count: 1
has body: It may be time to retool. Java is still a great language for enterprise-type development. However, what is hot now, and will be for the next several years is full-stack development with javascript. Node on the backend, Angular or some other declarative framework on the front end (jQuery is popular now, but it is imperative and not really a framework, just a DOM manipulator). Now you can have an integrated environment, one language, and you can concentrate on css, html5, and tons of javascript-based libraries to do practically anything you want to do. Just my opinion (so of course this will be voted down)
answers question: http://stackoverflow.com/q/23458083
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35961384
score: 1

http://stackoverflow.com/a/23492300
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23492114
score: 1
answers question: http://stackoverflow.com/q/23492114
type: AcceptedAnswer
downvote count: 0
has body: You need to return the final value that you found. It looks like modifying this line: temporalClient.searchForResponsibleClient(p); to return temporalClient.searchForResponsibleClient(p); should do the trick. This will explain why you're reaching the code you otherwise think you shouldn't get to
type: Answer

http://stackoverflow.com/q/23481352
tagged with: junit
has title: How to write a unit test for an uncaught thread exception handler.
upvote count: 6
score: 6
tagged with: unit-testing
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8943288
accepted answer: http://stackoverflow.com/a/23481880
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm trying to write a unit test for my applications uncaught thread exception handler, but have had no luck so far. The handler is application wide, and I know it works. It was also based around code found here. However I can't think of a way to actually write a unit test for it, considering that if I throw an exception from my test project it is entering that code, but it never returns. This causes any test that I've so far written to fail out. Here is my handler, does anyone have any suggestions how I can unit test this? public class MyApplication extends Application { // uncaught exception handler variable private final UncaughtExceptionHandler defaultUEH; // handler listener private final Thread.UncaughtExceptionHandler _unCaughtExceptionHandler = new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable ex) { // Try restarting the application if an uncaught exception has // occurred. PendingIntent myActivity = PendingIntent .getActivity(getApplicationContext(), 192837, new Intent( getApplicationContext(), MainGui.class), PendingIntent.FLAG_ONE_SHOT); AlarmManager alarmManager; alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, 15000, myActivity); System.exit(2); // re-throw critical exception further to the os (important) defaultUEH.uncaughtException(thread, ex); } }; public MyApplication() { defaultUEH = Thread.getDefaultUncaughtExceptionHandler(); // setup handler for uncaught exception Thread.setDefaultUncaughtExceptionHandler(_unCaughtExceptionHandler); } My project that contains the tests is separate from my actual application project. I've tried setting flags in the code, but after the exception is called, my test has already failed and there is no opportunity to check that flags have been set. I've thought of maybe adding a broadcast in the uncaught exception handler and triggering off that, or maybe to use preferences and somehow re-…
tagged with: uncaught-exception
tagged with: android
has answer: http://stackoverflow.com/a/23481880

http://stackoverflow.com/comment/36088046
score: 0
type: QuestionComment
type: Comment
has text: @AmalMurali would be less readable too. I don't know about you but reading this regex `(?<=(.))(?!\\1)` is going to make me scratch my head.
comment on: http://stackoverflow.com/q/23523597

http://stackoverflow.com/comment/36172916
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23571617
has text: Better do a search for servlet tutorials and such, as there are several choices one can make on some different techniques. To have a broad perspective. You can put objects as session attribute or request attribute, and query them in the JSP using EL, Expression Language. And so on.
score: 0

http://stackoverflow.com/comment/35953725
type: Comment
comment on: http://stackoverflow.com/a/23454195
score: 0
type: AnswerComment
has text: "The second level cache is meant for accessing the object by Primary Key, means the searching for whole entities based on Primary Key ie with session.get(), session.load() methods. I can think of only above two methods where second level cache will come in to picture."Is this statement correct?

http://stackoverflow.com/a/23612715
has comment: http://stackoverflow.com/comment/36249863
type: Answer
answers question: http://stackoverflow.com/q/23612381
score: 0
has body: Try with this: if (ServletFileUpload.isMultipartContent(request)) { try { List&lt;FileItem&gt; multiparts = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); for (FileItem item : multiparts) { if (!item.isFormField()) {

http://stackoverflow.com/comment/35952117
has text: Depends on the implementation & features required. Might be identical, might not. Depends also on what exactly you mean by "data storage".
type: Comment
comment on: http://stackoverflow.com/q/23453475
type: QuestionComment
score: 2

http://stackoverflow.com/comment/36029654
has text: If you're just starting out with Spring, I highly recommend (1) using the current version (4.0), (2) using Java-based configuration instead of XML, and (3) using Spring Boot to handle all of the standard configuration and wiring while you learn how to use controllers and other application-specific tools.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23494466
score: 1

http://stackoverflow.com/a/23526463
score: 0
has body: Use properties file to store such things that is configurable and changeable in the life of project. Its easy to maintain the configuration data in properties file one for each environment. You can create different copies of .properties file based on environment such as DEV, QA, PROD etc.
type: Answer
answers question: http://stackoverflow.com/q/23526366

http://stackoverflow.com/comment/36151294
type: QuestionComment
comment on: http://stackoverflow.com/q/23520475
score: 0
type: Comment
has text: no clear for me; which is the difrrence between the tow projects?

http://stackoverflow.com/q/23478013
accepted answer: http://stackoverflow.com/a/23485051
type: Question
tagged with: spring-boot
has answer: http://stackoverflow.com/a/23485051
score: 93
tagged with: playframework
tagged with: dropwizard
answer count: 1
has title: Advice deploying war files vs executable jar with embedded container
favorite count: 0
upvote count: 93
tagged with: war
has body: There seems to be a current trend in java space to move away from deploying java web applications to a java servlet container (or application server) in the form of a war file (or ear file) and instead package the application as an executable jar with an embedded servlet/HTTP server like jetty. And I mean this more so in the way newer frameworks are influencing how new applications are developed and deployed rather than how applications are delivered to end users (because, for example, I get why Jenkins uses an embedded container, very easy to grab and go). Examples of frameworks adopting the executable jar option: Dropwizard, Spring Boot, and Play (well it doesn't run on a servlet container but the HTTP server is embedded). My question is, coming from an environment where we have deployed our (up to this point mostly Struts2) applications to a single tomcat application server, what changes, best practices, or considerations need to be made if we plan on using an embedded container approach? Currently, we have about 10 homegrown applications running on a single tomcat server and for these smallish applications the ability to share resources and be managed on one server is nice. Our applications are not intended to be distributed to end users to run within their environment. However, moving forward if we decide to leverage a newer java framework, should this approach change? Is the shift to executable jars spurred on by the increasing use of cloud deployments (e.g., Heroku)? If you've had experience managing multiple applications in the Play style of deployment versus traditional war file deployment on a single application server, please share your insight.
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/q/23552791
type: UnansweredQuestion
has title: Response in Byte always null in linux & raspberry pi wheezy beside in windows same code work great
has comment: http://stackoverflow.com/comment/36179683
answer count: 0
tagged with: arrays
tagged with: linux
has comment: http://stackoverflow.com/comment/36137971
type: Question
tagged with: serial-port
tagged with: usbserial
has body: WHY BYTE ARRAY RESPONSES IS EMPTY IN LINUX SYSTEM BUT WORK IN WINDOWS? BYTE ARRAY VARIABLE VALUES ARE ALL 0 I am facing an issue in serial comm communication. I am using Serial USB Convertor of GEARMO USB RS 485/232 Convertor. In window my program works great on com13 port. Same program its not working in linux/raspberry pi wheezy/ubuntu systems! i tries all the solutions from google checked multiple Linux system. I checked multiple readBytes(),readBytes(4),UTF-ENCODING options. i also tries multiple byte conversion functions but all the time i got zero response. Also, I thought driver might be issue in linux for my problem but connection open, sending data, usb led light blinking always works but in return response data always got NULL VALUE AS bytes. import jssc.SerialPort; import jssc.SerialPortList; import jssc.SerialPortEvent; import jssc.SerialPortEventListener; import jssc.SerialPortException; .... // serialPort = new SerialPort("COM13"); // = FOR WINDOWS (work great) serialPort = new SerialPort("/dev/ttyUSB0"); = FOR LINUX/UBUNTU/WHEEZY (Byte data is null) serialPort.openPort();//Open port serialPort.setParams(19200, 8, 1, 2);//Set params serialPort.addEventListener(new SerialPortReader());//Add SerialPortEventListener public void serialEvent(SerialPortEvent event) { ... byte buffer[] = serialPort.readBytes(); System.out.println("Read Buffer "+ buffer);` for (int k = 0; k < array.length; k++) { System.out.println("Response[" + k + "] = " + "0x" + byteToHex(array[k])); ... System.out.print output: Read Buffer [B@58c80c System.out.println for loop output: Response[0] = 0x00 Response[1] = 0x00 Response[2] = 0x00 Response[3] = 0x00 Response[4] = 0x00 Response[5] = 0x00 Response[6] = 0x00 Response[7] = 0x00 Response[8] = 0x00 static public String byteToHex(byte b) { // Returns hex String representation of byte b char hexDigit[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; char[] array = { hexDigit[(b >> 4) & 0x0f], hexDigi…
has comment: http://stackoverflow.com/comment/36138741
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36164054

http://stackoverflow.com/q/23512871
tagged with: java
tagged with: oracle11g
type: Question
tagged with: oracle-spatial
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/24404601
type: UnansweredQuestion
has title: java.sql.SQLException: ORA-13268: error obtaining dimension from USER_SDO_GEOM_METADATA
tagged with: spring
has body: I'm getting SQl Exception ORA-13268: error obtaining dimension from USER_SDO_GEOM_METADATA. The query works fine, when I run individually and takes about 3seconds to execute. However I'm getting this error when I run multiple queries for same point using java( I'm using spring-mybatis) from different threads. The thread is created and executed such that for every 3 seconds there are two request going for database. When I analyzed my java logs first request takes 3 seconds and subsequent request goes on increasing with time taken to execute query as 5,8,12,13,16,17,23,26,29,34,39,.... so on. And finally when the query execution time reaches 100s I'm getting above error. The complete error description is as below. ### Error querying database. Cause: java.sql.SQLException: ORA-13268: error obtaining dimension from USER_SDO_GEOM_METADATA ORA-06512: at "MDSYS.MD", line 1723 ORA-06512: at "MDSYS.MDERR", line 8 ORA-06512: at "MDSYS.SDO_3GL", line 133 ### The error may exist in file [/var/lib/tomcat6/webapps/kp/WEB-INF/classes/sqlmap/IKPMapper.xml] ### The error may involve com.kp.persistence.IKPMapper.getAddress-Inline ### The error occurred while setting parameters ### SQL: SELECT A.BIN_ORDINATE,A.ADDRESS,A.HOUSE_OWNER, A.PIN_CODE FROM KP_GEOM_TBL A WHERE SDO_RELATE(A.BIN_ORDINATE,SDO_GEOMETRY(2001,3857,sdo_point_type(?,?,NULL),NULL,NULL),'mask=TOUCH+CONTAINS')='TRUE' ### Cause: java.sql.SQLException: ORA-13268: error obtaining dimension from USER_SDO_GEOM_METADATA ORA-06512: at "MDSYS.MD", line 1723 ORA-06512: at "MDSYS.MDERR", line 8 ORA-06512: at "MDSYS.SDO_3GL", line 133 ; uncategorized SQLException for SQL []; SQL state [72000]; error code [13268]; ORA-13268: error obtaining dimension from USER_SDO_GEOM_METADATA ORA-06512: at "MDSYS.MD", line 1723 ORA-06512: at "MDSYS.MDERR", line 8 ORA-06512: at "MDSYS.SDO_3GL", line 133 ; nested exception is java.sql.SQLException: ORA-13268: error obtaining dimension from USER_SDO_GEOM_METADATA ORA-06512: at "MDSYS.MD", line 1723 O…

http://stackoverflow.com/comment/35974959
has text: What you want is to create a `new java.util.TreeSet(herbSet)`.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23465463

http://stackoverflow.com/q/23598418
answer count: 2
downvote count: 0
tagged with: sts-springsourcetoolsuite
has body: Whenever I unpack dmg installer I see image containing launcher something like - "Installer - spring-tool-suite-3.6.0.CI-B1808453-e4 ". After I try to launch this installer the loading indicator hangs a little, disappears and nothing happens. I am being forced to migrate to Mac OS due to work environment. I can't even launch the installer. I suspect this is due to default Apple Java (whatever that means I am not OS X expert) being deleted on this laptop and JDK8 is on the home path. ALE:~$ echo ${JAVA_HOME} /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/ Well, this forces me to migrate to IntelliJ, but I can't just believe that because of someone else fashion I can't do the work usual way... Any hint? I don't even get error message..
favorite count: 0
tagged with: operating-system
has comment: http://stackoverflow.com/comment/36223324
tagged with: macos
has answer: http://stackoverflow.com/a/23995455
upvote count: 2
type: UnansweredQuestion
has title: Can't run Spring Tool Suite installer on Mac OS mavericks?
score: 2
has answer: http://stackoverflow.com/a/24055596
tagged with: osx-mavericks
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36223138

http://stackoverflow.com/comment/36163991
comment on: http://stackoverflow.com/a/23566675
type: Comment
has text: It should be `new classes().new Name();`, otherwise it doesn't compile.
score: 1
type: AnswerComment

http://stackoverflow.com/comment/35967699
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23461577
has text: Thanks for your reply. actually when I remove that line I still get the same erros...can't figure it out :/
score: 0

http://stackoverflow.com/q/23542337
tagged with: android
accepted answer: http://stackoverflow.com/a/23550802
type: AnsweredQuestion
type: Question
has body: is it possible? Because onResume I get (example log): I/dalvikvm-heap﹕ Grow heap (frag case) to 19.304MB for 8294416-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 27.213MB for 8294416-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 15.257MB for 4052160-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 17.277MB for 6169216-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 17.277MB for 6169216-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 17.277MB for 6169216-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 17.277MB for 6169216-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 17.277MB for 6169216-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 15.192MB for 3983200-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 19.304MB for 8294416-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 27.213MB for 8294416-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 16.059MB for 4892464-byte allocation I/dalvikvm-heap﹕ Grow heap (frag case) to 19.303MB for 8294416-byte allocation I assume it is because textures, sprites are reload, right? Resuming activity takes ~10 seconds on medium class device. I want decrease this time as much I can. Is it right way to do it?
tagged with: java
tagged with: andengine
answer count: 2
has answer: http://stackoverflow.com/a/23550802
possible better answer: http://stackoverflow.com/a/43894518
has answer: http://stackoverflow.com/a/43894518
score: 0
tagged with: opengl-es-2.0
has title: AndEngine GLES2 - avoid reloading Texture onResume

http://stackoverflow.com/comment/35962302
has text: Question has been modified.Actually there is no problem with color presentation and I just want the image to be what it really is.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23457754
type: Comment

http://stackoverflow.com/a/23458443
answers question: http://stackoverflow.com/q/23457963
score: 0
type: Answer
has body: All the Http requests are processed or identified by the servlet or ejb component in java. 1.We must deploy restful services server side code in webserver otherwise we cannot expose our functionality over the network 2.To access the rest resource we can use normal java program or any servlet or other. 3.Without using webserver you cannot expose your rest resource over the network at serverside.

http://stackoverflow.com/comment/36227969
type: QuestionComment
comment on: http://stackoverflow.com/q/23601114
has text: Are you loading the fonts from file every `paint`? Maybe you should do that once on start..
score: 0
type: Comment

http://stackoverflow.com/comment/36173784
score: 0
comment on: http://stackoverflow.com/q/23570907
type: Comment
type: QuestionComment
has text: No my project hasn t The Build.xml file .. Mark that doesn't help me The question si another one

http://stackoverflow.com/q/23545749
accepted answer: http://stackoverflow.com/a/23545792
has comment: http://stackoverflow.com/comment/120717543
has body: I made this method in Python : def save(a, b, c): if not os.path.exists("./Data"): os.makedirs("./Data") else: pass var_save = {1: a, 2: b, 3: c } savefile = open('./save.txt','wb') pickle.dump(var_save, savefile) savefile.close() Now I would like to migrate it to a Java program, but it looks like there's no Pickle module in Java. Does anyone know a way of doing this in Java? (a, b and c are Integers)
has title: Pickle module in Java
has comment: http://stackoverflow.com/comment/36124304
tagged with: python
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23545792
tagged with: java
type: Question
upvote count: 4
answer count: 1
downvote count: 0
score: 4

http://stackoverflow.com/q/23472068
tagged with: java
tagged with: rgb
has body: JColorChooser.showDialog(tEkran, "Select a Color", selectedColorBG); After a choice a colour I need to transfer it to 3 variable. Like this: colorR = selectedColorBG.getR colorG = selectedColorBG.getG colorB = selectedColorBG.getB Is there any way to do that ?
answer count: 3
has answer: http://stackoverflow.com/a/23472124
upvote count: 1
has title: How to get a RGB value from Color variable
score: -7
favorite count: 0
tagged with: colors
downvote count: 8
has comment: http://stackoverflow.com/comment/35986493
has answer: http://stackoverflow.com/a/23472164
has answer: http://stackoverflow.com/a/23472105
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23472105
possible better answer: http://stackoverflow.com/a/23472124
has comment: http://stackoverflow.com/comment/35986490
type: Question

http://stackoverflow.com/comment/36162588
type: Comment
has text: you have RequestMapping method implicitely because you define it at your class level. But the @ModelAttribute is per method and you need to define it with the name you want it to appear as in the view, so no it's not applied by default.
comment on: http://stackoverflow.com/a/23565995
type: AnswerComment
score: 0

http://stackoverflow.com/a/23583917
has body: The issue here is that the RecommendationInstance entity is a separate and independent entity that does not have a mapping for the order column. Eclipselink is designed to create inserts only from the entity itself. There is a feature request to have eclipselink store statements and add to them as it processes other mappings, I still don't have it handy though.
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23567267
accepted answer of: http://stackoverflow.com/q/23567267

http://stackoverflow.com/a/23491906
upvote count: 1
has body: Call findViewById() on the rootView you just inflated and not Activity.findViewById(). The fragment view hierarchy is not yet a part of the activity view hierarchy and trying to find the fragment's view from the activity will return null. Invoking a method such as getChildAt() on null causes the NPE. For example, change calls like drawView = (DrawingView)findViewById(R.id.drawing); to drawView = (DrawingView)rootView.findViewById(R.id.drawing);
has comment: http://stackoverflow.com/comment/36024208
has comment: http://stackoverflow.com/comment/36023563
score: 1
has comment: http://stackoverflow.com/comment/36023659
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23491867
has comment: http://stackoverflow.com/comment/36023893
has comment: http://stackoverflow.com/comment/36023793
answers question: http://stackoverflow.com/q/23491867
type: Answer

http://stackoverflow.com/a/23571497
upvote count: 1
answers question: http://stackoverflow.com/q/23571285
has body: you need to have a structure for your code, use simple OOP... your xml parser Class MyXmlParser{ public ArrayList&lt;Commands&gt; parse(String xmlFileName){ } public ArrayList&lt;Commands&gt; parse(String xmlString){ } } and a command class Class Command { private String command = ""; private String options = ""; : : //setters //getters } command sender class.. Class CommandSender{ private Socket socket = null; public CommandSender(String IP, int Port){ //init socket here ... } public boolean sendCommand(Command cmd){ //send command and return true/false... } public void close(){ //close the socket... } } finally ur main class Class AppStarter{ public Static Void Main(String args[]){ MyXmlParser xmlParser = new MyXmlParser(); ArrayList&lt;Commands&gt; cmds = xmlParser.parse(args[0]); CommandSender cmdSender = new CommandSender("192.168.1.110",8081); for(a=0;....cmds.size...){ cmdSender.sendCommand(cmds.get(a)); }//for loop }//main() }
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23522122
accepted answer of: http://stackoverflow.com/q/23521567
has comment: http://stackoverflow.com/comment/36783373
answers question: http://stackoverflow.com/q/23521567
type: AcceptedAnswer
has body: To (try) to answer your question, I'm guessing you are running into multi-thread issues. Swing events run in their own thread thread, the Event Dispatch Thread. If you are accessing the variable from another thread, you will run into occasional situations where the variables are not synchronized between threads. In the bigger picture, taking shortcuts in writing Java code will generally end up costing you a lot of time and effort. Placing your entire UI in static variables with static methods is not a good idea. Take the time to instantiate an instance. Beyond that, I'm guessing you didn't start the UI using SwingUtilities.invokeLater(). Read the Swing Tutorial, which I linked above. Swing works well, but it is not simple.
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/23459291
has comment: http://stackoverflow.com/comment/35966260
score: 2
has comment: http://stackoverflow.com/comment/35964576
has comment: http://stackoverflow.com/comment/35964454
answers question: http://stackoverflow.com/q/23459205
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35965796
has body: Scanner.nextLine() is a blocking call. This means it will make the current thread wait until it returns a value. If you want to receive input through your scanner, aswell as possibly do other things at the same time, youll need another thread. class Test { private static Scanner scanner; private static Thread inputThread = new Thread() { public void run() { scanner = new Scanner(System.in); while(true) { //scanner.nextLine(); } } }; public static void main(String[] args) { inputThread.start(); //handle everything else on main thread } } Because your scanner is receiving input on one thread, and possibly handling thr input on the other, you should start thinking of ways of passing values from thread-0 (the new thread) to the main thread (which calls the main method). There are many ways of doing this, the most basic probably being adding input data to a list right when it comes in, then retreive it from the list on your other thread. But keep in mind, when using multiple threads, you need to worrry about memory inconsistancy. If both objects are trying to access the same object (in this case, the list containing the data), things might not calculate as expected. This is where synchronization come in: http://docs.oracle.com/javase/tutorial/essential/concurrency/sync.html
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23459205
type: Answer

garbage-collection
tags question: http://stackoverflow.com/q/23469111
tags question: http://stackoverflow.com/q/23539174
tags question: http://stackoverflow.com/q/23549002
tags question: http://stackoverflow.com/q/23524419
tags question: http://stackoverflow.com/q/23481455
tags question: http://stackoverflow.com/q/23552134
tag name: garbage-collection
tags question: http://stackoverflow.com/q/23505052
type: Tag
tags question: http://stackoverflow.com/q/23607827
tags question: http://stackoverflow.com/q/23538536
tags question: http://stackoverflow.com/q/23476263

http://stackoverflow.com/q/23464950
has comment: http://stackoverflow.com/comment/35975131
has body: I'm writing a game where a Player can be either local or remote, so I have to read the "move" made by him using multithreading. I have a PlayerLoop thread which initially calls start() on several Player threads. After that, PlayerLoop should repeatedly wake up a single Player (going from the first to the last one) in a cyclic manner, until the game ends. However, not always the Player will wake up: sometimes PlayerLoop notifies the correct Player, but it does that too early (the Player isn't yet "waiting his turn"). Specifically, when I start the PlayerLoop for the first time it seems to work OK, but if during the game I cancel the match and start a new one, then every Player just waits their turn forever. Here's the PlayerLoop: public class PlayerLoop extends Thread { @Override public void run() { System.out.println("Thread [" + Thread.currentThread().getName() + "] is alive."); this.startPlayers(); // cycles Players and calls .start() while (true) { Player current = this.getCurrentPlayer(); current.connect(); // connect to this Player synchronized (current) { try { System.out.println("Notifying Thread [" + current.getName() + "] that it's his turn."); current.notify(); // the player thread "resumes" to eventually produce a "move" current.wait(); // wait for the "move" to be ready } catch (InterruptedException e) { // The game loop is interrupted, terminate thread break; } } this.applyMove(current.getMove()); // use the "move" current.disconnect(); // disconnect this Player this.goToNextPlayer(); } System.out.println("Terminating players..."); this.stopPlayers(); // cycles Players and calls .interrupt() System.out.println("Thread [" + Thread.currentThread().getName() + "] is dead."); } For the moment I'm not testing the "remote" part so here's just the LocalPlayer class, which extends Player, which extends Thread: public class LocalPlayer extends Player { @Override public void run() { System.out.println("Thread [" + Thread.currentThread().getName() + "] is alive.")…
tagged with: multithreading
has answer: http://stackoverflow.com/a/23465049
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/35976021
has comment: http://stackoverflow.com/comment/35976350
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/35974219
has comment: http://stackoverflow.com/comment/35975822
has title: Java multithreading: how to notify() a single thread after all threads are ready
has comment: http://stackoverflow.com/comment/35973961
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23465252

http://stackoverflow.com/comment/72729539
type: Comment
score: 1
has text: I find it strange to say shorthand. Yes, it requires fewer characters, but it requires more lines.
comment on: http://stackoverflow.com/a/23563811
type: AnswerComment

http://stackoverflow.com/q/23586680
upvote count: 1
has title: License plate number verification program JAVA
tagged with: licensing
type: AnsweredQuestion
tagged with: numbers
score: 1
tagged with: java
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/23586748
tagged with: validation
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23586748
has body: I'm trying to write a small program that reads in a license plate number from the user and returns if it is valid or not. I'm not quite sure on how to loop through it to see if certain characters are correct. Note: This is suppose to be an Icelandic license number plate. With Icelandic license number plates, the first 2 characters are capital strings. the 3rd character can be either a capital letter or a number, and the last 2 must be numbers as well. Here is an example of a valid license plate: "HX567". Anyway, here's my code so far, hopefully someone here can show me how to loop through the string and check if the first 2 characters are letters and capital etc..... import java.util.Scanner; import java.util.*; public class Bilnumer { public static void main(String[] args) { Scanner skanni = new Scanner(System.in); System.out.println("Good day, please enter your license plate number."); System.out.println("License plate number: "); String bilnumer = skanni.nextLine(); bilnumer = bilnumer.toUpperCase(); int lengd = bilnumer.length(); if (lengd &gt; 5) { System.out.println("License plate numbers can not be more then 5 characters"); }else{ System.out.println("Your license plate number is: "+bilnumer); } } }

http://stackoverflow.com/a/23540848
accepted answer of: http://stackoverflow.com/q/23540173
answers question: http://stackoverflow.com/q/23540173
has body: I haven't done this before, but it should be possible. You can use the method setKnownHosts(InputStream) and you won't have to create temporary files from the data fetched from DB. Maybe you will have to use a charset in the getBytes(Charset) method to make it work properly. Or maybe you can store it directly as a BLOB and use the bytes. InputStream is = new ByteArrayInputStream("knownh hosts from the file".getBytes()); jsch.setKnownHosts(is);
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/23522748
favorite count: 0
has answer: http://stackoverflow.com/a/23522829
answer count: 4
possible better answer: http://stackoverflow.com/a/23522829
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36081811
linked to: http://stackoverflow.com/q/4716503
accepted answer: http://stackoverflow.com/a/23522845
has answer: http://stackoverflow.com/a/23522927
has comment: http://stackoverflow.com/comment/36081429
downvote count: 1
type: Question
has title: Reading file contents line by line using Java
has answer: http://stackoverflow.com/a/23523340
has comment: http://stackoverflow.com/comment/36081372
has body: In my java program I need to read the contents of file line by line using java.I tried the following code but I am getting this error import acm.program.*; import acm.util.*; import java.io.*; import java.util.*; public class ReadFile extends ConsoleProgram{ private BufferedReader openFileReader(String Prompt){ BufferedReader rd =null; while(rd==null){ String name=readLine(Prompt); try{ rd=new BufferedReader(new FileReader(name)); }catch(IOException ex){ println("cannot open"); } } return rd; } public void run(){ BufferedReader rd = OpenFileReader('File'); try{ while(true){ String line=rd.readLine(); if(line==null){ break; } rd.close(); catch(IOException ex){ throw new ErrorException(ex); } } } } } I am getting error in this line BufferedReader rd = OpenFileReader('File'); The error I am getting is "Invalid character constant". How should I resolve this?
tagged with: java
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/36081800
has answer: http://stackoverflow.com/a/23522845

http://stackoverflow.com/comment/36018752
comment on: http://stackoverflow.com/a/23470916
has text: @Mac: beware that the entire thing only works if you can ensure that you read the `volatile` variable *after* the other thread has written to it. E.g. if `flag` is `volatile` your reading thread has to wait until it reads `true` from `flag`. Only then it can proceed reading the other variables knowing that it will read correctly all values that have been written before `flag` was set to `true`.
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/a/23555207
has body: If the algorithm or key size you want isn't listed in Standard Names you need an external provider that does support it.
has comment: http://stackoverflow.com/comment/36148244
answers question: http://stackoverflow.com/q/23555094
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/23569788
answers question: http://stackoverflow.com/q/23569056
type: Answer
score: 3
upvote count: 3
has body: Entering a[-1] = 5; is something only novices would do (as Richard Tingle said). So it's not worth the effort to update the language standard just for that kind of error. A more interesting case would be a[SOME_CONSTANT] = 5; where SOME_CONSTANT was defined as static final int SOME_CONSTANT = -1; (or some expression involving only constants that computes to -1) in some other class. Even then, however, if the compiler flagged this as an error, it might catch cases where the programmer has put a[SOME_CONSTANT] = 5; in an if statement that has already checked for negative values of the constant. (I'm assuming here that SOME_CONSTANT is a constant whose value could change if the application's requirements change.) So while the language could, in theory, make it illegal to write an array indexing operation that can't possibly succeed, there are good reasons not to. P.S. This is a real issue. The Ada language does do some compile-time checking for static expressions that can't succeed, but it doesn't check this case, and there has been some discussion in the last few weeks about whether it should, or whether compilers should be allowed (but not required) to reject programs with array indexing that is known to fail.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23569056
type: AcceptedAnswer

http://stackoverflow.com/comment/36064611
type: AnswerComment
type: Comment
has text: That's what I believe so as well but for some reason `isStarted` is changed and I understand why.
comment on: http://stackoverflow.com/a/23514032
score: 0

http://stackoverflow.com/comment/36000441
type: AnswerComment
comment on: http://stackoverflow.com/a/23478867
type: Comment
has text: I think you'd better use a while instead of a do-while
score: 0

http://stackoverflow.com/q/23601991
score: 0
answer count: 1
tagged with: hdfs
has comment: http://stackoverflow.com/comment/36341575
has title: How to run a system command on a file in the HDFS?
has answer: http://stackoverflow.com/a/23609761
has body: I have a set of files in my HDFS. I need to run a system command on all these files from java using the API. How do I do it without getting the files into the local filesystem? Is it even possible? I am very new to Hadoop; Please explain the solutions in simple terms. Thanks in advance.
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23609761
type: Question
tagged with: hadoop

http://stackoverflow.com/comment/36132832
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23550215
score: 0
has text: @Pradeep Parcelable is much faster and more optimized for IPC, which is why it is recommended by android. (People don't just go around adding new ways of doing the same thing just for the thrill of messing with people's head)

http://stackoverflow.com/comment/36062704
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23494959
has text: One solution which I can imagine is a "custom deserializer" where you can try to check what `unexpected_other_property_here` represents this time. If `JSON` does not contain any property which defines type of this property you can not use any annotation or something like this.

http://stackoverflow.com/comment/36252550
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23612109
has text: Without the code, hard to tell why it would stops and the rest doesn't. Make sure that it isn't waiting on the threads that are now being made.

http://stackoverflow.com/comment/36214621
has text: The reason why we create classes is not primarily to "add more methods". The answer to his question is much more complicated than this.
comment on: http://stackoverflow.com/a/23593825
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23545619
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/23545668
favorite count: 0
type: Question
has body: I'm writing a program that currently switches back and forth between different JPanels placed on a JFrame that also has a JMenuBar. (We're required to use Swing.) I need to write a tutorial and right now I have it giving step-by-step instructions from a popup window. However, it doesn't seem to resonate well with test users and quite frankly it's annoying to switch back and forth between screens. After checking out JDesktopPane and JInternalFrame it seems to make sense to place my entire program in a desktop pane and then create the tutorial using an internal frame. I'm worried that this will force me to place my different screens each in an internal frame which is NOT what I want to do. I just want the tutorial to be an internal popup(?) that can be minimized and moved around if necessary. Am I going about this the correct way or is there a more efficient/practical way to implement the same tutorial popup feature?
has title: Would it be appropriate to use JDesktopPane and JInternalFrame in this instance?
upvote count: 1
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/23545668
tagged with: java
type: AnsweredQuestion

http://stackoverflow.com/comment/36123428
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23544859
has text: My pleasure. You're most welcome. you can remember for longer time using Visually representation most probably for your next interview :)

http://stackoverflow.com/q/23464259
has answer: http://stackoverflow.com/a/23464323
score: 0
answer count: 3
has body: For some reason, When using my buffered reader to read a .mcf (Map Configuration File), It will not correctly find the characters. This is what I'm using for testing purpose. RendererPanel.java: File file = new File("src/net/PlatformPeril/resources/Railroad.mcf"); BufferedReader br = null; try { br = new BufferedReader(new FileReader(file)); } catch (FileNotFoundException e) { e.printStackTrace(); } String line; try { while ((line = br.readLine()) != null) { if(line.equalsIgnoreCase("0")){ System.out.println("Air Block!"); }else if(line.equalsIgnoreCase("1")){ System.out.println("Rock Block!"); }else if(line.equalsIgnoreCase(" ")){ System.out.println("Empty Line Char; Ignoring"); continue; }else System.out.println("What!"); } } catch (IOException e) { e.printStackTrace(); } try { br.close(); } catch (IOException e) { e.printStackTrace(); } MCF: 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 1 1 1 1 0 0 1 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 And, I'm getting alot of 'What!'.... Any idea of what I'm doing…
has comment: http://stackoverflow.com/comment/35983969
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35973274
has answer: http://stackoverflow.com/a/23465080
tagged with: java
has comment: http://stackoverflow.com/comment/35973261
has comment: http://stackoverflow.com/comment/35972704
has answer: http://stackoverflow.com/a/23464282
has title: BufferedReader Not Reading Correctly
has comment: http://stackoverflow.com/comment/35973569
type: Question

http://stackoverflow.com/q/23587138
answer count: 2
upvote count: 0
has body: For a school assignment we have to make a graph editor like the next one (given example): Most of the assignment goes well, we're stuck on one point: drawing the edges between vertices. In the given example, the lines are nicely drawn from points relatively close to the connecting vertex. For example the top one has two lines on its bottom edge, one more to the left and one more to the right. We are not sure on how to let the drawing of the lines keep the positions of the connecting vertex in account and how to adjust the positions of the beginning and end points on that (what calculations to make). Can someone help out?
favorite count: 0
has answer: http://stackoverflow.com/a/23587342
type: UnansweredQuestion
downvote count: 1
has title: Graph Editor (Java) tips on how to draw edges between vertices
has answer: http://stackoverflow.com/a/23587345
tagged with: java
score: -1
type: Question

http://stackoverflow.com/comment/36084406
type: QuestionComment
score: 2
has text: @djechlin - This has been retired as a close reason. Please choose a different reason if you find this question worthy of being closed.
comment on: http://stackoverflow.com/q/23523820
type: Comment

http://stackoverflow.com/a/23578024
has comment: http://stackoverflow.com/comment/36185072
answers question: http://stackoverflow.com/q/23577962
score: 0
type: Answer
has body: because the and symbol you're using is wrong! Use &amp;&amp; for a boolean condition between two expressions and &amp; only for bitwise operation
has comment: http://stackoverflow.com/comment/36185277

http://stackoverflow.com/comment/35992104
type: QuestionComment
has text: Check the [SO regex reference](http://stackoverflow.com/a/22944075) under **quantifiers**, it will link you to [this question](http://stackoverflow.com/questions/5319840/greedy-vs-reluctant-vs-possessive-quantifiers)
score: 1
comment on: http://stackoverflow.com/q/23474945
type: Comment

http://stackoverflow.com/a/23530220
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23530127
has body: The problem is that Readers/writers read text (as opposed to Input~/OutputStreams). FileReader internally uses the default operating system encoding. That conversion will never do for binary files. Also note, that readLine discards the line ending (\r\n, \n or \u0085). As of Java 7 you can do Files.copy(file.toPath(), socketOut); instead of the wile loop.
answers question: http://stackoverflow.com/q/23530127
type: Answer
has comment: http://stackoverflow.com/comment/36096270
has comment: http://stackoverflow.com/comment/36096534
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/23465492
tagged with: inheritance
score: 0
answer count: 3
has title: Wierd behaviour with Inheritance in C#
linked to: http://stackoverflow.com/q/856449
has answer: http://stackoverflow.com/a/23465533
has body: I am quite new to C#, so i hope if my question sounds silly please pardon my ignorance. - I was trying out Inheritance funda with C# and find it to behave in some odd manner, so i thought to check it out with Java, and i got my expected result. - I just want to know is there anything i am missing here....... C# CODE : class Animal { public void Sound() { System.Console.WriteLine("I don't make any sound"); } } class Dog : Animal { public void Sound() { System.Console.WriteLine("barking"); } } class InheritTest { static void Main() { Animal a = new Dog(); // Implicit conversion Dog d = (Dog) a; // Explicit conversion a.Sound(); d.Sound(); } } OUTPUT : I don't make any sound barking JAVA CODE : class Animal { public void sound() { System.out.println("I don't make any sound"); } } class Dog extends Animal { public void sound() { System.out.println("barking"); } } class InheritTest { public static void main(String[] args) { Animal a = new Dog(); // Implicit conversion Dog d = (Dog) a; // Explicit conversion a.sound(); d.sound(); } } OUTPUT : barking barking - Now my doubt about this whole episode is.. In C# i am assigning Dog object into the Object Reference Variable a of type Animal, then when i call method Sound() on a, i should be getting the output as barking (which is the overridden method in Dog class )but instead Animal's Sound() method is called giving the output as I don't make any sound. - But in Java things are working as expected.. Inheritance works the same way anywhere, so where did i go wrong. I will be obliged if someone can help me out with it...... Thanks in advance.
tagged with: explicit-conversion
type: AnsweredQuestion
tagged with: implicit-conversion
has answer: http://stackoverflow.com/a/23465516
accepted answer: http://stackoverflow.com/a/23465516
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23466073
tagged with: c#
possible better answer: http://stackoverflow.com/a/23465533

http://stackoverflow.com/a/23513149
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23492654
has body: So this is how I was using the wizard: MyCustomWizard wizard = new MyCustomWizard ("title"); WizardDialog wizardDialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard); wizardDialog.open(); Now I created a new class, MyCustomDialog extending the WizardDialog: public class MyCustomDialog extends WizardDialog { public MyCustomDialog(Shell parentShell, IWizard newWizard) { super(parentShell, newWizard); } @Override public void createButtonsForButtonBar(Composite parent){ super.createButtonsForButtonBar(parent); Button finishButton = getButton(IDialogConstants.FINISH_ID); finishButton.setText(windowTitle); } } And now I changed the code where I create wizard and wizard dialog as: MyCustomWizard wizard = new MyCustomWizard ("title"); MyCustomDialog wizardDialog = new MyCustomDialog(Display.getDefault().getActiveShell(), wizard); wizardDialog.open(); Hope it is useful to someone! :) Thanks for the help @greg-449 and @Baz
upvote count: 2
type: Answer

modeling
tags question: http://stackoverflow.com/q/23454667
tag name: modeling
type: Tag
tags question: http://stackoverflow.com/q/23456112

http://stackoverflow.com/q/23529087
favorite count: 0
tagged with: multithreading
has title: Can algorithm using Java AtomicStampedReference can be considered non-blocking?
has comment: http://stackoverflow.com/comment/36093793
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/23529189
has body: I'm trying to implement non-blocking binary search tree as described here using Java. This algorithm is based on single-world CAS but: The state and info fields are stored together in a CAS object. Thus, an internal node uses four words of memory. I decided to use AtomicStampedReference to store this data. The problem is that it maintains stamped references by creating internal objects representing "boxed" [reference, integer] pairs. Internal implementation of this structure: public boolean compareAndSet(V expectedReference, V newReference, int expectedStamp, int newStamp) { Pair&lt;V&gt; current = pair; return expectedReference == current.reference &amp;&amp; expectedStamp == current.stamp &amp;&amp; ((newReference == current.reference &amp;&amp; newStamp == current.stamp) || casPair(current, Pair.of(newReference, newStamp))); } Pair defined as: private static class Pair&lt;T&gt; { final T reference; final int stamp; private Pair(T reference, int stamp) { this.reference = reference; this.stamp = stamp; } static &lt;T&gt; Pair&lt;T&gt; of(T reference, int stamp) { return new Pair&lt;T&gt;(reference, stamp); } } Is this implementation still non-blocking? And the extra question: what's making this compareAndSet operation atomic ?
tagged with: concurrency
type: Question
upvote count: 4
downvote count: 0
tagged with: data-structures
score: 4
accepted answer: http://stackoverflow.com/a/23529189
answer count: 1
has comment: http://stackoverflow.com/comment/36093831

http://stackoverflow.com/q/23483761
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/22155920
has title: What to pass to `blobstoreService.createUploadUrl` so it is handled by my endpoint method
tagged with: blobstore
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25390791
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: My question is similar to getting blobstore to callback to endpoint method but s/he got no reply. Also I actually wrote my code. I created my callback url as BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService(); String url = blobstoreService.createUploadUrl("/loadImages"); And then I created my endpoint as @ApiMethod(name = "loadImages", httpMethod = HttpMethod.POST) public void loadImages(javax.servlet.http.HttpServletRequest req) { //…. get blob key etc. } Then I get an error on my server when the blobstore makes the callback call: No handlers matched this URL. (404) Does anyone know what to pass to blobstoreService.createUploadUrl so it is handled by my endpoint method? I have also tried changing ”/loadImages” to "/_ah/spi/com.company.package.ApiName.loadImages” so that it looks like the other paths, but that didn’t work either. Then I tried "_ah/api/apiname/1/loadImages”: nothing. Note: I am not looking for an alternative to the blobstore/endpoint. When I use simple servlet to receive the callback it works. But the servlet just cheapens my otherwise endpoint-only code.
tagged with: google-app-engine
score: 2
tagged with: google-cloud-endpoints

http://stackoverflow.com/comment/36212336
comment on: http://stackoverflow.com/q/23592838
type: Comment
type: QuestionComment
has text: Is bluecove-2.1.0.jar file located under MyProject_lib folder? If so, class-path should be MyProject_lib/bluecove-2.1.0.jar
score: 0

http://stackoverflow.com/a/23482694
has comment: http://stackoverflow.com/comment/36008576
has comment: http://stackoverflow.com/comment/36008682
upvote count: 2
has comment: http://stackoverflow.com/comment/36008422
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36007981
type: Answer
has comment: http://stackoverflow.com/comment/36009048
has comment: http://stackoverflow.com/comment/36007608
score: 2
accepted answer of: http://stackoverflow.com/q/23482627
has comment: http://stackoverflow.com/comment/36008060
has comment: http://stackoverflow.com/comment/36008647
downvote count: 0
answers question: http://stackoverflow.com/q/23482627
has body: Make two booleans: (example) num1 num2 Make 2 ints Hold1 = 0; Hold2 = 0; put this in your for loop. Try: if(i%rand == 0 &amp;&amp; rand != hold1) { num1 = true; hold1 = rand; } if(i%rand == 0 &amp;&amp; num1 &amp;&amp; rand*hold1 == i) { num2 = true; } then make another if statement: if(num1 &amp;&amp; num2) { (rest of program) } else{(for loop again}
has comment: http://stackoverflow.com/comment/36007339
has comment: http://stackoverflow.com/comment/36008833

http://stackoverflow.com/q/23523507
downvote count: 0
answer count: 0
has body: I've been having this issue for about a day now. I have a project that uses the LibGDX controllers extension. This isn't my first time using the extension, and I'm pretty sure I have it set up correctly. However, whenever I call any methods from the Controllers class, the application crashes, saying Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error creating controller manager: com.badlogic.gdx.controllers.desktop.DesktopControllerManager [...] Caused by: java.lang.NoClassDefFoundError: com/badlogic/gdx/utils/reflect/ClassReflection at com.badlogic.gdx.controllers.Controllers.initialize(Controllers.java:91) [...] Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.utils.reflect.ClassReflection After googling and reading other people's solutions, the problem seems to come from improperly referencing the gdx-controllers jars. But I'm pretty sure mine is set up right. This is the core project: This is the desktop project: The android project is also set up with gdx-controllers.jar and gdx-controllers-android.jar, but I haven't tested it yet. As far as the actual code goes, the only method I'm calling right now is Controllers.addListener(this); in a class that implements ControllerListener. As soon as I comment that line out, everything runs normally. Thanks for reading.
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/61754159
upvote count: 2
tagged with: java
tagged with: libgdx
type: UnansweredQuestion
has title: classNotFoundException when using LibGDX controller extension
score: 2
has comment: http://stackoverflow.com/comment/41774500

http://stackoverflow.com/a/23522197
score: 11
downvote count: 0
has body: You have it described quite well in the Java documentation. The answer to your first question is quite simple. Not using the -implicit option is almost like using -implicit:class (which is the default value of the option), but by explicitly using the option you suppress certain warning: The compiler might not discover the need for some type information until after annotation processing completes. When the type information is found in a source file and no -implicit option is specified, the compiler gives a warning that the file is being compiled without being subject to annotation processing. To disable the warning, either specify the file on the command line (so that it will be subject to annotation processing) or use the -implicit option to specify whether or not class files should be generated for such source files. Now your second question. As the documentation states: To compile a source file, the compiler often needs information about a type, but the type definition is not in the source files specified on the command line. The compiler needs type information for every class or interface used, extended, or implemented in the source file. This includes classes and interfaces not explicitly mentioned in the source file, but that provide information through inheritance. For example, when you create a subclass java.applet.Applet, you are also using the ancestor classes of Applet: java.awt.Panel, java.awt.Container, java.awt.Component, and java.lang.Object. Let's have three classes in three files: Main, ImplicitClass, BaseImplicitClass. Main.java: public class Main { public static void main(String[] args) { ImplicitClass ec = new ImplicitClass(); System.out.println(ec.getClass()); } } ImplicitClass.java: public class ImplicitClass extends BaseImplicitClass { } BaseImplicitClass.java: public class BaseImplicitClass { } When you compile them from command line like this: javac -cp . -implicit:class Main.java or javac -cp . Main.java all the three *.class files are creat…
type: AcceptedAnswer
upvote count: 11
type: Answer
answers question: http://stackoverflow.com/q/23520975
accepted answer of: http://stackoverflow.com/q/23520975

http://stackoverflow.com/q/23467624
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
favorite count: 0
has title: How can I click button to connect my socket with DataOutputStream()
type: UnansweredQuestion
has body: I can't connect button 2 plz tell me how to do this. I never do this >&lt; I can click button 1 button 2 but it show id button1 only. package com.app.messageclient; import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class MessageClient extends Activity implements OnClickListener { Button button1; Button button2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.messageclient); button2=(Button)findViewById(R.id.button2); button2.setOnClickListener(this); button1=(Button)findViewById(R.id.button1); button1.setOnClickListener(this); } I connect button 1 same this codes and connct to this Socket("10.2.114.192",8080) public void onClick(View v) { // TODO Auto-generated method stub Thread t=new Thread(){ public void run() { // TODO Auto-generated method stub try { Socket S=new Socket("10.2.114.192",8080); DataOutputStream dos=new DataOutputStream(S.getOutputStream()); dos.writeUTF(button1.getText().toString()); dos.flush(); dos.close(); S.close(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }; t.start(); Toast.makeText(this,"This message sent!", Toast.LENGTH_SHORT).show(); } can I write it to do that?? //Button2 public void onClick1(View v) { // TODO Auto-generated method stub Thread t=new Thread(){ public void run() { // TODO Auto-generated method stub try { Socket S=new Socket("10.2.114.192",8080); DataOutputStream dos=new DataOutputStream(S.getOutputStream()); dos.writeUTF(button2.getText().toString()); dos.flush(); dos.close(); S.close(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.…
tagged with: sockets
tagged with: android
answer count: 0

http://stackoverflow.com/q/23606388
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
has body: The eCobertura plugin for eclipse seams to ignoge the @CoverageIgnore tag. Classes or methods marked with the tag are still shown red and are counted as untested code in the coverage statistics. Any ideas to get the @CoverageIgnore tags working?
type: Question
has title: eCobertura does not respect @CoverageIgnore
has comment: http://stackoverflow.com/comment/36239044
tagged with: junit
downvote count: 0
favorite count: 0
tagged with: cobertura
tagged with: ecobertura
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36237826
answer count: 0

http://stackoverflow.com/comment/35993066
type: QuestionComment
comment on: http://stackoverflow.com/q/23475623
score: 0
has text: @m0skit0 I did see those, never a bad thing to ask however. Its so easy to not notice
type: Comment

http://stackoverflow.com/comment/36004031
has text: Execute an `ALTER TABLE` statement. Use `Statement#execute` for DDL statements.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23481131

http://stackoverflow.com/q/23463808
accepted answer: http://stackoverflow.com/a/26244692
favorite count: 0
tagged with: spring
has body: I am trying to make Spring 4.0.2 run as JBoss 7 module. When I deploy my war file the following error occur Caused by: java.lang.IllegalStateException: Could not detect JBoss VFS infrastructure at org.springframework.core.io.VfsUtils.&lt;clinit&gt;(VfsUtils.java:92) [spring-core-4.0.2.RELEASE.jar:4.0.2.RELEASE] ... 45 more Caused by: java.lang.ClassNotFoundException: org.jboss.vfs.VFS from [Module "********:main" from local module loader @5ab785fe (finder: local module finder @46be1539 (roots: C:\jboss-as-7.2.0.Final\modules,C:\jboss-as-7.2.0.Final\modules\system\layers\base))] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1] at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1] at org.springframework.core.io.VfsUtils.&lt;clinit&gt;(VfsUtils.java:69) [spring-core-4.0.2.RELEASE.jar:4.0.2.RELEASE] ... 45 more My webappname-servlet.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" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"&gt; &lt;context:component-scan base-package="webappname"/&gt; &lt;/beans&gt; My spring.handlers inside META-INF, without this file I ha…
tagged with: spring-mvc
type: AnsweredQuestion
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26244692
has comment: http://stackoverflow.com/comment/36136533
score: 1
tagged with: java
tagged with: jboss
has title: ClassNotFoundException: org.jboss.vfs.VFS when using Spring 4.0.2 as Jboss 7 module
downvote count: 0
answer count: 1

http://stackoverflow.com/a/23488152
has comment: http://stackoverflow.com/comment/85605253
answers question: http://stackoverflow.com/q/23488093
upvote count: 100
has comment: http://stackoverflow.com/comment/42446497
type: Answer
has comment: http://stackoverflow.com/comment/93562684
has body: Try mvn install before running spring-boot:repackage: mvn clean install spring-boot:repackage
downvote count: 2
score: 98
has comment: http://stackoverflow.com/comment/37151423
has comment: http://stackoverflow.com/comment/70885632

http://stackoverflow.com/q/23524737
type: UnansweredQuestion
tagged with: intersect
tagged with: swing
has answer: http://stackoverflow.com/a/23524823
has title: Making a global variable
answer count: 4
has comment: http://stackoverflow.com/comment/36087930
has comment: http://stackoverflow.com/comment/36085450
tagged with: java
has comment: http://stackoverflow.com/comment/36085285
tagged with: jpanel
has answer: http://stackoverflow.com/a/23524876
has body: I'm making a game and I'm having trouble getting variables from another class. I have a Sprite class and a JPanel class. In my game, I want my score to go up once I hit a coin. My intersect coin code is in my Sprite class. How would I make it so when I hit the coin, my score goes up my 1? This code is from my JPanel class. These are variables declared all the way up top. public static int CoinScore = 0; private String Score = "Score :"; private String TextOnScreen=""; This is my paintcomponent method from the JPanel. public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.drawImage(BackgroundImage,0,0,720,480,0,0,720,480,null); g2d.setColor(Color.black); g2d.fillRoundRect(25, 2, 100, 30, 10, 10); g2d.setColor(Color.orange); Font cp = new Font("Courier", Font.BOLD, 20); g2d.setFont(cp); TextOnScreen = Score + Integer.toString(CoinScore); g2d.drawString(TextOnScreen,30,30); 30,30. for (int i=0; i&lt;mySprites.length; i++) mySprites[i].drawSprite(g2d); } This is from my Sprite class. if (SpriteFilename == "Resources/sprite-concepts.png" &amp;&amp; sprites[i].SpriteFilename == "Resources/coin2.png") { sprites[i].SpriteVisible = false; sprites[i].SpriteBounds.width = 0; sprites[i].SpriteBounds.height = 0; } I tried putting CoinScore = CoinScore + 1 before the } in my if from the sprite class, but it says that CoinScore cannot be resolved to a variable? How would I fix it?
type: Question
has answer: http://stackoverflow.com/a/23526260
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36085424
favorite count: 0
has answer: http://stackoverflow.com/a/23524897

http://stackoverflow.com/a/23522963
answers question: http://stackoverflow.com/q/23522482
has body: Declaring a method parameter as final has the following implications : The method cannot change the method parameter to point to another reference. The method CAN modify the method parameter i.e change the state of the object being referred by the parameter (modify instance variables) I will illustrate this with the following example. Assume I have a Class to represent an employee : class Employee { public String name; public Integer id; } Case 1 : public void test(final Employee emp) { emp = new Employee(); //Invalid since you are changing the reference } Case 2 : public void test(final Employee emp) { emp.name = "John Doe"; //Valid } This is different from a const parameter in C++ which also stops the method from making any changes to the state of the object/reference being passed.
score: 0
type: Answer

http://stackoverflow.com/q/23492655
has answer: http://stackoverflow.com/a/23493081
has comment: http://stackoverflow.com/comment/36024562
type: Question
has title: Substring before numeric
possible better answer: http://stackoverflow.com/a/23492954
has comment: http://stackoverflow.com/comment/36024873
has body: I have : String word = "It cost me 500 box What I want to do is to display this sentence like this : It cost me 500 box I need a general methode, not only for this example. Can you helpe me please ?
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23493205
accepted answer: http://stackoverflow.com/a/23493205
tagged with: string
has answer: http://stackoverflow.com/a/23492954
tagged with: android
has comment: http://stackoverflow.com/comment/36024561
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36107815
score: 0
type: Comment
type: QuestionComment
has text: What does `task:annotation-driven` look like?
comment on: http://stackoverflow.com/q/23536710

http://stackoverflow.com/comment/36107478
type: QuestionComment
comment on: http://stackoverflow.com/q/23536314
has text: My suggestions: change form action to be `action=""` and return true with `ng-submit`. Also quick question, does the alert show?
score: 0
type: Comment

http://stackoverflow.com/comment/35993289
score: 1
has text: IMO I would ask for guidance in a more 'regular' Java programming forum with a 'new to java' section rather than in this Q&A oriented site.
comment on: http://stackoverflow.com/q/23475420
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23491795
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36025918
has comment: http://stackoverflow.com/comment/36061142
accepted answer of: http://stackoverflow.com/q/23487881
type: Answer
answers question: http://stackoverflow.com/q/23487881
downvote count: 0
score: 1
has body: You receive the response from the intermediate server. It sounds like your intermediate server acts as a (reverse) proxy server. When you make a request to your intermediate server, it in turn makes a request to the server on your network (just as you described it). However, the "real" server has usually no idea that the request was initiated by you. In particular, it does not know your IP address or the port you sent your request from. The only thing it does know is the IP address and port of the intermediate (the proxy) server. The proxy server on the other hand still knows the IP address and port from which you sent your request. So you send your request to the proxy, the proxy sends it to the "real" server, the real server sends its response back to the proxy, which sends it back to you. You and the "real" server do not communicate directly with each other.

http://stackoverflow.com/q/23589102
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: magnolia
has title: magnolia cms : Bootstrap failed while installing
tagged with: content-management-system
has comment: http://stackoverflow.com/comment/36484414
score: 0
has body: I got this problem when I installed magnolia cms on my PC. Here is the error message: Error while installing or updating standard-templating-kit module. Task 'Bootstrap' failed. (ValueFormatException: not a valid date: 2012-02-09T14:47:08.216+01:00) General message: Could not perform instal enter code herelation: Error importing config.modules.standard-templating-kit.dialogs.generic.pages.tabChannels: not a valid date: 2012-02-09T14:47:08.216+01:00) I tried to search for this problem, but I can't find any answers. Please help me.
has comment: http://stackoverflow.com/comment/36484392
has comment: http://stackoverflow.com/comment/36555091
has comment: http://stackoverflow.com/comment/36482709
answer count: 0

http://stackoverflow.com/comment/36067027
comment on: http://stackoverflow.com/q/23514787
score: 0
type: Comment
type: QuestionComment
has text: Try to debug the code which gets executed when the script executes `this.metaClass`. There must be a difference to the lookup via the type.

http://stackoverflow.com/q/23524350
score: 1
tagged with: java
tagged with: eclipse
tagged with: gradle
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/31325842
favorite count: 0
has comment: http://stackoverflow.com/comment/36091007
has comment: http://stackoverflow.com/comment/36090826
has title: Linked source folders
answer count: 1
has body: I'm using the Gradle eclipse plugin and I'm trying to connect two project. One of these project is a library and gets never exported since I just link to the library source in real projects. The other project should have a virtual link to the library source and add the linked directory as source directory to classpath. How can I do this with build.gradle? The has a feature for adding required projects (Project Properties -> Java Build Path -> Projects) or virtual source folders (Project Properties -> Java Build Path -> Source -> Link Source...), but it doesn't seem possible to use these features with Gradle java, Gradle eclipse or Gradle eclipse-wtp plugins.
tagged with: dependencies
type: UnansweredQuestion
tagged with: multi-project
has comment: http://stackoverflow.com/comment/36084702
downvote count: 0

http://stackoverflow.com/a/23552779
has comment: http://stackoverflow.com/comment/36138355
has comment: http://stackoverflow.com/comment/36138030
has comment: http://stackoverflow.com/comment/36147608
has comment: http://stackoverflow.com/comment/36138154
downvote count: 0
has comment: http://stackoverflow.com/comment/36138108
has body: This doesn't require multiple threads - I'm not sure why you're adding this complexity If threads were the right thing to use (but they aren't), making your own Jpanel class that is Runnable isn't the right way to do it. What you would want to do is have the Ball class be runnable, and have its position updated in a way that's completely separated from drawing stuff on the screen. Mixing your rendering and movement is not a good separation of concerns. Just have your ball worry about where it is and where it's moving, and let the UI worry about drawing where it is. Swing schedules repaints when it can get around to it, so you're bound to find out at some point that requests to redraw things won't always happen at a consistent frame rate, which may not be what you expect or actually need. If by any chance you're trying to make a game, Swing is going to be a massive waste of your time. What you need is more direct access to screen rendering. Building games with Swing will slowly kill your spirit and make you want to cry. Use something like Slick2D or libgdx instead. The Thread instances you're declaring in your custom Jpanel class aren't even used. Calling Thread.sleep(1) is pretty pointless. Why sleep at all if you're drawing balls on the screen and you're only going to wait about 1 millisecond between ball movements? If you weren't using multiple threads you could either sleep some reasonable amount of time (say, approximately 1/60th of a second) or you could just run at full speed all the time.
type: Answer
answers question: http://stackoverflow.com/q/23552509
score: 1
has comment: http://stackoverflow.com/comment/36138068
upvote count: 1

http://stackoverflow.com/a/27583121
has body: this scenario can be solved by using Multiple Input Format. Using this Input Format we can read two files of different formats and the result of both combined goes to reducer job. The brief description of the concept and examples are given in the below link. https://github.com/subbu-m/MultipleInputFormat I hope this information helps.
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23600368

http://stackoverflow.com/comment/35960233
type: AnswerComment
comment on: http://stackoverflow.com/a/23457442
type: Comment
has text: @JohnVint - OP posted the question without sharing the code of `Temp`. (S)he added it only following my answer.
score: 0

http://stackoverflow.com/comment/36063982
type: QuestionComment
comment on: http://stackoverflow.com/q/23495262
type: Comment
has text: And there they tell me that the question really belongs here :s
score: 0

http://stackoverflow.com/a/23497915
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/43751749
has body: Java 8: private final Map&lt;String, AtomicInteger&gt; cnts = new ConcurrentHashMap&lt;&gt;(); private void accumulate(String name) { cnts.computeIfAbsent(name, k -&gt; new AtomicInteger()).incrementAndGet(); } The ConcurrentHashMap can be freely accessed from multiple threads. The computeIfAbsent method takes a lambda to evaluate to get a value for the key if the key is not present in the map, and adds it if and only if there is no such mapping, and then returns that value. It's effectively putIfAbsent followed by get. The value is a new AtomicInteger with the value 0. Whether there was an existing value, or whether a new one with value 0 was just added, in either case increment it. Java 7: private final ConcurrentMap&lt;String, AtomicInteger&gt; cnts = new ConcurrentHashMap&lt;&gt;(); private void accumulate(String name) { cnts.putIfAbsent(name, new AtomicInteger()); cnts.get(name).incrementAndGet(); } For Java 7, there is no computeIfAbsent method, but that effectively just does a putIfAbsent followed by a get, so the same effect is achieved by calling those methods. There is no concern that the value already existed in the map; a new, zero AtomicInteger is added if and only if the map had no value for that key. Even if another thread got in there before us and added a zero, both threads would then see and increment that same AtomicInteger instance.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23497337
type: Answer
answers question: http://stackoverflow.com/q/23497337
has comment: http://stackoverflow.com/comment/36053174

http://stackoverflow.com/q/23494044
type: AnsweredQuestion
tagged with: syntax
tagged with: java
type: Question
has body: Here are type definitions from Delphi: type MD5Count = array [0 .. 1] of DWORD; MD5State = array [0 .. 3] of DWORD; could the same typedefs be done in Java? For reference: The example above defines two custom data types. One of them is a two-elements array of Int32, other is a four-elements array of Int32.
duplicate of: http://stackoverflow.com/q/1195206
score: 0
tagged with: types
answer count: 1
linked to: http://stackoverflow.com/q/1195206
tagged with: typedef
has title: Define custom array type in Java
has answer: http://stackoverflow.com/a/23494117
has comment: http://stackoverflow.com/comment/36027091
accepted answer: http://stackoverflow.com/a/23494117

http://stackoverflow.com/q/23581446
has comment: http://stackoverflow.com/comment/36193583
favorite count: 0
tagged with: transparency
has answer: http://stackoverflow.com/a/23582016
score: 2
upvote count: 2
tagged with: java
tagged with: swing
accepted answer: http://stackoverflow.com/a/23582016
type: Question
tagged with: jbutton
type: AnsweredQuestion
has title: How to make JButton with transparent background and regular text?
has comment: http://stackoverflow.com/comment/36191176
linked to: http://stackoverflow.com/q/4585867
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36191285
has body: Is there a way to make a JButton which has a transparent fill(30% transparent) and a text which is not transparent? For now I discovered the following options: make both the button and the text transparent. make both of them not transparent. is there an option in between?

http://stackoverflow.com/a/23515528
has comment: http://stackoverflow.com/comment/36067528
has comment: http://stackoverflow.com/comment/36067842
has comment: http://stackoverflow.com/comment/36067485
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23515503
upvote count: 2
has comment: http://stackoverflow.com/comment/36067962
has comment: http://stackoverflow.com/comment/36067707
has comment: http://stackoverflow.com/comment/36067611
has comment: http://stackoverflow.com/comment/36067666
has comment: http://stackoverflow.com/comment/36067388
has body: You go wrong over here + USER + " text not null, " + PWD + " text not null, );"; //remove , from last text not null correct SQL command with below private static final String TABLE_CREATE = "create table userTable(" + USER + " text not null, " + PWD + " text not null);" ;
downvote count: 0
has comment: http://stackoverflow.com/comment/36067995

http://stackoverflow.com/q/23540697
has answer: http://stackoverflow.com/a/23541144
accepted answer: http://stackoverflow.com/a/23541161
favorite count: 0
has comment: http://stackoverflow.com/comment/36115420
has comment: http://stackoverflow.com/comment/36115156
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/23541144
has comment: http://stackoverflow.com/comment/36114847
upvote count: 3
score: 0
tagged with: java
downvote count: 3
tagged with: date
has title: Java Best way to parse quarterly dates
has answer: http://stackoverflow.com/a/23541161
has body: I have a date as APR-JUN10 or APR-JUN 2010 and i need output as 2010-06-30 I need the best way to parse above date in java and should be flexible in adding more such format of dates. note: APR-JUN10 will not parse by any java api, we have to break down APR &amp; JUN 10 and get date as 2010-06-30.
type: AnsweredQuestion

http://stackoverflow.com/comment/36212599
comment on: http://stackoverflow.com/q/23590943
score: 0
has text: Also downvoting this because you can look up Android documentation yourself.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/103612489
type: Comment
type: AnswerComment
has text: The stub always has a hostname or IP address of some kind. It looks first at `java.rmi.server.hostname`, then at whatever `InetAddress` yields. If it yields 127.0.0.1 that can be because of the misconfiguration described in my answer. It isn't provided by Java.
score: 0
comment on: http://stackoverflow.com/a/23584151

http://stackoverflow.com/a/23547514
answers question: http://stackoverflow.com/q/23547418
downvote count: 0
has body: for mutual authentication(2 way SSL) only 2 things needs to be done server's certificate exported from server's keystore(not trust store - in case you are using different trust and key store) and second is client's certificate should be present in server's truststore(not key store - in case you are using different trust and key store) additionally there is a good blog here to read about the same
score: 4
has comment: http://stackoverflow.com/comment/36127765
has comment: http://stackoverflow.com/comment/36129215
type: Answer
has comment: http://stackoverflow.com/comment/36129614
upvote count: 4

http://stackoverflow.com/comment/36221778
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23597024
has text: @RichardKennethNiescior you mention that you failed to implement some algorithms from Wikipedia. Why don't you choose one of them and ask a question specifically about your difficulty there. Also, follow Niklas advice and use the Sieve of Erasthotenes. Look it up somewhere. The algorithm is reasonably easy to understand. Niklas's comment was about the mathematical analysis of the computational complexity of the algorithm (related to the time it takes to execute). Also, please try to be more clear as to what you're actually asking in the future =).
type: Comment

http://stackoverflow.com/comment/36207472
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23579813
has text: first thanks ,and I use eclipse,but i restart it many times.it output the same error.
score: 0

http://stackoverflow.com/comment/35963132
comment on: http://stackoverflow.com/q/23459205
type: Comment
type: QuestionComment
has text: You should use threads..
score: 2

http://stackoverflow.com/comment/36237086
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23606005
has text: Yaa exactly, So what should I do if I need to compare keys and values of both maps.?? also I dont want to put manual logic here..

http://stackoverflow.com/q/23531120
tagged with: reflection
tagged with: expression
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36098943
accepted answer: http://stackoverflow.com/a/23531733
has body: I have a class something like below public class ParentDTO { private String name; private List&lt;Child&gt; childs; .... getters and setters } I want to get the Nth child name from an expression. String sQuery ="childs[0].name"; Now I want to get name of that child from the parent DTO object public String getChildName(ParentDTO paretnDTO, String query) { // will return first child name when I pass // query as sQuery // please help to implement }
score: 0
has comment: http://stackoverflow.com/comment/36098379
answer count: 1
has title: Java Expression resolving to get Object
has answer: http://stackoverflow.com/a/23531733
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36097861

http://stackoverflow.com/a/23495336
answers question: http://stackoverflow.com/q/23494928
type: Answer
has body: public static void main(String arg[]) { String [] test="789455555".split(""); for(String s:test) System.out.println(s); }
score: 0

http://stackoverflow.com/comment/36175165
type: QuestionComment
comment on: http://stackoverflow.com/q/23572560
has text: What's the shape of your polygon? If you can easily break it down to triangles on your end and use those every frame, you might get a bit of a boost.
score: 0
type: Comment

http://stackoverflow.com/comment/36136975
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23551934
score: 0
has text: movies[i].setText(message.toString()); @rahulpasricha

http://stackoverflow.com/q/23607827
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36247752
has comment: http://stackoverflow.com/comment/36241586
has answer: http://stackoverflow.com/a/23635819
score: -1
type: AnsweredQuestion
has body: In Java, say that we are using a Mark and Sweep garbage collector. During the Mark phase, the collector does a DFS and then mark all the live objects live, then when it comes to the sweep phase, it passes through all the objects and reclaim memory of those object not marked live (That's what I learnt about how MS GC works). Say that if I only start from a half of the root, then there will be some objects not reachable during the mark phase, then they are not being marked live, when it comes to the sweep phase, will those un-marked objects being GCed or the GC doesn't know how to deal with them, which means we cannot start GC from half of the root? and why?
tagged with: java
tagged with: garbage-collection
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23635819
has comment: http://stackoverflow.com/comment/36366294
has title: With a Mark&Sweep garbage collector, what is the situation of objects being swept
has comment: http://stackoverflow.com/comment/36242158
has comment: http://stackoverflow.com/comment/36240723
upvote count: 0

http://stackoverflow.com/a/23583236
has comment: http://stackoverflow.com/comment/36194501
answers question: http://stackoverflow.com/q/23583173
upvote count: 2
has comment: http://stackoverflow.com/comment/36194694
has comment: http://stackoverflow.com/comment/36194527
has body: May be this will help... public static void main(String[] args) { BigInteger i = new BigInteger("5876934265987526278534978564378568734564937563487564327564376534875483753475"); String iStr = i.toString(); int[] intArray = new int[iStr.length()]; for(int j=0; j&lt;iStr.length(); j++) { intArray[j] = Integer.parseInt(String.valueOf(iStr.charAt(j))); } }
type: Answer
has comment: http://stackoverflow.com/comment/36194644
score: 1
has comment: http://stackoverflow.com/comment/36194613
downvote count: 1
has comment: http://stackoverflow.com/comment/36194466

http://stackoverflow.com/q/23579268
score: 0
has comment: http://stackoverflow.com/comment/36187363
has answer: http://stackoverflow.com/a/25114988
type: UnansweredQuestion
tagged with: file
has body: I'm trying to work with nio's way to read files from directory. I've come across the java.nio.file.DirectoryStream which is cool because now I don't need to maintain a list of files in the directory by myself and I like this idea. Now, my code is going to be run inside the WAR so that it will read the resources (say some xml files) packed inside jars inside this WAR. I couldn't find a good example of working with DirectoryStream like this. So my question is how can I use this approach (not necessarily this particular class of course) in my situation? Maybe there are some thirdparties that provide the similar abstraction... In addition I would like to test this code from my unit test (which means that ideally this code shouldn't really assume that it runs inside/outside the WAR if its possible of course). Thanks and have a nice day
has comment: http://stackoverflow.com/comment/36187769
has comment: http://stackoverflow.com/comment/36187479
tagged with: java
tagged with: nio
type: Question
has title: java.nio.file.DirectoryStream in WAR
has comment: http://stackoverflow.com/comment/36188074
answer count: 1

http://stackoverflow.com/comment/36106108
type: AnswerComment
has text: So, if an error occured during the first call to execute, it may be that the tables are locked?
type: Comment
comment on: http://stackoverflow.com/a/23535480
score: 0

http://stackoverflow.com/q/23512941
favorite count: 0
has answer: http://stackoverflow.com/a/63640741
has title: How to collapse JTree nodes?
has body: I want to implement a requirement where in I have to collapse all child nodes of JTree. I am using jdk1.6. Note: Only the child nodes of root element are to be collapsed on button click. Here is my code: private static void collapseAll(JTree tree, TreePath parent) { TreeNode node = (TreeNode)parent.getLastPathComponent(); if (!node.isLeaf() &amp;&amp; node.getChildCount()&gt;=0) { Enumeration e = node.children(); while (e.hasMoreElements()) { TreeNode n = (TreeNode)e.nextElement(); TreePath path = parent.pathByAddingChild(n); collapseAll(tree, path); } } tree.collapsePath(parent); }
upvote count: 1
tagged with: swing
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36063482
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/63640741
answer count: 2
tagged with: jtree
downvote count: 0
has answer: http://stackoverflow.com/a/23515039
accepted answer: http://stackoverflow.com/a/23515039
has comment: http://stackoverflow.com/comment/36063440

http://stackoverflow.com/comment/73477598
comment on: http://stackoverflow.com/q/23491630
has text: have you got the speech to text converter for Hindi? I have the same requirement can you guide, How did you implement that?
score: 0
type: Comment
type: QuestionComment

arraylist
tags question: http://stackoverflow.com/q/23504805
tags question: http://stackoverflow.com/q/23509560
tags question: http://stackoverflow.com/q/23523820
tags question: http://stackoverflow.com/q/23589851
tags question: http://stackoverflow.com/q/23549993
tags question: http://stackoverflow.com/q/23464124
tags question: http://stackoverflow.com/q/23575276
tags question: http://stackoverflow.com/q/23478905
tags question: http://stackoverflow.com/q/23576212
tags question: http://stackoverflow.com/q/23469583
tags question: http://stackoverflow.com/q/23567418
tags question: http://stackoverflow.com/q/23459504
tags question: http://stackoverflow.com/q/23517415
tags question: http://stackoverflow.com/q/23514525
tags question: http://stackoverflow.com/q/23571245
tags question: http://stackoverflow.com/q/23487668
tags question: http://stackoverflow.com/q/23518349
tags question: http://stackoverflow.com/q/23471553
tags question: http://stackoverflow.com/q/23576540
tags question: http://stackoverflow.com/q/23595305
tags question: http://stackoverflow.com/q/23471450
tags question: http://stackoverflow.com/q/23454565
tags question: http://stackoverflow.com/q/23600149
tags question: http://stackoverflow.com/q/23599182
tags question: http://stackoverflow.com/q/23601101
tags question: http://stackoverflow.com/q/23557587
tags question: http://stackoverflow.com/q/23515824
tags question: http://stackoverflow.com/q/23473567
tags question: http://stackoverflow.com/q/23595928
tags question: http://stackoverflow.com/q/23529720
tags question: http://stackoverflow.com/q/23599484
tags question: http://stackoverflow.com/q/23455233
tags question: http://stackoverflow.com/q/23477183
tags question: http://stackoverflow.com/q/23505868
tags question: http://stackoverflow.com/q/23586328
tags question: http://stackoverflow.com/q/23486327
tags question: http://stackoverflow.com/q/23468264
tags question: http://stackoverflow.com/q/23466170
tags question: http://stackoverflow.com/q/23506133
tags question: http://stackoverflow.com/q/23458290
tags question: http://stackoverflow.com/q/23528112
tags question: http://stackoverflow.com/q/23615261
tags question: http://stackoverflow.com/q/23535346
tags question: http://stackoverflow.com/q/23569913
tags question: http://stackoverflow.com/q/23530882
tags question: http://stackoverflow.com/q/23589253
tags question: http://stackoverflow.com/q/23514072
tags question: http://stackoverflow.com/q/23549433
tags question: http://stackoverflow.com/q/23570796
tags question: http://stackoverflow.com/q/23548903
tags question: http://stackoverflow.com/q/23492233
tags question: http://stackoverflow.com/q/23468305
tags question: http://stackoverflow.com/q/23456613
tags question: http://stackoverflow.com/q/23526722
tags question: http://stackoverflow.com/q/23467987
tags question: http://stackoverflow.com/q/23532990
tags question: http://stackoverflow.com/q/23583348
tags question: http://stackoverflow.com/q/23585257
tags question: http://stackoverflow.com/q/23521908
tags question: http://stackoverflow.com/q/23453094
tags question: http://stackoverflow.com/q/23506475
tags question: http://stackoverflow.com/q/23552723
tags question: http://stackoverflow.com/q/23563964
tags question: http://stackoverflow.com/q/23511821
tags question: http://stackoverflow.com/q/23596031
tags question: http://stackoverflow.com/q/23610488
tags question: http://stackoverflow.com/q/23594278
tags question: http://stackoverflow.com/q/23554162
type: Tag
tags question: http://stackoverflow.com/q/23512102
tags question: http://stackoverflow.com/q/23591279
tags question: http://stackoverflow.com/q/23574167
tags question: http://stackoverflow.com/q/23615438
tags question: http://stackoverflow.com/q/23585601
tags question: http://stackoverflow.com/q/23540204
tags question: http://stackoverflow.com/q/23544544
tag name: arraylist
tags question: http://stackoverflow.com/q/23531667
tags question: http://stackoverflow.com/q/23462072
tags question: http://stackoverflow.com/q/23542082

http://stackoverflow.com/q/23505374
tagged with: hadoop
score: 0
has comment: http://stackoverflow.com/comment/36050005
answer count: 1
type: UnansweredQuestion
tagged with: java
has body: IDbb5d7b0afbe40651f54120e31eb7fdd6 SI|us_us-800148_Rachel%20Maddow|http://www.msnbc.com/rachel-maddow-show TI1393717980 FC10 **UAMozilla/5.0** (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.73.11 (KHTML, like Gecko) Version/7.0.1 Safari/537.73.11 I am a beginner in Hadoop MapReduce looking for some guidance Above is 1 sample record. I have a flat file that contains 10,000 similar records. If I want to read only the UAMozilla from the following line and count its occurrence in the file. How can I achieve this using MapReduce in Java. Please help as I have been looking to resolve this for days with no luck !!! Sincere thanks !
type: Question
has title: Defining custom Keys
has answer: http://stackoverflow.com/a/23508415
tagged with: mapreduce

http://stackoverflow.com/a/23542238
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23542117
answers question: http://stackoverflow.com/q/23542117
upvote count: 2
type: AcceptedAnswer
has body: The simplest way to do this is to use some Pair class (that simply stores two parameters and implements hashCode and equals correctly) as the key of your HashMap. There is an implementation here or you can write your own, more specific to your purpose (with more sensible variable and method names).

http://stackoverflow.com/q/23553038
type: Question
linked to: http://stackoverflow.com/q/2393179
has body: I have a trouble with reading multiple objects from InputStream(i.e. from file). I receive the exception: java.io.StreamCorruptedException: invalid type code: AC at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1379) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371) at com.socket.Client.readFromFile(Client.java:63) at com.socket.Client.main(Client.java:44) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) I have managed to read/write only one object, it's OK. I can write many objects, it's OK too. But I cannot read more than one object from file. Why does it happen so? EDIT: NB! It seems I have faced with the problem of implementing of List in Externalazible class. How to implement it correcly? My 'Main' code: public class Client { public static void main(String[] args) { if (args[0] == null || args[1] == null) { System.out.println("No arguments entered!"); System.exit(0); } try (Socket clientSocket = new Socket("localhost", 3000); OutputStream outbound = clientSocket.getOutputStream(); BufferedReader inbound = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));) { outbound.write((args[0] + "\n").getBytes()); outbound.write("End\n".getBytes()); List&lt;StockQuote&gt; stockQuotes = new ArrayList&lt;&gt;(); String quote; while (true) { quote = inbound.readLine(); if (quote != null &amp;&amp; quote.equals("End")) break; stockQuotes.add(new StockQuote(args[0], new Double(quote))); } writeInFile(args[1], stockQuotes); stockQuotes.clear(); stockQuotes = readFromFile(args[1]); if (stockQuotes != null) for (StockQuote stockQuote : stockQuotes) System.out.println("The " + stockQuote.getSymbol() + " price is " + stockQuo…
has title: Cannot read multiple externalizable objects from InputStream
duplicate of: http://stackoverflow.com/q/2393179
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36138738
score: 0
tagged with: java
tagged with: inputstream
has answer: http://stackoverflow.com/a/23553258

http://stackoverflow.com/a/23489367
has comment: http://stackoverflow.com/comment/36018955
upvote count: 2
answers question: http://stackoverflow.com/q/23489297
has comment: http://stackoverflow.com/comment/36019678
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36019067
downvote count: 0
has body: Breakpoints are not Java. Breakpoints are IDE specific. Ergo, a Java method call isn't going to force the IDE to stop running normally and start debugging, because it isn't Java that initiates that in the first place. But, and I'm sure you've already considered this, what's wrong with: if(r &gt; 5 &amp;&amp; r &lt; 10) { methodCall() // Add break point here. }

http://stackoverflow.com/comment/36115834
type: Comment
comment on: http://stackoverflow.com/a/23470735
score: 0
type: AnswerComment
has text: NO ITS NOT FROM MY PROXY

http://stackoverflow.com/a/23604243
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23601161
has body: You need to generate a token before you make Ajax call. The s:token tag merely places a hidden element that contains the unique token. You need to put this hidden element inside the form, so it to be included among other fields that are submitted. Check the usage of the <s:token> tag. If you want to make an Ajax call you can do it in many ways, so you can check this answer too for Struts token interceptor. One way is to use jQuery plugin and its <sj:submit> tag. <%@ taglib prefix="s" uri="/struts-tags"%> <%@ taglib prefix="sj" uri="/struts-jquery-tags"%> <sj:head/> <s:form action="UpdateUser"> <s:textfield name="name" label="User Name"></s:textfield> <s:textfield name="address" label="Address"></s:textfield> <sj:submit name="submit" value="Update"></s:submit> <s:token /> </s:form>
answers question: http://stackoverflow.com/q/23601161
downvote count: 0
type: AcceptedAnswer
score: 1
type: Answer

executorservice
type: Tag
tags question: http://stackoverflow.com/q/23513497
tag name: executorservice
tags question: http://stackoverflow.com/q/23483150
tags question: http://stackoverflow.com/q/23552930
tags question: http://stackoverflow.com/q/23557550
tags question: http://stackoverflow.com/q/23597803
tags question: http://stackoverflow.com/q/23561745
tags question: http://stackoverflow.com/q/23563466
tags question: http://stackoverflow.com/q/23565170

http://stackoverflow.com/q/23596788
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23596835
downvote count: 3
answer count: 1
has comment: http://stackoverflow.com/comment/36220493
favorite count: 0
has body: I'm Suppoused to write a class with a constructor for a Point and a Line and in the Line class I'm suppoused to write a method that finds if two lines intersect or not. This is my Point class: public class Point { static double x; static double y; public Point(double x, double y) { this.x = x; this.y = y; } } This is my Line Class public class Line { public Line(Point x, Point y) { } // create two points for a line static Point x1y1; static Point x2y2; // create another two points for another line static Point x3y3; static Point x4y4; public static void main(String[] args) { // create lines Line line1 = new Line(x1y1, x2y2); Line line2 = new Line(x3y3, x4y4); //initialize points x1y1 = new Point(1.0, 1.0); x2y2 = new Point(3.0, 3.0); x3y3 = new Point(1.0, 2.0); x4y4 = new Point(4.0, 2.0); //call method to find if lines intersect findIntersection(line1, line2); System.out.println(x1y1.x); } public static void findIntersection(Line line1, Line line2) { double denominator = (x1y1.x - x2y2.x) * (x3y3.y - x4y4.y) - (x1y1.y - x2y2.y) * (x3y3.x - x4y4.x); double px = 0; double py = 0; if (denominator == 0) { System.out.println("Lines are parallel, they do not intersect"); } else { px = ((x1y1.x * x2y2.y - x1y1.y * x2y2.x) * (x3y3.x - x4y4.x) - (x1y1.x - x2y2.x) * (x3y3.x * x4y4.y - x3y3.y * x4y4.x)) / denominator; py = ((x1y1.x * x2y2.y - x1y1.y * x2y2.x) * (x3y3.y - x4y4.y) - (x1y1.y - x2y2.y) * (x3y3.x * x4y4.y - x3y3.y * x4y4.x)) / denominator; System.out.println(px + "," + py); } } } The problem is I initialize all the points so that the lines should intersect, but when I try to print out the values of the points, the values of the x-es and y-s of the firss 3 points are equal to the 4th one although I'm initializing them with different values and thus the method calcutes that the lines do not intersect. Why are the values of the first three y and x equal to the 4th?
type: UnansweredQuestion
score: -3
upvote count: 0
has title: How to find intersections of two lines
has comment: http://stackoverflow.com/comment/36220156

http://stackoverflow.com/a/23534665
score: 1
has comment: http://stackoverflow.com/comment/36104165
has comment: http://stackoverflow.com/comment/36104108
has body: Convert the date to days. For example how many days passed from 01/01/1900 then add 3 days and convert it back.
upvote count: 1
answers question: http://stackoverflow.com/q/23534528
type: Answer
downvote count: 0

http://stackoverflow.com/a/23609378
answers question: http://stackoverflow.com/q/23608059
type: Answer
has comment: http://stackoverflow.com/comment/36251741
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36252030
has comment: http://stackoverflow.com/comment/36251847
has body: "So what would be the best way to randomize or shuffle the images and values set to each button" Just use Collections.shuffle() to shuffle the array of buttons. It takes a List argument, but you can just use Arrays.toList(). After the array is shuffled, then re-layout the panel with the buttons. See example import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Arrays; import java.util.Collections; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class ShuffleButtons { private JButton[] buttons; private JPanel gridPanel; public ShuffleButtons() { gridPanel = new JPanel(new GridLayout(4, 4)); buttons = getButtons(16); layoutButtons(); JFrame frame = new JFrame("Shuffle Buttons"); frame.add(gridPanel); frame.add(getResetButton(), BorderLayout.SOUTH); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public void shuffleButtons() { if (buttons != null) { Collections.shuffle(Arrays.asList(buttons)); layoutButtons(); } } public void layoutButtons() { gridPanel.removeAll(); for (JButton button : buttons) { gridPanel.add(button); } gridPanel.revalidate(); gridPanel.repaint(); } private JButton[] getButtons(int size) { JButton[] buttons = new JButton[size]; for (int i = 0; i &lt; size; i++) { final JButton button = new JButton(" [ " + i + " ] "); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { System.out.println("Button " + button.getText() + " pressed"); } }); buttons[i] = button; } return buttons; } private JButton getResetButton() { JButton button = new JButton("RESET"); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { shuffleButtons(); } }); return button; } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ pu…
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23608059

http://stackoverflow.com/a/35903558
has body: I think that topic for each tenant is the right choice. The naming convention might be something like this: topic_base_name_tenant_id. The reasons are: It allows flexible configuration for each tenant (like @Sebastian mentioned earlier). Clearer logical separation. Now let's say that we will use different approach. For example, partition for each tenant. It might be problematic, since: You are limiting the parallelism level to the number of tenants. Adding new tenants, results adding new partition → republish old messages (The default partitioning algorithm is: message_key % partition_size).
score: 4
answers question: http://stackoverflow.com/q/23516427
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23516427
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/36158833
has text: @owlstead Hence my _usually_ ;)
type: AnswerComment
comment on: http://stackoverflow.com/a/23564238
type: Comment
score: 1

http://stackoverflow.com/a/23613941
has comment: http://stackoverflow.com/comment/36252026
type: Answer
has body: This is because s.charAt(i) is a character code of the digit, not its numeric value. the UNICODE code point for '0' is U+0030; for '1', it is U+0031. Change to int ch=s.charAt(i) - '0'; to fix the problem (demo on ideone). The reason this works is that the code points of digits are arranged sequentially. Subtracting the code point of zero from a code point of another decimal digit produces "the distance" between that code point and the corresponding digit, which corresponds to the numeric value of the digit.
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/36252181
has comment: http://stackoverflow.com/comment/36252076
accepted answer of: http://stackoverflow.com/q/23613895
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23613895
has comment: http://stackoverflow.com/comment/36252095

http://stackoverflow.com/comment/36536030
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23580312
type: Comment
has text: Thank you for your attention. The .lex file is in binary format, thats my problem. :) Yes, Microsoft office can read .lex files, I am not sure what else can. I am able to import a .lex dictionary and use it as a spellchecker in Word. I am now just hoping someone who has already worked on something similar can help me..

http://stackoverflow.com/a/23984585
has comment: http://stackoverflow.com/comment/36960332
has body: A server that requires client authentication will send a list of acceptable certificate types, possibly along with a list of acceptable CAs. By default, your Java client then applies the following algorithm: For each certificate type (RSA, DSA, EC) accepted by the server, find any public/private key pairs in the key store which have been generated with the specified algorithm If the server sent a list of acceptable CAs, remove any key pair that doesn't contain any of the CAs in the list in its certificate chain If there is at least one key pair remaining, select the private key corresponding to the first one; otherwise go back to step 1 for the next key type. The client certificate choice algorithm isn't specified in RFC 5246, but Java's simple default implementation seems reasonable, if subject to change in the future as noted by EJP. In particular, the 'first' one is pretty much random - credentials are currently stored in a Map, so it is going to depend on iteration order of the entry set. Also, the KeyManager implementations are pluggable, and there is a 'NewSun' implementation available with OpenJDK that is activated by passing the security property ssl.KeyManagerFactory.algorithm=NewSunX509. This second one will also take into account of your client certificates' keyUsage and extendedKeyUsage attributes, as well as the expiry dates. If you need to guarantee the certificate sent from a list of possibilities and you find that the default behaviours aren't doing it for you, your best option is to manually create a single-entry keystore and use it to initialise an SSLContext, or write your own implemenation of X509KeyManager to do what you want in chooseClientAlias, like in the answers to this question or this question.
type: Answer
score: 21
upvote count: 21
answers question: http://stackoverflow.com/q/23527426
accepted answer of: http://stackoverflow.com/q/23527426
has comment: http://stackoverflow.com/comment/36971107
has comment: http://stackoverflow.com/comment/36970353
has comment: http://stackoverflow.com/comment/36971663
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36971436

http://stackoverflow.com/a/23610825
type: Answer
has comment: http://stackoverflow.com/comment/36246082
has comment: http://stackoverflow.com/comment/36247275
accepted answer of: http://stackoverflow.com/q/23610415
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23610415
has comment: http://stackoverflow.com/comment/36279542
has comment: http://stackoverflow.com/comment/36248859
has comment: http://stackoverflow.com/comment/36245993
has comment: http://stackoverflow.com/comment/36249691
has body: If I remember correctly, a cross-correlation is the same as convolution with one of the signals time-reversed. A convolution in turn is efficiently calculated by multiplying the spectra of the two signals; i.e., take the FFT of each signal padded at least to the sum of the size of both signals, multiply the FFT transformed spectra, do an inverse IFFT, and search for your peak. For Java, you can use JTransforms to do the FFT/IFFT. If you want to play with this approach before actually implementing it, you can try my application FScape; it has a convolution module that takes two sound files (you tagged the question "audio-processing", so I assume you can generate sound files).
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36467644

http://stackoverflow.com/q/23541525
tagged with: jface
tagged with: e4
type: UnansweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has body: I have two partstacks. In one partstack I have JFace tableviewer with four coulmns with checkbox editing support. In second partstack is for displaying Jfreecharts based on the checkbox selection made in first part. In second part I can add parts(kind of tabs) dynamically. Basically after making selection in checkbox, chart is displayed , if i create a new part then the check box selection should be cleared up and i can select some checkbox and display the chart based on those selection. If I click on the previous part where the first selections are made and graph drawn should remain as it is. Depends on the part currently active, the selections made on the tableviewer should be shown.I am able to display the graph based on selection but I dnt know how to show changes made in check box for the corresponding part.Can any one please suggest some idea?
has answer: http://stackoverflow.com/a/23559883
answer count: 1
has title: How to keep track of the check box selection in tableviewer in eclipse e4
score: 0

http://stackoverflow.com/q/23511498
type: Question
has comment: http://stackoverflow.com/comment/36060363
tagged with: point-in-polygon
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/36061023
has body: i'm looking for a algorithm to test if a point is lying inside or outside of a polygon (in our case we're interested whether the point is lying outside of the minimum bounding box of a polygon). We had an idea to test if a segment of the point has even number of intersections with the mbb. But we have no idea how to convert this idea into a java-code. we've already two arraylist of the mbb-points and of our testpoints. We also have an the loweleft, upperright corner of the mbb and the height and the width of the mbb. so has someone an idea how to test this in java? thanks a lot!
has answer: http://stackoverflow.com/a/23511613
accepted answer: http://stackoverflow.com/a/23511613
type: AnsweredQuestion
tagged with: java
has title: point in polygon with segement intersection java
tagged with: segment

http://stackoverflow.com/q/23566383
has body: Say I have a class which I want to add an attribute to. The value of this property should implement a certain interface. I do, however, not care at all what kind of object/class it is, as long as it implements the methods from a certain interface. Is there a way to achieve this behavior? In Objective-C, I would do it like this: @property (nonatomic, strong) id &lt;MyInterface&gt; attr;
has title: Java attribute which implements a certain Interface
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23566429
has comment: http://stackoverflow.com/comment/36162776
answer count: 1
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/23566429
tagged with: interface
tagged with: attributes

http://stackoverflow.com/comment/36138897
type: AnswerComment
has text: It doesn't answer the question. The OP's code is fine, and this NoPlant idea is a bad idea.
comment on: http://stackoverflow.com/a/23553223
type: Comment
score: 1

http://stackoverflow.com/a/23552998
upvote count: 1
has body: As @ChristopheD said, use Enums. Here's an example: package main; public enum CPU_TYPE { TYPE1, TYPE2, TYPE3; } and then in your main class: public CPU_TYPE cpuType = new CPU_TYPE(); public static void main(String[] args) { //setting cpuType = CPU_TYPE.TYPE1; // getting if(cpuType == CPU_TYPE.TYPE1) { cpuType = CPU_TYPE.TYPE2; } }
type: Answer
answers question: http://stackoverflow.com/q/23552675
downvote count: 0
score: 1

http://stackoverflow.com/comment/108113241
has text: Where is this documented jon? I'm trying to unmarshal some JSON and I'm finding a very hard time finding good documentation for the XML DSL, which is what we're using. This would explain my issue, but I don't control the JSON I'm receiving :(
type: Comment
comment on: http://stackoverflow.com/a/23469933
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36239709
comment on: http://stackoverflow.com/a/23537742
score: 0
has text: Media decorator class is a simple decorator class or different and which method i have to override in this class to avoid html tags from download
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36040291
comment on: http://stackoverflow.com/q/23497741
score: 0
has text: Here is NPE: http://www.dodaj.rs/f/C/JH/MueBn3C/npe.png
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23551260
upvote count: 7
score: 7
has body: A key to success with Swing layouts is to avoid setLayout(null) and to pack() the enclosing Window. This lets the contained components adopt their preferred sizes, as shown below. To avoid this pitfall, don't invoke setResizable(false). import java.awt.*; import javax.swing.*; /** @see https://stackoverflow.com/a/23551260/230513 */ public class ClockFrame extends JFrame { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { ClockFrame cf = new ClockFrame(); } }); } public ClockFrame() { setTitle("Clock"); setDefaultCloseOperation(EXIT_ON_CLOSE); initComponents(); pack(); setLocationRelativeTo(null); setVisible(true); } @SuppressWarnings("unused") private void initComponents() { JPanel header = new JPanel(); header.setLayout(new BoxLayout(header, BoxLayout.LINE_AXIS)); JPanel section = new JPanel(); section.setLayout(new BoxLayout(section, BoxLayout.LINE_AXIS)); JLabel label = new JLabel("The time is..."); JButton speakButton = new JButton("Speak"); JLabel time = new JLabel("00:00"); time.setFont(time.getFont().deriveFont(72f)); section.add(Box.createHorizontalGlue()); section.add(time); section.add(Box.createHorizontalGlue()); header.add(label); header.add(Box.createHorizontalGlue()); header.add(speakButton); add(header, BorderLayout.PAGE_START); add(section, BorderLayout.CENTER); } }
downvote count: 0
has comment: http://stackoverflow.com/comment/36134988
answers question: http://stackoverflow.com/q/23549089
type: Answer

http://stackoverflow.com/a/23571670
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23554113
has body: The mistake is using SimpleTree. A SimpleTree is just a tree structure with no node labels, and so isn't useful for much. I've added a note in the documentation saying that. With LabeledScoredTreeNode it works fine: private static Tree addNodeFixed(Tree tree, Label posTag, Label value, int index) { Tree posNode = new LabeledScoredTreeNode(posTag); posNode.setValue(posTag.value()); Tree valueNode = new LabeledScoredTreeNode(value); valueNode.setValue(value.value()); posNode.addChild(valueNode); tree.insertDtr(posNode, index); return tree; } However, if you're using Tregex to match trees anyway, you might find it easier to do things with Tsurgeon. Watch for the infinite loops on insertions, though! private static Tree addNodeTsurgeon(Tree tree, String tag, String word) { TregexPattern pat = TregexPattern.compile("__=root !&gt; __ !&lt; " + tag); TsurgeonPattern surgery = Tsurgeon.parseOperation( "insert (" + tag + " " + word +") &gt;1 root"); return Tsurgeon.processPattern(pat, surgery, tree); }
answers question: http://stackoverflow.com/q/23554113
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/36222859
has text: Edit that into your post; a usage example always helps. As it stands, this answer isn't very clear. See: [How to answer?](http://stackoverflow.com/questions/how-to-answer)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23597471
type: AnswerComment

http://stackoverflow.com/comment/36148548
has text: Thank you, I do understand that regex will be not an efficient solution for finding large repeating sequences(hexamers and above), and will increase complexity.
comment on: http://stackoverflow.com/a/23558048
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23572589
has body: Check HTTP Response Codes. If you receive a status code that isn't OK(200) then you shouldn't try to parse for a successful response. For instance you may check the code and handle response like this (the object types are not actual Java types, but are given to provide an example): MyHttpResponse response = MyHttpHelper.execute(...); int status = response.getMyStatusCode(); String responseData = response.getStringBody(); switch(status) { case 200: { //request is successful, parse valid data break; } default: { //request is not valid, parse error data break; } }
answers question: http://stackoverflow.com/q/23572451
score: -1
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36174797
has comment: http://stackoverflow.com/comment/36176162
downvote count: 1

http://stackoverflow.com/comment/36077790
has text: using a hammer to crack an egg, I would probably use a javascript engine, as this is valid in javascript, to do the evaluation for me (rhino, probably).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23520979
type: Comment

http://stackoverflow.com/q/23595560
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23595915
accepted answer: http://stackoverflow.com/a/23595915
type: AnsweredQuestion
has body: I have saved Picasa's face data inside my JPEG files (in XMP) and now I am trying to read that information in Java. So far I am failing and help would be much appreciated. I am trying to use metadata-extractor library (though any other solution would also be fine). I can read the basic information (like the date, the image size etc.), but I am lost at extracting the additional data. This is what I get so far: File file -- this is my JPEG file Metadata metadata = JpegMetadataReader.readMetadata(file); XmpDirectory xmpDirectory = metadata.getDirectory(XmpDirectory.class); XMPMeta xmpMeta = xmpDirectory.getXMPMeta(); System.out.println(xmpMeta.dumpObject()); Result: ROOT NODE http://www.metadataworkinggroup.com/schemas/regions/ = "mwg-rs:" (0x80000000 : SCHEMA_NODE) mwg-rs:Regions (0x100 : STRUCT) mwg-rs:AppliedToDimensions (0x100 : STRUCT) stDim:h = "2793" stDim:unit = "pixel" stDim:w = "2047" mwg-rs:RegionList (0x200 : ARRAY) [1] (0x100 : STRUCT) mwg-rs:Area (0x100 : STRUCT) stArea:h = "0.69531" stArea:unit = "normalized" stArea:w = "0.790425" stArea:x = "0.491451" stArea:y = "0.41783" mwg-rs:Name = "abcde" mwg-rs:Type = "Face" http://ns.adobe.com/xap/1.0/ = "xmp:" (0x80000000 : SCHEMA_NODE) xmp:ModifyDate = "2014-04-06T19:43:24+01:00" I do not understand how to get to these stArea:w, mwg-rs:Type = "Face", etc.
score: 3
downvote count: 0
tagged with: picasa
tagged with: java
type: Question
has title: How to read XMP face data from JPEG in Java
tagged with: xmp
upvote count: 3
tagged with: metadata-extractor

http://stackoverflow.com/comment/36109782
score: 0
type: AnswerComment
has text: Thank you for clear answers. I would be glad to ask questions about Lotus Notes, I am just not sure this thread is a proper scope for that.
type: Comment
comment on: http://stackoverflow.com/a/23507456

http://stackoverflow.com/comment/36050013
has text: @LuiggiMendoza Adding and deleting fields works in serialization. It looks more like the field 'num' wasn't in the class E when the program was run. I bet a stack trace would show it happened at a line that references 'num' directly, not inside the object steam code.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23504458

http://stackoverflow.com/q/23470600
has body: I developed an application which I want to multiply for different targets. So the source code would stay the same but some vars change for each target. Xcode could easily do this by adding a new target. You could then run all individual targets as individual apps and when you change something in the source its affecting all targets. How does something like this work with Android? I'm developing in the latest Android Studio.
tagged with: white-labelling
tagged with: multiplication
tagged with: android
has title: Android apps based on project
has answer: http://stackoverflow.com/a/23470955
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
upvote count: 2
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23470955
linked to: http://stackoverflow.com/q/16737006
favorite count: 0
tagged with: android-studio

http://stackoverflow.com/q/23543192
has comment: http://stackoverflow.com/comment/36120832
has body: I fail to get a Class into scope of the ScriptEngine while running nashorn in scala. Here is what I try to do: import javax.script.{ScriptEngine, ScriptEngineManager} case class MyClass(id: Option[String], name: Option[String]) val manager: ScriptEngineManager = new ScriptEngineManager val engine: ScriptEngine = manager.getEngineByName("nashorn") var simpleScript: String = """ var myClass = new MyClass('myId', 'myName'); print(myClass.id); """` engine.eval(simpleScript) Does anyone know how to initiate MyClass from JavaScript? I get the following Exception: javax.script.ScriptException: ReferenceError: "MyClass" is not defined in &lt;eval&gt; at line number 1`
score: 0
answer count: 1
tagged with: scala
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36119687
has answer: http://stackoverflow.com/a/23544663
has title: How can I put a Class into Scope of a JJS ScriptEngine in Scala
tagged with: java
type: Question
tagged with: nashorn

http://stackoverflow.com/a/23485557
type: AcceptedAnswer
has body: After you got a nextInt(), you asked it if it had another input with hasNextInt() it only knows this if you enter something more. Perhaps you intended to put nextInt() inside the if block. Perhaps you also want to use int repeats as its an int value.
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/23485509
score: 3
accepted answer of: http://stackoverflow.com/q/23485509
downvote count: 0

http://stackoverflow.com/q/23487233
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/23488081
tagged with: java
tagged with: hibernate
type: Question
tagged with: replace
has answer: http://stackoverflow.com/a/23488081
downvote count: 0
tagged with: jar
tagged with: upgrade
answer count: 1
favorite count: 0
upvote count: 2
has body: Right now, My project framework is Hibernate 3.6.5 now want to upgrade it to the latest one Hibernate 4.3.5. There are some dependencies in between the .jar files. My question is : What all are the .jar files need to be change/replace at the time of upgrade ? Recently I have the following .jar files for the Hibernate 3.6.5. Here is the recent required .jars for the Hibernate 4.3.5. Which .jar files are need to be replace ? Thanks.
has title: Replacing jar when upgrade the hibernate from 3.6.5 to 4.3.5

http://stackoverflow.com/a/24533237
accepted answer of: http://stackoverflow.com/q/23506258
score: 0
type: AcceptedAnswer
type: Answer
has body: the database is not deleting because the id in your table is different than the one in your listview.Every time you create an entry, it is established with a new unique id not by its order in the table as the listview does. So add this method to your habitDbHelper class: public void delete(int orderInList){//orederInList is the position in your listView SQLiteDatabase db = this.getWritableDatabase(); List&lt;Integer&gt; database_ids = new ArrayList&lt;Integer&gt;(); Cursor c = db.rawQuery("SELECT*FROM "+TABLE_HABITS,null); while(c.moveToNext){ database_ids.add(Integer.parseInt(c.getString(0))); } db.delete(TABLE_HABITS,KEY_ID + " =?",new String[]{String.valueOf(database_ids.get(orderInList)}); And if you want to delete it OnLongClick add this: ListView lv = (ListView)findViewById(R.id.your_id); lv.setLongClickable(true); lv.setOnLongClickListener(new OnLongClickListener(){ @Override public boolean onItemLongClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { AlertDialog.Builder aat = new AlertDialog.Builder(this); aat.setTitle("Delete?") .setMessage("Are you sure you want to delete "+parent.getItemAtPosition(position).toString()+"?") .setCancelable(true) .setNegativeButton("Cancel", new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub dialog.cancel(); } }) .setPositiveButton("Delete", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub HabitDbHelper helper = new HabitDBHelper(this); helper.delete(position); helper.close(); onCreate(null);//call it here to refresh listView upon delete } }); AlertDialog art = aat.create(); art.show(); } }); hope this helps.
answers question: http://stackoverflow.com/q/23506258

http://stackoverflow.com/a/23516372
type: Answer
has comment: http://stackoverflow.com/comment/36069748
has comment: http://stackoverflow.com/comment/36072021
has comment: http://stackoverflow.com/comment/36070865
has comment: http://stackoverflow.com/comment/36070717
upvote count: 3
has comment: http://stackoverflow.com/comment/36070395
answers question: http://stackoverflow.com/q/23515880
score: 3
accepted answer of: http://stackoverflow.com/q/23515880
has body: Assuming your file data is in row/tabular format, just read it line by line, and split each line into an array, then add it to the DefaultTableModel then set the model for the table, something like public void getDataFromFile(File file, JTable table) { String[] colNames = { "Your", "Column", "Names", "Go", "Here" }; DefaultTableModel model = new DefaultTableModel(colNames, 0); try (BufferedReader br = new BufferedReader(new FileReader(file)) { String line; while ((line = br.readLine()) != null) { String[] data = line.split("\\s+"); model.addRow(data); } } catch (Exception ex) { ex.printStackTrace(); } table.setModel(model); } UPDATE "My column name and size is not set but it can be obtained from the first line of the text file so how am i going to set those column name and size depending on the text file? " Don't worry about setting the size. Just construct a default model, then use setColumnIdentifiers() after getting the first line. Then add the rows. DefaultTableModel model = new DefaultTableModel(); try (BufferedReader br = new BufferedReader(new FileReader(file)) { String line = br.readLine(); String[] colHeaders = line.split("\\s+"); model.setColumnIdentifiers(colHeaders); while ((line = br.readLine()) != null) { String[] data = line.split("\\s+"); model.addRow(data); } } This is all assuming your data is space delimited Javadocs public DefaultTableModel() - Constructs a default DefaultTableModel which is a table of zero columns and zero rows. public void setColumnIdentifiers(Object[] newIdentifiers) - Replaces the column identifiers in the model. If the number of newIdentifiers is greater than the current number of columns, new columns are added to the end of each row in the model. If the number of newIdentifiers is less than the current number of columns, all the extra columns at the end of a row are discarded. UPDATE 2 } else { DefaultTableModel model = new DefaultTableModel(); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line …
has comment: http://stackoverflow.com/comment/36069706
has comment: http://stackoverflow.com/comment/36070340
has comment: http://stackoverflow.com/comment/36072197
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36072610
downvote count: 0
has comment: http://stackoverflow.com/comment/36069604
has comment: http://stackoverflow.com/comment/36071843
has comment: http://stackoverflow.com/comment/36069534
has comment: http://stackoverflow.com/comment/36072884

http://stackoverflow.com/q/23516447
has title: HQL query takes way too long to execute
has body: I have this HQL query: String hql = "from "+Patient.class.getName() + " p " + " where p.medicalRoom.id = "+medicalRoom.getId() + " and exists (select tg.id from "+TherapyGroup.class.getName()+" tg where tg.treatment.patient.id = p.id " + " and not exists (select ta.id from "+TherapyEnd.class.getName()+" ta where ta.therapyGroup.id = tg.id))"; All the properties that are involved in the query are indexed... Though it takes more than one whole minute to execute..
score: 0
has comment: http://stackoverflow.com/comment/36069178
tagged with: sql
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36069081
has comment: http://stackoverflow.com/comment/36073536
tagged with: hql
type: Question

http://stackoverflow.com/q/23567917
has title: Eclipse e4 RCP: Core Expressions - Something less XML-hell?
tagged with: e4
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23602909
accepted answer: http://stackoverflow.com/a/23602909
type: Question
tagged with: java
tagged with: rcp
score: 4
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36166072
answer count: 1
has body: I'm working on an E4 RCP application, and have a context menu which has menu items visible or not depending on the selection. The way I've found to do this is with core expressions defined in the plugin.xml like so: <extension point="org.eclipse.core.expressions.definitions"> This works, and the menu item is displayed if the selected item is an instance of Class1 or Class2. This all seems like an extremely nasty way to do things! When many of these are added, its going to be a maintenance and debugging nightmare. Can anyone demonstrate a less XML-ish way of doing this? Pure programmatic methods in Java would be great!
favorite count: 0
tagged with: plugins
upvote count: 4

http://stackoverflow.com/comment/36193454
type: Comment
has text: @colymore: Look at LogCat to see if you have complaints, such as missing the `<service>` element.
comment on: http://stackoverflow.com/a/23582280
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36217202
comment on: http://stackoverflow.com/a/23595383
score: 0
type: AnswerComment
has text: You can use `Double.compare` instead.
type: Comment

http://stackoverflow.com/q/23504430
has title: Verifying the path of a web service resource
score: 0
answer count: 1
tagged with: rest
has answer: http://stackoverflow.com/a/23581751
type: UnansweredQuestion
has body: I am writing some unit tests for a web service written years ago. The root class has a path like: @Path("v1/path/") public class RootResource { ... } The methods inside the class have their respective path. One working path is: @GET @Path("orders/{order_num}.xml") @Produces(MediaType.APPLICATION_XML) public Response getXML() { ... } This is working fine at root_path/v1/path/orders/123123.xml. However, there is another method: @POST @Path("orders/{order_numer}/status.xml") @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response getStatusXML() { Logger.info(CALLER, "orderStatusXML", "XML Request received"); ... } When I try to access this at root_path/v1/path/orders/123423/status.xml I get 404 in return. Even the first line with the logger is missing from the logs. I am on Weblogic 12 and we used Jersey REST API for these web services. I have tried a number of things to make sure the path listed in the test case is the correct one. Any hints/ideas on how to check for the correct path?
tagged with: java
tagged with: web-services
type: Question
tagged with: jersey

http://stackoverflow.com/comment/36114744
type: QuestionComment
has text: I marked it as solved based on the comment of the author. I unmarked it, if that only relates to the original answer and not the comments.
comment on: http://stackoverflow.com/q/23534423
score: 0
type: Comment

http://stackoverflow.com/q/23529040
possible better answer: http://stackoverflow.com/a/45545922
accepted answer: http://stackoverflow.com/a/23529362
has body: I have a lot of geo data stored online with latitude and longitude and I'd like to use the distanceTo method instead of my own haversine formula. So I need to put each record into a Location field, but here's my question: it requires a "provider" string. Why? What will Android do with that information? for (ArrayList&lt;String&gt; item : Places_Data) { Location itemloc = new Location("provider"); itemloc.setLatitude(latIn); itemloc.setLongitude(lonIn); //do something with my new location }
has answer: http://stackoverflow.com/a/45545922
has comment: http://stackoverflow.com/comment/36097204
score: 0
answer count: 2
has title: Android: Why does a new instance of Location require a provider?
has comment: http://stackoverflow.com/comment/36094238
tagged with: constructor
tagged with: android
linked to: http://stackoverflow.com/q/4945697
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23529362
type: Question
tagged with: location

http://stackoverflow.com/q/23459749
tagged with: textview
has title: How to make a textview to wrap its content but also alignBottom to another textview?
has comment: http://stackoverflow.com/comment/36048055
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36052300
has comment: http://stackoverflow.com/comment/35980369
has comment: http://stackoverflow.com/comment/35964360
tagged with: java
has comment: http://stackoverflow.com/comment/36018923
type: Question
has body: I have this textview, tv1, and it contains 4 lines of words. I have this second textview, tv2, and it will vary from 1 line of text to 6 lines of text. How can I make tv1 always show 4 lines of text, but expand when tv2's text goes to 6 lines of text? Code: <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/labeltvItem1Pass" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignRight="@+id/tvMagRes" android:layout_below="@+id/labeltvSpeed" android:layout_alignBottom="@+id/tvItem1Pass" android:layout_alignTop="@id/tvItem1Pass" android:text="Passive from first item: " android:textSize="16sp" android:textStyle="bold" /> <TextView android:id="@+id/tvItem1Pass" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_marginTop="460dp" android:layout_toRightOf="@+id/tvMagRes" android:gravity="center_horizontal" android:text="Nothing" android:textSize="12sp" /> Beautiful paint image: Feel free to rephrase this question if its confusing I've tried to change around the code with no success. Any more help?
answer count: 2
has comment: http://stackoverflow.com/comment/36094339
has answer: http://stackoverflow.com/a/23529236
has answer: http://stackoverflow.com/a/23526785
has comment: http://stackoverflow.com/comment/35970277
score: 0
has comment: http://stackoverflow.com/comment/36005186

http://stackoverflow.com/a/23545614
type: Answer
has comment: http://stackoverflow.com/comment/36124148
has comment: http://stackoverflow.com/comment/36124289
has comment: http://stackoverflow.com/comment/36124102
has comment: http://stackoverflow.com/comment/36124215
upvote count: 3
answers question: http://stackoverflow.com/q/23545478
has comment: http://stackoverflow.com/comment/36124671
has comment: http://stackoverflow.com/comment/36124161
score: 3
accepted answer of: http://stackoverflow.com/q/23545478
has body: You are making a mess by creating the variable name dynamically by appending the counter as a String literal (Event1) and setting them to the prepared statement as a String input. You are actually setting the String literals like (Event1) instead of Values (22122014 13.26). This is not the way you should do.You may have to set the values directly like prepState.setString(1, Event1); prepState.setString(2, Event2); prepState.setString(3, Event3); prepState.setString(4, Event4); I'd suggest you to go for a List of String literals having all the Event values. Iterate them and set them in the Prepared statement and execute the query. List&lt;String&gt; eventValues = new ArrayList&lt;String&gt;();
has comment: http://stackoverflow.com/comment/36125680
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36125916
downvote count: 0

http://stackoverflow.com/comment/35994075
type: Comment
comment on: http://stackoverflow.com/a/23475507
has text: For regex: a*?b and pattern : aabab, can I say b is applied to the pattern and found none, and then "reluctantly" a* is used and match? I had null values for regex : a*? or a?? for pattern : aabab, so, can I say as middle * and ? can take 0 as value, zero is checked first? For greedy, regex a+ and pattern aabab gives aa result, so is the one of the differences between greedy and reluctant is, reluctant checks first after the "?" character ? As a+? gives predictable output because middle + takes 1 or more, this seems true according to my assumption.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23624610
type: AcceptedAnswer
has body: Default analzer means the tokens are lowercased and stored. So change the case of WEEKEND.try this FilterBuilder termfilter = FilterBuilders.termFilter("SCHEDULE_TYPE", "weekend"); REFER HOpe it helps..!
type: Answer
accepted answer of: http://stackoverflow.com/q/23605480
score: 0
answers question: http://stackoverflow.com/q/23605480

http://stackoverflow.com/comment/36131567
has text: About 1st solution: is List<LinkedList<MyEntry<k, v>>> an interface?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23549546

http://stackoverflow.com/comment/36209716
has text: It still gives me the AccessControlException error...sigh, I never knew how troublesome it would be to get an image going
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23591492
type: Comment

http://stackoverflow.com/comment/36171710
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23553655
type: Comment
has text: That was my first impulse and I did try some similar. Everything looked fine until I got hit with the performance problem. JDBC, at least in this case (JDBC.as400), takes a lot longer to access a file (open/clsoe) than it does to read it. Having several classes accessing the file multiple times would result in the loading time not being acceptable. If you consider running on the web or over a VPN, forget about it. Having several classes would also mean having to manage not only the setters and getters but also the classes themselves. I'd be fine with that if it wasn't for performance. Thanks!.

http://stackoverflow.com/q/23613418
has answer: http://stackoverflow.com/a/23625059
tagged with: netty
has body: I see that Netty is a framework for building asynchronous network software. I'm wondering if there is a way to integrated the server-side with Akka such that, any time a request is received from a Netty client, an Akka "actor" thread on the server picks it up and responds to it asynchronously. Is there any value to this type of integration (scaling, fault tolerance, etc.) on the server, or does Netty's asynchronous nature already provide everything that the server would need (from a threading standpoint)?
score: 4
tagged with: actor
answer count: 1
has title: Integrate Netty server with Akka?
tagged with: network-programming
tagged with: java
type: UnansweredQuestion
upvote count: 4
tagged with: akka
downvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/a/23490682
downvote count: 0
score: 1
upvote count: 1
has body: You are getting a timeout exception requesting http://repo.maven.apache.org/maven2 repository. Time to time http://repo.maven.apache.org/maven2 not working properly. Also possible other network problems, like your hosts dns, network broken hub, network proxy settings etc...
answers question: http://stackoverflow.com/q/23490556
type: Answer

http://stackoverflow.com/q/23544602
has answer: http://stackoverflow.com/a/23545665
has title: Need to modify java Timestamp to get thae Latest records from Database
tagged with: jdbc
tagged with: timestamp
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23545665
tagged with: java
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/23544657
has answer: http://stackoverflow.com/a/23544685
has body: I have written a webservice which will be responsible to display the latest inserted or updated records in Database to the User Interface . This is my query String selectSQL = "SELECT id , VendorName , Item , updated_at , created_at from Orders where updated_at &gt; ? OR created_at &gt; ?"; And this is my table structure mysql&gt; select * from Orders; +-------+--------------+----------+---------------------+---------------------+ | id | VendorName | Item | updated_at | created_at | +-------+--------------+----------+---------------------+---------------------+ | 12345 | PoppyCounter | Chocltae | 2014-05-08 18:49:42 | 2014-05-08 18:49:42 | +-------+--------------+----------+---------------------+---------------------+ 1 row in set (0.00 sec) I am checking with the currenttimestamp as shown below java.sql.Timestamp date = new java.sql.Timestamp(new java.util.Date().getTime()); How can i make the date less than 1 minute ?? package com.serviceees; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import com.google.gson.Gson; import dto.Orders; @Path("/updates") public class DBPollerService { @GET @Produces("application/json") public String getUpdates() { System.out.println("getUpdates called"); String clientResponse = "Error"; ArrayList&lt;Orders&gt; newOrdersList = new ArrayList&lt;Orders&gt;(); Gson gson = new Gson(); try { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { e.printStackTrace(); } System.out.println("connection"); Connection connection = null; PreparedStatement preparedStatement = null; String selectSQL = "SELECT id , VendorName , Item , updated_at , created_at from Orders where updated_at &gt; ? OR created_at &gt; ?"; try { connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "", ""); while (…
score: 0
possible better answer: http://stackoverflow.com/a/23544657
answer count: 3

http://stackoverflow.com/a/23545419
score: 3
has body: Why would you read the data from the database into an ArrayList and then copy the data to a Vector? Just load the data directly into a Vector. table.setRowSelectionAllowed(true); table.setColumnSelectionAllowed(true); The above code does not look correct. I would get rid of it. At the very least is should NOT be in the MouseListener. If this really is the behaviour you want, then those statements should be executed when you create the table, otherwise I would guess that when you change the selection properties AFTER you click on a cell, then you would lose the last selection values. public void MouseClicked(MouseEvent e) Or maybe the problem is simple that you use "M" on the mouseClicked method. It should be "m". You should use the @Override annotation when overriding methods to make sure you don't make typing mistakes. @Override public void mouseClicked(MouseEvent e)
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23540716

http://stackoverflow.com/comment/109941690
type: AnswerComment
comment on: http://stackoverflow.com/a/40426741
type: Comment
score: 2
has text: this answer should be marked as correctly one, a very small effort to overcome problem.

http://stackoverflow.com/q/23531071
downvote count: 0
score: 4
tagged with: groovy
accepted answer: http://stackoverflow.com/a/23531857
favorite count: 0
has title: What is the standard method for achieving Object-JSON mapping in Groovy?
has body: In Java, if I want to transform some JSON into a POJO (or vice veersa), I'll use Gson or even FlexJson to do the conversion for me inside some kind of mapper object: public interface JsonMapper&lt;T&gt; { public T toPojo(String json); public String toJson(T pojo); } public class WidgetJsonMapper implements JsonMappper&lt;Widget&gt; { private Gson mapper; @Override public Widget toPojo(String json) { // Use mapper to deserialize JSON into POJO } @Override public String toJson(Widget pojo) { // Use mapper to serialize a Widget instance into a JSON string. } } etc. I'm wondering how the game changes here when we're talking about Groovy. I see Grooovy has a JsonSlurper built right into it and was wondering if that could be used in lieu of a JSON mapping framework (like Gson) somehow.
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/23531857
type: Question
upvote count: 4
answer count: 1

http://stackoverflow.com/comment/36117227
has text: you set the nullSelectionItemId to "0" and select it. so vaadin will return null and this is what get's stored. this or your empty if-branch in the listener confuses me
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/23534366
type: Comment

http://stackoverflow.com/q/23462784
answer count: 1
has answer: http://stackoverflow.com/a/23463161
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/23463161
has comment: http://stackoverflow.com/comment/35970002
has comment: http://stackoverflow.com/comment/35969827
tagged with: jframe
has comment: http://stackoverflow.com/comment/35970083
upvote count: 1
tagged with: swing
downvote count: 1
type: AnsweredQuestion
tagged with: java
has body: I am trying to program a Battleship game with different states depending on user input. I am implementing the State Design Pattern for the different types of game types, the instructions panel and other features it is going to have. My question is, when I make the JFrame for my game, should the logic be invoked during construction, or should it be during the update of the window? For example: public class BattleshipGui extends JFrame { public BattleshipGui() { initizalizeFrame(); executeLogic(); } } The execute logic contains the game loop that changes according to the game events.
type: Question
has title: Game Logic in JFrame
tagged with: game-engine

http://stackoverflow.com/q/23479570
tagged with: jcomponent
has comment: http://stackoverflow.com/comment/36001011
type: Question
tagged with: java
tagged with: jpanel
score: 0
has title: How do you paint using 2 different classes
answer count: 1
has comment: http://stackoverflow.com/comment/36001064
has answer: http://stackoverflow.com/a/23479751
has body: (This program isn't really going to end up doing anything I'm just using this to learn/experiment) When I run my code I wanted one class to paint a black circle and another class to paint a blue circle that intersects it. But the way I have it now when an instance of Class2 is added it overwrites Class1 in the Frame. I can see what's going wrong I'm just not sure on how to fix it. Is it possible to do this or are you supposed to just do everything under the same paint()? public class Practice{ public static GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); public static final int dWidth = gd.getDisplayMode().getWidth(); public static final int dHeight = gd.getDisplayMode().getHeight(); public static void main(String[] args){ heyo(); } public static void heyo(){ JFrame window = new JFrame(); Class1 obj1 = new Class1(); Class2 obj2 = new Class2(); window.setSize(dWidth, dHeight); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setResizable(false); window.add(obj1); window.add(obj2); window.setVisible(true); } } public class Class1 extends JComponent{ public void paint(Graphics b){ Graphics2D brush = (Graphics2D)b; brush.setColor(Color.black); brush.drawOval(100, 100, 50, 50); } } public class Class2 extends JComponent{ public void paint(Graphics c){ Graphics2D brush = (Graphics2D)c; brush.setColor(Color.blue); brush.drawOval(200, 200, 50, 50); } }
type: AnsweredQuestion
tagged with: paint
tagged with: jframe
accepted answer: http://stackoverflow.com/a/23479751

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/23571285

http://stackoverflow.com/q/23499924
has title: Code optimization for pythagoras theorem
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23500013
favorite count: 0
has comment: http://stackoverflow.com/comment/36038842
has comment: http://stackoverflow.com/comment/36038752
has body: could anyone help me with the following code : import java.math.*; import java.util.Scanner; public class Pitagor { public static void main (String[] args){ System.out.println(pitagor(in1(),in2())); } public static int in1 (){ Scanner input = new Scanner(System.in); System.out.println("Eingabe von a "); int a = input.nextInt(); return a; } public static int in2 (){ Scanner input = new Scanner(System.in); System.out.println("Eingabe von b"); int b = input.nextInt(); return b; } public static double pitagor (int x , int y){ double c = Math.sqrt((x*x)+(y*y)); return c; } } My goal here is to make the code simpler by using separate methods for input and calculation, but i can't seem to understand how to make only one input method instead of in1() and in2(). What i tried was : public static void in (){ Scanner input = new Scanner(System.in); System.out.println("Eingabe von a "); int a = input.nextInt(); Scanner input = new Scanner(System.in); System.out.println("Eingabe von b"); int b = input.nextInt(); } but i don't know how to get a and b from this method, so i can use them in pitagor (int x , int y) Thanks in advance.
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: math
tagged with: java
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/23500013

http://stackoverflow.com/q/23490799
answer count: 1
has title: Data structure linkedlist next error.
favorite count: 0
has answer: http://stackoverflow.com/a/23492740
has body: This code: package Datastructures; public class ChainNode { Object element; ChainNode next; public ChainNode() { } public ChainNode(Object element) { this.element = element; } public ChainNode(Object element, ChainNode next) { this.element = element; this.next = next; } public static void main(String args[]) { ChainNode firstNode = new ChainNode("a"); ChainNode newNode = new ChainNode("b", firstNode.next); ChainNode newNode2 = new ChainNode("c", firstNode.next.next); System.out.println(firstNode.element); System.out.println(newNode.element); } } Stack trace: Exception in thread "main" java.lang.NullPointerException at Datastructures.ChainNode.main(ChainNode.java:24)
type: AnsweredQuestion
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23492740
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: data-structures
duplicate of: http://stackoverflow.com/q/218384
score: 0

http://stackoverflow.com/comment/36175498
type: AnswerComment
type: Comment
has text: 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 '? WHERE userid = ?' at line 1
score: 0
comment on: http://stackoverflow.com/a/23572402

http://stackoverflow.com/q/23474790
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35991906
has title: Tests. Do I really need to add "throws Exception"?
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35991990
possible better answer: http://stackoverflow.com/a/23475178
upvote count: 6
has comment: http://stackoverflow.com/comment/35991727
has answer: http://stackoverflow.com/a/23475313
accepted answer: http://stackoverflow.com/a/23475313
has answer: http://stackoverflow.com/a/23475178
answer count: 3
has body: I saw people using "throws Exception" in tests, but I never do. Should I worry? I never had any issues with that. What's the difference? @Test() public void test() throws Exception { //Do something } or @Test() public void test() { //Do something }
has answer: http://stackoverflow.com/a/23475075
favorite count: 0
tagged with: testng
downvote count: 0
score: 6
linked to: http://stackoverflow.com/q/156503
tagged with: unit-testing

http://stackoverflow.com/a/23557166
has body: To insert into Map use put(K,V) method, K is key and V is value. //timeTable[routeNumber] = strLine; timeTable.put(K, V); Your map key should be type of Route and value type should be List&lt;String&gt; See java api here
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23557074

http://stackoverflow.com/q/23547684
answer count: 2
has answer: http://stackoverflow.com/a/23547779
upvote count: 0
linked to: http://stackoverflow.com/q/3780963
favorite count: 0
has comment: http://stackoverflow.com/comment/36128050
possible better answer: http://stackoverflow.com/a/23547779
tagged with: constructor
has comment: http://stackoverflow.com/comment/36128112
has comment: http://stackoverflow.com/comment/36128110
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23547781
duplicate of: http://stackoverflow.com/q/3780963
tagged with: java
has comment: http://stackoverflow.com/comment/36128274
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36128025
has comment: http://stackoverflow.com/comment/36128114
score: -1
has body: In Java, how can I create a new instance of a class, where the class is not selected until the code is run? List&lt;Class&gt; classes = new ArrayList&lt;&gt;(); classes.add(String.class); classes.add(ArrayList.class); classes.add(Integer.class); classes.add(Random.class); Random r = new Random(); Class c = classes.get(r.nextInt(classes.size())); Object o = // new instance of "c"
accepted answer: http://stackoverflow.com/a/23547781
has title: New instance of an arbitrary class
tagged with: class

http://stackoverflow.com/comment/36213066
score: 0
type: Comment
type: QuestionComment
has text: Where do you currently initialize the `String[]` variables?
comment on: http://stackoverflow.com/q/23593249

http://stackoverflow.com/comment/36230298
score: 0
type: AnswerComment
type: Comment
has text: Yes you can reset the pictures on your buttons as well
comment on: http://stackoverflow.com/a/23601502

http://stackoverflow.com/a/23598577
accepted answer of: http://stackoverflow.com/q/23598281
score: 3
type: Answer
has body: I was curious, and implemented the approach mentioned in the comment: Could one solution be to simply fill a BufferedImage completely with the desired colors, and then paint this image using the given area as the Graphics#setClip? (Not sure about the performance here, but most likely better than manual tests...) The result is the following: This example uses some "dummy" class class ColorFunction { int getColor(int x, int y) { ... } } that is backed by a randomly filled BufferedImage, just for this test. This function is transferred into a BufferedImage in the paintComponent method. In a "real" application case, this could and should be done somewhere else, maybe in some constructor, so that it has to be done only once, but this depends on how this should be used. However, then, the image is just painted, using the Area as the clipping shape of the Graphics2D. It seems feasible, but I have not yet made any detailed performance tests. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.Shape; import java.awt.font.FontRenderContext; import java.awt.font.GlyphVector; import java.awt.geom.AffineTransform; import java.awt.geom.Area; import java.awt.image.BufferedImage; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class CustomFillingTest { 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); ColorFunction colorFunction = new ColorFunction(); Area area = createTestArea(); CustomFillingPanel customFillingPanel = new CustomFillingPanel(colorFunction, area); f.getContentPane().add(customFillingPanel, BorderLayout.CENTER); f.setSize(400,200); f.setLocationRelativeTo(null); f.setVisible(true); } private static …
upvote count: 3
answers question: http://stackoverflow.com/q/23598281
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36223611
downvote count: 0

http://stackoverflow.com/comment/36014814
comment on: http://stackoverflow.com/a/23486802
type: Comment
score: 1
has text: @CandiedOrange, got it. So, one way you can test this is to have a constructor that allows you to supply the array, and another constructor that default initializes the array to its hard-coded value.
type: AnswerComment

http://stackoverflow.com/comment/36043788
has text: in my main program i have an array of Port, will this work again there ?
type: Comment
comment on: http://stackoverflow.com/q/23502526
score: 0
type: QuestionComment

http://stackoverflow.com/q/23491899
favorite count: 0
tagged with: google-drive-api
tagged with: google-api
has comment: http://stackoverflow.com/comment/36059684
tagged with: android
type: AnsweredQuestion
has title: Download pdf and tif file from google drive in java
has comment: http://stackoverflow.com/comment/36024027
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36024078
upvote count: 1
has comment: http://stackoverflow.com/comment/36027643
has comment: http://stackoverflow.com/comment/36026919
type: Question
has answer: http://stackoverflow.com/a/23496757
has comment: http://stackoverflow.com/comment/36025258
has comment: http://stackoverflow.com/comment/36106148
has comment: http://stackoverflow.com/comment/36023359
accepted answer: http://stackoverflow.com/a/23496757
has body: I am using below code to download the pdf files from the google drive using GDrive v2 api. public InputStream downloadFile(Drive service, String fileId) { try { System.out.println("From Down load file file id" + fileId); System.out.println("From Down load file file id" + service); File file = service.files().get(fileId).execute(); String downloadUrl = file.getDownloadUrl(); if (downloadUrl != null &amp;&amp; downloadUrl.length() &gt; 0) { HttpResponse resp = service.getRequestFactory() .buildGetRequest(new GenericUrl(downloadUrl)).execute(); System.out.println("resp content: " + resp.getContent()); return resp.getContent(); } else { // The file doesn't have any content stored on Drive. return null; } } catch (IOException e) { // An error occurred. e.printStackTrace(); return null; } } I am getting alert saying "Corrupt or unsupported file format" when I am opening the downloaded pdf file. In google developers Console they have mentioned to use the below line String downloadUrl = file.getExportLinks().get("application/pdf"); But when I am using the above line I am getting null pointer exception. Can ANyone please tell me how to replace the above line in my code to download the pdf file and open the file. And also I want to know whether the file from google drive has been completely downloaded. Please help me. Thanks in advance.
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/36027242
answer count: 1
downvote count: 0

http://stackoverflow.com/a/23553499
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: I think a common inner class memory leak would work. Example taken from the internet: public class LeakFactory {//Just so that we have some data to leak int myID = 0; // Necessary because our Leak class is non-static public Leak createLeak() { return new Leak(); } // Mass Manufactured Leak class public class Leak {//Again for a little data. int size = 1; } } public class SwissCheese {//Can't have swiss cheese without some holes public Leak[] myHoles; public SwissCheese() { // let's get the holes and store them. myHoles = new Leak[1000]; for (int i = 0; i++; i&lt;1000) {//Store them in the class member myHoles[i] = new LeakFactory().createLeak(); } // Yay! We're done! // Buh-bye LeakFactory. I don't need you anymore... } } What happens here is the createLeak() factory method return Leak class and theoretically LeakFactory object is eligible for GC to be removed as we don't keep reference to it. But the Leak class needs LeakFactory to exists thus LeakFactory will never be deleted. This should create a memory leak no matter what Java version you use.
answers question: http://stackoverflow.com/q/23552912

http://stackoverflow.com/comment/36033150
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23486780
has text: I will try replacing the outermost container, the JFrame, with a JPanel and using JNLP/WebStart. Thank you.
score: 0

http://stackoverflow.com/comment/36007564
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23477866
score: 1
has text: possible duplicate of [Error - trustAnchors parameter must be non-empty](http://stackoverflow.com/questions/6784463/error-trustanchors-parameter-must-be-non-empty)

http://stackoverflow.com/comment/36221124
score: 1
has text: `ManyToMany` is simple db relation there you can find many usefull stuff related to your problem and you have comparison with xml configuration and annotation one. Please try to look on that: http://www.mkyong.com/hibernate/hibernate-many-to-many-example-join-table-extra-column-annotation/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23593675

mapping
tags question: http://stackoverflow.com/q/23552845
tags question: http://stackoverflow.com/q/23578558
tags question: http://stackoverflow.com/q/23523776
tag name: mapping
tags question: http://stackoverflow.com/q/23458076
type: Tag

http://stackoverflow.com/q/23519050
has body: Since KitKat launched, I've seen a lot of articles about how to be the "default messaging app" in Android. There's a lot of good information on what Receivers we need, and how to send and receive SMS. Everything I've read ignores the elephant in the room, which is how do we actually send MMS messages?! Likewise, I can't find anything about sending Group messages (which are also MMS). Does anyone have any insight on this? Thanks
tagged with: mms
downvote count: 0
answer count: 1
favorite count: 0
has title: How do I send MMS in Android KitKat (4.4)?
upvote count: 2
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23520821
score: 2
tagged with: java
type: Question
tagged with: messaging

http://stackoverflow.com/q/23552200
score: 1
tagged with: java
upvote count: 1
type: Question
downvote count: 0
has title: Using Non-default Fonts in a Java Application Launched Using Java Web Start
tagged with: unicode
has comment: http://stackoverflow.com/comment/36148421
tagged with: jnlp
linked to: http://stackoverflow.com/q/8364787
favorite count: 0
tagged with: fonts
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36167241
has body: I have a Java application in which rendering of Unicode characters is failing because the default font does not support them. I have tried several fixes (some of them based on posts to this forum) which all work when I launch the application directly from the command line but all fail when Java Web start is used instead. 1) Passing these parameters from the command line java -Xmx1g -jar /Users/sschultz/Documents/workspace/core-mcf/build/Pert.jar -Dswing.aatext=true -Dswing.plaf.metal.controlFont=Arial -Dswing.plaf.metal.userFont=Arial does work. However, I understand that to pass them in the JNLP file they need to be passed as properties like this: &lt;resources&gt; &lt;j2se version="1.7" java-vm-args="-Xmx512m"/&gt; &lt;property name="swing.aatext" value="true"/&gt; &lt;property name="swing.plaf.metal.controlFont" value="Arial"/&gt; &lt;property name="swing.plaf.metal.userFont" value="Arial"/&gt; &lt;jar href="https://.../Pert.jar"/&gt; &lt;/resources&gt; Furthermore, because they are considered nonsecure properties, the signed JAR file must include a copy of the JNLP file at JNLP-INF/APPLICATION_TEMPLATE.JNLP. Was able to verify that the template file was in fact being found and was passing verification when the application loaded. However, the Arial font was apparently not being used because the Unicode characters failed to render properly. 2) So I attempted to set the default font directly in the application at startup using: UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("Arial", Font.PLAIN, 10)); This works fine when launched from the command line but fails using web start. 3) Next I tried setting the font only for the panel in which I indented to render the unicode text: Font font = new Font("Arial", Font.PLAIN, 10); this.reviewScrollPane.setFont(font); This too works from the command line but fails with web start. 4) Finally, I read a post that suggested that non-default fonts must be supplied as resources in the JAR file launched by Java Web…
answer count: 0
has comment: http://stackoverflow.com/comment/36168694

http://stackoverflow.com/comment/36008696
type: Comment
has text: I would suggest adding a final `else` where you have `}//close if statement` to print out any unrecognised entry.
comment on: http://stackoverflow.com/a/23482773
type: AnswerComment
score: 0

http://stackoverflow.com/comment/37435799
comment on: http://stackoverflow.com/a/24215033
score: 0
type: AnswerComment
has text: Could you explain how and why this can happen with the G1 collector, or provide a link? I don't think the G1 collector is used here by the way, but I would still be interested in the details of your answer.
type: Comment

http://stackoverflow.com/q/23565451
type: Question
answer count: 2
has body: I recently add the follow service class to my spring project, which has the function to create databse AND tables for the application use: @Service public class InstallService { @Autowired UsuarioHome usuario; @Autowired AutorizacaoHome autorizacao; public boolean create_database(String maquina, String usuario, String senha) { try { Class.forName("org.postgresql.Driver"); String url = "jdbc:postgresql://localhost:5432/postgres?user="+usuario+"&amp;password="+senha; Connection conn = null; conn = DriverManager.getConnection(url); Statement stmt = conn.createStatement(); String sql = "SELECT * FROM pg_database"; ResultSet rs = stmt.executeQuery(sql); while(rs.next()) { if(rs.getString("datname").equals("horario")) return false; } sql = "CREATE DATABASE horario WITH OWNER = "+usuario+" ENCODING = 'UTF8' TABLESPACE = pg_default LC_COLLATE = 'pt_BR.utf8' LC_CTYPE = 'pt_BR.utf8' CONNECTION LIMIT = -1;"; stmt.executeUpdate(sql); rs.close(); stmt.close(); conn.close(); } catch (SQLException e) { e.getStackTrace(); } catch (ClassNotFoundException e) { e.getStackTrace(); } return create_tables(maquina, usuario, senha); } public boolean create_tables(String maquina, String usuario, String senha) { Configuration config = new Configuration(); config.setProperty("jdbc.Classname", "org.postgresql.Driver"); config.setProperty("jdbc.url", "jdbc:postgresql://"+maquina+"/horario?charSet=LATIN1"); config.setProperty("jdbc.user", usuario); config.setProperty("jdbc.pass", senha); config.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect"); config.setProperty("hibernate.show_sql", "false"); config.setProperty("hibernate.hbm2ddl.auto", "create"); SchemaExport schema = new SchemaExport(config); schema.create(true, true); Properties properties = new Properties(); properties.setProperty("jdbc.Classname", "org.postgresql.Driver"); properties.setProperty("jdbc.url", "jdbc:postgresql://"+maquina+"/horario?charSet=LATIN1"); properties.setProperty("jdbc.user", usuario); prop…
possible better answer: http://stackoverflow.com/a/23566484
score: 0
has answer: http://stackoverflow.com/a/23599663
accepted answer: http://stackoverflow.com/a/23599663
tagged with: jdbc
has answer: http://stackoverflow.com/a/23566484
tagged with: spring
has title: SchemaExport don't create my tables in the database
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/23464016
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23464032
upvote count: 0
tagged with: arrays
has title: Java: ArrayIndexOutofBoundsException
has body: This is my arraylist method from a class called ants, it is made to store objects such as nests,food and obstacles. public ArrayList&lt;Cell&gt; getObstacles() { ArrayList&lt;Cell&gt; obstacles = new ArrayList&lt;Cell&gt;(); for (int i = 0; i &lt; columns; i++) { for (int j = 0; j &lt; rows; j++) { Cell currentcell = cellArray[columns][rows]; // Initialize each object if(currentcell.isBlocked()){ obstacles.add(currentcell); } else if(currentcell.isGoal()){ obstacles.add(currentcell); } else if(currentcell.hasNest()){ obstacles.add(currentcell); } } } return obstacles; } When i retrieve my arraylist and use it in the method from another class called antscontrolpanel, there is an error-arrayindexoutofboundexception. Does anyone know how to solve this error? public void savemap (File file) { ArrayList&lt;Cell&gt; obstacles = ants.getObstacles(); if (file == null) { if (chooser == null) chooser = createChooser(); chooser.setDialogType(JFileChooser.SAVE_DIALOG); int r = chooser.showDialog(this, null); if (r != JFileChooser.APPROVE_OPTION) return; file = chooser.getSelectedFile(); } /** * For obstacles added to the program: * Simple parsing of relevant data into txt file for easy reading. * Rows will be written like so: * * 50 25 b * 51 25 b * 52 25 b * 34 28 n * . * . * * Column, followed by row, followed by type of obstacle. * Assumption: Only one obstacle per cell. Should be a relatively simple extension for multiple obstacles per cell. */ try { Writer writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(file), "utf-8")); for(int i = 0; i &lt; obstacles.size(); i++) { Cell currentCell = obstacles.get(i); writer.write(Integer.toString(currentCell.c)); writer.write(" "); writer.write(Integer.toString(currentCell.r)); writer.write(" "); if(currentCell.isBlocked()) writer.write(blockedChar); else if(currentCell.isGoal()) writer.write(goalChar); else if(currentCell.hasNest()) writer.write(nestChar); writer.write("\n"); } writer.close(); } catch (IOExcept…
has answer: http://stackoverflow.com/a/23464029
favorite count: 0
possible better answer: http://stackoverflow.com/a/23464029
score: -3
has answer: http://stackoverflow.com/a/23464032
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35972314
tagged with: java
tagged with: indexoutofboundsexception
downvote count: 3

http://stackoverflow.com/comment/35993991
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23476052
has text: @assylias i want to have the length (like String.length) but here the object can be byte[], int, String, ...
score: 0

http://stackoverflow.com/a/23512226
has body: You have an exception in v=cv*10+Integer.parseInt(cap); which causes t2.setText(cap); to be executed.
answers question: http://stackoverflow.com/q/23491812
type: Answer
has comment: http://stackoverflow.com/comment/36065753
has comment: http://stackoverflow.com/comment/36069458
score: 0

http://stackoverflow.com/comment/36248871
has text: @LuiggiMendoza: your comment is unconstructive and I have flagged it as such. FYI, people posting here are here to learn and exchange...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23611436

http://stackoverflow.com/a/23705957
answers question: http://stackoverflow.com/q/23480547
has body: Try the following code. Should work: if (driver.findElements(By.cssSelector("#toaster")).size() &gt; 0 &amp;&amp; toaster.isDisplayed()) { Actions builder = new Actions(driver); builder.moveToElement(toasterClose).moveByOffset(2,2).click().build().perform(); }
downvote count: 0
has comment: http://stackoverflow.com/comment/36536596
type: Answer
has comment: http://stackoverflow.com/comment/36535070
has comment: http://stackoverflow.com/comment/36537911
has comment: http://stackoverflow.com/comment/36537824
score: 1
upvote count: 1

http://stackoverflow.com/q/23457411
has comment: http://stackoverflow.com/comment/35960384
accepted answer: http://stackoverflow.com/a/23457442
tagged with: java
tagged with: multithreading
downvote count: 1
has comment: http://stackoverflow.com/comment/35960017
has answer: http://stackoverflow.com/a/23457662
has body: I have two threads and in one thread I set static variable and in another I check static variable via function like this Test test= new Test(); while(!Temp.isVarSet()){ } System.out.println("Variable set"); But this codes hangs - doesn't go to println statement. But the following code works Test test= new Test(); while(!Temp.isVarSet()){ System.out.println("I am still here"); } System.out.println("Variable set"); The Temp class public class Temp { private volatile static boolean varSet=false; public synchronized static void setVarSet() { Temp.varSet=true; } public synchronized static boolean isVarSet() { return Temp.varSet; } } Test class public class Test{ public Test() { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Model model= new Model(); View view = new View(); Controller controller=new Controller(model, view); Temp.setVarSet(); ... } }); } } What can be reason? I set method isVarSet() synchronized but it didn't help. EDIT This code works too. Test test = Test() while(!Temp.isVarSet()){ Thread.sleep(100); }
has answer: http://stackoverflow.com/a/23457673
linked to: http://stackoverflow.com/q/25425130
upvote count: 4
answer count: 4
has answer: http://stackoverflow.com/a/23457811
type: AnsweredQuestion
has title: While loop and checking static variable
score: 3
has answer: http://stackoverflow.com/a/23457442
has comment: http://stackoverflow.com/comment/35959975
has comment: http://stackoverflow.com/comment/35959946
favorite count: 0
possible better answer: http://stackoverflow.com/a/23457811
has comment: http://stackoverflow.com/comment/35959842
has comment: http://stackoverflow.com/comment/39730736
type: Question

http://stackoverflow.com/comment/36211510
comment on: http://stackoverflow.com/a/23592159
score: 0
type: Comment
has text: I have eupdated the web.xml file now check whats wrong
type: AnswerComment

http://stackoverflow.com/comment/36098045
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23531112
has text: `ImageIcon ground = new ImageIcon("C:\\Programming\\Ground.jpg");` By the time of deployment, those resources will likely become an [tag:embedded-resource]. That being the case, the resource must be accessed by `URL` instead of `File`. See the [info page](http://stackoverflow.com/tags/embedded-resource/info) for the tag, for a way to form an `URL`. Also, we should never be trying to load image in a painting method. They should be loaded at start-up and cached as class attributes.
score: 0

http://stackoverflow.com/comment/36201142
type: Comment
has text: This solution didn't help, but thank you for your help anyway!
score: 0
comment on: http://stackoverflow.com/a/23586692
type: AnswerComment

http://stackoverflow.com/comment/47787908
type: AnswerComment
type: Comment
has text: also this does not scale. How does it work if you have tens of properties in your object? not to mention that you destroy the initial objects and replace then by new ones. good way to break things elsewhere in your code.
comment on: http://stackoverflow.com/a/23504420
score: 0

http://stackoverflow.com/q/23501449
has answer: http://stackoverflow.com/a/23588037
favorite count: 0
tagged with: google-glass
upvote count: 2
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36050016
score: 2
has title: Can you wake up the device when publishing a card?
tagged with: java
tagged with: google-gdk
type: Question
has body: I have a background service that pushes live cards to the Glass. The device plays a tone when a card is published, but I would also like to wake the device up for a few moments. Is this possible without acquiring a wakelock?
downvote count: 0
answer count: 1

http://stackoverflow.com/q/23556567
has answer: http://stackoverflow.com/a/23556708
upvote count: 1
accepted answer: http://stackoverflow.com/a/23556708
type: AnsweredQuestion
has body: I have a class that holds contact data; wrapped in a respective class. I recently changed my Photo setup from being a simple byte[] to being a wrapped class as well, but the instantitaion is a little different and now won't serialize/wrap properly. My other classes wrap properly such as "number":{"log.PhoneNumber":{"number":"123-456-7890"}} but if I feed in a new photo (ie: new Photo("DEADBEEF")) I just get "photo":"DEADBEEF". This is causing problems with the deserializer too. public class ContactInfo { @JsonProperty("name") private Name m_name = null; @JsonProperty("number") private PhoneNumber m_number = null; @JsonProperty("email") private Email m_email = null; @JsonProperty("photo") private Photo m_photo = null; @JsonCreator public ContactInfo(@JsonProperty("name") Name name, @JsonProperty("number") PhoneNumber number, @JsonProperty("email") Email email, @JsonProperty("photo") Photo photo) { /** Set vars **/ } @JsonTypeInfo(use=Id.CLASS, include=As.WRAPPER_OBJECT) static public class Photo { private byte[] m_decodedBase64 = null; public Photo(byte[] encodedBase64) { m_decodedBase64 = Base64.decodeBase64(encodedBase64); } @JsonCreator public Photo(@JsonProperty("photoData")String encodedBase64) { m_decodedBase64 = Base64.decodeBase64(encodedBase64); } @JsonProperty("photoData") public String getEncodedPhoto() { return Base64.encodeBase64String(m_decodedBase64); } public byte[] getDecodedData() { return m_decodedBase64; } } } What am I doing wrong?
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Jackson won't wrap class
type: Question
downvote count: 0
tagged with: jackson
has comment: http://stackoverflow.com/comment/36145113
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23607893
has title: How finally block work
answer count: 2
linked to: http://stackoverflow.com/q/16030858
duplicate of: http://stackoverflow.com/q/16030858
tagged with: java
downvote count: 3
type: UnansweredQuestion
upvote count: 4
score: 1
has answer: http://stackoverflow.com/a/23607936
favorite count: 0
has answer: http://stackoverflow.com/a/23608014
type: Question
has body: If finally block executes before return statement present in side try block, then why return list is not printing null instead printing [DEV]. public class Sub { List list = new ArrayList(); public List check(){ try { list.add("DEV"); return list; }finally{ list = null; System.out.println("Inside finally ["+list+"]"); } } public static void main(String[] args) { Sub sup = new Sub(); System.out.println(sup.check()); System.out.println(sup.list); } } O/P: Inside finally [null] [DEV] null

http://stackoverflow.com/a/23502564
accepted answer of: http://stackoverflow.com/q/23502367
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36044029
answers question: http://stackoverflow.com/q/23502367
type: Answer
score: 2
has body: problem with your code you are creating multiple Model objects try this code public StaffInformation(){ ModelClass mc = new ModelClass(); mc.setName("Khan"); mc.setAge(30); mc.setAddress("NY"); Main.displayData(mc); } Here is your main class class Main{ public static displayData(ModelClass mc) { System.out.println(mc.getAge()); System.out.println(mc.getName()); System.out.println(mc.getAddress()); } public static void main(String[] args) { StaffInformation sc=new StaffInformation(); } }
type: AcceptedAnswer

http://stackoverflow.com/comment/36090232
type: Comment
comment on: http://stackoverflow.com/q/23527278
has text: hmm, for a keyword? check, maybe theres an add-ono for eclipse
score: 0
type: QuestionComment

http://stackoverflow.com/q/23538748
answer count: 4
has answer: http://stackoverflow.com/a/23539289
has comment: http://stackoverflow.com/comment/36111591
has comment: http://stackoverflow.com/comment/36111788
type: AnsweredQuestion
tagged with: android
accepted answer: http://stackoverflow.com/a/23539448
has title: how to call async task with different url
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/23538964
type: Question
score: 0
possible better answer: http://stackoverflow.com/a/23538964
has comment: http://stackoverflow.com/comment/36111456
has answer: http://stackoverflow.com/a/23539017
tagged with: java
has answer: http://stackoverflow.com/a/23539448
has body: I need to call asynctask with different urls. i have three button, they do a http post to server with different urls, now i can call asynctask with one url but how can i call the same function with different urls.the following is my asynctask class: private class Downloadfiles extends AsyncTask&lt;URL, Integer, JSONObject&gt;{ @Override protected void onPostExecute(JSONObject jo) { try { cards = jo.getInt("cards"); points = jo.getInt("points"); cash = jo.getInt("cash"); } catch (JSONException e1) { e1.printStackTrace(); } //cardsv.startAnimation(textio); cardsv.setText(""+cards); cashv.setText(""+cash); Log.e("wintype", "msg" + wintype); super.onPostExecute(jo); } @Override protected JSONObject doInBackground(URL... params) { Log.e("msg++--", "play game method called"); BufferedReader reader=null; data_to_send = "userId=" + userId ; try { Log.e("inside try block playgame", "get text" + data_to_send); // Defined URL where to send data URL url = new URL(playgame); // Send POST data request URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data_to_send); wr.flush(); // Get the server response reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuilder sb = new StringBuilder(); String line = null; // Read Server Response while((line = reader.readLine()) != null) { // Append server response in string sb.append(line + "\n"); Log.e("inside playgame", "while loop"); } play_response = sb.toString(); } catch(Exception ex) { Log.e("MyTag ", "Failure to get json data in playgame--1--", ex); } finally { try { reader.close(); } catch(Exception ex) { Log.e("MyTag", "Failure to get json data in playgame--2--", ex); } } Log.e("play response from the server in ", "play game" + play_response); JSONObject jo = null; try { jo = new JSONObject(play_response); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return jo; } } and …

http://stackoverflow.com/comment/54197055
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/23615478
has text: @SteveGreen Glad the answer helped you!

http://stackoverflow.com/a/23565700
score: 0
has comment: http://stackoverflow.com/comment/36226765
has body: I might get some downvotes :)) but I'm pretty sure there is no out-of-the-box support for property placeholders for @Path annotations. I guess you would have to build your own annotation processor in this case, that plugs into Spring property handling system.
answers question: http://stackoverflow.com/q/23564835
has comment: http://stackoverflow.com/comment/36226769
type: Answer

http://stackoverflow.com/comment/37257475
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23493846
has text: Are you able to get any additional information from the service you are calling (i.e. log messages)? Are you able to use something like wireshark to identify exactly what message is going out on the wire?
score: 0

http://stackoverflow.com/comment/36136890
type: QuestionComment
has text: Although from quickly skimming over the code of `ImagePlus.java` I'm pretty sure that creating an `ImagePlus` instance causes a new window to be opened (just as desribed by you, and in the linked question), I'm not *absolutely* sure, but maybe someone else can say more about this.
score: 0
comment on: http://stackoverflow.com/q/23548625
type: Comment

http://stackoverflow.com/comment/36272057
score: 0
type: Comment
has text: You will be running two tomcats.in one your application and on other your jenkins either you are doing this in windows or linux i will suggest you to download tomcat zip and make changes in server.xml file accordingly
type: AnswerComment
comment on: http://stackoverflow.com/a/23623235

http://stackoverflow.com/comment/36077336
type: Comment
type: QuestionComment
has text: Your logic seems fine. Now you need to retrieve the results in another collection.
comment on: http://stackoverflow.com/q/23520703
score: 0

http://stackoverflow.com/q/23465723
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23473966
tagged with: google-play-games
has body: I followed a tutorial in connecting to google leaderboard but a lot of tutorials are using the old google play services library. I manage to sign in to google using this code but it appears upon starting the app. Where should I put the googleAPIclient code so that I can log in when I click a button inside the game. I use libgdx and if anyone can link a tutorial that uses a new google play services library It would help a lot. I seemed to be stuck with this one. Thank you! @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Create the layout RelativeLayout layout = new RelativeLayout(this); // Do the stuff that initialize() would do for you requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags( WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); // Create the libgdx View View gameView = initializeForView(new RBGame(this,this), false); mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Plus.API) .addApi(Games.API) .addScope(Plus.SCOPE_PLUS_LOGIN) .addScope(Games.SCOPE_GAMES) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); // Create and setup the AdMob view adView = new AdView(this); adView.setAdSize(AdSize.BANNER); adView.setAdUnitId(AD_UNIT_ID); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); // Add the libgdx view layout.addView(gameView); // Add the AdMob view RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); adParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); //layout.addView(adView, adParams); // Hook it all up setContentView(layout); }
type: Question
tagged with: android
has title: How to control google play leaderboard log in
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23473966
answer count: 1
linked to: http://stackoverflow.com/q/22371896
tagged with: eclipse

http://stackoverflow.com/comment/128785294
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23466219
has text: WARNING: Be careful not to override the javaagent argLine, or risk spending hours to figure out why jacoco no longer works for instance...

parameters
tags question: http://stackoverflow.com/q/23614793
tags question: http://stackoverflow.com/q/23576828
type: Tag
tags question: http://stackoverflow.com/q/23594995
tag name: parameters
tags question: http://stackoverflow.com/q/23456813
tags question: http://stackoverflow.com/q/23485295
tags question: http://stackoverflow.com/q/23542117
tags question: http://stackoverflow.com/q/23571405
tags question: http://stackoverflow.com/q/23520528
tags question: http://stackoverflow.com/q/23569913

http://stackoverflow.com/comment/36056927
score: 0
has text: This [link](http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_api_codeformatter.htm) may help you
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23509598

http://stackoverflow.com/comment/36106742
type: Comment
type: QuestionComment
has text: possible duplicate of [ConcurrentModificationException for ArrayList](http://stackoverflow.com/questions/3184883/concurrentmodificationexception-for-arraylist)
comment on: http://stackoverflow.com/q/23536074
score: 0

http://stackoverflow.com/comment/36206806
type: Comment
comment on: http://stackoverflow.com/a/23573010
type: AnswerComment
score: 0
has text: Your implementation is correct. You may also integrate SSM with Spring Cache and use @Cacheable annotation.

http://stackoverflow.com/q/23482281
upvote count: 1
tagged with: eclipse
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/30004224
has title: UnsatisfiedLinkError, despite setting Djava.library.path variable
answer count: 1
has body: I am trying to integrate IBM's CPLEX library with my java application. For now, i'm just trying to create an IloCplex object. I added Cplex.jar, and it compiles fine, but when I run this: public class cplexTest{ public static void main(String[] args){ try{ IloCplex cplex = new IloCplex(); }catch (Exception e){ e.printStackTrace(); } } Cplex prints this message before throwing an exception: java.lang.UnsatisfiedLinkError: no cplex124 in java.library.path java.library.path must point to the directory containing the CPLEX shared library try invoking java with java -Djava.library.path=... I pass this argument to the JVM: -Djava.library.path="C:\Program Files\IBM\ILOG\CPLEX_Studio124\cplex\bin\x64_win64. This is the location of cplex124.dll. Every tutorial i've seen gives the same steps, and i feel like i followed them pretty well. What am I doing wrong??
favorite count: 0
type: AnsweredQuestion
tagged with: cplex
has answer: http://stackoverflow.com/a/30004224
score: 1
tagged with: java
tagged with: unsatisfiedlinkerror

http://stackoverflow.com/a/52626196
downvote count: 0
score: 14
type: Answer
upvote count: 14
has comment: http://stackoverflow.com/comment/139185874
has comment: http://stackoverflow.com/comment/138843536
answers question: http://stackoverflow.com/q/23454952
has comment: http://stackoverflow.com/comment/117272269
has body: 1 - As a public method return type when the method could return null: Here is a good article that shows usefulness of usecase #1. There this code ... if (user != null) { Address address = user.getAddress(); if (address != null) { Country country = address.getCountry(); if (country != null) { String isocode = country.getIsocode(); isocode = isocode.toUpperCase(); } } } ... is transformed to this String result = Optional.ofNullable(user) .flatMap(User::getAddress) .flatMap(Address::getCountry) .map(Country::getIsocode) .orElse("default"); by using Optional as a return value of respective getter methods.

http://stackoverflow.com/comment/36210318
type: Comment
has text: Then its the problem with your system only. May be settings of Firewall or Network or ...
comment on: http://stackoverflow.com/a/23591492
score: 0
type: AnswerComment

http://stackoverflow.com/q/23576401
answer count: 1
has answer: http://stackoverflow.com/a/23576442
accepted answer: http://stackoverflow.com/a/23576442
tagged with: linkedhashset
type: AnsweredQuestion
tagged with: java
type: Question
has title: LinkedHashSet Documentation Ambiguity: Re-insert
has body: The java documentation for LinkedHashSet states this: Note that insertion order is not affected if an element is re-inserted into the set. (An element e is reinserted into a set s if s.add(e) is invoked when s.contains(e) would return true immediately prior to the invocation.) For a recent project I decided to use one to hold a set of data tokens in a client-server communication for display to users in some list view widget. The idea being that I'd be able to cheaply re-insert elements with updated data and the user wouldn't be surprised because the order wouldn't change. Obviously that's not the case, using Oracle JRE 1.7.0_55-b13 it operates like any other Set, as this short test program shows: import java.util.LinkedHashSet; import static java.util.Arrays.deepToString; public class LhsStack { public static class T { public T ( int id ) { this.id = id; } public final Integer id; public String value; @Override public int hashCode () { return id.hashCode (); } @Override public boolean equals ( Object obj ) { return obj instanceof T &amp;&amp; id.equals ( ((T)obj).id ); } @Override public String toString () { return id + " =&gt; " + value; } } public static void main ( String [] args ) { LinkedHashSet &lt; T &gt; set = new LinkedHashSet &lt;&gt; (); T a = new T ( 1 ), b = new T ( 1 ), c = new T ( 2 ), d = new T ( 3 ); a.value = "Hello, World"; b.value = "World, Hello"; c.value = "Foo"; d.value = "Bar"; System.out.println ( "a == b: " + a.equals ( b ) ); if ( set.add ( a ) ) { System.out.println ( "Inserted: " + a.value ); } System.out.println ( "set.contains ( a ): " + set.contains ( a ) ); System.out.println ( "set.contains ( b ): " + set.contains ( b ) ); set.add ( c ); set.add ( d ); System.out.println ( "Elements: " + set.size () ); System.out.println ( deepToString ( set.toArray () ) ); if ( set.add ( b ) ) { System.out.println ( "Re-Inserted: " + b.value ); } else { System.out.println ( "Removing and Adding: " + b.value ); set.remove ( b ); set.add ( b ); } Sys…
score: 0

http://stackoverflow.com/q/23471634
has title: Convert the JSON to CSV using java
type: Question
has comment: http://stackoverflow.com/comment/35985935
has comment: http://stackoverflow.com/comment/36035077
upvote count: 0
has answer: http://stackoverflow.com/a/23471778
has body: I'm trying to convert the JSON to CSV file. But I'm facing the issue in the JSONArray docs = output.getJSONArray("Text will vary from each execution."); How to take the value of the getJSONArray(" xxx ") ??? JSONObject output = new JSONObject(jsonString); JSONArray docs = output.getJSONArray("elements"); File file=new File(csvFilepath); String csv = CDL.toString(docs); FileUtils.writeStringToFile(file, csv); Thanks in Advance
has answer: http://stackoverflow.com/a/23472152
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/36034068
has answer: http://stackoverflow.com/a/41080438
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/23475457
type: UnansweredQuestion
downvote count: 2
score: -2
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/56944152
has body: Kotlin extension function that works with all API versions handles multiple arguments Example usage textView.text = context.getText(R.string.html_formatted, "Hello in bold") HTML string resource wrapped in a CDATA section bold text: %1$s Result bold text: Hello in bold Code /** * Create a formatted CharSequence from a string resource containing arguments and HTML formatting * * The string resource must be wrapped in a CDATA section so that the HTML formatting is conserved. * * Example of an HTML formatted string resource: * bold text: %1$s */ fun Context.getText(@StringRes id: Int, vararg args: Any?): CharSequence = HtmlCompat.fromHtml(String.format(getString(id), *args), HtmlCompat.FROM_HTML_MODE_COMPACT)
has comment: http://stackoverflow.com/comment/116340112
type: Answer
has comment: http://stackoverflow.com/comment/115548217
score: 22
downvote count: 1
upvote count: 23
has comment: http://stackoverflow.com/comment/107297654
answers question: http://stackoverflow.com/q/23503642

http://stackoverflow.com/a/68752133
has comment: http://stackoverflow.com/comment/121535741
has body: THe SQL uses bigEndin but C# (and other languages) uses Little Endian for GetBytes. Thus, reverse the result after GetBytes. static long ComputeSha256HashbigInt(string rawData) { // Create a SHA256 using (SHA256 sha256Hash = SHA256.Create()) { // ComputeHash - returns byte array byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(rawData)); if (BitConverter.IsLittleEndian) Array.Reverse(bytes); long value = BitConverter.ToInt64(bytes, 0); return value; } }
score: 0
answers question: http://stackoverflow.com/q/23612593
type: Answer

http://stackoverflow.com/q/23565824
has comment: http://stackoverflow.com/comment/36161977
accepted answer: http://stackoverflow.com/a/23569625
type: AnsweredQuestion
has title: How do I color my output in the console in Intellij using Grep Console?
tagged with: intellij-plugin
type: Question
has comment: http://stackoverflow.com/comment/36168748
has answer: http://stackoverflow.com/a/23569625
score: 0
tagged with: java
has body: This is my first question to StackOverflow: I'm using IntelliJ IDEA on a Mac. Intellij does not support ANSI coloring of the output (I want to use it for coloring a ludoboard, that i'm representing in the console). So i'm trying to get Grep Console to work - but i don't know how. The only guides I could find, using google, refer to Eclipse or are not specific, so i'm out of IDEAs. Can anyone please ELI5?
answer count: 1
tagged with: intellij-idea

http://stackoverflow.com/comment/36033972
comment on: http://stackoverflow.com/a/23497081
type: Comment
has text: And how can the double be properly formatted to a string, like explained above?
type: AnswerComment
score: 0

http://stackoverflow.com/a/23613883
has comment: http://stackoverflow.com/comment/36252383
upvote count: 2
has comment: http://stackoverflow.com/comment/36252324
has comment: http://stackoverflow.com/comment/36252059
type: Answer
answers question: http://stackoverflow.com/q/23613641
score: 2
downvote count: 0
has body: It seems its happening beacause of scope you defined as provided remove provided and give a try Below is the description for provided scope from Maven provided This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.

http://stackoverflow.com/q/23547543
has answer: http://stackoverflow.com/a/23547610
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36128911
tagged with: java
has comment: http://stackoverflow.com/comment/36127913
type: Question
answer count: 2
has body: PHP can be executed as a script, without the existence of a web server. e.g php script.php I'm wondering if there's anything similar for JSP?
tagged with: jsp
tagged with: tomcat
score: 0
has answer: http://stackoverflow.com/a/23550396
has title: Is there a command-line shell for JSP? Just like the php cli program

http://stackoverflow.com/comment/36007700
has text: @Code-Guru the code includes the package name, so you may assume this is the whole content of the file. I copied/pasted in my text editor (Notepad++ in Windows) and spot the errors in both lines 65 and 86 with no problems.
score: 0
comment on: http://stackoverflow.com/q/23482922
type: Comment
type: QuestionComment

http://stackoverflow.com/a/59044025
score: 0
answers question: http://stackoverflow.com/q/23563343
has body: public class Assignment4 { HashMap map = new HashMap&lt;>(); public void addContact(String name, Integer number) { map.put(name, number); } public void getphoneNumber(String name) { if (map.containsKey(name)) { Integer a = map.get(name); System.out.println("Contact of " +name+" is " + a); } } public static void main(String[] args) { Assignment4 a4 = new Assignment4(); a4.addContact("vishal", 10345); a4.addContact("sachin", 30456); a4.addContact("sai", 30458); Scanner s=new Scanner(System.in); System.out.println("Enter name to get contact details"); a4.getphoneNumber(s.next()); s.close(); } }
type: Answer

http://stackoverflow.com/comment/36211440
comment on: http://stackoverflow.com/a/23591775
type: Comment
score: 0
type: AnswerComment
has text: @JqueryLearner Don't worry, I will not do anything. :)

http://stackoverflow.com/a/23508773
type: Answer
score: 8
downvote count: 0
upvote count: 8
answers question: http://stackoverflow.com/q/23497566
has body: Something is telling Tomcat to shut down. Tomcat does not gracefully shut down when it's "in trouble" (out of memory, or anything else). Linux does not gracefully shut down processes when it's low on memory, it stops them hard with a kill -9, which leave no trace in the Tomcat log. kill -15 will shut down tomcat gracefully, via the shut down hook. (The answer previously said kill -3 here, which is simply causing a thread dump.) An internal exit() will shut it down gracefully as well, again via the shut down hook. It can be shut down via JMX, and, of course the shut down command from Catalina. So, someone, somewhere, is telling Tomcat to do this. This isn't some unknown, internal "problem". Those kind of things just kill tomcat outright, they don't ask politely. One thing you might try is to enable DEBUG for logging, to see what chatter you get. If you get too much, you can try looking specifically at org.apache.catalina.core.StandardContext. This may well not give you more than it already being logged, but it may tell you something. After that, if so motivated, and it continues, I'd suggest building Tomcat yourself, and interjecting some stack trace dumps. For example, in org.apache.coyote.AbstractProtcol, you can add: Exception e = new Exception("Shut down trace"); getLog().info("Shutting down protocol", e); to the stop() method. That will give you a solid stack trace to learn from whence this came. Tomcat isn't really a nasty event storm of just random messages floating around. The shut down is pretty synchronous. So, that stack trace will give you a solid lead as to who started the party. Then you can look from there to see how that could have happened. There's a bunch of interfaces and abstractions in Tomcat, but really only a few implementations, so it's not impenetrable. And having a smoking stack trace will help immensely in pinning it down.
has comment: http://stackoverflow.com/comment/51660923
has comment: http://stackoverflow.com/comment/36057068

http://stackoverflow.com/a/23571304
accepted answer of: http://stackoverflow.com/q/23560547
downvote count: 0
type: AcceptedAnswer
has body: A MCVE showing that this is working in general. My guess would be that you are using a wrong instance of the save menu item. In doubt, add debug output @Override public void internalFrameIconified(InternalFrameEvent arg0) { System.out.println("Disabling "+save); save.setEnabled(false); } to your methods. import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.SwingUtilities; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; public class InternalFrameListenerTest { 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)); JMenuBar menubar = new JMenuBar(); JMenu menu = new JMenu("Menu"); menubar.add(menu); JMenuItem menuItem = new JMenuItem("Save"); menu.add(menuItem); frame.setJMenuBar(menubar); JDesktopPane d = new JDesktopPane(); Gui gui = new Gui(d, menuItem); frame.getContentPane().add(d); frame.setSize(500,500); frame.setLocationRelativeTo(null); frame.setVisible(true); } } class Gui implements InternalFrameListener, ActionListener { MyInternalFrame frame; JMenuItem save; public Gui(JDesktopPane desktop, final JMenuItem save) { frame = new MyInternalFrame("Title"); this.save = save; frame.setVisible(true); desktop.add(frame); try { frame.setSelected(true); } catch (java.beans.PropertyVetoException e) { } frame.addInternalFrameListener(this); } class MyInternalFrame extends JInternalFrame { static final int xPosition = 30, yPosition = 30; public MyInternalFrame(String title) { super(title, true, true, true, true); setSiz…
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23560547
score: 1

http://stackoverflow.com/comment/36036488
score: 0
type: Comment
has text: @Harmlezz +1 for taking the time to look for a non brute force solution. I would indeed choose such a solution (or similar) if I had to deal with this problem.
comment on: http://stackoverflow.com/a/23474480
type: AnswerComment

http://stackoverflow.com/a/23474029
has body: If you want to use a pure GWT solution, you can take advantage of GWT´s ScriptInjector: ScriptInjector.fromUrl("http://example.com/foo.js").setCallback( new Callback() { public void onFailure(Exception reason) { Window.alert("Script load failed."); } public void onSuccess(Void result) { Window.alert("Script load success."); } }).inject(); So, inside of your gwt´s onModuleLoad() method, you can place this snippet. In that way you do not need to write a single extra line of JS.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23473564
upvote count: 1
type: Answer

cassandra
tags question: http://stackoverflow.com/q/23564544
type: Tag
tag name: cassandra
tags question: http://stackoverflow.com/q/23533271
tags question: http://stackoverflow.com/q/23541119
tags question: http://stackoverflow.com/q/23560723
tags question: http://stackoverflow.com/q/23572487
tags question: http://stackoverflow.com/q/23610771
tags question: http://stackoverflow.com/q/23467724
tags question: http://stackoverflow.com/q/23590613

http://stackoverflow.com/comment/36018940
type: QuestionComment
has text: @Chris Isn't there some overhead with inheritance? I think it would offset any memory savings.
comment on: http://stackoverflow.com/q/23488243
score: 1
type: Comment

http://stackoverflow.com/a/23538135
downvote count: 0
type: Answer
has body: Please try below program public class FindKLargestElements { private static int n =0; private static int large[]; public static void findLarge(Node node, int k) { if (node == null) return; if (k == 0) return; findLarge(node.getRightNode(), k); if (k &gt;0) { large[n] = node.getValue(); k = k-1; n = n+1; } findLarge(node.getLeftNode(), k); } }
upvote count: 3
answers question: http://stackoverflow.com/q/23537757
score: 3
has comment: http://stackoverflow.com/comment/36112223
has comment: http://stackoverflow.com/comment/36111758

http://stackoverflow.com/q/23518349
has answer: http://stackoverflow.com/a/23518511
score: 0
tagged with: java
has body: I need to pass the same ArrayList from the main function to 3 different functions (all in different classes). When the 1st function receives the ArrayList, it makes changes not only in the local copy of the list but also the original ArrayList in the main method gets modified. This indicates that the changes are being made at the memory address. So, in the first function I copied the received arraylist into another arraylist of the same type, using: for(int i=0;i&lt;valuex.size();i++) { temp1=valuex.get(i); VALUE.add(temp1); } This worked for the first time when I introduced this modification but then the same problem restored. Later I made three copies of the arraylist and passed each copy to each of the 3 functions. This too failed. I didn't use clone(); because this created the same problem some time back.. Please help...
answer count: 3
has comment: http://stackoverflow.com/comment/36072838
has answer: http://stackoverflow.com/a/23518551
tagged with: arraylist
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23518489
has title: passing an ArrayList to a function makes changes in the original ArrayList
has comment: http://stackoverflow.com/comment/36073300
type: Question
accepted answer: http://stackoverflow.com/a/23518551
possible better answer: http://stackoverflow.com/a/23518511

http://stackoverflow.com/a/23486709
has comment: http://stackoverflow.com/comment/36014460
upvote count: 34
has comment: http://stackoverflow.com/comment/36014704
type: AcceptedAnswer
has body: In my case also there is same scenario. I used for loop to check whether this record exists in databse or not and then according to that I added this object in to two arraylist for insert or update. And then used batch for insert and update after for loop for that to list. here is ex. for update according to different where condition 1] this is for update &lt;foreach collection="attendingUsrList" item="model" separator=";"&gt; UPDATE parties SET attending_user_count = #{model.attending_count} WHERE fb_party_id = #{model.eid} &lt;/foreach&gt; 2] this is for insert &lt;insert id="insertAccountabilityUsers" parameterType="AccountabilityUsersModel" useGeneratedKeys="false"&gt; INSERT INTO accountability_users ( accountability_user_id, accountability_id, to_username, record_status, created_by, created_at, updated_by, updated_at ) VALUES &lt;foreach collection="usersList" item="model" separator=","&gt; ( #{model.accountabilityUserId}, #{model.accountabilityId}, #{model.toUsername}, 'A', #{model.createdBy}, #{model.createdAt}, #{model.updatedBy}, #{model.updatedAt} ) &lt;/foreach&gt; &lt;/insert&gt; In dao method declare as void insertAccountabilityUsers(@Param("usersList") List&lt;AccountabilityUsersModel&gt; usersList); Update Here is my batch session code public static synchronized SqlSession getSqlBatchSession() { ConnectionBuilderAction connection = new ConnectionBuilderAction(); sf = connection.getConnection(); SqlSession session = sf.openSession(ExecutorType.BATCH); return session; } SqlSession session = ConnectionBuilderAction.getSqlSession(); Actually I already given full example here for this question
has comment: http://stackoverflow.com/comment/36014727
accepted answer of: http://stackoverflow.com/q/23486547
has comment: http://stackoverflow.com/comment/70339946
downvote count: 5
has comment: http://stackoverflow.com/comment/68742459
type: Answer
has comment: http://stackoverflow.com/comment/59457051
answers question: http://stackoverflow.com/q/23486547
has comment: http://stackoverflow.com/comment/49037998
has comment: http://stackoverflow.com/comment/36014636
has comment: http://stackoverflow.com/comment/44978045
score: 29
has comment: http://stackoverflow.com/comment/36014518
has comment: http://stackoverflow.com/comment/36014792
has comment: http://stackoverflow.com/comment/58917319

http://stackoverflow.com/a/23505302
downvote count: 0
answers question: http://stackoverflow.com/q/23504933
upvote count: 2
type: Answer
has body: The code style you're linking to is called: Code Style Guidelines for Contributors By definition, it's for people who make their code publicly available and want it contributed to the larger android open source project. These instructions really have nothing to do with you. In your case, you'll compile your source files, and the pre-processor for your compiler will strip out any of those comments. So even if someone does reverse-engineer your code, that person won't have access to those comments even if they wanted to. This is not to say that you shouldn't mark your files with copyright information, so that if one day, your laptop gets stolen, or you get into a legal dispute, or someone buys your project, or if a couple of years from now, you don't remember which files you wrote yourself or which one you copied from some place, etc. You should definitely do that, but for practical reasons, it may be easier to keep your project under version control and mark your entire project under your own copyright instead of doing it file by file especially if you're its sole author.
score: 2

http://stackoverflow.com/comment/36136173
has text: i update map but at a place it change to wrong value.
comment on: http://stackoverflow.com/a/23551843
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/23549299
type: Answer
answers question: http://stackoverflow.com/q/23549255
upvote count: 1
has comment: http://stackoverflow.com/comment/36132185
score: 1
has comment: http://stackoverflow.com/comment/36133065
type: AcceptedAnswer
has body: Try this: import java.util.Date; import java.sql.Timestamp; public Timestamp convertDateToTimestamp(Date date) { Timestamp timestamp = null; if (date != null) { timestamp = new Timestamp(date.getTime()); } return timestamp; }
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23549255
has comment: http://stackoverflow.com/comment/36131575

http://stackoverflow.com/comment/35958071
has text: @user432 As I stated, in the same package as the main class (the only package) `me.spedwards.program` is the package and both the class and icon are in there.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23456627

http://stackoverflow.com/q/23530956
type: Question
tagged with: java-native-interface
has body: It used to be that you could use Connector/MXJ to embed a MySQL Database in to a Java Application, however the Connector/MXJ project has been EOL'd by Oracle (thanks Larry) so I am looking for the best way to accomplish my goal. Our application ships with an embedded Tomcat and JRE and we would like to embed the MySQL database as well (don't ask if we can use some other database engine - it has to be MySQL). I can't find any good documentation or answers on the best way to do this so here are the thoughts that I have come up with: Simply launch the executable to startup mysqld as part of the application's startup script Write/Use a JNI wrapper around libmysqld to startup the server at application start and stop it at application stop (this would be the preferred method) For the second (preferred) option, I don't think writing a JNI wrapper around the libmysqld calls would be too difficult, however I am wondering if that would even work since libmysqld only provides access to code running in the same process (no named pipes or tcp access). Would a process kicked off within a running java app allow the parent application to access the database?
answer count: 1
downvote count: 0
has title: How to embed MySQL Database in a Java Application
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/29034130
score: 2
upvote count: 2
tagged with: java
tagged with: web-applications
tagged with: mysql

http://stackoverflow.com/a/23513284
answers question: http://stackoverflow.com/q/23476405
score: 0
has body: I had same problems while importing quickblox samples into Eclipse. But I fixed them adding jar to build path and exporting it. I read this article: http://quickblox.com/developers/Android_XMPP_Chat_Sample Using latest samples I had problems while compiling samples cause I had to add app-compat project in dependency and support-v4 lib in build path. I fixed it successfully but in not all samples. Today I am using Mac Os. When I used Eclipse on Windows I had more problems. What OS are you using ? What Eclipse's version are you using?
type: Answer

http://stackoverflow.com/comment/36208725
type: AnswerComment
has text: I am really sorry. Respect **Design Pattern** that says **Favor composition over Inheritance**
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23544044

http://stackoverflow.com/comment/77261239
comment on: http://stackoverflow.com/a/45123439
has text: Thank you very much for your response. You are absolutely right, I really didn't need that much performance, however, I think the main question is still valid and remains unanswered.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36116724
score: 0
type: Comment
has text: please take another look.
comment on: http://stackoverflow.com/a/23540778
type: AnswerComment

http://stackoverflow.com/q/23488601
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23488894
tagged with: android
type: AnsweredQuestion
has title: Custom layout with listview in Dialog
tagged with: java
downvote count: 2
type: Question
score: -2
tagged with: dialog
has body: I would like to do a dialog which contains a ListView with an EditText and two Button , one to go to other dialog and the other to validate. I fill my ListView with SQLite, and the datas are loaded well but i have an error when i set the adapter to my listView.. This is my code : public void createDialog(){ // custom dialog ArrayList&lt;String&gt; list_datas = new ArrayList&lt;String&gt;(); ContractProductQuery contractProductQuery = new ContractProductQuery(this); contractProductQuery.open(); list_datas = contractProductQuery.getProductInContract(this.producer.getId(), this.point.getId()); contractProductQuery.close(); final Dialog dialog = new Dialog(ViewPdf.this); dialog.setContentView(R.layout.list_product); &lt;--- i load my custom layout final ListView list_view = (ListView) findViewById(R.id.list_prod); &lt;-- this is the listview id of my custom layout that loaded before final EditText quantity_product = (EditText) findViewById(R.id.quantity_product); &lt;-- and the EditText to getValue after dialog.setTitle("Produit présent dans le contrat"); ArrayAdapter&lt;String&gt; modeAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, list_datas); list_view.setAdapter(modeAdapter); -&lt;&lt; IT'S HERE WHERE I HAVE NULLPOINTEREXECPTION Button dialog_button_return = (Button) dialog.findViewById(R.id.button_return); dialog_button_return.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); Button dialog_button_validate = (Button) dialog.findViewById(R.id.button_validate); dialog_button_validate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); dialog.show(); } and tis is my error : 05-06 07:24:37.868: E/AndroidRuntime(953): FATAL EXCEPTION: main 05-06 07:24:37.868: E/AndroidRuntime(953): java.lang.NullPointerException 05-06 07:24:37.868: E/AndroidRuntime(953): at com.pdf.ViewPdf.test(ViewPdf.java:774) 05-06 07:24:37.868: E/AndroidR…
tagged with: listview
has answer: http://stackoverflow.com/a/23488894
upvote count: 0

http://stackoverflow.com/q/23574660
has comment: http://stackoverflow.com/comment/36182471
tagged with: jinternalframe
tagged with: jdesktoppane
has comment: http://stackoverflow.com/comment/36179969
answer count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23580178
upvote count: 1
tagged with: swing
type: AnsweredQuestion
tagged with: java
has title: Moving JInternalFrames from one JDesktopPane to another
has body: I have been designing a Swing-based tabletop RPG program to facilitate text-based roleplay with GUI control elements. To facilitate this, each running client gets a main desktop ("GM Desktop" on the hosting client and "Player Desktop" on the remote clients) with all of the important JFrames. Additionally, both GM and Players can open "Perspective Desktops" for characters, providing them with a separate JDesktopPane that contains the "Role Play Chat Window" that gives that character's perspective, along with additional JInternalFrames such as the "Character Sheet Window", etc. The user navigates between desktops using a JTabbedPane. The issue that I am having is that SOME of the windows I want to be able to move between desktops. For example, if the OOC (Out-of-Character) Chat receives a message while the user is in a Perspective Desktop, I want there to be an option for the OOC Chat Window to automatically relocate to the current desktop so the user sees the message immediately. Similarly I want the player to be able to "call" certain windows into the current desktop using the menu bar. However, when I attempt to move a JInternalFrame from one JDesktopPane to another, I receive an exception. com.finnickslab.textroleplayonline.exceptions.CommandEventHandlingException An exception was thrown during command handling. CommandEvent type: UI_OOC_CHAT (26). Cause Exception: java.lang.IllegalArgumentException illegal component position java.awt.Container.addImpl(Unknown Source) javax.swing.JLayeredPane.addImpl(Unknown Source) javax.swing.JDesktopPane.addImpl(Unknown Source) java.awt.Container.add(Unknown Source) com.finnickslab.textroleplayonline.ui.GameDesktop.receiveTransfer(GameDesktop.java:80) com.finnickslab.textroleplayonline.ui.GameDesktop.access$0(GameDesktop.java:74) com.finnickslab.textroleplayonline.ui.GameDesktop$2.run(GameDesktop.java:69) com.finnickslab.textroleplayonline.ui.UI.invokeEvent(UI.java:818) com.finnickslab.textroleplayonline.ui.GameDesktop.transfer…
type: Question
accepted answer: http://stackoverflow.com/a/23580178
downvote count: 0

http://stackoverflow.com/comment/35985079
type: Comment
has text: Of course. You just need to use Collections.sort() and define a Comparator using an anonymous class rather than a lambda. there must be hundreds of questions asking how to sort a list of objects in Java. Google for them, or read my edited answer.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23470280

http://stackoverflow.com/q/23574270
tagged with: tomcat
favorite count: 0
tagged with: exception
has answer: http://stackoverflow.com/a/23574383
has answer: http://stackoverflow.com/a/23574547
has title: RuntimeException using Tomcat and MySQL
type: AnsweredQuestion
upvote count: 2
possible better answer: http://stackoverflow.com/a/23574383
has body: I just cannot get this problem! java.lang.RuntimeException: 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 'SELECT user_id FROM user WHERE USER_NAME ='test';'' at line 1 Can you please help me? I have no idea, what could be wrong! The syntax is okay, isn't it? Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource ds = (DataSource) envCtx.lookup("jdbc/onlinebanking"); connection = ds.getConnection(); Statement statement = connection.createStatement(); resultSet = statement.executeQuery(sql); resultSetKunden_id = statement.executeQuery(kunde_id); resultSetKontostand = statement.executeQuery(kontostand); resultSetTest = statement.executeQuery(test); ResultSetMetaData metaData = resultSet.getMetaData(); Here's the SQL-Statement: String sql = "select tr.EMPFÄNGER_KONTO_ID, tr.BETRAG " + "from TRANSAKTION tr, KONTO ko, KUNDE ku " + "where tr.KONTO_ID = ko.KONTO_ID " + "and ko.KUNDE_ID = ku.KUNDE_ID " + "and ku.KUNDE_NAME = '" + username +"' " + "and ku.KUNDE_PASSWORD = '" + password +"';"; kunde_id = "SELECT kunde_id FROM kunde WHERE KUNDE_NAME ='" + username + "';"; String test = "SELECT * FROM kunde WHERE KUNDE_NAME ='" + username + "';"; kontostand = "Select betrag From Transaktion Where Konto_id = " + kunde_id + "';"; (Some words are in german) Here's the Exception: java.lang.RuntimeException: 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 'Janssen''' at line 1 de.java2enterprise.onlinebanking.HalloWeltServlet.getData(HalloWeltServlet.java:112) de.java2enterprise.onlinebanking.HalloWeltServlet.doGet(HalloWeltServlet.java:32) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) Thanks!
has comment: http://stackoverflow.com/comment/36177995
has comment: http://stackoverflow.com/comment/36178070
downvote count: 1
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36177994
accepted answer: http://stackoverflow.com/a/23574547
tagged with: mysql
answer count: 2
has comment: http://stackoverflow.com/comment/36177919
tagged with: jsp

http://stackoverflow.com/q/23530773
has comment: http://stackoverflow.com/comment/36103163
has body: I have a page with the following checkboxes &lt;input type="checkbox" name="option" value="Milk"&gt; Milk&lt;br&gt; &lt;input type="checkbox" name="option" value="Butter"&gt; Butter&lt;br&gt; &lt;input type="checkbox" name="option" value="Cheese"&gt; Cheese&lt;br&gt; If any two or all of them are checked, I am able to get the checked values in a servlet as follows: String[] results = request.getParameterValues("option"); My question is: the order of the selected values in the results array is guaranteed to match the order of checkboxes in HTML? For example: If Mike and Cheese are selected in HTML, then the values in results MUST be: results[0= Milk and results[1]=Cheese. Is there any specification about this?
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36098487
has comment: http://stackoverflow.com/comment/36099095
tagged with: java
type: Question
tagged with: jakarta-ee
has title: HTML and Java Servlet: the values of selected checkboxes in servlet have the same order of their checkboxes in HTML?
score: 0

http://stackoverflow.com/comment/36115763
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23541128
has text: _"I have tryed using the code the bellow"_ - ummm, _what_ code?

http://stackoverflow.com/comment/36147579
type: Comment
has text: I tested Integer a = new Integer(5); Integer b = new Integer(6); System.out.println(a.compareTo(b)); and it returns me -1, do I have to do it for my case at all? (I will be using Integer too...)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23558035

http://stackoverflow.com/a/23535180
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23526655
upvote count: 1
answers question: http://stackoverflow.com/q/23526655
type: Answer
has body: You are likely importing com.google.gwt.user.client.ui.Button not com.vaadin.ui.Button. You can't add Vaadin ClickListener to GWT Button or vice versa. Listening to button click events works in sub-windows just as everywhere else. So your code should otherwise be OK as long as 'this' really is implementing the correct interface.
downvote count: 0
score: 1

http://stackoverflow.com/q/23510836
has body: While running below code i am getting error, can some one pls help? what is the issue My Code : WebDriver wd=new FirefoxDriver(); wd.get("https://google.co.in"); Error Message: Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died. Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15' System info: host: 'INL-281384-1', ip: '10.14.225.69', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_45' Driver info: driver.version: RemoteWebDriver
has answer: http://stackoverflow.com/a/23512338
score: 0
has title: While opening the Firefox driver in webdriver am getting below error
answer count: 1
type: UnansweredQuestion
tagged with: java
tagged with: selenium
type: Question

http://stackoverflow.com/q/23531111
type: Question
type: AnsweredQuestion
tagged with: java
has body: I'm asking for a Java code. I'm looking for a way to select the first file in a directory in order to process it. Thanks.
score: -1
has answer: http://stackoverflow.com/a/23531198
accepted answer: http://stackoverflow.com/a/23531198
has comment: http://stackoverflow.com/comment/36097832
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36097985
downvote count: 1
tagged with: directory
upvote count: 0
tagged with: select
has title: Java: Select the first file in a directory
tagged with: file

http://stackoverflow.com/comment/36386151
has text: Not yet, when I find time to try it out, I'll let you know whether this was useful.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23505823

http://stackoverflow.com/comment/69639478
comment on: http://stackoverflow.com/a/31029429
score: 0
type: Comment
has text: Thanks ! i had wrong configuration in my yml file. network.host: property was set to 0.0.0.0. Changing it to 127.0.0.1 worked like a charm
type: AnswerComment

http://stackoverflow.com/a/23545989
answers question: http://stackoverflow.com/q/23545872
has comment: http://stackoverflow.com/comment/36129113
has comment: http://stackoverflow.com/comment/120956012
type: AcceptedAnswer
upvote count: 14
type: Answer
has body: Use an object, and set its initial state in the constructor: public class GameSettings { private int score = 0; private float speed = 2.3F; // methods omitted for brevity } ... public void resetGame() { gameSettings = new GameSettings(); } Also, please respect the Java naming conventions. ALL_CAPS is reserved for constants. Variables should be lowerCase.
downvote count: 0
score: 14
accepted answer of: http://stackoverflow.com/q/23545872

http://stackoverflow.com/q/23531991
has answer: http://stackoverflow.com/a/23532069
accepted answer: http://stackoverflow.com/a/23532069
tagged with: spring
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36099409
upvote count: 2
has title: Type missing when try Spring framework quickstart
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36099434
has comment: http://stackoverflow.com/comment/36099379
has body: I'm learning Spring framework and build my first Spring application according to the quickstart on http://projects.spring.io/spring-framework/. I use the maven dependency to add the respective libraries, and add the three java file. However, I can't compile Application.java because of following error at Line 1: The type org.springframework.beans.factory.support.BeanNameGenerator cannot be resolved. It is indirectly referenced from required .class files And the whole project looks like this: I don't know what I'm doing wrong. Please help me. UPDATED: Application.java
score: 2
downvote count: 0

http://stackoverflow.com/a/23485670
upvote count: 2
has body: parseDate takes the date to be parsed as a string in the format specified. Your format is for the destination, which doesn't matter, as JDBC will take care of that for you.. What you need is something like (untested): SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy k:mm:ss.SSSS"); Date parsedDate = dateFormat.parse(getCheckOutDate()); Timestamp timestamp = new Timestamp(parsedDate.getTime()); I do hope that helps.
has comment: http://stackoverflow.com/comment/36012529
accepted answer of: http://stackoverflow.com/q/23485550
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36012458
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23485550

http://stackoverflow.com/comment/35961196
has text: How can I detect this?
comment on: http://stackoverflow.com/q/23458186
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23497766
accepted answer: http://stackoverflow.com/a/23498999
score: 0
has comment: http://stackoverflow.com/comment/36035032
has comment: http://stackoverflow.com/comment/36035068
has answer: http://stackoverflow.com/a/23498999
has comment: http://stackoverflow.com/comment/36034916
tagged with: dictionary
possible better answer: http://stackoverflow.com/a/23498261
has answer: http://stackoverflow.com/a/23498261
has body: I have data in the following format (both double) Price1 Price2 1.2 5.1 3.2 4.2 1.4 1.4 1.3 1.1 I want price1 and price2 to be linked to each other. I need to sort price2 in descending order and then remove last record. I then need to sort price1 in descending. What is the best approach to take? - which datatype?. I was thinking of using hashmap but there is no concept of position although i can do a work around but it would be messy. Can also create an object to store them and then do a comparable but was thinking if I could do this in a few lines of code?. Not sure if a better option is viable but curious :)
type: AnsweredQuestion
tagged with: hashmap
tagged with: java
has title: Approach to filter a map
has comment: http://stackoverflow.com/comment/36035406
has comment: http://stackoverflow.com/comment/36034644
type: Question
has comment: http://stackoverflow.com/comment/36034562
linked to: http://stackoverflow.com/q/7427758
answer count: 2

http://stackoverflow.com/comment/36124514
has text: There is an option to edit your answer, so please use it instead of posting two answers (in reference to your *other* answer below).
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23545833

http://stackoverflow.com/q/23577808
tagged with: webui
has comment: http://stackoverflow.com/comment/36344718
has comment: http://stackoverflow.com/comment/36348631
tagged with: adempiere
has answer: http://stackoverflow.com/a/23626131
tagged with: java
has answer: http://stackoverflow.com/a/24029977
type: Question
answer count: 2
has title: Confirm (yes/No) dialog box in Callout Adempiere
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36348687
score: 2
upvote count: 2
type: UnansweredQuestion
has body: I'm trying to get the Confirm Dialog Box in Adempiere. I have used JOptionPane.showConfirmDialog(null, msg,"", JOptionPane.YES_NO_OPTION); or ADialog.ask(WindowNo, null,msg) instead of mTab.fireDataStatusEEvent ("NoQtyAvailable", "0", true); I getting the popup (yes /NO ) and working fine in Swing but it doesnt works with WEBUI. My Code: if (product.isStocked()) { if (available == null) available = Env.ZERO; if (available.signum() == 0){ //mTab.fireDataStatusEEvent ("NoQtyAvailable", "0", false); int response = JOptionPane.showConfirmDialog(null, msg, "", JOptionPane.YES_NO_OPTION); if (response == JOptionPane.YES_OPTION) mTab.setValue("BC_Qty", mTab.getValue("QtyEntered")); else mTab.setValue("BC_Qty", Env.ZERO); } } Buid ERROR: Buildfile: E:\Adempiere360\svn\base\build.xml init: [echo] =========== Build Base makedir: compile: [javac] E:\Adempiere360\svn\base\build.xml:56: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds [javac] Compiling 1 source file to E:\Adempiere360\svn\base\build [javac] E:\Adempiere360\svn\base\src\org\compiere\model\CalloutOrder.java:27: package org.adempiere.webui.window does not exist [javac] import org.adempiere.webui.window.FDialog; [javac] ^ [javac] E:\Adempiere360\svn\base\src\org\compiere\model\CalloutOrder.java:827: warning: [deprecation] getQtyAvailable(int,int,int,java.lang.String) in org.compiere.model.MStorage has been deprecated [javac] BigDecimal available = MStorage.getQtyAvailable [javac] ^ [javac] E:\Adempiere360\svn\base\src\org\compiere\model\CalloutOrder.java:833: cannot find symbol [javac] symbol : variable FDialog [javac] location: class org.compiere.model.CalloutOrder [javac] if(FDialog.ask(WindowNo, null, msg)) [javac] ^ [javac] E:\Adempiere360\svn\base\src\org\compiere\model\CalloutOrder.java:1309: warning: [deprecation] getQtyAvailable(int,int,int,java.lang.String) in org.compiere.model.MStorage has been deprecated [javac] BigDecimal available = MSt…

http://stackoverflow.com/comment/36192036
comment on: http://stackoverflow.com/a/23580671
type: AnswerComment
has text: Can you post some code to show me the use of multiple packages? Can you even use multiple packages?
score: 0
type: Comment

http://stackoverflow.com/a/71318119
downvote count: 0
has body: This is working val formatterNew = SimpleDateFormat(requiredFormat,Locale.forLanguageTag("ar"))
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/23612392
score: 2
has comment: http://stackoverflow.com/comment/126132760

http://stackoverflow.com/q/23608358
has answer: http://stackoverflow.com/a/23608951
tagged with: java
tagged with: jtextfield
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36241332
score: -1
has title: Reading a line from a text file and put it in a JTextField
tagged with: printstream
has comment: http://stackoverflow.com/comment/36242362
answer count: 3
upvote count: 0
has body: I have no clue how to read a line from a text file and put it in a JTextField. I have this so far to create a text file and be able to change the text inside it by changing my JTextFields. An example of this: public void outputFile() throws FileNotFoundException{ PrintStream output = new PrintStream(new FileOutputStream("test")); output.println(jtextfield1.getText()); } I run this method when I click on a button. It works and the text file is indeed being changed. The problem is that I want to read this newly changed text to my JTextField, and the reason for this is that I use removeAll() method when changing between the panels for this program, thus my JTextField will be set as default (empty) when going back to this panel again. For instance if I have written "abc" in my JTextField and clicked "OK" button, then when going back to my panel with my JTextField - my JTextField has to stay at "abc" and not get resetted (thus being empty), and the solution for this is to read from a file (but a line only, as there are many JTextFields) in to JTextField.
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23608434
has answer: http://stackoverflow.com/a/23608659
tagged with: text-files

http://stackoverflow.com/a/29440278
score: 1
has comment: http://stackoverflow.com/comment/47055474
upvote count: 1
has comment: http://stackoverflow.com/comment/47172447
downvote count: 0
answers question: http://stackoverflow.com/q/23560232
has comment: http://stackoverflow.com/comment/47161808
type: Answer
has body: All the answers I could find for this issue on the web were more or less related to code generation, but I was working on a framework project and didn't want to couple my code to any specific databases. The problem I had was, JOOQ cut off the time part from the data of DATE column when calling Record.getValue() methods. According to JOOQ's doc, I worked it around by getting the value of DATE column from underlying ResultSet instead of using Record.getValue(). Sample code: ResultQuery&lt;Record&gt; query; Cursor&lt;Record&gt; cursor = query.fetchLazy(fetchSize); cursor.fetchOne(new RecordMapper&lt;Record, Map&lt;String, Object&gt;&gt;() { @Override public Map&lt;String, Object&gt; map(final Record record) { for (Field&lt;?&gt; field : record.fields()) { record.getValue(field, converter); if ("date".equals(field.getDataType().getTypeName())) { resultSet resultSet = cursor.resultSet(); try { Timestamp ts = resultSet.getTimestamp(field.getName()); } catch (SQLException e) { // ...... } } } } );

http://stackoverflow.com/q/23578179
tagged with: playframework
has title: Playframework: Handling Form Submission
tagged with: model-view-controller
type: UnansweredQuestion
tagged with: java
has body: I am working on a Play 2.2 Form application. I create a form using this function public static Result editIndicator() { Indicators addIndObj = new Indicators(); addIndObj.aDt = (new Date()).toString(); addIndObj.aUid = Long.parseLong(play.mvc.Controller.session("userid")); addIndObj.dTag = "N"; // List of all Countries ALLCommon table_listobj = Indicators.ddl1(); Form&lt;Indicators&gt; newIndicatorForm = form(Indicators.class).fill( addIndObj); return (ok(addindicator.render(newIndicatorForm, table_listobj))); } the Indicator Model has parameters with constraints @Required for the parameters as follows @Constraints.Required @Column(name = "A_DT") public String aDt; @Constraints.Required @Column(name = "A_UID") public Long aUid; @Constraints.Required @Column(name = "D_TAG") public String dTag; @Column(name = "TIME") @Required @Formats.DateTime(pattern = "HH:mm:ss") public Date time; @Constraints.Required @Column(name = "INDFREQUENCY") public String indFrequency; So, I set the values before and then bind it to form. I don't use all of these @Required values (just the Frequency part) in my form and when I try to get the filledform I get form errors Form(of=class models.Indicators, data={}, value=None, errors={time=[ValidationError(time,error.required,[])], aDt=[ValidationError(aDt,error.required,[])], dTag=[ValidationError(dTag,error.required,[])], aUid=[ValidationError(aUid,error.required,[])], indFrequency=[ValidationError(indFrequency,error.required,[])]}) Do I need to set these values in form even if I don't use it? Or I am missing something.. Any help is appriciated.. thanks in advance.. :)
type: Question
has answer: http://stackoverflow.com/a/23588904
has answer: http://stackoverflow.com/a/23578809
score: 0
answer count: 2

http://stackoverflow.com/comment/36112361
type: Comment
has text: AFAIK, when you called findViewById, it will search the current contentview you used for your app, and if you never set any view, it will return null. So never forget to call setContentView before findViewById :D
score: 0
comment on: http://stackoverflow.com/a/23539296
type: AnswerComment

http://stackoverflow.com/a/23462830
downvote count: 0
answers question: http://stackoverflow.com/q/23462804
type: Answer
has body: It's not about the VM, the VM works on a lower level and doesn't even see expressions in the same order as you write them in Java. What is important here is operator precedence: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html Just like they teach you "multiplication before addition" at school, there's a precedence for all the other operators as well. In Java's case, &amp;&amp; has higher precedence than ||. Therefore (A == true &amp;&amp; B == true || C == true) is equivalent to ((A == true &amp;&amp; B == true) || C == true) But in reality, just like you said, use those parenthesis. It makes it easier to read. Free protip: == true is superfluous. It doesn't do anything. Replace A == true with just A.
accepted answer of: http://stackoverflow.com/q/23462804
has comment: http://stackoverflow.com/comment/35969907
upvote count: 7
score: 7
type: AcceptedAnswer

http://stackoverflow.com/a/28416283
downvote count: 0
type: Answer
has body: You need to divide by 100 because when you use the "%" the api multiples the value for 100 and put the sign "%". Font: http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/client/NumberFormat.html
score: 1
answers question: http://stackoverflow.com/q/23598069
upvote count: 1

http://stackoverflow.com/comment/36194830
has text: `String.equalsIgnoreCase()` might be useful.
comment on: http://stackoverflow.com/q/23583242
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23590943
tagged with: java
downvote count: 2
has title: What is textview.setTextSize()?
has comment: http://stackoverflow.com/comment/36209010
tagged with: android-layout
upvote count: 12
has answer: http://stackoverflow.com/a/60896453
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136258884
has body: In my android game, there is a textview. I am setting the text size using following code. textview.setTextSize(30); 30 is in pixels. But what exactly it is ? Is it the height or width of a character ? Is it ordinal no. ?
tagged with: textview
favorite count: 0
has comment: http://stackoverflow.com/comment/36213102
type: Question
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/70183857
linked to: http://stackoverflow.com/q/3687065
score: 10
has comment: http://stackoverflow.com/comment/36212599
has comment: http://stackoverflow.com/comment/36212836

http://stackoverflow.com/a/23589197
score: 0
answers question: http://stackoverflow.com/q/23589037
has comment: http://stackoverflow.com/comment/36205618
has comment: http://stackoverflow.com/comment/36205625
has comment: http://stackoverflow.com/comment/36205577
has comment: http://stackoverflow.com/comment/36205571
type: Answer
has body: Or in other words it is not calling the method addBall() I do not see where you have instantiated Balla. Are you getting a NullPointerException ? Also, your Exception block is empty. Add an e.printStackTrace() there and post the stack trace. That'll give u a clue as to what is going wrong. This seems like a sandboxed applet and hence cannot write to a file. Quoting from the docs: They cannot access client resources such as the local filesystem, executable files, system clipboard, and printers. Sources: 1. What Applets Can and Cannot Do 2. How can an applet Read/Write files on the local file-system?

http://stackoverflow.com/comment/36215523
type: Comment
comment on: http://stackoverflow.com/a/23594314
score: 1
type: AnswerComment
has text: What's SalesPoint? My suggestion is to change your property names to `code`, `name`, `description`, `price`, and your class name to `Product`. Then use the final query I put in the answer.

http://stackoverflow.com/q/23494221
tagged with: oauth
has comment: http://stackoverflow.com/comment/37632921
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: oauth-provider
has title: Implementing custom oauth-provider?
type: Question
score: 3
has body: I want to implement Oauth-provider in such a way. I have one project in which i am accessing the rest apis. Now i want to create my own oauth-provider for every api to hit.I google alot but count not found anything from which i can start my implementation. I found google code for auth-provider but i am not been able to make it run. Code url is auth-provider from google code. In jsp once i say that create my oauth then i want to create oauth setting from my oauth-provider. So that i can get it and send it in header to test my api. I also download IBM code but not getting how should i start. IBM oauth 2.0 code Please help me. Thanks
downvote count: 0
favorite count: 0
upvote count: 3

http://stackoverflow.com/comment/35990735
type: Comment
comment on: http://stackoverflow.com/a/23473942
has text: What does that mean ... the service is already being running and I get an error in eclipse when I try to create new webservice client project as IWAB0399E Error in generating java from wsdl
score: 0
type: AnswerComment

regular-language
tags question: http://stackoverflow.com/q/23468977
type: Tag
tag name: regular-language

http://stackoverflow.com/q/23576460
upvote count: 1
has answer: http://stackoverflow.com/a/23582422
has title: Getter methods in java with asynchronous connection needing a delay
favorite count: 0
has body: I'm making a series of connections asynchronously via MySQL, and I have a class which contains a bunch of easy-accesible static methods to update/remove/clear/get/etc data. The issue I'm confronted with is that the getter methods won't return the proper value (practically ever) because they are returned before the async connection gets a chance to update the value to be returned. Example: public static int getSomething(final UUID user) { Connection c = StatsMain.getInstance().getSQL().getConnection(); PreparedStatement ps; try { ps = c.prepareStatement("select something from stats where uuid=?"); ps.setString(1, user.toString()); ResultSet result = ps.executeQuery(); return result.getInt("something"); } catch (SQLException e) { return false; } } (Not copy &amp; pasted, but pretty close) I realize I can use a 'callback' effect by passing an interface to the method and doing such, but that becomes very tedious when the database stores 10 values for a key.
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36182402
tagged with: mysql
has comment: http://stackoverflow.com/comment/36182375
has comment: http://stackoverflow.com/comment/36182423
has answer: http://stackoverflow.com/a/23576781
type: Question
has comment: http://stackoverflow.com/comment/36182455
answer count: 2
has comment: http://stackoverflow.com/comment/36182384

http://stackoverflow.com/comment/36066208
type: Comment
has text: @niiraj874u reading the question properly gives you the answer...
comment on: http://stackoverflow.com/q/23514930
score: 0
type: QuestionComment

crop
tags question: http://stackoverflow.com/q/23610007
tag name: crop
type: Tag

http://stackoverflow.com/a/23573817
has body: Change Resources res = getResources(); words = res.getStringArray(R.array.words); //initialize random rand = new Random(); //initialize word currWord = ""; to Resources res = getResources(); words = (ArrayList&lt;String&gt;) Arrays.asList(res.getStringArray(R.array.words)); //initialize random rand = new Random(); (thanks Hossam for that code) so instead of a regular String array your words are stored in an ArrayList. Now that you have your arraylist of words you can change your playGame() method to look like this: private void playGame() { //this is the line that makes sure no words are reused, it removes the current word before a new one is picked words.remove(currWord); //choose a word currWord = words.get(rand.nextInt(words.size()); And that is all, you should never get repeat words in your game unless you reload the words arraylist from resources. If there are any problems with this post the rest of your code so we can see what is going wrong.
score: 0
has comment: http://stackoverflow.com/comment/36225458
answers question: http://stackoverflow.com/q/23573033
type: Answer
has comment: http://stackoverflow.com/comment/36184097
has comment: http://stackoverflow.com/comment/36202338

http://stackoverflow.com/a/23585121
accepted answer of: http://stackoverflow.com/q/23585107
upvote count: 1
answers question: http://stackoverflow.com/q/23585107
has comment: http://stackoverflow.com/comment/36213020
type: AcceptedAnswer
downvote count: 0
has body: You're trying to call a method on the null pointer graphics. Graphics must be instantiated and point to an instance before you can call methods on it. See more here What is a NullPointerException, and how do I fix it?
has comment: http://stackoverflow.com/comment/36213126
type: Answer
score: 1

http://stackoverflow.com/a/23600980
has body: I would use a JTable. See the section from the Swing tutorial on How to Use Tables for more information and working examples. Also, follow Java naming conventions. Variable names should NOT start with an upper case character.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36264614
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23600964
score: 1
answers question: http://stackoverflow.com/q/23600964

http://stackoverflow.com/a/23522187
has comment: http://stackoverflow.com/comment/36080809
type: Answer
has comment: http://stackoverflow.com/comment/36080418
has comment: http://stackoverflow.com/comment/36081485
has comment: http://stackoverflow.com/comment/36080822
has body: The problem is that you're loading the files from local disk. Load them directly from the web application resources. Usually, you do this using ${request.contextPath} that already contains http://yourIp/yourApplicationName: Rewriting all your sources to this style: Note that example above will work only on JSP pages. If working in HTML page, then you have to call the resources statically from the current path:
has comment: http://stackoverflow.com/comment/36080608
score: 0
accepted answer of: http://stackoverflow.com/q/23522010
has comment: http://stackoverflow.com/comment/36081242
has comment: http://stackoverflow.com/comment/36081261
has comment: http://stackoverflow.com/comment/36080685
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23522010
has comment: http://stackoverflow.com/comment/36081089

http://stackoverflow.com/a/28505392
score: 0
has body: Try this: criteria.setProjection(Projections.distinct(Projections.property("userType")), "userType"); Also u don't have to check for blank strings, try this: criteria.add(Restrictions.ne("userType",""));
type: Answer
answers question: http://stackoverflow.com/q/23516661

http://stackoverflow.com/q/23562721
tagged with: java
has answer: http://stackoverflow.com/a/23562783
type: Question
downvote count: 0
has body: I want to detect when a database is down and I know once the database is down it will throw a SQLException. Using Connection.isValid(). What does the timeout paramter represent? It says: timeout - - The time in seconds to wait for the database operation used to validate the connection to complete. If the timeout period expires before the operation completes, this method returns false. A value of 0 indicates a timeout is not applied to the database operation. What does this mean?
answer count: 3
possible better answer: http://stackoverflow.com/a/23562791
tagged with: jdbc
has answer: http://stackoverflow.com/a/23562791
accepted answer: http://stackoverflow.com/a/23562783
favorite count: 0
has title: Detecting Database is Down
has answer: http://stackoverflow.com/a/23562795
upvote count: 1
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/36044907
has text: Added the server side.
comment on: http://stackoverflow.com/q/23502963
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36197926
has text: Then what should OverFlowException class should include?I thought how try and catch works is if there's no error try part is executed.And if there's a error catch clause is executed.When catch is executed it looks at the OverFlowException class.I thought there I should have to mention how to test whether an error has occured(like calling for is full).I don't understand how this try and catch works.Can you please explain it to me
type: AnswerComment
comment on: http://stackoverflow.com/a/23584855
score: 0
type: Comment

http://stackoverflow.com/q/23534052
type: Question
has answer: http://stackoverflow.com/a/28551073
has comment: http://stackoverflow.com/comment/36103308
downvote count: 0
has answer: http://stackoverflow.com/a/23534258
linked to: http://stackoverflow.com/q/6343166
has comment: http://stackoverflow.com/comment/36105563
has title: Singleton class for socket connection not working
has comment: http://stackoverflow.com/comment/36111423
tagged with: singleton
tagged with: android
answer count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/23534418
accepted answer: http://stackoverflow.com/a/23534258
tagged with: sockets
upvote count: 1
has answer: http://stackoverflow.com/a/23534121
tagged with: design-patterns
has answer: http://stackoverflow.com/a/23534244
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36105517
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/23534121
has body: I created a singleton class to enable socket connection, which returns a socket object, which can be used by any number of activities in the application. the singleton class is as follows public class Singleton { private static Socket socket; private DataInputStream input; private DataOutputStream output; private boolean logged; private static Singleton instance; private String information; private static final int SERVERPORT = 8020; private static final String SERVER_IP = "192.168.1.33"; static PrintWriter out; private Singleton() { } public static Singleton getInstance() { return instance; } public static void initSingleton() { if(instance == null) { instance = new Singleton(); InetAddress serverAddr = null; try { serverAddr = InetAddress.getByName(SERVER_IP); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { socket = new Socket(serverAddr, SERVERPORT); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public Socket getSocket() { return socket; } public PrintWriter getOutput() { return out; } } In the MainActivity, I call the singleton class. public class MainActivity extends Activity implements OnItemSelectedListener { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initSingleton(); } protected void initSingleton() { Singleton.initSingleton(); } public void onClickon(View view) { Socket socket = Singleton.getInstance().getSocket(); try{ PrintWriter out=Singleton.getInstance().getOutput(); out.println("0"); } catch (Exception e) { e.printStackTrace(); } } } on button click , the onClickon function is called which uses the the getSocket() and getOutput() functions of the Singleton class to return the object types. Bu…

http://stackoverflow.com/comment/36090158
has text: Without a way to reproduce, this will be hard to diagnose remotely. Looks like all tests are passing, and then something goes wrong when tearing down the JVM(s) that are running the tests. (Each `Test` task spins up one or more JVMs to run tests in.)
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23523831

http://stackoverflow.com/a/23542760
accepted answer of: http://stackoverflow.com/q/23542530
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Let me take a stab at this: If you have no problem in simulating key presses in your app, you can do something of the sort: package robot; import java.awt.AWTException; import java.awt.Robot; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; public class KeyPresser { public static void main(String[] args) { try { Robot robot = new Robot(); // Simulate the charms shortcut: WIN key+C robot.keyPress(KeyEvent.VK_WINDOWS); robot.keyPress(KeyEvent.VK_C); robot.keyRelease(KeyEvent.VK_WINDOWS); robot.keyRelease(KeyEvent.VK_C); } catch (AWTException e) { e.printStackTrace(); } // TODO Auto-generated method stub } }
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23542530

http://stackoverflow.com/q/23556715
has comment: http://stackoverflow.com/comment/36145146
has comment: http://stackoverflow.com/comment/36145447
tagged with: android
tagged with: titanium
tagged with: module
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23558556
tagged with: java
type: Question
has title: unable to generate R.java in Titanium Module
has comment: http://stackoverflow.com/comment/36147107
score: 0
has comment: http://stackoverflow.com/comment/36145383
answer count: 1
has answer: http://stackoverflow.com/a/23558556
has body: I am developing an Titanium Module for Android. I add a customised menu xml "context_menu.xml" to it by placing it in folder /platform/android/res/menu/ in the Module Project. It can successfully packaged but when include the module in another Mobile Project, it always raise an error during build: [ERROR] Unable to find generated R.java file Here is the context_menu.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/acion_highlight" android:title="@string/highlight" android:showAsAction="always"/&gt; &lt;item android:id="@+id/action_addNote" android:title="@string/addNote" android:showAsAction="always"/&gt; &lt;/menu&gt; So what's wrong?? [EDITED: Add logs in logcat] 05-09 04:47:47.476: D/AndroidRuntime(1120): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit &lt;&lt;&lt;&lt;&lt;&lt; 05-09 04:47:47.476: D/AndroidRuntime(1120): CheckJNI is OFF 05-09 04:47:47.476: D/dalvikvm(1120): Unable to stat classpath element '/system/framework/filterfw.jar' 05-09 04:47:47.480: D/dalvikvm(1120): Trying to load lib libjavacore.so 0x0 05-09 04:47:47.480: D/dalvikvm(1120): Added shared lib libjavacore.so 0x0 05-09 04:47:47.484: D/dalvikvm(1120): Trying to load lib libnativehelper.so 0x0 05-09 04:47:47.488: D/dalvikvm(1120): Added shared lib libnativehelper.so 0x0 05-09 04:47:47.528: D/AndroidRuntime(1120): Calling main entry com.android.commands.pm.Pm 05-09 04:47:47.528: W/ActivityManager(324): No content provider found for permission revoke: file:///data/local/tmp/MyApp.apk 05-09 04:47:47.680: W/ActivityManager(324): No content provider found for permission revoke: file:///data/local/tmp/MyApp.apk 05-09 04:47:47.724: D/dalvikvm(324): GC_CONCURRENT freed 465K, 18% free 12077K/14663K, paused 11ms+1ms, total 27ms 05-09 04:47:47.724: D/dalvikvm(324): WAIT_FOR_CONCURRENT_GC blocked 1ms 05-09 04:47:47.740: D/dalvikvm(324): GC_FOR_ALLOC freed 347K, 20% free 11856K/14663K, paused …

http://stackoverflow.com/a/23531212
answers question: http://stackoverflow.com/q/23531070
has comment: http://stackoverflow.com/comment/36127416
has body: Resize the image to a smaller one, without antialiasing (BufferedImage) and do your own checking: black&amp;white, recognizing lines by avertical column. What else, unfortunately?
score: 0
has comment: http://stackoverflow.com/comment/36101263
type: Answer

http://stackoverflow.com/comment/35994764
comment on: http://stackoverflow.com/q/23476485
score: 0
type: Comment
type: QuestionComment
has text: I would first work out why you are changing the first section of your output. It would appear it shouldn't be changed. Have you tried debugging your code?

http://stackoverflow.com/comment/36213665
type: AnswerComment
has text: I just tried it out myself. I do not get any exceptions. Did you do some fancy stuff to your code in the mean time? Added my code to the answer.
type: Comment
comment on: http://stackoverflow.com/a/23593378
score: 0

http://stackoverflow.com/q/23568114
answer count: 3
tagged with: graphics2d
downvote count: 0
possible better answer: http://stackoverflow.com/a/23568283
favorite count: 0
has answer: http://stackoverflow.com/a/23568375
has answer: http://stackoverflow.com/a/23568524
type: AnsweredQuestion
has title: Converting text to image in Java
upvote count: 3
tagged with: java
has body: I am writing code for a Visual Cryptography project in Java. We want to create two share images for a random token (alphanumeric string), so that when the two images are overlayed the token will be revealed. Now - even before the visual crypto part kicks in, I am trying to figure a way to convert this alphanumeric token into an image, and don't know where to start. Any suggestions? Thanks!
tagged with: cryptoapi
accepted answer: http://stackoverflow.com/a/23568375
type: Question
score: 3
has answer: http://stackoverflow.com/a/23568283

http://stackoverflow.com/q/23554801
tagged with: java
has comment: http://stackoverflow.com/comment/36141782
tagged with: calendar
linked to: http://stackoverflow.com/q/428918
type: Question
has title: Add X hours to a date & time
has answer: http://stackoverflow.com/a/79460015
answer count: 6
tagged with: date
score: 4
has comment: http://stackoverflow.com/comment/85962041
linked to: http://stackoverflow.com/q/3581258
has answer: http://stackoverflow.com/a/79446413
possible better answer: http://stackoverflow.com/a/23555209
downvote count: 1
has answer: http://stackoverflow.com/a/23555209
accepted answer: http://stackoverflow.com/a/23554846
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/36141762
tagged with: time
has answer: http://stackoverflow.com/a/45184656
has body: I am currently fetching the time and date trough: DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); Date date = new Date(); System.out.println(dateFormat.format(date)); This returns the example '05/14/2014 01:10:00' Now I am trying to make it so I can add a hour to this time without having to worry about a new day or month etc. How would I go on getting '05/14/2014 01:10:00' but then for 10 hours later in the same format? Thanks in advance.
has answer: http://stackoverflow.com/a/23554846
has comment: http://stackoverflow.com/comment/36142545
tagged with: forward
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36141812
has answer: http://stackoverflow.com/a/23554899

http://stackoverflow.com/q/23471054
upvote count: 2
type: UnansweredQuestion
tagged with: android-dialog
has comment: http://stackoverflow.com/comment/64905533
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/23471091
type: Question
tagged with: android-layout
downvote count: 0
tagged with: android
answer count: 1
has body: I am showing a custom dialog in an activity of which the orientation is set to landscape. But the orientation is getting changed to portrait mode from the inital landscape(only the dialog, below activity remains in landscape mode). This is happening without any outside action like tilting the tablet or something. I could not find any help in fixing the orientation of dialog anywhere. Any ideas? Dialog mDialog = new Dialog(MainActivity.this); mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); mDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); mDialog.setContentView(R.layout.alert); mDialog.show(); This is the code used for showing the dialog. ------------------------------ --------------------------- This is the xml element parent tag used.
favorite count: 0
has title: Dialog changes the orientation by itself. How to fix the orientation of a dialog to landscape

http://stackoverflow.com/comment/36259572
type: AnswerComment
has text: Can you elaborate on how one might go about ensuring the ActionContext is available and/or how to ensure it's included during DispatcherType.FORWARD operations?
type: Comment
comment on: http://stackoverflow.com/a/23616657
score: 0

http://stackoverflow.com/q/23546298
type: AnsweredQuestion
tagged with: java
type: Question
has title: Invisible HeaderFilter after invoking chain.doFilter()
has body: I have a HeaderFilter containing simple String which I want to add to a servlet's html. When I invoke chain.doFilter(req, resp) in HeaderFilter doFilter() method, the mentioned text is invisible and I thought it could be somehow overwritten? However, when I do not invoke chain.doFilter(req, resp), the text is visible but the rest is not. What is the problem? So that's my code in HeaderFilter class: package com.example; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; public class HeaderFilter implements Filter { private String header = " " + " " + " Header " + " "; private Properties encodings = new Properties(); public void init(FilterConfig fc) throws ServletException { } public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { Locale locale = req.getLocale(); String charset = (String) encodings.get(locale); if (charset == null) charset = "windows-1250"; resp.setContentType("text/html; charset=" + charset); PrintWriter out = resp.getWriter(); out.println(header); chain.doFilter(req, resp); } public void destroy() { } } Not sure if I should post any other code?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23550144
accepted answer: http://stackoverflow.com/a/23550144
tagged with: servlet-filters

http://stackoverflow.com/a/23525950
accepted answer of: http://stackoverflow.com/q/23523334
has body: After printing out my code and tracing my data through the program I discovered my problem. In private void updatePrimer(String dateString) { Calendar calTest = Calendar.getInstance(); calTest.setTime(primer); int day = calTest.get(Calendar.DAY_OF_WEEK); try { primer = simpleFormat.parse(dateString); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println(day); shortString = shortFormat.format(primer); System.out.println(shortString); labelTrip = true; stringTrip = dateString; updateLabels(labelTrip, stringTrip); } the lines : calTest.setTime(primer); int day = calTest.get(Calendar.DAY_OF_WEEK); needed to be moved after the primer = simpleFormat.parse(dateString); try-catch block. My problem was that I was setting the time before setting the date.
answers question: http://stackoverflow.com/q/23523334
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/23573544
has body: From the stacktrace: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'database' Seems that you forgot to change the name of your database. Review your connection String: java:mysql://&lt;server&gt;:&lt;port&gt;/&lt;database_name&gt; ^ change this for a real database in your MySQL server
downvote count: 0
answers question: http://stackoverflow.com/q/23573514
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/23513370
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36068324
has comment: http://stackoverflow.com/comment/36068022
type: Answer
has comment: http://stackoverflow.com/comment/36064495
has comment: http://stackoverflow.com/comment/36068564
has comment: http://stackoverflow.com/comment/36068259
answers question: http://stackoverflow.com/q/23513299
score: 0
has comment: http://stackoverflow.com/comment/36069853
accepted answer of: http://stackoverflow.com/q/23513299
has body: Add a primary key to you table to ensure no duplicate records can be inserted. Else you can also go for Merge statement to avoid duplicates. Example for Merge: http://www.oracle-base.com/articles/9i/merge-statement.php

http://stackoverflow.com/a/23584432
has comment: http://stackoverflow.com/comment/36226785
has comment: http://stackoverflow.com/comment/36203851
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36226643
downvote count: 0
answers question: http://stackoverflow.com/q/23576191
has comment: http://stackoverflow.com/comment/36226594
has comment: http://stackoverflow.com/comment/36225829
has comment: http://stackoverflow.com/comment/36203895
type: Answer
has comment: http://stackoverflow.com/comment/36202334
has comment: http://stackoverflow.com/comment/36200328
has comment: http://stackoverflow.com/comment/36203711
has comment: http://stackoverflow.com/comment/36204400
has comment: http://stackoverflow.com/comment/36226317
has comment: http://stackoverflow.com/comment/36203982
score: 1
has comment: http://stackoverflow.com/comment/36221354
upvote count: 1
has comment: http://stackoverflow.com/comment/36226560
has comment: http://stackoverflow.com/comment/36202274
has body: First I'm going to remove all of the I/O (except for outputting the result), get rid of the decryption piece for brevity, and write encrypt(String) and encrypt(char) as pure functions. public class EncryptionMain { public static void main(String args[]){ System.out.println(encrypt("Hello")); } static String encrypt(String plaintext) { StringBuilder ciphertext = new StringBuilder(plaintext); for (int i = 0; i &lt; ciphertext.length(); i++) { ciphertext.setCharAt(i, encrypt(ciphertext.charAt(i))); } return ciphertext.toString(); } static char encrypt(char c) { int switchInc = 1; // 0 = BACK 1 = FORWARD for(int e = 0; e &lt; 1000; e++){ if (c == '!') { switchInc = 1; } else if (c == '~') { switchInc = 0; } switch (switchInc) { case 0: c--; break; default: c++; break; } } return c; } } And, whoops! - just by doing that, I accidentally fixed the bug. Here, I'll add it back: public class EncryptionMain { public static void main(String args[]){ System.out.println(encrypt("Hello")); } static String encrypt(String plaintext) { StringBuilder ciphertext = new StringBuilder(plaintext); for (int i = 0; i &lt; ciphertext.length(); i++) { ciphertext.setCharAt(i, encrypt(ciphertext.charAt(i))); } return ciphertext.toString(); } static int switchInc = 1; // 0 = BACK 1 = FORWARD static char encrypt(char c) { for(int e = 0; e &lt; 1000; e++){ if (c == '!') { switchInc = 1; } else if (c == '~') { switchInc = 0; } switch (switchInc) { case 0: c--; break; default: c++; break; } } return c; } } Edit - Here's a working Caesar cipher I referred to in the comments below. main/cipher/Cipher.java package cipher; public final class Cipher { public Cipher(Range range, int key) { this.range = range; this.key = key; } public final Range range; public final int key; public String encrypt(String plaintext) { return cipher(plaintext, key); } public String decrypt(String ciphertext) { return cipher(ciphertext, -key); } String cipher(String in, int n) { StringBuilder out = new StringBuilder(in.length()…
accepted answer of: http://stackoverflow.com/q/23576191
has comment: http://stackoverflow.com/comment/36204142
has comment: http://stackoverflow.com/comment/36200096

http://stackoverflow.com/q/23534366
tagged with: java
has body: i have one native select branchStateSelect: branchStateSelect = new NativeSelect("State:"); branchStateSelect.setImmediate(true); branchStateSelect.setWidth(COMMON_FIELD_WIDTH); branchStateSelect.setRequired(true); branchStateSelect.setNullSelectionItemId(0); branchStateSelect.setItemCaption(0, "--Select--"); branchStateSelect.addValueChangeListener(fetchCityListener); and there is another native select : this is binded to a fieldgroup communicationAddressStateSelect = new NativeSelect("State:"); communicationAddressStateSelect.setRequired(true); communicationAddressStateSelect.setImmediate(true); communicationAddressStateSelect.setNullSelectionAllowed(true); communicationAddressStateSelect.setWidth(COMMON_FIELD_WIDTH); communicationAddressStateSelect.setEnabled(false); and the city listener for state select : private ValueChangeListener fetchCityListener = new ValueChangeListener() { public void valueChange(ValueChangeEvent event) { if (event.getProperty().getValue() == null) { //do nothing } else{ communicationAddressStateSelect.setNullSelectionItemId(0l communicationAddressStateSelect.setItemCaption(0l, "state1"); communicationAddressStateSelect.select(0l); } } }} } }; when I select branchstateselect native select the value in the communicationAddressStateSelect is populated but value binded to the fieldgroup is null???? why>?>>> I want value 0L to be binded... what is the error
type: Question
has comment: http://stackoverflow.com/comment/36144706
score: 0
has comment: http://stackoverflow.com/comment/36117227
has title: why value in a native select not binding to the fieldgroup vaadin
answer count: 0
type: UnansweredQuestion
tagged with: vaadin7

http://stackoverflow.com/comment/35994192
type: QuestionComment
has text: @assylias the "length" of an int is the number of its digits in this case !
score: 0
comment on: http://stackoverflow.com/q/23476052
type: Comment

http://stackoverflow.com/a/24469656
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23588733
downvote count: 0
has body: I had faced the same issue. The text disappears on Nexus 7 & Nexus 10. Scenario in which the bug occurred: Use the following layout. Set text to the textView on the click of the button. <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="TextView" /> To fix the issue, you could either switch from TableLayout to LinearLayout or set width for your buttons. This was what worked for me.

http://stackoverflow.com/q/23610680
tagged with: date
score: 0
has title: Difference of time in milliseconds?
type: UnansweredQuestion
tagged with: datetime
tagged with: timestamp
has comment: http://stackoverflow.com/comment/36246074
has answer: http://stackoverflow.com/a/23612807
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36246612
type: Question
has comment: http://stackoverflow.com/comment/36247114
has body: jsp code: String activationkey=request.getParameter("activationkey"); System.out.println("key is=="+activationkey); CustinfoDao custinfoDao = new CustinfoDaoImpl(); CustomerInfo cust=custinfoDao.getDateByActivationKey(activationkey); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); //get current date time with Date() Date date = new Date(); Date d1=new Date(); System.out.println("d1================="+d1.getTime()); Date d2= cust.getCreatedDate(); System.out.println("d2================="+d2.getTime()); long d3=d1.getTime() - d2.getTime(); System.out.println("d3 is =="+d3); long diffHours = TimeUnit.MILLISECONDS.toHours(d3); System.out.println("diff in hours=="+diffHours); System.out.println("diff in hours=="+(diffHours<48)); if(diffHours < 48){ %> <% } else{ %> Your Link has been Expired.... <% } %> Output: key is==L2NWL49fx5 d1=================1399901683076 d2=================1399833000000 d3 is ==68683076 diff in hours==19 diff in hours==true I want to get the difference of time in hours between the current date and the date on which user had registered through a form and want to expire the link if the difference is geater than 48 hours or else want to execute other block of code.but i am not able to get exact time difference.Any help would be appreaciated.
answer count: 2
has answer: http://stackoverflow.com/a/23611120

http://stackoverflow.com/comment/35980942
type: Comment
has text: have a look at [this][1] [1]: http://stackoverflow.com/a/2843371/2764279
comment on: http://stackoverflow.com/q/23469071
score: 0
type: QuestionComment

http://stackoverflow.com/q/23554775
score: 0
has title: Constructor in Monster cannot be applied to given types
answer count: 1
has body: I am trying to make the code work by only changing the last line of the code. But it gives me an error before I even get to that part. Monster munster= new Monster(“Herman”); Object myObj = munster; Monster myMonster = myObj; // need to modify this line so that it works.
type: UnansweredQuestion
tagged with: object
has answer: http://stackoverflow.com/a/23554789
tagged with: java
type: Question

http://stackoverflow.com/comment/36054126
type: AnswerComment
score: 0
has text: Thanks for these tips. The problem I tried to reduce to the one above, handles a List of `Player`-Objects from whom one gets stored in a `Player::currentPlayer`field. The API provides a getter for the `currentPlayer` that returns a `Player` object and a getter for the player list, that returns the list as a stream. `players.stream()`. After a Player has done his moves, the next one in the list has to be set as the currentPlayer (round robin) and I don't know how to get access to the successor. My only idea was an iterator.
type: Comment
comment on: http://stackoverflow.com/a/23507958

eclipse
tags question: http://stackoverflow.com/q/23598003
tags question: http://stackoverflow.com/q/23492452
tags question: http://stackoverflow.com/q/23453048
tag name: eclipse
tags question: http://stackoverflow.com/q/23537013
tags question: http://stackoverflow.com/q/23492764
tags question: http://stackoverflow.com/q/23582268
tags question: http://stackoverflow.com/q/23477380
tags question: http://stackoverflow.com/q/23498173
tags question: http://stackoverflow.com/q/23455654
tags question: http://stackoverflow.com/q/23602001
tags question: http://stackoverflow.com/q/23505348
tags question: http://stackoverflow.com/q/23576558
tags question: http://stackoverflow.com/q/23602954
tags question: http://stackoverflow.com/q/23529230
tags question: http://stackoverflow.com/q/23530191
tags question: http://stackoverflow.com/q/23516144
tags question: http://stackoverflow.com/q/23557136
tags question: http://stackoverflow.com/q/23610639
tags question: http://stackoverflow.com/q/23468553
tags question: http://stackoverflow.com/q/23499180
tags question: http://stackoverflow.com/q/23591731
tags question: http://stackoverflow.com/q/23599058
tags question: http://stackoverflow.com/q/23459568
tags question: http://stackoverflow.com/q/23526240
tags question: http://stackoverflow.com/q/23487906
tags question: http://stackoverflow.com/q/23588707
tags question: http://stackoverflow.com/q/23475648
tags question: http://stackoverflow.com/q/23513165
tags question: http://stackoverflow.com/q/23471546
tags question: http://stackoverflow.com/q/23584443
tags question: http://stackoverflow.com/q/23465956
tags question: http://stackoverflow.com/q/23511243
tags question: http://stackoverflow.com/q/23532966
tags question: http://stackoverflow.com/q/23525119
tags question: http://stackoverflow.com/q/23594282
tags question: http://stackoverflow.com/q/23615057
tags question: http://stackoverflow.com/q/23524350
tags question: http://stackoverflow.com/q/23482281
tags question: http://stackoverflow.com/q/23543482
tags question: http://stackoverflow.com/q/23520931
tags question: http://stackoverflow.com/q/23609258
tags question: http://stackoverflow.com/q/23503381
tags question: http://stackoverflow.com/q/23495420
tags question: http://stackoverflow.com/q/23506314
tags question: http://stackoverflow.com/q/23474673
tags question: http://stackoverflow.com/q/23515489
tags question: http://stackoverflow.com/q/23599658
tags question: http://stackoverflow.com/q/23583011
tags question: http://stackoverflow.com/q/23575455
tags question: http://stackoverflow.com/q/23541525
tags question: http://stackoverflow.com/q/23487853
tags question: http://stackoverflow.com/q/23516624
tags question: http://stackoverflow.com/q/23480121
tags question: http://stackoverflow.com/q/23509979
tags question: http://stackoverflow.com/q/23490556
tags question: http://stackoverflow.com/q/23523169
tags question: http://stackoverflow.com/q/23525545
tags question: http://stackoverflow.com/q/23615024
tags question: http://stackoverflow.com/q/23503258
tags question: http://stackoverflow.com/q/23552584
tags question: http://stackoverflow.com/q/23495247
tags question: http://stackoverflow.com/q/23615275
tags question: http://stackoverflow.com/q/23466959
tags question: http://stackoverflow.com/q/23590093
tags question: http://stackoverflow.com/q/23538620
tags question: http://stackoverflow.com/q/23554803
tags question: http://stackoverflow.com/q/23512174
tags question: http://stackoverflow.com/q/23541532
tags question: http://stackoverflow.com/q/23527278
tags question: http://stackoverflow.com/q/23592300
tags question: http://stackoverflow.com/q/23530157
tags question: http://stackoverflow.com/q/23551605
tags question: http://stackoverflow.com/q/23525166
tags question: http://stackoverflow.com/q/23460208
tags question: http://stackoverflow.com/q/23470476
tags question: http://stackoverflow.com/q/23599610
tags question: http://stackoverflow.com/q/23514726
tags question: http://stackoverflow.com/q/23456295
tags question: http://stackoverflow.com/q/23455516

http://stackoverflow.com/a/23546986
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/36126882
answers question: http://stackoverflow.com/q/23546500
has body: Use Interfaces and factory pattern Create a class to hold the values ( R,L,C) public class RLCHolder { double rValue; double lValue; double cValue; //Setter and Getters } Create an Interface public interface CircuitCalculator { public double calculate(RLCHolder rlcHolder); } Now implement the Interface public class RLCCircuitCalculator implements CircuitCalculator { @Override public double calculate(RLCHolder rlcHolder) { // Do you Math and Return return 0; } } Like this add your implementation for other Circuits like. LCCircuitCalculator , RCCircuitCalculator and so Now create Factory method and call the calculate method public class Calculator { // factory method public static CircuitCalculator getCircuitCalculator(String circuitName){ CircuitCalculator circuitCalculator = null; if (circuitName.equals("RLC")){ circuitCalculator = new RLCCircuitCalculator(); // You can cache if you dont maintain state }else if (circuitName.equals("LC")){ // return LC object }//add your implementation.. return circuitCalculator; } public static void main(String args[]){ RLCHolder rlcHolder = new RLCHolder(); double result = Calculator.getCircuitCalculator("RLC").calculate(rlcHolder); } }
score: 2
downvote count: 0

http://stackoverflow.com/comment/36234041
type: Comment
score: 0
type: AnswerComment
has text: my table caption is `<display:caption media="excel [mymedia]"> <s:div cssClass="caption_head">Campaign Summary Range Hourly From &nbsp;<s:property value="startDateTime"/>&nbsp;&nbsp;To&nbsp;<s:property value="endDateTime"/> </s:div> </display:caption>` now in excel file html tags is also shown how can i edit so that only text will appear on excel file
comment on: http://stackoverflow.com/a/23537742

http://stackoverflow.com/a/23502493
answers question: http://stackoverflow.com/q/23502367
has comment: http://stackoverflow.com/comment/36043793
has comment: http://stackoverflow.com/comment/36043960
has body: Based on the code you show, the only place where you set name, age, or address is in the constructor to StaffInformation. But you also never instantiate StaffInformation, so all the fields in Model are left as their default values -- 0, null, and null, respectively.
type: Answer
score: 0

http://stackoverflow.com/a/23563967
has body: Try the below one. String[] result = string.split(" &amp; | / "); Hopes this helps.
answers question: http://stackoverflow.com/q/23563826
score: 0
type: Answer

http://stackoverflow.com/comment/35977410
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23466744
has text: @ThoQLuong, That is related to an earlier question. He was trying to put an `int` into two bytes.

http://stackoverflow.com/a/23474342
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23474192
type: Answer
downvote count: 0
score: 3
has body: Since Java 8 you can obtain the name of method argument. To do that you will have to compile your code with option -parameters. Then form instance of [Executable] class (Method or Constructor) you can use method getParameters() to obtain array of Parameter instances. The method getName() will resolve you the names. private void example(Class&lt;?&gt; type) { for(Method method : type.getMethods()){ for(Parameter parameter : getParameters()) { System.out.println("%s",parameger.getName()); } } }
accepted answer of: http://stackoverflow.com/q/23474192

http://stackoverflow.com/a/26544437
has body: Use Fast-MPJ or any other mpi in java which gives infinband device layer support. open-mpi was expected to release openMPI for java recently.
upvote count: 1
answers question: http://stackoverflow.com/q/23465538
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/36136765
type: Comment
type: QuestionComment
has text: No it didn't fix the problem though, that was for something else.
score: 0
comment on: http://stackoverflow.com/q/23548625

http://stackoverflow.com/a/23517195
answers question: http://stackoverflow.com/q/23517126
score: -1
has body: You cant access variables in declared inside other methods. To make it work, you would have to do this: public class TrialArray { int[][] dataStorage; public static void main(String [] args) { dataStorage = new int[5][5]; arrayTest(); arrayTest2(dataStorage); } public static void arrayTest() { dataStorage[1][2] = 1; System.out.printf("THIS PART WORKS"); } public static void arrayTest2(int[][] dataStorage) { dataStorage[2][2] = 3; System.out.printf("THIS DOESNT"); } }
downvote count: 1
type: Answer
upvote count: 0

http://stackoverflow.com/comment/36024344
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23492233
has text: surendhar, have you tried using ${requestScope.resultEmployeeList}

clientbundle
tags question: http://stackoverflow.com/q/23603234
tag name: clientbundle
type: Tag

http://stackoverflow.com/comment/36057288
comment on: http://stackoverflow.com/q/23509060
has text: but i all-ready try using AsyncTask,AsyncTaskLoader,Runnable,Thread class but not any improvement and when i launch application first time on device then work proper with expected result but second time it skipped frame there is any garbage collection issue?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36229534
score: 0
type: Comment
type: QuestionComment
has text: "what is this Object[] really means". Nothing special, it means same as any other array i.e. String[], Integer[] etc. A contiguos memory allocation of a specific type.
comment on: http://stackoverflow.com/q/23601916

http://stackoverflow.com/comment/36126825
comment on: http://stackoverflow.com/q/23530749
score: 0
type: Comment
type: QuestionComment
has text: I followed those steps exactly and it still is not working. Does this actually work for you?

http://stackoverflow.com/comment/35982057
has text: Okay! I created a Classpath variable under system variables in Environment Variables for mypack as: D\P\Notes, now the packDemo.java gets compiled, but while trying to execute it i again get an error that says: Could not find or load main class packDemo
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23469032

http://stackoverflow.com/a/23584151
downvote count: 1
has comment: http://stackoverflow.com/comment/103612489
has comment: http://stackoverflow.com/comment/36198739
type: Answer
answers question: http://stackoverflow.com/q/23478649
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/36463552
has body: I just ran into the same issue. I'm doing something very similar to what you are doing. What I noticed was that the first time I ran the client program, and it failed ( by design of the firewall test ) - that it failed with an error message showing the actual ip address of the host that I originally specified ( the 192.168.x.x address ), but all subsequent failures show that it is failing to make a connection to 127.0.0.1. Currently I'm suspecting some kind of caching on the client - has the JVM marked that ip address as never accessible again and it's refusing to ever try to connect to it again? UPDATE: In my case, the JVM on the RMI Server side was not able to properly set the java.rmi.server.hostname property at JVM startup. This property was being left as null. When clients connect to a specific RMI Registry and ask for a stub to a particular named object, they receive a stub containing the ip address of the remote machine where the actual object can be found. The RMI server copies the contents of the java.rmi.server.hostname property into the stubs it returns to clients, so if the java.rmi.server.hostname property is "" and it copies that to each stub it creates, each stub contains a reference to remote server with an IP address of "". By default the client jvm reacts to this by attempting to connect to the server object on the localhost, 127.0.0.1. To work around the problem, try this line of code before exporting any remote objects on the server side: System.setProperty( "java.rmi.server.hostname", "192.168.RMIServer.IP" ) ; This property will be automatically copied to all remote stubs exported on that server, and clients who receive that stub should then be able to reach the remote server ( assuming any firewalls are configured correctly ).

http://stackoverflow.com/comment/36072308
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23513418
type: Comment
has text: I think i got the wrong name :) it should be authenticationprovider. I have modified the answer.

http://stackoverflow.com/a/23468463
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23468261
has body: This is a Visitor Pattern First you need a Visitor public class PacketVisitor { void visit(NewClientPacket packet); void visit(DisconnectPacket packet); void visit(DataPacket packet); } Then you need to add a method to your interface Packet: interface Packet { void accept(PacketVisitor visitor); } Now in each Packet you need to implement this method: public class NewClientPacket implements Packet { @Override public void accept(PacketVisitor visitor) { visitor.visit(this); } } Finally in your service code: final PacketVisitor visitor = new PacketVisitor() { //implementation... } final Packet packet = (Packet) myStream.readObject(); packet.accept(visitor); What will happen is that the relevant visit method of the PacketVisitor will be called as the instance of Packet calls visit on the PacketVisitor.
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/23487772
answers question: http://stackoverflow.com/q/23487257
has comment: http://stackoverflow.com/comment/36049297
downvote count: 0
score: 3
type: Answer
has body: Enable the GWT Developer Plugin in Chrome. Check for other plugin that is installed on Chrome. Click on plugins for other systems to get more GWT Developer plugins. Here is the URL for GWT missing-plugin. Click on required GWT plugin and simply click on save button as shown below for IE9.
upvote count: 3

http://stackoverflow.com/comment/36041599
type: QuestionComment
has text: @PeterLawrey [My current phone](http://www.lg.com/us/cell-phones/lg-VN270-cosmos-touch) takes offense at your dig against old phones! (Though I wouldn't expect to play games on it at anything faster than 30 seconds per frame).
type: Comment
comment on: http://stackoverflow.com/q/23500383
score: 2

http://stackoverflow.com/q/23521442
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: .smali invoke-virtual & invoke-super
type: Question
has comment: http://stackoverflow.com/comment/36079293
has body: I am trying to generate a call graph based on .smali file. However, I encountered a confusing case as follow: .super Landroid/graphics/drawable/Drawable; .source "SBarExp.java" .method public final setBounds(Landroid/graphics/Rect;)V .line 514 iget-object v2, p0, Lcom/sds/android/ttpod/app/modules/skin/view/SeekBarExpansion$a;->b:Landroid/graphics/drawable/Drawable; invoke-virtual {v2, p1, v0, p3, v1}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V .line 515 invoke-super {p0, p1, v0, p3, v1}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V .end method Based on my understanding, invoke-super simply means it is going to call a parent method, so invoke-super {p0, p1, v0, p3, v1}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V can be interpreted as Landroid/graphics/drawable/Drawable;->setBounds(IIII)V ? If yes, I would like to know if invoke-virtual {v2, p1, v0, p3, v1}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V is the same as invoke-super {p0, p1, v0, p3, v1}, Landroid/graphics/drawable/Drawable;->setBounds(IIII)V? If not, what is the difference? If yes, why is it invoking the same method twice (using different ways)? Please help, many thanks!
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36080062
has answer: http://stackoverflow.com/a/23526336
favorite count: 0
tagged with: android
tagged with: smali
accepted answer: http://stackoverflow.com/a/23526336

http://stackoverflow.com/a/23501305
downvote count: 0
score: 1
has body: This is not practical without great pains. While you could define your high level API's to work with wrapper types (e.g. use Number instead of a specific type and have multiple implementations of the API that uses Float or Double under the hood), chances are that the wrappers will eat more performance than you can ever gain by selecting a less precise type. You could define high level objects as interfaces (e.g. Polygon etc.) and hide their actual data representation in the implementation. That means you will have to maintain two implementations, one using float and one for double. It probably requires considerable code duplication. Personally, I think you are attempting to solve a non-existant conundrum. Either you need double precision, then float isn't an option, or float is "good enough", then there is no advantage of ever using double. Simply use the smallest type that fits the requirements. Especially for a game float/double should make little difference. Its unlikely you spend that much time in math (in java code) - most likely your graphics will determine how fast you can go. Generally use float and only switch to double for parts where you need the precision and the question disappears.
answers question: http://stackoverflow.com/q/23500383
upvote count: 1
type: Answer

http://stackoverflow.com/a/23500829
has body: Yes. The code you mentioned will work. Casting of objects will always work if the original object is an instance of what it is being cast to. Since you've already checked whether o is an instance of Rectangle, no problems here. I'm more concerned with what you would do with Rectangle r. The scope of variable r is entirely within the innermost if() statement. Thus, if you would like to access r outside if (o instanceof Rectangle), that is not possible unless you declare it outside the if statement.
type: Answer
answers question: http://stackoverflow.com/q/23500709
score: 0

http://stackoverflow.com/a/33775470
answers question: http://stackoverflow.com/q/23471185
score: 0
type: Answer
has body: Assuming you (could) instantiate the controller by hand/guice and not from the FXML, you could use https://github.com/google/guice/wiki/AssistedInject if you need to pass any non DIable parameter to the constructor. You would then set the controller manually to the FXMLLoader with .setController(this) and load the FXML file in the constructor of the controller. Not sure if there are any drawbacks, but this kind of system seems to work for me :)

http://stackoverflow.com/comment/36206952
comment on: http://stackoverflow.com/a/23589523
has text: At beginning, I thought as each UUID value is unique, why not implement each value as a singleton.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36147988
comment on: http://stackoverflow.com/a/23557076
score: 0
type: AnswerComment
type: Comment
has text: @LuiggiMendoza pg.jar

http://stackoverflow.com/a/23607267
has body: Make the constructor public. public Checkerboard() { ... } The error appears because the constructor is package-private, e.g. you can't instantiate the class outside it's package.
score: 2
has comment: http://stackoverflow.com/comment/36240561
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36241040
accepted answer of: http://stackoverflow.com/q/23607224
has comment: http://stackoverflow.com/comment/36240383
answers question: http://stackoverflow.com/q/23607224
upvote count: 2
type: Answer

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/23481234
tag name: bytecode-manipulation
tags question: http://stackoverflow.com/q/23558106

http://stackoverflow.com/q/23474815
type: Question
tagged with: java
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35991811
has title: How does hot deploy relate with classloading?
tagged with: osgi
type: UnansweredQuestion
tagged with: dynamic-class-loaders
has body: I am reading good presentation about classloading and OSGI. But I have misunderstanding with following phrase: • For example: What app/web servers do for hot deployment it is slide #17 from this presentation screen from slide: Please clarify this.
tagged with: hotdeploy
tagged with: classloader
has answer: http://stackoverflow.com/a/23474979

http://stackoverflow.com/comment/36169488
comment on: http://stackoverflow.com/a/23569981
type: Comment
score: 0
type: AnswerComment
has text: Add ` a` to the end of your parse format string to start parsing `AM/PM`

http://stackoverflow.com/comment/36064518
has text: Check my original post, I added the query
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23512760

http://stackoverflow.com/a/23661163
accepted answer of: http://stackoverflow.com/q/23537963
answers question: http://stackoverflow.com/q/23537963
type: AcceptedAnswer
score: 0
has body: I solved the problem reading the norm at index time with: searcher.getIndexReader().norms(field);
type: Answer

http://stackoverflow.com/a/23468439
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23468264
answers question: http://stackoverflow.com/q/23468264
upvote count: 2
has comment: http://stackoverflow.com/comment/35979951
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35980257
has body: This asks for a Comparator with your Custom Class. http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html Make a new class that implements Comparator and implement this method: public class YourComparator&lt;CustomClass&gt; implements Comparator{ @Override public int compare ( CustomClass obj1, CustomClass obj2 ) { return (int) (obj1.getYourProperty() - obj2.getYourProperty()); } } Use it: Collections.sort(MyFinalList, new YourComparator());

http://stackoverflow.com/q/23552822
type: UnansweredQuestion
tagged with: java
has title: Trouble deploying web application with native library
type: Question
tagged with: java-native-interface
score: 0
linked to: http://stackoverflow.com/q/16728586
has body: I'm creating a simple web application in java servlet which need to call some C code through jni. The application have already run properly on localhost, but I have some troubles deploy it on the server. After I made the war file and deploy it on the server. I always got these errors. java.lang.NoClassDefFoundError: Could not initialize class demoServlet.doPost(demoServlet.java:55) demoServlet.doGet(demoServlet.java:36) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) Here is what I have been tried: 1. scp my local lib.so to server 2. export server's LD_LIBRARY_PATH to the lib.so path. But still I got this error from the web application, I'm sensing it's the reason I did'n configure my native library path well. I have tried block the static{System.loadLibrary("");} and the application can go through the initialization process. Please help
tagged with: loadlibrary
has comment: http://stackoverflow.com/comment/36204799
has comment: http://stackoverflow.com/comment/36356886
answer count: 0

http://stackoverflow.com/q/23535133
tagged with: java
tagged with: class
has answer: http://stackoverflow.com/a/23535245
has comment: http://stackoverflow.com/comment/36104895
score: 0
has answer: http://stackoverflow.com/a/23535902
answer count: 3
has comment: http://stackoverflow.com/comment/36105105
has comment: http://stackoverflow.com/comment/36104874
has answer: http://stackoverflow.com/a/23535336
has title: Java class inside other class, constructor
has comment: http://stackoverflow.com/comment/36105051
has body: I would like to create one class and then another class inside. This class will be directly connected with superior class. It should look like following (not code, just schema): class company string name class employee string firstName, lastName; int age Of course, I have constructors etc. Now I want to create company 'g' and employee f m of age 2 inside of that company. Maybe it is not justified to make class inside another class and I should just create class employee with field company? Code below does not work, compiler says: an enclosing instance that contains company.employee is required nowa=new company('g',2); nowa.prac=new company.employee('f','m',2); Full code below: public class program { public static class company { char name; int duration; public class employee { public char imie,nazwisko; public int wiek; public employee(char a,char b,int w) { imie=a; nazwisko=b; wiek=w; } } public company(char n,int c) { name=n; duration=c; } } public static void main(String []args) { company nowa=new company('g',2); nowa.empl=new employee('f','m',2); } }
type: UnansweredQuestion
type: Question
tagged with: object
linked to: http://stackoverflow.com/q/4070716

http://stackoverflow.com/comment/36017853
score: 0
type: Comment
has text: Thank you for the different answers, I think the suggestion of Peter Lawrey was exactly what I needed. With the help of EMMA I can create a code coverage report in Eclipse and export it as a .xml file. If I now look for methods with coverage > 0 the executed ones will be shown. Additionally it seems like only custom created methods (like I asked for in the initial post) will be presented in the report. So thank you again Mr. Lawrey.
type: QuestionComment
comment on: http://stackoverflow.com/q/23469033

http://stackoverflow.com/comment/35971075
type: Comment
has text: You're right, who needs complicated strange bit shifty functions when you could just use [xkcd's?](http://xkcd.com/221/) It's much more random.
comment on: http://stackoverflow.com/a/23463425
type: AnswerComment
score: 0

http://stackoverflow.com/a/23490049
score: 1
has body: As I found out, it was a maven resolution problem. The swagger lib 1.3.4 uses jersey-core-1.3 and jersey-server-1.3, which has been chosen by maven. Instead, I needed it in 1.17 like the jersey-servlet and jersey-multipart version. So I had to add those two dependencies to the pom to make the maven dependency resolution use 1.17 over 1.13.
has comment: http://stackoverflow.com/comment/42088042
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42063197
type: Answer
accepted answer of: http://stackoverflow.com/q/23489066
downvote count: 0
answers question: http://stackoverflow.com/q/23489066

http://stackoverflow.com/q/23474984
has comment: http://stackoverflow.com/comment/35994310
has answer: http://stackoverflow.com/a/23476519
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35991975
tagged with: java
accepted answer: http://stackoverflow.com/a/23476519
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35995006
has comment: http://stackoverflow.com/comment/35993754
type: Question
has answer: http://stackoverflow.com/a/23475195
answer count: 2
has comment: http://stackoverflow.com/comment/35994352
has comment: http://stackoverflow.com/comment/36000498
has comment: http://stackoverflow.com/comment/36002658
tagged with: arrays
has comment: http://stackoverflow.com/comment/35995263
has comment: http://stackoverflow.com/comment/35994085
has title: 2D Array with variable size
has comment: http://stackoverflow.com/comment/35992032
possible better answer: http://stackoverflow.com/a/23475195
has body: What I'm trying to accomplish is have something like String[][] array = new String[sizeX][sizeY] SizeX would be based on the length of a root JSON array, and sizeY based on the length of an array inside the root JSON array. Thinking about it, I could use a single array of arrays, but I'm not sure how I'd reference the internal array to get information back from it. For example: String[] array = new String[sizeX]; array[i] = new String[sizeY]; // initialized to variable size of JSON From here, how would I reference the internal array the objects in the internal array? The JSON {"23591778": { "pages": [ { "masteries": [ { "id": 4211, "rank": 2 }, { "id": 4214, "rank": 2 }, { "id": 4134, "rank": 3 }, { "id": 4124, "rank": 1 }, { "id": 4114, "rank": 1 }, { "id": 4222, "rank": 3 }, { "id": 4112, "rank": 4 }, { "id": 4221, "rank": 1 }, { "id": 4144, "rank": 1 }, { "id": 4122, "rank": 3 }, { "id": 4152, "rank": 3 }, { "id": 4141, "rank": 1 }, { "id": 4111, "rank": 1 }, { "id": 4132, "rank": 1 }, { "id": 4232, "rank": 1 }, { "id": 4162, "rank": 1 }, { "id": 4131, "rank": 1 } ], "id": 34787712, "name": "Blind", "current": false }, { "masteries": [ { "id": 4212, "rank": 2 }, { "id": 4233, "rank": 3 }, { "id": 4242, "rank": 1 }, { "id": 4214, "rank": 2 }, { "id": 4114, "rank": 1 }, { "id": 4251, "rank": 1 }, { "id": 4112, "rank": 4 }, { "id": 4222, "rank": 3 }, { "id": 4122, "rank": 3 }, { "id": 4262, "rank": 1 }, { "id": 4224, "rank": 1 }, { "id": 4252, "rank": 3 }, { "id": 4132, "rank": 1 }, { "id": 4241, "rank": 3 }, { "id": 4232, "rank": 1 } ], "id": 34787713, "name": "AD/Tank Jungle", "current": false }, { "masteries": [ { "id": 4242, "rank": 1 }, { "id": 4233, "rank": 3 }, { "id": 4243, "rank": 1 }, { "id": 4211, "rank": 2 }, { "id": 4214, "rank": 2 }, { "id": 4213, "rank": 2 }, { "id": 4114, "rank": 1 }, { "id": 4252, "rank": 2 }, { "id": 4222, "rank": 3 }, { "id": 4113, "rank": 4 }, { "id": 4221, "rank": 1 }, { "id": 4123, "rank": 3 }, { "id": 4262, "rank": 1 }, { "id"…
score: 0

http://stackoverflow.com/a/23514752
answers question: http://stackoverflow.com/q/23514525
has body: reflect can help. see the code blow : String obj = "abc"; String methodName = "toString"; try { Method method = obj.getClass().getMethod("toString"); System.out.println(method.invoke(obj)); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } we have a obj, and given a method, we can run this method on that object. And, you can also consider define a interface, and all your objects in the list implements the interface. and iterate the list, call those methods which defined in the interface.
has comment: http://stackoverflow.com/comment/36066019
type: Answer
has comment: http://stackoverflow.com/comment/36065884
upvote count: 2
score: 1
downvote count: 1

http://stackoverflow.com/a/23550542
type: Answer
has body: super.method() will let you call "method()" in the superclass, if you are overriding method() in the subclass. It's not a question of what you can access with super, but what methods you can override in a subclass: public protected default (no qualifier) IF the subclass is in the same package as the superclass. And only if the method isn't final.
answers question: http://stackoverflow.com/q/23550456
accepted answer of: http://stackoverflow.com/q/23550456
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/23602916
accepted answer of: http://stackoverflow.com/q/23598288
score: 1
answers question: http://stackoverflow.com/q/23598288
upvote count: 1
has body: If you are using Glassfish 4, @WebServiceRef annotation does not work properly on servlets and filters. This is filed under GLASSFISH-20740. Check this thread. HTH
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36237402
type: Answer
has comment: http://stackoverflow.com/comment/36236796
downvote count: 0

http://stackoverflow.com/q/23611400
type: Question
tagged with: graph
tagged with: data-structures
has body: I have been trying to implement simple graphs (Directed/Undirected+Weighted/Unweighted) as an adjacency list as a part of my data structures course project, and I couldn't get the delete method to work except if I used instanceof for every type(Vertex, Edge, and GraphNode). I have equals method implemented in every class, but the delete method does not call them by default, I have to down cast before doing that. Here is the code for this method: public void delete(T data) { if(!isEmpty()) { if(data instanceof Edge) { Edge edge = (Edge)data; Node&lt;T&gt; temp = head; while(temp != null) { if(edge.equals((Edge)head.data)) { deleteHead(); return; } else if(edge.equals((Edge)tail.data)) { deleteTail(); return; } else { while(temp != null) { if(edge.equals((Edge)temp.data)) { (temp.previous).next = temp.next; (temp.next).previous = temp.previous; return; } temp = temp.next; } } } } if(data instanceof Vertex) { Vertex vertex = (Vertex)data; Node&lt;T&gt; temp = head; while(temp != null) { if(vertex.equals((Vertex)head.data)) { deleteHead(); return; } else if(vertex.equals((Vertex)tail.data)) { deleteTail(); return; } else { while(temp != null) { if(vertex.equals((Vertex)temp.data)) { (temp.previous).next = temp.next; (temp.next).previous = temp.previous; return; } temp = temp.next; } } } } if(data instanceof GraphNode) { GraphNode gn = (GraphNode)data; Node&lt;T&gt; temp = head; while(temp != null) { if(gn.equals((GraphNode)head.data)) { deleteHead(); return; } else if(gn.equals((GraphNode)tail.data)) { deleteTail(); return; } else { while(temp != null) { if(gn.equals((GraphNode)temp.data)) { (temp.previous).next = temp.next; (temp.next).previous = temp.previous; return; } temp = temp.next; } } } } if(data.equals(head.data)) { deleteHead(); return; } else if(data.equals(tail.data)) { deleteTail(); return; } Node&lt;T&gt; current = head; while(current != null) { if(current.data.equals(data)) { current = current.next; current.previous = current; return; } current = current…
score: 0
tagged with: adjacency-list
has comment: http://stackoverflow.com/comment/36248229
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36248686
has title: Delete method in Doubly Linked List when implementing graphs as an adjacency list
has comment: http://stackoverflow.com/comment/36253406

http://stackoverflow.com/q/23595594
score: 0
has comment: http://stackoverflow.com/comment/36219281
accepted answer: http://stackoverflow.com/a/27816220
tagged with: java
has body: I'm currently working on a school project and it requires some JPA. I'm not exactly an expert in this, so I thought I might ask you guys for some help. It's a Maven project in NetBeans IDE, more specifically a Java Web application. I used a MySql database. I've got a situation where I have to check if a certain User is registered as a Guest for a Presentation. Now I would like to retrieve a list of Presentations for a certain Date where the Guest is registered for, so that i can check if none of those overlap. It's as follows: A Presentation has an owner (Student) and a List of Users (Guests) who will attend this presentation. A Presentation also has a Date and a Time. I configured it like this: Date has TimeSlots (d.slots) and is either a Presentation or EmptyTime, a Presentation has a List of Guests (p.inschrijvingen) (and a guest has a username: i.useName) but the superclass (TimeSlot) does not! So in some way I have to cast it to Presentation, since all the TimeSlot objects from d.slots are not all Presentations Now this was just some background, the problem itself is the query: em.createQuery("SELECT p FROM Datum d JOIN TREAT(d.slots as Presentatie) p JOIN p.inschrijvingen i WHERE d.simpleDate = :simpleDate AND i.userName = :username", Presentatie.class) I did some research and found that I could use a TREAT to downcast my slots to Presentation For some reason it doesn't recognise the TREAT, or at least the bracket '(' Do any of you have an idea what it might be? This is the exception I get: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 40 [SELECT p FROM domein.Datum d JOIN TREAT(d.slots as Presentatie) p JOIN p.inschrijvingen i WHERE d.simpleDate = :simpleDate AND i.userName = :username] at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54) at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47) at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.…
tagged with: mysql
answer count: 1
has comment: http://stackoverflow.com/comment/36238359
has comment: http://stackoverflow.com/comment/36239471
has comment: http://stackoverflow.com/comment/36237353
has comment: http://stackoverflow.com/comment/36232716
type: AnsweredQuestion
tagged with: jpa
type: Question
tagged with: maven
has answer: http://stackoverflow.com/a/27816220
has title: Exception in query downcasting to subclass with TREAT( ... as ... )
tagged with: netbeans
has comment: http://stackoverflow.com/comment/36233443

http://stackoverflow.com/a/23610605
score: 1
has comment: http://stackoverflow.com/comment/36245495
upvote count: 1
has body: If you want to find every prime, then you can use a version of erathmus' sieve to generate the first 1000 or so, and then only check the list of prior primes, as they are the only meaningful factors by the fundamental theorem of algebra. If you want to find all the primes this is almost certainly faster than using a general number field sieve, which are designed to try to factor large numbers efficiently when you dont have a list of primes. Here is somthing that I wrote for Euler Project Number 7. It has two functions, one which uses erathmus' sieve to find all the primes up to 1000, then it uses the list of primes as an input to sequentially work of the next number which is prime via trial division of the list of primes. public class NthPrime { /** * @param args */ public static void main(String[] args) { int N = 10001; long startTime = System.currentTimeMillis(); ArrayList&lt;BigInteger&gt; firstPrimes = primes(1000); System.out.println("The "+N +"th Prime is: " + Nthprime(firstPrimes, N)); long stopTime = System.currentTimeMillis(); long elapsedTime = stopTime - startTime; System.out.println(firstPrimes.toString()); System.out.println(elapsedTime); } public static BigInteger Nthprime(ArrayList&lt;BigInteger&gt; primes, int N) { if(N &lt; primes.size()) { return primes.get(N-1); } BigInteger start = primes.get(primes.size()-1); boolean bool = true; BigInteger ZERO = new BigInteger("0"); BigInteger ONE = new BigInteger("1"); BigInteger j = new BigInteger("1"); while(bool) { boolean hasfactor = false; for(int i=0; i&lt;primes.size(); i++) { BigInteger Q = start.add(j); BigInteger remainder = Q.mod(primes.get(i)); if(remainder.equals(ZERO)) { hasfactor = true; break; } } if(!hasfactor) { primes.add(start.add(j)); } if(primes.size() == N) { bool = false; } j = j.add(ONE); } return primes.get(primes.size()-1); } public static ArrayList&lt;BigInteger&gt; primes(int N) { boolean[] primes = new boolean[N+1]; for(int j = 0; j&lt;N+1; j++) { primes[j] = true; } int i = 2; w…
has comment: http://stackoverflow.com/comment/36298520
type: Answer
has comment: http://stackoverflow.com/comment/36246223
downvote count: 0
answers question: http://stackoverflow.com/q/23597024

http://stackoverflow.com/comment/35988974
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23468511
has text: Thanks for your answer. If I want to transform the geometry to the default CSR, can I just use the following method: JTS.toGeographic(this.geo, DefaultGeographicCRS.WGS84); ???

http://stackoverflow.com/comment/36186101
type: AnswerComment
type: Comment
has text: you really reduced my lot of codes Thank you!
comment on: http://stackoverflow.com/a/23568631
score: 1

http://stackoverflow.com/q/23483579
has body: for(int i = 0; i &lt; n-1; i++) { for(int j = i+1; j &lt;= n; j++) { } } How do I figure out the number of iterations through these loops as a summation in terms of n?
has answer: http://stackoverflow.com/a/23483649
has title: Total number of iterations through loops?
favorite count: 0
tagged with: series
has comment: http://stackoverflow.com/comment/36008868
has comment: http://stackoverflow.com/comment/36008643
has comment: http://stackoverflow.com/comment/36008637
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/23483649
score: -3
type: Question
has comment: http://stackoverflow.com/comment/36008687
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/36008664
possible better answer: http://stackoverflow.com/a/23483593
answer count: 2
has answer: http://stackoverflow.com/a/23483593

http://stackoverflow.com/a/23585324
has body: You need to use super to reference your parent class. class A { @Override public String toString() { return "A's toString()"; } } class B extends A { @Override public String toString() { return super.toString() + " " + "B's toString()"; } } B b = new B(); System.out.println(b); // prints "A's toString() B's toString()" Edit: If your child's toString() always calls the parent's, then you don't even need the toString() in the child. If you want to keep a custom toString() for your child that is different than the parent's in some case, but you also want to be able to call the parent's toString() from the child, make a delegation method. class B extends A { @Override public String toString() { ... } public String parentsToString() { return super.toString(); } } B b = new B(); b.parentsToString(); // will return the output of A's toString()
has comment: http://stackoverflow.com/comment/36199073
accepted answer of: http://stackoverflow.com/q/23585257
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36198562
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23585257
has comment: http://stackoverflow.com/comment/36199064

http://stackoverflow.com/comment/36084494
type: QuestionComment
comment on: http://stackoverflow.com/q/23521925
has text: Tin .i need somthing like that but getting images from mysql
score: 0
type: Comment

http://stackoverflow.com/q/23538519
type: Question
has answer: http://stackoverflow.com/a/23539642
answer count: 3
has body: I search lots of time some answers to my problem but i started a short time coding and i don't succeed in my code. So i ask for your help. Thanks a lot! So when i run my programm it works (no project errors) but on my emulator it doesn't work, i have this errors in the logcat My logcat *05-08 04:53:04.448: E/AndroidRuntime(1057): FATAL EXCEPTION: main 05-08 04:53:04.448: E/AndroidRuntime(1057): Process: com.example.carte, PID: 1057 05-08 04:53:04.448: E/AndroidRuntime(1057): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.carte/com.example.carte.MainActivity}: java.lang.NullPointerException 05-08 04:53:04.448: E/AndroidRuntime(1057): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 05-08 04:53:04.448: E/AndroidRuntime(1057): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 05-08 04:53:04.448: E/AndroidRuntime(1057): at android.app.ActivityThread.access$800(ActivityThread.java:135) 05-08 04:53:04.448: E/AndroidRuntime(1057): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 05-08 04:53:04.448: E/AndroidRuntime(1057): at android.os.Handler.dispatchMessage(Handler.java:102) 05-08 04:53:04.448: E/AndroidRuntime(1057): at android.os.Looper.loop(Looper.java:136) 05-08 04:53:04.448: E/AndroidRuntime(1057): at android.app.ActivityThread.main(ActivityThread.java:5017) 05-08 04:53:04.448: E/AndroidRuntime(1057): at java.lang.reflect.Method.invokeNative(Native Method) 05-08 04:53:04.448: E/AndroidRuntime(1057): at java.lang.reflect.Method.invoke(Method.java:515) 05-08 04:53:04.448: E/AndroidRuntime(1057): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 05-08 04:53:04.448: E/AndroidRuntime(1057): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 05-08 04:53:04.448: E/AndroidRuntime(1057): at dalvik.system.NativeStart.main(Native Method) 05-08 04:53:04.448: E/AndroidRuntime(1057): Caused by: java.lang.NullPointerException …
has title: google map eclipse not working on my emulator
type: UnansweredQuestion
tagged with: android
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23558777
tagged with: eclipse
has answer: http://stackoverflow.com/a/23687295
tagged with: android-emulator

http://stackoverflow.com/comment/36187419
has text: Are you building this from the command line or using an IDE such as Eclipse? If it's an IDE, which type and version?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23578697
type: QuestionComment

http://stackoverflow.com/comment/36219281
comment on: http://stackoverflow.com/q/23595594
type: Comment
type: QuestionComment
score: 0
has text: What version of Hibernate are you using?

http://stackoverflow.com/a/23593633
has comment: http://stackoverflow.com/comment/36214535
accepted answer of: http://stackoverflow.com/q/23593600
has comment: http://stackoverflow.com/comment/36213668
has comment: http://stackoverflow.com/comment/36213629
score: 3
downvote count: 0
has body: Create a class, let's called Person. Then read each line, split it to get the different parts, create a new Person and add it to the list. Then sorting it later would be easy, providing a custom comparator to Collections.sort, telling that you want to sort your List based on person's name.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36214603
answers question: http://stackoverflow.com/q/23593600
upvote count: 3
type: Answer

http://stackoverflow.com/comment/35995322
score: 0
type: AnswerComment
has text: Sorry I ran out of the space - Does that code provide the behavior of the third image in my post? I'm still getting my head around the maths so I'm slightly unsure. That code has been incredibly helpful so far, thanks!
type: Comment
comment on: http://stackoverflow.com/a/23474927

http://stackoverflow.com/q/23590308
upvote count: 1
has answer: http://stackoverflow.com/a/23590346
type: AnsweredQuestion
has body: "SET CLASSPATH=C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;." . Can anybody tell me how i can set the classpath permanently so that i will not have to set the classpath for the next time i restart my computer?
has answer: http://stackoverflow.com/a/23590350
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/23590346
has title: Running a jdbc program without setting the class path for each and every time
tagged with: oracle-database
tagged with: jdbc
favorite count: 0
accepted answer: http://stackoverflow.com/a/23590350

http://stackoverflow.com/q/23550456
has comment: http://stackoverflow.com/comment/36133305
upvote count: 0
has body: I'm not sure if I understand correctly whether I can access all kind of classes based on their modifier (even the private ones) from the super.() or just the public and protected ones. If I extend a class it's a subclass of the first, so super can bring me only the protected and public ones. Am I correct?
answer count: 1
has title: What classes (based on modifier) can be accessed by super.()?
tagged with: class
linked to: http://stackoverflow.com/q/215497
favorite count: 0
has comment: http://stackoverflow.com/comment/36133433
accepted answer: http://stackoverflow.com/a/23550542
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23550542
score: -1
type: Question

http://stackoverflow.com/q/23572748
tagged with: sudoku
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36175223
has comment: http://stackoverflow.com/comment/36175171
accepted answer: http://stackoverflow.com/a/23573180
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/36175281
has body: I have written the following class to generate a Sudoku grid. I am not able to understand some of the results from the program. Can anyone explain? public class SudokuUtility { static final int max = 8; static final int min = 0; static final int digitMax = 9; static final int digitMin = 0; static final int easyMin = 36; static final int easyMax = 49; static final int mediumMin = 32; static final int mediumMax = 40; static final int hardMin = 22; static final int hardMax = 30; public static int[][] makeAGrid(String option) { int[][] grid = new int[9][9]; option = "hard"; Random random = new Random(); int row = 0; int col = 0; int randomNumber = 0; int noOfCellsToBeGenerated = 0; if ("easy".equals(option)) { noOfCellsToBeGenerated = random.nextInt((easyMax - easyMin) + 1) + easyMin; } else if ("medium".equals(option)) { noOfCellsToBeGenerated = random.nextInt((mediumMax - mediumMin) + 1) + mediumMin; } else { noOfCellsToBeGenerated = random.nextInt((hardMax - hardMin) + 1) + hardMin; } for (int i = 1; i &lt;= noOfCellsToBeGenerated; i++) { row = random.nextInt((max - min) + 1) + min; col = random.nextInt((max - min) + 1) + min; randomNumber = random.nextInt((digitMax - digitMin) + 1) + digitMin; if (noConflict(grid, row, col, randomNumber)) { grid[row][col] = randomNumber; } else { i = i - 1; // Nullify this iteration } } int zeroCount = 0; for (int i = 0; i &lt; 9; i++) { for (int j = 0; j &lt; 9; j++) { if (grid[i][j] == 0) { zeroCount++; } System.out.print(grid[i][j] + " "); } System.out.println(); } System.out.println("No of zeros in the " + option + " puzzle = " + zeroCount + " and noOfCellsGenerated = " + noOfCellsToBeGenerated); return grid; } public static boolean noConflict(int[][] array, int row, int col, int num) { for (int i = 0; i &lt; 9; i++) { if (array[row][i] == num) { return false; } if (array[i][col] == num) { return false; } } int gridRow = row - (row % 3); int gridColumn = col - (col % 3); for (int p = gridRow; p &lt; gridRow + 3; p++) { for (int …
answer count: 1
has answer: http://stackoverflow.com/a/23573180
has comment: http://stackoverflow.com/comment/36175120
has title: Unexpected output when generating a Sudoku grid

http://stackoverflow.com/a/23457811
answers question: http://stackoverflow.com/q/23457411
downvote count: 0
has comment: http://stackoverflow.com/comment/35960394
upvote count: 2
type: Answer
score: 2
has body: Even after you made variable as volatile . if you add SOP in while loop it is working These two usecase gives me another thought. just try it. Since your read and write methods are sync , in your while loop while(!Temp.isVarSet()){ } It is nothing doing other than calling the method, it may possible this sync method holds the lock on the Temp Object which does not allow other thread to modify the values (though sync setMethod) . While add SOP inside the while , it is doing some work on IO and thus it is allowing some time slice to other thread get the lock of Temp and modify the same. Could you please try remove Sync from read method , just for testing purpose and post your results. public class Temp { private volatile static boolean varSet=false; public synchronized static void setVarSet() { Temp.varSet=true; } public static boolean isVarSet() { return Temp.varSet; } }

http://stackoverflow.com/comment/36556418
score: 0
comment on: http://stackoverflow.com/q/23544678
has text: @EJP The language syntax is not defined by me. So I have to use those.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36210164
has text: Someone else mentioned HTTP, but I don't know how to go about doing that. Google doesn't provide any good results that explain how to run it through HTTP and not the file system.
type: Comment
comment on: http://stackoverflow.com/a/23591492
score: 0
type: AnswerComment

http://stackoverflow.com/a/70183857
score: 1
answers question: http://stackoverflow.com/q/23590943
upvote count: 1
downvote count: 0
has body: @Rasoul Miri's answer works well for Java because Java does type promotion for numbers. Kotlin, on the other hand won't lift a finger and would just pedantically nag you with: The integer literal does not conform to the expected type Float So, be sure to beg it to do explicit conversion for you with a : .toFloat() call. So, @Rasoul's example becomes. textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14.toFloat()); NB: Would have added this as edit to @Rasoul's answer but StackOverflow says The suggested Edit queue is full.
type: Answer

http://stackoverflow.com/q/23606951
tagged with: java
tagged with: servlets
score: 0
tagged with: sql
answer count: 1
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36240418
upvote count: 1
has title: Prepare statement inside a loop
downvote count: 1
has answer: http://stackoverflow.com/a/23608317
type: Question
has comment: http://stackoverflow.com/comment/36239035
has body: I trying execute a query inside a loop. I am tryning this code : public List&lt;Products&gt; DisplayProducts(String []a) { ResultSet rs = null; List&lt;Products&gt; Data=null; try { for(int i=0;i&lt;a.length;i++) { String query = "select * from products where Brand=?"; PreparedStatement stmt=DataBaseConnection.DBConn.getConnection().prepareStatement(query); stmt.setString(1, a[i]); rs=stmt.executeQuery(); } if(rs.next()) { rs.beforeFirst(); Data=new ArrayList&lt;Products&gt;(); while(rs.next()) { Products p=new Products(); p.setTitle(rs.getString(2)); p.setCategory(rs.getString(3)); p.setSubCategory(rs.getString(4)); p.setSubCategoryTwo(rs.getString(5)); p.setPrice(rs.getInt(6)); p.setFlavour(rs.getString(7)); p.setImage(rs.getString(8)); p.setBrand(rs.getString(9)); p.setInstock(rs.getString(10)); p.setInstockQty(rs.getInt(11)); Data.add(p); } } return Data; } catch(Exception e) { System.out.println(e.getStackTrace()); return null; } } I have a jsp page where I have Checkboxes and I am displaying multiple products on this page. I am sorting this products by BRANDS. User selects Brand by checking checkbox. I am passing the value of checkbox to a servlet and on that servlet calling function Display Products: String arr[]=request.getParameterValues("On"); List&lt;Products&gt; Data=new SessionBeanClass().DisplayProducts(arr); Please tell me how do I execute this and get the result ?

http://stackoverflow.com/q/23601779
has comment: http://stackoverflow.com/comment/36229206
has answer: http://stackoverflow.com/a/23601893
has title: Different between Spring MVC vs Oracle ADF?
score: -1
upvote count: 3
downvote count: 4
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-adf
tagged with: spring
tagged with: spring-mvc
has body: Different between Spring MVC vs Oracle ADF Advantage and disadvantage of Spring MVC and Oracle ADF Which one is best Spring MVC or Oracle ADF?
tagged with: java
type: Question

http://stackoverflow.com/q/23555936
has body: Working on this JFrame lab for my java class. My program isnt finished yet but i just need some help on why the JFrame for the male and female isnt showing after i click on the male or female JButton. any help would be appreciated. here's my program: import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.util.*; public class Lab4EC extends JFrame implements ActionListener { private static final int Width = 500; private static final int Height = 200; private JLabel bodyweightJL,wristmeasurementJL,waistmeasurementJL,hipmeasurementJL,forearmJL,bodyfatJL; private JTextField bodyweightTF,wristmeasurementTF,waistmeasurementTF,hipmeasurementTF,forearmTF,bodyfatTF; private JButton maleJB,femaleJB,calculateJB,exitJB; double A1,A2,A3,A4,A5,a1,a2,b,B,bodyWeight,wristMeasurement,hipMeasurement,forearmMeasurement,waistMeasurement,fbodyFat,mbodyFat,fbodyFP,mbodyFP; Container pane = getContentPane(); public Lab4EC () { setTitle ("Body Fat Calculator"); maleJB = new JButton ("Male"); femaleJB = new JButton ("Female"); pane.setLayout (new GridLayout (2,1)); pane.add(maleJB); pane.add(femaleJB); maleJB.addActionListener(this); femaleJB.addActionListener(this); setSize(Width, Height); setVisible (true); } public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("Male")){ bodyweightJL = new JLabel ("Enter Body Weight: ", SwingConstants.RIGHT); waistmeasurementJL = new JLabel ("Enter Waist Measurement: ", SwingConstants.RIGHT); bodyfatJL = new JLabel ("Your Body Fat Percentage Is: ", SwingConstants.RIGHT); bodyweightTF = new JTextField(10); waistmeasurementTF = new JTextField(10); calculateJB = new JButton ("Calculate"); pane.setLayout (new GridLayout (4,2)); pane.remove(maleJB); pane.remove(femaleJB); pane.add(bodyweightJL); pane.add(waistmeasurementJL); pane.add(bodyfatJL); pane.add(calculateJB); pane.add(bodyweightTF); pane.add(waistmeasurementTF); pane.add(bodyfatTF); calculateJB.addActionListener(this); exitJB.addActionListener(this); setSi…
has answer: http://stackoverflow.com/a/23556241
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36143962
tagged with: java
has title: stuck in this JFrame program
has answer: http://stackoverflow.com/a/23556555
type: Question
answer count: 2
upvote count: 0
score: -2

http://stackoverflow.com/a/23544882
type: Answer
has body: Your method is declared as private. Have you tried making it public? private void executeLogin(){ Try changing it to. public void executeLogin(){
answers question: http://stackoverflow.com/q/23544210
score: 0

http://stackoverflow.com/comment/36009008
type: Comment
type: QuestionComment
has text: Don't call `setSize` on applets, the size of the applet is defined by the html code that loads it, not the applet code. Besides, the applet is using a layout manager, so it won't have any effect on the `ChineseCheckerboard`. Any reason why you're using AWT libraries?
score: 1
comment on: http://stackoverflow.com/q/23483786

http://stackoverflow.com/comment/36103730
comment on: http://stackoverflow.com/a/23534258
score: 0
type: Comment
type: AnswerComment
has text: Thanks for the reply. I have a few questions

http://stackoverflow.com/q/23481017
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/36003943
has answer: http://stackoverflow.com/a/23481105
score: 0
answer count: 1
has title: Why is the background black?
favorite count: 0
has body: The background worked before I added the paint method, I assume the paint method overrides the setBackground and setForeground methods in run, but I'm not sure how I can fix this problem. import java.awt.Color; import java.awt.DisplayMode; import java.awt.Font; import java.awt.Graphics; import javax.swing.JFrame; public class Afterworld extends JFrame{ public static void main(String[] args){ DisplayMode dm = new DisplayMode(800, 600, 16, DisplayMode.REFRESH_RATE_UNKNOWN); Afterworld game = new Afterworld(); game.run(dm); } public void run(DisplayMode dm){ setBackground(Color.PINK); setForeground(Color.WHITE); setFont(new Font("Arial", Font.PLAIN, 24)); Screen screen = new Screen(); try{ screen.setFullScreen(dm, this); try{ Thread.sleep(5000); }catch(Exception ex){} }finally{ screen.restoreScreen(); } } public void paint(Graphics g){ g.drawString("test", 200, 200); } }
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36003903
has comment: http://stackoverflow.com/comment/36003973
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/51423065
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23456488
has text: I wrote an answer to a related question [How to add parameters to api (http post) using okhttp library in Android](http://stackoverflow.com/a/31744565/1276636). It only uses OkHttp.

http://stackoverflow.com/comment/36008192
score: 0
comment on: http://stackoverflow.com/q/23483332
has text: Maybe you actually want a [`PriorityQueue`](http://docs.oracle.com/javase/7/docs/api/java/util/PriorityQueue.html)?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23570119
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23569913
has body: Arrays need to be given a size when created. ArrayList would be a better option for an ongoing Array increasing in size. When initializing an ArrayList you have to declare what type of objects the ArrayList is going to hold. private ArrayList&lt;Product&gt; products = new ArrayList&lt;Product&gt;(); The question has been edited and is now initialized correctly, it was missing object declaration previously.

http://stackoverflow.com/comment/36032684
score: 0
has text: Can these filters be implemented as normal Servlet filters?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23494308

http://stackoverflow.com/q/23587492
downvote count: 2
answer count: 1
favorite count: 0
has title: Zip4j fails to unzip gz files created in unix
type: AnsweredQuestion
tagged with: zip4j
has comment: http://stackoverflow.com/comment/36202594
has answer: http://stackoverflow.com/a/23587570
accepted answer: http://stackoverflow.com/a/23587570
tagged with: java
type: Question
has body: Zip4j fails to open/extract gz files created in UNIX. 7Zip opens the file without any problem. The zip is not enrypted. Is there any option to be set(like host type) before reading the file headers in the file. File file = new File("D:/unziptest/i6163795A140507230411.dl.gz"); try { System.out.println(file.length()); ZipFile zipFile = new ZipFile(file); if (!zipFile.isEncrypted()){ if(zipFile.getFileHeaders()!=null){ List&lt;FileHeader&gt; files = zipFile.getFileHeaders(); for(FileHeader fileHeader : files){ if(fileHeader!=null){ System.out.println(fileHeader.getFileName()); } } } } } catch (Exception e) { e.printStackTrace(); } Output 16388 net.lingala.zip4j.exception.ZipException: zip headers not found. probably not a zip file at net.lingala.zip4j.core.HeaderReader.readEndOfCentralDirectoryRecord(HeaderReader.java:122) at net.lingala.zip4j.core.HeaderReader.readAllHeaders(HeaderReader.java:78) at net.lingala.zip4j.core.ZipFile.readZipInfo(ZipFile.java:425) at net.lingala.zip4j.core.ZipFile.isEncrypted(ZipFile.java:722) at UnzipFile.main(UnzipFile.java:35)
upvote count: 2
score: 0

http://stackoverflow.com/comment/36203966
type: QuestionComment
score: 1
has text: If you add `System.out.flush(); System.err.flush();` lines to your code, the output will be sequential as expected.
type: Comment
comment on: http://stackoverflow.com/q/23588123

http://stackoverflow.com/q/23515394
upvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36068562
downvote count: 0
has comment: http://stackoverflow.com/comment/36067560
tagged with: java
has answer: http://stackoverflow.com/a/23518223
type: Question
has comment: http://stackoverflow.com/comment/36069042
tagged with: ant
linked to: http://stackoverflow.com/q/6733684
has body: I need to run an ANT build using the build.xml file that is stored inside the jar file. This jar file is available on the classpath. Is it possible to do it, without exploding the jar file and saving the build.xml to local directory? If so how can I do it. Update: The jar file is a ant build project where a build.xml in classpath is run via a java program using ANT libraries. The front end is a web application, which loads this build project jar as a dependency. A user will click a Build App button to run the ANT build. So I need to run the build.xml file in a jar when user clicks Build App. Code for reading the build.xml file URL preBuildFileUrl = getClass().getClassLoader().getResource("build.xml"); Project p = new Project(); p.setUserProperty("ant.file", preBuildFileUrl.toURI().getPath()); p.init(); ProjectHelper helper = ProjectHelper.getProjectHelper(); p.addReference("ant.projectHelper", helper); helper.parse(p, new File(preBuildFileUrl.toURI().getPath())); p.executeTarget(p.getDefaultTarget());
score: 4
has answer: http://stackoverflow.com/a/42229934
has title: Running an ANT build.xml file inside a Jar file
answer count: 2
has comment: http://stackoverflow.com/comment/36068217
possible better answer: http://stackoverflow.com/a/42229934
linked to: http://stackoverflow.com/q/17745788
has comment: http://stackoverflow.com/comment/36069491
favorite count: 0
has comment: http://stackoverflow.com/comment/36068283
accepted answer: http://stackoverflow.com/a/23518223

http://stackoverflow.com/comment/36204082
type: AnswerComment
comment on: http://stackoverflow.com/a/23588284
type: Comment
has text: Solved!! I changed this String sql="SELECT * FROM rental_movie WHERE Movie_idMovie = ?";
score: 0

http://stackoverflow.com/q/23605579
tagged with: memory
has comment: http://stackoverflow.com/comment/36245597
score: 0
has answer: http://stackoverflow.com/a/23606744
answer count: 1
tagged with: key
has comment: http://stackoverflow.com/comment/36237017
tagged with: dictionary
has comment: http://stackoverflow.com/comment/36255027
type: UnansweredQuestion
has body: I was using a Map(String,Integer) in java. Keys were generated from string concatenation of four given numbers. givenNumber1 at most 6 digits, givenNumber2 at most 4 digits, givenNumber3 at most 4 digits, givenNumber4 at most 4 digits. Because of memory cost, I want to use Map(Integer,Integer) in java. Now how can I generate an unique number from given four numbers and then how to get back these four numbers from this generated number? Is there an efficient(memory,cpu) way to do it?
has comment: http://stackoverflow.com/comment/36248082
type: Question
has comment: http://stackoverflow.com/comment/36236303
tagged with: java
has title: How to generate an unique number from a given four numbers and getting these given numbers back from generated unique number?

http://stackoverflow.com/comment/36176299
type: Comment
has text: @BheshGurung looks like an incomplete explanation.
score: 1
comment on: http://stackoverflow.com/q/23573105
type: QuestionComment

http://stackoverflow.com/q/23598748
has body: I am facing the following error when I try to create bean using Application Context for the circle class! Circle class implements the Shape interface which contains a method draw(). Configuration: I am learning spring and have setup a Java Project in eclipse with all the required jars (Spring and Apache commons logging). I have the spring.xml in my classpath in the src folder. Have also tried downloading the latest jars (Spring 4.0.4 release, previously worked with 4.0.0) but now is not working. Cannot think of any solution to fix this. Error: May 11, 2014 6:20:50 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@90832e: startup date [Sun May 11 18:20:50 EDT 2014]; root of context hierarchy May 11, 2014 6:20:50 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from class path resource [spring.xml] Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor': Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1021) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304) at org.springframework.beans.factory.support.Defa…
score: 4
has comment: http://stackoverflow.com/comment/36223820
accepted answer: http://stackoverflow.com/a/23634282
tagged with: spring
type: Question
has comment: http://stackoverflow.com/comment/36232871
type: AnsweredQuestion
has title: Error while creating bean: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
tagged with: java
has comment: http://stackoverflow.com/comment/36223773
upvote count: 4
has answer: http://stackoverflow.com/a/23634282
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36137643
type: Comment
score: 1
has text: Maybe it is not listener but action method. What about use it with `a4j:commandLink`?
type: QuestionComment
comment on: http://stackoverflow.com/q/23548924

http://stackoverflow.com/comment/36218514
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23594446
type: Comment
has text: Look for something based on BLAS and LAPACK. I haven't used it, but JBLAS seems like a possibility.

http://stackoverflow.com/a/77095974
type: Answer
has comment: http://stackoverflow.com/comment/135913633
has body: CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL)); URL urlCopy = new URL(url); HttpsURLConnection httpconnect = (HttpsURLConnection)urlCopy.openConnection(); httpconnect.setConnectTimeout(5000); httpconnect.connect(); if(httpconnect.getResponseCode()&lt;=400) { System.out.println(url+&quot; - &quot;+httpconnect.getResponseMessage() +&quot; - &quot;+ httpconnect.getResponseCode()); } }
answers question: http://stackoverflow.com/q/23517139
score: 0

http://stackoverflow.com/a/23591808
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23591740
has body: I ll assume that your are using maven : com.lowagie itext 2.1.7 antlr antlr 2.7.7 commons-beanutils commons-beanutils 1.8.0 commons-collections commons-collections 2.1.1 commons-digester commons-digester 2.1 org.codehaus.groovy groovy-all 2.0.1

http://stackoverflow.com/q/23523007
answer count: 0
score: 0
tagged with: java
has title: Access edittext in TextWatcher
type: Question
has comment: http://stackoverflow.com/comment/36083171
has comment: http://stackoverflow.com/comment/36082626
has body: I have a textWatcher as TextChangeListener and I need to change the text from edittext. My code is: holder.txtResponder.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) { holder.txtResponder.setText("I need change the text from this edit text but holder.txtResponder is not accessible"); } });
has comment: http://stackoverflow.com/comment/36083454
has comment: http://stackoverflow.com/comment/36082753
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/23614605
has answer: http://stackoverflow.com/a/24146506
tagged with: local-system-account
possible better answer: http://stackoverflow.com/a/24146506
answer count: 3
accepted answer: http://stackoverflow.com/a/39020819
downvote count: 0
favorite count: 0
upvote count: 6
type: AnsweredQuestion
tagged with: java
has title: NPE in Win32ShellFolder2.access when creating new JFileChooser as Local System Account in Windows 7
has body: I have written unit tests for a Swing GUI that creates JFileChooser. Since the unit tests are run on a build server as a service, the unit tests need to run as the local system account. However, when the unit tests try to create a new JFileChooser, they throw a NullPointerException. I've reduced the problem to that of running the following main class as local system account (NOT THE REAL CODE) package com.example.mcgr; import javax.swing.*; import java.io.IOException; public class FileChooserAsSystem { public static void main(String[] args) throws IOException { SwingUtilities.invokeLater(new Runnable() { public void run() { JFileChooser fileChooser = new JFileChooser(); fileChooser.showDialog(null, "Ok"); } }); } } Using the following build file. <delete dir="build"/> <mkdir dir="build/classes"/> <javac srcdir="src" destdir="build/classes"/> <mkdir dir="build/jar"/> <attribute name="Main-Class" value="com.example.mcgr.FileChooserAsSystem"/> <java jar="build/jar/FileChooserAsSystem.jar" fork="true"/> If I run the code as my own user account, the JFileChooser appears (that's all I want it to do as the above stripped down code obviously doesn't do anything after that). If I run the above code as the system account (e.g. by installing PsTools/PsExec and running PsExec.exe -s -i cmd.exe to start cmd as system account and then running the jar, then I get the following stack trace: [java] Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException [java] at sun.awt.shell.Win32ShellFolder2.access$200(Win32ShellFolder2.java:72) [java] at sun.awt.shell.Win32ShellFolder2$1.call(Win32ShellFolder2.java:242) [java] at sun.awt.shell.Win32ShellFolder2$1.call(Win32ShellFolder2.java:237) [java] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [java] at java.util.concurrent.FutureTask.run(FutureTask.java:166) [java] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [java] at java.util.concurrent.ThreadPoolExecutor$Worker.…
score: 6
has answer: http://stackoverflow.com/a/26661990
tagged with: swing
has answer: http://stackoverflow.com/a/39020819
tagged with: jfilechooser
tagged with: unit-testing
type: Question

http://stackoverflow.com/comment/36005347
has text: @Jukka Creating another `@Bean` method in the configuration class did resolve the issue, but I'm still wondering why. I'm gonna do some digging to see if I can figure out the why, but if you happen to find anything out please let me know. The curiosity is killing me.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23480035

http://stackoverflow.com/q/23556379
has title: How to trigger Enter Key Function in Webdriver?
has body: I ran in to a situation where sometimes clicking on a Submit button doesn't work in Selenium Webdriver. The same functionality could be obtained by pressing the Enter button. Here, after entering the value in text box, I want Selenium WebDriver to press Enter key. How would I do that? I'm using java driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys("testing@netexam.com"); Thanks in advance!
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23556407
score: 0
has answer: http://stackoverflow.com/a/23556407
answer count: 1

http://stackoverflow.com/a/23634190
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/133635022
answers question: http://stackoverflow.com/q/23573303
has body: I'm able to implement it successfully using Spring, Mybatis &amp; Oracle. The reference code to implement is as below 1) Create Type in Database CREATE OR REPLACE TYPE TypeName AS OBJECT( Field1 varchar(6), Field2 varchar(6) ) 2) Create Table of Type in Database CREATE OR REPLACE TYPE TableTypeName AS TABLE OF TypeName; 3) Create transfer object in java with 2 fields 4) Generate necessary arraylist for transfer object 5) Create database call CALL StoredProcedureName( #{Parameter_in, javaType=Object, jdbcType=ARRAY, jdbcTypeName=TableTypeName , mode=INOUT, typeHandler=javaHandlername} ) 6) Create handler public class javaHandlername implements TypeHandler { // Set data to oracle object @Override public void setParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException { List&lt;TO&gt; TOs = (List&lt;TO&gt;) parameter; StructDescriptor structDescriptor = StructDescriptor .createDescriptor("TypeName", ps.getConnection()); STRUCT[] structs = null; structs = new STRUCT[TOs.size()]; for (int index = 0; index &lt; TOs.size(); index++) { TO to = TO.get(index); Object[] params = new Object[2]; params[0] = fSVDisptchSchedDely.getField1(); params[1] = fSVDisptchSchedDely.getField2(); STRUCT struct = new STRUCT(structDescriptor, ps.getConnection(), params); structs[index] = struct; } ArrayDescriptor desc = ArrayDescriptor.createDescriptor( "TableTypeName", ps.getConnection()); ARRAY oracleArray = new ARRAY(desc, ps.getConnection(), structs); ps.setArray(i, oracleArray); } // Set the result back to Java object public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { List&lt;TO&gt; TOs= new ArrayList&lt;TO&gt;(); Object[] structArray = (Object[]) cs.getArray(columnIndex).getArray(); oracle.sql.STRUCT mystruct = null; for (Object structObj : structArray) { TO to= new TO(); mystruct = (oracle.sql.STRUCT) structObj; Object[] structAttr = mystruct.getAttributes(); to.setField1((String)structAttr[0])); to.setField2((Stri…
score: 4
type: Answer

http://stackoverflow.com/q/23583228
duplicate of: http://stackoverflow.com/q/1532461
favorite count: 0
has answer: http://stackoverflow.com/a/23583401
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36194659
tagged with: stringbuilder
score: 1
tagged with: java
has title: StringBuilder vs String (in exact situation)
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36194471
has body: I've read about StringBuilder class in Java and I'm wondering, what is more efficient way to do some task: Using "+" concatenation: String result = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + " " + " " + (et_title.getText().toString()) + " " + "<y:access>"+ privacymode +"</y:access>" + "<category scheme=\"urn:ya.ru:posttypes\" term=\"link\"/>" + "<y:meta>" + "<y:url>" + (et_link.getText().toString()) + "</y:url>" + "</y:meta>" + " " + signature_select() + " " + " "; or StringBuilder sb = new StringBuilder(); sb.append( "<?xml version=\"1.0\" encoding=\"utf-8\"?>") .append(" ") .append(" ") .append(et_title.getText().toString()) .append(" ") .append("<y:access>"+ privacymode +"</y:access>") .append( "<category scheme=\"urn:ya.ru:posttypes\" term=\"link\"/>") .append("<y:meta>" + "<y:url>" + (et_link.getText().toString()) + "</y:url>" + "</y:meta>") .append( " " + signature_select() + " ") .append(" "); String result = sb.toString();
downvote count: 0
linked to: http://stackoverflow.com/q/1532461
has answer: http://stackoverflow.com/a/23583481
tagged with: string

http://stackoverflow.com/comment/36235229
comment on: http://stackoverflow.com/q/23604540
score: 0
type: Comment
type: QuestionComment
has text: @geoand yup, tried that. If I just launch the application context without the WebMvc part, the tests are green. When I try to inject the validator into the spring controller, the tests fail (can't inject the validator).

http://stackoverflow.com/a/23460456
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23460393
score: 3
has body: I need delete it from my private List zoz? zoz.remove(sectedRowIndex); // if table is not sortable Note: Do not initialize the list again after deleting the selected row. DefaultTableModel is not populating from the list put a check tblTabulka.getSelectedRow() != -1 before deleting the row whether row is selected or not? Use Map instead of List something like Map&lt;String,Book&gt; books = new HashMap&lt;String,Book&gt;(); where you can make isbn or id as key. Sample code: button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // check for selected row first if (tblTabulka.getSelectedRow() != -1) { // get value of first cell of selected row String isbn= (String)tableModel.getValueAt(tblTabulka.getSelectedRow(), 0); books.remove(isbn); // remove from the model also model.removeRow(tblTabulka.getSelectedRow()); } } });
downvote count: 0

http://stackoverflow.com/q/23544274
possible better answer: http://stackoverflow.com/a/23544653
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/23560811
has answer: http://stackoverflow.com/a/23544653
has body: I'm quite newbie to Hibernate, so I'm still learning how to do things that should be easy. I have the following simple relational model: I have all Hibernate XML files already configured and the mappings from my DB done. All POJOs and XMLs are good because NetBeans' HQL editor runs without any problem all these three queries: from Device from Site from Country If I run the following code everything works good: public void getAllDevices() throws Exception { List&lt;Device&gt; devicesList = (List&lt;Device&gt;) session.createQuery("from Device").list(); int size = devicesList.size(); System.out.println("Size was " + size); for(int i=0; i&lt;size; i++){ System.out.println(devicesList.get(i).getDeviceOperationsName()); } } However, if I try to run a more complex query (not that complex...): FROM Device As device INNER JOIN device.site INNER JOIN device.site.country WHERE device.site.country.countryCode = 'ES' NetBeans' HQL editor runs it without a problem, but when used in the above Java code (replacing "from Device") it throws the following error referring to the System.out.println line: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to Entity.Device at DAO.MasterDataDAO.getAllDevices(MasterDataDAO.java:41) at CapaDominio.Main.main(Main.java:40) It appears that Hibernate is trying to populate a list of Device POJOs, while the query is actually returning data from several tables. I expected Hibernate to populate not only Device but Country and Site tables as well, while I can manage all data from the returned List&lt;Device&gt; and navigate from each Device object to their other corresponding objects. Please, could anybody point to what I'm doing wrong or not understanding? How can I achieve the desired way of managing the objects (getting a Device list and iterating through them)? Thanks!!
tagged with: hql
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
score: 1
has answer: http://stackoverflow.com/a/23560811
tagged with: netbeans
answer count: 2
tagged with: hibernate-mapping
upvote count: 1
has title: Retrieving into POJOs query with several tables in Java an Hibernate

http://stackoverflow.com/q/23601471
has answer: http://stackoverflow.com/a/23640284
type: AnsweredQuestion
has title: Camel Dead Letter channel
tagged with: java
tagged with: apache-camel
has body: I have a route: from("restlet://RestletBean/{id}?restletMethod=GET") .setHeader(Exchange.HTTP_METHOD, constant("GET")) .setHeader(Exchange.HTTP_URI, simple("http://x.y.z.com?id={header.id}")) .to("http://dummyHost") When I don't give an appropriate input (id in this case, which is being used as URI parameter in the to route). The to route will respond me with an error page. Which is not happening. Instead there is a blank white page even after handling using dead letter channel error handler: from("restlet://RestletBean/{id}?restletMethod=GET"). .setHeader(Exchange.HTTP_METHOD, constant("GET")) .setHeader(Exchange.HTTP_URI, simple("http://x.y.z.com?id={header.id}")) .to("http://dummyHost") .errorHandler("http://x.y.z.com?id={header.id}");
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/23640284
tagged with: dead-letter
favorite count: 0
upvote count: 2
downvote count: 2

http://stackoverflow.com/a/23473761
score: 0
has body: You can use list of pojo here..iterate through result set, make new object and store it in list here is some code.. // Fetch each row from the result set while (rs.next()) { String i = rs.getString("user_name"); String str = rs.getString("permission"); //Assuming you have a user object User user = new User(i, str); ll.add(user); }
type: Answer
answers question: http://stackoverflow.com/q/23473662

http://stackoverflow.com/q/23592220
has title: on pressing default cancel icon[x] of called JFrame layout class, calling layout class gets cancelled too
tagged with: jframe
has body: Class1 which is a NewJFrame Form and is also a calling class to class2, NewJFrame3 has a Jbutton component, jButton1, for which method actionPerformed has been over-ridden. I call the object with a thread. On calling, Class2, NewJFrame3, a new frame pops up. Problem is when I press the default cross of called class, NewJFrame3, button [X], both screens gets cancelled. I was not using threads before and was calling the layout method for JFrame3 with just object, but it had this problem, so i used thread but it wouldnt work. Code of calling class (Layout is fine for this and on clicking its button JButton1, class NewJframe3’s layout pops up) : public class NewJFrame extends javax.swing.JFrame implements ActionListener { public NewJFrame() { initComponents(); jButton1.addActionListener(this); } private void initComponents() { //layout code for JFrame1 – gives the desired layout/output } public void actionPerformed(ActionEvent e) { If(some_condition) { NewJFrame3 obj2 = new NewJFrame3(); Thread th1 = new Thread(obj2, "thread1"); th1.start(); } } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NewJFrame().setVisible(true); } }); }//Main ends }//Calling Class NewJFrame1 ends Code for called class(same package) : public class NewJFrame3 extends javax.swing.JFrame implements Runnable { public void run() { // System.out.println("Inside Run"); this.test(); this.setVisible(true); } protected void test() { //layout code for JFrame3 – gives the desired layout/output } PSVM() { //Main method code not relevant here, since layout function is called from run() which gets called on starting thread for this class. } } //Called Class NewJFrame3 end Thanks a ton for your time!
upvote count: 1
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23592250
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/36211608
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36212000
favorite count: 0
has answer: http://stackoverflow.com/a/23592250

http://stackoverflow.com/comment/84570948
type: AnswerComment
has text: @Dylanthepiguy What part of 'not use it' didn't you understand?
type: Comment
comment on: http://stackoverflow.com/a/23465698
score: 0

http://stackoverflow.com/comment/36001608
type: QuestionComment
has text: If they chose these numbers, you would ask why not -512 to 511. They had to make a good compromise, and chose these numbers.
comment on: http://stackoverflow.com/q/23479882
score: 4
type: Comment

http://stackoverflow.com/comment/35989394
type: Comment
has text: Actually he needs shallow clone. Deep clone means copy the objects in array themselves.
score: 1
comment on: http://stackoverflow.com/a/23473590
type: AnswerComment

http://stackoverflow.com/comment/36161727
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23565724
type: AnswerComment
has text: hm, maybe I didn't understand how to implement in a JSON String, I gave a very small example, could you try to show with the example I gave?

http://stackoverflow.com/q/23507422
has comment: http://stackoverflow.com/comment/36053851
has comment: http://stackoverflow.com/comment/36053324
has comment: http://stackoverflow.com/comment/41633462
has comment: http://stackoverflow.com/comment/60351292
has title: Graphics Context misaligned on first paint
has answer: http://stackoverflow.com/a/23509046
has comment: http://stackoverflow.com/comment/36053790
has comment: http://stackoverflow.com/comment/36054020
downvote count: 2
has comment: http://stackoverflow.com/comment/36053078
has comment: http://stackoverflow.com/comment/36054065
has comment: http://stackoverflow.com/comment/36054160
tagged with: swing
has comment: http://stackoverflow.com/comment/36053675
has comment: http://stackoverflow.com/comment/36053733
has comment: http://stackoverflow.com/comment/36053340
upvote count: 17
has comment: http://stackoverflow.com/comment/36054082
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36054093
tagged with: java
has comment: http://stackoverflow.com/comment/36053111
tagged with: affinetransform
score: 15
has body: I've been working up an answer for another question and came across a bizare issue that I've not seen before... Basically, the program uses a AffineTransform to provide translation, scaling and rotating of a Graphics element, simple enough stuff, done a thousand times before The problem is, when the screen first appears, the output is not where it should be, but once I touch one of the controls (adjust one of the slides) it jumps to the right spot. Based on the screen shots, the Graphics content seems to be misplaced by the amount of the other controls. If I remove the controls from the GUI, it appears in the right spot (in the center). If I resize the window, it doesn't fix the issue, it only fixes when one of the sliders triggers repaint on the DrawPane... I've added diagnostics to the output and the all the values are the same - that is, they print the same values when the program first starts and when I adjust all slider values to their initial values. If I remove the setRotation and setScale calls from the AffineTransform, it doesn't fix it. If I remove the setTranslation, the square isn't initially painted until the panel is updated (it's painted off screen) If I use Graphics2D g2d = (Graphics)g; instead of g.create(), same result (and yes, I reset the transform before the paintComponent method exited ;)) import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.geom.AffineTransform; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class Parker { public static void main(String[] args) { new Parker(); } public Parker() { EventQueue.invokeLater(new Runnable() { @O…
has comment: http://stackoverflow.com/comment/36055130
has comment: http://stackoverflow.com/comment/36053149
has comment: http://stackoverflow.com/comment/36053250
linked to: http://stackoverflow.com/q/23506118
accepted answer: http://stackoverflow.com/a/23509046
has comment: http://stackoverflow.com/comment/36053226
has comment: http://stackoverflow.com/comment/36053988
answer count: 1
has comment: http://stackoverflow.com/comment/36053300
favorite count: 0
has comment: http://stackoverflow.com/comment/36053632

http://stackoverflow.com/a/23468957
has body: You have to add the issuer CA's of your server certificate (or directly the server certificate in case of for example your cds is selfsigned) to the truststore in order to avoid PKIX path builder exception. By default java truststore is on JAVA_HOME/jre/lib/security/cacerts (you can specify another trust store with javax.net.ssl.trustStore property). To do this, first download the server certificate. You can download the server certificate for example with Chrome connecting to the server url and click on the green lock, then select the tab connection and click on certificate information: Then save this certificate on disc. Now you have to add this certificate to java trust store, you can do it with java keytool (if is in your path use keytool if not keytool is on JAVA_HOME/bin/keytool): keytool -import -trustcacerts -alias myServerCertificate -file path/myServerCert.crt -keystore JAVA_HOME/jre/lib/security/cacerts The default password for cacerts is: changeit Hope this helps,
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23465472
answers question: http://stackoverflow.com/q/23465472
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/131033756
downvote count: 0
upvote count: 11

swing
tags question: http://stackoverflow.com/q/23460393
tags question: http://stackoverflow.com/q/23501706
tags question: http://stackoverflow.com/q/23508187
tags question: http://stackoverflow.com/q/23479355
tags question: http://stackoverflow.com/q/23518886
tags question: http://stackoverflow.com/q/23610227
tags question: http://stackoverflow.com/q/23496235
tags question: http://stackoverflow.com/q/23543459
tags question: http://stackoverflow.com/q/23483440
tags question: http://stackoverflow.com/q/23463522
tags question: http://stackoverflow.com/q/23589396
tags question: http://stackoverflow.com/q/23516236
tags question: http://stackoverflow.com/q/23534412
tags question: http://stackoverflow.com/q/23487884
tags question: http://stackoverflow.com/q/23611092
tags question: http://stackoverflow.com/q/23525922
tags question: http://stackoverflow.com/q/23479666
tags question: http://stackoverflow.com/q/23587011
tags question: http://stackoverflow.com/q/23505305
tags question: http://stackoverflow.com/q/23512779
tags question: http://stackoverflow.com/q/23516980
tags question: http://stackoverflow.com/q/23511824
tags question: http://stackoverflow.com/q/23528528
tags question: http://stackoverflow.com/q/23537478
tags question: http://stackoverflow.com/q/23540383
tags question: http://stackoverflow.com/q/23506314
tags question: http://stackoverflow.com/q/23553051
tags question: http://stackoverflow.com/q/23453323
tags question: http://stackoverflow.com/q/23594046
tags question: http://stackoverflow.com/q/23497405
tags question: http://stackoverflow.com/q/23457419
tags question: http://stackoverflow.com/q/23602144
tags question: http://stackoverflow.com/q/23531112
tags question: http://stackoverflow.com/q/23460458
tags question: http://stackoverflow.com/q/23566232
tags question: http://stackoverflow.com/q/23615429
tags question: http://stackoverflow.com/q/23577126
tags question: http://stackoverflow.com/q/23551254
tags question: http://stackoverflow.com/q/23611214
tags question: http://stackoverflow.com/q/23505800
tags question: http://stackoverflow.com/q/23463951
tags question: http://stackoverflow.com/q/23463097
tags question: http://stackoverflow.com/q/23595832
tags question: http://stackoverflow.com/q/23506089
tags question: http://stackoverflow.com/q/23553750
tags question: http://stackoverflow.com/q/23503764
tags question: http://stackoverflow.com/q/23494448
tags question: http://stackoverflow.com/q/23500961
tags question: http://stackoverflow.com/q/23585060
tags question: http://stackoverflow.com/q/23459624
tags question: http://stackoverflow.com/q/23506756
tags question: http://stackoverflow.com/q/23521090
tags question: http://stackoverflow.com/q/23534184
tags question: http://stackoverflow.com/q/23478905
tags question: http://stackoverflow.com/q/23505528
tags question: http://stackoverflow.com/q/23462784
tags question: http://stackoverflow.com/q/23600964
tags question: http://stackoverflow.com/q/23576111
tags question: http://stackoverflow.com/q/23590285
tags question: http://stackoverflow.com/q/23484247
tags question: http://stackoverflow.com/q/23503835
tags question: http://stackoverflow.com/q/23467700
tags question: http://stackoverflow.com/q/23495742
tags question: http://stackoverflow.com/q/23584619
tags question: http://stackoverflow.com/q/23551078
tags question: http://stackoverflow.com/q/23523334
tags question: http://stackoverflow.com/q/23475026
tags question: http://stackoverflow.com/q/23584537
tags question: http://stackoverflow.com/q/23588895
tags question: http://stackoverflow.com/q/23546141
tags question: http://stackoverflow.com/q/23507967
tags question: http://stackoverflow.com/q/23495571
tags question: http://stackoverflow.com/q/23612716
tags question: http://stackoverflow.com/q/23552310
tags question: http://stackoverflow.com/q/23599726
tags question: http://stackoverflow.com/q/23506118
tags question: http://stackoverflow.com/q/23602871
tags question: http://stackoverflow.com/q/23500969
tags question: http://stackoverflow.com/q/23577658
tags question: http://stackoverflow.com/q/23524351

http://stackoverflow.com/q/23506475
downvote count: 2
has comment: http://stackoverflow.com/comment/36051943
has answer: http://stackoverflow.com/a/23506843
has comment: http://stackoverflow.com/comment/36051665
tagged with: java
has comment: http://stackoverflow.com/comment/36051636
has title: gui not functioning properly
type: Question
has comment: http://stackoverflow.com/comment/36051513
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/36051364
has answer: http://stackoverflow.com/a/23506540
has body: i am getting a clean compile but when i run it and type in a name and click "add" it just gives me the error message "invalid entry" when it is supposed to just add it to the arraylist and thats it. what happened? import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class FinalB extends JFrame{ private static int WIDTH = 500; private static int HEIGHT = 250; private static String nameEntered; private static ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); private int row = 20; private JTextField textF = new JTextField(20); private JButton addB, removeB, searchB, printB; private JButton exitB; private ButtonEventHandler eventHandler; public FinalB(){ setTitle("Very Important List"); setSize(WIDTH,HEIGHT); Container pane = getContentPane(); exitB = new JButton("Exit"); addB = new JButton("Add"); removeB = new JButton("Remove"); searchB = new JButton("Search"); printB = new JButton("print list"); JLabel label = new JLabel("Enter a Name:"); label.setFont(new Font("Arial", Font.BOLD, 18)); pane.add(label); label.setLocation(0,50); label.setSize(200, 30); label.setForeground(Color.BLACK); eventHandler = new ButtonEventHandler(); exitB.addActionListener(eventHandler); addB.addActionListener(eventHandler); removeB.addActionListener(eventHandler); searchB.addActionListener(eventHandler); printB.addActionListener(eventHandler); pane.setLayout(null); //sets pane to null //set the buttons (500,250) exitB.setLocation(125,150); addB.setLocation(125,100); removeB.setLocation(205,100); searchB.setLocation(300,100); printB.setLocation(303,150); textF.setLocation (125,50); //set size of buttons exitB.setSize(90, 30); addB.setSize(75, 30); removeB.setSize(90, 30); searchB.setSize(90, 30); printB.setSize(90, 30); textF.setSize(268,30); //add them to the pane pane.add(exitB); pane.add(addB); pane.add(removeB); pane.add(searchB); pane.add(printB); pane.add(textF); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); }//ends const…
tagged with: arraylist
answer count: 2
tagged with: user-interface
has comment: http://stackoverflow.com/comment/36051445
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/36065296
type: Comment
type: QuestionComment
has text: IntBuffer and ByteBuffer have different positions to the same underlying data. I would just not use an IntBuffer here, you can use plain ByteBuffer and it would be simpler.
comment on: http://stackoverflow.com/q/23514069
score: 1

http://stackoverflow.com/q/23565445
score: 0
has comment: http://stackoverflow.com/comment/36164205
has title: Jackson Writer object missing characters during serialization
has comment: http://stackoverflow.com/comment/36161052
tagged with: serialization
has comment: http://stackoverflow.com/comment/36167615
type: UnansweredQuestion
has body: Jackson writer misses characters for instance: as you can see the first "value" property has a "case" attribute while the second one doesn't "value" : { "case" : 0.9992928025068476, "unit" : 0.0012222687181184695, "revenue" : 0.0019201603131782656, "cost" : 4.066965790792624E-9, "margin" : 0.0012176183516316138 }, "value" : { "0.9999990.9999999964045203, "unit" : 1.679374899388513E-7, "revenue" : 1.7145802215154812E-7, "cost" : 7.49609082287828E-18, "margin" : 1.6790001622333746E-7 }, How can this happen? My environment is multi-threaded and the serialization of JSON files happens in parallel. ObjectReader &amp; ObjectWriter are immutable so they are thread-safe and Mapper is not touched after static initialization... The class code is as follows: public class JsonFileRepository { private static final ObjectMapper mapper = new ObjectMapper(); private final ObjectReader reader; private final ObjectWriter writer; static { AnnotationIntrospector jaxbIntrospector = new JaxbAnnotationIntrospector(); mapper.setDeserializationConfig(mapper.getDeserializationConfig() .withAnnotationIntrospector(jaxbIntrospector)); mapper.setSerializationConfig(mapper.getSerializationConfig() .withAnnotationIntrospector(jaxbIntrospector)); mapper.configure( org.codehaus.jackson.map.SerializationConfig.Feature.WRAP_ROOT_VALUE, false); mapper.configure( org.codehaus.jackson.map.SerializationConfig.Feature.INDENT_OUTPUT, true); } public JsonFileRepository(String entityType, Class clazz) { this.reader = mapper.reader(clazz); this.writer = mapper.writerWithType(clazz); ... EDIT I serialize 70 entities, and it happens randomly approximately 2 times per run. Each time in different files, though the run is the same! UPDATE Moving from Jackson to Gson eliminated this behavior. So it is definitely either a wrong usage of Jackson on my behalf or a bug in Jackson ** FINAL UPDATE ** I was able to produce similar phenomena via Gson (though much less frequently), FINALLY I found the problem was indeed a mu…
has comment: http://stackoverflow.com/comment/36198257
has comment: http://stackoverflow.com/comment/65081095
has comment: http://stackoverflow.com/comment/36164484
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36161062
type: Question
has comment: http://stackoverflow.com/comment/36175900
tagged with: jackson

http://stackoverflow.com/comment/36211156
comment on: http://stackoverflow.com/q/23583951
score: 0
has text: What does the code you posted?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23566162
tagged with: network-programming
tagged with: libgdx
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23583409
answer count: 1
has title: KryoNet sendToAllTCP vs sendTCP
score: 0
accepted answer: http://stackoverflow.com/a/23583409
tagged with: kryonet
tagged with: tcp
has body: I am thinking about creating a networking game. The game should be a 2D platform shooter, created with Libgdx and Box2D. For the networking I planed following structure: Server and client are 2 programms Server handles ALL the ingame logic Client sends key/mouse inputs Server reacts on those and updates the whole level Server sends those updates (if possible 45 times per second so no client side interpolation needed) Client gets updates and updates its local level/world by using the received updates Client draws the things in its view frustum First question: What do you think about this structure? Next question: 45 times per second could be a lot of data upload from the serverside, if there are a few players which shoot a lot of bullets (player and bullet positions need to be send). To limit the upload needed i thought about using view frustum culling and send only the data/updates the client will actually see. Now i have seen the KryoNet method sendToAllTCP and wondered, if this method is somehow more efficient and could somehow upload the data only once, instead of once per client. I am not that experienced with networking and i don't really think that it is possible to have 1 upload for more then one client. But to be sure i ask. So is it more efficient to send every update of the level with sendToAllTCP or is it more efficient to send once for every client and then only things they can see?
type: AnsweredQuestion

http://stackoverflow.com/comment/36011056
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23484949
has text: Welcome to SO! Post code please, not just theory. Nice to see new people around :)

http://stackoverflow.com/comment/35976691
type: Comment
has text: fyi: my output with this test is "true"
comment on: http://stackoverflow.com/a/23466264
type: AnswerComment
score: 0

http://stackoverflow.com/q/23553413
tagged with: java
type: Question
has body: I am trying to develop a web project but it is required to authenticate the users with LDAP, I am doing something like this: Hashtable&lt;String, String&gt; env = new Hashtable&lt;String, String&gt;(); env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.PROVIDER_URL, "ldap://host:port"); env.put(Context.SECURITY_PRINCIPAL,"user@hostname.lab.local"); env.put(Context.SECURITY_CREDENTIALS, "mysecret"); env.put(Context.REFERRAL,"follow"); DirContext ctx = new InitialDirContext(env); And I do not get any errors, however I need to check status of user in order to give access. What else should I do? Am I going in the right way?
tagged with: apache
tagged with: tomcat
tagged with: ldap
score: 0
has answer: http://stackoverflow.com/a/23553494
answer count: 1
type: UnansweredQuestion
has title: LDAP Authentication with JSF and Tomcat
tagged with: jsf

http://stackoverflow.com/a/23576958
answers question: http://stackoverflow.com/q/23576911
type: Answer
has body: You've got a Swing threading problem where by trying to read in a file in the Swing event thread, you end up tying up the thread, freezing your GUI until the read is complete. I suggest that you create a background thread, such as that provided by a SwingWorker, with which to read in your File, and then after each line, publish the line to the JTextField, and perhaps if you wish, call Thread.sleep(...) in your background thread. An alternative is to read the whole file in in one fell swoop, again in a background thread, but then use a Swing Timer to display each row, one at a time.
score: 0

http://stackoverflow.com/comment/36209014
type: Comment
type: QuestionComment
score: 1
has text: Parse it as Double, then multiply and finally round to integer
comment on: http://stackoverflow.com/q/23591093

http://stackoverflow.com/comment/36197438
type: QuestionComment
comment on: http://stackoverflow.com/q/23584794
has text: Have you tried Runnable Jar File export option? it has an option to include dependencies.
score: 0
type: Comment

image-scaling
tags question: http://stackoverflow.com/q/23466597
tag name: image-scaling
type: Tag

http://stackoverflow.com/a/23521383
type: Answer
accepted answer of: http://stackoverflow.com/q/23517075
answers question: http://stackoverflow.com/q/23517075
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1
has body: Thanks Stephane, This post Actually guided me to exclude the dependencies to logback and jcl-over-slf4j. Now it's working fine.

http://stackoverflow.com/a/23619574
has body: You should check your bounds before adding/removing from your int[] a (i.e. 500 is not a valid index). Also, look at your constructor IntegerSet(input[] n), you cannot just directly "assign" it like that. You need to parse the array and update your local a[] properly. "n" ranges from 0-255 for values, whereas "a" should only be {1,0}. A few other things need fixing too.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23533231
score: 0
accepted answer of: http://stackoverflow.com/q/23533231
type: Answer

http://stackoverflow.com/a/23603296
has body: Your text is unclear. If 31st character exists is the 32nd character optional or required? [A-Z1-9]{0,30}?(?:[A-Z]|[A-Z][1-9])? This one allows 30 characters, 31 characters or 32 characters. [A-Z1-9]{0,30}?(?:[A-Z][1-9])? This one allows 30 characters or 32 characters (i.e. if 31st is present then 32nd is required).
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23603086
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36232218

http://stackoverflow.com/a/29369701
type: Answer
has body: You have to put wallmusic.release() somewhere in your code to release memory otherwise this error will occure.
score: 0
answers question: http://stackoverflow.com/q/23591709

http://stackoverflow.com/comment/49821399
type: Comment
comment on: http://stackoverflow.com/a/23555260
type: AnswerComment
has text: add this line if your index does not exists before mapping client.admin().indices().create(new CreateIndexRequest("indexname")).actionGet(); prior to applying mapping otherwise indexMissingException will be thrown
score: 1

http://stackoverflow.com/comment/36097143
has text: You should not use multiple Scanner objects for a single stream, as it will be consumed. [Here's some more info around that](https://www.securecoding.cert.org/confluence/display/java/FIO06-J.+Do+not+create+multiple+buffered+wrappers+on+a+single+InputStream). Use a single scanner object, and then the issues can be worked out from there.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23530609
type: QuestionComment

http://stackoverflow.com/q/23558886
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
type: Question
answer count: 1
favorite count: 0
has title: Potentially insecure random numbers on Android 4.3 and older
upvote count: 3
tagged with: android
has body: After updating Android SDK, I noticed this new warning in my code: Potentially insecure random numbers on Android 4.3 and older. Read https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.html for more info. My code for usage is following where seed is user typed string: KeyGenerator kgen = KeyGenerator.getInstance("AES"); // Gives warning SecureRandom sr = SecureRandom.getInstance("SHA1PRNG", "Crypto"); sr.setSeed(seed); kgen.init(BLOCKS, sr); SecretKey skey = kgen.generateKey(); So my question is, that is the code still safe to use because of the seed? If not does the code in the link provide fix to use the same code after running PRNGFixes.apply()?
has answer: http://stackoverflow.com/a/23558919
accepted answer: http://stackoverflow.com/a/23558919

http://stackoverflow.com/q/23493684
linked to: http://stackoverflow.com/q/457629
has comment: http://stackoverflow.com/comment/36026393
favorite count: 0
tagged with: return
has answer: http://stackoverflow.com/a/23493920
has answer: http://stackoverflow.com/a/34474253
has answer: http://stackoverflow.com/a/34472524
has comment: http://stackoverflow.com/comment/56818884
type: UnansweredQuestion
has title: How to use multiple values returned by one method in another method
has answer: http://stackoverflow.com/a/34499577
has answer: http://stackoverflow.com/a/34531081
has body: I'm having trouble (in Java) trying to figure out how to use variables that are returned from one method and then calling another method with those returned variables. Here's what I have: public static void main(String[] args) { sortFile(args[0]); // this returns 3 variables, nWords, nSyllables, nSentences getFRE(nWords, nSyllables, nSentences); // these "cannot be resolved to a variable" } Is what I'm trying to do not possible? I'm sure it's something really simple. Thanks
score: 2
has comment: http://stackoverflow.com/comment/36026330
has answer: http://stackoverflow.com/a/23493720
downvote count: 0
has answer: http://stackoverflow.com/a/34513065
tagged with: java
linked to: http://stackoverflow.com/q/7470861
has comment: http://stackoverflow.com/comment/56723051
tagged with: methods
linked to: http://stackoverflow.com/q/16609269
has answer: http://stackoverflow.com/a/34543706
type: Question
has comment: http://stackoverflow.com/comment/36026399
answer count: 11
has answer: http://stackoverflow.com/a/23495603
has answer: http://stackoverflow.com/a/23493825
has comment: http://stackoverflow.com/comment/36026667
upvote count: 2
has answer: http://stackoverflow.com/a/34530851

http://stackoverflow.com/comment/36132908
has text: What results did you get when you profiled it yourself?
score: 3
comment on: http://stackoverflow.com/q/23550288
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36183157
type: Comment
type: QuestionComment
has text: `I get insane amounts of slow down,` - what do you mean? The rendering doesn't just stop in the middle and do nothing. If it only takes 2% CPU, then that is all that is needed to do the rendering. If you think the painting should be faster than post your [SSCCE](http://www.sscce.org/) that demonstrates the problem. You probably have other problems in the code not related to the rendering.
comment on: http://stackoverflow.com/q/23576889
score: 1

http://stackoverflow.com/a/23519375
has comment: http://stackoverflow.com/comment/36136379
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/36120005
type: Answer
has body: This line String hiddenname = request.getParameter("hiddenname"); may result in hiddenname beeing null (see ServletRequest#getParameter) so when you do if (hiddenname.equals("login")) you get a NullPointerException change it to yoda notation (it's a best pactice anyways) if ("login".equals(hiddenname)) ... else if("update".equals(hiddenname)) "login" (a string literal in general) can never be null and you won't get a NPE. Or make sure that the request parameter is always present.
has comment: http://stackoverflow.com/comment/36079247
has comment: http://stackoverflow.com/comment/36079507
accepted answer of: http://stackoverflow.com/q/23514780
answers question: http://stackoverflow.com/q/23514780

http://stackoverflow.com/a/23503822
type: Answer
has body: First, why were you told not to multithread? That seems like a pretty limiting rule for modern computers. It seems as if you wanna schedule a task to fire at a given rate. You should look into Timer#schedule(). It allows you to pass in a task, as well as some configuration for timing that task. public class TimerDemo { public static void main(String[] args) { // creating timer task, timer TimerTask tasknew = new TimerSchedulePeriod(); Timer timer = new Timer(); // scheduling the task at interval timer.schedule(tasknew, 0, 10); } // this method performs the task public void run() { System.out.println("timer working"); } } Source of code: http://www.tutorialspoint.com/java/util/timer_schedule_period.htm
score: 0
answers question: http://stackoverflow.com/q/23503686

http://stackoverflow.com/q/23463740
has title: Android/Java Parse anonymous JSONArray object
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Duplicate of Get JSONArray without array name? Server is returning me the following anonymous JSONArray, I don't know how to parse it. Please help me in parsing it. I am not using any library like Gson, I am using org.json.JSONObject. Pleaes help. [ { "provider_metadata": { "filename": "vr-banner-small.png" }, "name": "vr-banner-small.png", "enabled": false, "provider_name": "sonata.media.provider.image", "provider_status": 1, "provider_reference": "1debc89fa2a4a54599c48ba13f9ccfe1ff7c2360.png", "width": 183, "height": 122, "context": "default", "updated_at": "2014-04-18T22:54:50+0800", "created_at": "2014-04-18T22:54:50+0800", "content_type": "image/png", "size": 42117, "id": 190 }, { "provider_metadata": { "filename": "Chrysanthemum.jpg" }, "name": "中文名稱.png", "enabled": false, "provider_name": "sonata.media.provider.image", "provider_status": 1, "provider_reference": "2d2ea78282c45fac7c7a3b3e37c77b92b05850cb.jpeg", "width": 1024, "height": 768, "context": "default", "updated_at": "2014-04-19T03:16:53+0800", "created_at": "2014-04-18T22:59:11+0800", "content_type": "image/jpeg", "size": 879394, "id": 191 }, { "provider_metadata": { "filename": "1111.jpg" }, "name": "1111.jpg", "enabled": false, "provider_name": "sonata.media.provider.image", "provider_status": 1, "provider_reference": "605e5a4ec678546d780a72ffa0629c901d65bb1b.jpeg", "width": 284, "height": 160, "context": "default", "updated_at": "2014-04-18T23:02:24+0800", "created_at": "2014-04-18T23:02:24+0800", "content_type": "image/jpeg", "size": 26337, "id": 192 }, { "provider_metadata": { "filename": "vr-banner-medium.png" }, "name": "vr-banner-medium.png", "enabled": false, "provider_name": "sonata.media.provider.image", "provider_status": 1, "provider_reference": "75ec61e5b12b2d0868886297c073f6228bf9fdcc.png", "width": 183, "height": 314, "context": "default", "updated_at": "2014-04-18T23:47:34+0800", "created_at": "2014-04-18T23:47:34+0800", "content_type": "image/png", "size": 87214, "id": 193 }, { "pr…
duplicate of: http://stackoverflow.com/q/10164741
has answer: http://stackoverflow.com/a/23463760
accepted answer: http://stackoverflow.com/a/23463760
type: Question
tagged with: arrays
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/10164741
possible better answer: http://stackoverflow.com/a/23463838
has answer: http://stackoverflow.com/a/23463838
tagged with: android
tagged with: anonymous
type: AnsweredQuestion

http://stackoverflow.com/q/23479409
has title: In need of a clear example on how to get the word count of DOC and DOCX files
has body: I am able to read a DOC file and get its word count, BUT it is wrong. My code: public class WordCounter { public static void main(String[] args) throws Throwable { processDOC(); } private static void processDOC() throws Throwable { File file = new File("/Users/yjiang/Desktop/whatever.doc"); File file2 = new File("/Users/yjiang/Desktop/Test.docx"); File file3 = new File("/Users/yjiang/Desktop/QB Tests 4-14-2014.xls"); File file4 = new File("/Users/yjiang/Desktop/QB Tests 4-14-2014.xlsx"); try { FileInputStream fs = new FileInputStream(file); POIFSFileSystem poifsFileSystem = new POIFSFileSystem(fs); DirectoryEntry directoryEntry = poifsFileSystem.getRoot(); DocumentEntry documentEntry = (DocumentEntry) directoryEntry.getEntry(SummaryInformation.DEFAULT_STREAM_NAME); DocumentInputStream dis = new DocumentInputStream(documentEntry); PropertySet ps = new PropertySet(dis); SummaryInformation si = new SummaryInformation(ps); System.out.println(si.getWordCount()); } catch (Exception e) { e.printStackTrace(); } try { HWPFDocument hwpfDocument = new HWPFDocument(new FileInputStream(file)); System.out.println(hwpfDocument.getDocProperties().getCWords()); // actually 71 words using word count in MSWord, returned 57. System.out.println(hwpfDocument.getDocProperties().getCWordsFtnEnd()); XWPFDocument xwpfDocument = new XWPFDocument(new FileInputStream(file2)); // actually 71 words using word count in MSWord, returned 57. System.out.println(xwpfDocument.getProperties().getExtendedProperties().getUnderlyingProperties().getWords()); System.out.println(); } catch (Exception e) { e.printStackTrace(); } } } "whatever.doc" has 71 words, when I run this, it returns only 57. Seems I cannot use the same method to read DOCX files, when I run it I get the following: 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 …
tagged with: http://stackoverflow.com/tag/docx
type: UnansweredQuestion
tagged with: apache-poi
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36013590
has comment: http://stackoverflow.com/comment/36031274
tagged with: doc
tagged with: apache
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/49825847
favorite count: 0

binary
tags question: http://stackoverflow.com/q/23613895
tags question: http://stackoverflow.com/q/23573748
tags question: http://stackoverflow.com/q/23524933
tags question: http://stackoverflow.com/q/23551540
tag name: binary
tags question: http://stackoverflow.com/q/23463784
tags question: http://stackoverflow.com/q/23489321
tags question: http://stackoverflow.com/q/23463160
tags question: http://stackoverflow.com/q/23508860
tags question: http://stackoverflow.com/q/23587821
type: Tag

http://stackoverflow.com/comment/36028256
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23494223
has text: Actually I do not want to post attr1 and attr2 to the server at all....Since on my Resource layer in MyVO, I only have attr1and2

http://stackoverflow.com/q/23475157
has title: Swipe Tab - NullPointerException - Android
has answer: http://stackoverflow.com/a/28731214
favorite count: 0
tagged with: nullpointerexception
tagged with: android
type: AnsweredQuestion
tagged with: pagerslidingtabstrip
tagged with: android-tabs
has answer: http://stackoverflow.com/a/23475437
type: Question
has comment: http://stackoverflow.com/comment/35992495
has comment: http://stackoverflow.com/comment/35992239
has body: I followed this tutorial: #127 Android Scrollable Tabs Part 1:Android Tutorial For Beginners and I created three Fragments with three layouts, but I get java.lang.NullPointerException. I don't know where is wrong. MainActivity.java: public class MainActivity extends FragmentActivity implements TabListener { ViewPager viewPager; ActionBar actionBar; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setAdapter(new MyAdapter(getSupportFragmentManager())); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // TODO Auto-generated method stub actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int position, float arg1, int pixels) { // TODO Auto-generated method stub } @Override public void onPageScrollStateChanged(int position) { // TODO Auto-generated method stub } }); actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.Tab tab1 = actionBar.newTab(); tab1.setText("Tab 1"); tab1.setTabListener(this); ActionBar.Tab tab2 = actionBar.newTab(); tab2.setText("Tab 2"); tab2.setTabListener(this); ActionBar.Tab tab3 = actionBar.newTab(); tab3.setText("Tab 3"); tab3.setTabListener(this); actionBar.addTab(tab1); actionBar.addTab(tab2); actionBar.addTab(tab3); } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub viewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { // TODO Auto-generated method stub } } class MyAdapter extends FragmentPagerAdapter { public MyAdapter(FragmentManager fm) { super(fm); // TODO Auto-generated constructor stub } @Override public…
tagged with: java
linked to: http://stackoverflow.com/q/9564947
score: 4
upvote count: 4
answer count: 2
possible better answer: http://stackoverflow.com/a/28731214
accepted answer: http://stackoverflow.com/a/23475437
downvote count: 0
has comment: http://stackoverflow.com/comment/35992116

http://stackoverflow.com/comment/36068063
type: QuestionComment
has text: Have you tried (and profiled) anything?
comment on: http://stackoverflow.com/q/23516030
score: 0
type: Comment

runtime
tags question: http://stackoverflow.com/q/23473546
type: Tag
tag name: runtime
tags question: http://stackoverflow.com/q/23476405

http://stackoverflow.com/q/23492986
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23493028
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: imageview
has body: This problem is really driving me mad. I have spent 2-3 days just trying to pass it. I have a listview, I iterate through each list element to set their images from a drawable. I checked if findViewById works, and it does because logcat gave me the id it had. When I try to setImageResource or use Picasso to load the image from the internet nothing happens and the images do not appear. Here is the ImageView definition in the XML: &lt;ImageView android:id="@+id/Photo" android:layout_height="100dp" android:layout_width="100dp" android:contentDescription="@string/desc" /&gt; And here is the iteration process: for (int i = 0; i &lt; list.getCount(); i++) { v = mAdapter.getView(i,null, list); ImageView photo = (ImageView) v.findViewById(R.id.Photo); photo.setImageResource(R.drawable.abc_ab_bottom_solid_dark_holo); } It looks a very simple task to do but for some reason it is not working. I tried cleaning the project if that might matter. Also, This is all in a fragment, and I have already used setAdapter on the list. I really appreciate any help..
has title: What Does It Mean If findViewById finds view but setText or setImageResource Do not work
tagged with: listview
accepted answer: http://stackoverflow.com/a/23493028

http://stackoverflow.com/comment/36282746
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23556665
has text: This required some extra work (the resources you linked skip quite a bit, and if I had not done research beforehand, I don't think I could've made sense of these), but I've got it running. I think I might amend your answer with some extra info, if I can figure out how to format it properly.

http://stackoverflow.com/comment/36230168
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23602266
type: Comment
has text: Ok, but I don't want to change what is in the cell, I just want the image to be shown when the cursor of the mouse is on the cell

http://stackoverflow.com/q/23469007
score: 7
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35982774
tagged with: mongodb
answer count: 3
has comment: http://stackoverflow.com/comment/35981437
has answer: http://stackoverflow.com/a/32985165
upvote count: 7
has answer: http://stackoverflow.com/a/32737189
accepted answer: http://stackoverflow.com/a/32737189
has title: Mongodb java driver cannot reconnect to primary after a crash
has body: I have an issue when trying the failover capacity of mongodb with the java driver. I have a cluster of primary/secondary mongodb, namely server1 and server2. When I kill the primary server1 to simulate a failure the server2 becomes primary in a few seconds and my applications, that access mongo using the java driver, start using the new primary server2. When I re-start server1, it takes back it's primary role in a few seconds but then my application, instead of connecting to the server1 still tries to connect to server2 and, as it's now in secondary state failled! All the requests are failling with this error : com.mongodb.MongoServerSelectionException: Unable to connect to any server that matches {serverSelectors=[ReadPreferenceServerSelector{readPreference=primary}, LatencyMinimizingServerSelector{acceptableLatencyDifference=15 ms}]} I am using a mongodb 2.6 and a java driver 2.12. I am not passing any parameter to my MongoClient that is created using all the nodes of my cluster. Any help will be welcome. Regards, Loïc
possible better answer: http://stackoverflow.com/a/32734880
favorite count: 0
has comment: http://stackoverflow.com/comment/53314748
has comment: http://stackoverflow.com/comment/53231336
has answer: http://stackoverflow.com/a/32734880
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/36221246
type: QuestionComment
comment on: http://stackoverflow.com/q/23597287
has text: I guess you re missing Google play services. you can install it from sdk manager
score: 2
type: Comment

http://stackoverflow.com/comment/78474398
type: Comment
score: 0
has text: @VJVishalJogiya Seems you are updating your data by other means than the greendao-entities. First you should try to avoid this! If that's not possible `daoSession.clear()` can be used. Depending on your app your performance will decrease, because of the repeated queries against the database.
comment on: http://stackoverflow.com/a/23495650
type: AnswerComment

http://stackoverflow.com/a/23484651
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23484233
has body: In addition to adding the jars, you also need to add the natives. You can do so with Djava.library.path="C:\[absolute path to dir containing *.dll files and such]" Note that you need to provide the directory, not the file itself.

http://stackoverflow.com/a/23603141
has comment: http://stackoverflow.com/comment/36232095
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23602789
has body: Here is some link I think it will help you in your learning process. Oracle Application Development Framework - Oracle ADF Series of presentations will take you through the basics of learning Oracle's ADF Learn ADF in Steps ADF Code Corner Articles

http://stackoverflow.com/a/47752543
answers question: http://stackoverflow.com/q/23517139
score: 1
upvote count: 1
downvote count: 0
has body: It called if url starts with "https" if(url.startswith("https"){ HttpsURLConnection httpCon = (HttpsURLConnection) url.openConnection(); } use netty-3.9.2 > .jar to solve this issue When you use this netty.jar. the process of post call changed. http://dl.bintray.com/netty/downloads/netty-3.9.12.Final.tar.bz2
has comment: http://stackoverflow.com/comment/82466316
type: Answer

http://stackoverflow.com/comment/36222896
comment on: http://stackoverflow.com/q/23598281
score: 0
has text: @Marco13 Indeed that would be a start, drawing a rectangle image, and then clip it to with the Shape of my area.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36094337
score: 0
type: AnswerComment
type: Comment
has text: Hi Braj, I very much appreciate all the assistance you have provided. Now all I need to do is get the migration to my new Windows 8 PC fixed and I am right. Thank you very much, Glyn.
comment on: http://stackoverflow.com/a/23512190

http://stackoverflow.com/a/23463151
answers question: http://stackoverflow.com/q/23463055
type: Answer
has body: First, you can't call indexOf on an array. I think you are getting confused with ArrayList. To find the index of an object in an array, make a method like this: (this would require you to make it an Character[]) public static &lt;E&gt; int indexOf(E[] array, E item) { for (int i = 0; i &lt; array.length; i++) if(array[i].equals(item)) return i; throw new InvalidParameterException("Item not in array."); } Or you could convert the array to an ArrayList&#60;Character&#62; and call the method indexOf(int).
score: 0

http://stackoverflow.com/a/23489645
has body: It's just a matter of the syntax. If you look how to import a specific class: import java.util.List; it seams consistent to express import everything from some package by using the asterisk * like in so many other environments: pattern matching, Ant, etc. import java.util.*; The asterisk has a history to match "everything". And due to conventions and not any Java restrictions, you would not be able to distinguish between the sub-package io and a class named io. There is no compile error if you name a class not starting with an uppercase letter.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23489568
score: 2
upvote count: 2

http://stackoverflow.com/q/23615275
tagged with: android
has comment: http://stackoverflow.com/comment/36255642
has title: Android: Application Crashing when loading listview oncreate
accepted answer: http://stackoverflow.com/a/23629514
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36254699
has body: Whenever I run my SetList Method oncreate the app crashes on startup(the method works fine when called via an on click event etc) I am very new to android development so I am not entirely sure of the order of operations are for the program startup. Line 130: lv.setAdapter(adapter); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } LoadLogs(); } ArrayList&lt;String&gt; Logs = new ArrayList&lt;String&gt;(); String path = Environment.getExternalStorageDirectory().getAbsolutePath(); String name = "Logs.txt"; boolean Returned = true; public void LoadLogs() { File file = new File(path,name); try { if(!file.exists()) { file.createNewFile(); } } catch(Exception e) { e.printStackTrace(); } try { BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); String l; Returned = true; while (( l = bufferedReader.readLine()) != null) { Returned = l.contains("Returned"); Logs.add(l); } } catch (Exception e) { e.printStackTrace(); } SetList(); } public void SetList() { ListView lv = (ListView) findViewById(R.id.listView1); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1,Logs); lv.setAdapter(adapter); } Layout: &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$PlaceholderFragment" &gt; &lt;Button android:id="@+id/button2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layou…
tagged with: java
tagged with: eclipse
answer count: 1
has answer: http://stackoverflow.com/a/23629514
score: 0

http://stackoverflow.com/comment/36087628
type: Comment
has text: it would happen if the `Suite` class itself is unloaded, which does not happen in normal use.
type: AnswerComment
comment on: http://stackoverflow.com/a/23525993
score: 0

database-migration
tags question: http://stackoverflow.com/q/23545657
tag name: database-migration
type: Tag

http://stackoverflow.com/comment/139078665
comment on: http://stackoverflow.com/q/23505346
score: 0
has text: They also interact. The interaction between parametric polymorphism and subtyping polymorphism leads to the concepts of variance and bounded quantification. [Source](https://en.wikipedia.org/wiki/Polymorphism_(computer_science)#Subtyping)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23562005
answer count: 1
favorite count: 0
tagged with: annotations
accepted answer: http://stackoverflow.com/a/23584037
score: 6
type: AnsweredQuestion
tagged with: playframework-2.0
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23584037
type: Question
has body: Working with Play Framework 2.2, making a RESTfull API. In a model I'm using, I wanted to output(Json with Jackson) only the Id of a related object, not the entire object. I found how to do that, as follows: @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id") @JsonIdentityReference(alwaysAsId = true) @JsonIgnore public Object myObject; The Json output will contain a JsonNode "myObjectId: 1". For instance. The IdentityInfo and IdentityReference take care of this. The problem is, wherever I want this, I have to paste down these 3 lines, along with any other annotations that need to be present for a certain field. This get grow too large and I'm trying to create just 1 custom annotation that does all these things together. Is this possible, and how? A link where I can read about it or an example would be appreciated.
upvote count: 6
has title: Java make a separate annotation that combines a others
tagged with: jackson

http://stackoverflow.com/a/23508497
answers question: http://stackoverflow.com/q/23508448
type: AcceptedAnswer
downvote count: 0
has body: When I make a few assumptions, public static void main(String[] args) { String getErrText = ""; // &lt;--------------- To trigger else. String readerIterator = "Yes it is"; // &lt;-- To display a message. if (getErrText.length() &gt; 0) { // &lt;-------- else means that getErrText **must** be "" System.out.println(getErrText + " For " + readerIterator); } else { System.out.println("Error is not displayed " + "- Err Cell For " + readerIterator); } } Output is Error is not displayed - Err Cell For Yes it is As I would expect. Edit As per comment(s), your actual problem is likely to be one of // trim() the String! if (getErrText != null &amp;&amp; getErrText.trim().length() &gt; 0) { // as before... } or silently swallowing your exception. Please don't do that. try { getErrText = toSearch.errorCell.getText(); getErrText = (getErrText != null) ? getErrText.trim() : ""; }catch(Exception e){ e.printStackTrace(); }
type: Answer
accepted answer of: http://stackoverflow.com/q/23508448
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36058075

http://stackoverflow.com/q/23601681
upvote count: 21
has title: How to use @XmlElement and @XmlRootElement for marshalling object inside an object?
tagged with: jaxb
has answer: http://stackoverflow.com/a/23601799
type: Question
possible better answer: http://stackoverflow.com/a/23607129
has answer: http://stackoverflow.com/a/23607129
downvote count: 0
answer count: 3
has body: I have seen many implementations of JAXB where we can convert java primitive to XML element using @XmlElement annotation. But, I want to convert following POJO to XML (Note there is an address object inside employee class and not just primitives): public class Employee { private Address address; private int employeeId; // constructors + setters + getters } How to use these JAXB annotations to marshall an employee object to XML? Thanks.
has answer: http://stackoverflow.com/a/23601922
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 21
tagged with: java
accepted answer: http://stackoverflow.com/a/23601922

http://stackoverflow.com/comment/36030989
type: Comment
score: 2
comment on: http://stackoverflow.com/q/23495944
has text: remove `start`. You are spawning 2 `cmd` process and waiting for the first while the second runs free.
type: QuestionComment

http://stackoverflow.com/q/23568914
has answer: http://stackoverflow.com/a/23569142
score: 0
has body: I have this query below. I've checked it in ms access and it works fine. But when I add it to my program, A "Syntax error in FROM clause." appears. Any suggestions on how to resolve this? String query ="TRANSFORM COUNT(a.present)\n" + "SELECT e.ID,e.firstName,e.lastName,e.position,e.rate\n" + "FROM employees e \n" + "INNER JOIN attendance a \n" + "ON e.ID = a.empID \n" + "GROUP BY e.ID,e.firstName,e.lastName,e.position,e.rate \n" + "PIVOT a.dateAttended"; this is the full method where the query belongs. The connectToDB method is used to insert the result set to a jtable. Are jtables able to insert pivot queries? private void attendanceView() throws ClassNotFoundException{ try{ String query ="TRANSFORM COUNT(a.present) " + "SELECT e.ID,e.firstName,e.lastName,e.position,e.rate " + "FROM employees e " + "INNER JOIN attendance a " + "ON e.ID = a.empID " + "GROUP BY e.ID,e.firstName,e.lastName,e.position,e.rate " + "PIVOT a.dateAttended"; Object[][] result = connectToDB(query); System.out.print(result); monthlyAttendanceTable.setModel(new javax.swing.table.DefaultTableModel( result, new String [] {"Employee ID","First Name","Last Name", "Position", "Rate","",""} ) { Class[] types = new Class [] { java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class,java.lang.Integer.class,java.lang.Integer.class,java.lang.String.class }; boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false, false, false,false }; public Class getColumnClass(int columnIndex) { return types [columnIndex]; } public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); }catch (ClassNotFoundException ex) { Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, null, ex); ex.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/36168350
tagged with: java
tagged with: select
has comment: http://stackoverflow.com/comment/36167831
downvote count: 1
has comment: http://stackoverflow.com/comment/36167926
has comment: http://stackoverflow.com/comment/36167768
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36167778
type: Question
tagged with: sql
has comment: http://stackoverflow.com/comment/36167743
tagged with: ms-access
favorite count: 0
linked to: http://stackoverflow.com/q/23552345
has title: Error in the "FROM CLAUSE"
has comment: http://stackoverflow.com/comment/36167955
upvote count: 1
has comment: http://stackoverflow.com/comment/36168121
has comment: http://stackoverflow.com/comment/36167855

http://stackoverflow.com/q/23463522
has title: Display an array of objects in a GUI
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23463544
has body: I am working on a program that is supposed to track the inventory of Blu-ray movies. I have stored the movies in an object array (the array stores the name, ID, number of discs, and price of each movie). I know ArrayLists are a more efficient way of storing the objects in an array, but for the purpose of this assignment I am required to use an array. I have previously had this program print out to the console with not problem, but I'm trying to add this program to a GUI. I have already written a class for the GUI, but I cannot figure out how to add the arrays to the JPanel and JFrame. Here is my GUI class: class TextInFrame extends JFrame { private JLabel greeting; private JLabel inventoryUnsorted; private JPanel panel; public TextInFrame(){ super("Blu-ray Movie Inventory"); setLayout(new FlowLayout()); JFrame.setDefaultLookAndFeelDecorated(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); pack(); setVisible(true); panel = new JPanel(); greeting = new JLabel(BluRay.programGreeting()); add(greeting); greeting.setVerticalTextPosition(JLabel.BOTTOM); greeting.setHorizontalTextPosition(JLabel.CENTER); panel.add(greeting); this.add(panel); } } Here is a portion of my main method that has the public class Inventory { public static void main(String[] args) { TextInFrame window = new TextInFrame(); window.setSize(600, 600); BluRay[] movies = new BluRay[5]; movies[0] = new BluRay("Man of Steel", "48461", 24, 17.99); movies[1] = new BluRay("Fast Five", "84624", 10, 12.99); movies[2] = new BluRay("Batman Begins", "15483", 19, 13.98); movies[3] = new BluRay("X-Men", "48973", 6, 15.99); movies[4] = new BluRay("The Outsiders", "01893", 16, 9.98); String[] stringArray = Arrays.copyOf(movies, movies.length, String[].class); // loop to print through the BluRay movies array for (String string : stringArray) { System.out.println(string); } Every time I try to add the array into a JLabel or JPanel, I get the error "BluRay[] cannot be converted to Strin…
score: 0
tagged with: user-interface
tagged with: arrays
answer count: 1
favorite count: 0
tagged with: jframe
has answer: http://stackoverflow.com/a/23463544
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14737810

http://stackoverflow.com/comment/36071162
score: 0
type: Comment
type: QuestionComment
has text: If you feel like you want to implement it, here's the link how you do it swiftly. http://stackoverflow.com/questions/22701363/use-etsys-staggeredgridview-in-eclipse
comment on: http://stackoverflow.com/q/23517404

http://stackoverflow.com/q/23588707
answer count: 2
accepted answer: http://stackoverflow.com/a/23588810
downvote count: 0
has body: This must be quite elementary, but I'm fairly new to Maven and I didn't find this info. I have the typical mavenized Java project (I use Eclipse), with a main artifact (src/main/java -> mylib.jar ) and the additional classes in src/test/java (not only unit tests, but also miscellanous code, samples, etc, that I don't want to include in the main jar). My question is: how I can be sure that there are no circular dependencies inside the classes-artifacts of my project? Specifically, how can be sure that inadvertently some class of main is depending on some test\? I'm concerned about the possibility of releasing a broken mylib.arj. Eclipse knows about dependency among projects, but here we have only one project. Is there some standard way?
favorite count: 0
possible better answer: http://stackoverflow.com/a/23589019
has answer: http://stackoverflow.com/a/23589019
has title: Maven layout: How to be sure that src/main does not depend on src/test?
has answer: http://stackoverflow.com/a/23588810
tagged with: maven
upvote count: 1
tagged with: dependency-management
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/36052174
type: Comment
has text: Is software certifying/signing inexpensive? I saw some yearly fees online of over $100 and I wouldn't be willing to spend more than a couple dollars on getting my student programming projects signed.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23506512

http://stackoverflow.com/a/23479115
downvote count: 0
answers question: http://stackoverflow.com/q/23477743
type: Answer
has body: Note that root (/) means the context root of your web application. /servlet Matches to a specific resource that maps directly to path servlet under root(/) /servlet/* Matches to any resource under /servlet. /* Matches to any resource under root(/). *.do Matches to a specific file pattern i.e. that ends with .do.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23477743
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/36223906
type: AnswerComment
has text: You shouldn't be thinking in terms of time, but rather game turns (i.e. game loop iterations). If you have a "render" method in your game loop (like in the updated `run` method above), it can at least increment a game turn counter, which is a field that can be read by `shouldMove` methods. If you are at round `r`, then your `shouldMove` method has two parameters (`r` and animal index `i`) which it can use to decide whether it's time to skip this round.
score: 0
comment on: http://stackoverflow.com/a/23598785
type: Comment

slick2d
tags question: http://stackoverflow.com/q/23510445
tags question: http://stackoverflow.com/q/23610295
type: Tag
tag name: slick2d

http://stackoverflow.com/a/23464686
downvote count: 0
has body: Both languages should work the same, and I can't see any obvious bugs in your code. However it's not clear what IP address your using for all your examples: a) Your java example doesn't specify an IP address to bind to (I assume by default it will bind to 0.0.0.0 i.e all local IP addresses, but you can check using netstat). b) The C# code will just bind to the first IP address it finds. This could be something like 127.0.0.1. To make sure, just change both code fragments to explicitly bind to the expected IP address (192.168.0.196) and try again.
type: Answer
accepted answer of: http://stackoverflow.com/q/23464570
has comment: http://stackoverflow.com/comment/35973606
answers question: http://stackoverflow.com/q/23464570
has comment: http://stackoverflow.com/comment/35975979
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35975989
type: AcceptedAnswer

http://stackoverflow.com/a/23491992
has body: Take a look at flyaway, a java tool for db migration and version control. Another alternative is liquibase but I find it more heavyweight than flyaway. Flyaway can be embedded in your application and run on startup or can be triggered via ant/maven/gradle etc.
has comment: http://stackoverflow.com/comment/36023501
score: 0
has comment: http://stackoverflow.com/comment/36023687
type: Answer
answers question: http://stackoverflow.com/q/23491835
has comment: http://stackoverflow.com/comment/36023467

http://stackoverflow.com/q/23454489
has comment: http://stackoverflow.com/comment/35963721
tagged with: arrays
tagged with: string
favorite count: 0
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23454506
has answer: http://stackoverflow.com/a/23454516
has title: JAVA So i have this code that i am using arrays of [60] and when i use the add command it rewrites all the previous statements i made
possible better answer: http://stackoverflow.com/a/23454506
tagged with: addition
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35954377
type: AnsweredQuestion
has body: Could you please help me figure out why when i add a new book it overwrites all of the books with the current one? ---------------------- |Name| -|ISBN|-|Author| for example i add a book called |game| | of | Thrones| and if i go &amp; add a book named |Song| | of | Ice and fire | no matter if there are 10 books there they will all be renamed according to the last entry (here Song of ice and fire) //Package ask1 main class Library package ask1; import java.lang.Object.*; import java.util.Scanner; import java.util.Arrays; import java.io.*; public class library { public static void main(String[] args) throws InstantiationException, IllegalAccessException { Management manager = new Management(); Scanner input = new Scanner(System.in); Book vivlio = new Book(); System.out.println("\n\t\t^*^*^*^*^*^*^* LIBRARY MANAGEMENT ^*^*^*^*^*^*^"); while (true) { System.out.println("------------------MENU-------------------------------"); System.out.print("\nENTER UR CHOICE\n\t" + "1:Add a new Book\n\t" + "2:Edit Book Infos\n\t" + "3:Search a Book (with ISBN)\n\t" + "4:Show all the Books\n\t" + "5:Delete a Book (with ISBN)\n\t" + "6:Exit \n :"); int selection; selection = input.nextInt(); if (selection == 1) { System.out.println("Adding a new book "); String empty = input.nextLine(); System.out.println("name of book:"); vivlio.name = input.nextLine(); System.out.println("Author:"); vivlio.author = input.nextLine(); System.out.println("ISBN:"); vivlio.isbn = input.nextLine(); System.out.println("Number of copies:"); vivlio.number = input.nextInt(); System.out.println(""); manager.AddBook(vivlio); } else if (selection == 2) { System.out.println("Editing a Book "); System.out.println("Please enter title of book to edit:"); String title = input.next(); Book editingBook = findBookByTitle(title); if (editingBook == null) { System.out.println("Sorry no book found with title name = " + title); } else { //ask user for new price etc what ever you want to edit. System.out.println("Please enter…
accepted answer: http://stackoverflow.com/a/23454516
tagged with: java
has comment: http://stackoverflow.com/comment/35954460
type: Question
has answer: http://stackoverflow.com/a/23454670

http://stackoverflow.com/a/24605852
type: Answer
answers question: http://stackoverflow.com/q/23516144
score: 2
upvote count: 2
has body: I ran into the same problem. To achieve that the example works, you need to complete three steps: Add google play services lib (did) Add android support v4 library (did) And finally note that the source code in this examples are in java/com/google/android/gcm/demo/app/ directory, but when eclipse compiles the source code not search in this path for source code. For solving this you have two options: Create a package named com.google.android.gcm.demo.app into src folder (right click -> New -> Package) and then move the three source code java files to src directory (just drag and drop). Finally clean the project (go to Project -> Clean). Note that src directory is by default in the java build path. or Add the path of source code to java build path. Go to project properties -> Java Build Path -> Add Folder... -> now select Java directory -> OK. I attach a screenshot to help https://i.sstatic.net/yQoLC.png Sorry for my English. I hope this helps.
downvote count: 0

http://stackoverflow.com/comment/36110928
comment on: http://stackoverflow.com/q/23538399
type: QuestionComment
score: 2
has text: who said there is error and what it exactly says?
type: Comment

http://stackoverflow.com/comment/36065510
comment on: http://stackoverflow.com/q/23514352
score: 0
has text: Assuming you are not familiar with Singleton, this is a pattern that causes you to have only one single instance of a given class. This could be useful if the object can be kept as global for the entire application, and also it consumes a lot of resources to get instantiated. So, the singleton saves you time and memory as you will construct the object once only and use the same instance in all other cases. As you can see, the reasoning here is the object's constructor being heavy on the system. There might be other reasons behind this pattern usage, in Android, memory and CPU are limited .
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23587212
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36259134
upvote count: 1
has body: This error comes from the program trying to load a file which gives the distributional similarity mapping from words to clusters. It's trying to get it from the location that is specified in the training properties file (and you naturally don't have a file at that location). This happened because you don't have a properly initialized TaggerConfig object at the time readModelAndInit() is called. The way it gets initialized is unintuitive (was badly architected), but you're only encountering this because you're trying to use a non-public API. Why can't you just use the public API as follows? MaxentTagger base = new MaxentTagger("http://my.url.com/models/english-left3words-distsim.tagger");
has comment: http://stackoverflow.com/comment/39932084
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23576279
score: 1
accepted answer of: http://stackoverflow.com/q/23576279

http://stackoverflow.com/comment/36250783
has text: Have you considered providing a proxy view or an alternate implementation that no-ops the methods that change state? The clients using the `AntHill` and `Ant` objects need not know that such a proxy or implementation even exists, but if they try to change it, nothing would happen. Maybe just drop a message in the logs explicitly stating that the attempted change was ignored.
comment on: http://stackoverflow.com/q/23613103
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23510048
has answer: http://stackoverflow.com/a/25293945
has comment: http://stackoverflow.com/comment/36063366
tagged with: javascript
has comment: http://stackoverflow.com/comment/36063277
tagged with: ajax
accepted answer: http://stackoverflow.com/a/23563708
has comment: http://stackoverflow.com/comment/36058124
has comment: http://stackoverflow.com/comment/36062508
has comment: http://stackoverflow.com/comment/36057734
has comment: http://stackoverflow.com/comment/36071020
has title: JS does not work if i remove alert statement
tagged with: d3.js
score: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36057707
tagged with: java
has answer: http://stackoverflow.com/a/23563708
possible better answer: http://stackoverflow.com/a/25293945
has body: I am building a Treemap layout using d3.js and facing a typical problem with the code. The code works if an alert statement is put other wise it doesn't. I am briefly explaining code below, default.HTML file and FetchData.java A form tag with 3 radio buttons and 2 text boxes. (The text boxes will be used as a date filter for fetching the DB data) A button with onclick event that will call the function loadNewData(). loadNewData -It does a AJAX call to a servlet "FetchData.java" with query parameters as inputs from the text boxes The "FetchData.java" connects to DB (each time on onclick event), extracts the data and write it into a file called "OuputJSON" . The random number is generated everytime for every onclick event. This file name is sent back to the AJAX call (process function in default.html) is an input to another JS function call called wrapperFunc(str) This function calls the d3.json that takes the filename (URL of the json data file) and creates a treemap. Step 6 works properly i put an alert statement just before calling the wrapperFunc(str). So there will not be any issue with d3.sjon function. As I remove the alert it doesn't work. Any help is much appreciated &lt;!-- DEFAULT.HTML --&gt; &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;meta http-equiv="Pragma" content="no-cache"&gt; &lt;meta http-equiv="Cache-Control" content="no-cache"&gt; &lt;meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT"&gt; &lt;script type="text/javaScript" src="d3/d3.js"&gt;&lt;/script&gt; &lt;script&gt; var xhr = new XMLHttpRequest(); function loadNewData(){ //alert("AJAX CALL"); xhr.open("GET","FetchData?from="+document.getElementById("from").value+"&amp;to="+document.getElementById("to").value,true); //xhr.open("GET","FetchData",false); xhr.onreadystatechange=process; xhr.send(null); } function process(){ //alert("proces()"); if(xhr.readyState == 4 &amp;&a…
type: Question
has comment: http://stackoverflow.com/comment/36058381
answer count: 2

http://stackoverflow.com/q/23588299
has body: Given an array of integers f, I want to see if f[k]=k for some k in the array. I'm having some trouble because I would like to return on the left and right half of the array, but I am not sure how to go about doing that. This is what I have so far: public class Find { int a = 0; public boolean find(int[] f) { if(f.length &lt; 1) { return false; } System.out.println(f[0] + " " + a); if(f.length == 1 &amp;&amp; f[0] == a) { return true; } if(f.length == 1 &amp;&amp; f[0] != a) { return false; } int[] L = Arrays.copyOfRange(f, 0, f.length / 2); int[] R = Arrays.copyOfRange(f, f.length / 2, f.length); find(L); a++; //find(R); return find(R); //only finds in the right half... } public static void main(String[] args) { Find F = new Find(); int[] test = {0, 13, 2, 3, 4}; System.out.println(F.find(test)); } }
has title: Java Recursion return boolean
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: recursion
score: 0
has comment: http://stackoverflow.com/comment/36204058
answer count: 1
has comment: http://stackoverflow.com/comment/36204099
has answer: http://stackoverflow.com/a/23588322
has comment: http://stackoverflow.com/comment/36204077

http://stackoverflow.com/q/23579607
has answer: http://stackoverflow.com/a/26195988
tagged with: liquibase
type: Question
has answer: http://stackoverflow.com/a/25750728
upvote count: 6
favorite count: 0
has title: Run migrations programmatically in Dropwizard
answer count: 5
tagged with: dropwizard
has answer: http://stackoverflow.com/a/26811590
accepted answer: http://stackoverflow.com/a/26811590
downvote count: 0
score: 6
possible better answer: http://stackoverflow.com/a/25750728
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31986898
has answer: http://stackoverflow.com/a/23598691
tagged with: java
has body: I have dropwizard-application (0.7.0) for which I want to run integration tests. I've set up an integration test using DropwizardAppRule, like this: @ClassRule public static final DropwizardAppRule&lt;MyAppConfiguration&gt; RULE = new DropwizardAppRule&lt;MyAppConfiguration&gt;( MyApplication.class, Resources.getResource("testconfiguration.yml").getPath()); When I try to run the below tests using it, it doesn't work because I haven't run my migrations. What is the best way to run the migrations? Test: @Test public void fooTest() { Client client = new Client(); String root = String.format("http://localhost:%d/", RULE.getLocalPort()); URI uri = UriBuilder.fromUri(root).path("/users").build(); client.resource(uri).accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).post(User.class, new LoginUserDTO("email@email.com", "password")); } Configuration: public class MyAppConfiguration extends Configuration { @Valid @NotNull private DataSourceFactory database = new DataSourceFactory(); @JsonProperty("database") public DataSourceFactory getDataSourceFactory() { return database; } @JsonProperty("database") public void setDataSourceFactory(DataSourceFactory dataSourceFactory) { this.database = dataSourceFactory; } }

http://stackoverflow.com/q/23464654
tagged with: java
has title: Java GUI development manually
has comment: http://stackoverflow.com/comment/35973512
upvote count: 2
answer count: 2
tagged with: layout
tagged with: user-interface
downvote count: 1
has body: I am trying to make a panel to have 4 items on top. these are a JLabel, JTextField, JLabel and JTextField. In the center I need a JTextArea and to the left of it a JList that is scrollable. On the bottom I need 3 buttons. What would be the best layout manager for this and how should I go about it? Would having just 3 columns be a good idea? Heres what I have so far: JPanel panel = new JPanel(); JTextField IDLabel = new JLabel("ID: "); IDLabel.setBounds(10, 10, 80, 25); panel.add(IDLabel); JTextArea IDText = new JTextField(5); IDText.setBounds(100, 10, 160, 25); panel.add(IDText); JLabel TitleLabel = new JLabel("Title: "); TitleLabel.setBounds(10, 10, 80, 25); panel.add(TitleLabel); JTextField TitleText = new JTextField(10); TitleText.setBounds(100, 10, 160, 25); panel.add(TitleText); JList list = new JList(new String[]{"test1", "test22"}); list.setFixedCellWidth(150); list.setFixedCellHeight(50); list.setFont(new Font("Serif",Font.BOLD,16)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); panel.add(list); JTextArea BodyArea = new JTextArea(); BodyArea.setSize(200, 200); BodyArea.setText("Test area"); panel.add(BodyArea);
has answer: http://stackoverflow.com/a/23464683
favorite count: 0
has answer: http://stackoverflow.com/a/23464715
type: UnansweredQuestion
tagged with: swing
type: Question
score: 1

twos-complement
tags question: http://stackoverflow.com/q/23508860
tags question: http://stackoverflow.com/q/23548387
tag name: twos-complement
type: Tag

http://stackoverflow.com/a/23562168
has comment: http://stackoverflow.com/comment/36162763
answers question: http://stackoverflow.com/q/23561939
downvote count: 0
type: Answer
upvote count: 16
score: 16
has body: Actually its not necessary to have an interface when you have only one implementation. But there are certain situation where it is very practical that you dont have a depencecy to the concrete class: Testing your service that calls the DAO: You can write a mock DAO that behaves just as you need it in the test (e.g. simulat that there is no DB connection, which is hard to reproduce automatically) generate some Layers aoround your DAO. You could use AOP to generate caching or transaction handling around your DAO methods. In this case you have an object that implements the DAOs interface but has nothing to do with the original implementation. Switching the DB technology. If you switch from MySQL to DB2 you just need to write another implementation of the interface and switch the MySQL DAO and the DB2 DAO Therefore its a good practice to have an interface for you DAOs and Services.

http://stackoverflow.com/comment/60048082
type: AnswerComment
has text: For posterity, could you expand on your answer? As it is, this question isn't as useful to the wider community as it would be if your answer explained what in particular got you your answer. Edit this answer to include the working XML if applicable.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/36207283

http://stackoverflow.com/comment/36108879
type: QuestionComment
comment on: http://stackoverflow.com/q/23537103
type: Comment
has text: I downvoted and for me this question, even from a beginner, just reveal you have not checked this site or any other help prior to ask your question on SO.
score: 0

libgdx
tags question: http://stackoverflow.com/q/23589669
tags question: http://stackoverflow.com/q/23513572
tags question: http://stackoverflow.com/q/23513090
tags question: http://stackoverflow.com/q/23600768
tags question: http://stackoverflow.com/q/23505287
tags question: http://stackoverflow.com/q/23574821
tag name: libgdx
tags question: http://stackoverflow.com/q/23592433
tags question: http://stackoverflow.com/q/23504918
tags question: http://stackoverflow.com/q/23555768
tags question: http://stackoverflow.com/q/23546544
tags question: http://stackoverflow.com/q/23477585
tags question: http://stackoverflow.com/q/23508024
tags question: http://stackoverflow.com/q/23556472
tags question: http://stackoverflow.com/q/23585421
type: Tag
tags question: http://stackoverflow.com/q/23586907
tags question: http://stackoverflow.com/q/23472436
tags question: http://stackoverflow.com/q/23466904
tags question: http://stackoverflow.com/q/23535727
tags question: http://stackoverflow.com/q/23566162
tags question: http://stackoverflow.com/q/23509560
tags question: http://stackoverflow.com/q/23530416
tags question: http://stackoverflow.com/q/23606038
tags question: http://stackoverflow.com/q/23588219
tags question: http://stackoverflow.com/q/23570314
tags question: http://stackoverflow.com/q/23545317
tags question: http://stackoverflow.com/q/23594663
tags question: http://stackoverflow.com/q/23523507
tags question: http://stackoverflow.com/q/23485622
tags question: http://stackoverflow.com/q/23467936
tags question: http://stackoverflow.com/q/23548173
tags question: http://stackoverflow.com/q/23480272
tags question: http://stackoverflow.com/q/23541494
tags question: http://stackoverflow.com/q/23587331
tags question: http://stackoverflow.com/q/23485190

http://stackoverflow.com/comment/36125911
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23546565
has text: ??? if you're asking about a syntax error, then please post the error here for us to see!
score: 0

http://stackoverflow.com/a/23460421
has comment: http://stackoverflow.com/comment/61850213
upvote count: 54
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35965557
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23460367
type: Answer
answers question: http://stackoverflow.com/q/23460367
has comment: http://stackoverflow.com/comment/35965620
has comment: http://stackoverflow.com/comment/61921104
has body: First things first, you need to loop to &lt; a.length rather than a.length - 1. As this is strictly less than you need to include the upper bound. So, to check all pairs of elements you can do: for (int i = 0; i &lt; a.length; i++) { for (int k = 0; k &lt; a.length; k++) { if (a[i] != a[k]) { //do stuff } } } But this will compare, for example a[2] to a[3] and then a[3] to a[2]. Given that you are checking != this seems wasteful. A better approach would be to compare each element i to the rest of the array: for (int i = 0; i &lt; a.length; i++) { for (int k = i + 1; k &lt; a.length; k++) { if (a[i] != a[k]) { //do stuff } } } So if you have the indices [1...5] the comparison would go 1 -&gt; 2 1 -&gt; 3 1 -&gt; 4 1 -&gt; 5 2 -&gt; 3 2 -&gt; 4 2 -&gt; 5 3 -&gt; 4 3 -&gt; 5 4 -&gt; 5 So you see pairs aren't repeated. Think of a circle of people all needing to shake hands with each other.
score: 54
has comment: http://stackoverflow.com/comment/61863827
has comment: http://stackoverflow.com/comment/61864629
has comment: http://stackoverflow.com/comment/61851116

http://stackoverflow.com/q/23594585
upvote count: 0
favorite count: 0
downvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23595292
tagged with: java
has answer: http://stackoverflow.com/a/23594586
has body: I have recently got into java and I need help with a basic program: public static void main(String[] args) { Random gen = new Random(); int roll = gen.nextInt(6) + 1; int[] array = new int[20]; // Replacing all the numbers of the array to random ones for (int i=0; i&lt;20; i++){ roll = gen.nextInt(6) + 1; array[i] = roll; } // Bracketing all repeating numbers for (int i=0; i&lt;19; i++){ if (array[i] == array[i++]){ System.out.print("("); } System.out.print(array[i]); if (array[i] == array[i--]){ System.out.print(")"); } } } } All this code does is take the random die roll and bracket all the numbers that are the same: 13(66)5(2222)(66)71 However, all it does with this code is bracket all the numbers instead of the ones that are the same: (1)(3)(6)(6)(5)(2)(2)(2)(2)(6)(6)(7)(1) What am I doing wrong?
possible better answer: http://stackoverflow.com/a/23595292
type: Question
score: -2
has title: Grouping similar numbers into brackets
answer count: 2
accepted answer: http://stackoverflow.com/a/23594586
has comment: http://stackoverflow.com/comment/36215465

http://stackoverflow.com/comment/36056405
comment on: http://stackoverflow.com/q/23509364
score: 0
has text: Ive read through the Basic I/O Tutorial didnt really help
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36232515
has text: ^^ A fix would be to start use int. And cache .valueOf or you will create a new BigInteger everytime.
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/23603513

http://stackoverflow.com/q/23540075
has comment: http://stackoverflow.com/comment/36113626
has comment: http://stackoverflow.com/comment/36113500
has comment: http://stackoverflow.com/comment/36114833
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23542143
tagged with: grizzly
tagged with: java
has title: Grizzly web server with domain
type: Question
tagged with: jersey
answer count: 1
has body: I have a subdomain. I want attach it to Java JAX-RS project with grizzly server implementation. When i set up on localhost:8080 it works well, but i can't figure out, how can i set up it with my subdomain or domain. Thanks
has comment: http://stackoverflow.com/comment/36113863
score: 0
has answer: http://stackoverflow.com/a/23542143
tagged with: jax-rs

http://stackoverflow.com/comment/36009598
type: QuestionComment
score: 0
has text: @kdgregory thanks for your suggestions; i will try google search for some algos for my research.
type: Comment
comment on: http://stackoverflow.com/q/23463126

http://stackoverflow.com/a/23460509
has body: The way you're doing it now, it's looking for the whole string as is, literally, not interpreting the || as any form of or. You can either set the element in the switch to uppercase or lowercase use : switch(month.toLowerCase()) { case "january" : ... break; case "february": ... ... } or you have to double case elements: switch (month) { case "January": case "january": ... break; case "February": case "february": ... ... }
score: 6
type: AcceptedAnswer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/23460479
answers question: http://stackoverflow.com/q/23460479
type: Answer
downvote count: 0

http://stackoverflow.com/a/23557558
has comment: http://stackoverflow.com/comment/36559140
accepted answer of: http://stackoverflow.com/q/23557293
has body: Fragment "/common/IncludeGoogleKey.jsp" should be present in : /&lt;WEB_Project_Name>/WebContent/ common/IncludeGoogleKey.jsp Make sure IncludeGoogleKey.jsp is present in above location.
type: AcceptedAnswer
score: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/109743648
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/23557293

http://stackoverflow.com/comment/36206473
type: AnswerComment
type: Comment
has text: Nope. It doesn't get as far as using that data. As the question says, the exception happens after the first "(" - this is because `parenterizacao(s, 1, n)` passes a 3x3 array (`s`), with `n=4`, and the first recursive call using `s[i][j]` therefore tries to access `s[1][4]` and boom. None of this has anything to do with the values produced by the loops. (The loops were also incorrect, which causes further problems - see my answer for more details, but this was *not* causing the original exception).
comment on: http://stackoverflow.com/a/23586044
score: 0

http://stackoverflow.com/a/23595068
answers question: http://stackoverflow.com/q/23593926
upvote count: 1
type: AcceptedAnswer
has body: The working code is here public class RestrictedTreeTableCell &lt;S,T&gt; extends TextFieldTreeTableCell&lt;S, T&gt; { private final int maxChars; private final String pattern; private TextField textField = new TextField(); private RestrictedTextField rtf ; private static final Logger log = Logger.getLogger(RestrictedTreeTableCell.class); public RestrictedTreeTableCell(int maxVal,String disallowed) { super(); this.maxChars = maxVal; this.pattern = disallowed; if(pattern!=null || pattern.length()&gt;0) rtf = new RestrictedTextField(textField, maxChars,pattern); else rtf = new RestrictedTextField(textField, maxChars); } @Override public void startEdit() { log.debug("Inside over ridden edit"); super.startEdit(); if (isEditing()) { log.debug("Inside is editing "); textField.textProperty().addListener(rtf); if(getItem()!=null) textField.setText(getItem().toString()); setGraphic(textField); textField.selectAll(); } } }
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23593926

http://stackoverflow.com/q/23571207
tagged with: swing
has comment: http://stackoverflow.com/comment/36173844
has comment: http://stackoverflow.com/comment/36182104
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36172022
tagged with: java
has comment: http://stackoverflow.com/comment/36171969
has comment: http://stackoverflow.com/comment/36173693
type: Question
score: 0
has body: So I am making a Calendar program for my final project in a programming class and to add the days listed in the month I have a whole bunch of JLabels as instance variables (42 for a 6 by 7 grid) JLabel day1; JLabel day2; JLabel day3; JLabel day4; JLabel day5; JLabel day6; JLabel day7; JLabel day8; JLabel day9; JLabel day10; etc. then I have a method that gets the current month I have set and based off of what that returns I have a whole bunch of if statements to set what numbers go to which (I am planning to have the 42 in the set locations and just change their contents based off the month instead of moving the locations of 31) if (Threads.getMonth() == 0) { day1 = new JLabel(""); day2 = new JLabel(""); day3 = new JLabel(""); day4 = new JLabel("1"); day5 = new JLabel("2"); day6 = new JLabel("3"); day7 = new JLabel("4"); day8 = new JLabel("5"); day9 = new JLabel("6"); day10 = new JLabel("7"); etc. my more experienced friend recommended creating the object within the if statements so this is what that looks like. Then after those twelve if statements I have the setting of boundaries and adding it to the frame. day10.setBounds(100, 100, 500,500); add(day10); I had it at that location simply to test that it appeared and used day 10 because no matter which month the 10th day always had an actual value. Although whenever I run this program the JLabel fails to show up and I cannot get my program to function without being able to do this. If it helps I have around 20 classes (one for each month, a main, a threads class, a gui, and a few others for some other functions that I am still working on.) This bit of code is coming from the gui class. If it might have a play on this the way I have the classes interact is that the main class calls the threads class the threads get the date and open the class for that month that class opens the gui and then all button presses are run through a handler class that shoots the data to the threads class for getting more done and then you …
has title: None of my JLabels will appear
has answer: http://stackoverflow.com/a/23572430
linked to: http://stackoverflow.com/q/5621338
answer count: 1
has comment: http://stackoverflow.com/comment/36173169
tagged with: jlabel
accepted answer: http://stackoverflow.com/a/23572430
linked to: http://stackoverflow.com/q/17874717
tagged with: jframe

http://stackoverflow.com/q/23485649
tagged with: file-upload
has answer: http://stackoverflow.com/a/23511748
type: UnansweredQuestion
has body: I have a JSP form containing text fields as well as file input. I want to know ways to handle the validation/processing of the form. Since the form has file input, it is multipart form so I am then checking separately for file as in protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { List&lt;FileItem&gt; items = new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request); for (FileItem item : items) { if (item.isFormField()) { // Process regular form field (input type="text|radio|checkbox|etc", select, etc). String fieldname = item.getFieldName(); String fieldvalue = item.getString(); // ... (do your job here) } else { // Process form file field (input type="file"). String fieldname = item.getFieldName(); String filename = FilenameUtils.getName(item.getName()); InputStream filecontent = item.getInputStream(); // ... (do your job here) } } } catch (FileUploadException e) { throw new ServletException("Cannot parse multipart request.", e); } // ... } (Taken from here). But, my question is how can I process the file (say excel file), without storing it and just directly processing the spreadsheet data into map using POI XSSF(since FileInput looks for stored file path)? Also, how can I pass the local variables/maps from above servlet back to the jsp page? Basically, I want to allow users to fill a form and select an excel file to process, and I want to display the results after validation in servlet on the same jsp without refreshing the jsp (like showing results below the form?
linked to: http://stackoverflow.com/q/2422468
tagged with: excel
type: Question
has title: How to read excel file from client using JSP and process data without storing
tagged with: java
tagged with: forms
score: 0
answer count: 1
tagged with: jsp

http://stackoverflow.com/q/23486643
has comment: http://stackoverflow.com/comment/36016704
has comment: http://stackoverflow.com/comment/36102025
has comment: http://stackoverflow.com/comment/36139796
has title: What is the best way to turn this Java Swing application into a sandboxed embed-able (applet or Web Start)?
has answer: http://stackoverflow.com/a/23526993
has answer: http://stackoverflow.com/a/23506512
has comment: http://stackoverflow.com/comment/36032685
tagged with: swing
has comment: http://stackoverflow.com/comment/36046394
has answer: http://stackoverflow.com/a/23486780
type: AnsweredQuestion
tagged with: executable
tagged with: java
possible better answer: http://stackoverflow.com/a/23486780
accepted answer: http://stackoverflow.com/a/23526993
type: Question
score: 0
answer count: 3
tagged with: applet
has body: I am working on a primitive online game client that I wrote as a Java Swing application. My problem is that potential users refuse to download and run any unfamiliar executable. I want my game to be reach as many people as possible and users fear that the executable might contain a virus. That is why I would like to embed the game client into my web page instead. How would you turn this Java executable code (liked below) into an applet? Thus far I have a main which makes the initial connection to the game server... https://dl.dropboxusercontent.com/u/214507961/Main.java A Java Swing GUI that I made with the Netbeans GUI builder... https://dl.dropboxusercontent.com/u/214507961/GUI.form Object input/output streams connected to my game/web server... https://dl.dropboxusercontent.com/u/214507961/Clients_Input.java https://dl.dropboxusercontent.com/u/214507961/Clients_Output.java And some buffered images for graphics... https://dl.dropboxusercontent.com/u/214507961/Image_Repo.java Note that in future development, I would like to replace much of the primitive looking 2D Swing GUI with content rendered with the Lightweight Java Game Library or some other higher-level video game graphics specific library to make the game look better. Given that information, what is the best way to make this Java application into an embed-able (applet)? Describe your method and reasoning in such a way that even a college freshman could follow. Note: Following the advice below, I have tried using WebStart, but I still get an intimidating warning: Update: I am in the process of refactoring my code so that the top level container is a JPanel. I have tried making "GUI" extend JPanel and changing the "gamewindow" from a JFrame into a JPanel. Modified Main: https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/Main.java Modified GUI: https://dl.dropboxusercontent.com/u/214507961/Panel_Top_Level_Container/GUI.java Despite the changes, Netbeans will not allow this program to run wi…

http://stackoverflow.com/comment/36161637
has text: Thanks for your help. I did confirm that this method would work. However, I decided to use another approach. Check out my answer if you're interested.
type: Comment
comment on: http://stackoverflow.com/a/23526322
score: 0
type: AnswerComment

http://stackoverflow.com/q/23491949
tagged with: java
has comment: http://stackoverflow.com/comment/36024691
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/36024502
type: Question
score: 5
has comment: http://stackoverflow.com/comment/77827734
has comment: http://stackoverflow.com/comment/36024528
has answer: http://stackoverflow.com/a/23497666
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36024583
has comment: http://stackoverflow.com/comment/36023426
has comment: http://stackoverflow.com/comment/36023552
favorite count: 0
upvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23492898
has title: Adding JSON array to a JSONObject without the quotes for the value of JSON Array in JAVA
has body: I am trying to add a JSONArray toa JSONObject using the code below: defObj.put("locArr",(Object)locArr); But this is resulting in the following format of JSON: ["locArr":"[{"longitude":35,"latitude":39,"ip":"81.212.204.150"}, {"longitude":-122.1781,"latitude":37.459,"ip":"173.252.110.27"}]"] I am initializing and populating locArr as shown below: JSONObject locObj = new JSONObject(); JSONArray locArr = new JSONArray(); locObj.put("ip", ip); locObj.put("latitude", latitude); locObj.put("longitude", longitude); locArr.put(locObj) As you can see the value of the JSONArray is being enclosed in double quotes. Because of this, when I am trying to parse this JSON, I am facing an Unexpected character error because of the quote. I want the output like below: ["locArr":[{"longitude":35,"latitude":39,"ip":"81.212.204.150"}, {"longitude":-122.1781,"latitude":37.459,"ip":"173.252.110.27"}]] Could anyone please let me know how to add the value of JSONArray without enclosing with double quotes?

http://stackoverflow.com/a/23551476
answers question: http://stackoverflow.com/q/23551369
has body: You are trying to compare 2 strings using '&lt;' operator which doesnt work. Rather you should use compareTo function to compare 2 objects that are Comparable. if(words[index]&lt;words[minIndex]) // doesnt work - Compilation error { min = j; } Change your if condition in the method selectionSort as follows : if(words[j].comapareTo(words[min]) &lt; 0) { min = j; } Also you need to swap words at index i &amp; min, rather than swapping i &amp; j swap(words, i, j); //wrong swap(words, i, min); //correct - as it swaps min word &amp; current word
accepted answer of: http://stackoverflow.com/q/23551369
upvote count: 2
has comment: http://stackoverflow.com/comment/36136482
has comment: http://stackoverflow.com/comment/36136087
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36135640
has comment: http://stackoverflow.com/comment/36135688
type: Answer
has comment: http://stackoverflow.com/comment/36136141
score: 2
has comment: http://stackoverflow.com/comment/36136424
downvote count: 0
has comment: http://stackoverflow.com/comment/36136197
has comment: http://stackoverflow.com/comment/36135658

http://stackoverflow.com/comment/35966087
type: AnswerComment
score: 0
type: Comment
has text: i understand what u mean , but the problem in my app that if the user try to close the app by a multi tasking or any other way the app starts again by it self !?
comment on: http://stackoverflow.com/a/23460190

http://stackoverflow.com/comment/36064333
type: Comment
comment on: http://stackoverflow.com/a/23512986
has text: I left out the Worker implements Thread/Runnable part, as that wasn't relevant to the primary difficulty the OP was having -- the knowledge responsibility issues of the various participants.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23609768
has comment: http://stackoverflow.com/comment/36244164
has title: How can we read the vm file into web content folder from spring controller
has comment: http://stackoverflow.com/comment/81131692
score: 0
has comment: http://stackoverflow.com/comment/36325763
has comment: http://stackoverflow.com/comment/36273373
has body: I am trying to read the vm file from web content folder using spring controller, but not able to do this. I am using tomcat server with eclipse env. I am using the following code: ServletContext context = request.getServletContext(); String path = context.getContextPath() + "/resources/text.vm"; VelocityEngine ve = new VelocityEngine(); VelocityContext ctxt = new VelocityContext(); try { Template template = ve.getTemplate(path); } catch (ResourceNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (ParseErrorException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Is there any other way to do this thing?
tagged with: spring-mvc
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36269733
tagged with: file
type: Question

http://stackoverflow.com/q/23532073
type: Question
score: 0
has body: I have two website using Struts2 with Hibernate, deploy on Ubuntu with Tomcat 7. Tomcat server run with port 80, i use "iptables" of Ubuntu to redirect port 8080 to 80 : iptables -t nat -A PREROUTING -p tcp --dport 8080 -j REDIRECT --to-ports 80 After a few of first requests on port 80 and 8080 website run normal, one of website (some time both of two) has error with hibernate occur message "Cannot open connection" Here is my hibernate configuration file of two website : <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://<serverip>/<dbname>?characterEncoding=UTF-8 <dbuser> <dbpassword> 99 convertToNull UTF-8 UTF-8 true false 10 100 300 200 300 0 true org.hibernate.dialect.MySQLDialect update </hibernate-configuration> Here is error : org.hibernate.exception.JDBCConnectionException: Cannot open connection at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:99) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:160) at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:81) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1473) at com.anhdt.website.dao.AbstractSimpleGenericDao.<init>(AbstractSimpleGenericDao.java:38) at com.anhdt.website.dao.BlogDao.<init>(BlogDao.java:28) at com.anhdt.website.action.BlogArticle.execute(BlogArticle.java:79) 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:622) at …
answer count: 1
tagged with: tomcat
has title: Hibernate cannot open connection while redirect port with iptables
type: UnansweredQuestion
tagged with: http-redirect
has answer: http://stackoverflow.com/a/23536398
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/36245607
type: Comment
has text: This is an interesting learning exercise, but nothing more than that. Bubble sort should **never** be used in production code. Moreover handwritten short algorithms shouldn't be used (unless you have a very good reason). Further, if your method is passed a `LinkedList` rather than an `ArrayList` then the performance goes from the (already terrible) `O(n^2)` to something in the order of `O(n^4)`.
comment on: http://stackoverflow.com/a/23595751
score: 0
type: AnswerComment

http://stackoverflow.com/a/23585411
answers question: http://stackoverflow.com/q/23585347
has comment: http://stackoverflow.com/comment/49258281
score: 3
downvote count: 0
has body: I am not sure if "Israel" is a valid timezone, try "Asia/Jerusalem", have a look at this post
type: Answer
upvote count: 3

http://stackoverflow.com/q/23477462
upvote count: 1
has comment: http://stackoverflow.com/comment/35996814
has body: I'm trying to make an app where as you click on the button "dodaj" it saves the values from the editText forms and it then saves them into a database. But I'm having a hard time with this onClickListener. Every time I click on the button "dodaj" it crashes the app at db.addToDB... dodaj = (Button) findViewById(R.id.potrdi); dodaj.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (predmet.getText() != null) { naslov = predmet.getText().toString(); } if (snov1.getText() != null) { prvi = snov1.getText().toString(); } if (snov2.getText() != null) { drugi = snov2.getText().toString(); } if (snov3.getText() != null) { tretji = snov3.getText().toString(); } if (snov4.getText() != null) { cetrti = snov4.getText().toString(); } if (snov5.getText() != null) { peti = snov5.getText().toString(); } db.addToDB (naslov, prvi, drugi, tretji, cetrti, peti); //error here finish(); } }); Here is the code for adding items to the database: int addToDB(String ime_predmeta, String snov_1, String snov_2, String snov_3, String snov_4, String snov_5) { ContentValues cv = new ContentValues(); if (ime_predmeta != null) {cv.put(DatabaseManager.PREDMET, ime_predmeta);} if (snov_1 != null) {cv.put(DatabaseManager.SNOV1, snov_1);} if (snov_2 != null) {cv.put(DatabaseManager.SNOV2, snov_2);} if (snov_3 != null) {cv.put(DatabaseManager.SNOV3, snov_3);} if (snov_4 != null) {cv.put(DatabaseManager.SNOV4, snov_4);} if (snov_5 != null) {cv.put(DatabaseManager.SNOV5, snov_5);} open(); return (int)db.insert(DatabaseManager.TABELA, null, cv); } The LogCat also showed that something is wrong with my method for opening the database: void open() { db = dbManager.getWritableDatabase(); //error here as well } StackTrace : 05-05 18:39:51.510: E/ThermalEngine(215): [GPU_MON] ACTION: GPU - [GPU_MON] Setting GPU[0] to 450000000 05-05 18:40:00.720: E/SQLiteLog(5207): (1) near "TABLEdodajanje": syntax error 05-05 18:40:00.740: E/AndroidRuntime(5207): FATAL EXCEPTION: main 05-05…
tagged with: java
tagged with: database
score: -1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35996594
tagged with: android
tagged with: sqlite
has answer: http://stackoverflow.com/a/23477666
has title: Android SQLite crashing
has answer: http://stackoverflow.com/a/23477618
favorite count: 0
has comment: http://stackoverflow.com/comment/35996679
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/comment/36100551
comment on: http://stackoverflow.com/q/23532615
has text: @v1kas any java class even activity class?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36227750
comment on: http://stackoverflow.com/q/23600386
score: 1
has text: And you're trying to use Java 1.1 because it's embedded in the printer somehow or for some other reason? Seriously, that doesn't even have Collections.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36154995
has text: No. The solution is to *not declare the variable as static.* And then make whatever code adjustments are necessary. Probably `SomeMethod()` is static when it shouldn't be.
comment on: http://stackoverflow.com/a/23562362
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/36169574
has text: I'll put your answer as correct since my question is not well asked :-/
type: Comment
comment on: http://stackoverflow.com/a/23567100
score: 0
type: AnswerComment

http://stackoverflow.com/q/23511962
linked to: http://stackoverflow.com/q/13512494
upvote count: 2
has comment: http://stackoverflow.com/comment/36060943
answer count: 1
has title: Oracle sequence with Hibernate
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
has answer: http://stackoverflow.com/a/23512028
score: 2
downvote count: 0
tagged with: java
tagged with: hibernate
has body: I have my application with Spring 3 that went so well. Basically the client wanted to migrate db from MySQL to Oracle. So everything is right; the problem is presented with the sequence of Oracle. I tried in every way to configure Hibernate but I always get the error org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assi gned before calling save(): org.hibernate.id.Assigned.generate(Assigned.java:52) org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:117) org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:206) org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:191) org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:114) org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90) org.hibernate.internal.SessionImpl.fireSaveOrUpdate(SessionImpl.java:735) org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:727) org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:723) it.openingcode.vwh.dao.AbstractHibernateDAOImpl.save(AbstractHibernateDAOImpl.java:48) it.openingcode.vwh.dao.AbstractHibernateDAOImpl.save(AbstractHibernateDAOImpl.java:20) it.openingcode.vwh.services.AbstractCrudServiceImpl.save(AbstractCrudServiceImpl.java:70) it.openingcode.vwh.services.AbstractCrudServiceImpl.saveAll(AbstractCrudServiceImpl.java:77) it.openingcode.vwh.services.PrivilegiServiceImpl.updateFromGruppo(PrivilegiServiceImpl.java:92) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) In the m…
type: Question

http://stackoverflow.com/q/23552849
accepted answer: http://stackoverflow.com/a/23582902
type: Question
has title: Add mutiple user types with each user having its diffrent functionality
has body: I have an application in which have 45 types of different user and every user has a set of functionalities available. We use enums to identify every set of user and each functionality is hardcoded in the client side which makes it very difficult to change. e.g : USER_KABO, USER HAEB, USER_IOQW ... //Method getFunctionality is hardcoded for every user. -(ArrayList)getFunctionality:(UserType)type{ switch(type): case : USER_KABO: al = new ArrayList(); al.add(new Functionality()); case : USER HAEB; .... } I iterate through this array to check if a user has a functionality or not. Depnding upon login status I set usertype in my code. I am looking for a more flexible approach which could make it easy to add functionality to any user and allow to add any user without modifying too much code.
downvote count: 0
answer count: 1
score: 1
has answer: http://stackoverflow.com/a/23582902
favorite count: 0
linked to: http://stackoverflow.com/q/300359
tagged with: cocoa-design-patterns
upvote count: 1
tagged with: design-patterns
type: AnsweredQuestion
tagged with: oop
tagged with: java

timer
tag name: timer
tags question: http://stackoverflow.com/q/23484690
tags question: http://stackoverflow.com/q/23483123
tags question: http://stackoverflow.com/q/23475182
tags question: http://stackoverflow.com/q/23471028
tags question: http://stackoverflow.com/q/23503686
type: Tag
tags question: http://stackoverflow.com/q/23553711
tags question: http://stackoverflow.com/q/23590285
tags question: http://stackoverflow.com/q/23507967
tags question: http://stackoverflow.com/q/23543584
tags question: http://stackoverflow.com/q/23602041
tags question: http://stackoverflow.com/q/23464460
tags question: http://stackoverflow.com/q/23602711

http://stackoverflow.com/a/23600171
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23600149
has comment: http://stackoverflow.com/comment/36226482
type: Answer
accepted answer of: http://stackoverflow.com/q/23600149
has comment: http://stackoverflow.com/comment/36226743
score: 3
has body: This is an example of how call by value is implemented in java . When you do the below example , your original deck is being altered shuffled.add(deck.remove(c)); // Changes the value of the underlying object of deck reference, hence // both the original deck and the deck variable in the function are altered The below statement only changes the reference of the variable in the function. Your original deck object still is an emptied out list deck = shuffled; // The deck variable in the function is now pointing to shuffled within // the function. This deck variable is lost after your function call ends.
upvote count: 3
has comment: http://stackoverflow.com/comment/36226361

http://stackoverflow.com/q/23504948
has answer: http://stackoverflow.com/a/65787562
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23505008
type: Question
upvote count: 4
has title: Java classes missing from jar built with maven
downvote count: 0
tagged with: jar
possible better answer: http://stackoverflow.com/a/23505002
score: 4
has body: When i try to run my .jar the classes cannot be found? Its a basic app, contains 2 custom classes and commons-lang The .jar contains classes for commons-lang but not for my java classes. rob@work:~/git/ProjectName/target$ java -jar uber-ProjectName-1.0-SNAPSHOT.jar Exception in thread "main" java.lang.NoClassDefFoundError: com/test/server/Main Caused by: java.lang.ClassNotFoundException: com.test.server.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) Could not find the main class: com.test.server.Main. Program will exit. This is pom.xml 4.0.0 com.test.server ProjectName jar 1.0-SNAPSHOT thisisatest http://maven.apache.org commons-lang commons-lang 2.3 compile org.apache.maven.plugins maven-jar-plugin 2.4 com.test.server.Main org.apache.maven.plugins maven-shade-plugin package shade uber-${artifactId}-${version} build output .. rob@work:~/git/ProjectName$ mvn package [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building thisisatest [INFO] task-segment: [package] [INFO] ------------------------------------------------------------------------ [INFO] Ignoring available plugin update: 2.3 as it requires Maven version 3.0 [INFO] Ignoring available plugin update: 2.2 as it requires Maven version 3.0 [INFO] Ignoring available plugin update: 2.1 as it requires Maven version 3.0 [INFO] Ignoring available plugin update: 2.0 as it requires Maven version 3.0 [INFO] [resources:resources {execution: default-resources}] [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /home/rob/git/ProjectNam…
favorite count: 0
has answer: http://stackoverflow.com/a/23505002
answer count: 3
has answer: http://stackoverflow.com/a/23505008
tagged with: maven

http://stackoverflow.com/comment/36198365
score: 2
comment on: http://stackoverflow.com/q/23585157
has text: That means your test is flawed. Just because you put something into a `Bundle` does not mean that it goes through the process of being put into or out of a `Parcel`. In your case, the `savedInstanceState` `Bundle` (which I am guessing is what you used) is not converted into a `Parcel` for a simple configuration change. Instead, toggle on "Don't keep activities" in Developer Options in Settings. Then, run your activity and press HOME. Then, try to get back into your activity via the recent-tasks list. That should more fully exercise your code. Or, use your `Parcelable` in an `Intent` extra.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23471073
upvote count: 1
tagged with: android
downvote count: 1
has answer: http://stackoverflow.com/a/23471285
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23471223
has answer: http://stackoverflow.com/a/23471221
has title: Logout functionality with SharedPreferences
tagged with: java
tagged with: sharedpreferences
favorite count: 0
has body: I have created a app with a login functionality. When the user logs in for the first time, his credentials get saved using SharedPreferences. The next time he logs in he is redirected to the 2nd screen directly. I have implemented a logout funtionality. I clear the preferences but when I try logging in from other account, I still get the details of the previous account. Here is my code:- Main.java private SessionManagement sessionManager; sessionManager.createLoginSession(username, deviceUrl, deviceId, endPointHost, deviceName, name , encodedAccountNameToken, hostUrlToken); SessionManagement.java public class SessionManagement { SharedPreferences pref; // Editor for Shared preferences Editor editor; // Context Context _context; // Shared pref mode int PRIVATE_MODE = 0; // Sharedpref file name private static final String PREF_NAME = "UserDetails"; // All Shared Preferences Keys private static final String IS_LOGIN = "IsLoggedIn"; // User name (make variable public to access from outside) public static final String KEY_EMAILID = "email"; // Email address (make variable public to access from outside) public static final String KEY_DEVICEURL = "deviceurl"; public static final String KEY_ENDPOINTHOST = "endpointhost"; public static final String KEY_DEVICENAME = "devicename"; public static final String KEY_USERSNAME = "usersname"; public static final String KEY_ENCODEDACCOUNTNAME = "encodedaccountname"; public static final String KEY_HOSTURL = "hosturl"; public static final String KEY_DEVICEiD = "deviceid"; public static final String KEY_DEVICEREGISTERED = "deviceregistered"; // Constructor public SessionManagement(Context context) { this._context = context; pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); editor = pref.edit(); } public void createLoginSession(String emailId, String deviceauthurl, String deviceid, String endpointhost, String devicename, String usersname, String encodedaccountname, String hosturl) { // Storing login value as TRUE editor.putBo…
type: Question
has comment: http://stackoverflow.com/comment/35984717
score: 0
answer count: 3

http://stackoverflow.com/comment/36129852
type: QuestionComment
comment on: http://stackoverflow.com/q/23548387
has text: This has nothing at all to do with C. Even if you think so.
score: 0
type: Comment

http://stackoverflow.com/comment/36239582
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23602176
has text: i posted some jsp - "code", i hope this helps. Do you need somemore pointers?
type: AnswerComment

http://stackoverflow.com/comment/36025261
has text: Have you tried one of the `org.jfree.chart.annotations`?
score: 1
comment on: http://stackoverflow.com/q/23491509
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36081018
type: AnswerComment
score: 0
has text: @Holger: What *exactly* do you mean by "no Java 8 support"?
type: Comment
comment on: http://stackoverflow.com/a/23519642

http://stackoverflow.com/comment/36210389
comment on: http://stackoverflow.com/a/23591492
type: AnswerComment
has text: Alright I tried the sample code, same socket permission error
score: 0
type: Comment

http://stackoverflow.com/comment/36026425
has text: Well, instead of being `static synchronized`, `AccessorInjector.prepare(…)` might contain a `synchronized (AccessorInjector.class)` statement; the result would be the same…
comment on: http://stackoverflow.com/q/23491667
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23553753
favorite count: 0
has answer: http://stackoverflow.com/a/23554514
accepted answer: http://stackoverflow.com/a/23554514
score: -3
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/36140164
type: AnsweredQuestion
tagged with: scala
has body: I am using MVC architecture in Play Framework in which the view part is a mix of scala and html. Now, I need to sort a Map coming from the controller layer in my view. As scala has no memory its being really hard to create a sort function to sort my map by timestamp. Can anybody please help i'm really not able to solve this one as i am new to scala. This is my First Question. Any help would be Appreciated.
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/36140987
downvote count: 4
tagged with: playframework
upvote count: 1
has title: How to apply Sort function on a Map in scala?
answer count: 1

http://stackoverflow.com/comment/36153014
type: AnswerComment
type: Comment
score: 0
has text: I imported as a project into Eclipse and the Transcriber working fine. But i don't know which files or folders in HindiASR are for acoustic model and the dictionary.
comment on: http://stackoverflow.com/a/23502287

http://stackoverflow.com/q/23457897
has title: foreign keys in objectify / google app engine
score: 0
has body: I'm trying to write an application for the google app engine using Objectify and am having some trouble. I'm new to noSQL datastores so it's probably a conceptual problem. I have an entity called a message, and each message has a from User - the user who created the message. @Entity public class Message { @Index private Key&lt;User&gt; fromUserKey; @IgnoreSave private User fromUser; Annoyingly, I have to have both a User and a Key field in the message. JSON needs the User object to populate the response with useful fields, and the google app engine needs the Key to be able to store the reference to the user. The @IgnoreSave annotation is used to stop Objectify asking the google app engine to try to store the User object (which will fail). When fetching messages, the from user key is populated, but the from User object is not. Here's what the DAO code looks like for my "getMessages" operation: public static List&lt;Message&gt; getSentMessages(long userId) { List&lt;Message&gt; result; result= ofy().load().type(Message.class).filter("from", Key.create(User.class, userId)).limit(1000).list(); return result; } But the fromUser object is not populated on each Message, only the fromUserKey. How do I get the actual User object populated in the response? I need to access such fields as forename, surname, etc - not just the ID of the User. I could get the from User from the DB, loop through the results, then call setFromUSer on each message, but it's ugly. And it also causes a ConcurrentModificationException... I'm sure I'm doing something wrong here, but I can't work out what.
has answer: http://stackoverflow.com/a/23460374
answer count: 1
accepted answer: http://stackoverflow.com/a/23460374
tagged with: objectify
tagged with: google-app-engine
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/35976405
type: Comment
type: QuestionComment
has text: post the declaration of `setempId()` or the class `PersonalInfoBO_1`
score: 0
comment on: http://stackoverflow.com/q/23466422

http://stackoverflow.com/q/23596923
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/36223051
answer count: 1
accepted answer: http://stackoverflow.com/a/23597152
score: -1
has body: So I have a big array of bytes. The first 2/3 of it is just blank basically, just 0's. And at the really end there is some text that is useful for me and also a lot of jibberish in between that text. Now how do you even filter out atleast the empty part from the byte array? Right now, this is what I am doing: FileInputStream fis = null; fis = new FileInputStream("resources/xampp2.zip"); byte[] bytes = IOUtils.toByteArray(fis); String decoded = new String(bytes, "UTF-8"); It is a corrupted .zip, so the 2/3 as I sayd, is completely empty, and the rest is the Central directory. But right now It will just load it all into one really big String variable which is not really an efficient way of doing thing I belive? But how would it be smart to iterate over blocks of bytes in my array, and filter out rubbish?
has title: Not sure how to work on with my array of bytes
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23597152
type: Question
upvote count: 0

http://stackoverflow.com/a/23495710
score: 3
has body: The issue is being caused by the fact that ServletContextListeners are invoked before all Servlets of the context are created. As the API for ServletContextListener states: Receives notification that the web application initialization process is starting. All ServletContextListeners are notified of context initialization before any filters or servlets in the web application are initialized. So in your configuration: org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath:config/application-context-*.xml means that your Spring ApplicationContext is created before any of the Servlets. This is why you are getting your error. To fix it you need to ensure that whatever you are trying to do in your bean, you do it once the Proxool servlet is properly initialised. I think the easiest way to do this is to switch your Spring ApplicationContext to be loaded by DispatcherServlet and ensure that the load-on-startup value for DispatcherServlet is greater than that of the Proxool servlet. For more information on DispatcherServlet, see here.
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23487672
downvote count: 0

http://stackoverflow.com/comment/36253297
type: QuestionComment
comment on: http://stackoverflow.com/q/23613829
has text: AudioFormat describes a *transport format* within the JRE - *not* a specific file format. AudioFormat is simply part of the abstraction layer used to decouple application logic from physical representation. As for the details of MP3, why don't you simply look it up?
score: 0
type: Comment

http://stackoverflow.com/comment/99316567
has text: This might not be the preferred answer, but even for those who have no maven project and cannot fix their pom files it works fine.
type: AnswerComment
comment on: http://stackoverflow.com/a/43295825
type: Comment
score: 0

http://stackoverflow.com/comment/36233550
has text: That makes sense to me in theory, so I will definitely give that a try. Thanks!
type: Comment
comment on: http://stackoverflow.com/a/23568283
score: 0
type: AnswerComment

http://stackoverflow.com/a/23603865
type: Answer
has body: In url String url="http://chart.apis.google.com/chart?&amp;cht=lc&amp;chco=000000&amp;chds=0,10&amp;chdlp=b&amp;chxt=x,y" +"&amp;chg=1.04,0,5,1&amp;chds=0,30&amp;chco=3072F3,ff0000,00aaaa&amp;chls=2,4,1&amp;chm=s,FF0000,0,-1,0|s,0000ff,1,-1,0|s,00aa00,2,-1,0" +"&amp;chs=480x280&amp;chof=validate&amp;chd=t:100,200,300,400,500,600,700&amp;chd=t:" +point; Your point is converted with point.toString() and appended to the url in this part "&amp;chd=t:"+point; which is the second time when chd appers in the url. So in effect only the last chd value is considered. And the first which was chd=t:100,200,300,400,500,600,700 is not considered. If you want to pass chd it has to be in format chd=t:val,val,val where val represents a value from your data. See an example with a data chd=t:-5,30,-30,50,80,200 and chd should appear only once in the url. So your code for the url would be this: String url="http://chart.apis.google.com/chart?&amp;cht=lc&amp;chco=000000&amp;chds=0,10&amp;chdlp=b&amp;chxt=x,y" + "&amp;chg=1.04,0,5,1&amp;chds=0,30&amp;chco=3072F3,ff0000,00aaaa&amp;chls=2,4,1&amp;chm=s,FF0000,0,-1,0|s,0000ff,1,-1,0|s,00aa00,2,-1,0" + "&amp;chs=480x280&amp;chof=validate&amp;chd=t:"+&lt;comma separated list of values&gt;;
answers question: http://stackoverflow.com/q/23578929
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23578929
has comment: http://stackoverflow.com/comment/36238103

http://stackoverflow.com/q/23595707
score: 1
tagged with: java
upvote count: 1
has body: Why when I run this code the window has 3 columns and 10 rows? I thought that it should have 10 columns and 10 rows. Code: JFrame frame = new JFrame(); Container container = frame.getContentPane(); container.setLayout(new GridLayout(10,10)); for (int i = 0; i &lt; 5; i++) { for (int j = 0; j &lt; 5; j++) { if (i &gt;= j) { container.add(new JButton("X")); } else { container.add(new JLabel("*")); } } } frame.setSize(500, 500); frame.setVisible(true);
accepted answer: http://stackoverflow.com/a/23595755
type: Question
tagged with: grid-layout
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23595755
tagged with: swing
has title: Grid Layout behaviour in java
type: AnsweredQuestion

http://stackoverflow.com/q/23542101
type: AnsweredQuestion
score: -2
has answer: http://stackoverflow.com/a/23542258
tagged with: java
has answer: http://stackoverflow.com/a/23542234
accepted answer: http://stackoverflow.com/a/23542234
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36120179
has comment: http://stackoverflow.com/comment/36118866
tagged with: wait
favorite count: 0
downvote count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/23542258
has comment: http://stackoverflow.com/comment/36117410
linked to: http://stackoverflow.com/q/6114320
tagged with: multithreading
has title: When to call wait() on super
has body: When to invoke super.wait(), something like below - synchronized (this) { while (true) { try { super.wait(); } catch (InterruptedException e) { return; } } }

http://stackoverflow.com/a/23532103
upvote count: 3
has comment: http://stackoverflow.com/comment/36099904
has body: I would recommend the following things in order. Investigate why your app is running out of memory. Are you creating arrays or other objects bigger than what you need. I hope you might have done that already. But still I thought it's worth mentioning because this should not be ignored. If you think there is nothing wrong with step 1 then check you are not running with too low memory settings. or 32 bit jvm If there is no issue with step 2. Now it's not always true that a light weight database will give you best performance. If you don't require searching the temp data may be you won't gain much from implementing a light weight database. But if your application needs lot of searching / querying the temp data it may be different case. If you don't need searching custom file format may be fast and efficient. I hope it helps you solve the issue at hand :)
answers question: http://stackoverflow.com/q/23531704
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/comment/36004918
type: Comment
comment on: http://stackoverflow.com/a/23479809
has text: What camickr is saying is that you really should implement the `get*Size()` methods so that layout managers can do their job. Many layout managers use max, min, and preferred size to determine how to allocate space in the container to the various components inside of that container. If you don't implement those methods, then your component will not play well with others (or even by itself) when used with those layouts. This may work if don't use your component in those containers, but is not really "proper". This is why your component doesn't work with GridBagLayout.
type: AnswerComment
score: 0

http://stackoverflow.com/a/23512330
has comment: http://stackoverflow.com/comment/36068342
has comment: http://stackoverflow.com/comment/36071258
score: 0
has comment: http://stackoverflow.com/comment/36067039
has comment: http://stackoverflow.com/comment/36064210
type: Answer
has comment: http://stackoverflow.com/comment/36069147
has comment: http://stackoverflow.com/comment/36074213
answers question: http://stackoverflow.com/q/23512102
has body: In class A I have a method which I want to call from C You should make an association between A and C via putting a C field into the A. You can pass the reference to it in the constructor or use a setter method to initialize it. Actually, you don't need them in the code for deposit method, but you can initialize them in this method for further references or usage in other methods. EDIT: import java.util.ArrayList; public class A { private ArrayList&lt;Customer&gt; customerlist; private Customer customer; private SavingsAccount account; public A() { customerlist = new ArrayList&lt;Customer&gt;(); } public boolean deposit(long pNr, int accountId, double amount) { for(Customer customer : customerlist) { if(customer.getPCode() == pNr) { this.customer = customer; //initialize List&lt;SavingsAccount&gt; accounts = customer.getAccounts(); for (SavingsAccount account : accounts) { if (account.getAccountId() == accountId){ this.account = account; //initialize account.transaction(amount); return true; } } } } return false; } } public class Customer { private long pNr; private ArrayList&lt;SavingsAccount&gt; accounts; public long getPCode(){ return pNr; } public Customer(long pCode) { pNr = pCode; accounts = new ArrayList&lt;SavingsAccount&gt;(); } public ArrayList&lt;SavingsAccount&gt; getAccounts(){ return accounts; } } public class SavingsAccount { private double balance; private int accountId; public int getAccountId(){ return accountId; } public SavingsAccount(int accountId){ this.accountId = accountId; } public double transaction(double amount){ if(amount &lt; 0 &amp;&amp; balance + amount &lt; 0) return -0; else return balance += amount; } }
has comment: http://stackoverflow.com/comment/36064899
has comment: http://stackoverflow.com/comment/36072985

http://stackoverflow.com/comment/36172760
type: Comment
comment on: http://stackoverflow.com/q/23571375
type: QuestionComment
has text: This is probably the worst-formatted code I've seen here so far. If you really want help could you at least put some effort into making your code readable?
score: 0

http://stackoverflow.com/comment/36144946
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23556498
type: Comment
has text: same, it's 05-09 11:26:43.417: ERROR/AndroidRuntime(637): FATAL EXCEPTION: AsyncTask #1 05-09 11:26:43.417: ERROR/AndroidRuntime(637): java.lang.RuntimeException: An error occured while executing doInBackground()

http://stackoverflow.com/comment/35965125
has text: @Orion a few more things are necessary. I will update my answer.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23460223
type: Comment

http://stackoverflow.com/comment/36020700
has text: I want to use a service as a Client.I am using java for the same
comment on: http://stackoverflow.com/a/23490329
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/23581044
has body: I did public class Employee implements Comparable &lt;Object&gt; { public int compareTo (Object other ){ i did the implementation well (it works fine) and calles it from other class: import java.util.Vector; public class Firm { private Vector &lt;Employee&gt; employees = new Vector&lt;Employee&gt;(); and using in the same class (Firm) Comperator Vector in function : public void SortVector(Vector &lt;Comparable&gt; vector) { and calls it with: SortEmployeesBy(this.employees); ////Error is here and in this line the compiler said: The method SortVector(Vector) in the type Firm is not applicable for the arguments (Vector)" Note: i required to use only vector and need to use SortVector several times so that i need to use the comparator because i have many vector and other classes like Employee, customer, Artist... tha each has own implementation for Comparable why is that, and how to fix it?
has comment: http://stackoverflow.com/comment/36190488
has title: How to use Vector and Comparable Interface
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/36190871
type: Question
has comment: http://stackoverflow.com/comment/36192483
upvote count: 0
score: -1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23581081

while-loop
tags question: http://stackoverflow.com/q/23593111
type: Tag
tags question: http://stackoverflow.com/q/23495167
tags question: http://stackoverflow.com/q/23582478
tags question: http://stackoverflow.com/q/23530609
tags question: http://stackoverflow.com/q/23455252
tags question: http://stackoverflow.com/q/23531088
tags question: http://stackoverflow.com/q/23598714
tags question: http://stackoverflow.com/q/23599712
tags question: http://stackoverflow.com/q/23550985
tags question: http://stackoverflow.com/q/23562293
tags question: http://stackoverflow.com/q/23551705
tags question: http://stackoverflow.com/q/23611420
tags question: http://stackoverflow.com/q/23478387
tag name: while-loop

http://stackoverflow.com/comment/139235859
comment on: http://stackoverflow.com/a/65970152
has text: I don't understand the point of SO if such great answers don't get more upvotes.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23463583
has body: I have used opengl for a long time and to setup a transform that will map sprite locations to the window coordinates I use the following ... glOrtho(0, screenWidth, screenHeight, 0, -1, 1); then to position a sprite at a window coordinate I would use the following ... glTranslate(100, 100, 0); For the programmable pipeline I would do the same thing except instead of using glOrtho and glTranslate I would create matrix data structures and send them to shader uniforms I am now using the java LWJGL library with a programmable pipeline and for some reason the transforms have to be equivalent to glOrtho(0, screenWidth, screenHeight, 0, -1, 1); glTranslate(100, -100, 0); if I do the programmable pipeline equivalent of glTranslate(100, 100, 0); the sprite goes of the screen. It appears that the y translation is reversed from what I am used to. Has anyone else worked with LWJGL and know about any issues that make it different from C/C++ opengl in this regard? for reference in java I set up my ortho matrix with this code float tx = -(right + left) / (right - left); float ty = -(top + bottom) / (top - bottom); float tz = -(far + near) / (far - near); float sx = 2 / (right - left); float sy = 2 / (bottom - top); float sz = -2 / (far - near); matrix.m00 = sx; matrix.m10 = 0; matrix.m20 = 0; matrix.m30 = tx; matrix.m01 = 0; matrix.m11 = sy; matrix.m21 = 0; matrix.m31 = ty; matrix.m02 = 0; matrix.m12 = 0; matrix.m22 = sz; matrix.m32 = tz; matrix.m03 = 0; matrix.m13 = 0; matrix.m23 = 0; matrix.m33 = 1; and use the Matrix4f.translate to create the translation matrix. The matrices are sent to a projection and model uniforms and in the vertex shader the position is calculated as followed ... gl_Position = projection * model * vec4(aPosition, 1.0); The matrix is setup to be transposed. I have also tried not transposed but I get an invalid transform when the matrix is not transposed. I found the problem it was an error in the above code instead of float sy = 2 / (bottom - top); it shoul…
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23463769
type: UnansweredQuestion
has title: LWJGL ortho + translation matrix issue
tagged with: opengl
tagged with: java
tagged with: lwjgl

http://stackoverflow.com/comment/47620565
type: AnswerComment
has text: This isn't actually correct. The Neo4j embedded database supports concurrent access. The limitation here is that neo4j only allows a single instance of a database to run in a single directory. When you start up an instance it creates a file store.lock, and attempting to create another instance in the same directory find this file and throws the exception org.neo4j.kernel.StoreLockException: Unable to obtain lock on store lock file: /tmp/import.db/store_lock. Please ensure no other process is using this database, and that the directory is writable (required even for read-only access)
comment on: http://stackoverflow.com/a/23516189
type: Comment
score: 2

http://stackoverflow.com/q/23513510
has body: I'm working on RCP application. I'm using tycho to build product. I want to add content of About Dialog, currently I'm writing it manually by editing product file under Branding tab. Is there is any other way to add build ID for my application in about dialog.?
has answer: http://stackoverflow.com/a/23537521
answer count: 1
downvote count: 0
tagged with: eclipse-plugin
tagged with: eclipse-rcp
tagged with: eclipse-kepler
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion
has title: How to add build ID in about dialog,
type: Question
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/23582021
answers question: http://stackoverflow.com/q/23581759
score: 2
has comment: http://stackoverflow.com/comment/36196006
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23581759
has body: Add an ActionListener or ItemListener to your JCheckBox if you want to be notified when it is checked or unchecked and then respond to it. Simple as that. As for writing to the JFormattedTextField part, we have no idea about what specifically has you hung up given the limited information you've posted so far. Don't use null layouts and setBounds(...) this makes for very inflexible GUI's that while they might look good on one platform look terrible on most other platforms or screen resolutions and that are very difficult to update and maintain. Instead you will want to study and learn the layout managers and then nest JPanels, each using its own layout manager to create pleasing and complex GUI's that look good on all OS's. Your current code suggests that you want to use a GridLayout with 2 columns. Google and then study the Java Swing Tutorials as all this information and more is to be easily found there.
has comment: http://stackoverflow.com/comment/36195912
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36217519
type: AnswerComment
has text: I tried printing nothing but I added this line for (int i = 0; i < list.getLength(); i++) { System.out.println("Table is :"+i); and I notice it gets so what else can I do ? OR how to print all the elements found under tag Table ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23595481

http://stackoverflow.com/a/23599026
answers question: http://stackoverflow.com/q/23598066
has comment: http://stackoverflow.com/comment/36224794
downvote count: 0
has body: I agree with @Groo. Implementing a shouldMoveXXX is a much better idea than needlessly messing with concurrency. You could still make this time based(as your comments make you seem like you want) like this: // time between each move final int SLEEP_TIME = 1000; //each animal has this variable, it is the last time they moved long lastMoveTime; public boolean shouldMoveRabbit(){ if(System.currentTimeMillis() &gt;= lastMoveTime + SLEEP_TIME) return true; return false; } public void doMoveRabbit(){ lastMoveTime = System.currentTimeMillis(); // move stuff }
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/23598066

http://stackoverflow.com/comment/36152326
has text: @VishnudevK Can you explain better?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23559150
type: QuestionComment

http://stackoverflow.com/q/23570473
has title: Compare Numbers in an Array
type: UnansweredQuestion
has body: I have an ArrayList of numbers, I want to compare the list of numbers against a number stored in an variable. For example 7 is stored in the variable, and my array consists of, 5 1 2 4 How would I compare each number in the array in order against the one next to it to see if it equals 7? then if the numbers do equal or is less than 7 move them to the back of the number list. i.e 5 + 1 = 6 but 5 + 1 + 2 = 8 so 5 and 1 moves to the back of the list and it becomes 2 4 5 1. At the moment I have a few if statements but they do not hold up and give me out of bounds exceptions when I run it. Edit: This is what I've so far which covers 1 condition of what I want it to do. for(int z = 0; z &lt; sum; z++) { System.out.println(arr); if(arr.get(z) == sum ) { arr.add(z); arr.remove(z); tot = total2 + arr.get(z); } }
has answer: http://stackoverflow.com/a/23570556
tagged with: java
downvote count: 2
type: Question
tagged with: algorithm
upvote count: 0
score: -2
tagged with: arrays
answer count: 1
favorite count: 0

http://stackoverflow.com/q/23538349
accepted answer: http://stackoverflow.com/a/23538901
linked to: http://stackoverflow.com/q/23541364
score: 11
answer count: 2
has answer: http://stackoverflow.com/a/33743195
tagged with: intellij-idea
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/33743195
upvote count: 11
has answer: http://stackoverflow.com/a/23538901
type: AnsweredQuestion
has title: Maven compile does not create class files
tagged with: maven
type: Question
has body: I have a 3 module maven project with parent pom. From parent when I run a maven clean-compile-test. It fails at test phase and gives tons of compilation errors saying "symbol not found" for my local classes. I discovered using IntelliJ ide if I use the "Make Project" button before I run a maven test, then maven test works! Edit: Now I figured out that probelem is maven compile does not create class files in target folder for some reason this is my maven compiler plugin configuration in parent pom file: org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 **/*.* Any ideas?
has comment: http://stackoverflow.com/comment/36111070
has comment: http://stackoverflow.com/comment/36113209
tagged with: java
has comment: http://stackoverflow.com/comment/36111053

http://stackoverflow.com/q/23555129
type: AnsweredQuestion
tagged with: object
has answer: http://stackoverflow.com/a/23555977
tagged with: java
has body: How could I limit the user to creating objects with certain variable values? In other words, if some class has variables a, b, and c, the class should only be created if the value of c is part of a certain set of values. if the value of c is not in that set of values, then simply prevent the creation of that class object. This in reference to Java.
has answer: http://stackoverflow.com/a/23556513
type: Question
accepted answer: http://stackoverflow.com/a/23555977
possible better answer: http://stackoverflow.com/a/23556513
has comment: http://stackoverflow.com/comment/36142404
tagged with: class
score: 0
answer count: 2
has title: Possible to disallow class object creation if certain parameter is supplied?
tagged with: constructor
has comment: http://stackoverflow.com/comment/36143832

http://stackoverflow.com/q/23552310
tagged with: java
tagged with: jpanel
has title: Switching a JButton from one JPanel to another Jpanel in Swing
type: Question
has comment: http://stackoverflow.com/comment/36151544
has comment: http://stackoverflow.com/comment/36142493
score: 0
tagged with: drag-and-drop
has body: I try to drag and drop a Button from on Panel to another. Everything is Custom already. But I think I'm missing something. Both have "GridLayouts" And both are 100% filed with Buttons. I have already Implemented a MouseMotionListener which works really well. I am able to move the Buttons around inside their Panel. BUT if I want to leave the Panel the Button disappears. I'm able to move it back if I keep it dragged but I can't see the Button once it leaves the Panel. Is there an easy fix to this, which I am missing? This is my first time creating a minimal example, I hope it's ok import java.awt.Color; import java.awt.EventQueue; import java.awt.GridLayout; import java.awt.Image; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.TransferHandler; //this class works perfekt class TileRackListener implements MouseMotionListener { public void mouseDragged(MouseEvent argEvent) { System.out.println("(" + argEvent.getX() + "," + argEvent.getY() + ")"); if (argEvent.getX() < 0 || argEvent.getY() < 0) { Rectangle objBounds = argEvent.getComponent().getBounds(); argEvent.getComponent().setLocation(objBounds.x + argEvent.getX(), objBounds.y + argEvent.getY()); } else { Rectangle objBounds = argEvent.getComponent().getBounds(); if (objBounds.x <= objBounds.x + argEvent.getX() && objBounds.x + argEvent.getX() <= objBounds.x + objBounds.width && objBounds.y <= objBounds.y + argEvent.getY() && objBounds.y + argEvent.getY() <= objBounds.y + objBounds.height) { argEvent.getComponent().setLocation( objBounds.x + argEvent.getX(), objBounds.y + argEvent.getY()); } else { argEvent.getComponent().setLocation(argEvent.getX(), argEvent.getY()); } } argEvent.getComponent().transferFocus(); ; argEvent.getComponent().repaint(); } @Override public void mouseMoved(MouseEvent arg0) { // TODO Auto-generated method s…
answer count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: jbutton

http://stackoverflow.com/comment/35970998
comment on: http://stackoverflow.com/q/23463149
type: Comment
type: QuestionComment
score: 0
has text: I didn't notice that. It still displayed without binding it somehow but when I made it bind the buffer in the render loop it didn't change anything.

http://stackoverflow.com/q/23462447
answer count: 2
has answer: http://stackoverflow.com/a/23462535
score: 0
has comment: http://stackoverflow.com/comment/35969197
possible better answer: http://stackoverflow.com/a/23462536
tagged with: java.util.scanner
has body: So I'm going through a bunch of basic programming ideas to help me get the hang of Java and I created a program that will print PI up to the 10th decimal place (and I can add more if I want). However, I decided to go an extra step and create an option to keep running the program over and over until the user tells it to stop. I created a method to return either true (run again) or false (exit program). Originally I created a scanner in the method to take user input, and the program runs fine that way, but it tells me I have a resource leak because I didn't close the scanner in the method. I have just passed the input scanner from main to the method as a parameter, but when I run the program it doesn't accept user input and will print out "Sorry, there was an error" (the else{} option in the if-else statement in my method). Now, I can go back and create a seperate scanner but my OCD doesn't want Eclipse telling me there is a resource leak (I think input.close() closes both scanners, but I am not sure). Here is my code, I apologize to any Java enthusiasts who become smitten and offended at any bad practices I am unaware of, I am learning. import java.util.Scanner; import java.text.DecimalFormat; public class PiDecimalFormat { public static void main(String[] args) { Scanner input = new Scanner(System.in); DecimalFormat format = new DecimalFormat("#"); int decPlace = 0; boolean runProgram = true; System.out.println("This program will print out PI to the decimal place of your choosing."); while (runProgram == true) { System.out.print("\nEnter the number of decimal places (up to 10) that \nyou would like to print PI to: "); decPlace = input.nextInt(); switch (decPlace) { case 0: format = new DecimalFormat("#"); break; case 1: format = new DecimalFormat("#.#"); break; case 2: format = new DecimalFormat("#.##"); break; case 3: format = new DecimalFormat("#.###"); break; case 4: format = new DecimalFormat("#.####"); break; case 5: format = new DecimalFormat("#.#####"); break…
type: AnsweredQuestion
has title: Java passing scanner into method
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/23462536
accepted answer: http://stackoverflow.com/a/23462535
type: Question

http://stackoverflow.com/q/23541721
type: Question
has body: The program deal four is supposed to create a shuffled deck and deal four hands of 13 cards from the deck. I keep getting an out of memory error at cards[i] = Card(x); in the DealFour class. I attempted to increase the maximum heap space through the java -Xmx argument. This does not work. Here is the Card class package Casino; @SuppressWarnings("unchecked") public class Card extends Object { String[] deck = {"AH", "KH", "QH", "JH", "10H", "9H", "8H", "7H", "6H", "5H", "4H", "3H", "2H", "AS", "KS", "QS", "JS", "10S", "9S", "8S", "7S", "6S", "5S", "4S", "3S", "2S", "AD", "KD", "QD", "JD", "10D", "9D", "8D", "7D", "6D", "5D", "4D", "3D", "2D", "AC", "KC", "QC", "JC", "10C", "9C", "8C", "7C", "6C", "5C", "4C", "3C", "2C"}; String card; public Card(int i) { card = deck[i]; } public void show() { System.out.println(card); } } And Here is the DealFour class: import java.util.*; import java.io.*; import Casino.*; @SuppressWarnings("unchecked") public class DealFour { public static void main(String[] args) { Stack shuffledDeck = new Stack(); Random repeater = new Random(); Card[] cards = new Card[52]; int high = 52; for(int i = 0; i &lt; 52;) { int x = Math.abs(repeater.nextInt(52)); if(x&lt;52) { cards[i] = new Card(x); if(i==0) { shuffledDeck.push(cards[i]); } else { for(int w = 0; w &lt; i;) { int q = (int)(i-1); if(w==q) { shuffledDeck.push(cards[i]); i++; } if(cards[w]!=cards[i]) { w++; } } } } } Card[] hand1 = new Card[13]; Card[] hand2 = new Card[13]; Card[] hand3 = new Card[13]; Card[] hand4 = new Card[13]; System.out.println("Hand 1"); for(int x = 0; x &lt; 13; x++) { hand1[x] = (Card)shuffledDeck.pop(); hand1[x].show(); hand2[x] = (Card)shuffledDeck.pop(); hand3[x] = (Card)shuffledDeck.pop(); hand4[x] = (Card)shuffledDeck.pop(); } System.out.println("Hand 2"); for(int y = 0; y &lt; 13; y++) { hand2[y].show(); } System.out.println("Hand 3"); for(int z = 0; z &lt; 13; z++) { hand3[z].show(); } System.out.println("Hand 4"); for(int g = 0; g &lt; 13; g++) { hand4[g].sh…
has comment: http://stackoverflow.com/comment/36116856
score: -1
has comment: http://stackoverflow.com/comment/36117106
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36116878
has answer: http://stackoverflow.com/a/23541948
has comment: http://stackoverflow.com/comment/36117175
favorite count: 0
has comment: http://stackoverflow.com/comment/36117338
tagged with: heap-memory
type: UnansweredQuestion
has title: Dealing four hands
upvote count: 0
tagged with: java

http://stackoverflow.com/a/23615681
answers question: http://stackoverflow.com/q/23615451
upvote count: 3
downvote count: 1
has body: The short answer is Type Inference. Here's what's going on. You're not simply calling Lists.newArrayList(); you're also assigning it to a variable, like List&lt;Person&gt; people = Lists.newArrayList(); Since you've specified the type arguments in the variable declaration, Java is able to "infer" (figure out) the type arguments you'd want in your new ArrayList, so you don't need to specify them.
score: 2
type: Answer

http://stackoverflow.com/a/23576129
score: 4
has comment: http://stackoverflow.com/comment/36181707
has body: JFileChooser filedlg = new JFileChooser(); filedlg.showOpenDialog(null); File selected = filedlg.getSelectedFile(); textField.setText(selected.getName()); textField_1.setText(selected.length()); String fullName = selected.getAbsolutePath(); Also, the .length() gives size in bytes, so you will have to transform it to whatever you want after. http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html http://docs.oracle.com/javase/6/docs/api/java/io/File.html
accepted answer of: http://stackoverflow.com/q/23576111
has comment: http://stackoverflow.com/comment/36181790
answers question: http://stackoverflow.com/q/23576111
upvote count: 4
has comment: http://stackoverflow.com/comment/36181694
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36181660
has comment: http://stackoverflow.com/comment/36181865
type: Answer
has comment: http://stackoverflow.com/comment/36181693

http://stackoverflow.com/comment/36144587
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23556342
type: Comment
has text: sorry mate,I posted the wrong code. jList1.setListData(vdate); jList1.setListData(vsubject); jList1.setListData(vfrom); I've edited it. You can take a look now...sorry again......

http://stackoverflow.com/a/23553258
has comment: http://stackoverflow.com/comment/36163648
downvote count: 0
has body: Your reads and writes are not symmetric. To write two stock quotes, you open a new ObjectOutputStream write a StockQuote close the ObjectOutputStream open a new ObjectOutputStream write a StockQuote close the ObjectOutputStream To read these two StockQuotes, you open an ObjectInputStream read a StockQuote read a StockQuote close the ObjectInputStream Each time you open a new ObjectOutputStream, a serialization header is written to the underlying stream. My advice: store all the StockQuotes to a list, and write this list to the ObjectOutputStream when you're done. On the receiver end, read the list.
type: Answer
answers question: http://stackoverflow.com/q/23553038
score: 2
has comment: http://stackoverflow.com/comment/36156525
upvote count: 2

http://stackoverflow.com/a/23561624
type: Answer
has body: Try either not packaging your music in jar (put it alongside) or load your packaged file as a resource. See Java resource files for example. Here Loading resources (images) contained in a .Jar file or in the classpath might be a better explanation.
score: 0
answers question: http://stackoverflow.com/q/23561102

http://stackoverflow.com/comment/36015121
type: QuestionComment
comment on: http://stackoverflow.com/q/23487272
score: 0
type: Comment
has text: Internal memory means the `thing` - some `Colleciton of Entry` internal structure of `HashMap` implementation that keeps data for `HashMap`.

http://stackoverflow.com/comment/109081198
has text: @PeterCordes: Not a SPARC expert, but from [3] my understanding is this not about SMT and logical cores. In SMT when a logical core switches to another thread, that thread will uses the same register set that the previous one was using on that same logical core (the OS saves/restores the values in the registers as part of context switch). SPARC has multiple distinct register-sets and flips the "active window" so the other thread resumes on a distinct set of registers. This is to speed up context switching (OS does not need to save/restore register values).
type: AnswerComment
comment on: http://stackoverflow.com/a/23770837
score: 0
type: Comment

http://stackoverflow.com/q/23525748
has body: I developed a web service with the JAX-WS API and now I'm trying to test it with soap ui and other client web service. The problem is when I enter an input, no output figures (I think that it is an encoding problem). This is snapshots for the client web service and exceptions in my WS
has comment: http://stackoverflow.com/comment/36089510
has comment: http://stackoverflow.com/comment/36088337
downvote count: 0
has comment: http://stackoverflow.com/comment/36087243
has comment: http://stackoverflow.com/comment/36087840
has title: Error when testing a web service with client web service
has comment: http://stackoverflow.com/comment/36087178
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36087603
upvote count: 1
has comment: http://stackoverflow.com/comment/36088983
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36087446
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/a/23473966
type: AcceptedAnswer
has body: Easiest way to get it going is to use BaseGameUtils which you can download here (it is located in /BasicSamples/libraries/). The Google Play Game Services documentation describes how to use it. You still don't have to use BaseGameUtils, you could just use it as a reference for coding your own. But using it seems to be the way Google wants it done - probably to provide some consistency across games :) Personally, I don't like using the BaseGameActivity as a base for my own activities and allowing it to take over the sign-in flow completely. I just use the GameHelper class to perform the required functionality on demand.
accepted answer of: http://stackoverflow.com/q/23465723
type: Answer
has comment: http://stackoverflow.com/comment/35994836
answers question: http://stackoverflow.com/q/23465723
downvote count: 0
has comment: http://stackoverflow.com/comment/36019785
has comment: http://stackoverflow.com/comment/36018654
has comment: http://stackoverflow.com/comment/36021545
has comment: http://stackoverflow.com/comment/35996153
has comment: http://stackoverflow.com/comment/36018498
score: 1
has comment: http://stackoverflow.com/comment/36016641
has comment: http://stackoverflow.com/comment/36010757
upvote count: 1
has comment: http://stackoverflow.com/comment/36037231

http://stackoverflow.com/q/23525437
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/23526238
tagged with: user-interface
has answer: http://stackoverflow.com/a/23525799
favorite count: 0
type: UnansweredQuestion
has body: I'm working on a project that needs a GUI. How do I get the input for two given strings from the user using JTextField and display the output? My code: public static void main(String[] args) { // TODO code application logic here Scanner user_input = new Scanner(System.in); String s ; System.out.println("Enter the Barcode:"); s = user_input.next(); String z; System.out.println("Enter the Serial Number:"); z = user_input.next(); Random r = new Random(); int low = 1; int high = 21;// Set the number of random methods int rand = r.nextInt(high - (low - 1)) + low; }
tagged with: user-input
tagged with: java
has title: How do I get user input in a GUI using text field?
upvote count: 1
tagged with: jtextfield
downvote count: 1
type: Question

http://stackoverflow.com/comment/36802085
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23542312
has text: The cli example given in the doc is "dcmqr -L DCMQR DCM4CHEE@RadiologyServer:11112 -q00100020=QCTEST1 -q00100021=JHH -cget -cstore 1.2.840.10008.5.1.4.1.1.128 -cstoredest C:\Test" What command did you use? Do you know the sop class uids of the objects you want to retrieve?
type: Comment

http://stackoverflow.com/comment/36138030
type: AnswerComment
comment on: http://stackoverflow.com/a/23552779
type: Comment
has text: He's not directly invoking `paint(...)` on a component. He's calling it on objects of the logical (non-GUI) class, Ball1, which does not extend any Swing or AWT component, so his code, in this regard is OK. He still should override paintComponent and not paint. I'm also not sure about your point number 2. above.
score: 0

http://stackoverflow.com/comment/36191443
has text: Here is some documentation .. http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.1.2
type: Comment
comment on: http://stackoverflow.com/q/23581642
type: QuestionComment
score: 1

http://stackoverflow.com/comment/97564456
has text: Can this work for features as well, or only scenarios?
score: 0
comment on: http://stackoverflow.com/a/23611139
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23589211
type: Answer
has body: with current data-structure you must loop over the map: ArrayList&lt;String&gt; relatedKeys = new ArrayList&lt;String&gt;(); for(String k : departmentList.keySet()){ if(departmentList.get(k).equals(searchKey)) relatedKeys.add(k); at the end, you have a list of all related keys and can use for(String k : relatedKeys) System.out.println(k);
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23589020
score: 1
has comment: http://stackoverflow.com/comment/36225562
has comment: http://stackoverflow.com/comment/36205818
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23589020

http://stackoverflow.com/comment/36115273
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23540869
has text: Sure, <restriction base="{http://www.w3.org/2001/XMLSchema}string"> change this
score: 0

http://stackoverflow.com/comment/36115355
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23540308
has text: Yes, I tried sbt clean compile but it didn't change anything
score: 0

http://stackoverflow.com/comment/35985215
has text: Thanks for replying. Could you please elaborate? I am trying to understand about the default user name and password we use to connect to LDAP for the first time. Do we really need some user to bind to LDAP first ? I need a functionality where user should be authenticated and bound to LDAP at the time of logging into Liferay.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23469710
type: QuestionComment

http://stackoverflow.com/comment/36007504
type: QuestionComment
has text: The error messages are very descriptive. Check file `MainActivity.java`, line 65 and fix it. Similar for line 86.
score: 4
type: Comment
comment on: http://stackoverflow.com/q/23482922

http://stackoverflow.com/q/23610308
has title: Google Image request returns only 3 images
score: 0
accepted answer: http://stackoverflow.com/a/23778038
answer count: 1
has answer: http://stackoverflow.com/a/23778038
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
tagged with: google-image-search
has body: I'm writing a program that requests images from Google Images. I get a JSON object which I convert to an array. But for some reasons it always has only 4 images which sounds like a limit. And I want to disable it... JSONArray results = json.getJSONObject("responseData").getJSONArray("results"); for(int j = 0; j &amp;lt; results.length(); j++) { String strurl = results.getJSONObject(j).getString("unescapedUrl"); BufferedImage image = null; try { URL url = new URI(strurl).toURL(); System.out.println("URL content type:"+url.openConnection().getContentType()); URLConnection connection = url.openConnection(); image = ImageIO.read(connection.getInputStream()); } catch(MalformedURLException e) { e.printStackTrace(); } catch(IOException e ) { e.printStackTrace(); continue; } catch (URISyntaxException e) { e.printStackTrace(); } // I display the image. } And the JSONArray results is always 3(I printed it out) not matter what the search keyword is. Is there way to define the amount of results I want? I'm desperate... I'll be grateful for any kind of answer, even a longshot.

http://stackoverflow.com/a/23591547
has body: Try this one if the image in the "build" (also called bin) folder together with the classes. I have posted an answer in your last question itself. How am I supposed to draw an image from my Java Applet?.
answers question: http://stackoverflow.com/q/23591367
type: Answer
score: 0

http://stackoverflow.com/a/23534920
has comment: http://stackoverflow.com/comment/36137572
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23532066
downvote count: 0
has comment: http://stackoverflow.com/comment/36127812
type: Answer
has body: You probably want a List rather than an array. As you essentially have a two-dimensional result you need a List of arrays (or lists). The "outer" list represents the rows in the result, the "inner" list contains the columns of each row. String query = "select varchar_column, date_colum from the_table"; // this could a List&lt;List&lt;String&gt;&gt; just as well List&lt;String[]&gt; rows = new ArrayList&lt;String[]&gt;(); Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(query); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); while (rs.next()) { // create a list holding the values for a single row String[] columnValues = new String[2]; columnValues[0] = s.getString(1); java.sql.Date date = rs.getDate(2); columnValues[1] = sdf.format(date); rows.add(columnValues); } rs.close(); stmt.close(); Of course you will need to add error handling to the above. You could also use an Object[] instead of String[] as the elements of the "row list". An Object[] has the advantage that you can leave the formatting of the Date instances to the renderer of your JTable, which gives you a bit more flexibility. Using the "nested List" you can then create a TableModel that can be used for the JTable. The most important part is the getValueAt() method. A very basic implementation could look like this: public class MyModel extends AbstractTableModel { private List&lt;String[]&gt; data = null; public MyModel(List&lt;String[]&gt; data) { this.data = data; } public Object getValueAt(int row, int column) { List&lt;String&gt; columnValues = data.get(row); return columnValues[column]; } ... implement other methods from the TableModel } Again this is without error checking or handling, just a basic example.
has comment: http://stackoverflow.com/comment/36137193

extjs
tags question: http://stackoverflow.com/q/23517326
tags question: http://stackoverflow.com/q/23589253
type: Tag
tag name: extjs

http://stackoverflow.com/q/23470377
answer count: 2
tagged with: php
score: -1
possible better answer: http://stackoverflow.com/a/23470614
has title: how get post variable in php?
accepted answer: http://stackoverflow.com/a/23474105
has comment: http://stackoverflow.com/comment/35983565
tagged with: java
has body: i am writing a java code that http post with a parameter.that parameter is a long variable that convert to string. ArrayList&lt;NameValuePair&gt; parameters =new ArrayList&lt;NameValuePair&gt;(); parameters.add(new BasicNameValuePair("MAX_ID", String.valueOf(maxNewsId))); String result = CustomHttpClient.executeHttpPost(NewsUrl,parameters); and i want write a php code at the server. that code should get that long number and connect to Data base and select rows that have id greater than that parameter. i write this code but not working. what should i do? &lt;?php $db_host = "localhost"; $db_uid = "**********"; $db_pass = "**********"; $db_name = "**********"; $db_con = mysql_connect($db_host,$db_uid,$db_pass,$db_name) or die('could not connect'); mysql_select_db($db_name); $maxId = $_POST['MAX_ID']; mysql_query("set names utf8"); $sql = "SELECT * FROM News where Nid&gt; ".mysql_real_escape_string($maxId); $result = mysql_query($sql); while($row=mysql_fetch_assoc($result)) { $output[]=$row; } print(json_encode($output)); mysql_close(); ?&gt;
has comment: http://stackoverflow.com/comment/35983453
downvote count: 1
upvote count: 0
tagged with: http-post
has answer: http://stackoverflow.com/a/23474105
type: AnsweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/23470614
type: Question

http://stackoverflow.com/a/23538840
answers question: http://stackoverflow.com/q/23538620
type: Answer
has body: Most of the plugins work in Java EE 7. To deploy it you can use an Ant File and can use any server (Tomcat, Glassfish, Jboss...). Maybe, Git plugin will be useful to save your code in the cloud.
score: 0

http://stackoverflow.com/q/23493178
tagged with: java
has comment: http://stackoverflow.com/comment/36026332
upvote count: 1
downvote count: 1
type: Question
has body: I have this code public class Operator { public static void main(String[] args) { //This part of the code is about my weight on earth. System.out.print("My weight on earth is "); double mWOE = 66.2; //mWOE = myWheightOnEarth System.out.println(mWOE); //This part of the code is about my weight on jupiter. System.out.print("My weight on jupiter is "); double mWOJ = mWOE * 2.54; //mWOJ = myWheightOnJupiter System.out.println(mWOJ); //This part of the code is about my wheight on saturn System.out.print("My weight on saturn is "); double mWOS = mWOE * 1.08; //mWOS = myWheightOnSaturn System.out.println(mWOS); } } I want to make my program get the weight and give weight on Saturn and Jupiter. What should i do to the code? P.S: It's in java.
score: 0
has title: Calculating weight on Saturn and Jupiter
accepted answer: http://stackoverflow.com/a/23493243
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36025430
has answer: http://stackoverflow.com/a/23493243
type: AnsweredQuestion

http://stackoverflow.com/a/23527445
type: Answer
downvote count: 0
score: 1
has body: Your LogCat logs that you it can't find a view who's id is container (it's the default id of the activity_main.xml file) for a PlaceHolderFragment. If your code is in your MainActivity, and not in the PlaceHolderFragment, then you can try this: If you have this in your onCreate() method of your MainActivity, delete it: if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } If you don't need the PlaceHolderFragment, you can delete this part of your code as well: public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } }
answers question: http://stackoverflow.com/q/23526734
has comment: http://stackoverflow.com/comment/36099235
upvote count: 1

http://stackoverflow.com/comment/36214906
type: QuestionComment
has text: @HovercraftFullOfEels I'm creating a application where the GUI will be updated, and invokeLater should run the main-thread asynchronously on the AWT event dispatching thread, but since I'm trying to access the JFrame directly after, it will throw an exception because it hasn't been initialized yet.
comment on: http://stackoverflow.com/q/23594081
score: 0
type: Comment

http://stackoverflow.com/q/23573423
tagged with: file
type: Question
score: -2
has title: Playing random audio onClick doesn't reset when a new random audio file is created - Android
downvote count: 2
tagged with: random
answer count: 1
favorite count: 0
has body: Bit of an android programming noob here. Just trying to get my audio to stop playing and play the new random audio each time my imageButton is clicked. If you could help pinpoint my problem that would be great. package com.shamu11.musesoundboard; import java.util.Random; //import com.shamu11.firstapp.MainActivity; //import com.shamu11.firstapp.R; import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ImageButton; public class MainActivity extends Activity { ImageButton buttonOne; private final int NUM_SOUND_FILES = 3; private int mSndFilesMatt[] = new int[NUM_SOUND_FILES]; private Random rnd = new Random(); MediaPlayer matt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSndFilesMatt[0] = R.raw.fury; mSndFilesMatt[1] = R.raw.knights_of_cydonia; mSndFilesMatt[2] = R.raw.supremacy; buttonOne = (ImageButton) findViewById(R.id.imageButton1); buttonOne.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub int sndToPlay = rnd.nextInt(NUM_SOUND_FILES); matt = MediaPlayer.create(MainActivity.this, mSndFilesMatt[sndToPlay]); matt.seekTo(0); matt.start(); } }); } }
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23573691
tagged with: audio
upvote count: 0
tagged with: java

http://stackoverflow.com/q/23608326
accepted answer: http://stackoverflow.com/a/23813714
tagged with: google-oauth
has title: Migrating from OAuth2.1 to OAuth2.0
answer count: 1
downvote count: 0
has body: I have a GWT web application. I have big table with Google tokens and token secrets. I want to move to OAuth2.0 without reauthenticating the users. I have tried the following in Java tests String url = "https://accounts.google.com/o/oauth2/token"; HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(url); String generatedString = Utils.generateRandomString(10); String key = new Date().getTime() + ""; // add header post.setHeader("Host", "accounts.google.com"); post.setHeader("Content-Type", "application/x-www-form-urlencoded"); post.setHeader("Authorization", "OAuth " + "oauth_consumer_key=\"" + CONSUMER_KEY + "\"," + "oauth_token=\"" + token + "\"," + "oauth_signature_method=\"HMAC-SHA1\"" + "timestamp=\"" + key + "\"," + "oauth_nonce=\"" + generatedString + "\"," + "oauth_signature=\"" + calculateRFC2104HMAC(key, generatedString) + "\"," + "oauth_signature_method=\"HMAC-SHA1\""); List&lt;NameValuePair&gt; urlParameters = new ArrayList&lt;NameValuePair&gt;(); urlParameters.add(new BasicNameValuePair("grant_type", "urn:ietf:params:oauth:grant-type:migration:oauth1")); urlParameters.add(new BasicNameValuePair("client_id", CONSUMER_KEY)); urlParameters.add(new BasicNameValuePair("client_secret", CONSUMER_SECRET)); urlParameters.add(new BasicNameValuePair("oauth_consumer_key", CONSUMER_KEY)); urlParameters.add(new BasicNameValuePair("oauth_consumer_secret", CONSUMER_SECRET)); urlParameters.add(new BasicNameValuePair("oauth_signature_method", "HMAC-SHA1")); urlParameters.add(new BasicNameValuePair("oauth_timestamp", "" + new Date().getTime())); urlParameters.add(new BasicNameValuePair("oauth_token", token)); urlParameters.add(new BasicNameValuePair("oauth_token_secret", token)); post.setEntity(new UrlEncodedFormEntity(urlParameters)); HttpResponse response = client.execute(post); System.out.println("Sending 'POST' request to URL : " + url); System.out.println("Post parameters : " + post.getEntity()); System.out.println("Response Code : " + response.…
favorite count: 0
tagged with: oauth
has answer: http://stackoverflow.com/a/23813714
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22913146
score: 1
tagged with: java
tagged with: oauth-2.0
upvote count: 1
type: Question
tagged with: gwt

http://stackoverflow.com/q/23493167
tagged with: delegates
answer count: 1
downvote count: 0
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/36025925
tagged with: android
has comment: http://stackoverflow.com/comment/36026652
favorite count: 0
tagged with: android-asynctask
has title: How to return images from asynctask on Android
has body: I am writing an application where I am building a list view in which each item has an image. The content of the list view is generated by an XML file that is stored locally, the pictures are fetched from Amazon AWS S3. I want to write a class AWSImageFetcher that will be responsible for the authentication first (by using another dedicated class) and then for fetching the images. I understood that it is best practice on Android to subclass AsyncTask in cases like this to perform the network requests. I am now wondering how I should return the images from the AWSImageFetcher class to the list view. I am coming from iOS where I would just write a delegate for the AWSImageFetcher which would be invoked after the images have been fetched, but this doesn't feel right on Android. Should I use a listener class instead? How would you solve a situation like this on Android in an elegant way?
upvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23493628
accepted answer: http://stackoverflow.com/a/23493628
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36025475

http://stackoverflow.com/comment/36083913
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23523820
has text: @Kayaman Maybe this. is useless here. I have updated with my first try of printing out. Is there anything I have missed in any of the methods that doesn't connect between pNr and accountId?

http://stackoverflow.com/comment/36198343
type: QuestionComment
has text: I tried using request.getAttribute("test") to print and it gives me null. :(
comment on: http://stackoverflow.com/q/23576929
score: 0
type: Comment

http://stackoverflow.com/comment/36232358
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23602309
type: Comment
has text: pattrn is the arraylist of arraylist values.first is an List<String> I am using all the variable here is arraylist or String no integer is used.

http://stackoverflow.com/q/23487558
tagged with: android
has comment: http://stackoverflow.com/comment/36023776
has comment: http://stackoverflow.com/comment/36023579
has comment: http://stackoverflow.com/comment/36021801
has answer: http://stackoverflow.com/a/23503379
tagged with: sockets
has title: Server receiving packets after timeout TCP/IP
has comment: http://stackoverflow.com/comment/36023078
has comment: http://stackoverflow.com/comment/36023368
has comment: http://stackoverflow.com/comment/36019602
has comment: http://stackoverflow.com/comment/36032858
type: AnsweredQuestion
tagged with: tcp
tagged with: java
has body: I am writing simple Server through TCP/IP for my android app. I am facing a problem where server only receives messages after the timeout on the app. My server side: System.out.println("Connection accepted"); DataOutputStream outToClient = new DataOutputStream(connectionSocket.getOutputStream()); capitalizedSentence = "READY"; writeToUser(outToClient, "READY".getBytes()); String response = readFromUser(connectionSocket); // Server hangs on readFromUser(); if(response.contains("IL")) { byte[] bytes = DatatypeConverter.parseHexBinary(foo); writeToUser(outToClient, bytes); } App side: if (ack.equals("READY")) { ack = ""; dataOutputStream.writeBytes(command); dataOutputStream.flush(); buf = new byte[556]; dataInputStream.read(buf); // app hangs on read() and gets timeout } The problem is that, server receives command only after application gets read timeout. My current scenario is this: Connection accepted: Application receives "READY" Application sends commands and tries to read response from server Server is hanging on readFromUser() and only receives message after the app gets read timeout. Any ideas what am I doing wrong ? Update: The code works if I use readLine, instead of read(buf) ( if I understand clearly server hangs on read(buf) and is in waiting mode as socket is not closed yet even though no more data is beeing sent. ) However such way I have to add "\n" after each command, and server is only emulator, app works with different device who does not understand "\n" at the end and will crash. Is there any way I could make this work without using readLine() ? Update 2 public void writeToUser(DataOutputStream outToClient, byte[] bytes) throws IOException { outToClient.write(bytes); outToClient.flush(); String s = new String(bytes); writeLog("Sent to client: " + s); } public String readFromUser(Socket socket) throws IOException, InterruptedException { writeLog("Reading..."); BufferedReader inFromClient = new BufferedReader(new InputStreamReader(socket.getInputStre…
has comment: http://stackoverflow.com/comment/36021420
accepted answer: http://stackoverflow.com/a/23503379
type: Question
has comment: http://stackoverflow.com/comment/36022271
possible better answer: http://stackoverflow.com/a/23506485
has comment: http://stackoverflow.com/comment/36023715
has comment: http://stackoverflow.com/comment/36023989
has answer: http://stackoverflow.com/a/23506485
has comment: http://stackoverflow.com/comment/36045604
has comment: http://stackoverflow.com/comment/36045935
has comment: http://stackoverflow.com/comment/36023664
score: 0
has answer: http://stackoverflow.com/a/23487718
answer count: 3
has comment: http://stackoverflow.com/comment/36018020

http://stackoverflow.com/comment/35954088
has text: @EJP: As a valuable member of the SO community, you can dig up the relevant lambda-dev mails to give an equally authoritative answer. This has happened on SO before. Note that Brian Goetz didn't request a public *discussion*. He requested a public *Q&A*. The discussion and rationale has long been given, but is hidden in the mailing lists which are not well referenced in Google searches. Having an authoritative answer here on SO would in fact further increase the quality of an already very useful platform.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23453287
score: 1

http://stackoverflow.com/comment/35977453
type: QuestionComment
comment on: http://stackoverflow.com/q/23466744
score: 0
has text: @AkashG, Since your question is about Sockets, it would make sense to post enough code to show a full client and server. As it is, nobody else can run your code because you have not even included the Socket creation code.
type: Comment

http://stackoverflow.com/comment/35974766
type: Comment
score: 0
has text: @ManyToOne(targetEntity=Employee.class,fetch = FetchType.LAZY) @JoinColumn(name = "employee_id", referencedColumnName="employee_id",nullable=false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public Employee getEmployee() { return employee; }
type: AnswerComment
comment on: http://stackoverflow.com/a/23465342

http://stackoverflow.com/q/23464424
downvote count: 0
favorite count: 0
tagged with: osgi
type: UnansweredQuestion
upvote count: 1
tagged with: jakarta-ee
has body: OSGi client tries to connect to GF4. In maven I added gf-client-module 4. I see that bundle glassfish-naming-4.0.jar is installed. So in Activator I have. ClassLoader thatLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); try { Properties jndiProps = new Properties(); jndiProps.put("java.naming.factory.initial", "com.sun.enterprise.naming.impl.SerialInitContextFactory"); jndiProps.put("java.naming.factory.url.pkgs", "com.sun.enterprise.naming"); jndiProps.put("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl"); jndiProps.setProperty("org.omg.CORBA.ORBInitialHost", "x.x.x.x"); jndiProps.setProperty("org.omg.CORBA.ORBInitialPort", "3700"); InitialContext ctx = new InitialContext(jndiProps); } finally { Thread.currentThread().setContextClassLoader(thatLoader); } And this is what I get javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.enterprise.naming.SerialInitContextFactory [Root exception is java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory] How can it be fixed? Bundle glassfish-naming-4.0.jar has Activator inside. Should I start this bundle? I tried but got unresolved constraints exception. Solution SerialInitContextFactory not found in glassfish naming didn't help.
score: 1
has answer: http://stackoverflow.com/a/23479486
tagged with: java
has title: OSGi and ClassNotFoundException for InitialContext
has answer: http://stackoverflow.com/a/23465338
tagged with: glassfish
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/7804357
tagged with: ejb

http://stackoverflow.com/a/23577010
answers question: http://stackoverflow.com/q/23576987
has body: You're not passing anything in. You're explicitly telling the framework that, when this particular call is invoked, then return something. ChefService chefServiceMock = mock(ChefService.class); // some reasonable, expected entry value List&lt;CookbookVersion&gt; cookbookVersions = ...; when(chefServiceMock.listCookbookVersions()).thenReturn(cookbookVersions); // You're not actually using the API object, so you can pass in null. // It'd be wiser to remove it altogether. String actual = testObject.getAllCookBooks(chefServiceMock, null); When you're done, you'll want to ensure that it was called, so you would want to verify the call. // later verify(chefServiceMock).listCookbookVersions(); Then, make sure that you verify the actual result. I've seen tests which only validate that the mocks work, but the data that was actually being generated was garbage. Be sure that it's data you also expect to receive from your list of inputs from the API.
has comment: http://stackoverflow.com/comment/36185352
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23576987

http://stackoverflow.com/a/31986898
upvote count: 2
has body: Another approach that doesn't rely on importing Liquibase's classes directly is to run the db migrate command in the same way that you might from the command line, using the RULE: @Before public void migrateDatabase() throws Exception { RULE.getApplication().run("db", "migrate", ResourceHelpers.resourceFilePath("testconfiguration.yml")); } This approach also works for any other commands from any other bundles that you might want to run before starting the tests. A small winkle: Doing this with any commands that extend Dropwizards ConfiguredCommand (which all of the dropwizard-migrations do) will unnecessarily disable logback when the command finishes. To restore it, you can call: RULE.getConfiguration().getLoggingFactory().configure(RULE.getEnvironment().metrics(), RULE.getApplication().getName());
answers question: http://stackoverflow.com/q/23579607
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/23576929
has body: Due to some reasons (existing design of application), i need to call a controller method in a jsp using jsp include. I need to access the set attributes in controller in parent jsp. Below is my controller: @Controller @SessionAttributes({"profile"}) @RequestMapping("/manageMyAccount") public class MyPageDataController { @RequestMapping(value="/",method=RequestMethod.GET) public void initData(HttpServletRequest request, Model model, HttpSession session) { Profile profile = (Profile) session.getAttribute("profile"); model.addAttribute("test", "success"); model.addAttribute("profile", profile); } } JSP Code: jsp:include page="/mvc/manageMyAccount/"/&gt; I am trying to get data in jsp after above statement in jsp as ${test}, but am getting blank.
has title: call controller method from jsp and get model attributes in jsp
has comment: http://stackoverflow.com/comment/36192993
type: Question
has comment: http://stackoverflow.com/comment/36183518
tagged with: jsp
has answer: http://stackoverflow.com/a/23579404
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36198343
favorite count: 0
has comment: http://stackoverflow.com/comment/36201534
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36195850
has comment: http://stackoverflow.com/comment/36193537
has comment: http://stackoverflow.com/comment/36205848
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36214599
has comment: http://stackoverflow.com/comment/36198086
has comment: http://stackoverflow.com/comment/36192717
has comment: http://stackoverflow.com/comment/36195863
tagged with: java
has comment: http://stackoverflow.com/comment/36198662

http://stackoverflow.com/comment/36223181
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23598479
has text: http://stackoverflow.com/questions/683041/java-how-do-i-use-a-priorityqueue

http://stackoverflow.com/comment/35972659
score: 0
type: Comment
has text: What is `decreaseKey()` supposed to do?
comment on: http://stackoverflow.com/a/23463977
type: AnswerComment

http://stackoverflow.com/comment/36053397
has text: @SWPhantom yes, a percentage would be nice. Could you please show me how to implement this in my code and post as an answer?
score: 0
comment on: http://stackoverflow.com/q/23507451
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23571285
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/36172136
has comment: http://stackoverflow.com/comment/36172141
has title: How to use the information of a parsed xml file (java)?
tagged with: java
score: -1
type: Question
answer count: 1
favorite count: 0
tagged with: jaxp
has body: I have parsed a XML file using a DOM parser in Java but I require tips on how to actually use this information. I have to create a method that takes the information parsed and sends out commands, based on certain information extracted from the file, to a software that I use at work, by using a socket. The software I use maps communications. For example: since Federate Jurassic and Federate WWS communicate, one of the string commands would be used to map it. I need assistance in beginning to write this method. Thanks. This is my Java code so far: public class Parse { public static void main(String args[]) throws IOException, InterruptedException { Socket s = null; try { s = new Socket("localhost", 8008); System.out.println(s.isConnected()); File Configuration = new File("Configuration.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(Configuration); doc.getDocumentElement().normalize(); System.out.println("root of xml file " + doc.getDocumentElement().getNodeName()); NodeList nodes = doc.getElementsByTagName("Federate"); NodeList n = doc.getElementsByTagName("Interface"); System.out.println("Federate names:"); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); System.out.println(node.getAttributes().getNamedItem("name")); } System.out.println(""); System.out.println("Interface names:"); for (int i = 0; i < n.getLength(); i++) { Node a = n.item(i); System.out.println(a.getAttributes().getNamedItem("name")); System.out.println(a.getAttributes().getNamedItem("publish")); System.out.println(a.getAttributes().getNamedItem("subscribe")); System.out.println(""); } } catch (Exception ex) { ex.printStackTrace(); } String command1 = "{\"Command\":\"AddVertex\",\"Params\":{\"Attr\":{\"UniqueID\":\"Fed1\"},\"Show\":\"True\"}}"; String command2 = "{\"Command\":\"AddVertex\",\"Params\":{\"Attr\":{\"UniqueID\":\"Fed2\"},\"Show\":\"True\"}}"; S…
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23571497

http://stackoverflow.com/a/41264579
score: 3
type: Answer
answers question: http://stackoverflow.com/q/23462940
upvote count: 3
has body: Cut the folder .idea and the files *.iml in the root folder and paste somewhere else out of project. when you re-open the project , auto import will work again magically.
downvote count: 0

http://stackoverflow.com/q/23491667
tagged with: thread-dump
tagged with: performance
has comment: http://stackoverflow.com/comment/36026932
has comment: http://stackoverflow.com/comment/36024823
tagged with: java
has comment: http://stackoverflow.com/comment/36026127
linked to: http://stackoverflow.com/q/7203893
has comment: http://stackoverflow.com/comment/36026425
type: Question
has title: Java thread dump, can't find thread that blocking others
has answer: http://stackoverflow.com/a/23634811
accepted answer: http://stackoverflow.com/a/23634811
has comment: http://stackoverflow.com/comment/36026016
tagged with: jstack
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36025790
has comment: http://stackoverflow.com/comment/36023202
tagged with: multithreading
has body: Our application is lagging. I'm get thread dump using jstack util. I do a data preparation and sort it. And this is what I have: 198 java.lang.Thread.State: BLOCKED (on object monitor) 198 - waiting to lock &lt;0x0000000582e56bc8&gt; (a java.lang.Class for com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector) 198 threads are BLOCKED. As I understand from waiting to lock &lt;0x0000000582e56bc8&gt;, they all waiting some thread with ID 0x0000000582e56bc8. The strange thing is that I cannot find this 0x0000000582e56bc8 in thread dump output, I cannot find what they all waiting for. Or it is not true? What is this 0x0000000582e56bc8? Here is little peace of dump: "http-thread-pool-8080(790)" daemon prio=3 tid=0x00000001100fa000 nid=0x339a waiting for monitor entry [0xfffffffeec1f6000] java.lang.Thread.State: BLOCKED (on object monitor) at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:82) - waiting to lock &lt;0x0000000582e56bc8&gt; (a java.lang.Class for com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector) All 198 other thread dumps are the same Update 1. After @Holder comment "http-thread-pool-8080(642)" daemon prio=3 tid=0x0000000110a8c800 nid=0x32ec runnable [0xffffffff05af5000] java.lang.Thread.State: RUNNABLE at java.util.zip.Inflater.inflateBytes(Native Method) at java.util.zip.Inflater.inflate(Inflater.java:256) - locked &lt;0x000000058f2af0c0&gt; (a java.util.zip.ZStreamRef) at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:152) at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:122) at org.apache.felix.framework.util.WeakZipFileFactory$WeakZipFile$WeakZipInputStream.read(WeakZipFileFactory.java:669) at java.io.DataInputStream.readShort(DataInputStream.java:312) at com.sun.xml.bind.v2.bytecode.ClassTailor.tailor(ClassTailor.java:173) at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.tailor(AccessorInjector.java:126) at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInje…
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/36029385
comment on: http://stackoverflow.com/a/23494770
has text: Can you explain your answer? (Flagged as low quality by SO)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23551268
has comment: http://stackoverflow.com/comment/36137297
type: Question
has comment: http://stackoverflow.com/comment/36135261
has comment: http://stackoverflow.com/comment/36136981
score: 0
tagged with: rest
type: UnansweredQuestion
has body: Good afternoon, I have a doubt, will be days I'm trying to get a result but without success. I wish someone would give me a light, I'm able to make the request to synchronize a group of users that is the case (3) to the authentication server which returns me status = 200, which is something that tells me that is working, but in response the return that comes to me is void, and should return users in this way for example: Ex: {"tpUsuario":"admin","messages":["msg 1","msg 2","msg 3"],"name":"usuario"} Here is the method that I did: @XmlElement public void sincronizarUsuarios() { Autenticacao groupThree = new Autenticacao(); groupThree.setIdGroup(3); // The Config.REST_SERVICE_SYNC is my webService; Response response = restFactory.getInvocationBuilder(Config.REST_SERVICE_SYNC).post(Entity.json(groupThree)); // Returns the status of my post and is returning me 200, // This means that making requizição ie is working System.out.println(response.getStatus()); // This should return me the Users in String format but // Return null; System.out.println(response.readEntity(String.class)); } PS: Grammar by Google translator, in Brazil could not help.
has title: Synchronize users between applications oauth
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36135372
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/23533541
favorite count: 0
accepted answer: http://stackoverflow.com/a/23536190
upvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
has body: Here I come up with problem with Operation like update,delete and view so now insert is working but other operation like update, delete, view showing error like. Could some one can guide to go right direction? This what I have tried up to now Error: HTTP Status 500 - java.lang.NullPointerException type Exception report message java.lang.NullPointerException description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: java.lang.NullPointerException org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419) root cause java.lang.NullPointerException Action.Testiue.view(Testiue.java:115) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404) com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationIntercepto…
answer count: 2
tagged with: jsp
has answer: http://stackoverflow.com/a/23536190
tagged with: struts2
tagged with: servlets
possible better answer: http://stackoverflow.com/a/23533617
has title: insert update delete in Struts 2 but showing NullPointerException
has answer: http://stackoverflow.com/a/23533617
tagged with: jdbc
downvote count: 0
score: 1

http://stackoverflow.com/q/23481131
favorite count: 0
has comment: http://stackoverflow.com/comment/36004062
type: UnansweredQuestion
has title: Java JDBC: Altering table
tagged with: jdbc
has comment: http://stackoverflow.com/comment/36004098
has answer: http://stackoverflow.com/a/23481267
tagged with: ddl
tagged with: java
tagged with: mysql
type: Question
score: 5
has comment: http://stackoverflow.com/comment/36004273
upvote count: 5
has body: I wish to make the following alterations to this table: Add: Column for state (varchar(20)) column for date (timestamp) I am unsure how to do so String createTable = "Create table aircraft (" +"aircraftNumber int," +"airLineCompany varchar(20)," +"departureAirport varchar (20)," +"fuelPercentage int," +"passengerCount int);";
has comment: http://stackoverflow.com/comment/36004031
has answer: http://stackoverflow.com/a/23481321
answer count: 3
tagged with: sql
downvote count: 0
has answer: http://stackoverflow.com/a/57201556

http://stackoverflow.com/comment/36373232
type: QuestionComment
has text: The latest one: 1.3.1
comment on: http://stackoverflow.com/q/23516631
score: 0
type: Comment

http://stackoverflow.com/comment/36021744
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23490941
type: QuestionComment
has text: I chose not to make the namespaces etc more compact because, who knows, the mistake may be in there..

http://stackoverflow.com/comment/36159922
score: 0
type: Comment
has text: I'm aware of what the exception means; I'm telling the OP why it happened.
comment on: http://stackoverflow.com/a/23564008
type: AnswerComment

http://stackoverflow.com/q/23575568
tagged with: custom-view
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: In my current project I run into an dead end. My custom view, only created to show a specific color, won't show in the view of my emulator (although it seems to show up correctly in the editor of Eclipse) except if it had a minimum height, but then it only get this exact height. I want it to match_parent. The problem might be that it is in the item layout of a list view. That's the code of my Custom View: import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Style; import android.util.AttributeSet; import android.util.Log; import android.view.View; import android.widget.TextView; public class ColorView extends View { private int mColor; private Context mContext; private int width; private int height; public ColorView(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ColorView, 0, 0); try { mColor = a.getColor(R.styleable.ColorView_color, 0xFFFFFF); } finally { a.recycle(); } } public void setColor(int hexColor) { mColor = hexColor; invalidate(); } public void setColorFromResource(int resID) { mColor = mContext.getResources().getColor(resID); invalidate(); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); Log.d("DEBUG", Integer.toString(w) + " " + Integer.toString(h)); width = w; height = h; } @Override public void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawColor(mColor); Log.d("DEBUG", "drawn"); } } And a simplified version of my layout file: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:raabeapp="http://schemas.android.com/apk/res/com.example.myapp" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/row_view" android:layout_width="match_parent" android:la…
tagged with: android-custom-view
type: Question
has title: Custom View not showing: no height, but still width
tagged with: android-layout
has answer: http://stackoverflow.com/a/23575589
answer count: 2
possible better answer: http://stackoverflow.com/a/23575589
upvote count: 1
has answer: http://stackoverflow.com/a/23632979
accepted answer: http://stackoverflow.com/a/23632979
favorite count: 0
tagged with: android

http://stackoverflow.com/a/23544859
type: Answer
has comment: http://stackoverflow.com/comment/36122683
has body: Whenever you call new in JAVA it create an object in heap and obviously it will call the constructor also. String literals will go to String Constant Pool. It might help you to understand it visually.
downvote count: 0
has comment: http://stackoverflow.com/comment/36123383
has comment: http://stackoverflow.com/comment/36123272
has comment: http://stackoverflow.com/comment/36122672
has comment: http://stackoverflow.com/comment/36122991
score: 5
has comment: http://stackoverflow.com/comment/36123040
accepted answer of: http://stackoverflow.com/q/23544752
has comment: http://stackoverflow.com/comment/36123428
answers question: http://stackoverflow.com/q/23544752
has comment: http://stackoverflow.com/comment/36123353
type: AcceptedAnswer
upvote count: 5

http://stackoverflow.com/q/23562536
tagged with: xbmc
has body: Here is my code: import com.bmc.arsys.api.ARException; import com.bmc.arsys.api.ARServerUser; public class ARServer { public static void main(String[] args) { ARServerUser ar = new ARServerUser(); ar.setServer("ServerName"); ar.setUser("Username"); ar.setPassword("Password"); ar.connect(); ar.login(); try { ar.verifyUser(); } catch (ARException e) { System.out.println(e.getMessage()); } } } I have created build path for this jar file "ardoc7604_build002.jar" but still i am getting errors like: import com.bmc.arsys.api.ARException can not be resolved import com.bmc.arsys.api.ARServerUser; can not be resolved ARserver can not be resolved ARException can not be resolved to a type. Thanks in advance for help.
favorite count: 0
has answer: http://stackoverflow.com/a/24808760
tagged with: remedy
has title: Not able to connect to ARServer
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/23573876
type: Question
has answer: http://stackoverflow.com/a/23573876
accepted answer: http://stackoverflow.com/a/24808760
answer count: 2
has comment: http://stackoverflow.com/comment/36155595
has comment: http://stackoverflow.com/comment/36156473
downvote count: 0

keylistener
tags question: http://stackoverflow.com/q/23477051
type: Tag
tags question: http://stackoverflow.com/q/23486827
tags question: http://stackoverflow.com/q/23496046
tags question: http://stackoverflow.com/q/23548647
tags question: http://stackoverflow.com/q/23480130
tags question: http://stackoverflow.com/q/23553051
tags question: http://stackoverflow.com/q/23602787
tags question: http://stackoverflow.com/q/23599606
tag name: keylistener
tags question: http://stackoverflow.com/q/23489900

http://stackoverflow.com/comment/36110859
has text: ya correct and it will be also dynamic from database only @Biraj Zalavadia
type: Comment
comment on: http://stackoverflow.com/a/23537591
type: AnswerComment
score: 0

http://stackoverflow.com/q/23464539
tagged with: abstract-class
possible better answer: http://stackoverflow.com/a/23464572
downvote count: 0
has body: I've been looking at this problem for a while, and I can't figure out a solution to it. private abstract class Node { private Rectangle bounds; } private class LeafNode extends Node { private Rectangle bounds; .... } private class InternalNode extends Node{ private Rectangle bounds; .... } So I'm getting a null pointer error so I went through the debugger in eclipse. But what's confusing me is in eclipse, it's showing that there are two bounds fields, and I'm pretty sure I'm accessing the null one, instead of the one I actually set. When I'm in the debugger, sometimes I see the first bounds variable being used, and other times I see the second one being used. The only possible thing I could think of is that throughout the code, I do some casting with LeafNode and InternalNode. So could the two bounds variables be linked with the abstract class I'm using?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23464587
has answer: http://stackoverflow.com/a/23464572
score: 1
tagged with: java
has title: Duplicate variable in eclipse debugger
has comment: http://stackoverflow.com/comment/35973518
tagged with: eclipse
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23464587
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/23591093
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/36209014
favorite count: 0
has body: I have a method which tries to convert strings into long: public static Long getLong(String str) { long multiplier = 1; try { Long value = -1L; str = str.replaceAll("\\s", ""); // remove whitespace str = str.replaceAll("%", ""); str = str.replaceAll(",", ""); if (str.contains("M")) { str = str.replaceAll("M", ""); multiplier = 1000000; } else if (str.contains("B")) { str = str.replaceAll("B", ""); multiplier = 1000000000; } else if (str.contains("K")){ str = str.replaceAll("K", ""); multiplier = 1000; } // an exception is thrown for values like 199.00, so removing // decimals if any str = str.contains(".") ? str.substring(0, str.lastIndexOf(".")) : str; value = Long.valueOf(str); value = value * multiplier; return value; } catch (Exception e) { throw new RuntimeException(str + " cannot be parsed into long value"); } This method works fine values like "1K", "300M", "2B", "0" but not for the values like 3.14M or 1.1K. As mentioned in above comment Long.valueOf(str) throws exception if it has to take a input like 1.24 so I have to remove the digits after decimal (which I don't want to)
possible better answer: http://stackoverflow.com/a/23591129
has answer: http://stackoverflow.com/a/23591129
linked to: http://stackoverflow.com/q/18457854
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16968587
has answer: http://stackoverflow.com/a/23591127
has comment: http://stackoverflow.com/comment/36209767
has answer: http://stackoverflow.com/a/23591197
downvote count: 1
has comment: http://stackoverflow.com/comment/36209737
type: Question
has title: convert string line 3.14M into Long
linked to: http://stackoverflow.com/q/9381560
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/36209069
has comment: http://stackoverflow.com/comment/36209731
accepted answer: http://stackoverflow.com/a/23591127

http://stackoverflow.com/a/23569981
downvote count: 0
answers question: http://stackoverflow.com/q/23569950
has body: From SimpleDateFormat: Letter Date or Time Component &lt;br /&gt; y Year &lt;br /&gt; Y Week year H Hour in day (0-23) h Hour in am/pm (1-12) So, use yyyy for year and HH for hours in the day. Also, you're separating the fields by -, not by /: Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).parse(test); After doing this, as @JigarJoshi suspects, you can format your Date to look with another format: String dateInDesiredFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss a", Locale.ENGLISH).format(date); Or written as a complete block of code: DateFormat parse = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.ENGLISH); DateFormat format = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss a", Locale.ENGLISH); String test = "2014-04-01 05:00:00"; Date date = parse.parse(test); System.out.println(format.format(date)); Produces the following output: 2014/04/01 05:00:00 AM
has comment: http://stackoverflow.com/comment/36169562
score: 4
has comment: http://stackoverflow.com/comment/36169836
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/36169503
has comment: http://stackoverflow.com/comment/36169843
has comment: http://stackoverflow.com/comment/36169542
has comment: http://stackoverflow.com/comment/36169518
has comment: http://stackoverflow.com/comment/36169488
has comment: http://stackoverflow.com/comment/36169821
has comment: http://stackoverflow.com/comment/36169790

http://stackoverflow.com/a/23559622
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23520938
score: 0
type: Answer
has body: I solved this by changing List&lt;> to Set&lt;> on the ManyToMany and OneToMany relations
accepted answer of: http://stackoverflow.com/q/23520938

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/23498033
tags question: http://stackoverflow.com/q/23475559
tags question: http://stackoverflow.com/q/23533212
tag name: android-actionbar

http://stackoverflow.com/q/23582621
has comment: http://stackoverflow.com/comment/36195988
answer count: 1
tagged with: httpurlconnection
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/52224173
has comment: http://stackoverflow.com/comment/36196523
type: AnsweredQuestion
tagged with: ioexception
has answer: http://stackoverflow.com/a/32168731
has comment: http://stackoverflow.com/comment/36196109
tagged with: java
has body: I try to make my application communicate with my php server using HttpUrlConnection. I wrote a class that works fine on my computer but when I execute it on my phone it doesn't work at all. Here is my code : String data = "username=" + URLEncoder.encode(username, "UTF-8") + "&amp;password=" + URLEncoder.encode(password, "UTF-8") + "&amp;remember=1"; connection = (HttpURLConnection) new URL(BASE_URL + "user/login/app").openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Length", String.valueOf(data.length())); connection.setDoInput(true); connection.setDoOutput(true); DataOutputStream out = new DataOutputStream(connection.getOutputStream()); out.writeBytes(data); out.flush(); out.close(); The line DataOutputStream out = new DataOutputStream(connection.getOutputStream()); throws this exception : E/Cloud (10393): java.io.IOException E/Cloud (10393): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:85) E/Cloud (10393): at libcore.net.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:194) E/Cloud (10393): at com.andryr.runningpal.data.cloud.Cloud.login(Cloud.java:139) E/Cloud (10393): at com.andryr.runningpal.data.SessionList$2.onLogin(SessionList.java:177) E/Cloud (10393): at com.andryr.runningpal.ui.dialog.LoginDialogFragment$2.onClick(LoginDialogFragment.java:56) E/Cloud (10393): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:169) E/Cloud (10393): at android.os.Handler.dispatchMessage(Handler.java:99) E/Cloud (10393): at android.os.Looper.loop(Looper.java:154) E/Cloud (10393): at android.app.ActivityThread.main(ActivityThread.java:4624) E/Cloud (10393): at java.lang.reflect.Method.invokeNative(Native Method) E/Cloud (10393): at java.lang.reflect.Method.invoke(Method.java:511) E/Cloud (10393): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.ru…
type: Question
score: 5
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/36195652
accepted answer: http://stackoverflow.com/a/32168731
has title: HttpUrlConnection getOutputStream throws IOException

http://stackoverflow.com/q/23614731
favorite count: 0
has comment: http://stackoverflow.com/comment/36254756
has title: HTTP server in Java using HTTPServer Class
type: Question
has body: I have to create a HTTP web server (file based) in Java using the HttpServer and HttpHandler classes. I cannot find suitable samples and tutorials Also, I would like to know the basics I should know before coding up a server , eg. keep-alive, thread-pooling etc. Where can I find such tutorials?
has answer: http://stackoverflow.com/a/23615293
score: 0
tagged with: java
upvote count: 1
tagged with: httpserver
has comment: http://stackoverflow.com/comment/36255277
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36253537
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36254212

http://stackoverflow.com/q/23534087
has comment: http://stackoverflow.com/comment/36103180
answer count: 4
type: UnansweredQuestion
has title: To divide by 2 which one is better Right Shift Operator or traditional division operator?
has comment: http://stackoverflow.com/comment/36103098
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36103272
has body: While reading Java Source code for Collections.reverse method, Right Shift operator is used for finding middle. ...... for (int i=0, mid=size&gt;&gt;1, j=size-1; i&lt;mid; i++, j--) // Right Shift swap(list, i, j); ..... Same can be done by using traditional divide by 2 approach. I explored on stack Right Shift to perform division and find that its better to use division operator and not Right Shift. UPDATE : But then why java guys used Right Shift and not division ? So which approach is better to use and Why ?
tagged with: bitwise-operators
linked to: http://stackoverflow.com/q/2143840
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/36136626
has answer: http://stackoverflow.com/a/23534235
has answer: http://stackoverflow.com/a/23536148
has comment: http://stackoverflow.com/comment/36103188
downvote count: 1
duplicate of: http://stackoverflow.com/q/2143840
favorite count: 0
has answer: http://stackoverflow.com/a/23534149
has answer: http://stackoverflow.com/a/23534133
has comment: http://stackoverflow.com/comment/36103213

http://stackoverflow.com/q/23496486
score: -4
accepted answer: http://stackoverflow.com/a/23496539
has body: I have fields that contain a name in the following format: First Last (Middle Initial). Not all fields have the middle initial and the middle initial sometimes has a period, sometimes it doesn't. I need to put the middle initial before the last name. ex. John Smith f. needs to be John f. Smith Possible iterations of a name include: John Smith John Smith F John Smith F. John Smith f John Smith f.
favorite count: 0
has comment: http://stackoverflow.com/comment/36032104
tagged with: regex
has title: Moving a middle initial from the end of a name to the middle
type: Question
has answer: http://stackoverflow.com/a/23496539
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36031937
tagged with: java
downvote count: 4
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36032795

http://stackoverflow.com/comment/35989071
has text: position: 0 Unexpected token END OF FILE at position 0. Vector Length: 14759 Unexpected token END OF FILE at position 0. at org.json.simple.parser.JSONParser.parse(JSONParser.java:257) at org.json.simple.parser.JSONParser.parse(JSONParser.java:81) at org.json.simple.parser.JSONParser.parse(JSONParser.java:75) at WeatherClient.getHistory(WeatherClient.java:445) at WeatherClient.main(WeatherClient.java:150)
type: QuestionComment
comment on: http://stackoverflow.com/q/23472270
score: 0
type: Comment

http://stackoverflow.com/comment/36228776
score: 0
type: Comment
type: QuestionComment
has text: what sort of other operations are done with this 2D array? Is it more global operations that require a series of spread out array items, or looks at one / a range of array item at a time.
comment on: http://stackoverflow.com/q/23531704

http://stackoverflow.com/q/23524038
has body: I saw a lot of questions about "Bitmap Exceeds VM Budget" Error and how to prevent and used tons of preventing solutions and codes in my app, But steel I'm getting that error in some of devices. now I got tired and just want to know how can I find out when that problem occur (maybe with a "if" condition) so that I can tell user that it's from his cell phone and in this way just prevent "Force Close" error. this is my code: public static Bitmap decodeFile(String filePath) { BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; BitmapFactory.decodeFile(filePath, o); final int REQUIRED_SIZE = 2048; int width_tmp = o.outWidth, height_tmp = o.outHeight; int scale = 1; while (true) { if (width_tmp &lt; REQUIRED_SIZE &amp;&amp; height_tmp &lt; REQUIRED_SIZE) break; width_tmp /= 2; height_tmp /= 2; scale *= 2; } BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inSampleSize = scale; o2.inDither=false; o2.inPurgeable=true; o2.inInputShareable=true; o2.inTempStorage=new byte[32 * 1024]; Bitmap bmp = BitmapFactory.decodeFile(filePath, o2); return bmp; } any idea would be appreciated.
tagged with: bitmap
has answer: http://stackoverflow.com/a/23524399
type: Question
linked to: http://stackoverflow.com/q/8037821
tagged with: java
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36084889
type: UnansweredQuestion
tagged with: android
has title: how to find out when Bitmap exceeds VM Budget?

http://stackoverflow.com/q/23534908
type: Question
has answer: http://stackoverflow.com/a/23534985
has comment: http://stackoverflow.com/comment/36104474
tagged with: java
has comment: http://stackoverflow.com/comment/36104545
has title: next/back button to retrieve next/previous record in Android
accepted answer: http://stackoverflow.com/a/23534985
score: 0
tagged with: sqlite
answer count: 1
has body: Can you give me an idea on how I would be able to fetch next/previous data from database then show it on my textview? I have no idea with what to do. Main objective: Create a next/back button that will retrieve data from database then show it on textview. This is my MainActivity. public class MainActivity extends ActionBarActivity { private DatabaseHelper dbHelper = new DatabaseHelper(MainActivity.this,"MyDatabase2",2); TextView text; TextView num; TextView user; TextView password; EditText txt1; EditText txt2; EditText txt3; EditText txt4; EditText txt5; Button btnAdd; Button btnClose; Button btnUpdate; Button btnDelete; Button btnLess; Button btnGreat; Button btnLesser; Button btnGreater; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); text = (TextView) findViewById(R.id.textView1); num = (TextView) findViewById(R.id.textView2); user = (TextView) findViewById(R.id.textView3); password = (TextView) findViewById(R.id.textView4); txt1 = (EditText) findViewById(R.id.editText1); txt2 = (EditText) findViewById(R.id.editText2); txt3 = (EditText) findViewById(R.id.editText3); txt4 = (EditText) findViewById(R.id.editText4); txt5 = (EditText) findViewById(R.id.editText5); btnAdd = (Button) findViewById(R.id.button1); btnClose = (Button) findViewById(R.id.button2); btnUpdate = (Button) findViewById(R.id.button3); btnDelete = (Button) findViewById(R.id.button4); btnLess = (Button) findViewById(R.id.button5); btnGreat = (Button) findViewById(R.id.button6); btnLesser = (Button) findViewById(R.id.button7); btnGreater = (Button) findViewById(R.id.button8); SQLiteDatabase db = dbHelper.getWritableDatabase(); try { db.execSQL("create table User(ID integer, fname varchar(90), lname varchar(90),mname varchar(90),course varchar(90));"); text.setText("Successful in creating table."); } catch(Exception e) { text.setText("Error in creating table."); e.printStackTrace(); } btnAdd.setOnClickListener(…
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/q/23545394
tagged with: collections
has comment: http://stackoverflow.com/comment/36123660
has comment: http://stackoverflow.com/comment/36124416
type: Question
has comment: http://stackoverflow.com/comment/36123801
has comment: http://stackoverflow.com/comment/36123759
has comment: http://stackoverflow.com/comment/36123878
has body: I am getting an UnsupportedOperationException when calling add() in the following code: Collection&lt;MyClass&gt; myClass = method(); MyClass newObject = new MyClass(); myClass.add(newObject); method() returns Collection&lt;MyClass&gt;. Also, what should I do if method returns null or an empty Collection?
has comment: http://stackoverflow.com/comment/36124158
has answer: http://stackoverflow.com/a/23545539
has comment: http://stackoverflow.com/comment/36123975
has comment: http://stackoverflow.com/comment/36123923
has comment: http://stackoverflow.com/comment/36124283
has answer: http://stackoverflow.com/a/23545562
has comment: http://stackoverflow.com/comment/36123856
has answer: http://stackoverflow.com/a/23545585
answer count: 3
possible better answer: http://stackoverflow.com/a/23545539
downvote count: 0
has comment: http://stackoverflow.com/comment/36123702
score: 1
favorite count: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/36124235
accepted answer: http://stackoverflow.com/a/23545585
has comment: http://stackoverflow.com/comment/36124322
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36123633
has title: Collection throws UnsupportedOperationException
upvote count: 1

http://stackoverflow.com/comment/36136389
comment on: http://stackoverflow.com/q/23551683
score: 0
has text: [http://stackoverflow.com/questions/17540031/junk-characters-while-reading-text-file-in-java][1] [1]: http://stackoverflow.com/questions/17540031/junk-characters-while-reading-text-file-in-java This may help
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23556304
has answer: http://stackoverflow.com/a/23556342
type: Question
tagged with: java
has body: I am trying to display the data in vector in jlist. The below method connect()executes fine, without any error when it is called, but the vector data is not displayed in jlist. My code is: public void connect(String user, String pass) { vdate = new Vector(); vsubject = new Vector(); vfrom = new Vector(); vmessage = new Vector(); final String password = pass; final String username = user; try { props = new Properties(); props.setProperty("mail.host", "imap.gmail.com"); props.setProperty("mail.port", "995"); props.setProperty("mail.transport.protocol", "imaps"); session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username,password); } }); store = session.getStore("imaps"); store.connect(); Folder inbox = store.getFolder("INBOX"); inbox.open(Folder.READ_ONLY); Message messages[] = inbox.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false)); for (int i = 0; i &lt; messages.length; i++) { Message message = messages[i]; Address[] from = message.getFrom(); frm = from[0].toString(); vfrom.addElement(frm); date = message.getSentDate().toString(); vdate.addElement(date); Multipart mp = (Multipart)message.getContent(); BodyPart bp = mp.getBodyPart(0); mess = ""+bp.getContent(); subject = message.getSubject().toString(); vsubject.addElement(subject); } jList1.setListData(vdate); jList2.setListData(vsubject); jList3.setListData(vfrom); } catch (Exception mex) { mex.printStackTrace(); } } The for loop executes fine. Also the data gets stored in vector but when I set it to jlist nothing shows up........plz help
has comment: http://stackoverflow.com/comment/36144624
answer count: 1
has title: vector data in jlist?
score: 0
has comment: http://stackoverflow.com/comment/36144906
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/q/23543595
linked to: http://stackoverflow.com/q/3757047
has comment: http://stackoverflow.com/comment/36120905
has answer: http://stackoverflow.com/a/23544176
answer count: 4
has answer: http://stackoverflow.com/a/23543692
type: UnansweredQuestion
has title: Java class method access
has body: Back into Java but i'm lost on some basic referencing If i have for example: how do i refer to method test2 or test3 from within method problem within class b? Any help would be greatly appreciated. public class zz{ a1=new a(); // i can do a1.b1.test(); public test2() { } } public class a{ b b1= new b() public test3() { } } public class b{ public test() { } public problem() { // but how do i refer to method test2 or test3 from here? something like zz.test2(); zz.a1.test3(); } }
tagged with: java
has answer: http://stackoverflow.com/a/23543700
type: Question
has answer: http://stackoverflow.com/a/23543698
tagged with: class
score: 0

http://stackoverflow.com/q/23591709
answer count: 1
has comment: http://stackoverflow.com/comment/36233084
type: UnansweredQuestion
tagged with: android
tagged with: java
has title: Andengine problems with music in the game
has answer: http://stackoverflow.com/a/29369701
tagged with: andengine
has body: I write some code in response when my player is hit by the monster in my game. when monster hit my player, it will shout. It is fine at begin but when the sound plays too much time or too frequently, the sound shut down and so as my background music. Can any one help me about this. Here is my code about the shout sound: public void createMusic() { try { MusicFactory.setAssetBasePath("mfx/"); wallmusic = MusicFactory.createMusicFromAsset(engine.getMusicManager(), activity, "speed.ogg"); wallmusic.setLooping(false); } catch (final IOException e) { Debug.e(e); } if (!wallmusic.isPlaying()){ wallmusic.seekTo(0); wallmusic.play(); } } and the log says: 05-11 18:32:22.844: E/MediaPlayer(29575): error (-19,0) 05-11 18:32:22.844: E/MediaPlayer(29575): Error (-19,0) 05-11 18:32:22.844: E/MediaPlayer(29575): pause called in state 0 05-11 18:32:22.844: E/MediaPlayer(29575): error (-38,0) 05-11 18:32:22.844: E/MediaPlayer(29575): Error (-38,0) How do I fix this problem?
type: Question
score: 0

http://stackoverflow.com/comment/36168794
comment on: http://stackoverflow.com/a/23568115
score: 1
type: AnswerComment
type: Comment
has text: Not the same thing. That settings controls what the batch inspection produces. I refer to what happens when you run the compilation, and an error is found which the inspection did not detect. In this case, double-clicking on the error message line in the compilation tool window places the cursor at the offending line. But if I have many source buffers open, it is not obvious in which one of them that line is, since the highlight is so subtle.

http://stackoverflow.com/a/36349886
answers question: http://stackoverflow.com/q/23538864
type: Answer
upvote count: 1
has body: As you are executing the command on remote host so, it will invoke the new Shell on the remote host. The PATH which you have set in the current host .bashrc file will not make any difference. Instead if you set the PATH for Java in remote host's .bashrc things should work else if you are running any script then mention the complete path for JAR like /usr/jdk64/jdk1.8.0_40/bin/jar -tf /tmp/jars/abc.jar while invoking the command on remote host. Two ways to do: export PATH=$PATH:/usr/jdk64/jdk1.8.0_40/bin ---> in remote host's .bashrc /usr/jdk64/jdk1.8.0_40/bin/jar -tf /tmp/jars/abc.jar --> invoke the jar command with complete path for JAR from remote host.
score: 1
downvote count: 0

indexof
tags question: http://stackoverflow.com/q/23586063
type: Tag
tag name: indexof

http://stackoverflow.com/a/26523338
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23529237
has body: I try to give an answer, but the answer will be speculative; the problem is in the code which performs the remove on the entity manager, i.e. in eventoFacade.remove(e). However, assume that you have created and stored an Entity of type EventoSession in the database, and then you try to invoke em.remove with an instance of the base type, then you get the exception which you mentioned. Let us assume, that the entity of type EventoSession has the primary key 1, and now we try to remove this entity. Evento es = new Evento(); es.setNumeroEvento("..."); es.setId(1); es = em.merge(es); // detached objects cannot be removed, therefore we merge es em.remove(es); The call to em.merge will then end in a javax.persistence.PersistenceException, caused by: Caused by: org.hibernate.WrongClassException: Object [id=null] was not of the specified subclass [entidades.Evento]: class of the given object did not match class of persistent copy and I assume that this could be the problem. To fix it, simply load the instance to be removed over the entity manager: em.remove(em.find(Evento.class, 1));
downvote count: 0

http://stackoverflow.com/comment/36244615
comment on: http://stackoverflow.com/a/23609324
score: 0
type: Comment
has text: Can you ELI5? Or give me an example using my sample code? Yes I'm using jersey.
type: AnswerComment

http://stackoverflow.com/comment/36235896
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23604846
has text: Sorry my first time here, would I have to add another question or just edit this one to add code?

http://stackoverflow.com/a/37898581
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23519827
has body: By default this feature i.e. Enable annotation based null analysis is DISABLE in eclipse. Please enable this. Go to Window=&gt;Preferences =&gt; Java=&gt; Compiler =&gt; Error/Warning. Enable the setting as shown in Once you have this setting enable, you will get Null type mismatch: required '@NonNull String' but the provided value is null compile time error.
has comment: http://stackoverflow.com/comment/135451912
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/36254465
comment on: http://stackoverflow.com/a/23575589
type: AnswerComment
has text: Good idea, but it didn't work. The problem is not that the row layout does not fit the row - I got components sometime higher than my view gets at maximum size -, but that the view has no hight at all, although it is supposed to.
score: 0
type: Comment

http://stackoverflow.com/comment/36541966
type: QuestionComment
comment on: http://stackoverflow.com/q/23542571
score: 0
has text: @MikkelLøkke I'm not testing the website. I just used the htmlunit class to write an automation program to log out from the website. The process of logging out from the specific website is just one part of my automation posting program. I wanted to avoid the error caused by incidental timeout and kept the program running down to the next step. That's why I added some conditional statement.
type: Comment

illegalstateexception
tags question: http://stackoverflow.com/q/23613247
tags question: http://stackoverflow.com/q/23464360
tag name: illegalstateexception
type: Tag

http://stackoverflow.com/comment/36221035
comment on: http://stackoverflow.com/a/23597288
type: AnswerComment
score: 0
type: Comment
has text: Easy to overlook those small things. You're welcome.

http://stackoverflow.com/comment/36226965
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23600478
has text: I guess it is missplace of `}` bracket in onCreate() method
score: 0

http://stackoverflow.com/comment/36233911
has text: Don't ask questions with numbers, just ask clear questions. This makes no sense.
comment on: http://stackoverflow.com/q/23604270
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23579660
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/36197340
answers question: http://stackoverflow.com/q/23570480
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23570480
has body: Even you get SMTP return code 250, it doesn't guarantee your email will arrive in final destination. That return code means that the relay server ACCEPTS your email-delivery request. After they accept the request, who knows what happen after that. Several possibilities: The remote server scan your email with AntiSpam daemon and (unfortunately) your email is mis-idenfified as spam. So they discard/drop it. The remote server just don't like your email. Maybe your IP Address blacklisted. So they silently discard it. The remote server is busy processing other jobs. So they delay your email delivery. The server happily to forward your email to final destination right now. Further info: Simple_Mail_Transfer_Protocol on Wikipedia
type: Answer
has comment: http://stackoverflow.com/comment/36193305
has comment: http://stackoverflow.com/comment/36189420

http://stackoverflow.com/q/23571861
tagged with: types
tagged with: covariance
tagged with: generics
has body: I have this abstract class Operand { public abstract &lt;T extends Operand&gt; Operand operation(Operator operator, T operand); } abstract class Numeric extends Operand { } class Integer extends Numeric @Override public &lt;Integer&gt; Operand operation(Operator operator, Integer operand) {//problem } } How can I solve this situation? I don't want to use generics in the class Operand (so I have Operand) because I need Operand to be a single type. Inside the Integer's method I need to call the constructor (new Integer(arg)), a solution could be to call that method in some other way. Solutions?
favorite count: 0
has answer: http://stackoverflow.com/a/23590814
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23590814
tagged with: java
upvote count: 1
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23572148
tagged with: inheritance
has answer: http://stackoverflow.com/a/23572148
has answer: http://stackoverflow.com/a/23590242
has title: JAVA: Type parameter hiding class type
score: 0
answer count: 3

http://stackoverflow.com/comment/36039181
type: Comment
comment on: http://stackoverflow.com/a/23500179
has text: Its not homework. I am not in school. I already have my bachelors in computer science.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23527646
has comment: http://stackoverflow.com/comment/36091082
has body: I am trying to convert this Oracle query into HSQL, but i have difficulties. select a.t_user_id, listagg(et.event_type_name,', ') within group (order by a.t_user_id ) from t_agency a inner join t_agency_event_type aet on a.t_user_id = aet.agency_id inner join t_event_type et on aet.t_event_type_id=et.id group by a.t_user_id; Can anybody help me? Thanks in advance! ADDED: My HSQL query is like this: Query queryEventTypes = em.createQuery("select agency, GROUP_CONCAT(et.eventTypeName SEPARATOR ', ') as eventTypeName " + "from TAgency agency join agency.tAgencyEventTypes eat " + "join eat.tEventType et " + "group by hiredAgency.tUserId, hiredAgency.address, hiredAgency.city, hiredAgency.information, " + "hiredAgency.website"); But it gives me the error: unexpected token: SEPARATOR near line 1, column 46 [select agency, GROUP_CONCAT(et.eventTypeName SEPARATOR ', ') as eventTypeName from bg.fmi.master.thesis.model.TAgency agency join agency.tAgencyEventTypes eat join eat.tEventType et group by hiredAgency.tUserId, hiredAgency.address, hiredAgency.city, hiredAgency.information, hiredAgency.website]
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36091677
type: Question
has comment: http://stackoverflow.com/comment/36092560
has title: How to convert this Oracle query into HSQL query
has answer: http://stackoverflow.com/a/23528034
score: 0
answer count: 1
tagged with: hsqldb
type: UnansweredQuestion

http://stackoverflow.com/comment/36243562
has text: Ignoring the rude tone, there are already multiple answers to this question, for instance http://stackoverflow.com/questions/13620555/case-sensitive-file-extension-and-existence-checking Moreover, if your filesystem driver is not case sensitive, as kelunik pointed, there is no point trying to check it (educational purposes).
score: 0
comment on: http://stackoverflow.com/q/23609530
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36315527
comment on: http://stackoverflow.com/a/23613202
score: 1
type: AnswerComment
has text: Still not quite right ;) A Vaadin session is just a wrapper around the HTTP Session. So, with a browser refresh you won't get a new Vaadin session either. It's only about whether or not a new UI instance is created by the servlet. See https://vaadin.com/api/7.1.15/com/vaadin/annotations/PreserveOnRefresh.html for reference. Without using this annotation a user will not be logged out after a refresh, unless this login information is stored in UI scope (see my blog post http://blog.oio.de/2013/02/22/vaadins-variable-scopes-vaadinsession-and-ui/ on UI and session scope in Vaadin).
type: Comment

http://stackoverflow.com/q/23583501
score: 0
has answer: http://stackoverflow.com/a/23583597
answer count: 1
type: UnansweredQuestion
tagged with: android
has body: I have a array of JSON objects being returned from a server (as follows), ["{\"schedule\":{\"type\":\"times\"},\"videos\":{\"abc\":\"def\"}}","{\"schedule\":{\"type\":\"tod_repeat\",\"start\":\"00:09:00\"},\"videos\":{\"mk_320059\":{\"url\":\"http://m.mtvkatsomo.fi/?progId=320059\",\"siteId\":\"mk\"}}}"] which seems to be valid json as per JSONLint (http://jsonlint.com/). However in android when I try to convert this to an object I get an exception, org.json.JSONException: Value {"schedule":{"type":"times"},"videos":{"abc":"def"}} at 0 of type java.lang.String cannot be converted to JSONObject The relevant code is, if (resp != null) { try { JSONArray lists = new JSONArray(resp); Log.d(CLASS_NAME, "STRING REP:"+lists.getJSONObject(0).toString()); // &lt;-- at this line } catch (JSONException e) { e.printStackTrace(); } } It seems like I am missing something here as I cant seem to figure out what the problem is here. Any help is appreciated.
tagged with: java
type: Question
has title: Android cannot be converted to JSONObject error
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/23508948
possible better answer: http://stackoverflow.com/a/79341613
has answer: http://stackoverflow.com/a/23508974
tagged with: date
has comment: http://stackoverflow.com/comment/36055795
has comment: http://stackoverflow.com/comment/36056172
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23508974
has title: java string date conversion
type: Question
upvote count: 1
has body: I want to convert a string to date before storing it and I used SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd"); Date returnDate = format.parse(date); When I ran this with sample date: the input string for date conversion is 2014-05-06 the parsed date is Mon Jan 06 00:05:00 IST 2014 now when I store the returnDate in MySql the value is 2014-01-06 00:05:00 Why is the date changed ? Want to know if I am missing something. I went through the posts related to date string conversion : How to convert a date from a Datepicker to Mysql DATETIME format using java?
has answer: http://stackoverflow.com/a/79341613
linked to: http://stackoverflow.com/q/23492808
linked to: http://stackoverflow.com/q/16851107
tagged with: java
has answer: http://stackoverflow.com/a/23509053
answer count: 3
tagged with: mysql

http://stackoverflow.com/comment/36211132
has text: You can't do this , you can't do that . So you can't do anything but ask question. :)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23581481
type: AnswerComment

http://stackoverflow.com/q/23551683
linked to: http://stackoverflow.com/q/17540031
has answer: http://stackoverflow.com/a/23551896
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36136148
has body: I read a line from a file: KatalogObrazków 1 32 Means that I should look for data in: C:\Users\NAME_OF_THE_USER/KatalogObrazków and so I do it, but there is horrible thing going on. In splitLine[0] I have a word "KatalogObrazków" but then the computer says that "KatalogObrazków".equals(splitLine[0]) is false, there is no whitespace arround splitLine[0] left after splitting line. Please have a look at the code below. BufferedReader br = new BufferedReader(new FileReader(path)); String line; String[] splitLine; if ((line = br.readLine()) != null) { splitLine = line.split(" "); System.out.println(splitLine[0]);//1st line of output System.out.println("KatalogObrazków".equals(splitLine[0]));//these are not EQUAL!!!!!??? WHY? imageDirectoryPath = System.getProperty("user.home")+"/" + splitLine[0]; System.out.println(new File(imageDirectoryPath).exists()); delay = Integer.parseInt(splitLine[1]); fontSize = Integer.parseInt(splitLine[2]); } br.close(); Output: KatalogObrazków false false C:\Users\R/KatalogObrazków EDIT: System.out.println(); for (char c : splitLine[0].toCharArray()) System.out.print((int) c + " "); System.out.println(); for (char c : "KatalogObrazków".toCharArray()) System.out.print((int) c + " "); System.out.println(); GOT ME: 65279 75 97 116 97 108 111 103 79 98 114 97 122 107 243 119 75 97 116 97 108 111 103 79 98 114 97 122 107 243 119
downvote count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/1835430
score: 5
has comment: http://stackoverflow.com/comment/36135801
has comment: http://stackoverflow.com/comment/36136389
has title: Two identical Strings are not equal(Not pointer/reference mistake)
has comment: http://stackoverflow.com/comment/36135868
has comment: http://stackoverflow.com/comment/36136153
answer count: 1
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/36136013
tagged with: equals
upvote count: 5

http://stackoverflow.com/comment/36115096
type: QuestionComment
comment on: http://stackoverflow.com/q/23540308
has text: Why, AbstractMethodError is the new NullPointerException. Instead of turning runtime exceptions into compilation errors, it's the other way around. Is this a clean compile?
score: 0
type: Comment

http://stackoverflow.com/q/23579028
has answer: http://stackoverflow.com/a/23609412
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23588110
tagged with: wildfly
tagged with: openshift
type: Question
possible better answer: http://stackoverflow.com/a/23588110
tagged with: java
answer count: 2
tagged with: websocket
tagged with: tomcat
has title: WebSockets not working on OpenShift Tomcat 7.0 and WildFly Application Server 8.1.0.CR1
accepted answer: http://stackoverflow.com/a/23609412
score: 0
has comment: http://stackoverflow.com/comment/36200376
has body: I 've spent the whole night trying to run a simple echo test on Tomcat 7. The test I try to run runs locally as expected. But when deployed to the openshift the connection opens and then immediately closed. I've been looking for the right setup on the internet and found questions and answers for them for exactly the same problem but the solutions don't work for me. The example of what I have as a test can be checked at http://pureikka-belgampaul.rhcloud.com/pi-8/index.html At the bottom of the viewarea there's a debug console reporting the statsus of the websocket. So I feel like I have not made a simple mistake in the setup and it runs locally with only the change of the host name and the port number for the websocket. Could it be a routing trouble after the upgrade of the connection? I deploy my war file directly to the webapps directory. I also think I got websockets working at one moment but i'm not so sure anymore. I could be looking at the localhost after all. Eventually I decided to try wildfly8 gear because it ships with support for websockets. I checked out the https://github.com/javaee-samples/javaee7-samples repo and deployed the chat demo to the local wildfly8 and the example worked from the first run as it is supposed. Great. But the same war file fails to work correctly on the openshift (http://wildfly8-belgampaul.rhcloud.com/chat3/) I tried to use ports 80 or 8000 in both setups. Need someone's help? advice or question to send me back to the right direction Maybe someone has solved a similar issue?

list
type: Tag
tags question: http://stackoverflow.com/q/23611643
tags question: http://stackoverflow.com/q/23483525
tags question: http://stackoverflow.com/q/23583348
tags question: http://stackoverflow.com/q/23512225
tags question: http://stackoverflow.com/q/23521908
tags question: http://stackoverflow.com/q/23566397
tags question: http://stackoverflow.com/q/23478900
tags question: http://stackoverflow.com/q/23457361
tags question: http://stackoverflow.com/q/23526164
tags question: http://stackoverflow.com/q/23485944
tag name: list
tags question: http://stackoverflow.com/q/23461128
tags question: http://stackoverflow.com/q/23536628
tags question: http://stackoverflow.com/q/23595305
tags question: http://stackoverflow.com/q/23574802
tags question: http://stackoverflow.com/q/23542117
tags question: http://stackoverflow.com/q/23559157
tags question: http://stackoverflow.com/q/23614212
tags question: http://stackoverflow.com/q/23487351
tags question: http://stackoverflow.com/q/23544288
tags question: http://stackoverflow.com/q/23612220
tags question: http://stackoverflow.com/q/23535346
tags question: http://stackoverflow.com/q/23566478
tags question: http://stackoverflow.com/q/23590982

http://stackoverflow.com/q/23476261
tagged with: java
possible better answer: http://stackoverflow.com/a/23476812
accepted answer: http://stackoverflow.com/a/23476838
has answer: http://stackoverflow.com/a/23476812
upvote count: 1
type: Question
tagged with: shortest-path
tagged with: algorithm
tagged with: data-structures
has comment: http://stackoverflow.com/comment/35994971
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23476838
favorite count: 0
has comment: http://stackoverflow.com/comment/35995118
has body: I have a question about Java algorithm of one program. I want to write an android program that provides information about "bus route". Program is worked that user selects one bus station(A station) and program says to user "take the bus number 4,and take off B station.And take the bus number 8 then take off C station." Anyone has an idea about that programs algorithm? What can I use for saving each bus route? Queue, stack or someting like that? Can I use BFS or DFS algorithm for shortest bus route path? Purpose of program; How can user finds the transportation route with using Bus. (Bus number 4 does not go to the station 8 directly,user needs transfer to station B) I need to know ; Which data structure and which shortest path algorithm do I use.
has title: Bus Route Program,What kind of algorithm and data-structure do I use?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35995473
score: 1

http://stackoverflow.com/q/23530013
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/23540932
type: Question
has title: NetBeans Hibernate reverse engineering data types mismatch
answer count: 1
has answer: http://stackoverflow.com/a/23540932
tagged with: sql-server
score: 0
tagged with: netbeans
has body: I'm quite new to Hibernate since I've always used plain JDBC. I'm trying to configure the entities by using NetBeans' reverse engineering process against a SQL Server database. I've followed the NetBeans' webpage tutorial and I'm able to get a new package into my project with all entities created, but when I run this simple query from Country in the HQL editor I get this error: org.hibernate.type.SerializationException: could not deserialize at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:217) at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:240) at org.hibernate.type.SerializableType.fromBytes(SerializableType.java:82) at org.hibernate.type.SerializableType.get(SerializableType.java:39) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163) at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154) at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308) at org.hibernate.loader.Loader.getRow(Loader.java:1206) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580) at org.hibernate.loader.Loader.doQuery(Loader.java:701) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.doList(Loader.java:2220) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104) at org.hibernate.loader.Loader.list(Loader.java:2099) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) Caused by…
tagged with: reverse-engineering
type: AnsweredQuestion

http://stackoverflow.com/q/23568792
has comment: http://stackoverflow.com/comment/40894204
possible better answer: http://stackoverflow.com/a/38138264
answer count: 8
has answer: http://stackoverflow.com/a/32235134
has title: Android 4.4 WebView file chooser not opening?
downvote count: 0
accepted answer: http://stackoverflow.com/a/23634577
has answer: http://stackoverflow.com/a/33159820
has comment: http://stackoverflow.com/comment/36170630
score: 28
favorite count: 0
upvote count: 28
tagged with: android-4.4-kitkat
has comment: http://stackoverflow.com/comment/40829029
tagged with: android
has body: We are creating an app which uses the webview and will access a page where the user needs to upload a file. We are experiencing problems with Android 4.4 where the file chooser does not open and clicking the upload button causes nothing to happen. This functionality works with earlier versions using the openFileChooser method like so: webview.setWebChromeClient(new WebChromeClient() { //The undocumented magic method override //Eclipse will swear at you if you try to put @Override here // For Android 3.0+ public void openFileChooser(ValueCallback&lt;Uri&gt; uploadMsg) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); MainActivity.this.startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); } // For Android 3.0+ public void openFileChooser(ValueCallback uploadMsg, String acceptType) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); MainActivity.this.startActivityForResult( Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE); } //For Android 4.1 public void openFileChooser(ValueCallback&lt;Uri&gt; uploadMsg, String acceptType, String capture) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("image/*"); MainActivity.this.startActivityForResult(Intent.createChooser(i, "File Chooser"), MainActivity.FILECHOOSER_RESULTCODE); } }); I have spent a good amount of time searching for a way to do it on 4.4 but have had no luck. Has anyone managed to do this?
has answer: http://stackoverflow.com/a/26648110
has comment: http://stackoverflow.com/comment/47530609
has comment: http://stackoverflow.com/comment/46436773
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36232825
has answer: http://stackoverflow.com/a/27168321
tagged with: webview
has answer: http://stackoverflow.com/a/23634577
type: Question
has answer: http://stackoverflow.com/a/24404560
has comment: http://stackoverflow.com/comment/36233555
has answer: http://stackoverflow.com/a/38138264
linked to: http://stackoverflow.com/q/30317113
tagged with: java
has answer: http://stackoverflow.com/a/57821492
linked to: http://stackoverflow.com/q/5907369

http://stackoverflow.com/comment/36196283
type: AnswerComment
has text: java.lang.NullPointerException
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23584007

http://stackoverflow.com/comment/36236348
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23597104
has text: is IplImage#getBufferedImage() the inbuild method which converts the source IplImage to BufferedImage?
score: 0

http://stackoverflow.com/comment/36120434
has text: a `Set` is a `Collection`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23543663
score: 1

http://stackoverflow.com/a/23471107
upvote count: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/23470720
answers question: http://stackoverflow.com/q/23470720
has body: An answer based on the comments. java.exe is installed into the %SystemRoot%\system32 directory and this java runs the version of Java based on your registry. If you want to override this version of Java, you need to ensure not only that it is in your PATH, but it must appear before your %SystemRoot%\system32 otherwise only additional commands like javac or jar use the version you expect. (As these are not in System32 )
type: AcceptedAnswer
downvote count: 0
score: 8
has comment: http://stackoverflow.com/comment/36000943

http://stackoverflow.com/comment/36210871
type: AnswerComment
has text: If all you want to do is *display* a number in its binary form, why not use [`Integer.toBinaryString(int)`](http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#toBinaryString%28int%29)?
comment on: http://stackoverflow.com/a/23591833
type: Comment
score: 0

http://stackoverflow.com/comment/36107241
type: QuestionComment
has text: I don't believe it has something to do with the cert. You're getting a `connecction refused` error which says the server actively refuses your connection. Either the port is not right or the server is not listening on that port (or any firewall blocking your request). Please see if you're indeed receiving your request on the server.
comment on: http://stackoverflow.com/q/23536246
score: 4
type: Comment

http://stackoverflow.com/comment/35988303
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23472971
has text: Not compilable. You need to actually make a Collection out of the array.
score: 0

http://stackoverflow.com/q/23482202
accepted answer: http://stackoverflow.com/a/23492572
score: 0
tagged with: google-glass
answer count: 1
has comment: http://stackoverflow.com/comment/36009597
has body: I am stuck with the Google Glass Java Starter Project. I have succesfully downloaded it and ran it locally using mvn jetty:run. It runs beautifully on localhost in my machine. I deployed it to Google App Engine sucessfully, but I wanted to add more functionality to it, so I decided to use the Java Quartz library to send scheduled notifications to the glassware. Unfortunately, the quartz library works spawning new threads and GAE doesn't allow me to do so. I decided to run it in a separate server (Amazon EC2) and I am able to deploy it, but I have a servlet mapping error. The error I get is: HTTP Status 404 - /oauth2callback type Status report message /oauth2callback description The requested resource (/oauth2callback) is not available. I have tried to add the "glass" part to each url-pattern but that doesn't work. I am aware this is a servlet mapping issue, but I don't know how to fix it. This is my web.xml This is the servlets part from my web.xml main com.google.glassware.MainServlet main /glass/main oauth2callback com.google.glassware.AuthServlet oauth2callback /glass/oauth2callback notify com.google.glassware.NotifyServlet notify /glass/notify attachmentproxy com.google.glassware.AttachmentProxyServlet attachmentproxy /glass/attachmentproxy index.jsp Would anyone be so kind as to point me in the right direction? or explain why this isn't working? UPDATE For people having the same problem I am having, I fixed it. The user Prisoner pointed me in the right direction, but I was having a hard time following the lead. What he means by running the app as "ROOT" is to have the application run in: http://amazon-server.com:8080/ I was trying to run it as "glass" http://amazon-server.com:8080/glass and it was messing everything up that I was trying to do. All you have to do is delete the folder ROOT in your webapps folder and upload your precompiled war renamed as "ROOT.war" The exact command I used was: scp -i myamazon.pem /Users/.../.../mirror-api-quickstart/target/glass…
linked to: http://stackoverflow.com/q/23284260
tagged with: google-mirror-api
has title: Java Google glass starter project mapping in AWS EC2
has comment: http://stackoverflow.com/comment/36011871
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23492572
tagged with: amazon-ec2
tagged with: servlets

http://stackoverflow.com/q/23589589
tagged with: java
has answer: http://stackoverflow.com/a/23599737
accepted answer: http://stackoverflow.com/a/23599737
type: Question
tagged with: jersey
has comment: http://stackoverflow.com/comment/36206250
has comment: http://stackoverflow.com/comment/36206527
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/36206296
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/36206322
tagged with: spring
has title: Jersey: How to log HTTP POST data?
has comment: http://stackoverflow.com/comment/36218558
type: AnsweredQuestion
has body: I have a code block like final Invocation.Builder builder = webTarget.request(); final Entity&lt;IFSRequestPresentation&gt; entity = Entity.entity(ifsRequestPresentation, MediaType.APPLICATION_JSON); final Response response = builder.post(entity); The server (which is external to me and I can't see logs) is not returning me the data I expect. I believe that the json payload is not good The IFSRequestPresentation is quite complex and I would like to see how it is represented as json String. I am using Spring(4.0.3) and Jersey(2.8). Is there a way I can log builder.post(entity) method? or at least see what entity looks like as json String?

http://stackoverflow.com/comment/36215726
comment on: http://stackoverflow.com/q/23594663
score: 0
type: Comment
type: QuestionComment
has text: are you using `glClearColor` and `glClear` before the rendering starts? You must clear the screen, otherwise the old textures will be shown and a 'flickering' effect appears.

http://stackoverflow.com/q/23553051
has comment: http://stackoverflow.com/comment/36138481
has body: I got problem with KeyListener. I create class gra where is full code need to play game Tetris in constructor i only addKeyListener. In other class Menu I create object Gra gra = new Gra() and coll it when condition is met gra.start(g); but when I am in class Gra KeyListener not work. Please help me sove this issue. He is code from class gra import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.Random; import javax.swing.JPanel; //@SuppressWarnings("serial") public class Gra extends JPanel implements KeyListener{ public Gra(){ addKeyListener(this); setFocusable(true); requestFocus(); repaint(); } public void start(Graphics g) { Graphics2D g2d = (Graphics2D) g; setFocusable(true); requestFocus(); repaint(); } @Override public void keyPressed(KeyEvent arg0) { // TODO Auto-generated method stub System.err.println("sdfafs"); char c = arg0.getKeyChar(); System.err.println(c); } @Override public void keyReleased(KeyEvent arg0) { // TODO Auto-generated method stub char c = arg0.getKeyChar(); System.err.println(c); } @Override public void keyTyped(KeyEvent arg0) { // TODO Auto-generated method stub char c = arg0.getKeyChar(); System.err.println(c); } }
type: Question
has comment: http://stackoverflow.com/comment/36138883
linked to: http://stackoverflow.com/q/13354230
linked to: http://stackoverflow.com/q/8482268
score: 0
tagged with: swing
answer count: 1
duplicate of: http://stackoverflow.com/q/8482268
has title: KeyListener not work in object
tagged with: java
type: UnansweredQuestion
tagged with: keylistener
has comment: http://stackoverflow.com/comment/36138627
has answer: http://stackoverflow.com/a/23553100

http://stackoverflow.com/comment/36219942
score: 1
has text: The real question here is *what is n*?
comment on: http://stackoverflow.com/q/23596522
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23494882
answer count: 1
tagged with: olap-cube
type: UnansweredQuestion
has body: I wrote a java class with the main() method to connect to "msmdpump.dll" and execute MDX on cube and retrieve a result. like this : public static void main(String[] args) throws ClassNotFoundException, OlapException{ Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver"); Connection connection = null;; try { connection = DriverManager.getConnection("jdbc:xmla:Server=http://172.20.0.29:80/OLAP/msmdpump.dll"+ ";Catalog=CreditCard", "", ""); } catch (SQLException e) { e.printStackTrace(); } if (null== connection){ System.out.println("Connection null"); }else System.out.println("Connect Successfully !"); OlapWrapper wrapper = (OlapWrapper) connection; OlapConnection olapConnection = null; try { olapConnection = wrapper.unwrap(OlapConnection.class); } catch (SQLException e) { e.printStackTrace(); } OlapStatement statement = null; CellSet cellSet = null; try { statement = (OlapStatement) olapConnection.createStatement(); cellSet = statement.executeOlapQuery( "SELECT NON EMPTY { [Measures].[Instalment Future Amount] } ON COLUMNS"+ ", NON EMPTY { ([Dim MerchantInstalmentCashFlowDate].[J Year].[J Year].ALLMEMBERS * [Dim MerchantInstalmentCashFlowDate].[Persian Month].[Persian Month].ALLMEMBERS) } ON ROWS "+ "FROM [Credit Card DW] where ([Dim Merchant].[Mrc Unique Id].[Mrc Unique Id].&amp;[100000000000013])" ); } catch (SQLException e) { e.printStackTrace(); } for (Position row : cellSet.getAxes().get(1)) { for (Position column : cellSet.getAxes().get(0)) { for (Member member : row.getMembers()) { System.out.println(member.getName()); } final Cell cell = cellSet.getCell(column, row); System.out.println(cell.getFormattedValue()); System.out.println(); } } } everything is fine, I executed it on my local computer and see the result on my console :) Next I copied the same code in my backbean's method to call it from jsf page. I deployed the EAR file contained those pages and when I brows that jsf on browser I got this error which means the application doesn't have authorize to …
has answer: http://stackoverflow.com/a/23500193
score: 0
tagged with: java
type: Question
tagged with: weblogic
has title: Execute query on SASS cube with XmlaOlap4jDriver on Weblogic
tagged with: olap4j

http://stackoverflow.com/a/23501521
type: Answer
has body: The quick and practical way is to clear those texts htmleditor.getHtmlText() .replace("&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;", "") .replace("&lt;/body&gt;&lt;/html&gt;", "") .isEmpty(); However if you want a real emptiness of html content then it is a little hard. Search the net with "java html strip tag" keywords.
score: 0
answers question: http://stackoverflow.com/q/23492194

http://stackoverflow.com/comment/36002844
comment on: http://stackoverflow.com/q/23480485
type: QuestionComment
has text: Your first link show that it is in the org.apache.commons.collections package. Apache commons is an external library and not part of the JDK.
type: Comment
score: 9

http://stackoverflow.com/a/74664561
has body: Solution Using Java Stream If you want to use Java Stream any of the following options will give you the desired result: Option 1 Just return the only element from the stream: set.stream().findFirst().get() Option 2 Or use Stream.reduce; since adding the only element to zero has no effect a little too much IMHO set.stream().reduce(0, Integer::sum) You can test it here.
has comment: http://stackoverflow.com/comment/138882045
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23595749
upvote count: 2

http://stackoverflow.com/comment/45481728
score: 0
comment on: http://stackoverflow.com/a/23475358
has text: @LuiggieMendoza Would there be any differences in terms of performance between case 1 and case 2?
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23470940
downvote count: 0
has body: I am unable to run my script neither on device nor on simulator. It gives the following error : error: Could not determine your device from Appium arguments or desired capabilities. Please make sure to specify the 'deviceName' capability It was working earlier with Appium v0.18.2 but when I updated it to v1.0.0 - Orion , it's giving this error. I tried with : [1] capabilities.setCapability("deviceName", "iPhone Simulator"); [2] capabilities.setCapability("device", "iPhone Simulator"); [3] capabilities.setCapability("device", "iPhone"); [4] capabilities.setCapability("deviceName", "iPhone"); My other capabilties are set as below : DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS"); capabilities.setCapability(CapabilityType.VERSION, "7.1"); capabilities.setCapability(CapabilityType.PLATFORM, "Mac"); capabilities.setCapability("app", "/Users/smriti/Abc.app"); driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); Where need to set this deviceName. Any help would be appreciated.
has title: Getting Error: Please make sure to specify the 'deviceName' capability in Appium v1.0.0
favorite count: 0
has answer: http://stackoverflow.com/a/48958911
has comment: http://stackoverflow.com/comment/62956168
has answer: http://stackoverflow.com/a/23528730
type: UnansweredQuestion
tagged with: selenium-webdriver
score: 4
tagged with: java
type: Question
upvote count: 4
answer count: 2
tagged with: automation
tagged with: appium
tagged with: ios

http://stackoverflow.com/q/23615024
has title: Trying to run a java program in console will give a could not find or load main class error
type: Question
has comment: http://stackoverflow.com/comment/36255610
tagged with: java
linked to: http://stackoverflow.com/q/16334625
has comment: http://stackoverflow.com/comment/36254151
possible better answer: http://stackoverflow.com/a/23615972
tagged with: eclipse
has body: So I want to run my program from console. I copied the same execution line that Eclipse used to run my program: "C:\Program Files\Java\jre7\bin\javaw.exe" -Dfile.encoding=Cp1257 -classpath C:\Users\MyName\workspace\MyProject\bin;C:\Users\MyName\workspace\MyProject\lib\commons-io-2.4.jar files.Start Figured that it will not run it so I changed it to this: java C:\Users\MyName\workspace\MyProject\lib\commons-io-2.4.jar files.Start I run it at the root folder of my project and java will throw this error: Error: Could not find or load main class files.Start What is the problem in here? It runs fine with Eclipse.
has answer: http://stackoverflow.com/a/23615972
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36255779
has answer: http://stackoverflow.com/a/23615074
has comment: http://stackoverflow.com/comment/36255339
has comment: http://stackoverflow.com/comment/36256114
has comment: http://stackoverflow.com/comment/36255465
has comment: http://stackoverflow.com/comment/36255971
linked to: http://stackoverflow.com/q/23613495
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23615074
has comment: http://stackoverflow.com/comment/36254568
duplicate of: http://stackoverflow.com/q/23613495
has comment: http://stackoverflow.com/comment/36256058

http://stackoverflow.com/comment/36244378
type: Comment
has text: What the problem with `subImage()`?
score: 0
comment on: http://stackoverflow.com/q/23610007
type: QuestionComment

http://stackoverflow.com/q/23478466
has body: I try to develop a sipPhone for the project of the end of study .Now, I still stick in how can I register to Asterisk 1.8 server with authentication. I downloaded this code from here: package examples.authorization; import gov.nist.javax.sip.Utils; import java.net.InetAddress; import java.util.ArrayList; import java.util.Properties; import javax.sip.ClientTransaction; import javax.sip.Dialog; import javax.sip.DialogTerminatedEvent; import javax.sip.IOExceptionEvent; import javax.sip.ListeningPoint; import javax.sip.RequestEvent; import javax.sip.ResponseEvent; import javax.sip.SipFactory; import javax.sip.SipListener; import javax.sip.SipProvider; import javax.sip.SipStack; import javax.sip.TimeoutEvent; import javax.sip.TransactionTerminatedEvent; import javax.sip.address.Address; import javax.sip.address.AddressFactory; import javax.sip.header.AuthorizationHeader; import javax.sip.header.CSeqHeader; import javax.sip.header.CallIdHeader; import javax.sip.header.ContactHeader; import javax.sip.header.FromHeader; import javax.sip.header.HeaderFactory; import javax.sip.header.MaxForwardsHeader; import javax.sip.header.ToHeader; import javax.sip.header.ViaHeader; import javax.sip.message.MessageFactory; import javax.sip.message.Request; import javax.sip.message.Response; public class SipInit implements SipListener { private String ip; private SipFactory sipFactory; private Properties properties; private SipStack sipStack; @SuppressWarnings("unused") private MessageFactory messageFactory; private HeaderFactory headerFactory; private AddressFactory addressFactory; private ListeningPoint listeningPoint; private int port; private String protocol; private SipProvider sipProvider; private String username; private Address contactAddress; @SuppressWarnings("unused") private ContactHeader contactHeader; private String server; private char[] tag; private Request request; private String password; private ClientTransaction inviteTid; private Dialog dialog; public void init() { try…
tagged with: java
has comment: http://stackoverflow.com/comment/48477918
has title: SIP Register Request using JAIN SIP
downvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/48486355
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/52511575
upvote count: 1
answer count: 1
tagged with: jain-sip

http://stackoverflow.com/a/23599160
type: Answer
has comment: http://stackoverflow.com/comment/36225740
has comment: http://stackoverflow.com/comment/36225727
answers question: http://stackoverflow.com/q/23599058
has comment: http://stackoverflow.com/comment/36224499
accepted answer of: http://stackoverflow.com/q/23599058
type: AcceptedAnswer
has body: It is pretty standard across any web view No, it is not. Is there something in the XML etc that I can change to remove this wrapped, and display the full web page rather than with any extra? Yes. You can get rid of the EditText widget, the Button widget, and perhaps other stuff as well. Let's assume for the moment that the layout XML in question is the one that you put in your previous question: &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;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; &lt;EditText android:id="@+id/urlField" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@+id/textView1" android:layout_centerHorizontal="true" android:ems="10" /&gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/urlField" android:layout_centerHorizontal="true" android:onClick="open" android:text="@string/browse" /&gt; &lt;WebView android:id="@+id/webView1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_alignParentBottom="true" android:layout_below="@+id/button1" /&gt; &lt;/RelativeLayout&gt; If you do not want the Button, delete the Button. If you do not want the EditText, delete the EditText. If you do not want the TextView, delete the TextView. If, after all of the above, you have only the RelativeLayout and the WebView, you could even get rid of the Rela…
has comment: http://stackoverflow.com/comment/36238599
score: 0

http://stackoverflow.com/q/23499200
type: Question
has title: Java Exception has occurred in .jar
answer count: 2
tagged with: jar
has answer: http://stackoverflow.com/a/23499479
has comment: http://stackoverflow.com/comment/36037561
score: 0
has comment: http://stackoverflow.com/comment/36040258
has comment: http://stackoverflow.com/comment/36037294
linked to: http://stackoverflow.com/q/10382929
has answer: http://stackoverflow.com/a/23499459
has comment: http://stackoverflow.com/comment/36037694
has body: I made a .jar file using NetBeans. When I move it to any place on my laptop and double click it, it will work. When I try it on a different PC, it gives me a message box saying: title: Java Virtual Machine Launcher. text: A Java Exception has occurred. Every PC i tried so far, gives me this. Those PCs do not have any additional Java software installed, only the basic one which updates itself automatically. If there is a way to share my Java file on different PCs, please tell me (even if this involves converting the file to some other format, but not that the user has to install anything extra). Here is my error:
type: UnansweredQuestion
tagged with: netbeans
tagged with: java
has comment: http://stackoverflow.com/comment/36037617
has comment: http://stackoverflow.com/comment/36037309
has comment: http://stackoverflow.com/comment/36037748

http://stackoverflow.com/comment/36011963
type: QuestionComment
has text: @StormSurge95 either would be fine, however a single large graphic would be better if performance was an issue. The cells do not need to be visible for the grid, they just need to map to your game world in some way (though making a debug flag to toggle drawing them can help you to visualise and debug)
score: 0
comment on: http://stackoverflow.com/q/23485190
type: Comment

http://stackoverflow.com/a/23597471
type: Answer
has comment: http://stackoverflow.com/comment/36222614
has comment: http://stackoverflow.com/comment/36222158
has comment: http://stackoverflow.com/comment/36222859
has comment: http://stackoverflow.com/comment/36223048
has body: MULTIPLE_INTERVAL_SELECTION this constant could help you to choose more than one selection
score: 0
has comment: http://stackoverflow.com/comment/36260946
answers question: http://stackoverflow.com/q/23597366

http://stackoverflow.com/a/23567100
score: 1
accepted answer of: http://stackoverflow.com/q/23566693
has body: Its working fine for me after doing some of the changes. remove all children[0].children[0] remove $entry() complete code: public static native String initiateFilesInput(Element fileUpload, UploadItemWidget imagesPanel)/*-{ fileUpload.addEventListener("change", fileUpload.addEventListener( "change", function(e) { showThumbnail(fileUpload.files, imagesPanel); }, false)); function showThumbnail(files, imagesPanel) { for ( var i = 0; i &lt; files.length; i++) { var file = files[i] var image = $doc.createElement("img"); image.file = file; var reader = new FileReader(); reader.onload = (function(img) { return function(e) { img.src = e.target.result; imagesPanel.@fr.onevu.vume.client.common.widget.fileUpload.ImageHolder::addImage(Lcom/google/gwt/dom/client/Element;)(img); }; }(image)); var ret = reader.readAsDataURL(file); } } }-*/; missing part of the code in your original post. Please validate. public class ImageHolder implements UploadItemWidget { public SimplePanel panel = new SimplePanel(); public FileUpload fileUpload = new FileUpload(); public ImageHolder() { panel.add(fileUpload); } ... } Entry point class public void onModuleLoad() { ImageHolder imageHolder = new ImageHolder(); RootPanel.get().add(imageHolder.panel); ImageHolder.initiateFilesInput(imageHolder.fileUpload.getElement(), imageHolder); } Screenshot: (3 images are selected)
has comment: http://stackoverflow.com/comment/36169322
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36169574
upvote count: 1
answers question: http://stackoverflow.com/q/23566693

http://stackoverflow.com/comment/124929005
type: QuestionComment
comment on: http://stackoverflow.com/q/23601862
score: 0
has text: Still getting this in API>21 & with permissions as well. Did you find a solution to this
type: Comment

http://stackoverflow.com/a/23521193
downvote count: 0
has comment: http://stackoverflow.com/comment/36080380
has comment: http://stackoverflow.com/comment/36080123
has comment: http://stackoverflow.com/comment/36079631
has comment: http://stackoverflow.com/comment/36079498
has comment: http://stackoverflow.com/comment/36084337
has comment: http://stackoverflow.com/comment/36093580
has comment: http://stackoverflow.com/comment/36089480
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/36093219
has comment: http://stackoverflow.com/comment/36092648
score: 2
has comment: http://stackoverflow.com/comment/36078781
has comment: http://stackoverflow.com/comment/36080333
has body: Maybe this can help you? https://stackoverflow.com/a/23435922/3464293 Smthng like this? View decorView = getActivity().getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); Update: (source: https://stackoverflow.com/a/2844648/3464293) In your LoginDialog.java add this method: @Override public void onStart() { super.onStart(); Window window = getDialog().getWindow(); window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); window.requestWindowFeature(Window.FEATURE_NO_TITLE); int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN; window.getDecorView().setSystemUiVisibility(uiOptions); } and try then. Remove previous updates.
answers question: http://stackoverflow.com/q/23520892

http://stackoverflow.com/comment/35983384
type: Comment
comment on: http://stackoverflow.com/q/23470145
type: QuestionComment
has text: NO .. Not exactly .. I am getting just one value . Can you tell where am going worng : for(Entry<Integer, List<String>> i:m.entrySet()) { System.out.println(i.getValue()+"\n"+i.getKey()); System.out.println(i.getValue().size()); }
score: 0

http://stackoverflow.com/q/23610979
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/36246967
has comment: http://stackoverflow.com/comment/36247744
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/35366884
tagged with: video
upvote count: 3
tagged with: java
has body: I have a Java backend running on Tomcat 7. I'd like to add support for an HTTP request that would begin streaming an MP4 video from Java code in Tomcat, and not sure where to begin. I believe HTTP GET somehow supports A/V streaming, but not entirely sure. Let's pretend that the MP4 file is located at /opt/videos/myvid.mp4, and that the Tomcat instance has file permissions to read/write to that directory and file. Now let's pretend that an HTTP GET (or whatever supports streaming) request comes in, and we need to start streaming myvid.mp4 to the client - in pure Java, from inside a Controller class. How would this work?
type: Question
tagged with: video-streaming
linked to: http://stackoverflow.com/q/2308181
has title: How to stream custom video from Tomcat
has comment: http://stackoverflow.com/comment/36247728
score: 3
answer count: 1

http://stackoverflow.com/q/23571617
tagged with: jsp
tagged with: preferences
type: UnansweredQuestion
has body: I'm new with Jsp and Servlets. So my first question is how to use List (ArrayList) elements with referentions on all my .Jsp pages and Servlet pages and my second question is how to read this List element in .Jsp files and Servlets. When I used java classes without Jsp and create in several classes a referention to other classes with an List element then can I acces this referention everywhere I want. But how can I do this in JSP? And how can you read this array in a .Jsp file? In java classes will I set a refention between two or more classes like this: Class Users example: Public class User() { Private List&lt;Role&gt; allRoles = ArrayList&lt;Role&gt;(); // contains data insight from the class Role // things to do }
has comment: http://stackoverflow.com/comment/36172916
answer count: 0
has comment: http://stackoverflow.com/comment/36173360
type: Question
tagged with: java
tagged with: servlets
has title: Acces and create List elements with referention
score: 0

http://stackoverflow.com/a/23455368
answers question: http://stackoverflow.com/q/23454482
has body: Youn need to download the JDBC driver JAR files (and all dependencies). Then call java -cp path_to_jar/jtds-1.3.1.jar;path_to_jar/jtde.jar;path_to_classes;path_to_other_jars/otherjar.jars your_main_class (Alle names are sample names) On Linux you have to use : as separator
score: 0
type: Answer

nexus-5
tags question: http://stackoverflow.com/q/23568848
type: Tag
tag name: nexus-5

http://stackoverflow.com/q/23489718
possible better answer: http://stackoverflow.com/a/23489818
has answer: http://stackoverflow.com/a/23489834
has comment: http://stackoverflow.com/comment/124950861
favorite count: 0
has answer: http://stackoverflow.com/a/48425422
accepted answer: http://stackoverflow.com/a/48425422
has body: Friends, I am having a problem in getting entire data using TreeSet. I have sorted the TreeSet on some same values. here is my code: MyCars class: class MyCars implements Comparable&lt;MyCars&gt;{ private String number; private int yearModel; private double horsePower; public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public int getYearModel() { return yearModel; } public void setYearModel(int yearModel) { this.yearModel = yearModel; } public double getHorsePower() { return horsePower; } public void setHorsePower(double horsePower) { this.horsePower = horsePower; } @Override public int compareTo(MyCars c) { return Double.compare(this.horsePower,c.getHorsePower()); } } SortTest class: public class SortTest { void GoForSort(){ Set dataStructure=new TreeSet(); MyCars c1=new MyCars(); c1.setNumber("SRT-Viper123"); c1.setYearModel(2013); c1.setHorsePower(450.00); MyCars c2=new MyCars(); c2.setNumber("Chevrolet-Corvette901"); c2.setYearModel(2012); c2.setHorsePower(450.00); MyCars c3=new MyCars(); c3.setNumber("Ford-Mustang678"); c3.setYearModel(2014); c3.setHorsePower(455.00); dataStructure.add(c1); dataStructure.add(c2); dataStructure.add(c3); Iterator&lt;MyCars&gt; it=dataStructure.iterator(); while(it.hasNext()){ MyCars c=it.next(); System.out.println(c.getNumber()+"\t"+c.getHorsePower()+"\t"+c.getYearModel()); } } public static void main(String[] args) { SortTest st=new SortTest(); st.GoForSort(); } } As you can see I have sorted the TreeSet on the basis of horsePower. And I have given SAME value for horse-power to two objects. Here is the output I get: SRT-Viper123 450.0 2013 Ford-Mustang678 455.0 2014 But I also want Chevrolet-Corvette901 to come in this set of output. Why I am not getting it. Is there any way to include that also? Because I found there was NO Problem when I change my collection to ArrayList. Does TreeSet sorts only unique elements? Is there any trick to get &amp; print all objects during It…
has answer: http://stackoverflow.com/a/23489741
has title: why does TreeSet remove duplicates when they are unequal?
has comment: http://stackoverflow.com/comment/36019322
has answer: http://stackoverflow.com/a/23489787
has comment: http://stackoverflow.com/comment/125789548
has comment: http://stackoverflow.com/comment/126525820
tagged with: collections
has answer: http://stackoverflow.com/a/23489818
has comment: http://stackoverflow.com/comment/36019235
has comment: http://stackoverflow.com/comment/126525745
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23490105
downvote count: 0
tagged with: java
answer count: 6
has comment: http://stackoverflow.com/comment/126525664
type: Question
upvote count: 2

http://stackoverflow.com/q/23512102
tagged with: methods
has body: If I have three classes. One class A, one class Customer where I've put an ArrayList of A in the constructor and one class SavingsAccount where I want to put them together. In class A I have a method which I want to call from SavingsAccount. How do I do that? And to call for both Customer and SavingsAccount? In Customer there is a variable; SocSecNr, that has to match a Nr in SavingsAccount, to be correct in A, that's why I put an ArrayList of SavingsAccount in Customer. (This is just an example class. I only want to know how to do this call without inheritance) import java.util.ArrayList; public class A { private ArrayList&lt;Customer&gt; customerlist; private SavingsAccount account; public A() { customerlist = new ArrayList&lt;Customer&gt;(); account = new SavingsAccount(); } public boolean deposit(long pNr, int accountId, double amount) { for(int i = 0; i &lt; customerlist.size(); i++) { if(customerlist.get(i).getPCode() == pNr) { account.transaction(amount); } } return false; } public double transaction(){ if(amount &lt; 0 &amp;&amp; balance + amount &lt; 0) return -0; else return balance += amount; } public class Customer { private long pNr; private ArrayList&lt;SavingsAccount&gt; accounts; public Customer(long pCode) { pNr = pCode; accounts = new ArrayList&lt;SavingsAccount&gt;(); } public ArrayList&lt;SavingsAccount&gt; getAccount(){ return accounts; } } public class SavingsAccount { private double balance; public SavingsAccount(){ accountId = accountCount; } public double transaction(double amount){ if(amount &lt; 0 &amp;&amp; balance + amount &lt; 0) return -0; else return balance += amount; } }
type: Question
tagged with: callback
has answer: http://stackoverflow.com/a/23512330
tagged with: class
tagged with: arraylist
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36061274
has title: Call for methods of an ArrayList in another class in Java
has comment: http://stackoverflow.com/comment/36061545
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36061324
has comment: http://stackoverflow.com/comment/36062650
has answer: http://stackoverflow.com/a/23512180
tagged with: java
has comment: http://stackoverflow.com/comment/36062586
has comment: http://stackoverflow.com/comment/36061264

http://stackoverflow.com/a/37054861
has body: I have the same issue with any android project when I add jCenter dependency on org.apache.ftpserver:ftpserver-core:1.0.6. Project compiles successfully, but it fails when I try to start it. I realized, that ftpserver-core-1.0.6.jar contains classes from ftplet-api-1.0.6.jar. To fix the issue, I used local libraries, but deleted ftplet-api-1.0.6.jar. I am not sure that it is totally correct solution, but it works for me.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23476431
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/23476431
has comment: http://stackoverflow.com/comment/81765142

http://stackoverflow.com/comment/35986959
score: 2
type: Comment
type: QuestionComment
has text: You have a **compiler** error there. A basic skill is to know to what program you're talking or what program is talking to you.
comment on: http://stackoverflow.com/q/23472311

http://stackoverflow.com/comment/36248052
type: QuestionComment
has text: And what makes you think it returns `false`? That code will just terminate `main` with the same exception that you've rethrown...
comment on: http://stackoverflow.com/q/23611436
score: 2
type: Comment

http://stackoverflow.com/comment/36154275
type: AnswerComment
has text: You can create classes folder in that if it is not there.did you use `export=true` in displaytag ?
comment on: http://stackoverflow.com/a/23537742
type: Comment
score: 0

http://stackoverflow.com/q/23468543
score: 0
tagged with: mina
has comment: http://stackoverflow.com/comment/35983178
type: UnansweredQuestion
answer count: 0
has body: In Apache Mina, is it possible to use different handler for each session?
tagged with: java
type: Question
has title: Apache Mina : Different handler for each session
has comment: http://stackoverflow.com/comment/35981512
tagged with: nio

http://stackoverflow.com/comment/36771986
type: QuestionComment
has text: hi Tomer.z can you please post your answer , as u are able to solve. I am having same problem how to pass arguments to MethodInvocation
comment on: http://stackoverflow.com/q/23592524
score: 0
type: Comment

http://stackoverflow.com/q/23489928
has comment: http://stackoverflow.com/comment/36019789
has comment: http://stackoverflow.com/comment/36020606
accepted answer: http://stackoverflow.com/a/23491046
has comment: http://stackoverflow.com/comment/36019809
score: 0
has title: addPropertyReference cannot be applied to abstractBeanDefinition
has comment: http://stackoverflow.com/comment/36021278
answer count: 1
has comment: http://stackoverflow.com/comment/36021750
has comment: http://stackoverflow.com/comment/36019962
has comment: http://stackoverflow.com/comment/36020253
tagged with: spring
has comment: http://stackoverflow.com/comment/36019805
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36019636
has comment: http://stackoverflow.com/comment/36021094
tagged with: java
has body: Im trying to construct beans at runtime based on entries in a config file. I have a class that implements BeanDefinitionRegistryPostProcessor, and in the postProcessBeanDefinitionRegistry I have the following code for (DataSourceConfig dsc : configuration.getDatabase()) { AbstractBeanDefinition jdbcTemplateDefinition = BeanDefinitionBuilder.rootBeanDefinition("com.me.threads.RemoteDataCollector") .addPropertyReference("remoteDBDoa", BeanDefinitionBuilder.rootBeanDefinition("com.me.db.RemoteDBDoa") .addPropertyValue("jdbcTemplateRemote", BeanDefinitionBuilder.rootBeanDefinition("org.springframework.jdbc.core.JdbcTemplate") .addPropertyValue("dataSource", BeanDefinitionBuilder.genericBeanDefinition(DriverManagerDataSource.class) .addPropertyValue("driverClassName", dsc.getDriverClassName()) .addPropertyValue("url", dsc.getUrl()) .addPropertyValue("username", dsc.getUsername()) .addPropertyValue("password", dsc.getPassword()) .getBeanDefinition() ) .getBeanDefinition() ) .getBeanDefinition() String name = BeanDefinitionReaderUtils.registerWithGeneratedName(jdbcTemplateDefinition, registry); jdbcTemplateBeanNames.put(dsc.getName(), name); } There is an issue somewhere within this code that i cnt seem to find. Is this the right way to accomplish what i want or is there a better way?
has answer: http://stackoverflow.com/a/23491046
type: Question

http://stackoverflow.com/q/23570919
tagged with: java
tagged with: ssl
has comment: http://stackoverflow.com/comment/36181184
score: 0
has body: I understand how to load a key from a file into a KeyStore so that I can pass it to a KeyManager and ultimately to SSLContext so that I can use the key as my client-side SSL certificate (as explained in this article). I would like my app to generate and keep its own unique client certificate when it is first run. I am able to successfully use generateKeyPair() to get a KeyPair, but I'm stuck trying to import it into a KeyStore. (SingleKeyManager is a class I wrote.) KeyPair keyPair = new SingleKeyManager().getKey(); KeyStore keyStore = KeyStore.getInstance("PKCS8"); Am I on the right track? What's the best way to do what I want to accomplish? Note that I'm not picky about the actual format of the key.
type: UnansweredQuestion
tagged with: android
has title: Using generated SSL key with KeyStore
linked to: http://stackoverflow.com/q/20175447
answer count: 0
duplicate of: http://stackoverflow.com/q/20175447
type: Question
has comment: http://stackoverflow.com/comment/36181211

http://stackoverflow.com/a/23578599
answers question: http://stackoverflow.com/q/23578558
upvote count: 2
has body: No, the contract for Map clearly states: A map cannot contain duplicate keys; each key can map to at most one value. In addition, your code isn't close to valid Java, as arrays aren't Lists, and those are strings, not whatever Service might be. You might, however, be interested in Guava's Multimap, which is essentially a map from keys to a collection of values.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/23589141
answer count: 2
accepted answer: http://stackoverflow.com/a/23599989
downvote count: 0
favorite count: 0
tagged with: soap
has body: I have created a SOAPHandler at client side to log outgoing request to server & added a SOAP header in SOAP message.It is logging the outgoing soap xml without the header part .But at the server end I am able to log the whole message with soap header. Server side log : <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header> <Credential xmlns="http://soap.header.test.com" password="123" username="ashok"/> </SOAP-ENV:Header> <S:Body> <ns2:addNumber xmlns:ns2="http://service.ashok.com/"> 10 200 </ns2:addNumber> </S:Body> Client side log <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> **NO HEADER** <S:Body> <ns2:addNumber xmlns:ns2="http://service.ashok.com/"> 10 200 </ns2:addNumber> </S:Body> My partial SOAPHandler at client side if (outgoingRequest) { SOAPMessage message = context.getMessage(); SOAPEnvelope envelope = message.getSOAPPart().getEnvelope(); SOAPHeader header = envelope.getHeader(); if (null == header) { header = envelope.addHeader(); } QName credential = new QName("http://soap.header.test.com","Credential"); SOAPHeaderElement headerElement = header.addHeaderElement(credential); QName username = new QName("username"); headerElement.addAttribute(username, "ashok"); QName password = new QName("password"); headerElement.addAttribute(password, "123"); message.writeTo(System.out); } Please suggest me how to log SOAP message with header part at client side
tagged with: web-services
has answer: http://stackoverflow.com/a/23599989
has title: Not able to log complete SOAP message in SOAPHandler
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/63512325
tagged with: jax-ws
score: 4
has answer: http://stackoverflow.com/a/63512325
type: Question
upvote count: 4

http://stackoverflow.com/comment/36105121
score: 0
has text: What is the difference between cell and column? Isn't it same thing?
type: Comment
comment on: http://stackoverflow.com/a/23533443
type: AnswerComment

http://stackoverflow.com/q/23599305
has comment: http://stackoverflow.com/comment/36225423
tagged with: spring
has answer: http://stackoverflow.com/a/23599327
has comment: http://stackoverflow.com/comment/36225455
has body: i 'm developing a mvc web application using spring mvc ,hibernate andjsp. my view is a page JSP home.jsp that contains a Form f i would like to retrieve and save the different values into my data base but i encounter some problems. ps : i testes my services class and my dao it works well i think that the problem desscriped due to the code of servlet or the view . if someone can help me :) stack trace `Grave: Servlet.service() for servlet [servlet1] in context with path [/erp] threw exception [java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'houssem' available as request attribute] with root cause java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'houssem' available as request attribute at org.springframework.web.servlet.support.BindStatus.&lt;init&gt;(BindStatus.java:141) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:178) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:198) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:164) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:151) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:142) at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:126) at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:421) at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142) at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102) at org.spr…
downvote count: 1
type: Question
tagged with: java
tagged with: hibernate
has title: error on view spring mvc
score: -1
upvote count: 0
answer count: 1
tagged with: jsp
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/36166585
has text: Your question is too broad. We can't help you understand all Javadoc everywhere. If you question is just about understanding that piece of code, then remove half your words and ensure that's the sole subject.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23568302
type: Comment

http://stackoverflow.com/comment/36257215
type: AnswerComment
type: Comment
has text: Yeah!! listKey is the thing I'm looking for! Thanks!
comment on: http://stackoverflow.com/a/23614659
score: 0

http://stackoverflow.com/comment/35997066
type: Comment
comment on: http://stackoverflow.com/a/23477537
score: 0
has text: posted the entire `context.xml` file. I have this in index.jsp file: `Go To Home` hence the method is invoked accordingly.
type: AnswerComment

http://stackoverflow.com/a/23454560
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35958248
has body: One of the possibilities is to structure you application as follows: 1) @Entity annotated POJO represent your data layer representing tables, relationships between them, etc using JPA 2) Stateless session beans implementing Session Facade desing pattern wrap your container managed CRUD operations. There are typically one facade per entity, they usually look like this: @Stateless public class FooFacade extends AbstractFacade&lt;Foo&gt;{ @PersistenceContext EntityManager em; public EntityManager getEM() { return em; } public void save (Foo entity) { getEM.persiste(Foo.class, entity); } public void reload (Foo entity) { getEM.refresh(entity); } //other similar stuff } AbstractFacade is an abstract class that provides genetic find and other operations that look identical in all facade classes (to avoid duplicate code). This e-commerce sample application can be used as a great example of this strategy. The classes are usually named as EntityName + Facade. 3) Stateless session beans that realise your business logic (calculations for competitions in your case or adding goods into basket, implementing checkout, etc. for ecommerce app). Usually they talk to data layer via *Facade EJBs mentioned in part 2 above. This part of the aforementioned tutorial realises these EJBs. 4) Servlets to which your UI layer will refer their request. Servlets will utilize EJBs from part 3 to serve the requests. 5) UI layer - JavaFX, Swing, JSF, JSP, Apache Wicket framework - add anything you like. Such a structure gives you both flexibility and scalability. Centring your business logic in stateless beans means you can scale well because they are pooled and every instance in the pool can equally be used when you application (e.g. servlet) needs talk to an instance of such a bean. I strongly recommend you to thoroghly read through the ecommerce tutorial on Netbean's website to see the concrete implementation of this scheme. Here is the download link for the source code of the application, Affabl…
has comment: http://stackoverflow.com/comment/35958309
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23453944
has comment: http://stackoverflow.com/comment/35958860

http://stackoverflow.com/a/23538893
has comment: http://stackoverflow.com/comment/36126619
score: 4
has comment: http://stackoverflow.com/comment/36122689
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/36126328
has body: I have no idea how Verifier is implemented but this code snippet demonstrates how one can create a custom hostname verifier none of those shipped with HttpClient fits their needs KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); InputStream in = new FileInputStream(new File("C:\\Program Files (x86)\\Java\\jre7\\bin\\my.keystore")); try { ks.load(in, "blahblah".toCharArray()); } finally { in.close(); } SSLContext sslContext = SSLContexts.custom() .useTLS() .loadTrustMaterial(ks) .build(); X509HostnameVerifier verifier = new AbstractVerifier() { @Override public void verify(final String host, final String[] cns, final String[] subjectAlts) throws SSLException { verify(host, cns, subjectAlts, true); } }; CloseableHttpClient hc = HttpClients.custom() .setSslcontext(sslContext) .setHostnameVerifier(verifier) .build();
has comment: http://stackoverflow.com/comment/36126003
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23527615
has comment: http://stackoverflow.com/comment/36120266
answers question: http://stackoverflow.com/q/23527615
has comment: http://stackoverflow.com/comment/36126227
type: AcceptedAnswer

http://stackoverflow.com/q/23557507
answer count: 2
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/23558985
favorite count: 0
has title: @Transactional not woking in JPA entity
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36146576
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/36146612
score: 1
tagged with: java
tagged with: hibernate
has body: I have a static method in the entity @Transactional public static void updateState() { entityManager().createNativeQuery("UPDATE TABLEA SET hide = 1 WHERE id= 1").executeUpdate(); } But when I call the method, I catch a exception say the update statement need a transaction. Am I using the @Transactional in the wrong way?
type: Question
has answer: http://stackoverflow.com/a/23557681

http://stackoverflow.com/a/23464323
type: Answer
answers question: http://stackoverflow.com/q/23464259
score: 0
has body: This line.equalsIgnoreCase(" ") may cause problems, try line.trim().isEmpty() instead

http://stackoverflow.com/a/23463742
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23462309
downvote count: 0
type: Answer
has body: The solution was changing the HibernateUtil.java: import org.hibernate.*; import org.hibernate.cfg.*; @SuppressWarnings("deprecation") public class HibernateUtil { public static final SessionFactory sessionFactory; static { try { // Création de la SessionFactory à partir de hibernate.cfg.xml sessionFactory = new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } @SuppressWarnings("rawtypes") public static final ThreadLocal session = new ThreadLocal(); public static SessionFactory getSessionFactory() { return sessionFactory; } } And the jar liste is:

http://stackoverflow.com/comment/36072087
comment on: http://stackoverflow.com/q/23517186
type: Comment
type: QuestionComment
has text: yes, so this should return false, but i am getting true for this case. for all the cases i am getting true.
score: 0

http://stackoverflow.com/q/23504217
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36048158
has answer: http://stackoverflow.com/a/23538971
tagged with: java
has comment: http://stackoverflow.com/comment/36047594
type: Question
has body: my Q is pretty straightforward. I can't figure the way to modify properties of the currently active window from my service. I saw some threads here on stack, also elsewhere, but none of them really answers. The foreground (active) activity can be just anything. I have no access to it. This guys seems to ask same Q, getting no A... How to get the foreground activity instance? Many thanx in advance !
has answer: http://stackoverflow.com/a/61414163
upvote count: 2
has comment: http://stackoverflow.com/comment/127316049
answer count: 2
has comment: http://stackoverflow.com/comment/127297536
tagged with: window
linked to: http://stackoverflow.com/q/16783359
tagged with: android-activity
tagged with: service
favorite count: 0
has title: How do I get active window that is on foreground?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36047322
tagged with: android
has comment: http://stackoverflow.com/comment/127247877
has comment: http://stackoverflow.com/comment/36048211
linked to: http://stackoverflow.com/q/10826579

http://stackoverflow.com/q/23593584
has comment: http://stackoverflow.com/comment/36218283
has comment: http://stackoverflow.com/comment/36213515
has comment: http://stackoverflow.com/comment/36218239
favorite count: 0
has answer: http://stackoverflow.com/a/23593804
has comment: http://stackoverflow.com/comment/36218247
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23593936
upvote count: 1
downvote count: 1
type: Question
has title: Comparing dates manually Java
has body: I would like to compare two dates from either a string or parameter, parameter and parameter, or string and string in a class without using SimpleDateFormat or Date libraries, as well as testing. I have my constructors and getters all set and tested. This is what I have for pseudo code. public static void compare(int d, int m, int y) If year in c1 is greater than c2, print c2 is earlier than c1 Else if month in c1 is greater than c2, print c2 is earlier than c1 Else if day in c1 is greater than c2, print c2 is earlier than c1 I'm not sure as to how I would compare two examples when each part of the date is already split up. I have a string method which takes the input as a string and parses that. Also the method should be called in another program, how would I call it in this instance where there are two variables being used?
has comment: http://stackoverflow.com/comment/36213643
has comment: http://stackoverflow.com/comment/36213862
has answer: http://stackoverflow.com/a/23593836
tagged with: java
score: 0
answer count: 3

http://stackoverflow.com/comment/36023813
comment on: http://stackoverflow.com/q/23492233
has text: ${resultEmployeeList} this list in request scope... I hope you are setting in the controller
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23550412
type: AnsweredQuestion
tagged with: reflection
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23556859
has body: While browsing through the Netty code base I came across below code block in NioEventLoop.java. SelectedSelectionKeySet selectedKeySet = new SelectedSelectionKeySet(); Class&lt;?&gt; selectorImplClass = Class.forName("sun.nio.ch.SelectorImpl", false, PlatformDependent.getSystemClassLoader()); // Ensure the current selector implementation is what we can instrument. if (!selectorImplClass.isAssignableFrom(selector.getClass())) { return selector; } Field selectedKeysField = selectorImplClass.getDeclaredField("selectedKeys"); Field publicSelectedKeysField = selectorImplClass.getDeclaredField("publicSelectedKeys"); selectedKeysField.setAccessible(true); publicSelectedKeysField.setAccessible(true); selectedKeysField.set(selector, selectedKeySet); publicSelectedKeysField.set(selector, selectedKeySet); selectedKeys = selectedKeySet; Why Netty uses reflection to change a member of java library class sun.nio.ch.SelectorImpl? I see one advantage instead of using Set from java collections it uses array based Set, which I believe will be faster. Is there any other specific reason for that ?
tagged with: nio
has title: Why Netty uses reflection to replace members in sun.nio.ch.SelectorImpl class with array based set?
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23556859
upvote count: 2
tagged with: netty
has comment: http://stackoverflow.com/comment/36137952
score: 2

http://stackoverflow.com/a/23525835
score: 0
answers question: http://stackoverflow.com/q/23525545
type: Answer
has comment: http://stackoverflow.com/comment/36087685
has body: Try refactoring a package in your project then trying it again. Could also be a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=357127 Which version are you using?

http://stackoverflow.com/q/23491595
has comment: http://stackoverflow.com/comment/36030357
has comment: http://stackoverflow.com/comment/36029628
score: 5
accepted answer: http://stackoverflow.com/a/23496806
tagged with: spring
answer count: 1
tagged with: spring-mvc
has title: Spring override properties at runtime and keep them persistent
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/36031707
has comment: http://stackoverflow.com/comment/36030613
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23496806
favorite count: 0
type: Question
has body: I am using Spring 3.2.8 and keep my settings in a properties file. Now I want some of them override at runtime. ​​I want to keep the new values persistent by overwriting the old values in the properties file​​. How can I do this in Spring? Some properties ​​I inject with @ Value and others get with MessageSource.getMessage(String, Object [], Locale). The beans are already instantiated with these values​​. How can I access the properties, store them and update all beans system wide? Thanks!
has comment: http://stackoverflow.com/comment/36030279

http://stackoverflow.com/a/23522998
downvote count: 0
has comment: http://stackoverflow.com/comment/36083065
has comment: http://stackoverflow.com/comment/36083034
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23522965
answers question: http://stackoverflow.com/q/23522965
type: Answer
score: 3
has body: Because you're checking if it contains the id, which will be autoboxed to Integer: productTypes.contains(p.getId())); You should send the ProductType instead: productTypes.contains(p);

http://stackoverflow.com/comment/36069718
comment on: http://stackoverflow.com/a/23516823
has text: i didnt test it in xperia. But i think it will start
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36061606
has text: I understood that but dayList.add("Wednesday"); and dayList.add("Thursday"); are done before iteration, how this is linked with exception and as per link http://javarevisited.blogspot.in/2014/01/ow-to-remove-objects-from-collection-arraylist-java-iterator-traversing.html ,it should throw exception in my case.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23511240
type: Comment

http://stackoverflow.com/q/23560232
has comment: http://stackoverflow.com/comment/36153767
accepted answer: http://stackoverflow.com/a/23569699
has title: Jooq - Date column with time
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36151364
favorite count: 0
tagged with: jooq
upvote count: 2
has body: In my oracle database, in a table, I have a Date column. I fetch it using jooq, its a simple select query. The jooq fetches the column value, but without time. Have I missed any configurations?
tagged with: jdbc
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29440278
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/29440278
has answer: http://stackoverflow.com/a/23569699

http://stackoverflow.com/comment/36154312
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23561882
type: AnswerComment
has text: Now, a last question would be interesting: how can I tell spring to look for the application.properties outside of the classpath, so that in production I can create a local `application.properties` file somewhere that always overrides any existing settings with `spring.profiles.active=prod`?

http://stackoverflow.com/comment/36070986
has text: array with 8 element cannot contain 9 element, check sizes
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23517415
score: 1

http://stackoverflow.com/comment/36053991
type: AnswerComment
comment on: http://stackoverflow.com/a/23507876
type: Comment
has text: The problem is that I don't know how many times the user will repeat the process or what is the n value (maximum number).
score: 0

http://stackoverflow.com/comment/36655969
type: Comment
has text: The regex will only return the first segment for filenames with more than one dot, e.g. "core/pages/viewemployee.jsff.bak".
comment on: http://stackoverflow.com/a/23557939
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36203782
type: Comment
comment on: http://stackoverflow.com/a/23588147
has text: A point that the OP could have easily determined by reading the description of printStackTrace.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36243434
comment on: http://stackoverflow.com/a/23552046
type: AnswerComment
score: 0
type: Comment
has text: I think the only way is using SPARQL Query to do what I want.

http://stackoverflow.com/comment/35976540
type: AnswerComment
type: Comment
has text: thanks for the answer JB . This is working as you suggested and adding this : ` true ` in appengine-web.xml file.
comment on: http://stackoverflow.com/a/23460145
score: 0

http://stackoverflow.com/comment/36117851
comment on: http://stackoverflow.com/q/23542082
has text: Will do! Thank you for your feed back - I'm new to this and appreciate you looking into this for me.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36219709
comment on: http://stackoverflow.com/a/23596517
score: 0
has text: @user1905568 what is the error? post the stacktrace could be a problem in `Result.java`
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35969504
comment on: http://stackoverflow.com/q/23462518
has text: When I did the code formatting, I had to comment that bit out, as IntelliJ would stumble on it forever if I didn't. I hope you have that commented out in your code.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36202819
type: AnswerComment
has text: If you can't understand what would be happening, use the debugger to help you.
score: 0
comment on: http://stackoverflow.com/a/23587629
type: Comment

http://stackoverflow.com/comment/35968077
comment on: http://stackoverflow.com/q/23461489
score: 0
has text: @Pshemo I do believe he indicated in his original post that it is a requirement of his assignment to read the characters as `int` directly from the file. (Hence my answer which references the no-arg `read()` method.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36102934
type: Comment
type: QuestionComment
has text: Isn't "ENG" present in both arrays as well?
score: 0
comment on: http://stackoverflow.com/q/23533952

http://stackoverflow.com/q/23486786
tagged with: export-to-excel
type: Question
score: 3
has answer: http://stackoverflow.com/a/23537742
tagged with: displaytag
downvote count: 0
answer count: 1
favorite count: 0
has title: How to export excel file with xlsx extension in displaytag
type: AnsweredQuestion
has body: We used displaytag for exporting the files in xls format but I want it in xlsx format. Is there any way to convert the excel file to new format? I change the extension in display tag from xls to xlsx &lt;display:setProperty name="export.excel" value="true"/&gt; &lt;display:setProperty name="export.excel.filename" value="assignedUserGroup.xlsx" /&gt; but it gives me "File extension is not valid" when I opened it in office 2007 or 2010.
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/23537742
tagged with: excel

http://stackoverflow.com/comment/36145013
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23556608
has text: try putting your code under onAttach Fragments take some time to attach to activity. Till this happens, sometimes we get NullPointerException

http://stackoverflow.com/comment/36219937
type: Comment
has text: Did you try removing the `produces` attribute?
comment on: http://stackoverflow.com/q/23596697
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36129503
comment on: http://stackoverflow.com/a/23548433
has text: @Sergiu Then call Long.parseLong in the same way.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/23518466
type: Answer
accepted answer of: http://stackoverflow.com/q/23517186
answers question: http://stackoverflow.com/q/23517186
has comment: http://stackoverflow.com/comment/36076806
has body: You're ignoring the return value of isBinaryBST in the recursive calls, so the function just returns whether the root's children is correct. But the way you tried to solve the problem fundamentally won't work. Take this tree: 5 / 3 \ 7 It's not a valid BST, as 7 &gt; 5. There's no way you can check for this by only looking at the direct children. The recommended approach would be passing in a min and max to your function, i.e. the signature would be: boolean isBinaryBST(Node node, int min, int max) And simply checking whether the current node's value is between the two (or the node is null) (no need for helper functions), and making the appropriate recursive calls to the children (and remember to check their return values!). The general idea would be: (pseudo-code) return (current node is between min and max) &amp;&amp; (left subtree is okay, i.e. recursive call with left child) &amp;&amp; (right subtree is okay, i.e. recursive call with right child) I'll leave the exact details to you to work out. In the above example, when we get to 7, min = 3 and max = 5, so we see that 7 &gt; max, and return false.
has comment: http://stackoverflow.com/comment/36078224
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36077060
score: 0

http://stackoverflow.com/comment/35953285
has text: @user3580294 No unfortunately there is no constructor that accepts a `Character` array.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23453869
type: AnswerComment

http://stackoverflow.com/comment/36059597
comment on: http://stackoverflow.com/q/23511110
score: 0
type: QuestionComment
type: Comment
has text: @Totò : thanks mate but i can not use it as the output is further processed!! :)

http://stackoverflow.com/a/54498229
score: 2
downvote count: 0
upvote count: 2
has body: This is how to do it in android. Took awhile to figure out. The documentation gives few examples[for this]. SpreadsheetProperties properties = new SpreadsheetProperties(); properties.setTitle(calendar.getTime().toString()); Spreadsheet requestBody = new Spreadsheet(); GridProperties gridProperties = new GridProperties(); gridProperties.setFrozenRowCount(2); SheetProperties sheetProperties = new SheetProperties(); sheetProperties.setTitle("my new sheet"); sheetProperties.setGridProperties(gridProperties); Sheet sheet = new Sheet(); sheet.setProperties(sheetProperties); List&lt;Sheet&gt; sheets = new ArrayList&lt;&gt;(); sheets.add(sheet); requestBody.setSheets(sheets); requestBody.setProperties(properties);
answers question: http://stackoverflow.com/q/23565275
type: Answer

http://stackoverflow.com/comment/35997110
comment on: http://stackoverflow.com/a/23477151
type: Comment
has text: Looks like Mati beat me to the punch.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35995986
type: QuestionComment
type: Comment
score: 1
has text: Please be more specific about the error message. Particularly, does it say which two types were incompatible?
comment on: http://stackoverflow.com/q/23477117

http://stackoverflow.com/a/23530396
downvote count: 1
answers question: http://stackoverflow.com/q/23530372
has body: Yes, a return statement should be the last statement in a block of code. If it's not, then any code below it won't ever be reached, because the return statement transfers control to the method that called the current method (or to a finally block first, if it exists). There is no point to code in a block after a return statement, so it's disallowed.
score: 1
type: Answer
upvote count: 2

http://stackoverflow.com/comment/36324630
comment on: http://stackoverflow.com/q/23593167
type: Comment
type: QuestionComment
has text: May i know the reason to Down vote my Question ?
score: 0

http://stackoverflow.com/comment/36079025
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23520690
has text: @Snedden27 - I have updated my answer with some additional information that should help.
type: AnswerComment

http://stackoverflow.com/q/23485916
accepted answer: http://stackoverflow.com/a/23485940
tagged with: servlets
has comment: http://stackoverflow.com/comment/36013079
has comment: http://stackoverflow.com/comment/36013037
type: Question
has answer: http://stackoverflow.com/a/23712794
has body: I am trying to pass basic values such as id from jsp to the servlet through ajax. I tried everything but only null is being passed. Even console.log(val) does not print anything to browser console. My understanding is: Web page has form values which onsubmit calls js file. js has ajax which calls the servlet and passes the data of the form. The servlet grabs data from ajax by request.getParameter(val) Here is my code: Main.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here Enter name: main.js var form = $('#firstform'); console.log("gi"); form.submit(function() { $.ajax({ url: 'Main', data: form.serialize(), type: 'post', success: function(data){ console.log(data); } }); //return false; }); Main.java package servlets; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class Main */ @WebServlet("/Main") public class Main extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public Main() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub int ids; response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String val = request.getParameter("id"); System.out.print(val); if(val != null){ ids = Integer.parseInt(val); out.print(ids); // } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, …
downvote count: 0
tagged with: jsp
tagged with: jquery
tagged with: ajax
has title: Java ajax passing values from jsp to servlet
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/23485940
has answer: http://stackoverflow.com/a/23485981
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/36016770
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23485981
has comment: http://stackoverflow.com/comment/36012847
has comment: http://stackoverflow.com/comment/36012870
tagged with: java

http://stackoverflow.com/comment/36084096
score: 0
type: AnswerComment
type: Comment
has text: This will not display all the views proportionally.
comment on: http://stackoverflow.com/a/23524067

http://stackoverflow.com/a/23572557
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Following is not an HQL but a native SQL - select userId, userName from User_table where userId = :id And it gives you a list of Object[], array of objects, and not a list of Users. So, you need to change the following - List&lt;User&gt; list = query.list(); to List&lt;Object[]&gt; list = query.list(); And also change the following user = list.get(0); to Object[] row = list.get(0); Now, immediately after the above line, you can populate the User object that you instantiated at the beginning as follows - user.setUserId((Integer)row[0]); user.setUserName((String)row[1]);
has comment: http://stackoverflow.com/comment/36181489
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23572168
accepted answer of: http://stackoverflow.com/q/23572168

http://stackoverflow.com/comment/36171625
score: 0
type: QuestionComment
type: Comment
has text: It is static. I updated original post and added the whole code. In earlier version, my build method was static, but now I managed to make it works if it's not static. Does this look ok, or it could be improved?
comment on: http://stackoverflow.com/q/23554127

http://stackoverflow.com/a/23561635
has body: where is this setWorkingLineQty("21"); method defined? in the same class? You can pass arguments in the doMessageDataOverrides() method as public class ABC extends LineAvailabilityNew { public void doMessageDataOverrides(String x, String y) throws MessageHandlerExcection { super.doMessageDataOverrides(); setWorkingLineQty(x); setStoppedLineQty(y); } }
answers question: http://stackoverflow.com/q/23561456
type: Answer
score: 0

http://stackoverflow.com/comment/36003621
type: Comment
type: QuestionComment
has text: Because you already stored the value returned by length in the both variables. This is not Excel!
comment on: http://stackoverflow.com/q/23480911
score: 4

http://stackoverflow.com/comment/36071168
score: 1
has text: @gstackoverflow: If `MyOtherClass` exposes the getter `getX` and data member `x`, and `getX` doesn't get the value of `x`, `MyOtherClass` is broken. :-) (Some would argue it's broken anyway.) Polymorphism is a reason *to* use the getter, not a reason *not* to.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23517314

http://stackoverflow.com/a/23607403
has body: Equals method for strings There are several issues here. First == should not be used to compare strings. You should use string.equals(otherString); Contatinating words Second you appear to be combining words when you want to combine values prodCheck2 = "tempProd1" + "tempProd2" + "tempProd3" + "tempProd4" + "tempProd5" + "tempProd6; will give prodCheck2 = "tempProd1tempProd2tempProd3tempProd4tempProd5tempProd6"; always. The fact that those words happen to have the same name as some of your variables makes no difference to java. There are many better ways to concatenate integers. But the easiest is probably as follows prodCheck2 = tempProd1 + "" + tempProd2 + "" +tempProd3 + "" +tempProd4 + "" +tempProd5 + "" +tempProd6"; Using while when for would be better while (num1 &lt; 1000){ while (num2 &lt; 1000){ ...... num2++; } num1++; } This code never decreases num2, which means num2 goes 1->1000 for num1=0 and then stays at 1000 from then on. I'm guessing this isn't what you want. We could fix the while loop but really this is what a for loop is for for(int num1=0;num1&lt;1000;num1++){ for(int num2=0;num2&lt;1000;num2++){ //code as before, no need to inciment or reset num1 or num2 inside the loop } } Issues that don't break your code You're declaring all your variables with very large scope. For example tempProd1 is declared outside all the loops depite only being needed inside the inner loop. Declare variables in the smallest scope possible. This will catch bugs like those we've found here. Critically num2 couldn't have accidently been made non resetting if you'd delared it within the first loop
accepted answer of: http://stackoverflow.com/q/23607269
answers question: http://stackoverflow.com/q/23607269
has comment: http://stackoverflow.com/comment/36239908
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/23593966
has title: How to check the order of the elements in an array
has comment: http://stackoverflow.com/comment/36214356
has answer: http://stackoverflow.com/a/23594102
type: Question
tagged with: arrays
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36214350
downvote count: 3
has comment: http://stackoverflow.com/comment/36214688
upvote count: 0
has body: How to check the order of the elements in an array ? Like i have two arrays, and the program must check if all the elements in the first one are in the same order as of second one, BUT it's fine if some elements in between are skipped Like, String[] expected = { "a", "b", "c", "d", "e", "f", "g" }; String[] actual = { "a", "b", "d", "e" }; The above one is fine. But this below one must fail: String[] actual = { "a", "b", "c", "e", "d" }; I Have tried the below looks fine but is there a bettwe way: boolean matching = false; int e = 0; int a = 0; // 0 1 2 3 4 5 6 String[] expected = { "a", "b", "c", "d", "e", "f", "g" }; String[] actual = { "a", "b", "d" ,"g","c"}; while (a &lt; 5) { if (actual[a].equals(expected[e])) { matching = true; if(e&lt;6){ a++; e++; } else{ matching = false; break; } } else { if (e &lt; 6) e++; else break; matching = false; } } if (matching) System.out.println("seems alright"); else System.out.println("No");
type: UnansweredQuestion
score: -3
tagged with: java

http://stackoverflow.com/a/62302963
answers question: http://stackoverflow.com/q/23488221
has body: Simple, You can also use below code in poi 4.1.1 cell.setCellValue(Double.parseDouble(yourvalue));
score: 0
type: Answer

mousemotionlistener
type: Tag
tags question: http://stackoverflow.com/q/23484255
tag name: mousemotionlistener

http://stackoverflow.com/a/23606500
has body: When you read the excel file in your servlet, you should read that file a UTF8 stream. Then, when you insert the data into database, the connection you used for inserting must declare as a UTF8 connection, for an example DriverManager.getConnection( "jdbc:mysql://"+host+"/"+dbName+"?useUnicode=true&amp;characterEncoding=UTF-8",user,pass);
type: Answer
answers question: http://stackoverflow.com/q/23605720
score: 0

sax
tags question: http://stackoverflow.com/q/23584156
tags question: http://stackoverflow.com/q/23544180
tag name: sax
tags question: http://stackoverflow.com/q/23559868
type: Tag

http://stackoverflow.com/a/23579768
answers question: http://stackoverflow.com/q/23579737
downvote count: 0
has body: This is what reflection is for. Before ruling it out, I'd suggest giving it a try and seeing whether, on any JVM from the last several years, you actually see any performance issue related to it. I suspect you won't. Your only other real option (actually, there's cglib; see this other answer for more, and why you may not want to use it) is a method that you let people call, pass in the name of the method to call, and then dispatch to that method (e.g., with a big switch, or a dispatch table, or similar). E.g.: public Object callMethod(String methodName, Object[] args) { switch (methodName) { // Using strings in `switch` requires a recent version of Java case "foo": return this.foo(args[0]); case "bar": this.bar(args[0], args[1]); return null; // ...and so on... default: throw new AppropriateException(); } }
has comment: http://stackoverflow.com/comment/36191296
has comment: http://stackoverflow.com/comment/74293302
score: 6
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/36191101

http://stackoverflow.com/q/23591731
answer count: 2
downvote count: 0
favorite count: 0
tagged with: android
has body: Eclipse format my code this way, means it puts the parameters one different lines: nearByLocationsArray = getAddress( currentLocation.getLatitude(), currentLocation.getLongitude(), 10).toArray( new String[nearbyLocations.size()]); nearbyLocations = gCoder.getFromLocation(latitude, longitude, maxResults); However, I seriously don’t like that I want to keep it simple like this in one line: nearByLocationsArray = getAddress(currentLocation.getLatitude(),currentLocation.getLongitude(), 10).toArray(new String[nearbyLocations.size()]); nearbyLocations = gCoder.getFromLocation(latitude, longitude,maxResults); I tried looking for the appropriate option in the formatting settings but couldn't find, can anyone please help me in setting this up, please.
possible better answer: http://stackoverflow.com/a/23591902
linked to: http://stackoverflow.com/q/3697287
has answer: http://stackoverflow.com/a/23591902
has answer: http://stackoverflow.com/a/23592140
upvote count: 1
has title: Eclipse putting each parameter on new lines, how to stop this formatting
has comment: http://stackoverflow.com/comment/36210330
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/23592140

http://stackoverflow.com/comment/36239199
score: 0
type: AnswerComment
type: Comment
has text: Thanks Thomas. At the moment I'm just trying to create a simple java application, so I think your indications should be enough for now. The JARs I was looking at did not have a pom.xml packed with them but a plugin.xml, which made me think they couldn't be used in Maven (directly). Cheers for the help, much clear now.
comment on: http://stackoverflow.com/a/23606764

http://stackoverflow.com/a/23581726
downvote count: 1
answers question: http://stackoverflow.com/q/23564049
has comment: http://stackoverflow.com/comment/36200485
type: Answer
has comment: http://stackoverflow.com/comment/36227846
has body: The Akka docs you reference state that the happens-before rules only apply to the same actor. So if you send a message from one sender actor to a different receiver actor, the happens-before rules don't apply. Also, as your code base evolves over time, it's going to be increasingly difficult to "make sure" that the only actor who every modifies that Map is the original sender. Why not create a new immutable Map in the original sender, or any other place you modify the message contents before sending it to another actor? Then you'll be 100% sure that no other actors can modify the message they've received, and you'll have easily avoided any concurrency problems.
has comment: http://stackoverflow.com/comment/36233769
score: 0
has comment: http://stackoverflow.com/comment/36202554
upvote count: 1

http://stackoverflow.com/q/23595210
accepted answer: http://stackoverflow.com/a/23595423
downvote count: 1
type: Question
tagged with: indexoutofboundsexception
score: -1
has title: StringIndexOutOfBoundsException when using delimiter
upvote count: 0
answer count: 1
tagged with: string
has answer: http://stackoverflow.com/a/23595423
favorite count: 0
tagged with: delimiter
has body: I want to split a string into multiple parts based on parentheses. So if I have the following string: In fair (*NAME OF A CITY), where we lay our (*NOUN), The string should be split as: In fair *NAME OF A CITY , where we lay our *NOUN I set up a delimiter like so: String delim = "[()]"; String [] inputWords = line.split (delim); Because the strings in all caps with an * at the beginning are going to be replaced with user input, I set up a loop like so: while (input.hasNextLine()) { line = input.nextLine(); String [] inputWords = line.split (delim); for (int i = 0; i &lt; inputWords.length; i++) { if (inputWords[i].charAt(0) != '*') { newLine.append (inputWords[i]); } else { String userWord = JOptionPane.showInputDialog (null, inputWords[i].substring (1, inputWords[i].length())); newLine.append (userWord); } } output.println (newLine.toString()); output.flush(); newLine.delete (0, line.length()); } Looks like I'm getting an error with this if statement: if (inputWords[i].charAt(0) != '*') When I run it, I get a StringIndexOutOfBoundsException: String index out of range: 0. Not sure why that's happening. Any advice? Thank you!
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/23583679
answers question: http://stackoverflow.com/q/23583574
has comment: http://stackoverflow.com/comment/36196669
upvote count: 2
has comment: http://stackoverflow.com/comment/36196001
has comment: http://stackoverflow.com/comment/36196262
has body: You need to specify the -XstartOnFirstThread option when you run an SWT app on MAc OS X.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/36092315
type: Comment
has text: I have added the info requested :) please bump, as this answer is more direct than the one above. Thanks @Philip
comment on: http://stackoverflow.com/a/23479076
score: 1
type: AnswerComment

http://stackoverflow.com/q/23487754
has title: Android - Check if Runnable is running
tagged with: android
has body: I want to check if either the Runnable is alive or not in my service. Is there a way i could do this? private Runnable sendData = new Runnable() { public void run() { try { superToast.show(); screenOn(); vibrate(); mHandler.postDelayed(sendData, time); } catch (Exception e) { e.printStackTrace(); } } };
tagged with: service
upvote count: 5
tagged with: multithreading
type: AnsweredQuestion
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23487806
tagged with: eclipse
type: Question
score: 5
answer count: 1
has answer: http://stackoverflow.com/a/23487806
favorite count: 0

http://stackoverflow.com/comment/36218882
score: 4
comment on: http://stackoverflow.com/q/23596230
type: Comment
has text: Did you import `java.sql.Date` instead of `java.util.Date`?
type: QuestionComment

http://stackoverflow.com/comment/36017257
score: 0
comment on: http://stackoverflow.com/q/23488221
type: Comment
type: QuestionComment
has text: possible duplicate of [how to remove warnings in excel generated by POI ?](http://stackoverflow.com/questions/9229644/how-to-remove-warnings-in-excel-generated-by-poi)

http://stackoverflow.com/comment/36195375
type: Comment
type: QuestionComment
has text: Looks like exercise. Show your attempts and we will help you on that basis.
comment on: http://stackoverflow.com/q/23583686
score: 0

http://stackoverflow.com/comment/36006171
comment on: http://stackoverflow.com/q/23476427
score: 0
type: QuestionComment
type: Comment
has text: @geoand done. Although spring-boot tag has ~300 questions :(

testng
tags question: http://stackoverflow.com/q/23479580
tags question: http://stackoverflow.com/q/23518502
tags question: http://stackoverflow.com/q/23520496
tags question: http://stackoverflow.com/q/23501191
tag name: testng
tags question: http://stackoverflow.com/q/23471424
tags question: http://stackoverflow.com/q/23567410
tags question: http://stackoverflow.com/q/23540121
tags question: http://stackoverflow.com/q/23587082
type: Tag
tags question: http://stackoverflow.com/q/23474790

http://stackoverflow.com/comment/36045981
comment on: http://stackoverflow.com/q/23503622
score: 2
type: Comment
has text: This sounds like a school assignment. Please share the objective. At this point even your loop isn't quite correct.
type: QuestionComment

http://stackoverflow.com/q/23472950
tagged with: xwpf
downvote count: 0
has title: Can not resolve xwpf
has comment: http://stackoverflow.com/comment/35988667
has comment: http://stackoverflow.com/comment/35988161
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23473028
upvote count: 2
tagged with: maven
score: 2
type: AnsweredQuestion
tagged with: apache-poi
tagged with: java
type: Question
has body: I'm trying to use POI to convert word files to the txt files , but when i use org.apache.poi.xwpf.usermodel.XWPFDocument it tells me that "cannot resolve xwpf" my pom.xml : <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 convert convertor 1.0-SNAPSHOT org.apache.poi poi 3.10-FINAL org.apache.xmlbeans xmlbeans 2.6.0 When I run clean & package it gives me success. How can I resolve this problem?
has answer: http://stackoverflow.com/a/23473028

http://stackoverflow.com/a/23511240
has comment: http://stackoverflow.com/comment/36066325
has comment: http://stackoverflow.com/comment/36066011
has body: Well add a Thursday and you would start getting the exception again :) List dayList= new ArrayList(); dayList.add("Sunday"); dayList.add("Monday"); dayList.add("Tuesday"); dayList.add("Wednesday"); dayList.add("Thursday"); // Added by Kuldeep dayList.remove("Tuesday"); Iterator itr=dayList.iterator(); while(itr.hasNext()) { Object testList=itr.next(); if(testList.equals("Monday")) { dayList.remove(testList); } } System.out.println(dayList); So essentially that is because The fail-fast behavior of an iterator cannot be guaranteed. Fail-fast iterators throw ConcurrentModificationException on a best-effort basis. Look at the documentation here. EDIT : The exception is not thrown in your case is because in the following code: if(testList.equals("Monday")) { dayList.remove(testList); } you are removing the second last element, which actually change the size or the dayList from 3 to 2. So the itr.hasNext() returns false after Monday is removed from the list and hence does not go into the loop for last entry i.e. Wednesday and avoids the call to itr.next(). You may try debugging the code to verify this behavior.
has comment: http://stackoverflow.com/comment/36061606
downvote count: 0
has comment: http://stackoverflow.com/comment/36064376
type: Answer
has comment: http://stackoverflow.com/comment/36064127
answers question: http://stackoverflow.com/q/23510754
upvote count: 1
has comment: http://stackoverflow.com/comment/36061351
score: 1
has comment: http://stackoverflow.com/comment/36060643

http://stackoverflow.com/q/23518180
has body: I am trying to make a game involving the calcualtion of forces needed to perform some simple mathematical operations. I have a dx variable that represents both the speed and direction along the X-axis. Now I want to subtract friction but it would have to be an addition if the direction of dx is negative. Is there any way to subtract friction from dx using absolute values while returning a signed value? I was looking in to bitwise operators but I have no idea what the possibilities are... What I could do (i think): sign = ( dx &gt;&gt; 31 ) &lt;&lt; 31; dx = (dx &lt;&lt; 1) &gt;&gt; 1; dx = ( dx - friction ) &amp; sign; Not sure if this would work, just the idea... Any improvements? Edit: this is what I did: dxSign = Integer.signum(dx) * -1; dySign = Integer.signum(dy) * -1; dy = Math.abs(dy); dx = Math.abs(dx); fric = body.friction * mass; dx = ( dx &gt; fric ) ? dx - fric : 0; dy = ( dy &gt; fric ) ? dy - fric : 0; dx = dx * absorption; dy = dy * absorption; dx *= dxSign; dy *= dySign;
type: Question
has answer: http://stackoverflow.com/a/23526697
tagged with: sign
linked to: http://stackoverflow.com/q/11227809
has answer: http://stackoverflow.com/a/23518459
has answer: http://stackoverflow.com/a/23518220
favorite count: 0
score: -1
tagged with: integer
has answer: http://stackoverflow.com/a/23518568
has title: Java: Perform mathematical operation while ignoring sign
answer count: 5
type: UnansweredQuestion
tagged with: bit-manipulation
downvote count: 2
has answer: http://stackoverflow.com/a/23518516
tagged with: math
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/36204816
score: 0
type: Comment
type: QuestionComment
has text: This question is a little broad... Stack Overflow isn't supposed to do the heavy lifting for you; it's more if you have a specific question about your code that you're stuck on. Is there some kind of behavior you're looking for that you're missing? It sounds like you haven't tried running it yourself, the way your question is currently worded.
comment on: http://stackoverflow.com/q/23588618

http://stackoverflow.com/q/23539180
has comment: http://stackoverflow.com/comment/36112717
has comment: http://stackoverflow.com/comment/36112277
linked to: http://stackoverflow.com/q/2346306
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36113116
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/36113847
type: Question
has comment: http://stackoverflow.com/comment/36112781
has title: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2
has body: This is my javax.swing class. But it always throws the error java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2. Not quite sure what is causing it. Where is the error? import java.awt.event.*; import java.awt.*; import java.sql.*; import javax.swing.*; public class SwingSearchApp extends JFrame implements ActionListener { //Initializing Components private static final long serialVersionUID = 1L; JLabel lb, lb1, lb2, lb3, lb4, lb5; JTextField tf1, tf2, tf3, tf4, tf5; JButton btn; //Creating Constructor for initializing JFrame components SwingSearchApp() { //Providing Title super("Fetching Student Information"); lb5 = new JLabel("Enter Name:"); lb5.setBounds(20, 20, 100, 20); tf5 = new JTextField(20); tf5.setBounds(130, 20, 200, 20); btn = new JButton("Submit"); btn.setBounds(50, 50, 100, 20); btn.addActionListener(this); lb = new JLabel("Fetching Search Information From Database"); lb.setBounds(30, 80, 450, 30); lb.setForeground(Color.red); lb.setFont(new Font("Serif", Font.BOLD, 20)); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(500, 500); lb1 = new JLabel("U_Name:"); lb1.setBounds(20, 120, 100, 20); tf1 = new JTextField(50); tf1.setBounds(130, 120, 200, 20); lb2 = new JLabel("U_Mail:"); lb2.setBounds(20, 150, 100, 20); tf2 = new JTextField(100); tf2.setBounds(130, 150, 200, 20); lb3 = new JLabel("U_Pass:"); lb3.setBounds(20, 180, 100, 20); tf3 = new JTextField(50); tf3.setBounds(130, 180, 200, 20); lb4 = new JLabel("U_Country:"); lb4.setBounds(20, 210, 100, 20); tf4 = new JTextField(50); tf4.setBounds(130, 210, 100, 20); setLayout(null); //Add components to the JFrame add(lb5); add(tf5); add(btn); add(lb); add(lb1); add(tf1); add(lb2); add(tf2); add(lb3); add(tf3); add(lb4); add(tf4); //Set TextField Editable False tf1.setEditable(false); tf2.setEditable(false); tf3.setEditable(false); tf4.setEditable(false); } public void actionPerformed(ActionEvent e) { //Create DataBase Coonection and Fetc…
has comment: http://stackoverflow.com/comment/36112981
has answer: http://stackoverflow.com/a/23540410
accepted answer: http://stackoverflow.com/a/23540410
score: 0
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/36112500
has comment: http://stackoverflow.com/comment/36113837
tagged with: ms-access

http://stackoverflow.com/q/23532007
tagged with: amazon-web-services
type: UnansweredQuestion
has title: vert.x replication over a cluster
answer count: 0
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/36103705
has comment: http://stackoverflow.com/comment/36101517
type: Question
has body: I want to user vert.x to implement a socket server. I will be using a cluster and I have one problem I can not figure out. If say I create a ConcurrentMap to store the socket connections on one verticle and this is accessed by the other verticles on other clusters, what happens if the node that is running the first verticle with the ConurrentMap crashes? Obviously I would lose all connections in the ConcurrentMap. How would I replicate this ConcurrentMap so that one is always ready in-case of a crash? I have looked over the documentation and there does not seem to be a solution for replication. The only solution I can think of is whenever there is a new socket connection to insert it into the concurrentMap and also create an in-memory redis database and insert a new socket connection there everytime. This though seems like too much overkill and to recover could take a lot of time if there are a lot of connections (millions). Is there any easier way?
tagged with: vert.x
tagged with: amazon-ec2

http://stackoverflow.com/a/23526580
has comment: http://stackoverflow.com/comment/36089539
answers question: http://stackoverflow.com/q/23526307
has comment: http://stackoverflow.com/comment/36089014
has body: When I run this, I can achieve stretching of each column by setting an explicit height on the `GridView. If you want this to be dynamic, I'd suggest setting an explicit height programatically.
type: Answer
has comment: http://stackoverflow.com/comment/36089515
score: 0

http://stackoverflow.com/comment/36019623
comment on: http://stackoverflow.com/q/23489824
has text: json-simple-1.1.1.jar lib used
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23525324
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/85096232
has body: Currently we don't have functionality like this available out of the box. You might want to have a look at the QueueStore/QueueLoader interface. It provides the same functionality for the Queue as the MapStore/MapLoader for the map. We are working on a disk based storage solution for all data-structures, but that isn't ready yet.
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23518116
answers question: http://stackoverflow.com/q/23518116

http://stackoverflow.com/a/23574594
score: 0
type: Answer
has body: Try getting the lastDate like this: String lastDate = cursor.getString(cursor.getColumnIndex(SqliteHelperInstance.COLUMN_DATE)); Also, you should use parameterized queries: int i = database.update(SqliteHelperInstance.TABLE_NAME, values,SqliteHelperInstance.COLUMN_DATE + " = ?", new String[]{ lastDate }); Other than that, I'm not sure what could be wrong.
answers question: http://stackoverflow.com/q/23574470
accepted answer of: http://stackoverflow.com/q/23574470
type: AcceptedAnswer

http://stackoverflow.com/comment/35967516
type: QuestionComment
comment on: http://stackoverflow.com/q/23461514
has text: I use `b = new BufferedReader(new FileReader("foo.txt"))`.
score: 0
type: Comment

http://stackoverflow.com/comment/77801000
type: Comment
comment on: http://stackoverflow.com/a/35135972
has text: Hm. That's weird. You could start by checking if the response code is 200 or something else.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23506787
possible better answer: http://stackoverflow.com/a/23506888
has answer: http://stackoverflow.com/a/23506888
tagged with: delimiter
accepted answer: http://stackoverflow.com/a/23506833
upvote count: 2
score: 2
type: AnsweredQuestion
has title: Deliminter is not working for scanner
tagged with: java
has body: The user will enter a=(number here). I then want it to cut off the a= and retain the number. It works when I use s.next() but of course it makes me enter it two times which I don't want. With s.nextLine() I enter it once and the delimiter does not work. Why is this? Scanner s = new Scanner(System.in); s.useDelimiter("a="); String n = s.nextLine(); System.out.println(n);
type: Question
has answer: http://stackoverflow.com/a/23506833
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/36022293
has text: thank you i will try that. i am also using another quiz with questions stored in sqlite. i have changed the questions on android studio and answers to ones that i want but when i run the app, the question and answer buttons still come up with the default suggestions. i found the template at developer feed and have checked the source folder and there is no sign of a database or sql in the folders. have you any ideas on how to remove? i can post a separate question if necessary.
type: AnswerComment
comment on: http://stackoverflow.com/a/23485518
type: Comment
score: 0

http://stackoverflow.com/a/23583314
upvote count: 0
answers question: http://stackoverflow.com/q/23582900
has body: I have a good solution without subscript... public class test{ int counter=0;int last; public static void main(String[] args){ test t1=new test(); //object of test String line="This is a working code"; //line in which char to be counted char c='q'; // char to be counted t1.last=line.length()-1; //setting last System.out.println("In sentence: "+line); if(t1.count(line, c)!=-1) System.out.println("The character "+c+" is "+t1.counter+" times"); //printing result else System.out.println("The character "+c+" is not found"); } public int count (String line, char c){ if (last&lt;0){ // case for empty string or nil char. return counter; // recursion ends here and return counted } else if(line.charAt(last)==c) { counter++; //counting } last--; //shitin last; count(line, c); return -1; //if even a single times is not found then return -1; } } It may help you...You may take line and char which is to be searched as input from Command prompt......Thank you....
score: -1
downvote count: 1
type: Answer

http://stackoverflow.com/comment/36216096
comment on: http://stackoverflow.com/a/23590545
type: Comment
has text: thank you for the answer, to clarify: the remote object is RMIServiceImpl? I added Unreferenced to it but the unreferenced() method is never called. What am I missing? thanks!
type: AnswerComment
score: 0

http://stackoverflow.com/a/66968550
answers question: http://stackoverflow.com/q/23535318
type: Answer
score: 0
has body: Run SOLR with command solr -f -a "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=4044" This run configuration:

http://stackoverflow.com/q/23513590
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/23519472
downvote count: 0
score: 7
tagged with: java
has body: I'm writing a postback handler library for a service that has some odd JSON mapping practices. I can very easily configure a custom Jackson ObjectMapper to handle the mapping, but if I register a Spring MVC message converter with that mapper, it applies the mapping (which is incorrect for the rest of the JSON I'm dealing with) to all incoming requests. There are a handful of manual approaches I can apply to hand-decode these messages, but it would be much cleaner to have the Spring type-conversion service handle it in the request pipeline. Is there a feasible way to attach a custom message converter to a specific controller, handler method, or mapping string/template/prefix?
type: Question
tagged with: type-conversion
upvote count: 7
answer count: 1
has title: Specify message converters for single Spring Controller
favorite count: 0
type: UnansweredQuestion
tagged with: spring

rdma
tags question: http://stackoverflow.com/q/23465538
type: Tag
tag name: rdma

http://stackoverflow.com/comment/36114746
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23540383
score: 0
has text: `conn = server.accept();` is blocking the EDT.

http://stackoverflow.com/comment/36235706
type: AnswerComment
has text: Thank you for your ideas. Could i not have an action listener that would automatically get the data from the user input panel and put it into the totals panel? The keylistener and focus stuff is above me.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23605227

http://stackoverflow.com/q/23458866
has answer: http://stackoverflow.com/a/23459368
accepted answer: http://stackoverflow.com/a/23458974
has body: I have a test tomorrow and I have a doubt about inheritance in java. Question: Suppose a program in java where Y is a subclass of X. Suppose that the following code is valid in the program: Y[] vetY = new Y[3]; X[] vetX = vety; Is the following assignment valid or not in this program? Justify. vetX[0] = new X(); My answer(not sure): It is not valid because vetX has the methods of Y and I don't know what was implemented in Y. So it can compile but it will not run.
has comment: http://stackoverflow.com/comment/35962672
favorite count: 0
possible better answer: http://stackoverflow.com/a/23459368
has title: Simple exercice Inheritance in Java
downvote count: 2
has comment: http://stackoverflow.com/comment/35962658
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35962315
has comment: http://stackoverflow.com/comment/35962892
tagged with: theory
type: Question
answer count: 2
upvote count: 0
score: -2
tagged with: inheritance
has answer: http://stackoverflow.com/a/23458974

http://stackoverflow.com/comment/36426952
has text: Then I'm afraid you'll have to live with this then. It's clearly somewhere hidden in your project, because a new project does not reproduce it.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23631998
type: Comment

http://stackoverflow.com/comment/35991865
has text: Thank you brother. Your's `temp` object was really a magic code.
type: Comment
comment on: http://stackoverflow.com/a/23474738
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36200926
comment on: http://stackoverflow.com/q/23586668
type: Comment
type: QuestionComment
has text: The Java Standard Library refers to the collection of classes provided by the Java language.
score: 0

http://stackoverflow.com/q/23501796
answer count: 2
tagged with: jpa
has answer: http://stackoverflow.com/a/23524226
has body: The following JPQL query is not returning results. How do I alter it so that it returns the results that are expected? @SuppressWarnings("unchecked") public Collection&lt;Description&gt; findDescriptionsForConcept(Concept conc) { System.out.println("in JpaSnomedRepository(), conc.getConceptPk().getId() is: "+conc.getConceptPk().getId());; Query query = this.em.createQuery("SELECT descr FROM Description descr WHERE descr.concept =:cid"); query.setParameter("cid", conc); return query.getResultList(); } NOTE: The solution was to change the name of one of the joincolumns in the manytoone relationship in the description class. But I am marking one of the answers below as accepted because the person invested a lot of time trying to help me.
has comment: http://stackoverflow.com/comment/36046387
favorite count: 0
tagged with: sql
downvote count: 0
possible better answer: http://stackoverflow.com/a/23524226
has comment: http://stackoverflow.com/comment/36085239
tagged with: spring
has title: JPQL query not returning expected results
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23502388
accepted answer: http://stackoverflow.com/a/23502388
type: Question
upvote count: 2

http://stackoverflow.com/comment/36090764
has text: excellent! I shall use `nextTime = new Date(Long.MIN_VALUE);`
type: Comment
comment on: http://stackoverflow.com/a/23527271
type: AnswerComment
score: 0

http://stackoverflow.com/q/23557786
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16982056
has comment: http://stackoverflow.com/comment/36149369
score: 1
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23557937
has comment: http://stackoverflow.com/comment/36150819
has answer: http://stackoverflow.com/a/23557805
accepted answer: http://stackoverflow.com/a/23557805
has title: How to get current date - two weeks date in Java?
has answer: http://stackoverflow.com/a/23558219
tagged with: date
upvote count: 2
duplicate of: http://stackoverflow.com/q/16982056
favorite count: 0
has answer: http://stackoverflow.com/a/23557821
has body: I have today's date in this string format 2014-05-08 and I needed to get the date of 2 weeks prior the currents date. So the data I should be getting back is - 2014-04-24. String currentDate= dateFormat.format(date); //2014-05-08 String dateBefore2Weeks = currentDate- 2 week; But I am not sure how do I extract date of two weeks prior to current date in Java?
possible better answer: http://stackoverflow.com/a/23558219

jsf
tags question: http://stackoverflow.com/q/23509079
tags question: http://stackoverflow.com/q/23465387
type: Tag
tags question: http://stackoverflow.com/q/23537657
tags question: http://stackoverflow.com/q/23526078
tags question: http://stackoverflow.com/q/23489342
tags question: http://stackoverflow.com/q/23466518
tags question: http://stackoverflow.com/q/23465050
tags question: http://stackoverflow.com/q/23566899
tags question: http://stackoverflow.com/q/23547208
tags question: http://stackoverflow.com/q/23600568
tags question: http://stackoverflow.com/q/23466541
tags question: http://stackoverflow.com/q/23465270
tags question: http://stackoverflow.com/q/23548924
tags question: http://stackoverflow.com/q/23560119
tags question: http://stackoverflow.com/q/23568156
tags question: http://stackoverflow.com/q/23610705
tags question: http://stackoverflow.com/q/23499690
tags question: http://stackoverflow.com/q/23528843
tags question: http://stackoverflow.com/q/23498619
tags question: http://stackoverflow.com/q/23475884
tags question: http://stackoverflow.com/q/23484152
tags question: http://stackoverflow.com/q/23540360
tags question: http://stackoverflow.com/q/23453944
tags question: http://stackoverflow.com/q/23611995
tag name: jsf
tags question: http://stackoverflow.com/q/23472726
tags question: http://stackoverflow.com/q/23541330
tags question: http://stackoverflow.com/q/23549142
tags question: http://stackoverflow.com/q/23525512
tags question: http://stackoverflow.com/q/23464297
tags question: http://stackoverflow.com/q/23496479
tags question: http://stackoverflow.com/q/23512643
tags question: http://stackoverflow.com/q/23614941
tags question: http://stackoverflow.com/q/23553413
tags question: http://stackoverflow.com/q/23467530

http://stackoverflow.com/q/23590782
type: Question
tagged with: android
tagged with: fragment
has comment: http://stackoverflow.com/comment/36208519
has title: Java Android - AsyncTask with Navigation Drawer
score: 0
tagged with: java
answer count: 1
tagged with: navigation-drawer
has comment: http://stackoverflow.com/comment/36208369
type: UnansweredQuestion
has body: h1, my problem: When starting Fragment, it starts to download the file through AsyncTask JSON and after going. Setadapter () in ListView, but if i change Fragment, app crash, because NullPointerException occurs because (Acces error). How cancel AsyncTask and setAdapter in fragments, when user change ? Not a lot of code: Navigation Drawer Fragments Start: private void displayView(int position) { android.app.Fragment fragment = null; switch (position) { case 0: fragment = new FirstFragment(); break; case 1: fragment = new SecondFragment(); break; case 2: fragment = new OtherFragment(); break; default: break; } if (fragment != null) { FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.frame_container, fragment).commit(); mDrawerList.setItemChecked(position, true); mDrawerList.setSelection(position); setTitle(navMenuTitles[position]); mDrawerLayout.closeDrawer(mDrawerList); } else { Log.e("MainActivity", "Error in creating fragment"); } } Start AsyncTask in Fragment: new SingleTask(getActivity(), table_name, URL) { protected void onPostExecute(ArrayList&lt;ItemInfo&gt; item) { feed_item = item; SetAdapter(); } }.execute(); Class with AsyncTask: public SingleTask(Context context, String table, String URLs) { thisContext = context; URL = URLs; table_name = table; } @Override protected ArrayList&lt;ItemInfo&gt; doInBackground(Object... params) { try { db = new DatabaseStorage(thisContext); JsonParser jParser = new JsonParser(); JSONObject json = jParser.getJSONFromUrl(URL); dataJsonArr = json.getJSONArray("data"); if (getCount(table_name) != 0) { db.onDelete(table_name); } for (int i = 0; i &lt; dataJsonArr.length(); i++) { JSONObject c = dataJsonArr.getJSONObject(i); String nickname = c.getString("nickname"); db.insertLabel(nickname, table_name); item.add(new ItemInfo(nickname)); } } catch (JSONException e) { throw new RuntimeException(e); } return item; } Error Log: 05-11 11:54:44.364: E/AndroidRuntime(31391): FATAL E…
has comment: http://stackoverflow.com/comment/36208456
has answer: http://stackoverflow.com/a/23596809
has comment: http://stackoverflow.com/comment/36208591

http://stackoverflow.com/q/23505957
tagged with: java
has comment: http://stackoverflow.com/comment/36060397
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36051453
downvote count: 0
has title: Reflection calls to Methods with Primitive parameters, using the wrapper class
score: 1
favorite count: 0
type: UnansweredQuestion
has body: I'm currently working on a project, whereby I need to make requests to methods that I don't know the parameter types of at compile time, and they are being resolved at run time. Until now, it has been working fine, but I've just run into a bit of a speed bump. The Problem The issue I'm facing is actually frustratingly simple. I'm attempting to call JTextField.setVisible(). As we know, setVisible takes one parameter of type boolean. My code resolves some XML, and returns an object of type Boolean. When attempting to call this method with the boolean wrapper object, I am receiving a NoSuchMethodException because it is failing to map Boolean to boolean, when resolving the method. My Question Is there a way of resolving the primitive type at run time, and passing that class in, in place of the wrapper class? My code Firstly, some user input is parsed. This user input is then filtered through the following method, that converts the String input into an Object output: /** * Converts a string value to it's appropriate primitive value. * * @param input the string value usually taken from the XML. * @return the object representing the value in the string. */ public static Object toPrimitive(String input) { if (input.matches(Constants.INTEGER_PATTERN)) { return new Integer(input); } else if (input.matches(Constants.DOUBLE_PATTERN)) { return new Double(input); } else if (input.matches(Constants.BOOLEAN_PATTERN)) { return new Boolean(input); } else { return input; } } This is then eventually propagated to the following method, that attempts to resolve the setter: // Cycle through each value and populate instance with it, assuming a setter. String setterName = toSetter(key); Object value = namedParameter.get(key); // Value returned from method. // Execute the setter, adding the value to the object. Method setter = clazz.getDeclaredMethod(setterName, value.getClass()); setter.invoke(instance, value); And at the line setter.invoke(instance, value), I am receiving the NoSuchMethodE…
answer count: 0
tagged with: reflection

http://stackoverflow.com/q/23613992
has body: I want to be able to store (and append to and later retrieve) files within my Web Application in a portable manner (so not an absolute path for a given server) that is also never web accessible (even if the webapp its self is removed/broken, so not dependent on Java/xml config to block a GET request for some url). An SQL BLOB or TEXT field or filesystem file is fine, as long as lots of appends can be pushed efficiently.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36253427
tagged with: spring
has title: Java Spring MVC non-web accessable file storage
has comment: http://stackoverflow.com/comment/36253314
tagged with: java
type: Question
answer count: 1
tagged with: persistence
score: 0
has answer: http://stackoverflow.com/a/23614549

http://stackoverflow.com/q/23496538
tagged with: annotations
tagged with: unit-testing
possible better answer: http://stackoverflow.com/a/23496831
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23496831
downvote count: 0
has answer: http://stackoverflow.com/a/23496667
score: 16
has body: Should I use assert statements (assertEquals,...) in the @Before method of a JUnit test? If the assertion fails, all tests will fail, so it behaves exactly how I want, but I'm not convinced this is a good idea as the @Before-annotated method is not a test.
tagged with: junit
has comment: http://stackoverflow.com/comment/36032223
favorite count: 0
accepted answer: http://stackoverflow.com/a/23496667
has comment: http://stackoverflow.com/comment/36032114
has title: Use an assert statement in the @Before method of a JUnit test?
upvote count: 16
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36218925
type: Comment
type: AnswerComment
has text: I'm trying to get my head around it but as a total newbie to Java it's in some ways going in one ear and coming out the other, especially with the group comparator using an arraylist but me needing it for a 2d array do you perhaps know of an example where it's used, I followed the link and tried to find common points of reference and such but no luck as of now.
comment on: http://stackoverflow.com/a/23594772
score: 0

http://stackoverflow.com/q/23494590
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23534162
tagged with: java
has comment: http://stackoverflow.com/comment/36028210
type: Question
has comment: http://stackoverflow.com/comment/36028217
score: 0
answer count: 2
has title: Calculate percentage with multiple numbers and convert to long
has answer: http://stackoverflow.com/a/23534162
possible better answer: http://stackoverflow.com/a/23495084
has answer: http://stackoverflow.com/a/23495084
has body: I have a requirement where I have 4 float varaibles which represents the percentage and the sum is 100. I need to convert the float varaibles into long and the total of the LONG percentage should be 100. If i do the following long longPercentage1 = (long) (floatPercentage1 + 0.5); long longPercentage2 = (long) (floatPercentage2 + 0.5); long longPercentage3 = (long) (floatPercentage3 + 0.5); long longPercentage4 = (long) (floatPercentage4 + 0.5); it works most of the time. But if the floatPercentages are like below: 95.95 -> 96 1.36 -> 1 1.35 -> 1 1.34 -> 1 In the above case, the total comes to 96+1+1+1=99. Now, in the following set of float values, the total comes to 101. 98.2 -> 98 0.61 -> 1 0.60 -> 1 0.59 -> 1 Really appreciate if anyone could provide a good solution.

http://stackoverflow.com/comment/35980385
has text: @Pankaj no because of that I used the -classpath it should do the work am I right?!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23468553

http://stackoverflow.com/comment/35987047
has text: For this, `selection`also needs to be declared as int.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23472374
type: Comment

http://stackoverflow.com/q/23593290
downvote count: 4
possible better answer: http://stackoverflow.com/a/23593340
has answer: http://stackoverflow.com/a/23593340
linked to: http://stackoverflow.com/q/56860
favorite count: 0
has answer: http://stackoverflow.com/a/23593342
has comment: http://stackoverflow.com/comment/36215197
has answer: http://stackoverflow.com/a/23594362
answer count: 4
type: AnsweredQuestion
has title: "What are the criteria for creating a new class? Should there be a new class for any different instance?"
upvote count: 2
accepted answer: http://stackoverflow.com/a/23594362
type: Question
tagged with: oop
has comment: http://stackoverflow.com/comment/36212977
score: -2
tagged with: java
has body: I have the following code: public class Toy { static protected int d = 1;; protected int id; protected double price; protected int minAge; protected int maxAge; protected String size; protected String name; public Toy(double price, int minAge, int maxAge, String size) { this.id = d++; this.price = price; this.maxAge = maxAge; this.minAge = minAge; this.size = size; String s = this.getClass().getName(); this.name = size + "_" + s.substring(s.lastIndexOf('.') + 1) + "_" + id; } public double getPrice() { return price; } public int getId() { return id; } public String getSize() { return size; } public int getMinAge() { return minAge; } public int getMaxAge() { return maxAge; } public String getName() { return name; } public boolean check(double price, int minAge, int maxAge, String size) { if (this.price &lt;= price &amp;&amp; this.minAge &lt;= minAge &amp;&amp; this.maxAge &gt;= maxAge &amp;&amp; size.equals(this.size)) return true; return false; } public String ToString() { return name + "_" + minAge + "-" + maxAge; } } and some subclasses, one of them: public class Ball extends Toy { public Ball(double price, int minAge, int maxAge, String size) { super(price, minAge, maxAge, size); } } I think, that this is no good way to create class, which does not have new fields/methods/. Can you give me an advice if i am right? "What are the criteria for creating a new class? Should there be a new class for any different instance? Is it good to create a sub-class if it would not have any new fields/methods?"
has answer: http://stackoverflow.com/a/23593825
has comment: http://stackoverflow.com/comment/36215162

cryptography
tags question: http://stackoverflow.com/q/23611227
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/23516961
tags question: http://stackoverflow.com/q/23471599
tags question: http://stackoverflow.com/q/23597984
tags question: http://stackoverflow.com/q/23500790
tags question: http://stackoverflow.com/q/23486896
tags question: http://stackoverflow.com/q/23482145
tags question: http://stackoverflow.com/q/23555094
tags question: http://stackoverflow.com/q/23582694
tags question: http://stackoverflow.com/q/23612593

http://stackoverflow.com/comment/36317286
comment on: http://stackoverflow.com/a/23647365
type: AnswerComment
score: 0
has text: Good call. One of Java's most obvious shortcomings.
type: Comment

http://stackoverflow.com/comment/35962011
score: 0
has text: Ya because mappings is integer n null is string type..n put manic.resources(mapPic [I]) inside a loop...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23458659

http://stackoverflow.com/q/23490326
has comment: http://stackoverflow.com/comment/36020824
has title: Xpath OR syntax
score: 0
has answer: http://stackoverflow.com/a/23535171
has comment: http://stackoverflow.com/comment/36020514
has body: My xpath for a html page is as follows: //div[@id='contenttext']/form/table/tbody/tr[11]/td[position()=1 or position()=2] Now I am checking a string which is actually in 2nd column of table. i.e. td[2]. Along with it it can be at td[1]. Hence for both of it i need to evaluate as TRUE. BUT the OR condition in along with position() function is not working somehow. Can you please suggest to check the string at both positions of the table column? Thanks in Advance
answer count: 1
tagged with: xpath
has comment: http://stackoverflow.com/comment/36104762
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36024229
has comment: http://stackoverflow.com/comment/36028662
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/36022810
type: Question
has comment: http://stackoverflow.com/comment/36020979

http://stackoverflow.com/comment/36148988
type: AnswerComment
type: Comment
has text: There is also ListMap in the Scala collections, both mutable and immutable, which will keep the order of the keys.
comment on: http://stackoverflow.com/a/23554514
score: 0

http://stackoverflow.com/comment/35964482
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23459807
type: QuestionComment
has text: Peter, You said "...If you don't want an interrupt to stop the acquire() use the later..". So, will the acquired semaphored ever be useful when the thread itself got interrupted?

http://stackoverflow.com/a/23506290
has comment: http://stackoverflow.com/comment/36056001
downvote count: 0
answers question: http://stackoverflow.com/q/23494200
score: 3
has body: While the other answers are correct, both the answers and your question are working too hard. ISO 8601 Format The format of the string in question, "2014-04-10T00:00:00.000", is standard ISO 8601 format. The DateTime class in Joda-Time has a built-in ISO 8601 parser/formatter built-in, used by default. So no need to instantiate a formatter. Merely pass the string to the constructor of DateTime. Time Zone Specify a time zone by which to interpret that date-time value. Otherwise the JVM's current default time zone is applied. Example: DateTimeZone timeZoneMontréal = DateTimeZone.forID( "America/Montreal" ); Example Code Some example code using Joda-Time 2.5. DateTime dateTime = new DateTime( "2014-04-10T00:00:00.000", DateTimeZone.UTC ); If that string represented a wall-time† moment in Québec rather than UTC, then specify that time zone by which the string should be understood while parsing. DateTime dateTime = new DateTime( "2014-04-10T00:00:00.000", timeZoneMontréal ); Specify Format As per the comment by Meno Hochschild, you may prefer to specify the expected format of the incoming String. Joda-Time has many pre-defined formatters built-in, as well as permitting you to define your own. In this case, our string lacks a time zone offset at the end, so we specify the formatter known as dateHourMinuteSecondFraction. What if the incoming string is malformed or using an unexpected format? An exception is thrown. For robust code, trap for that exception. String input = "2014-04-10T00:00:00.000"; DateTimeZone timeZoneMontréal = DateTimeZone.forID( "America/Montreal" ); DateTimeFormatter formatter = ISODateTimeFormat.dateHourMinuteSecondFraction().withZone( timeZoneMontréal ); DateTime dateTime = null; try { dateTime = formatter.parseDateTime( input ); } catch ( IllegalArgumentException e ) { System.out.println( "Unexpected format of incoming date-time string: " + input + ". Exception: " + e ); // Handle exception for bad input. } Adjust to UTC for comparison. DateTime dat…
has comment: http://stackoverflow.com/comment/36061205
upvote count: 3
has comment: http://stackoverflow.com/comment/36068274
type: Answer

http://stackoverflow.com/q/23590596
tagged with: jdialog
answer count: 1
downvote count: 1
tagged with: frame
has body: How do i completely close a JDialog window without closing the Frame one? I already tried using dispose(), but seems it hides the JDialog instead of realeasing it's memory, althought i believe this is not truth acoording to java API. Is it correct to create a new JDialog when i hit the button from the Frame window, then i create a Menu inside JDialog class and pass this JDialog object to the Menu using a set method. When i choose the option of the menu "GiveUp", I try to close JDialog object using dispose(). Am i doing something wrong, or does anyone have a tip of what kind of problem i am having? I have already spent may hours trying to solve this problem Ps: This is a chess game which have the option to giveup during the current match and start a new one, but althouth some of the objects are lost after the dispose, most of them continue at the same position of the screen or in over another object. Everytime i use System.exit(0) the game runs perfectly but when i use the dispose it always gives some problem. Frame Before play the game Before dispose After Dispose public class Janela extends JFrame implements ActionListener { JDialog d1; public Janela() { super("Jogo de Xadrez - v2.0"); button = new JButton("Abrir JDialog"); button.addActionListener(this); this.getContentPane().add(button, BorderLayout.SOUTH); this.setLocationRelativeTo(null); this.pack(); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); @Override public void actionPerformed(ActionEvent ae) { d1 = new TelaJogo(); **//HERE I INTEND TO CREATE A NEW JDIALOG WINDOW EVERY TIME I CHOOSE THE OPTION "GIVEUP" FROM THE MENU BAR** } public class TelaJogo extends JDialog { private static int i=0; private Menu menu; public TelaJogo() { System.out.println(i++); this.setTitle("Jogo de Xadrez - v2.0"); JDialog.setDefaultLookAndFeelDecorated(true); setSize(1000, 700); setLocation((Toolkit.getDefaultToolkit().getScreenSize().width) / 2 - getWidth() / 2, (Toolkit.getDefaultToolkit().getScree…
favorite count: 0
upvote count: 0
type: AnsweredQuestion
has title: How do i close completely a JDialog without closing the Frame
accepted answer: http://stackoverflow.com/a/23591601
tagged with: java
score: -1
tagged with: dispose
type: Question
has answer: http://stackoverflow.com/a/23591601

http://stackoverflow.com/a/23548357
upvote count: 2
has comment: http://stackoverflow.com/comment/36345874
type: AcceptedAnswer
downvote count: 0
has body: If your library is a .jar containing .java source files, then you can unpack it using, eg. unzip, and move the contents of its src and res directories into your project's src and res directories. If, however, this library contains only compiled Java .class files, there's not much you will be able to do with them. Unless you want to try to decompile them, the library must be used as-is.
type: Answer
accepted answer of: http://stackoverflow.com/q/23467251
answers question: http://stackoverflow.com/q/23467251
score: 2

http://stackoverflow.com/a/23547781
has body: If you know that the class has a no-arg constructor you can just call c.newInstance(). Otherwise you need to call the overloaded version of newInstance() which accepts arguments.
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23547684
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23547684

http://stackoverflow.com/comment/36009778
type: Comment
score: 0
type: AnswerComment
has text: I ran the same tests, and what I found was that `getTimeInMillis()` returned different values from a directly instantiated GregorianCalendar than it did when called on a GregorianCalendar created from an XMLGregorianCalendar, even when the directly instantiated calendar had its change-over date set to `new Date(Long.MIN_VALUE)`—at least for dates between Oct. 5 1582 and Oct. 14 1582.
comment on: http://stackoverflow.com/a/23460471

http://stackoverflow.com/comment/36239216
comment on: http://stackoverflow.com/a/23605674
score: 0
type: AnswerComment
has text: Yes I found mistake, you are right I now understand. Thank you a lot
type: Comment

http://stackoverflow.com/q/23506137
type: UnansweredQuestion
has title: I'm trying to add a JPanel to a JFrame with Flowlayout, but continue to get an exception. What did I do wrong?
has body: I am trying to add a JPanel to a JFrame with FlowLayout, but continue to get this exception: "Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: illegal component position". I would like to be able to implement a JPanel with a few buttons in the near future, so please let me know what I can do to allow that. package textadv; import java.awt.FlowLayout; import java.awt.Button; import java.awt.Color; import java.awt.Dimension; import java.awt.Label; import java.awt.event.KeyEvent; import javax.swing.AbstractButton; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class TextAdv { private JFrame frame = new JFrame("Text Adventure"); private JPanel mainPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); private JButton b1 = new JButton("Left"); public TextAdv() { mainPanel.setBackground(Color.RED); int FRAME_WIDTH = 400; int FRAME_HEIGHT = 400; b1.setEnabled(true); b1.setVisible(true); b1.setPreferredSize(new Dimension(40, 40)); mainPanel.setVisible(true); mainPanel.setPreferredSize(new Dimension (50, 50)); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); frame.setVisible(true); mainPanel.add(b1, FlowLayout.CENTER); frame.add(mainPanel); } public static void main(String[] args) { java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { TextAdv fS = new TextAdv(); } }); }
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/23506252
type: Question
tagged with: jpanel
score: 0
answer count: 1
tagged with: jframe
tagged with: exception

http://stackoverflow.com/comment/35987088
type: QuestionComment
comment on: http://stackoverflow.com/q/23472270
score: 1
has text: 0 < cities.length (the for loop condition) will just loop forever
type: Comment

http://stackoverflow.com/comment/36102833
type: Comment
comment on: http://stackoverflow.com/a/23513116
score: 0
type: AnswerComment
has text: @Steve- Can i use WWF instead of Drool.NET?Is there any limitation for WWF?

http://stackoverflow.com/a/23559793
type: Answer
score: 3
downvote count: 0
has body: You don't have write permission to /usr, or, less probably, the file /usr/swa.png already exists and isn't deletable or writable by you.
answers question: http://stackoverflow.com/q/23558594
upvote count: 3

http://stackoverflow.com/q/23526365
has answer: http://stackoverflow.com/a/23526409
tagged with: epsilon
has body: I have jFrame, many components there, jLabel too. I want set jLabel text not as string or through picture as icon. But as symbol (epsilon). Is that possible?
score: 2
tagged with: java
linked to: http://stackoverflow.com/q/4448180
type: Question
has answer: http://stackoverflow.com/a/23526676
has title: Can I set jLabel´s text as symbols?
has answer: http://stackoverflow.com/a/23526538
linked to: http://stackoverflow.com/q/15182329
answer count: 3
tagged with: symbols
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/3775373
tagged with: jlabel
upvote count: 2
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/q/23461841
tagged with: maven
linked to: http://stackoverflow.com/q/2273009
upvote count: 1
tagged with: spring
score: 1
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/23504560
answer count: 1
downvote count: 0
has title: Maven resource filtering not working on Spring configuration XML file wiith tests
favorite count: 0
has body: I am trying to add some filtering to the Spring application context file, which resides in src/main/resources folder but it's not working. I put my filter file in src/main/filters I've tried many solutions but none are working when i launch unit test through maven install or junit but if i skip test it's filtering it's working . I've modified the file .classPath , I removed exclude attribute from the file edit classpath solution then I read this article bug in maven-resources-plug who said that there is a bug in maven-resources-plugin so I updated the plugin to a newer version but it's still not working. My pom.xml : core-impl target src/main/java target/classes src/test/java target/test-classes org.apache.maven.plugins maven-resources-plugin 2.6 src/main/resources true src/main/filters/filter.properties
type: UnansweredQuestion

http://stackoverflow.com/q/23550985
possible better answer: http://stackoverflow.com/a/23551031
has title: How to break a while loop from an if condition inside the while loop?
linked to: http://stackoverflow.com/q/886955
type: AnsweredQuestion
score: 23
downvote count: 1
upvote count: 24
type: Question
tagged with: if-statement
has comment: http://stackoverflow.com/comment/36135471
tagged with: java
has answer: http://stackoverflow.com/a/23551020
has comment: http://stackoverflow.com/comment/36134479
answer count: 3
has answer: http://stackoverflow.com/a/23551051
has comment: http://stackoverflow.com/comment/36134410
has answer: http://stackoverflow.com/a/23551031
favorite count: 0
tagged with: while-loop
has body: I want to break a while loop of the format below which has an if statement. If that if statement is true, the while loop also must break. Any help would be appreciated. while(something.hasnext()) { do something... if(contains something to process){ do something break if condition and while loop } }
tagged with: break
accepted answer: http://stackoverflow.com/a/23551020

http://stackoverflow.com/a/23536172
type: Answer
has body: I think you can use the | operator of the regex and put the different regexes in paranthesis to be considered one whole regex to be matched. ("(P1)|(P2)|(P3)")
upvote count: 47
downvote count: 0
answers question: http://stackoverflow.com/q/23536133
score: 47

http://stackoverflow.com/comment/36152293
type: Comment
score: 8
type: AnswerComment
has text: Note that there’s a small semantic difference. The method reference is unchangeably bound to the value of `System.out` found at the time when the `Consumer` was created while the lambda will execute the statement as usual when `accept` is invoked, reading `System.out` right before calling `println`. Of course, this makes a difference when `System.out` [is changed](http://docs.oracle.com/javase/8/docs/api/java/lang/System.html#setOut-java.io.PrintStream-) only.
comment on: http://stackoverflow.com/a/23554492

http://stackoverflow.com/q/23455363
type: UnansweredQuestion
has title: How to put a large text file in to Array?
has answer: http://stackoverflow.com/a/23455597
answer count: 4
has comment: http://stackoverflow.com/comment/35955690
has answer: http://stackoverflow.com/a/23455517
has body: I have a large text file. I want to put every character in the text file, in to Character array. I use this code to put it. List&lt;String&gt; set = new ArrayList&lt;String&gt;(); BufferedReader bf = new BufferedReader(new FileReader(file_path)); String check_line=bf.readLine(); while(check_line!=null){ set.add(check_line); check_line=bf.readLine(); } ArrayList&lt;Character&gt; charr = new ArrayList&lt;Character&gt;(); for(int j=0;j&lt;set.size();++j){ String str=set.get(j); for (int x = 0; x &lt; str.length(); x ++){ charr.add(str.charAt(x)); }} return charr; But it takes long time.Is there any efficient way to do this?
type: Question
has answer: http://stackoverflow.com/a/23455446
tagged with: large-files
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23455379

http://stackoverflow.com/comment/36017484
comment on: http://stackoverflow.com/q/23488619
has text: Good heavens. You have two nested loops, and inside the inner loop you create a connection without closing it. Create your connection just once, and re-use it for your statements. You should also create your PreparedStatement just once and re-use it.
score: 2
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23517244
tagged with: twitter4j
tagged with: java
tagged with: warnings
tagged with: twitter
tagged with: eclipse
linked to: http://stackoverflow.com/q/3138384
type: Question
answer count: 1
has title: Java Eclipse Warning using twitter4j
has answer: http://stackoverflow.com/a/23522409
has comment: http://stackoverflow.com/comment/36075190
has comment: http://stackoverflow.com/comment/36077758
score: 0
has comment: http://stackoverflow.com/comment/36079031
has comment: http://stackoverflow.com/comment/36079989
has comment: http://stackoverflow.com/comment/36078214
has body: I have replicated this code in my Eclipse: http://alvinjayreyes.com/2012/01/02/twitter-api-on-your-java-application/ It runs but it doesn't work. I have only this Warning "Description Resource Path Location Type Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment. Build path JRE System Library Problem" I tried this solution: Warning - Build path specifies execution environment J2SE-1.4 with no benefits. Does anyone have solution for this problem? My code: package stream; import twitter4j.Paging; import twitter4j.ResponseList; import twitter4j.Status; import twitter4j.Twitter; import twitter4j.TwitterFactory; import twitter4j.auth.AccessToken; public class streaming { public static void main(String[] args) { Twitter twitter = new TwitterFactory().getInstance(); twitter.setOAuthConsumer("xxx","xxx"); twitter.setOAuthAccessToken(new AccessToken("xxx","xxx")); try { ResponseList&lt;Status&gt; a=twitter.getUserTimeline(new Paging(1,5)); for (Status b:a) { System.out.println(b.getText()); } }catch(Exception e) { e.printStackTrace(); } } } Console output: 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following). {"errors":[{"message":"SSL is required","code":92}]} TwitterException{exceptionCode=[ced778ef-115a04e4], statusCode=403, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.5} at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:185) at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65) at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:85) at twitter4j.TwitterImpl.get(TwitterImpl.java:1895) at twitter4j.TwitterImpl.getUserTimeline(TwitterImpl.java:254) at stream.str…
accepted answer: http://stackoverflow.com/a/23522409
type: AnsweredQuestion

http://stackoverflow.com/q/23478558
has comment: http://stackoverflow.com/comment/35999133
tagged with: java
has body: Firstly I'd like to say I'm new to coding, only been doing it for the past year in Java, below are the errors. I don't know where to look within my program for it to post my code, so as to not be posting unnecessary code. Any additional help would be grateful. Thanks in advance :) 1231-1231/mostwantedgames.mostwantedgames.mostwantedgames W/EGL_genymotion﹕ eglSurfaceAttrib not implemented 1231-1231/mostwantedgames.mostwantedgames.mostwantedgames E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from GradienCache 1231-1231/mostwantedgames.mostwantedgames.mostwantedgames E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from Caches::initConstraints() EDIT: My application is simple. It allows users to store information on their phone. A bug I get which I can't figure out how to fix is when a user types into the top line the "add button" is supposed to be able to be clicked, however it's doing the complete opposite. I've attempted removing the code and seeing if that works but the error still persists. MainActivity code: gameTxt.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @TargetApi(Build.VERSION_CODES.GINGERBREAD) @Override public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { addBtn.setEnabled(String.valueOf(gameTxt.getText()).trim().isEmpty()); } @Override public void afterTextChanged(Editable editable) { } });
downvote count: 1
type: Question
upvote count: 0
score: -1
answer count: 1
favorite count: 0
tagged with: android-studio
type: UnansweredQuestion
has title: Building an application through Android Studio, I keep getting the following errors
tagged with: android
has answer: http://stackoverflow.com/a/23478661

http://stackoverflow.com/q/23468645
has title: What is the best way to store Data as long as Tomcat works
accepted answer: http://stackoverflow.com/a/23490687
upvote count: 1
has comment: http://stackoverflow.com/comment/35980212
has comment: http://stackoverflow.com/comment/35990118
answer count: 1
type: AnsweredQuestion
downvote count: 0
has body: I have to decide how and where I want to save a list of Server information. What I want to achieve is to init an application which is working with Hibernate. Every time it maps a database it has to save the database-name, the Url and some other data. Can anyone suggest a fast way how to save, update and read data in this case? And what kind of data structure I should use? I am free to choose any design or third party library I want (e.g. Properties, Spring Beans etc.). My main task is to decide which of those to us and to motivate why. I'm currently working with Spring, Hibernate and Java 7.
score: 1
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/36020971
type: Question
tagged with: spring
has answer: http://stackoverflow.com/a/23490687
has comment: http://stackoverflow.com/comment/35980506
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/23540399
type: Question
has body: I have an e-Commerce-Software based on Grails Framework. Right now, we're using Hibernate SecondLevel Cache and Hazelcast (prior to Terracotta DSO) for distribution of our servers. This allows me to retreive objects directly (so I can call Objet.get(id) and I will get the object from Hibernate instead of an expensive database call. I'm wondering how the "big" sites are doing this? Especially for category-pages with appended filters (such as price, ordering, brand) my method doesn't work anymore. What is the best-case strategy to avoid hitting the database all the time? Is it to have all in memory and order/sort/filter in Java instead of SQL queries? Thanks for your feedback. Update: Here's the ehcache.xml: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ehcache name="Cache" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd"&gt; &lt;defaultCache maxEntriesLocalHeap="10000" timeToIdleSeconds="0" timeToLiveSeconds="0"&gt; &lt;persistence strategy="distributed"/&gt; &lt;elementValueComparator class="net.sf.ehcache.store.DefaultElementValueComparator"/&gt; &lt;terracotta clustered="true"&gt; &lt;nonstop enabled="true" /&gt; &lt;/terracotta&gt; &lt;/defaultCache&gt; &lt;terracottaConfig rejoin="true" url="tcURL:9510" /&gt; &lt;/ehcache&gt; and the hibernate configuration (taken from Grails): hibernate { cache.use_second_level_cache = true cache.use_query_cache = false cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' }
has comment: http://stackoverflow.com/comment/36115261
tagged with: java
tagged with: hibernate
tagged with: grails
tagged with: caching
score: 0
has comment: http://stackoverflow.com/comment/36115565
has comment: http://stackoverflow.com/comment/36115401
tagged with: hazelcast
type: UnansweredQuestion
has title: Java Caching Stategy
has comment: http://stackoverflow.com/comment/36114295
has comment: http://stackoverflow.com/comment/36114898
has comment: http://stackoverflow.com/comment/36114593
has comment: http://stackoverflow.com/comment/36115141
has comment: http://stackoverflow.com/comment/36115989
answer count: 0

http://stackoverflow.com/q/23509364
has title: Outputting to a .dat file
has comment: http://stackoverflow.com/comment/36056472
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11496700
has comment: http://stackoverflow.com/comment/36056405
score: 1
has comment: http://stackoverflow.com/comment/36056523
tagged with: printwriter
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23509431
tagged with: java
possible better answer: http://stackoverflow.com/a/23509407
has answer: http://stackoverflow.com/a/23509407
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/23509431
favorite count: 0
has body: I deleted my last post because I did'nt even ask what I wanted toask so sorry about that. Anyways, This is regarding my last Question. The assingment wants me to send data to an outputfile that looks like this: EXample Input File: ABC54301 TFTFTFTT TFTFTFFTTFT Example Output File: ABC54301 TFTFTFTTSTFTFTFFTTFT 77.5% C X X X X X So in My outputData Method I need to Change the Print and Println Statements so they send it it to the output file. Here is my outputData Method and Main Method public static void outputData(String[][] studentTests, StringBuilder[][] studentResults, double[] testScores) { for(int rowIndex = 0; rowIndex &lt; studentTests.length; rowIndex++) { for(int colIndex = 0; colIndex &lt; studentTests[rowIndex].length; colIndex++) { if(colIndex == 0) { System.out.print(studentTests[rowIndex][colIndex] + " "); } else { System.out.println(studentTests[rowIndex][colIndex]); } } for(int colIndex = 0; colIndex &lt; studentTests[rowIndex].length; colIndex++) { if(colIndex == 0) { System.out.print(studentResults[rowIndex][colIndex] + " "); } else { System.out.println(studentResults[rowIndex][colIndex]); } } } } Here is the Main Method public static void main(String[] args)throws IOException { inFile = new Scanner(new FileReader("GradesIn.dat")); outFile = new PrintWriter("GradesOut.dat"); String testAnswers = inFile.next(); int numberOfStudents = inFile.nextInt(); double[] testScores = new double[numberOfStudents]; String[][] studentTests = new String[numberOfStudents][2]; StringBuilder[][] studentResults = new StringBuilder[numberOfStudents][2]; initializeResults(studentResults); getData(studentTests); gradeTests(studentTests, studentResults, testAnswers, testScores); outputData(studentTests, studentResults, testScores); outFile.close(); inFile.close(); } So if someone could help me NOT give me the code to make it where it will send the data to the output file and put the Grade Percentage and LetterGrade out to the side of the T's and F's in the output file. T…
tagged with: file-io

http://stackoverflow.com/comment/36198104
has text: Put a breakpoint or `Log` statements in `writeToParcel()`. Repeat your test. Was the method called? If not, then what good was your test?
comment on: http://stackoverflow.com/q/23585157
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35964556
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23458661
score: 0
has text: For everyone's sake, I used the code formatter of an IDE to make this code semi-readable.

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/23530689
tags question: http://stackoverflow.com/q/23542781
tags question: http://stackoverflow.com/q/23469732
tags question: http://stackoverflow.com/q/23519367
tags question: http://stackoverflow.com/q/23610308
tags question: http://stackoverflow.com/q/23551268
tags question: http://stackoverflow.com/q/23462823
tags question: http://stackoverflow.com/q/23517243
tags question: http://stackoverflow.com/q/23526164
tags question: http://stackoverflow.com/q/23499721
tags question: http://stackoverflow.com/q/23598445
tags question: http://stackoverflow.com/q/23608411
tags question: http://stackoverflow.com/q/23489824
tags question: http://stackoverflow.com/q/23612140
tags question: http://stackoverflow.com/q/23556772
tags question: http://stackoverflow.com/q/23545805
tags question: http://stackoverflow.com/q/23479560
tags question: http://stackoverflow.com/q/23459686
tags question: http://stackoverflow.com/q/23499217
tags question: http://stackoverflow.com/q/23496640
tags question: http://stackoverflow.com/q/23545779
tags question: http://stackoverflow.com/q/23598180
tags question: http://stackoverflow.com/q/23610215
tags question: http://stackoverflow.com/q/23531071
tags question: http://stackoverflow.com/q/23515388
tags question: http://stackoverflow.com/q/23594994
tags question: http://stackoverflow.com/q/23463740
tags question: http://stackoverflow.com/q/23560740
type: Tag
tags question: http://stackoverflow.com/q/23470495
tags question: http://stackoverflow.com/q/23512485
tags question: http://stackoverflow.com/q/23592614
tags question: http://stackoverflow.com/q/23491949
tags question: http://stackoverflow.com/q/23600433
tags question: http://stackoverflow.com/q/23571413
tags question: http://stackoverflow.com/q/23477002
tags question: http://stackoverflow.com/q/23491090
tags question: http://stackoverflow.com/q/23500436
tags question: http://stackoverflow.com/q/23587331
tags question: http://stackoverflow.com/q/23472277
tags question: http://stackoverflow.com/q/23478047
tags question: http://stackoverflow.com/q/23550895
tags question: http://stackoverflow.com/q/23559874
tags question: http://stackoverflow.com/q/23480154
tags question: http://stackoverflow.com/q/23487458
tags question: http://stackoverflow.com/q/23556567
tags question: http://stackoverflow.com/q/23574258
tags question: http://stackoverflow.com/q/23552827
tags question: http://stackoverflow.com/q/23459619
tags question: http://stackoverflow.com/q/23508277
tags question: http://stackoverflow.com/q/23514283
tag name: json
tags question: http://stackoverflow.com/q/23565445
tags question: http://stackoverflow.com/q/23473729
tags question: http://stackoverflow.com/q/23514084
tags question: http://stackoverflow.com/q/23549353
tags question: http://stackoverflow.com/q/23514072
tags question: http://stackoverflow.com/q/23583501
tags question: http://stackoverflow.com/q/23465079
tags question: http://stackoverflow.com/q/23520204
tags question: http://stackoverflow.com/q/23482439
tags question: http://stackoverflow.com/q/23611935
tags question: http://stackoverflow.com/q/23469784
tags question: http://stackoverflow.com/q/23572451
tags question: http://stackoverflow.com/q/23489104
tags question: http://stackoverflow.com/q/23545860
tags question: http://stackoverflow.com/q/23467674
tags question: http://stackoverflow.com/q/23593779
tags question: http://stackoverflow.com/q/23529230
tags question: http://stackoverflow.com/q/23479332
tags question: http://stackoverflow.com/q/23471634
tags question: http://stackoverflow.com/q/23505722
tags question: http://stackoverflow.com/q/23538897
tags question: http://stackoverflow.com/q/23584023
tags question: http://stackoverflow.com/q/23573994
tags question: http://stackoverflow.com/q/23592879
tags question: http://stackoverflow.com/q/23601842
tags question: http://stackoverflow.com/q/23578637
tags question: http://stackoverflow.com/q/23463265
tags question: http://stackoverflow.com/q/23485882

http://stackoverflow.com/comment/36201843
type: Comment
type: QuestionComment
has text: Which side is throwing the exception: the end which records and encrypts, or the end which decrypts and plays back?
score: 0
comment on: http://stackoverflow.com/q/23586686

http://stackoverflow.com/a/23544264
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
has body: Let us talk straight here: Henceforth I am assuming that your "special use case" is that you want to tweak/hack user authentication, hopefully in a legal way for testing or whatever. The main problems to be solved are: It would be easy to just manipulate the result of your foo method (I have renamed it to isCurrentUser(String userID) to clarify its intent). But if I understand correctly, the method has side effects, i.e. it calls other methods, and you want to keep those side effects. So we have to be more careful and use a scalpel, not an axe. There is no pointcut for local variable changes so you have to intercept the method execution or call which changes the local variable's value. AspectJ cannot normally intercept JDK method execution() (unless you want to weave the JDK first, which is possible but out of scope here). Thus, you have to intercept the call() from your own code. I am assuming it is possible to weave into that code even if it is contained in a JAR and you do not have the sources. You can either use LTW for the target class or binary weaving for the JAR, creating a new, woven version of it. Your method call to NTSystem.getName() is not done in a normal way but via Reflection API. Thus, you cannot just use a pointcut like call(NTSystem.getName()) because it will never be triggered. You have to intercept call(public Object Method.invoke(Object, Object...)). Theoretically it could be that other reflective method calls are made from within isCurrentUser(..), so we have to refine our pointcut in order to only match if really NTSystem.getName() is called, not any other method. As a convenience function, we want to be able to dynamically switch the hackingMode on and off. Now here is a complete, compileable code sample (obviously only working on Windows just like your own code snippet): Java class with method to be manipulated and main method for demonstration purposes: package de.scrum_master.app; import java.lang.reflect.Method; import de.scrum_master.as…
accepted answer of: http://stackoverflow.com/q/23537854
answers question: http://stackoverflow.com/q/23537854
has comment: http://stackoverflow.com/comment/36494345
has comment: http://stackoverflow.com/comment/36493522
score: 4

foreground
type: Tag
tag name: foreground
tags question: http://stackoverflow.com/q/23508816

http://stackoverflow.com/q/23563966
has body: I have a POM that describes a set of dependencies in it's dependencyManagement section. This set of dependencies defines what dependencies will be provided when I deploy my application so I want to stick to this list and not have my project redefine them. Is there a way that I can inherit the managed dependencies from this POM without it being the parent POM of my project? I would like to avoid specifying versions etc in my project POM.
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36160501
has answer: http://stackoverflow.com/a/23564168
upvote count: 3
tagged with: maven
tagged with: dependency-management
accepted answer: http://stackoverflow.com/a/23564168
type: AnsweredQuestion
score: 3
tagged with: java
has title: Importing managed dependencies from another POM with maven
type: Question

http://stackoverflow.com/q/23532713
tagged with: syntax-error
score: -2
has title: Cannot find symbol error when compiling.
tagged with: arrays
linked to: http://stackoverflow.com/q/23532132
has comment: http://stackoverflow.com/comment/36100910
downvote count: 2
has answer: http://stackoverflow.com/a/23532749
answer count: 1
favorite count: 0
upvote count: 0
has body: Can someone help me find the error in my program? When I compile it, it gives the cannot find symbol error. I have been playing around with it for a while but cant seem to grasp my mistake. My main class: public static void main(String[] args) { int plays; SlotMac machine[] = new SlotMac[3]; machine[0] = new SlotMac(3,35,30); machine[1] = new SlotMac(10,100,60); machine[2] = new SlotMac(4,10,9); plays= firstmachine(machine[0]); System.out.println(plays); My other class: public class SlotMac { int win_plays, plays; int times_played; int quarters; public SlotMac(int times_played, int win_plays, int quarters) { this.win_plays= win_plays; this.times_played= times_played; this.quarters= quarters; } public int firstmachine() { return plays; } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36102133
tagged with: java
type: Question

synchronized
tags question: http://stackoverflow.com/q/23460193
type: Tag
tag name: synchronized
tags question: http://stackoverflow.com/q/23524250
tags question: http://stackoverflow.com/q/23612739
tags question: http://stackoverflow.com/q/23453568
tags question: http://stackoverflow.com/q/23474460

http://stackoverflow.com/q/23570796
has comment: http://stackoverflow.com/comment/36171321
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23572073
accepted answer: http://stackoverflow.com/a/23572073
has answer: http://stackoverflow.com/a/23570978
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: servlets
has comment: http://stackoverflow.com/comment/36171668
tagged with: arraylist
tagged with: html-table
answer count: 2
possible better answer: http://stackoverflow.com/a/23570978
downvote count: 0
tagged with: jsp
has body: I'm trying to send a table with 3 input text with a value that I write by form POST. Then I recieve the values in servlet like this: String [] num1 = request.getParameterValues("num1"); When I got all the values inside the array, I loop the array, then I add inside an arraylist all the values. ArrayList<String> List = new ArrayList<String>(); for(int i= 0; i < num1.length; i++){ List.add(num1[i]); } Finally I send the values to JSP: request.setAttribute("num1", List); request.getRequestDispatcher("/JSPSite.jsp").forward(request, response); The thing that I dont know how to do is.. If now the table got a button that when I click it increment +1 the column dynamically, How can I send all the input values, to servlet, calculate the sum of them, then In jsp show the same table with a td below the input text with the sum of the inputs?
favorite count: 0
has title: HTML to Servlet to JSP dynamically Table

http://stackoverflow.com/comment/36532818
type: Comment
has text: For JDBC there is JdbcProxy: http://sourceforge.net/projects/jdbcproxy/ According to the documentation it can be used for record and replay, but I hasn't been updated since 2006 and I haven't tried it yet.
comment on: http://stackoverflow.com/a/23495002
score: 0
type: AnswerComment

http://stackoverflow.com/q/23534901
tagged with: equals
score: -3
downvote count: 3
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23535004
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/23534946
possible better answer: http://stackoverflow.com/a/23534941
tagged with: string
has body: I would like know how the following scenario works. String test = "a,b,c"; String testary[] = test.split(","); if(!testary[0].equals("\"D")) gives? I want to know why we are using backslash along with some char and how does the above statement works.
has answer: http://stackoverflow.com/a/23534941
favorite count: 0
has title: what does SomeString.equals("\"D")) means?
accepted answer: http://stackoverflow.com/a/23535004

http://stackoverflow.com/q/23488796
has title: Class not found exception with google maps api v2 and eclipse
has comment: http://stackoverflow.com/comment/36019306
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36018178
has body: I want to write a simple map program. I am using eclipse. I get the following exceptions: 05-06 10:25:33.474: E/AndroidRuntime(7341): FATAL EXCEPTION: main 05-06 10:25:33.474: E/AndroidRuntime(7341): Process: com.example.mapapp, PID: 7341 05-06 10:25:33.474: E/AndroidRuntime(7341): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mapapp/com.example.mapapp.MapAppHome}: android.view.InflateException: Binary XML file line #12: Error inflating class fragment 05-06 10:25:33.474: E/AndroidRuntime(7341): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 05-06 10:25:33.474: E/AndroidRuntime(7341): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 05-06 10:25:33.474: E/AndroidRuntime(7341): at android.app.ActivityThread.access$800(ActivityThread.java:135) 05-06 10:25:33.474: E/AndroidRuntime(7341): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 05-06 10:25:33.474: E/AndroidRuntime(7341): at android.os.Handler.dispatchMessage(Handler.java:102) 05-06 10:25:33.474: E/AndroidRuntime(7341): at android.os.Looper.loop(Looper.java:136) 05-06 10:25:33.474: E/AndroidRuntime(7341): at android.app.ActivityThread.main(ActivityThread.java:5017) 05-06 10:25:33.474: E/AndroidRuntime(7341): at java.lang.reflect.Method.invokeNative(Native Method) 05-06 10:25:33.474: E/AndroidRuntime(7341): at java.lang.reflect.Method.invoke(Method.java:515) 05-06 10:25:33.474: E/AndroidRuntime(7341): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 05-06 10:25:33.474: E/AndroidRuntime(7341): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 05-06 10:25:33.474: E/AndroidRuntime(7341): at dalvik.system.NativeStart.main(Native Method) 05-06 10:25:33.474: E/AndroidRuntime(7341): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class fragment 05-06 10:25:33.474: E/AndroidRuntime(7341): at android.view.LayoutInflater.createVi…
tagged with: java
tagged with: eclipse
type: Question
tagged with: google-maps
score: 0
tagged with: android

http://stackoverflow.com/comment/36007526
type: Comment
comment on: http://stackoverflow.com/a/23482773
type: AnswerComment
has text: yeah, debugger didn't find anything.
score: 0

http://stackoverflow.com/comment/36129623
has text: Thank you for your reply. I meant first case ("what language this word belongs to"). I have tried google translate (https://translate.google.com/) and it seems to be able to identify the language correctly. I am wondering if we have any built in apis within oracle for language detection or character set.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23530728
type: Comment

http://stackoverflow.com/a/23562729
has comment: http://stackoverflow.com/comment/36156235
has comment: http://stackoverflow.com/comment/36227119
type: Answer
has body: i think moving it in another class will still cause your program to be stuck in infinite loop. try and make a class the extends Thread, put display filter pdu method as: this is the new thread class: public class YourThreadClass extends Thread{ String fake_input_in_thread = null; public YourThreadClass(String fake_input){ //constructor //save the input / whatever you need to pass in from the other class here, and use it later fake_input_in_thread = fake_input } public void run() { //your filter code try{ //now you can use the value pass-in from you main class. This should display "testing123" in console. System.out.println(fake_input_in_thread); EspduReceiver.socket = new MulticastSocket(EspduSender.PORT); EspduReceiver.address = InetAddress.getByName(EspduSender.DEFAULT_MULTICAST_GROUP); EspduReceiver.socket.joinGroup(EspduReceiver.address); ............................. } //put the below method into the thread class public void endOfFilter(){ EspduReceiver.stopCapture = false; } } when you GUI needs to trigger that method, here's what your main class will looks like //initialize YourThreadClass thread = null; public static void displayFilteredPdu(){ if(thread ==null){ //This string is to demostrate how you'd pass variables into your custom class, does not have any actual use String str = "testing123"; thread = new YourThreadClass(str); thread.start(); } } //in main code public static void stopFilteredPdu(){ if(thread != null){ thread.endOfFilter(); thread = null; } }
has comment: http://stackoverflow.com/comment/36156870
has comment: http://stackoverflow.com/comment/36163135
answers question: http://stackoverflow.com/q/23562293
has comment: http://stackoverflow.com/comment/36162751
score: 1
has comment: http://stackoverflow.com/comment/36227037
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/23526062
score: 0
type: Answer
has body: If you just want to grab the max Entry in the Map use Collections.max with your defined Comparator: Map&lt;Key, Integer&gt; myMap= new HashMap&lt;Key,Integer&gt;(); myMap.put(k1,5); myMap.put(k2,20); myMap.put(k3,10); myMap.put(k4,15); Entry&lt;Key, Integer&gt; maxEntry = Collections.max(myMap.entrySet(), new Comparator&lt;Entry&lt;Key, Integer&gt;&gt;(){ @Override public int compare(Entry&lt;Key, Integer&gt; e1, Entry&lt;Key, Integer&gt; e2) { return e1.getValue().compareTo(e2.getValue()); } }); // outputs k2=20 System.out.print(maxEntry); If you really want to have a 1 entry map in the end, you can clear the old one away and add maxEntry: myMap.clear(); myMap.put(maxEntry.key(), maxEntry.value());
answers question: http://stackoverflow.com/q/23524852

http://stackoverflow.com/q/23505541
tagged with: menu
tagged with: contextmenu
has body: I would like to have Eclipse behavior for mouse clicks outside menus and popup menus in Swing. Basically, in Eclipse, when you press the mouse OUTSIDE the menu, the menu disappears and the mouse press event is forwarded to the component on which you clicked with the mouse. Irritatingly, Swing does not do this, and I can't find a way around it. Right now, even with Windows LAF, i have to click a second time to get the component to register the mouse click. For the sake of the response just do it on a table final JPopupMenu popupMenu = new JPopupMenu(); JMenuItem viewProfile = new JMenuItem("View Profile"); viewProfile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); popupMenu.add(viewProfile); table.setComponentPopupMenu(popupMenu); EDIT: here is a test code. I don't think it is convenient to add a mouse listener to every simple component so they can register mouse clicks after a popup menu. In the following example, the Table does implement it, but not the Button. import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.table.DefaultTableModel; public class TestMouse { public static void main(String[] args) { new TestMouse(); } private JLabel counter; private int count; private JPanel northPanel; private JButton clickMe; public TestMouse() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessExce…
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
has title: Swing Mouse Click Event for JMenu and JPopupMenu
score: 3
tagged with: mouseevent
has answer: http://stackoverflow.com/a/26540790
upvote count: 3
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/23509199

http://stackoverflow.com/comment/36055552
comment on: http://stackoverflow.com/q/23508187
has text: Then were going to need an actual [runnable example that demonstrates your problem](https://stackoverflow.com/help/mcve) to be able to state more...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36254141
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23614728
has text: Minor typo (the parentheses), thanks for spotting it. I agree with your comment, so +1 :-).
score: 0

http://stackoverflow.com/a/23521048
has comment: http://stackoverflow.com/comment/36079714
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/23520703
score: 3
downvote count: 0
has body: An alternative solution would be mapping the results and collecting them into a List using Collectors#toList: List&lt;Long&gt; results = nums2.stream() .filter(p -&gt; p%2 == 0) .map(p -&gt; p = (long)Math.pow(p, 2)) .collect(Collectors.toList());

http://stackoverflow.com/comment/36031618
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23473772
has text: Because the JAI library requires them to be set when manipulating TIFFs. I did not write that library.
type: Comment

http://stackoverflow.com/q/23486827
tagged with: java
has answer: http://stackoverflow.com/a/23486873
tagged with: swing
type: Question
has title: Java KeyListener vs Keybinding
tagged with: key-bindings
tagged with: actionlistener
accepted answer: http://stackoverflow.com/a/23486873
tagged with: keylistener
has body: i am trying to write a calculator and having a problem. I already made a actionlistener for all buttons and now i want to make it possible to input data from keyboard. DO i need to do the whole thing for KeyListener or Keybinding or is there any other a way to make that after clicking a button it will be sent to the instructions in actionlistener? And whats better:Keylistener or Keybinding
linked to: http://stackoverflow.com/q/7441625
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36018807
possible better answer: http://stackoverflow.com/a/23499330
has answer: http://stackoverflow.com/a/23499330
type: AnsweredQuestion

http://stackoverflow.com/comment/36039634
comment on: http://stackoverflow.com/a/23500400
has text: but OP is looking or `method.invoke()` otherwise this is also an answer `array[2]`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36232433
comment on: http://stackoverflow.com/q/23603486
score: 0
type: QuestionComment
type: Comment
has text: Because different tools are better suited for different tasks.

http://stackoverflow.com/comment/36232302
score: 0
has text: @assylias Not ready to prove that, but I think c++ instructions can be quite flexible and allow different types of barriers.. Following the common logic, it should easier to forbid only loads, then both loads and stores..
comment on: http://stackoverflow.com/q/23603304
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23559764
has body: can any one suggest me how can we call country code in respect of country on selection. country list is defined under country.xml! i want when we select india then in ph. no input box country code must apeear auto maticaly +91. I am just stuck here, and nothing comes in my mind how to do that?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36151206
tagged with: java
type: Question
has title: how can we call country code in respect of country
has answer: http://stackoverflow.com/a/23560249
tagged with: liferay
answer count: 1
has comment: http://stackoverflow.com/comment/36234524
score: 0

http://stackoverflow.com/q/23523820
answer count: 1
has comment: http://stackoverflow.com/comment/36090175
favorite count: 0
has comment: http://stackoverflow.com/comment/36087813
has comment: http://stackoverflow.com/comment/36083640
has comment: http://stackoverflow.com/comment/36084192
accepted answer: http://stackoverflow.com/a/23524154
has title: Creating a method from calling two classes in java
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36083498
has comment: http://stackoverflow.com/comment/36187259
tagged with: java
has comment: http://stackoverflow.com/comment/36106515
has comment: http://stackoverflow.com/comment/36083913
has body: I'm not sure which one of my methods that's not working. When i create accounts from addSavingsAccount everything is working fine, but when I want to print out the info from two classes it prints name and pNr but shows the first accountnumber to all clients. What's wrong with this? //this works fine public int addSavingsAccount(long pNr){ for(int i = 0; i &lt; customerlist.size(); i++) { if(customerlist.get(i).getPCode() == pNr) { Customer customer = customerlist.get(i); customer.addAccount(pNr); return account.getAccountId(); } } return -1; } //but this don't public String infoAccount(long pNr, int accountId) { String info = ""; for(Customer customer : customerlist) { if(customer.getPCode() == pNr) { this.customer = customer; ArrayList&lt;SavingsAccount&gt; accounts = customer.getAccount(); for (SavingsAccount account : accounts) { this.account = account; if (account.getAccountId() == accountId){ info = account.toString(); } } } } return info; } //this was my first try of printing out: public String infoAccount(long pNr, int accountId) { String info = ""; for(Customer customer : customerlist) { if(pNr == customer.getPCode()) { for(SavingsAccount account : accounts) { if(accountId == account.getAccountId()) { info = "Personnummer: " + pNr + "\nKontonummer: " + accountId + "\nSaldo: " + amount + "\nRänta: " + SavingsAccount.RATE; } } } } return info; } //the methods in Customerclass public void addAccount(long pNr){ accounts.add(new SavingsAccount()); } public ArrayList&lt;SavingsAccount&gt; getAccount(){ return accounts; } //methods from SavingsAccount public int getAccountId(){ return accountCount++; } public String toString(){ String infoAccount = "\tKontonr: " + accountId + "\tKontotyp: " + accounttype + "\nSaldo: " + balance + "\tRäntesats: " + RATE; return infoAccount; }
tagged with: methods
downvote count: 1
has comment: http://stackoverflow.com/comment/36091989
type: Question
has comment: http://stackoverflow.com/comment/36120645
tagged with: object
has comment: http://stackoverflow.com/comment/36084406
has answer: http://stackoverflow.com/a/23524154
has comment: http://stackoverflow.com/comment/36083522
tagged with: arraylist
upvote count: 0

http://stackoverflow.com/q/23593752
type: Question
has comment: http://stackoverflow.com/comment/36214649
tagged with: android-layout
has comment: http://stackoverflow.com/comment/36215025
accepted answer: http://stackoverflow.com/a/23602437
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23602437
tagged with: android
type: AnsweredQuestion
has body: So i've been working on my project, first android project to be specific, and i kinda progressed in stuff that i want, i used fragments and all pretty successfully, but just recently i added a PopupWindow and use it as a window for displaying a music player in it, but when i created activity for that player and inflated the layout of this player activity in my other class, the main class that was created with player activity is now ignored, i checked with a button click event, and strangely, button click event is working when called from that other class where i inflated the layout of player activity, this is messy and all, but my question would be this - is there a way to inflate/show a popup window with a layout of my player activity while being able to have all methods and events in that same player activity java class? Here is a snippet that inflates layout from player activity: LayoutInflater inflater = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); final View layout = inflater.inflate(R.layout.activity_play,null,false); popup = new PopupWindow(context); popup = new PopupWindow(layout, 480, 250, true); popup.setBackgroundDrawable(new BitmapDrawable()); popup.setAnimationStyle(R.style.Animation); popup.showAtLocation(layout,Gravity.NO_GRAVITY,50,550); The class that i call it from extends ListFragment. And here is a snippet from the player activity class that is ignored public class PlayAct extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_play); ImageButton imbPlay = (ImageButton)findViewById(R.id.imbPlay); imbPlay.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { AlertDialog.Builder builder = new AlertDialog.Builder(PlayAct.this); builder.setMessage("THIS IS A MESSAGE FROM NEW PLAYER ACTIVITY"); builder.setTitle("MESSAGE"); AlertDialog alert = builder.create(); alert.show(); } }…
tagged with: java
has title: Java class is ignored by activity layout when layout is inflated in other class

http://stackoverflow.com/q/23516370
accepted answer: http://stackoverflow.com/a/23516632
has title: SVD with different solution as WolframAlpha
has body: I've found out that the results of the SVDecomp function in Java are very different from the results of WolframAlpha. The input matrix is excactly the same for OpenCV and WolframAlpha {{0.2229632566816983, 18.15370964847313, 4.87085706173828}, {-14.31728552253419, 2.642676839378287, -33.69501515553716}, {-2.982323803144884, 33.70091859922499, 0.8997452211463326}} Here are the results from WolframAlpha: U = (-0.441818862735368 | 0.214800119324567 | -0.871009185525260 -0.245069575462508 | -0.962880608842737 | -0.113145200062862 -0.862981457340684 | 0.163468167704881 | 0.478059789601005) W = (38.5925763913943 | 0 | 0 0 | 36.8337256561100 | 0 0 | 0 | 3.76859638821616×10^-10) V = (0.155053443270976 | 0.362336795687042 | 0.919059560758203 -0.978207790691182 | 0.186347267503429 | 0.0915653543928191 0.138086740713550 | 0.913228745925823 | -0.383334461865688) And here is what OpenCV produces when using SCDecomp: U: [0.4418188627353685, 0.2148001193245664, -0.8710091855252606; 0.2450695754625076, -0.9628806088427376, -0.113145200062862; 0.8629814573406845, 0.1634681677048805, 0.4780597896010051] W: [38.59257639139431; 36.83372565611004; 3.768597946996713e-10] VT:[-0.155053443270976, 0.3623367956870423, 0.9190595607582029; 0.9782077906911818, 0.1863472675034285, 0.09156535439281914; -0.1380867407135498, 0.9132287459258235, -0.3833344618656882] To mention: W in OpenCV is not a matrix, as well as the sign of the values are sometimes different. Is this a bug? Here is my SourceCode Core.SVDecomp(E, w, u, vt);
has answer: http://stackoverflow.com/a/23516632
tagged with: opencv
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
score: 0

http://stackoverflow.com/comment/36210188
comment on: http://stackoverflow.com/q/23569236
has text: Maybe this simple example can help: https://github.com/sgothel/jogl/blob/master/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23497180
tagged with: gwt
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: gwt-maven-plugin
has body: I have the following maven configuration my goal is to replace web-xml for development mode from usual web.xml to web-dev.xml gwt-maven-plugin seems to have configuration wor it (webXml) but it's not working not as eclipse plugin (run as web application), not when mvn gwt:run. <plugins> org.codehaus.mojo gwt-maven-plugin ${gwtVersion} compile <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath> ${webappDirectory} index.html src/main/webapp/WEB-INF/web-dev.xml true
type: Question
accepted answer: http://stackoverflow.com/a/23497830
has title: GWT Maven plugin replace web.xml
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: maven
has answer: http://stackoverflow.com/a/23497830

http://stackoverflow.com/comment/36070741
has text: i want to show String between new and in.Start position new and end position in.result User
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23517333
type: AnswerComment

http://stackoverflow.com/a/23513418
has comment: http://stackoverflow.com/comment/36102013
score: 0
has comment: http://stackoverflow.com/comment/36065468
answers question: http://stackoverflow.com/q/23510740
has comment: http://stackoverflow.com/comment/36072308
type: Answer
has body: Havent tried this myself: You could migrate the old users into your new db and keep the MD5 hashes in the password column. You create two AuthenticationProviders. One for BCrypt and one for MD5. Order them so that BCrypt will be checking first. If the frist provider fails the second will check against an MD5 hash. During a password change you can only use the BCrypt hasher so that after a while all users will use a BCrypted password. You might be able to force the user to update their password after a successful login via the MD5 hash.
has comment: http://stackoverflow.com/comment/36072874

http://stackoverflow.com/comment/36066040
type: Comment
comment on: http://stackoverflow.com/q/23514594
score: 0
has text: Ah sorry, I understand now - yes, correcting the loglevel would be even better. The problem I've got though is that the applications have been setup to use parameterized logging, but there are a number of naughty developers who replace the parameter placeholder in their application with a hardcoded value and forget to change it back before committing.
type: QuestionComment

http://stackoverflow.com/comment/36156777
has text: Yes actually I want to learn how the top above code can be implemented so that it runs in parallel.
comment on: http://stackoverflow.com/q/23552930
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/44727062
type: Comment
has text: @NeilLunn you are right, there was a lot more to be said about the question. Just edited it to include a more detailed explanation. Thank you.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23455155

http://stackoverflow.com/comment/35953692
has text: didn't this help http://stackoverflow.com/questions/10080004/no-persistence-provider-found-with-jboss-as-7
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23454185

multithreading
tags question: http://stackoverflow.com/q/23485160
tags question: http://stackoverflow.com/q/23459807
tags question: http://stackoverflow.com/q/23573061
tags question: http://stackoverflow.com/q/23527030
tags question: http://stackoverflow.com/q/23590808
tags question: http://stackoverflow.com/q/23457411
tags question: http://stackoverflow.com/q/23485855
tags question: http://stackoverflow.com/q/23460193
tags question: http://stackoverflow.com/q/23599668
tags question: http://stackoverflow.com/q/23564104
tags question: http://stackoverflow.com/q/23523967
type: Tag
tags question: http://stackoverflow.com/q/23573312
tags question: http://stackoverflow.com/q/23595821
tags question: http://stackoverflow.com/q/23538818
tags question: http://stackoverflow.com/q/23524250
tags question: http://stackoverflow.com/q/23487397
tags question: http://stackoverflow.com/q/23559744
tags question: http://stackoverflow.com/q/23595101
tags question: http://stackoverflow.com/q/23591470
tags question: http://stackoverflow.com/q/23600982
tags question: http://stackoverflow.com/q/23546178
tags question: http://stackoverflow.com/q/23593061
tags question: http://stackoverflow.com/q/23513670
tags question: http://stackoverflow.com/q/23601861
tags question: http://stackoverflow.com/q/23513497
tags question: http://stackoverflow.com/q/23491667
tags question: http://stackoverflow.com/q/23594656
tags question: http://stackoverflow.com/q/23479848
tags question: http://stackoverflow.com/q/23495415
tags question: http://stackoverflow.com/q/23583848
tags question: http://stackoverflow.com/q/23607109
tags question: http://stackoverflow.com/q/23594203
tags question: http://stackoverflow.com/q/23465039
tags question: http://stackoverflow.com/q/23487754
tags question: http://stackoverflow.com/q/23483150
tags question: http://stackoverflow.com/q/23527350
tags question: http://stackoverflow.com/q/23597999
tags question: http://stackoverflow.com/q/23502832
tags question: http://stackoverflow.com/q/23496035
tags question: http://stackoverflow.com/q/23568943
tags question: http://stackoverflow.com/q/23612739
tags question: http://stackoverflow.com/q/23568572
tags question: http://stackoverflow.com/q/23536856
tags question: http://stackoverflow.com/q/23509954
tags question: http://stackoverflow.com/q/23505800
tags question: http://stackoverflow.com/q/23472698
tags question: http://stackoverflow.com/q/23525138
tags question: http://stackoverflow.com/q/23573433
tags question: http://stackoverflow.com/q/23574357
tags question: http://stackoverflow.com/q/23598620
tags question: http://stackoverflow.com/q/23487272
tags question: http://stackoverflow.com/q/23561389
tags question: http://stackoverflow.com/q/23501967
tags question: http://stackoverflow.com/q/23488545
tags question: http://stackoverflow.com/q/23578305
tags question: http://stackoverflow.com/q/23604694
tags question: http://stackoverflow.com/q/23529087
tags question: http://stackoverflow.com/q/23586559
tags question: http://stackoverflow.com/q/23458569
tags question: http://stackoverflow.com/q/23562293
tags question: http://stackoverflow.com/q/23495763
tags question: http://stackoverflow.com/q/23599477
tags question: http://stackoverflow.com/q/23584863
tags question: http://stackoverflow.com/q/23474460
tags question: http://stackoverflow.com/q/23467100
tags question: http://stackoverflow.com/q/23598066
tags question: http://stackoverflow.com/q/23527252
tags question: http://stackoverflow.com/q/23528064
tags question: http://stackoverflow.com/q/23461565
tags question: http://stackoverflow.com/q/23506028
tags question: http://stackoverflow.com/q/23533406
tags question: http://stackoverflow.com/q/23480272
tags question: http://stackoverflow.com/q/23536074
tags question: http://stackoverflow.com/q/23520883
tags question: http://stackoverflow.com/q/23606031
tags question: http://stackoverflow.com/q/23500017
tags question: http://stackoverflow.com/q/23594864
tags question: http://stackoverflow.com/q/23497337
tags question: http://stackoverflow.com/q/23593166

http://stackoverflow.com/comment/36223701
score: 0
type: Comment
type: QuestionComment
has text: without the provider it works, and if the response from the service is a Vector (JAX-RS implementation not mine) how come I cant set the same Vector (that works!). This just doesnt make any sense. Whithout the provider it works. And no its not duplicated because what im trying to do is not convert Vector to JSON directly
comment on: http://stackoverflow.com/q/23598180

http://stackoverflow.com/comment/36378157
type: AnswerComment
has text: Thanks for the input. As per the link: "Note: it is more common to implement an action listener using the "action" or "actionListener" attributes of a command component, such as h:commandButton or h:commandLink. The f:actionListener tag is useful for cases where you want to implement or reuse common action listener functionality across multiple components." And the methods are listed in code completion with 'h:commandButton', with the usage I posted above.
type: Comment
comment on: http://stackoverflow.com/a/23664131
score: 0

http://stackoverflow.com/q/23604115
has comment: http://stackoverflow.com/comment/36275706
tagged with: apache-commons-httpclient
type: AnsweredQuestion
tagged with: netbeans
has title: Newly-developed encoding issue with an Oracle Java program
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/3216730
tagged with: java
has body: My Java program (or rather, a part of it) sends a request to a webservice and receives rdf-strings including ancient Greek words in unicode. I wrote the program in netbeans and so far, there has not been a problem during run-time, both in the netbeans environment and outside as a standalone jar under Linux and Windows XP. Now, all of a sudden the Greek words in the rdf come back garbled like this: á¼€ At first, I thought this was a Windows XP problem, but when checking under Windows 7 the problem persisted. I found out that I was running OpenJDK under Linux, and was since able to reproduce the issue using Oracle Java. This is the relevant code (of course, I may have tunnel vision, so please tell me if you need more): try { HttpClient client = new DefaultHttpClient(); HttpGet get; get = new HttpGet(URL+URLEncoder.encode(form, "UTF-8")); HttpResponse response = client.execute(get); if (201 == response.getStatusLine().getStatusCode()) { HttpEntity respEnt = response.getEntity(); BufferedReader reader = new BufferedReader(new InputStreamReader(respEnt.getContent())); StringBuilder sb = new StringBuilder(); char[] cbuffer = new char[256]; int read; while ((read = reader.read(cbuffer)) != -1) { sb.append(cbuffer,0,read); } //System.out.println(sb.toString()); rdf = new String(sb.toString().getBytes("UTF-8"),"UTF-8"); } else { System.err.println("HTTP Request fehlgeschlagen."); } } catch (IOException e) { System.err.println("Problem beim HTTP Request."); } The webservice is the Perseus morphology service, it can be found here: http://services.perseids.org/bsp/morphologyservice/analysis/word?lang=grc&amp;engine=morpheusgrc&amp;word=. Try "word=μῆνιν", for example. How or when the rdf is generated, I really don't know. I would be very grateful for further insights!
has comment: http://stackoverflow.com/comment/36236517
type: Question
has comment: http://stackoverflow.com/comment/36377534
tagged with: encoding
has comment: http://stackoverflow.com/comment/36275954
has answer: http://stackoverflow.com/a/23658557
accepted answer: http://stackoverflow.com/a/23658557
has comment: http://stackoverflow.com/comment/36235240
tagged with: httprequest
has comment: http://stackoverflow.com/comment/36237242
has comment: http://stackoverflow.com/comment/36234446
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36237050
favorite count: 0
has comment: http://stackoverflow.com/comment/36332594
has comment: http://stackoverflow.com/comment/36236956
has comment: http://stackoverflow.com/comment/36234964
has comment: http://stackoverflow.com/comment/36377216

http://stackoverflow.com/comment/36278561
type: QuestionComment
has text: Did you try my suggestion "Create a docx in Word [with headers] setup as you'd like it, then run it through the docx4j demo webapp"?
score: 0
comment on: http://stackoverflow.com/q/23601516
type: Comment

http://stackoverflow.com/comment/36071029
comment on: http://stackoverflow.com/q/23515631
score: 0
type: Comment
type: QuestionComment
has text: please guide .... trying from last two days..

semaphore
type: Tag
tags question: http://stackoverflow.com/q/23461565
tag name: semaphore

http://stackoverflow.com/comment/36119511
type: AnswerComment
type: Comment
has text: Hope you don't mind the edits, I think I still captured your meaning. So if I were to go this route and create a common super-class, could I put anything in the `@XmlRootElement(name="")`? For example: `@XmlRootElement(name="null")`. Or can I leave the name out entirely?
comment on: http://stackoverflow.com/a/23526322
score: 0

http://stackoverflow.com/q/23497741
has comment: http://stackoverflow.com/comment/36035123
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36035544
tagged with: android
tagged with: android-adapter
upvote count: 1
has comment: http://stackoverflow.com/comment/36040291
has comment: http://stackoverflow.com/comment/36035250
has comment: http://stackoverflow.com/comment/36041262
has body: I need to implement expandable ListView, but I have null pointer exception in adapter at getChildrenCount() line of the code. Here is the code of adapter: public class DigitalMenuListAdapter extends BaseExpandableListAdapter { private Context _context; private ArrayList&lt;ProductCategory&gt; _listDataHeader; // header titles // child data in format of header title, child title // private HashMap&lt;String, ArrayList&lt;Products&gt;&gt; _listDataChild; private ProductCategory productCategory; private Products products; private HashMap&lt;String, ArrayList&lt;Products&gt;&gt; productsList; public DigitalMenuListAdapter(Context context, ArrayList&lt;ProductCategory&gt; productCategoryList, HashMap&lt;String, ArrayList&lt;Products&gt;&gt; listDataForChild) { this._context = context; this._listDataHeader = productCategoryList; this.productsList = listDataForChild; } @Override public Object getChild(int groupPosition, int childPosititon) { return null; } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { //final String childText = (String) getChild(groupPosition, childPosition); products = productsList.get(childPosition).get(childPosition); final String childText = products.getName(); if (convertView == null) { LayoutInflater infalInflater = (LayoutInflater) this._context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = infalInflater.inflate(R.layout.digital_menu_list_item, null); } TextView txtListChild = (TextView) convertView .findViewById(R.id.lblListItem); txtListChild.setText(childText); return convertView; } @Override public int getChildrenCount(int groupPosition) { return this.productsList.get(groupPosition).size(); } @Override public Object getGroup(int groupPosition) { return this._listDataHeader.get(groupPosition); } @Override public int getGroupCount() { return …
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36034713
downvote count: 0
has title: Expandable ListView Adapter getChildrenCount NPE
has comment: http://stackoverflow.com/comment/36040214
has comment: http://stackoverflow.com/comment/36039112
tagged with: android-listview

http://stackoverflow.com/a/23501907
answers question: http://stackoverflow.com/q/23501716
has body: Ljava/uitl/Date is misspelled. Should be Ljava/util/Date instead. Also, a Delphi TDateTime, which is implemented as a Double, is not compatible with a Java java.util.Date, which is an object instance. You need to create a real Date object instance and assign the TDateTime value to it as needed. Try something more like this instead (I don't use JNI in Delphi, so this might need some tweaking, but you get the idea): uses ..., DateUtils; procedure TMyJavaObject.SetDateStart(const DateStart: TDateTime); var DateValue: Int64; // a Java 'long' is a 64-bit type DateClass: JClass; DateObj: JObject; method : JMethodID; begin // DateTimeToUnix() returns a value in seconds, // but the java.util.Date(long) constructor expects // a value in milliseconds instead... DateValue := DateTimeToUnix(DateStart) * 1000; // create a java.util.Date object instance, passing the // converted TDateTime value as a 'long' to its constructor... DateClass := JNIEnv.FindClass('java/util/Date'); method := JNIEnv.GetMethodID(DateClass, '&lt;init&gt;', '(J)V'); DateObj := JNIEnv.NewObject(DateClass, method, [DateValue]); // pass the java.util.Date object to the desired object method... method := getMethod(self.clazz, 'setDateStart', '(Ljava/util/Date;)V'); JNIEnv.CallVoidMethod(self.javaObject, method, [DateObj]); end;
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23501716

http://stackoverflow.com/a/23563884
has body: use getValue() method instead of getName() method
answers question: http://stackoverflow.com/q/23563478
score: 0
type: Answer

http://stackoverflow.com/comment/35985408
has text: You might want to remove the static keyword in your snippet (since you tell him what to do in order to solve the issue) :)
type: Comment
comment on: http://stackoverflow.com/a/23471517
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36036988
comment on: http://stackoverflow.com/q/23498514
type: Comment
type: QuestionComment
score: 0
has text: The only way I see for checking such a constraint at compile time is to annotate all these classes with a custom annotation and let a annotation processor do the checks (see package [`javax.annotation.processing`](http://docs.oracle.com/javase/8/docs/api/javax/annotation/processing/package-summary.html)).

android-activity
tags question: http://stackoverflow.com/q/23461802
tags question: http://stackoverflow.com/q/23593775
tags question: http://stackoverflow.com/q/23518196
tags question: http://stackoverflow.com/q/23504217
tags question: http://stackoverflow.com/q/23491128
tag name: android-activity
tags question: http://stackoverflow.com/q/23593433
tags question: http://stackoverflow.com/q/23592797
tags question: http://stackoverflow.com/q/23546303
tags question: http://stackoverflow.com/q/23596477
tags question: http://stackoverflow.com/q/23540904
tags question: http://stackoverflow.com/q/23462476
tags question: http://stackoverflow.com/q/23535365
tags question: http://stackoverflow.com/q/23613994
tags question: http://stackoverflow.com/q/23502174
tags question: http://stackoverflow.com/q/23573752
type: Tag

http://stackoverflow.com/comment/36124436
score: 1
comment on: http://stackoverflow.com/q/23545490
type: Comment
type: QuestionComment
has text: Oh OK. Thanks for the heads up. Now that you mentioned it, I'm reading on previously answered questions about HibernateTemplate.

http://stackoverflow.com/a/24457111
score: 22
answers question: http://stackoverflow.com/q/23575067
upvote count: 22
has body: CompletableFuture.supplyAsync is just a helper method that creates a CompletableFuture for you, and submits the task to the ForkJoin Pool. You can create your own supplyAsync with your requirements like this: private static final ScheduledExecutorService schedulerExecutor = Executors.newScheduledThreadPool(10); private static final ExecutorService executorService = Executors.newCachedThreadPool(); public static &lt;T&gt; CompletableFuture&lt;T&gt; supplyAsync( final Supplier&lt;T&gt; supplier, long timeoutValue, TimeUnit timeUnit, T defaultValue) { final CompletableFuture&lt;T&gt; cf = new CompletableFuture&lt;T&gt;(); // as pointed out by Peti, the ForkJoinPool.commonPool() delivers a // ForkJoinTask implementation of Future, that doesn't interrupt when cancelling // Using Executors.newCachedThreadPool instead in the example // submit task Future&lt;?&gt; future = executorService.submit(() -&gt; { try { cf.complete(supplier.get()); } catch (Throwable ex) { cf.completeExceptionally(ex); } }); //schedule watcher schedulerExecutor.schedule(() -&gt; { if (!cf.isDone()) { cf.complete(defaultValue); future.cancel(true); } }, timeoutValue, timeUnit); return cf; } Creating the CompletableFuture with that helper is as easy as using the static method in CompletableFuture: CompletableFuture&lt;String&gt; a = supplyAsync(() -&gt; "hi", 1, TimeUnit.SECONDS, "default"); To test it: a = supplyAsync(() -&gt; { try { Thread.sleep(2000); } catch (InterruptedException e1) { // ignore } return "hi"; }, 1, TimeUnit.SECONDS, "default");
has comment: http://stackoverflow.com/comment/49572214
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/73943343
has comment: http://stackoverflow.com/comment/60536511
has comment: http://stackoverflow.com/comment/49625997

http://stackoverflow.com/q/23535723
possible better answer: http://stackoverflow.com/a/23535774
has title: Split starting alphabetical characters from numeric characters
has body: I want to split a string so that I get starting alphabetical string(until the first numeric digit occured). And the other alphanumeric string. E.g.: I have a string forexample: Nesc123abc456 I want to get following two strings by splitting the above string: Nesc, 123abc456 What I have tried: String s = "Abc1234avc"; String[] ss = s.split("(\\D)", 2); System.out.println(Arrays.toString(ss)); But this just removes the first letter from the string.
tagged with: string
has answer: http://stackoverflow.com/a/23535829
has answer: http://stackoverflow.com/a/23535801
tagged with: regex
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23535774
tagged with: java
has answer: http://stackoverflow.com/a/23537048
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/23535771
answer count: 6
accepted answer: http://stackoverflow.com/a/23535801
has answer: http://stackoverflow.com/a/23535910
score: 0

http://stackoverflow.com/a/25470574
score: 0
type: Answer
has body: you must close your client socket before closing client window...
answers question: http://stackoverflow.com/q/23467866

http://stackoverflow.com/q/23470495
answer count: 1
downvote count: 0
tagged with: httpurlconnection
favorite count: 0
accepted answer: http://stackoverflow.com/a/23470562
has title: Sending data over using HttpUrlConnection
tagged with: put
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
has body: I am trying to send data over to a rest service using HttpUrlConnection like this: public void makePutRequest(String objtype,String objkey,String json) { String uri="http://localhost:8180/GoogleMapsLoadingTest/rest/GoogleMapsErp/"+objtype+"/"+objkey; HttpURLConnection conn=null; URL url=null; BufferedWriter writer=null; try { url=new URL(uri); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { conn=(HttpURLConnection) url.openConnection(); conn.addRequestProperty("Content-Type", "application/json"); conn.setRequestMethod("PUT"); conn.setDoInput(true); conn.setDoOutput(true); System.out.println(json); writer=new BufferedWriter(new OutputStreamWriter(conn.getOutputStream())); writer.write(json); int rc=conn.getResponseCode(); System.out.println("The response code is "+rc); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if(writer!=null) { try { writer.flush(); writer.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(conn!=null) conn.disconnect(); } } } I get this error because the String could not be sent over
type: Question
tagged with: jersey
has answer: http://stackoverflow.com/a/23470562

http://stackoverflow.com/comment/36100910
has text: you have asked 5 questions but havent accepted any answers.Reward the person by accepting answer of that person whose answer solved your problem
comment on: http://stackoverflow.com/q/23532713
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23591166
upvote count: 1
has body: if you are using emulator to run your app for local server. mention the local ip as 10.0.2.2 and have to give Internet permission into your app For more details, please refer this link. Also, Turn Off the firewall and any anti-virus application in your PC
answers question: http://stackoverflow.com/q/23591096
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/23613492
downvote count: 0
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/33270860
has body: I'm developing a webservice using Dropwizard JDBI framework. Now, instead of having a db configurations in yaml file, I want to use 'user specified params' what i mean to say is, the db configs will be provided through the endpoint url. Is having custom creds possible through dropwizard jdbi? if yes, what changes should i be thinking to do in the code while referring this ? -> http://dropwizard.readthedocs.org/en/latest/manual/jdbi.html I understand, in normal flow, the service method gets the config details in the run method - -- Config Class public class ExampleConfiguration extends Configuration { @Valid @NotNull @JsonProperty private DatabaseConfiguration database = new DatabaseConfiguration(); public DatabaseConfiguration getDatabaseConfiguration() { return database; } } -- Service Class @Override public void run(ExampleConfiguration config, Environment environment) throws ClassNotFoundException { final DBIFactory factory = new DBIFactory(); final DBI jdbi = factory.build(environment, config.getDatabaseConfiguration(), "postgresql"); final UserDAO dao = jdbi.onDemand(UserDAO.class); environment.addResource(new UserResource(dao)); } -- and yaml database: # the name of your JDBC driver driverClass: org.postgresql.Driver # the username user: pg-user # the password password: iAMs00perSecrEET # the JDBC URL url: jdbc:postgresql://db.example.com/db-prod But in this case, I might get the config details in the Resource level... smthing like - @GET @Path(value = "/getProduct/{Id}/{dbUrl}/{dbUname}/{dbPass}") @Produces(MediaType.APPLICATION_JSON) public Product getProductById(@PathParam(value = "Id") int Id, @PathParam(value = "dbUrl") String dbUrl, @PathParam(value = "dbUname") String dbUname, @PathParam(value = "dbPath") String dbPass) { //I have to connect to the DB here! using the params i have. return new Product(); //should return the Product } I'd appreciate if someone can point me a direction.
tagged with: jdbi
has answer: http://stackoverflow.com/a/23614134
accepted answer: http://stackoverflow.com/a/23614134
type: Question
score: 3
has title: Use custom creds while using DropWizard JDBI
tagged with: java
upvote count: 3
has answer: http://stackoverflow.com/a/33270860
answer count: 2
tagged with: dropwizard

http://stackoverflow.com/comment/35997242
type: AnswerComment
has text: You mean you get better performance with a static class? Do you know if there are any metrics on how much more efficient this is? I imagine it would be pretty small.
comment on: http://stackoverflow.com/a/23477814
score: 0
type: Comment

http://stackoverflow.com/comment/36209117
has text: ahh yea this works, thanks alot! I will read more about streams for now
comment on: http://stackoverflow.com/a/23581396
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36225321
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23599619
score: 4
has text: Have you tried using a debugger? The exception describes what's going on pretty darn well...

http://stackoverflow.com/comment/36183917
comment on: http://stackoverflow.com/a/23577248
type: Comment
has text: Well you can't get the javadoc from the source on runtime, but you could use Doclet with javadoc to extract that information to a file
score: 1
type: AnswerComment

http://stackoverflow.com/q/23459315
has title: How to understand this piece of generics in Java?
has body: This is the sample code from Hadoop's online tutorial (https://hadoop.apache.org/docs/r1.2.1/mapred_tutorial.html) public class WordCount { public static class Map extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { // Something here } } In the square brackets, there are &lt;LongWritable, Text, Text, IntWritable&gt; and the twice appearance of Text confuses me. How do we tell which Text it refers to in the actual code since there are two of them with the same name? e.g. when we use private Text word = new Text(); A similar code in the same piece is public static class Reduce extends MapReduceBase implements Reducer&lt;Text, IntWritable, Text, IntWritable&gt;.
accepted answer: http://stackoverflow.com/a/23459359
type: AnsweredQuestion
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/23459359
score: 0
has comment: http://stackoverflow.com/comment/35963212
answer count: 1
tagged with: generics

http://stackoverflow.com/comment/36234890
comment on: http://stackoverflow.com/q/23604510
has text: this question needs more Java context. Java files, arrays and strings are a whole different world compared to C.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/36239543
score: 1
comment on: http://stackoverflow.com/q/23540387
type: Comment
type: QuestionComment
has text: the name `…JAVA_HOME` suggests that it should point to the `jre` directory rather than the `bin\java.exe` within it. You can try to set `EXE4J_LOG` to `yes` to get a log file in your `%TMP%` directory which might tell you why the automated lookup failed.

http://stackoverflow.com/q/23464310
has comment: http://stackoverflow.com/comment/35978085
has body: If I have: public static int[] leftHalf(int[] array) { int size1 = array.length / 2; int[] left = new int[size1]; for (int i = 0; i &lt; size1; i++) { left[i] = array[i]; } return left; } Is this equivalent to public static ArrayList&lt;T&gt; leftHalf(ArrayList&lt;T&gt; list) { int sizeLeft = list.size()/2; ArrayList&lt;T&gt; left = new ArrayList&lt;T&gt;(sizeLeft); for(int i=0; i&lt;sizeLeft; i++) { left.add(list.get(i)); } return left; } I think the add part is the tricky one since ArrayList has different properties with regards to things like size and capacity. Is the conversion correct?
tagged with: java
has answer: http://stackoverflow.com/a/23464393
accepted answer: http://stackoverflow.com/a/23464393
has comment: http://stackoverflow.com/comment/35972892
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/35972840
has comment: http://stackoverflow.com/comment/35973320
score: 0
has comment: http://stackoverflow.com/comment/35972912
has title: Convert array syntax for ArrrayList
possible better answer: http://stackoverflow.com/a/23464345
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35972803
has answer: http://stackoverflow.com/a/23464345
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/a/23519574
answers question: http://stackoverflow.com/q/23517975
has comment: http://stackoverflow.com/comment/36088931
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36077295
has body: They just seem to be JS warnings. Most likely because the JS engine doesn't like some parts of the code. Disregard them if the process work properly. If you want to turn them off they would most likely go away with my answer to this question (you just have to add 2 lines): Turning HtmlUnit Warnings off
has comment: http://stackoverflow.com/comment/75975136

http://stackoverflow.com/comment/35964623
has text: @tony what is that you want. there is no quit for android. Each activity has a lifecyle and you need to handle it. Activities are added to back stack and popped.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23459966

http://stackoverflow.com/q/23516976
has body: I have a main class that extends jpanel,and an inner class Brick that uses a graphics parameter to draw rectangle on screen,i am trying to make these rectangle resizeable when the panel size change these Bricks are drawn in the method paintComponent() also their width and height are assigned in the same method,I call paintComponent() every 30millis brick width is a percentage of the panel width so i'm trying to save the old brick width in a variable and increasing the x coordinate of the brick by the difference between the old and new brick width but it wouldn't work I have the following code: int width,height,brickHeight,brickWidth,tempBWidth,diffrence; ArrayList&lt;Brick&gt; listOfBricks = new ArrayList&lt;Panel.Brick&gt;(); Timer timer = new Timer(30,this); boolean bricksFilled,resized; public Panel() { setBackground(Color.BLACK); setVisible(true); timer.start(); } //end constructor Panel(). protected void paintComponent(Graphics g) { width = getWidth(); height = getHeight(); setSize(width,height); tempBWidth = brickWidth; brickHeight = height/20; brickWidth = width/10; if(width != 0 &amp;&amp; tempBWidth != brickWidth) { diffrence = brickWidth - tempBWidth; } super.paintComponent(g); if(bricksFilled == false) { fillListOfBricks(); } drawBricks(listOfBricks, g); diffrence = 0; } //end method paintComponent(). public void actionPerformed(ActionEvent event) { repaint(); } //end method actionPerformed(). void fillListOfBricks() { for (int row = 0;row &lt; height/2;row += brickHeight+1 ) { for (int column = 0;column &lt; width;column += brickWidth+1) { if(brickWidth != 0){ listOfBricks.add(new Brick(column,row,true,brickWidth,brickHeight)); bricksFilled = true; } //end if. } //end inner loop. } //end outer loop. } //end method fillListOfBricks(). void drawBricks(ArrayList&lt;Brick&gt; listOfBricks,Graphics g) { for (Brick brick:listOfBricks) { if(listOfBricks.isEmpty() == false) { if (brick.visible) { brick.draw(g); } //end inner if. } //end outer if. } //end loop. }…
has comment: http://stackoverflow.com/comment/36070051
type: UnansweredQuestion
has title: how to resize a JComponent on repaint?
tagged with: resizable
tagged with: swing
has comment: http://stackoverflow.com/comment/36069972
has answer: http://stackoverflow.com/a/23517709
has answer: http://stackoverflow.com/a/23518478
tagged with: java
tagged with: jcomponent
type: Question
score: 0
answer count: 2

http://stackoverflow.com/q/23598620
score: 0
answer count: 3
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/36223565
has answer: http://stackoverflow.com/a/23598673
has body: I have a txt-file of names I need to be able to sort alphabetically. My program then takes the array, splits into the amount of threads passed as an argument in the terminal, and gives each thread a piece of the array to sort, then stores all the threads in an array. Now, what I need some help with is this: I now want to take threads, as soon as they are done (Ie. if two are done before the others, they start to merge then wait for more). Think of it like braiding. I know how to write the sorting code for the merging, but what I hope you can help me with is this: How do I manage the threads? I know what wait() and notify() does, but I can't seem to be able to wrap my ead around what exactly I would need to do to make them merge into one array. Should I: Create a method inside the thread-class that merges the arrays? Create a new thread for every other thread that is done, pass the two sorted word-arrays as a parameter, and let that thread do the sorting? Something else I haven't thought of. I hope this was clear enough, and of good enough quality as the questions should be.
has comment: http://stackoverflow.com/comment/36223544
type: AnsweredQuestion
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/23598673
type: Question
possible better answer: http://stackoverflow.com/a/23599500
has answer: http://stackoverflow.com/a/23626019
has answer: http://stackoverflow.com/a/23599500
tagged with: java
has comment: http://stackoverflow.com/comment/36223518
has title: Java sorting an array of words with threads

http://stackoverflow.com/comment/36172141
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23571285
has text: You are asking a general and vague question. Obviously, other people don't know what information your XML file contains and how this translates to the commands you're talking about, so it's going to be hard to help you with this.
score: 0

http://stackoverflow.com/q/23557634
type: UnansweredQuestion
tagged with: android
tagged with: maven
score: 2
downvote count: 0
has body: if i add library from maven repository into my project (via its IDE's ui) then inteliJ ideadon't write its dependency in pom.xml file. why? how? do you have any idea?
tagged with: java
has title: Auto importing and updating pom.xml [inteliJ idea 13]
type: Question
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/23557773
upvote count: 2
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36233797
type: AnswerComment
type: Comment
has text: My bad. That was not valid offcourse. Edited - now it should be ok. http://www.nilab.info/docs/jak091130/de/micromata/opengis/kml/v_2_2_0/Kml.html
comment on: http://stackoverflow.com/a/23604163
score: 0

http://stackoverflow.com/comment/36241586
type: Comment
type: QuestionComment
has text: usually during the mark phase we do DFS on all the roots, but for this situation we only do DFS on half of them
score: 0
comment on: http://stackoverflow.com/q/23607827

http://stackoverflow.com/a/23524369
has comment: http://stackoverflow.com/comment/36085427
has comment: http://stackoverflow.com/comment/36084965
has comment: http://stackoverflow.com/comment/36087181
has comment: http://stackoverflow.com/comment/36085308
score: 1
has comment: http://stackoverflow.com/comment/36085210
has body: Your consumer code reads int product = 0; // code which doesn't change "product" System.out.println("consumed:"+product); I suggest you need a remove() method which returns the value from the queue instead of being passed a value. I also suggest you get the code to work in one thread before attempting to use in multiple threads.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23524250
upvote count: 1
answers question: http://stackoverflow.com/q/23524250
type: Answer
has comment: http://stackoverflow.com/comment/36087896
downvote count: 0
has comment: http://stackoverflow.com/comment/36084900
has comment: http://stackoverflow.com/comment/36085365

http://stackoverflow.com/a/23608792
has body: The link http://www.lyricsfreak.com/search.php is not available that is why its showing error. When you say it lists after sometimes, what actually happens is a redirect to home page. So instead of using http://www.lyricsfreak.com/search.php you could use home page link http://www.lyricsfreak.com/ A sample based on comment Ok. I suppose you want to read the tracks after a search from a java program using jsoup. the problem with lyricsfreak is it checks for source before returning result. If the source querying is not lyricsfreak.com it redirects to a access_error.htm and from there using the below script it submits again to get the result after 3.5 seconds &lt;script type="text/javascript"&gt; var redirect_url = document.location.href.match(/\?(.*)/); redirect_url = redirect_url ? '/search.php?' + redirect_url[1] : '/'; setTimeout(function() { document.location.href = (redirect_url); }, 3500); &lt;/script&gt; So what you could do here is set the referrer as 'lyricsfreak.com' via jsoup and it'll give you proper result with out access_error. So a sample code would be as follows. Of course you could parse the page in a better way but this is just to give you an idea. import java.util.ArrayList; import java.util.List; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; public class LyricsParser { public static void main(String[] args) throws Exception { String SEARCH_STRING = "Madonna"; String URL = "http://www.lyricsfreak.com/search.php?a=search&amp;type=song&amp;q="; List&lt;String&gt; artists = new ArrayList&lt;String&gt;(); List&lt;String&gt; songs = new ArrayList&lt;String&gt;(); List&lt;String&gt; hits = new ArrayList&lt;String&gt;(); Document doc = Jsoup.connect(URL + SEARCH_STRING) .referrer(URL + SEARCH_STRING).get(); for(Element tracks : doc.select("td.colfirst")){ for(Element links : tracks.getElementsByTag("a")){ artists.add(links.text()); } } for(Element tracks : doc.select("td &gt; a.song")){ for(Element links : tracks.…
answers question: http://stackoverflow.com/q/23608452
type: Answer
accepted answer of: http://stackoverflow.com/q/23608452
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36244640
has comment: http://stackoverflow.com/comment/36268384
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36314389
has comment: http://stackoverflow.com/comment/36242146

http://stackoverflow.com/comment/35954129
type: Comment
has text: No worries, glad we could help.
type: AnswerComment
comment on: http://stackoverflow.com/a/23454506
score: 0

http://stackoverflow.com/a/23604851
answers question: http://stackoverflow.com/q/23604794
upvote count: 4
downvote count: 0
score: 4
type: Answer
has body: You are checking for the existence of the next line and scanning the next word. Either change the condition in while to while(scanner.hasNext()) or the scan line to String s = scanner.nextLine(). Try this: public int getOffset(File file, String searched) throws FileNotFoundException { Scanner scanner = new Scanner(file).useDelimiter(System.getProperty("line.separator")); int occurences = 0; while (scanner.hasNext()) { String s = scanner.next(); if (s.indexOf(searched) &gt;= 0) { occurences++; } } return occurences; } or public int getOffset(File file, String searched) throws FileNotFoundException { Scanner scanner = new Scanner(file).useDelimiter(System.getProperty("line.separator")); int occurences = 0; while (scanner.hasNextLine()) { String s = scanner.nextLine(); if (s.indexOf(searched) &gt;= 0) { occurences++; } } return occurences; }

http://stackoverflow.com/comment/36136087
type: AnswerComment
type: Comment
has text: works great. thanks alot. just added another method to example. wonder if I add user validation there or in main method?
comment on: http://stackoverflow.com/a/23551476
score: 0

http://stackoverflow.com/comment/36178495
score: 0
type: AnswerComment
has text: Hi again, it seems you were on the right track. I have to prepare `OuterClass.class`, which constructs an `OuterClass.FinalClass` object, but I also have to prepare `TestClass.class` because it constructs an `OuterClass` object. If you update your answer, I will accept it.
type: Comment
comment on: http://stackoverflow.com/a/23573796

http://stackoverflow.com/a/35515703
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23611800
has body: If you want to read a value of var for example title name of room in config Form form = chat.getConfigurationForm(); String value = form.getField("muc#roomconfig_roomname").getValues().next(); then do what ever you want with value..

http://stackoverflow.com/comment/36141167
comment on: http://stackoverflow.com/q/23553419
has text: I had not stumbled onto `SetDragEnabled` until just now. (It's in none of my texts.) However, given the particulars of my situation (can only drag "black" letters from the seven cells at the bottom of the screen to non-empty cells on the grid and other "rule-enforcement" complications, such as re-filling the empty box after its contents are dragged), I'm not sure having set `setDragEnabled` would have saved much code. I still wouldn't know which cells were involved, would I?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35997604
type: Comment
comment on: http://stackoverflow.com/a/23464225
has text: @user3602810: You should probably ask that as a new question if you want any attention. Remember to trim your code down to the relevant part and post a clear question.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23530594
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23530127
has body: Joop's solution is perfect for Java7 (or later). If you are stuck on an older version (or want to extend your tool arsenal anyway), have a look at the following free libraries: Apache Commons IO (actually all Apache Commons are interesting to look at). There you can do IOUtils.copy(...) Google Guava There it is a little more complicated but flexible. Use ByteSource.copyTo(ByteSink) I like the caching in the Google libraries, pretty neat
downvote count: 0
type: Answer

http://stackoverflow.com/a/27871675
score: 3
downvote count: 0
type: Answer
has body: I had the same problem, mine was a little different though I did not have a package name. My problem was the Class Path for example: C:\Java Example&gt;java -cp . HelloWorld The -cp option for Java and from what I can tell from my experience (not much) but I encountered the error about 20 times trying different methods and until I declared the class Path I was receiving the same error. Vishrant was correct in stating that . represents current directory. If you need more information about the java options enter java -? or java -help I think the options are not optional. I just did some more research I found a website that goes into detail about CLASSPATH. The CLASSPATH must be set as an environment variable; to the current directory &lt;.>. You can set it from the command line in windows: // Set CLASSPATH to the current directory '.' prompt&gt; set CLASSPATH=. When you add a new environment setting you need to reboot before enabling the variable. But from the command prompt you can set it. It also can be set like I mentioned at the beginning. For more info, and if your using a different OS, check: Environment Variables.
answers question: http://stackoverflow.com/q/23530173
upvote count: 3

http://stackoverflow.com/a/23465120
has body: If you are using a front controller[spring mvc] then you can pass the data by doing, model.addAttribute("variable_name ", data); and in the jsp you can access it by doing this ${variable_name};
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23464968
has comment: http://stackoverflow.com/comment/35974282

http://stackoverflow.com/comment/47782697
type: QuestionComment
comment on: http://stackoverflow.com/q/23497040
score: 0
has text: Did you find solution for this?
type: Comment

http://stackoverflow.com/comment/36643381
type: AnswerComment
comment on: http://stackoverflow.com/a/23804322
has text: Excellent Answer! Thank you so much. That particular document, pdf in question, had some sensitive data that I could not post. But I was trying to find some document with similar attributes I could post without worrying about it. Anyway, this seems to resolve the issue! Thanks again! :)
score: 0
type: Comment

http://stackoverflow.com/comment/36140891
comment on: http://stackoverflow.com/q/23554240
has text: While a complete code sample is great, your code seems a bit too artificial at present - while we could just answer your question as stated, we may not be able to give you the best solution to your problem, as we don't have enough context regarding why you want to do this. See also - [What is the XY problem?](http://meta.stackexchange.com/q/66377)
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/a/23562437
answers question: http://stackoverflow.com/q/23562308
score: 2
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has body: You can use Set.retainAll. Here's an ugly example: Map&lt;String, String&gt; m0 = new HashMap&lt;String, String&gt;(); m0.put("a", "a"); m0.put("b", "b"); Map&lt;String, String&gt; m1 = new HashMap&lt;String, String&gt;(); m1.put("c", "c"); m1.put("b", "b"); Set&lt;String&gt; s = new HashSet&lt;String&gt;(m0.keySet()); s.retainAll(m1.keySet()); System.out.println(s); Output [b]
type: Answer
accepted answer of: http://stackoverflow.com/q/23562308

http://stackoverflow.com/comment/36169690
type: Comment
comment on: http://stackoverflow.com/q/23569846
type: QuestionComment
has text: And you still get the same exception?
score: 0

http://stackoverflow.com/comment/36243423
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/23609530
has text: Why do you care about that? Windows folder names are by default case insensitive.
type: Comment

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/23471054

http://stackoverflow.com/q/23496936
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23498798
score: 0
has comment: http://stackoverflow.com/comment/36033440
has title: Binary Search Tree - Removal results in incorrect tree
answer count: 1
favorite count: 0
tagged with: binary-search-tree
accepted answer: http://stackoverflow.com/a/23498798
type: AnsweredQuestion
has body: I'm trying to learn data structures myself and I'm struggling to understand how the remove method should work for a Binary Search Tree. I'm following the example from Data Structures and Algorithms - Barnett &amp; Del Tongo textbook: I've got most of it working, however this section of my code is resulting in the tree being incorrect: //Case 4 TreeNode largestValue = nodeToRemove.left; while (largestValue.right != null) { //Find the largest value in the left subtree of nodeToRemove largestValue = largestValue.right; } TreeNode n = findParent(largestValue.getKey(), this.root); n.right = null; nodeToRemove.key = largestValue.getKey(); If you can help me fix it or recommend a better resource that will help me construct this method correctly, that would be great.
tagged with: java

http://stackoverflow.com/q/23520814
answer count: 1
tagged with: android-sensors
tagged with: android-4.4-kitkat
tagged with: android
has comment: http://stackoverflow.com/comment/36077769
has body: I need a pedometer for a project I am doing, so I followed this tutorial: http://blog.bawa.com/2013/11/create-your-own-simple-pedometer.html Unfortunately even following every single line of code from it, it does not work. By that I mean, no steps are ever counted or detected. Unfortunately I can't get in touch with the creator of the tutorial and I need it ASAP. Anyone have any idea what might be the issue? Am I missing something important? Here is the code: private TextView textView; private SensorManager mSensorManager; private Sensor mStepCounterSensor; private Sensor mStepDetectorSensor; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView = (TextView)findViewById(R.id.textView); mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); mStepCounterSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER); mStepDetectorSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR); } protected void onResume() { super.onResume(); mSensorManager.registerListener(this, mStepCounterSensor, SensorManager.SENSOR_DELAY_FASTEST); mSensorManager.registerListener(this, mStepDetectorSensor, SensorManager.SENSOR_DELAY_FASTEST); } protected void onStop() { super.onStop(); mSensorManager.unregisterListener(this, mStepCounterSensor); mSensorManager.unregisterListener(this, mStepDetectorSensor); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { // TODO Auto-generated method stub } @Override public void onSensorChanged(SensorEvent event) { Sensor sensor = event.sensor; float[] values = event.values; int value = -1; if (values.length &gt; 0) { value = (int) values[0]; } if (sensor.getType() == Sensor.TYPE_STEP_COUNTER) { textView.setText(" Step …
has comment: http://stackoverflow.com/comment/36077946
tagged with: java
tagged with: sensormanager
type: Question
type: AnsweredQuestion
has title: Simple Android Pedometer not working
accepted answer: http://stackoverflow.com/a/23521170
score: 0
has answer: http://stackoverflow.com/a/23521170

http://stackoverflow.com/comment/35995861
has text: .add(Restrictions.eq("name", name)) is same -- return true, although "name" is "aa" and name (without "") is "Aa"
comment on: http://stackoverflow.com/a/23476885
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23614224
has body: This problem is related to the initialization of the Jersey packages through param name and param value. Your url looks perfect. Param value should contain the valid package name. Make sure the LifeEvent class exists in this package (autobiographical.aid.webservices) That resolves the issue.
answers question: http://stackoverflow.com/q/23613942
has comment: http://stackoverflow.com/comment/36258498
type: Answer
score: 0

http://stackoverflow.com/comment/36198225
type: QuestionComment
score: 0
has text: I've just tried it. This method was not called
comment on: http://stackoverflow.com/q/23585157
type: Comment

http://stackoverflow.com/comment/36024647
type: Comment
type: QuestionComment
has text: what is the error message?
score: 1
comment on: http://stackoverflow.com/q/23492764

http://stackoverflow.com/q/23570343
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23571214
tagged with: sql-server
score: 0
tagged with: sql
has comment: http://stackoverflow.com/comment/36170588
type: UnansweredQuestion
has body: There are three tables as follows Table 1 - Vehicle Vehicle_Id PRIMARY KEY Name Serial_Number Table 2 - Propertyname Property_Id PRIMARY KEY Name Table 3 - Property Property_Id (FOREIGN KEY) references Property_Id from Propertyname table Value Id (FOREIGN KEY) references Vehicle_Id from Vehicle table Sample Data Table 1 - Vehicle Vehicle_Id Name Serial_Number 1000 WagonR Maruti-WagonR 1001 Estilo Maruti-Estilo 1002 Zen Maruti-Zen Table 2 - Propertyname Property_Id name 100 Mileage 101 FuelType 102 Country Table 3 - Property Property_Id Value Id 100 50 1000 101 Petrol 1000 102 India 1000 100 35 1001 101 Diesel 1002 From the three tables we can see that each vehicle has a set of properties which are kept as rows in the Property table. This is done so that in case we add more properties to a vehicle we add a row entry for the vehicle rather than adding a column which is not feasible. Now I have a UI where in i can search for vehicles based on their 1) Name, Serial_Number - These are available as columns in the Vehicle table &amp; 2) Mileage, FuelType, Country - These are the properties for the particular Vehicle The user can enter any combination of values in 1) and 2) above to search through the list of vehicles. Eg:- If the user enters Mileage as 50 and FuelType as Diesel, i should fetch results of vehicles which have Mileage as 50 AND FuelType as Diesel. I tried the following SQL statement to do the same select vh.Vehicle_Id, vh.name, pt.Property_Id, pn.name, pt.value from property pt inner join propertyname pn on pt.Property_Id=pn.Property_Id inner join vehicle vh on vh.Vehicle_Id=pt.Id and ((pn.Name='Mileage' AND pt.Value='50') AND (pn.Name='FuelType' AND pt.Value='Petrol')); But i get zero results due to the AND condition on the single row result. But if i change the last AND condition to OR i get two results which match the criteria. But I am trying to fetch Vehicles which matches both the properties matching. I have tried using INTERSECT, inner join of two SQL …
has answer: http://stackoverflow.com/a/23571340
has title: Select query to retrieve results based on multiple values for a one column (AND condition)
has comment: http://stackoverflow.com/comment/36170344
tagged with: java

http://stackoverflow.com/comment/36202009
comment on: http://stackoverflow.com/q/23587157
score: 1
type: Comment
type: QuestionComment
has text: Also note that if n is an odd number then it is possible that the requested element belongs to both diagonals.. When r == c && r == n/2+1

http://stackoverflow.com/comment/36131651
score: 0
type: Comment
type: QuestionComment
has text: Well Next best bet create overloaded method getX(Fuwa fooObj) and getX(Fuko fooObj) , then just call x = getX(fooObject)
comment on: http://stackoverflow.com/q/23549262

http://stackoverflow.com/q/23570014
tagged with: java
has answer: http://stackoverflow.com/a/44378199
has answer: http://stackoverflow.com/a/23570704
has title: Spring 4 Java Config for MultipartResolver for Servlet 3.0
type: Question
upvote count: 9
tagged with: spring-java-config
tagged with: servlets
score: 9
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/23570704
favorite count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has body: I'm taking an all-Java approach to Spring MVC configuration and cannot figure out how to associate a MultipartConfigElement with my DispatcherServlet programmatically. Spring documentation states: In order to use Servlet 3.0 based multipart parsing, you need to mark the DispatcherServlet with a "multipart-config" section in web.xml, or with a javax.servlet.MultipartConfigElement in programmatic Servlet registration... http://docs.spring.io/spring/docs/4.0.4.RELEASE/spring-framework-reference/htmlsingle/#mvc-multipart Here is my WebApplicationInitializer code: public class DispatcherServletInitializer implements WebApplicationInitializer { private static final Logger logger = LoggerFactory.getLogger(DispatcherServletInitializer.class); @Override public void onStartup(ServletContext container) { // Create the 'root' Spring application context AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(AppConfig.class); // Manage the lifecycle of the root application context container.addListener(new ContextLoaderListener(rootContext)); // Create the dispatcher servlet's Spring application context AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext(); dispatcherContext.register(WebConfig.class); //HOW CAN I ASSOCIATE THIS CONFIG WITH MY DISPATCHER SERVLET? MultipartConfigElement config = new MultipartConfigElement("C:\\Temp", 20848820, 418018841, 1048576); DispatcherServlet dispatcherServlet = new DispatcherServlet(dispatcherContext); // Register and map the dispatcher servlet ServletRegistration.Dynamic dispatcher = container.addServlet("dispatcher", dispatcherServlet); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/*"); } } How do I associate the MultipartConfigElement with my DispatcherServlet? I don't see any method like setMultipartConfiguration or any constructor that accepts it. Also note that my WebConfig declares a MultipartResolver: @Bean public …
possible better answer: http://stackoverflow.com/a/44378199

http://stackoverflow.com/comment/36087728
comment on: http://stackoverflow.com/q/23524733
score: 0
type: Comment
type: QuestionComment
has text: Added the other http now. Hope it helps

http://stackoverflow.com/a/23469575
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23468880
answers question: http://stackoverflow.com/q/23468880
type: Answer
score: 0
has body: Fixed, I've changed the method getResourceAsStream() with getResource() it fix all the problems

http://stackoverflow.com/a/23493336
score: 1
has body: Create a custom method which does it for you.. Something like this private static boolean parseExpression(int number1, String operator, int number2) { if ("&lt;".equals(operator)) { return number1 &lt; number2; } else if ("&gt;".equals(operator)) { return number1 &gt; number2; } else if ("&lt;=".equals(operator)) { return number1 &lt;= number2; } else if ("&gt;=".equals(operator)) { return number1 &gt;= number2; } else if ("==".equals(operator)) { return number1 == number2; } else { throw new IllegalArgumentException("Invalid operator"); } } private static boolean parseExpression(double number1, String operator, double number2) { if ("&lt;".equals(operator)) { return Double.compare(number1, number2) == -1; } else if ("&gt;".equals(operator)) { return Double.compare(number1, number2) == 1; } else if ("&lt;=".equals(operator)) { return Double.compare(number1, number2) &lt;= 0; } else if ("&gt;=".equals(operator)) { return Double.compare(number1, number2) &gt;= 0; } else if ("==".equals(operator)) { return Double.compare(number1, number2) == 0; } else if ("!=".equals(operator)) { return Double.compare(number1, number2) != 0; } else { throw new IllegalArgumentException("Invalid operator"); } } If you don't want to use a comparator, it's something "simple" but should work. For double/floats should do a bit more of work anyway P.S with Enums you could do something very elegant. With Java7 you can use switch-strings too.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/23493024
downvote count: 1

http://stackoverflow.com/q/23476145
upvote count: 1
has body: I am trying to learn about Java's permission model. I tried this sample code: public static void main(String[] args) { File file = new File("/etc/passwd"); try (BufferedReader reader = new BufferedReader(new FileReader(file));) { reader.lines().forEach(s -&gt; System.out.println(s)); } catch (IOException e) { e.printStackTrace(); } FilePermission perm = new FilePermission("/etc/passwd", "read"); AccessController.checkPermission(perm); // throws Exception } This prints the contents of /etc/passwd fine, but throws an exception in the end: Exception in thread "main" java.security.AccessControlException: access denied ("java.io.FilePermission" "" "read") Why is it that the file read works fine, but a check for the permission gives a negative result?
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23476304
downvote count: 0
has title: Strange behaviour of AccessController.checkPermission
score: 1
favorite count: 0
type: Question
tagged with: file-permissions
tagged with: permissions
answer count: 2
has answer: http://stackoverflow.com/a/23478055

http://stackoverflow.com/q/23515880
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23516372
has comment: http://stackoverflow.com/comment/36068410
type: Question
has body: I am working on a student attendance database but I have no idea how to load the text file created from the jtable back into the same jtable? I have already checked the api docs and surf the net for potential hints but was unable to get the table read properly. This is my code so far: public class AttendanceArchive extends JFrame { private JPanel contentPane; private JTextField txtStudentName; private JTable table; private ScrollPane scrollPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { AttendanceArchive frame = new AttendanceArchive(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public AttendanceArchive() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 726, 516); setLocationRelativeTo(null); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); File dir = new File("C:/GCK Database/Attendance/"); File[] Filename = dir.listFiles(); if (Filename.length == 0) { txtStudentName = new JTextField(); txtStudentName.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { txtStudentName.setText(""); } }); txtStudentName.setBackground(Color.WHITE); txtStudentName.setText("STUDENT NAME"); txtStudentName.setBounds(25, 22, 262, 20); contentPane.add(txtStudentName); txtStudentName.setColumns(10); JLabel lblViewBy = new JLabel("VIEW BY"); lblViewBy.setFont(new Font("Tahoma", Font.BOLD, 12)); lblViewBy.setBounds(25, 53, 57, 14); contentPane.add(lblViewBy); table = new JTable(){ @Override public boolean isCellEditable(int row, int column) { return false; } }; table.setCellSelectionEnabled(true); table.getTableHeader().setReorderingAllowed(false); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); getContentPane().add(table); final DefaultTableModel tableModel = new DefaultTableModel(new Ob…
has comment: http://stackoverflow.com/comment/36067933
has title: how to save jtable to text file and read it back to jtable
tagged with: jtable
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36067981
has comment: http://stackoverflow.com/comment/36068185
favorite count: 0
accepted answer: http://stackoverflow.com/a/23516372
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36068250

http://stackoverflow.com/a/23464455
has comment: http://stackoverflow.com/comment/35973733
has comment: http://stackoverflow.com/comment/35973766
accepted answer of: http://stackoverflow.com/q/23464404
score: 1
answers question: http://stackoverflow.com/q/23464404
upvote count: 1
has comment: http://stackoverflow.com/comment/35973352
has body: When you create java files, you should have a package name also. It is probably a good idea to use some prefix substring of that package name as a guideline for the groupId.
has comment: http://stackoverflow.com/comment/35973199
has comment: http://stackoverflow.com/comment/35973287
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35973416
has comment: http://stackoverflow.com/comment/35974000
type: Answer

http://stackoverflow.com/q/23605427
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36238475
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/23710098
tagged with: trident
answer count: 1
tagged with: user-interface
has title: Trident: trying to fade a JLabel, getting error
tagged with: awt
has body: [EDIT: For now, I've ended up hand-rolling my own solution with swing timers, which seems to be working OK for my needs. I'm still concerned about performance and would be willing to junk my solution in favour of Trident if anyone can suggest a solution to the below. Looking around online, I'm wondering whether Trident is still "alive" as a project? NB I also tried TimingFramework but didn't see advantages compared to my own code.] I'm an old hand with back-end Java programming but inexperienced with the GUI side, and completely new to the Trident library. Our requirement is to have a large number of labels that fade in and out independently, so I'm keen to do this with a library rather than trying to hand-code everything. The test code below reproduces the problem. TTGui runs and calls a method to add a label saying "HELLO WORLD". The method asks Trident to animate the alpha of the label. TTLabel subclasses JLabel to achieve this (and for other reasons). Main class: import java.awt.*; import javax.swing.*; import org.pushingpixels.trident.Timeline; public class TTGui extends JFrame { private Container pane; public static void main(String[] args){ TTGui gui = new TTGui(); gui.addText("HELLO WORLD", 100); while (true) { } } public TTGui() { this.setExtendedState(Frame.MAXIMIZED_BOTH); pane = getContentPane(); pane.setBackground(Color.WHITE); pane.setLayout(null); setVisible(true); } public void addText(String text, int size){ TTLabel label = new TTLabel(text, size, 50, 50); pane.add(label); pane.repaint(); Timeline rolloverTimeline = new Timeline(label); rolloverTimeline.addPropertyToInterpolate("alpha", 0.0, 1.0); rolloverTimeline.setDuration(2500); rolloverTimeline.play(); } } Label subclass: import java.awt.AlphaComposite; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.SwingConstants; public class TTLabel extends javax.swing.JLabel { private float alpha = 0; public TTLabel(String str, int size, int x, int y){ super(s…
tagged with: animation
has comment: http://stackoverflow.com/comment/36237276
has answer: http://stackoverflow.com/a/23710098

http://stackoverflow.com/q/23607180
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/23607439
tagged with: java
type: Question
answer count: 1
has body: jtable get selected row value i want to make it so when u click on a row it will get the row number and put it into a variable. int Test1 = 0; This is in my button Listener myList.remove(Test1); but what do i need to find what row is selected. any help would be grateful thanks i used this in the end table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { sel = table.getSelectedRow(); } });
has title: Getting selected row value out of a jtable
tagged with: jtable
score: 0

http://stackoverflow.com/comment/36077827
comment on: http://stackoverflow.com/a/23520465
has text: Advantage of constructor based injection is that you cannot (easily) create an invalid object. With `@PostConstruct` and a default constructor you still can create an object without an `ISessionProvider`.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36068564
has text: My problem is particular row position is getting repeated all the time.Whatever the values that are present in the particular row position,those are getting added two times into database.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23513370
type: AnswerComment

http://stackoverflow.com/q/23535291
has body: I was looking for the usage of ThreadLocal and landed on this popular page When and how should I use a ThreadLocal variable? The accepted, highest voted answer says One possible (and common) use is when you have some object that is not thread-safe, but you want to avoid synchronizing access to that object (I'm looking at you, SimpleDateFormat). And the core part of the code is return new SimpleDateFormat("yyyyMMdd HHmm"); which won't change or be affected by conncurrent execution, or would it? Can you please highlight how this could be a issue? And why would we need a thread safe object here? In other occurrence, I have come across a similar usage with java.security.MessageDigest;, which is also a puzzler to me. It would be great if anyone could explain the reasons behind this, with some helpful code if possible.
tagged with: multithreading
has answer: http://stackoverflow.com/a/23535629
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/38129715
upvote count: 3
tagged with: simpledateformat
linked to: http://stackoverflow.com/q/817856
tagged with: java
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23535353
has title: Why would anyone need a thread safe SimpleDateFormat object?
answer count: 2
has answer: http://stackoverflow.com/a/23535353
accepted answer: http://stackoverflow.com/a/23535629
has comment: http://stackoverflow.com/comment/36105794
has comment: http://stackoverflow.com/comment/36105784
linked to: http://stackoverflow.com/q/6840803
favorite count: 0

http://stackoverflow.com/q/23613646
tagged with: java
has comment: http://stackoverflow.com/comment/48732667
type: Question
has comment: http://stackoverflow.com/comment/48326190
score: 4
has comment: http://stackoverflow.com/comment/48382841
has comment: http://stackoverflow.com/comment/48845956
has comment: http://stackoverflow.com/comment/37553053
upvote count: 4
has comment: http://stackoverflow.com/comment/48412853
tagged with: cargo
favorite count: 0
has comment: http://stackoverflow.com/comment/39820242
has comment: http://stackoverflow.com/comment/48807242
answer count: 0
type: UnansweredQuestion
tagged with: jetty
tagged with: maven
has body: I am using cargo maven plugin for testing purposes. Cargo is used to start our webapp and then REST API tests are run against it. We are using jetty 9.1.1. I am using cargo version: 1.4.8 Here is the configuration of the cargo plugin: org.codehaus.cargo cargo-core-uberjar ${cargo.version} org.codehaus.cargo cargo-maven2-plugin ${cargo.version} false jetty9x 180000 org.eclipse.jetty jetty-distribution ${jetty.version} standalone <cargo.servlet.port>${jetty.port}</cargo.servlet.port> <cargo.jvmargs>-Xmx1024m -XX:MaxPermSize=512m</cargo.jvmargs> <cargo.logging>high</cargo.logging> org.codehaus.cargo simple-war war ${unpacked.war.directory} portal start-server pre-integration-test start stop-server post-integration-test stop Our code in one of the servlets uses org.eclipse.jetty.servlet.ServletContextHandler$Context Since we are running in production with jetty embedded, we configure in the module which uses this in pom.xml with the provided scope for jetty modules. There are no problems in production. But when running in cargo, I get the following exception: java.lang.NoClassDefFoundError: org/eclipse/jetty/servlet/ServletContextHandler$Context at my.package.DefaultServletConfiguration.setServletConfig(DefaultServletConfiguration.java:42) at my.package.InitServlet.init(InitServlet.java:204) at javax.servlet.GenericServlet.init(GenericServlet.java:244) at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:612) at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:395) at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:871) at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298) at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349) at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342) at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741) at org.eclipse.jetty.webapp.WebAppContext.doStart(Web…
has comment: http://stackoverflow.com/comment/48329101
has title: Cargo NoClassDefFoundError when having a webapp which uses jetty modules embedded 9.1.1
downvote count: 0

http://stackoverflow.com/comment/35995575
comment on: http://stackoverflow.com/a/23465256
type: Comment
has text: I would suggest sending null in your case, if the fields you send are completely different I would consider making it a different object. Sending a few extra null fields is almost always an ok price to pay to keep the model intact.
type: AnswerComment
score: 0

http://stackoverflow.com/q/23560063
has body: I want to apply a renderer on a cell of my JTable, to do so I created a class named myRenderer : import java.awt.Component; import javax.swing.ImageIcon; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; public class MyRenderer extends DefaultTableCellRenderer { public Component getTableCellRendererComponent(JTable table, ImageIcon icon) { setIcon(icon); return this; } } And I use this piece of code to apply the renderer on the cell : MyRenderer renderer = new MyRenderer(); renderer.getTableCellRendererComponent(table, icon); table.getColumnModel().getColumn(6).setCellRenderer(renderer); The problem is that the rebderer is applied on all the cells in the column 6, and I want it to be applied on one cell only (row/column) but I don't know how to do so ? Thanks in advance
tagged with: swing
tagged with: renderer
type: Question
score: 3
has answer: http://stackoverflow.com/a/23560542
accepted answer: http://stackoverflow.com/a/23560542
tagged with: jtable
upvote count: 3
tagged with: cell
answer count: 2
has title: How to render an image to a JTable cell
favorite count: 0
possible better answer: http://stackoverflow.com/a/23560505
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/23560505
tagged with: java

http://stackoverflow.com/a/23595582
type: Answer
has body: The HttpParams values that are included in a new DefaultHttpClient contain some basic headers (like user agent and protocol version), while a brand new BasicHttpParams is completely empty. http.protocol.expect-continue=false, http.protocol.version=HTTP/1.1, http.protocol.content-charset=ISO-8859-1, http.useragent=Apache-HttpClient/UNAVAILABLE (java 1.4) Your server is probably expecting at least some of them, hence the "bad request" response. If you need to add custom parameters, you should start with httpClient.getParams() and build them from there.
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23594213
answers question: http://stackoverflow.com/q/23594213
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/36048398
has text: Oh yes ! i have Assets class if you mean that and i load it at start with mainmenu !
comment on: http://stackoverflow.com/q/23467936
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36124630
score: 1
comment on: http://stackoverflow.com/q/23545860
type: Comment
type: QuestionComment
has text: don't manipulate json with string operations. Unless you know EXACTLY what you're doing, you can very easily corrupt the entire string. decode the string to a native structure, delete whatever you want from that, then re-encode to json.

http://stackoverflow.com/q/23471224
has answer: http://stackoverflow.com/a/23471407
has body: I'm looking for java tool for converting regular String to utf-8 string. e.g. input: special-数据应用-text output: special-%u6570%u636E%u5E94%u7528-text (note the preceding "%u")
favorite count: 0
has answer: http://stackoverflow.com/a/23492245
type: Question
accepted answer: http://stackoverflow.com/a/23471420
has answer: http://stackoverflow.com/a/74665716
tagged with: utf-8
possible better answer: http://stackoverflow.com/a/23472015
upvote count: 2
has title: escaping Java string to utf-8
has answer: http://stackoverflow.com/a/23472015
tagged with: java
tagged with: escaping
answer count: 5
has answer: http://stackoverflow.com/a/23471420
linked to: http://stackoverflow.com/q/6230190
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/36197497
type: QuestionComment
has text: Yes I tried, but as I said, using this way of exporting doesn't include the sources in my .jar
comment on: http://stackoverflow.com/q/23584794
score: 0
type: Comment

http://stackoverflow.com/comment/35970633
has text: This doesn't really have anything to do with PHP... but you want a json parser for Java such as: https://code.google.com/p/json-simple/
score: 0
comment on: http://stackoverflow.com/q/23463265
type: Comment
type: QuestionComment

wsdl
tags question: http://stackoverflow.com/q/23534722
tags question: http://stackoverflow.com/q/23475189
tags question: http://stackoverflow.com/q/23477730
tags question: http://stackoverflow.com/q/23604577
tags question: http://stackoverflow.com/q/23490941
tags question: http://stackoverflow.com/q/23538626
type: Tag
tag name: wsdl
tags question: http://stackoverflow.com/q/23612901
tags question: http://stackoverflow.com/q/23540869
tags question: http://stackoverflow.com/q/23598288

http://stackoverflow.com/comment/36163656
has text: @LuiggiMendoza I get an error saying "'classes' is not an enclosing class"
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23566575
score: 0

http://stackoverflow.com/comment/36110968
comment on: http://stackoverflow.com/a/23538362
has text: I have added my amended code, but this seems to be changing the checkboxs to false and then back to true when i click it.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23566899
tagged with: datetime
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23568215
tagged with: jsf
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/36164589
type: Question
has title: f:convertDateTime displays wrong Date if timezone is provided by a bean
accepted answer: http://stackoverflow.com/a/23568215
has comment: http://stackoverflow.com/comment/36165482
score: 3
answer count: 1
downvote count: 0
favorite count: 0
has body: While specifiing the timezone as a string literal works flawless: &lt;h:outputText value="#{item.dateChange}"&gt; &lt;f:convertDateTime pattern="dd.MM.yyyy HH:mm" timeZone="Europe/Berlin"/&gt; &lt;/h:outputText&gt; Providing the value by bean doesn't work (Timeoffset 1h to UTC and daylight saving 1h are not applied) &lt;h:outputText value="#{item.dateChange}"&gt; &lt;f:convertDateTime pattern="dd.MM.yyyy HH:mm" timeZone="#{item.platform.timeZone}"/&gt; &lt;/h:outputText&gt; I tried both of the methods below none of them works: public TimeZone getTimeZone() { return TimeZone.getTimeZone("Europe/Berlin"); } public String getTimeZone() { return "Europe/Berlin"; } I need the timezone to be configurable for a user, how can this be achieved? EDIT: In order to make sure that the timezone object is available: &lt;h:outputText value="#{item.platform.timeZone}"/&gt; sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]] or simply: "Europe/Berlin" in the 2nd attempt.
linked to: http://stackoverflow.com/q/7122460

http://stackoverflow.com/comment/36062458
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23512515
type: Comment
has text: In my design, SlaveWorker is a subclass of Thread. So, I will need, new instances for starting new threads. Wouldn't your design require new instances of Worker?

http://stackoverflow.com/comment/36231029
comment on: http://stackoverflow.com/a/23601225
has text: I would think a properly configured `StringBuilder` would work better, not to mention you'd get better performance from using `else-if` statements
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/23476387
linked to: http://stackoverflow.com/q/5409595
favorite count: 0
tagged with: android
has body: I want to execute a specific command only in the first application lunch and when the user opens the application again another command will be executed instead . Here's an example if (this_is_first_lunch == true){ Toast.makeText(getApplicationContext(), "First time to open the app", Toast.LENGTH_SHORT).show(); }else{ Toast.makeText(getApplicationContext(), "Not the first time to open it", Toast.LENGTH_SHORT).show(); } My question here is what should I write instead of "this_is_first_lunch" to make this code working?
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23476451
has comment: http://stackoverflow.com/comment/35994546
tagged with: java
has title: Execute code only in the first application launch
has answer: http://stackoverflow.com/a/23476440
tagged with: eclipse
duplicate of: http://stackoverflow.com/q/5409595
accepted answer: http://stackoverflow.com/a/23476486
duplicate of: http://stackoverflow.com/q/5854499
type: Question
possible better answer: http://stackoverflow.com/a/23476440
score: -2
linked to: http://stackoverflow.com/q/5854499
has comment: http://stackoverflow.com/comment/35994480
has comment: http://stackoverflow.com/comment/35994488
has answer: http://stackoverflow.com/a/23476453
has answer: http://stackoverflow.com/a/23476486
downvote count: 3
upvote count: 1

http://stackoverflow.com/q/23541565
answer count: 2
has title: Console console = System.console(); gives null
linked to: http://stackoverflow.com/q/10963765
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/36116523
tagged with: console
has answer: http://stackoverflow.com/a/23543066
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36119779
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/23543524
has comment: http://stackoverflow.com/comment/36116887
type: Question
has body: I have to use Console console = System.console(); to enter password via console in Eclipse, but it always gives me java.lang.NullPointerException. Why is it so? or there is any other way available by which we can enter password via console which is not visible??

http://stackoverflow.com/q/23550150
answer count: 3
tagged with: reset
tagged with: combobox
tagged with: default
has body: I've created and populated a combobox by querying a database. When I have performed a few other functions in the program, I want to reset the combobox to the original value, i.e. a blank space. When I do this, I get an exception being thrown by the program. The code is as follows: to create the combo box: tableNumberJComboBox = new JComboBox(); tableNumberJComboBox.setBounds( 168, 26, 80, 20 ); tableNumberJComboBox.setFont(new Font("Serif", Font.PLAIN, 12)); tableNumberJComboBox.addItem(""); waiterJPanel.add(tableNumberJComboBox); and then to populate it: private void loadTableNumbers() { try { myStatement = null; myResultSet = null; myStatement = myConnection.createStatement(); myResultSet = myStatement.executeQuery("SELECT tableNumber FROM restauranttables"); while (myResultSet.next()) { tableNumberJComboBox.addItem(myResultSet.getInt(1)); } myResultSet.close(); } catch(SQLException sqlexception) { sqlexception.printStackTrace(); } } // end method loadTableNumbers and then to reset the table number to a blank space: tableNumberJComboBox.setSelectedItem(""); and the exception is: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer I've tried setSelectedItem(0), but this didnt work. How do I set this back to the original white space? Thanks in advance.
has answer: http://stackoverflow.com/a/23550419
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78615100
has title: Resetting a combobox to the first item
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/23551266

http://stackoverflow.com/comment/36245695
has text: If you want it to be correct for Norwegian, the single space and decimal comma is correct
comment on: http://stackoverflow.com/q/23610651
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35969674
score: 0
type: Comment
has text: How can I read the file into array of objects ??
comment on: http://stackoverflow.com/a/23462200
type: AnswerComment

http://stackoverflow.com/a/23557016
downvote count: 0
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23554726
has body: This is the line that messes everything up: jframe.setLayout(new FlowLayout()); You're changing the layout to FlowLayout and then adding glcanvas next to startButton. The preferred size of glcanvas is 0 so it is not visible, although you can see a slight movement of startButton when the button is clicked. I assume that setting FlowLayout was not intentional because you are using BorderLayout.CENTER constraint to add glcanvas. So here is a simple fix: Comment out: //jframe.setLayout(new FlowLayout()); Add startButton to the NORTH of the panel instead of a CENTER since glcanvas will go to the CENTER. Change: jframe.add(startButton); to: jframe.add(startButton, BorderLayout.NORTH); That fixed the revalidation issue, at least on Windows 7 Java 7. Also, see A Visual Guide to Layout Managers for more details and examples about layouts.
answers question: http://stackoverflow.com/q/23554726
has comment: http://stackoverflow.com/comment/36153344
type: AcceptedAnswer

http://stackoverflow.com/comment/36226525
comment on: http://stackoverflow.com/a/23600220
type: Comment
score: 0
type: AnswerComment
has text: Yes. It explained the problem but didn't offer a solution. In any case, your solution is better than mine.

http://stackoverflow.com/q/23519125
has body: I am developing my app, using Spring v3. Now I have included another module (using Maven), which, in turn, depends on Spring v4. While my app and this module work perfectly fine, when booted separately, cooperation just fails. Is it possible to combine my app with this module somehow, resulting in two different version of Spring bundled into resulting app?
tagged with: maven
tagged with: spring
upvote count: 4
has comment: http://stackoverflow.com/comment/36076623
has title: Two versions of Spring Framework in a single app?
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/90163371
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36074615
answer count: 1
has answer: http://stackoverflow.com/a/39239331
score: 4
has comment: http://stackoverflow.com/comment/36076918
has comment: http://stackoverflow.com/comment/36074254
favorite count: 0
has comment: http://stackoverflow.com/comment/36074321
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/36188913
score: 0
has text: "*Whats the difference between a package and an import?*" `import` imports class/classes from specified `package`. "*Please give an example.*" you already posted one. "*Why cant we just use `import java.util.*;`*" you can, nothing stops you. "*Doesn't it give access to all the others automatically?*" others *what*?
comment on: http://stackoverflow.com/q/23580284
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23585852
has answer: http://stackoverflow.com/a/23586044
score: 0
has comment: http://stackoverflow.com/comment/36199574
tagged with: matrix
has title: Error with matrices and array index out of bounds
has body: So, i need to implement this code that will return me the best solution of parentheses from a multiplication of matrices in java. I made a function for the printing of "(" ")" and in the main i did the construction of the matrices M and S for the resolution (dinamic programming). i keep getting this error after it prints the first "(": Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4 at ProgramacaoDinamica.parenterizacao(ProgramacaoDinamica.java:13) at ProgramacaoDinamica.main(ProgramacaoDinamica.java:46) code: public class ProgramacaoDinamica { private static int[][] s; public static void parenterizacao(int[][] s, int i, int j) { if (i == j) { System.out.println("M" + i); } else { System.out.println("("); parenterizacao(s, i, s[i][j]); parenterizacao(s, s[i][j] + 1, j); System.out.println(")"); } } public static void main(String[] args) { int[] p = {15, 5, 10, 20, 25}; //VETOR P DO ENUNCIADO (alteracoes aqui!!!) int n = p.length - 1; int[][] m = new int[n][n]; int[][] s = new int[n - 1][n - 1]; for (int i = 0; i &lt; n; i++) { m[i][i] = 0; } for (int l = 1; l &lt; n; l++) { for (int i = 1; i &lt;= l - n + 1; i++) { int j = i + l - 1; m[i][j] = 9999; for (int k = i; k &lt;= j - 1; k++) { int q = m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]; if (q &lt; m[i][j]) { m[i][j] = q; s[i][j] = k; } } } } parenterizacao(s, 1, n); } } can anyone help me out with this? im starting to get lost with the code? im following this semi codes: java1 java2
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/23586012
accepted answer: http://stackoverflow.com/a/23586012
possible better answer: http://stackoverflow.com/a/23586044

http://stackoverflow.com/comment/62168019
type: Comment
comment on: http://stackoverflow.com/a/32231630
score: 3
has text: @StephenNYC this should be the accepted answer now, as it's built into dropwizard
type: AnswerComment

http://stackoverflow.com/q/23474957
downvote count: 0
has comment: http://stackoverflow.com/comment/35991986
has answer: http://stackoverflow.com/a/23475124
has answer: http://stackoverflow.com/a/23475050
upvote count: 1
has answer: http://stackoverflow.com/a/23475012
favorite count: 0
has body: Receiving the error: Pay.java:81: error: variable hourlyWage might not have been initialized JOptionPane.showMessageDialog(null, hourlyWage); for the following code. The double hourlyWage is declared, these statements are within the main argument. Not seeing what I'm missing, do you? if(skillInt == 1){ hourlyWage = 17.00; } else if(skillInt == 2){ hourlyWage = 20.00; } else if(skillInt == 3){ hourlyWage = 22.00; } JOptionPane.showMessageDialog(null, hourlyWage);
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35991884
has answer: http://stackoverflow.com/a/23475034
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35991958
type: Question
has answer: http://stackoverflow.com/a/23494497
has comment: http://stackoverflow.com/comment/35991837
linked to: http://stackoverflow.com/q/2448843
has title: Error: variable might not have been initialized

http://stackoverflow.com/comment/36160438
score: 0
has text: 'temp' doesn't exist in that code snippet?! Undefined cannot resolve symbol...
comment on: http://stackoverflow.com/q/23565230
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23599149
answers question: http://stackoverflow.com/q/23598479
score: 0
type: Answer
has body: The CompH is directly analogous to a java.util.Comparator, and the PQ class itself is java.util.PriorityQueue.

http://stackoverflow.com/a/63498728
upvote count: 1
has body: If anyone is trying to get this working with Spring WebFlux, the method which determines whether the request is handled is called "securityMatcher", rather than "requestMatcher". i.e. fun configureBasicAuth(http: ServerHttpSecurity): SecurityWebFilterChain { return http .securityMatcher(BasicAuthServerWebExchangeMatcher()) .authorizeExchange() ...
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23526644

specifications
type: Tag
tag name: specifications
tags question: http://stackoverflow.com/q/23538066

http://stackoverflow.com/q/23475944
type: UnansweredQuestion
has body: So I have to get the users first and last name which I have but then I have to take the first letter of the persons first name and concatenate it to the last name to create a username (all lowercase) but I'm stuck on how to add that... Im assuming I have to use one of the methods from the string class but I'm not exactly sure which one or how to do it? package userinput.java; import java.util.Scanner; public class UserinputJava { public static void main(String[] args) { Scanner userInput = new Scanner (System.in); String firstname; String lastname; String fullname; System.out.print("Enter first name: "); firstname = userInput.next(); System.out.print("Enter last name: "); lastname = userInput.next(); fullname = firstname + lastname; System.out.println ("You are " + fullname + "!"); } }
upvote count: 0
has title: How to concatenate two strings in java?
linked to: http://stackoverflow.com/q/21570278
favorite count: 0
has comment: http://stackoverflow.com/comment/35993671
duplicate of: http://stackoverflow.com/q/21570278
type: Question
downvote count: 6
linked to: http://stackoverflow.com/q/47605
has answer: http://stackoverflow.com/a/23476007
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/23476059
score: -6

http://stackoverflow.com/comment/35969827
score: 0
has text: Your question is unclear to me. There will be logic invoked in the beginning and throughout the game.
type: Comment
comment on: http://stackoverflow.com/q/23462784
type: QuestionComment

http://stackoverflow.com/q/23537757
answer count: 3
has answer: http://stackoverflow.com/a/23538135
tagged with: binary-search-tree
type: UnansweredQuestion
has title: Finding K largest elements in Binary Search Tree
upvote count: 1
tagged with: recursion
has comment: http://stackoverflow.com/comment/36113491
score: 1
tagged with: java
type: Question
has body: I am trying to find the K largest elements in BST but my code flow is not happenging properly. e.g Consider the BST as below 9 / \ 7 12 / \ / \ 6 10 11 16 My code flow is happening in the order 16 --> 12 --> 9, though I am trying to have it 16 --> 12 --> 11. Code as below public class FindKLargestElements { private static int n =0; public static int[] findLarge(Node node, int large[], int k) { if (node == null) return large; if (k == 0) return large; findLarge(node.getRightNode(), large, k); if (k &gt;0) { large[n] = node.getValue(); k = k -1; n = n +1; return large; } findLarge(node.getLeftNode(), large, k); return large; } } I have fixed this now. Here is the final code. This is what I did Removed the return statement from if k > 0 block Changed the primitive k to class level rather than recursive method level as updated to it were getting lost. public class FindKLargestElements { private static int n =0; private static int k =3; public static int[] findLarge(Node node, int large[]) { if (node == null) return large; if (k == 0) return large; findLarge(node.getRightNode(), large); if (k &gt;0) { large[n] = node.getValue(); k = k -1; n = n +1; } findLarge(node.getLeftNode(), large); return large; } }
has answer: http://stackoverflow.com/a/26075097
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23539906
tagged with: binary-tree

http://stackoverflow.com/a/23606291
has body: rsp.addHeader is also a mocked method and values you set there are not returned via rsp.getHeader. But you can verify if methods on your mock object are invoked using verify method. If you really want to have addHeader to work together with getHeader, you should consider using a spy object that is backed by a real object. I would verify that addHeader was called with right arguments using verify(rsp).addHeader(...).
accepted answer of: http://stackoverflow.com/q/23605993
has comment: http://stackoverflow.com/comment/50761214
answers question: http://stackoverflow.com/q/23605993
upvote count: 3
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/50762872

http://stackoverflow.com/q/23598796
linked to: http://stackoverflow.com/q/3901253
tagged with: string
favorite count: 0
duplicate of: http://stackoverflow.com/q/3901253
type: Question
has comment: http://stackoverflow.com/comment/36224907
answer count: 1
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23598822
tagged with: bitwise-operators
upvote count: 0
has comment: http://stackoverflow.com/comment/36223843
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36223814
score: -3
has body: So, I saw this code for converting ascii to binary: String s = "foo"; byte[] bytes = s.getBytes(); StringBuilder binary = new StringBuilder(); for (byte b : bytes) { int val = b; for (int i = 0; i &lt; 8; i++) { binary.append((val &amp; 128) == 0 ? 0 : 1); val &lt;&lt;= 1; } binary.append(' '); } System.out.println("'" + s + "' to binary: " + binary); In this context, what does the &lt;&lt;= operator do? How exactly does this code build a binary representation of s?
has title: What is the purpose of `<<=` in Java?

http://stackoverflow.com/q/23472513
has answer: http://stackoverflow.com/a/23472860
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/23474480
type: Question
has answer: http://stackoverflow.com/a/23474480
has comment: http://stackoverflow.com/comment/35987482
tagged with: discrete-mathematics
accepted answer: http://stackoverflow.com/a/23472801
has body: I have a group of numbers 0 to 9 => {0 .. 9}, but another group that represent each amount of {0 .. 9} we have, for example: 0 =&gt; 1 1 =&gt; 2 2 =&gt; 3 3 =&gt; 4 4 =&gt; 5 5 =&gt; 6 6 =&gt; 7 7 =&gt; 8 8 =&gt; 9 9 =&gt; 1 The lowest value that we cannot represent with those groups is 99. They are digits to represent a number, for example if we only have: 2 =&gt; 2 7 =&gt; 1 The lowest value should be 0 or 1, and the possibilities are, 2, 7, 22, 27, 72, 227, 272, 722. I am doing an algorithym in java to calculate the lowest value that we cannot represent, but I even do not very well how to do it, and I need a little or big help. Thanks.
tagged with: algorithm
has comment: http://stackoverflow.com/comment/35987734
has comment: http://stackoverflow.com/comment/35987541
has comment: http://stackoverflow.com/comment/35987797
downvote count: 0
has comment: http://stackoverflow.com/comment/35987745
has answer: http://stackoverflow.com/a/23472921
has title: How to know the lowest value that is not in a group of numbers
favorite count: 0
has comment: http://stackoverflow.com/comment/35987656
answer count: 5
has comment: http://stackoverflow.com/comment/35987325
has answer: http://stackoverflow.com/a/23472801
has answer: http://stackoverflow.com/a/23472882
has comment: http://stackoverflow.com/comment/35987607
type: AnsweredQuestion
score: 2

http://stackoverflow.com/a/23474324
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23474192
has body: There is no direct method to do this. I mean, there is no java API that can retrieve you parameters. You can however use the the following approaches. Add log message in the beginning of each method. Print all arguments manually. Use byte code engineering Use (dynamic) proxy Examples of byte code engineering libraries are ASM, CGLIB, Javassist. Example of higher level, AOP library is AspectJ.
downvote count: 0

stardog
tags question: http://stackoverflow.com/q/23552010
tag name: stardog
type: Tag

http://stackoverflow.com/comment/36190934
type: Comment
type: QuestionComment
has text: You can't drive a car without having a car. You can't take the plane without plane. You can't read an object of class Person without having the Person class.
score: 1
comment on: http://stackoverflow.com/q/23581329

http://stackoverflow.com/comment/36243723
has text: http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html
comment on: http://stackoverflow.com/q/23609482
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/23561872
tagged with: split
answer count: 3
has answer: http://stackoverflow.com/a/23561912
tagged with: string
favorite count: 0
score: 0
has body: My String is , String myString = "Hello Boom, Ho3w are || You ? Are ^ you ," fr45ee now ?"; I tried the below to split the string as , "Hello,Boom,Ho3w,are,You,Are,you,fr45ee,now" - where comma indicates the separation of String to String array. My code is String[] temp = data.split("\\s+\\^,?\"'\\|+"); But it is no working . Hope You people helps.Thanks.
has comment: http://stackoverflow.com/comment/36154101
has title: Java - Split a String?
tagged with: regex
possible better answer: http://stackoverflow.com/a/23561912
upvote count: 1
has answer: http://stackoverflow.com/a/23561920
downvote count: 1
accepted answer: http://stackoverflow.com/a/23561920
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23561950

http://stackoverflow.com/comment/35972803
has text: Looks OK to me. What happened when you tested it?
type: QuestionComment
comment on: http://stackoverflow.com/q/23464310
type: Comment
score: 2

http://stackoverflow.com/q/23476334
answer count: 0
linked to: http://stackoverflow.com/q/23108644
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/36000537
has comment: http://stackoverflow.com/comment/36017912
has body: @OneToMany and CascadeType.All does not work as I expected. Here is my code. The 'One' Side @Entity @Table(name = "orders") public class Order { private long id; private User usersByUserId; private Collection&lt;OrderBook&gt; orderBooksById = new HashSet&lt;&gt;(); @Id @Column(name = "id") public long getId() { return id; } public void setId(long id) { this.id = id; } @ManyToOne @JoinColumn(name = "user_id", referencedColumnName = "id", nullable = false) public User getUsersByUserId() { return usersByUserId; } public void setUsersByUserId(User usersByUserId) { this.usersByUserId = usersByUserId; } @OneToMany(mappedBy = "pk.order", cascade = CascadeType.ALL) public Collection&lt;OrderBook&gt; getOrderBooksById() { return orderBooksById; } public void setOrderBooksById(Collection&lt;OrderBook&gt; orderBooksById) { this.orderBooksById = orderBooksById; } } And the 'many' side. @Entity @Table(name = "order_book") public class OrderBook { private OrderBookPK pk = new OrderBookPK(); private int num; @EmbeddedId public OrderBookPK getPk() { return pk; } public void setPk(OrderBookPK pk) { this.pk = pk; } @Transient public Book getBook(){ return getPk().getBook(); } public void setBook(Book book){ getPk().setBook(book); } @Transient public Order getOrder(){ return getPk().getOrder(); } public void setOrder(Order order){ getPk().setOrder(order); } @Basic @Column(name = "num") public int getNum() { return num; } public void setNum(int num) { this.num = num; } } @Embeddable public class OrderBookPK implements Serializable { private Order order; private Book book; @ManyToOne @JoinColumn(name="order_id", referencedColumnName = "id", nullable = false) public Order getOrder() { return order; } public void setOrder(Order order) { this.order = order; } @ManyToOne @JoinColumn(name="book_id", referencedColumnName = "id", nullable = false) public Book getBook() { return book; } public void setBook(Book book) { this.book = book; } } And I use this in my service. @Transactional public vo…
linked to: http://stackoverflow.com/q/4496548
score: 0
has comment: http://stackoverflow.com/comment/36000779
has comment: http://stackoverflow.com/comment/36000566
tagged with: jpa
has comment: http://stackoverflow.com/comment/36016123
has comment: http://stackoverflow.com/comment/36012159
has title: Hibernate onetomany cascade not worked
type: UnansweredQuestion

http://stackoverflow.com/comment/36247404
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23606208
type: AnswerComment
has text: ,Thank u. can u tell me , where must I put this code segment in my MainActivity.java file. Do I need to call to this method inside onCreate method? Please clarify it.

http://stackoverflow.com/q/23564191
linked to: http://stackoverflow.com/q/35842
tagged with: linux
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23564335
upvote count: 2
has title: get Process ID via JMX
tagged with: jmx
has answer: http://stackoverflow.com/a/23564563
accepted answer: http://stackoverflow.com/a/23564563
has comment: http://stackoverflow.com/comment/36158550
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36158731
tagged with: java
duplicate of: http://stackoverflow.com/q/35842
has body: I am adding following JVM parameters to connect the application via JMX. After connected the application via jconsole over JMX, is there a menu that shows me the running application PID? -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=5592 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false Linux Redhat 6.2 java JDK 1.6
type: Question
possible better answer: http://stackoverflow.com/a/23564335

http://stackoverflow.com/q/23499176
has title: Java enum constructor call in foreach loop
favorite count: 0
has answer: http://stackoverflow.com/a/23499235
type: Question
has comment: http://stackoverflow.com/comment/36037288
possible better answer: http://stackoverflow.com/a/23499243
has answer: http://stackoverflow.com/a/23499408
score: -1
tagged with: java
downvote count: 2
answer count: 3
has body: Can somebody help me understand why the output of the following code, in java: public class Main { public static int position1, position2; private enum Direction{ North(1,1), South(-1,-1), West(-1,0), East(1,0); Direction(int i, int j){ position1=i; position2=j; } } public static void main(String[] args){ for(Direction d: Direction.values()){ System.out.println(d + " has coordinates (" + position1 + "," + position2 + ")"); } } } The output is: North has coordinates (1,0) South has coordinates (1,0) West has coordinates (1,0) East has coordinates (1,0) This is, the constructor is called always with the arguments of the element East. Why is this happening? I can't seem to find this explained anywhere.
accepted answer: http://stackoverflow.com/a/23499235
upvote count: 1
tagged with: enums
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36037268
has answer: http://stackoverflow.com/a/23499243

http://stackoverflow.com/a/23463387
has body: This is a basic example of spinning a sprite What this does is maintain's a virtual state which the Player object inspects in order to determine how it should be changed accordingly. This separates the action from the result, meaning that it would be possible to substitute the action (arrow up key) with some other action, but still obtain the same result. This example also uses the key bindings API, which doesn't suffer from the same focus related issues that KeyListener does, but this is a pure Swing API and won't be compatiable with Canvas, but is a nice demonstration ;) The real magic occurs in the characters paint method... public void paint(Graphics2D g2d) { Graphics2D g = (Graphics2D) g2d.create(); AffineTransform at = new AffineTransform(); at.translate(x, y); at.rotate(Math.toRadians(angle), character.getWidth() / 2, character.getHeight() / 2); g.transform(at); g.drawImage(character, 0, 0, null); } Basically, this creates a AffineTransformation which is then compounded to produce the result we need. That is, first it's anchor position is translated to the characters x/y position and then rotated about the characters center point. Because it's been translated, we can simply paint the character at 0x0. This much easier then try to calculate the characters rotation anchor somewhere else in virtual space - IMHO The character is rotated by pressing either the Up or Down arrow keys. While pressed, the character will continue to rotate, this is a feature of the example for demonstration purpose. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.…
score: 1
has comment: http://stackoverflow.com/comment/36004182
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23463174
upvote count: 1
has comment: http://stackoverflow.com/comment/35988188

http://stackoverflow.com/comment/35983518
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23470234
has text: The default `toString()` implementation available in the `Object` class gives you a string formed from `getClass().getName() + '@' + Integer.toHexString(hashCode())` and that is not useful 99.8% of the time. Usually you want to output the value of some attributes of your class.

http://stackoverflow.com/comment/36130480
type: AnswerComment
type: Comment
has text: Of course i add semi column at the end of my statement sorry i did not write them into my question, but they were written in my code.
comment on: http://stackoverflow.com/a/23548653
score: 0

http://stackoverflow.com/comment/36237241
has text: Thanks for your sujjestion. But I said I dont want to put manual logic here... Becuase the map I have , is superMap and have so many other inner maps Or pojos object. So i just need to use something generic otherwise I have to get value of map first and then compare of inner pojo's properties
type: Comment
comment on: http://stackoverflow.com/a/23606111
type: AnswerComment
score: 0

http://stackoverflow.com/q/23496995
accepted answer: http://stackoverflow.com/a/23499379
possible better answer: http://stackoverflow.com/a/23499394
has answer: http://stackoverflow.com/a/23499394
has body: I'm working on a project that I need to code and encode a string in java. my string is an UTF-8 string consist of persian character. I simply want to xor every bytes with a static character and then xor it again with the same static character. I wrote the below code but it completely works wrong! I check it with English character and it works. How can I fix this problem? String str = "س"; char key = 'N'; byte bKey = (byte) key; byte[] b = str.getBytes(); for (int i = 0; i &lt; b.length; i++) { b[i] = Byte.valueOf((byte) (b[i] ^ bKey)); } String str1 = new String(b); b = str1.getBytes(); for (int i = 0; i &lt; b.length; i++) { b[i] = (byte) (b[i] ^ bKey); } String str2 = new String(b);
type: AnsweredQuestion
tagged with: java
has title: encoding and decoding utf8 string and its bytes in Java
type: Question
has answer: http://stackoverflow.com/a/23499379
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23497355
tagged with: utf-8
tagged with: string

http://stackoverflow.com/comment/36055157
has text: What's the performance of this expression like? I have a suspicion it might run very slowly on large strings.
comment on: http://stackoverflow.com/a/23508527
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/121946094
score: 1
comment on: http://stackoverflow.com/a/23533769
has text: But the [OP wrote](https://stackoverflow.com/questions/23533695/java-convert-bytes-to-file/23533769#comment36102606_23533695): *"No, just [an] instance of File in memory. I do not need to write it to [the] filesystem."*
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23464910
tagged with: java
has body: I just started looking into Log4j 2.0. Looking at the user guide, it looks like some new things have been implemented that I'm currently a bit confused as to when I should be using. The primary example is Flow Logging. public class LogTest { public static void main(final String[] args) { logger.entry(); doTest("value"); try { doTest(null); } catch (final Exception e) { logger.catching(e); } logger.exit(); } private static void doTest(final String value) { logger.entry(); if (value == null) { final Exception e = new IllegalArgumentException( "value must not be null"); throw logger.throwing(e); } System.out.println(value); logger.exit(); } } My question is, am I using the logger.throwing() and logger.catching() in the intended way?
accepted answer: http://stackoverflow.com/a/23466938
type: Question
downvote count: 0
answer count: 1
has title: Logging Conventions using Log4j 2
favorite count: 0
tagged with: log4j
has answer: http://stackoverflow.com/a/23466938
upvote count: 3
tagged with: log4j2
tagged with: logging
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/36204283
has text: Do you need to use an array? Why not use `List`?
comment on: http://stackoverflow.com/q/23588412
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23595821
tagged with: java
score: -1
answer count: 2
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23596527
favorite count: 0
type: UnansweredQuestion
has body: Looking for some assistance with a college assignment , really stuck with this one, would appreciate some help ... is it synchronization ? Consider the code shown below: public class Q3 { public static void main(String args[]) { new Q3(Integer.parseInt(args[0])); } public Q3(int keyholdersRequired) { SecretChest secretChest = new SecretChest(keyholdersRequired); for(int i = 0; i &lt; keyholdersRequired; i++) { new KeyHolder(secretChest).start(); try { Thread.sleep((int)(Math.random() * 5000)); } catch (InterruptedException ie) {} } } } class KeyHolder extends Thread { private SecretChest secretChest; public KeyHolder(SecretChest secretChest) { this.secretChest = secretChest; System.out.println("New Keyholder Arrived..."); } public void run() { if(secretChest.unlock() == true) System.out.println("Secret chest unlocked"); } } class SecretChest { private int keysStillRequired; public SecretChest(int keysRequired) { keysStillRequired = keysRequired; } public boolean unlock() { keysStillRequired--; return true; } } In this program, new KeyHolder threads are started intermittently. Each KeyHolder then calls the unlock method on the SecretChest to which it has been given a reference. The unlock method should return when the SecretChest in opened. The SecretChest should not be opened until the required number of KeyHolder threads have called the unlock method. The number of KeyHolders required is passed to the program as a command line argument. As it stands, the output from the program, for 3 KeyHolders is: java Q3 3 New Keyholder Arrived... Secret chest unlocked New Keyholder Arrived... Secret chest unlocked New Keyholder Arrived... Secret chest unlocked The desired output is: java Q3 3 New Keyholder Arrived... New Keyholder Arrived... New Keyholder Arrived... Secret chest unlocked Secret chest unlocked Secret chest unlocked Using Java’s object monitors, make the necessary changes to the SecretChest class above to produce the desired behaviour. I got this working using cl…
tagged with: multithreading
has answer: http://stackoverflow.com/a/23596017
has title: Java object monitors
type: Question
tagged with: object

http://stackoverflow.com/comment/36070901
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23516661
has text: I'm just looking at http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch17.html#querycriteria-projection and it looks like you should be able to do `c.setProjection(Projections.projectionList().add(Projections.groupProperty("user_id").add(Projections.groupProperty("user_type")));` I think this will return you a list of maps. I haven't done precisely what you're doing though, so I'm far from certain. You could try this and see how it goes.
score: 0

http://stackoverflow.com/a/23575981
downvote count: 2
type: Answer
score: 25
has body: In Spring Framework, there are number of ways of handing exceptions (and particularly 404 error). Here is a documentation link. First, you can still use error-page tag in web.xml, and customize error page. Here is an example. Second, you can use one @ExceptionHandler for all controllers, like this: @ControllerAdvice public class ControllerAdvisor { @ExceptionHandler(NoHandlerFoundException.class) public String handle(Exception ex) { return "404";//this is view name } } For this to work, set throwExceptionIfNoHandlerFound property to true for DispatcherServlet in web.xml: throwExceptionIfNoHandlerFound true You can also pass some objects to error view, see javadoc for this.
has comment: http://stackoverflow.com/comment/58813038
answers question: http://stackoverflow.com/q/23574869
has comment: http://stackoverflow.com/comment/57144888
upvote count: 27
has comment: http://stackoverflow.com/comment/58862719
has comment: http://stackoverflow.com/comment/58862278
has comment: http://stackoverflow.com/comment/66093923
has comment: http://stackoverflow.com/comment/36247734
has comment: http://stackoverflow.com/comment/36262369
has comment: http://stackoverflow.com/comment/36262878

apache-storm
tags question: http://stackoverflow.com/q/23492366
type: Tag
tags question: http://stackoverflow.com/q/23516427
tags question: http://stackoverflow.com/q/23584494
tags question: http://stackoverflow.com/q/23563239
tags question: http://stackoverflow.com/q/23578430
tag name: apache-storm
tags question: http://stackoverflow.com/q/23532063

http://stackoverflow.com/comment/96168941
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23489038
has text: plus[1] for the order doesnt matter mention!
score: 0

http://stackoverflow.com/q/23543569
favorite count: 0
has answer: http://stackoverflow.com/a/23619048
upvote count: 2
has body: I try to take the following steps: right click on pom.xml and run as maven install in eclipse but I got this error: [ERROR] Failed to execute goal on project tt: Could not resolve dependencies for project com.sunshineatnoon:tt:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.apache.hbase:hbase:jar:0.96.1.1-hadoop2, com.yahoo.ycsb:core:jar:0.1.4: Failure to find org.apache.hbase:hbase:jar:0.96.1.1-hadoop2 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1] however, when I looked into http://repo.maven.apache.org/maven2, there indeed exists this org.apache.hbase:hbase:jar:0.96.1.1-hadoop2. My pom.xml is as follows: 4.0.0 com.sunshineatnoon tt 0.0.1-SNAPSHOT org.apache.hbase hbase 0.96.1.1-hadoop2 org.apache.hadoop hadoop-client 2.2.0 com.yahoo.ycsb core 0.1.4 How can I solve this problem?Any help will be appreciated, thanks in advance!
tagged with: maven
type: AnsweredQuestion
score: 2
tagged with: java
has title: The following artifacts could not be resolved: org.apache.hbase:hbase:jar:0.96.1.1-hadoop2
accepted answer: http://stackoverflow.com/a/23619048
tagged with: eclipse
has answer: http://stackoverflow.com/a/24873450
type: Question
answer count: 2
tagged with: apache
downvote count: 0
possible better answer: http://stackoverflow.com/a/24873450

http://stackoverflow.com/a/23523148
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23498313
score: 6
type: Answer
upvote count: 6
has body: The Artifact Usage Nexus Plugin is an open source plugin for Nexus that can do that. A list of further available plugins and integrations is available in the free Nexus book. Be sure to use the correct version of Nexus with the plugin or fork the project and update it to your version of Nexus.
accepted answer of: http://stackoverflow.com/q/23498313

http://stackoverflow.com/comment/36066245
type: QuestionComment
comment on: http://stackoverflow.com/q/23514930
score: 0
has text: If you'll always have the same format `"[...]TestSomeNumber.csv"`, a combination of `substring` and `indexOf` will do the trick.
type: Comment

http://stackoverflow.com/q/23583582
type: UnansweredQuestion
upvote count: 1
tagged with: java
type: Question
has body: Is it possible for Javascript routes be used with non-static controller methods (i.e. route methods prefixed with @ for DI) ? For example GET /foo @controllers.Foo.bar() ... public static Result jsRoutes(){ response().setContentType("text/javascript"); return ok(Routes.javascriptRouter("jsRoutes", // Fails to compile controllers.routes.javascript.Foo.bar(), // Also fails to compile (cant find symbol JavascriptReverseRoute) Router.JavascriptReverseRoute.apply("controllers.Foo.bar", "function() {return _wA({method:'GET', url: /foo })}")) ); } Any guidance would be appreciated. If its impossible then i dont mind using regular ajax but it would be a nice feature to have.
answer count: 1
downvote count: 0
has title: Play framework javascript routes + non static methods
tagged with: routes
tagged with: playframework
score: 1
tagged with: playframework-2.2
favorite count: 0
has answer: http://stackoverflow.com/a/29098899

http://stackoverflow.com/q/23588504
upvote count: 0
favorite count: 0
has body: How can i convert the following date string to Date in java. I am trying SimpleDateFormat: Date parse = sdf.parse("2012-02-14T20:23:40.127"); it throws : Exception in thread "main" java.text.ParseException: Unparseable date: "2012-02-14T20:23:40.127" at java.text.DateFormat.parse(DateFormat.java:357) at Play.main(Play.java:27) Java Result: 1
has comment: http://stackoverflow.com/comment/36204487
has comment: http://stackoverflow.com/comment/36204427
possible better answer: http://stackoverflow.com/a/23588513
answer count: 4
has answer: http://stackoverflow.com/a/23588529
accepted answer: http://stackoverflow.com/a/23588529
downvote count: 1
has title: Java : String to date conversion
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23589688
has answer: http://stackoverflow.com/a/23588513
score: -1
type: Question
has answer: http://stackoverflow.com/a/23588567

http://stackoverflow.com/q/23462597
has comment: http://stackoverflow.com/comment/35969530
type: UnansweredQuestion
tagged with: android
tagged with: ssh
has title: Implementing JSch to run ssh command in android app
has comment: http://stackoverflow.com/comment/35969729
downvote count: 0
score: 1
type: Question
has body: I'm currently trying to code up an android app that does a simple "ls" command over ssh to a remote machine. I've tried to use JSch and this page, but it just doesn't seem to work. I've looked around and it seems that I have to implement some Async task to run the code. Here is the entire code for the main activity right now: package com.sshtest.sshtest; import android.app.Activity; import android.os.Bundle; import android.os.AsyncTask; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import java.util.Properties; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelExec; import com.jcraft.jsch.*; import java.io.InputStream; import java.io.ByteArrayOutputStream; import java.lang.String; public class MainActivity extends Activity { String string; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } private class sshconnection extends AsyncTask&lt;String, Void, String&gt; { protected String doInBackground(String... params) { try { JSch jsch = new JSch(); Session session = jsch.getSession("name", "ipaddress", 22); session.setPassword("password"); // Avoid asking for key confirmation Properties prop = new Properties(); prop.put("StrictHostKeyChecking", "no"); session.setConfig(prop); session.connect(); ChannelExec channel = (ChannelExec)session.openChannel("exec"); channel.setCommand("ls"); channel.connect(); InputStream input = channel.getInputStream(); channel.disconnect(); } catch (Exception e) { System.out.println(e.getMessage()); } return null; } @Override protected void onPostExecute(String result) { TextView txt = (TextView) findViewById(R.id.txtipinfo); txt.setText("Executed"); } } adding uses-permission android:name="android.permission.INTERNET" to AndroidManifest.xml This is my first attempt at any serious coding, if anyone can help it would …
tagged with: java
upvote count: 1
answer count: 1
tagged with: jsch
has answer: http://stackoverflow.com/a/34487106
favorite count: 0
tagged with: android-asynctask

http://stackoverflow.com/q/23576079
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/36181565
has comment: http://stackoverflow.com/comment/36181606
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23576292
tagged with: comparable
has comment: http://stackoverflow.com/comment/36181590
tagged with: comparator
linked to: http://stackoverflow.com/q/18218830
has comment: http://stackoverflow.com/comment/36181686
has comment: http://stackoverflow.com/comment/36181563
answer count: 1
has title: Why is my code giving me a "Warning from the last Compilation"?
favorite count: 0
duplicate of: http://stackoverflow.com/q/18218830
downvote count: 1
has body: I am trying to modify the compareTo Method so that I can use Comparable Interface here but it's giving me the stated warning. What am I doing wrong ? It shows that there are no syntax errors but as soon as I click on Compile, a small window pops up with a message : " Warnings from last compilation F:\Desktop\PoochyPavy.java uses unchecked or unsafe operations. Recompile with -Xlint:unchecked for details." The original Code is : public class PoochyPavy implements Comparable { public PoochyPavy(int k) { value = k; } public int compareTo(Object nerd) //This method doesn’t follow the normal rules { PoochyPavy pp = (PoochyPavy) nerd; int r; if (value = = 6 * pp.value) { r = 136; } else { r = -137; } return r; } …other methods… public int value; } My attempt to modify the code : public int PoochyPavy(int k) { int Value = k; return k; } public int compareTo(Comparable nerd) //This method needs modification { PoochyPavy pp = (PoochyPavy) nerd; int r = 0; if (((Comparable)value).compareTo(6*pp.value)==0) { return r; } else if (((Comparable)value).compareTo(6*pp.value)&lt;0) { return r-1; } else if (((Comparable)value).compareTo(6*pp.value)&gt;0) { return r+1; } return r; } //…other methods… public int value;
has comment: http://stackoverflow.com/comment/36181562
upvote count: 0
has comment: http://stackoverflow.com/comment/36181605

http://stackoverflow.com/a/23489818
upvote count: 5
downvote count: 0
has body: TreeSet is a child of Set and sets do not store duplicate values. Here is the first line from the definition of set in java docs. A collection that contains no duplicate elements. Edit: As pointed out by @AlexEfimov in the comment below, TreeSet uses the compareTo method to determine the ordering and equality of elements, and so as others have pointed out, the compareTo implementation of MyCars would make the two elements with the same horse power equal, and hence only one of them would be stored in the TreeSet.
has comment: http://stackoverflow.com/comment/110976005
answers question: http://stackoverflow.com/q/23489718
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/110912788

http://stackoverflow.com/comment/36100482
comment on: http://stackoverflow.com/q/23532615
type: Comment
type: QuestionComment
score: 1
has text: find something about java reflection .

http://stackoverflow.com/comment/36112546
type: Comment
comment on: http://stackoverflow.com/a/23539432
type: AnswerComment
has text: I have get a default value for the button like this ....Button btnShowLocation=null; and I have uncomment that line as said but still it doesn't run
score: 0

postorder
type: Tag
tag name: postorder
tags question: http://stackoverflow.com/q/23557845

http://stackoverflow.com/q/23607585
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36243460
tagged with: caching
type: Question
has title: how can i query Java Caching System
has comment: http://stackoverflow.com/comment/36241305
score: 0
tagged with: java
has body: i'm use Java Caching System(JCS) to save database in memory. is there a way to execute a query in this system? for example: Select name from Employee where sal&gt;20000 thank you
tagged with: jcs
answer count: 0

http://stackoverflow.com/comment/36004062
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23481131
has text: Can you not just change the string above to include the columns?
score: 0

http://stackoverflow.com/q/23463149
tagged with: vbo
has comment: http://stackoverflow.com/comment/35971430
type: AnsweredQuestion
tagged with: opengl
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/35970609
type: Question
has body: Every time I try to run my LWJGL application the JVM crashes. It seems to be related to adding multiple triangles to my VBO. Here is my initialization code float[] vertices = { -0.5f, 0.5f, 0f, -0.5f, -0.5f, 0f, 0.5f, -0.5f, 0f, 0.5f, -0.5f, 0f, 0.5f, 0.5f, 0f, -0.5f, 0.5f, 0f }; vertexCount = vertices.length / 3; FloatBuffer verticesBuffer = BufferUtils.createFloatBuffer(vertices.length); verticesBuffer.put(vertices); verticesBuffer.flip(); vboId = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, vboId); glBufferData(GL_ARRAY_BUFFER, verticesBuffer, GL_STATIC_DRAW); glVertexPointer(vertexCount, GL_FLOAT, 0, 0L); glBindBuffer(GL_ARRAY_BUFFER, 0); And this is my rendering code glEnableClientState(GL_VERTEX_ARRAY); glDrawArrays(GL_TRIANGLES, 0, vertexCount); glDisableClientState(GL_VERTEX_ARRAY); When I remove the last 9 values in the vertices array it works fine, but if I keep those, or add more, the JVM will crash.
accepted answer: http://stackoverflow.com/a/23463608
has comment: http://stackoverflow.com/comment/35970998
score: 0
answer count: 1
tagged with: jvm
has answer: http://stackoverflow.com/a/23463608
has title: JVM crashing with VBOs using LWJGL

http://stackoverflow.com/q/23540359
has title: Configuration WildFly/HornetQ for JMS/MQ browsing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36168954
answer count: 0
score: 0
tagged with: wildfly
type: Question
has comment: http://stackoverflow.com/comment/36168937
tagged with: configuration
tagged with: java
tagged with: hornetq
has body: I'm currently switching from Glassfish to WildFly-8.0.0.Final application server, and my MQ / JMS browser does not support the built-in HornetQ (2.4.0.Final) implementation. After changing to JMSBrowser 2.6 (which should support HornetQ), I was unable to connect to my running WildFly instance. I presume, I need a little more configuration within the application server to make it work Can someone supply a working wildfly standalone.xml or standalone-full.xml configuration, that has an enabled remote jmx which can be accessed by QBrowsers?
tagged with: jms

http://stackoverflow.com/a/23598820
type: Answer
has comment: http://stackoverflow.com/comment/36223945
has body: You should pass an instance of CreateFile as the argument.
answers question: http://stackoverflow.com/q/23598783
score: 0

http://stackoverflow.com/comment/36085340
type: AnswerComment
has text: Hm... maybe a quick & dirty String.replace after the String.toLowerCase will work for you then? @ikirankumar
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23524516

http://stackoverflow.com/comment/36154015
comment on: http://stackoverflow.com/a/23561665
score: 0
type: Comment
has text: it is basically path problem check your folder name( assets,font etc)
type: AnswerComment

http://stackoverflow.com/q/23557124
upvote count: 1
tagged with: geronimo
score: 1
tagged with: java
tagged with: authentication
has answer: http://stackoverflow.com/a/23854687
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/36145856
has answer: http://stackoverflow.com/a/23751874
has body: I'm just now researching how to add authentication to a Java servlet. I found this example showing how to use authentication for a servlet, but this is for a Tomcat implementation. Our production environment uses Geronimo. How can I accomplish the same thing in Geronimo? Sorry, just learned the basics around Geronimo the other day yet have yet to find, at a high level, how to require authentication for a servlet running in Geronimo.
has comment: http://stackoverflow.com/comment/36145906
has title: Simple authentication for a Java servlet running in Geronimo
has comment: http://stackoverflow.com/comment/36145944
has comment: http://stackoverflow.com/comment/36145886
downvote count: 0
has comment: http://stackoverflow.com/comment/36515433
has comment: http://stackoverflow.com/comment/36145986
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/36145975
has answer: http://stackoverflow.com/a/23773485
answer count: 3
has comment: http://stackoverflow.com/comment/36794082
has comment: http://stackoverflow.com/comment/36145883
has comment: http://stackoverflow.com/comment/36146115
type: UnansweredQuestion

ejb
tags question: http://stackoverflow.com/q/23471714
tags question: http://stackoverflow.com/q/23597008
tags question: http://stackoverflow.com/q/23552785
tags question: http://stackoverflow.com/q/23604234
tags question: http://stackoverflow.com/q/23533788
tag name: ejb
tags question: http://stackoverflow.com/q/23591950
tags question: http://stackoverflow.com/q/23502313
tags question: http://stackoverflow.com/q/23505191
tags question: http://stackoverflow.com/q/23580485
tags question: http://stackoverflow.com/q/23464424
tags question: http://stackoverflow.com/q/23481646
type: Tag
tags question: http://stackoverflow.com/q/23580975

http://stackoverflow.com/comment/36168698
type: Comment
comment on: http://stackoverflow.com/q/23566511
has text: @AndrewThompson, yes you are right, though I hope it was still clear what I meant by reading my code snippet.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/35959633
score: 0
has text: [String.split](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String)) takes a _regex_ as the parameter
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23457430

http://stackoverflow.com/q/23595518
favorite count: 0
tagged with: terminal
has answer: http://stackoverflow.com/a/23595589
has body: I have a directory myDir with a lot of subdirectories . I want to execute the following command : java -cp bin Main on each and every subdirectory , and then , create (in each subdirectory) a file with the output of the command java -cp bin Main on the subdirectory . I tried this : // edited , doesn't work But it doesn't really work Any idea how to do that ? Thanks
has title: Ubuntu - How to run a command on folder and its subdirectories , and create a file in each folder with the output?
has answer: http://stackoverflow.com/a/23595641
linked to: http://stackoverflow.com/q/3008043
possible better answer: http://stackoverflow.com/a/23595589
has comment: http://stackoverflow.com/comment/36217674
type: AnsweredQuestion
tagged with: java
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/36217410
accepted answer: http://stackoverflow.com/a/23595641
tagged with: ubuntu
has answer: http://stackoverflow.com/a/23595737
score: -3
answer count: 3
upvote count: 0
tagged with: shell
tagged with: directory

http://stackoverflow.com/comment/36048845
has text: I think linear search is the quickest search algorithm for LinkedLists. And one advantage the list doesn't have to be sorted. (next time say it when it is for homework)
comment on: http://stackoverflow.com/q/23505107
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23560967
upvote count: 0
has comment: http://stackoverflow.com/comment/36152693
answers question: http://stackoverflow.com/q/23560777
score: -1
downvote count: 1
type: Answer
has body: Try this it ll help you. Typeface font = Typeface.createFromAsset(getApplicationContext().getAssets(),"fonts/helvetica.ttf"); ttf file should be in small letter.

http://stackoverflow.com/comment/36061991
type: AnswerComment
type: Comment
has text: docx4all is a standalone application, as opposed to a component.
comment on: http://stackoverflow.com/a/23506712
score: 0

http://stackoverflow.com/q/23607269
has body: I'm trying to make a program that finds the largest palindrome that is a product of two 3-digit numbers. This is what I have right now (I am new to programming): int num1 = 0; int num2 = 0; int product = 0; int tempProd1 = 0; int tempProd2 = 0; int tempProd3 = 0; int tempProd4 = 0; int tempProd5 = 0; int tempProd6 = 0; String prodCheck1 = ""; String prodCheck2 = ""; while (num1 &lt; 1000){ while (num2 &lt; 1000){ product = num1 * num2; prodCheck1 = Integer.toString(product); tempProd1 = product % 10; product = product / 10; tempProd2 = product % 10; product = product / 10; tempProd3 = product % 10; product = product / 10; tempProd4 = product % 10; product = product / 10; tempProd5 = product % 10; product = product / 10; tempProd6 = product % 10; product = product / 10; prodCheck2 = "tempProd1" + "tempProd2" + "tempProd3" + "tempProd4" + "tempProd5" + "tempProd6"; if (prodCheck1 == prodCheck2){ System.out.println(prodCheck1); } num2++; } num1++; } Thing is, every time I try to run it, it terminates without an error. Could someone explain what I'm doing wrong? Edit: Thanks everyone, finally fixed it. The answer is 853358, if anyone was wondering. Edit: Actually, the number was 906609.
has title: Java program terminating without error?
has answer: http://stackoverflow.com/a/23607365
score: 0
has comment: http://stackoverflow.com/comment/36239390
tagged with: java
answer count: 3
upvote count: 1
accepted answer: http://stackoverflow.com/a/23607403
possible better answer: http://stackoverflow.com/a/23607365
downvote count: 1
has answer: http://stackoverflow.com/a/23607369
has comment: http://stackoverflow.com/comment/36239410
linked to: http://stackoverflow.com/q/513832
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36241007
has answer: http://stackoverflow.com/a/23607403
favorite count: 0
has comment: http://stackoverflow.com/comment/36239340
type: Question
has comment: http://stackoverflow.com/comment/36239444

http://stackoverflow.com/q/23590344
downvote count: 0
has answer: http://stackoverflow.com/a/23590422
type: Question
type: AnsweredQuestion
tagged with: android
score: 1
has body: I got 3 TextView and 3 EditText in my Layout. The problem i have is that when I type more into my EditText will overlap my other views.. How my layout looks How it looks after i put my text I want if possible, while the EditText is getting bigger, the views under to go down, and I can scroll to see them, or any other method to make the layout look normal.. My XML code <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Title" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/editText1" android:layout_centerHorizontal="true" android:layout_marginTop="20dp" android:text="Words(Separated by space)" android:textAppearance="?android:attr/textAppearanceMedium" /> android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz " <requestFocus /> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/editText3" android:layout_centerHorizontal="true" android:text="Time (In seconds)" android:textAppearance="?android:attr/textAppearanceMedium" />
favorite count: 0
possible better answer: http://stackoverflow.com/a/23590422
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/23590477
tagged with: java
has title: EditText lines are overlapping other views
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/23590477
tagged with: android-layout

http://stackoverflow.com/comment/36017320
type: Comment
type: QuestionComment
has text: `1399293072000` is `Mon May 05 12:31:12 2014 +0000`, `1399276872000` is `Mon May 05 08:01:12 2014 +0000`. So the result *is* correct. Check your timezones.
score: 0
comment on: http://stackoverflow.com/q/23488526

http://stackoverflow.com/q/23500391
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23500704
linked to: http://stackoverflow.com/q/23111402
has comment: http://stackoverflow.com/comment/36039731
has comment: http://stackoverflow.com/comment/36039702
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36039990
accepted answer: http://stackoverflow.com/a/23500704
possible better answer: http://stackoverflow.com/a/23500641
has body: Suppose a function in a thread gets called on a specific event, and assume that the function has a runtime of 1 sec and suppose that this event happens 5 times a second, could that lead to Java OutOfMemory Errors? Basically it is one thread that is open and its role is to listen to messages. Each message that comes in will trigger an event. My question, is what happens if this thread receives more messages that it could handle? would that build an event queue that would create an OutOfMemory Exception? or would the messages be ignored? Update: it must have been a network queue, or some socket issue, messages were received over the network and the result of the processing, after the event was triggered, was written back on the network. When I removed the write back on the network, after the processing, the issue was solved.
has answer: http://stackoverflow.com/a/23500641
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36040191
has title: Java OutOfMemoryError caused by multiple event tiggers?

http://stackoverflow.com/a/23602828
has comment: http://stackoverflow.com/comment/36235587
answers question: http://stackoverflow.com/q/23602144
has comment: http://stackoverflow.com/comment/36233570
has comment: http://stackoverflow.com/comment/36233598
downvote count: 0
score: 8
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/36233471
has body: You can override prepareRenderer of the JTable and setToolTip for the cell/column/row component, and use some HTML for the tooltop, as see here and here For each different image you will need to get a different URL as the src of the img tag. You'll need to know some basic HTML for this. You can obtain an URL by using getClass().getResource() for images in the class path. Or you can use File.getUri().getUrl() to get image files on the file system. One of the links above also shows how you can get images from a relational database. Whatever way you obtain the URL, you will use it for the URL in the &lt;img src tag. Something like (from linked answer): URL url = getClass().getResource("/path/to/image"); String html = "&lt;html&gt;&lt;body&gt;" + "&lt;img src='" + url + "' width=150 height=150&gt; "; jc.setToolTipText(html + "&lt;br/&gt;" + getValueAt(row, column).toString() + ": row, col (" + row + ", " + column + ")" + "&lt;/body&gt;&lt;/html&gt;"); You will need to organize your images in some way where you can the data from the model corresponds some way to a path that can used to obtain the URL. Say you have a name as a piece of data in the table, then you want to be able to use that name as an identifier in obtaining the URL UPDATE with complete example Given this is my following project structure ProjectRoot src resources mario Mario.png Luigi.png the following works import java.awt.Component; import java.net.URL; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingUtilities; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; public class TableTooltipDemo { public TableTooltipDemo() { JTable table = getTable(getModel()); JFrame frame = new JFrame("Table ToolTip"); frame.add(new JScrollPane(table)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } private JTable…

http://stackoverflow.com/comment/36054065
has text: @AndrewThompson Also used `SwingUtilities.invokeLater` to change the frame size and a Swing `Timer`, same result
comment on: http://stackoverflow.com/q/23507422
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36054041
has text: `private String num_slots;` What? Why is a `String` holding something referred to as a num_(ber)? While on the subject. Please learn common [Java naming conventions](http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#73307) (specifically the case used for the names) for class, method & attribute names & use them consistently. I.E. `numSlots` as opposed to `num_slots`.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23507967
type: QuestionComment

epub
type: Tag
tags question: http://stackoverflow.com/q/23591391
tag name: epub

http://stackoverflow.com/q/23598758
score: 19
has body: I have two JodaTime objects and I wanted a method like so // Return the latest of the two DateTimes DateTime latest(DateTime a, DateTime b) But I can't find such a thing. I could easily write it, but I'm sure JodaTime would have it somewhere.
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/36843460
tagged with: java
has title: Math.max(...) for JodaTime
type: Question
tagged with: jodatime
answer count: 2
upvote count: 19
accepted answer: http://stackoverflow.com/a/23598816
has answer: http://stackoverflow.com/a/36843460
favorite count: 0
has answer: http://stackoverflow.com/a/23598816

http://stackoverflow.com/comment/36181276
type: QuestionComment
has text: Right. Does Friend really have a capital F like that ? It shouldn't if it's a variable name.
score: 0
comment on: http://stackoverflow.com/q/23575888
type: Comment

http://stackoverflow.com/q/23552827
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/23553302
tagged with: jsonp
has answer: http://stackoverflow.com/a/23552984
score: 0
answer count: 2
has body: I have a the following objects: server: a string products: will be arrays within the server productProperties: will be an array within a product Is the following a correct way to store the value in a JSON format? JSONOBJECT jmap = new JSONOBJECT(); jsonArray jproduct = new jsonArray (); jsonArray jproductsProperty1 = new jsonArray (); jproductsProperty1 .put("P1"); jproductsProperty1 .put("P2"); jsonArray jproductsProperty2 = new jsonArray (); jproductsProperty2 .put("Q1"); jproductsProperty2 .put("Q2"); jproduct.put(jproductsProperty1); jproduct.put(jproductsProperty2); jmap.put(server,jproduct); out.print(jmap.toString());
has title: How do you store arrays into a JSON object?
tagged with: org.json
type: UnansweredQuestion

http://stackoverflow.com/comment/36057800
type: Comment
comment on: http://stackoverflow.com/q/23509964
score: 0
has text: As your name is a `String` and `String` implements `Comparable` as well, just reuse it: `return this.name.compareTo(emp.name);`
type: QuestionComment

http://stackoverflow.com/comment/36048055
type: QuestionComment
has text: @myanimal The problem is although the TextView does wrap the content, the height of it is compressed because tv2 is only one line long, and so therefore tv1 is one line long.
comment on: http://stackoverflow.com/q/23459749
score: 0
type: Comment

http://stackoverflow.com/comment/36137728
has text: thanks , so obvious ... a wrong copy/paste after some hours working ... I should have had a cup of tea and come back .... thanks a lot !!!
comment on: http://stackoverflow.com/a/23549272
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36026851
type: Comment
type: QuestionComment
has text: http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html
comment on: http://stackoverflow.com/q/23493949
score: 0

http://stackoverflow.com/comment/73779300
score: 2
comment on: http://stackoverflow.com/a/23574723
has text: @sbromberger Give credit to Luc Devroye, his book was a labor of love and a real contribution. The book is now out of print, so Devroye has made it available for free as a PDF online. You can get it here: http://www.eirene.de/Devroye.pdf
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23529086
has comment: http://stackoverflow.com/comment/36094657
accepted answer of: http://stackoverflow.com/q/23528708
answers question: http://stackoverflow.com/q/23528708
has body: You can put everything in a csv file, something like: L1412,10,100,Nissan,Sedan and create a static factory method to create the instance you want: public static Vehical createVehical(String line){ String[] parts = line.split(","); String type = parts[parts.length -1]; //get the last column switch (type) { case "Van": return new Car(a, b, c,...); case "Sedan": return new Van(a, b, c...); default: return null; } } For furture checking subclass, use if(vehical instanceof Sedan){ }else if(vehical instanceof Van){ }else... Or you can look into Java Generic Collections, it may help you to solve your problem, hope it helps
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36095161
type: Answer
has comment: http://stackoverflow.com/comment/36094799
downvote count: 0
score: 1

http://stackoverflow.com/comment/36104802
comment on: http://stackoverflow.com/q/23517326
type: Comment
has text: I suppose, you do not want to display the buttons in GridRowEditing. You can try, extend the gridRowEditing class, override createRowEditor and hide the buttons. See the class, how they have implemented it. Or, you can create the complete functionality just by looking at how they created it
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36153120
has text: @kai He could debug / see his logs to see if the exception is catched. The problem though is probably that the file couldn't be found in the location you used.
comment on: http://stackoverflow.com/q/23561189
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23608182
downvote count: 0
has comment: http://stackoverflow.com/comment/36241037
has comment: http://stackoverflow.com/comment/36241493
has body: Find my the solution while I was writing this question, so just decided to share. Object value = map.get(new Integer(2)); if (map.containsKey(new Integer(2))) { System.gc(); // can happen here System.out.println(value); } else { System.out.println("Key is deleted"); } I have to get value first and only then check for key existence. That way I am protected against incorrect result. Current result is: 2 2 that is correct, at least for my case.
has comment: http://stackoverflow.com/comment/36240979
score: 1
has comment: http://stackoverflow.com/comment/36241625
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36246094
type: Answer
accepted answer of: http://stackoverflow.com/q/23608181
answers question: http://stackoverflow.com/q/23608181
has comment: http://stackoverflow.com/comment/36242587

http://stackoverflow.com/comment/35970083
type: QuestionComment
has text: Personally, they should be separate. The "state" or "logic" should be supplied to (and independent of) the frame, this way, the GUI's only responsibility is to generate a representation of "state" or "logic"...
comment on: http://stackoverflow.com/q/23462784
score: 1
type: Comment

http://stackoverflow.com/comment/36082306
has text: @Nishant OP never said anything about having dups.
comment on: http://stackoverflow.com/q/23523182
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23608929
has comment: http://stackoverflow.com/comment/36242250
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/23609113
tagged with: arrays
favorite count: 0
has title: Adding to an int inside an array
type: Question
has comment: http://stackoverflow.com/comment/36242445
has body: I keep trying to add (many times) +1 to a number (the number is zero) already in an array which is zero but it is not working. int i=0;//var for arrays int [] countArray = new int[10]; ///////////////////// //__________ ask for values -------------- System.out.println("Hello please enter the number you would" + " like to be sorted separated by commas. \n" + "Example: \" 2,3,5,83,2 \".\t only use" + " commas. to separate numbers\n"); //----------- save values ----- Scanner scan = new Scanner(System.in); String allInput = scan.nextLine();//single string object with all input String [] arr = allInput.split(",");//string array that holds all values //as String int [] numbersArray =new int[arr.length] ;//numbers for ( String w: arr){//change Strings to Int numbersArray[i]= Integer.valueOf(arr[i]); i++; } //__ set all number in count to zero because necessary i=0; for ( int x: countArray){//set all numbers to zero countArray[i]=0; i++; } //everything zeroed i=0; This works now, thank you guys: for (int x = 0; x &lt; numbersArray.length; x++){ if (numbersArray[x] &gt;=10 &amp;&amp; numbersArray[x] &lt;=100) { countArray[(numbersArray[x]-1)/10]++;} else{ if (numbersArray[x] &gt;=0 &amp;&amp; numbersArray[x] &lt;=10) { countArray[1 -1]++;} } }
accepted answer: http://stackoverflow.com/a/23609113
downvote count: 3
has comment: http://stackoverflow.com/comment/36242374
answer count: 1
tagged with: java
score: -3
tagged with: int

http://stackoverflow.com/q/23590652
has comment: http://stackoverflow.com/comment/36208354
has comment: http://stackoverflow.com/comment/36208461
answer count: 0
has comment: http://stackoverflow.com/comment/36208204
has body: I try to get take a photo (from camera) with the following code where imageCaptureUri = file:///storage/emulated/0/myApp/ProfileImageCapture.tmp imageFile is the output file == /storage/emulated/0/myApp/ProfileImage.tmp private void cropImage(Uri imageCaptureUri) { // Use existing crop activity. Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(imageCaptureUri, AccountSignInDetails.IMAGE_UNSPECIFIED); // Specify the output path File imageFile = new File(ResManager.mAppDir, AccountSignInDetails.PROFILE_IMAGE_FILE); intent.putExtra("output", Uri.fromFile(imageFile)); // Specify image size intent.putExtra("outputX", 100); intent.putExtra("outputY", 100); // Specify aspect ratio, 1:1 intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("scale", true); intent.putExtra("return-data", true); // REQUEST_CODE_CROP_PHOTO is an integer tag you defined to // identify the activity in onActivityResult() when it returns mActivity.startActivityForResult(intent, ImageTaker.REQUEST_CODE_CROP_PHOTO); } but sometimes I get the following log-cat error: I understand that error is for the imageCaptureUri 05-11 11:26:19.338: W/DecodeUtils(24836): java.io.IOException: broken file descriptor 05-11 11:26:19.338: W/DecodeUtils(24836): at android.graphics.BitmapRegionDecoder.nativeNewInstance(Native Method) 05-11 11:26:19.338: W/DecodeUtils(24836): at android.graphics.BitmapRegionDecoder.newInstance(BitmapRegionDecoder.java:88) 05-11 11:26:19.338: W/DecodeUtils(24836): at com.android.gallery3d.data.DecodeUtils.createBitmapRegionDecoder(DecodeUtils.java:229) 05-11 11:26:19.338: W/DecodeUtils(24836): at com.android.gallery3d.data.UriImage$RegionDecoderJob.run(UriImage.java:175) 05-11 11:26:19.338: W/DecodeUtils(24836): at com.android.gallery3d.data.UriImage$RegionDecoderJob.run(UriImage.java:171) 05-11 11:26:19.338: W/DecodeUtils(24836): at com.android.gallery3d.app.CropImage$LoadDataTask.run(CropImage.java:1023) 05-11 11:26:19.338: W/Dec…
type: UnansweredQuestion
type: Question
tagged with: android-layout
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/36208530
tagged with: layout
has title: java.io.IOException: broken file descriptor
has comment: http://stackoverflow.com/comment/36208172
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/36208227

http://stackoverflow.com/q/23489555
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: google-oauth
has title: How to use authentification on Google App Engine
answer count: 1
has answer: http://stackoverflow.com/a/23489719
accepted answer: http://stackoverflow.com/a/23489719
score: 0
tagged with: google-app-engine
has body: I'm looking for a good example, documentation or starting point for the following scenario. My own Google App (Java Servlet) running within Google App Engine SSL activated for this app A mobile Android app talking to my Google App OAuth or other? My problem is step 4. Somehow I want to make sure that only my Android app is allowed to talk to my Google App and depending on the user on the mobile device I have to restrict the privileges. But I couldn't find a "very simple" "easy to start" documentation. Would be glad if someone gives me a hint. A very short example would be great.

http://stackoverflow.com/comment/36112277
comment on: http://stackoverflow.com/q/23539180
score: 0
type: Comment
type: QuestionComment
has text: You are not passing the expected parameters to SQL. It expects 2 parameters. Please debug.

http://stackoverflow.com/a/23454131
has body: Usually domain layer means "entities" (models for domain) and domain services. Entities hold all business logic related to them. Validations (checking that they're in correct state) and calculations are usually put in the property setters/getters, while operations for transforming data are exposed via public methods. Domain services are classes that operate with multiple entities and do some calculations and/or transformations between entities. A few things to consider. In order for this design to work properly (so it is testable, decoupled etc), dependency injection (DI) must be used. Domain should never be bothered by getting or saving data etc. It should be clearly decoupled and all its dependencies should be known upfront. If it is a simple application it may be wise to combine domain layer and data access layer, so objects that are created from ORM are already entities. Just add domain services (if you need them). Use then the same entities on presentation as well (as model for MVC). This will decrease the need for mappers to map between ORM made objects (lets call them dbos), entities and possible models needed for presentation. Of-course if you need different objects for each layer, by all means create them. Just don't over complicate if it is not needed.
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/35957857
type: AcceptedAnswer
upvote count: 6
answers question: http://stackoverflow.com/q/23453944
accepted answer of: http://stackoverflow.com/q/23453944
type: Answer
has comment: http://stackoverflow.com/comment/35958138
has comment: http://stackoverflow.com/comment/35957682

http://stackoverflow.com/comment/36067038
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23515389
has text: Look into Java's [URI](http://docs.oracle.com/javase/7/docs/api/java/net/URI.html) and [URL](http://docs.oracle.com/javase/7/docs/api/java/net/URL.html) classes.

http://stackoverflow.com/comment/36068676
comment on: http://stackoverflow.com/q/23515239
score: 0
type: Comment
has text: @Gimby I think you should convert your comments into an answer.
type: QuestionComment

http://stackoverflow.com/comment/36047101
type: QuestionComment
has text: Did you create 2 different classes, extending the appropriate classes? If yes, open another question, post your code and error message/reason why it isn't working.
score: 0
comment on: http://stackoverflow.com/q/23481057
type: Comment

http://stackoverflow.com/comment/36009767
type: QuestionComment
has text: gridView.setAdapter(adapter1);
score: 0
comment on: http://stackoverflow.com/q/23484179
type: Comment

http://stackoverflow.com/comment/58704901
has text: Would love to but I'm not privileged enough to do so - "You must have 50 reputation to comment"
type: Comment
score: 0
comment on: http://stackoverflow.com/a/35488970
type: AnswerComment

http://stackoverflow.com/comment/36245773
comment on: http://stackoverflow.com/a/23610546
has text: Thanks, but your last edit suggest that it will not be possible to run it offline. However it also fails: `java.net.MalformedURLException: Protocol handler not found: codebase=http`
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23497745
type: Question
type: AnsweredQuestion
has body: Here is my problem, have a server and a client class which communicate via 2 threads (MsgWriter and MsgReader) To read the input and write it in a stream i use a scanner. It works but the Scanner need an input twice to continue. For example: I write a Message Your Message: a text. So i want to send the message right after i hit "enter" but i have to press enter another time to send the text. I'm sorry, i'm very bad in explaining. however here is the Code of the MsgWriter Thread public class MsgWriter extends Thread { private Socket s; private Buffer buffer = new Buffer(); public MsgWriter(Socket s) { this.s = s; } public void run() { String message = ""; BufferedReader br = null; boolean end = false; while(!end){ try{ synchronized (buffer) { while (!buffer.isEmpty()) { buffer.wait(); } //buffer.put(s); OutputStream out = s.getOutputStream(); PrintStream writer = new PrintStream(out); Scanner input = new Scanner(System.in); input.useDelimiter("\n"); if (input.nextLine().equals("")){ System.out.println("Your message: "); message = input.next(); br = new BufferedReader(new StringReader(message)); if (input.hasNext("x")) { br = new BufferedReader(new StringReader("Good Bye")); end = true; } message = br.readLine(); writer.println(message); System.out.println("-------------------------------"); } buffer.notifyAll(); } }catch(Exception ex){ System.out.println(ex.getMessage()); } } } } And the Output ServerIP: localhost/127.0.0.1 Port number: 56763 ++ Connected to Server Your message: hi server Received: hi client Let me know if you need the Code of the MsgReader Thread as-well.
tagged with: stream
answer count: 1
has answer: http://stackoverflow.com/a/23498178
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23498178
has title: Java Scanner needs input twice

http://stackoverflow.com/comment/36056613
has text: I couldn;t get you. can you please explain
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23508704

http://stackoverflow.com/q/23594433
type: Question
linked to: http://stackoverflow.com/q/23489986
has title: How to type in iframe using selenium2 (java)?
score: 0
has answer: http://stackoverflow.com/a/23600692
answer count: 1
type: UnansweredQuestion
tagged with: selenium
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/36215791
tagged with: java
has body: I'm new in selenium webdriver & I want to type in iframe with Rich text editor like this : #document I used this : WebDriver driver; WebElement frame = driver.findElement(By.xpath("//iframe[@title = 'Rich text editor, Post_description']")); driver.switchTo().frame(frame); WebElement editable = driver.switchTo().activeElement(); editable.sendKeys(desc); driver.switchTo().defaultContent(); But it does nothing... It only types white lines... Any help?
tagged with: webdriver

http://stackoverflow.com/comment/36196532
type: QuestionComment
comment on: http://stackoverflow.com/q/23584278
has text: Please read [how to ask a good question](http://stackoverflow.com/help/how-to-ask). It might be useful to know which [method](http://en.wikipedia.org/wiki/Hash_function) is being used to compute the hash.
score: 0
type: Comment

http://stackoverflow.com/comment/36039990
comment on: http://stackoverflow.com/q/23500391
score: 0
has text: I have no idea, what happens if the messages are received and the thread is busy processing older messages. Again, assume that the thread needs 1 sec to run and you receive 5 messages per sec.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23539174
has answer: http://stackoverflow.com/a/25556084
linked to: http://stackoverflow.com/q/2860121
tagged with: garbage-collection
possible better answer: http://stackoverflow.com/a/24215033
upvote count: 7
has comment: http://stackoverflow.com/comment/36241244
type: Question
has body: Sometimes, on a test machine (Windows), Java full GC takes over 20 seconds. The GC logs show that the real time is very high, user is also high, but not as high (around 3 seconds). In one case, it is: 21.2209796 secs [Times: user=3.76 sys=0.45, real=21.22 secs] What could be the reason? I have a suspicion but don't want to say right now. What is the easiest way to find out what the root cause is? If you don't know for Windows but know for Linux, that's an option as well: the tests could be re-run on Linux. The process was started as follows: "%JAVA_HOME%\bin\java.exe" -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:publish.gc.log -XX:PermSize=256m -XX:MaxPermSize=1024m -Xms1024m -Xmx3072m -XX:NewSize=352m -XX:MaxNewSize=352m -XX:SurvivorRatio=6 I don't know why NewSize, XX:MaxNewSize and SurvivorRatio are used. MaxPermSize is needed because it's an OSGi environment. Full thread dumps don't show anything special. The complete log of full GCs is (sorry, long): 2014-05-06T21:38:18.735-0700: 150.261: [Full GC [PSYoungGen: 23614K-&gt;0K(309952K)] [PSOldGen: 693188K-&gt;311405K(688128K)] 716802K-&gt;311405K(998080K) [PSPermGen: 45120K-&gt;45120K(262144K)], 1.4533481 secs] [Times: user=1.45 sys=0.01, real=1.45 secs] 2014-05-06T21:38:58.379-0700: 189.907: [Full GC [PSYoungGen: 1664K-&gt;0K(335488K)] [PSOldGen: 668139K-&gt;283959K(688128K)] 669803K-&gt;283959K(1023616K) [PSPermGen: 46688K-&gt;46688K(262144K)], 1.3466773 secs] [Times: user=1.34 sys=0.00, real=1.35 secs] 2014-05-06T21:39:44.082-0700: 235.613: [Full GC [PSYoungGen: 15200K-&gt;0K(309184K)] [PSOldGen: 668643K-&gt;292329K(740800K)] 683843K-&gt;292329K(1049984K) [PSPermGen: 47733K-&gt;47733K(262144K)], 1.3649206 secs] [Times: user=1.36 sys=0.00, real=1.37 secs] 2014-05-06T21:40:33.090-0700: 284.623: [Full GC [PSYoungGen: 10132K-&gt;0K(326528K)] [PSOldGen: 718669K-&gt;308144K(858368K)] 728802K-&gt;308144K(1184896K) [PSPermGen: 49596K-&gt;43403K(262144K)], 1.2978991 secs] [Times: user=1.31 sys=0.02, re…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36117464
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/36276210
has comment: http://stackoverflow.com/comment/36246021
accepted answer: http://stackoverflow.com/a/25556084
answer count: 2
has comment: http://stackoverflow.com/comment/36220718
downvote count: 0
has title: Very slow Java full GC wall clock
has comment: http://stackoverflow.com/comment/36234784
favorite count: 0
has comment: http://stackoverflow.com/comment/36260703
has comment: http://stackoverflow.com/comment/36246247
linked to: http://stackoverflow.com/q/2254041
has comment: http://stackoverflow.com/comment/36231833
has comment: http://stackoverflow.com/comment/36111912
has comment: http://stackoverflow.com/comment/36112192
has comment: http://stackoverflow.com/comment/36112023
has answer: http://stackoverflow.com/a/24215033

http://stackoverflow.com/comment/36225120
comment on: http://stackoverflow.com/a/23599497
score: 0
has text: @Quinn: it's really a view not a clone. If you want to clone that slice, then you have to copy it into a new object. It's really not related to references.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23480847
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23480684
type: Answer
answers question: http://stackoverflow.com/q/23480684
downvote count: 0
score: 1
has body: You forgot spaces and " ' "- around the strings, but you have to "Learn to use parameterized queries" like xQbert says...
has comment: http://stackoverflow.com/comment/36004456

http://stackoverflow.com/comment/36136537
comment on: http://stackoverflow.com/a/23551491
has text: I do not add then. They come from my game server (unity3d) and there I have the class player witch has the attribute user. When I create a new game there I send all users from my players (players.Select(player => player.User)). Maybe I should remove the null users even before send they to my application server.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23560877
has body: I would like to know if there is any way to directly inject a set of double values in a matrix using the .xml configuration file and the Spring Framework. More precisely, I have something like this: public myClass { private double [][] myMatrix; ... } I would like to inject the values for each row and each column of myMatrix when defining the myMatrix property of the bean instantiated from myClass. I solved the problem in this way, but isn't there any other (faster) solution? 0.80 0.0 0.60 0.0 0.40 0.0 0.20 0 </bean>
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23560993
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Direct injection of double values in a matrix using Spring Framework
tagged with: matrix
has comment: http://stackoverflow.com/comment/36152448
upvote count: 1
answer count: 1

http://stackoverflow.com/a/23551430
answers question: http://stackoverflow.com/q/23551207
has comment: http://stackoverflow.com/comment/36136536
has comment: http://stackoverflow.com/comment/36137676
has comment: http://stackoverflow.com/comment/36138214
has comment: http://stackoverflow.com/comment/36137004
has comment: http://stackoverflow.com/comment/36137871
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36137798
has comment: http://stackoverflow.com/comment/36136618
downvote count: 0
has body: Is it possible to create another appender with a different layout in the configuration file and use the specific appender wherever I choose in the code? Yes you can create different appender with a different layout and create different categories for each appender. use the category name to get the logger instead of appender name. Sample: (log4j.xml) <?xml version="1.0" encoding="UTF-8" ?> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <priority value="INFO" /> <appender-ref ref="stdout1" /> <priority value="DEBUG" /> <appender-ref ref="stdout2" /> </log4j:configuration> Java Code: (get the logger based on category name) org.apache.log4j.Logger.getLogger("category1").warn("debug msg for stdout1 appender"); org.apache.log4j.Logger.getLogger("category2").info("info msg for stdout2 appender"); Output: [main] WARN category1 - warn msg for stdout1 appender 2014-05-09 02:46:29,216 [main] INFO category2 - info msg for stdout2 appender
has comment: http://stackoverflow.com/comment/36138280
has comment: http://stackoverflow.com/comment/36136501
has comment: http://stackoverflow.com/comment/36138047
has comment: http://stackoverflow.com/comment/36135519
upvote count: 2
has comment: http://stackoverflow.com/comment/36136806

http://stackoverflow.com/a/23564350
has comment: http://stackoverflow.com/comment/36159473
downvote count: 0
has body: The length of an array is immutable in java. This means you can't change the size of an array once you have created it. So if you don't know the final size of the array you can't do what you want using Array. When you do: MyClass[] obj = list.toArray(new myclass[0]); You are creating an Array with size=1. Then you can't add elements. Using List instead of Array could be a good solution.
score: 1
has comment: http://stackoverflow.com/comment/36159950
answers question: http://stackoverflow.com/q/23563964
upvote count: 1
type: Answer

http://stackoverflow.com/a/23537865
has body: Change for (int i = 2; i == 13; i++) to for (int i = 2; i &lt;= 13; i++). The second argument is the loop condition which has to be true to run the loop.
upvote count: 2
answers question: http://stackoverflow.com/q/23537824
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/a/23589376
upvote count: 1
has comment: http://stackoverflow.com/comment/36206146
score: 1
has comment: http://stackoverflow.com/comment/36206525
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23589350
answers question: http://stackoverflow.com/q/23589350
type: Answer
has comment: http://stackoverflow.com/comment/36206047
has comment: http://stackoverflow.com/comment/36206503
has comment: http://stackoverflow.com/comment/36206416
has body: Netbeans doesn't care (and doesn't need) your jar. What you have to do is add the jar to your project, instead of adding an external library to netbeans. If your project is a maven project (unlikely), add the jar as a dependency. If your project is a java project then look for a library (lib) folder. If you are trying to modify the look and feel of netbeans itself: Force look and feel on NetBeans 6.5

http://stackoverflow.com/a/23506585
has comment: http://stackoverflow.com/comment/36054055
accepted answer of: http://stackoverflow.com/q/23506468
score: 0
answers question: http://stackoverflow.com/q/23506468
type: AcceptedAnswer
has body: The problem is that you're returning false too early. Here's what it looks like you're trying to do. You look at each element X in array1. Then you compare that one element to each element in array2. If X equals any element in array2, you're good (so far) and you can look at the next element in array1. But if X is different from every element in array2, then return false. That's a good approach. The problem is that you return false if X is different from any element in array2, not if it's different from every element. This is because as soon as you see two elements that are different between the two arrays, you return false right away. public boolean main(int []array1, int []array2) { for(int i=0;i&lt;10;i++) { for(int j=0;j&lt;10;j++) { if(array1[i]==array2[j]) { break; } else if (array1[i] != array2[j]) return false; } return true; } } To fix this: You need to do the return false check outside the for (int j... loop. There are a number of ways to do this, but my favorite is this: Declare a boolean variable found. You will initialize this to false before going through array2. Before you break, set found = true;, to indicate that the element X in array1 was found in array2. After you're done going through array2, check found. If it's false, then you know the whole function should return false. Also, your return true is in the wrong place. If you fix those two things, your method should work. EDIT: I missed that the equality has to be two ways. The above, with my suggestions, will return true if every element in array1 is in array2, but not vice versa. One simple update would be to write a helper method allElementsAreIn that uses two int[] arrays, and then call it twice, something like allElementsAreIn(array1,array2) &amp;&amp; allElementsAreIn(array2,array1). By the way, don't call your function main. That name should be used only for the main program, which must be void and take a String[] parameter. P.S. I'm assuming that the purpose of the exercise is to learn th…
type: Answer

http://stackoverflow.com/a/23596221
downvote count: 0
answers question: http://stackoverflow.com/q/23596141
type: Answer
accepted answer of: http://stackoverflow.com/q/23596141
score: 3
upvote count: 3
has body: You could use ShowcaseView to display the tips. And SharedPreferences for checking if the apps is being started for the first time, as shown in this answer
type: AcceptedAnswer

http://stackoverflow.com/a/23513171
has comment: http://stackoverflow.com/comment/36063276
has comment: http://stackoverflow.com/comment/36063123
has comment: http://stackoverflow.com/comment/36063427
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23513132
has comment: http://stackoverflow.com/comment/36063562
score: 1
upvote count: 1
has body: You need to add this in your import statement import java.util.StringTokenizer; Update public static void Display()throws IOException, FileNotFoundException { Scanner infile = new Scanner(new FileReader("G:\\DataFile.txt")); StringTokenizer token = null; String line=null; while((line=infile.nextLine())!=null &amp;&amp; !"".equals(line.trim())) { token = new StringTokenizer(line); StringElement str = new StringElement(); while(token.hasMoreTokens()) { str.setString(token.nextToken()); stringList.insert(str); } } stringList.print(); }

http://stackoverflow.com/q/23475943
has comment: http://stackoverflow.com/comment/35993729
tagged with: java
has comment: http://stackoverflow.com/comment/35993932
type: Question
has comment: http://stackoverflow.com/comment/35993800
score: 0
has comment: http://stackoverflow.com/comment/35995030
has comment: http://stackoverflow.com/comment/35994992
has comment: http://stackoverflow.com/comment/35994065
answer count: 1
has title: How to create an output file without running arguments in java?
favorite count: 0
has comment: http://stackoverflow.com/comment/35994057
has body: So I have a java program that is fully working but the results are so massive I want to put the results on a text file so I can see it clearly and so it can all fit. How do I put the output results of my program on a text file without having to run arguments?
has comment: http://stackoverflow.com/comment/35994629
has comment: http://stackoverflow.com/comment/35994692
has comment: http://stackoverflow.com/comment/35994300
has answer: http://stackoverflow.com/a/23476078
has comment: http://stackoverflow.com/comment/35995085
type: UnansweredQuestion
upvote count: 1
tagged with: output
downvote count: 1

http://stackoverflow.com/a/23495603
score: 0
type: Answer
has body: In Java method return a single varible/object. You may put your three sting variable in a Array and return that array. Or you can use A object to be returned with same properties. like public String[] sortFile(args[0]){ String[] array; //your logic goes here return array }
answers question: http://stackoverflow.com/q/23493684

http://stackoverflow.com/q/23536314
has comment: http://stackoverflow.com/comment/36107478
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23536915
type: Question
has title: jsp form and servlet with Angular.js validation
has body: I try to do a jsp form which would appeal to the the servlet after the Angular.js validation . I have 3 main files - default.jsp First name Enter a valid last first name. Submit AfterFormServlet.java import java.io.IOException; 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 AfterFormServlet */ @WebServlet("/AfterFormServlet") public class AfterFormServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public AfterFormServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("Hi"); } } app.js // create angular app var validationApp = angular.module('validationApp', []); // create angular controller validationApp.controller('mainController', function($scope) { // function to submit the form after all validation has occurred $scope.submitForm = function(isValid) { // check to make sure the form is completely valid if (isValid) { alert('Thanks, your order was Sent'); } else { alert('Invalid form'); } }; }); After I run it I get into the form , fill the required fields , click on the submit and it get into the servlet even though the validation failed . How to make it work ? Update: following @ug_ suggestion - make the validation but doesn't get into the servlet . And - cause the validation take affect but it get into the servlet even though the validation failed .
tagged with: jsp
tagged with: javascript
tagged with: servlets
answer count: 1
has comment: http://stackoverflow.com/comment/36107621
tagged with: angularjs
type: UnansweredQuestion

http://stackoverflow.com/comment/36149042
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23558612
type: QuestionComment
has text: How do i give access to the file somescript.sh ? many thanks.

http://stackoverflow.com/a/23554532
has comment: http://stackoverflow.com/comment/93815921
answers question: http://stackoverflow.com/q/23506651
score: 19
type: AcceptedAnswer
downvote count: 0
has body: fileInputStream = new FileInputStream("indexedFiles.txt"); ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream); Try it with a BufferedInputStream between the FileInputStream and the ObjectInputStream. This will reduce I/O system calls by a factor of 8. I found in practice that it lowered the time to deserialize an ArrayList&lt;&gt; with 1,000,000 items from 213s to 9s.
type: Answer
accepted answer of: http://stackoverflow.com/q/23506651
upvote count: 19

http://stackoverflow.com/q/23493462
has comment: http://stackoverflow.com/comment/36026798
upvote count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36026061
has body: I am using Spring and Hibernate and i always get this error message: java.lang.NoSuchMethodError: antlr.collections.AST.getLine() It happens when i make custom definitions in my repositories: public interface UserRepository extends JpaRepository<User, Long> { @Query("select u from User u where username = ?1") List<User> findByUsername(String username); @Query("select u from User u where username = ?1 and password = ?2") List<User> findByUsernameAndPassword(String username, String password); } If i remove the 2 queries then everything works just fine. I also added antlr as a dependency: org.antlr antlr 3.5.2 but this was unsuccessful to solve my issue. Spring: 3.2.3 RELEASE Hibernate: org.hibernate hibernate-entitymanager 4.0.1.Final runtime org.hibernate hibernate-jpamodelgen 1.2.0.Final compile
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/36026341
has comment: http://stackoverflow.com/comment/36026030
has comment: http://stackoverflow.com/comment/36026160
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36027506
has answer: http://stackoverflow.com/a/27872346
linked to: http://stackoverflow.com/q/4838741
type: Question
has title: java.lang.NoSuchMethodError: antlr.collections.AST.getLine() using Spring and Hibernate
tagged with: antlr
has comment: http://stackoverflow.com/comment/36026915
answer count: 2
has answer: http://stackoverflow.com/a/23494551

titanium
type: Tag
tags question: http://stackoverflow.com/q/23542551
tag name: titanium
tags question: http://stackoverflow.com/q/23457649
tags question: http://stackoverflow.com/q/23556715

http://stackoverflow.com/q/23480128
answer count: 0
has comment: http://stackoverflow.com/comment/36002522
has comment: http://stackoverflow.com/comment/36002661
type: UnansweredQuestion
tagged with: maven
has title: Building Maven (OSGI bundles) project in Eclipse
has comment: http://stackoverflow.com/comment/36002645
has comment: http://stackoverflow.com/comment/36006913
has comment: http://stackoverflow.com/comment/36002784
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/36002853
tagged with: blueprint-osgi
has comment: http://stackoverflow.com/comment/36008143
has comment: http://stackoverflow.com/comment/36002682
score: 0
has body: I am struggling to get Eclipse to think my project is compiled and works. I inherited this project that has 23 modules (all osgi bundles) and when I run 'mvn install' it passes, but Eclipse still has red x's next to all the modules. My ultimate goal is to be able to run this code through eclipse and debug it. Right now I am forced to deploy this into Karaf, start it, install the features, then tear it all down when done. This is KILLING me as it's taking so much time. Any suggestions on how I might improve this so it doesn't take over 5 minutes to add a small little change into the code? Thanks!!
has comment: http://stackoverflow.com/comment/36002350

http://stackoverflow.com/q/23572363
type: Question
has comment: http://stackoverflow.com/comment/36174326
linked to: http://stackoverflow.com/q/4131092
score: -2
tagged with: database
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/23572391
has body: 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 '? WHERE userid public static User updateAccountbyUser(User updateinfo){ System.out.println(updateinfo.getName() +"=custName"); try { getConnection(); String updateSQL = "UPDATE dchan.user SET " + " dchan.user.name = ? WHERE userid"+updateinfo.getId() ; preparedStatement = conn.prepareStatement(updateSQL); preparedStatement.setString(1, updateinfo.getName()); preparedStatement.executeUpdate(updateSQL); return updateinfo; } catch (Exception e) { e.printStackTrace(); } prepareDisconnect(); return null; } //ends updateUserAccount
favorite count: 0
type: UnansweredQuestion
tagged with: jdbc
has answer: http://stackoverflow.com/a/23572402
duplicate of: http://stackoverflow.com/q/4131092
downvote count: 4
has title: 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 '? WHERE userid
has comment: http://stackoverflow.com/comment/36174319
tagged with: java
has comment: http://stackoverflow.com/comment/36175610
tagged with: mysql

http://stackoverflow.com/a/23557257
type: AcceptedAnswer
downvote count: 0
has body: Your Service instance is being created manually. Spring will only fire the injections when your bean is handled by the Spring context. How to resolve this error? Do not initialize your beans manually, recover them using Spring context or by Spring injection. You may inject the bean inside another bean: @Component public class FooComponent { @Autowired Service service; public void foo() { System.out.println(service.getId()); //prints the value injected by Spring } } Or recover it directly from the Spring context @Component public class BarComponent { @Autowired BeanFactory beanFactory; void bar() { Service service = (Service)beanFactory.get("service"); System.out.println(service.getId()); //prints the value injected by Spring } } There's another option that let you create the beans manually and getting all the Spring power within them by using @Configurable annotation as explained here. In case you want to test your Spring beans, use JUnit + Spring Test, but this is more used for integration testing rather than unit testing. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(location={"classpath:location/of/your/spring.xml"}) public class MySpringTest { @Autowired Service service; @Test public void fooTest() { System.out.println(service.getId()); Assert.assertEquals(100, service.getId()); } }
type: Answer
accepted answer of: http://stackoverflow.com/q/23557245
score: 2
answers question: http://stackoverflow.com/q/23557245
upvote count: 2

http://stackoverflow.com/a/23611537
type: Answer
has body: You Most decrypt data from server side before sent it .
has comment: http://stackoverflow.com/comment/36330153
score: 0
answers question: http://stackoverflow.com/q/23611227

http://stackoverflow.com/a/23606906
type: Answer
has body: I must repeat Alex's question. "Why don't you just replace > with /"? However if you insist to check that the > has content on both sides then lookarounds are the way to go. (?&lt;=[\w\-\*\.\#]|[\[[^\]]+\]])&gt;(?=[\w\-\*\.\#]|\[ ) This just catches the > so replace with /.
upvote count: 1
downvote count: 0
type: AcceptedAnswer
score: 1
accepted answer of: http://stackoverflow.com/q/23604928
has comment: http://stackoverflow.com/comment/36239979
answers question: http://stackoverflow.com/q/23604928

http://stackoverflow.com/comment/35985443
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23471451
has text: **Just a side-note:** if you like to improve your code, change it this way `for (String name : cities) allCity.put(name, new Node(name));`
type: Comment

http://stackoverflow.com/q/23464360
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/39312075
type: Question
has comment: http://stackoverflow.com/comment/36403680
tagged with: illegalstateexception
score: 0
tagged with: java-bytecode-asm
has title: IllegalStateException: "Undefined label used" with ASM > 4.1
has body: I want to upgrade Commons Javaflow from ASM 4 to 5 (same problem with 4.1 ) and I get this exception: java.lang.IllegalStateException: Undefined label used at org.objectweb.asm.util.CheckMethodAdapter.visitMaxs(Unknown Source) at org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAdapter.visitMaxs (ContinuationMethodAdapter.java:313) at org.objectweb.asm.tree.MethodNode.accept(Unknown Source) at org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAnalyzer.visitEnd(ContinuationMethodAnalyzer.java:140) the code triggering this error is: public void visitMaxs(int maxStack, int maxLocals) { Label endLabel = new Label(); mv.visitLabel(endLabel); mv.visitLocalVariable("__stackRecorder", "L" + STACK_RECORDER + ";", null, startLabel, endLabel, stackRecorderVar); mv.visitMaxs(0, 0); } Any idea how to fix that?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36327993

http://stackoverflow.com/comment/131839223
comment on: http://stackoverflow.com/a/74697531
has text: Its another way for sorting List of List of Integer using lambda function [Upvote for more such Java solution ♨︎].
type: AnswerComment
score: 0
type: Comment

instantiation
type: Tag
tags question: http://stackoverflow.com/q/23541215
tag name: instantiation
tags question: http://stackoverflow.com/q/23602239

http://stackoverflow.com/comment/36660435
has text: You're right but even if that is the case, by this code he gets the filename without the extension. Even if that file is a backup file, he will still get the filename, "viewemployee", which he desires to get.
comment on: http://stackoverflow.com/a/23557939
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35984614
score: 0
type: Comment
type: QuestionComment
has text: Thank you for the answer but isn't there a simple way just to show the time using thread? I mean the aim is just to show how long the video streaming is going
comment on: http://stackoverflow.com/q/23471028

http://stackoverflow.com/q/23465618
score: 0
possible better answer: http://stackoverflow.com/a/23465740
answer count: 3
tagged with: japplet
has comment: http://stackoverflow.com/comment/35975248
has body: public class NewAccountApplet extends JApplet implements ActionListener{ JPanel jp1, jp2, jp3, jp4, jp5, jp6; GridLayout productLO = new GridLayout(10,4,10,10); int qty = 5; JComboBox&lt;Object&gt;[] selectQty; if (e.getActionCommand().equals("Login")) { if (id.equals(checkID) &amp;&amp; pw.equals(checkPW)) { JOptionPane.showMessageDialog(null, "Authenticated"); JPanel content = (JPanel)getContentPane(); GridBagConstraints firstCol = new GridBagConstraints(); firstCol.weightx = 1.0; firstCol.anchor = GridBagConstraints.WEST; firstCol.insets = new Insets(5, 20, 5, 5); GridBagConstraints lastCol = new GridBagConstraints(); lastCol.gridwidth = GridBagConstraints.REMAINDER; lastCol.weightx = 1.0; lastCol.fill = GridBagConstraints.HORIZONTAL; lastCol.insets = new Insets(5, 5, 5, 20); selectQty = new JComboBox[qty]; jp1.setVisible(false); jp2.setVisible(false); jp3.setVisible(false); jp4.setVisible(true); jp5.setVisible(true); jp6.setVisible(true); String[] itemText = {"1", "2", "3", "4", "5"}; JLabel[] items = new JLabel[6]; JLabel purchasePage = new JLabel("Items for Purchase"); jp4.add(purchasePage); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); content.add(jp4); jp4 = new JPanel(); jp5 = new JPanel(new GridBagLayout()); //set jp5 as a new jpanel with gridbaglayout jp6 = new JPanel(); for(int i=0; (i&lt;items.length); i++) { items[i] = new JLabel(); //adds items[i] as JLabel items[i].setText(itemText[i]); //sets text of items as itemText[] jp5.add(items[i], firstCol); //adds items to firstcol of jp5 selectQty[i] = new JComboBox&lt;Object&gt;(); //JComboBox selectqty[i] selectQty[i].setPreferredSize(new Dimension(300, 20)); //sets the size jp5.add(selectQty[i], lastCol); //sadsdasd } } else JOptionPane.showMessageDialog(null, "Wrong account information");} I have some questions regarding adding a JComboBox into a loop to display on my JApplet. the for loop on the bottom adds my JComboBox (selectQty) to the screen. But I get an error message on eclipse whe…
tagged with: jcombobox
accepted answer: http://stackoverflow.com/a/23465733
has answer: http://stackoverflow.com/a/23466019
tagged with: swing
has answer: http://stackoverflow.com/a/23465733
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23465740
tagged with: java
tagged with: loops
type: Question
has title: JComboBox[] loop to show on JApplet not working

http://stackoverflow.com/comment/36155361
type: QuestionComment
comment on: http://stackoverflow.com/q/23562297
has text: it should be `if(o1>=o2) continue;` to get the output you said
score: 0
type: Comment

http://stackoverflow.com/q/23562451
has answer: http://stackoverflow.com/a/23563545
has title: Why an extra "/.\" in linux path?
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36157286
has comment: http://stackoverflow.com/comment/36154958
tagged with: linux
has body: Windows Scenario :- I have a small piece of code which gets me the location of a specific folder in the directory. The code is as given below: browserPath = this.EnginePath + "\\Chrome_Selenium\\" + "chromedriver.exe"; This gets me the exact path : D:\Engine\Test I am trying to use the same logic to get the path in linux machine. The path where the Engine and Chrome Driver is stored in my linux machine (VM) is /root/Engine/Chrome_Selenium Now the linux part :- I am using the following piece of code to get that browserPath = this.EnginePath + "/Chrome_Selenium/" + "chromedriver"; The path this piece of code fetches is /root/Engine/.\Chrome_Selenium\chromedriver Can you please help me understand why the "/.\" is appearing in the path?
has comment: http://stackoverflow.com/comment/36155054
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36155068
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/36214175
comment on: http://stackoverflow.com/q/23593763
score: 2
has text: [7 Tips to deal with sensitive information or password in Java](http://javarevisited.blogspot.com/2012/05/best-practices-while-dealing-with.html)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36121976
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23544180
has text: I put a1 a2 for example but all of them is a
score: 0

http://stackoverflow.com/q/23573671
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36176735
tagged with: jpanel
has body: I want to add a vector of 36 JButtons into a JPanel but when I do it gives me errors and say that I can't add a vector into a JPanel. Is there any way to do that? thanks for your help.
has answer: http://stackoverflow.com/a/23573746
type: Question
tagged with: vector
accepted answer: http://stackoverflow.com/a/23573781
has comment: http://stackoverflow.com/comment/36176759
possible better answer: http://stackoverflow.com/a/23573731
score: 0
has answer: http://stackoverflow.com/a/23573731
answer count: 3
has answer: http://stackoverflow.com/a/23573781
has title: how to add a vector of jbuttons into a jpanel
tagged with: jbutton

http://stackoverflow.com/a/23474651
type: Answer
downvote count: 0
score: 1
has body: No. There is by definition no way to sort a HashSet. You can use a TreeSetinstead tho'.
answers question: http://stackoverflow.com/q/23474574
upvote count: 1

http://stackoverflow.com/q/23479882
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/36001896
duplicate of: http://stackoverflow.com/q/20897020
has title: Reason for java.lang.Integer.IntegerCache between -128 and 127?
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36001933
type: Question
has comment: http://stackoverflow.com/comment/36001608
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/36001856
linked to: http://stackoverflow.com/q/20897020
has comment: http://stackoverflow.com/comment/36001605
has answer: http://stackoverflow.com/a/23479982
has answer: http://stackoverflow.com/a/23479938
favorite count: 0
has body: java.lang.Integer has an internal cache (IntegerCache) that optimizes access to numbers between -128 to 127. The question is why only between these numbers? Why not -256 to 255?
has comment: http://stackoverflow.com/comment/36010931

out-of-memory
tags question: http://stackoverflow.com/q/23475586
tags question: http://stackoverflow.com/q/23506614
tags question: http://stackoverflow.com/q/23544829
tags question: http://stackoverflow.com/q/23469111
type: Tag
tag name: out-of-memory
tags question: http://stackoverflow.com/q/23530097
tags question: http://stackoverflow.com/q/23557765

http://stackoverflow.com/comment/36131564
score: 0
type: AnswerComment
has text: I'm sorry if I wasnt clear. I know about the 13 and 10. I don't know where the other numbers are and how the first 5 decimal numbers create the 1001.49. Thank you
type: Comment
comment on: http://stackoverflow.com/a/23548754

propertyeditor
tags question: http://stackoverflow.com/q/23589639
type: Tag
tag name: propertyeditor

http://stackoverflow.com/q/23575559
linked to: http://stackoverflow.com/q/16608135
tagged with: java
tagged with: zxing
has body: I am making an app in android studio that uses a bar code scanner. I am using the Google ZXing lib. I downloaded the zip, opened the project and added the core.jar file as instructed but the tutorial was for eclipse and there is no option to add as library in android studio. so I am stuck on how to add it. any help would be greatly appreciated :)
type: Question
has title: Add ZXing android project as library in android studio
answer count: 2
has answer: http://stackoverflow.com/a/23576943
has answer: http://stackoverflow.com/a/25058097
downvote count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/46468681
favorite count: 0
tagged with: android-studio
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36180498
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/36180605

http://stackoverflow.com/q/23602492
score: 1
has answer: http://stackoverflow.com/a/23602705
upvote count: 1
type: Question
tagged with: java
has body: import java.io.*; public class Talk { public static void main(String[] args) { Console c = new Console(); String pw; System.out.print("password: "); pw = c.readLine(); System.out.println("got " + pw); } } Please explain to me this compiler exception at console java:5: error: Console() has private access in Console Console c = new Console(); ^ 1 error
has comment: http://stackoverflow.com/comment/36230851
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36230760
has title: Why do I get an exception when trying to create a new Console?
favorite count: 0
type: UnansweredQuestion
tagged with: scjp

http://stackoverflow.com/a/23502549
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36044048
has body: Question 1: It depends on security requirements. For most cases it's enough. Question 2: Here you can find a way to calculate SHA1 of string: Java String to SHA1 Question 3: Storing passwords in some particular table in database is quite a common practice. I recommend to use hashed passwords together with so-called salt, so the protocol is: User is registering or changing password and sending you his/her password. We generate some looooooooong random string which we gonna use as salt. Now, we need to calculate the value we're going in the database. Assuming you have sha1() method that performs hash calculation: String salt = generateLongRandomString(); String hashToStore = sha1(sha1(password) + salt); Now, we need to store in database at least three fields for each user: username or something similar, maybe email; hashToStore; salt; Ok, next step is authentication. User wants to authenticate and send you his password. You retrieve stored hash and salt for this user, searching by username or email; You recalculate hash using the formula I wrote above and compare it with the stored value. If it matches, the user is authentic and you may inform his/her about it.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36044133
accepted answer of: http://stackoverflow.com/q/23502395
has comment: http://stackoverflow.com/comment/36044221
answers question: http://stackoverflow.com/q/23502395

http://stackoverflow.com/comment/36134857
score: 0
comment on: http://stackoverflow.com/q/23551108
has text: Unrelated to your actual issue, but `binaryForm` has no reason to return `Object` so its return type should be `void`, or perhaps `String` (if you wanted the binary returned instead of printed).
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23501995
type: UnansweredQuestion
upvote count: 1
has title: Is there a portable shared memory mechanism in Java?
tagged with: java
tagged with: cross-platform
type: Question
tagged with: ipc
answer count: 1
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/23502433
favorite count: 0
has comment: http://stackoverflow.com/comment/36043009
has body: We are looking for a shared memory mechanism to transfer large amounts of data between processes without copying, in Java. It has to be portable (including Windows). Is there such a thing? We were thinking about using mmap-ed files, as they are portable, however their contents are written to disk which is not desirable. Are there alternatives? Otherwise, Windows has page-file-backed sections; is there an easy way to use these in Java? We are probably ok if we can use some other shared memory mechanism on *nix and those on Windows.
tagged with: shared-memory

http://stackoverflow.com/q/23493749
has comment: http://stackoverflow.com/comment/36026953
has answer: http://stackoverflow.com/a/23495496
type: UnansweredQuestion
has body: I am creating a board game in Eclipse and trying to do unit testing. For my unit testing, I am using Junit and EclEmma. Within a class, I am trying to test that if a button (newGameButton) is pressed, it will take the player to the contentPane "Player Details". Here is the relevant portion of the code for the JButton: public void createGUI() { JButton newGameButton = new JButton("New Game"); newGameButton.setToolTipText("Click to start a new game"); newGameButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CardLayout cardLayout = (CardLayout) contentPane.getLayout(); cardLayout.show(contentPane, "Player Details"); pack(); } }); And my test code (in a separate class) is: @Test public void testHomeButtonMainMenu() { appTest.createGUI(); appTest.newGameButton.doClick(); // I know this isn't correct, I'm trying to simulate newGameButton being pressed Assert.assertTrue(); // somehow test that the game is on the player details } Does anyone know how to correct code the JButton newGameButton being pressed and what test to write to show that the test was successful? Thanks
tagged with: unit-testing
has title: How do I test JButton ActionListener from within a method? (unit testing)
tagged with: jbutton
type: Question
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/23496592
score: 0
answer count: 2
tagged with: assert

http://stackoverflow.com/q/23520528
has comment: http://stackoverflow.com/comment/36077733
has answer: http://stackoverflow.com/a/23520636
tagged with: parameters
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36077213
tagged with: java
type: Question
tagged with: substitution
answer count: 1
accepted answer: http://stackoverflow.com/a/23520636
has comment: http://stackoverflow.com/comment/36076962
score: 0
has title: Parametric string replacement
has body: I am running in to bit of a trouble trying to use parametric replacement. In my properties file I have the following entry tpi.message=This is a test message. Generated for ? on ? . The text above is displayed on the web and in the report therefore I need to replace ? with parameters. However, I can't use replace* method because ? is special character for regex. I also don't want to use String.format method. I know it is possible to replace ? but I don't remember how. Your help is appreciated.

http://stackoverflow.com/a/23582902
type: Answer
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/23552849
answers question: http://stackoverflow.com/q/23552849
type: AcceptedAnswer
downvote count: 0
has body: From the architectural point of view, your question is similar to Best Design for a User/Role Management System?. There the accepted answer suggests to use the role-based access control (RBAC) pattern, which also makes sense in your case. Basically each User knows one or more Roles (what you called user type). Each Role knows one or more Operations it can perform (what you called functionality). If you want to add new functionality, you have to create a new class derived from Operation, which contains the new sourcecode, and link all appropiate Roles against it. If you want to add a new user or a new role, you don't have to create new sourcecode, so you create no new class but just a new object from the classes Subject or Role and link it appropriate. For the maintenance of your app, you could easily extract the User- and Role-creation from code into a configuration outside of your app, so that you don't have to modify any code for changing them. This works well because you don't have to create or modify classes. But since that is the case to change Operations, these are more difficult to configure from outside your app and most likely the best way is just to create the new classes; but of course it's also possible, e.g. with a plugin mechanism.

http://stackoverflow.com/comment/36041428
score: 0
has text: it's an Intent. Android Name it automatically in onActivityResult.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23501269

http://stackoverflow.com/q/23459371
tagged with: java
has answer: http://stackoverflow.com/a/23459664
has title: how to only trim the blanks in the beginning of a string
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23459400
accepted answer: http://stackoverflow.com/a/23459400
possible better answer: http://stackoverflow.com/a/23459478
upvote count: 1
has answer: http://stackoverflow.com/a/23459478
tagged with: string
favorite count: 0
has body: Java method: String.trim() trim blanks (white space, new line, etc.) at both the beginning and end of a string. How to only trim the blanks in the beginning of a String?
has comment: http://stackoverflow.com/comment/35963830
answer count: 4
tagged with: trim
has answer: http://stackoverflow.com/a/23459677
downvote count: 0
score: 1

http://stackoverflow.com/comment/36236131
score: 1
has text: It would be a *lot* easier to read your post if you'd format your code cleanly.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23605515

http://stackoverflow.com/comment/36264496
has text: @user2952821, happy it helped! If you hover over a comment, you'll see a gray up arrow and flag appear to the left of it -- if you click the up arrow it'll get upvoted :)
score: 0
comment on: http://stackoverflow.com/q/23615094
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23586606
has comment: http://stackoverflow.com/comment/36200900
has comment: http://stackoverflow.com/comment/36201521
tagged with: java
has comment: http://stackoverflow.com/comment/36200795
has comment: http://stackoverflow.com/comment/36200831
has comment: http://stackoverflow.com/comment/36201409
has comment: http://stackoverflow.com/comment/36200822
tagged with: patternsyntaxexception
type: Question
has comment: http://stackoverflow.com/comment/36201198
answer count: 2
has comment: http://stackoverflow.com/comment/36200886
has title: Regex pattern SyntaxException
score: 0
accepted answer: http://stackoverflow.com/a/23586999
tagged with: android
tagged with: replaceall
tagged with: regex
has body: In my app, I'd like to remove all text in between "example" and the first occurance after this of } from a string. And I want to do this for all occurences. So I use this code: myString.replaceAll("\"example\"(.+?)}", ""); However, this gives me a PatternSyntaxException. Why? And: how do I solve it? stack trace: 05-10 23:32:16.129: W/System.err(724): java.util.regex.PatternSyntaxException: Syntax error in regexp pattern near index 16: 05-10 23:32:16.129: W/System.err(724): "example"(.+?)} 05-10 23:32:16.129: W/System.err(724): ^ 05-10 23:32:16.159: W/System.err(724): at java.util.regex.Pattern.compileImpl(Native Method) 05-10 23:32:16.190: W/System.err(724): at java.util.regex.Pattern.compile(Pattern.java:400) 05-10 23:32:16.190: W/System.err(724): at java.util.regex.Pattern.&lt;init&gt;(Pattern.java:383) 05-10 23:32:16.219: W/System.err(724): at java.util.regex.Pattern.compile(Pattern.java:374) 05-10 23:32:16.219: W/System.err(724): at java.lang.String.replaceAll(String.java:1784) ...
has comment: http://stackoverflow.com/comment/36201136
has comment: http://stackoverflow.com/comment/36201463
possible better answer: http://stackoverflow.com/a/23586692
has comment: http://stackoverflow.com/comment/36201397
has answer: http://stackoverflow.com/a/23586999
has answer: http://stackoverflow.com/a/23586692
has comment: http://stackoverflow.com/comment/36201164
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36201175

http://stackoverflow.com/comment/36083863
has text: @Konstantinos, both, error and well, as a collateral, not the expected result.
comment on: http://stackoverflow.com/q/23522446
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23547045
has comment: http://stackoverflow.com/comment/36127119
tagged with: java
downvote count: 2
tagged with: calendar
answer count: 1
has title: Constructor with Calendar - New Object
has answer: http://stackoverflow.com/a/23547300
has comment: http://stackoverflow.com/comment/36127128
type: AnsweredQuestion
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23547300
type: Question
has comment: http://stackoverflow.com/comment/36126904
score: -2
has comment: http://stackoverflow.com/comment/36126954
has comment: http://stackoverflow.com/comment/36127224
has body: My code: public MyCode (Calendar example1, String example2){ this.example1 = new GregorianCalendar(); this.example2 = example2; } How I do create objects with parameters?

http://stackoverflow.com/comment/35994057
score: 0
comment on: http://stackoverflow.com/q/23475943
type: Comment
has text: @user3600008 check my example
type: QuestionComment

http://stackoverflow.com/q/23563728
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23564424
type: AnsweredQuestion
upvote count: 14
has body: I have two List&lt;Map&lt;String, Object&gt;&gt; object. [{Month=August-2013, Sales=282200}, {Month=July-2013, Sales=310400}, {Month=June-2013, Sales=309600}, {Month=May-2013, Sales=318200}, {Month=September-2013, Sales=257800}] and [{Month=April-2013, NoOfTranx=8600}, {Month=August-2013, NoOfTranx=6700}, {Month=July-2013, NoOfTranx=14400}, {Month=June-2013, NoOfTranx=8500}, {Month=May-2013, NoOfTranx=14400}] I want to join(Merge) these two List on Month key. How can I perform several join operation (i.e. FULL OUTER JOIN, RIGHT OUTER JOIN etc.) on these List using new Collection API.
tagged with: collections
tagged with: java-8
type: Question
score: 14
has title: Joins in Java 8 Collection API
tagged with: join
tagged with: java
has answer: http://stackoverflow.com/a/23564424

http://stackoverflow.com/comment/36171551
has text: @ElliottFrisch Not necessarily, for example Firebird and PostgreSQL JDBC drivers return all columns
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23567687

http://stackoverflow.com/comment/36064753
type: AnswerComment
type: Comment
has text: @dwnz I did not understand your comment. Are you saying this does not solve your issue? Have you updated getInstance() like I posted?
comment on: http://stackoverflow.com/a/23514032
score: 0

http://stackoverflow.com/comment/36123396
type: AnswerComment
score: 1
type: Comment
has text: Thank you very much. It worked, I removed the "try-catch" block and the "read()".
comment on: http://stackoverflow.com/a/23544331

http://stackoverflow.com/comment/36093482
type: Comment
comment on: http://stackoverflow.com/a/23528298
type: AnswerComment
score: 0
has text: @LuiggiMendoza I don't think it is a bug in Java 7.

http://stackoverflow.com/q/23531713
downvote count: 1
tagged with: tomcat
favorite count: 0
has title: spring mvc tomcat error
tagged with: postgresql
tagged with: spring
upvote count: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23531826
type: Question
has body: while I'm trying to execute my spring-mvc application on tomcat server I got a PropertyAccessException can someone help me to identify the problem ? I am beginner in mvc-spring framework. Stack trace mai 08, 2014 4:03:50 AM org.apache.catalina.core.StandardContext listenerStart Grave: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceUnitManager' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Cannot resolve reference to bean 'datasource' while setting bean property 'defaultDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [org.postgresql.Driver] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:52…
tagged with: hibernate
has answer: http://stackoverflow.com/a/23531856
score: -1
answer count: 2

http://stackoverflow.com/comment/36232216
comment on: http://stackoverflow.com/q/23602702
has text: I mentioned earlier, this happens only when i tried to scroll fast through my list view.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36068375
type: AnswerComment
has text: I guess something wrong. what is the class file names ?
type: Comment
comment on: http://stackoverflow.com/a/23515534
score: 0

http://stackoverflow.com/comment/35972892
comment on: http://stackoverflow.com/q/23464310
type: Comment
type: QuestionComment
has text: @DavidWallace It's part of a merge sort algorithm which doesn't seem to be working properly. I'm converting it from an int array implementation i Googled up.
score: 0

http://stackoverflow.com/comment/36133151
has text: If I created an array of JLabel, I would have to add all the labels to the array manually. I might as well have just added the labels to the JPanel manually, right?
comment on: http://stackoverflow.com/a/23550233
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36176178
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23573105
has text: @Vishrant is not a duplicate. That question ask about how to accomplish that behavior in Java. This question asks **why** Java has this behavior.

http://stackoverflow.com/comment/36147322
comment on: http://stackoverflow.com/q/23557948
type: Comment
type: QuestionComment
has text: i always use lowercase letters. `float f = 3,14f; double d = 3,14d; long l = 10L` but for long its better to use an uppercase L, because the lowercase looks like 1.
score: 3

http://stackoverflow.com/comment/35994801
type: Comment
has text: That does not handle the 28-31 days per month issue.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23476393

http://stackoverflow.com/comment/36012031
type: QuestionComment
has text: does the string need to be written like this? private String [] answerA=new String[10]; rather than private String [] = answerA
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23485477

http://stackoverflow.com/q/23595749
has answer: http://stackoverflow.com/a/74664561
tagged with: hashset
has comment: http://stackoverflow.com/comment/36218114
accepted answer: http://stackoverflow.com/a/23596028
has comment: http://stackoverflow.com/comment/36221062
has comment: http://stackoverflow.com/comment/36218008
score: 8
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/36218516
has answer: http://stackoverflow.com/a/23595933
has answer: http://stackoverflow.com/a/23595765
type: AnsweredQuestion
has body: I have a set like below: HashSet<Integer> set = new HashSet<Integer>(); set.add(1); How can I get the 1 out? I can do it by for(integer i : set). My specified problem is "Given an array of integers, every element appears twice except for one. Find that single one." I want to use add elements into the set if the set doesn't contain it and remove existing elements during the loop. And the last remaining element is the answer. I don't know how to return it. public static int singleNumber(int[] A) { HashSet<Integer> set = new HashSet<>(); for (int a : A) { if (!set.contains(a)) { set.add(a); } else { set.remove(a); } } /** * for(Integer i : set) { return i; } *return A[0]; //need one useless return /** * while(set.iterator().hasNext()) { return set.iterator().next(); } * return A[0]; //need one useless return */ return set.toArray(new Integer[1])[0]; }
has comment: http://stackoverflow.com/comment/36218602
tagged with: java
tagged with: set
possible better answer: http://stackoverflow.com/a/23595765
has answer: http://stackoverflow.com/a/23596028
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36217844
has answer: http://stackoverflow.com/a/23595859
upvote count: 9
has comment: http://stackoverflow.com/comment/36218618
has title: If only one element in a hashset, how can I get it out?
has comment: http://stackoverflow.com/comment/36218653

http://stackoverflow.com/q/23608866
answer count: 3
has body: Ok so I'm building to show students how a loop goes through an array, I have added 2 images to help explain and the code, the first is the result I get after I click go then it freezes . The Second image is what I'd like it to do after you put in the values of 1 in start, 15 in stop, 3 in step and click the Go Button. And then to be cleared on the click of Clear button. I think they probably related. Can anyone see the problem? Thanks in advanced! import java.awt.*; import java.awt.event.*; import java.awt.Color; import javax.swing.JOptionPane; public class Checkerboard extends Frame implements ActionListener { int[] blocksTextField = new int[15]; Panel blocksPanel = new Panel(); TextArea blocksDisplay[] = new TextArea[16]; TextField start = new TextField (3); TextField stop = new TextField (3); TextField step = new TextField (3); //Colors Color Red = new Color(255, 90, 90); Color Green = new Color(140, 215, 40); Color white = new Color(255,255,255); //textField ints int inputStart; int inputStop; int inputStep; //Lables Label custStartLabel = new Label ("Start : "); Label custStopLabel = new Label ("Stop : "); Label custStepLabel = new Label ("Step : "); //Buttons Button goButton = new Button("Go"); Button clearButton = new Button("Clear"); //panel for input textFields and lables Panel textInputPanel = new Panel(); //Panel for buttons Panel buttonPanel = new Panel(); public Checkerboard() {//constructor method //set the 3 input textFields to 0 inputStart = 0; inputStop = 0; inputStep = 0; //set Layouts for frame and three panels this.setLayout(new BorderLayout()); //grid layout (row,col,horgap,vertgap) blocksPanel.setLayout(new GridLayout(4,4,10,10)); textInputPanel.setLayout(new GridLayout(2,3,20,10)); buttonPanel.setLayout(new FlowLayout()); //setEditable() //setText() //add components to blocks panel for (int i = 0; i&lt;16; i++) { blocksDisplay[i] = new TextArea(null,3,5,3); if(i&lt;6) blocksDisplay[i].setText(" " +i); else blocksDisplay[i].setText(" " +i); blo…
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23608947
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/23609006
possible better answer: http://stackoverflow.com/a/23608926
type: Question
has answer: http://stackoverflow.com/a/23608926
tagged with: for-loop
upvote count: 0
tagged with: arrays
score: -3
has title: Program freezing(not responding) after button click no a Java app
accepted answer: http://stackoverflow.com/a/23608947

http://stackoverflow.com/comment/36020530
comment on: http://stackoverflow.com/q/23489994
has text: What version of java are you using? (needs to be Java 1.7). Try downloading OpenJML again? (I've just run it across your Edge.java and it reported no errors). Are you doing anything more complex than `java -jar openjml.jar Edge.java` ? if so, post command line. Do you have an SMT prover available? Which?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23589630
has body: Easiest and most robust way to serialise all your records and load into your app when it first run.
upvote count: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36206683
answers question: http://stackoverflow.com/q/23587074
score: 1

http://stackoverflow.com/comment/36105336
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23535046
has text: There is nothing wrong with it, but it gives me just the query string with the getQuery function. Then i have to write my own function to parse it. We have also to keep in mind that there are parameters with multiple values.
score: 0

wifi
tag name: wifi
tags question: http://stackoverflow.com/q/23497428
tags question: http://stackoverflow.com/q/23504782
type: Tag

http://stackoverflow.com/a/23527448
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/36090738
has comment: http://stackoverflow.com/comment/36090783
score: 2
has comment: http://stackoverflow.com/comment/36091782
answers question: http://stackoverflow.com/q/23527350
downvote count: 0
has body: Keep your created threads in a list and just start each one of them in the first loop without executing join(). Then iterate the list and join each thread. List&lt;GetNamesThread&gt; threads = new ArrayList&lt;GetNamesThread&gt;(); while(startYear &lt;= endYear){ try { GetNamesThread st = new GetNamesThread(startYear, numNames, allNames); st.start(); threads.add(st); } catch (IllegalThreadStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } startYear++; } for (GetNamesThread thread : threads) { try { thread.join(); } catch (InterruptedException e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/36090823

http://stackoverflow.com/comment/35993800
comment on: http://stackoverflow.com/q/23475943
score: 0
type: Comment
type: QuestionComment
has text: So where will the output file be located if I call System.setOut

http://stackoverflow.com/comment/36113635
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23540163
has text: will there be two digits only or more than two digits too ?

random
tags question: http://stackoverflow.com/q/23556561
tags question: http://stackoverflow.com/q/23608059
tags question: http://stackoverflow.com/q/23517415
tags question: http://stackoverflow.com/q/23584629
tags question: http://stackoverflow.com/q/23613457
tags question: http://stackoverflow.com/q/23576651
tags question: http://stackoverflow.com/q/23504552
tags question: http://stackoverflow.com/q/23613704
tags question: http://stackoverflow.com/q/23462323
tags question: http://stackoverflow.com/q/23467987
tags question: http://stackoverflow.com/q/23459875
tags question: http://stackoverflow.com/q/23463634
tag name: random
tags question: http://stackoverflow.com/q/23474176
tags question: http://stackoverflow.com/q/23573423
tags question: http://stackoverflow.com/q/23544720
tags question: http://stackoverflow.com/q/23607293
type: Tag
tags question: http://stackoverflow.com/q/23544415
tags question: http://stackoverflow.com/q/23561551
tags question: http://stackoverflow.com/q/23507829

navigation-drawer
tags question: http://stackoverflow.com/q/23460076
type: Tag
tags question: http://stackoverflow.com/q/23590782
tags question: http://stackoverflow.com/q/23469639
tags question: http://stackoverflow.com/q/23554436
tag name: navigation-drawer

http://stackoverflow.com/a/23604986
score: 4
has comment: http://stackoverflow.com/comment/36235212
type: Answer
has comment: http://stackoverflow.com/comment/36235125
has body: Save it in a variable before the try block.
has comment: http://stackoverflow.com/comment/36235529
upvote count: 4
answers question: http://stackoverflow.com/q/23604964
downvote count: 0

one-to-many
tags question: http://stackoverflow.com/q/23494323
type: Tag
tag name: one-to-many

http://stackoverflow.com/a/23529189
has comment: http://stackoverflow.com/comment/36094690
has comment: http://stackoverflow.com/comment/36094555
has body: What do we call a lock-free algorithm? [Disclaimer] Until I wrote this explicitly, my statements is about algorithms in general, not considering Java CAS implementation. Yes, in my opinion algorithm based on CAS can be considered lock-free. Wikipedia provides definition of lock-free algorithm: In computer science, a non-blocking algorithm ensures that threads competing for a shared resource do not have their execution indefinitely postponed by mutual exclusion. A non-blocking algorithm is lock-free if there is guaranteed system-wide progress regardless of scheduling; ... In modern usage, therefore, an algorithm is non-blocking if the suspension of one or more threads will not stop the potential progress of the remaining threads. Let's take a look over CAS-based algorithm in that context [saying algorithm I mean setting variable using CAS instruction with while loop]: Question one: Is CAS-based algorithm non-blocking? At each particular moment of time, there is one thread that will successfully CAS variable. If we suspend one of them, one of remaining will succeed instead. Thus, the algorithm satisfies the definition I quoted and the answer is yes. Question two: Is CAS-based algorithm lock-free? I think the answer is yes again, because system-wide, but not per-thread progress (each thread will eventually succeed cas-ing variable) is guaranteed. Now, let's consider CAS-based algorithms implemented in Java using AtomicXXX classes and CAS operations on its objects. Technically, there is no guarantee of lock-free-ness of such algorithms because of possible external influences from JVM side: public class Entity { static { new Thread(){ @Override public void run() { synchronized (getClass().getClassLoader()){ try { getClass().getClassLoader().wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } }.start(); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } public static void main(String[] args) { AtomicReference v = new At…
score: 5
has comment: http://stackoverflow.com/comment/36094711
upvote count: 5
answers question: http://stackoverflow.com/q/23529087
has comment: http://stackoverflow.com/comment/36094520
has comment: http://stackoverflow.com/comment/36094844
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36094760
accepted answer of: http://stackoverflow.com/q/23529087
has comment: http://stackoverflow.com/comment/36113473
has comment: http://stackoverflow.com/comment/36094780
type: Answer

http://stackoverflow.com/a/23583401
type: Answer
answers question: http://stackoverflow.com/q/23583228
has body: This looks to be worrying about premature optimization. If this is a one-off bit of code and not being called within a tight loop, why worry about optimizing? Having said that, most often the xml text would be found in a text file and not hard-coded in the program, and then you'll use a loop and a StringBuilder, i.e., StringBuilder xmlSb = new StringBuilder(); Scanner xmlScanner = new Scanner(Foo.class.getResourceAsStream(RESOURCE)); while (xmlScanner.hasNextLine()) { xmlSb.append(xmlScanner.nextLine()); } if (xmlScanner != null) { xmlScanner.close(); } // parse and use your xml text here
score: 0

http://stackoverflow.com/comment/36141111
score: 2
has text: I think you want `super.setF(-f);` inside those curly braces; but it's far from clear. What are you actually trying to achieve?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23554455

http://stackoverflow.com/comment/36234632
has text: Well for starters we should need to know why the exceptions are thrown? Is it because of shutdown? That case no way you should ignore them.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23604234
score: 0

http://stackoverflow.com/comment/36004406
type: Comment
comment on: http://stackoverflow.com/a/23480796
has text: Well, setting this outside don't work for me, maybe you need to do a export (don't know how to do this on windows). If you don't want to change the file, you can create a mvnDebug.bat and put the debug line on it. And then run mvnDebug jetty:run
score: 0
type: AnswerComment

http://stackoverflow.com/q/23567932
has answer: http://stackoverflow.com/a/23568070
has title: Shared resources among Eclipse projects
favorite count: 0
has comment: http://stackoverflow.com/comment/36166175
duplicate of: http://stackoverflow.com/q/3342818
type: UnansweredQuestion
tagged with: project
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/3342818
type: Question
has comment: http://stackoverflow.com/comment/36166124
has body: My team is developing different web applications using several common components and resources, so I suggested to create a shared jar project to contain common code and reference it as a jar. But we also need to share resources like css, images and custom tags for jsp pages. What's the common way to share these additional resources among Eclipse projects? NOTE My main doubt is about custom tags, which are still under construction and at the moment changes must be replicated in each project...
has comment: http://stackoverflow.com/comment/36165757
score: 0
has comment: http://stackoverflow.com/comment/36166169
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/35996864
has text: Paint on a JPanel, and override `paintComponent` instead.
comment on: http://stackoverflow.com/q/23477590
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/36005526
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23481191
has text: That's probably the cause of the null. The code you presented here is fine. Can you post the constructor's code?
score: 0

http://stackoverflow.com/comment/46354555
has text: I disagree with #3. It can be useful to have an `Optional` as a field when things are to be done or not to be done upon presence or absence of a value.
comment on: http://stackoverflow.com/a/23464794
type: AnswerComment
type: Comment
score: 64

http://stackoverflow.com/comment/36071020
has text: It may be caused by a race condition. The `d3.json` might be being invoked before the JSON file is created, the `alert` dialog stops the execution until the user clicks 'Ok', giving more time to the backend to generate the file. Try adding a pause instead of the alert dialog, or loading an existing file instead of a generated one to see if the visualization works.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23510048
type: Comment

http://stackoverflow.com/comment/36199458
comment on: http://stackoverflow.com/a/23585635
has text: Later I want to insert many dogs, and will do it with an doPost() form. But now only two Objects without a doPost().
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23456385
has answer: http://stackoverflow.com/a/23456431
tagged with: java
tagged with: unit-testing
type: Question
tagged with: mocking
tagged with: mockito
accepted answer: http://stackoverflow.com/a/23456431
score: 0
has comment: http://stackoverflow.com/comment/35957546
answer count: 1
has body: I have a method in my code that looks something like this: action.onResult(new Handler&lt;MyClass&gt;() { @Override public MyClass handle() { // Do something here } } } I want to be able to mock it (using Mockito). Something like this: when(mockedAction.onResult(any(Handler.class))).thenReturn(firstArg.handle()); Meaning, I want to call the handle method of the argument that's sent to the method onResult. I can't mock the handler because it uses inner methods of the calling class (I thought about using a private class but haven't reached a good enough solution) Motivation: This is an asynchronous callback mechanism that's used in a synchronous area. I want to mock the call to the handler itself in order to continue the flow synchronously in the code.
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/35957561
has title: Using mocked method argument to mock next steps
type: AnsweredQuestion

tree
tags question: http://stackoverflow.com/q/23554113
tags question: http://stackoverflow.com/q/23611541
type: Tag
tags question: http://stackoverflow.com/q/23591779
tags question: http://stackoverflow.com/q/23546679
tag name: tree
tags question: http://stackoverflow.com/q/23460804

http://stackoverflow.com/comment/36170006
type: QuestionComment
comment on: http://stackoverflow.com/q/23569971
score: 0
type: Comment
has text: this is the link that i have downloaded it from: http://www.apache.org/dyn/closer.cgi/lucene/java/4.8.0

http://stackoverflow.com/q/23612146
has answer: http://stackoverflow.com/a/23628952
has body: For a GeoSPARQL test project I want to have a custom datatype set in Jena. Howerver when I try this through the example provided at the Jena website, it still doesn't work. I get the following result: _:b0 &lt;http://www.opengis.net/ont/geosparql#asWKT&gt; "POINT (52.83525867111958 6.870789811954563)^^http://www.opengis.net/ont/sf#wktLiteral "^^&lt;java:com.hp.hpl.jena.rdf.model.impl.LiteralImpl&gt; . And of course I don't want the java:com.hp.hpl.jena.rdf.model.impl.LiteralImpl but http://www.opengis.net/ont/sf#wktLiteral because I wan to work with GeoSPARQL. On this page they have example data that works perfectly with my triple store and spatial index. But the above data doesn't work at all with spatial indexing. So, my question is, I do I define a custom datatype in my RDF in Jena?
tagged with: semantic-web
accepted answer: http://stackoverflow.com/a/23628952
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/23614188
type: Question
has answer: http://stackoverflow.com/a/23614188
tagged with: sparql
answer count: 2
has title: Jena custom datatype
upvote count: 1
tagged with: jena
tagged with: java

http://stackoverflow.com/q/23552303
has comment: http://stackoverflow.com/comment/36137030
has comment: http://stackoverflow.com/comment/36137352
has comment: http://stackoverflow.com/comment/36137215
has comment: http://stackoverflow.com/comment/36137029
has comment: http://stackoverflow.com/comment/36137170
answer count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36137398
linked to: http://stackoverflow.com/q/22975413
has comment: http://stackoverflow.com/comment/36137368
type: Question
has body: I got this error: "method format(String, Object[]) in the type String is not applicable for the arguments (String, int, int, int)" The following is the code, please anyone can help me! //Time1 class declaration maintains the time in 24-hour format. public class Time1 { private int hour; // 0-23 private int minute; //0-59 private int second; //0-59 //set a new time value using universal time; throw //an exception if the hour, minute or second //is invalid. public void setTime(int hour, int minute, int second) { //validate hour, minute and second if (hour &lt; 0 || hour &gt;= 24 || minute &lt; 0 || minute &gt;= 60 || second &lt; 0 || second &gt;= 60) { throw new IllegalArgumentException("hour, minute and/or second was out of range"); } this.hour = hour; this.minute = minute; this.second = second; } //convert to String in universal-time format (HH:MM:SS) public String toUniversalString() { return String.format("%02d:%02d:%02d", hour, minute, second); } //convert to String in standard-time format(H:MM:SS AM or PM) public String toString() { return String.format("%d:%02d:%02d %s", ((hour == 0 || hour == 12) ? 12 : hour % 12), minute, second, (hour &lt; 12 ? "AM" : "PM")); } } // end class Time1
has comment: http://stackoverflow.com/comment/36137230
has comment: http://stackoverflow.com/comment/36137108
has comment: http://stackoverflow.com/comment/36137109
duplicate of: http://stackoverflow.com/q/22975413
downvote count: 6
has comment: http://stackoverflow.com/comment/36137429
has comment: http://stackoverflow.com/comment/36137283
has comment: http://stackoverflow.com/comment/36137380
has comment: http://stackoverflow.com/comment/36141839
upvote count: 7
has comment: http://stackoverflow.com/comment/36137135
has comment: http://stackoverflow.com/comment/36137047
has comment: http://stackoverflow.com/comment/36136931
has comment: http://stackoverflow.com/comment/36137355
has comment: http://stackoverflow.com/comment/36137133
tagged with: java
has comment: http://stackoverflow.com/comment/36137114
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36136963
has title: The I got this error "method format(String, Object[]) in the type String is not applicable for the arguments (String, int, int, int)"
has comment: http://stackoverflow.com/comment/36137434

http://stackoverflow.com/comment/36154210
has text: And there should be a *space* between 11th placeholder and `WEHRE`. Shoule be `...courses = ? WHERE id =?"`
comment on: http://stackoverflow.com/q/23561868
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23511877
has title: Error: "Cannot find symbol - method length()" when applied on JTextField
has body: I want to create a PaliodromeChecker but there is an error on int length = txtInput.length(); In public void actionPerformed(ActionEvent e). The error is cannot find symbol - method length() Did I do any wrong with code? public class checker extends JFrame implements ActionListener { private JButton btnCheck; private JLabel lblInput, lblOutput; private JTextField txtInput; public Q4() { Container c = getContentPane(); c.setLayout(new GridLayout(3,1)); JPanel p1 = new JPanel(); JPanel p2 = new JPanel(); JPanel p3 = new JPanel(); lblInput = new JLabel("Enter a word:"); lblOutput = new JLabel("Welcome to check palindrome"); btnCheck = new JButton("Check Palindrome"); txtInput = new JTextField(15); p1.add(lblInput); p1.add(txtInput); p2.add(btnCheck); p3.add(lblOutput); c.add(p1); c.add(p2); c.add(p3); btnCheck.addActionListener(this); } public void actionPerformed(ActionEvent e){ int length = txtInput.length(); String reverse = ""; for ( int i = length - 1 ; i &gt;= 0 ; i-- ) reverse = reverse + txtInput.charAt(i); if(txtInput.equals(reverse)) lblOutput.setText(txtInput.getText() + "is paliodrome"); else lblOutput.setText(txtInput.getText() + "is not paliodrome"); } public static void main(String[] args){ Q4 myGUI = new Q4(); myGUI.setTitle("PaliodromeChecker"); myGUI.setSize(350,150); myGUI.setVisible(true); }
has answer: http://stackoverflow.com/a/23511952
upvote count: 1
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/23511988
has comment: http://stackoverflow.com/comment/36060842
accepted answer: http://stackoverflow.com/a/23511948
possible better answer: http://stackoverflow.com/a/23511944
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23511944
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23747504
has answer: http://stackoverflow.com/a/23511948
has answer: http://stackoverflow.com/a/23511946
type: Question
has answer: http://stackoverflow.com/a/23512042
has comment: http://stackoverflow.com/comment/36061082

izpack
tag name: izpack
type: Tag
tags question: http://stackoverflow.com/q/23478436
tags question: http://stackoverflow.com/q/23604151

http://stackoverflow.com/comment/36229586
type: Comment
has text: share your updated code
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23601385

http://stackoverflow.com/comment/40315166
score: 0
has text: @tmyklebu I say nothing here about doing arithmetic with floats, so your objections about widening intervals and about the sum of two floats not agreeing with the sum of the shortest decimal expansions are both true, but both irrelevant. My point here is that in the process of working with floats or doubles, we typically hold all three of these models in our heads at some point, and we need to understand the differences between them, and why neither one of them is really a complete picture of what's going on. The second and third "options" are there to illustrate why `23.45` is not in ...
type: Comment
comment on: http://stackoverflow.com/a/23675210
type: AnswerComment

apache-stringutils
tag name: apache-stringutils
type: Tag
tags question: http://stackoverflow.com/q/23470115

http://stackoverflow.com/comment/36134410
has text: You said the answer in your question!
comment on: http://stackoverflow.com/q/23550985
type: Comment
type: QuestionComment
score: 3

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/23488314

http://stackoverflow.com/comment/36153433
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23554726
has text: You don't add an OpenGL context, you add a JOGL AWT GLCanvas which isn't the same thing. Please use an animator instead of creating a thread, look at my example: http://en.wikipedia.org/wiki/Java_OpenGL#Code_example
score: 0

http://stackoverflow.com/a/23456840
score: 0
type: Answer
has body: I suppose you already have the MD5 HEX String from another process/program and you need to convert this HEX value to byte[16]. Use the following method: import javax.xml.bind.DatatypeConverter; public static byte[] toByteArray(String s) { return DatatypeConverter.parseHexBinary(s); }
has comment: http://stackoverflow.com/comment/35959195
answers question: http://stackoverflow.com/q/23456590

http://stackoverflow.com/comment/36020786
score: 0
comment on: http://stackoverflow.com/a/23490319
type: Comment
has text: @Braj What a code review? Are you not a java programmer? Or anything wrong with the format the answer? Or you just kidding me out there?
type: AnswerComment

http://stackoverflow.com/q/23542117
type: Question
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/23542506
has answer: http://stackoverflow.com/a/23542238
has answer: http://stackoverflow.com/a/23542506
answer count: 3
linked to: http://stackoverflow.com/q/156275
has answer: http://stackoverflow.com/a/23542395
downvote count: 0
favorite count: 0
has body: How do I use Hashmap with 3 parameters with string, string, int. The first string is a location, the second string is a different location, and the int represents the time from one to the other. If I make a key posistion1, position3, int it will tell me how much time between position1 and position3. There is 100 locations and I need to specify the time between all locations.
tagged with: hash
has title: How to make a Java Hashmap with three parameters
accepted answer: http://stackoverflow.com/a/23542238
upvote count: 1
tagged with: parameters
type: AnsweredQuestion
tagged with: list
score: 1
tagged with: java

http://stackoverflow.com/q/23500659
has answer: http://stackoverflow.com/a/23500824
type: AnsweredQuestion
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/23500824
possible better answer: http://stackoverflow.com/a/23502127
has answer: http://stackoverflow.com/a/23502127
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36040272
upvote count: 1
downvote count: 1
has body: I am learning java and I am writing a client-server hangman game where the client contacts the server and the server responds with a random word. The client then covers the word with asterisks. For example, if the word is java, the user will see ****. The user then guesses a letter and the part I am stuck on is how decrement the amount of guesses remaining when the user guesses a wrong letter. So for example: The client sends the word "NEW" to the server and the server responds with the length of a random word and the program translates this into asterisks. Let's say the word is "java". **** The user guesses the letter 'a'. The server then would respond with something like: false true false true This is the value of theValue The way I wrote my program it prints: *a*a This is what I want however, my program subtracts two guesses since 2 of the 4 boolean values returned by the server are false even though the user guessed a correct letter. Is there a way to look at all the boolean values and if none are true, then decrement a guess? Here is the code: public void evaluateGuess() { try { for (int i = 0; i &lt; wordAsItIs.length(); i++) { String word = in.readLine(); boolean theValue = Boolean.parseBoolean(word); ArrayList&lt;Boolean&gt; booleans = new ArrayList&lt;Boolean&gt;(); booleans.add(theValue); System.out.println(booleans); if (booleans.contains(true) &amp;&amp; wordAsItIs.charAt(i) == '*') { wordAsItIs.setCharAt(i, playersGuess); } if (!booleans.contains(true)) guessesRemaining--; } displayGame(); } catch (IOException e) { e.printStackTrace(); } }
has title: Hangman Java Game Logic
tagged with: java

http://stackoverflow.com/comment/36165482
score: 0
has text: @Spindizzy Thanks http://stackoverflow.com/questions/7122460/jsf-convertdatetime-with-timezone-in-datatable explains the issue. I wonder why it works for you.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23566899

http://stackoverflow.com/a/23573851
has comment: http://stackoverflow.com/comment/36177675
has comment: http://stackoverflow.com/comment/36177248
has comment: http://stackoverflow.com/comment/36177644
upvote count: 7
has comment: http://stackoverflow.com/comment/124145443
type: Answer
has comment: http://stackoverflow.com/comment/36195905
has comment: http://stackoverflow.com/comment/36177388
has comment: http://stackoverflow.com/comment/36177073
has comment: http://stackoverflow.com/comment/36177282
score: 6
has comment: http://stackoverflow.com/comment/36178028
has body: Even if static methods can't be overridden they are still inherited so what you are trying to do would lead to situation similar to class Foo{ public static void m(Number n){ System.out.println("Number A"); }; public static int m(Number n){ System.out.println("Number B"); return 1; }; } which is wrong because you can't have two methods with same signature but with different return types. Reason why it was forbidden is quite simple... Lets say we have methods: Foo method(){ return new Foo(); } Bar method(){ return new Bar(); } and you would want to invoke them like System.out.println(method()); Should result be Foo or Bar? Compiler wouldn't be able to decide. To prevent this kind of situations compiler forbids overriding/hiding methods with same signature by changing its return types. Only exception is when you are changing return type to more detailed one like class X{ List&lt;String&gt; m(){...} } class Y extends X{ LinkedList&lt;String&gt; m(){...} } So it seems that override is not best word here. Correct word should be hide since static methods can be hidden, not overridden. But it looks like same rules (or at least some portion of them) are used to test if we can hide method as rules for overriding, so in case of problem same error message is shown (about overriding instead of hiding), which can be misleading.
answers question: http://stackoverflow.com/q/23573726
has comment: http://stackoverflow.com/comment/36177379
has comment: http://stackoverflow.com/comment/36177047
downvote count: 1
has comment: http://stackoverflow.com/comment/124143175

http://stackoverflow.com/comment/36210031
type: Comment
type: QuestionComment
has text: Thanks for the link, but it does not have an answer. Sorry, it has the answer "it depends". As the app is running (my code is running) i have concrete device with concrete Android OS version so the question is much more detailed than on the link. Is there any possibility to get the value on-the-fly?
comment on: http://stackoverflow.com/q/23591470
score: 0

http://stackoverflow.com/comment/36069640
type: Comment
type: QuestionComment
has text: As a very general rule of thumb, cramming everything into a single statement isn't the best way of doing something. In some cases, it can be fine (in this example, using regex), but in a lot of cases, you're just writing confusing code.
comment on: http://stackoverflow.com/q/23516719
score: 0

http://stackoverflow.com/q/23602013
has comment: http://stackoverflow.com/comment/36230410
tagged with: java
tagged with: jax-ws
has title: EJB Exception: : java.lang.NoClassDefFoundError: com/mysql/jdbc/MySQLConnection
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
favorite count: 0
tagged with: weblogic-10.x
type: Question
has comment: http://stackoverflow.com/comment/36229828
has comment: http://stackoverflow.com/comment/36229706
has comment: http://stackoverflow.com/comment/36230076
has comment: http://stackoverflow.com/comment/36229955
tagged with: oracle-adf-mobile
upvote count: 2
tagged with: oracle-adf
has body: I am Creating web-service using ADF JEE web application. When I was trying to access web-service it's throwing exception. I place mysql-connector-java-5.1.26-bin jar in my project class path and C:\Users\PC2\AppData\Roaming\JDeveloper\system11.1.2.4.39.64.36.1\DefaultDomain\lib also but it throwing exception like below. Exception EJB Exception: : java.lang.NoClassDefFoundError: com/mysql/jdbc/MySQLConnection at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:630) at java.lang.ClassLoader.defineClass(ClassLoader.java:614) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343) at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302) at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270) at java.lang.ClassLoader.loadClass(ClassLoader.java:305) at java.lang.ClassLoader.loadClass(ClassLoader.java:246) at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) Thank you I Overcome from this exception Now another exception raised Exception javax.xml.soap.SOAPException: Unable to receive message. caused by: java.io.IOException: null caused by: javax.xml.stream.XMLStreamException: javax.xml.stream.XMLStreamException: Premature end of file encountered caused by: javax.xml.stream.XMLStreamException: Premature end of file encountered

http://stackoverflow.com/comment/36227447
type: AnswerComment
comment on: http://stackoverflow.com/a/23466998
score: 0
type: Comment
has text: It seems lambda expressions don't eliminate the need for final variables which means you'll only be saving a few characters off your screen.

http://stackoverflow.com/comment/35998343
score: 1
comment on: http://stackoverflow.com/a/23472827
type: AnswerComment
has text: Well you have a list of Customers , when you create the SavingsAccount i.e new SavingsAccount() call setPrNo(customer.getPrNo()); that way you have a link from the customer to the Account.
type: Comment

http://stackoverflow.com/a/36462750
has comment: http://stackoverflow.com/comment/111189196
score: 4
type: Answer
answers question: http://stackoverflow.com/q/23575067
upvote count: 4
downvote count: 0
has body: There's no standard library method for constructing a CompletableFuture supplied with a value after a timeout. That said, it's really simple to roll your own with minimal resource overhead: private static final ScheduledExecutorService EXECUTOR = Executors.newSingleThreadScheduledExecutor(); public static &lt;T&gt; CompletableFuture&lt;T&gt; delayedValue(final T value, final Duration delay) { final CompletableFuture&lt;T&gt; result = new CompletableFuture&lt;&gt;(); EXECUTOR.schedule(() -&gt; result.complete(value), delay.toMillis(), TimeUnit.MILLISECONDS); return result; } It can be used with the "either" methods of CompleteableFuture: accceptEither, acceptEitherAsync applyToEither, applyToEitherAsync runAfterEither, runAfterEitherAsync One application is using a cached value if a remote service call exceeds some latency threshold: interface RemoteServiceClient { CompletableFuture&lt;Foo&gt; getFoo(); } final RemoteServiceClient client = /* ... */; final Foo cachedFoo = /* ... */; final Duration timeout = /* ... */; client.getFoos() .exceptionally(ignoredException -&gt; cachedFoo) .acceptEither(delayedValue(cachedFoo, timeout), foo -&gt; /* do something with foo */) .join(); In case the remote client call completes exceptionally (e.g. SocketTimeoutException), we can fail fast and use the cached value immediately. CompletableFuture.anyOf(CompletableFuture&lt;?&gt;...) can be combined with this delayedValue primitive to wrap a CompletableFuture with the above semantics: @SuppressWarnings("unchecked") public static &lt;T&gt; CompletableFuture&lt;T&gt; withDefault(final CompletableFuture&lt;T&gt; cf, final T defaultValue, final Duration timeout) { return (CompletableFuture&lt;T&gt;) CompletableFuture.anyOf( cf.exceptionally(ignoredException -&gt; defaultValue), delayedValue(defaultValue, timeout)); } This nicely simplifies the remote service call example above: withDefault(client.getFoos(), cachedFoo, timeout) .thenAccept(foo -&gt; /* do something with foo */) .join();…

http://stackoverflow.com/comment/39648298
type: AnswerComment
comment on: http://stackoverflow.com/a/25382366
score: 0
type: Comment
has text: Thanks for the tip! I'm going to try to work on this again soon, and will post back if I'm able to resolve it.

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/23526471
tags question: http://stackoverflow.com/q/23600733
tags question: http://stackoverflow.com/q/23548701
tags question: http://stackoverflow.com/q/23553764
tags question: http://stackoverflow.com/q/23546761
tags question: http://stackoverflow.com/q/23579835
tags question: http://stackoverflow.com/q/23487618
tags question: http://stackoverflow.com/q/23544180
tags question: http://stackoverflow.com/q/23604392
tags question: http://stackoverflow.com/q/23538626
tags question: http://stackoverflow.com/q/23481594
tags question: http://stackoverflow.com/q/23592766
tags question: http://stackoverflow.com/q/23466666
tags question: http://stackoverflow.com/q/23561399
tags question: http://stackoverflow.com/q/23488676
tags question: http://stackoverflow.com/q/23532358
type: Tag
tags question: http://stackoverflow.com/q/23613641
tags question: http://stackoverflow.com/q/23546635
tags question: http://stackoverflow.com/q/23534131
tags question: http://stackoverflow.com/q/23528540
tags question: http://stackoverflow.com/q/23485295
tags question: http://stackoverflow.com/q/23607128
tags question: http://stackoverflow.com/q/23509480
tags question: http://stackoverflow.com/q/23514814
tags question: http://stackoverflow.com/q/23562392
tags question: http://stackoverflow.com/q/23554839
tags question: http://stackoverflow.com/q/23602623
tags question: http://stackoverflow.com/q/23538994
tags question: http://stackoverflow.com/q/23539541
tags question: http://stackoverflow.com/q/23461391
tags question: http://stackoverflow.com/q/23511325
tags question: http://stackoverflow.com/q/23575450
tags question: http://stackoverflow.com/q/23535298
tags question: http://stackoverflow.com/q/23481251
tags question: http://stackoverflow.com/q/23606008
tags question: http://stackoverflow.com/q/23465692
tags question: http://stackoverflow.com/q/23599083
tags question: http://stackoverflow.com/q/23573429
tags question: http://stackoverflow.com/q/23497180
tags question: http://stackoverflow.com/q/23613320
tags question: http://stackoverflow.com/q/23484309
tags question: http://stackoverflow.com/q/23465375
tags question: http://stackoverflow.com/q/23522217
tags question: http://stackoverflow.com/q/23603450
tags question: http://stackoverflow.com/q/23502979
tags question: http://stackoverflow.com/q/23562978
tags question: http://stackoverflow.com/q/23527833
tags question: http://stackoverflow.com/q/23505858
tags question: http://stackoverflow.com/q/23612048
tags question: http://stackoverflow.com/q/23596036
tags question: http://stackoverflow.com/q/23609231
tags question: http://stackoverflow.com/q/23512231
tags question: http://stackoverflow.com/q/23474010
tags question: http://stackoverflow.com/q/23564157
tags question: http://stackoverflow.com/q/23520506
tags question: http://stackoverflow.com/q/23471523
tags question: http://stackoverflow.com/q/23490177
tag name: xml
tags question: http://stackoverflow.com/q/23550154
tags question: http://stackoverflow.com/q/23480631
tags question: http://stackoverflow.com/q/23595071
tags question: http://stackoverflow.com/q/23582338
tags question: http://stackoverflow.com/q/23604710
tags question: http://stackoverflow.com/q/23482981
tags question: http://stackoverflow.com/q/23477730
tags question: http://stackoverflow.com/q/23568455
tags question: http://stackoverflow.com/q/23556715
tags question: http://stackoverflow.com/q/23578697
tags question: http://stackoverflow.com/q/23588755
tags question: http://stackoverflow.com/q/23571405
tags question: http://stackoverflow.com/q/23570817
tags question: http://stackoverflow.com/q/23470459
tags question: http://stackoverflow.com/q/23546230
tags question: http://stackoverflow.com/q/23467897
tags question: http://stackoverflow.com/q/23493181
tags question: http://stackoverflow.com/q/23591690
tags question: http://stackoverflow.com/q/23612315
tags question: http://stackoverflow.com/q/23513439
tags question: http://stackoverflow.com/q/23571712

http://stackoverflow.com/a/23492803
answers question: http://stackoverflow.com/q/23492619
score: 0
type: Answer
has body: Use a ListView rather than a TableLayout. A TableLayout is usually used to display static, pre-defined content, while a ListView is much more dynamic and can directly handle the Cursor you get from the SQLite-db: Learn How to Create ListView From SQLite Database in Android Development

http://stackoverflow.com/q/23538399
type: Question
has comment: http://stackoverflow.com/comment/36110567
tagged with: testing
answer count: 2
has answer: http://stackoverflow.com/a/23538632
upvote count: 0
has title: What is the bug in this code
favorite count: 0
accepted answer: http://stackoverflow.com/a/23538596
score: -1
has comment: http://stackoverflow.com/comment/36110595
has comment: http://stackoverflow.com/comment/36111027
has comment: http://stackoverflow.com/comment/36110632
downvote count: 1
type: AnsweredQuestion
has body: I was reading on the importance of testing and as an example this code appeared: public Scheme join(final Scheme other) { final HashSet&lt;Attribute&gt; $ = new HashSet&lt;Attribute&gt;(); for (int i = 0; i &lt; attributes.length; ++i) $.add(attributes[i]); for (int i = 0; i &lt; attributes.length; ++i) $.add(other.attributes[i]); return new Scheme(true, $.toArray(new Attribute[$.size()])); } and it said it has a bug in Scehme.join() but I can't see one!
tagged with: java
has comment: http://stackoverflow.com/comment/36110684
has comment: http://stackoverflow.com/comment/36110928
has answer: http://stackoverflow.com/a/23538596
possible better answer: http://stackoverflow.com/a/23538632

http://stackoverflow.com/a/23459663
has body: remove spaces first then get the character char letter = kb.nextLine().trim().charAt(0); input 1 hello notice space before hello Output: Wanna start the game? 1. Start 2. Quit 1 hello Type something hello does not contain h
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23459633

http://stackoverflow.com/comment/36215692
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23594070
has text: @gstackoverflow it refers to class type.
type: Comment

http://stackoverflow.com/comment/36033548
type: Comment
has text: is there a equivalent of C# StandardAnalyzer in Java?
comment on: http://stackoverflow.com/a/23486478
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36121909
type: Comment
score: 1
has text: My advice is to learn to read compiler messages. You have to do that if you want to get good with Java or any compiled language.
type: AnswerComment
comment on: http://stackoverflow.com/a/23544493

http://stackoverflow.com/comment/36095832
score: 0
type: Comment
type: QuestionComment
has text: You are right! I now feel rather silly for not having scrolled up a bit further. Perhaps I could check to see if I could get Netty to call that instead...
comment on: http://stackoverflow.com/q/23528586

http://stackoverflow.com/q/23529733
tagged with: java
has comment: http://stackoverflow.com/comment/36104068
type: Question
has comment: http://stackoverflow.com/comment/36135669
downvote count: 0
has comment: http://stackoverflow.com/comment/36095117
has comment: http://stackoverflow.com/comment/36097383
has comment: http://stackoverflow.com/comment/36096006
tagged with: security
has body: hey thanks for reading in advance. I am facing some issue in encrypting something in 3des, it is working but doesn't seem to out the proper values purpose: i need to authenticate to a rest API from php to be able to retrieve info, their documentation states this : step 1 call the login function to receive a token (i have this) step 2, call the authorize function using a string generated from the token I have implemented the below code, but not sure if am doing something wrong, here's some info from the docs The process to generate key is as follows: 1. The internal value 99991231 defined by Huawei is added in the plain text to be encrypted. Result A is generated. 2. The standard MD5 algorithm is executed on result A. Result B is generated. 3. Result B is converted into a hexadecimal number. Result C is generated. If the first character is 0 in the hexadecimal string, ignore it. If another character is 0, retain it. For example, 0x0100101F3B is converted into 100101F3B. 4. The first eight characters in result C are obtained. Result D is generated. 5. The characters in result D are converted into lowercase characters. The encrypted text is generated. this is the example code they have provided to generate md5 huawei (i think it's java? need it's php equivalent) byte[] id = plainPwd.getBytes(); MessageDigest md = MessageDigest.getInstance("MD5"); md.update(id); md.update("99991231".getBytes()); // “99991231” mentioned in XML-API DOC byte[] buffer = md.digest(); StringBuffer sb = new StringBuffer(); for (int i = 0; i <buffer.length; i++) { sb.append(Integer.toHexString((int) buffer[i] & 0xff)); } String md5Pwd = sb.substring(0, 8); // only use first 8 characters this is what is required: The 3DES encryption algorithm is used to generate an authenticator. The format of a plain text to be encrypted is as follows: Random+"$"+EncryToken+"$"+userid+"$"+terminalid+"$"+terminalip+"$"+mac+"$"+Reserved+"$"+"CTC" they key is generated based on this: The 3DES encryption result is …
tagged with: 3des
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: encryption
tagged with: php
score: 2
has title: php encrypt string using huawei md5 + 3des
answer count: 0

http://stackoverflow.com/comment/36157080
score: 1
comment on: http://stackoverflow.com/a/23563090
type: AnswerComment
type: Comment
has text: @ikhebgeenaccount (btw: please change your username), more likely you need to specify the full path to the database file.

http://stackoverflow.com/comment/36284538
has text: It sounds like you are asking how to extract the data from Excel, but you already know how to do the Documentum part (creating folders from a path). Is that correct? In that case, may be better to tag this as an Excel or Java question rather than Documentum.
comment on: http://stackoverflow.com/q/23469019
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36086770
score: 0
comment on: http://stackoverflow.com/q/23524852
has text: @Magnus..We cant always guarantee a single entry. Say two key have the same value, both the greatest in the map, then the resulting map will have two entries.. Just a thought :)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24491820
answers question: http://stackoverflow.com/q/23504819
score: 73
has comment: http://stackoverflow.com/comment/105426629
upvote count: 74
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/130886756
downvote count: 1
has body: I wish I still had a link to the source that lead me in this direction, but this is the code that ended up working for me. By looking over the JavaDoc for X509TrustManager it looks like the way the TrustManagers work is by returning nothing on successful validation, otherwise throwing an exception. Thus, with a null implementation, it is treated as a successful validation. Then you remove all other implementations. import javax.net.ssl.*; import java.security.*; import java.security.cert.X509Certificate; public final class SSLUtil{ private static final TrustManager[] UNQUESTIONING_TRUST_MANAGER = new TrustManager[]{ new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers(){ return null; } public void checkClientTrusted( X509Certificate[] certs, String authType ){} public void checkServerTrusted( X509Certificate[] certs, String authType ){} } }; public static void turnOffSslChecking() throws NoSuchAlgorithmException, KeyManagementException { // Install the all-trusting trust manager final SSLContext sc = SSLContext.getInstance("SSL"); sc.init( null, UNQUESTIONING_TRUST_MANAGER, null ); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } public static void turnOnSslChecking() throws KeyManagementException, NoSuchAlgorithmException { // Return it to the initial state (discovered by reflection, now hardcoded) SSLContext.getInstance("SSL").init( null, null, null ); } private SSLUtil(){ throw new UnsupportedOperationException( "Do not instantiate libraries."); } }
has comment: http://stackoverflow.com/comment/75568173
has comment: http://stackoverflow.com/comment/75580284
type: Answer
has comment: http://stackoverflow.com/comment/102947425
accepted answer of: http://stackoverflow.com/q/23504819

http://stackoverflow.com/comment/66832081
type: Comment
comment on: http://stackoverflow.com/a/27872346
has text: this solution worked for me once and on another occasion, deleting the 2.7.2 jar from the local repo resolved the issue
type: AnswerComment
score: 0

http://stackoverflow.com/q/23515239
has comment: http://stackoverflow.com/comment/36066613
possible better answer: http://stackoverflow.com/a/23515441
tagged with: java
has answer: http://stackoverflow.com/a/23515441
has title: Java version cannot be recognized on java.com
has comment: http://stackoverflow.com/comment/36067083
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23535296
accepted answer: http://stackoverflow.com/a/23535296
has comment: http://stackoverflow.com/comment/36067529
score: 0
has comment: http://stackoverflow.com/comment/36067169
has comment: http://stackoverflow.com/comment/36066680
has body: Recently reinstalled system and meet interesting problem. I installed java jdk8, however when I try to verify version on java.com it asks to install java. Meanwhile: java - version java version "1.8.0_05" Java(TM) SE Runtime Environment (build 1.8.0_05-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode) echo %JAVA_HOME% E:\Programms\Java\JDK8 echo %JRE_HOME% E:\Programms\Java\JDK8\jre echo %PATH% C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Wi ndows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;E:\Pr ogramms\Java\JDK8\bin;E:\Programms\Java\JDK8\jre\bin; Java Control Panel > Security > Enable Java content in Browser is checked Why browser and java.com does not recognize my java instalation? Java plug-in is not included in jdk?
has comment: http://stackoverflow.com/comment/36068676
has comment: http://stackoverflow.com/comment/36105187
has comment: http://stackoverflow.com/comment/36095278
has comment: http://stackoverflow.com/comment/36066708
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36066862

http://stackoverflow.com/q/23492194
tagged with: java
tagged with: javafx
tagged with: html-editor
score: 0
answer count: 2
has body: I am having HTMLEditor, in that htmleditor by default i am getting &lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt; text. So when ever i am finding length in editor , minimum i am getting 62. But how to know whether HTMLEditor is empty or not
has answer: http://stackoverflow.com/a/23495230
has answer: http://stackoverflow.com/a/23501521
type: UnansweredQuestion
type: Question
has title: How to make HtmlEditor default text to empty in javafx

http://stackoverflow.com/comment/36096756
comment on: http://stackoverflow.com/q/23530173
type: QuestionComment
score: 0
has text: Command prompt looks like this... C:\Users\xyz\Documents\Java\javastudy\src\org\tij\exercises>javac HelloWorld.java C:\Users\xyz\Documents\Java\javastudy\src\org\tij\exercises>java HelloWorld Error: Could not find or load main class HelloWorld
type: Comment

http://stackoverflow.com/a/23598782
answers question: http://stackoverflow.com/q/23598066
downvote count: 0
type: Answer
score: 1
has body: What you want to do is think in terms of frames. Update everything every frame (e.g 1/60th of a second) then sleep till the next frame (an animal doesn't have to do anything when its updated, its just given the opportunity to). So say that one rabbit moves then needs to rest for 2 seconds before moving again. Each rabbit would have an instance variable of restTime which it would set to 2 seconds after making a move. Each frame it would reduce this variable by the frame time (1/60th of a second). When the variable is zero or less it moves again. This means that you can do it all one one thread and the animals movements are not dependant on each other (except for when you want them to be of course). If you're animating this it's best to measure the actual frame time and use that rather than assuming you'll actually get exactly the 1/60th of a second you asked for. An example might be as follows public class Rabbit { private double timeBetweenMoves; private double sleepTime=0; private String name; public Rabbit(String name,double timeBetweenMoves) { this.name=name; this.timeBetweenMoves=timeBetweenMoves; } public void update(double timeSlice){ sleepTime-=timeSlice; if (sleepTime&lt;0){ makeMove(); } } private void makeMove(){ sleepTime=timeBetweenMoves; //actually make the move System.out.println(name + " Moved"); } public static void main(String[] args){ double frameTime=1/60.0; List&lt;Rabbit&gt; rabbits=new ArrayList&lt;&gt;(); rabbits.add(new Rabbit("Floppsy",2)); //moves every 2 seconds rabbits.add(new Rabbit("Hopper",5)); //moves every 5 seconds while(true){ for(Rabbit rabbit:rabbits){ rabbit.update(frameTime); //assumes frametime is actually what you asked for, can cause graphics to look stuttery } try { long milllisecondsToSleep=(long)(frameTime*1000); Thread.sleep(milllisecondsToSleep); } catch (InterruptedException ex) { Logger.getLogger(Rabbit.class.getName()).log(Level.SEVERE, null, ex); } } } }
upvote count: 1

http://stackoverflow.com/comment/36097165
comment on: http://stackoverflow.com/a/23530694
score: 0
type: AnswerComment
type: Comment
has text: for create the tables; but i want create the database.

http://stackoverflow.com/comment/36176865
has text: I'm not sure why the compiler error is about overriding when it should be a wrong overloading.
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23573726

http://stackoverflow.com/q/23587639
downvote count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7866723
tagged with: eclipse
upvote count: 2
has body: I am trying to build the most recent version of my libgdx app, but haven't had any success in figuring out what is going wrong here. I looked up other errors like it, and tried to see if any of them fixed my problem, but no dice (basically tried changing up the Java versions and uninstalling/reinstalling eclipse and reinstalling all the updates). This problem only started after an update with the android SDK in the last few days from what i can figure (haven't exported the app since Thursday and this is the only thing that I can think of that has changed). Do any of you have any ideas that could help me out? Here is the full stack trace. [2014-05-10 20:04:02 - ***********] Dx UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.cf.iface.ParseException: bad class file magic (2f2a2a2a) or version (2a2a.2a2a) at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472) at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406) at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388) at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251) at com.android.dx.command.dexer.Main.processClass(Main.java:665) at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634) at com.android.dx.command.dexer.Main.access$600(Main.java:78) at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572) at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) at com.android.dx.command.dexer.Main.processOne(Main.java:596) at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498) at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264) at com.android.dx.command.dexer.Main.run(Main.java:230) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccess…
has title: UNEXPECTED TOP-LEVEL EXCEPTION Error when building with Android and Libgdx
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23597540
accepted answer: http://stackoverflow.com/a/23597540
tagged with: android
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/23518202
has comment: http://stackoverflow.com/comment/36072788
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/36075606
answer count: 1
tagged with: vba
linked to: http://stackoverflow.com/q/138028
favorite count: 0
has body: We have a large number of excel files. I want to modify the macros in each of the file. The change is same across all file. A specific use case would be to change initialization of string from ABC to abc. Is there a programmatic way to access and edit a particular function. Java would be preferable but other language would be okay.
downvote count: 0
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/23519927
tagged with: excel
has title: Programmatically editing macros in excel
tagged with: java

http://stackoverflow.com/comment/36070138
has text: @EJP I am sorry,actually I am using JSSE, and now I am able to connect properly after restarting the system, but still have a question how certificate gets changed as in out.println I am able to see my message
comment on: http://stackoverflow.com/q/23516609
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23474144
has body: Apache Commons Lang, has an ImmutablePair, that you can put in a Set if you want. Whether Set is useful in this case, depends on what you want to do with the data. Sets are Iterable, but cannot be read (can only be checked for), also worth mentioning is that by default, in a Set &lt;100, 13> and &lt;100, 14> are not the same item (ie, if you add both, you will have 2 items with "key" 100). Furthermore, if you care about ordering, I would probably use a TreeSet/TreeMap instead.
score: 0
answers question: http://stackoverflow.com/q/23473762
type: Answer

http://stackoverflow.com/comment/35979611
score: 0
comment on: http://stackoverflow.com/q/23468305
type: Comment
type: QuestionComment
has text: what error is thrown?

http://stackoverflow.com/comment/36158385
type: Comment
comment on: http://stackoverflow.com/q/23563964
type: QuestionComment
has text: show your code snippet
score: 0

http://stackoverflow.com/comment/36077020
has text: @ MadProgrammer so what if i keep my original code in which i read files and write into them ? how could i include the directory /xml to the classpath ,so as to permit the jar file to access these files ??? if you have an idea help me ,and thanks :)
comment on: http://stackoverflow.com/a/23481890
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23484690
favorite count: 0
accepted answer: http://stackoverflow.com/a/23485410
tagged with: timer
has title: A Timer() thread still running after cancelling it
type: Question
tagged with: android
upvote count: 3
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36010731
has answer: http://stackoverflow.com/a/23485410
type: AnsweredQuestion
score: 3
has body: I do not know why the thread is still alive even after i cancel it? in the code below the Timer thread implements runnable and in the code i want it to stay running for 7 seconds using Thread.sleep(7000);and after that i called mTimer.cancel(); to kill the thread. during the 7 seconds the run() method should be called to execute a task that will last for 10 seconds. When i executed that program, the time of the first line was 12:18:37 and as i expected, since this thread will live only for 7 seconds before i cancel it, however the time of second line to be displayed was 05 12:18:44, now this is 7 seconds difference and it is rational. But unexpectedly, after 3 seconds another line appeared on the console and it was timed to 05 12:18:47. If you noticed the difference between the first and the third line you will find it 10 seconds.My question is, why the entire thread did not die after 7 seconds. JavaCode: public class TimerTaskExample extends TimerTask { private static Timer mTimer; @Override public void run() { // TODO Auto-generated method stub System.out.println("going to sleep at: " + new Date()); dosomeWorks(); System.out.println("returned back at: " + new Date()); } private void dosomeWorks() { // TODO Auto-generated method stub try { Thread.sleep(10000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String args[]) { TimerTask timerTask = new TimerTaskExample(); mTimer = new Timer(true); mTimer.scheduleAtFixedRate(timerTask, new Date(), 2*1000); //System.out.println("timer will start now at: " + new Date()); try { Thread.sleep(7000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } mTimer.cancel(); System.out.println("timer is cancelled now at: " + new Date()); try { Thread.sleep(3000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } Output: going to sleep at: Mon May 05 12:18:37 CEST 2014 timer i…
answer count: 1
downvote count: 0

http://stackoverflow.com/a/70235749
has body: //Get user input as a 1 2 3 4 5 6 .... and then some of the even or odd number like as 2+4 = 6 for even number Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int evenSum = 0; int oddSum = 0; while (n &gt; 0) { int last = n % 10; if (last % 2 == 0) { evenSum += last; } else { oddSum += last; } n = n / 10; } System.out.println(evenSum + &quot; &quot; + oddSum); } }
type: Answer
answers question: http://stackoverflow.com/q/23506429
score: 0

http://stackoverflow.com/comment/36001933
score: 0
type: Comment
type: QuestionComment
has text: IMO it is good to have a cache for a certain number of `Integer`s in order to avoid creation of new instance of those immutable objects. On the other hand, if you want/need more `Integer`s to be cached, you could write your own cache or, even better, leverage this to the JVM and use a configuration for it.
comment on: http://stackoverflow.com/q/23479882

http://stackoverflow.com/a/23497508
upvote count: 4
has comment: http://stackoverflow.com/comment/36034435
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23497405
has comment: http://stackoverflow.com/comment/36046106
answers question: http://stackoverflow.com/q/23497405
type: Answer
has body: Try label1.setIcon(image1); instead of label1 = new JLabel(image1); in EventClass. Because you create a new instance of JLabel with new Icon which is not added to your JFrame.
has comment: http://stackoverflow.com/comment/36034038
has comment: http://stackoverflow.com/comment/36034147
has comment: http://stackoverflow.com/comment/36046393
score: 4
has comment: http://stackoverflow.com/comment/36043885

http://stackoverflow.com/q/23486419
tagged with: java
tagged with: process
type: Question
has comment: http://stackoverflow.com/comment/36018263
downvote count: 0
has title: How to get JVM cache location for current process in linux
has comment: http://stackoverflow.com/comment/36025507
has body: As we know, each JVM process would create a cache directory. Such like this: /root/.java/deployment/cache/6.0/35 2df4eba3-16182299 2df4eba3-16182299-n 2df4eba3-4678facc.idx 2df4eba3-16182299.idx 2df4eba3-1a176e8d.idx 2df4eba3-654177dc.idx 2df4eba3-16182299-n is the cache location. If I want to get this location in the java code, how to do that?
tagged with: caching
has comment: http://stackoverflow.com/comment/36018190
has comment: http://stackoverflow.com/comment/36228218
favorite count: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/36014031
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36025002
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/36157726
score: 1
type: AnswerComment
has text: You are right. I had to set another header. In fact code works.
type: Comment
comment on: http://stackoverflow.com/a/23561428

http://stackoverflow.com/q/23525760
has comment: http://stackoverflow.com/comment/36087233
tagged with: bigdecimal
accepted answer: http://stackoverflow.com/a/23525828
has comment: http://stackoverflow.com/comment/36087409
answer count: 2
has comment: http://stackoverflow.com/comment/36087231
downvote count: 0
score: 7
favorite count: 0
has title: Why doesn't my operation work when I use BigDecimal?
has comment: http://stackoverflow.com/comment/36087755
upvote count: 7
has answer: http://stackoverflow.com/a/23525828
type: AnsweredQuestion
has body: I'm trying to do an operation using BigDecimal but it always return 0. Why does it work when I use double? public static void main(String[] args) { double a = 3376.88; BigDecimal b = new BigDecimal(a); System.out.println(a-a/1.05); System.out.println(b.subtract(b).divide(new BigDecimal(1.05)).doubleValue()); } Thanks.
possible better answer: http://stackoverflow.com/a/23525815
tagged with: java
has comment: http://stackoverflow.com/comment/36087574
has answer: http://stackoverflow.com/a/23525815
has comment: http://stackoverflow.com/comment/36087320
type: Question

akka
type: Tag
tags question: http://stackoverflow.com/q/23535524
tags question: http://stackoverflow.com/q/23533757
tags question: http://stackoverflow.com/q/23488519
tags question: http://stackoverflow.com/q/23609520
tag name: akka
tags question: http://stackoverflow.com/q/23513599
tags question: http://stackoverflow.com/q/23564049
tags question: http://stackoverflow.com/q/23613418
tags question: http://stackoverflow.com/q/23496142

http://stackoverflow.com/comment/36028336
comment on: http://stackoverflow.com/a/23494709
type: Comment
has text: `println()` -> `print()`
score: 0
type: AnswerComment

http://stackoverflow.com/a/23590814
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23571861
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23571861
type: Answer
has body: Try with overloaded method abstract class Operand { public abstract &lt;T extends Operand&gt; Operand operation(Operator operator, T operand); } abstract class Numeric&lt;T extends Numeric&lt;T&gt;&gt; extends Operand { public abstract Operand operation(Operator operator, T operand); } class Integer extends Numeric&lt;Integer&gt; { @Override public Operand operation(Operator operator, Integer operand) { // add your Integer specific code here return null; // replace null with actual returned value } @Override public &lt;T extends Operand&gt; Operand operation(Operator operator, T operand) { // simply call to overridden Integer specific method // no harm to downcast it here return operation(operator, (Integer) operand); } }

http://stackoverflow.com/comment/36057812
has text: added the comment to answer
comment on: http://stackoverflow.com/a/23509243
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/35979970
comment on: http://stackoverflow.com/q/23466267
has text: Well it got working, the only problem was bodytext=bodytext.substring(bodytext.indexOf(name)+name.length());
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36106778
type: QuestionComment
has text: @Zeeshan Nothing really, I enter the name for the third object and the program just stops accepting input. But it doesn't stop, I have to manually stop the program which is why I figured it was an infinite loop.
comment on: http://stackoverflow.com/q/23535974
score: 0
type: Comment

http://stackoverflow.com/comment/90730781
type: Comment
comment on: http://stackoverflow.com/a/30591269
has text: How to pass initialization vector ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36025185
comment on: http://stackoverflow.com/q/23493020
score: 0
type: Comment
type: QuestionComment
has text: indeed i have but that did not fix it

http://stackoverflow.com/a/23589331
has comment: http://stackoverflow.com/comment/36259549
has comment: http://stackoverflow.com/comment/36259888
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23589253
has body: The only way for this to happen is if you have a singleton somewhere that keeps track of the session and for some reason this singleton is mixing up the variables between sessions. You can try this: Instead of differentiating a user only by its credentials (assuming you are not using Federation), return a token, unique amongst all sessions to the user logging in, and make the user send that unique id with every request. This way you will be able to differentiate the request/responses even if the user logs in using many different browsers. But again, this will only happen when you do something like having a singleton connecting the session, by itself the session would not exchange variables amongst them.
has comment: http://stackoverflow.com/comment/36259735
has comment: http://stackoverflow.com/comment/36259454

http://stackoverflow.com/comment/36052748
comment on: http://stackoverflow.com/a/23507263
type: AnswerComment
score: 0
type: Comment
has text: That's what I meant by `template`. That's actually a database. http://www.postgresql.org/docs/9.3/static/manage-ag-templatedbs.html Keep in mind that'll be used in every DB, so it shouldn't be crammed with lots of DB-specific stuff, but for a utility function like this, I think it's a reasonable place to put it. You could also create a special template DB just for this function and any similar ones.

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/23507451
tags question: http://stackoverflow.com/q/23580991
tags question: http://stackoverflow.com/q/23524243
tags question: http://stackoverflow.com/q/23583624
tags question: http://stackoverflow.com/q/23567822
tags question: http://stackoverflow.com/q/23595649
type: Tag
tags question: http://stackoverflow.com/q/23529640
tags question: http://stackoverflow.com/q/23587270

http://stackoverflow.com/comment/36016730
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23488221
has text: Cant you set the cell value with appropriate Data format like Number,Date,String,etc., ?
score: 1

http://stackoverflow.com/q/23511821
tagged with: android
accepted answer: http://stackoverflow.com/a/23512112
score: 1
tagged with: java
tagged with: sharedpreferences
upvote count: 1
has title: How to save an arrayList<LatLng> with SharedPreferences
type: Question
type: AnsweredQuestion
tagged with: arraylist
has answer: http://stackoverflow.com/a/23512112
has comment: http://stackoverflow.com/comment/36061097
has body: I was looking for this - but found only how to save an arrayList for example this code: Editor prefsEditor = mPrefs.edit(); Gson gson = new Gson(); String json = gson.toJson(MyObject); prefsEditor.putString("MyObject", json); prefsEditor.commit(); I want to store this object(point) which is LatLng in SharedPreferences, after that i will need to get it from this save. Here is what i want to save: public void onMapClick(LatLng point) { // TODO Auto-generated method stub mMap.addMarker(new MarkerOptions().position(point)); **checkPoints.add(point);** }
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/113526618
type: Comment
has text: While this answer isnt as detailed or useful to the OP, this helped me with remembering the syntax of a multivariable for loop for use in a different situation than the one that OP asked about
comment on: http://stackoverflow.com/a/23532853
score: 0
type: AnswerComment

jvm
tags question: http://stackoverflow.com/q/23510994
tags question: http://stackoverflow.com/q/23463149
tags question: http://stackoverflow.com/q/23609955
tags question: http://stackoverflow.com/q/23545325
tags question: http://stackoverflow.com/q/23561128
type: Tag
tags question: http://stackoverflow.com/q/23541734
tags question: http://stackoverflow.com/q/23593167
tags question: http://stackoverflow.com/q/23549889
tags question: http://stackoverflow.com/q/23534699
tags question: http://stackoverflow.com/q/23584694
tags question: http://stackoverflow.com/q/23524419
tags question: http://stackoverflow.com/q/23529359
tag name: jvm
tags question: http://stackoverflow.com/q/23487489
tags question: http://stackoverflow.com/q/23552134
tags question: http://stackoverflow.com/q/23552296
tags question: http://stackoverflow.com/q/23550385
tags question: http://stackoverflow.com/q/23466950
tags question: http://stackoverflow.com/q/23561555
tags question: http://stackoverflow.com/q/23527955
tags question: http://stackoverflow.com/q/23470720

http://stackoverflow.com/q/23551705
has answer: http://stackoverflow.com/a/23551908
tagged with: mysql
type: Question
tagged with: java
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23551953
has title: program laggin once it reads about 30,000 zipcodes
has body: My program is to match the Craigslist US sites and assign zipcode to it from a US zipcode file. First it reads the zipcode file which has US zipcodes and appropriate cities. After reading each entry it checks the source code of craigslist website to find a match of the city. If it finds a match, the program assigns that zipcode to that url and inserts both the URL and zipcde to mySQL database. But once it reads about 30,000 zipcodes, the program lags a lot. I've included my code that compares the zipcode and if finds a match it inserts to the database: String sql = "SELECT city, state FROM CRAIGSLIST"; ResultSet rs = con.createStatement().executeQuery(sql); while(rs.next()) { String state = rs.getString("state"); String city = rs.getString("city"); if((city.equalsIgnoreCase(cityInFile)) &amp;&amp; (state.equalsIgnoreCase(stateInFie))){ sql = "UPDATE CRAIGSLIST "+ " SET zipcode = '"+ZipCode+"' WHERE city = '"+city+"'" ; con.createStatement().executeUpdate(sql); System.out.println("Found a match!"); break; } } Somebody please help. Thank you
tagged with: while-loop
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36172019
has answer: http://stackoverflow.com/a/23552040

http://stackoverflow.com/q/23497824
has comment: http://stackoverflow.com/comment/40609642
tagged with: python
score: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40632737
tagged with: php
has body: I downloaded freebase data-dump in RDF data is serialized using the N-Triples format, encoded as UTF-8 text and compressed with Gzip. I would like to import it to Neo4j. There are a lot of java source codes without documentation and with too much dependencies. Even manuals on official website are linking to broken pages or github repositories without documentation at all. I understand that Neo4j isn't a triple store, I would like to create a graph. How to create database from freebase full data dump file in neo4j?
tagged with: java
type: Question
tagged with: freebase
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/19676485
tagged with: neo4j
favorite count: 0
has answer: http://stackoverflow.com/a/23513475
upvote count: 3
has title: How to import freebase full data-dump file N-Triples UTF8 to neo4j

http://stackoverflow.com/q/23590101
upvote count: 0
has comment: http://stackoverflow.com/comment/36207080
tagged with: java
downvote count: 1
type: Question
has title: Compiler error when creating class
score: -1
has body: I need fill in the constructor for a person class. I am new to Java and programming in general. I would like some help maybe understanding the problem and understanding the logic or theory behind the solution. This is what I need to do: TODO #1: Fill in the rest of the arguments to the Person constructor The Person constructor should take in 3 additional arguments: 1) String pictureName 2) int xCoord 3) int yCoord TODO #2: Fill in the rest of this constructor You need to create a local variable called picture and assign to picture the picture that we want to use. TODO #3: You need need to move the picture to xCoord and yCoord. You can move the picture object by calling the translate method. the last step is to draw the picture. And this is what I've done but I get error, and I don't know why. I believe that's what I need to do unless I am missing something. If someone could help me figure this out and and explain this very clear would be exceptionally appreciated. I am new to Java and programming so my apologies if this question is public class Person { private String name; private String friends; public Person (String aName, String pictureName, int xCoord, int yCoord) // I have added: String pictureName, int xCoord, and yCoord parameters. { name = aName; friends = ""; //My solution starts here String picture; picture = pictureName; picture.translate(xCoord, yCoord); picture.draw(); // and ends here. } public void addFriend(Person friend) { friends = friends + friend.name + " "; } public void unfriend(Person nonFriend) { friends = friends.replace(nonFriend.name + " ", ""); } public String getFriends() { return friends; } }
tagged with: class
answer count: 1
accepted answer: http://stackoverflow.com/a/23590113
favorite count: 0
has answer: http://stackoverflow.com/a/23590113
has comment: http://stackoverflow.com/comment/36207070
type: AnsweredQuestion

http://stackoverflow.com/comment/36082866
has text: Not enough information. Is it a file you're trying to load into memory? If so, try a bufferedReader.
comment on: http://stackoverflow.com/q/23523526
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/36971663
has text: Having these extensions doesn't mean it won't get selected, it just means it won't be preferred if there's a better match. Do you test with just that cert or others better matching certs in your keystore too?
type: Comment
comment on: http://stackoverflow.com/a/23984585
score: 0
type: AnswerComment

http://stackoverflow.com/q/23564938
tagged with: cucumber-junit
downvote count: 0
type: Question
has title: Can I use spring to autowire controller in cucumber test?
tagged with: java
has answer: http://stackoverflow.com/a/28763058
score: 15
has answer: http://stackoverflow.com/a/32355665
has answer: http://stackoverflow.com/a/24626512
tagged with: cucumber
accepted answer: http://stackoverflow.com/a/24626512
has body: I am using Cucumber to automate the testing of services and controllers in my app. In addition, I am using the Cucumber Junit runner @RunWith(Cucumber.class) in the test steps. I need to instantiate my controller and was wondering if I could use Spring to autowire this. The code below shows what I want to do. public class MvcTestSteps { //is it possible to do this ???? @Autowired private UserSkillsController userSkillsController; /* * Opens the target browser and page objects */ @Before public void setup() { //insted of doing it like this??? userSkillsController = (UserSkillsController) appContext.getBean("userSkillsController"); skillEntryDetails = new SkillEntryRecord(); }
has comment: http://stackoverflow.com/comment/36204070
favorite count: 0
tagged with: cucumber-jvm
answer count: 3
tagged with: spring
upvote count: 15
possible better answer: http://stackoverflow.com/a/32355665
type: AnsweredQuestion

ignore-case
type: Tag
tags question: http://stackoverflow.com/q/23589570
tag name: ignore-case

http://stackoverflow.com/comment/36137853
comment on: http://stackoverflow.com/a/23552690
type: Comment
score: 2
type: AnswerComment
has text: I think it is. I can't think of anything that I miss about Eclipse since switching over to Android Studio.

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/23591779
type: Tag
tags question: http://stackoverflow.com/q/23537757
tags question: http://stackoverflow.com/q/23546679

http://stackoverflow.com/a/23515441
score: 1
answers question: http://stackoverflow.com/q/23515239
has body: I suspect that you need to install the JRE rather than a JDK using the Windows installer at (java.oracle.com). This should set up everything properly.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36251805
has text: Please show us what you tried.
comment on: http://stackoverflow.com/q/23613704
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36145389
has text: your json format is invalid, check it here http://jsonlint.com/
score: 0
comment on: http://stackoverflow.com/q/23556772
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23472801
has comment: http://stackoverflow.com/comment/35989050
has body: You should decompose your problem. Global algorithm IMO, you should start at n = 0, and go up. For each value of n, check if the sequence of digits needed to represent it is allowed. As soon as you can't, n is your answer. Smaller part The new problem is to verify if the sequence of digits for a given number is allowed. That does not seem very difficult. You seem to deal with base 10 numbers only I guess: decompose your number in base 10 digits count the number of occurrences of each digit in your number compare with the quantity available of that digit if there are not enough, you're done, the number can't be represented if there are enough, keep going with the other digits Example implementation of the main algo. The argument nbAllowed would be a 10-sized array containing the quantity available of each digit. Ex: nbAllowed[2] is the number of times that the digit '2' is allowed to be used. public static int smallestNonRepresentable(int[] nbAllowed) { int n=0; while (isRepresentable(n, nbAllowed)) { n++; } return n; } Example implementation of the subroutine. This methods returns whether n is representable depending on the quantity available for each digit. private static boolean isRepresentable(int n, int[] nbAllowed) { int[] digitCount = getDigitCount(n); // check if each digit is available enough times for (int d = 0; d &lt; nbAllowed.length; d++) { if (nbAllowed[d] &lt; digitCount[d]) { return false; // not enough d digits to represent n } } return true; // enough of all digits } Example implementation of how to count the number of occurrences of each digit in a number n. This method returns a 10-sized array containing the number of occurrences of each digit in n. Ex: digitCount[2] is the number of times that the digit '2' appears in the decimal representation of n. private static int[] getDigitCount(int n) { int[] digitCount = new int[10]; // 10 distinct digits Arrays.fill(digitCount, 0); // start at 0 occurrence for each digit // special case 0 if (n == 0) { …
answers question: http://stackoverflow.com/q/23472513
has comment: http://stackoverflow.com/comment/35995121
has comment: http://stackoverflow.com/comment/35994467
has comment: http://stackoverflow.com/comment/36036135
has comment: http://stackoverflow.com/comment/36025431
has comment: http://stackoverflow.com/comment/35988051
has comment: http://stackoverflow.com/comment/35987988
upvote count: 2
has comment: http://stackoverflow.com/comment/36025908
has comment: http://stackoverflow.com/comment/35990316
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35988842
has comment: http://stackoverflow.com/comment/36036070
has comment: http://stackoverflow.com/comment/35989107
has comment: http://stackoverflow.com/comment/36036431
has comment: http://stackoverflow.com/comment/35989925
type: Answer
has comment: http://stackoverflow.com/comment/36034612
accepted answer of: http://stackoverflow.com/q/23472513
score: 2
downvote count: 0

http://stackoverflow.com/a/23584232
type: Answer
accepted answer of: http://stackoverflow.com/q/23583048
score: 2
answers question: http://stackoverflow.com/q/23583048
type: AcceptedAnswer
downvote count: 0
has body: In case someone else is facing the same problem, there's an option when you make a new project to include, servlets mapping in web.xml, if you tick mark the option, in that case your web.xml shows up the servlets mapping. And web.xml will be found in WEB-INF folder.
upvote count: 2

http://stackoverflow.com/comment/36073733
score: 0
has text: @yshavit: if it is visible to the thread invoking `awaitTermination` that all tasks have been completed (which is the defined purpose of this method) all actions performed by these actions should be visible too. The only mistake is that the code here proceeds even when catching an `InterruptedException` as in this case it is not guaranteed that all tasks have been completed.
type: QuestionComment
comment on: http://stackoverflow.com/q/23497337
type: Comment

http://stackoverflow.com/comment/72839029
type: Comment
comment on: http://stackoverflow.com/q/23454952
type: QuestionComment
has text: @fge isn't that better expressed with `getOrDefault()`?
score: 4

http://stackoverflow.com/comment/36102855
comment on: http://stackoverflow.com/a/23533054
has text: I tried both and still the same result. I may just remove the id value from the habit object and see if it will fetch it automatically using the adapterview in onItemLongClick
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/35983957
type: QuestionComment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/52018/discussion-between-absurd-mind-and-flashdisk)
comment on: http://stackoverflow.com/q/23468553
score: 0
type: Comment

http://stackoverflow.com/a/23589725
has body: Use Maven &amp; Artifact for build management. It will take care about all these kind of dependencies. Refer it from its official site.
answers question: http://stackoverflow.com/q/23589025
type: Answer
score: 0

http://stackoverflow.com/a/23532773
score: 0
answers question: http://stackoverflow.com/q/23532229
type: Answer
has body: Assuming your file is correctly validated (i.e. every psalm number is followed by a text line), then for the existing binarySearch method, there are 2 corrections needed: . . middle = (left + right) / 2; middle += middle &amp; 1; // to the nearest even number . . . } else { return binarySearch(myArray, middle + 2, right, searchForPsalm); } } 1) As all psalm numbers are in the even array position, you need to ensure the middle is set to the nearest even offset. 2) For the 'right side' partition, you should skip over the text line by setting it to 'middle + 2'. This will ensure that you are comparing the psalm numbers as intended. Now rather than returning a boolean, you could return the string to display the associated text if found, so here is the revised method: public static String binarySearch(String myArray[], int left, int right, String searchForPsalm) { int middle; if (left &gt; right) { return ""; } middle = (left + right) / 2; middle += middle &amp; 1; if (myArray[middle].equals(searchForPsalm)) { return myArray[middle + 1]; } if (searchForPsalm.compareTo(myArray[middle]) &lt; 0) { return binarySearch(myArray, left, middle - 1, searchForPsalm); } else { return binarySearch(myArray, middle + 2, right, searchForPsalm); } } It will return a empty string if no entry found. In addition, if you need the 'middle' value also to be returned, you could revise it to return an object, say Result, which has both the 'middle' and the string value - see examples here: How to return multiple values in java?

http://stackoverflow.com/q/23453999
answer count: 1
has answer: http://stackoverflow.com/a/23454053
score: 0
has body: So i am trying to write a program that will grab all my emails from my email adress and save them to a text file, the problem i am having is grabbing more then 1 email with the Java Mail API. This is what i use to get an email which works fine, but i want to get every email in my inbox: public static void checkMail(String username, String password) { Properties props = new Properties(); props.setProperty("mail.store.protocol", "imaps"); try { Session session = Session.getInstance(props, null); Store store = session.getStore(); store.connect("imap.gmail.com", username, password); Folder inbox = store.getFolder("INBOX"); inbox.open(Folder.READ_ONLY); Message msg = inbox.getMessage(inbox.getMessageCount()); Address[] in = msg.getFrom(); for (Address address : in) { System.out.println("FROM:" + address.toString()); } Multipart mp = (Multipart) msg.getContent(); BodyPart bp = mp.getBodyPart(0); System.out.println("SENT DATE:" + msg.getSentDate()); System.out.println("SUBJECT:" + msg.getSubject()); System.out.println("CONTENT:" + bp.getContent()); } catch (Exception mex) { mex.printStackTrace(); } } If someone could possibly show me how to do this or explain it then that would be greatly appreciated.
tagged with: email
tagged with: gmail
has title: Exporting all emails from Gmail with Java Mail API
accepted answer: http://stackoverflow.com/a/23454053
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/36153912
comment on: http://stackoverflow.com/q/23561749
type: Comment
type: QuestionComment
has text: Please include the compiler error in your question.
score: 3

http://stackoverflow.com/comment/36026664
comment on: http://stackoverflow.com/q/23493828
has text: Is it written *exactly like that* in your property file? Because properties files use backslash for escaping, so you'd need to double it.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36054551
type: AnswerComment
comment on: http://stackoverflow.com/a/23508209
type: Comment
has text: The value of name that is being stored in Product.
score: 0

http://stackoverflow.com/comment/36181932
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23576212
score: 1
has text: Yes. ArrayList is Serializable, so you can serialize it with writeObject().

crystal-reports
tags question: http://stackoverflow.com/q/23563937
tag name: crystal-reports
type: Tag

http://stackoverflow.com/q/23532811
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23532839
type: Question
tagged with: sockets
has answer: http://stackoverflow.com/a/23533047
tagged with: android
has title: Android: How to have a common socket connection to server in all activities
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/36101423
upvote count: 1
type: UnansweredQuestion
has body: I am pretty new to android. How could I make a socket connection to a server which is available to all the activities, instead of me establishing connection to the same server in every activity? In the MainActivity I have a thread which is running, but this is thread is not accesible by other activities. public class MainActivity extends Activity implements OnItemSelectedListener { private Socket socket; private static final int SERVERPORT = 8020; private static final String SERVER_IP = "192.168.1.36"; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); new Thread(new ServerThread()).start(); } class ClientThread implements Runnable { private Socket socket; private static final int SERVERPORT = 8020; private static final String SERVER_IP = "192.168.1.36"; @Override public void run() { try { InetAddress serverAddr = InetAddress.getByName(SERVER_IP); socket = new Socket(serverAddr, SERVERPORT); } catch (UnknownHostException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } } How do i make the same connection to server on 192.168.1.36 available to all activities instead of me creating a connection on every activity. EDIT TO ANSWER I created a class which stores all the connection parameters package com.example.clientmobile2; public class DataHolderClass { private static DataHolderClass dataObject = null; private DataHolderClass() { // left blank intentionally } public static DataHolderClass getInstance() { if (dataObject == null) dataObject = new DataHolderClass(); return dataObject; } private int server_port=8020; private String server_ip="192.168.1.33";; public int get_server_port() { return server_port; } public String get_server_ip() { return server_ip; } } MainActivity is as follows :- public class MainActivity extends Activity implements OnItemSelectedListener { private static final int SERVERPORT = DataHolderClass.getInstance().get_server_port(); private stat…
downvote count: 0

http://stackoverflow.com/comment/36081148
type: QuestionComment
score: 0
has text: possible duplicate of [Why would one mark local variables and method parameters as "final" in Java?](http://stackoverflow.com/questions/316352/why-would-one-mark-local-variables-and-method-parameters-as-final-in-java)
comment on: http://stackoverflow.com/q/23522482
type: Comment

http://stackoverflow.com/a/23469188
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/23469071
downvote count: 1
has body: This is not possible without a workaround like http://www.mkyong.com/java/java-append-values-into-an-object-array/ try ArrayList, List, Map, HashMap or something like this instead
type: Answer

version
tags question: http://stackoverflow.com/q/23538126
tags question: http://stackoverflow.com/q/23497066
type: Tag
tag name: version
tags question: http://stackoverflow.com/q/23579896

http://stackoverflow.com/comment/36105383
type: AnswerComment
type: Comment
has text: OK now it got it. Let me check. What about your new issues?
comment on: http://stackoverflow.com/a/23533443
score: 0

http://stackoverflow.com/q/23537989
tagged with: android
has body: So I'm publishing a Live Card on Google Glass using the GDK, but I can't work out a way to unpublish the card after I publish a new one. If I don't it goes back to the clock screen and looks bad. Here's my liveCard Publishing, can you select an already active card and delete it later? I expect this is a logic problem but I can't quite get my head around it. public void makeNotificationCard() { RemoteViews aRV = new RemoteViews(this.getPackageName(), R.layout.card_text); mNotCard = mTimelineManager.createLiveCard(LIVE_CARD_ID); aRV.setTextViewText(R.id.price, bigNum); aRV.setTextViewText(R.id.price2, littleNum); aRV.setTextViewText(R.id.merchant, shop); mNotCard.setViews(aRV); Intent mIntent = new Intent(this, MainActivity.class); mIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); mNotCard.setAction(PendingIntent.getActivity(this, 0, mIntent, 0)); mNotCard.publish(LiveCard.PublishMode.REVEAL); }
tagged with: java
has title: How to publish live card in Google Glass before unpublishing the previous instance of the livecard
tagged with: google-gdk
type: Question
has answer: http://stackoverflow.com/a/23540369
score: 0
tagged with: google-glass
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/36052113
type: QuestionComment
has text: What do you mean, "parsed XML to a String"? Also, any reason you don't use an XML parser for XML manipulation, such as Xerces? Manipulating XML by regexp is... [dangerous](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454).
comment on: http://stackoverflow.com/q/23506875
score: 0
type: Comment

http://stackoverflow.com/comment/36041196
comment on: http://stackoverflow.com/q/23500383
score: 1
has text: @schmop You seem to be very keen to find a solution which no concrete problem to solve. You know very well that no GPU will run Java. This is a non-issue with a non-solution to a non-problem, so I suggest you give it up.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/35968614
has text: How do I grab the log?
comment on: http://stackoverflow.com/a/23460190
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/24404560
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/23568792
has body: I have tried the File Chooser in a webview using the latest Android release 4.4.3, and it's working fine. I guess Google has fixed the issue.
downvote count: 2
score: -2

http://stackoverflow.com/comment/36108221
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23523018
has text: @Katana24 Move it to `src/main/resources` or `src/main/java`.

http://stackoverflow.com/q/23611085
has comment: http://stackoverflow.com/comment/36253182
tagged with: linkedhashmap
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23646153
has comment: http://stackoverflow.com/comment/36252766
tagged with: java
has comment: http://stackoverflow.com/comment/36256433
tagged with: concurrency
has comment: http://stackoverflow.com/comment/36255184
accepted answer: http://stackoverflow.com/a/23646153
tagged with: caching
type: Question
has comment: http://stackoverflow.com/comment/36252138
has title: concurrently invalidate cache of several workers in java without hurting performances
has comment: http://stackoverflow.com/comment/36260843
has comment: http://stackoverflow.com/comment/36255072
score: 0
has comment: http://stackoverflow.com/comment/36256719
has comment: http://stackoverflow.com/comment/36254390
answer count: 1
has body: I am creating my own cache object that will serve several threads, this is an assignment so i am not allowed to use packages and jar that are out there. I am trying to figure out how to invalidate all of them at the same time. I have a date structure that contains a bunch of entries, where the key is an integer and the value is a boolean. When a worker have a miss, it adds the value to its cache. I have several other threads that update this data structure, and once they update it they should invalidate all the other worker threads that have this cache, only if the have this entry in their cache. For example say that there are two workers T1 cache has 1,true T2 cache has 3,true and the data structure has 1,true; 2,true; 3 true. Now the updater changes 3, false. So it should check T1 and not do anything and should check T2 and change it. However, this two checks should happen somehow at the same time, because if I have a case in which T1 cache has 3,true T2 cache has 3,true T1 may be invalidated, while T2 was not invalidated yet, and we have an inconsistent behavior. any ideas? my cache code is import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.locks.ReentrantLock; public class workerCache { @SuppressWarnings("rawtypes") LinkedHashMap cache; ReentrantLock lock; @SuppressWarnings("serial") public &lt;T&gt; workerCache(final int maxEntries) { this.lock = new ReentrantLock(); this.cache = new LinkedHashMap&lt;T, T&gt;(maxEntries + 1) { @SuppressWarnings("rawtypes") protected boolean removeEldestEntry(Map.Entry eldest) { return size() &gt; maxEntries; } }; } @SuppressWarnings("unchecked") public &lt;T&gt; void setEntry(T key, T value) { lock.lock(); try { cache.put(key, value); } finally { lock.unlock(); } } public &lt;T&gt; void invalidateEntry(T key) { lock.lock(); try { cache.remove(key); } finally { lock.unlock(); } } @SuppressWarnings("unchecked") public &lt;T&gt; T get(T key) { lock.lock(); try { return (T) this.cache.get(key); } fina…

http://stackoverflow.com/comment/36146958
score: 0
type: Comment
has text: sorry andrey, auto importing is just kinnda read operation where ide read pom and tell maven to solve dependecies but, i want ide to write pox.xml when i import lib from ide's own iterface, i don't wanant write pom.xml each time.
type: AnswerComment
comment on: http://stackoverflow.com/a/23557773

http://stackoverflow.com/q/23515061
has comment: http://stackoverflow.com/comment/36066888
type: AnsweredQuestion
has body: I tried to get the last visited page in my GWT application. I want to skip particular page if that comes in history. To get last visited page, I tried History.getToken() to get current token as described in docs. But it is always returning blank token. Please help. I am beginner level developer at GWT.
downvote count: 0
score: 1
favorite count: 0
type: Question
has title: GWT - History.getToken() is always returning blank value
has answer: http://stackoverflow.com/a/23515710
upvote count: 1
answer count: 1
tagged with: gwt
tagged with: java
accepted answer: http://stackoverflow.com/a/23515710
tagged with: browser-history

http://stackoverflow.com/a/23503059
has body: At least on my windows 7, finnish keyboard layout, µ is bound to Alt Gr + m. On different flavours of linux, it might differ a bit, but try something along the lines of ctrl + shift + (unicode) + enter. Generally speaking though, you need to copy &amp; paste them, learn the unicode sequence by heart, or learn to use greek keyboard..
answers question: http://stackoverflow.com/q/23502933
score: 0
type: Answer

http://stackoverflow.com/q/23561352
tagged with: authentication
tagged with: jndi
type: UnansweredQuestion
tagged with: tomcat
has body: I am trying to get LDAP authentication using Tomcat 7. I have the below configuration in my server.xml &lt;Context path="/WebApp" reloadable="false" docBase="E:\ESS\Tomcat 7\webapps\WebApp"&gt; &lt;ResourceLink name="mail/WebAPPMS" type="javax.mail.Session" global="mail_Session"/&gt; &lt;Manager checkInterval="60" debug="99"/&gt; &lt;ResourceLink name="jdbc/WebAppDS" type="javax.sql.DataSource" global="WebAppDataSource"/&gt; &lt;Realm className="org.apache.catalina.realm.JNDIRealm" debug="99" connectionURL="ldap://company.com:3268" userBase="DC=company,DC=com" userSubtree="true" userSearch="(CN={0})"/&gt; &lt;ResourceLink name="directory/WebAppReports" type="java.lang.String" global="SchemaReportsDirectory"/&gt; &lt;/Context&gt; Now in our LDAP, anonymous bind is not allowed. So I need to bind before searching and authenticating. However, I cannot pass connectionName, connectionPassword and userPassword, since it would create authentication in Comparison mode, which is not allowed by LDAP. Using the above config I am getting the following error: May 8, 2014 1:25:44 PM org.apache.catalina.realm.JNDIRealm authenticate SEVERE: Exception performing authentication javax.naming.NamingException: [LDAP: error code 1 - 00000000: LdapErr: DSID-0C090627, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece ]; remaining name 'DC=company,DC=com' at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source) at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source) at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source) at com.sun.jndi.ldap.LdapCtx.searchAux(Unknown Source) at com.sun.jndi.ldap.LdapCtx.c_search(Unknown Source) at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(Unknown Source) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(Unknown Source) at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(Unknown Source) at javax.naming.directory.InitialDirContext.search(Unknown Sour…
tagged with: ldap
type: Question
linked to: http://stackoverflow.com/q/1940777
has answer: http://stackoverflow.com/a/23578748
has title: LDAP authentication in Tomcat 7, how do I bind the LDAP in server.xml?
answer count: 1
has comment: http://stackoverflow.com/comment/96598802
score: 0
tagged with: java

http://stackoverflow.com/q/23598915
downvote count: 0
answer count: 1
has title: run java project in ant
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23598993
score: 1
tagged with: java
tagged with: swt
upvote count: 1
type: Question
has body: Im trying to run my java project (two programs, server and client) in ant. This is my build.xml Client Server gui project <property name="srcdirserver" location="src/src_server"/> <property name="srcdirclient" location="src/src_client"/> <property name="lib" location="lib"/> <property name="build" location="build"/> <property name="buildserver" location="build/server"/> <property name="buildclient" location="build/client"/> <property name="dest_server" location="dest-server"/> <property name="dest_client" location= "dest-client"/> <property name="examples" location="examples"/> <property name="doc" location="doc"/> <delete dir="${build}"/> <delete dir="${dest_server}"/> <delete dir="${dest_client}"/> <mkdir dir="${buildserver}"/> <javac includeantruntime="false" srcdir="${srcdirserver}" destdir="${buildserver}" encoding="UTF-8" classpath="${src}"/> <mkdir dir="${buildclient}"/> <javac includeantruntime="false" srcdir="${srcdirclient}" destdir="${buildclient}" encoding="UTF-8" classpath="${lib}/swt.jar:${src}"/> <mkdir dir="${dest_server}"/> <attribute name="Main-Class" value="game_server.main.Init"/> <mkdir dir="${dest_server}/examples"/> <fileset dir="${examples}" includes="**"/> <mkdir dir="${dest_client}"/> <attribute name="Main-Class" value="game_client.main.Gui"/> <attribute name="Class-Path" value="lib/swt.jar"/> <mkdir dir="${dest_client}"/> <mkdir dir="${dest_client}/lib"/> <java jar="${dest_server}/myserver.jar" dir="${dest_server}" fork="true"/> <java jar="${dest_client}/myclient.jar" dir="${dest_client}" fork="true"/> Server works fine, but client with gui is compiled/archived into jar successfuly, but when i run it it throws this error: /EDIT: i found out i was using wrong swt.jar version i downloaded proper now, but still getting similar error :/ run: [java] OpenJDK 64-Bit Server VM warning: You have loaded library /home/blackened/.swt/lib/linux/x86_64/libswt-gtk-4332.so which might have disabled stack guard. The VM will try to fix the stack guard now. …
tagged with: ant

http://stackoverflow.com/comment/35977969
type: Comment
has text: So something is wrong with the data. Can't help you further with that. Maybe the payload should be 0x2151?
comment on: http://stackoverflow.com/a/23467300
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36451627
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23631998
type: Comment
has text: Moreover, I removed the unnecessary (unused) *styles.xml* as well. There are no additional values-xxx folders, so the issue shouldn't be due to those.

http://stackoverflow.com/a/23594028
type: Answer
answers question: http://stackoverflow.com/q/23594004
downvote count: 0
score: 1
upvote count: 1
has body: You need to initialize your local variables, so try to do: double charges = 0.0;

http://stackoverflow.com/q/23602623
has comment: http://stackoverflow.com/comment/36230764
has comment: http://stackoverflow.com/comment/36230766
linked to: http://stackoverflow.com/q/373833
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36230774
duplicate of: http://stackoverflow.com/q/562160
favorite count: 0
linked to: http://stackoverflow.com/q/562160
linked to: http://stackoverflow.com/q/8484921
has title: reading xml stored as a string in java
downvote count: 4
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/23602671
upvote count: 0
has body: The contents of my webpage is an XML file and I am saving this content in a string. I have to read the nodes of the XML file. How do I fetch the values of the nodes from this XML file? Can someone please help me on this?
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/36230775

http://stackoverflow.com/comment/36080174
type: AnswerComment
has text: @diegoaguilar Another interesting thing that you can look up is something called `composition over inheritance`. It's a rather interesting idea.
comment on: http://stackoverflow.com/a/23521922
type: Comment
score: 0

http://stackoverflow.com/q/23598770
tagged with: java
has answer: http://stackoverflow.com/a/23599016
type: Question
answer count: 2
downvote count: 0
has body: I am trying to paint an image in only the makeFrame() method, but when I compile, it says that paintComponent is not declared import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; i
has title: How to put an image only in one method
favorite count: 0
has answer: http://stackoverflow.com/a/23598893
upvote count: 2
type: UnansweredQuestion
tagged with: swing
score: 2

http://stackoverflow.com/a/23554865
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23554803
type: Answer
has body: Okey seems I have answered myself, I don't know why it works, but works, despite the buildSessionFactory is strikthrough public SessionFactory open (){ Configuration configuration=new Configuration(); configuration.configure(); SessionFactory sf = new Configuration().configure().buildSessionFactory(); return sf; }
score: 0
answers question: http://stackoverflow.com/q/23554803

http://stackoverflow.com/q/23563363
tagged with: spring
linked to: http://stackoverflow.com/q/25427684
has comment: http://stackoverflow.com/comment/36161508
has answer: http://stackoverflow.com/a/49544543
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25850000
tagged with: java
possible better answer: http://stackoverflow.com/a/28488602
has comment: http://stackoverflow.com/comment/69285450
has answer: http://stackoverflow.com/a/28488602
linked to: http://stackoverflow.com/q/31017064
has answer: http://stackoverflow.com/a/56540655
type: Question
answer count: 8
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/36158540
score: 76
has title: How to override application.properties during production in Spring-Boot?
has comment: http://stackoverflow.com/comment/36157178
upvote count: 76
accepted answer: http://stackoverflow.com/a/49544543
has comment: http://stackoverflow.com/comment/36160680
has body: I'm using spring boot and application.properties to select a database during development by @Configuration @Profile("dev"). spring.profiles.active=dev spring.config.location=file:d:/application.properties During production I'd like to create a file outside of the application context that should be loaded and then active a different configuration profile, with d:/application.properties: spring.profiles.active=production Result: when I start the app, the configuration is still dev, so somehow the additional location of the productive properties file is not taken into account. Am I missing anything? spring boot 1.1.0.BUILD-SNAPSHOT Note: this question is NOT about tomcat.
has comment: http://stackoverflow.com/comment/36158433
has answer: http://stackoverflow.com/a/52386389
has answer: http://stackoverflow.com/a/59634352
downvote count: 0
has comment: http://stackoverflow.com/comment/36156979
has answer: http://stackoverflow.com/a/54657317
favorite count: 0
has answer: http://stackoverflow.com/a/23563481
has comment: http://stackoverflow.com/comment/36160258
has comment: http://stackoverflow.com/comment/36157384

character-encoding
tags question: http://stackoverflow.com/q/23610462
tags question: http://stackoverflow.com/q/23563351
tags question: http://stackoverflow.com/q/23502933
tags question: http://stackoverflow.com/q/23551530
tag name: character-encoding
tags question: http://stackoverflow.com/q/23554839
tags question: http://stackoverflow.com/q/23455681
type: Tag
tags question: http://stackoverflow.com/q/23461514
tags question: http://stackoverflow.com/q/23491827

http://stackoverflow.com/comment/36148507
type: Comment
type: QuestionComment
has text: @SwapL That can't be happening. If the directory exists, it means that you don't have permissions to write to that directory. But java would fire a `java.lang.IOEsception: Permission Denied` in that case. So double check, likely your directory doesn't exist.
comment on: http://stackoverflow.com/q/23558594
score: 0

http://stackoverflow.com/q/23466951
upvote count: 11
has answer: http://stackoverflow.com/a/38233875
has answer: http://stackoverflow.com/a/23467010
has title: Hibernate 4 Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
has answer: http://stackoverflow.com/a/43373460
linked to: http://stackoverflow.com/q/18792185
favorite count: 0
answer count: 12
has answer: http://stackoverflow.com/a/49823105
accepted answer: http://stackoverflow.com/a/23532558
score: 11
possible better answer: http://stackoverflow.com/a/23467010
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/32884840
has answer: http://stackoverflow.com/a/27182691
has answer: http://stackoverflow.com/a/23532558
has answer: http://stackoverflow.com/a/29879730
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/40610473
has body: I am using Hibernate latest version 4.3.5.Final. My hibernate.cfg.xml file content: <?xml version="1.0" encoding="UTF-8"?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost/Test pankaj xxxx org.hibernate.dialect.MySQLDialect <mapping resource="employee.hbm.xml"/> </hibernate-configuration> Utility class to create SessionFactory: package com.example; import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml Configuration configuration = new Configuration(); configuration.configure("hibernate.cfg.xml"); System.out.println("Hibernate Configuration loaded"); SessionFactory sessionFactory = configuration.buildSessionFactory(new StandardServiceRegistryBuilder().build()); return sessionFactory; } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } } When I use it in my main() method, I get the following exception: May 04, 2014 11:55:56 PM org.hibernate.cfg.Configuration doConfigure INFO: HHH000041: Configured SessionFactory: null Hibernate Configuration loaded May 04, 2014 11:55:57 PM org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator initiateService WARN: HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections Initial SessionFactory creation failed.org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set Exception in thread "main" java.lang.ExceptionInInitializerError at com.example.HibernateUtil.buildS…
type: Question
has answer: http://stackoverflow.com/a/26975019
has answer: http://stackoverflow.com/a/23467012
has answer: http://stackoverflow.com/a/26402985
downvote count: 0

http://stackoverflow.com/comment/36255062
has text: Try commenting out the code in the `if` statement and always execute the code in the `else` statement (ie: don't use `moveTaskToFront()` but instead use `startActivity(restartTaskIntent)`) and see if that works on your device
comment on: http://stackoverflow.com/q/23593433
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36116075
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23539715
type: Comment
has text: thanks bro, i might need time to understand this...pretty new to threading as i just took up java in college

http://stackoverflow.com/a/23539742
type: Answer
has comment: http://stackoverflow.com/comment/36113741
has body: you can try this: double value; String text =your_edittext.getText().toString(); if(!text.isEmpty()) try { value= Double.parseDouble(text); // it means it is double } catch (Exception e1) { // this means it is not double e1.printStackTrace(); }
has comment: http://stackoverflow.com/comment/36113131
accepted answer of: http://stackoverflow.com/q/23539713
has comment: http://stackoverflow.com/comment/36113693
score: 10
upvote count: 10
has comment: http://stackoverflow.com/comment/36113808
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23539713

http://stackoverflow.com/comment/35965043
type: Comment
has text: Well which one worked? The top or the bottom? I'll implement it once you let me know.
comment on: http://stackoverflow.com/a/23460190
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36168734
type: Comment
comment on: http://stackoverflow.com/a/23568958
has text: the problem is not in thread but in how to launch thread from JSP. For example the operator press button"print" coresponding to the first printer, so a thread is launched and while that thread is running he press button "print" of printer 2 . as a result i should have two threads: one for printer1 and the other for printer 2
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36158659
comment on: http://stackoverflow.com/a/23563792
has text: thank you very much the problem is that you described! but how i use the Executors works with the thread available?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36229313
type: AnswerComment
type: Comment
has text: @chopu Are you sure you have that class in your classpath. Please double check
score: 0
comment on: http://stackoverflow.com/a/23601789

http://stackoverflow.com/q/23541164
answer count: 0
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
favorite count: 0
tagged with: rest
has body: I am using jackson-jaxrs-1.5.7.jar for my rest web service. I am using Ant to generate resourcedoc.xml. Every thing is fine. But my problem is, In the web.xml I have added 4 resources (ie 4 package names- every one are different project) so that while hitting application.wadl from browser all the documentation for the packages that are mentioned in the web.xml are mapped. But I need the documentation for only one package. How to achieve it?? The CustomWADLGeneratorConfig is given below. public class CustomWADLGeneratorConfig extends WadlGeneratorConfig{ @Override public List&lt;WadlGeneratorDescription&gt; configure() { return generator(WadlGeneratorResourceDocSupport.class).prop("resourceDocStream", "resourcedoc.xml").descriptions(); }
has title: Filtering WADL documentation by package name at the time of building
type: UnansweredQuestion
tagged with: wadl

http://stackoverflow.com/q/23595099
type: Question
has answer: http://stackoverflow.com/a/23596188
answer count: 1
has title: Cloudgraph service throws Number format exception under high load conditions
has body: Cloudgraph service throws Number format exception under high load conditions. We randomly see the following exception under high load. Caused by: java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Long.parseLong(Long.java:431) at java.lang.Long.parseLong(Long.java:468) at java.text.DigitList.getLong(DigitList.java:177) at java.text.DecimalFormat.parse(DecimalFormat.java:1297) at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1589) at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1311) at java.text.DateFormat.parse(DateFormat.java:335) at org.plasma.sdo.helper.DataConverter.fromString(DataConverter.java:1768)
accepted answer: http://stackoverflow.com/a/23596188
tagged with: maven
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/36034068
comment on: http://stackoverflow.com/q/23471634
type: Comment
type: QuestionComment
has text: what your not understanding in my question
score: 0

http://stackoverflow.com/comment/36316813
has text: So show us the where you use the classes and retrieve the list's size.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23600959

http://stackoverflow.com/comment/36060309
has text: forgot beans.xml. DOH! I didn't even consider the possibility. Well good job figuring it out anyway.
comment on: http://stackoverflow.com/a/23494565
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/23580671
has body: Package is used to put all one Module related into one specified Folder for a better understanding ,whereas import is used to import the specific class that we need to run our application/class(Like we use Java.Util...etc).
upvote count: 2
has comment: http://stackoverflow.com/comment/36192036
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/23580284
score: 1

http://stackoverflow.com/comment/36062348
type: Comment
type: QuestionComment
has text: @fge Because I want to be able to reuse the objects from the pool, that is, when one user has released a session back to the pool, another one can get that same session.
comment on: http://stackoverflow.com/q/23512725
score: 0

http://stackoverflow.com/q/23517107
has comment: http://stackoverflow.com/comment/36070535
has comment: http://stackoverflow.com/comment/36072221
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23517898
has comment: http://stackoverflow.com/comment/36070341
answer count: 1
has comment: http://stackoverflow.com/comment/36071862
favorite count: 0
has comment: http://stackoverflow.com/comment/36071064
has title: Structures of files in java
upvote count: 2
has comment: http://stackoverflow.com/comment/36070231
has answer: http://stackoverflow.com/a/23517898
type: AnsweredQuestion
has body: Hello I am new in Java so I would like some guidelines on how to organize files of a project in java. Currently I am building an app with GUI so I want two files one that relates to the GUI and another file that relates to any functions that are called from the first. Right now I've named the second file Utilities.java and looks like this: package Directory; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.swing.JProgressBar; import javax.swing.JTextArea; import javax.swing.SwingWorker; public class Utilities { public class FileCopy{ private File Source; private File Destination; private long totalBytes=0L; FileCopy(File source,File destination){ Source=source; Destination=destination; retrieveTotalBytes(source); } File getSource(){return Source;} File getDestination(){return Destination;} Long gettotalBytes(){return totalBytes;} private void retrieveTotalBytes(File sourceFile) { if(sourceFile.isDirectory()==false){ totalBytes = sourceFile.length(); } else{ File[] files = sourceFile.listFiles(); for(File file : files) { if(file.isDirectory()) retrieveTotalBytes(file); else totalBytes += file.length(); } } System.out.print("Done retrieving"); } } public class Copy extends SwingWorker&lt;Void,Integer&gt; { File src,dest; InputStream in; OutputStream out; JProgressBar progressBar; JProgressBar all; JTextArea txt; public int progress; //private int all_progress; private long totalBytes = 0L; private long copiedBytes = 0L; boolean keepStructure=false; boolean delete=false; public Copy(File source,File dst,JProgressBar br,JTextArea text,boolean keep,boolean delete) { src=source; dest=dst; progressBar=br; txt=text; progressBar.setValue(0); progressBar.setVisible(true); txt.setText("Copying " + src.getName()); keepStructure=keep; this.delete=delete; } @Override public V…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36072335

http://stackoverflow.com/q/23563239
has title: Building a storm topology with shell bolts
has answer: http://stackoverflow.com/a/23772904
accepted answer: http://stackoverflow.com/a/23772904
has comment: http://stackoverflow.com/comment/36189549
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: apache-storm
type: Question
has body: I'm currently trying to implement a Storm topology that integrates with the R language. As a starting point, i took the following project (https://github.com/allenday/R-Storm) which works by extending the ShellBolt class to implement R integration, as well as an R library to handle communication between the java and R sides. My problem is that if i create a topology based on regular (java-only) bolts, i can chain them together without issue. However, when one of the bolts in the middle of the chain is an R Shell Bolt, the thing just falls apart with: 5661 [Thread-18] ERROR backtype.storm.util - Async loop died! java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: Pipe to subprocess seems to be broken! No output read. Shell Process Exception: at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:87) ~[storm-0.9.0-wip16.jar:na] at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:58) ~[storm-0.9.0-wip16.jar:na] at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:62) ~[storm-0.9.0-wip16.jar:na] at backtype.storm.daemon.executor$fn__3557$fn__3569$fn__3616.invoke(executor.clj:715) ~[storm-0.9.0-wip16.jar:na] at backtype.storm.util$async_loop$fn__436.invoke(util.clj:377) ~[storm-0.9.0-wip16.jar:na] at clojure.lang.AFn.run(AFn.java:24) ~[clojure-1.4.0.jar:na] at java.lang.Thread.run(Unknown Source) ~[na:1.7.0_25] Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Pipe to subprocess seems to be broken! No output read. More concrete, the following topology works as expected: TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("spout", new RandomSentenceSpout(), 1); builder.setBolt("permutebolt", new PermuteBolt(), 1).shuffleGrouping("spout"); Where PermuteBolt is an R Shell Bolt. The logs for this example show the expected output: 6246 [Thread-18] INFO backtype.storm.daemon.task - Emitting: spout default [four score and seven years …
upvote count: 2
tagged with: http://stackoverflow.com/tag/r
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36209455

http://stackoverflow.com/comment/36251609
type: QuestionComment
type: Comment
has text: @AntonH, thats what i tried doing in the first place, but that returned rediculous values (like i putted in 10 and parts 4 and it would return like 20 million, 40 million, 20 million, 25 million) @
score: 0
comment on: http://stackoverflow.com/q/23613704

http://stackoverflow.com/a/23530614
has comment: http://stackoverflow.com/comment/36121166
type: Answer
accepted answer of: http://stackoverflow.com/q/23524733
downvote count: 0
answers question: http://stackoverflow.com/q/23524733
score: 3
has body: You have three &lt;http&gt; blocks which are creating three separate security filter chains (i.e. where you aren't using security='none' to bypass security for particular URLs). Neither of these has a "pattern" attribute which means they will both be configured to handle all requests, which doesn't make sense. The second and third of these blocks have no authentication method configured. Either of these would cause the error you are getting. The form-login only applies with the http element which contains it. Just use one &lt;http&gt; element to contain all the intercept-url configurations you want to apply, unless you specifically want to have different security configurations for different URL patterns. Also take a look at this question and answer.
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/q/23463394
has comment: http://stackoverflow.com/comment/35971073
favorite count: 0
tagged with: priority-queue
has comment: http://stackoverflow.com/comment/35971219
has answer: http://stackoverflow.com/a/23463977
tagged with: binary-heap
accepted answer: http://stackoverflow.com/a/23463977
has comment: http://stackoverflow.com/comment/35971394
has comment: http://stackoverflow.com/comment/35971606
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35970945
downvote count: 1
type: Question
upvote count: 2
tagged with: algorithm
has body: so I'm working on a lab for my class. I need to create a Priority Queue in Java using an array list. The kicker is that each node has to have a "handle" which is just an object which contains the index of of the node that it's associated with. I know that sounds weird but we have to implement it this way. Anyway, my priority queue seem to work fine except the handle values apparently aren't updating correctly because I fail the handle test. Also, I run into problems with handles only after extractMin() is called, so I figured the problem would be somewhere in that method but I've been through it a million times and it looks good to me. Here is my Priority Queue Class: package lab3; import java.util.ArrayList; /** * A priority queue class supporting operations needed for * Dijkstra's algorithm. */ class PriorityQueue&lt;T&gt; { final static int INF = 1000000000; ArrayList&lt;PQNode&lt;T&gt;&gt; queue; /** * Constructor */ public PriorityQueue() { queue = new ArrayList&lt;PQNode&lt;T&gt;&gt;(); } /** * @return true iff the queue is empty. */ public boolean isEmpty() { if (queue.size() &lt;= 0) return true; return false; } /** * Insert a (key, value) pair into the queue. * * @return a Handle to this pair so that we can find it later. */ Handle insert(int key, T value) { queue.add(new PQNode(key, value)); int loc = queue.size()-1; // Swap with parent until parent not larger while (loc &gt; 0 &amp;&amp; queue.get(loc).getKey() &lt; queue.get(parent(loc)).getKey()) { swap(loc, parent(loc)); loc = parent(loc); } return new Handle(loc); } private void swap(int i, int j) { PQNode t = queue.get(i); queue.set(i, queue.get(j)); queue.get(i).setHandleIndex(i); queue.set(j, t); queue.get(j).setHandleIndex(j); } /** * @return the min key in the queue. */ public int min() { if (isEmpty()) return -INF; return queue.get(0).getKey(); } /** * Find and remove the smallest (key, value) pair in the queue. * * @return the value associated with the smallest key */ public T extractMin() { if…
has comment: http://stackoverflow.com/comment/35972244
has comment: http://stackoverflow.com/comment/35971436
has comment: http://stackoverflow.com/comment/35971153
answer count: 1
has title: Priority Queue in Java which keeps track of each node's position

http://stackoverflow.com/q/23594822
favorite count: 0
upvote count: 12
tagged with: apache-poi
tagged with: excel
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
score: 12
answer count: 2
possible better answer: http://stackoverflow.com/a/23619684
has answer: http://stackoverflow.com/a/23619684
accepted answer: http://stackoverflow.com/a/23603460
has title: Creating a CellStyle library in Apache POI
has body: My system produces lots of different Excel reports using Apache POI from Java. A lot of these reports share the same styles. I have created a CellStyle library for use by all of the reports. I wondered if there was a neater way. import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.Workbook; public class CellStyles { CellStyle headingCellStyle = null; Workbook wb; public CellStyles(Workbook wb) { this.wb = wb; } public CellStyle getHeadingCellStyle() { if (headingCellStyle == null) { headingCellStyle = wb.createCellStyle(); headingCellStyle.setFillForegroundColor(HSSFColor.YELLOW.index); headingCellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); } return headingCellStyle; } } and then calling it Workbook wb = new XSSFWorkbook(inputStream); // XSSF for .xlsm CellStyles cs = new CellStyles(wb); CellUtil.getCell(myRow, 2).setCellStyle(cs.getHeadingCellStyle());
has answer: http://stackoverflow.com/a/23603460

http://stackoverflow.com/a/23485627
has body: You are calling x.hasNextInt() and the Scanner waits for another input to check if it is an int. You are also reading in an int and assigning it to a double (which an int is not). And to further it, you pass your int/double hybrid to Math.round which converts it to a Long and then casts it to an int and tries to assign it to a double. If you are wanting to check if an a line is an int, you should try something like: System.out.println("Please enter an integer."); String line = x.nextLine(); int res=0; try{ res=Integer.parseInt(line); }catch(Exception e){ System.out.println("Not a number"); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23485509

http://stackoverflow.com/comment/36325763
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23609768
score: 0
has text: It does not work. I did something different. we need config the velocity resource that velocityEngine.setApplicationAttribute("javax.servlet.ServletContext", servletContext); velocityEngine.setProperty("resource.loader", "webapp"); velocityEngine.setProperty("webapp.resource.loader.class", "org.apache.velocity.tools.view.servlet.WebappLoader"); velocityEngine.setProperty("webapp.resource.loader.path",

http://stackoverflow.com/a/23536057
has comment: http://stackoverflow.com/comment/36106676
answers question: http://stackoverflow.com/q/23519709
type: Answer
score: 0
has body: You should create custom views that extend TemplatesPlugin (or ViewsPlugin, in the newest version). This information is explained in securesocial website.

http://stackoverflow.com/comment/35954149
type: QuestionComment
score: 1
has text: In your example you must put `@Cache` annotation on the employee entity itself cause collection cache holds nothing but employees primary keys (ids) and not actual employee instances. It means that Hibernate will have to go to DB to load them if employee itself is not cached also.
comment on: http://stackoverflow.com/q/23454133
type: Comment

http://stackoverflow.com/q/23583848
tagged with: java
has comment: http://stackoverflow.com/comment/36195659
has title: Multi threaded chat server
type: Question
has body: I am new to Threads. I am trying to broadcast message from the server to clients.but I cannot. It seems like the server is always listen to a new connection.But I can send messages to other clients using the clients terminal. My question is how to allow input while listening at the same time. Here is the code. MultiThreadChatServerSync.java import java.io.InputStreamReader; import java.io.DataInputStream; import java.io.PrintStream; import java.io.IOException; import java.net.Socket; import java.net.ServerSocket; import java.io.BufferedReader; public class MultiThreadChatServerSync extends Thread { private static ServerSocket serverSocket = null; private static Socket clientSocket = null; private static Socket serversSocket = null; private static DataInputStream iss = null; private static PrintStream oss = null; private static final int maxClientsCount = 10; private static final clientThread[] threads = new clientThread[maxClientsCount]; public static void main(String args[]) { int num = 0; int portNumber = 2222; if (args.length &lt; 1) { System.out.println("Usage: java MultiThreadChatServerSync&lt;portNumber&gt; "Nowusingnumber=" + portNumber); } else { portNumber = Integer.valueOf(args[0]).intValue(); } try { serverSocket = new ServerSocket(portNumber); } catch (IOException e) { System.out.println(e); } DataInputStream iss = null; while (true) { try { System.out.println("5"); num++; // I want to be able to input text here to the server which will be // send to different clients // But I cannot clientSocket = serverSocket.accept(); int i = 0; for (i = 0; i &lt; maxClientsCount; i++) { if (threads[i] == null) { System.out.println("6"); (threads[i] = new clientThread(clientSocket, threads)) .start(); break; } } if (i == maxClientsCount) { PrintStream os = new PrintStream(clientSocket.getOutputStream()); os.println("Server too busy. Try later."); os.close(); clientSocket.close(); } } catch (IOException e) { System.out.println(e); } } } } class clientThread extends Thr…
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23583878
has comment: http://stackoverflow.com/comment/36195704
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/36195581
score: 1

http://stackoverflow.com/comment/36157480
type: Comment
has text: yes dear. The jsp containing displaytag can not be used with `tiles:insertattribute` or `jsp:include`. :(
comment on: http://stackoverflow.com/a/23537742
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36235208
score: 1
has text: Note that you can also make threads on frontend instances, however they can not outlive the request: [ThreadManager.createThreadForCurrentRequest(..)](https://developers.google.com/appengine/docs/java/javadoc/com/google/appengine/api/ThreadManager#createThreadForCurrentRequest(java.lang.Runnable)) So you can have parallel threads on frontend instances that run for max of 10 minutes (if executed via Task Queue).
comment on: http://stackoverflow.com/a/23601340
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23537816
has body: You can do something like this long startDate; long endDate; private void calculateMonthStartAndEndTime(int month, int year){ //create the first date of month Calendar mycal = new GregorianCalendar(year,month, 1); startDate = mycal.getTimeInMillis(); // Get the number of days in that month which actually gives the last date. int lastDate = mycal.getActualMaximum(Calendar.DAY_OF_MONTH); mycal = new GregorianCalendar(year, month, lastDate); endDate = mycal.getTimeInMillis(); }
has comment: http://stackoverflow.com/comment/36109668
has comment: http://stackoverflow.com/comment/36112938
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23537475
type: Answer
answers question: http://stackoverflow.com/q/23537475
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36145443

http://stackoverflow.com/comment/36003073
type: QuestionComment
comment on: http://stackoverflow.com/q/23480307
type: Comment
has text: @AlexeyMalev I tried your code and got the following new error: `Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: Concept is not mapped [SELECT conc FROM Concept conc WHERE conc.conceptPK.id =:cid order by conc.conceptPK.effectiveTime desc]`. What do you suggest?
score: 0

http://stackoverflow.com/q/23496142
accepted answer: http://stackoverflow.com/a/23511371
type: AnsweredQuestion
has body: I have a supervisor Actor which delegates work to a lower level child Actor using the tell command. The child Actor does some web service logic and when completes sends a response back to the supervisor. Can someone tell me what happens during this interaction in terms of access to the parents onReceive method? For example when the parent calls tell can it then take another message from its mailbox and start processing that or does it need to wait until the child completes and sends response?
tagged with: java
type: Question
score: 0
has title: Akka: Blocking implications in supervisor-child hierarchy
tagged with: akka
answer count: 1
has answer: http://stackoverflow.com/a/23511371

http://stackoverflow.com/comment/36162998
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23566397
has text: Not sure if your assignment allows for it, but Java has some nice [baked in features](http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html) for sorting and with your compareTo method you're half way there.

http://stackoverflow.com/q/23477918
tagged with: sql
upvote count: 1
answer count: 1
tagged with: jdbc
linked to: http://stackoverflow.com/q/1905607
favorite count: 0
type: UnansweredQuestion
downvote count: 0
has body: I can't seem to work out the bug. I need the ResultSet though to get the actual Object. The error is: java.sql.SQLException: Can not issue data manipulation statements with executeQuery(). at rs = pst.executeQuery();. Code: Connection con = null; PreparedStatement pst = null; ResultSet rs = null; String url = null; //Set, but not visible in code. String user = null; //Set, but not visible in code. String password = null; //Set, but not visible in code. public Object get(String table, String key){ try { con = DriverManager.getConnection(url, user, password); String query = "SELECT * FROM `" + table + "` WHERE key = ?;"; pst = con.prepareStatement(query); pst.setString(1, key); pst.executeUpdate(); rs = pst.executeQuery(); rs.next(); return rs.getObject(1); } catch (SQLException ex) { return null; } finally { try { if (rs != null) { rs.close(); } if (pst != null) { pst.close(); } if (con != null) { con.close(); } } catch (SQLException ex) { return null; } } }
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/23446377
tagged with: mysql
has title: java.sql.SQLException: Can not issue data manipulation statements with executeQuery()
has answer: http://stackoverflow.com/a/41942700
type: Question
has comment: http://stackoverflow.com/comment/35997808
has comment: http://stackoverflow.com/comment/35997668
has comment: http://stackoverflow.com/comment/35997723
duplicate of: http://stackoverflow.com/q/1905607

http://stackoverflow.com/comment/110666631
type: Comment
has text: This would have been a lot more helpful with an example implementing your request instead of a simple link. :(. https://xkcd.com/979/ is relevant
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/24552618

http://stackoverflow.com/comment/36353994
type: QuestionComment
comment on: http://stackoverflow.com/q/23581163
has text: It appears to be a strange side effect of the software that this code is embedded in. A standalone client works as expected. I didn't find the reason yet. Something prevents the socket to send out the data from the buffer.
score: 0
type: Comment

http://stackoverflow.com/comment/36189904
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23580564
has text: well, it seems that you have two steps to solve here. The first one is to create the necessary code to represent your AST. From your AST, you can generate your assembly program. The second step is to interpret your program, emulating what a real processor would do.

http://stackoverflow.com/a/23835835
answers question: http://stackoverflow.com/q/23465387
type: Answer
type: AcceptedAnswer
has body: Thanks for the answer, I checked that using Maven its a little bit different and in the built path you have to specify the path for your maven repository, so, it will incluide all libraries directly or you can copy and past them into your project
accepted answer of: http://stackoverflow.com/q/23465387
score: 0

http://stackoverflow.com/comment/36069465
type: QuestionComment
has text: Check this http://stackoverflow.com/questions/12032748/hibernate-criteria-projection-distinct
comment on: http://stackoverflow.com/q/23516661
score: 0
type: Comment

http://stackoverflow.com/comment/36209274
type: Comment
comment on: http://stackoverflow.com/a/23591071
has text: Yes. You are already passing a list of words to the words() method, why you are trying to use scanner there?
type: AnswerComment
score: 0

mysql
tags question: http://stackoverflow.com/q/23595499
tags question: http://stackoverflow.com/q/23535285
tags question: http://stackoverflow.com/q/23559115
tags question: http://stackoverflow.com/q/23594187
tags question: http://stackoverflow.com/q/23599182
tags question: http://stackoverflow.com/q/23575871
tag name: mysql
tags question: http://stackoverflow.com/q/23614016
tags question: http://stackoverflow.com/q/23457174
tags question: http://stackoverflow.com/q/23478047
tags question: http://stackoverflow.com/q/23471866
tags question: http://stackoverflow.com/q/23530956
tags question: http://stackoverflow.com/q/23491770
tags question: http://stackoverflow.com/q/23570441
tags question: http://stackoverflow.com/q/23472076
tags question: http://stackoverflow.com/q/23508948
tags question: http://stackoverflow.com/q/23535138
tags question: http://stackoverflow.com/q/23551673
tags question: http://stackoverflow.com/q/23490048
tags question: http://stackoverflow.com/q/23543919
tags question: http://stackoverflow.com/q/23556291
tags question: http://stackoverflow.com/q/23605720
tags question: http://stackoverflow.com/q/23598360
tags question: http://stackoverflow.com/q/23576460
tags question: http://stackoverflow.com/q/23599832
tags question: http://stackoverflow.com/q/23527173
tags question: http://stackoverflow.com/q/23481131
tags question: http://stackoverflow.com/q/23480005
tags question: http://stackoverflow.com/q/23514084
tags question: http://stackoverflow.com/q/23559789
tags question: http://stackoverflow.com/q/23508043
tags question: http://stackoverflow.com/q/23595594
tags question: http://stackoverflow.com/q/23490313
tags question: http://stackoverflow.com/q/23551705
tags question: http://stackoverflow.com/q/23546702
tags question: http://stackoverflow.com/q/23502963
tags question: http://stackoverflow.com/q/23527856
tags question: http://stackoverflow.com/q/23606041
tags question: http://stackoverflow.com/q/23585170
tags question: http://stackoverflow.com/q/23521925
tags question: http://stackoverflow.com/q/23506508
tags question: http://stackoverflow.com/q/23456524
tags question: http://stackoverflow.com/q/23453228
tags question: http://stackoverflow.com/q/23468182
tags question: http://stackoverflow.com/q/23546063
tags question: http://stackoverflow.com/q/23510624
tags question: http://stackoverflow.com/q/23461637
tags question: http://stackoverflow.com/q/23520506
tags question: http://stackoverflow.com/q/23574270
tags question: http://stackoverflow.com/q/23542781
tags question: http://stackoverflow.com/q/23610705
tags question: http://stackoverflow.com/q/23539427
tags question: http://stackoverflow.com/q/23540593
tags question: http://stackoverflow.com/q/23481860
tags question: http://stackoverflow.com/q/23572168
tags question: http://stackoverflow.com/q/23524458
tags question: http://stackoverflow.com/q/23537424
tags question: http://stackoverflow.com/q/23550074
tags question: http://stackoverflow.com/q/23570491
tags question: http://stackoverflow.com/q/23609258
tags question: http://stackoverflow.com/q/23472174
tags question: http://stackoverflow.com/q/23474673
tags question: http://stackoverflow.com/q/23541111
tags question: http://stackoverflow.com/q/23533061
tags question: http://stackoverflow.com/q/23564540
tags question: http://stackoverflow.com/q/23528843
type: Tag
tags question: http://stackoverflow.com/q/23504731
tags question: http://stackoverflow.com/q/23462468
tags question: http://stackoverflow.com/q/23490653
tags question: http://stackoverflow.com/q/23482343
tags question: http://stackoverflow.com/q/23496432
tags question: http://stackoverflow.com/q/23534314
tags question: http://stackoverflow.com/q/23508719
tags question: http://stackoverflow.com/q/23525903
tags question: http://stackoverflow.com/q/23503986
tags question: http://stackoverflow.com/q/23536795
tags question: http://stackoverflow.com/q/23530125
tags question: http://stackoverflow.com/q/23521217
tags question: http://stackoverflow.com/q/23561868

http://stackoverflow.com/comment/36080123
score: 0
type: Comment
has text: edited answer, try it. You pasted me the class, but where do you instantiate your LoginDialog and use LoginDialog.show()? I'm not sure if my update will run.
type: AnswerComment
comment on: http://stackoverflow.com/a/23521193

http://stackoverflow.com/a/23614650
has comment: http://stackoverflow.com/comment/36257610
accepted answer of: http://stackoverflow.com/q/23612649
type: AcceptedAnswer
downvote count: 0
has body: Run application as a service or run application in background. Service or running in background depends on which operating system your using.
has comment: http://stackoverflow.com/comment/36257433
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36269271
answers question: http://stackoverflow.com/q/23612649

http://stackoverflow.com/a/23588582
has body: As mentioned above, it is better to use a List. But besides that, there is a bug in your code. You must reset your timetable variable again before the second while statement. Hope this helps.
answers question: http://stackoverflow.com/q/23588412
score: 0
type: Answer

http://stackoverflow.com/comment/39730641
has text: possible duplicate of [Loop doesn't see changed value without a print statement](http://stackoverflow.com/questions/25425130/loop-doesnt-see-changed-value-without-a-print-statement)
comment on: http://stackoverflow.com/q/23495167
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23532122
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23532391
has body: I'm trying to create a Matcher instance to pull tokens out of a string. This is what I used: Matcher base = Pattern.compile("red|green|blue|\\+|\\(|\\)").matcher(input.trim()); while (!base.hitEnd()) { if (base.find()) { String s = base.group(); output += String.format(" %s", s); } else { throw new IllegalArgumentException("Invalid tokens in the input! " + base.toString()); } } In this case input is my input string to be tokenized. However, even if I give it the input "red", it still throws the exception, and shows that the object attempted no matches (no change to the indices being considered, no prior matches). My goal is to match the exact words "red", "green", "blue", the plus sign and the opening and closing parens, as tokens. What am I missing?
has answer: http://stackoverflow.com/a/23532391
score: 0
answer count: 1
tagged with: regex
has title: Java's Matcher not matching input correctly
type: AnsweredQuestion

http://stackoverflow.com/comment/36337156
has text: Sorry i don't know how to add code in comment section.
comment on: http://stackoverflow.com/q/23600959
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23458581
has comment: http://stackoverflow.com/comment/35961936
type: Question
has body: I'm in the process of writing a reverse proxy. Parts of that is obviously rewriting the links to reflect the mapping. What is the best approach to achieve that? As I'm doing that with Scala I was looking for a tidy approach with JSoup or something similar but they all seem quite slow for something this central. So I was wondering, is there a better approach to take? Thank you for opinions! Regards Alessandro
linked to: http://stackoverflow.com/q/1732348
downvote count: 0
has comment: http://stackoverflow.com/comment/35962126
favorite count: 0
tagged with: url-rewriting
type: UnansweredQuestion
tagged with: scala
tagged with: http://stackoverflow.com/tag/html
has title: Adapt/Rewrite all Links in an HTML Document that is not necessarily XML Compliant
answer count: 0
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/23592163
tagged with: java
has answer: http://stackoverflow.com/a/23592409
upvote count: 1
downvote count: 1
type: Question
score: 0
has title: Applet not Initialized in applet viewer(2D Game)
accepted answer: http://stackoverflow.com/a/23592409
answer count: 1
favorite count: 0
type: AnsweredQuestion
has body: I'm trying to create a basic 2D game, following a YouTube series. I'm trying to go out of my way to make it more neater (by adding Classes that have individual jobs) GitHub Link I'm trying to communicate between: Window (should just generate the window/applet, Loop (the main of the program), and Movement (which updates the player's coordinates and img animation). I just completed adding everything, but when i try and run the program It says "APPLET NOT INTIALIZED" and Spams: ava.lang.StackOverflowError at java.security.AccessControlContext.optimize(Unknown Source) at java.security.AccessController.getContext(Unknown Source) at java.awt.Component.&lt;init&gt;(Unknown Source) at java.awt.Container.&lt;init&gt;(Unknown Source) at java.awt.Panel.&lt;init&gt;(Unknown Source) at java.awt.Panel.&lt;init&gt;(Unknown Source) at java.applet.Applet.&lt;init&gt;(Unknown Source) at org.joelmale.game.darkshrine.backend.Loop.&lt;init&gt;(Loop.java:8) at org.joelmale.game.darkshrine.backend.Movement.&lt;init&gt;(Movement.java:28) Is there something i'm doing wrong?

hql
tag name: hql
tags question: http://stackoverflow.com/q/23489923
tags question: http://stackoverflow.com/q/23516447
tags question: http://stackoverflow.com/q/23544274
tags question: http://stackoverflow.com/q/23480005
type: Tag
tags question: http://stackoverflow.com/q/23566110
tags question: http://stackoverflow.com/q/23575593
tags question: http://stackoverflow.com/q/23606960

http://stackoverflow.com/comment/36201271
has text: That is an interesting idea and would seem to accomplish what I want. Do you know of a slick way to build this file--to create a large image from a bunch of little ones?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23586702

http://stackoverflow.com/a/23527676
score: 2
answers question: http://stackoverflow.com/q/23526078
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36091732
upvote count: 2
has body: Both statements may be one line after another but they are not executed at the same time. &lt;c:if&gt; is a JSTL-Tag which is executed during view build time. The other expression will be wrapped in a &lt;h:outputText&gt; which will be executed during view render time. And I guess the service will be created in between. To solve your problem you could replace the &lt;c:if&gt; with &lt;ui:fragment rendered="#{serviceUiDescriptions.isLinkInDescriptionForCheckbox(service)}"&gt; or replace the &lt;span&gt; element with &lt;h:panelGroup styleClass="smallText" rendered="#{serviceUiDescriptions.isLinkInDescriptionForCheckbox(service)}"&gt; (without the &lt;c:if&gt;). See also: JSTL in JSF2 Facelets… makes sense? JavaServer Faces (JSF) - ui:repeat not showing new elements
accepted answer of: http://stackoverflow.com/q/23526078

http://stackoverflow.com/q/23518193
has comment: http://stackoverflow.com/comment/36107495
tagged with: spring
score: 2
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/36106930
type: UnansweredQuestion
has body: I am trying to create auditing mechanism using Spring aop and custom annotations. For some reason in my unit testing spring doesn't trigger my AOP endpoint. Custom annotation: package com.mycompany.cismanager.annotations; import com.mycompany.cismanager.aspect.AuditingAspect; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created by idanf on 04/05/2014. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD,ElementType.TYPE}) public @interface Audit { AuditingAspect.ActionAuditType auditType(); } My Aspect class: package com.mycompany.cismanager.aspect; @Aspect public class AuditingAspect { private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(AuditingAspect.class); public enum ActionAuditType { EXTERNAL_USER_REGISTRATION("Register external user"), EXTERNAL_USER_MODIFICATION("Modify external user"); private String mDescription; private ActionAuditType(String aDescription) { mDescription = aDescription; } public String getDescription() { return mDescription; } public void setDescription(String aDescription) { mDescription = aDescription; } } @Before(value = "execution(@com.mycompany.cismanager.annotations.Audit * *(..)) &amp;&amp; @annotation(audit)", argNames = "audit") public void logTheAuditActivity(JoinPoint aPoint, Audit audit) { // String userName = getUserName(); logger.info("Parms Auditing User Name: " + audit.auditType().getDescription()); // mlogger.info("auditType:" + parmsAudit.auditType().getDescription()); String arguments = getArgs(aPoint.getArgs()); logger.debug("arguments=" + arguments); // if (arguments.length() &gt; 0) { // mlogger.info("args-" + arguments); // } } private String getArgs(Object[] args) { String arguments = ""; int argCount = 0; for (Object object : args) { if (argCount &gt; 0) { arguments += ", "; } arguments += "arg[" + ++argCount + "]=" + "[" + object + "]"; } return argume…
has title: Spring AOP and custom annotations not working
tagged with: annotations
has comment: http://stackoverflow.com/comment/36072537
tagged with: java
tagged with: aop
type: Question
upvote count: 2
tagged with: aspectj
favorite count: 0
has comment: http://stackoverflow.com/comment/50210368

http://stackoverflow.com/q/23500709
has answer: http://stackoverflow.com/a/23500829
downvote count: 4
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36040378
type: Question
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36040302
has title: Object Type Assigned to Class
has comment: http://stackoverflow.com/comment/36040309
has comment: http://stackoverflow.com/comment/36040418
type: UnansweredQuestion
has body: Object o = getRectangle(); if(o instanceof Rectangle){ Rectangle r = (Rectangle) o; } In the event that getRectangle() returns a Rectangle (Rectangle of which is a class in my project), would I be able to assign Rectangle to the object like so?
has comment: http://stackoverflow.com/comment/36040281
score: -4

http://stackoverflow.com/q/23454635
tagged with: spring-mvc
score: 0
tagged with: java
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23515656
has comment: http://stackoverflow.com/comment/35956782
has body: I'm making a spring web app with i18n support. Right now the way the app works is that if there is a language defined in the URL parameter it'll use that, and if the parameter doesn't exist or is empty it will use the default. However I'm not satisfied with having the parameter there and I'm wondering if there's a way I can store the locale in session so it's behind the scenes and persists over all pages in the web app(because now if there is no locale parameter in the URL it'll use the defaultLocale). My current configuration is: applicationConfig.xml ... <property name="defaultLocale" value="hr" /> <mvc:interceptors> <property name="paramName" value="locale" /> </mvc:interceptors>
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23515656
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/35959508
tagged with: spring
has title: Spring MVC 3 i18n, how to store locale in session instead of URL parameter?
answer count: 1
has comment: http://stackoverflow.com/comment/35957113
tagged with: internationalization

http://stackoverflow.com/a/23538003
has comment: http://stackoverflow.com/comment/36111130
has body: JSF is basically an MVC framework focused in the view layer. When comparing it with Spring, it could be an equivalent to Spring MVC, but never to the whole Spring framework, which has much more functions. For your question of who manages the dependency injection, the own JSF framework used to do that, for me, as an example, I'm using Tomcat which is just a servlet container, so I use JSF for that work (this means I can only inject other managed beans and not a Service or a DAO). In other cases, for JavaEE servers as JBoss or Glassfish, the server itself has an embeded container (which acts like the Spring framework) so you could delegate the injection to its CDI implementation. Finally you tell about JSF being an Spring replacement. As I've said before, this makes no sense. JSF is a part of JavaEE specification and it's being oriented to be used with CDI injections. Spring MVC, being part of the Spring framework, could be the best choice if you manage your application with Spring instead of with a JavaEE container, although you could also use JSF instead of it. Anyway, remember there's always the discussion of going with Spring or JavaEE. The first one, being a non-standard, offers a faster support and improvement releasing. On the other hand, JavaEE follows the Java specification, with all the benefits of that. See also: Spring 3.0 vs Java EE 6.0 Using JSF as view technology of Spring MVC
has comment: http://stackoverflow.com/comment/36110436
has comment: http://stackoverflow.com/comment/36110594
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23537657
answers question: http://stackoverflow.com/q/23537657
has comment: http://stackoverflow.com/comment/36110916
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36247867
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23609955
type: QuestionComment
has text: What's the problem you meet?

http://stackoverflow.com/comment/35952980
comment on: http://stackoverflow.com/q/23453876
has text: You have quite a few alert debuggers. How far does the code get through those? Do you get a response from the server? Or does it hang before then? I suspect an issue with contentType: "application/x-www-form-urlencoded"...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36239079
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23603069
has text: My input is nothing but the values in arraylist of arraylist same as I mensioned in my question. Only change happening is there will be more number of value some time. Why I can't put my code is,if I'm putting it means I have to explain it to you and making you understand that will be complicated
score: 0

http://stackoverflow.com/q/23526240
has answer: http://stackoverflow.com/a/23526602
tagged with: java
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/23526602
tagged with: rad
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36088545
accepted answer: http://stackoverflow.com/a/23527232
favorite count: 0
has body: I am trying to do a search and replace in eclipse on the imports in my java file but I cant get the search to match the imports I want. In short I want to match all import statements except ones that end with a particular string. so far I have ^import\s.*[^{STRINGTEXT}];$ but this does not return the results I need. I have tried using related expressions from other questions on this site but none seem to work...I would guess that this is a special case. Any help would be appreciated
tagged with: regex
has comment: http://stackoverflow.com/comment/36088822
type: AnsweredQuestion
score: 2
upvote count: 2
has title: regular expression to match all java imports except one with a certain ending
has comment: http://stackoverflow.com/comment/36088684
type: Question
has answer: http://stackoverflow.com/a/23527232
has comment: http://stackoverflow.com/comment/36088472

http://stackoverflow.com/comment/36448616
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23511755
has text: Which part of programming in java do you want to teach your players? I wouldn't recommend trying to implement a full ide in your game. Maybe you can think of a solution that does not require you to support full programs and the complete language. (Not implementing a full ide is especially important since none of your players would eventually use your game as their primary coding environment)
score: 0

http://stackoverflow.com/q/23594864
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
score: -3
linked to: http://stackoverflow.com/q/23583848
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36216118
has answer: http://stackoverflow.com/a/23595053
type: Question
has body: Just when I thought I figured it out how threads work in Java, I was wrong.I want this server to listen for clients but at the same time allow me to input text on the console. public class MultiThreadChatServerSync implements Runnable{ private static ServerSocket serverSocket = null; private static Socket clientSocket = null; private static final int maxClientsCount = 10; private static final clientThread[] threads = new clientThread[maxClientsCount]; public static void main(String args[]) { int portNumber = 2222; if (args.length &lt; 1) { System.out.println("Usage&lt;portNumber&gt;\n"); } else { portNumber = Integer.valueOf(args[0]).intValue(); } try { serverSocket = new ServerSocket(portNumber); } catch (IOException e) { System.out.println(e); } //I thought this was the answer and it would run in the backround (new Thread(new MultiThreadChatServerSync())).start(); } public void run() { while (true) { try { clientSocket = serverSocket.accept(); int i = 0; for (i = 0; i &lt; maxClientsCount; i++) { if (threads[i] == null) { (threads[i] = new clientThread(clientSocket, threads)).start(); break; } } if (i == maxClientsCount) { PrintStream os = new PrintStream(clientSocket.getOutputStream()); os.println("Server too busy. Try later."); os.close(); clientSocket.close(); } } catch (IOException e) { System.out.println(e); } } } } Please.What am I missing?
upvote count: 0
has comment: http://stackoverflow.com/comment/36216196
duplicate of: http://stackoverflow.com/q/23583848
answer count: 1
has title: Threads and Servers in Java

http://stackoverflow.com/comment/36049695
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23505572
score: 0
has text: What a rookie mistake. Thanks for the help! :D

http://stackoverflow.com/q/23602220
has answer: http://stackoverflow.com/a/23602272
has answer: http://stackoverflow.com/a/23602253
tagged with: objectoutputstream
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23602272
accepted answer: http://stackoverflow.com/a/23602253
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36229933
has comment: http://stackoverflow.com/comment/36229932
has title: Java: what file extension should I use when writing objects with ObjectOutputStream
score: 4
upvote count: 4
answer count: 3
downvote count: 0
has body: The API shows .tmp, my text book uses .dat and I've seen .ser Does it matter? I'm writing an arraylist of objects
favorite count: 0
has answer: http://stackoverflow.com/a/23602650

http://stackoverflow.com/q/23471051
has answer: http://stackoverflow.com/a/32374909
tagged with: sonarqube
score: 0
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23471215
linked to: http://stackoverflow.com/q/16903602
has body: I have refered : Security - Array is stored directly. My code is as public IndexBlockAdapter(String[] itemStr) { if(itemStr == null) { this.itemStr = new String[0]; } else { this.itemStr = Arrays.copyOf(itemStr, itemStr.length); } } But Sonar still picks it up and complains about "Array is stored directly", despite making a copy. I am very confused. Any help is appreciated!
tagged with: java
type: Question
has title: The user-supplied array is stored directly
tagged with: arrays

http://stackoverflow.com/comment/35985427
has text: **Of course they aren't available.** Don't you think such information shouldn't be available to untrusted code?
score: 1
comment on: http://stackoverflow.com/q/23471516
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23529237
has body: I'm using inheritance to describe my model on JPA with hibernate, I have this classes: @Entity @Table(name = "evento") @Inheritance(strategy = InheritanceType.JOINED) public class Evento implements Serializable { @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "id") @Id private int id; @Column(name = "numero") private String numeroEvento; And this child class: @Entity @Table(name = "evento_sesion") @PrimaryKeyJoinColumn(name = "idevento", referencedColumnName = "id") public class EventoSesion extends Evento implements Serializable { @Column(name = "objeto") private String objeto; ... The problem is when I try to do a "eventoFacade.remove(e)" (e is an instance of an existent object in DB) I get this error: Caused by: javax.persistence.PersistenceException: org.hibernate.WrongClassException: Object with id: null was not of the specified subclass: entidades.Evento (class of the given object did not match class of persistent copy) Somebody can help me or give me a clue? Thanks :)
has answer: http://stackoverflow.com/a/26523338
has comment: http://stackoverflow.com/comment/41674260
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
tagged with: jpa
downvote count: 0
has title: Hibernate : org.hibernate.WrongClassException when I try to remove an object
favorite count: 0

http://stackoverflow.com/comment/36191457
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23581652
type: Comment
has text: Sounds quite strange to me. According to the `Accept` header in the request the only valid response must be of content-type `application/json` so Spring has to use Jackson for the answer and Jackson should produce valid JSON. In this case the response is simply invalid. It has content-type `application/json` but was not converted to JSON.

http://stackoverflow.com/comment/36205967
has text: You want to eliminate the coverage data from "toString" methods because... it takes too much runtime space? disk space? display space? Why can't you just ignore it in the display?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23578822

http://stackoverflow.com/q/23453224
tagged with: client-server
score: 2
has comment: http://stackoverflow.com/comment/35951743
tagged with: android
has answer: http://stackoverflow.com/a/23453295
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/14250989
tagged with: web-services
has title: what is the best way to communicate with a server in android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23453295
has body: I'm writing an app for android in Java, and a server also in Java. I'm looking for a way to communicate with the server like a web service. I want to be able to call functions written in the server from the client.
upvote count: 3
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/comment/36002298
has text: Type is Long in this case
score: 0
comment on: http://stackoverflow.com/q/23480150
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23491110
tagged with: oracle11g
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36021977
tagged with: java
has answer: http://stackoverflow.com/a/23491245
score: -1
type: Question
tagged with: sql
answer count: 1
favorite count: 0
has body: I have this code in a scriptlet to connect to a Oracle 11g database. This sits in a asp and will return data from the database (Please ignore the fact scriptlets are used and MVC pattern has been ignored, I can't do anything about this) When I try to connect to the database and run a query I get this error java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended. Could someone please review the code and see what I am doing wrong? Many Thanks Driver myDriver = new oracle.jdbc.driver.OracleDriver(); DriverManager.registerDriver(myDriver); Connection conn = null; Statement statement = null; ResultSet resultSet = null; String DBURL = "jdbc:oracle:thin:@localhost:1521:aaa"; String DBUSER = "user"; String DBPASSWORD = "password"; StringBuffer sql = new StringBuffer(); sql.append("select 'aa', count(*) from queue where priority &lt;= 3 "); sql.append("union "); sql.append("select 'bb', count(*) from queue where priority = 4 "); sql.append("union "); sql.append("select 'cc', count(*) from ccrqueue "); sql.append("union "); sql.append("select 'dd', count(*) from ddqueue "); sql.append("union "); sql.append("select 'ee', count(*) from eequeue "); sql.append("union "); sql.append("select 'ff', count(*) from ffqueue "); sql.append("union "); sql.append("select 'gg', count(*) from ggqueue where id is null "); sql.append("union "); sql.append("select 'hh', count(*) from hhqueue" ); sql.append("union" ); sql.append("select 'ii', count(*) from iiqueue" ); sql.append("union" ); sql.append("select 'jj', count(*) from jjqueue where queuetype = ERROR" ); sql.append("union" ); sql.append("select 'kk', count(*) from kkqueue" ); sql.append("order by 2 desc" ); try { conn = DriverManager.getConnection(DBURL, DBUSER, DBPASSWORD); statement = conn.createStatement(); resultSet = statement.executeQuery(sql.toString()); out.println(resultSet); } catch (SQLException e) { e.printStackTrace(); } finally { try { if (conn != null) { conn.close(); } } catch (SQLException e) { e.pri…
tagged with: jdbc
has title: ORA-00933: SQL command not properly ended in scriptlet
upvote count: 0
accepted answer: http://stackoverflow.com/a/23491245

http://stackoverflow.com/a/23494708
accepted answer of: http://stackoverflow.com/q/23493578
answers question: http://stackoverflow.com/q/23493578
has comment: http://stackoverflow.com/comment/136882427
type: AcceptedAnswer
downvote count: 0
upvote count: 8
has body: Java annotations take compile time constants, which are defined as final primitives or strings. SO change your definition to public static final int VARIANCE_TIME = 10; public static final long FIXED_DELAY = ((VARIANCE_TIME * 60 * 1000) / 2) @Scheduled(fixedDelay = FIXED_DELAY) public void runDynamic()
type: Answer
score: 8

http://stackoverflow.com/q/23478047
has comment: http://stackoverflow.com/comment/36002895
has comment: http://stackoverflow.com/comment/36000435
favorite count: 0
has comment: http://stackoverflow.com/comment/36000713
tagged with: android
has comment: http://stackoverflow.com/comment/36002730
has comment: http://stackoverflow.com/comment/36003859
tagged with: php
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: mysql
linked to: http://stackoverflow.com/q/2471935
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I'm trying to display an image into imageview in android from php mysql..I'm using JSON to parse the image.. nom | couleur | image ------------------------------------------------------------------- passat | gris |http://10.0.2.2/model/image/passat.jpg My php code: $result = mysql_query("SELECT * FROM info WHERE nom = '$nom'"); if (!empty($result)) { // check for empty result if (mysql_num_rows($result) &gt; 0) { $result = mysql_fetch_array($result); $info = array(); $info["nom"] = $result["nom"]; $info["couleur"] = $result["couleur"]; $info["prix"] = $result["prix"]; $info["image"] = base64_encode($result["image"]); // success $response["success"] = 1; // user node $response["info"] = array(); array_push($response["info"], $info); // echoing JSON response echo json_encode($response); } } and here is my Info.java code: package com.example.gridview2; import java.util.ArrayList; import java.util.List; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.util.Base64; import android.util.Log; import android.widget.ImageView; import android.widget.TextView; public class Info extends Activity { TextView txt1,txt2,txt3; ImageView image; JSONParser jParser = new JSONParser(); private static final String url_product_detials = "http://10.0.2.2/model/detail.php"; private static final String TAG_SUCCESS = "success"; private static final String TAG_PRODUCT = "info"; private static final String TAG_NAME = "nom"; private static final String TAG_COLOR = "couleur"; private static final String TAG_PRICE = "prix"; private static final String TAG_IMAGE = "image"; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main7); process(); } priva…
has comment: http://stackoverflow.com/comment/36000330
type: Question
has title: Displaying Image from PHP MySQL into imageview in Android using Json
has comment: http://stackoverflow.com/comment/36000790
upvote count: 1
has comment: http://stackoverflow.com/comment/36000575

http://stackoverflow.com/q/23516631
tagged with: sql-server-2008-r2
favorite count: 0
has body: I am using jTDS to make ssl connection to SQL Server 2008 database in my java application which is running on JRE 1.8. When I configure ssl=request property in connection URL the connection just hangs in JRE 1.8. However the same thing works perfectly fine in JRE 1.7. I tried doing same thing using Microsoft jdbc driver with encrypt=true property and it works perfectly fine in both JRE 1.7 and 1.8. Any idea why this must be happening? I am not able to understand whether this is a bug with jTDS or Java 8 or SQL Server 2008.
tagged with: jdbc
has answer: http://stackoverflow.com/a/23673452
type: UnansweredQuestion
tagged with: java
tagged with: jtds
upvote count: 1
has comment: http://stackoverflow.com/comment/36329207
type: Question
has title: jTDS ssl connection hangs with JRE 1.8
tagged with: ssl
has comment: http://stackoverflow.com/comment/36373232
has comment: http://stackoverflow.com/comment/36371764
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/36094119
comment on: http://stackoverflow.com/a/23525674
has text: -1: "In practice, if the AES key is not accessible and the data in the cookie has some semantic meaning, you would likely be able to detect modifications to the encrypted cookie as it would decrypt to something meaningless." - Not true if AES is used in CTR mode and very much in danger of a padding oracle attack in case of CBC (real world example: http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx ).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23522283
has comment: http://stackoverflow.com/comment/36088369
score: 0
has comment: http://stackoverflow.com/comment/36081723
has body: After adding the class variable make sure both the sending and the receiving sides have the new version of this class they are serializing/deserializing. That should fix your issue. Of course, also regenerate the disk/serialized data.
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23522228
has comment: http://stackoverflow.com/comment/36151086

http://stackoverflow.com/q/23567123
tagged with: cookies
tagged with: java
tagged with: selenium
type: Question
has answer: http://stackoverflow.com/a/23579360
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Multiple domain cookies handling using selenium webdriver
has body: I save all cookies for gmail login. I use this cookies when I login again in gmail I load this cookies file but I can not login with this cookies get exception like "Exception in thread "main" org.openqa.selenium.InvalidCookieDomainException: You may only set cookies for the current domain" My code is look like: File f = new File("c:\\browser.data"); WebDriver driver = new FirefoxDriver(fb, fp); driver.get("https://accounts.google.com"); driver.findElement(By.name("Email")).sendKeys("myusername"); driver.findElement(By.name("Passwd")).sendKeys("mypassword"); driver.findElement(By.name("PersistentCookie")).click(); driver.findElement(By.name("signIn")).submit(); Thread.sleep(20000); try { f.delete(); f.createNewFile(); try (FileWriter fos = new FileWriter(f); BufferedWriter bos = new BufferedWriter(fos)) { for (Cookie ck : driver.manage().getCookies()) { bos.write((ck.getName() + ";" + ck.getValue() + ";" + ck.getDomain() + ";" + ck.getPath() + ";" + ck.getExpiry() + ";" + ck.isSecure())); bos.newLine(); } bos.flush(); } } catch (IOException ex) { ex.printStackTrace(); } driver.findElement(By.cssSelector(".gb_V.gbii")).click(); driver.findElement(By.xpath(".//*[@id='gb_71']")).click(); driver.close(); WebDriver driver1 = new FirefoxDriver(pf); driver1.get("https://accounts.google.com"); FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String line; while ((line = br.readLine()) != null) { StringTokenizer str = new StringTokenizer(line, ";"); while (str.hasMoreTokens()) { String name = str.nextToken(); String value = str.nextToken(); String domain = str.nextToken(); String path = str.nextToken(); Date expiry = null; String dt; if (!(dt=str.nextToken()).equals("null")) { expiry =new SimpleDateFormat("EEE MMM d H:m:s z y").parse(dt); } boolean isSecure = Boolean.valueOf(str.nextToken()).booleanValue(); Cookie ck1 = new Cookie(name, value, domain, path, expiry, isSecure); System.out.println(domain); if (domain.equalsIgnoreCase(".google.com…
tagged with: selenium-webdriver
score: 2

http://stackoverflow.com/comment/36181606
comment on: http://stackoverflow.com/q/23576079
score: 0
has text: It shows that there are no syntax errors but as soon as I click on Compile, a small window pops up with a message : " Warnings from last compilation F:\Desktop\PoochyPavy.java uses unchecked or unsafe operations. Recompile with -Xlint:unchecked for details."
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23511547
tagged with: android
tagged with: google-cloud-messaging
answer count: 1
type: UnansweredQuestion
tagged with: php
tagged with: java
has answer: http://stackoverflow.com/a/23513269
has body: I am new to Android GCM service I am sending the message with PHP i got as a response {"multicast_id":5035179847798608085,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1399447523487490%5695579af9fd7ecd"}]} it look like it dose send it but not receiving in on my android app here is my PHP code : $registrationId="APA91bHx1bvBURGF4YSMDWGd5fPb33YtWfwEDspbsT-ejAYR0K_rao7NCSUtki7bP_1BvoCWn8fNpqAIPSjchvcy2JGtdJPvVC85cU9fhFoiE-Cos7PyhUhqIkpXznrD2rNhg9sVlWF2J5c9vSLLHP0LJDq5Q5M29dnUGzaROWcGBqsw3673VKM"; // API access key from Google API's Console // Message to send $message = "the test message"; $tickerText = "ticker text message"; $contentTitle = "content title"; $contentText = "content body"; //$registrationId = 'DEVICE_ID'; $apiKey = "AIzaSyBx6hRnATNJGeYqeF4fzZLrNriuV2TRacI"; $response = sendNotification( $apiKey, $registrationId, array('message' =&gt; $message, 'tickerText' =&gt; $tickerText, 'contentTitle' =&gt; $contentTitle, "contentText" =&gt; $contentText) ); echo $response; $data = array( 'data'=&gt;$messageData, 'registration_ids' =&gt; array($registrationIds) ); var_dump( $headers); var_dump ($data); $ch = curl_init(); $data= json_encode($data); curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); curl_setopt( $ch, CURLOPT_URL, "https://android.googleapis.com/gcm/send" ); curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 0 ); curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, 0 ); curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch, CURLOPT_POSTFIELDS, $data ); var_dump ($data); $response = curl_exec($ch); curl_close($ch); return $response; } Need help
type: Question
has title: Android GCM messages sending Not receiving
score: 0

http://stackoverflow.com/q/23546779
has comment: http://stackoverflow.com/comment/36247279
answer count: 0
has comment: http://stackoverflow.com/comment/36238121
tagged with: java
tagged with: ivy
has comment: http://stackoverflow.com/comment/36247503
type: Question
has comment: http://stackoverflow.com/comment/36132292
has body: My company runs an internal Ivy repository over a NAS. There we put all the dependencies for our projects. A few days ago, the repo has been rebuilt completely from scratch, using a combination of Java code and calls to Ant task ivy-install. I personally designed and performed the rebuilding, but faced an important issue. While I used mvrepository.com as reference for importing common open source projects (e.g. Spring, Hibernate), often packages were available in not-widely-known Maven repositories I had to Google for. Every time (e.g. with hibernate-spatial) I found a package belonging to an "unknown" Maven source I had to some manual work by registering the remote source into ivy-settings.xml and manually run again ivy-install. This made me think: does it even exist a tool that graphically (e.g. web interface) helps Ivy administrator search and download to local repository artifacts from multiple remote sources (registered by user)? Like if I type the &lt;dependency&gt; tag, or the org, name and rev attributes and it lists available sources. When I need to download a package to local repo, simply click and it gets published.
tagged with: ant
linked to: http://stackoverflow.com/q/7362453
score: 0
has title: Managing and importing Ivy artifacts from global Maven repositories
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/comment/36205504
has text: If you use a getter, then you satisfy condition 2, so yes you'd load `Foo`. But OP's code as posted would never result in `random` being initialized.
comment on: http://stackoverflow.com/a/23589072
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23471415
downvote count: 0
accepted answer: http://stackoverflow.com/a/26798414
has body: Dear friends I'm new of vaadin and I would want to use wizard add-on in my vaadin application. Now my trouble is that I don't have a fix number of steps. I try to explain in a better way, I have the following optionGroup Then when i choose fixed size I don't have a problem because I can do this // instantiate the Wizard Wizard wizard = new Wizard(); // add some steps that implement the WizardStep interface wizard.addStep(new FirstStep()); wizard.addStep(new SecondStep()); wizard.addStep(new ThirdStep()); wizard.addStep(new FourthStep()); while when i choose the dynamic size, I don't know the exact number of step, but is the user that while running the wizard can add additional step or not. Is this possible with the wizard add-on?
has comment: http://stackoverflow.com/comment/36019726
answer count: 1
favorite count: 0
has title: Using Wizard addon
upvote count: 2
has comment: http://stackoverflow.com/comment/35995754
tagged with: vaadin7
has comment: http://stackoverflow.com/comment/35989295
score: 2
has answer: http://stackoverflow.com/a/26798414
type: AnsweredQuestion
tagged with: java
tagged with: vaadin
type: Question
has comment: http://stackoverflow.com/comment/36016991
has comment: http://stackoverflow.com/comment/36005041

http://stackoverflow.com/a/23543524
has body: As stated in the Javadoc for System.console(), it can return null if there is no console allocated for the JVM. In fact this is often the case. So you can't rely on it being non-null. When running your app from Eclipse, you can configure it to allocate a console. Open the launch configuration for your app, go to the Common tab, and near the bottom you'll find a checkbox option, "Allocate console (necessary for input)." See @Jean-Baptiste's answer for hiding the user's typing in the console. But keep in mind that your app must gracefully deal with null from Systemconsole().
answers question: http://stackoverflow.com/q/23541565
type: Answer
score: 0

http://stackoverflow.com/comment/35966022
score: 0
has text: of course not. mvn clean install fixed the issue.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23460662

http://stackoverflow.com/q/23599720
accepted answer: http://stackoverflow.com/a/23601598
has body: I ran into a little snag with the concrete implementation of strategy components using generic types. Wondering if anyone can point me in the right direction with an example? Here is what I am working towards, but I get caught up when I declare the decode method as it expcects a List when I create the ArrayList... Not a surprise. public class CsvFormat&lt;T,T1&gt; implements FormatStrategy&lt;T,T1&gt; { public CsvFormat(boolean header) { setHeader(header); @Override public final T decode(T1 csvData) { csvData = new ArrayList(); //ERROR**** List&lt;Map&lt;String, String&gt;&gt; decodedData = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); //turn collection into an array of maps if (this.hasHeader()) { decodeDataWithHeader(csvData, decodedData); } else { decodeDataNoHeader(csvData, decodedData); } return decodedData; } private void decodeDataNoHeader(List&lt;String&gt; csvData, List&lt;Map&lt;String, String&gt;&gt; records) { int recordCount = FIRST_IDX; List&lt;String&gt; fields = null; //= Arrays.asList(csvData.get(recordCount).split(DELIM)); //turn line into a list, first record for (String data : csvData) { //for each unformatted string int delimIndex = FIRST_IDX; //reset delim fields = Arrays.asList(data.split(DELIM));//after header, start mapping records.add(new LinkedHashMap&lt;String, String&gt;()); //make a new map recordCount++; for (String field : fields) { final String KEY_ID = "Column-" + (delimIndex + RECORD_BUFFER); records.get(records.size() - RECORD_BUFFER).put(KEY_ID, field); delimIndex++; } } } Here is what I had to start with The only way I can think of so far to achieve the above without error is to overload the the decode methods based on what object they are passed.. public class CsvFormat implements FormatStrategy&lt; List&lt;Map&lt;String, String&gt;&gt;, List&lt;String&gt;&gt; { public CsvFormat(boolean header) { setHeader(header); } @Override public final List&lt;Map&lt;String, String&gt;&gt; decode(List&lt;String&gt; csvData) { List&lt;Ma…
type: AnsweredQuestion
tagged with: java
tagged with: strategy-pattern
type: Question
possible better answer: http://stackoverflow.com/a/23603209
has answer: http://stackoverflow.com/a/23601598
has answer: http://stackoverflow.com/a/23603209
score: 0
answer count: 2
has title: Generics and concrete implementations of strategy components
tagged with: generics

http://stackoverflow.com/comment/36243911
type: Comment
type: QuestionComment
has text: check out the [link](http://stackoverflow.com/questions/22678833/splitting-of-string-for-whitespace-and)
comment on: http://stackoverflow.com/q/23609703
score: 0

http://stackoverflow.com/comment/35952584
has text: @MartinStrejc: That *might* be an explanation for omitting `default synchronized`, yet not necessarily for `static synchronized`, although I would accept that the latter might've been omitted for consistency reasons.
comment on: http://stackoverflow.com/q/23453568
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36203232
comment on: http://stackoverflow.com/q/23587821
has text: The code which converts Decimal to Binary is the one posted (The Hexadecimal to is quite precise, and yes, I've tested it). As per the rest of your comment, I agree with you, my issue is how should I do it. I remember a bit from digital systems logic that you can subtract something from a binary number to get it's reverse, but I honest to god cannot remember what it was exactly (I am very tired)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/54866311
answers question: http://stackoverflow.com/q/23454952
has body: An Optional has similar semantics to an unmodifiable instance of the Iterator design pattern: it might or might not refer to an object (as given by isPresent()) it can be dereferenced (using get()) if it does refer to an object but it can not be advanced to the next position in the sequence (it has no next() method). Therefore consider returning or passing an Optional in contexts where you might previously have considered using a Java Iterator.
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/23513684
has body: My android app sometimes throws this exception: java.lang.IllegalArgumentException: provider=network at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2517) at android.app.ActivityThread.access$1900(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1302) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4784) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:845) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.IllegalArgumentException: provider=network at android.os.Parcel.readException(Parcel.java:1429) at android.os.Parcel.readException(Parcel.java:1379) at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:657) at android.location.LocationManager._requestLocationUpdates(LocationManager.java:686) at android.location.LocationManager.requestLocationUpdates(LocationManager.java:508) In this line: mLocationManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 0, 0, mNetlocListener); What have I done wrong? I use the network enum provider.
score: 0
upvote count: 1
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/36063951
has answer: http://stackoverflow.com/a/23513781
accepted answer: http://stackoverflow.com/a/23513781
favorite count: 0
has comment: http://stackoverflow.com/comment/36063988
tagged with: android
type: AnsweredQuestion
tagged with: geolocation
tagged with: android-intent
has comment: http://stackoverflow.com/comment/36063994
type: Question
has comment: http://stackoverflow.com/comment/36063921
linked to: http://stackoverflow.com/q/9990129
tagged with: java
has title: java.lang.IllegalArgumentException: provider=network

http://stackoverflow.com/a/23521572
type: Answer
answers question: http://stackoverflow.com/q/23521160
score: 0
has body: date = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy", Locale.ENGLISH) .parse(string) Your time format doesn't match with the string. You missed the z in your format where it refers to the timezone. Check out this link for more detailsSimpleDateFormat

http://stackoverflow.com/q/23520703
tagged with: lambda
tagged with: java-8
score: 2
has answer: http://stackoverflow.com/a/23520959
has comment: http://stackoverflow.com/comment/36077518
tagged with: java
has title: Squaring even numbers using lambda expressions
has answer: http://stackoverflow.com/a/78772324
has body: I'm trying to take a list of numbers, filter out the even numbers and then square those even numbers so that the even numbers in the original list are squared. Here's my code: ArrayList&lt;Long&gt; nums2 = new ArrayList&lt;Long&gt;(); for(long i = 0; i &lt; 100000; i++) nums2.add(i); nums2.stream().filter(p -&gt; p%2 == 0).forEach(p -&gt; p = (long)Math.pow(p, 2)); Tried a couple other things, but this is where I'm at so far
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/36077710
has answer: http://stackoverflow.com/a/23521048
has comment: http://stackoverflow.com/comment/36077336
has answer: http://stackoverflow.com/a/74533172
has comment: http://stackoverflow.com/comment/36077630
favorite count: 0
linked to: http://stackoverflow.com/q/14830313
has answer: http://stackoverflow.com/a/42699963
downvote count: 0
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36077486

http://stackoverflow.com/comment/36080008
score: 0
type: AnswerComment
type: Comment
has text: I edited my question to my full code. I need to extend from activity to do some actions. U didnt really understand what did you said.
comment on: http://stackoverflow.com/a/23521583

language-agnostic
tags question: http://stackoverflow.com/q/23550028
tag name: language-agnostic
type: Tag

http://stackoverflow.com/comment/36045423
type: QuestionComment
has text: Please post your real code. I think I know what your problem is, but I can't be sure because this is just pseudocode.
score: 1
comment on: http://stackoverflow.com/q/23503346
type: Comment

http://stackoverflow.com/q/23538994
has comment: http://stackoverflow.com/comment/36114698
has comment: http://stackoverflow.com/comment/36114266
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
tagged with: java
has body: I'm completely newbie to Stored Procedure. Got a requirement like the Input type to be passed is of XML datatype to DB2 stored procedure and output as ResultSet. //Stored Procedure: CREATE PROCEDURE GetGrpInfo (IN inpdoc XML) DYNAMIC RESULT SETS 1 P1: BEGIN Declare tin VARCHAR(9); Declare max_records INT; Declare start_index INT; DECLARE rcount INT; DECLARE total_count INT; .......... .......... //Java Code: private final static String myXML = "inpdoc"; private final static String SpOutput = "RESULT"; @Autowired public void setDataSource(DataSource db2DataSource) { String procedureName = "schemaname.GetGrpInfo"; this.db2DataSource = db2DataSource; this.jdbcCall = new SimpleJdbcCall(this.db2DataSource) .withProcedureName(procedureName) .withoutProcedureColumnMetaDataAccess() .useInParameterNames(myXML) .declareParameters(new SqlParameter(myXML, Types.SQLXML)) .returningResultSet("GroupInfo", new BeanPropertyRowMapper&lt;GroupInfo&gt;(){ public GroupInfo mapRow(ResultSet rs, int rowNum) throws SQLException { GroupInfo gInfo = new GroupInfo(); gInfo.setGroupId(rs.getString("GroupID")); gInfo.setGroupName(rs.getString("GroupName")); gInfo.setGroupTaxId(rs.getString("GroupTIN")); return gInfo; } }); } String input1 = "&lt;Input&gt;&lt;TIN&gt;"+tin+"&lt;/TIN&gt;&lt;MaxRecords&gt;"+max_records+" &lt;/MaxRecords&gt;&lt;StartIndex&gt;"+start_index+"&lt;/StartIndex&gt;&lt;/Input&gt;"; SqlParameterSource in = new MapSqlParameterSource().addValue(myXML, input1); Map result = jdbcCall.execute(in); return (String)result.get("GroupInfo"); Not sure whether use of returningResultSet is good at here and also Types.SQLXML. Tried with various formats but not sure whether my approach is correct.
has comment: http://stackoverflow.com/comment/36125531
tagged with: db2-connect
type: Question
tagged with: stored-procedures
has comment: http://stackoverflow.com/comment/36333229
tagged with: db2
has title: Passing XML datatype as input from Java to DB2 stored Procedure
score: 0

http://stackoverflow.com/comment/36217556
has text: @arfbtwn: I see. When you wrote "what is the significance of the comment", I thought you were asking about the *purpose* of the *first* sentence (since it was explaining what already seemed obvious to you); I didn't realize you were asking about the *meaning* of the *second* sentence. I've updated my answer now; please let me know if it makes sense.
comment on: http://stackoverflow.com/a/23576442
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36210034
comment on: http://stackoverflow.com/a/23591492
has text: No dice thus far, I am using NetBeans by the way, if that makes any difference.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/36360652
has text: I think I figured out the issue - but don't have solution. In my app, I have to play short clips in a loop - each in new thread. The volume control works if I let a clip play in infinite loop from a thread - but not if multiple threads are launched. I may have to concat the loops in one file and launch one thread to be able to control the volume.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23590046

http://stackoverflow.com/comment/35993531
type: Comment
comment on: http://stackoverflow.com/a/23475673
type: AnswerComment
score: 0
has text: @AnubianNoob ah, sorry, I thought the case would apply after the division. I tried it on ideone and it worked (although it gave me `0.035`.)

http://stackoverflow.com/comment/36087387
type: Comment
type: AnswerComment
has text: Actually, cleaning up from the leave-behinds of having *ever* run something as privileged account can be a royal pain, and is a key reason not to do it.
score: 0
comment on: http://stackoverflow.com/a/23525539

finalize
type: Tag
tags question: http://stackoverflow.com/q/23534142
tag name: finalize

http://stackoverflow.com/comment/35979939
type: QuestionComment
has text: @Pramod PP - ok, but if I set modal = false, then JDialog go back under parent frame when I click on parent window. It should be always on top in scope of application (not on whole system).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23467700

http://stackoverflow.com/a/23483916
answers question: http://stackoverflow.com/q/23483899
type: AcceptedAnswer
type: Answer
has body: str.equals("\""); \ is used as an escape character to tell the compiler that the next character is to be interpreted literally. In this case, it causes the " to be interpreted as a character in the string instead of as a ending quotation mark. \" is used to represent ". To be safer with null strings, you can also do: "\"".equals(str); This will return false if str is null instead of throwing a NullPointerException.
downvote count: 0
score: 13
upvote count: 13
accepted answer of: http://stackoverflow.com/q/23483899

http://stackoverflow.com/comment/36196390
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23584278
has text: The thing about hashcodes is that it is supposed to be the same for each equal instance of your object. So only two exactly the same strings are guaranteed to give you the same hashcode. I have no idea what it is you're trying to do in your code though.
score: 0

http://stackoverflow.com/comment/36095918
type: AnswerComment
has text: remove the `eclim-completion.elc` file, and then the `(require 'cl)` should work.
type: Comment
comment on: http://stackoverflow.com/a/23518293
score: 0

http://stackoverflow.com/comment/36235937
type: QuestionComment
comment on: http://stackoverflow.com/q/23605379
score: 0
has text: In wich layout file are you declaring the UI components?
type: Comment

http://stackoverflow.com/q/23582761
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23582801
answer count: 1
accepted answer: http://stackoverflow.com/a/23582801
has title: Code to create database returning wrong value
has body: In my spring project, I have this code to create the database the application will use: int result = stmt.executeUpdate("CREATE DATABASE horario WITH OWNER "+usuario+";"); System.out.println("result = "+result); if(result &gt; 0) { System.out.println("calling_create_tables"); create_tables(maquina, usuario, senha); rs.close(); stmt.close(); conn.close(); return true; } The problem is, despite the database being created normally, the variable result is always receiving the value 0, what cause the non execution of code inside the if. Anyone knows why this happening? ps.: the full code for the class is this: https://github.com/klebermo/webapp_horario_livre/blob/master/src/com/horariolivre/service/InstallService.java
tagged with: jdbc
score: 0

http://stackoverflow.com/comment/36032396
type: Comment
has text: Can you share all code from the `Nodes` bean? Is there a node in the database with the id passed as `left` parameter?
comment on: http://stackoverflow.com/q/23494918
score: 0
type: QuestionComment

http://stackoverflow.com/q/23577482
answer count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/36184155
score: 0
has answer: http://stackoverflow.com/a/23577746
tagged with: java
possible better answer: http://stackoverflow.com/a/23577566
has comment: http://stackoverflow.com/comment/36184191
has answer: http://stackoverflow.com/a/23577566
has comment: http://stackoverflow.com/comment/36184221
tagged with: eclipse
has body: I am encountering errors when trying to use the constructor of my arrayAdapter for a listView. When I call it like this: ListArrayAdapter adapters = new ListArrayAdapter(this, R.layout.list_view_row_item, foodList); I get the error (in eclipse): the constructor ListArrayAdapter(Context, int, ArrayList&lt;ListItem&gt;) is undefined. This is the code for the arrayAdapter: import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import android.app.Activity; import android.app.LauncherActivity.ListItem; import android.content.Context; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ProgressBar; import android.widget.TextView; public class ListArrayAdapter extends ArrayAdapter&lt;ListItem&gt; { Context mContext; int layoutResourceId; ListItem data[] = null; private ProgressBar progressBar; private int progressStatus = 0; private TextView textView; private Handler handler = new Handler(); ArrayList&lt;ListItem&gt; foodList = new ArrayList&lt;ListItem&gt;(); public ListArrayAdapter(Context mContext, int layoutResourceId, ArrayList&lt;ListItem&gt; foodList) { super(mContext, layoutResourceId, foodList); this.layoutResourceId = layoutResourceId; this.mContext = mContext; this.foodList = foodList; } @Override public View getView(int position, View convertView, ViewGroup parent) { if(convertView==null){ // inflate the layout LayoutInflater inflater = ((Activity) mContext).getLayoutInflater(); convertView = inflater.inflate(layoutResourceId, parent, false); } return convertView; } The main part of my program: import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import android.app.Activity; import android.app.Fragment; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android…
has comment: http://stackoverflow.com/comment/36184263
tagged with: listview
has title: listView arrayAdapter errors
accepted answer: http://stackoverflow.com/a/23577746
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36184176
has comment: http://stackoverflow.com/comment/36184175
type: Question

http://stackoverflow.com/comment/36233084
score: 0
comment on: http://stackoverflow.com/q/23591709
type: QuestionComment
has text: maybe you forgot to release the music, when you stop it. wallmusic.release()
type: Comment

http://stackoverflow.com/comment/36011697
type: QuestionComment
score: 0
type: Comment
has text: I initially had emptyCount and fillCount is Integer objects and synchronized them but I went back on it. Will try AtomicIntegers
comment on: http://stackoverflow.com/q/23485160

http://stackoverflow.com/comment/35990507
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23474283
type: QuestionComment
has text: Please show what you have tried and where you're having a problem.

http://stackoverflow.com/comment/36203665
type: Comment
comment on: http://stackoverflow.com/a/23588009
has text: Thats not the problem. the problem is that the place that WoodCounter is being called from is seeing "int WoodCounter;" and then just going with that and not waiting to see the value added to it
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35957988
type: Comment
has text: @DanielSchulz - the point he is making is that you don't have to >>assign<< outside the if block. You can define it outside then assign to it inside. However, he has (maybe) forgotten about the definite assignment rule.
comment on: http://stackoverflow.com/a/23456406
score: 0
type: AnswerComment

http://stackoverflow.com/q/23598763
score: 0
tagged with: java
answer count: 3
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36223791
has answer: http://stackoverflow.com/a/23598793
has body: I have a string that I want to read line by line: "8688642986379252 Michael_Thompson 816 2500.0 8904000405634912 Barbara_Martin 8610835007621519 Charles_Jackson 1019 52800.0" It goes on on and on in that format. I tried separating it using for loops, charAt() and reducing the size of the string using substring() but I failed miserably. I'm sure it's something simple but I just can't get it. Any ideas?
type: AnsweredQuestion
tagged with: string
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/23598793
has title: How do I separate a string like this line by line?
possible better answer: http://stackoverflow.com/a/23598790
has answer: http://stackoverflow.com/a/23598774
has answer: http://stackoverflow.com/a/23598790

http://stackoverflow.com/q/23593433
type: Question
has comment: http://stackoverflow.com/comment/36253935
downvote count: 0
has comment: http://stackoverflow.com/comment/36241315
has comment: http://stackoverflow.com/comment/36253984
tagged with: android
has title: how to run (launch) recent task from recent task list from a android service?
tagged with: android-activity
favorite count: 0
has body: I am trying to launch last recent task from task list in android . Using ActivityManager to get list of tasks. This will get me task id,baseintent etc ActivityManager m = (ActivityManager)ChatHeadService.this.getSystemService(ACTIVITY_SERVICE); List recentTasks = m.getRecentTasks(2, ActivityManager.RECENT_WITH_EXCLUDED); this is the code i am using to get last . but when i run this its not switching . if(android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.HONEYCOMB) { final ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); am.moveTaskToFront(apps.id, ActivityManager.MOVE_TASK_WITH_HOME); } else { // API 10 and below (Gingerbread on down) Intent restartTaskIntent = new Intent(apps.baseIntent); if (restartTaskIntent != null) { restartTaskIntent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY); try { startActivity(restartTaskIntent); } catch (ActivityNotFoundException e) { Log.w("MyApp", "Unable to launch recent task", e); } } } This is also not working for me. I am looking for apps like this
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36241236
tagged with: android-intent
has comment: http://stackoverflow.com/comment/38856582
has comment: http://stackoverflow.com/comment/36255062
tagged with: java
tagged with: android-recents

http://stackoverflow.com/a/23531759
has comment: http://stackoverflow.com/comment/36099177
score: 0
has comment: http://stackoverflow.com/comment/36099132
type: Answer
has comment: http://stackoverflow.com/comment/36099026
has comment: http://stackoverflow.com/comment/36099130
has comment: http://stackoverflow.com/comment/36099309
answers question: http://stackoverflow.com/q/23531667
has body: import java.util.ArrayList; import java.util.Scanner; public class ArrayInput { public static ArrayList&lt;Integer&gt; input() { //This collect user CU and place in an ArrayList ArrayList&lt;Integer&gt; cus = new ArrayList&lt;&gt;(); Scanner input = new Scanner(System.in); int value; do { // do loop System.out.println("Enter a # total for a single item and then press enter. To quit type exit: "); value = input.nextInt(); if (value &lt; 0) { System.out.println("Error: must not be negative numbers: "); } } while(value &lt; 0); // loop as long as it's negative number System.out.println("Enter a CU total for another single class and then press enter. To quit type exit: "); cus.add(value); return cus; } This should keep prompting the user for the value as long as the number is negative. However I noted that your "Enter a CU total for another single class and then press enter. To quit type exit: " wouldn't work properly. Guess you haven't implement it yet? Things to note: this is not a main method. Therefore you shouldn't really get user to "continue to collect positive #.", however if that's what you really want you can use this loop method to keep asking the user. Also it would be better not to use Scanner to get input in this method. Instead get the input from the user in main method and call upon this method and passing in the input as an argument to add cus would be the right way of using methods.

http://stackoverflow.com/comment/36084641
comment on: http://stackoverflow.com/q/23523526
type: Comment
type: QuestionComment
has text: How do we even know if your data set is not really the problem ? For all we know, it could be a 10mb file and you are just creating too many objects in an infinite loop.
score: 0

http://stackoverflow.com/q/23533230
score: 0
has answer: http://stackoverflow.com/a/23536615
type: UnansweredQuestion
tagged with: spring
has body: In the below article says, enter link description here PROPAGATION_REQUIRED – Support a current transaction; create a new one if none exists. Below code inert a product and then product details for two tables. public void save(Product product, int qoh){ productDao.save(product); System.out.println("Product Inserted"); ProductQoh productQoh = new ProductQoh(); productQoh.setProductId(product.getProductId()); productQoh.setQty(qoh); productQohBo.save(productQoh); System.out.println("ProductQoh Inserted"); } My problem is when this kind of behavior can happen? I mean How come a current transaction ends? Is it after a save or update? If we use PROPAGATION_REQUIRED suppose the current transaction ends after insert product. Then a new transaction comes but if any failure when insert product quantity it will only rollback the quantity not the product details entered know? So still the data is inconsistency knw?
tagged with: transactions
tagged with: java
has title: PROPAGATION_REQUIRED in Spring Transaction
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23533561

http://stackoverflow.com/comment/36158707
comment on: http://stackoverflow.com/a/23557398
has text: When I use a break statement for every case label mentioned above, Eclipse says its an unreachable code. What's the reason behind this? I have a return statement and then a break after that before the start of next case label such as case PreferenceType.SECOND : return something; break;
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/q/23463445
has title: Integer from/to byte conversion
answer count: 1
tagged with: android
downvote count: 1
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23471788
has body: I'm developing an app based on Samsung Chord SDK. I need to send the video's current position in the sendDataToAll(), which accepts data in byte[][]. My problem is that when I try to send the current position (which is an int) type-casted into byte, I'm getting negative value (in byte) as returned. And when I try to convert the negative value in to int in the OnDataRecived(), it's still the same negative value. How do I solve this issue? Sending code: //for sending the message int currPos = mVideoView.getCurrentPosition(); logView.append("Duration sent= " + currPos); //Integer resume = -3; Byte msgByte = new Byte("-3"); byte [] [] pay = new byte [1] [2]; pay[0] [0] = msgByte; Byte msgByte2 = new Byte((byte) currPos); logView.append("Duration sent= " + msgByte2); pay[0] [1] = msgByte2; mChordchannel.sendDataToAll("Integer", pay); // im sending -3 so that im checking that the user pressed the resume . Receiving code: //on receiving else if(intRec == -3) { Byte pos = rec[0] [1]; int posn; posn = pos.intValue(); logView.append("Duration received= " + posn); mVideoView.seekTo(posn); mVideoView.start(); }
tagged with: samsung-mobile-sdk
tagged with: java
score: -1
type: Question

http://stackoverflow.com/q/23548252
has answer: http://stackoverflow.com/a/23562818
tagged with: cmis
type: UnansweredQuestion
has body: I´m trying to set up the OpenCMIS InMemory Repository following the instructions from Apache but I keep getting the following error when running the maven command mvn clean install -Dmaven.test.skip=true: [INFO] 4 errors [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Apache Chemistry OpenCMIS ......................... SUCCESS [1.665s] [INFO] OpenCMIS Commons API .............................. SUCCESS [3.327s] [INFO] OpenCMIS Commons Implementation ................... SUCCESS [7.599s] [INFO] OpenCMIS Client API ............................... SUCCESS [0.714s] [INFO] OpenCMIS Client Bindings Implementation ........... FAILURE [2.285s] [INFO] OpenCMIS Client Implementation .................... SKIPPED [INFO] OpenCMIS Server Support ........................... SKIPPED [INFO] OpenCMIS Server Implementation .................... SKIPPED [INFO] OpenCMIS Server Implementation WAR packaging ...... SKIPPED [INFO] OpenCMIS Test Utilities ........................... SKIPPED [INFO] OpenCMIS InMemory Server WAR packaging ............ SKIPPED [INFO] OpenCMIS FileShare Server Implementation .......... SKIPPED [INFO] OpenCMIS JCR Server Implementation ................ SKIPPED [INFO] OpenCMIS Server Archetype ......................... SKIPPED [INFO] OpenCMIS Bridge WAR packaging ..................... SKIPPED [INFO] OpenCMIS Test Compatibility Kit ................... SKIPPED [INFO] OpenCMIS Full Integration Tests ................... SKIPPED [INFO] OpenCMIS Tools .................................... SKIPPED [INFO] OpenCMIS Browser .................................. SKIPPED [INFO] OpenCMIS Browser Application ...................... SKIPPED [INFO] OpenCMIS Workbench ................................ SKIPPED [INFO] OpenCMIS OSGi Client Wrapper ...................... SKIPPED [INFO] OpenCMIS Android Client ........................... SKIPPED [INFO] OpenCM…
tagged with: maven
tagged with: opencmis
tagged with: java
type: Question
has title: Setting up OpenCMIS InMemory Repository
score: 0
answer count: 2
tagged with: apache-chemistry
has answer: http://stackoverflow.com/a/23550223

http://stackoverflow.com/comment/36105387
has text: You can check the codes used in https://github.com/joakime/android-apk-parser
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23534767
score: 0

http://stackoverflow.com/q/23589289
has answer: http://stackoverflow.com/a/23597949
tagged with: java
has body: The regex is pretty simple: WHERE t.name =~ "(?i).*\\baaaaaaaa\\b.*" This works in the Neo4j server web console. I receive the expected results. When I use the REST interface via Java, I had to change the regex to: "(?i).*\\\baaaaaaaa\\\b.*" (added a back slash). I don't understand why, but it works (again the expected results are returned). The same regex don't work on embedded Neo4j: Caused by: Invalid input '': expected '\', ''', '"', 'b', 'f', 'n', 'r', 't' or Unicode (line 1, column 64) MATCH ... WHERE t.name =~ "(?i)\ aaaaaaaa\ " ... ^ Note that \b isn't shown on the error log (at least on the Intellij console). To make things worse "(?i).*\\baaaaaaaa\\b.*" is correctly parsed (at least no exception is thrown) both on embedded and server databases. But no results are returned. Important considerations: Neo4j 2.0 I'm using Spring Data (3.0)
has title: Whole word regex not working in Neo4j Embedded
score: 2
downvote count: 0
tagged with: neo4j
has comment: http://stackoverflow.com/comment/36205839
accepted answer: http://stackoverflow.com/a/23597949
tagged with: spring-data-neo4j
type: Question
type: AnsweredQuestion
tagged with: regex
favorite count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/23547885
answer count: 1

http://stackoverflow.com/a/23547682
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23547412
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36128590
has body: I am not familiar with hama, but maybe you need to export a runnable jar and then run as: hama jar yourProject.jar

ajax
tags question: http://stackoverflow.com/q/23576893
tags question: http://stackoverflow.com/q/23592879
tags question: http://stackoverflow.com/q/23484007
tags question: http://stackoverflow.com/q/23489824
type: Tag
tags question: http://stackoverflow.com/q/23518450
tags question: http://stackoverflow.com/q/23601161
tags question: http://stackoverflow.com/q/23485916
tags question: http://stackoverflow.com/q/23543843
tags question: http://stackoverflow.com/q/23562928
tags question: http://stackoverflow.com/q/23510048
tags question: http://stackoverflow.com/q/23508398
tags question: http://stackoverflow.com/q/23612140
tags question: http://stackoverflow.com/q/23496479
tags question: http://stackoverflow.com/q/23614941
tags question: http://stackoverflow.com/q/23613796
tags question: http://stackoverflow.com/q/23548760
tags question: http://stackoverflow.com/q/23489342
tags question: http://stackoverflow.com/q/23468653
tags question: http://stackoverflow.com/q/23489119
tags question: http://stackoverflow.com/q/23466518
tags question: http://stackoverflow.com/q/23519223
tags question: http://stackoverflow.com/q/23499685
tags question: http://stackoverflow.com/q/23548924
tags question: http://stackoverflow.com/q/23556156
tags question: http://stackoverflow.com/q/23610431
tags question: http://stackoverflow.com/q/23549633
tag name: ajax

http://stackoverflow.com/comment/35957123
type: QuestionComment
has text: In fact, @user3580294 has given the answer: The type inference of Java 7 simply was not smart enough to involve the *target type* in its type resolution. This has been tackled in http://openjdk.java.net/jeps/101 , and the fact that it works in Java 8 is referred to as "generalized target type inference" - also see http://docs.oracle.com/javase/tutorial/java/generics/genTypeInference.html#target_types
score: 0
comment on: http://stackoverflow.com/q/23455524
type: Comment

http://stackoverflow.com/comment/36024603
has text: They should behave the same.
comment on: http://stackoverflow.com/a/23492735
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35994731
type: Comment
score: 0
type: AnswerComment
has text: I said my image in local drive, I mean in D:/uploads/Img.jpg path.
comment on: http://stackoverflow.com/a/23459977

http://stackoverflow.com/a/23498640
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: Since you need a String representation of your Date, then use SimpleDateFormat to convert the Date object into a String: Calendar calendar = ... //... date = calendar.getTime(); Timestamp epochTimeStamp = new Timestamp(date.getTime()); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); try { System.out.println(sdf.format(date)); System.out.println(sdf.format(epochTimeStamp)); } catch (Exception e) { //handle it! } From your example, prints 01/01/1970 09:21:18 01/01/1970 09:21:18
accepted answer of: http://stackoverflow.com/q/23497846
answers question: http://stackoverflow.com/q/23497846
upvote count: 1

http://stackoverflow.com/a/23520959
has body: You need to do something with the result, for example store it in an array. Also note that you don't need the initial list and can start with a stream directly: long[] result = IntStream.range(0, 100000) //instead of your initial list .filter(p -&gt; p % 2 == 0) //filters .mapToLong(p -&gt; (long) Math.pow(p, 2)) //"replaces" each number with its square .toArray(); //collect the results in an array Or you could decide to print the result: IntStream.range(0, 100000) .filter(p -&gt; p % 2 == 0) .mapToLong(p -&gt; (long) Math.pow(p, 2)) .forEach(System.out::println);
upvote count: 6
answers question: http://stackoverflow.com/q/23520703
type: Answer
downvote count: 0
score: 6

http://stackoverflow.com/comment/99638263
type: Comment
has text: @HarryQ as you see, there is a `mHandler.postDelayed();` at the end of `try{ }`, which means this method keeps running periodically. So if we put `isRunning = false` in `finally{ }`, after the first time method runs when the `isRunning` is `false`!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23487806

http://stackoverflow.com/comment/36287155
comment on: http://stackoverflow.com/a/23631998
has text: Remove it :) See what happens. I'm assuming you're using some version control like Git, so no harm done.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23538461
score: 0
answers question: http://stackoverflow.com/q/23538217
type: Answer
has body: Light weight directory protocal(ldap) server is popularly used for authentication.It stores the values in form of tree structure.Which is easy to retreive the login credintials when multiple requests come at a time instead of using database. Popular ldap servers in market are 1.openldap 2.ApacheDirectoryStudio Use any of these above servers and workout below examples refer this link for example 1.springldap Ex 1 2.springldap Ex2

http://stackoverflow.com/q/23512485
has answer: http://stackoverflow.com/a/23549465
answer count: 2
has answer: http://stackoverflow.com/a/23512610
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
has body: I'm thinking the answer here is probably no, but just in case. I'm doing something like this: @RequestMapping(value="data.json", params="query=overview") public String getOverview(@RequestBody MyRequest myRequest) { [...] return "overview"; } @RequestMapping(value="data.json", params="query=detail") public String getDetail(@RequestBody MyRequest myRequest) { [...] return "detail"; } and the client is POSTing JSON data, which is deserialized by Jackson on the way in and bound to the MyRequest parameter, all working nicely. However, I don't like the query type having to be specified in the URL of the requests. What I would like is to include the query parameter in the JSON object and use that to drive the @RequestMapping. Is this possible? If not, I guess I will implement a single mapping and have that method delegate to others based on the incoming data, but that feels like a step in the wrong direction.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Can I use JSON data in RequestMapping in Spring MVC
possible better answer: http://stackoverflow.com/a/23549465
type: Question
accepted answer: http://stackoverflow.com/a/23512610

http://stackoverflow.com/comment/36073559
type: QuestionComment
has text: How did you get 396 rep on this site if you're asking questions that can be answered with 3 seconds of googling?
score: 3
comment on: http://stackoverflow.com/q/23518760
type: Comment

http://stackoverflow.com/comment/37100389
score: 1
comment on: http://stackoverflow.com/a/23525993
type: AnswerComment
has text: @assylias, the classes loaded by the system classloader CANNOT be GC'd since there is a native ref (gc root) to the system classloader. The latter in effect has a Vector with references to the every single loaded classes (via `Class.forName`). Hence 'unlikely' in the answer is actually 'never'
type: Comment

http://stackoverflow.com/q/23564855
favorite count: 0
accepted answer: http://stackoverflow.com/a/23570288
linked to: http://stackoverflow.com/q/13307500
type: AnsweredQuestion
score: 1
upvote count: 1
tagged with: swing
tagged with: jfreechart
type: Question
linked to: http://stackoverflow.com/q/3066590
has title: Add listener to Legend
has answer: http://stackoverflow.com/a/23570288
tagged with: java
has body: I am using XYPlot class from jfreechart library. I have got two XYSeries and there are legend of them in the bottom of the ChartPanel. Now I want to process mouse click events on that legend. Is it possible to add listener to the legend? If it is not how can I get the coordinates of legend (with coordinates I can add listener to ChartPanel)?
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/35999994
has text: @OctavianGanea: You wrote that you're having 500 GB real memory and that only about 30 GB are used, right? And switching them off seems not to help. Maybe you could find the size of a reference (`Unsafe` should do, but there are some tools) to verify if it's really off. You could also set `-XX:ObjectAlignmentInBytes=16` and check if the available memory doubles.
comment on: http://stackoverflow.com/a/23469368
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23485363
type: Question
has comment: http://stackoverflow.com/comment/36022978
has comment: http://stackoverflow.com/comment/44507199
has comment: http://stackoverflow.com/comment/36017355
has answer: http://stackoverflow.com/a/23486279
has answer: http://stackoverflow.com/a/28061198
upvote count: 11
has comment: http://stackoverflow.com/comment/36017304
tagged with: sendkeys
has comment: http://stackoverflow.com/comment/36017865
answer count: 7
has answer: http://stackoverflow.com/a/23624169
has body: I am trying to send a String to the sendkeys() method, but it is not accepting and throwing an error as my codes follows: package healthcare; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.Select; import com.thoughtworks.selenium.Selenium; import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium; public class MailRegister_Webdriver { public WebDriver driver; public Selenium selenium; public void openURL(){ //System.setProperty("webdriver.chrome.driver", "F:\\Library\\chromedriver.exe"); driver=new FirefoxDriver(); selenium=new WebDriverBackedSelenium(driver, "http://mail.in.com"); driver.get("http://mail.in.com"); } public void register() throws Exception{ //driver.findElement(By.cssSelector("input.registernow")).click(); selenium.click("css=input.registernow"); Thread.sleep(3000); driver.findElement(By.id("fname")).sendKeys("Nagesh"); selenium.select("day", "10"); selenium.select("month", "Jun"); new Select(driver.findElement(By.id("year"))).selectByVisibleText("1999"); Thread.sleep(1000); driver.findElement(By.xpath("(//input[@name='radiousername'])[5]")).click(); Thread.sleep(2000); driver.findElement(By.id("password")).sendKeys("nag123"); driver.findElement(By.id("repassword")).sendKeys); driver.findElement(By.id("altemail")).sendKeys(); driver.findElement(By.id("mobileno")).sendKeys("7894561230"); driver.findElement(By.id("imageField")).click(); } public static void main(String[] args) throws Exception { // TODO Auto-generated method stub MailRegister_Webdriver m=new MailRegister_Webdriver(); m.openURL(); m.register(); } } Can somebody help on this, Why Sendkeys() method is not taking String values as arguments?
has comment: http://stackoverflow.com/comment/36014164
has comment: http://stackoverflow.com/comment/57055073
has comment: http://stackoverflow.com/comment/36013133
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33615188
has answer: http://stackoverflow.com/a/30636595
score: 11
has comment: http://stackoverflow.com/comment/36043849
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/23491446
has title: The method sendKeys(CharSequence[]) in the type WebElement is not applicable for the arguments (String)
has answer: http://stackoverflow.com/a/24103315
downvote count: 0
tagged with: java
favorite count: 0
tagged with: webdriver

http://stackoverflow.com/q/23582474
upvote count: 2
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: otto
has answer: http://stackoverflow.com/a/23622402
has title: In OTTO are all instances of a parameterized class the "same"?
type: Question
has body: I thought I had a nice solution to another question I asked, but now I don't think it will work out. In Otto, if I do something like this: @Subscribe public void foo(ApiRequestEvent&lt;Foo&gt; event) { } @Subscribe public void bar(ApiRequestEvent&lt;Bar&gt; even) { } It seems like both methods are called if I post any instance of ApiRequestEvent&lt;&gt; onto the bus. It that what is expected? I am suspecting that this happens because in Java there is only really one class ApiRequestEvent, and Otto is looking at the class while ignoring the type parameters. Before I abandon this approach, is there anyway around this? I was going to use this parameterized class as the "signature" for the events I wanted to subscribe to.
accepted answer: http://stackoverflow.com/a/23622402
linked to: http://stackoverflow.com/q/23543951
answer count: 1
downvote count: 0
favorite count: 0

xml-parsing
tags question: http://stackoverflow.com/q/23593067
tags question: http://stackoverflow.com/q/23603585
tag name: xml-parsing
tags question: http://stackoverflow.com/q/23528540
tags question: http://stackoverflow.com/q/23486897
type: Tag
tags question: http://stackoverflow.com/q/23502979
tags question: http://stackoverflow.com/q/23550154
tags question: http://stackoverflow.com/q/23559868
tags question: http://stackoverflow.com/q/23544180
tags question: http://stackoverflow.com/q/23604392
tags question: http://stackoverflow.com/q/23520208

http://stackoverflow.com/comment/36185432
has text: that is good but it's have 10MB and this is make a big size apk for my application. do you have any other idea?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23578090
type: Comment

http://stackoverflow.com/a/23538362
upvote count: 2
has comment: http://stackoverflow.com/comment/36110816
has comment: http://stackoverflow.com/comment/36110968
has body: You are always setting it to true by button[i].setSelection(true); that's why you always get true. You need to set the button once you make a selection. Do you have a listener attached to it. You have to use void addSelectionListener(SelectionListener listener) Adds the listener to the collection of listeners who will be notified when the control is selected by the user, by sending it one of the messages defined in the SelectionListener interface. Please read the documentation on SelectionListener. You have to use void widgetSelected(SelectionEvent e) Sent when selection occurs in the control. void widgetDefaultSelected(SelectionEvent e) Sent when default selection occurs in the control.
has comment: http://stackoverflow.com/comment/36110734
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23538289
type: Answer
accepted answer of: http://stackoverflow.com/q/23538289
score: 2

http://stackoverflow.com/comment/36023959
has text: Problem resolved. It was with dialect. I was using org.hibernate.dialect.MySQLInnoDBDialect but in my case with MySQL-5.6 org.hibernate.dialect.MySQL5InnoDBDialect worked. +5 for me. LOL
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23491770
score: 0

soap
tags question: http://stackoverflow.com/q/23477730
tags question: http://stackoverflow.com/q/23519300
type: Tag
tags question: http://stackoverflow.com/q/23502438
tags question: http://stackoverflow.com/q/23518027
tags question: http://stackoverflow.com/q/23470459
tags question: http://stackoverflow.com/q/23541334
tags question: http://stackoverflow.com/q/23525747
tags question: http://stackoverflow.com/q/23496112
tags question: http://stackoverflow.com/q/23589141
tags question: http://stackoverflow.com/q/23612901
tags question: http://stackoverflow.com/q/23495260
tags question: http://stackoverflow.com/q/23490941
tag name: soap

http://stackoverflow.com/a/23585238
upvote count: 1
type: AcceptedAnswer
has body: Add JScrollPane directly into the JFrame's Content Pane instead of adding JScrollPane first into JPanel. Do in this way private void AddRootPanel(ArrayList&lt;String&gt; imageList) { rp = new RootPanel(imageList); Container container = getContentPane(); container.add(rp.getScrollpane()); } // Not require to extend JPanel for RootPanel class if it contains only single component class RootPanel{ private JScrollPane scrollpane; ... private void addImageLabel() { imgLabel = new JLabel(); scrollPane= new JScrollPane(imgLabel); ... } public JScrollPane getScrollpane(){ return scrollPane; } }
accepted answer of: http://stackoverflow.com/q/23585060
answers question: http://stackoverflow.com/q/23585060
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23490041
type: Answer
answers question: http://stackoverflow.com/q/23489362
upvote count: 2
score: 2
has body: There's no official certification book which contains all topics for OCPJP 7. So, As of now, you are on your own. See this note, this might help you. Although I can suggest below two books. Oracle Certified Professional Java SE 7 Programmer Exams OCA/OCP Java SE 7 Programmer I &amp; II Study Guide
downvote count: 0

http://stackoverflow.com/q/23580643
tagged with: vaadin
has title: Application Client Server Java EE ( Java Enterprise Edition)
type: Question
tagged with: jakarta-ee
score: -2
tagged with: jboss
has body: I've to implement an application for sending messages. The Application should support different type of messages. Plus the application should offer simple UI with some characteristics like Input for messages to a contact (STRING (email for example)), Input for message text, Selection for message type, send button, list of messages that have been already sent, list should contain message type, recipient and content After pressing send button the message is shown in the list of messages Application should be implemented in Client – Server architecture with using Java EE. The Client has to be a standalone application. EJB should be used for remote invocations. Methods for message sending and obtaining list of sent messages should offered. plus: Extendable design (idea: more message types are coming soon) Sent messages are persisted on server side and available when application is opened again (file can be used to store messages). Preferred UI choice: Vaadin. Is not necessary to implement the actual sending. it is enough to write into logs/system out that sms or email was sent along with recipient and message content (in addition to storing it in some db/file) For Server part use JBoss 7. Now I'm getting crazy over this program because is required something that i don't understand. Vaadin is for web applications. Is out there anyone that can help me to understand how to proceed about creating a UI using Vaadin for a standalone client that comunicates with the server side? Thanks in advance
tagged with: client-server
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23589490
tagged with: java
downvote count: 2

http://stackoverflow.com/comment/36044004
score: 0
type: Comment
has text: It works, such a simple solution that I feel like I should have came to it, but you live to learn :) Thanks a lot!
comment on: http://stackoverflow.com/a/23493299
type: AnswerComment

http://stackoverflow.com/a/37134312
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/100657135
type: Answer
has body: I faced this issue with tomcat 7 + jdk 1.8 with java 1.7 and lower versions it's working fine. window -> preferences -> java -> installed jre in my case I changed jre1.8 to JDK 1.7 and accordingly modify project facet , select same java version as it's there in selected Installed JRE.
answers question: http://stackoverflow.com/q/23541532
score: 0

http://stackoverflow.com/comment/36200550
score: 0
type: AnswerComment
type: Comment
has text: how will the above way can form groups for each department?
comment on: http://stackoverflow.com/a/23586382

http://stackoverflow.com/comment/36077518
type: Comment
comment on: http://stackoverflow.com/q/23520703
type: QuestionComment
score: 0
has text: @LuiggiMendoza Just curious, would `p -> p = (long)Math.pow(p, 2)` have no effect because the variable reference would be passed by value so reassigning wouldn't have an effect? I don't have much experience with streams, so I very well might be wrong on this. I'm imagining the lambda to be roughly equivalent to `void method(Long p) { p = (long)Math.pow(p, 2);}`. Is that right?

http://stackoverflow.com/comment/35997975
has text: @VolodymyrBakhmatiuk Only one way to find out: measure.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23477675

http://stackoverflow.com/q/23587821
has comment: http://stackoverflow.com/comment/36203517
has comment: http://stackoverflow.com/comment/36208023
has comment: http://stackoverflow.com/comment/36203686
has comment: http://stackoverflow.com/comment/36203196
has comment: http://stackoverflow.com/comment/36203734
has comment: http://stackoverflow.com/comment/36203234
favorite count: 0
has comment: http://stackoverflow.com/comment/36203809
has comment: http://stackoverflow.com/comment/36203873
has comment: http://stackoverflow.com/comment/36208614
tagged with: base-conversion
has comment: http://stackoverflow.com/comment/36203470
has comment: http://stackoverflow.com/comment/36203214
has comment: http://stackoverflow.com/comment/36203911
has answer: http://stackoverflow.com/a/23591833
has comment: http://stackoverflow.com/comment/36203633
has body: Background I'm doing a college assignment, which requires me to draw a pattern represented by 4 Hexadecimal digits. So far, I've managed to create everything I need to do it, except a little tiny thing: I have a bug in my code, which renders Hexadecimal values between A - F (or Decimal 10-17) useless. I created a method where I obtain a decimal value from an hexadecimal , and convert it to a binary value. Here's a list of the results I've obtained: Decimal 1 -&gt; Binary 1 -&gt; CORRECT Decimal 2 -&gt; Binary 1 -&gt; Should be 10 Decimal 3 -&gt; Binary 11 -&gt; CORRECT Decimal 4 -&gt; Binary 1 -&gt; Should be 100 Decimal 5 -&gt; Binary 101 -&gt; CORRECT Decimal 6 -&gt; Binary 11 -&gt; Should be 110 Decimal 7 -&gt; Binary 111 -&gt; CORRECT Decimal 8 -&gt; Binary 1 -&gt; Should be 1000 Decimal 9 -&gt; Binary 1001 -&gt; CORRECT Decimal 10 -&gt; Binary 101 -&gt; Should be 1010 Decimal 11 -&gt; Binary 1101 -&gt; Should be 1011 Decimal 12 -&gt; Binary 11 -&gt; Should be 1100 Decimal 13 -&gt; Binary 1011 -&gt; Should be 1101 Decimal 14 -&gt; Binary 111 -&gt; Should be 1110 Decimal 15 -&gt; Binary 1111 -&gt; CORRECT The output is actually the reverse of what it should be. How can reverse the output, or make my code output the correct order in the first place? Edit #2 The problem here, as refered to on the original post is that: for (int i = 0; i&lt;=3; i++){ //loops trough my pattern array // Will receive the binary values while (nDecimal[i]!=0){ pattern[i]= pattern[i]*10 + nDecimal[i]%2; nDecimal[i]/=2; System.out.println("Binary ["+i+"] " + pattern[i]); } is not working correctly, and is outputting the binary digits on the inverse order. In short, here's the code that does the conversion: int myDecimal; int result; while (myDecimal!=0){ result= result*10 + myDecimal%2; myDecimal=2; }
has comment: http://stackoverflow.com/comment/36203430
has comment: http://stackoverflow.com/comment/36203484
has comment: http://stackoverflow.com/comment/36208873
has comment: http://stackoverflow.com/comment/36203405
upvote count: 0
tagged with: binary
has answer: http://stackoverflow.com/a/23588334
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36203232
has title: Converting Decimal (Base 10) to its Binary (Base 2) counterpart without using parseInt
has comment: http://stackoverflow.com/comment/36203490
has comment: http://stackoverflow.com/comment/36203511
has comment: http://stackoverflow.com/comment/36203369
has comment: http://stackoverflow.com/comment/36203416
score: -2
has comment: http://stackoverflow.com/comment/36203355
tagged with: java
has comment: http://stackoverflow.com/comment/36206301
has comment: http://stackoverflow.com/comment/36203593
type: Question
tagged with: decimal
answer count: 2
downvote count: 2

http://stackoverflow.com/a/23595859
answers question: http://stackoverflow.com/q/23595749
score: 0
has body: The typical solution includes a check if the current iterator position has any left element through setIterator.hasNext() which returns true only if there is an extra element unchecked. For example HashSet set = new HashSet(); Iterator setIterator = set.iterator(); while(setIterator.hasNext()){ String item = setIterator().next(); ... }
type: Answer

http://stackoverflow.com/comment/36063122
type: Comment
type: QuestionComment
has text: Please paste the code of StoreHomeFragment class
comment on: http://stackoverflow.com/q/23513118
score: 0

http://stackoverflow.com/comment/36146433
has text: Please please read the documentation and don't just issue two commands which you've seen somewhere. The ports you tell the server must reflect the actual ports you use (in this case 50222) not just something you just made up.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23556722
type: AnswerComment

http://stackoverflow.com/q/23549482
tagged with: ui-automation
has title: Methods stubbed out in uiautomator.jar in android
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23549817
has comment: http://stackoverflow.com/comment/36131883
favorite count: 0
accepted answer: http://stackoverflow.com/a/23549817
tagged with: android
type: AnsweredQuestion
tagged with: uidevice
score: 1
tagged with: java
upvote count: 1
tagged with: android-uiautomator
type: Question
has body: I am using uiautomator APIs in my project. I found that uiautomator.jar has stubbed APIs while their implementation is present in sources under sdk folder. public static UiDevice getInstance() { throw new RuntimeException("Stub!"); } What should I do now?
has comment: http://stackoverflow.com/comment/36131815

http://stackoverflow.com/a/23516140
answers question: http://stackoverflow.com/q/23516092
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/36068335
has body: The new features of java 8 are there to enable some behaviours we previously used interfaces for. Abstract classes are a structural concept. You use them to implement the IS-A relationship between classes in a class hierarchy.
type: Answer
has comment: http://stackoverflow.com/comment/36068374
upvote count: 1

http://stackoverflow.com/comment/36147625
comment on: http://stackoverflow.com/a/23530649
score: 0
type: AnswerComment
has text: @chhh there is a book called *Camel in Action* from Claus Ibsen (core team member). This should be a good introduction to Camel.
type: Comment

http://stackoverflow.com/comment/36252114
score: 0
type: AnswerComment
type: Comment
has text: any error they till me add build path
comment on: http://stackoverflow.com/a/23612890

http://stackoverflow.com/a/23559344
score: 0
type: Answer
has body: I am correctly retaining the data object but after a device rotation the function in UI thread has no effect, a function to change the selected section in the NavigationDrawer. I thought it was because I was losing the correct UI thread but actually, what I was losing is this NavigationDrawerFragment. Just by adding the setRetainInstance(true) line in the OnCreate() of the NavigationDrawerFragment solves the problem: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); ...
accepted answer of: http://stackoverflow.com/q/23518196
answers question: http://stackoverflow.com/q/23518196
type: AcceptedAnswer

http://stackoverflow.com/comment/36163146
has text: What's your target platform? Web page served by java application server? Java desktop application? Swing? JavaFX?
score: 0
comment on: http://stackoverflow.com/q/23565935
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23580131
has comment: http://stackoverflow.com/comment/36188621
has comment: http://stackoverflow.com/comment/36189383
tagged with: popup
tagged with: java
has title: Show a JDialog with MouseEnter event
type: Question
tagged with: jtable
has body: I am using a JTable, I my first column I have an image, I would like that when I pass the mouse over it looks more enlarged, I mean to open a kind of a window with a larger picture. I am using a custom model, the cell works as JLabel. I tried this : private void jLabel1MouseEntered(java.awt.event.MouseEvent evt) { NewJDialog c = new NewJDialog(this, rootPaneCheckingEnabled); c.setVisible(true); } this is my DefaultTableCellRenderer: public class IconCellRenderer extends DefaultTableCellRenderer { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value instanceof JLabel) { JLabel label = (JLabel) value; label.setOpaque(true); fillColor(table, label, isSelected); return label; } else { return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); } } public void fillColor(JTable t, JLabel l, boolean isSelected) { if (isSelected) { l.setBackground(t.getSelectionBackground()); l.setForeground(t.getSelectionForeground()); l.setBackground(new Color(255, 255, 200)); } else { l.setBackground(t.getBackground()); l.setForeground(t.getForeground()); } } } I know it works but my question is: how to do it with a specific JTable cell?
score: 0
has comment: http://stackoverflow.com/comment/36188628
has comment: http://stackoverflow.com/comment/36189425
has comment: http://stackoverflow.com/comment/36188739
has comment: http://stackoverflow.com/comment/36188792
answer count: 0
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/a/58246928
answers question: http://stackoverflow.com/q/23478358
score: 0
type: Answer
has body: You can take a look at my example where I played with CyclicBarrier.Here each worker makes some calculation and at the barrier the condition is checked. If it meets the condition than all workers stop calculations, otherwise they continue: class Solver { private static final int REQUIRED_AMOUNT = 100; private static final int NUMBER_OF_THREADS = 4; AtomicInteger atomicInteger = new AtomicInteger(); AtomicBoolean continueCalculation = new AtomicBoolean(true); final CyclicBarrier barrier; public static void main(String[] args) { new Solver(); } class Worker implements Runnable { int workerId; Worker(int workerId) { this.workerId = workerId; } public void run() { try { while(continueCalculation.get()) { calculate(workerId); barrier.await(); } } catch (Exception ex) { System.out.println("Finishing " + workerId); } } } public Solver() { Runnable barrierAction = () -&gt; { if (done()) { continueCalculation.set(false); } }; barrier = new CyclicBarrier(NUMBER_OF_THREADS, barrierAction); List&lt;Thread&gt; threads = new ArrayList(NUMBER_OF_THREADS); for (int i = 0; i &lt; NUMBER_OF_THREADS; i++) { Thread thread = new Thread(new Worker(i)); threads.add(thread); thread.start(); } } private void calculate(int workerId) throws InterruptedException { // Some long-running calculation Thread.sleep(2000L); int r = new Random().nextInt(12); System.out.println("Worker #" + workerId + " added " + r +" = " + atomicInteger.addAndGet(r)); } private boolean done() { int currentResult = atomicInteger.get(); boolean collected = currentResult &gt;= REQUIRED_AMOUNT; System.out.println("======================================================="); System.out.println("Checking state at the barrier: " + currentResult); if (collected) { System.out.println("Required result is reached"); } System.out.println("======================================================="); return collected; } }

http://stackoverflow.com/comment/36175739
type: Comment
type: AnswerComment
has text: Synchronization will work if both threads work on same object. But not when they communicate over queue.
score: 0
comment on: http://stackoverflow.com/a/23572697

http://stackoverflow.com/comment/36181872
type: QuestionComment
score: 2
has text: You're making your life hard. Instead of looping to write and read every acount, why don't you write the list itself (only one call to ObjectOutputStream.writeObject()), and read the list itself (only one call to ObjectInputStream.readObject())?
type: Comment
comment on: http://stackoverflow.com/q/23576212

http://stackoverflow.com/comment/36155874
type: QuestionComment
has text: @Susei it may lead people to the wrong answer, as the correct output for the code you posted is `(1, 2) (1, 3) (1, 4) (2, 1) (2, 3) (2, 4) (3, 1) (3, 2) (3, 4) (4, 1) (4, 2) (4, 3)`. Basically there is an inconsistence in the question.
score: 1
comment on: http://stackoverflow.com/q/23562297
type: Comment

http://stackoverflow.com/comment/35992419
type: Comment
type: QuestionComment
has text: If building a `String`, use `StringBuilder` instead of string concatenation.
score: 1
comment on: http://stackoverflow.com/q/23475263

http://stackoverflow.com/q/23571853
upvote count: 1
tagged with: java
has title: Adding Variables to CLASSPATH Java
score: -1
tagged with: classpath
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23572158
has body: I'm trying to add OnBarcode.AndroidBarcode.jar to the class path in windows. I've set a new environment variable called CLASSPATH and put the path to the jdk bin folder in it. I've put OnBarcode.AndroidBarcode.jar in that bin folder. I've also put OnBarcode.AndroidBarcode.jar in the libs folder in my project. And thats it. It doesn't work. I've already looked at a couple of other posts like http://tinyurl.com/krs9w3b
has comment: http://stackoverflow.com/comment/36173259
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36177227

http://stackoverflow.com/a/23576896
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/23576608
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23576608
downvote count: 0
has body: Sample code public static void main(String[] args) throws NumberFormatException, IOException, ParseException { URL url = new URL("http://cdn.portableapps.com/GoogleChromePortable_128.png"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); InputStream is = conn.getInputStream(); BufferedImage image = ImageIO.read(is); OutputStream os = new FileOutputStream(new File("output.png")); ImageIO.write(image, "png", os); }

http://stackoverflow.com/a/23509057
upvote count: 1
type: Answer
has body: There's a bug in the stack overflow thread you copied from. 0x100 is 256 in decimal, so... 0x100 + 1 = 257 = 0b100000001 (9 digits) 0x100 + (-128) = 128 = 0b10000000 (8 digits) In other words, since 128 is less than Byte.MAX_VALUE, you don't get the padding effect that the poster intended. You can choose a bigger value to pad -- try 0x200 and strip the first two characters?? FWIW, it's understandable these types of bugs b/c negative byte values are a bit of a weird java thing. Oh well.
has comment: http://stackoverflow.com/comment/36056163
downvote count: 0
has comment: http://stackoverflow.com/comment/36056125
score: 1
answers question: http://stackoverflow.com/q/23508860

http://stackoverflow.com/q/23610325
has answer: http://stackoverflow.com/a/58545418
has comment: http://stackoverflow.com/comment/36245704
tagged with: environment-variables
has comment: http://stackoverflow.com/comment/36245853
downvote count: 0
has comment: http://stackoverflow.com/comment/36245014
tagged with: variables
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23610774
has comment: http://stackoverflow.com/comment/36277155
has comment: http://stackoverflow.com/comment/36245182
upvote count: 6
answer count: 4
has comment: http://stackoverflow.com/comment/36245533
has title: User environment variable in java
tagged with: java
score: 6
has answer: http://stackoverflow.com/a/23610484
type: Question
has answer: http://stackoverflow.com/a/72337016
has body: I am trying to get a user environment variable in java. The System.getEnv() method only return system environment variables. Does anybody know how to get user environment variables?

http://stackoverflow.com/a/23759087
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23544678
upvote count: 1
has body: The problem is that you have '(' at the begining of the two alts in bool_expr. A--&gt;'('AB|'('B is contains also a problem of recursivity. @see the generated parser. The solution is to add the backtracking option to your grammar: options { backtrack=true; }

http://stackoverflow.com/q/23594282
has body: I am getting SQL Grammar Exception on simple select statement here is my products class @Entity public class products { private String Code,Name,Description; private double Price; @Id public String getCode() { return Code; } public void setCode(String code) { Code = code; } public String getName() { return Name; } public void setName(String name) { Name = name; } public String getDescription() { return Description; } public void setDescription(String description) { Description = description; } public double getPrice() { return Price; } public void setPrice(double price) { Price = price; } } Here is my query which i am executing public products getProductDescription(String Code) { setSessionFactory(); Session session = factory.getCurrentSession(); session.beginTransaction(); String query = "from products p where p.code=:code"; Query q = session.createQuery(query); q.setString("code", Code); System.out.println(query); products pr = (products)session.createQuery(query); session.close(); return pr; } All The Tables Exist and "from products" query works perfectly but when i insert where clause here it doesn't work UPDATE1 public products getProductDescription(String Code) { setSessionFactory(); Session session = factory.getCurrentSession(); session.beginTransaction(); String query = "from products p where p.code=:code"; Query q = session.createQuery(query); q.setString("code", Code); System.out.println(query); products pr = (products)session.createQuery(q); session.close(); return pr; } Error at products pr = (products)session.createQuery(q); saying The function createQuery does not support argument of type Query. Quickfix tells me to change it to string
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36214905
tagged with: eclipse
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23594314
score: 0
accepted answer: http://stackoverflow.com/a/23594314
has title: Hibernate SQL Grammar Exception on Select Statement
type: AnsweredQuestion

http://stackoverflow.com/a/25115982
score: 4
has body: After a long long time, I found the solution to my problem.. It all goes away, by adding in the suite tag, the entryconfigfailurepolicy, and set it to continue, in your suite xml files like this: &lt;suite name="Test-Suite" configfailurepolicy="continue"&gt; By default the value of the parameter was skip, which was causing tests to skip, if a failed configuration occured.
answers question: http://stackoverflow.com/q/23518502
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/35983449
comment on: http://stackoverflow.com/q/23470459
score: 0
type: Comment
has text: separately means.? can you elaborate more.?
type: QuestionComment

http://stackoverflow.com/q/23549920
answer count: 0
score: 1
tagged with: java
type: Question
has body: I have a server connected to two clients, and I want to send messages from one to another with only one client active at a time, so after every message send it waits for response from the other client. Therefore client should know if the first thing it needs to do is write a message to 2nd client or wait for a message from 1st one. This is the server side of my project: public void connect() throws IOException { log(TA, "ServerSocket created. \nListering for connections...\n"); server = new ServerSocket(port, 2); conn1 = server.accept(); output1 = new PrintWriter(conn1.getOutputStream()); input1 = new BufferedReader(new InputStreamReader( conn1.getInputStream())); log(TA, "User " + 1 + " connected.\n"); output1.println("1"); conn2 = server.accept(); output2 = new PrintWriter(conn2.getOutputStream()); input2 = new BufferedReader(new InputStreamReader( conn2.getInputStream())); log(TA, "User " + 2 + " connected.\n"); output2.println("2"); while (true) { String text = input1.readLine(); TA.append("Player 1: " + text + "\n"); output2.println("Player 1: " + text); text = input2.readLine(); TA.append("Player 2: " + text + "\n"); output1.println("Player 2: " + text); } } And this is the client: private static void connect() throws IOException { conn = new Socket("192.168.0.25", port); TA.append("Socket created.\n"); out = new PrintWriter(conn.getOutputStream(), true); in = new BufferedReader(new InputStreamReader(conn.getInputStream())); TA.append("Streams created.\n"); String inputLine; while ((inputLine = in.readLine()) != null) player_number = Integer.parseInt(inputLine); TA.append("Your ID is " + player_number + " ."); } public void actionPerformed(ActionEvent evt) { String text = TF.getText(); TA.append("Me: " + text + "\n"); TF.selectAll(); TA.setCaretPosition(TA.getDocument().getLength()); if (player_number == 2) try { TA.append("Player 1: " + in.readLine()); } catch (IOException e1) { e1.printStackTrace(); } out.println(text); if (player_number == 1) try { TA.appen…
downvote count: 0
has comment: http://stackoverflow.com/comment/36134874
has title: Client and server socket conection - how to send IDs to clients
favorite count: 0
has comment: http://stackoverflow.com/comment/36134232
type: UnansweredQuestion
tagged with: sockets
upvote count: 1

http://stackoverflow.com/q/23492625
tagged with: java
type: Question
tagged with: filtering
has title: Filtering a dependency's version in a maven POM file
linked to: http://stackoverflow.com/q/30571
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/8825812
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23496766
tagged with: maven
has body: Is it possible to somehow include a dependency's version number in a pom's properties tag pair? I simply want to get hold of a dependency's version number. This is more or less an extension of this question: Possible to get one of dependency version to insert into a filtered resource file? This is basically what I want to achieve, but I don't want to have to explicitly write down the version number of the dependency I need - i.e. I should be able to inherit the version number of the dependency.

http://stackoverflow.com/comment/36133603
type: QuestionComment
has text: At first I thought about making measurements, but then I noticed things could vary a lot with number of arguments (repeated and not), number of methods calls, the combination of functional interfaces (say a BiFunction<String, Function<String,Boolean>, Predicate<Integer>>)... I believe knowledge about the inner workings can better answer my doubts about the overall "design patter".
score: 0
comment on: http://stackoverflow.com/q/23550288
type: Comment

http://stackoverflow.com/q/23483610
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23483695
downvote count: 1
type: Question
tagged with: try-catch
tagged with: java
has body: I'm working on a chat client that communicates with a server. I recently just changed from using BufferedReaders and PrintWriters to using Object streams. I'm curious as to why the print statement is never reached in this snippet of code. I've tried a few things and it appears as if any code after the streams are setup is unreachable. I know that the client has successfully connected to the server because I have it print out the ip address of connected users. Here is the code: try { socket = new Socket (hostName, portNumber); sIn = new ObjectInputStream(socket.getInputStream()); sOut = new ObjectOutputStream(socket.getOutputStream()); while (true) { System.out.println("here2"); String msg = "hi"; sOut.writeObject(msg); } } Question is: Why is the print statement never reached in this code.
score: -1
tagged with: inputstream
has comment: http://stackoverflow.com/comment/36008867
answer count: 2
has comment: http://stackoverflow.com/comment/36008720
upvote count: 0
has answer: http://stackoverflow.com/a/23483700
tagged with: outputstream
has comment: http://stackoverflow.com/comment/36008705
has title: Java Unreachable Code in Try Block

http://stackoverflow.com/q/23612615
downvote count: 0
tagged with: java
has body: I have a doubt regarding the purpose of @PreserveOnRefresh annotation. What is the purpose of this particular annotation and what are the scenarios in which it has to be used? What are the effects of using/not using this annotation? Thanks, Daniccan VP
tagged with: annotations
linked to: http://stackoverflow.com/q/15439761
has answer: http://stackoverflow.com/a/25611695
accepted answer: http://stackoverflow.com/a/25611695
linked to: http://stackoverflow.com/q/3106452
type: Question
has title: @PreserveOnRefresh - Purpose and need?
score: 5
has answer: http://stackoverflow.com/a/23613202
tagged with: vaadin
answer count: 2
tagged with: web
favorite count: 0
upvote count: 5
possible better answer: http://stackoverflow.com/a/23613202
tagged with: vaadin7
type: AnsweredQuestion

http://stackoverflow.com/q/23576892
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23578675
has body: Development Environment: Java, Selenium WebDriver, JUnit I have to automate a test case where i have to enter values in couple of field leaving other fields blank. As i enter submit button, error message will be thrown and all the blanks fields will be highlighted. Example url: https://www.salesforce.com/in/form/trial/freetrial.jsp?d=70130000000Enyk I do not know how to find out highlighted fields using webdriver? Thanks.
type: AnsweredQuestion
has title: How to find out highlighted element(s) on web page by using WebDriver?
tagged with: java
tagged with: selenium
type: Question
accepted answer: http://stackoverflow.com/a/23578675

http://stackoverflow.com/q/23496643
has body: [SOLVED] I did not have the same namespace on both ends. I have this manual page about the Google cast companion library and I don't understand the part about 'Support for data-centric applications' where it says "This will send a message. Messages that are sent to the sender from the receiver can be captured by extending DataCastConsumerImpl class and overriding the following callbacks:" I have all the code for sending the message but when I press the 'confirmButton' nothing happens and the log doesn't throw any exceptions. So I wanted to add the 'onMessageSendFailed' callback but I have no idea how to add it to my code. Thank you in advance for your help! If you need more info I will be glad to give it!
type: Question
has answer: http://stackoverflow.com/a/23498046
score: 0
tagged with: google-cast
answer count: 1
tagged with: android
tagged with: chromecast
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23498046
has title: understanding the manual for google cast companion library
tagged with: java

http://stackoverflow.com/q/23474555
has body: WebView web; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Bundle extras = getIntent().getExtras(); String uid = extras.getString("uid"); web = (WebView) findViewById(R.id.webview01); web.setWebViewClient(new myWebClient()); web.getSettings().setJavaScriptEnabled(true); web.loadUrl("http://xxx.xxx.xxx.xxx/android/login.php?uid="+uid); } public class myWebClient extends WebViewClient { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } } This is the code of my webview activity. I'd like to implement a page loading function which is It will count in background when URL called.If URL doesnt load completely in 5000ms, the code below must run automatically. I cant figure out how to figure It. Intent i = new Intent(MainActivity.this, InternetError.class); startActivity(i); I've tried lot of methods but never get correct result. Thank you.
type: UnansweredQuestion
tagged with: webview
type: Question
tagged with: java
has title: Android - Java - WebView >> Count Page Loading time, if not loaded, intent new activity
has answer: http://stackoverflow.com/a/23489514
answer count: 1
score: 0
tagged with: android

http://stackoverflow.com/comment/36001974
type: Comment
has text: Thanks a lot for your help :) Though I'm getting the syntax error "Syntax error on token "start", Identifier expected after this token" on .start(); , which I don't know how to fix. Also, what is a "Handler object"? I ask this as I'm getting the error "Syntax error on token "mHandler", VariableDeclaratorId expected after this token". I'm quite new to coding, so a lot of the terminology such as "Handler object" I don't yet understand.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23479966

http://stackoverflow.com/a/23589745
type: Answer
has body: long.MaxValue = 9223372036854775807 your value 1 = 18374686479671623680 your value 2 = 9259542123273814144 Your values are bigger than the signed long can hold. This is why you have to use unsigned.
has comment: http://stackoverflow.com/comment/36216967
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23589703
has comment: http://stackoverflow.com/comment/36206673
answers question: http://stackoverflow.com/q/23589703

http://stackoverflow.com/a/23534941
upvote count: 5
answers question: http://stackoverflow.com/q/23534901
downvote count: 0
score: 5
type: Answer
has body: When you're writing a string literal, you put it in double quotes ("). If you want to put an actual " character in the string, you have to put a backslash (\) before it so the parser knows that it's part of the string, not the ending quote. This is called "escaping" the quote character. So the line if(!testary[0].equals("\"D")) tests whether the string at index 0 of the testary array does not equal the string "D (a double quote followed by the capital letter D). (The "not" part of that is the ! at the beginning.)

http://stackoverflow.com/a/23690076
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23593067
has body: You need to use a marshall/unmarshall library. Start creating a java class that match your xml document. To do it, I recomend you to use JAXB-2 plugin. It's a maven plugin that generate and Java Class from a xsd schema. You must to have the schema that your xml objects follow. You just need to provide this xsd schema to the plugin and it creates you the Java class. If you don't have the schema (you should) you must Y with the fields necessary to store the values of your xml. Once you have a Java class, just use a marshalling/unmarshalling library to extract the data from the xml. One of the most used is JAXB. You can follow the documentation to unmarshall a xml at the oficial documentation https://jaxb.java.net/tutorial/section_3_1-Unmarshalling-and-Using-the-Data.html#Unmarshalling
downvote count: 0
score: 1

http://stackoverflow.com/q/23547674
has comment: http://stackoverflow.com/comment/36128797
tagged with: generics
has comment: http://stackoverflow.com/comment/36128361
type: UnansweredQuestion
has title: Generic method won't work
tagged with: dictionary
has body: My generic method gives casting exception. java.util.LinkedHashMap cannot be cast to com.example.model.Student main class public static void main(String[] args) { Map&lt;String, Student&gt; students = SampleClass.getStudents("students.json"); System.out.println(students.get("student1").getName()); } SampleClass public static &lt;T&gt; Map&lt;String, T&gt; getStudents(String filename) { Map&lt;String, T&gt; studentMap = null; ObjectMapper mapper = new ObjectMapper(); try { studentMap = mapper.readValue(new File(filename), new TypeReference&lt;Map&lt;String, T&gt;&gt;() { }); } catch (JsonParseException e) { System.out.println(e.getMessage()); } catch (JsonMappingException e) { System.out.println(e.getMessage()); } catch (IOException e) { System.out.println(e.getMessage()); } return (Map&lt;String, T&gt;)studentMap; } what I'm doing wrong? UPDATE json file { "student1" : { "name" : "name1", "age" : 22 }, "student2" : { "name" : "name2", "age" : 22 } } UPDATE found this as solution.
has comment: http://stackoverflow.com/comment/36128169
has answer: http://stackoverflow.com/a/23547974
has comment: http://stackoverflow.com/comment/36128902
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/11798394
has answer: http://stackoverflow.com/a/23548574
tagged with: jackson
linked to: http://stackoverflow.com/q/11664894
score: 0
answer count: 2
tagged with: generic-method

http://stackoverflow.com/q/23572530
tagged with: java
tagged with: hibernate
tagged with: pagination
score: 0
has body: I have a table of items with a flag of "null" or "done" , I need to fetch the null flagged items ,process them, set flag to done. thing is , I want to use pagination , where I fetch 500 by 500 item(null flagged) my design goes as follows I fetch 500 item // the producer put them in a queue some thread takes these 500 item // the consumer operate on them and updates flag to "done" the problem am facing is the consumer is pretty slow, so the producer fetches the same 500 part again , so I went for indexing but seems not to work properly public List&lt;Parts&gt; getNParts(int listSize) { try { criteria = session.createCriteria(Parts.class); criteria.setFirstResult(DBIndexGuard.getNextIndex()); //index+=500; criteria.add(Restrictions.isNull("Status")); criteria.setMaxResults(listSize); //list size is 500; newPartList = criteria.list(); } catch (Exception e) { e.printStackTrace(); } finally { } return newPartList; } how can I implement pagination in order to fetch 500 by 500 different items with the criteria that these items are null flagged ?
upvote count: 1
has answer: http://stackoverflow.com/a/23572861
has answer: http://stackoverflow.com/a/23575314
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23575607
type: UnansweredQuestion
has title: Hibernate pagination
has answer: http://stackoverflow.com/a/23572697
answer count: 4
type: Question

http://stackoverflow.com/comment/36215151
score: 1
has text: @user1375948 the `Query` interface is very fluent. Check along the methods to see how to use parameters. If you resist to do that, you can check the official documentation as well.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23594314

http://stackoverflow.com/q/23477088
favorite count: 0
tagged with: c++
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35996255
tagged with: integration-testing
type: Question
tagged with: testing
has body: I am completely new to unit testing/integration testing. I have read that unit tests should use mocks when interacting with external systems, but it seems a lot of manual work. For external systems I mean: A big database that my class accesses and computes some information An external web service that my class accesses and retrieves a big XML My class implements a serial protocol that connects to an external machine and after a long dialog retrieves lots of data and computes it. This external system is not always available as it depends on another company. Nevertheless, I want to test my application many times even if not all the external systems are available. I am thinking of a framework (for Java and/or C++) that does the following: Uses some kind of spy and the real external system and the spy "records" (in a local file) all the interactions with the external system. This needs to be run only once. Automatically a mock is created that "replays" the previous interactions of the real system (accessing the local file). This part can be executed as many times as needed. If my application (in the "replay" phase) calls the same methods it called the first time (the "record" phase) it should get the same results. Does such a framework exist? If not, what alternative would you suggest? I have implemented simulators for many external systems but it doubles my work. For example in the case of serial protocol I have to implement my "client" and also a simulator for the "server". I wonder if there's a way to avoid reinventing the wheel every time.
has answer: http://stackoverflow.com/a/23495002
downvote count: 0
accepted answer: http://stackoverflow.com/a/23495002
has title: What record-and-replay network protocol stubbing/mocking tools are there for C++ and Java?
answer count: 1
has comment: http://stackoverflow.com/comment/36004490

http://stackoverflow.com/comment/36085057
score: 1
type: Comment
type: QuestionComment
has text: Actually scrap that, I've read more though the tutorial and it explains how to run the test case as a separate project. Many thanks for your help.
comment on: http://stackoverflow.com/q/23523280

http://stackoverflow.com/q/23582685
has answer: http://stackoverflow.com/a/23582780
score: 0
has title: Java program to swap characters in a string
has body: I am writing a Java program to encrypt a four digit number. Some procedures require to swap 1st digit with 3rd and 2nd with 4th... Here's what I have written, but it's not working. for example, if my input is 9876 then after these four swaps it gives output 9898. which means that first and third Swaps are not working. But if I comment the second and fourth swaps then 1st and 3rd swap works. char ch; ch=str.charAt(0); str=str.replace(str.charAt(0),str.charAt(2)); str=str.replace(str.charAt(2),ch); ch=str.charAt(1); str=str.replace(str.charAt(1),str.charAt(3)); str=str.replace(str.charAt(3),ch);
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23582719
type: Question
answer count: 2

http://stackoverflow.com/q/23545198
tagged with: mendeley
has comment: http://stackoverflow.com/comment/36132913
tagged with: apache
answer count: 1
downvote count: 0
has title: Oauth 2 in Mendeley with Java
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23563434
tagged with: oauth
tagged with: oauth-2.0
upvote count: 1
has body: I need to create an application with Mendeley in Java. But I have problems with the oauth2's conexion. I use Apache Oltu, but if you know another better alternative, told me please. I have this: OAuthClientRequest request = OAuthClientRequest .tokenLocation("https://api-oauth2.mendeley.com/oauth/token") .setGrantType(GrantType.AUTHORIZATION_CODE) .setClientId(CLIENT_ID) .setClientSecret(CLIENTE_SECRET) .setRedirectURI(REDIRECT_URI) .setCode("code") .setScope("all") .buildQueryMessage(); OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient()); GitHubTokenResponse oAuthResponse = oAuthClient.accessToken(request, GitHubTokenResponse.class); String accessToken = oAuthResponse.getAccessToken(); String expiresIn = oAuthResponse.getExpiresIn().toString(); System.out.println("ACCESS TOKEN: " + accessToken); System.out.println("EXPIRES IN : " + expiresIn); but this produces this exception: Exception in thread "main" OAuthProblemException{error='invalid_request', description='Missing parameters: access_token', uri='null', state='null', scope='null', redirectUri='null', responseStatus=0, parameters={}} at org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:59)....... Any idea? I repeat, if you know another alternative or solution help me please. Thanks a lot.
type: Question
score: 1
tagged with: java

http://stackoverflow.com/a/33619237
downvote count: 0
type: Answer
score: 4
has body: Here's a solution where security checking is disabled (for example, conversing with the localhost) Also, some of the solutions I've seen now contain deprecated methods and such. /** * @param configFilePath * @param ipAddress * @param userId * @param password * @throws MalformedURLException */ public Upgrade(String aConfigFilePath, String ipAddress, String userId, String password) { configFilePath = aConfigFilePath; baseUri = "https://" + ipAddress + ":" + PORT + "/"; restTemplate = new RestTemplate(createSecureTransport(userId, password, ipAddress, PORT)); restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter()); restTemplate.getMessageConverters().add(new StringHttpMessageConverter()); } ClientHttpRequestFactory createSecureTransport(String username, String password, String host, int port) { HostnameVerifier nullHostnameVerifier = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }; UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password); CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials( new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT, AuthScope.ANY_REALM), credentials); HttpClient client = HttpClientBuilder.create() .setSSLHostnameVerifier(nullHostnameVerifier) .setSSLContext(createContext()) .setDefaultCredentialsProvider(credentialsProvider).build(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(client); return requestFactory; } private SSLContext createContext() { TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType) { } public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType) { } } }; try { SSLContext s…
answers question: http://stackoverflow.com/q/23504819
upvote count: 4

http://stackoverflow.com/comment/36414687
comment on: http://stackoverflow.com/a/23521871
type: Comment
has text: @r.bhardwaj - that's certainly better as you wouldn't run the risk of arbitrary code execution. The only remaining issue is the 'usual' problem that any page (and subframe) can call either alert or console.log. The code to handle onConsoleMessage/onJsAlert should be written with that in mind. Also, something like loadUrl("javascript:console.log('"+randomNumber+":' + function())"); and only trusting callbacks that contain the right number would make it harder for any potential attacker to trick your app.
score: 1
type: AnswerComment

http://stackoverflow.com/q/23594832
answer count: 2
has title: non-static variable cannot be referenced from static context
favorite count: 0
tagged with: static
score: 0
tagged with: non-static
has body: i have read similar issues on here, but i still can't figure out how to fix my code. i am testing a timer and while i can put the timer output in the command line while the gui opens in seperate thread i cannot get the timer's output into my JtextArea called attArea. i understand i am not referencing the instance of my Gui class which causes the problem, but i do not know how to fix my code so i can. i have even tried instantiating my timer class inside the buildGui method belonging to Gui class. that way compiles and the timer is running i think because the exit on close from the Gui does not give me a new prompt on the command line, so the timer must still be running on it's own thread. however it is not printing in the attarea. below is my code(3 classes) class Main{ public static void main(String[] args){ new Gui(); new TimerTest(); } } next class import javax.swing.*; import java.awt.*; class Gui extends JFrame{ int fieldWidth = 20; String[] choose = {"Choose"}; JPanel pnlBack = new JPanel(); JPanel topPanel = new JPanel(); JPanel citiesPanel = new JPanel(); JLabel citiesLabel = new JLabel("Cities: "); JComboBox citiesBox = new JComboBox(choose); //citiesBox.add("choose"); JPanel typePanel = new JPanel(); JLabel typeLabel = new JLabel("Type: "); JComboBox typeBox = new JComboBox(choose); JPanel namePanel = new JPanel(); JLabel nameLabel = new JLabel("Name: "); JComboBox nameBox = new JComboBox(choose); JPanel midPanel = new JPanel(); JPanel attPanel = new JPanel(); JTextArea attArea = new JTextArea(12, 50); JPanel bottomPanel = new JPanel(); JPanel gasPricePanel = new JPanel(); JLabel gasPriceLabel = new JLabel(" Price of gas: "); JTextField gasPriceBox = new JTextField(fieldWidth); JPanel mpgPanel = new JPanel(); JLabel mpgLabel = new JLabel(" mpg of vehicle: "); JTextField mpgBox = new JTextField(fieldWidth); JPanel moneyPanel = new JPanel(); JLabel moneyLabel = new JLabel(" Money you have:"); JTextField moneyBox = new JTextField(fieldWidth); JPanel costPanel…
has answer: http://stackoverflow.com/a/23594889
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/23594896
type: Question
tagged with: java

http://stackoverflow.com/a/30590522
type: Answer
score: 0
has body: I am using another approach , for similar task. Create empty subproject in main playframework project. In build.sbt it looks like // Main project lazy val root = (project in file(".")).enablePlugins(play.PlayScala).enablePlugins(com.typesafe.sbt.web.SbtWeb) // Utils sbt project with scripts lazy val sjutil = project.aggregate(root).dependsOn(root) and sjutil/build.sbt like normal sbt project with extra deps if needed, for me it was akka-remote name := "sjutil" version := "1.0-SNAPSHOT" scalaVersion := "2.11.1" libraryDependencies += "com.typesafe.akka" %% "akka-remote" % "2.3.4" You can place some App direct in sjutil/ folder sjutil/actorsstarter.scala: object actorsstarter { lazy val logger = play.api.Logger("actorsstarter") def main(args: Array[String]) { // read config from conf/application.conf of main project val remoteConfig = ConfigFactory.load.getConfig("botstarter") val system = ActorSystem("application",remoteConfig) val path = "akka.tcp://application@127.0.0.1:2553/user" .... logger.info("Started") } } after that you can run this script with: ./activator sjutil/run and make everything you can do with normal project: stage, dist and etc.
answers question: http://stackoverflow.com/q/23583244

z-order
tags question: http://stackoverflow.com/q/23555676
tag name: z-order
type: Tag

http://stackoverflow.com/comment/36025801
has text: Please share the whole method body so I can run it locally and revert back.
comment on: http://stackoverflow.com/a/23492898
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23586362
tagged with: java
has answer: http://stackoverflow.com/a/24031192
type: Question
has answer: http://stackoverflow.com/a/23587245
has title: Parse Local Datastore: I can't access ACL secured objects from the network after force closing the app? (Android)
accepted answer: http://stackoverflow.com/a/24031192
has answer: http://stackoverflow.com/a/23586423
possible better answer: http://stackoverflow.com/a/23586408
downvote count: 0
has answer: http://stackoverflow.com/a/23586408
favorite count: 0
tagged with: parse-platform
tagged with: sdk
tagged with: android
tagged with: facebook
has body: After a successful login I'm calling: ParseUser currentUser = ParseUser.getCurrentUser(); currentUser.isAuthenticated() Now if I switch to another app via the home button or multitasking and return to my app the currentUser is still authenticated. But if I force close the app and then reopen it the currentUser is not authenticated. Therefore it seems that I can't access any objects from the network which have the default Access Control List (ACL) added to them via: Parse.enableLocalDatastore(this); ParseACL.setDefaultACL(new ParseACL(), true); Update with sample code: // Pinning ParseObject gameScore = new ParseObject("GameScore"); gameScore.put("score", 1337); gameScore.put("playerName", "Sean Plott"); gameScore.put("cheatMode", false); gameScore.pinInBackground("NEW_GAMESCORES", null); // Syncing Local Changes ParseQuery&lt;ParseObject&gt; localQueryNewScores = ParseQuery .getQuery("GameScore"); localQueryNewScores.fromPin("NEW_GAMESCORES"); localQueryNewScores.findInBackground(new FindCallback&lt;ParseObject&gt;() { public void done(List&lt;ParseObject&gt; scores, ParseException e) { Log.d("score", "New scores = " + scores.size()); for (ParseObject score : scores) { score.saveInBackground(); score.unpinInBackground("NEW_GAMESCORES", null); score.pinInBackground("GAMESCORES", null); } } }); // Syncing Network Changes ParseQuery&lt;ParseObject&gt; networkQueryScores = ParseQuery .getQuery("GameScore"); // Query for new results from the network. networkQueryScores.findInBackground(new FindCallback&lt;ParseObject&gt;() { public void done(final List&lt;ParseObject&gt; scores, ParseException e) { Log.d("score", "Network scores = " + scores.size()); // Remove the previously cached results. ParseObject.unpinAllInBackground("GAMESCORES", new DeleteCallback() { public void done(ParseException e) { // Cache the new results. ParseObject.pinAllInBackground("GAMESCORES", scores); } }); } }); // Querying the Local Datastore ParseQuery&lt;ParseObject&gt; localQueryScores = Parse…
answer count: 4
type: AnsweredQuestion
score: 2
upvote count: 2

http://stackoverflow.com/q/23582478
tagged with: loops
has answer: http://stackoverflow.com/a/23582504
type: Question
answer count: 2
has title: endless while loop in Java
score: -1
has answer: http://stackoverflow.com/a/23582596
has body: int option=0; while (option1!=1 || option1!=2){ System.out.println("Give 1 for the first list which includes what we have in our exhibition"); System.out.print("and 2 which we have not:"); // 2 print because i want to show at two different lines option1= Integer.parseInt(in.nextLine());} // when i give 1 or 2 as an option it doesn't goes out frome the loop
has comment: http://stackoverflow.com/comment/36192872
tagged with: while-loop
possible better answer: http://stackoverflow.com/a/23582596
accepted answer: http://stackoverflow.com/a/23582504
favorite count: 0
has comment: http://stackoverflow.com/comment/36192906
downvote count: 2
upvote count: 1
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36018437
score: 0
has text: I don't think there is a specific method to check if a date follows a given pattern. I would use the SimpleDateFormat.parse method and check for a ParseException. In case you are sure that the date is correct and it is in one of the two patterns, you could just check if there is '.' in the string.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23488721

http://stackoverflow.com/comment/35985897
has text: Although this might be the reason, why the copy mechanism is complained about, a shallow copy is still enough. Keep in mind: _String is immutable_.
comment on: http://stackoverflow.com/a/23471215
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36181561
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23532993
has text: Thanks for the advice on the design. I am using the number of consumers as a trigger whether to put a stop message on the queue and stop the process consuming the messages. If there are no consumers of the queue, there is nothing to stop and putting a message will only cause a premature stoppage later once the process is restarted. Do you happen to have a java code snippet for this?

http://stackoverflow.com/comment/36159937
type: AnswerComment
score: 0
type: Comment
has text: All students are read from the database since students() is called and therefore all the changes show
comment on: http://stackoverflow.com/a/23564223

http://stackoverflow.com/a/23496481
score: 0
answers question: http://stackoverflow.com/q/23479560
type: Answer
has body: From the documentation: BasicDBObject doc = new BasicDBObject("Physicalentity", "Pressure"). append("Sensor", "Tinkerforge"). append("Unit", "Lux"). append("loc", new BasicDBObject("longtitude", 203).append("latitude", 102)); append("value", pressure). append("time", time). append("date", date); pre_collection.insert(doc); But maybe you can do a little trick and remove with code the first and the last quotes like this: String word="[wdsd34svdf]"; System.out.println(word.substring(1, word.length()-1)); I hope it helps :)

http://stackoverflow.com/q/23602041
score: 0
answer count: 2
tagged with: countdown
tagged with: timer
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23604635
has title: How can i Reset my Timer value meanwhile completion of timer?
has answer: http://stackoverflow.com/a/23603449
tagged with: java
type: Question
tagged with: counter
has body: I am trying to start a timer when activity created and be able to reset the timer back from zero if the same button is pressed but every time I press the button that initiates the set Interval it seems to be creating a new interval and not resetting the one that was already creating. Can someone help please? Here is my code timer = (TextView) findViewById(R.id.timer_value); Count = new CountDownTimer(time, 1000) { public void onTick(long millisUntilFinished) { timer.setText("Time Left: " + millisUntilFinished / 1000); } public void onFinish() { timer.setText("OUT OF TIME!"); if (time &lt; 10000) { time = 10000; } AlertDialog.Builder builder = new AlertDialog.Builder( TicTacToe.this); builder.setMessage("You are Out of Time").setPositiveButton( "Replay", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // reset the game environment. Count.onFinish(); // Count.cancel(); Count.start(); new_game(player_name_1); } }); AlertDialog alert = builder.create(); alert.show(); } }.start();

http://stackoverflow.com/comment/36304041
score: 0
has text: You're welcome. Now if you're stuck again, create a new question, with specific problem. This one is too huge to be really answered, so focus one thing at a time. Good luck !
type: AnswerComment
comment on: http://stackoverflow.com/a/23615833
type: Comment

http://stackoverflow.com/comment/36141554
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23536470
type: Comment
has text: Okay, maybe I should just ask, which is the best way to implement add/remove/peek? Should add() sort the array immediately so remove can remove the first element, or should add() just add it to the front and remove/peek will traverse to find the highest priority element? Which one is the best way to do it?

http://stackoverflow.com/comment/36147312
comment on: http://stackoverflow.com/a/23557076
score: 0
type: Comment
has text: i followed you advice but my program still not working the code i write is String strSQL = "Query"; pstmt.setString(1, locationID); pstmt =con.prepareStatement(strSQL,ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); log.debug(pstmt);rs=pstmt.executeQuery(); while (rs.next()) { piscode = rs.getString("pis_code").trim(); password = rs.getString("pis_passwd"); pis.add(piscode); pwd.add(password);passwdMatched = checkPassword(piscode,password); if(passwdMatched) s="true"; else s="false"; rs.updateString(2,s);
type: AnswerComment

http://stackoverflow.com/comment/36031921
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23496309
type: Comment
has text: How about maintaining a map instead of traversing the whole values every time, It wont cause a big impact on performance but still?

http://stackoverflow.com/q/23546909
tagged with: objectinputstream
type: Question
score: 5
has body: I'm trying to construct an ObjectInputStream from a string but I'm getting a java.io.StreamCorruptedException: My code: public static final String PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7bO/38XhXYLJikoEEQ7s\naHKYcrrkD2Q+IWS6P0GOOvoX0rfRI6Hb30ETBE/ySzV6F9tpgtCbjU/w7tE8vmOy\nxQDwToUobbS+uZDi+F72PAY9NRKRogtY7YCwJuvAxNVmsTu9i/P/oA3qO3l0ge61\nZu3lMf4ujh969T9Dj0fjIdXQGewqk+ROB6UqoIEHTYi9wRdPlxDGnKTrORu5I5hH\n1xQfM0l49ME36G4u3Ipg5Y9Tqr1F8EL82GYeRoSX+xG+brQAdbjnQGrmrW/VFRkT\n9uL327vrRjiOit9yoTNtP3HYk1g5+Db7XdSNi+8KHZOQ3T2xcYFseXNnd7nIGj97\nBwIDAQAB\n-----END PUBLIC KEY-----"; public static final String PRIVATE_KEY_FILE = "C:/keys/private.key"; public static void test() { Log.d("DEBUG","Original Text: "); try { final String originalText = "top secret text"; ObjectInputStream inputStream = null; InputStream is = new ByteArrayInputStream(PUBLIC_KEY.getBytes()); //Log.d("DEBUG","Original Text:3 " + convertStreamToString(is)); // Encrypt the string using the public key inputStream = new ObjectInputStream(is); final PublicKey publicKey = (PublicKey) inputStream.readObject(); final byte[] cipherText = encrypt(originalText, publicKey); // Decrypt the cipher text using the private key. inputStream = new ObjectInputStream(new ByteArrayInputStream(PRIVATE_KEY.getBytes())); final PrivateKey privateKey = (PrivateKey) inputStream.readObject(); final String plainText = decrypt(cipherText, privateKey); // Printing the Original, Encrypted and Decrypted Text Log.d("DEBUG","Original Text: " + originalText); Log.d("DEBUG","Encrypted Text: " +cipherText.toString()); Log.d("DEBUG","Decrypted Text: " + plainText); } catch (Exception e) { e.printStackTrace(); } } Could someone explain me what I am doing wrong ?
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/23547026
has title: Android convert string to ObjectInputStream
answer count: 1
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/23547026
tagged with: android
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36126654
has comment: http://stackoverflow.com/comment/36126592

http://stackoverflow.com/a/23591187
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23590487
answers question: http://stackoverflow.com/q/23590487
type: Answer
downvote count: 0
score: 1
has body: If you use wait() on the main thread then your UI Thread will freeze till some other method calls notify() and the execution of the further code starts.
upvote count: 1

http://stackoverflow.com/comment/36086960
comment on: http://stackoverflow.com/a/23481890
type: AnswerComment
has text: You wouldn't need to (include them in the class path). You would need to place them out side of your jar, on the file system and access them like a normal file, if possible, up using a relative path
type: Comment
score: 0

http://stackoverflow.com/comment/36030183
score: 0
type: Comment
type: QuestionComment
has text: @keyser Could you explain it more explicitly?
comment on: http://stackoverflow.com/q/23495326

http://stackoverflow.com/q/23490313
answer count: 0
downvote count: 0
has title: unable to retrieve the new primary key from the database
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36021367
has comment: http://stackoverflow.com/comment/36020378
tagged with: mysql
tagged with: eclipse
type: Question
upvote count: 1
has body: I have a gaming project. Each game dynamically generates a unique id. I retrieve the primary key from the database using the id by using the where clause. Once the game is over the user can play the game again. Second time he plays the game a new unique id is generated. Now when i try to retrieve the new primary key by specifying the new id, instead of getting the new primary key i am getting the older primary key. what may be the reason for this strange behavior? public long getPrimaryKey(String id) { Query q = getSession().createQuery("FROM Game_Answers g where g.gameid= '"+id+"' "); Game_Answers ga=(Game_Answers)q.uniqueResult(); return ga.getId(); }
has comment: http://stackoverflow.com/comment/36021411
favorite count: 0
has comment: http://stackoverflow.com/comment/36020614

http://stackoverflow.com/comment/36560632
has text: @marcin.kosiba: Actually, the app behaves like a browser(which doesn't store any user info) and where results are displayed from our secure server(search engine). There is no native login functionality in the app.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23521871
type: Comment

http://stackoverflow.com/a/23518308
type: Answer
has body: Personally I would skip all the hassle with separate directories as well as collections. You would endlessly have to move files around, or changes their properties. It would be much easier to not calculate anything up front, and simply use lastModified property, or something alike, to determine most recent items at run-time. HTH!
has comment: http://stackoverflow.com/comment/36086683
has comment: http://stackoverflow.com/comment/36113447
has comment: http://stackoverflow.com/comment/36113568
answers question: http://stackoverflow.com/q/23482946
has comment: http://stackoverflow.com/comment/36090436
score: 0

http://stackoverflow.com/comment/36251896
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23610651
has text: @haraldK how did you try it? I am talking about a web application in Servlet. Look at my another post [different locale pattern on standalone Java application and Web application](http://stackoverflow.com/questions/23613071/different-locale-pattern-on-standalone-java-application-and-web-application)

http://stackoverflow.com/a/23534482
has body: The javadocs are for this. Here you can see that Throwable is the superclass for all Exceptions and Errors. Then you have checked and unchecked Exceptions, where the latter is RuntimeException and all its subclasses. Remember to use Google when you're wondering about things like this, because all this information is widely available and easily found with a search engine.
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/23534439
downvote count: 0

http://stackoverflow.com/q/23596367
upvote count: 1
answer count: 1
tagged with: jsp
favorite count: 0
has title: Dojo plugin not working in Struts 2
accepted answer: http://stackoverflow.com/a/23597194
tagged with: dojo
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23597194
type: Question
tagged with: struts2
has body: None of ajax tags are working in my code. I simply wants to use tabbedpanel,but it is not showing. My code is : tabbedpanel.jsp : <%@ taglib uri="/struts-tags" prefix="s" %> <%@ taglib uri="/struts-dojo-tags" prefix="sx" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <sx:head debug="true" cache="false" compressed="false" /> Insert title here <s:form> <sx:tabbedpanel id="tabContainer"> <sx:div id="one" label="Tab 1" theme="ajax"> first tab </sx:div> <sx:div id="two" label="Tab 2" theme="ajax"> second Tab </sx:div> </sx:tabbedpanel> <s:submit value="submit" ></s:submit> </s:form> and tabs.java: package com.heman; import com.opensymphony.xwork2.ActionSupport; public class tabs extends ActionSupport { @Override public String execute() throws Exception { // TODO Auto-generated method stub return SUCCESS; } } and struts.xml : <?xml version="1.0" encoding="UTF-8"?> tabbedpanel.jsp It is not showing up in tabbed panels but it simple shows on same place.
tagged with: struts2-jquery

minecraft
tags question: http://stackoverflow.com/q/23457364
tags question: http://stackoverflow.com/q/23569894
tags question: http://stackoverflow.com/q/23483903
tags question: http://stackoverflow.com/q/23507451
tags question: http://stackoverflow.com/q/23567822
type: Tag
tags question: http://stackoverflow.com/q/23580991
tags question: http://stackoverflow.com/q/23524243
tags question: http://stackoverflow.com/q/23583624
tags question: http://stackoverflow.com/q/23482443
tags question: http://stackoverflow.com/q/23595649
tags question: http://stackoverflow.com/q/23587270
tag name: minecraft

http://stackoverflow.com/q/23478347
has answer: http://stackoverflow.com/a/23519520
has answer: http://stackoverflow.com/a/23481220
has title: How to draw a rotated rectangle
possible better answer: http://stackoverflow.com/a/23482675
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/36004126
linked to: http://stackoverflow.com/q/1240660
has answer: http://stackoverflow.com/a/23482675
upvote count: 3
tagged with: java
type: Question
tagged with: graphics
has body: Can anyone share a code how to draw a rectangle like this? (not vertical, not horizontal, somewhere between) Because as I see you can only specify 4 ints to function DrawRect(), not 4 points. The area of rectangle must be sensitive to touch (I use Contains() method) As I tried, Matrix and Rotate() update only graphics, the rect's area remains the same it was
accepted answer: http://stackoverflow.com/a/23519520
downvote count: 0
answer count: 3
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/36104868
type: AnswerComment
comment on: http://stackoverflow.com/a/23534121
has text: When I call `Singleton.getInstance().getSocket();` the getInstance method calls the `initSingleton()` so the Singleton gets created. What printed when it crashed?
type: Comment
score: 0

http://stackoverflow.com/comment/36178677
score: 0
type: Comment
has text: @minimen What is the other exception?
comment on: http://stackoverflow.com/a/23574547
type: AnswerComment

http://stackoverflow.com/comment/35989599
type: Comment
has text: Did u follow my answer ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23466604

eclipse-wtp
tags question: http://stackoverflow.com/q/23530157
tag name: eclipse-wtp
type: Tag

http://stackoverflow.com/q/23562832
tagged with: java
has comment: http://stackoverflow.com/comment/36155754
downvote count: 1
has answer: http://stackoverflow.com/a/23562993
has body: In Java, I have defined an interface MyInterfaceName [MyInterfaceName.class]. This .class file is available inside a jarFile. Using Java Reflection, I am trying to use the method, class.isInterface() in this particular class, but it returns false. Again, based upon the following references, http://tutorials.jenkov.com/java-reflection/classes.html#modifiers http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Modifier.html#isInterface(int) ModifierValueLink I tried the following code: int modifierValue = MyInterfaceName.class.getModifiers(); System.out.println(modifierValue) boolean interfaceFound = Modifier.isInterface(modifierValue); System.out.println(interfaceFound) This interfaceFound returns only false. Also, modifierValue returns 17, which doesn't fit anywhere in the ModifierValueLink I have provided. But MyInterfaceName is an interface defined according to java standards. I couldn't understand why it doesn't work. Please help out. Thanks.
has comment: http://stackoverflow.com/comment/36156170
type: Question
has answer: http://stackoverflow.com/a/23564442
linked to: http://stackoverflow.com/q/11016092
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36156772
has comment: http://stackoverflow.com/comment/36156387
upvote count: 1
has comment: http://stackoverflow.com/comment/36156723
favorite count: 0
has comment: http://stackoverflow.com/comment/36156382
has comment: http://stackoverflow.com/comment/36156361
has comment: http://stackoverflow.com/comment/36155744
has title: Java isInterface() does not return true for an Interface
has comment: http://stackoverflow.com/comment/36156302
tagged with: reflection
has comment: http://stackoverflow.com/comment/36155915
type: UnansweredQuestion

http://stackoverflow.com/a/23564305
upvote count: 2
downvote count: 0
has body: When you are adding a new row, it is being populated correctly. (You can see the ImageIcon). So, the JButton object is also being inserted correctly. The only difference here, JTable does not know how to display it or handle events on it. That is why JTable calls toString() method on JButton and displays the text (as you mentioned). javax.swing.JButt...... To overcome this problem, we need to supply two additional objects to the JTable. TableCellEditor to handle events. TableCellRenderer to handle painting. You can find additional information about implementation details here : How to use custom JTable cell editor and cell renderer Hope this helps. Good luck. Edit in response to the comment. table.getColumnModel().getColumn(7).setCellRenderer(new MyCellRenderer()); // Put painting logic in MyCellRenderer class. This way you can assign different renderer objects to different columns.
has comment: http://stackoverflow.com/comment/36158642
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23563827

http://stackoverflow.com/comment/36216196
comment on: http://stackoverflow.com/q/23594864
score: 0
has text: @Don Roby.I apologise.Will do so next time.Just that I dont know what I am missing and tried very hard to get it but I dont.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23573307
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23573414
score: 1
upvote count: 1
type: Question
tagged with: java
has body: If I have two different packages that have classes with the same name, and I want specifically to call class1 from package1 I would use: import package1.class1; import package2.*; But what if I also want all the other classes of package1? Would the correct code be: import package1.*; import package2.*; and then package1.class1 teste = new package1.class1(); ?
has answer: http://stackoverflow.com/a/23573414
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36176062
favorite count: 0
linked to: http://stackoverflow.com/q/4368120
tagged with: package
has title: Import two packages that have the same classe but also other classes

http://stackoverflow.com/q/23589749
answer count: 3
has answer: http://stackoverflow.com/a/23617366
has answer: http://stackoverflow.com/a/23737016
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23754431
upvote count: 3
type: Question
score: 3
tagged with: java
has title: Access HornetQ Connection Factory (Locally) via JNDI in JBoss EAP 6.2.0
tagged with: jboss
accepted answer: http://stackoverflow.com/a/23754431
tagged with: jboss6.x
tagged with: hornetq
downvote count: 0
favorite count: 0
has body: I'v deployed a web application (jms-api.war) in JBoss, and I want to get a JMS connection factory via JNDI from it, Is it possible without any configuration (like this)? I tried to use JNDI without any configuration: my connection factory in standalone.xml: &lt;jms-connection-factories&gt; &lt;connection-factory name="InVmConnectionFactory"&gt; &lt;connectors&gt; &lt;connector-ref connector-name="in-vm"/&gt; &lt;/connectors&gt; &lt;entries&gt; &lt;entry name="java:/ConnectionFactory"/&gt; &lt;/entries&gt; &lt;/connection-factory&gt; &lt;/jms-connection-factories&gt; And in my application i have this spring bean to access connection factory (It's working in my tests with embedded hornetq): &lt;bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean"&gt; &lt;property name="jndiName" value="/ConnectionFactory" /&gt; &lt;property name="resourceRef" value="true"/&gt; &lt;/bean&gt; In jboss startup i get this error, how can i solve it?: JBAS014775: New missing/unsatisfied dependencies: service jboss.naming.context.java.jboss.resources.jms.ConnectionFactory (missing) dependents: [service jboss.naming.context.java.module.jms-api.jms-api.env.jms.ConnectionFactory] Jboss log (hornetq start part): 11:00:32,689 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 50) HQ221000: live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=C:\Users\Mojtaba\workspace-hornetq\build\appserver\jboss\standalone\data\../../../hornetqdata/journal,bindingsDirectory=C:\Users\Mojtaba\workspace-hornetq\build\appserver\jboss\standalone\data\../../../hornetqdata/bindings,largeMessagesDirectory=C:\Users\Mojtaba\workspace-hornetq\build\appserver\jboss\standalone\data\../../../hornetqdata/large-message,pagingDirectory=C:\Users\Mojtaba\workspace-hornetq\build\appserver\jboss\standalone\data\../../../hornetqdata/paging) 11:00:32,691 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 50…
possible better answer: http://stackoverflow.com/a/23617366

file
type: Tag
tags question: http://stackoverflow.com/q/23586045
tags question: http://stackoverflow.com/q/23508708
tags question: http://stackoverflow.com/q/23570944
tags question: http://stackoverflow.com/q/23462077
tags question: http://stackoverflow.com/q/23599956
tags question: http://stackoverflow.com/q/23587065
tags question: http://stackoverflow.com/q/23534474
tags question: http://stackoverflow.com/q/23550863
tags question: http://stackoverflow.com/q/23561456
tags question: http://stackoverflow.com/q/23551227
tags question: http://stackoverflow.com/q/23569488
tags question: http://stackoverflow.com/q/23496119
tag name: file
tags question: http://stackoverflow.com/q/23530897
tags question: http://stackoverflow.com/q/23587604
tags question: http://stackoverflow.com/q/23514069
tags question: http://stackoverflow.com/q/23530127
tags question: http://stackoverflow.com/q/23576212
tags question: http://stackoverflow.com/q/23518734
tags question: http://stackoverflow.com/q/23609768
tags question: http://stackoverflow.com/q/23574892
tags question: http://stackoverflow.com/q/23559941
tags question: http://stackoverflow.com/q/23579268
tags question: http://stackoverflow.com/q/23513731
tags question: http://stackoverflow.com/q/23587331
tags question: http://stackoverflow.com/q/23533695
tags question: http://stackoverflow.com/q/23552387
tags question: http://stackoverflow.com/q/23454441
tags question: http://stackoverflow.com/q/23461577
tags question: http://stackoverflow.com/q/23531111
tags question: http://stackoverflow.com/q/23580312
tags question: http://stackoverflow.com/q/23482443
tags question: http://stackoverflow.com/q/23579929
tags question: http://stackoverflow.com/q/23585671
tags question: http://stackoverflow.com/q/23536233
tags question: http://stackoverflow.com/q/23515878
tags question: http://stackoverflow.com/q/23614466
tags question: http://stackoverflow.com/q/23573423
tags question: http://stackoverflow.com/q/23568455
tags question: http://stackoverflow.com/q/23525947
tags question: http://stackoverflow.com/q/23485855

http://stackoverflow.com/q/23457966
has comment: http://stackoverflow.com/comment/35960858
has answer: http://stackoverflow.com/a/23458117
favorite count: 0
has comment: http://stackoverflow.com/comment/35960894
possible better answer: http://stackoverflow.com/a/23458228
has answer: http://stackoverflow.com/a/23458228
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35960830
upvote count: 3
has body: How feasible is to do something like this? Consider Enum* a enum Enum* { /* ... */ }... public static void main(String[] args) { ?[] types = new ?[] { Enum1, Enum2, Enum3 }; for(? type : types) { for(Enum elem : type.values() { /* ... */ } } } My main requirement is basically a bunch of String constants, each one grouped in a different type. Would I be better set with a bidimensional String array (String[][])? I'd like some more constrained values, rather than types[j] where j==1 is A, and j==2 is B. I know I could play around with reflection, but I dare say it would turn out too complex and then, less readable.
tagged with: java
accepted answer: http://stackoverflow.com/a/23458117
has title: Java Array of Enum (classes)
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/35960745
tagged with: enums
tagged with: arrays
has comment: http://stackoverflow.com/comment/35960799
answer count: 2
score: 2

http://stackoverflow.com/comment/36081450
has text: @Siddharth Then copy the code of BioJava for your "stand alone application", (keep in mind the copy rights).
comment on: http://stackoverflow.com/q/23522446
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23480684
score: -3
has body: I have an error message in Java eclipse. I have a database in MySql and it has colomns String user_name, int id_time, int id_desk, int user_password. I want to insert data with using public void reserve(String user_name, int id_time, int id_desk, int user_password){ try{ String reserveSql = "INSERT INTO reservation" +"VALUES ('" + user_name + "," + id_time + "," + id_desk + "," + user_password + "');"; stmt.executeUpdate(reserveSql); }catch (SQLException ex) { System.out.println("Error: " + ex.getMessage()); } } method. In database user_name is varchar(45), id_time is int(3), id_desk is int(3) and user_password is int(4) But in main method when i write object.reserve("irem",002,111,1111); it give me error message that Error: 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 ''irem,2,111,1111')' at line 1 how can i fix it? Thanks for helping
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/36003459
has comment: http://stackoverflow.com/comment/36003282
downvote count: 3
accepted answer: http://stackoverflow.com/a/23480847
tagged with: sql
has title: Error: 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 **
answer count: 1
tagged with: insert
favorite count: 0
has answer: http://stackoverflow.com/a/23480847

http://stackoverflow.com/q/23529720
has comment: http://stackoverflow.com/comment/36095185
has comment: http://stackoverflow.com/comment/36095309
upvote count: 3
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36095084
has comment: http://stackoverflow.com/comment/36095266
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/36095155
has comment: http://stackoverflow.com/comment/36095130
tagged with: sorting
linked to: http://stackoverflow.com/q/16088994
has answer: http://stackoverflow.com/a/23529845
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/36095474
has title: How can I sort an arraylist without using collections.sort()?
linked to: http://stackoverflow.com/q/7787754
answer count: 1
has comment: http://stackoverflow.com/comment/36095606
linked to: http://stackoverflow.com/q/13727030
favorite count: 0
duplicate of: http://stackoverflow.com/q/7787754
has body: I have been looking for a while for a way to sort an arraylist without using collections.sort as my own logic is flawed and I have been having a lot of trouble. I need to sort it in a way that I can use a method I created that basically does what collections.swap does in order to completely sort an arraylist. Here is my code: public static void mySort(ArrayList&lt;Double&gt; sort){ int min = 0; int i; int j = 0; for(i = 0; i &lt; sort.size() - 1; i++) { min = i; mySwap(sort, j ,min); for(j = 0; j &lt; sort.size() -1;j++){ if(j &lt; min ){ min = j; } } } } public static void mySwap(ArrayList&lt;Double&gt; a, int x, int y){ double temp = a.get(x); a.set(x,a.get(y)); a.set(y,temp); } I have been having a lot of trouble of with this. Sorry if it is a question is that harming the community.
linked to: http://stackoverflow.com/q/14907334
has comment: http://stackoverflow.com/comment/36095312
accepted answer: http://stackoverflow.com/a/23529845
has comment: http://stackoverflow.com/comment/36095250
type: AnsweredQuestion

http://stackoverflow.com/comment/36182536
score: 0
comment on: http://stackoverflow.com/a/23576526
type: Comment
has text: @fscore whoops, forgot to add the `map` caller. See edit. I pasted my C approach, sorry.
type: AnswerComment

http://stackoverflow.com/comment/36087977
type: AnswerComment
has text: Restore Defaults didn't make any difference. I probably should have mentioned that before I posted my question I tried everything in that thread except refactoring, which seemed unnecessarily risky+speculative. I'll edit that in.
comment on: http://stackoverflow.com/a/23526060
type: Comment
score: 0

http://stackoverflow.com/q/23527163
has comment: http://stackoverflow.com/comment/36090705
has comment: http://stackoverflow.com/comment/36090695
has comment: http://stackoverflow.com/comment/36090146
has answer: http://stackoverflow.com/a/23527302
has comment: http://stackoverflow.com/comment/36090327
score: 0
tagged with: java
tagged with: collections
has comment: http://stackoverflow.com/comment/36091013
type: Question
has title: HashMap in service method of servlet
tagged with: hashmap
has comment: http://stackoverflow.com/comment/36090171
has comment: http://stackoverflow.com/comment/36091522
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/36089971
tagged with: servlets
has body: If a HashMap is created under the service method of the servlet than will it be thread safe? It is a user based web-application, different users will login and access the servlet and hence access their specific map data according to their groups. service(request,response) { HashMap h = new HashMap(); h.put(keyfromserver,valuefromserver); // this is in for loop }
has comment: http://stackoverflow.com/comment/36090306
answer count: 1
has comment: http://stackoverflow.com/comment/36090257
has comment: http://stackoverflow.com/comment/36090291
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36090382
has comment: http://stackoverflow.com/comment/36091114

http://stackoverflow.com/a/23472015
score: 1
answers question: http://stackoverflow.com/q/23471224
has body: Two things: The string you want as result is not UTF-8, at least the string you put as example is sort of UTF-16 encoded (java uses UTF-16 internally) An example of code that gives you the string that you want: String str = "special-数据应用-text"; StringBuilder builder = new StringBuilder(); for(char ch: str.toCharArray()) { if(ch &gt;= 0x20 &amp;&amp; ch &lt;= 0x7E) { builder.append(ch); } else { builder.append(String.format("%%u%04X", (int)ch)); } } String result = builder.toString();
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/23576221
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Read your code. The program creates a JFrame. It creates an instance of addressPanel (which should be named AddressPanel). ANd it adds this addressPanel instance to the frame conent pane. Now what is added to the addressPanel? Nothing: public addressPanel() { JPanel addressParent = new JPanel(new BorderLayout()); addressParent.add (new titlePanel(), BorderLayout.NORTH); addressParent.add (new orderTypePanel(), BorderLayout.WEST); addressParent.add (new addressLabelPanel(), BorderLayout.CENTER); addressParent.add (new addressTextPanel(), BorderLayout.EAST); addressParent.add (new buttonsPanel(), BorderLayout.SOUTH); } The constructor of addressPanel creates another panel (addressParent), adds plenty of things to this addressParent panel, but doesn't add anything to this, the addressPanel. So the addressPanel is empty. Please respect the Java naming conventions to make your code readable. Classes start with an uppercase letter.
has comment: http://stackoverflow.com/comment/36211899
answers question: http://stackoverflow.com/q/23576085
has comment: http://stackoverflow.com/comment/36181910

http://stackoverflow.com/comment/36111333
type: Comment
comment on: http://stackoverflow.com/a/23538831
has text: Not sure if that's the problem but normally a SQL server will be smart enough to take in String values (single quotes) for int.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23465004
has answer: http://stackoverflow.com/a/23465077
accepted answer: http://stackoverflow.com/a/23465077
favorite count: 0
tagged with: netbeans
has body: Create a java file in NetBeans, name it Catalog.java. Create one String array to store 3 products for a catalogue Create the appropriate variables to store the product name, product code and product price. At the start of the program display the catalogue for the user by looping through the array and outputting it to the screen with a number listing for each product, as shown above Create an infinite loop to enter orders; to stop the loop the user should enter 0. Keep a running total (accumulator) of all products amount total and sub-total (multiple accumulators) Write a method to calculate the taxes and return a grand total Write another method to print out the order as listed above its supposed to be entered like this I would like to know how to have the user input like this and be stored in an array. Enter Order Number (0 to stop): M3487 Enter Quantity: 2 Enter Order Number (0 to stop): W3876 Enter Quantity: 3 Enter Order Number (0 to stop): R9983 Enter Quantity: 3 Enter Order Number (0 to stop): 0 when i enter the code "M3487" its not going to the quantity, its ending the program. This is the code I have so far. I'm a beginner, so please bear with me. package catalog; import java.util.*; public class Catalog { static String products[] = new String[3]; static int answer; public static void main(String[] args) { System.out.println("------------------"); System.out.println("Shopping Catalog"); System.out.println("------------------"); String[] pCode = new String[3]; float pPrice[] = new float[3]; int orderNum = 0; int quantity=0; Scanner s = new Scanner(System.in); System.out.println("------------------------------------------"); System.out.println("condensed milk [M3487], $9.50 per can."); System.out.println(""); System.out.println("Distilled Water [W3876], $3.00 a bottle."); System.out.println(""); System.out.println("Pack Rice [R9983], $12.75 for 5lbs."); System.out.println("------------------------------------------"); do{ System.out.println("Please enter order…
has title: creating a shopping catalog in netbeans
downvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 0
answer count: 1
score: -1

http://stackoverflow.com/comment/36207903
score: 0
type: Comment
has text: My bad, I thought i have installed it already, but there was NO Storage error, and it was the old install, it works , thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/23590477

nio
tags question: http://stackoverflow.com/q/23579268
tags question: http://stackoverflow.com/q/23528586
tags question: http://stackoverflow.com/q/23468543
tags question: http://stackoverflow.com/q/23550412
tags question: http://stackoverflow.com/q/23476378
tag name: nio
tags question: http://stackoverflow.com/q/23478611
type: Tag
tags question: http://stackoverflow.com/q/23577576

http://stackoverflow.com/comment/35962480
type: Comment
type: QuestionComment
score: 1
has text: Hm, I am still not sure that annotations are what you are looking for. Maybe you would rather need a better approach. Depending on where the code is: You could try something like `rdbtn1.setEnabled(selectedIndex > 1)` - in one method which is called whenever the selection changes. You could also extend the radio buttons and implement them as property change listener, making sure that they are informed whenever the selection changes. But what you would really need is the possibility to bind the properties together. However, I don't know whether this can be achieved in Swing..
comment on: http://stackoverflow.com/q/23458532

http://stackoverflow.com/q/23584034
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/23584074
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/36195981
has answer: http://stackoverflow.com/a/23584092
favorite count: 0
has comment: http://stackoverflow.com/comment/36196026
has comment: http://stackoverflow.com/comment/36196512
has comment: http://stackoverflow.com/comment/36196119
type: UnansweredQuestion
upvote count: 1
has title: Calling JavaScript function from Servlet, Defined in JSP page
has body: i have a JavaScript function function ShowDeptPanel() { document.getElementById("table1").style.visibility="hidden"; document.getElementById("table2").style.visibility="visible"; } which is defined in JSP page, but i want to call it from Servlet. How can i do this ? Note: i want to disable 1 table after a certain check in my Servlet Code.
has comment: http://stackoverflow.com/comment/36195939
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36195971
has comment: http://stackoverflow.com/comment/36195979
tagged with: servlets

http://stackoverflow.com/q/23503686
linked to: http://stackoverflow.com/q/21289140
answer count: 3
has answer: http://stackoverflow.com/a/23503822
linked to: http://stackoverflow.com/q/21868170
favorite count: 0
tagged with: timer
has answer: http://stackoverflow.com/a/23503827
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/4044726
downvote count: 1
linked to: http://stackoverflow.com/q/21532761
has body: I'm trying to understand how to use one some kind of basic animation. I can use threads, but I was told by multiple people not to multi-thread in java. I think I cold do something like: Timer t = new Timer(10, somthing); t.start(); x++; t.end(); That's my basic understanding of it. Can someone link a tutorial or explain how to make a time do something every 10 seconds or longer?
has answer: http://stackoverflow.com/a/23503975
linked to: http://stackoverflow.com/q/4044726
linked to: http://stackoverflow.com/q/21800466
tagged with: java
linked to: http://stackoverflow.com/q/22123266
score: -1
type: Question
linked to: http://stackoverflow.com/q/21587972
upvote count: 0
has title: Animation using a timer?

http://stackoverflow.com/comment/36247498
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23611597
type: Comment
has text: You mean `new java.sql.Timestamp`. `java.sql.Date` only stores date, not date and time.

http://stackoverflow.com/q/23576085
has title: Jpanel is not appearing in JFrame
has comment: http://stackoverflow.com/comment/36181673
tagged with: java
score: -1
type: Question
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23576221
has body: So I am trying to get a JFrame to display a JPanel that has 5 other JPanels in it. I dont have any syntax errors and all that displays is a very small screen. I have been at this all day and have yet to find a solution. public class addressPanel extends JPanel { private JTextField nameT; private JTextField addressT; private JTextField cityT; private JTextField stateT; private JTextField zipCodeT; private JTextField phoneNumberT; private JLabel Title; private JLabel addressTitle; private JLabel nameL; private JLabel addressL; private JLabel stateL; private JLabel cityL; private JLabel zipCodeL; private JLabel phoneNumberL; private JLabel orderType; private JRadioButton takeOut; private JRadioButton delivery; private JButton clear; private JButton submit; private JPanel addressTextPanel; private JPanel addressLabelPanel; private JPanel orderTypePanel; private JPanel titlePanel; private JPanel buttonsPanel; public JPanel addressTextPanel() { nameT = new JTextField(1); addressT = new JTextField(2); cityT = new JTextField(3); stateT = new JTextField(4); zipCodeT = new JTextField(5); phoneNumberT = new JTextField(6); Font font = new Font(Font.SERIF, Font.PLAIN, 24); nameT.setFont(font); addressT.setFont(font); cityT.setFont(font); stateT.setFont(font); zipCodeT.setFont(font); phoneNumberT.setFont(font); JPanel addressTextPanel = new JPanel(); addressTextPanel.setPreferredSize(new Dimension(125, 250)); addressTextPanel.setLayout(new BoxLayout(addressTextPanel, BoxLayout.Y_AXIS)); addressTextPanel.add(nameT); addressTextPanel.add(addressT); addressTextPanel.add(cityT); addressTextPanel.add(stateT); addressTextPanel.add(zipCodeT); addressTextPanel.add(phoneNumberT); return addressTextPanel; } public JPanel addressLabelPanel() { nameL = new JLabel("Name:"); addressL = new JLabel("Address:"); cityL = new JLabel("City:"); zipCodeL = new JLabel("Zip Code:"); stateL = new JLabel("State:"); phoneNumberL = new JLabel("Phone Number:"); nameL.setFont(nameL.getFont().deriveFont(24.0f)…
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36181616
downvote count: 1

http://stackoverflow.com/q/23575884
favorite count: 0
linked to: http://stackoverflow.com/q/17987638
has answer: http://stackoverflow.com/a/23579367
has title: What does @Basic annotation really do?
has body: It seems that @Basic annotation on a java variable only declares that the variable must be saved as a column with NOT NULL constraint. Is that correct ? This post says that: @Basic(optional = false) @Column(nullable = false) The @Basic annotation marks the property as not optional on the Java object level. The second setting, nullable = false on the column mapping, is only responsible for the generation of a NOT NULL database constraint. The Hibernate JPA implementation treats both options the same way in any case, so you may as well use only one of the annotations for this purpose. I am confused. What does this mean - The @Basic annotation marks the property as not optional on the Java object level. How is a property or variable "optional" at Java level ?
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/23579499
score: 17
possible better answer: http://stackoverflow.com/a/23579499
answer count: 2
tagged with: jpa
accepted answer: http://stackoverflow.com/a/23579367
upvote count: 17

http://stackoverflow.com/q/23471451
has answer: http://stackoverflow.com/a/23471503
has comment: http://stackoverflow.com/comment/35985443
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/23471517
has answer: http://stackoverflow.com/a/23471517
answer count: 3
accepted answer: http://stackoverflow.com/a/23471495
upvote count: 1
has title: HashMap change Values Object
has body: I have a set with String and i want to create hash map with String key and Node Object value. and this is my code Set&lt;String&gt; cities = new HashSet&lt;&gt;(); Map&lt;String, Node&gt; allCity = new HashMap&lt;&gt;(); Iterator&lt;String&gt; c = cities.iterator(); while(c.hasNext()){ String name = c.next(); Node cit = new Node(name); allCity.put(name, cit); } my problem is when i read first from c iterator and correctly make new object and put it to hash map but when second object was create in my hash map the previous object value was change like this first read key = "New York" Value = Node (and the value of node is New York) second read Key = "Los Angles" Value = Node (and the value of node is Los Angles) and my first read Value with New York key was change to Los Angles. myNode class public class Node{ private static String city; private static double pathCost; private ArrayList&lt;Edge&gt; neighbours; private Node parent; public Node(String cityName){ city = cityName; neighbours = new ArrayList&lt;&gt;(); } public static String getValue() { return city; } public static void setValue(String city) { Node.city = city; } public static double getPathCost() { return pathCost; } public static void setPathCost(double pathCost) { Node.pathCost = pathCost; } public static String getCity() { return city; } public static void setCity(String city) { Node.city = city; } public ArrayList&lt;Edge&gt; getNeighbours() { return neighbours; } public void setNeighbours(ArrayList&lt;Edge&gt; neighbours) { this.neighbours = neighbours; } public void addNeighbours(Edge n){ this.neighbours.add(n); } public Node getParent() { return parent; } public void setParent(Node parent) { this.parent = parent; } @Override public String toString() { return city; } } Please help me.
favorite count: 0
has answer: http://stackoverflow.com/a/23471495

http://stackoverflow.com/comment/36006415
has text: the code was a sample for you to illustrate the usage of BufferedReader's redLine and Scanner's nextLine. in new version i see that nested main method inside getInputFileName method.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23482188

http://stackoverflow.com/comment/37093485
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24056086
has text: The value is not specific that it will be numeric.It can be numeric or it can be alphanumeric.

http://stackoverflow.com/q/23479332
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am trying to read a json link in java and parse it so I can use it for other matters, but the problem is that I get errors that I really don't know waht to do about them. Here is the code: package weather.data; import weather.data; import com.fasterxml.jackson.core.JsonParseException; //import com.fasterxml.jackson.annotation.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonMappingException; import java.io.File; import java.net.URI; import java.io.IOException; public class usertest { public static void main() throws JsonParseException, JsonMappingException, IOException { URI jsonUrl = new URI("https://gist.githubusercontent.com/anonymous/4b32c7ef1ceb5dd48bf5/raw/ef1987551faa3fb61473bb0e7aad70a228dc36d6/gistfile1.txt"); ObjectMapper mapper = new ObjectMapper(); City = mapper.readValue(jsonUrl, data.class); } } Here are the errors: about import weather.data:Multiple markers at this line - Only a type can be imported. weather.data resolves to a package - The import weather.data is never used about City = mapper.readValue(jsonUrl, data.class):Multiple markers at this line - data cannot be resolved to a type - City cannot be resolved to a variable - The method readValue(JsonParser, Class) in the type ObjectMapper is not applicable for the arguments (URI, Class) - The method readValue(JsonParser, Class) in the type ObjectMapper is not applicable for the arguments (URI, Class) - City cannot be resolved to a variable - data cannot be resolved to a type Any Ideas? Also I really do not understand the concept of using mapper.readValue. would any one help me please? Note: I have used json gen to generate the data objects inside the link and now I have object data java files: City, Coord, List1, Temp and Weather with the following contents. For City.java as a sample: package weather.data; import java.util.List; public class City{ private Coord coord; private String country; private Number id; private String nam…
type: Question
has title: Import json URL to java and parse it using jackson library
possible better answer: http://stackoverflow.com/a/23479462
upvote count: 5
has answer: http://stackoverflow.com/a/23479661
tagged with: jackson
has answer: http://stackoverflow.com/a/23479462
answer count: 2
score: 5
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/23479661

http://stackoverflow.com/comment/36050424
score: 0
type: Comment
has text: Why would you want to?
type: QuestionComment
comment on: http://stackoverflow.com/q/23505887

code-duplication
tag name: code-duplication
tags question: http://stackoverflow.com/q/23460875
tags question: http://stackoverflow.com/q/23511047
type: Tag
tags question: http://stackoverflow.com/q/23477511

http://stackoverflow.com/comment/36113718
comment on: http://stackoverflow.com/q/23540169
score: 1
has text: Check for errors in your XML files..
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23481650
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/26062748
has title: Hibernate NOWAIT does not work with SQLServer2008
type: Question
score: 4
upvote count: 4
tagged with: sql-server
tagged with: sql
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26062748
favorite count: 0
tagged with: sql-server-2008
has body: I'm using Hibernate 3.6.10FINAL and I am unable to generate a nowait command for SQLServer2008. I have tried using both dialects ("SQLServer2008Dialect" and "SQLServerDialect" (they both generate quite different SQL queries)) to no avail. I have tried the following: List<TournamentTemplateRecord> leastRecentlyUsedTournaments = s.createCriteria(TournamentTemplateRecord.class) .addOrder(Order.asc("lastUse")) .setMaxResults(5) .setLockMode(LockMode.UPGRADE_NOWAIT) .setTimeout(0) .list(); List<TournamentTemplateRecord> leastRecentlyUsedTournaments = s.createQuery("from TournamentTemplateRecord ORDER BY lastUse") .setMaxResults(5) .setLockOptions(LockOptions.UPGRADE) .setTimeout(0) .list(); for(TournamentTemplateRecord t : leastRecentlyUsedTournaments){ s.buildLockRequest(LockOptions.UPGRADE).setTimeOut(LockOptions.NO_WAIT).setLockMode(LockMode.UPGRADE_NOWAIT).lock(t); } None of them generate a nowait query. This is the generate query in all cases: WITH query AS (select ROW_NUMBER() OVER ( order by tournament0_.lastuse) as __hibernate_row_nr__, tournament0_.combattemplateid as id89_, tournament0_1_.combattypeid as combatty2_89_, tournament0_1_.combattargetid as combatta3_89_, tournament0_1_.resourcenameid as resource4_89_, tournament0_1_.resourcedescriptionid as resource5_89_, tournament0_1_.rewardloottemplateid as rewardlo6_89_, tournament0_1_.combatcontainertypeid as combatco7_89_, tournament0_.requirementtemplateid as requirem2_90_, tournament0_.assetid as assetid90_, tournament0_.durationinsec as duration4_90_, tournament0_.lastuse as lastuse90_ from tournament_tournamenttemplate tournament0_ inner join readyforcombat_combattemplate tournament0_1_ with (updlock, rowlock) on tournament0_.combattemplateid=tournament0_1_.id ) SELECT * FROM query WHERE __hibernate_row_nr__ BETWEEN ? AND ? How can I getmy queries to not wait for a lock? Edit: It's worth mentioning that .setLockMode(LockMode.UPGRADE_NOWAIT) and .setLockMode(LockMode.PESSIMISTIC_WRITE) generate the same exa…
type: AnsweredQuestion

http://stackoverflow.com/comment/36161129
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23565489
has text: What is the value of `result02`?

http://stackoverflow.com/q/23489900
tagged with: keylistener
accepted answer: http://stackoverflow.com/a/23493053
score: 0
has answer: http://stackoverflow.com/a/23493034
has title: Reflecting the value of jSpinner on jLabel when key released
possible better answer: http://stackoverflow.com/a/23490083
has answer: http://stackoverflow.com/a/23490083
has answer: http://stackoverflow.com/a/23490221
has comment: http://stackoverflow.com/comment/36019923
has comment: http://stackoverflow.com/comment/36019833
has comment: http://stackoverflow.com/comment/36024494
answer count: 4
type: AnsweredQuestion
tagged with: jspinner
tagged with: swing
has body: My jSpinner does not reflect the value to JLabel when I change the value using keyboard. When I use up down arrows works fine ! When I use keyboard JLabel remains with previous value Here is the code below private void jSpinner1StateChanged(javax.swing.event.ChangeEvent evt) { value = (Integer)jSpinner1.getValue(); jLabel1.setText(value.toString()); } private void jSpinner1KeyTyped(java.awt.event.KeyEvent evt) { value = (Integer)jSpinner1.getValue(); jLabel1.setText(value.toString()); }
type: Question
has answer: http://stackoverflow.com/a/23493053
tagged with: java

http://stackoverflow.com/comment/36047471
has text: @DRAX : using `set` is not really fine, in this case
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23503921
score: 0

http://stackoverflow.com/comment/36125946
type: Comment
comment on: http://stackoverflow.com/a/23545967
score: 0
type: AnswerComment
has text: thanks so much feel like an idiot for not checking missing the constructor

http://stackoverflow.com/comment/36248515
score: 2
has text: post your xhtml and bean code.
comment on: http://stackoverflow.com/q/23611995
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36227371
has text: Check whether `activity_main` layout contains `save` button. Also use `return true;` within your `OnTouchListener`. Finally remove `public void onClick(View v){ }` from your `save.setOnTouchListener`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23600478

http://stackoverflow.com/q/23555880
favorite count: 0
type: UnansweredQuestion
has title: API for Microsoft Certification Authority integration
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: ssl
downvote count: 0
has body: Do we have a specific Java API to automate the integration with Microsoft Certification Authority (CA)? Only the following link seems relevant, but it just provides a high level information. Enrolling a Certificate in Microsoft Certification services for a User From Java Program Is there a way to access Microsoft Cryptography API [http://msdn.microsoft.com/en-us/library/aa380256%28v=VS.85%29.aspx] using Java?

http://stackoverflow.com/comment/36210825
has text: got it. So must be a hardware / network problem.
score: 0
comment on: http://stackoverflow.com/q/23579258
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36029444
has text: @Destructor Ah, my bad. Could you please post some code, so we can see what you're actually doing/using?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23492732
type: Comment

http://stackoverflow.com/comment/36084392
has text: The opposite of `--q` is `q++`
comment on: http://stackoverflow.com/q/23524250
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23501527
has answer: http://stackoverflow.com/a/23501576
tagged with: android
has answer: http://stackoverflow.com/a/23502120
type: AnsweredQuestion
has body: I have a string like String str = "102, 308, 409.5"; and I want to add the numbers in the string 102+308+409.5 and keep the result in variable. How can I achieve that?Thanks Note I was trying to convert the string to string array and then to int array in the below code, but doesn't works. int sum = 0; String[] arr = str.split(","); int[] numArr = new int[arr.length]; for(int i=0; i&lt;arr.length; i++){ numArr[i] = Double.parseDouble(arr[i]); sum+=numArr[i]; }
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23501576
has comment: http://stackoverflow.com/comment/36042179
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36041855
has title: Add numbers in a string array- android
possible better answer: http://stackoverflow.com/a/23502120

http://stackoverflow.com/comment/36036980
type: QuestionComment
has text: @Pavel Horal ,As per liferay documentation ,enabling this attribute would do the mass import of all the users from LDAP. As the LDAP I am dealing with organization LDAP ,there are very large no of users.I want to do the LDAP user import on demand i.e. only when user logs in. http://www.liferay.com/community/wiki/-/wiki/Main/LDAP
comment on: http://stackoverflow.com/q/23478461
score: 0
type: Comment

http://stackoverflow.com/a/28763058
answers question: http://stackoverflow.com/q/23564938
has body: In addition to Jewel's answer above do not forget to add in your own additional spring dependencies as "cucumber-spring" artifact seems to only provided the "Glue" between Cucumber and Spring. In my case I got Spring Injection to work in my step definitions with the following added dependency. org.springframework spring-test test org.springframework spring-core org.springframework spring-beans org.springframework spring-context org.slf4j slf4j-api org.slf4j jcl-over-slf4j ch.qos.logback logback-classic test ..... Plus the rest of the cucumber dependencies My Step Definition: @ContextConfiguration("/cucumber.xml") @PropertySource("classpath*:qa-test.properties") public class StepsDefinition { @Autowired private ServiceToInject serviceToInject; } CukesRunner @RunWith(Cucumber.class) @CucumberOptions(format = { "pretty", "html:target/cucumber-html-report", "json:target/cucumber-json-report.json" }) public class CukesRunner {} Cucumber.xml <?xml version="1.0" encoding="UTF-8"?> <import resource="classpath:applicationContext.xml"/> applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="com.mypackage"/> <property name="location" value="qa-test.properties"/> ---- rest of my beans
upvote count: 5
type: Answer
downvote count: 0
score: 5

http://stackoverflow.com/comment/36116660
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23541681
has text: do you receive any error or what is not working?
type: Comment

http://stackoverflow.com/comment/35978978
comment on: http://stackoverflow.com/q/23453287
score: 0
type: Comment
type: QuestionComment
has text: [As can be seen in the cited discussion](http://mail.openjdk.java.net/pipermail/lambda-dev/2011-December/004430.html), the visibility discussion is closely related to the discussion about other class building tools, like `final`. Unfortunately, my reference is not very up-to-date. There must've been more recent discussions with respect to `final`. As far as multiple-inheritance conflicts are concerned, we already have those. Consider: `interface A1 { void x(); }` and `interface A2 { int x(); }`. Or `interface B1 extends List<Object> {}` and `interface B2 extends List<String> {}`

http://stackoverflow.com/comment/36192231
has text: do you want to swap chars at index 2 and 3 in a String?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23581904

http://stackoverflow.com/a/23607709
type: Answer
answers question: http://stackoverflow.com/q/23607583
score: 0
has body: i think you missed the second argument of replace all. You need to put a empty string as argument 2 instead of actually leaving it empty. try replaceAll(&lt;your regexp&gt;,"")

http://stackoverflow.com/a/23613091
has body: Finally I get this problem solved. Here is what i did: while ((inputLine = br.readLine()) != null) { if (inputLine.substring(0, 1).equals("[")) { nameList.add(inputLine.substring(0, inputLine.indexOf("]")+1)); checkPoint = nameList.size() - 1; } else { finalList.add(nameList.get(checkPoint) + inputLine ); } }
has comment: http://stackoverflow.com/comment/36250515
upvote count: 1
answers question: http://stackoverflow.com/q/23571096
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23558416
score: 0
type: Answer
has body: Write a Servlet which will pull appropriate image from database based on some request parameter and return to browser. Put the url of the servlet in the "src" of your image tag in html. Use JavaScript to change the image src whenever required.
answers question: http://stackoverflow.com/q/23558326

xor
tags question: http://stackoverflow.com/q/23600685
type: Tag
tag name: xor

unsafe
tags question: http://stackoverflow.com/q/23603304
tag name: unsafe
type: Tag

http://stackoverflow.com/a/23505732
has comment: http://stackoverflow.com/comment/36089487
has comment: http://stackoverflow.com/comment/36050764
type: Answer
has body: First Solution: It seems, you wanted to include header area in your jsp. But it's wrong way. You should create a header.jsp and then include header.jsp into your MyTagUser.jsp and they should be under the WEB-INF directory(or its sub-directory). Including method : &lt;%@ include file="WEB-INF/tags/header.jsp"> use this code in MyTagUser.jsp Second Solution : in your tag file &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; core jstl taglib if necessary &lt;%@ attribute name="subtitle" required="true" %&gt; this is subTitle attribute you should define attribute(s). check out http://docs.oracle.com/javaee/1.4/tutorial/doc/JSPTags5.html
answers question: http://stackoverflow.com/q/23504719
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/36092053
score: 0
type: QuestionComment
type: Comment
has text: I tried to run in jdk 7 with `project language level` starting from `1.4` to `1.7` and in 1.4, 1.5, 1.6 I got the following error: **Error:(17, 18) java: binary literals are not supported in -source 1.6 (use -source 7 or higher to enable binary literals) Error:(17, 18) java: binary literals are not supported in -source 1.4 (use -source 7 or higher to enable binary literals)** It Run only in **1.7**
comment on: http://stackoverflow.com/q/23527295

http://stackoverflow.com/q/23500021
tagged with: jar
has answer: http://stackoverflow.com/a/23500131
score: 0
linked to: http://stackoverflow.com/q/10382929
duplicate of: http://stackoverflow.com/q/10382929
possible better answer: http://stackoverflow.com/a/23500112
has answer: http://stackoverflow.com/a/23500112
has body: I made a .jar file using NetBeans and when I try to run it on a different PC, it giver me this message: It isn't a typo or anything because I made several other .jar files and got the same response. If the code matters, then here is the code: package java_blackjack; import java.awt.CardLayout; import java.util.Arrays; import java.util.Scanner; class globals{ static int[] dealer = new int[5]; static int[] player = new int[5]; static int number = 0; } public class java_blackjack extends javax.swing.JFrame { public java_blackjack() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { main = new javax.swing.JPanel(); panel1 = new javax.swing.JPanel(); title = new javax.swing.JLabel(); begin_button = new javax.swing.JToggleButton(); instructions_button = new javax.swing.JButton(); quit_button = new javax.swing.JButton(); panel2 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); panel2_textarea = new javax.swing.JTextArea(); hit_button = new javax.swing.JButton(); stand_button = new javax.swing.JButton(); results_panel = new javax.swing.JPanel(); results_title = new javax.swing.JLabel(); jScrollPane2 = new javax.swing.JScrollPane(); results_info = new javax.swing.JTextArea(); menu_button = new javax.swing.JButton(); instructions = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jScrollPane3 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); main.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N main.setName("main"); // NOI18N main.setLayout(new java.awt.CardLayout()); title.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N title.setForeground(new java.awt.Color(0, 0, 204)); title.setText("Blackjack game"); begin_button.setText("BEGIN"); begin_button.addActionLis…
accepted answer: http://stackoverflow.com/a/23500131
has comment: http://stackoverflow.com/comment/36039114
has comment: http://stackoverflow.com/comment/36038945
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36039039
tagged with: java
has title: Jar files not working
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/23500253
tagged with: user-interface

http://stackoverflow.com/a/23539467
score: 0
answers question: http://stackoverflow.com/q/23496620
has body: thanks for trying to help out. I've decided to simply add the password input field in the Client_GUI window instead of having another separate frame, and simply call this method when b_button is pressed: public void passwordCheck(){ String pass = new String(jPasswordField1.getPassword()); if (pass.equals(password)) { verify(); connect(); } else { System.out.println(pass); JOptionPane.showMessageDialog(null, "Incorrect password", "", JOptionPane.ERROR_MESSAGE); } }
type: Answer

http://stackoverflow.com/a/23457397
score: 1
has body: You can leverage a Set to determine the word count. I also suggest normalizing your input string by calling str.toLowerCase() so that "The" and "the" would only count for one word. I would also pass false for the returnDelims parameter in the StringTokenizer since the delimiters shouldn't constitute words. Here is an example: public int wordCount(String str) { StringTokenizer s = new StringTokenizer(str.toLowerCase(), " ,.", false); Set&lt;String&gt; uniqueWords = new HashSet&lt;String&gt;(); while (s.hasMoreTokens()) { uniqueWords.add(s.nextToken()); } return uniqueWords.size(); }
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23457240

http://stackoverflow.com/a/23473488
has body: final variables can't be re-evaluated again runtime, If you want to use switch case you can't do like (b+c) in case clause, instead of this do use this one, void add() { final int a = 30; final int b = 10; final int c; c = 20; final int cmp=b+c; switch (a) { case cmp: System.out.println("In case b+c"); break; default: break; } } Now this will work fine for you,
score: -1
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/35989990
answers question: http://stackoverflow.com/q/23473149
downvote count: 1

http://stackoverflow.com/q/23595675
type: Question
possible better answer: http://stackoverflow.com/a/23595812
has comment: http://stackoverflow.com/comment/36267831
has comment: http://stackoverflow.com/comment/36267842
score: 0
has body: when i run my app i get this error in the log-cat: Caused by: java.lang.NullPointerException at com.myfirstapp.myfirstapp.MainActivity.onCreate(MainActivity.java:52) at android.app.Activity.performCreate(Activity.java:5312) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2552) ... 11 more Here's line 52: String message = editTextInput.getText().toString(); So far i've worked out that the NPE must be when I define the EditText (or any view for that matter): EditText editText = (EditText) findViewById(R.id.input_text); However though, I don't get an NPE when I define a EditText without: findViewById() like this View: TextView desc = new TextView(this); Here is the entire onCreate() method: 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(); } EditText editText = (EditText) findViewById(R.id.input_text); Button submit = (Button) findViewById(R.id.submit); LinearLayout layout = (LinearLayout) findViewById(R.id.layout_main); Intent intent = new Intent(this, testActivity.class); final TextView desc = new TextView(this); final TextView title = new TextView(this); String message = editText.getText().toString(); submit.setVisibility(View.VISIBLE); submit.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub editText.setVisibility(View.GONE);}}); desc.setTextSize(20); desc.setText(message); desc.setGravity(Gravity.LEFT | Gravity.TOP); desc.setPadding(5, 5, 5, 5); desc.setTextColor(getResources().getColor(R.color.black)); title.setTextSize(10); title.setText(R.string.title_activity_dictionary); title.setGravity(Gravity.LEFT | Gravity.TOP); title.setPadding(5, 5, 5, 5); title.setTextColor(getResources…
answer count: 3
has comment: http://stackoverflow.com/comment/36261064
has comment: http://stackoverflow.com/comment/36217719
has answer: http://stackoverflow.com/a/23595812
has answer: http://stackoverflow.com/a/23595960
tagged with: nullpointerexception
tagged with: android
accepted answer: http://stackoverflow.com/a/23621898
has title: Android NullPointerException when findViewById
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36303252
has answer: http://stackoverflow.com/a/23621898
linked to: http://stackoverflow.com/q/19876874

persistence
tags question: http://stackoverflow.com/q/23613992
tags question: http://stackoverflow.com/q/23520416
tags question: http://stackoverflow.com/q/23501247
tags question: http://stackoverflow.com/q/23480119
tags question: http://stackoverflow.com/q/23512695
tags question: http://stackoverflow.com/q/23525442
tag name: persistence
type: Tag
tags question: http://stackoverflow.com/q/23489923

http://stackoverflow.com/a/23538150
has comment: http://stackoverflow.com/comment/36110231
type: Answer
score: 0
has body: a random though, maybe you could do it in your server instead? It seems like you want a simple way rather than a efficent way. I'd recommend trying something like cronjob in linux. Simply make a script in your DB server that query for changes every once and a while, and send some sort of notification(mail?) out when changes detected? I have no idea how complex your script needs to be in order to detect the changes you want, so this might not be the best idea edit: so basically you want to edit external files with triggers, then maybe UDF is the thing you need. take a look at this blog and see if that's what you want.
answers question: http://stackoverflow.com/q/23536795
accepted answer of: http://stackoverflow.com/q/23536795
has comment: http://stackoverflow.com/comment/36111305
type: AcceptedAnswer

http://stackoverflow.com/q/23524016
has title: Facebook android SDK graph request - access token issue
has answer: http://stackoverflow.com/a/23526283
tagged with: api
tagged with: facebook-graph-api
tagged with: android
tagged with: facebook
accepted answer: http://stackoverflow.com/a/23526283
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23524388
has answer: http://stackoverflow.com/a/33204971
possible better answer: http://stackoverflow.com/a/26795117
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26795117
type: Question
has body: I am new to the facebook SDK and I am encountering this issue: After login I have then Session object, the I want to execute some graph API request. Here is my code: Request request = new Request(session, "me?fields=email,installed,first_name,last_name"); Response response = request.executeAndWait(); GraphObject obj = response.getGraphObject(); JSONObject json = obj.getInnerJSONObject(); Here is the Request object (toString()): {Request: session: {Session state:OPENED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[public_profile, email, contact_email, user_hometown]}, appId:MY_APP_ID}, graphPath: me?fields=email,installed,first_name,last_name, graphObject: null, restMethod: null, httpMethod: GET, parameters: Bundle[{access_token=ACCESS_TOKEN_STRING_OF_SESSION, format=json, sdk=android}]} And here is the Response object (toString()): {Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 2500, errorType: OAuthException, errorMessage: An active access token must be used to query information about the current user.}, isFromCache:false} When I am executing the request in the browser like this: https://graph.facebook.com/v2.0/me?access_token=ACCESS_TOKEN_STRING_OF_SESSION I am getting a valid json response. So I am getting this error as seen in the response, why is it? every thing seems ok with the Request object. Thanks

http://stackoverflow.com/comment/36217667
type: QuestionComment
has text: well considering that they are doing the same thing...
comment on: http://stackoverflow.com/q/23595573
score: 0
type: Comment

http://stackoverflow.com/comment/36103744
score: 1
has text: It's hard to say without a lot more context.
comment on: http://stackoverflow.com/q/23534423
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36223218
type: Comment
has text: The whole error is "expected"?
type: QuestionComment
comment on: http://stackoverflow.com/q/23598500
score: 0

http://stackoverflow.com/q/23504458
has comment: http://stackoverflow.com/comment/36049921
accepted answer: http://stackoverflow.com/a/23505954
linked to: http://stackoverflow.com/q/285793
type: Question
has comment: http://stackoverflow.com/comment/36048172
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36047417
has comment: http://stackoverflow.com/comment/36050013
has comment: http://stackoverflow.com/comment/36048114
has comment: http://stackoverflow.com/comment/36051739
has comment: http://stackoverflow.com/comment/36048721
has body: import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; public class Manager { public static void main(String[] args) throws Exception { serialize(); deSerialize(); } public static void serialize() throws Exception { E obj = new E(); obj.num = 100; F f1 = new F(); f1.j = 40; f1.e1 = obj; FileOutputStream fout = new FileOutputStream("test1.txt"); ObjectOutputStream out = new ObjectOutputStream(fout); out.writeObject(f1); } public static void deSerialize() throws Exception { FileInputStream fin = new FileInputStream("test1.txt"); ObjectInputStream in = new ObjectInputStream(fin); F f2 = (F) in.readObject(); System.out.println(f2.e1.num); System.out.println(f2.j); } } class E implements Serializable { int num; } class F implements Serializable { E e1; int j; } // Why am I getting java.lang.NoSuchFieldError : numruntime error in this Program.
favorite count: 0
has answer: http://stackoverflow.com/a/23505954
has title: Java Subtle Serialization
upvote count: 1
has comment: http://stackoverflow.com/comment/36048150
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36048442

http://stackoverflow.com/comment/36054020
has text: @AndrewThompson Programmatically or manually? I've added an animated GIF to demonstrate the manual resizing. Add a `MouseListener` to the `DrawPanel` and called `repaint` on `MouseClicked` and that realigned the output :P
comment on: http://stackoverflow.com/q/23507422
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23568848
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
score: 2
tagged with: portrait
tagged with: java
type: Question
has body: In my app, I have a dialog with EditText. I have coded it in such a way that as soon as the dialog shows up,the soft keyboard shows up, the edit text will get focus , all the existing text in the editText is preselected. And user can start typing. This all works fine when I am holding my phone in portrait orientation. But the same thing does not work when I have phone in landscape orientation. Part of my code in my fragment is pasted below. final EditText inputDeviceId = new EditText(getActivity()); inputDeviceId.setInputType(InputType.TYPE_CLASS_TEXT); String savedDevId = getDeviceID(); inputDeviceId.setText(savedDevId); inputDeviceId.setSelectAllOnFocus(true); // some more code ... to create dialog , ok cancel buttons then, final AlertDialog alertDialog = alertDialogBuilder.create(); inputDeviceId.setOnFocusChangeListener(new View.OnFocusChangeListener() { if(hasFocus){ alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); } }); alertDialog.show(); Now this all works in portrait orientation and does not work in landscape. In landscape mode the dialog with edittext shows up , it has focus and existing text is preselected but it does not show the keyboard. User has to click in the editText for keyboard to come up. Why? I am using nexus-5 to test.
downvote count: 0
has title: Soft KeyBoard does not show up in Landscape orientation
tagged with: landscape
tagged with: nexus-5

http://stackoverflow.com/q/23548717
tagged with: dropwizard
answer count: 1
tagged with: jax-rs
has answer: http://stackoverflow.com/a/27484369
has body: I am looking to programmatically create endpoints for dropwizard. Such is available via jersey as can be seen here. Any Idea how to do this? Here is some example code I have tried, that has NOT worked: Resource.Builder resourceBuilder = Resource.builder(); resourceBuilder.path("helloworld"); ResourceMethod.Builder methodBuilder = resourceBuilder.addMethod("GET"); methodBuilder.produces(MediaType.APPLICATION_JSON).handledBy(new Inflector&lt;ContainerRequestContext, Object&gt;() { @Override public Object apply(ContainerRequestContext containerRequestContext) { return "HELLO"; } }); environment.jersey().register(resourceBuilder.build());
type: UnansweredQuestion
has title: Dropwizard Programmatic Endpoints
tagged with: java
type: Question
tagged with: jersey
score: 0

http://stackoverflow.com/a/23546605
answers question: http://stackoverflow.com/q/23546426
upvote count: 1
type: Answer
has body: You can just extend HashMap like this: public class ListMap&lt;K, V&gt; extends HashMap&lt;K, List&lt;V&gt;&gt; { ... }
downvote count: 0
score: 1

http://stackoverflow.com/a/23542234
has comment: http://stackoverflow.com/comment/36117682
has comment: http://stackoverflow.com/comment/36118269
accepted answer of: http://stackoverflow.com/q/23542101
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23542101
has body: Object.wait() is declared final and cannot be overridden. So super.wait() always means just wait() but is a bit longer.
has comment: http://stackoverflow.com/comment/36118534
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/48807242
score: 0
comment on: http://stackoverflow.com/q/23613646
type: Comment
type: QuestionComment
has text: I don't have the jetty jar inside WAR in the first place. And if I put there the same jar, then ClassCastException occurs. Clearly something is wrong with class loaders here.

http://stackoverflow.com/comment/36154141
type: Comment
type: QuestionComment
has text: What you have currently appears to be attempting to put 10 objects of class Address in an object of class save, as opposed to just the information *within* address
comment on: http://stackoverflow.com/q/23561871
score: 0

http://stackoverflow.com/comment/36203754
type: Comment
type: QuestionComment
has text: ok , but sop's are there in more than 5000 files so it is time taking process we don't have that much time,
comment on: http://stackoverflow.com/q/23588081
score: 0

http://stackoverflow.com/q/23469286
tagged with: java
tagged with: itext
downvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23469614
has title: Merging of pdf with digital signature with itext 5.4.0 or greatest gives error
has body: I have a big problem in trying to merge some pdf, created with itext, with digital signature. This is the code: ByteArrayOutputStream bos = new ByteArrayOutputStream(); Document document = new Document(); PdfCopy writer = new PdfCopy(document, bos); writer.setMergeFields(); document.addTitle(""); document.open(); PdfReader reader = null; for (int i = 0; i &lt; iss.length; i++) { reader = new PdfReader(iss[i]); writer.addDocument(reader); reader.close(); } document.close(); bos.close(); On execute i receive this error: java.lang.IllegalStateException: Already closed at com.itextpdf.text.io.ArrayRandomAccessSource.get(ArrayRandomAccessSource.java:65) at com.itextpdf.text.io.IndependentRandomAccessSource.get(IndependentRandomAccessSource.java:78) at com.itextpdf.text.pdf.RandomAccessFileOrArray.read(RandomAccessFileOrArray.java:226) at com.itextpdf.text.pdf.RandomAccessFileOrArray.readFully(RandomAccessFileOrArray.java:248) at com.itextpdf.text.pdf.RandomAccessFileOrArray.readFully(RandomAccessFileOrArray.java:242) at com.itextpdf.text.pdf.PdfReader.getStreamBytesRaw(PdfReader.java:2522) at com.itextpdf.text.pdf.PdfReader.getStreamBytesRaw(PdfReader.java:2559) at com.itextpdf.text.pdf.PRStream.toPdf(PRStream.java:230) at com.itextpdf.text.pdf.PdfIndirectObject.writeTo(PdfIndirectObject.java:158) at com.itextpdf.text.pdf.PdfWriter$PdfBody.write(PdfWriter.java:420) at com.itextpdf.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:398) at com.itextpdf.text.pdf.PdfWriter$PdfBody.add(PdfWriter.java:377) at com.itextpdf.text.pdf.PdfWriter.addToBody(PdfWriter.java:868) at com.itextpdf.text.pdf.PdfCopyFieldsImp.closeIt(PdfCopyFieldsImp.java:439) at com.itextpdf.text.pdf.PdfCopyFieldsImp.close(PdfCopyFieldsImp.java:397) at com.itextpdf.text.pdf.PdfCopyFields.close(PdfCopyFields.java:159) at it.almavivaitalia.commons.crystal.utils.ReportClientDocumentManager.mergePdfs(ReportClientDocumentManager.java:310) at it.almavivaitalia.commons.crystal.utils.ReportClientDocumentManager.exportR…
upvote count: 0
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
favorite count: 0
tagged with: digital-signature
accepted answer: http://stackoverflow.com/a/23469614
tagged with: merge
score: -1

http://stackoverflow.com/comment/36248742
type: QuestionComment
comment on: http://stackoverflow.com/q/23607291
has text: Just to clarify: what you want to do is to use your library as a dependency in another SBT project?
score: 0
type: Comment

http://stackoverflow.com/a/23508934
answers question: http://stackoverflow.com/q/23508770
type: Answer
score: 0
has body: I do not frequently do this, but you have shown sufficient effort in this case that I think it is warranted. Along with the points mentioned in alfasin's answer, here is a correct version with inline comments and simplifications. Note that the public class is class Classroom, so this code needs to live in a file called Classroom.java unless you rename the class. import java.util.*; class Student{ String name; int id; int status; // Tool for generating random numbers static Random random = new Random(); // Constructor public Student(String name){ this.name = name; status = random.nextInt() % 4 + 1; // Get a number from 0 to 3 using mod, and then add 1 to make it 1 to 4 id = random.nextInt(); } } public class Classroom{ public static void main(String[] args){ // A better name would be "students" but I kept your variable name. Student[] name = new Student[20]; // The standard way to go through an array is a for loop, not a while loop. for (int i = 0; i &lt; name.length; i++) { String currentName = "Name" + (i+i); name[i] = new Student(currentName); //hopefully this loads objects into arrays } // Find all the juniors. Note that this could have been done in the earlier loop. for (int i = 0; i &lt; name.length; i++) { if (name[i].status == 3) System.out.println(name[i].name + " " + name[i].id); } } }

http://stackoverflow.com/a/23508092
has body: No real magic: struct Node node = {"Adam", 1, NULL, NULL}; struct Node *nodePtr = &amp;node; printf("word[%s] count[%d] left[%p] right[%p]\n", node.word, node.count, node.left, node.right); printf("word[%s] count[%d] left[%p] right[%p]\n", nodePtr-&gt;word, nodePtr-&gt;count, nodePtr-&gt;left, nodePtr-&gt;right);
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/23508028
answers question: http://stackoverflow.com/q/23508028
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23465261
accepted answer of: http://stackoverflow.com/q/23465032
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35974729
has comment: http://stackoverflow.com/comment/35974485
has body: Well, if you need to stop the user from entering a text longer than x, simply put android:maxLength="x" as an attribute for your EditText. Or, mEditText.setFilters( new InputFilter[] { new InputFilter.LengthFilter(&lt;length&gt;) } );
has comment: http://stackoverflow.com/comment/35974677
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35974468
answers question: http://stackoverflow.com/q/23465032
type: Answer

http://stackoverflow.com/a/23475523
answers question: http://stackoverflow.com/q/23472983
score: 1
accepted answer of: http://stackoverflow.com/q/23472983
upvote count: 1
has body: You are using AMI. There are no way get dtmf in AMI without dialplan support. You can get event via ami using something like this in dialplan exten =&gt; s,1,Read(variable,filetoplay) exten =&gt; s,2,UserEvent(variable: variable) Or you can use fastagi to control call execution and collect dtmf
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23453038
answer count: 2
downvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/35951608
tagged with: nimbus
linked to: http://stackoverflow.com/q/2482971
score: -1
has answer: http://stackoverflow.com/a/23453252
tagged with: java
tagged with: look-and-feel
has body: I want to use a Look and Feel for my Java GUI project (in Swing) in which the windows container's frame color is dark and the color of the body of the container is white. As an example, you can see the picture of the browser: the frame is black while the body is white. I want something like that in my Java GUI project. Preferably a Nimbus L&amp;F, so any suggestions?
upvote count: 1
possible better answer: http://stackoverflow.com/a/23453252
has answer: http://stackoverflow.com/a/23453111
has title: Suggestions on using a Look and Feel for my Java project
has comment: http://stackoverflow.com/comment/35951617
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2781987
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/23453111
has comment: http://stackoverflow.com/comment/35951717
has comment: http://stackoverflow.com/comment/35951696
favorite count: 0
type: Question

http://stackoverflow.com/q/23546352
score: 2
downvote count: 0
has body: I'm trying to make a dead reckoning device for Android, similar to a bicycle computer. I have a reed switch and a magnet for the input, and the plan is to count the number of pulses using an Android application. As I understand it I can: 1) Use the headphone jack. If I can provide an output voltage to the switch, when the magnet passes the input voltage should drop to zero. I know about AudioRecord, but I'm not sure if it's possible to simultaneously output to and take input from the headphone jack, which would be necessary. 2) Use the usb. I know this is probably the better way, as it allows me to use the reed switch as a digital input, but I would like to avoid buying an IOIO if possible as I only need one input. I can solder the usb pins to the switch, but is it possible to make a simple driver for that? 3) Use both. I can take power from the usb and audio input from the switch output. Is it necessary to use a driver just to draw usb power, or is it on by default? What would you guys recommend? Thanks!
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33486040
tagged with: output
type: Question
tagged with: java
tagged with: usb
upvote count: 2
has title: Reed switch input to an Android
answer count: 1
favorite count: 0
tagged with: android
tagged with: input

http://stackoverflow.com/comment/36039731
has text: I imagine if it tries to allocate memory and there isn't enough available, no matter what the circumstances, then you will get this error
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23500391

http://stackoverflow.com/comment/36003989
score: 1
has text: What is `parent`? Do you mean `super`.
comment on: http://stackoverflow.com/a/23481105
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36160227
type: QuestionComment
has text: Can you use regex in a `@Path` like you can in `@RequestMapping`? If so, you could use regex to pull in all characters, then compare the matched part in your handler and either throw a 404 or let them by.
comment on: http://stackoverflow.com/q/23564835
score: 0
type: Comment

http://stackoverflow.com/comment/36050884
score: 0
has text: actually i want it on my window but when searched couldn't find how to show it
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23506089

http://stackoverflow.com/comment/36062735
type: QuestionComment
comment on: http://stackoverflow.com/q/23512725
has text: @fge The point is that connecting to servers via ssh does take some time, in the system i work on that happens quite a lot, and i want to save some time. On the other hand, i want to do several things on the same server in parallel, and i don't want other devs to make the mistake of passing the same ssh connection to a process while it is being used in a different process.
score: 0
type: Comment

http://stackoverflow.com/q/23601114
has answer: http://stackoverflow.com/a/23601149
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36228014
type: Question
downvote count: 0
has title: What could be causing the memory leak in my paint method?
has comment: http://stackoverflow.com/comment/36228109
accepted answer: http://stackoverflow.com/a/23601149
has comment: http://stackoverflow.com/comment/36228020
tagged with: memory-leaks
has comment: http://stackoverflow.com/comment/36227969
answer count: 1
has comment: http://stackoverflow.com/comment/36228001
favorite count: 0
has comment: http://stackoverflow.com/comment/36228163
has body: As I usually do when I make a game in Java, I create an object to handle the graphics. But, never before have I had a memory leak somewhere inside the "main" paint method. It's never happened before, so I don't know what it could be. My guess is it has something to do with the Images/retrieving the images, because if I wipe the cache clean and reload them each time, it doesn't appear to leak memory. Any ideas? Question: What could be the cause of a memory leak in the following: [Edit] It turns out it actually was the Fonts. Thanks. Paint method for reference: public void drawFrame(Graphics2D g) { // Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int width = CLIENT.GAMEFRAME.getBounds().width; int height = CLIENT.GAMEFRAME.getBounds().height; g.setColor(Color.BLACK); Font font1 = null; Font font2 = null; try { font1 = Font.createFont(Font.TRUETYPE_FONT, new File( "./cache/fonts/Minecraftia.ttf")); font2 = Font.createFont(Font.TRUETYPE_FONT, new File( "./cache/fonts/SF Automaton Extended.ttf")); g.setFont(font1.deriveFont(15f).deriveFont(Font.BOLD)); } catch (FontFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if (CLIENT.user.loggedIn) { g.drawImage(images.getPermaImage(3), width - 520, height - 94, null); g.drawImage(images.getPermaImage(2), width - 518, height - 92, null); // Skills g.drawImage(images.getPermaImage(0), width - 516, height - 90, null); g.drawImage(images.getPermaImage(0), width - 466, height - 90, null); g.drawImage(images.getPermaImage(0), width - 416, height - 90, null); g.drawImage(images.getPermaImage(0), width - 366, height - 90, null); g.drawImage(images.getPermaImage(0), width - 316, height - 90, null); g.drawImage(images.getPermaImage(0), width - 266, height - 90, null); g.drawImage(images.getPermaImage(0), width - 216, height - 90, null); g.drawImage(images.getPermaImage(0), width - 166, height - 90, null); g.drawImage(images.getPermaImage(0), width - 116, height - 90, null); g.draw…
upvote count: 1
type: AnsweredQuestion
tagged with: paint

http://stackoverflow.com/comment/35961004
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23458051
has text: Give different bean ids for each of the bean and access them by id instead of name.

http://stackoverflow.com/q/23559249
has title: Synchronizing on a static object
score: 2
has answer: http://stackoverflow.com/a/23559416
upvote count: 2
tagged with: java
type: Question
has body: I am really confused on how synchronization actually work. I have this following code: public class FunTest { static FunTest test; public void method() { synchronized (test) { if (Thread.currentThread().getName() == "Random1") { try { wait(); } catch (InterruptedException ex) { ex.printStackTrace(); } } else { notify(); } } } public static void main(String[] args) { test = new FunTest(); final FunTest t0 = new FunTest(); Thread t1 = new Thread(new Runnable() { public void run() { t0.method(); } }); Thread t3 = new Thread(new Runnable() { public void run() { t0.method(); } }); t1.setName("Random1"); t3.setName("Random2"); t1.start(); t3.start(); } } The code throws IllegalMonitorStateException when run. I don't understand why this is happening. Is it not possible to acquire lock this way? If I replace test with this in synchronization block it works fine though. Why is this so?
has comment: http://stackoverflow.com/comment/36149629
answer count: 2
has comment: http://stackoverflow.com/comment/36149658
downvote count: 0
has answer: http://stackoverflow.com/a/23559327
favorite count: 0
tagged with: synchronization
tagged with: static
type: UnansweredQuestion

http://stackoverflow.com/comment/51772637
type: QuestionComment
has text: As of 2015, IntelliJ 14 has been great on HiDPI computers. For anyone who may see this thread late.
score: 0
comment on: http://stackoverflow.com/q/23602954
type: Comment

http://stackoverflow.com/a/23518230
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23517243
answers question: http://stackoverflow.com/q/23517243
type: Answer
has body: First of all the best practice which I think you should follow is to organise your code in blocks. Initialise all your views after setContentView() no matter when you are using them. If you start doing this you won't have exceptions thrown like this one which you have. The problem in your code is that you are not initialising your textView variable and using it in your onPostExecute() method of AsyncTask. Your onCreate should look like this: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_category); grid = (GridView) findViewById(R.id.gridViewAllItems); textview = (TextView) findViewById(R.id.myTextView); numResults = (TextView) findViewById(R.id.textView2); // Start your AsyncTask here ... }

http://stackoverflow.com/comment/36163517
has text: Hi Shashi,i went through the mentioned document. Good One. I am implementing in a different way. please find the below servlet and web.xml code. Here i am getting HTTP Status 404-The requested resource is not available. Could you please help me out.
comment on: http://stackoverflow.com/a/23513967
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23560113
accepted answer of: http://stackoverflow.com/q/23560067
score: 0
type: AcceptedAnswer
has body: You cannot. Once you have opened another App (the clock app), that app is the current running app on the device. It is now in control of how buttons work and what the back button will do.
type: Answer
answers question: http://stackoverflow.com/q/23560067

hypermedia
type: Tag
tags question: http://stackoverflow.com/q/23503895
tag name: hypermedia

http://stackoverflow.com/comment/35988242
has text: One such way of handling this is using a proxy driver that logs your desired parameters. Check out my answer for more info on one such proxy called log4jdbc.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23472945
score: 0

http://stackoverflow.com/q/23537824
tagged with: for-loop
has comment: http://stackoverflow.com/comment/36109662
possible better answer: http://stackoverflow.com/a/23537863
favorite count: 0
has answer: http://stackoverflow.com/a/23537974
has answer: http://stackoverflow.com/a/23537939
has comment: http://stackoverflow.com/comment/36109554
has body: Here is my code : private String SerialNo; private String FirmVersion; public String GetSerial(int[] Data){ System.out.println("GetSerial Debug : Data =&gt; "+Data); for (int i = 2;i==13;i++){ System.out.println("In the FOR =&gt; ok "); if (i != 9){ SerialNo = SerialNo + Data[i]; } if (i == 9){ SerialNo = SerialNo + "."; } } System.out.println("SerialNo =&gt; "+ SerialNo); return SerialNo; } My problem : I can't "enter" in the FOR So my sysout of "In the FOR => ok", never shows and all the "actions" aren't done. What am I doing wrong ? ps : I'm sure that I'm compiling the right file.
upvote count: 0
answer count: 9
has answer: http://stackoverflow.com/a/23538109
downvote count: 5
has answer: http://stackoverflow.com/a/23537873
has answer: http://stackoverflow.com/a/23537865
type: Question
has answer: http://stackoverflow.com/a/23538014
type: AnsweredQuestion
score: -5
has title: Doesn't enter in the "for-loop"?
has comment: http://stackoverflow.com/comment/36109714
tagged with: java
has answer: http://stackoverflow.com/a/23537926
accepted answer: http://stackoverflow.com/a/23537926
has answer: http://stackoverflow.com/a/23538162
has answer: http://stackoverflow.com/a/23537863

http://stackoverflow.com/comment/36215353
has text: so wait, everything I said I was trying to do has already been done by the code in the HangmanMain class? As in, it already creates the list of words with the specified length? all I need to do is add the return statement in the HangmanManager?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23591071
type: Comment

http://stackoverflow.com/q/23493073
has body: I need to get the connections of a user whose id is yZTcaxINNv. I use linkedin-j and the code looks something like this import com.google.code.linkedinapi.client.LinkedInApiClient; import com.google.code.linkedinapi.client.LinkedInApiClientFactory; import com.google.code.linkedinapi.schema.Connections; import com.google.code.linkedinapi.schema.Person; public class Linkedin_Data_Extract { public static void main(String[] args) { final String consumerKeyValue = "My key"; final String consumerSecretValue ="My Secret"; final String accessTokenValue = "Access Token"; final String tokenSecretValue = "Secret"; final String id = "yZTcaxINNv"; final LinkedInApiClientFactory factory = LinkedInApiClientFactory.newInstance(consumerKeyValue, consumerSecretValue); final LinkedInApiClient client = factory.createLinkedInApiClient(accessTokenValue, tokenSecretValue); Connections cc=client.getConnectionsById(id); for(Person p :cc.getPersonList()) { System.out.println(p.getLastName()); System.out.println(p.getId()); System.out.println("Industry "+p.getIndustry()); System.out.println("currentStatus "+p.getCurrentStatus()); System.out.println("link "+p.getPublicProfileUrl()); System.out.println("position "+p.getEducations()); System.out.println(); } } } But i get an error like this Exception in thread "main" com.google.code.linkedinapi.client.LinkedInApiClientException: Access to connections denied at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.createLinkedInApiClientException(BaseLinkedInApiClient.java:3906) at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.callApiMethod(BaseLinkedInApiClient.java:3781) at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.callApiMethod(BaseLinkedInApiClient.java:3725) at com.google.code.linkedinapi.client.impl.BaseLinkedInApiClient.getConnectionsById(BaseLinkedInApiClient.java:235) at Linkedin_Data_Extract.main(Linkedin_Data_Extract.java:27) Why am i getting permission issues
type: AnsweredQuestion
type: Question
tagged with: java
tagged with: linkedin-j
score: 0
tagged with: linkedin-api
answer count: 1
has answer: http://stackoverflow.com/a/23493229
accepted answer: http://stackoverflow.com/a/23493229
has title: Getting Connections of a person by id in LinkedIn

http://stackoverflow.com/comment/36012382
has text: Each time you call ResultSet.Next() you move to the next row in the result set.
type: AnswerComment
comment on: http://stackoverflow.com/a/23484351
type: Comment
score: 1

http://stackoverflow.com/comment/36229710
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23601385
type: AnswerComment
has text: showed and working now haha thx ! you helped a lot also, thx a lot for your support !

http://stackoverflow.com/q/23481107
has title: Calculate Java Int Overflow
type: AnsweredQuestion
downvote count: 0
tagged with: expression
has answer: http://stackoverflow.com/a/23481716
score: 1
tagged with: math
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36004118
has comment: http://stackoverflow.com/comment/36004033
has comment: http://stackoverflow.com/comment/36004069
has comment: http://stackoverflow.com/comment/36004319
has answer: http://stackoverflow.com/a/23481538
tagged with: integer-overflow
answer count: 3
accepted answer: http://stackoverflow.com/a/23481542
possible better answer: http://stackoverflow.com/a/23481716
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36004159
has answer: http://stackoverflow.com/a/23481542
has comment: http://stackoverflow.com/comment/36003996
has comment: http://stackoverflow.com/comment/36004189
has comment: http://stackoverflow.com/comment/36004384
has body: Is there a formula to calculate what the overflow of a Java int would be? Example: if I add 1 to Integer.MAX_VALUE; the answer is not 2147483648, but rather -2147483648. Question: if I wanted to calculate what Java would print for a value larger than 2^32, is there an easy mathematical expression (theoretical, not in code)?

http://stackoverflow.com/a/23543471
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23542673
has body: Here's a basic implementation. It's not the most optimal and will take some more work if you want to implement the full Set interface. public class FrequencySet&lt;T&gt; implements Iterable&lt;T&gt; { private TreeSet&lt;T&gt; set; private HashMap&lt;T, Integer&gt; elements = new HashMap&lt;T, Integer&gt;(); public FrequencySet() { set = new TreeSet&lt;T&gt;(new Comparator&lt;T&gt;() { public int compare(T o1, T o2) { return elements.get(o2)-elements.get(o1); } }); } public void add(T t) { Integer i = elements.get(t); elements.put(t, i == null ? 1 : i+1); set.remove(t); set.add(t); } public Iterator&lt;T&gt; iterator() {return set.iterator();} public static void main(String [] args) { FrequencySet&lt;String&gt; fset = new FrequencySet&lt;String&gt;(); fset.add("foo"); fset.add("bar"); fset.add("foo"); for (String s : fset) System.out.print(s); System.out.println(); fset.add("bar"); fset.add("bar"); for (String s : fset) System.out.print(s); } } The key is in the add method. We change the counter for the given object (which changes the relation order), remove it from the backing set and put it back in.

http://stackoverflow.com/comment/36156507
score: 1
type: AnswerComment
type: Comment
has text: Interesting, I would have expected a driver to 'accept' a connection string with the subprotocol (ie: `jdbc:postgresql:`) supported by that driver and throw a `SQLException` if it didn't match the required format, on the other hand this way would allow for alternative drivers to try as well.
comment on: http://stackoverflow.com/a/23559085

http://stackoverflow.com/a/23547438
score: 0
type: Answer
has body: Usually games use more than one thread (for example when using Swing or painting any graphics), e.g. so inputs are not blocked. That means with all the other solutions you might run into race conditions. This solution of Evan Knowles came closest. I would suggest a immutable GameState class, e.g. public GameState { private final int score; private final int speed; // initial state/"reset game" public GameState() { score = 0; speed = 2.3; } // Private so we are always in a valid state private GameState(int _score, int _speed) { score = _score; speed = _speed; } public GameState updateSpeed(int _speed) { return new GameState(this.score, _speed); } public GameState updateScore(int _score) { return new GameState(_score, this.speed); } public int getSpeed() { return speed;} public int getScore() { return score;} // add getters, setters and whatsoever here. But watch for proper synchronization between threads! } The advantage here is that once the values are assigned, they can't be changed anymore ("immutable"/read-only) from the outside, so there are no concurrency issues. Plus, you get a sort of chaing for free (see below)! Moreover, you can safely (de-)serialize the game state for saving/loading games. Effectively, each GameState represents one state in a finite state machine. Calling either updateSpeed or updateScore is a transition to a new state. The public default constructor is a transition to the initial state of the state machine. On a side note, the state machine is finite because the value ranges of score and speed are finite, thus all combiniations of them result in a finite amount of states. I now assume your class for doing other game stuff is called Game. public Game { private volatile GameState gameState = new GameState(); public void resetGame() { gameState = new GameState(); } // Just an example public increaseSpeed(int _additionalSpeed) { gameState = gameState.updateSpeed(gameState.getSpeed() + _additionalSpeed); } // Change more than one value public …
answers question: http://stackoverflow.com/q/23545872

http://stackoverflow.com/a/23590225
answers question: http://stackoverflow.com/q/23590156
has body: The method to replace every occurrence of a char by another char is replace(). The char literal for a single quote is '\'' (the single quote must be escaped, so that it's not interpreted as the end of the char literal). So you want s = s.replace('\'', '"'); replaceAll(), suggested by many other answers, replaces substrings matching a regexp by another substring. It's less appropriate than the method replacing a single char by another one. Side note: please respect the Java naming conventions. Variables start with a lowercase letter. Only class names start with an uppercase letter.
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/23590156
has comment: http://stackoverflow.com/comment/36207509

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/23554726
tags question: http://stackoverflow.com/q/23546265
tags question: http://stackoverflow.com/q/23586181
tags question: http://stackoverflow.com/q/23542862
tags question: http://stackoverflow.com/q/23569236
type: Tag
tags question: http://stackoverflow.com/q/23462125

http://stackoverflow.com/q/23538265
has title: how to compare array from sqlite with contents with json array
favorite count: 0
has answer: http://stackoverflow.com/a/23538665
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23538635
upvote count: 1
type: Question
score: 1
has answer: http://stackoverflow.com/a/23538503
tagged with: java
has body: Hi I´m having a problems with the best strategy to compare an array from an sqlite database and a json array coming from a webservice response . Please tell me the best way to compare this two arrays . Here is my code : public void getAllElements() { Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); try { //select all query db.open(); Cursor cc= db.getAllEntries(); try { // looping through all rows and adding to list if (cc.moveToFirst()) { do { map.put("ID",cc.getString(cc.getColumnIndex(DbHelper.ENTRY_ID))); } while (cc.moveToNext()); } } finally { try { cc.close(); } catch (Exception ignore) {} } } finally { try { db.close(); } catch (Exception ignore) {} } // return list } protected String doInBackground(String... params) { // Creating service handler class instance JSONParser jParser = new JSONParser(); DefaultHttpClient client = new DefaultHttpClient(); // Thread String uri = "url"; HttpGet httpget = new HttpGet(uri); httpget.setHeader("Cookie", cookie); try { response = client.execute(httpget); // response String res = EntityUtils.toString(response.getEntity()); // jarray with the json responde jArr = new JSONArray(res); System.out.println("response" + jArr); for (int i = 0; i &lt; jArr.length(); i++) { // create json object JSONObject jsonObject = jArr.getJSONObject(i); // easy parse fields String vid = jsonObject.getString("vid"); String nid = jsonObject.getString("nid"); // uid value String field_text = jsonObject.getString("field_text"); String field_edit_ts = jsonObject.getString("field_editts"); String field_deleted_flag = jsonObject.getString("field_deleted"); String field_device_name = jsonObject.getString("field_devicename"); String field_creation_ts = jsonObject.getString("field_creationts"); String field_device_key = jsonObject.getString("field_devicekey"); } } catch(Exception e){ } }
answer count: 3
tagged with: sqlite
tagged with: arrays
downvote count: 0

http://stackoverflow.com/a/23570331
type: Answer
has comment: http://stackoverflow.com/comment/36185821
has body: Request.newMeRequest is simply a wrapper around new Request(session, "/me"). It's a convenience method. If you want to ask for anything else, you need to construct it yourself, probably using the newGraphPathRequest method - https://developers.facebook.com/docs/reference/android/current/class/Request/#newGraphPathRequest So for the "me/interests" example above, you would do something like: Request.newGraphPathRequest(session, "me/interests", new Request.Callback() {...}) .executeAsync();
has comment: http://stackoverflow.com/comment/36297185
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/23565832
answers question: http://stackoverflow.com/q/23565832

http://stackoverflow.com/comment/36217684
type: Comment
type: QuestionComment
has text: From your last edit, there's no `anotherName` method to override, thus you get a compiler error. Also, you say that `Bar` implements `Foo` but there's no `public List<String> foo(String arg1, String arg2)` method in `Bar` class (or another method which signature `foo(String arg1, String arg2)` that returns a `List` or a subtype of `List`).
comment on: http://stackoverflow.com/q/23593946
score: 0

http://stackoverflow.com/comment/35953850
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23454047
has text: We can't help you if you don't tell us what the error is!

google-app-engine
tags question: http://stackoverflow.com/q/23502926
tag name: google-app-engine
tags question: http://stackoverflow.com/q/23472174
tags question: http://stackoverflow.com/q/23505974
tags question: http://stackoverflow.com/q/23548044
tags question: http://stackoverflow.com/q/23599479
type: Tag
tags question: http://stackoverflow.com/q/23483761
tags question: http://stackoverflow.com/q/23610559
tags question: http://stackoverflow.com/q/23530157
tags question: http://stackoverflow.com/q/23565908
tags question: http://stackoverflow.com/q/23600982
tags question: http://stackoverflow.com/q/23518450
tags question: http://stackoverflow.com/q/23564012
tags question: http://stackoverflow.com/q/23494323
tags question: http://stackoverflow.com/q/23459584
tags question: http://stackoverflow.com/q/23522523
tags question: http://stackoverflow.com/q/23543843
tags question: http://stackoverflow.com/q/23551438
tags question: http://stackoverflow.com/q/23457897
tags question: http://stackoverflow.com/q/23503803
tags question: http://stackoverflow.com/q/23592157
tags question: http://stackoverflow.com/q/23487075
tags question: http://stackoverflow.com/q/23568970
tags question: http://stackoverflow.com/q/23466255
tags question: http://stackoverflow.com/q/23574825
tags question: http://stackoverflow.com/q/23514301
tags question: http://stackoverflow.com/q/23485722
tags question: http://stackoverflow.com/q/23459619
tags question: http://stackoverflow.com/q/23571413
tags question: http://stackoverflow.com/q/23487034
tags question: http://stackoverflow.com/q/23591500
tags question: http://stackoverflow.com/q/23504455
tags question: http://stackoverflow.com/q/23582466
tags question: http://stackoverflow.com/q/23478588
tags question: http://stackoverflow.com/q/23558319
tags question: http://stackoverflow.com/q/23592738
tags question: http://stackoverflow.com/q/23537013
tags question: http://stackoverflow.com/q/23489555
tags question: http://stackoverflow.com/q/23582669
tags question: http://stackoverflow.com/q/23477745
tags question: http://stackoverflow.com/q/23455222
tags question: http://stackoverflow.com/q/23609969
tags question: http://stackoverflow.com/q/23546003

http://stackoverflow.com/comment/35990170
type: QuestionComment
comment on: http://stackoverflow.com/q/23472289
has text: Most likely there are no file contents to extract in a directory, the extraction already created a new file of type directory. There are no futher details so break the loop. Im asuming this happens when you zip an empty folder.
score: 0
type: Comment

http://stackoverflow.com/comment/36043534
score: 0
comment on: http://stackoverflow.com/a/23502084
type: AnswerComment
has text: Also, seems this is the only answer that leaves room to change the size while leaving other defaults untouched.
type: Comment

http://stackoverflow.com/comment/36065739
score: 0
type: Comment
has text: As I said: you should show your code to investigate
comment on: http://stackoverflow.com/a/23513212
type: AnswerComment

http://stackoverflow.com/comment/36060738
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23511800
has text: Try to find a pattern to select the strings: you have "COPY " and then your strings separated by commas
score: 0

http://stackoverflow.com/comment/36163542
type: Comment
type: QuestionComment
has text: @AntonH the code is explicit to spot the errors.
comment on: http://stackoverflow.com/q/23566575
score: 0

http://stackoverflow.com/q/23560663
has body: I'm trying to do a matrix multiplication using double arrays for an assignment but the arrays' values can neither be added nor multiplied using operators such as + or *= . What am I doing wrong? import java.util.Arrays; public class MatrixMultiplication { public static void main(String[] args) { //Initializing all required arrays double[][] matrix1 = new double[][] { { 3.0, 2.0, 1.0 }, { 1.0, 0.0, 2.0 } }; double[][] matrix2 = new double[][] { { 1.0, 2.0 }, { 0.0, 1.0 }, { 4.0, 0.0 }}; double[][] intermediate = new double[][] { { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 }, {0.0, 0.0, 0.0}}; double[][] result = new double[][] { { 0.0, 0.0 }, { 0.0, 0.0 }}; //check arrays' lengths and heights if ( matrix1.length == matrix2[0].length) { //multiply first line and first column for (int i = 0; i == matrix1.length; i++) { intermediate[i] = matrix1[i] * matrix2[0][i]; result[0] += intermediate[i]; } //multiply first line and second column for (int i = 0; i == matrix1.length; i++) { intermediate[i] = matrix1[i] * matrix2[1][i]; result[1] += intermediate[i]; } //multiply second line and first column for (int i = 0; i == matrix1.length; i++) { intermediate[i] = matrix1[i][1] * matrix2[0][i]; result[0][1] += intermediate[i]; } //multiply second line and second column for (int i = 0; i == matrix1.length; i++) { intermediate[i] = matrix1[i][1] * matrix2[1][i]; result[1][1] += intermediate[i]; } System.out.println(Arrays.deepToString(result).replace("], ", "]\n")); } else { System.out.println("Matrices can not be multiplied"); } } }
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/36152263
answer count: 1
tagged with: operators
has answer: http://stackoverflow.com/a/23560836
type: UnansweredQuestion
tagged with: double
has comment: http://stackoverflow.com/comment/36152056
tagged with: java
has title: Matrix multiplication - double array calculation in java
has comment: http://stackoverflow.com/comment/36152070
type: Question
tagged with: matrix-multiplication

http://stackoverflow.com/comment/36057005
comment on: http://stackoverflow.com/a/23509564
type: Comment
has text: In that case, you wont be extracting "to" or "from" or you can just put a check if the tag is present, then proceed for fetching attributes else just fetch body by tagName---- If this is what you asked and I understood.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23525747
type: Question
score: 0
tagged with: mongodb
accepted answer: http://stackoverflow.com/a/23526112
answer count: 1
has title: Return ObjectId from soap web service
has body: I have 2 java application. Soap server (jax-ws) and soap client. Soap server use spring mongo and mongoDb as database. So, On my Server I have method that reterns all companies @WebMethod(operationName = "getCompanies") public CompanyList getCompanies(){ CompanyList companyList = new CompanyList(); companyList.companyDocArrayList = Lists.newArrayList(orgStructService.getCompanyDocService().findAll()); return companyList; } companyList class public class CompanyList { public ArrayList&lt;CompanyDoc&gt; companyDocArrayList; } And CompanyDoc public class CompanyDoc{ @Id private ObjectId id; private String companyName; //getter setter } So, when I call this method ClientService clientService = new ClientService Service().getClientServicePort(); modelMap.addAttribute("companyList", clientService.getCompanies().getCompanyDocArrayList()); In clientService.getCompanies() in List I get strange objectId like com.web.client.services.ws.ObjectId@45ee7ab1 (45ee7ab1 - this value change every refresh page) But in database it is 5369fefa1d6e6712866daaea What I am doing wrong?
tagged with: soap
tagged with: spring
tagged with: web-services
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23526112
tagged with: java

http://stackoverflow.com/q/23592524
tagged with: abstract-syntax-tree
answer count: 1
has comment: http://stackoverflow.com/comment/36212381
has comment: http://stackoverflow.com/comment/36211680
has answer: http://stackoverflow.com/a/24069334
score: 0
has comment: http://stackoverflow.com/comment/36211953
has comment: http://stackoverflow.com/comment/36212126
has comment: http://stackoverflow.com/comment/36771986
has comment: http://stackoverflow.com/comment/36211828
has title: AST eclipse, adding arguments to a MethodInvocation
type: AnsweredQuestion
tagged with: java
has body: Im trying to add arguments to the arguments list of a MethodInvocation and it doesnt seem to work, I can remove objects but I cant see to add them. My end goal is to take 2 MethodInvocation that invoke the same method with different arguments and convert it to 1 MethodInvocation that has a ConditionalExpression as an argument. Example: if (A){ System.out.println("hi"); } else { System.out.println("hey"); } Will be converted to: System.out.println((A ? "hi" : "hey")); So I would also appreciate it if someone knwos how to convert the argument list to 1 big Expression I can place in the ConditionalExpression. Thanks! EDIT: sorry forgot to mention is it a code formatting plug-in for ecplise EDIT2: the code I am trying to run: final ExpressionStatement thenStmnt=(ExpressionStatement)((Block)node.getThenStatement()).statements().get(0), elseStmnt=(ExpressionStatement)((Block)node.getElseStatement()).statements().get(0); MethodInvocation thenMethod=(MethodInvocation)thenStmnt.getExpression(), elseMethod=(MethodInvocation)elseStmnt.getExpression(); final MethodInvocation method=ast.newMethodInvocation(); method.setName(ast.newSimpleName("add")); method.arguments().add(0, elseMethod.arguments().get(0)); ast is a given leagal AST and node is a given leagal IfStatement.
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/24069334
type: Question

http://stackoverflow.com/a/23604163
has comment: http://stackoverflow.com/comment/36235447
score: 0
has comment: http://stackoverflow.com/comment/36237261
has comment: http://stackoverflow.com/comment/36238537
has body: At the page: http://labs.micromata.de/projects/jak/quickstart.html You might also see there is specified encoding in xml: &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; when they are using: final Kml kml = Kml.unmarshal(new File("HelloKml.kml")); That mght be the case.
has comment: http://stackoverflow.com/comment/36233797
has comment: http://stackoverflow.com/comment/36234780
has comment: http://stackoverflow.com/comment/36235927
type: Answer
answers question: http://stackoverflow.com/q/23603424
has comment: http://stackoverflow.com/comment/36240870
has comment: http://stackoverflow.com/comment/36236175
has comment: http://stackoverflow.com/comment/36242795

http://stackoverflow.com/q/23515555
has comment: http://stackoverflow.com/comment/36105102
has title: Spring data testing custom repository data doesn't update
accepted answer: http://stackoverflow.com/a/23535309
type: Question
has answer: http://stackoverflow.com/a/23535309
has body: I am trying to write a test for custom spring data repository. I'm also using QueryDSL. I am new to spring-data. I use spring support for HSQL DB in testing. MySQL for dev. Problem: I do not see updated data in tests if I use custom repository. public interface AuctionRepository extends AuctionRepositoryCustom, CrudRepository&lt;Auction, Long&gt;, QueryDslPredicateExecutor&lt;Auction&gt; { // needed for spring data crud } . public interface AuctionRepositoryCustom { long renameToBestName(); } . public class AuctionRepositoryImpl extends QueryDslRepositorySupport implements AuctionRepositoryCustom { private static final QAuction auction = QAuction.auction; public AuctionRepositoryImpl() { super(Auction.class); } @Override public long renameToBestName() { return update(auction) .set(auction.name, "BestName") .execute(); } } My test Somehow fails at last line public class CustomAuctionRepositoryImplTest extends AbstractIntegrationTest { @Inject AuctionRepository auctionRepository; @Test public void testDoSomething() { Auction auction = auctionRepository.findOne(26L); assertEquals("EmptyName", auction.getName()); // test save auction.setName("TestingSave"); auctionRepository.save(auction); Auction saveResult = auctionRepository.findOne(26L); assertEquals("TestingSave", saveResult.getName()); // test custom repository long updatedRows = auctionRepository.renameToBestName(); assertTrue(updatedRows &gt; 0); Auction resultAuction = auctionRepository.findOne(26L); assertEquals("BestName", resultAuction.getName()); // FAILS expected:&lt;[BestNam]e&gt; but was:&lt;[TestingSav]e&gt; } } I can't figure out why data doesn't update when using custom repository. If I start application in dev mode, and call renameToBestName() through controller, everything works as expected, name changes. Below is Test Configuration if needed @RunWith(SpringJUnit4ClassRunner.class) @Transactional @ActiveProfiles("test") @ContextConfiguration(classes = {TestBeans.class, JpaConfig.class, EmbeddedDataS…
has comment: http://stackoverflow.com/comment/36070035
upvote count: 1
answer count: 1
favorite count: 0
tagged with: querydsl
has comment: http://stackoverflow.com/comment/36068090
has comment: http://stackoverflow.com/comment/36071551
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36067716
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/36071527
linked to: http://stackoverflow.com/q/22533399
tagged with: spring-data

http://stackoverflow.com/comment/36270799
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23622862
type: Comment
has text: Now the question is getting printed but in the same column,my options are also there.so how do i display the whole column,ie ,the question along with the options..

http://stackoverflow.com/a/23573422
has body: Actually, my problem was that I forgot to start the thread: stream.forEach(socket -&gt; { new Thread(() -&gt; { socket.getOutputStream().write("Hi there, client."); }).start(); });
downvote count: 0
answers question: http://stackoverflow.com/q/23573274
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/36002523
type: Comment
type: QuestionComment
has text: Yes, the interceptor is in the same package as the configuration file. In this case, the scanned package is the base of the project so everything is scanned. As stated, this *does* work if I remove the Jasypt-related beans.
score: 0
comment on: http://stackoverflow.com/q/23480035

http://stackoverflow.com/q/23582694
tagged with: encryption
has comment: http://stackoverflow.com/comment/36193950
type: AnsweredQuestion
has body: I am new in Java and I need to write an algorithm for cracking Caesar's cipher using brute force and then matching the words from the dictionary to find the correct shift. That's the code I have written so far. I would really appreciate if somebody helps me with the implementation of shifting the letters and matching them with the file dictionary.txt. 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[] decodedText; private String plainText; public String producePlaintext(String cipherText) { //put each letter of the ciphertext in an array of characters in the upper case format char[] message = cipherText.toUpperCase().toCharArray(); //loop through all the possible keys for (int key = 0; key &lt; alphabet.length; key++) { //set the value of the decrypted array of characters to be the same as the length of the cipher text decodedText = new char[message.length]; //loop through the characters of the ciphertext for (int i = 0; i &lt; message.length; i++) { //if character is not space if (message[i] != ' ') { //shift the letters }else{ decodedText[i] = ' '; } } plainText = String.valueOf(decodedText); } return plainText; }
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23583171
accepted answer: http://stackoverflow.com/a/23583171
has comment: http://stackoverflow.com/comment/36193863
type: Question
has title: Java caesars cipher brute forcing
upvote count: 3
downvote count: 2
tagged with: brute-force
answer count: 1
tagged with: cryptography
favorite count: 0

http://stackoverflow.com/comment/35966086
type: QuestionComment
has text: If you've opened a view provided by JDT, or one of its editors, preference pages, or anything it contributes to the UI, it's already loaded. As +Makoto said, Debug it. Look and see what's actually going on.
type: Comment
comment on: http://stackoverflow.com/q/23460285
score: 0

http://stackoverflow.com/comment/90912715
type: AnswerComment
type: Comment
has text: Maybe using `android.util.Base64.decode(str, android.util.Base64.DEFAULT);`
comment on: http://stackoverflow.com/a/30591380
score: 0

http://stackoverflow.com/q/23590755
has comment: http://stackoverflow.com/comment/36208468
tagged with: java
has answer: http://stackoverflow.com/a/23592056
favorite count: 0
has title: How am I supposed to draw an image from my Java Applet?
type: Question
has answer: http://stackoverflow.com/a/23590867
has comment: http://stackoverflow.com/comment/36208488
tagged with: image
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36209681
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36208433
has comment: http://stackoverflow.com/comment/36208351
tagged with: applet
linked to: http://stackoverflow.com/q/22988516
has comment: http://stackoverflow.com/comment/36208529
type: UnansweredQuestion
has body: I am not sure how to fully express this but, I have probably gone through 10 pages of Google links on this topic and not one of them has helped me solve my issue. I thought it would be simple enough, I was just trying to add an image to the paint function of my java applet, like any other shape, but this has turned out to be a nightmare for me. The problem is that every time I try to run the drawImage function it keeps saying Access Denied ("java.io.FilePermission" "Image.jpg" "read"). Yet, none of the tutorials mention this at all, all they ever say is that I should do the following: import java.applet.*; import java.awt.*; Image img; //These would go in the paint function img=getImage(getDocumentBase(),"/Image.jpg"); //I have tried without the slash too g.drawImage(img,20,20,this); This is all they do and it works for them, but it just won't work for me. Other methods are far too complex for the sake of just adding an image, and even when I go through the toil of doing those it keeps giving me the "Access Denied" message. There's also the method of "signing" it, but I really don't think that's going to help given all that I have tried, so I am afraid it might just be another wasted endeavor. None of the tutorials even tell you to have your applet signed. I have the image in the "build" (also called bin) folder together with the classes. The program seemed to run when I included the entire file path, but even then the image did not display. That is not to mention I can't really include the complete path from my own computer because then it wouldn't work when I actually send it to another person. Please, I just want to know why it doesn't work for me yet seems to work perfectly for others. That, and if there's a way around this. This is an example of what I am doing: import java.applet.*; import java.awt.*; public class JavaProject extends JApplet { Image img; public void init() { img=getImage(getDocumentBase(),"/Image.jpg"); } public void paint(Graphics g) { super.…
has answer: http://stackoverflow.com/a/23591492
has comment: http://stackoverflow.com/comment/36208348

http://stackoverflow.com/q/23519367
has title: Did not Pop appears in AutoCompleteTextView
downvote count: 0
has body: Hereby i have design this activity, My data from webservice is properly working, but i can't get the dropdownlist. here i convert the arraylist into String array for show the result in autocomplete.Kindly help me. Thanks in Advance. File:proprety.xml <?xml version="1.0" encoding="utf-8"?> <AutoCompleteTextView android:id="@+id/et_propertyact_propertyname" android:layout_width="match_parent" android:layout_height="28dp" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="10dp" android:background="@drawable/property_text" android:cursorVisible="true" android:ems="10" android:hint="Property Name" android:paddingLeft="8dp" android:paddingRight="8dp" android:singleLine="true" android:textColor="#ffffff" android:textColorHint="#ffffff" android:textSize="14sp" android:textStyle="bold" > <requestFocus /> </AutoCompleteTextView> <AutoCompleteTextView android:id="@+id/et_propertyact_blockname" android:layout_width="match_parent" android:layout_height="28dp" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="10dp" android:background="@drawable/block_text" android:cursorVisible="true" android:ems="10" android:hint="Block Name" android:paddingLeft="8dp" android:paddingRight="8dp" android:singleLine="true" android:textColor="#ffffff" android:textColorHint="#ffffff" android:textSize="14sp" android:textStyle="bold" > </AutoCompleteTextView> <AutoCompleteTextView android:id="@+id/et_propertyact_appartmentname" android:layout_width="match_parent" android:layout_height="28dp" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="10dp" android:background="@drawable/apartment" android:cursorVisible="true" android:ems="10" android:hint="Apartment Name" android:paddingLeft="8dp" android:paddingRight="8dp" android:singleLine="true" android:textColor="#ffffff" android:textColorHint="#ffffff" android:textSize="14sp" android:textStyle="bold" > </AutoCompleteTextView> File:…
has answer: http://stackoverflow.com/a/23539000
type: AnsweredQuestion
tagged with: android
score: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: Question
accepted answer: http://stackoverflow.com/a/23539000
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1

http://stackoverflow.com/a/23550774
answers question: http://stackoverflow.com/q/23549549
downvote count: 0
has body: The problem is most likely that you are removing all system environment variables before executing firefox, and replacing them all with the single variable DISPLAY. You can run env -i DISPLAY=:0.0 /home/msatyam/test.sh to simulate what you're doing in Java from the command line. If this reproduces the problem, you should instead get all the system's environment variable (using System.getenv()) and append DISPLAY=:0.0 to that list, and then run your script.
type: Answer
has comment: http://stackoverflow.com/comment/36134560
upvote count: 1
score: 1

http://stackoverflow.com/q/23516661
has comment: http://stackoverflow.com/comment/36069465
has comment: http://stackoverflow.com/comment/36071646
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36078463
upvote count: 1
has comment: http://stackoverflow.com/comment/36070062
has comment: http://stackoverflow.com/comment/36072600
has comment: http://stackoverflow.com/comment/36071438
has comment: http://stackoverflow.com/comment/36113819
has answer: http://stackoverflow.com/a/28505392
has comment: http://stackoverflow.com/comment/36115028
score: 1
tagged with: java
tagged with: hibernate
has title: Hibernate - Distinct Query returning two columns result
has comment: http://stackoverflow.com/comment/36075086
has body: Sometime back I asked the question regarding how to do a Distinct query using Hibernate. Now that I'm past that milestone, there is another thing that I require. And that is, given the table, --------------------------------------- | user_id | user_name | user_type | --------------------------------------- | 1 | mark taylor | admin | | 2 | bill paxton |co-ordinator| | 1 | tony brooks | admin | | 3 | ali jahan | developer | --------------------------------------- I want to create a distinct query which returns the distinct user_type along with it's corresponding user_id. Please do note that the user_id for a particular user_type is same. So for example, admin = 1 co-ordinator = 2 developer = 3 So the return I'm expecting is somewhat like a ArrayList or that sort which contains both values like user_id,user_type The code I've written to get Distinct UserType is as follows and I'm hoping there could be some modification to it to get the desired result. public List&lt;String&gt; findDistinctUserName() throws HibernateException { List&lt;String&gt; returnVal = new ArrayList&lt;String&gt;(); Criteria c = this.createCriteria(); c.setProjection(Projections.distinct(Projections.property("userType"))); c.addOrder(Order.asc("userType")); List&lt;String&gt; userTypeList = c.list(); for(String userType : userTypeList) { if(!userType.equalsIgnoreCase("")) { returnVal.add(userType); } } return returnVal; } Thank you for your answers in advance.
has comment: http://stackoverflow.com/comment/36075902
type: Question
has comment: http://stackoverflow.com/comment/36069594
downvote count: 0
has comment: http://stackoverflow.com/comment/36070558
tagged with: sql
has comment: http://stackoverflow.com/comment/36115153
tagged with: distinct
has comment: http://stackoverflow.com/comment/36072301
answer count: 1
has comment: http://stackoverflow.com/comment/36070625
favorite count: 0
has comment: http://stackoverflow.com/comment/36069967
has comment: http://stackoverflow.com/comment/36070901
linked to: http://stackoverflow.com/q/12032748

http://stackoverflow.com/comment/36149625
type: Comment
comment on: http://stackoverflow.com/q/23559007
has text: @Braj Or File file = new File(new File(path),filename);
score: 0
type: QuestionComment

http://stackoverflow.com/comment/49625997
type: AnswerComment
comment on: http://stackoverflow.com/a/24457111
type: Comment
has text: You are right @Peti! The commonPool in ForkJoinPool delivers an implementation of Future of type `ForkJoinTask` that doesn't interrupt the Future in case of cancel, while the Executors deliver a `FutureTask` that does. See Javadocs in the `cancel` method of `ForkJoinTask` : _mayInterruptIfRunning: this value has no effect in the default implementation because interrupts are not used to control cancellation_
score: 2

http://stackoverflow.com/comment/36102474
type: QuestionComment
comment on: http://stackoverflow.com/q/23533695
score: 0
has text: try with http://www.mkyong.com/java/how-to-convert-array-of-bytes-into-file/
type: Comment

http://stackoverflow.com/comment/36046980
type: Comment
comment on: http://stackoverflow.com/a/23504174
score: 0
type: AnswerComment
has text: With border layout, you should set jpanel preferred size.

http://stackoverflow.com/comment/36211619
score: 0
type: Comment
type: QuestionComment
has text: Even If I remove file option, data is not passed to the controller.
comment on: http://stackoverflow.com/q/23592157

intellij-idea
tags question: http://stackoverflow.com/q/23533375
tags question: http://stackoverflow.com/q/23602954
tags question: http://stackoverflow.com/q/23453196
tags question: http://stackoverflow.com/q/23553053
tags question: http://stackoverflow.com/q/23538349
tags question: http://stackoverflow.com/q/23603345
tags question: http://stackoverflow.com/q/23614355
tags question: http://stackoverflow.com/q/23567207
type: Tag
tags question: http://stackoverflow.com/q/23517661
tags question: http://stackoverflow.com/q/23566391
tags question: http://stackoverflow.com/q/23480034
tags question: http://stackoverflow.com/q/23460681
tag name: intellij-idea
tags question: http://stackoverflow.com/q/23490634
tags question: http://stackoverflow.com/q/23587270
tags question: http://stackoverflow.com/q/23473772
tags question: http://stackoverflow.com/q/23480119
tags question: http://stackoverflow.com/q/23487906
tags question: http://stackoverflow.com/q/23535318
tags question: http://stackoverflow.com/q/23462940
tags question: http://stackoverflow.com/q/23565824
tags question: http://stackoverflow.com/q/23570275
tags question: http://stackoverflow.com/q/23586366
tags question: http://stackoverflow.com/q/23557634
tags question: http://stackoverflow.com/q/23552063
tags question: http://stackoverflow.com/q/23492804
tags question: http://stackoverflow.com/q/23499960
tags question: http://stackoverflow.com/q/23540366
tags question: http://stackoverflow.com/q/23537515
tags question: http://stackoverflow.com/q/23614676
tags question: http://stackoverflow.com/q/23467112
tags question: http://stackoverflow.com/q/23523280
tags question: http://stackoverflow.com/q/23539693

http://stackoverflow.com/comment/36125121
has text: The game state could become inconsistent. Usually, you have more than one thread running in a game. Assume thread A calls resetGame() and executes after SCORE = DEFAULT_SCORE and then is paused so thread B takes control and reads SCORE and SPEED. Because speed wasn't reset yet, the game state will be inconsistent.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23545917

http://stackoverflow.com/q/23460875
tagged with: refactoring
tagged with: java
tagged with: code-duplication
has answer: http://stackoverflow.com/a/23460963
type: Question
has title: Java - avoiding code duplication in matrix iteration
score: 3
has answer: http://stackoverflow.com/a/23460948
has answer: http://stackoverflow.com/a/23461028
accepted answer: http://stackoverflow.com/a/23461028
upvote count: 3
has answer: http://stackoverflow.com/a/23461382
favorite count: 0
possible better answer: http://stackoverflow.com/a/23460948
has body: Suppose I have an int[size][size] matrix. I want to iterate through it like so: 01 02 03 04 08 07 06 05 09 10 11 12 16 15 14 13 Do I really have to say: for (int y=0; y&lt;size; y++) { int startIndex, endIndex, increment; boolean lessThan; if (y%2 == 0) { startIndex = 0; endIndex = size; lessThan = true; increment = 1; } else { startIndex = size-1; endIndex = -1; lessThan = false; increment = -1; } for (int x=startIndex; lessThan ? x&lt;endIndex : x&gt;endIndex; x+=increment) { // Process element } } to avoid doing this: for (int y=0; y&lt;size; y++) { if (y%2 == 0) { for (int x=0; x&lt;size; x++) { // Process element } } else { for (int x=size-1; x&gt;-1; x--) { // Process element } } } which is far nicer but repeats code. Is there a better way to structure this?
answer count: 4
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/37566307
comment on: http://stackoverflow.com/q/23545851
type: Comment
type: QuestionComment
has text: @tveon I'm sorry, I missed that. :-)
score: 0

netbeans
tags question: http://stackoverflow.com/q/23455815
tags question: http://stackoverflow.com/q/23589350
tags question: http://stackoverflow.com/q/23555242
tags question: http://stackoverflow.com/q/23530013
tags question: http://stackoverflow.com/q/23596100
tags question: http://stackoverflow.com/q/23606860
tags question: http://stackoverflow.com/q/23470545
tags question: http://stackoverflow.com/q/23544274
tags question: http://stackoverflow.com/q/23595594
tags question: http://stackoverflow.com/q/23568687
tags question: http://stackoverflow.com/q/23523227
tags question: http://stackoverflow.com/q/23582511
tags question: http://stackoverflow.com/q/23564735
tags question: http://stackoverflow.com/q/23459741
tags question: http://stackoverflow.com/q/23584312
tags question: http://stackoverflow.com/q/23499200
tags question: http://stackoverflow.com/q/23558313
tags question: http://stackoverflow.com/q/23541128
tags question: http://stackoverflow.com/q/23488101
type: Tag
tags question: http://stackoverflow.com/q/23482523
tags question: http://stackoverflow.com/q/23534851
tags question: http://stackoverflow.com/q/23517139
tags question: http://stackoverflow.com/q/23543158
tags question: http://stackoverflow.com/q/23569664
tags question: http://stackoverflow.com/q/23553046
tags question: http://stackoverflow.com/q/23506508
tags question: http://stackoverflow.com/q/23456831
tags question: http://stackoverflow.com/q/23586941
tags question: http://stackoverflow.com/q/23467866
tags question: http://stackoverflow.com/q/23496253
tags question: http://stackoverflow.com/q/23465004
tags question: http://stackoverflow.com/q/23504731
tags question: http://stackoverflow.com/q/23462468
tags question: http://stackoverflow.com/q/23469079
tags question: http://stackoverflow.com/q/23551321
tags question: http://stackoverflow.com/q/23479582
tags question: http://stackoverflow.com/q/23569846
tags question: http://stackoverflow.com/q/23471323
tags question: http://stackoverflow.com/q/23567418
tags question: http://stackoverflow.com/q/23507981
tags question: http://stackoverflow.com/q/23467100
tags question: http://stackoverflow.com/q/23604115
tags question: http://stackoverflow.com/q/23460730
tags question: http://stackoverflow.com/q/23583048
tags question: http://stackoverflow.com/q/23571624
tags question: http://stackoverflow.com/q/23459089
tags question: http://stackoverflow.com/q/23464460
tag name: netbeans
tags question: http://stackoverflow.com/q/23569971
tags question: http://stackoverflow.com/q/23530749
tags question: http://stackoverflow.com/q/23545290
tags question: http://stackoverflow.com/q/23509495
tags question: http://stackoverflow.com/q/23590116
tags question: http://stackoverflow.com/q/23501042
tags question: http://stackoverflow.com/q/23481594
tags question: http://stackoverflow.com/q/23552785

http://stackoverflow.com/comment/35976754
comment on: http://stackoverflow.com/a/23464962
type: AnswerComment
score: 0
has text: @user3590149 consider if you were getting the number 4. 4%5 = 4. If you then subtract it from 5 you get 1. Now is it 1 from the end? no its the last (0). I have a hard time explaining things like this but that's how I originally came to the conclusion. I hope that helps.
type: Comment

http://stackoverflow.com/comment/35952576
comment on: http://stackoverflow.com/a/23453530
type: Comment
score: 1
type: AnswerComment
has text: you should change message in your catch block to something more useful like the number of films are not more than seven or something like that. Just one point to your awesome answer.

http://stackoverflow.com/comment/36163341
has text: changed the answer, on your request for single row.
type: Comment
comment on: http://stackoverflow.com/a/23566398
score: 0
type: AnswerComment

http://stackoverflow.com/q/23607881
upvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36240413
has title: Returning a private collection using a getter method in Java
tagged with: java
possible better answer: http://stackoverflow.com/a/23607947
type: Question
has answer: http://stackoverflow.com/a/23608636
accepted answer: http://stackoverflow.com/a/23608636
has body: I have a number of Java classes that use private sets or lists internally. I want to be able to return these sets/lists using a get...List() method. The alternatives I am considering: return a reference to the internal object construct a new set/list and fill it up (this seems bad practice?) use Collections.unmodifiableList(partitions); Which of these is the most common / best way to solve this issue?
score: 4
has answer: http://stackoverflow.com/a/23607947
has answer: http://stackoverflow.com/a/23607955
has answer: http://stackoverflow.com/a/23607982
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23608146
answer count: 5

http://stackoverflow.com/comment/36181910
score: 1
type: AnswerComment
has text: Thank you so much. I bit off more than I could chew taking on this project and have been struggling to teach myself everything required.
type: Comment
comment on: http://stackoverflow.com/a/23576221

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/23514594
tags question: http://stackoverflow.com/q/23547134

variables
tag name: variables
tags question: http://stackoverflow.com/q/23610325
tags question: http://stackoverflow.com/q/23581642
type: Tag
tags question: http://stackoverflow.com/q/23522437
tags question: http://stackoverflow.com/q/23523539
tags question: http://stackoverflow.com/q/23463427
tags question: http://stackoverflow.com/q/23521567
tags question: http://stackoverflow.com/q/23481411
tags question: http://stackoverflow.com/q/23562431
tags question: http://stackoverflow.com/q/23552675
tags question: http://stackoverflow.com/q/23601046
tags question: http://stackoverflow.com/q/23545942

http://stackoverflow.com/comment/36113837
has text: possible duplicate of [java.sql.SQLException: \[Microsoft\]\[ODBC Microsoft Access Driver\] Too few parameters](http://stackoverflow.com/questions/2346306/java-sql-sqlexception-microsoftodbc-microsoft-access-driver-too-few-paramet)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23539180

http://stackoverflow.com/comment/36034644
type: Comment
comment on: http://stackoverflow.com/q/23497766
score: 0
has text: What is the exact relationship between price1 and price2 elements?
type: QuestionComment

http://stackoverflow.com/q/23614884
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23624943
tagged with: vcf-vcard
tagged with: contacts
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/23624943
type: AnsweredQuestion
has title: Primary TEL, EMAIL and etc properties in VCard
score: 1
tagged with: java
has body: I'm working on contacts exchange and sync framework for Android mobiles. I need to transform the data from Android ContactsContract.Data table to VCard and vice versa. So, it will be possible to export and import contacts in VCard format. I decided to use EZVCard library for parsing and formatting VCards. Android ContactsContract.Data table has IS_PRIMARY column. In rfc6350 (VCard standard) i found nothing about primary properties. Is there standard way to mark a property in VCard as primary?

http://stackoverflow.com/comment/36081871
has text: @Pavel Horal , I have edited original question.Let me know if you get any clue from it.Thank you.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23478461

http://stackoverflow.com/q/23508319
has comment: http://stackoverflow.com/comment/36054670
has title: Regex expression to check for alphanumeric string does not work
favorite count: 0
type: Question
tagged with: regex
accepted answer: http://stackoverflow.com/a/23508345
answer count: 6
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/23508327
has comment: http://stackoverflow.com/comment/36054602
upvote count: 1
has answer: http://stackoverflow.com/a/23508327
downvote count: 1
has answer: http://stackoverflow.com/a/23508341
has answer: http://stackoverflow.com/a/23509273
has answer: http://stackoverflow.com/a/23508527
has answer: http://stackoverflow.com/a/23508395
has answer: http://stackoverflow.com/a/23508345
has body: I am trying to test if my String contains a character ( a-z) (A-Z) and a number (0-9) package testing; import java.io.*; import java.security.*; import javax.xml.bind.DatatypeConverter; import java.lang.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.image.BufferedImage; import javax.imageio.ImageIO; public class Testing extends JPanel { public static void main(String[] args) { String foo = "abc1"; if (foo.matches(".*[0-9].*") &amp;&amp; foo.matches(".*[A-Z].*") &amp;&amp; foo.matches(".*[a-z].*")) { //contain letters and numbers only System.out.println("Foo"); } } } I am expecting Foo to be printed out but there seems to be a problem with my regex expression. Can someone help me out ?? Thanks
type: AnsweredQuestion

http://stackoverflow.com/comment/36208531
has text: i tired your way but i get the distance = 0 , known that if statements are satisfied because i get the value of s1,s2,s3,d1,d2,and d3 at the system out any suggestion
type: AnswerComment
comment on: http://stackoverflow.com/a/23590831
score: 0
type: Comment

http://stackoverflow.com/q/23460344
linked to: http://stackoverflow.com/q/12119753
has comment: http://stackoverflow.com/comment/35965471
has comment: http://stackoverflow.com/comment/35965411
tagged with: android
has comment: http://stackoverflow.com/comment/35965563
has comment: http://stackoverflow.com/comment/35965526
has body: I been reading in various places and I need to enable GPU rendering for my canvas, but after adding android:hardwareAccelerated="true" To the android manifest, it still tells me hardware acceleration(GPU rendering) is not enable.... (I use this to determine if it is enabled, yet it returns false DrawingCanvas.isHardwareAccelerated() ) that There must be someone to force android to just render using the GPU instead of the CPU. I currently am using android kitkat.
has title: How to force GPU Rendering(Hardware acceleration) for android canvas
downvote count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35965529
type: Question
has comment: http://stackoverflow.com/comment/35965699
score: 1
tagged with: java
tagged with: hardware-acceleration
upvote count: 1
has comment: http://stackoverflow.com/comment/35965655
favorite count: 0

http://stackoverflow.com/q/23514072
has title: Sending several files from server side using http 'POST' -send ArrayList of FileInputStream
tagged with: fileinputstream
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23518119
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/36069431
tagged with: arraylist
has body: I succesfully wrote an http 'post' that gets 1 file (image) from the server side like this: @Path("getImage") @POST @Produces({MediaType.APPLICATION_OCTET_STREAM}) public Response getImage(picRequest request) throws Exception { File file = ...... return Response.ok(new FileInputStream(file)).build(); } And I check it using client: ClientResponse response = webResource .type(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_OCTET_STREAM) .post(ClientResponse.class, inp); The problem is that I cann't succeed when trying to send several files in a list. (ArrayList of FileInputStream) ArrayList&lt;InputStream&gt; resultData = new ArrayList&lt;InputStream&gt;(); while (rs.next()) { .... resultData.add(new FileInputStream(file)); } return Response.ok(resultData).build(); How do I do it? and what should be the MediaType? Thank you so much for helping.
score: 0

http://stackoverflow.com/a/23513518
has body: Check if StoreHomeFragment extends Fragment and, if you use the support library, check your class imports because Fragment class is also contained in support library. Pratically you have to import the same Fragment class that you use in StoreGenreFragment or StoreStepFragment
answers question: http://stackoverflow.com/q/23513118
has comment: http://stackoverflow.com/comment/36063839
score: 0
has comment: http://stackoverflow.com/comment/36064326
type: Answer

http://stackoverflow.com/comment/36454630
score: 0
type: AnswerComment
has text: Do you mean test user on facebook or in my app? I can do it in my app for sure, but then that won't test the full end-to-end process of authorising the app with facebook.
type: Comment
comment on: http://stackoverflow.com/a/23570906

http://stackoverflow.com/q/23475490
has title: Parse.com Android: Number of ParseObjects I can pin to the Local Datastore?
tagged with: sdk
downvote count: 0
favorite count: 0
tagged with: parse-platform
linked to: http://stackoverflow.com/q/17246991
tagged with: android
tagged with: facebook
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23504005
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23504005
has body: I'm building an Android health &amp; fitness app and would like to store some health data. To be able to use the app without internet connection I'm using the Parse Local Datastore exactly as described here: https://parse.com/docs/android_guide#localdatastore-caching Everything works fine as long I have less then 100 ParseObjects pinned to the Local Datastore. If I have more ParseObjects, only the first 100 will be loaded. So I would like to know if there's a way to increase the maximum number of ParseObjects I can pin to the Local Datastore or some kind of workaround?
answer count: 1

http://stackoverflow.com/q/23473814
has answer: http://stackoverflow.com/a/23473871
tagged with: java
has body: This is my first time working with WS so maybe this will be a dumb question. I have generated my client with SoapUI and WebMethod looks like so @WebResult(name = "result", targetNamespace = "http://xxx.wsdl", partName = "result") @WebMethod(action = "xxx.wsdl/getBylWs") public Kp2ParBylosOtUserArray getAWs( @WebParam(partName = "a", name = "a") String a, @XmlElement(nillable = true) @WebParam(partName = "b", name = "b") String b, @WebParam(partName = "c", name = "c") String c ); b and c params can be null, in SoapUi this is easy nil="true" but how to pass null in java code?
has title: Passing null to java @WebMethod
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/35990119
type: Question
upvote count: 1
tagged with: web-services
answer count: 1

http://stackoverflow.com/comment/36048198
type: QuestionComment
has text: The compiler doesn't know you only asked for letters, and it doesn't know if the user really did enter a letter and if they didn't `num1` wont be initialised to anything.
comment on: http://stackoverflow.com/q/23504876
score: 0
type: Comment

http://stackoverflow.com/a/23536585
downvote count: 0
answers question: http://stackoverflow.com/q/23536493
type: Answer
has body: In Java, ArrayLists (and other generic classes) only accept object references as types, not primitive data types. There are wrapper classes that allow you to emulate using primitives, though: Boolean, Byte, Short, Character, Integer, Long, Float and Double; public ArrayList&lt;Double&gt; list = new ArrayList&lt;Double&gt;(); //or "public ArrayList&lt;Double&gt; list = new ArrayList&lt;&gt;();" in Java 1.7 and beyond Values inside are "autoboxed" and "autounboxed" so you can treat doubles as Doubles without problems, and vice versa. You may need to explicitly specify whether you want arguments to be treated as int or Integer when dealing with lists of integral types, though, to disambiguate between cases like remove(int index) and remove(Object o).
score: 3
upvote count: 3

http://stackoverflow.com/comment/36165512
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23561747
score: 0
has text: Any help? i can't understand how to solve this

http://stackoverflow.com/comment/36194643
comment on: http://stackoverflow.com/a/23548574
score: 1
type: AnswerComment
has text: Thanks Syam. As I saw in several places, your method should work. But mine didn't work. Anyway I found answer [here](http://stackoverflow.com/a/19262843/1244383)
type: Comment

http://stackoverflow.com/a/24800923
type: Answer
answers question: http://stackoverflow.com/q/23535788
upvote count: 1
has body: Bash is a bad choice to handle the Chromiums Native Messaging API. It cannot handle binary info in any efficient way, see this question I did manage to launch a bash script though. For that I used sendNativeMessage. Sending just once chrome.runtime.sendNativeMessage('com.centeropenmiddleware.l3p1.xmleditor', {text: "send"}, function(response) {console.log("Received " + chrome.runtime.lastError.message); }); It will launch /home/paco2/pp.sh, but parsing the message will be difficult in bash, even if it's a short as send. In short don't use bash for this, try C++, or Python in between and use subprocess.
downvote count: 0
score: 1

http://stackoverflow.com/comment/36002740
comment on: http://stackoverflow.com/q/23479924
has text: if u was null it should crash 2 lines above 298, on this line u.layout(0, 0, totalWidth, totalHeight); I dont think u is null after all.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/35994397
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23473764
has text: Hi Sean,yes you got it right.The POJO User has a get property which is List<Permission>.Permission contains only names.After executing the select query, i am getting result as shown in above table.In Jsp, i want to show that the User1 has add, view permissions. Please suggest me how to achieve it.

http://stackoverflow.com/comment/36169984
type: QuestionComment
has text: @PeterLawrey Thanks, was double checking as I think I've gotten away with it in the past hence the confusion.
score: 0
comment on: http://stackoverflow.com/q/23570227
type: Comment

http://stackoverflow.com/a/23592595
upvote count: 4
has comment: http://stackoverflow.com/comment/36211810
accepted answer of: http://stackoverflow.com/q/23519223
answers question: http://stackoverflow.com/q/23519223
score: 4
has comment: http://stackoverflow.com/comment/36248016
type: AcceptedAnswer
downvote count: 0
has body: this is the javascript code //get text 1 by ajax function getText1(urlstarted) { xmlHttp = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... xmlHttp = new XMLHttpRequest(); if (xmlHttp.overrideMimeType) { // set type accordingly to anticipated content type //http_request.overrideMimeType('text/xml'); xmlHttp.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!xmlHttp) { alert('Cannot create XMLHTTP instance'); return false; } var url=urlstarted+"/jsp/viewText1.jsp"; //put the link to ur Ajax page here xmlHttp.onreadystatechange = startAjaxingText; xmlHttp.open("GET", url, true); xmlHttp.send(null); } function startAjaxingText() { if (xmlHttp.readyState != 4) { document.getElementById('image').style.display='block' ; document.getElementById('result').style.display='none' ; } if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { document.getElementById('image').style.display='none' ; document.getElementById('result').style.display='block'; document.getElementById('result').innerHTML = xmlHttp.responseText; } else { alert("There was a problem with the request."); } } } //get text 2 by ajax function getText2(urlstarted) { xmlHttp = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... xmlHttp = new XMLHttpRequest(); if (xmlHttp.overrideMimeType) { // set type accordingly to anticipated content type //http_request.overrideMimeType('text/xml'); xmlHttp.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!xmlHttp) { alert('Cannot create XMLHTTP instance'); return false; } var url=urlstarted+"/jsp/viewText2.jsp"; //put the link to ur Ajax page here xmlHttp.onreadystatechange = startAjaxingText2; xmlHttp.open("GET", url, tru…
type: Answer

http://stackoverflow.com/q/23495944
has comment: http://stackoverflow.com/comment/36058728
possible better answer: http://stackoverflow.com/a/23496131
tagged with: batch-file
answer count: 3
has comment: http://stackoverflow.com/comment/36041863
has comment: http://stackoverflow.com/comment/46317373
tagged with: windows
has body: I am currently trying to execute a .bat file in Java. The bat file actually runs perfectly but after it is executed, my main program exits. I have no idea why and i need it to carry on with its code once the bat file has been executed. The program and bat file will all be run on Windows. Here is the code to how i run the bat file: if(!running) { @SuppressWarnings("unused") Process process = Runtime.getRuntime().exec("cmd /c start "+localTargetInPath+"\\startBatchClient.bat"); process.getInputStream().close(); process.getOutputStream().close(); process.getErrorStream().close(); } //wait to allow batch client to start up Thread.sleep(1000); I have been trying to figure this out for days with no luck. Any ideas? EDIT: Just to clarify something stated in answers: The point is to do the following: Run batch file batch file launches batch client Java program continues to run Java program connects to running batch client EDIT 2: Here is the contents of the batch file (which again runs the application without any problems: set JAVA_HOME="C:\Program Files\Java\jdk1.6.0_23" set ep_root=C:\app\plm\e6_1_1\P2\BatchClient set axalant_root=C:\app\plm\e6_1_1\P2\BatchClient\axalant set batchcli_root=C:\app\plm\e6_1_1\P2\BatchClient set EP_MACH=intel-ms-nt4.0 C:\Windows\system32\cmd.exe /K c:\app\plm\e6_1_1\P2\BatchClient\axalant\cmd\batchclient_nowrapper.cmd -eciservermode -p %localInPath%\batchClient.properties -T C:\zftmp\svc.emea.batch11e\testclient.properties
has comment: http://stackoverflow.com/comment/36031203
favorite count: 0
has title: Running a .bat file in Java
upvote count: 1
has answer: http://stackoverflow.com/a/23496139
linked to: http://stackoverflow.com/q/615948
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/46317466
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23496675
has comment: http://stackoverflow.com/comment/36030924
type: Question
has comment: http://stackoverflow.com/comment/36030994
has answer: http://stackoverflow.com/a/23496131
downvote count: 0
has comment: http://stackoverflow.com/comment/36030989
accepted answer: http://stackoverflow.com/a/23496139

http://stackoverflow.com/a/38597348
score: 0
answers question: http://stackoverflow.com/q/23542807
type: Answer
has body: Oracle will eventually clean up the dead registrations. You can also enable keep alive in the sqlnet parameter file on the server-side to speed up this cleaning process.

http://stackoverflow.com/comment/36164041
type: QuestionComment
comment on: http://stackoverflow.com/q/23566952
score: 0
has text: Please show the architecture of your code and tell us what part of it is exactly that you want to test.
type: Comment

http://stackoverflow.com/q/23604846
tagged with: swing
has answer: http://stackoverflow.com/a/23605227
type: Question
tagged with: java
has body: Ok here is my question. I am writing a program which takes 4 panels combines them into one with a user input in the west, totals in the east, and a banner in the north. my question is how do i implement an action listener to get the numbers that someone is typing in the west panel to automatically show up in the totals (east) panel? The code is a little long (for me) and I am getting close with this and just want to get it done. Do I have to put the event handler class in the user info panel, or just have it all in the totals panel? I checked out the other questions and could not find an answer. import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Scanner; import javax.swing.*; import javax.swing.border.TitledBorder; /** * * User input panel * first panel * has JTextFields for input of date for the hw/h, hours, and gallons **/ public class UserInput extends JFrame implements ActionListener { //variables/attributes private double kwh; private double hours; private double gallons; public double total; //JFrame componants private final JTextField kwhField; private final JTextField hoursField; private final JTextField gallonsField; private final JLabel kwhLabel; private final JLabel hoursLabel; private final JLabel gallonsLabel; public UserInput() { // create the Grid setLayout (new GridLayout (3,2)); //create the fields kwhField = new JTextField(15); hoursField = new JTextField(15); gallonsField = new JTextField(15); //create the labels kwhLabel = new JLabel ("Kw/H"); hoursLabel = new JLabel ("Hours"); gallonsLabel = new JLabel ("Gallons"); //Add a border TitledBorder titled; titled = BorderFactory.createTitledBorder("User Input"); //Add the tiles into the grid add(kwhField); add(kwhLabel); add(hoursField); add(hoursLabel); add(gallonsField); add(gallonsLabel); //add action listeners kwhLabel.addActionListener(this); } //The get method to retrieve the user inputs Scanner keyboard = new Scanner(System.in); /** * * …
has comment: http://stackoverflow.com/comment/36237053
answer count: 1
has comment: http://stackoverflow.com/comment/36235851
has comment: http://stackoverflow.com/comment/36236188
has comment: http://stackoverflow.com/comment/36235135
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36236456
has title: Action Listener help across panels
has comment: http://stackoverflow.com/comment/36234903
has comment: http://stackoverflow.com/comment/36235896
has comment: http://stackoverflow.com/comment/36237126
has comment: http://stackoverflow.com/comment/36235019
tagged with: listener
has comment: http://stackoverflow.com/comment/36236250
score: 0
has comment: http://stackoverflow.com/comment/36236145

http://stackoverflow.com/q/23603424
score: 0
has body: I would like to ask for a solution for the problem that I will display below. I read a kml file that has greek characters with kml.unmarshal and I receive those characters Ξ”Ξ—Ξ�Ξ�Ξ£Ξ™Ξ�Ξ™ Ξ§Ξ©Ξ΅Ξ�Ξ™ final Kml kml = Kml.unmarshal(new File("something.kml")); final de.micromata.opengis.kml.v_2_2_0.Document document = (de.micromata.opengis.kml.v_2_2_0.Document) kml.getFeature(); List&lt;Feature&gt; t = document.getFeature(); for (Object o : t) { PointOfInterest poi = new PointOfInterest(); Folder f = (Folder) o; List&lt;Feature&gt; tg = f.getFeature(); for (Object ftg : tg) { Placemark g = (Placemark) ftg; ExtendedData extdat = g.getExtendedData(); List&lt;SchemaData&gt; list = extdat.getSchemaData(); List&lt;SimpleData&gt; list2 = list.get(0).getSimpleData(); for (int i = 0; i &lt; list2.size(); i++) { SimpleData dat = list2.get(i); // System.out.println(dat.getName() + " - " + dat.getValue()); if (dat.getName().equals("newcat")) if (dat.getValue().equalsIgnoreCase("Ελληνικοι χαρακτηρες"){...}}} The code is not mine and I try to find out why dat.getvalue has the following content Ξ”Ξ—Ξ�Ξ�Ξ£Ξ™Ξ�Ξ™ Ξ§Ξ©Ξ΅Ξ�Ξ™ when it has greek characters. Edit: I tried to use final Kml kml = Kml.unmarshal(new FileInputStream(new File("something.kml")), "UTF8")) and I get the following error.Any idea why? no suitable method found for unmarshal(FileInputStream,String) method Kml.unmarshal(InputStream) is not applicable (actual and formal argument lists differ in length) method Kml.unmarshal(String) is not applicable (actual and formal argument lists differ in length) method Kml.unmarshal(File) is not applicable (actual and formal argument lists differ in length) method Kml.unmarshal(File,boolean) is not applicable (actual argument FileInputStream cannot be converted to File by method invocation conversion) unreported exception FileNotFoundException; must be caught or declared to be thrown ';' expected
has comment: http://stackoverflow.com/comment/36235593
has comment: http://stackoverflow.com/comment/36232598
answer count: 1
has comment: http://stackoverflow.com/comment/36232626
has comment: http://stackoverflow.com/comment/36235470
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36232338
has title: java kml doesn't read greek characters
tagged with: java
has answer: http://stackoverflow.com/a/23604163
type: Question
tagged with: kml

http://stackoverflow.com/comment/36183034
has text: If that was the old array, the new one would be {-2, -1, 0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5}. Long story short it doesn't sort them it just fills in the numbers in between elements.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23576784
type: Comment

http://stackoverflow.com/q/23454590
favorite count: 0
type: Question
tagged with: hadoop
tagged with: remoteexception
linked to: http://stackoverflow.com/q/10097246
has answer: http://stackoverflow.com/a/23557438
tagged with: apache
has title: Not able to get rid of famous DataStreamer Exception: org.apache.hadoop.ipc.RemoteException: error
has body: I am running hadoop cluster with Ubuntu host as master-slave and virtual machine running on it as another slave(2 node cluster). It seems the solution to the problem which is supposed to be resolved at No data nodes are started is not working for me. I tried both the solutions explained there. It seems that when i manually equate the namespace ids of the affected datanodes to name node and start the cluster(solution 2 in the linked post) i still get the same error( DataStreamer Exception). Next the logs of one of the datanode shows the same Incompatible namespaceIDs error, but the namespace id of data node which is shown in the log is different from that present my tmp/dfs/data/current/version file(which is not changed and is same as that of tmp/dfs/name/current/version) After many hours of debugging i am still clueless :(. PS: There is no connection problem from my host to slave When i start the cluster using start-dfs.sh then datanodes on both the nodes are started which is normall just to clarify. This error i am facing when i copy file from local to hdfs. I performed a simple test after all this Deleted the tmp/dfs/data and tmp/dfs/name folder on master Deleted tmp/dfs/data on slave format the namenode using hadoop namenode -format started the cluster using start-dfs. all nodes it started normally on master and datanode is also up on slave now ran the copyfromLocal command and it gave me the same error as below But this time there is no namespace mismatch error in any of datanode logs master or slave 14/05/04 04:12:54 WARN hdfs.DFSClient: DataStreamer Exception: org.apache.hadoop.ipc.RemoteException: java.io.IOException: File /user/dsingh/mysample could only be replicated to 0 nodes, instead of 1 at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getAdditionalBlock(FSNamesystem.java:1920) at org.apache.hadoop.hdfs.server.namenode.NameNode.addBlock(NameNode.java:783) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAcc…
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/23457683
has answer: http://stackoverflow.com/a/23457683
has answer: http://stackoverflow.com/a/33532243
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/23557438
tagged with: java

http://stackoverflow.com/comment/36126196
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23546561
score: 1
has text: You say you have "1.0.17-demo" in your build path - you mean you only have the demo jar in your classpath and not the library jar? You should have "jfreechart-1.0.17.jar" in your classpath as well.

http://stackoverflow.com/q/23580780
tagged with: java
tagged with: ssl
has comment: http://stackoverflow.com/comment/36190030
type: Question
has answer: http://stackoverflow.com/a/23586029
has body: I am trying to create an application where I have a server that hosts files and a client that wants to retrieve those files. I am currently trying to establish a SSL connection between the client and the server, however, I only want the encryption part of SSL not the authentication (I do not want to go through the troubles of creating and managing keystores etc). All the sample code I have found has used TLS which requires authentication. I was wondering what implementation does not use authentication? I read that there is a Diffie Hellman handshake but I was wondering if there was any other cipher suite besides TLS I could use? SSLSocketFactory factory = null; try { SSLContext ctx; KeyManagerFactory kmf; KeyStore ks; char[] passphrase = "passphrase".toCharArray(); ctx = SSLContext.getInstance("TLS"); kmf = KeyManagerFactory.getInstance("SunX509"); ks = KeyStore.getInstance("JKS"); is there a different SSLContext I could use that will not require me to create a KeyManagerFactory or a Keystore?
score: 0
linked to: http://stackoverflow.com/q/4914033
has comment: http://stackoverflow.com/comment/36189978
answer count: 1
type: UnansweredQuestion
tagged with: encryption
has title: Java: establish SSL connection without authentication

http://stackoverflow.com/a/23580710
accepted answer of: http://stackoverflow.com/q/23580333
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/23580333
has body: Just have one thread reading the stream and doing everything which needs to be done for each object. This thread can do all the work of the two threads and/or you can have it message between threads to have other threads do additional work.
upvote count: 4

http://stackoverflow.com/comment/36124322
type: Comment
comment on: http://stackoverflow.com/q/23545394
score: 0
has text: @qualtar Do you have access for the code of `method()`? If yes just check what does it return, if not it should be documented elsewhere.
type: QuestionComment

http://stackoverflow.com/a/23560496
accepted answer of: http://stackoverflow.com/q/23535196
type: Answer
answers question: http://stackoverflow.com/q/23535196
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
has body: Add the following property to the text element: <textField> $F{color} ...

http://stackoverflow.com/comment/36081723
type: Comment
has text: This doesn't really address the question - the OP appears to be using serialization as a persistence mechanism (I'm assuming that from the reading/writing to disk part). They're now unable to read their data because it was written with a previous version of the class, so while it's true that if you were sending an object between client and server, both sides should use the same class, that advice isn't applicable in this case
score: 2
comment on: http://stackoverflow.com/a/23522283
type: AnswerComment

http://stackoverflow.com/q/23509702
tagged with: java
has answer: http://stackoverflow.com/a/23534829
type: Question
score: 5
tagged with: rackspace-cloud
answer count: 2
has answer: http://stackoverflow.com/a/23531226
tagged with: rackspace
favorite count: 0
possible better answer: http://stackoverflow.com/a/23531226
upvote count: 5
tagged with: jclouds
tagged with: rackspace-cloudfiles
accepted answer: http://stackoverflow.com/a/23534829
type: AnsweredQuestion
has title: Rackspace Cloud Files (using jclouds) - how to get container location
has body: I use jclouds as an api for Rackspace Cloud Files. Api allows me to create containers in different locations using BlobStore.createContainerInLocation Now, having container that is already exists, how do I get it's location?
downvote count: 0

http://stackoverflow.com/comment/35977549
has text: You could use maven assembly plugin to create a jar with dependencies [jar-with-dependencies](http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23464902

http://stackoverflow.com/a/23571603
answers question: http://stackoverflow.com/q/23549374
type: Answer
score: 0
has body: Scenario: Used WebApplicationContext to intialize the beans defined in the applicationCOntext.xml file and received a null while trying to use the instantaited bean object in the code after autowiring. Issue in this scenario: I'm trying to autowire a spring bean in a class on which Spring has control over. Solution: Extending the Servlet class (Class which is not in Spring control) which is the endpoint of my JBOSS WS with Spring's SpringBeanAutowiringSupport class helped me resolve the issue. Below is the code snippet public class MServiceImpl extends SpringBeanAutowiringSupport implements MService{ @Autowired private Helper helper; public MServiceImpl() { } ...... ...... } Figured out that using static block to initialize the spring bean is bad approach. Thanks to @Engineer Dollery

http://stackoverflow.com/a/23477162
has body: Your class is not in a JComponent and key listeners can be only added to JComponent (You only implemented KeyListener). See the examples again, it should extend a JComponent (like JPanel)
has comment: http://stackoverflow.com/comment/35996331
answers question: http://stackoverflow.com/q/23477051
type: Answer
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23477051

http://stackoverflow.com/q/23513952
tagged with: java
answer count: 1
score: 1
has title: How can I show display an error in an EditTextPreference's dialog when validation fails?
favorite count: 0
tagged with: android
tagged with: android-edittext
upvote count: 2
type: UnansweredQuestion
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/30442470
has body: I've just discovered that the EditText on Android has a method called setError when invoked shows an error symbol in the EditText. Here's what it looks like: I'd like to display the same thing in the dialog of my EditTextPreference when the validation fails (e.g. the word was longer than 5 characters). For this, I guess I'll need to extend the EditTextPreference, get the reference to the EditText in it and do the validation when a key is pressed. This should be rather simple but I'm quite lost.

http://stackoverflow.com/comment/36079880
has text: That won't compile, and it certainly won't return the sum.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23522020

http://stackoverflow.com/q/23592157
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36214000
upvote count: 1
type: Question
has body: I know it has been asked multiple times but I am unable to get my problem fixed. Bean class @Component @Scope("prorotype") public class NotesData { //with getters/setters String college; String topic; String subject; String description; MultipartFile file; } JSP <form:form action="/upload" method="post" enctype="multipart/form-data" modelAttribute="notesData"> <form:input path="file" name="file" type="file" /> <form:input path="description" name="description" type="text" /> colleges <form:select path="college" name="college"> <c:forEach var="entry" items="${colleges}"> ${entry.key} </c:forEach> </form:select> </form:form> Controller: @RequestMapping(value="/upload", method = RequestMethod.POST) public String uploadFile(@ModelAttribute("notesData") NotesData nd, ModelMap model, BindingResult br, HttpServletRequest request) { //TODO: Check why modelAttribute is not working. System.out.println("Inside post " + nd); System.out.println(request.getParameterMap()); model.addAttribute("subjects", getSubjects()); model.addAttribute("colleges", getColleges()); return "upload"; } On submission of the form, request is coming to the controller but values are not coming up. Along with @ModelAttribute, I also passed HttpServletRequest but that is also coming out to be empty. Problem seems to be with GAE and MultipartUpload incompatibility. I tried using GMultipart but then I keep on getting following exception: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemHeadersSupport at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method)…
downvote count: 0
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/36211619
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/36214087
has title: JSP file upload not being passed to Controller in GAE
has comment: http://stackoverflow.com/comment/36210952
has comment: http://stackoverflow.com/comment/36211921
tagged with: spring-mvc
tagged with: model-view-controller
answer count: 0

http://stackoverflow.com/comment/35987244
comment on: http://stackoverflow.com/q/23472430
score: 0
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/23070299/get-the-windows-download-folders-path

http://stackoverflow.com/a/23460778
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/35966284
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23459711
has body: This could be a problem with the Java compiler settings where you describe whether each kind compile issue (e.g. local value not read, etc.) is to be treated as an error, warning or simple ignored. Go to Preferences -> Java -> Compiler -> Errors/Warnings and confirm that the warnings you expect to be flagged are in fact configured to be warnings.
answers question: http://stackoverflow.com/q/23459711

http://stackoverflow.com/comment/36214073
has text: Did you like any of the given answers
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23514726

http://stackoverflow.com/q/23543919
score: 1
favorite count: 0
has title: how to correctly MySQL "desc table" via java connectivity
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/23544071
answer count: 1
tagged with: java
has body: I am actually building a project where the names of tables present in databases of mysql are displayed in a list in java. user selects a table from a list and the description of that table in given using "desc tablename" command. The problem is, it is supposed to get every field in table but it only gets first field. Below i have explained it more, but first heres my code-: try { int rowCount = tableModel.getRowCount(); for (int i = 0; i &lt; rowCount; i++) { tableModel.removeRow(i); } String z = jList2.getSelectedValue().toString(); try { Class.forName("java.sql.DriverManager"); } catch (ClassNotFoundException e) { timeget(); jTextArea4.append(now + ": " + "/ Failed in getting Driver \n Error Message: " + e.getMessage() + " / \n \n"); JOptionPane.showMessageDialog(this, e.getMessage()); } DriverManager.getConnection("jdbc:mysql://localhost:" + GlobalParams.portvar + "/", "" + k, "" + j); stmnt = (Statement) con.createStatement(); String query = "desc " + z; jTextArea5.append(now + ": " + "/ desc " + z + "; / \n \n"); ResultSet rs = stmnt.executeQuery(query); String[] cnames = {"Field", "Type", "Null", "Key", "Extra"}; tableModel.setColumnIdentifiers(cnames); jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); jTable1.setFillsViewportHeight(true); if (rs.next()) { String field = rs.getString("Field"); String type = rs.getString("type"); String nullinfo = rs.getString("null"); String key = rs.getString("key"); String extra = rs.getString("extra"); tableModel.addRow(new Object[]{field, type, nullinfo, key, extra}); } catch(SQLException e){//some blabla} Now for detailing into problem-> Say from the list, i select a table called "city". Originally, it has four fields- ID, Name, Population, CountryCode. But in my jTable, only "ID" appears. the code... int rowCount = tableModel.getRowCount(); for (int i = 0; i &lt; rowCount; i++) { tableModel.removeRow(i); } ...is simply to remove fields of old table when a new table is selected from list. Hope i clarified my prob…
tagged with: mysql
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23544071
downvote count: 0

http://stackoverflow.com/q/23517630
tagged with: quartz-scheduler
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36071262
has title: It is possible to connect Oracle to Quartz back-end database
has body: I'm using Quarts to schedule the jobs.. Back-end database is now sql server It is possible to connect to Oracle database. if yes how..?
possible better answer: http://stackoverflow.com/a/23517695
has answer: http://stackoverflow.com/a/23517701
accepted answer: http://stackoverflow.com/a/23517701
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/23517695
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/36071303
tagged with: java

http://stackoverflow.com/comment/36198468
type: Comment
has text: You're right, GridLayout is definitely the best choice here: [link](http://docs.oracle.com/javase/tutorial/uiswing/layout/grid.html)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23585064

classpath
tags question: http://stackoverflow.com/q/23604744
tags question: http://stackoverflow.com/q/23534662
tags question: http://stackoverflow.com/q/23512174
tags question: http://stackoverflow.com/q/23562122
tags question: http://stackoverflow.com/q/23563469
tags question: http://stackoverflow.com/q/23551166
tags question: http://stackoverflow.com/q/23561059
tags question: http://stackoverflow.com/q/23606860
tags question: http://stackoverflow.com/q/23530173
tags question: http://stackoverflow.com/q/23551301
type: Tag
tags question: http://stackoverflow.com/q/23495198
tags question: http://stackoverflow.com/q/23550561
tags question: http://stackoverflow.com/q/23468553
tag name: classpath
tags question: http://stackoverflow.com/q/23571853
tags question: http://stackoverflow.com/q/23541111
tags question: http://stackoverflow.com/q/23469032

http://stackoverflow.com/q/23465472
tagged with: ssl-certificate
has answer: http://stackoverflow.com/a/23466816
favorite count: 0
answer count: 3
tagged with: httpurlconnection
upvote count: 11
has comment: http://stackoverflow.com/comment/35975027
has title: Using browser's certificate in java program
has body: I am trying to make HTTP GET request using HttpURLConnection in java. When I make get using browser it says me certificate is not trusted do you want to proceed. I accept certificate and GET request get data. but i am getting certificate exception in java( given below ) What i understood from this exception is, I need to download that certificate and put this java system property berfore making GET request. My questions are. How will download this certificate from browser? Can I use browser's certificate store in my java program, what do I need to know to use that? If i want to install certificate in my keystore then what do I need to do? THANKS A LOT :) I am trying to download certificate using keytool command. I do not have any idea where certificate is stored in server, but i gave the path of server which i use in browser and browser says certificate is not trusted. URL gatewayServiceUrl = new URL("http://192.168.55.179:56400/nwa"); HttpURLConnection connection = (HttpURLConnection) gatewayServiceUrl.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("Authorization", getExample.getBasicAuth()); connection.connect(); if (HttpURLConnection.HTTP_OK == connection.getResponseCode()) { System.out.println("success"); System.out.println(getExample.getDataFromStream(connection.getInputStream())); } else { System.out.println("success"); System.out.println(getExample.getDataFromStream(connection.getErrorStream())); } System.out.println(connection.getResponseCode()); Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at su…
accepted answer: http://stackoverflow.com/a/23468957
score: 11
tagged with: google-chrome
has answer: http://stackoverflow.com/a/51046684
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35975448
linked to: http://stackoverflow.com/q/3685548
tagged with: java
tagged with: ssl
possible better answer: http://stackoverflow.com/a/51046684
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/23468957

http://stackoverflow.com/a/23750778
answers question: http://stackoverflow.com/q/23610303
type: Answer
score: 0
has body: I realize an answer's already been accepted, but it's unfortunate that it relies on a Jetty-specific solution. I haven't tried anything I'm about to suggest, but the first thing that comes to mind is to make use of Endpoint.setExecutor(Executor). One possibility is to create a ThreadFactory that explicitly sets the uncaught exception handler for every thread it creates. Guava's ThreadFactoryBuilder can help: public class MyHandler implements Thread.UncaughtExceptionHandler { private final Endpoint endpoint; public MyHandler(Endpoint endpoint) { this.endpoint = endpoint; } @Override public void uncaughtException(Thread t, Throwable e) { // ... } } Endpoint endpoint = Endpoint.create(new MyServiceImpl()); Thread.UncaughtExceptionHandler handler = new MyHandler(endpoint); ThreadFactory factory = new ThreadFactoryBuilder().setUncaughtExceptionHandler(handler).build(); Executor executor = Executors.newSingleThreadExecutor(factory); endpoint.setExecutor(executor); endpoint.publish("http://localhost:4425/myService"); Another possibility is to extend ThreadPoolExecutor and override afterExecute(Runnable, Throwable). public class ServiceExecutor extends ThreadPoolExecutor { private final Endpoint endpoint; // ThreadPoolExecutor has four ctors public ServiceExecutor(Endpoint endpoint, ...) { this.endpoint = endpoint; } @Override protected void afterExecute(Runnable r, Throwable t) { super.afterExecute(r, t); if (t != null) { // ... } } } Endpoint endpoint = Endpoint.create(new MyServiceImpl()); Executor executor = new ServiceExecutor(endpoint, ...); endpoint.setExecutor(executor); endpoint.publish("http://localhost:4425/myService");

http://stackoverflow.com/comment/36145176
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23556608
type: Comment
has text: To use v2 your `Fragment` needs to extend `SupportMapFragment` not `Fragment`

http://stackoverflow.com/comment/36052731
comment on: http://stackoverflow.com/q/23491086
score: 0
has text: @Ben I've try to use different ID but nothing data stored to database... my problem is my first checkbox doesn't store the value to database.. this happen just for my first checkbox, the other checkbox is ok..
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36056246
comment on: http://stackoverflow.com/q/23509060
score: 0
has text: You can use AsyncTask to solve this issue..
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23540319
has body: Type casting using (String) Object can only type cast an object of type String. If its not a String object then it will generate an error.. Better Method is to use String.valueOf(object); Here in your case it will surely generate an error if the session.getAttribute("wrongP") returns an instance of object other than String.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23540215
answers question: http://stackoverflow.com/q/23540215
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23571712
type: Question
has comment: http://stackoverflow.com/comment/36173125
score: 0
answer count: 2
has title: Simple modification of XML file using Java
tagged with: http://stackoverflow.com/tag/xml
has body: I have an xml file with the following structure: <jnlp> cisco-upgrade_v1_5.jar 1.5 commons-email_v1_1.jar 1.1 cnt_v1_1.jar 1.1 </jnlp What I am trying to do is modify the version-id for only one of the resources. What would be the best way to go about doing this? Is this possible to do without each resource having an ID?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23572028
has answer: http://stackoverflow.com/a/23571977
tagged with: java

http://stackoverflow.com/q/23484007
accepted answer: http://stackoverflow.com/a/23484136
tagged with: servlets
has title: Pass variable from Javascript to Servlet Method get Return value
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/23484097
linked to: http://stackoverflow.com/q/4112686
has answer: http://stackoverflow.com/a/23484136
tagged with: ajax
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23484097
tagged with: java
duplicate of: http://stackoverflow.com/q/4112686
type: Question
has body: Can i be provided with an example of a scenario whereby i have a Servet as such : @WebServlet(name = "testservlet", urlPatterns = {"/testservlet"}) public class testservlet extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Data d = new Data(); ArrayList infos = d.getData(String ID); } How can i pass the value for getData method in javascript using ajax and receive the reply by sending back the infos object ? I will appreciate an example in javascript. This should be triggered by an on button click. Please your reply should be like a tutorial

http://stackoverflow.com/comment/36100525
has text: then either you have to use switch case or define an enum and then use in switch case.
type: AnswerComment
comment on: http://stackoverflow.com/a/23532634
score: 0
type: Comment

http://stackoverflow.com/a/23572989
answers question: http://stackoverflow.com/q/23572785
type: Answer
score: 0
has body: basically you need to count characters in both sets and compare them void fillInCharCounts(String word,int[] counts) { for (int i = 0; i&lt;word.length(); i++) { char ch = word.charAt(i); int index = ch - 'a'; counts[index]++; } } int[] counts1 = new int[26]; int[] counts2 = new int[26]; fillInCharCounts("test",counts1); fillInCharCounts("bet",counts1); fillInCharCounts("tbtese",counts2); boolean failed = false; for (int i = 0; i&lt;counts1.length; i++) { if (counts1[i] &gt; counts2[i]) { failed = true; } } if (failed) { whatever } else { something else } If you are generalizing it, don't forget to call .toLowerCase() on the word before sending it in (or fix the counting method).

http://stackoverflow.com/q/23562833
type: Question
has title: Android - Thread.sleep removes displayed text
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23563109
accepted answer: http://stackoverflow.com/a/23563109
tagged with: android
tagged with: textview
favorite count: 0
has body: I'm programming an Android app that teaches simple math. When a user enters a correct answer and presses a button, a message is displayed indicating whether they are correct. When an answer is correct, I want the message displayed for a few seconds and then the activity reloads. This code correctly displays the message: if (answer == userAnswer){ resultsDisplay.setText(correctResponses[new Random.nextInt(correctResponses.length)]); } else if (answer != userAnswer){ resultsDisplay.setText(incorrectResponses[new Random().nextInt(incorrectResponses.length)]); } When I add a Thread.sleep, the text of resultsDisplay is either never set or set and removed so quickly that I don't see it happening. loadActivity() is a method I used to abstract the onCreate method, it works in every other case, so it isn't the problem. The thread does sleep before calling loadActivity, I just want the resultsDisplay text to display during that sleep: if (answer == userAnswer){ resultsDisplay.setText(correctResponses[new Random.nextInt(correctResponses.length)]); try { Thread.sleep(5000); loadActivity(operand); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if (answer != userAnswer){ resultsDisplay.setText(incorrectResponses[new Random().nextInt(incorrectResponses.length)]); }
downvote count: 1
linked to: http://stackoverflow.com/q/4483650
type: AnsweredQuestion
tagged with: java
score: -1
tagged with: sleep

http://stackoverflow.com/a/23494518
answers question: http://stackoverflow.com/q/23492116
has body: Your problem is that you cannot compare null with a String. The best is that you surround with try and catch the function call. try { SendPlayer (/*Here the params*/); //Continue, since no null pointer exception has been thrown } catch (NullPointerException) { //Your handling code here... }
score: 0
type: Answer

http://stackoverflow.com/q/23508681
has body: I would like to get something to work, a splitting in two places. System.out.println( Integer.parseInt(text.getText().split("--")[1] .substring((text.getText().split("--")[1]).split("x")[0]))); does not work. If I type --400x55 how do I get it to print "400 , 55". I want it to be changeable, so if the user types some different dimensions, it will use those. So how would I do this?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23508767
has comment: http://stackoverflow.com/comment/36055339
type: Question
has comment: http://stackoverflow.com/comment/36055291
tagged with: input
has answer: http://stackoverflow.com/a/23508774
has answer: http://stackoverflow.com/a/23508762
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23508767
possible better answer: http://stackoverflow.com/a/23508762
has comment: http://stackoverflow.com/comment/36055316
answer count: 4
has title: How do I get to split in two places?
has answer: http://stackoverflow.com/a/23508814

http://stackoverflow.com/q/23519011
linked to: http://stackoverflow.com/q/3194278
tagged with: generics
has answer: http://stackoverflow.com/a/23519260
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23519937
has answer: http://stackoverflow.com/a/23519107
has body: To implement a Queue, why do we use? Queue&lt;Integer&gt; q = new LinkedList&lt;Integer&gt;(); I mean a Superclass reference, why don't we use a LinkedList reference?
has comment: http://stackoverflow.com/comment/36074508
downvote count: 1
type: Question
has title: Using SuperClass as reference instead of SubClass?
has comment: http://stackoverflow.com/comment/36074069
tagged with: java
tagged with: class
score: 0
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/23519107
tagged with: inheritance
favorite count: 0
has comment: http://stackoverflow.com/comment/36073972
accepted answer: http://stackoverflow.com/a/23519937

http://stackoverflow.com/comment/36155020
comment on: http://stackoverflow.com/q/23562344
score: 0
type: QuestionComment
has text: @ClaasWilke As I said, I imported a java project from a git repository, but when I work inside of the imported git repository errors do not report as if I was working in my local version of the project.
type: Comment

http://stackoverflow.com/comment/36047434
has text: also, `Array.set(j,Array.get(j - 1));` does not swap
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23503921

http://stackoverflow.com/q/23498523
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23498621
tagged with: webview
type: Question
has comment: http://stackoverflow.com/comment/95399290
has body: I have an application that uses a webview and inside the webview is a map, I have got it working to the user automatically find the users location with the following code: Manifest file Permissions: &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_GPS" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; WebView Activity: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map_layout); WebViewSettings(); LoadWebPage(urlString); } WebView Settings: @SuppressLint("SetJavaScriptEnabled") public void WebViewSettings(){ webView = (WebView) findViewById(R.id.webview); webView.canGoBack(); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setSupportZoom(true); webView.getSettings().setLoadWithOverviewMode(true); webView.setWebViewClient(new WebViewClientSetup()); webView.setWebChromeClient(new GeoWebChromeClient()); webView.getSettings().setGeolocationEnabled(true); myTimer = new Timer(); //Start this timer when you create you task myTimer.schedule(new loaderTask(), 20000); } WebViewClient: public class WebViewClientSetup extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return false; } @Override public void onLoadResource(WebView view, String url) { // Check to see if there is a progress dialog if (progressDialog == null) { progressDialog = new ProgressDialog(context); progressDialog.setTitle("Loading..."); progressDialog.setMessage("Please wait."); progressDialog.se…
tagged with: webviewclient
has title: Android Ask for permission to use location within webview
upvote count: 1
tagged with: webchromeclient
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23498621
type: AnsweredQuestion

http://stackoverflow.com/q/23539994
has comment: http://stackoverflow.com/comment/36113477
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23540508
type: Question
possible better answer: http://stackoverflow.com/a/23540573
has comment: http://stackoverflow.com/comment/36113711
has answer: http://stackoverflow.com/a/23540508
has comment: http://stackoverflow.com/comment/36113512
has answer: http://stackoverflow.com/a/23540711
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36113533
has title: Automate the new spring initiated beans to be added to the application
has answer: http://stackoverflow.com/a/23540573
has body: I am working on a shopping-cart application I have created one product bean and all the new products are being added through spring context given below &lt;bean id="product1" class="entities.Product"&gt; &lt;property name="name" value="product1" /&gt; &lt;/bean&gt; &lt;bean id="product2" class="entities.Product"&gt; &lt;property name="name" value="product2" /&gt; &lt;/bean&gt; ..... My product team is adding one bean in the spring context every-time they have a new product I am getting the bean using the following code Product product = (Product) context.getBean("product1"); Product product2 = (Product) context.getBean("product2"); but every time they add the product I need to change my code to my display product set How can I automate so that I can know number of product in the XML before hand or have every new product handled automatically I am using this currently which is working fine but I am sure there is better solution to it Set&lt;Product&gt; products = new HashSet&lt;Product&gt;(); int i=1; while(true){ try{ products.add((Product) context.getBean("product"+i)); } catch(NoSuchBeanDefinitionException n){ System.out.println(n); break; } i++; } for(Product p : products) System.out.println(p.getName());
tagged with: spring

http://stackoverflow.com/comment/36179851
has text: A little off topic, but why don't you use a [JList](http://docs.oracle.com/javase/7/docs/api/javax/swing/JList.html) ? I think (really not sure) `JList` with custom cell renderer should to trick
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23574977

javafx
tags question: http://stackoverflow.com/q/23471028
tags question: http://stackoverflow.com/q/23576867
tags question: http://stackoverflow.com/q/23553607
tags question: http://stackoverflow.com/q/23535854
tags question: http://stackoverflow.com/q/23554927
type: Tag
tags question: http://stackoverflow.com/q/23571643
tags question: http://stackoverflow.com/q/23510648
tags question: http://stackoverflow.com/q/23586164
tags question: http://stackoverflow.com/q/23527679
tags question: http://stackoverflow.com/q/23523227
tags question: http://stackoverflow.com/q/23492194
tags question: http://stackoverflow.com/q/23515172
tags question: http://stackoverflow.com/q/23592005
tags question: http://stackoverflow.com/q/23506874
tags question: http://stackoverflow.com/q/23456089
tags question: http://stackoverflow.com/q/23525416
tag name: javafx
tags question: http://stackoverflow.com/q/23567418
tags question: http://stackoverflow.com/q/23489098
tags question: http://stackoverflow.com/q/23571245
tags question: http://stackoverflow.com/q/23593164
tags question: http://stackoverflow.com/q/23476415
tags question: http://stackoverflow.com/q/23578765
tags question: http://stackoverflow.com/q/23475026
tags question: http://stackoverflow.com/q/23573614
tags question: http://stackoverflow.com/q/23471185
tags question: http://stackoverflow.com/q/23467100
tags question: http://stackoverflow.com/q/23587279
tags question: http://stackoverflow.com/q/23563046
tags question: http://stackoverflow.com/q/23605840
tags question: http://stackoverflow.com/q/23557861
tags question: http://stackoverflow.com/q/23476586
tags question: http://stackoverflow.com/q/23606933
tags question: http://stackoverflow.com/q/23488280
tags question: http://stackoverflow.com/q/23467797
tags question: http://stackoverflow.com/q/23491944
tags question: http://stackoverflow.com/q/23590833
tags question: http://stackoverflow.com/q/23522130
tags question: http://stackoverflow.com/q/23533083
tags question: http://stackoverflow.com/q/23528331

http://stackoverflow.com/q/23573625
tagged with: criteria
tagged with: java
tagged with: hibernate
has body: My problem is: I have a class that contains a specific list of objects and I need to return all the class objects whose list contains a specific sublist that I passed as param. For example: class A{ List&lt;Object&gt; b; } Criteria criteria = getSession().createCriteria(A.class, "a"); criteria.createAlias("a.b", "b"); criteria.add(Restrictions.in("b.name", new String[]{"name 1","name 2"})) return criteria.list(); But, this returns the same object of class A twice. Thanks.
has answer: http://stackoverflow.com/a/23574101
answer count: 1
score: 0
has title: Make a hibernate criteria that return all objects with same objects on sublist
type: UnansweredQuestion
tagged with: hibernate-criteria
type: Question

http://stackoverflow.com/comment/36083011
score: 0
type: Comment
type: QuestionComment
has text: by `something`, do you mean **R**?
comment on: http://stackoverflow.com/q/23523450

http://stackoverflow.com/comment/36227741
type: AnswerComment
comment on: http://stackoverflow.com/a/23567236
type: Comment
has text: I am using spring-security version 3.0.5. I added @ExceptionHandler(AccessDeniedException.class) to my controller. Still getting the same login page.
score: 0

http://stackoverflow.com/q/23511513
has comment: http://stackoverflow.com/comment/36110245
has comment: http://stackoverflow.com/comment/36082977
has comment: http://stackoverflow.com/comment/36101477
linked to: http://stackoverflow.com/q/20184041
has comment: http://stackoverflow.com/comment/36060973
score: 0
tagged with: file-io
has title: Open remote excel file in java
has body: I have tried snippet given in the below thread,it works perfectly on the local system where I have developed. It is an web application ,on click of the button, excel file is generated and at the same time opened. I am able to open excel sheet when I access the web application link from local system but when I access the application from remote system then It generates the file on my local system but doesn't open the excel file on that remote system. Java Apache POI Opening file? Do I need to share the drive? Edit : Used below snippet to directly open the excel Process p = Runtime.getRuntime() .exec("rundll32 url.dll,FileProtocolHandler " + "D:\\new.xls");
has comment: http://stackoverflow.com/comment/36062398
type: UnansweredQuestion
tagged with: excel
tagged with: apache-poi
answer count: 0
has comment: http://stackoverflow.com/comment/36069411
tagged with: java
type: Question

http://stackoverflow.com/comment/36073106
type: AnswerComment
comment on: http://stackoverflow.com/a/23517709
has text: Also you brick state should be handled in the brick class. Have methods in the class like `setX()` `setWidth()`. As far as why your code doesn't work, I don't even really want to check it, it hurts my eyes :-)
score: 0
type: Comment

http://stackoverflow.com/q/23558868
accepted answer: http://stackoverflow.com/a/23558943
type: AnsweredQuestion
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23558943
tagged with: java
has title: javax.servlet.ServletException: java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.MethodVisitor, but class was expected
has comment: http://stackoverflow.com/comment/36149046
tagged with: jsp
has body: I am struggling with this error , when i am publishing my JSP application in Tomcat7.0 i am getting this error javax.servlet.ServletException: java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.MethodVisitor, but class was expected I don't know the exact reason for this error.
tagged with: servlets

file-io
tags question: http://stackoverflow.com/q/23503234
tags question: http://stackoverflow.com/q/23564041
type: Tag
tags question: http://stackoverflow.com/q/23586106
tags question: http://stackoverflow.com/q/23516285
tags question: http://stackoverflow.com/q/23531893
tags question: http://stackoverflow.com/q/23531740
tags question: http://stackoverflow.com/q/23559007
tags question: http://stackoverflow.com/q/23478611
tags question: http://stackoverflow.com/q/23467913
tags question: http://stackoverflow.com/q/23534040
tags question: http://stackoverflow.com/q/23581381
tags question: http://stackoverflow.com/q/23466179
tags question: http://stackoverflow.com/q/23534142
tags question: http://stackoverflow.com/q/23561456
tags question: http://stackoverflow.com/q/23509364
tags question: http://stackoverflow.com/q/23514016
tags question: http://stackoverflow.com/q/23498018
tags question: http://stackoverflow.com/q/23559941
tags question: http://stackoverflow.com/q/23511513
tags question: http://stackoverflow.com/q/23513731
tags question: http://stackoverflow.com/q/23517069
tags question: http://stackoverflow.com/q/23464784
tag name: file-io
tags question: http://stackoverflow.com/q/23550881
tags question: http://stackoverflow.com/q/23483072

http://stackoverflow.com/q/23458864
tagged with: message-passing
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/35962323
tagged with: java
has title: Message Passing in Java with Channels, send, receive
type: Question
has body: I am using the JMP library (http://ants.inf.um.es/staff/jlaguna/jmp/javadoc/), and I want to know how can I create 2 threads that print a Char and wait for the other prints his (by sending him a msg). The result should be something like this: Main(){ ThreadB(); ThreadC(); } Output: B C B C ... And this is what I have done: import messagepassing.Channel; public class Main3 { static Channel canalBC = new Channel(); static Channel canalCB = new Channel(); public static void procesoB(final Channel canalBC, final Channel canalCB){ Thread thCliente = new Thread(new Runnable () { @Override public void run (){ for(int i=0;i&lt;=5;i++){ canalCB.receive(); System.out.println("B"); canalBC.send(1); } } } , "A"); thCliente.start(); } public static void procesoC(final Channel canalBC, final Channel canalCB){ Thread thCliente = new Thread(new Runnable () { @Override public void run (){ for(int i=0;i&lt;=5;i++){ canalBC.receive(); System.out.println("C"); canalCB.send(1); } } } , "A"); thCliente.start(); } public static void main(String[] args) { canalCB.send(1);// Printing the first B procesoB(canalBC,canalCB); procesoC(canalBC,canalCB); } } But it doesn't work.
tagged with: channel
answer count: 1
has answer: http://stackoverflow.com/a/23476199

http://stackoverflow.com/comment/35998668
has text: This isn't really an answer but I would think very carefully about implementing your own bulk email sender. It's a much harder problem than it sounds at first. Some of the large bulk mail sending companies have published guides to illustrate the complexity.
score: 0
comment on: http://stackoverflow.com/q/23475667
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23514190
type: Question
possible better answer: http://stackoverflow.com/a/23514285
has answer: http://stackoverflow.com/a/23514261
answer count: 2
upvote count: 7
has title: How to get a nested field
favorite count: 0
has body: I'm new of reflection and I'm trying to get a nested field. Summarizing I have the following classes: public class Agreement{ private Long id; private String cdAgreement; private Address address; //Constructor getter and setter } public class Address{ private Long id; private String description; //Constructor getter and setter } Now I want to get the description field, then i wrote this code: Agreement agreement = new Agreement(); Class c = agreement.getClass(); Field f = c.getDeclaredField("address.descritpion"); but not works, I get the following exception: java.lang.NoSuchFieldException: address.descritpion at java.lang.Class.getDeclaredField(Class.java:1948) Where am I doing wrong?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23514261
downvote count: 0
tagged with: reflection
has answer: http://stackoverflow.com/a/23514285
score: 7
tagged with: java

http://stackoverflow.com/comment/36217048
type: QuestionComment
has text: Yes, call `Collections.sort` providing a custom comparator and compare the second value of the arrays.
comment on: http://stackoverflow.com/q/23595305
type: Comment
score: 0

http://stackoverflow.com/q/23546178
linked to: http://stackoverflow.com/q/9338896
has answer: http://stackoverflow.com/a/23546360
type: UnansweredQuestion
tagged with: multithreading
score: 2
has answer: http://stackoverflow.com/a/23546271
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/36125388
answer count: 6
tagged with: sorting
has body: I am writing a program that reads words from a file and sorts them in alphabetical order. You provide the input and output files in the command line, and the program reads the words from the input file and writes a sorted list back to the output file. This is done, and it works as it should do. No questions here. I am not looking for specific code, but rather help on how to approach a problem. The next part of the assignment states that in the command line, you are to be able to set the number of Threads you want the program to use in the sorting process. For instance, if you compile with the following: java Sort 12 infile.txt outfile.txt The above program is meant to use 12 Threads to sort the words from "infile.txt". Each Thread is to sort a number of N = (numberOfWords)/(numberOfThreads) words. All the words are read into memory, before the Threads are started. I'm aware that this might sound cryptic, but I have been googling around looking for a good explanation on "multithreading"/defining the number of Threads in a Java program, yet I am not any wiser. If anyone knows how to explain how you can set the number of Threads in Java, even with a small example, I would be very grateful! Thanks!
favorite count: 0
has answer: http://stackoverflow.com/a/23546734
has answer: http://stackoverflow.com/a/23546308
has answer: http://stackoverflow.com/a/23547160
has title: Defining Multiple Threads in Java
has comment: http://stackoverflow.com/comment/36125226
has answer: http://stackoverflow.com/a/23546763

http://stackoverflow.com/comment/36002831
type: Comment
comment on: http://stackoverflow.com/a/23479966
has text: Ahh, thank you for the links :) So just a last query; This "MyHandlerClass" in the code, does it refer to a class I have to surround the runnable in, or something else? I only ask because using the official android site to explain anything to myself is like learning Spanish by reading newspaper articles - I have no idea what any of it means :')
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36007322
has text: I can't find any libraries on this. I thing ImageIO or BufferedImage should support this?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23482626

jax-rs
tags question: http://stackoverflow.com/q/23494308
tags question: http://stackoverflow.com/q/23549467
tags question: http://stackoverflow.com/q/23608733
tags question: http://stackoverflow.com/q/23489066
tags question: http://stackoverflow.com/q/23582222
tags question: http://stackoverflow.com/q/23567570
tags question: http://stackoverflow.com/q/23589589
tags question: http://stackoverflow.com/q/23474199
tags question: http://stackoverflow.com/q/23501682
tags question: http://stackoverflow.com/q/23457290
tags question: http://stackoverflow.com/q/23521647
type: Tag
tags question: http://stackoverflow.com/q/23558337
tags question: http://stackoverflow.com/q/23540075
tags question: http://stackoverflow.com/q/23468429
tags question: http://stackoverflow.com/q/23541854
tags question: http://stackoverflow.com/q/23537267
tags question: http://stackoverflow.com/q/23548717
tag name: jax-rs
tags question: http://stackoverflow.com/q/23598180

http://stackoverflow.com/tag/csv
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/23471634
tags question: http://stackoverflow.com/q/23486005
tags question: http://stackoverflow.com/q/23584677
tags question: http://stackoverflow.com/q/23567059
tags question: http://stackoverflow.com/q/23454606
tags question: http://stackoverflow.com/q/23584373

http://stackoverflow.com/q/23545942
score: 2
has answer: http://stackoverflow.com/a/23546145
has body: Basically I am trying to send a broadcast message every second with one thread, and wait for an answer with another thread. The thing is I can't seem to get my code right, so I did a small example which would do the same thing, running two threads, one stopping when the other modified a certain variable. Here it is: public class test { public static void main(String[] args){ test2 t = new test2(); } } public class test2 { private volatile Opponent b = new Opponent(); public test2(){ new Thread(new Runnable(){ public void run(){ synchronized(this){ while(!b.a){ for(int i = 0; i &lt; 100; i ++){ System.out.println(i); try{ this.wait(1000); }catch(InterruptedException ie){ } } } } } }).start(); new Thread(new Runnable(){ public void run(){ synchronized(this){ for(int i = 0; i &lt; 100; i ++){ System.out.println(i*100); if(i*100 == 200){ b.a = true; System.out.println("true"); } try{ this.wait(1000); }catch(InterruptedException ie){ } } } } }).start(); } } public class Opponent { static boolean a = false; public Opponent(){ } } My problem is that if I do synchronized(this), the threads run, but the b.a is never updated, and the loop goes on forever. If I do synchronized(b), I get an IllegalMonitorException. What am I doing wrong? Thanks
tagged with: java
type: Question
has title: Broadcast and answer with two threads and one shared variable
tagged with: shared
answer count: 1
downvote count: 0
tagged with: variables
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/a/23515656
answers question: http://stackoverflow.com/q/23454635
has comment: http://stackoverflow.com/comment/68680565
accepted answer of: http://stackoverflow.com/q/23454635
downvote count: 2
score: -2
upvote count: 0
type: AcceptedAnswer
has body: I've managed to solve my problem by using instead of tags so I'll consider this question resolved. Thanks for the help.
type: Answer

http://stackoverflow.com/q/23519728
tagged with: jtable
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/11527477
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23519957
linked to: http://stackoverflow.com/q/10346219
tagged with: dynamic
tagged with: swing
type: Question
tagged with: java
has title: Dynamically load Image in jTable based on database value
has body: I am trying to load image in a jTable based on database value. String query = "SELECT ID, CATEGORY FROM TATTOO_LIB ORDER BY ID DESC"; try { conn = new data.connection().db(); stmtt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = stmtt.executeQuery(query); while (rs.next()) { //I donot know how to write these lines here... File f = new File("C:/img/" + rs.getString(1) + ".jpg"); ImageIcon icon = new ImageIcon(f); model.addRow(new Object[]{icon, rs.getString(1), rs.getString(2)}); } } catch(SQLException e ) { JOptionPane.showMessageDialog(null, "Error In Connection!!"); } finally { try { stmtt.close(); rs.close(); conn.close(); } catch (SQLException e) { } } How can I load an Image in the first column based on the database value. I tried to follow this and this. But I am lost somewhere. Please help.

http://stackoverflow.com/q/23522010
accepted answer: http://stackoverflow.com/a/23522187
tagged with: java
has answer: http://stackoverflow.com/a/23522324
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23522324
has comment: http://stackoverflow.com/comment/36080345
has comment: http://stackoverflow.com/comment/36079934
tagged with: javascript
has title: Can't find a way to use jQuery in my JSP, help me please
score: 0
has answer: http://stackoverflow.com/a/23522187
has answer: http://stackoverflow.com/a/23522404
tagged with: jsp
has comment: http://stackoverflow.com/comment/36079910
has comment: http://stackoverflow.com/comment/36080529
tagged with: jquery
has comment: http://stackoverflow.com/comment/36080191
answer count: 5
has answer: http://stackoverflow.com/a/23522180
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/23522328
has body: I'm actually working on a website using JSP and Servlet. I'm not a pro so I try to do my best and I wanted to implement a calendar that would show up on one of my webpages. I checked the web and found this : http://arshaw.com/fullcalendar/ It seemed promising so even though I'm a noob in JS I downloaded the package and tried to use it. But that didn't work. I've tried a lot of things and I'm going to die if I can't find a solution to this. The problem comes from jQuery, which doesn't work. At all. Here's my code : <%@page contentType="text/html" pageEncoding="UTF-8"%> Planning <%@ include file="../menu.html"%> The fact is : nothing works. I mean, HTML does. The webpage loads and show the first image and the menu.html, but the script doesn't do anything. Isn't it supposed to show me a message ? You can see that I used the full path for the jQuery file, because I really was desperated. I'm working on two computers, this one who has Internet access, and an other one, on which I program, who doesn't have Internet access, so I can't use web url. EDIT: Current project structure (current jsp in folder "pages": https://i.sstatic.net/9bVBb.png

http://stackoverflow.com/a/23521871
has comment: http://stackoverflow.com/comment/36479045
has body: Is this approach okay for ensuring no urls other than my specific urls could bind using javascriptInterface bridge? No. You are using contains() and not equals(), so an attacker can trivially craft a URL that happens to have those substrings. Also, there may be timing issues, as you are determining the availability of the JS interface before that page is loaded, which means you are immediately affecting the currently-loaded page. There would still be other possible attacks (e.g., proxy servers, evil JS served by those pages through ad networks or other third-party sources) that URL detection would not catch, though addressing those would be difficult at best.
has comment: http://stackoverflow.com/comment/36486777
has comment: http://stackoverflow.com/comment/36572623
has comment: http://stackoverflow.com/comment/36166728
upvote count: 1
has comment: http://stackoverflow.com/comment/36478665
has comment: http://stackoverflow.com/comment/36103337
has comment: http://stackoverflow.com/comment/36500226
has comment: http://stackoverflow.com/comment/36279186
has comment: http://stackoverflow.com/comment/36291647
has comment: http://stackoverflow.com/comment/36573584
score: 1
has comment: http://stackoverflow.com/comment/36560632
has comment: http://stackoverflow.com/comment/36414687
answers question: http://stackoverflow.com/q/23521555
has comment: http://stackoverflow.com/comment/36414775
has comment: http://stackoverflow.com/comment/36279624
has comment: http://stackoverflow.com/comment/36482597
downvote count: 0
has comment: http://stackoverflow.com/comment/36290723
has comment: http://stackoverflow.com/comment/36414022
has comment: http://stackoverflow.com/comment/36113276
has comment: http://stackoverflow.com/comment/36103092
type: Answer
has comment: http://stackoverflow.com/comment/36571004

http://stackoverflow.com/comment/36103072
type: QuestionComment
has text: @OlegEstekhin So vote to close the question.
comment on: http://stackoverflow.com/q/23533746
score: 0
type: Comment

http://stackoverflow.com/a/23544140
answers question: http://stackoverflow.com/q/23544055
has comment: http://stackoverflow.com/comment/36128645
has comment: http://stackoverflow.com/comment/39033774
type: Answer
has body: Yes it is possible. If your season is a string then you would use: UPDATE table_name SET wins = 5, losses = 3 WHERE Team_Name = 'Something' AND Season = '1' However, if your season is a number then you would use: UPDATE table_name SET wins = 5, losses = 3 WHERE Team_Name = 'Something' AND Season = 1
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36128753
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23544055
type: AcceptedAnswer

http://stackoverflow.com/comment/36119971
score: 0
type: AnswerComment
has text: I just finished rewriting the whole post in order to clarify things. thanks again !!!
type: Comment
comment on: http://stackoverflow.com/a/23539343

http://stackoverflow.com/comment/36119701
type: QuestionComment
type: Comment
has text: Have you tried [protobuf](https://code.google.com/p/protobuf/) to define your messages?
comment on: http://stackoverflow.com/q/23543247
score: 0

http://stackoverflow.com/comment/36171778
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23570936
has text: I put up what I have thus far as far as determining how long my new array should be.
type: Comment

http://stackoverflow.com/q/23518790
has title: To Show restricted links on Homepage based on the username we get from siteminder
tagged with: jsp
tagged with: siteminder
has comment: http://stackoverflow.com/comment/36101828
has comment: http://stackoverflow.com/comment/37344562
has body: We have siteminder authentication and I am able to fetch the screenname(username) from the siteminder. Now I have to create groups based on the screennames. The groups will be Admin and Others. If the screenname is under admin group , it will be able to access each and everything else if the screenname is under other group, a different homepage should appear containing only the links which other group can access. How do I achieve this? I have tried to use Realm, user,group roles method but it is prompting for username and password. Also I dont want to use any username and password because I want to filter on the basis of screennames. PS: I dont have knowledge of spring framework and other framework. I know only JSP and Servlets. Regards, Ethan
tagged with: security-constraint
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: servlets
has comment: http://stackoverflow.com/comment/36094271
score: 0

http://stackoverflow.com/q/23505287
tagged with: android
has answer: http://stackoverflow.com/a/23506116
type: AnsweredQuestion
tagged with: libgdx
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23506116
has body: Hi I'm currently trying to make a picross game with libdgx and I'm having trouble drawing images to the screen from within a class. Just wondering what parameters I have to pass a draw/render function within the class, the code I have so far is below. I'm fairly new to programming with libdgx so any help would be greatly appreciated. Thanks package PicrossGameObjects; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class Tile { Texture BlankTile; Texture RedTile; int xCoord; int yCoord; public Tile(int x, int y){ BlankTile = new Texture("BlankTile.png"); RedTile = new Texture("RedTile.png"); xCoord = x; yCoord = y; } public void Render(SpriteBatch batch){ } }
answer count: 1
has comment: http://stackoverflow.com/comment/36050098
has title: Drawing from a class libgdx
score: 0

http://stackoverflow.com/q/23454264
score: 0
has answer: http://stackoverflow.com/a/23454284
answer count: 1
has body: I want my app to call an other app and then close him self I call a new app by : Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new ComponentName("com.aaa.bbb", "com.aaa.bbb.MainActivity")); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); and the new app is running fine but I want now the app that called the intent to close and what ever I do I still see it in the running apps (as an Icon in the list) how can I close it? I tryed: android.os.Process.killProcess(mid); System.exit(0); finish(); Thank you!!!
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
type: Question
has title: call an app and close the current running app
tagged with: java

http://stackoverflow.com/a/23557757
has comment: http://stackoverflow.com/comment/36161310
has body: You can implement a custom MessageBodyWriter and serialize your POJOs on your own. @Provider @Produces(MediaType.APPLICATION_JSON) public class JsonVulnerabilityWriter implements MessageBodyWriter&lt;Object&gt; { @Override public boolean isWriteable(Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mediaType) { return true; } @Override public long getSize(Object t, Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mediaType) { return -1; } @Override public void writeTo(Object obj, Class&lt;?&gt; type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap&lt;String, Object&gt; httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException { entityStream.write(")]}',\n".getBytes("UTF-8")); entityStream.write(new ObjectMapper().writeValueAsBytes(obj)); } }
score: 4
has comment: http://stackoverflow.com/comment/36173859
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23549467
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/23549467
downvote count: 0

http://stackoverflow.com/comment/36096752
has text: But there is not a method to specify to use the HDFS or the local system for output? It is just based on the `conf/core-site.xml` and cannot be achieved in the code?
type: Comment
comment on: http://stackoverflow.com/a/23508553
type: AnswerComment
score: 0

http://stackoverflow.com/a/23453493
has body: A stack works like a tray of dirty dishes, the first one you put on the stack will be the last one out of the stack. The last one on the stack will be the first one popped off the stack (Last in first out). The queue works in the same way a line at the supermarket works. The first one in a queue will be the first one out of the queue(First in first out).
accepted answer of: http://stackoverflow.com/q/23453475
answers question: http://stackoverflow.com/q/23453475
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/36065468
type: Comment
comment on: http://stackoverflow.com/a/23513418
has text: Martin, could you please give me a link to AuthenticationVoters documentation/ reference? failed to find anything useful by myself
score: 0
type: AnswerComment

http://stackoverflow.com/a/23586190
has body: Introspection via reflection. All parameters are strings. The parameter name is used to figure out what type the action property is. There is a set of default convertors that go from String to several default types. You can also register custom type convertors to cover more action property types.
type: Answer
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23571250
score: 1

http://stackoverflow.com/comment/125789548
comment on: http://stackoverflow.com/q/23489718
score: 0
type: Comment
type: QuestionComment
has text: @AndrewSpencer thanks for noticing this correctly. Came across to this issue after 7 years. I am still confused. Does compareTo method internally works like overridden equals method?

http://stackoverflow.com/comment/71720178
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23580906
has text: Your solution is missing a annotation to work. @@EnableWebMvc @@ControllerAdvice public class GlobalExceptionHandler {}
type: AnswerComment

http://stackoverflow.com/comment/36122203
type: QuestionComment
has text: Unrelated note: if you don't need the thread-safty of StringBuffer, use StringBuilder.
comment on: http://stackoverflow.com/q/23544484
score: 0
type: Comment

http://stackoverflow.com/comment/36128661
type: Comment
comment on: http://stackoverflow.com/a/23547974
score: 0
type: AnswerComment
has text: The exception tells different story: the mapper seems to be returning a map that contains a `LinkedHashMap` instead of the expected `Student`.

http://stackoverflow.com/a/23607656
type: Answer
accepted answer of: http://stackoverflow.com/q/23607583
answers question: http://stackoverflow.com/q/23607583
upvote count: 18
has body: The correct RegEx for selecting all numbers would be just [0-9], you can skip the +, since you use replaceAll. However, your usage of replaceAll is wrong, it's defined as follows: replaceAll(String regex, String replacement). The correct code in your example would be: replaceAll(&quot;[0-9]&quot;, &quot;&quot;).
type: AcceptedAnswer
downvote count: 0
score: 18

jna
tags question: http://stackoverflow.com/q/23611596
tags question: http://stackoverflow.com/q/23584908
type: Tag
tags question: http://stackoverflow.com/q/23510014
tag name: jna

http://stackoverflow.com/q/23483192
has title: Unable to Create and Save Customer Object in Android
type: Question
score: 0
has answer: http://stackoverflow.com/a/23522275
answer count: 1
has body: I am spinning my wheels trying to create and Save a Customer Object to SQLite in Android, Here is my Customer Class public class Customer { private int id; private String Name; private String EmailAddress; private String Phone; private Double InitialValue; private Double BalanceOnCard = 0.00; private String CardUID; private Date EnrollmentDate = new Date(); private Date LastTransactionDate = new Date(); public Customer(){} In my Activity I create private variables like so public class EnrollmentActivity extends MenuOnlyActivity { private CustomerSQLiteHelper db; private final String TAG = "Customer_Add"; Button submitButton; Button cancelButton; private EditText customerNameEditText; private EditText customerEmailEditText; private EditText customerPhoneEditText; private EditText valueToAddEditText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_enrollment); submitButton = (Button) findViewById(R.id.buttonEnrollment); cancelButton = (Button) findViewById(R.id.CancelEnrollment); customerNameEditText = (EditText) findViewById(R.id.editTextCustomerName); customerEmailEditText = (EditText) findViewById(R.id.editTextCustomerEmailAddress); customerPhoneEditText = (EditText) findViewById(R.id.editTextBusinessPhoneNumber); valueToAddEditText = (EditText) findViewById(R.id.editTextValueToAdd); And here is the SubmitButton listener and it is within this code block that it fails, Its not getting to the point of calling the DatabaseHelper to save the Customer object, it fails somewhere right after creating a blank Customer object and starting to set the instance variables. Log.i(TAG, "Entering Submit Button event"); submitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (customerNameEditText.getText().length() == 0) { Toast.makeText(EnrollmentActivity.this, "Enter Customer's name", Toast.LENGTH_SHORT).show(); customerNameEditText.requestFocus()…
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36014915
tagged with: android-sqlite
tagged with: java

http://stackoverflow.com/q/23604612
has comment: http://stackoverflow.com/comment/36251309
type: Question
has title: grab the web html source file with java
downvote count: 0
tagged with: url
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
tagged with: web
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/36234625
has body: I'm trying to use java to open a URL and get the html source and do some analyses. I expect it to work like a browser, with which you can load the page and right-click to look at the html source. I had the following code, which is a pretty standard way I think. public class getWeb { /** * @param args */ private static final String url = "http://www.appannie.com/apps/ios/top/united-states/games/action/?device=iphone&amp;date=2014-05-08"; private static final String url_alt = "http://www.mkyong.com"; public static void main(String[] args) { try{ URL appannie = new URL(url_alt); URLConnection page = appannie.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader( page.getInputStream(), "UTF-8")); String inputLine; StringBuilder a = new StringBuilder(); while ((inputLine = in.readLine()) != null) a.append(inputLine); in.close(); System.out.println(a.toString()); } catch (IOException e){ e.printStackTrace(); } } } The problem is that url does not work, it just returns me a status code of 503, which means it's not available. But I can definitely open that page in a browser and see the html code, and I can also get the html if I use url_alt instead. I'm not very familiar with the web server, I don't why I cannot just get the html source of all kinds of URLs, like using a browser. I also tried some other apis such as jsoup and apache's httpclient, but the problem is the same. Thanks in advance.
has comment: http://stackoverflow.com/comment/36234547
score: 1
tagged with: java

http://stackoverflow.com/comment/36077623
comment on: http://stackoverflow.com/q/23520825
has text: Read up on frequency analysis. The most common letter in English text is `e`, so the most common letter in Caesar-ciphered English text will most likely be `'e'+n`, where `n` is the key.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23508407
has title: Mongodb search by nested field in java
score: 0
tagged with: mongodb
answer count: 1
tagged with: morphia
has body: Lets Say I have table named Person as follows: class Person{ ObjectId id; String name; @Reference Address adr; } class Address{ Position pos; } class Position{ double longitude; double latitude; } how can I return all the persons in a sphere? the query for a sphere is: DBObject queryOnVenue = QueryBuilder.start("pos").withinCenterSphere(longitude, latitude, radiusInMeters / HandlersConfiguration.EARTH_RADIUS).get();
tagged with: java
has answer: http://stackoverflow.com/a/23519925
accepted answer: http://stackoverflow.com/a/23519925
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/23455095
has answer: http://stackoverflow.com/a/23455903
accepted answer: http://stackoverflow.com/a/23455903
score: 0
type: AnsweredQuestion
has body: I notice that Highgui.imread("h:/opencv.jpg") will automatically create the Mat instance with the correct type through auto-detection regardless of the file extensions. Now what i have is a byte array uploaded from network. Is it possible to create the correct Mat object without having to manually construct it with the row, col and type ? I think this should be doable since imread can read the file bytes and detect the type, why not with the file bytes that i can pass ?
type: Question
tagged with: opencv
tagged with: java
answer count: 1
has title: How to create Mat from file bytes

http://stackoverflow.com/a/46714330
type: Answer
has body: For me this actually means I had somehow mixed things and was using $ mvn dependency:list | grep jersey [INFO] com.sun.jersey:jersey-client:jar:1.11:compile [INFO] com.sun.jersey:jersey-core:jar:1.0.2:compile (conflict within jersey 1.x)
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23521647
downvote count: 0

http://stackoverflow.com/comment/35975290
type: QuestionComment
comment on: http://stackoverflow.com/q/23465613
score: 1
has text: @EJP, okay, I'll grant that it may be too strong. However, manual serialization is very error-prone and very easy to break backwards compatibility. In places where it is required, I would still recommend using protocol buffers to generate and parse the binary format that you actually serialize instead of using Java's automatic serialization.
type: Comment

http://stackoverflow.com/q/23596447
tagged with: gwt
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/23973421
accepted answer: http://stackoverflow.com/a/23973421
has title: GWT Module is unloading randomly
type: Question
has comment: http://stackoverflow.com/comment/36221598
has comment: http://stackoverflow.com/comment/36219322
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36233268
favorite count: 0
has comment: http://stackoverflow.com/comment/36234856
has body: I have a GWT project I have been working on for several months. I am using the GWT Development Mode with Chrome 34.0.1847.131 m and Eclipse EE Indigo with GWT 2.5.0. All of the sudden is started failing to load sometimes with no errors. After some investigation, I found the only difference is this second line: [INFO] [mypackage.MyClass] - Module mypackage.MyClass has been loaded [INFO] [mypackage.MyClass] - Unloading module mypackage.MyClass (mypackage.MyClass) There is about 150ms between the load and unload. This started failing randomly yesterday. Prior to that it always ran fine. It's strange, I will clear my cache and restart the browser and it works fine for a while, then it just stops working again. How do I get GWT to output the real problem? I put -logLevel=DEBUG but that did not add any more logs to it.
has comment: http://stackoverflow.com/comment/36232181
upvote count: 3

http://stackoverflow.com/q/23606549
score: 0
answer count: 1
has body: Expanding upon this question, if using a properties file in the dependency is the original question possible?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23607044
tagged with: maven
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/6681635
has title: Maven - access properties file from dependency

http://stackoverflow.com/comment/36083022
score: 0
type: QuestionComment
has text: Ubuntu is running on a rented root server (dedicated server)
type: Comment
comment on: http://stackoverflow.com/q/23523407

http://stackoverflow.com/comment/36091211
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23527711
has text: Since you want to modify the behavior of a class (implement `flush()`) you need to extend it. You can start by creating your own class that extends some type of `OutputStream` and you should be able to override and implement `flush()` then.

http://stackoverflow.com/comment/36244801
type: Comment
has text: @Dzior: Yes, exactly.
comment on: http://stackoverflow.com/a/23610187
type: AnswerComment
score: 0

http://stackoverflow.com/q/23532990
favorite count: 0
has comment: http://stackoverflow.com/comment/36101230
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36102148
score: -3
has comment: http://stackoverflow.com/comment/36101191
has body: I have to sort an arrayList containing the frequency of the purchases of customers. So I can display the output whether in an ascending or descending order. However, I am not quite sure what I am missing but it is not sorting the elements at all. I'd really appreciate any comments or feedback! This is what I have so far: for(int i=0; i&lt;customers.size(); i++) { for(int k= i+1; k &lt;customers.size(); k++) { if((customers.get(k)).compareTo(customers.get(i)) &lt; 0) { Customer temp = customers.get(i); customers.set(i, customers.get(k)); customers.set(k,temp); } } System.out.println(customers.get(i)); }
has comment: http://stackoverflow.com/comment/36101256
tagged with: java
has comment: http://stackoverflow.com/comment/36101683
downvote count: 3
has comment: http://stackoverflow.com/comment/36101875
has answer: http://stackoverflow.com/a/23533141
has comment: http://stackoverflow.com/comment/36101317
has comment: http://stackoverflow.com/comment/36112809
type: Question
upvote count: 0
has title: Java - Sorting ArrayList - Bubble Sort
has comment: http://stackoverflow.com/comment/36101437
has comment: http://stackoverflow.com/comment/36101406
tagged with: bubble-sort
tagged with: sorting
has comment: http://stackoverflow.com/comment/36102036
has answer: http://stackoverflow.com/a/23533194
has answer: http://stackoverflow.com/a/23533269
has answer: http://stackoverflow.com/a/56616688
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36101545
has comment: http://stackoverflow.com/comment/36101588
has comment: http://stackoverflow.com/comment/36101188
has comment: http://stackoverflow.com/comment/36101224
answer count: 4

http://stackoverflow.com/comment/35981789
comment on: http://stackoverflow.com/q/23469059
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Java string to date conversion](http://stackoverflow.com/questions/4216745/java-string-to-date-conversion)

http://stackoverflow.com/comment/36017040
type: Comment
comment on: http://stackoverflow.com/a/23488153
has text: This doesn't exit the loop.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35998496
type: Comment
has text: and the stacktrace? You forcefully hide a usefull stacktrace in your log statements... Have fun debugging :-)
comment on: http://stackoverflow.com/q/23478390
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36117079
comment on: http://stackoverflow.com/a/23541858
has text: OP should really indicate how often these relative types of queries are executed. Traversal of hierarchies sure is ideally suited to neo4j, but search by location name is in the sweet spot of SOLR and even RDBMS. Also, if OP's hierarchy is just 3 deep (max) then maybe RDBMS isn't so bad there. If OP's hierarchy were huge, then the difference with neo4j would dominate. But it's not clear that neo4j is best here; if 80% of workload is search by name, and hierarchy is never more than 3 deep, RDBMS or SOLR is likely better *overall*.
type: Comment
score: 2
type: AnswerComment

http://stackoverflow.com/a/23573930
answers question: http://stackoverflow.com/q/23573915
downvote count: 0
type: Answer
has body: Use a temporary variable: double tmp = balance; balance = 0; return tmp;
upvote count: 5
score: 5

dbtable
tags question: http://stackoverflow.com/q/23469079
type: Tag
tag name: dbtable

http://stackoverflow.com/comment/36053199
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23497402
has text: Validator.isNotNull(searchTerm) return true, it means try catch block was performed, just object didn't send to jsp file.

http://stackoverflow.com/a/23593297
has comment: http://stackoverflow.com/comment/36213032
has comment: http://stackoverflow.com/comment/36213141
answers question: http://stackoverflow.com/q/23593241
accepted answer of: http://stackoverflow.com/q/23593241
has comment: http://stackoverflow.com/comment/36212985
has body: You never set invoiceAmount anywhere. public double getInvoiceAmount () { amount = quantity*price; return amount; } So just call setInvoiceAmount with the result you got from getInvoiceAmount(). public void setInvoiceAmount (double i) { invoiceamount = i; } So in your invoiceTest class, add this before trying to print the values: double amount = newInvoice.getInvoiceAmount(); newInvoice.setInvoiceAmount(amount); Also, please respect the java naming convention, use camelCase. It is hard for others to read your code. An useful technique to debug problems like this is to add print statements to track the variable. Start from the first place where the variable is set, and each time the variable is changed add a print statement to see how it is changing. Eventually you'll find out where it goes wrong.
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/36213261
has comment: http://stackoverflow.com/comment/36213175

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/23495611

http://stackoverflow.com/comment/36240036
type: Comment
score: 0
has text: @Macrosoft-Dev Struts 1, not Struts 2. And the answer is particularly confusing since in Struts 2 which you link to there's no such attribute `scope`.
comment on: http://stackoverflow.com/a/23603130
type: AnswerComment

http://stackoverflow.com/comment/36183560
comment on: http://stackoverflow.com/q/23577109
type: Comment
type: QuestionComment
has text: Thank you. Which line is line 53? `TestEmployer.java:53`
score: 0

http://stackoverflow.com/comment/36189750
type: Comment
has text: @danny Good catch - my example only works when `from` is 1. Will amend.
type: AnswerComment
comment on: http://stackoverflow.com/a/23475461
score: 0

http://stackoverflow.com/comment/36092560
type: QuestionComment
comment on: http://stackoverflow.com/q/23527646
score: 0
has text: hibernate query has a different syntax and restrictions, why do you need so? May be better to use Criteria API, trying to reproduce the SQL generated by hibernate.
type: Comment

http://stackoverflow.com/q/23509216
answer count: 3
has answer: http://stackoverflow.com/a/23509260
has comment: http://stackoverflow.com/comment/36056636
favorite count: 0
linked to: http://stackoverflow.com/q/40480
upvote count: 1
type: AnsweredQuestion
has body: I have two classes as follows package com.test; public class TestObject { private String id; private String name; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void printValues() { System.out.println("ID = "+id); System.out.println("Name = "+name); } } and package com.test; public class Test { public void test1() { TestObject to = new TestObject(); test2(to); to.printValues(); TestObject to2 = null; to2 = test2(to2); to2.printValues(); } public TestObject test2(TestObject _to) { if(_to == null) { _to = new TestObject(); _to.setId("System ID"); _to.setName("System Name : "+new java.util.Date()); } else { _to = new TestObject(); _to.setId("Some ID"); _to.setName("Some Name : "+new java.util.Date()); } return _to; } public static void main(String[] args) { Test test = new Test(); test.test1(); } } when i run this code i got following output ID = null Name = null ID = System ID Name = System Name : Wed May 07 10:38:22 IST 2014 I don't if object is null then i am creating from function and returned from function so why it gives me null? please help me Thanks in advance.
accepted answer: http://stackoverflow.com/a/23509260
tagged with: java
has answer: http://stackoverflow.com/a/23509332
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23509329
has answer: http://stackoverflow.com/a/23509329
has title: Why reference is not set while passing object to function
score: 0

http://stackoverflow.com/comment/36198009
has text: I have no idea how you would do this in Java, unfortunately. I know how to do this in C, but it is pretty complicated - it involves injecting code into OpenGL32.dll at run-time. The other option is to place a custom OpenGL32.DLL in the application's working directory before it begins, while that is considerably easier, it is not very robust.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23584908
score: 0

http://stackoverflow.com/a/23494895
answers question: http://stackoverflow.com/q/23494789
type: Answer
score: 0
has body: HibernateException extends RuntimeException, therefore making it an unchecked exception. Unchecked exceptions don't need to be caught

http://stackoverflow.com/q/23465295
tagged with: jtable
has comment: http://stackoverflow.com/comment/35974556
upvote count: 8
tagged with: actionevent
type: Question
has body: I want to remove a Selected row from a table in java. The event should be performed on button click. I will be thank full if someone helps... For example there is a table named sub_table with 3 columns i.e sub_id, sub_name,class. when I select one of the rows from that table and click delete button that particular row should be deleted..
has title: remove a selected row from jtable on button click
has comment: http://stackoverflow.com/comment/35974578
tagged with: swing
has comment: http://stackoverflow.com/comment/35974571
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35974621
linked to: http://stackoverflow.com/q/1117888
type: UnansweredQuestion
score: 8
has answer: http://stackoverflow.com/a/23465377
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/35974639

http://stackoverflow.com/comment/36126096
has text: Yes that's exactly what I'm looking for, thank you. However, the group I'm working with wants something a little more "special" so I may have to go with an internalFrame just because it looks a little different.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23545668
type: Comment

http://stackoverflow.com/q/23532681
has comment: http://stackoverflow.com/comment/36101696
has answer: http://stackoverflow.com/a/23532842
accepted answer: http://stackoverflow.com/a/23532842
tagged with: maven
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has title: maven: including selected dependencies for single jar
answer count: 1
downvote count: 0
has body: I have a maven module, which depends on two other modules com.org.me_services.federated_services ifs 1.0-SNAPSHOT com.org.me_services.inventory converter 1.0-SNAPSHOT I want both of these dependencies to be included in jar created by this module. I tried maven shade plugin like <plugins> org.apache.maven.plugins maven-shade-plugin business-${artifactId}-${version} shade package but this bundles every depedency (even the framework). Is there a way to be selective about which dependencies I want to include in final jar?
favorite count: 0

http://stackoverflow.com/comment/36136584
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23551923
type: Comment
has text: RE the edit - If ultimately your question is about javascript, please remove all the bits about java and jodatime, and edit the title and tags accordingly. That just confuses the issue.

http://stackoverflow.com/q/23454588
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/57511370
type: Question
has body: I have a EditText View with some hint text. When the device rotates the hint turns to real text. If the user has written some text before - it's overridden. How can I change the behavior? stop the hint from turning into text?
downvote count: 0
has title: hint text turns to real text in EditText after device rotation
answer count: 2
has comment: http://stackoverflow.com/comment/35954297
favorite count: 0
has answer: http://stackoverflow.com/a/23455021
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: android-edittext

http://stackoverflow.com/q/23519346
has comment: http://stackoverflow.com/comment/36074750
linked to: http://stackoverflow.com/q/4388992
has body: I am trying include facebook authentication into my app. I've created hash key with keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64 then i've added this hash into appDashboard. APK without sign works fine, but when i trying buid signed APK from android studio(Build-Generate Signed APK), i have error about mismatched hashkey... could anybody help me fix this problem? Thx!
has comment: http://stackoverflow.com/comment/36120736
accepted answer: http://stackoverflow.com/a/23520115
tagged with: android
tagged with: facebook
has comment: http://stackoverflow.com/comment/36124113
has title: Android + facebook sdk
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23520115
answer count: 1
has comment: http://stackoverflow.com/comment/36075151
score: 0

http://stackoverflow.com/q/23520063
has answer: http://stackoverflow.com/a/23520721
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36076207
has comment: http://stackoverflow.com/comment/36078327
has answer: http://stackoverflow.com/a/23520399
has body: I have the following block of code in my Java program: Filter.sitesToBeFiltered.add(eid.getSite()); System.out.println("Entity Site added to ArrayList. "); Filter.applicationsToBeFiltered.add(eid.getApplication()); System.out.println("Entity Application added to ArrayList. "); Filter.IDsToBeFiltered.add(eid.getEntity()); System.out.println("Entity ID added to ArrayList"); Filter.positionsToBeFilteredX.add(position.getX()); System.out.println("Entity X position added to ArrayList. "); Filter.positionsToBeFilteredY.add(position.getY()); System.out.println("Entity Y position added to ArrayList. "); Filter.positionsToBeFilteredZ.add(position.getZ()); System.out.println("Entity Z position added to ArrayList. "); Currently, it will read the values of a set of JTextFields, and add each value to an associated ArrayList. (The ArrayLists are either ArrayLists of Integers or Doubles). However, it will read their values no matter whether the value is a String, int/ double or null... I want to add some error checking code, so that it will only add the value to the associated ArrayList if it is of the correct data type. I've tried doing this by surrounding each of the two-line blocks in the code displayed above with an 'if' statement, such as: if(eid.getSite() != null){ Filter.sitesToBeFiltered.add(eid.getSite()); System.out.println("Entity Site added to ArrayList. "); } But if I do this, I get a compile error on the if statement that says "The operator != is undefined for the argument type(s) int, null"... Why is this? What should I use to check that the value of the JTextFields are not equal to null instead?
score: 0
tagged with: java
tagged with: forms
type: Question
tagged with: null
has answer: http://stackoverflow.com/a/23522031
has title: How to ignore null values when reading from a form?
has answer: http://stackoverflow.com/a/23520333
answer count: 4

http://stackoverflow.com/a/46166905
score: 2
has body: To me, upgrading bcel to 6.0 fixed the problem.
upvote count: 2
answers question: http://stackoverflow.com/q/23541532
downvote count: 0
type: Answer

http://stackoverflow.com/q/23586398
type: Question
accepted answer: http://stackoverflow.com/a/23586432
has body: I am interested in how exceptions in Android work when trown manually. I tried to make an app where you can push a button and a random exception would popup. Here I noticed something strange. When for instance, I throw an ArrayIndexOutOfBoundsException, I get an IlligalStateException. Function that generates exception: public void GenerateRandomException(View view) { Random rand = new Random(); int random = rand.nextInt(5); switch(random) { case 0: throw new ArrayIndexOutOfBoundsException("An ArrayIndexOutOfBoundsException occured!"); case 1: throw new RuntimeException("A RuntimeException occured!"); case 2: throw new NullPointerException("An NullPointerException occured!"); case 3: throw new IllegalThreadStateException("An IllegalThreadStateException occured!"); case 4: throw new IllegalArgumentException("An IllegalArgumentException occured!"); default: break; } } Stacktrace: FATAL EXCEPTION: main java.lang.IllegalStateException: Could not execute method of the activity at android.view.View$1.onClick(View.java:3838) at android.view.View.performClick(View.java:4475) at android.view.View$PerformClick.run(View.java:18786) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:176) at android.app.ActivityThread.main(ActivityThread.java:5419) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at android.view.View$1.onClick(View.java:3833) ... 11 more Caused by: java.lang.ArrayIndexOutOfBoundsException: An ArrayIndexOutOfBoundsException occured! at gamebugtracker.lib.Mai…
answer count: 1
tagged with: exception
tagged with: android
score: 0
has comment: http://stackoverflow.com/comment/36200464
has comment: http://stackoverflow.com/comment/36200628
has answer: http://stackoverflow.com/a/23586432
type: AnsweredQuestion
tagged with: java
has title: Android Java Exceptions - How do they work when thrown manually?

http://stackoverflow.com/comment/40016917
type: AnswerComment
comment on: http://stackoverflow.com/a/25320545
score: 0
type: Comment
has text: Hi, I am having trouble at step 2. After specifying the `google-play-services_lib` directory, it doesn't enable the next button, like [this](http://tinypic.com/r/ei8ak7/8). Please help if you can.

http://stackoverflow.com/a/23582717
accepted answer of: http://stackoverflow.com/q/23582563
type: Answer
has body: Vector.java: public interface Vector&lt;T extends Vector&gt; { public int getX(); public int getY(); public int getZ(); public T sum(T other); } BaseVector.java: public abstract class BaseVector&lt;T extends Vector&gt; implements Vector&lt;T&gt; { private final int x; private final int y; private final int z; public BaseVector(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } protected abstract T createNew(int x, int y, int z); @Override public T sum(T other) { return createNew(x + other.getX(), y + other.getY(), other.getZ()); } @Override public int getX() { return x; } @Override public int getY() { return y; } @Override public int getZ() { return z; } @Override public String toString() { return "BaseVector [x=" + x + ", y=" + y + ", z=" + z + "]"; } } Velocity.java: public class Velocity extends BaseVector&lt;Velocity&gt; { public Velocity(int x, int y, int z) { super(x, y, z); } @Override protected Velocity createNew(int x, int y, int z) { return new Velocity(x, y, z); } } Test.java: public static void main(String[] args) { Velocity v1 = new Velocity(14, 14, 14); Velocity v2 = new Velocity(14, 14, 14); Velocity result = v1.sum(v2); System.out.println(result); } }
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23582563

http://stackoverflow.com/q/23542571
has comment: http://stackoverflow.com/comment/36638917
has comment: http://stackoverflow.com/comment/36563473
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/36541966
tagged with: htmlunit
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23630803
favorite count: 0
tagged with: exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36624581
has comment: http://stackoverflow.com/comment/36119186
downvote count: 2
has title: Due to an occasional exception, shoud I ignore an exception in Htmlunit
type: Question
has body: I used Htmiunit to write a method snippet to log out from a social webpage, which is listed below: private void logoutWeibo(){ String WeiboLogoutURL = "http://login.sina.com.cn/sso/logout.php?"; HtmlPage WeiboLogoutPage = null; do{ try { WeiboLogoutPage = client.getPage(WeiboLogoutURL); } catch (FailingHttpStatusCodeException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }while(WeiboLogoutPage.getElementById("username") == null); } Occasionally, the statement "WeiboLogoutPage = client.getPage(WeiboLogoutURL);" would throw an IOException due to connection timeout. I'm willing to ignore it and ask the program to continue. Should I ignore it and could I fulfill it by re-writing the code snippet like this: private void logoutWeibo(){ String WeiboLogoutURL = "http://login.sina.com.cn/sso/logout.php?"; HtmlPage WeiboLogoutPage = null; int errorTimeout = 0; do{ try { WeiboLogoutPage = client.getPage(WeiboLogoutURL); } catch (FailingHttpStatusCodeException e){ e.printStackTrace(); } catch (IOException e) { if(errorTimeout++ &gt; 5){ break; } else{ logoutWeibo(); } } }while(WeiboLogoutPage.getElementById("username") == null); } Thanks a lot.

http://stackoverflow.com/a/23602405
type: Answer
has body: I am by no means a regex expert. But not replacing the * at all, and adding a .* at the end did it for me List&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("Test"); list.add("Test Test"); list.add("Test Second"); String queryString = "Te*s"; // queryString = queryString.replaceAll("\\*", "\\.\\*"); queryString = queryString.concat(".*"); for (String str : list) { if (str.matches(queryString)) System.out.println(str); }
answers question: http://stackoverflow.com/q/23602045
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23602045
score: 0

http://stackoverflow.com/comment/36017346
comment on: http://stackoverflow.com/q/23487891
score: 0
has text: It does not match using Java 6u45 too. I tested it in javascript and i see that it captures a single group with the value `http://abcd.at/2025RainR4`. You should edit the question and provide all this information.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23491199
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/36022239
has body: Run your tests inside your web project. Define another source package like '/src/test/' and put them there. Then modify your ant script: run these tests on build or test exclude this source package on war. Alternative extract common classes, which both projects are using, and create a new project jar. Then import this new jar on both projects as dependency.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23490903

http://stackoverflow.com/q/23604207
type: Question
tagged with: playframework
has body: In views folder kq.xml: @(code:String) &lt;Response&gt; &lt;Say voice="alice"&gt; welcome &lt;/Say&gt; &lt;Pause length="1"/&gt; &lt;Say loop="6" voice="alice" &gt; your conformation code is &lt;Pause length="1"/&gt; @code &lt;/Say&gt; &lt;/Response&gt; In controller: def kqxml(code:String) = Action { implicit request =&gt; try { Ok(views.xml.kq(code)) } catch { case e: Exception =&gt; Ok(write(Map("result" -&gt; "error"))) } } But getting error: object kq is not a member of package views.xml [error] Ok(views.xml.kq(code)) ^ I also tried: Ok(views.html.kq(code)) which of course didn't work.
has title: Dealing with xml in Scala play framework
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
tagged with: scala
tagged with: model-view-controller
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23604496
tagged with: java
accepted answer: http://stackoverflow.com/a/23604496

http://stackoverflow.com/comment/36123337
comment on: http://stackoverflow.com/a/23545045
type: AnswerComment
has text: By the way, your code makes it that you can only drag the rectangle down and right. You don't want to allow the origin to be the bottom right point?
score: 0
type: Comment

http://stackoverflow.com/q/23532066
tagged with: java
tagged with: derby
score: 0
answer count: 2
tagged with: sql
has answer: http://stackoverflow.com/a/23534918
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23534920
has body: I'm a beginner with SQL, though I know enough to get by. The statements aren't what is confusing me, it's the combination with Java that gets me. Essentially I'm trying to display a JTable that shows the data in the Database. My train of thought is to simply get all the data into a String array and use a for loop to add to my JTable's model. The database table only has 2 columns, a varchar(30) and a date. I'm completely lost though using Derby and the online documentation is latin to me. I've been able to set up the database without issue using Connection, Statement objects to exicute the SQL Queries. I think my answer lies somewhere within ResultSet, as I can query the entire table with SELECT * FROM table_name, just don't know how to get that object into a String Array. I apologize for the disorganized question, dead tired from work. TL;DR: Get entire table into a String Array from a Derby Database.
has title: Getting Embedded Derby Database entire table into a string array
type: Question

http://stackoverflow.com/q/23548645
has title: Spring3 MVC: Validation not working
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/23548825
linked to: http://stackoverflow.com/q/23524282
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has body: The gender validation is not working. Even if no values are entered in the gender text field, the form is getting validated successfully without throwing any error. Below is the Employee class: @Size(min=2,max=10) private String gender; // Setters and Getters Below is the Controller method: @RequestMapping(value="done", method = RequestMethod.POST) public String validateForm(@Valid Employee employee, BindingResult result, ModelMap m){ if(result.hasErrors()){ System.out.println("Validation Failed!!!"); return "main"; }else{ System.out.println("Validation Succeeded!!!"); return "done"; } } Below is the context file: &lt;context:annotation-config /&gt; &lt;context:component-scan base-package="com.XXX" /&gt; &lt;bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt; &lt;property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /&gt; &lt;property name="prefix" value="/WEB-INF/pages/" /&gt; &lt;property name="suffix" value=".jsp" /&gt; &lt;/bean&gt; Below is the jsp file: &lt;tr&gt; &lt;td&gt; Gender: &lt;/td&gt; &lt;td&gt; &lt;form:input path="gender"/&gt; &lt;form:errors path="gender" cssStyle="color: red;"/&gt; &lt;/td&gt; &lt;/tr&gt; I am not able to find out whats missing but its something silly. Please help.
type: Question
accepted answer: http://stackoverflow.com/a/23548825
has comment: http://stackoverflow.com/comment/36129947
has comment: http://stackoverflow.com/comment/36130004
tagged with: validation
answer count: 1
downvote count: 0
score: 1
favorite count: 0

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/23459989
type: Tag

http://stackoverflow.com/q/23519790
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/38309745
tagged with: java
tagged with: authentication
type: Question
upvote count: 2
answer count: 1
has body: I am working with Google Drive and wanna make a permanent login session. I just found that the google api will ask me to use a browser to obtain an access token. Is it possible that I could hard-code my username and password or in other ways so that I could program to login to google using code only? I am using Java. Thanks.
has answer: http://stackoverflow.com/a/28735621
favorite count: 0
tagged with: google-drive-api
type: UnansweredQuestion
has title: google drive login api without browser

http://stackoverflow.com/q/23596457
tagged with: android-gridview
type: AnsweredQuestion
favorite count: 0
type: Question
tagged with: android
tagged with: fragment
has body: I'm new on Android, I have one problem implementing GridView on "extends Fragment". Tab2SalonActivity.java public class Tab2SalonActivity extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View root= inflater.inflate(R.layout.page_two_salon, container, false); GridView gridview = (GridView) root.findViewById(R.id.gridView); gridview.setAdapter(new ImageAdapter(this));//Line error gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { } }); return root; } } ImageAdapter.java public class ImageAdapter extends BaseAdapter { private Context mContext; public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; }//continue... ¿How I can solve this issue? The Error it's: "The constructor ImageAdapter(Tab2SalonActivity) is undefined" I don't know how i can defined on constructor, always i have errors, please, help me! Thanks
has answer: http://stackoverflow.com/a/23596461
score: 0
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23596461
answer count: 1
downvote count: 1
has title: Android - The constructor ImageAdapter(Tab2SalonActivity)is undefined

http://stackoverflow.com/a/23516206
score: 0
type: Answer
has body: An array is the wrong structure for this. You want a HashMap that will hold the current count for each word. You get the current count for a word, change null to 0, then add 1 and put it back in the map. You can prune it past 1000 as you like.
answers question: http://stackoverflow.com/q/23515878

http://stackoverflow.com/q/23512544
answer count: 2
tagged with: bean-validation
has body: I worked out a concept to conditionally validate using JSR 303 groups. "Conditionally" means that I have some fields which are only relevant if another field has a specific value. Example: There is an option to select whether to register as a person or as a company. When selecting company, the user has to fill a field containing the name of the company. Now I thought I use groups for that: class RegisterForm { public interface BasicCheck {} public interface UserCheck {} public interface CompanyCheck {} @NotNull(groups = BasicCheck.class) private Boolean isCompany @NotNull(groups = UserCheck.class) private String firstName; @NotNull(groups = UserCheck.class) private String lastName; @NotNull(groups = CompanyCheck.class) private String companyName; // getters / setters ... } In my controller, I validate step by step depending on the respective selection: @Autowired SmartValidator validator; public void onRequest(@ModelAttribute("registerForm") RegisterForm registerForm, BindingResult result) { validator.validate(registerForm, result, RegisterForm.BasicCheck.class); if (result.hasErrors() return; // basic check successful =&gt; we can process fields which are covered by this check if (registerForm.getIsCompany()) { validator.validate(registerForm, result, RegisterForm.CompanyCheck.class) } else { validator.validate(registerForm, result, RegisterForm.UserCheck.class); } if (!result.hasErrors()) { // process registration } } I only want to validate what must be validated. If the user selects "company" fills a field with invalid content and then switches back to "user", the invalid company related content must be ignored by the validator. A solution would be to clear those fields using Javascript, but I also want my forms to work with javascript disabled. This is why I totally like the approach shown above. But Spring breaks this idea due to data binding. Before validation starts, Spring binds the data to registerForm. It adds error to result if, for instance, types are i…
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/49060550
accepted answer: http://stackoverflow.com/a/23513968
linked to: http://stackoverflow.com/q/30467124
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
has title: JSR-303 / Spring MVC - validate conditionally using groups
has answer: http://stackoverflow.com/a/40555272
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/40555272
has answer: http://stackoverflow.com/a/23513968

http://stackoverflow.com/q/23489986
accepted answer: http://stackoverflow.com/a/23490137
tagged with: selenium
upvote count: 1
has title: How to select new IFrame using Selenium WebDriver?
type: Question
has answer: http://stackoverflow.com/a/39790747
tagged with: java
has answer: http://stackoverflow.com/a/23490137
tagged with: webdriver
has answer: http://stackoverflow.com/a/23494559
has body: I wanted to select an Iframe and Enter values in the Body . I am trying with the below code. HTML code: Selenium code: driver.switchTo().frame(driver.findElement(By.xpath("//iframe[contains(@id,'content_ifr')]"))); driver.findElement(By.xpath("//*[@id='tiny']/div[1]")).sendKeys("Happy New IFrame"); But I could not able to enter values. Can anybody help me with this?
answer count: 3
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23494559
tagged with: selenium-webdriver
type: AnsweredQuestion
score: 1
tagged with: iframe

http://stackoverflow.com/q/23487257
has comment: http://stackoverflow.com/comment/36020154
has answer: http://stackoverflow.com/a/23543112
tagged with: google-chrome
tagged with: gwt
type: AnsweredQuestion
tagged with: internet-explorer
upvote count: 9
has comment: http://stackoverflow.com/comment/36139933
tagged with: java
accepted answer: http://stackoverflow.com/a/23543112
type: Question
has answer: http://stackoverflow.com/a/23662082
score: 9
has answer: http://stackoverflow.com/a/23487772
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23487772
has answer: http://stackoverflow.com/a/23538381
has title: GWT Developer plugin for Chrome and Internet Explorer - error preventing installation
has body: I am trying to install the GWT Developer plugin for Chrome (Version 34.0.1847.131 m) and I get the following error "This application is not supported on this computer. Installation has been disabled. The following problems are detected:" and "NPAPI plugin is required by this app". Is there a way around this? I have installed Microsoft Visual C++ 2008 SP1 Redistributable Package as suggested by one answer. I am also trying to run in Explorer (version 11) and it requires me to download the GWT Developer plugin for Firefox. Which then requires content to be opened in a new window. I then elect to open "gwt-dev-plugin.xpi". When it finishes downloading it requests me to save it (if I open it it just download again). Is there a way around this? I am running on Windows 8.1.
answer count: 4

http://stackoverflow.com/comment/36092380
type: AnswerComment
comment on: http://stackoverflow.com/a/23527322
type: Comment
has text: I am currently doing a google search for keywords and it is working, but it is not as integrated as the api help.
score: 0

http://stackoverflow.com/comment/36290154
type: Comment
type: QuestionComment
has text: possible duplicate of [Problem in getting url.getContent()](http://stackoverflow.com/questions/6523730/problem-in-getting-url-getcontent)
comment on: http://stackoverflow.com/q/23615455
score: 0

http://stackoverflow.com/comment/36081673
has text: I made a mistake in other place in my code, but I thought that the reason is in this part of code, so problem is solved.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23519534

http://stackoverflow.com/comment/36199299
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23581887
has text: Is there no way i can open a connection to the server and use that same connection for each request? So i dont have to reconnect to the server then disconnect each time
score: 0

http://stackoverflow.com/q/23464803
has comment: http://stackoverflow.com/comment/35973763
type: AnsweredQuestion
has title: How to return a string with a Breadth First Order traversal of a binary search tree?
accepted answer: http://stackoverflow.com/a/23464896
score: 1
has comment: http://stackoverflow.com/comment/35973902
tagged with: java
has answer: http://stackoverflow.com/a/23464896
answer count: 1
downvote count: 0
tagged with: string
favorite count: 0
has body: So I've figured out how to do a bread-first order for a binary search tree but I need to return a String with a breadth-first order traversal of the tree, how do I do that? My Code: /** * Returns a breadth-first order String of tree elements. * * @return a String with a breadth-first order traversal of the tree */ public String breadthFirstOrder() { Queue&lt;Node&lt;E&gt;&gt; queue = new LinkedList&lt;Node&lt;E&gt;&gt;(); if (root == null) System.out.println("Empty tree"); queue.clear(); queue.add(root); while(!queue.isEmpty()){ Node&lt;E&gt; node = queue.remove(); System.out.print(node.data + " "); if(node.left != null) queue.add(node.left); if(node.right != null) queue.add(node.right); } }
upvote count: 1
type: Question

liferay-6
tags question: http://stackoverflow.com/q/23478461
tags question: http://stackoverflow.com/q/23515716
tags question: http://stackoverflow.com/q/23541474
tags question: http://stackoverflow.com/q/23526189
tags question: http://stackoverflow.com/q/23562491
tags question: http://stackoverflow.com/q/23469710
tag name: liferay-6
type: Tag
tags question: http://stackoverflow.com/q/23453097
tags question: http://stackoverflow.com/q/23469824
tags question: http://stackoverflow.com/q/23608438

http://stackoverflow.com/comment/36041512
type: Comment
comment on: http://stackoverflow.com/q/23501353
score: 2
has text: I don't see where `encrypted` is initialized
type: QuestionComment

http://stackoverflow.com/a/23522786
has body: I'm running Kepler and Aptana Studio in Ubuntu 14.04 64 without any issues. I'm using the Oracle 1.7 JDK/JRE, which I installed manually. That includes creating links to java, javaws in /usr/local/bin. Other than that, I haven't tweaked anything I can think of. I hope that helps; telling you it works for me isn't much help...
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36111458
type: Answer
answers question: http://stackoverflow.com/q/23522606
score: 1

http://stackoverflow.com/comment/36015939
score: 0
has text: My guess is that there is an encoding problem somewhere, possibly when you retrieve the data, possibly in an earlier stage. You are better off fixing the source of the problem as it will be difficult to create a list of invalid characters.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23487618

http://stackoverflow.com/q/23541489
tagged with: c#
has body: I have a string which is in following format or comma separated format s1 ,s2,s3,s4,and so on. I want to convert it into s1 s2 s3 s4 .. .. .. I know how I can do this by using a loop but I want to do this by regex in c# and in java without using the loop can I achive this ???
possible better answer: http://stackoverflow.com/a/23541529
score: -2
accepted answer: http://stackoverflow.com/a/23541679
answer count: 3
has comment: http://stackoverflow.com/comment/36116241
tagged with: regex
tagged with: string
has comment: http://stackoverflow.com/comment/36116211
favorite count: 0
has title: Converting the comma separated string
duplicate of: http://stackoverflow.com/q/17571841
has answer: http://stackoverflow.com/a/23541679
linked to: http://stackoverflow.com/q/17571841
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36116205
tagged with: java
has answer: http://stackoverflow.com/a/23541529
downvote count: 3
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23541613

hadoop
tags question: http://stackoverflow.com/q/23459315
tags question: http://stackoverflow.com/q/23492452
tags question: http://stackoverflow.com/q/23602001
tags question: http://stackoverflow.com/q/23541119
tag name: hadoop
tags question: http://stackoverflow.com/q/23580319
tags question: http://stackoverflow.com/q/23507105
tags question: http://stackoverflow.com/q/23488388
type: Tag
tags question: http://stackoverflow.com/q/23547412
tags question: http://stackoverflow.com/q/23604371
tags question: http://stackoverflow.com/q/23522013
tags question: http://stackoverflow.com/q/23522523
tags question: http://stackoverflow.com/q/23505374
tags question: http://stackoverflow.com/q/23454590
tags question: http://stackoverflow.com/q/23586740
tags question: http://stackoverflow.com/q/23561736
tags question: http://stackoverflow.com/q/23457027
tags question: http://stackoverflow.com/q/23495247
tags question: http://stackoverflow.com/q/23472688
tags question: http://stackoverflow.com/q/23530948
tags question: http://stackoverflow.com/q/23478746
tags question: http://stackoverflow.com/q/23534905
tags question: http://stackoverflow.com/q/23553669
tags question: http://stackoverflow.com/q/23601380
tags question: http://stackoverflow.com/q/23601991
tags question: http://stackoverflow.com/q/23584137
tags question: http://stackoverflow.com/q/23504322
tags question: http://stackoverflow.com/q/23600368
tags question: http://stackoverflow.com/q/23471136
tags question: http://stackoverflow.com/q/23577652
tags question: http://stackoverflow.com/q/23505999
tags question: http://stackoverflow.com/q/23605542

http://stackoverflow.com/q/23592413
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23608668
tagged with: query-cache
has body: i want to configure query cache without second level cache for some learning purpose as i have read it can be done but somehow for me query cache works only with 2nd level cache. Here is my configuration true Entity class is @Entity public class Company {} but when i do session = factory.openSession(); Query getQuery=session.createQuery("from Company where companyId=1"); getQuery.setCacheable(true); Object company2 = getQuery.uniqueResult(); session.close(); session = factory.openSession(); getQuery=session.createQuery("from Company where companyId=1"); getQuery.setCacheable(true); company2 = getQuery.uniqueResult(); session.close(); Two separate queries are fired . As soon as i do @Entity @Cacheable @Cache(usage=CacheConcurrencyStrategy.READ_WRITE) public class Company {} Query cache work but it enables the second level cache also. So how to configure query cache without enabling second level cache?
has title: Configure query cache without second level cache
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
tagged with: second-level-cache
downvote count: 0
answer count: 1

http://stackoverflow.com/q/23466179
has answer: http://stackoverflow.com/a/23466287
tagged with: file-io
has title: Java replace specific string in text file
has answer: http://stackoverflow.com/a/23466343
answer count: 4
tagged with: text-files
possible better answer: http://stackoverflow.com/a/23466384
has comment: http://stackoverflow.com/comment/35976171
has answer: http://stackoverflow.com/a/23466384
has body: I've got a text file called log.txt. It's got the following data 1,,Mon May 05 00:05:45 WST 2014,textFiles/a.txt,images/download.jpg 2,,Mon May 05 00:05:45 WST 2014,textFiles/a.txt,images/download.jpg The numbers before the first comma are indexes that specify each item. What I want to do is to read the file and then replace one part of the string(e.g. textFiles/a.txt) in a given line with another value(e.g. something/bob.txt). This is what I have so far: File log= new File("log.txt"); String search = "1,,Mon May 05 00:05:45 WST 2014,textFiles/a.txt,images/download.jpg; //file reading FileReader fr = new FileReader(log); String s; try (BufferedReader br = new BufferedReader(fr)) { while ((s = br.readLine()) != null) { if (s.equals(search)) { //not sure what to do here } } }
accepted answer: http://stackoverflow.com/a/23466287
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35976365
tagged with: java
has comment: http://stackoverflow.com/comment/35976083
upvote count: 4
downvote count: 0
score: 4
linked to: http://stackoverflow.com/q/3935791
favorite count: 0
has answer: http://stackoverflow.com/a/67386268

http://stackoverflow.com/comment/36135955
score: 0
type: Comment
type: QuestionComment
has text: What does inQueue.get() return? Don't compare with both null and true. Compare only with null if it returns a String. If it returns a boolean then use true. That it compiles...
comment on: http://stackoverflow.com/q/23551227

http://stackoverflow.com/comment/36016513
type: AnswerComment
score: 0
type: Comment
has text: Yes I liked and +1ed your answer but cant really say it correct answer to question in title Thank you and sorry :)
comment on: http://stackoverflow.com/a/23471283

http://stackoverflow.com/comment/36108585
type: Comment
type: QuestionComment
score: 0
has text: Not sure what's wrong with people over SO nowadays; simply downvote even if it doesn't make any sense.
comment on: http://stackoverflow.com/q/23537103

http://stackoverflow.com/comment/36166823
type: QuestionComment
type: Comment
has text: Are you getting the error on the actual device or on emulator?
comment on: http://stackoverflow.com/q/23568455
score: 2

http://stackoverflow.com/comment/36166693
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23568393
has text: In order to help you get an answer, it would be better if you could actually phrase this as a question. What is it specifically you would like help with?

constructor
tags question: http://stackoverflow.com/q/23601267
tags question: http://stackoverflow.com/q/23547684
tags question: http://stackoverflow.com/q/23545870
tags question: http://stackoverflow.com/q/23555129
tags question: http://stackoverflow.com/q/23530286
tags question: http://stackoverflow.com/q/23477930
tags question: http://stackoverflow.com/q/23602239
tags question: http://stackoverflow.com/q/23611122
tags question: http://stackoverflow.com/q/23598783
tag name: constructor
tags question: http://stackoverflow.com/q/23498514
type: Tag
tags question: http://stackoverflow.com/q/23543513
tags question: http://stackoverflow.com/q/23532265
tags question: http://stackoverflow.com/q/23596911
tags question: http://stackoverflow.com/q/23529040

http://stackoverflow.com/comment/35959210
has text: What happens when you run it? etc.
score: 1
comment on: http://stackoverflow.com/q/23457240
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23611614
type: Question
has title: Human Location Tracking
tagged with: java
answer count: 1
tagged with: websocket
has body: I need to write a software project for Human Location Tracking with benefit distributed system components. I need to use web sockets to push information to the server from any computer with coordinates as input. However, I am newbie about distributed systems. Can you suggest me any resource(s) that will help me to gain some info on how I can write that kind of program with using web sockets and java? I am familiar to java, and the idea behind the distribution systems; but never developed any program for it. Thanks in Advance
tagged with: distributed-computing
has answer: http://stackoverflow.com/a/23611696
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/36035609
type: QuestionComment
has text: And in reference to the meta post, it does *not* "work as intended" in the current form. In any case, even if we determine that it might be more on-topic in CR, that's not a reason to close it in SO, unless it's explicitly and without a doubt off-topic here
type: Comment
comment on: http://stackoverflow.com/q/23472537
score: 0

http://stackoverflow.com/comment/36212453
score: 0
type: Comment
type: QuestionComment
has text: Is there a reason why you are not using jax-ws?
comment on: http://stackoverflow.com/q/23591219

http://stackoverflow.com/comment/35975661
comment on: http://stackoverflow.com/a/23465841
score: 0
type: AnswerComment
has text: Whoops - too much JavaScript for me ;) Fixed
type: Comment

http://stackoverflow.com/q/23556156
linked to: http://stackoverflow.com/q/19374345
tagged with: servlets
type: Question
has title: sending json data from javascript to java
has comment: http://stackoverflow.com/comment/36144760
answer count: 2
downvote count: 0
tagged with: jquery
tagged with: ajax
has comment: http://stackoverflow.com/comment/36161921
has answer: http://stackoverflow.com/a/23556786
favorite count: 0
type: UnansweredQuestion
has body: I'm trying to send json data to servlet using ajax jquery call... below is the code $(function() { $( "#mybutton").click(function() { var testdata = JSON.stringify({ 'name': 'name', 'desc':'test' }); $.ajax({ type: "POST", url:"/Alert/ReportServlet", data: testdata, dataType: "json", contentType: "application/json", success : function(data){ console.log("success:", data); }, error : function(data) { console.log("error:", data); } }); }); }); and the servlet code is public class ReportingServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException { System.out.println("The data is" + request.getParameter("testdata")); } } The value is coming as null...Please suggest
upvote count: 1
has answer: http://stackoverflow.com/a/23556570
has comment: http://stackoverflow.com/comment/36147342
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/36144318

http://stackoverflow.com/q/23550074
has title: How to show Url Image in a jtable with mysql?
tagged with: java
tagged with: mysql
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/10620448
has body: Hi I would like to print to a cell in a table image that works as a url. I have the url stored in my database table data as text. I put the method I'm using to print the rest of data in the other columns, I would like to add another column with the image link. any help would be good. public void SearchMovie() throws SQLException { try { Connection con = null; ResultSet rs = null; Statement st = null; String Genre = ComboGenero.getSelectedItem().toString(); String Era = ComboEra.getSelectedItem().toString(); String Clsssification = ComboClasification.getSelectedItem().toString(); String sql = "select Poster,Title,Year,Country ,imdb ,Trailer from movie where Genre ='" + Genre + "'"; Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost/whichmovie", "Asis", "dekrayat24"); System.out.println("Conectado a la base de datos SQLite"); st = con.createStatement(); rs = st.executeQuery(sql); jTable1.setDefaultRenderer(Object.class, new IconCellRenderer()); DefaultTableModel model = new DefaultTableModel(); this.jTable1.setModel(model); // Donde 50 es el tamaño que querramos en la celda según lo q necesitemos jTable1.setRowHeight(55); jTable1.setCellSelectionEnabled(true); ResultSetMetaData rsMD = rs.getMetaData(); int numcolumnas = rsMD.getColumnCount(); for (int x = 1; x &lt;= numcolumnas; x++) { model.addColumn(rsMD.getColumnLabel(x)); } if (!rs.next()) { ResultadosLabel.setText("No Movies found "); } else { do { Object[] fila = new Object[numcolumnas]; for (int i = 0; i &lt; numcolumnas; i++) { fila[i] = rs.getObject(i + 1); byte[] imagedataCover = rs.getBytes("Poster"); format = new ImageIcon(imagedataCover); byte[] imagedataCountry = rs.getBytes("Country"); format2 = new ImageIcon(imagedataCountry); fila[0] = new JLabel(format); fila[3] = new JLabel(format2); ResultadosLabel.setText(i - 2 + " " + "Movies found "); } model.addRow(fila); setAnchoColumnas(); } while (rs.next()); rs.close(); st.close(); con.close(); } } catch (Class…
has answer: http://stackoverflow.com/a/23550775
score: 0
answer count: 1
tagged with: url
type: UnansweredQuestion

http://stackoverflow.com/q/23496838
linked to: http://stackoverflow.com/q/5329662
tagged with: android
tagged with: webchromeclient
has answer: http://stackoverflow.com/a/23496948
type: UnansweredQuestion
tagged with: webview
type: Question
has body: I need to get the location of a user from within a webview and it's not asking me for permission to get the location. Below is my webview code: WebView Setup public void WebViewSettings(){ webView = (WebView) findViewById(R.id.webview); webView.canGoBack(); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setSupportZoom(true); webView.getSettings().setLoadWithOverviewMode(true); webView.setWebViewClient(new WebViewClientSetup()); //webView.setWebChromeClient(new GeoWebChromeClient()); webView.getSettings().setGeolocationEnabled(true); //webView.getSettings().setGeolocationDatabasePath( context.getFilesDir().getPath() ); myTimer = new Timer(); //Start this timer when you create you task myTimer.schedule(new loaderTask(), 20000); } WebChromeClient: public class GeoWebChromeClient extends WebChromeClient { @Override public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) { callback.invoke(origin, true, false); } } WebViewClient: public class WebViewClientSetup extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { return false; } @Override public void onLoadResource(WebView view, String url) { // Check to see if there is a progress dialog if (progressDialog == null) { progressDialog = new ProgressDialog(context); progressDialog.setTitle("Loading..."); progressDialog.setMessage("Please wait."); progressDialog.setCancelable(true); progressDialog.setIndeterminate(true); progressDialog.show(); } } @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { handler.proceed(); } @Override public void onPageFinished(WebView view, String url) { isPageLoadedComplete = true; View mapHeight = (View) findViewById(R.id.webview); int height = mapHeight.getHeight(); Log.d("map height", "map height" + height); /…
tagged with: java
has comment: http://stackoverflow.com/comment/45305409
score: 0
answer count: 1
tagged with: webviewclient
has title: Android Geolocation on webview

http://stackoverflow.com/a/23453066
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/23453043
score: 3
has body: you have already declared MainFrame mf; outside so just replace this statement MainFrame mf = new MainFrame(Workers); with mf = new MainFrame(Workers); //jFrame inorder to access the object outside of run()

http://stackoverflow.com/comment/35983022
has text: But I want the final result to have descending order based on count ,i.e the most repeated name to appear first
type: Comment
comment on: http://stackoverflow.com/q/23470145
type: QuestionComment
score: 0

http://stackoverflow.com/q/23494344
has answer: http://stackoverflow.com/a/23494418
has comment: http://stackoverflow.com/comment/36028043
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/256859
has comment: http://stackoverflow.com/comment/36027889
has comment: http://stackoverflow.com/comment/36028135
has comment: http://stackoverflow.com/comment/36027728
accepted answer: http://stackoverflow.com/a/23494418
has comment: http://stackoverflow.com/comment/36027793
linked to: http://stackoverflow.com/q/3298202
has title: Java foreach performance
answer count: 4
has comment: http://stackoverflow.com/comment/36029566
has body: I've using the "foreach" loop in my Java applications for a long time. Recently I started wondering if there is any significative difference in performance (or even in the result) between: Collection&lt;String&gt; collection = someMethod(); for(String element : collection) { ... } and: for(String element : someMethod()) { ... } What if instead of a Collection it is a List, a Map, a Set or an array?
has comment: http://stackoverflow.com/comment/36027813
has answer: http://stackoverflow.com/a/23494538
score: 0
has comment: http://stackoverflow.com/comment/36027688
has comment: http://stackoverflow.com/comment/36027765
possible better answer: http://stackoverflow.com/a/43311914
has comment: http://stackoverflow.com/comment/36031053
tagged with: foreach
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/43311914
has answer: http://stackoverflow.com/a/23495111

http://stackoverflow.com/a/23478141
has body: Could someone confirm that global variable of the class normally declared (i.e. private int x = 5) are readable in the other thread? Public global variable (instance or static) at class level is readable by other thread, but there is no guarantees about what value you'll get after reading. To ensure visibility guarantees, usually you need to make this variable volatile. Consider reading this article for further information.
answers question: http://stackoverflow.com/q/23477970
score: 0
type: Answer

http://stackoverflow.com/q/23578765
type: Question
answer count: 2
tagged with: type-systems
tagged with: compilation
has title: JavaFX: why can't be compile no matter what kind of `changeListener` I passed to `textArea.getKeyPressedProperty().addListener`
has answer: http://stackoverflow.com/a/23579452
accepted answer: http://stackoverflow.com/a/23579452
score: 0
has answer: http://stackoverflow.com/a/23580078
type: AnsweredQuestion
has body: JavaFx code: public class MyController implements Initializable { @FXML private TextArea editor; @Override public void initialize(URL url, ResourceBundle resourceBundle) { editor.onKeyReleasedProperty().addListener(new ChangeListener&lt;KeyEvent&gt;() { @Override public void changed(ObservableValue&lt;? extends KeyEvent&gt; o, KeyEvent oldVal, KeyEvent newVal) { System.out.println("changed!"); } }); } } This code can't be compiled on the lines of new ChangeListener..., and the error is: Can't resolve method 'addListener (javafx.beans.value.ChangeListener&lt;javafx.scene.input.KeyEvent&gt;&gt;)' I have changed the code again and again, but I can't find a way to make it compile. (I'm using Intellij-IDEA 13 + jdk 1.7)
tagged with: java
tagged with: javafx
possible better answer: http://stackoverflow.com/a/23580078

http://stackoverflow.com/q/23600885
downvote count: 0
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18690596
tagged with: spring
duplicate of: http://stackoverflow.com/q/18690596
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Spring IAMP Mail receiver not reading all emails everytime
tagged with: imap
has body: I have code that connects to gmail and reads all emails. I then loop each message and parse for some data. Below is the code that connects and downloads emails. ImapMailReceiver receiver = new ImapMailReceiver("imaps://"+mailAccount.box+":"+ URLEncoder.encode(mailAccount.pw,"utf-8")+"@imap.gmail.com:993/INBOX"); receiver.setShouldMarkMessagesAsRead(false); receiver.setShouldDeleteMessages(false); receiver.setMaxFetchSize(200); receiver.afterPropertiesSet(); Message[] receive = receiver.receive(); The issue is - first time I run the program with given userid/pwd, it works fine and downloads emails. I run the code again from second time onwards, it doesn't download any emails. I guess it looks for newer emails after my previous download. How do I download all the emails everytime I run the code.
tagged with: jakarta-mail

http://stackoverflow.com/comment/36050388
type: AnswerComment
has text: Worth noting that `10/3` returns an `int` and the assignment to a `double` is an implicit upcast.
comment on: http://stackoverflow.com/a/23505966
type: Comment
score: 1

http://stackoverflow.com/comment/36071815
has text: Sure you can http://stackoverflow.com/questions/9580571/running-a-client-server-prog-on-a-single-system
score: 0
comment on: http://stackoverflow.com/q/23516903
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35976082
type: QuestionComment
has text: why you have [] ? can you tell me what it means here?
comment on: http://stackoverflow.com/q/23466170
score: 0
type: Comment

http://stackoverflow.com/q/23575469
score: 2
tagged with: rmi
tagged with: java
type: Question
has title: Java RMI: setup-method returns immediatly and RMI threads aren't created
has comment: http://stackoverflow.com/comment/38339272
has answer: http://stackoverflow.com/a/23575697
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36180406
has comment: http://stackoverflow.com/comment/36184683
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I'm trying to set up a simple RMI server which is bound to the registry for clients to fetch for all further communication. I am using the code below: public class RMIServer implements ServerInterface { static Registry reg; public static void main(String[] args) throws NoSuchObjectException { //Registry reg; try { reg = LocateRegistry.createRegistry(1099); System.out.println("Registry created."); } catch (RemoteException ex) { System.err.println("Registry already existed."); return; } ServerInterface server = new RMIServer(); ServerInterface stub; try { stub = (ServerInterface)UnicastRemoteObject.exportObject(server, 0); } catch (RemoteException ex) { System.err.println("Could not create stub."); ex.printStackTrace(); return; } try { reg.rebind("server", stub); System.out.println("Server bound to registry."); } catch (RemoteException ex) { System.err.println("Could not bind server to registry."); ex.printStackTrace(); //UnicastRemoteObject.unexportObject(server, true); return; } } ... } This works perfectly fine when testing on my local machine and I was able to establish connections between (local) clients and the server. The main method above will not exit until I terminate it manually, which is the expected behavior. My local machine (Win8) runs Java 1.7.0_17 64-bit. Now when I execute the same code as above on a Ubuntu 12.04 Server with OpenJDK (version 1.7.0_55 64-bit), the main method and whole JVM immediately exit and the RMI threads aren't running. No error messages are printed; I only get the messages about the registry being created and the server being bound to the registry. Obviously clients then cannot connect, as no RMI process is running on the server. As far as I am aware, the main method should not automatically exit as long as there are exported objects which I have not unexported again. Yet it does on one of my machines. Does anyone have an idea what I am missing here? Thank you! Update 1: (Sorry, very busy lately and didn't get the chance to look…
has comment: http://stackoverflow.com/comment/36181251

http://stackoverflow.com/q/23521273
tagged with: java
tagged with: jpype
upvote count: 4
linked to: http://stackoverflow.com/q/23430466
downvote count: 0
linked to: http://stackoverflow.com/q/44033891
tagged with: python-2.7
has answer: http://stackoverflow.com/a/23608516
type: AnsweredQuestion
tagged with: macos
favorite count: 0
has body: I have read and searched all stack overflow .. I also found JPype class not found but it didn't help me although it is solved! I have the same problem ! I am using Mac , python 2.7.6 My both python code and A.java are on desktop. But I keep receiving this error : Traceback (most recent call last): File "/Users/jeren/Desktop/aa.py", line 13, in A = jpype.JClass("A") File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/jpype/_jclass.py", line 54, in JClass raise _RUNTIMEEXCEPTION.PYEXC("Class %s not found" % name) java.lang.ExceptionPyRaisable: java.lang.Exception: Class A not found aa.py : import jpype import os jpype.startJVM(jpype.getDefaultJVMPath(), "-ea", "-Djava.class.path=/Users/jeren/Desktop/") A = jpype.JClass("A") a = A() jpype.shutdownJVM() A.java : class A { public A() { super(); } public String sayHi() { return("Hello"); } public static void main(String[] argv) { System.out.println ("Hello "); } public static int add(int a, int b) { return(a+b); } } My mac , java and python are all 64bit ! where the problem can be?
accepted answer: http://stackoverflow.com/a/23608516
type: Question
has title: Class not found error on Jpype
answer count: 2
possible better answer: http://stackoverflow.com/a/55416918
tagged with: python
has answer: http://stackoverflow.com/a/55416918
score: 4

http://stackoverflow.com/comment/36082187
comment on: http://stackoverflow.com/a/23504551
score: 0
type: AnswerComment
type: Comment
has text: It shouldn't be too terribly difficult - you already have the part where the user's input affects the image on-screen in real-time, so all that you would need to do is make a new file with the correct dimensions, save the user's input in some format you can read later (e.g. draw red line from pixel (253, 221) to pixel (321, 883) and iterate over every pixel using a nested `for` loop, checking each pixel against the user's input you saved earlier to see if that pixel was affected by that input. I'll add some pseudo-code to my answer to make this a bit clearer.

http://stackoverflow.com/a/66079126
score: 0
has comment: http://stackoverflow.com/comment/116854378
type: Answer
has body: It took a while before I succeeded on my mac, but using locate on the terminal gave me the correct path: /Applications/NetBeans/Apache NetBeans 12.2.app/Contents/Resources/NetBeans/netbeans/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar That I entered into the: NetBeans &gt; Preferences &gt; Java &gt; Ant &gt; Options &gt; Properties setting. libs.CopyLibs.classpath=Applications/NetBeans/Apache NetBeans 12.2.app/Contents/Resources/NetBeans/netbeans/java/ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar Thank you for your help.
has comment: http://stackoverflow.com/comment/116852140
answers question: http://stackoverflow.com/q/23532966

http://stackoverflow.com/a/23556232
has comment: http://stackoverflow.com/comment/36144488
has body: suppose the file is present in Desktop/MyPics/Pic.jpg you can call setWallpaper() like following setWallpaper(new File("Desktop/MyPics/Pic.jpg"));
has comment: http://stackoverflow.com/comment/36144457
score: 0
has comment: http://stackoverflow.com/comment/36144474
answers question: http://stackoverflow.com/q/23556202
has comment: http://stackoverflow.com/comment/36144384
type: Answer
has comment: http://stackoverflow.com/comment/36144444

ubuntu
tags question: http://stackoverflow.com/q/23595518
tags question: http://stackoverflow.com/q/23575747
tags question: http://stackoverflow.com/q/23509988
tags question: http://stackoverflow.com/q/23533631
tags question: http://stackoverflow.com/q/23493893
tags question: http://stackoverflow.com/q/23522606
tags question: http://stackoverflow.com/q/23484260
tags question: http://stackoverflow.com/q/23504474
tag name: ubuntu
tags question: http://stackoverflow.com/q/23572487
tags question: http://stackoverflow.com/q/23550283
tags question: http://stackoverflow.com/q/23567819
type: Tag
tags question: http://stackoverflow.com/q/23523407
tags question: http://stackoverflow.com/q/23605464
tags question: http://stackoverflow.com/q/23551957

http://stackoverflow.com/q/23614793
downvote count: 0
tagged with: boolean
has answer: http://stackoverflow.com/a/23614890
answer count: 1
favorite count: 0
upvote count: 2
tagged with: boxing
has comment: http://stackoverflow.com/comment/36254008
tagged with: parameters
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/23614890
has body: I was looking around the Android framework documentation, and one thing caught my eye. The setIs24HourView method of TimePicker uses the wrapper class Boolean, not the primitive type boolean. I was just wondering, could there be a specific reason to use the wrapper class there? Can it do any benefit or could it just be a developer accidentally pressing Shift a little too long? And could/should it be reported as a bug (indeed an extremely tiny one, because of auto-boxing, but still one)?
tagged with: java
has comment: http://stackoverflow.com/comment/36253766
has title: Why are some methods using the Boolean class and not the primitive type?
tagged with: methods
type: Question

http://stackoverflow.com/comment/93404877
has text: On OpenJdk 11.0.1 there is 4 options: `-version`, `--version`, `-showversion` and `--showversion`. Both `version`and `showversion`does the same effect, but with only one dash it output as error, with two dash both output as normal and can be stored into variables. If you want to get, for some reason, error output and store it into variable you can do like this: > Invoke-Expression "java -version" -ErrorVariable javaVaraible java : openjdk version "11.0.1" 2018-10-16 ... > $javaVaraible java : openjdk version "11.0.1" 2018-10-16 ...
score: 2
comment on: http://stackoverflow.com/a/23465339
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/118915531
score: 1
type: Comment
comment on: http://stackoverflow.com/a/67275229
has text: You could explain in detail how/why OP's attempt didn't work and how your answer works differently to accomplish OP's/question's intended goal. I am a reviewer. StackOverflow requested review due to you being a new contributor. Your answer is much appreciated & helpful. This comment is to help you take a good answer & make it excellent.
type: AnswerComment

http://stackoverflow.com/comment/36028687
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23494411
has text: Why do you think you need to remove it from excluded parameters? It is *special* parameter you don't want it to be manipulated.
type: Comment

http://stackoverflow.com/q/23479829
has comment: http://stackoverflow.com/comment/36001694
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36001836
has body: I am trying to assign a string value from an array to an integer via parseInt and I'm getting this error. Any suggestions? System.out.println("in the loop for loading info"); try { String testnumber = "1 "; System.out.println("Numeric value of testnumber is:" + Integer.parseInt(testnumber.trim())); System.out.println("String value from array is:" + Global.teamPlayerHandicap[row][0].trim()); int testvalue = Integer.parseInt(Global.teamPlayerHandicap[row][0].trim()); System.out.println("Test value:" + testvalue); } catch (NumberFormatException e) { System.out.println("This is not a number:" + Global.teamPlayerHandicap[row][0].trim() +"END"); System.out.println(e.getMessage()); } Output: in the loop for loading info Numeric value of testnumber is:1 Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "1" String value from array is:1 This is not a number:1END For input string: "1" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Integer.parseInt(Integer.java:449) at java.lang.Integer.parseInt(Integer.java:499) at com.snafilter.TGL.DoWorkTGL1.PopulateSubmitScoresInfo(DoWorkTGL1.java:1271)
has answer: http://stackoverflow.com/a/23480059
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5267241
has title: Java parseInt NumberFormatException
score: 0
tagged with: numberformatexception
tagged with: parseint
answer count: 1
has comment: http://stackoverflow.com/comment/36001688

http://stackoverflow.com/comment/80610640
type: Comment
comment on: http://stackoverflow.com/a/23546802
type: AnswerComment
score: 2
has text: This is an answer? is the same that log but with a lot of lines "ClassCastException: android.app.Application cannot be cast to android.app.Activity" A solution for me is to use "this" from an Activity

http://stackoverflow.com/comment/36073780
type: Comment
comment on: http://stackoverflow.com/a/23518166
has text: found the problem. Thanks for the help.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36260452
comment on: http://stackoverflow.com/q/23586686
has text: Comment out everything you don't need to reproduce the problem.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23551369
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36135079
answer count: 1
has title: Selection sort issues
tagged with: selection-sort
has answer: http://stackoverflow.com/a/23551476
score: 0
has body: Feel as if im so close, just dont know what to put in "If Statment" and order of things. Please Help. Also not sure what to do with swap method for sure? private static void selectionSort(String[] words, int numWords) { for (int i = 0; i &lt; words.length; i++) { int min = i; for(int j = i+1; j &lt; words.length; j++) { if(words[index]&lt;words[minIndex]) { min = j; } swap(words, i, j); } } } public static int indexOfNextSmallest(String[] words, int startIndex) { int minIndex = startIndex; for(int i = startIndex; i &lt; words.length; i++) { if(words[i].compareTo(words[minIndex]) &lt; 0) minIndex = i; } return minIndex; } private static void swap(String[] words, int i, int j) { String swap = words[i]; words[i] = words[j]; words[j] = swap; } Trying to add user validation. Wondering if I should do it in method below or up in main method? private static int getMenuChoice(Scanner stdIn) { int option = 0; System.out.println("\n1: Add Word"); System.out.println("2: Remove Word"); System.out.println("3: Print Words"); System.out.println("4: Quit"); System.out.print("Choose an option(1-4): "); option = stdIn.nextInt(); return option; }
accepted answer: http://stackoverflow.com/a/23551476

http://stackoverflow.com/comment/36225094
has text: @QuinnMcHugh Remember that you can construct a new list by passing the slice to the constructor. This will force a copy.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23599497

http://stackoverflow.com/a/23459820
has comment: http://stackoverflow.com/comment/35964187
answers question: http://stackoverflow.com/q/23459686
type: Answer
has comment: http://stackoverflow.com/comment/35964262
has comment: http://stackoverflow.com/comment/35964208
has comment: http://stackoverflow.com/comment/35964247
has body: There is the simple way to convert json string to object : Try this : ObjectMapper mapper = new ObjectMapper(); POJO obj = mapper.readValue(yourJSONString, POJO.class);
score: 0

http://stackoverflow.com/q/23599610
has answer: http://stackoverflow.com/a/23599687
score: 0
has body: I am the beginner for java, and have one program that keeps running without error report. Please help me how to debug this problem? I would like to use Scanner class to print one capital in random. import java.nio.CharBuffer; import java.util.Random; import java.util.Scanner; class SequenceChar{ private static Random rand = new Random(47); private static final char[] capitals = "ABCDE".toCharArray(); char generate(){ char buffer; int idx = 0; buffer = capitals[rand.nextInt(capiticals.length)]; return buffer; } } public class C8 extends SequenceChar implements Readable{ private int i; public C8(int i){ this.i = i; } public int read(CharBuffer ch){ char buffer = generate(); ch.put(buffer); return buffer; } public static void main(String[] args) { Scanner output = new Scanner (new C8(103)); System.out.println("begin"); while(output.hasNext()){ System.out.println(output.next()); } System.out.println("end"); } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36225496
tagged with: java
tagged with: eclipse
has title: How to debug the program that always keeps running in java (eclipse)?
type: Question
has comment: http://stackoverflow.com/comment/36225323
answer count: 1

http://stackoverflow.com/comment/92551840
score: 0
has text: also check `$CATALINA_BASE/bin/setenv.sh`. (`$CATALINA_BASE` versus `$CATALINA_HOME`). In general, the `$CATALINA_BASE` version is not required.
type: Comment
comment on: http://stackoverflow.com/a/23525089
type: AnswerComment

http://stackoverflow.com/q/23459518
tagged with: unit-testing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23459648
tagged with: java
type: Question
score: 2
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23459648
tagged with: assertj
tagged with: generics
has body: For one of my projects, I am attempting to get rid of string-based unit testing; one class I have as a target right now is ParsingResult. I have successfully converted another class with a custom AssertJ assertion, so I am now trying to write a custom assertion class for my next "victim". The class goes like this: public final class ParsingResultAssert&lt;V&gt; extends AbstractAssert&lt;ParsingResultAssert&lt;V&gt;, ParsingResult&lt;V&gt;&gt; { private ParsingResultAssert(final ParsingResult&lt;V&gt; actual) { super(actual, ParsingResult.class); } public static &lt;E&gt; ParsingResultAssert&lt;E&gt; assertResult( final ParsingResult&lt;E&gt; actual) { return new ParsingResultAssert&lt;E&gt;(actual); } } In order to test it, I though I'd try and insert it in a test file I ultimately want to remove: public abstract class ParboiledTest&lt;V&gt; { public class TestResult&lt;V&gt; { public final ParsingResult&lt;V&gt; result; private final ParsingResultAssert&lt;V&gt; resultAssert; public TestResult(ParsingResult&lt;V&gt; result) { this.result = result; resultAssert = ParsingResultAssert.assertResult(result); // HERE } // rest is not relevant At the line marked HERE it fails with this: java.lang.ClassCastException at java.lang.Class.cast(Class.java:2999) at org.assertj.core.api.AbstractAssert.&lt;init&gt;(AbstractAssert.java:63) at com.github.parboiled1.grappa.assertions.ParsingResultAssert.&lt;init&gt;(ParsingResultAssert.java:13) at com.github.parboiled1.grappa.assertions.ParsingResultAssert.assertResult(ParsingResultAssert.java:19) at org.parboiled.test.ParboiledTest$TestResult.&lt;init&gt;(ParboiledTest.java:42) [...] The last line of the stacktrace is this line: resultAssert = ParsingResultAssert.assertResult(result); And org.assertj.core.api.AbstractAssert.&lt;init&gt;(AbstractAssert.java:63) is this: // we prefer not to use Class&lt;? extends S&gt; selfType because it would force inherited // constructor to cast with a compiler warning // let's keep compiler warni…
upvote count: 2
tagged with: classcastexception
has title: Generics and ClassCastException: why do I get this exception, how do I "work around" it?

http://stackoverflow.com/comment/35999444
score: 0
type: Comment
type: QuestionComment
has text: If I'm understanding you correctly, I think using the `sp_executesql` stored procedure would be helpful: http://stackoverflow.com/a/5139825/926713
comment on: http://stackoverflow.com/q/23477126

http://stackoverflow.com/q/23583837
tagged with: android
score: 2
type: AnsweredQuestion
type: Question
tagged with: nested-class
has body: I have a couple of questions from the following code snippet: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // creating LinearLayout LinearLayout linLayout = new LinearLayout(this); //****QUESTION 2********* // specifying vertical orientation linLayout.setOrientation(LinearLayout.VERTICAL); // creating LayoutParams LayoutParams linLayoutParam = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); //*****QUESTION 1*** // set LinearLayout as a root element of the screen setContentView(linLayout, linLayoutParam); } The base class is ViewGroup.LayoutParams, that is LayoutParams is a nested class of ViewGroup. I had also read that it is a static nested class. So why don't we refer to it using the outer class' name and dot notation: ViewGroup.LayoutParams linLayoutParam = new ViewGroup.Layout(...); In the following statement, what object is "this"? In the Java programming language, the this keyword in a method refers to the current object, i.e. the object to which this method belongs. But we are not explicitly calling (using an object) the onCreate() here in Android. LinearLayout linLayout = new LinearLayout(this);
has title: Creating Layout Programmatically- Two Basic Questions
tagged with: layoutparams
tagged with: java
upvote count: 2
accepted answer: http://stackoverflow.com/a/23583974
tagged with: this
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23583974

http://stackoverflow.com/comment/36183944
type: QuestionComment
comment on: http://stackoverflow.com/q/23577183
has text: actually in my program I wont be using the output in System.out.println, rather I have to pass it to JAXRS. If I store the variable as String, in the REST response it shows as distance:"33,644.234". I was looking for an way if I can make it distance: 33,644.234
score: 0
type: Comment

http://stackoverflow.com/a/23596517
has comment: http://stackoverflow.com/comment/36219814
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36219690
has body: Change this <action android:name="android.intent.action.lAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" /> to The same for all others except MainActivity which should probably be the Launcher Activity http://developer.android.com/guide/components/intents-filters.html Explicit intents specify the component to start by name (the fully-qualified class name). You'll typically use an explicit intent to start a component in your own app, because you know the class name of the activity or service you want to start. For example, start a new activity in response to a user action or start a service to download a file in the background. You don't need intent-filter. You can use Explicit Intents
has comment: http://stackoverflow.com/comment/36219709
downvote count: 0
answers question: http://stackoverflow.com/q/23596477

http://stackoverflow.com/a/23463932
answers question: http://stackoverflow.com/q/23463097
has body: I believe that I may need to write a custom TableModelListener... Check out the Table Cell Listener. It is very similar to a TableModelListener, but you do need to specify the JTable when creating the TableCellListener, so you do have access to the table when a value is changed.
type: Answer
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/23498638
score: 0
has title: How to send mouse coordinate using TCP socket
answer count: 1
has comment: http://stackoverflow.com/comment/36036273
tagged with: sockets
has answer: http://stackoverflow.com/a/23498778
type: AnsweredQuestion
tagged with: tcp
tagged with: java
type: Question
has body: I want to send mouse coordinate to android application using TCP socket.which is the simplest method to do this??should i send one by one or can i send both coordinate in single packet.
accepted answer: http://stackoverflow.com/a/23498778

http://stackoverflow.com/a/23498600
has body: for (int i=12; i&gt;=1; i--) { String month; if (i&lt;10) month= "0" + i; else month= "" + i; //You might want to do something with the variable "month" }
has comment: http://stackoverflow.com/comment/36039988
answers question: http://stackoverflow.com/q/23498499
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36036276
upvote count: 1

http://stackoverflow.com/comment/36290119
comment on: http://stackoverflow.com/q/23595197
type: Comment
type: QuestionComment
has text: Yes they fixed in latest update!
score: 0

http://stackoverflow.com/comment/36079576
score: 0
type: Comment
type: QuestionComment
has text: Step by step debugging will help you out here. On a side note, use @UserName when replying to someone's comment if you want them to be notified of it.
comment on: http://stackoverflow.com/q/23520883

http://stackoverflow.com/comment/36102810
type: AnswerComment
comment on: http://stackoverflow.com/a/23533742
type: Comment
has text: the mGray instead of grayMatImage was a typing mistake when cutting and pasting the code into this quesion. I corrected that In the question
score: 0

http://stackoverflow.com/comment/36459473
type: Comment
comment on: http://stackoverflow.com/a/23656361
has text: Thanks for this. I can see that having a separate native app and offline web app probably won't work, and I should use webviews within a native app instead. But in that case why use the IDB at all? Won't it be better to do all the data storage work in the native app?
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36068477
has text: Well you want to count the occurance of a word, you just have to change the word you're searching for in my example.
comment on: http://stackoverflow.com/a/23516196
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36124880
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23544875
has text: In my experience this works for activities but if you open a dialog it will not.
type: Comment

http://stackoverflow.com/a/23573010
has comment: http://stackoverflow.com/comment/36206806
has body: It doesn't work because self invocations are not intercepted. To make it work extract getComplexObjectFromDB method to separated Spring bean and call it in your test using this bean: myBean.getComplexObjectFromDB.
score: 1
has comment: http://stackoverflow.com/comment/36206674
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23567680
type: Answer
has comment: http://stackoverflow.com/comment/36189200
answers question: http://stackoverflow.com/q/23567680

http://stackoverflow.com/comment/36244000
score: 3
comment on: http://stackoverflow.com/q/23608885
type: Comment
type: QuestionComment
has text: @Juvanis: notice that each enum instance has it own unique name so I don't consider it as a violation against the idioms of enums. In my case, instances of MyEnum acts as keys to a map which keys I want also to output to external target. These output values happens to be same in some cases according to the specification.

http://stackoverflow.com/comment/35997880
has text: You don't return `so_far` or `rest`, so they lose scope when `permutate` finishes. What did you think would happen?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23477938
type: QuestionComment

http://stackoverflow.com/a/23504223
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23476452
upvote count: 1
has body: You might use profiles. Unfortunately filters aren't allowed inside profile, so you could use the following workaround: Outside profiles write: src/${switch}/filters/filter.properties In a main profile write: main src/main/resources true in a test profile write: test true src/test/resources Finally run: mvn install -Pmain or: mvn install -Ptest
type: Answer

http://stackoverflow.com/q/23576608
score: 0
has answer: http://stackoverflow.com/a/23576896
has comment: http://stackoverflow.com/comment/36183015
has title: JSP save "rendered" image as
has comment: http://stackoverflow.com/comment/36182660
has comment: http://stackoverflow.com/comment/36183234
type: AnsweredQuestion
tagged with: java
has body: I have a servlet that generate charts, based on given parameters. I need to be able to save those charts in the server as a regular image: myImage.png for example. These charts are created with a code like this: http://127.0.0.1:8080/servlet/graficadorPS?type=area&amp;val1=32.0|32.0|38.0|92.0&amp;cat1=y|y|y|y&amp;eje1=D|I|S|C&amp;titulo=HF&amp;ancho=130&amp;alto=260 so, the image "per se" doesn't exist anywhere. Is there a way to do this??
accepted answer: http://stackoverflow.com/a/23576896
type: Question
answer count: 1
tagged with: jsp
tagged with: jquery
tagged with: servlets

http://stackoverflow.com/q/23604775
score: 0
tagged with: jsoup
answer count: 1
tagged with: http://stackoverflow.com/tag/html
has body: I want to extract data from one div class, but it is showing the whole string where I want to get data items one by one. Document doc = Jsoup.parse(get_html); String Title = doc.getElementsByClass("jTit").text(); String CoName = doc.getElementsByClass("coName").text(); System.out.println(Title); System.out.println(CoName);
has answer: http://stackoverflow.com/a/23605449
has comment: http://stackoverflow.com/comment/36234757
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23605449
tagged with: java
type: Question
has title: Extracting data of an Element via JSOUP

http://stackoverflow.com/comment/36110636
has text: you should not insert the whole string just once but multiple inserts of fragments each with own set. Or use insertString() just once and color it fragment by fragment using setCharacterAttributes(). And then call setDocument() (not setText())
comment on: http://stackoverflow.com/a/23534419
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/125789967
type: Comment
score: 1
comment on: http://stackoverflow.com/a/48425422
type: AnswerComment
has text: Thank You for the explanation.. So `TreeSet` breaks the `Set` contract because it secretly prohibits duplicates (as according to you, `compareTo` returning 0 for identical objects) even when we not override `equals` method in our Foo,Bar classes.

http://stackoverflow.com/comment/36241244
type: Comment
score: 2
has text: A lot of code? No source? Come on - How were you going to implement a fix? What's the reason for this question? Your looking for root-cause with your hands tied. Not possible.
comment on: http://stackoverflow.com/q/23539174
type: QuestionComment

http://stackoverflow.com/q/23517699
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: java
tagged with: stack-trace
type: Question
tagged with: testing
has title: How to change Play Framework 2 "test" settings to show complete stacktraces?
has answer: http://stackoverflow.com/a/25620315
possible better answer: http://stackoverflow.com/a/23527569
has answer: http://stackoverflow.com/a/23527569
accepted answer: http://stackoverflow.com/a/25620315
answer count: 2
tagged with: playframework
downvote count: 0
favorite count: 0
upvote count: 8
has body: I am using Java in Play framework and I have some tests (functional tests) that are passed when I run them through my IDE (IntelliJ) but failed when I run the tests through console. My problems is that the stack traces that are shown in the test logs are only 2 lines and I need the complete stack trace to see what is going on in there, I have tried any combination of settings mentioned here: spec2 settings both through putting them in build.sbt or providing them in the command line. It seems that there is no effect! Here is my build.sbt: version := "1.0-SNAPSHOT" libraryDependencies ++= Seq( javaJdbc, javaEbean, cache, filters ) logBuffered in Test := false testOptions += Tests.Argument(TestFrameworks.JUnit, "-v") testOptions += Tests.Argument("fullStackTrace","true") traceLevel := 50 Can someone help me please? I am using Typesafe activator (play 2.2.2). Thanks
score: 8

http://stackoverflow.com/q/23522156
linked to: http://stackoverflow.com/q/326390
type: UnansweredQuestion
has title: Haskell complete text file indexer
upvote count: 1
tagged with: recursion
has answer: http://stackoverflow.com/a/23522658
tagged with: java
tagged with: haskell
type: Question
has answer: http://stackoverflow.com/a/23522885
answer count: 2
downvote count: 0
score: 1
favorite count: 0
has body: Upon seeing a post earlier about text file indexing, i became curious as I'm currently learning to use Haskell (which isn't going well) as to if its possible to achieve the same goal easily in Haskell: How do I create a Java string from the contents of a file? The objective of the class is to read a file, alphabetically order the words within the file and display the line numbers these words appear on. Would the function in Haskell be able to be built in a similar approach to this?

http://stackoverflow.com/q/23473931
score: 0
answer count: 1
has title: How to highlight duplicate values in an Excel sheet
type: AnsweredQuestion
has body: This is my piece of code , but the problem is the it does not highlight the particular duplicate value , it's highlighting all the values if it finds the duplicate value in the cell at A5 and A6 but if I do changes at other cell like at A8 and A10 it does not highlight in Red colour. This is the code: HSSFSheetConditionalFormatting mycf = new_hire.getSheetConditionalFormatting(); HSSFConditionalFormattingRule rule = mycf.createConditionalFormattingRule("COUNTIF($A$5:$A$500,A5)&gt;1"); HSSFFontFormatting mypattern = rule.createFontFormatting(); mypattern.setFontStyle(false, true); mypattern.setFontColorIndex(IndexedColors.RED.getIndex()); CellRangeAddress[] range = { CellRangeAddress.valueOf("A5:A500") }; mycf.addConditionalFormatting(range,rule);
tagged with: apache-poi
has answer: http://stackoverflow.com/a/23517871
accepted answer: http://stackoverflow.com/a/23517871
type: Question
tagged with: java
tagged with: servlets

http://stackoverflow.com/q/23612854
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/64263467
has comment: http://stackoverflow.com/comment/36250110
type: Question
score: 5
has answer: http://stackoverflow.com/a/64263467
accepted answer: http://stackoverflow.com/a/23614383
has comment: http://stackoverflow.com/comment/36250194
has body: I'm currently trying to build an application with JavaFX 8, but I can't get uncaught exception handling to work. Due to this post (https://bugs.openjdk.java.net/browse/JDK-8100937) it should be fixed / implemented with JavaFX 8 (Lombard), but I can't find anything on the net... I don't want to go the hackish way, may you give me a hint where to search for further information?
answer count: 2
tagged with: javafx-8
has answer: http://stackoverflow.com/a/23614383
favorite count: 0
has title: JavaFX 8 (Lombard) global exception handling
upvote count: 5
tagged with: exception
type: AnsweredQuestion

http://stackoverflow.com/comment/36237192
type: Comment
type: QuestionComment
has text: This is the class that loads a jpg file n creates an instance of an object of IplImage and detects faces. (This code works) Now i want to integrate this code with my GUI but the problem is my gui accepts and works on BufferedImage. I need to know for calling the method <detect(IplImage src)> here, that takes in parameters as IplImage, on my gui which works on BufferedImage, so needed to convert my BufferedImage into IplImage first and then pass the Image into this method. and i have no clue on how to convert it.
comment on: http://stackoverflow.com/q/23597104
score: 0

http://stackoverflow.com/comment/36327375
type: Comment
type: QuestionComment
has text: Don't forget to close your input streams when you load your keystores.
score: 0
comment on: http://stackoverflow.com/q/23596093

http://stackoverflow.com/comment/36055908
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23508996
has text: Can you please add more details so your question is bit more clear?
score: 0

http://stackoverflow.com/comment/36113710
has text: yes i have tried to use Gridlayout and BorderLayout.NORTH and other thing .can you post the comment showing me how to use getPreferredSize and setBounds(left,top,width,height)?!
comment on: http://stackoverflow.com/q/23539653
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36212074
type: Comment
has text: Never mind, the error way me misspelling something, so there is no errors, and it works fine. Thanks again!
type: AnswerComment
comment on: http://stackoverflow.com/a/23592451
score: 0

http://stackoverflow.com/a/23581307
type: Answer
answers question: http://stackoverflow.com/q/23580284
has body: package name is user defined its what you give, Ex: package test; import package is used to get already predefined packages in java to be used in your current package Ex: if you want to use "util" package in your test package, package test; java.util.Scanner; Here util is java predefined package and Scanner is the class present in util package.
has comment: http://stackoverflow.com/comment/36192053
score: 0

http://stackoverflow.com/comment/36099095
comment on: http://stackoverflow.com/q/23530773
score: 0
type: QuestionComment
type: Comment
has text: I did some tests. It appears the order in HTML matches the order in the servlet. However, I am not sure whether there is specs for this. Otherwise, the results may vary with the servlet container.

http://stackoverflow.com/a/23534508
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23534439
has body: From the javadocs: Class Exception java.lang.Object | -&gt;java.lang.Throwable | -&gt;java.lang.Exception Hope this clears the doubt.
downvote count: 0

http://stackoverflow.com/comment/36278214
score: 1
comment on: http://stackoverflow.com/a/23625160
has text: a version without recursion https://sites.google.com/site/nguyenthevinhbk/home/file-finder
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36578811
comment on: http://stackoverflow.com/a/23591222
score: 0
type: Comment
has text: Thanks, I got it with : see below @All : With this post : http://stackoverflow.com/questions/15945545/writting-an-image-using-ndefmessage
type: AnswerComment

http://stackoverflow.com/q/23606908
answer count: 1
downvote count: 0
favorite count: 0
has title: How to know SQLException is due to database connection failure
tagged with: exception
has comment: http://stackoverflow.com/comment/36238703
type: UnansweredQuestion
upvote count: 1
has body: In my java application, log file have large number of SQLException traces due to database connection failure. which try after each 5 seconds. So I have to know that SQLException goes to log is either due to database connection failure or due to some miss happening in sql query. So that if database connection failure occure in between and try to log more then three or 4 time then I can limit this to write after 1 minute.Log method is as below public static synchronized void log( Exception e, boolean forcePrint) { if(sqlExceptionLogTime!=null && e instanceof SQLException &&((new Date()).getTime()-sqlExceptionLogTime.getTime())&lt;60000){ // do nothing }else if ( (forcePrint || debugFlag) && (logStream != null)) { e.printStackTrace(logStream); logStream.flush(); logcount++; if(e instanceof SQLException){ sqlExceptionLogTime = new Date(); } } } In this sqlExceptionLogTime is a static date type variable
has comment: http://stackoverflow.com/comment/36238932
has comment: http://stackoverflow.com/comment/36238761
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/12725041
has answer: http://stackoverflow.com/a/23607060
type: Question

http://stackoverflow.com/comment/80764779
comment on: http://stackoverflow.com/a/23586895
type: Comment
score: 1
has text: ZipInputStream has skip implemented, but getNextEntry does not read from where you skipped .
type: AnswerComment

http://stackoverflow.com/a/36970055
has comment: http://stackoverflow.com/comment/61495818
answers question: http://stackoverflow.com/q/23475420
type: Answer
has body: OUTPUT output Default temperatures: 0.0C OR 32.0F 1.Convert Celcius to Fareiheit 2.Convert Fareiheit to Celcius 3.Update default temperature 1 Enter temperature in Celcius to convert into Farenheit 60 60.0C = 92.0F Default temperatures: 0.0C OR 32.0F 1.Convert Celcius to Fareiheit 2.Convert Fareiheit to Celcius 3.Update default temperature 2 Enter temperature in Farenheit to convert into Celcius -10 -10.0F = -23.333333333333336C Default temperatures: 0.0C OR 32.0F 1.Convert Celcius to Fareiheit 2.Convert Fareiheit to Celcius 3.Update default temperature 3 Enter temperature in celcius 25 Default temperatures: 25.0C OR 57.0F 1.Convert Celcius to Fareiheit 2.Convert Fareiheit to Celcius 3.Update default temperature Temperature.java public interface Temperature { public double getTempInFarenheit(double celcius); public double getTempInCelcius(double farenheit); public double getCurrentTemp(); public double setDefaultTemp(double defaultCelcius); } TemperatureImpl.java public class TemperatureImpl implements Temperature { private double defaultTemp=0.0; public double Temperature(double defaultTemp){ return this.defaultTemp=defaultTemp; } @Override public double getTempInFarenheit(double celcius) { return ((double)(9/5)*(celcius+32.0)); } @Override public double getTempInCelcius(double farenheit) { return ((double)5/9*(farenheit-32.0)); } @Override public double getCurrentTemp() { return defaultTemp; } @Override public double setDefaultTemp(double defaultCelcius){ return this.defaultTemp = defaultCelcius; } } Main.java import java.util.Scanner; public class Main { public static void main(String[] args) { TemperatureImpl temp = new TemperatureImpl(); while(true){ System.out.println("Default temperatures: "+temp.getCurrentTemp()+"C OR "+temp.getTempInFarenheit(temp.getCurrentTemp())+"F"); System.out.println("1.Convert Celcius to Fareiheit"); System.out.println("2.Convert Fareiheit to Celcius"); System.out.println("3.Update default temperature"); Scanner sc = new Scanner(Syst…
score: 0

http://stackoverflow.com/comment/36112548
has text: Thanks ..I have pasted my jquerycode .Please see. My java code is very vast , i can not paste that sorry. BUT to be specific it it getting the request paramters which u saw in jquery code and than updating the map with those values and than putting that map in session.setAttribute("map",map) and send response back. This process repeats until user wants to manipulate the data . Once user done he will click on submit button.
type: Comment
comment on: http://stackoverflow.com/a/23539092
score: 0
type: AnswerComment

http://stackoverflow.com/q/23494273
tagged with: java
has body: We have collection 'message' with following fields _id | messageId | chainId | createOn 1 | 1 | A | 155 2 | 2 | A | 185 3 | 3 | A | 225 4 | 4 | B | 226 5 | 5 | C | 228 6 | 6 | B | 300 We want to select all fields of document with following criteria distict by field 'chainId' order(sort) by 'createdOn' in desc order so, the expected result is _id | messageId | chainId | createOn 3 | 3 | A | 225 5 | 5 | C | 228 6 | 6 | B | 300 We are using spring-data in our java application. I tried to go with different approaches, nothing helped me so far. Is it possible to achieve above with single query?
tagged with: mapreduce
has title: Mongodb select all fields group by one field and sort by another field
has answer: http://stackoverflow.com/a/23583566
score: 9
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/45712318
has answer: http://stackoverflow.com/a/38518832
accepted answer: http://stackoverflow.com/a/23494458
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/23583566
upvote count: 9
has answer: http://stackoverflow.com/a/23494458
tagged with: aggregation-framework
tagged with: spring-data-mongodb
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/23505142
score: 0
has body: Change this: while (findBinName = false) to while (findBinName == false) or even better to while (!findBinName) In the former version, the value false is assigned to findBinName, then the value of findBinName is tested but it's already false. So your loop never executes.
has comment: http://stackoverflow.com/comment/36049053
type: Answer
answers question: http://stackoverflow.com/q/23505107

http://stackoverflow.com/comment/36147011
type: Comment
score: 0
has text: The order columns is set only if you save the RecommendationInstance within your list, not if stored standalone.
comment on: http://stackoverflow.com/q/23545352
type: QuestionComment

http://stackoverflow.com/q/23610488
type: Question
tagged with: arraylist
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36245301
has title: ArrayList elements aren't printed
type: UnansweredQuestion
tagged with: tostring
tagged with: oop
tagged with: java
has body: I'm pretty new to java and what i'm trying to do is make a model for a catalog storing available products in a computer parts shop, using collections. My instructor asked for one instance of each product in the catalog. This is what i came up with: import java.util.*; public class AvailablesCatalog { public AvailablesCatalog(List cat1) { cat1 = new ArrayList(); Motherboard item1 = new Motherboard("MD4652", 1995, "Lenovo", 100.50, "Intel", 32, 5); CPU item2 = new CPU("MD4652", 1995, "Lenovo", 100.50, 2.9, 6); Graphics item3 = new Graphics("MD4652", 1995, "Lenovo", 100.50, "AMD", 6); RAM item4 = new RAM("MD4652", 1995, "Lenovo", 100.50, "DDR2", 4, 1600); HD item5 = new HD("MD4652", 1995, "Lenovo", 100.50, "SSD", 2.5, 750); Monitor item6 = new Monitor("MD4652", 1995, "Lenovo", 100.50, "LED", 17.5, "1920x1080", "HDMI"); Keyboard item7 = new Keyboard("MD4652", 1995, "Lenovo", 100.50, "Wireless"); Mouse item8 = new Mouse("MD4652", 1995, "Lenovo", 100.50, "Laser", "Wireless"); Printer item9 = new Printer("MD4652", 1995, "Lenovo", 100.50, "Laser", "Colored"); cat1.add(item1); cat1.add(item2); cat1.add(item3); cat1.add(item4); cat1.add(item5); cat1.add(item6); cat1.add(item7); cat1.add(item8); cat1.add(item9); } public String toString(List cat1, int i) { for(i=0; i&lt;cat1.size(); i++) { System.out.println(cat1.get(i).toString()); } return "----------------------------------------------------"; } } Now, through the shop's mainApp that i'm using to to print the catalog, i have stored an instance of the AvailablesCatalog object type in a variable called av. This is the mainApp: public class mainApp { public static void main(String[] args){ /* Variables for Menu System and Sub Menu System */ int MainMenu; String SubMenu; String ReturnToMenu; String SubMenuReturnToMenu; List cat1 = new ArrayList(); AvailablesCatalog av = new AvailablesCatalog(cat1); /* Displays menu system to console */ System.out.println("..............MENU..............."); System.out.println("..............1 …
tagged with: collections
has answer: http://stackoverflow.com/a/23610567

http://stackoverflow.com/comment/35992126
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23475105
has text: So, your basic question is: Did exists some library which can do the thing? Am I right?
score: 0

http://stackoverflow.com/comment/36115323
type: Comment
score: 1
has text: Can you post the full stack trace please?
comment on: http://stackoverflow.com/q/23541008
type: QuestionComment

http://stackoverflow.com/comment/36012550
has text: Possible duplicate : Have you checked the answer to [this question](http://stackoverflow.com/questions/999172/how-to-parse-a-date?rq=1)?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23485550
type: QuestionComment

http://stackoverflow.com/comment/36236609
type: Comment
comment on: http://stackoverflow.com/q/23605707
type: QuestionComment
has text: What says it can't find the symbol of what? I didn't know Java *had* symbols.
score: 0

http://stackoverflow.com/comment/36179537
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23574984
has text: While many do [consider it to be good practice](http://programmers.stackexchange.com/questions/16528/single-statement-if-block-braces-or-no), it doesn't make any functional difference here.

http://stackoverflow.com/comment/36246036
has text: Thank you for the answer. As I thought I am not using the correct data structure - I will just put the four values that I need to compare with other objects' values into an Array or Array List and will make a class which creates objects of this type when needed.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23610109
type: Comment

http://stackoverflow.com/q/23516624
score: 0
answer count: 1
has title: upgrading of Birt to 4.3.2 --->org.eclipse.birt.report.exception.ViewerException: Fatal error occurred when try to startup report engine
type: AnsweredQuestion
tagged with: birt
tagged with: java
type: Question
has body: I am working with BIRT from 2 months, while upgrading from Birt3.2.20 to Birt4.3.2 I have faced bellow exception from Tomcat 7 in my J2EE application, to upgrade from Birt3.2.20 to Birt4.3.2 I came to know just replacing the old jar files in "Plugins" folder of application with new jar files from birt-runtime-4_3_2\ReportEngine\lib folder jar files. After doing the same I have restarted my Tomcat 7 which throws bellow error INFO: Deploying web application archive D:\Suneel\apache-tomcat-7\webapps\CADBReports.war May 07, 2014 4:30:14 PM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://www.eclipse.org/birt/taglibs/birt.tld is already defined org.eclipse.birt.report.exception.ViewerException: Fatal error occurred when try to startup report engine. at org.eclipse.birt.report.service.ReportEngineService.setEngineContext(ReportEngineService.java:328) at org.eclipse.birt.report.service.BirtViewerReportService.setContext(BirtViewerReportService.java:1022) at org.eclipse.birt.report.listener.ViewerServletContextListener.contextInitialized(ViewerServletContextListener.java:62) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4797) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5291) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) 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:633) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655) 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$Wo…
has answer: http://stackoverflow.com/a/23647344
accepted answer: http://stackoverflow.com/a/23647344
tagged with: eclipse

http://stackoverflow.com/comment/36054791
comment on: http://stackoverflow.com/a/23508395
score: 0
type: AnswerComment
has text: No, it matches strings that have a letter anywhere before a number or a number anywhere before a letter. I didn't use ^ or $ so it is not anchored to the start or end of the source string.
type: Comment

http://stackoverflow.com/q/23573689
answer count: 2
has answer: http://stackoverflow.com/a/23574194
tagged with: vector
tagged with: arrays
tagged with: data-structures
has body: Is it possible in Java to parametrize a data structure so that it can only hold arrays of a certain length. I am writing a program that deals with 3d objects and I want a list that will only hold vectors stored as 3 doubles in an array or double[3]. The code below wont compile. Vector&lt;double[3]&gt; myList = new Vector&lt;double[3]&gt;(); Is there a way to restrict the size of an array stored in a data structure?
downvote count: 0
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/23573734
score: 2
type: AnsweredQuestion
has title: Parametrize a data structure to hold arrays of a specific size?
tagged with: java
accepted answer: http://stackoverflow.com/a/23573734
type: Question
possible better answer: http://stackoverflow.com/a/23574194

http://stackoverflow.com/comment/36202980
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23587528
type: Comment
has text: Can't get it to work. When I try to do like them, I still get error.

http://stackoverflow.com/q/23469695
score: 0
has body: I am new in spring, and I try to use it with hibernate to create tables from the entity class but it never works, here is my spring-cinfig.xml : ' <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://localhost:8889/testeleve"/> <property name="username" value="root"/> <property name="password" value="yassine"/> <property name="showSql" value="true"/> <property name="generateDdl" value="true"/> <property name="database" value="MYSQL"/> <property name="dataSource" ref="dataSource"/> <property name="jpaVendorAdapter" ref="jpaVendorAdapter"/> <property name="packagesToScan" value="Class"/> ' and here is my test class : ' @Autowired private static CrudRepository repository; public static void main(String[] args) { AbstractApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml"); createEleve(22, "Saint", "Peter"); createEleve(23, "Jack", " Dorsey"); createEleve(24, "Sam", "Fox"); }' and here is the exception: Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [TestEleve2/resources/spring-config.xml]; nested exception is java.io.FileNotFoundException: class path resource [TestEleve2/resources/spring-config.xml] cannot be opened because it does not exist
has comment: http://stackoverflow.com/comment/35983198
has answer: http://stackoverflow.com/a/23470482
has comment: http://stackoverflow.com/comment/35982022
answer count: 3
tagged with: spring
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23469846
tagged with: java
tagged with: hibernate
has title: hibernate spring class path not found
has comment: http://stackoverflow.com/comment/35983090
type: Question
has answer: http://stackoverflow.com/a/23470249

http://stackoverflow.com/a/56977276
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23534528
has body: package StringProgram; public class AddingDaystoDate { public static String addDays(String date, int n) { int[] daysInNormalYear={31,28,31,30,31,30,31,31,30,31,30,31}; int[] daysInLeapYear={31,29,31,30,31,30,31,31,30,31,30,31}; String[] sArray=date.split("/"); int dd=Integer.valueOf(sArray[0]); int mm=Integer.valueOf(sArray[1]); int yy=Integer.valueOf(sArray[2]); String updatedDate=""; if(calculateLeapYear(yy)==true) { int maxDayinMonth=daysInLeapYear[mm-1]; dd=dd+n; if(dd&gt;maxDayinMonth) { dd=dd-maxDayinMonth; mm++; if(mm&gt;12) { yy++; mm=1; } } updatedDate=new String(""+dd+"/"+mm+"/"+yy); } else { int maxDayinMonth=daysInNormalYear[mm-1]; dd=dd+n; if(dd&gt;maxDayinMonth) { dd=dd-maxDayinMonth; mm++; if(mm&gt;12) { yy++; mm=1; } } updatedDate=new String(""+dd+"/"+mm+"/"+yy); } return updatedDate; } public static boolean calculateLeapYear(int year) { if(year%4==0) { if(year%100==0) { if(year%400==0) { return true; } } return false; } return false; } public static void main(String[] args) { String date="27/12/2014"; String s=addDays(date,5); System.out.print(s); } }

http://stackoverflow.com/comment/36209684
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23591490
score: 0
has text: first i run JSP page and then it requests a servlet

http://stackoverflow.com/q/23488927
favorite count: 0
has body: As it turns out Jackson does not do stable JSON object comparison contrary to this question. So I was wondering if GSON has stable comparison of JSON objects. (without having to override equals/implement one's own comparator)
type: UnansweredQuestion
has title: Stable/Terministic comparison of JSON objects in Jackson and GSON
tagged with: gson
upvote count: 1
type: Question
score: 1
has answer: http://stackoverflow.com/a/23489038
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/2253750
tagged with: jackson

http://stackoverflow.com/comment/36092236
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23526638
has text: I just posted my pom.xml file

http://stackoverflow.com/q/23608166
downvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/12351570
has title: Undo method for a paint program
score: 1
tagged with: java
duplicate of: http://stackoverflow.com/q/12351570
has answer: http://stackoverflow.com/a/23610025
type: Question
tagged with: graphics
has body: I am trying to create a little drawing pad in one of my programs. This is the class: class DrawPad extends JComponent { Image image; Graphics2D graphics; int currentX, currentY, oldX, oldY; public DrawPad() { setDoubleBuffered(false); addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { oldX = e.getX(); oldY = e.getY(); } }); addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent e) { currentX = e.getX(); currentY = e.getY(); if (graphics != null) { graphics.drawLine(oldX, oldY, currentX, currentY); } repaint(); oldX = currentX; oldY = currentY; } }); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); if (image == null) { image = createImage(getSize().width, getSize().height); graphics = (Graphics2D) image.getGraphics(); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); clear(); } g.drawImage(image, 0, 0, null); } public void clear() { graphics.setPaint(Color.white); graphics.fillRect(0, 0, getSize().width, getSize().height); graphics.setPaint(Color.black); repaint(); } public void undo() { // restore previous graphics here } public void red() { graphics.setPaint(Color.red); repaint(); } public void black() { graphics.setPaint(Color.black); repaint(); } public void magenta() { graphics.setPaint(Color.magenta); repaint(); } public void blue() { graphics.setPaint(Color.blue); repaint(); } public void green() { graphics.setPaint(Color.green); repaint(); } } I add it to a JPanel. The drawing itself works fine. Now I would like to implement an undo method. I thought I could just copy the current graphics2D object into a backup variable and on click of the undo-button I would replace the current object with the backup object. Unfortunately that didn't work. I tried the following: In the mousePressed method I assigned the current value of graphics to the backup variable. addMouseListener(new MouseAdapter() { @Override public v…
tagged with: awt
has comment: http://stackoverflow.com/comment/36241696
answer count: 1
accepted answer: http://stackoverflow.com/a/23610025
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/23582689
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: tabAreaLabel.setBounds(tabArea.getLocation().getX(), tabArea.getLocation().getY(), 250, 338); The size of the tabAreaLabel is (250, 338). short[] xLocation = { 549, 574, 605, 635, 673, 704, 730, 577, 605, 637, 674, 705, 732 }; The x location of all the labels is greater than 250, so they will NOT fit on the label. Fix your coordinates or fix the size of the tabAreaLabel. Generally you should NOT hardcode the size of an image. Instead you can use something like: tabAreaLabel.setSize( tabAreaLabel.getPreferredSize() ); tabAreaLabel.setLocation(...); Also, don't use a short[] array. Use an int[] array. Same with you for loop: for (byte b = 0; b &lt; 13; b++) { don't use byte, just use int.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23581563
answers question: http://stackoverflow.com/q/23581563

http://stackoverflow.com/a/23516097
has comment: http://stackoverflow.com/comment/36068504
has body: No way around it, I'm afraid. Comparing data sets to see if they are identical demands looking at all elements, by definition. On a side note, comparing 1000 values is nothing even on relatively old hardware. You can do it thousands of time per second.
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/36068347
answers question: http://stackoverflow.com/q/23516030

http://stackoverflow.com/comment/36019962
type: QuestionComment
type: Comment
has text: Well `AbstractBeanDefinition` doesn't have a `addPropertyReference` method. The `BeanDefinitionBuilder` however does have it, so not sure why you are downcasting to an `AbstractBeanDefinition`.
score: 0
comment on: http://stackoverflow.com/q/23489928

http://stackoverflow.com/a/23614783
answers question: http://stackoverflow.com/q/23614419
has body: If I understand your question, you could do it with something like this - Calendar c = Calendar.getInstance(); DateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); // <-- Set the timezone on the // DateFormat /* Your input date/time */ c.setTime(new GregorianCalendar(2013, 10, 15, 0, 28, 44).getTime()); System.out.println(formatter.format(c.getTime())); c.setTimeZone(TimeZone.getTimeZone("EST")); System.out.println(c.getTime()); The output of this code is Fri Nov 15 05:28:44 UTC 2013 Fri Nov 15 00:28:44 EST 2013
upvote count: 1
has comment: http://stackoverflow.com/comment/120611766
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/120614624

http://stackoverflow.com/q/23587057
tagged with: dropbox
type: UnansweredQuestion
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/24093875
tagged with: account
score: 0
has title: Android: Link to dropbox and Login to account programmatically
answer count: 1
tagged with: java
tagged with: authentication
has body: I am able to follow these instructions to set up dropbox for an android app. However, I want to able able to log in to the desired account programmatically. The instruction startlink like this to prompt for login. mAccountManager.startLink((Activity)MyActivity.this, REQUEST_LINK_TO_DBX); How can I log in programmatically so that the user is not prompted?

http://stackoverflow.com/comment/35999419
has text: Although I am not familiar with Angular, I am willing to bet that your save method there is not posting form data, but something else (perhaps JSON), while the Spring Controller is clearly setup to accept form parameters
type: Comment
comment on: http://stackoverflow.com/q/23463809
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36123015
has text: And replace listeners with adapters.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23545045
score: 1

http://stackoverflow.com/comment/36131593
score: 0
has text: post db.getAllRecords() too
type: QuestionComment
comment on: http://stackoverflow.com/q/23549476
type: Comment

http://stackoverflow.com/a/23544453
type: Answer
has body: Don't reinvent the wheel. Prefer using java.util.LinkedList and add the Student instances in the way you need. This will preserve the order in which you add to the list
answers question: http://stackoverflow.com/q/23544288
has comment: http://stackoverflow.com/comment/36129673
score: 0

http://stackoverflow.com/a/23547545
has comment: http://stackoverflow.com/comment/36131428
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23546761
type: Answer
accepted answer of: http://stackoverflow.com/q/23546761
has body: You have tagged your question as XSLT 2.0, the commercial versions of one of the Java XSLT 2.0 processors, namely Saxon 9, provide http://www.saxonica.com/documentation/index.html#!functions/saxon/string-to-base64Binary. Or which Java XSLT 2.0 processor do you use?
downvote count: 0

http://stackoverflow.com/q/23461128
has answer: http://stackoverflow.com/a/23461143
has answer: http://stackoverflow.com/a/23461212
has body: I have two classes 1 class Runner : instance variables = name , time. 2 class MarathonAdmin I created list -runners- which hold Runner class objects.object's time are random numbers , generated by another method in class MarathonAdmin. now i want to sort list runners by TIME property of Runner objects in such a way that smallest time taken by runner come first and than so on . I tried to get two lists that takes time of runners and reversed one list so that i get different time to compare with each other , but that didnt work , so i need help . I have to compare time with each other . my code written so far is public void sortRunnerList(){ for(Runner nameRunner : runners){ int time1 = nameRunner.getTime(); List&lt;Integer&gt; time1list = new ArrayList&lt;&gt;(); time1list.add(time1); Collections.reverse(time1list); System.out.println( "time for obj1" + time1list); } for(Runner nameRunner : runners){ int time2 = nameRunner.getTime(); List time2list = new ArrayList&lt;>(); time2list.add(time2); //Collections.shuffle(time2list); System.out.println( "time for obj2" + time2list); } } and for compareTo method @Override public int compareTo(Runner anotherRunner) { return this.getTime()-(anotherRunner.getTime()); }
linked to: http://stackoverflow.com/q/2784514
upvote count: 0
type: UnansweredQuestion
score: -3
duplicate of: http://stackoverflow.com/q/2784514
has title: Sort List in java
tagged with: properties
tagged with: object
tagged with: list
tagged with: java
type: Question
answer count: 2
tagged with: sorting
favorite count: 0
downvote count: 3

http://stackoverflow.com/q/23458687
tagged with: java
accepted answer: http://stackoverflow.com/a/23458699
downvote count: 1
type: Question
tagged with: jpanel
has comment: http://stackoverflow.com/comment/35963195
has title: add and remove element to jPanel
answer count: 1
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23458699
tagged with: swing
has body: I have empty jpanel. After button click should add elements to it in loop. My code: radio = new JRadioButton[answerArrayList.size()]; for (int i = 0; i &lt; answerArrayList.size(); i++) { final Answer a = answerArrayList.get(i); radio[i] = new JRadioButton(); radio[i].setText(a.getAnswer()); group.add(radio[i]); aPanel.add(radio[i]); } aPanel.repaint(); But after this action panel is still empty. How I can add items to panel and clear all items from it?
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/q/23547152
has title: Error by SSLServerSocket
type: AnsweredQuestion
has body: I tried to make an Android Server with an SSLServerSocket. I made a keystore and started to make the server. I initialize the server as follows: String keyStoreType = KeyStore.getDefaultType(); KeyStore keyStore = KeyStore.getInstance(keyStoreType); InputStream inputStream = context.getResources().openRawResource(R.raw.server); keyStore.load(inputStream, "passwd".toCharArray()); String keyalg = KeyManagerFactory.getDefaultAlgorithm(); kmf.init(keyStore, "passwd".toCharArray()); KeyManagerFactory kmf = KeyManagerFactory.getInstance(keyalg); SSLContext context = SSLContext.getInstance("TLS"); context.init(kmf.getKeyManagers(), null, null); SSLServerSocket ss = (SSLServerSocket) context.getServerSocketFactory().createServerSocket(); inputStream.close(); //Here comes the error ss.accept(); So if I try to accept clients (without that the client side tried to connect), I get an error. java.net.SocketException: accept failed: EINVAL (Invalid argument) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:110) at java.net.ServerSocket.implAccept(ServerSocket.java:203) at com.android.org.conscrypt.OpenSSLServerSocketImpl.accept(OpenSSLServerSocketImpl.java:184) at de.turtc.util.ServerUtil.run(ServerUtil.java:88) Caused by: libcore.io.ErrnoException: accept failed: EINVAL (Invalid argument) at libcore.io.Posix.accept(Native Method) at libcore.io.BlockGuardOs.accept(BlockGuardOs.java:55) at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:98) Without a SSLServerSocket it works! I dont get any information of this error!
tagged with: java
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23627563
score: 0
tagged with: android
tagged with: serversocket
accepted answer: http://stackoverflow.com/a/23627563

http://stackoverflow.com/comment/36139085
type: Comment
has text: NOw you are storing a reference to entire Tree in function foo() so its not holding a strong refernce to leaf yet
comment on: http://stackoverflow.com/a/23552901
type: AnswerComment
score: 0

http://stackoverflow.com/q/23523169
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/23523185
score: 0
answer count: 1
has body: In a class, I have this line: import javax.swing.*; However on the StyledDocument doc = new DefaultStyledDocument(); Eclipse gives me an error (red line under the text) and offers to import StyledDocument (javax.swing.text) Weird. I imported the entire swing package, why do I also need to import the class specifically?
has comment: http://stackoverflow.com/comment/36082327
has title: Eclipse says I need to import a class, when I already imported it's whole package
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23523185
tagged with: java
tagged with: import
type: Question

http://stackoverflow.com/q/23557293
has answer: http://stackoverflow.com/a/23557558
tagged with: java
has body: Im facing an exception HTTP Status 500 - javax.servlet.ServletException: File &amp;quot;/common/IncludeGoogleKey.jsp&amp;quot; not found Looking that system can not find file "/common/IncludeGoogleKey.jsp" where using statement &lt;jsp:include page="/common/IncludeGoogleKey.jsp" /&gt; to include the file, file is on the same location as mentioned and when i click on the page attribute by pressing the Ctrl key(as using eclipse) IDE takes me to that file it means that file exist on correct location but when i refresh the web page it gives exception. EDIT webapps/AppName/common/IncludeGoogleKey.jsp is the file need to be includ, where webapps/AppName/PVS/P_Search.jsp is the file having the include statement. full trace is May 09, 2014 1:28:12 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [action] in context with path [/appName] threw exception [javax.servlet.ServletException: File &amp;quot;/common/IncludeGoogleKey.jsp&amp;quot; not found] with root cause javax.servlet.ServletException: File &amp;quot;/common/IncludeGoogleKey.jsp&amp;quot; not found at org.apache.jasper.servlet.JspServlet.handleMissingResource(JspServlet.java:412) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:392) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:690) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:599) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:536) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954) at org.apache.jsp.PVS.Partner_005fSearch_jsp._jsp…
type: Question
has comment: http://stackoverflow.com/comment/36146613
has comment: http://stackoverflow.com/comment/36146722
tagged with: struts
accepted answer: http://stackoverflow.com/a/23557558
possible better answer: http://stackoverflow.com/a/26568831
answer count: 3
score: 2
has answer: http://stackoverflow.com/a/26568831
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/56725815
favorite count: 0
has comment: http://stackoverflow.com/comment/36146819
upvote count: 2
has title: HTTP Status 500 - javax.servlet.ServletException file not found
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36156649

http://stackoverflow.com/a/23582518
has comment: http://stackoverflow.com/comment/36193415
type: Answer
answers question: http://stackoverflow.com/q/23582463
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36193031
has body: The code is basically OK. One bug you do have there, though, is initializing the length of somelong with L1. L1 is the number of characters in tekst, so this will result with bunch of unintentional zeroes at the end of your array. The correct size would be the same size as tekstarray. EDIT: As Luiggi Mendoza commented, splitting by "\\s+" instead of " " would resolve any issue with the number being delimited by more than one space. public long[] ConvertStringToLongArray(String tekst) { String[] tekstarray = tekst.split("\\s+"); long[] somelong = new long[teksarray.length]; for (int i = 0; i &lt;= somelong.length; i++) { somelong[i] = Long.parseLong(tekstarray[i]); } return somelong; }
has comment: http://stackoverflow.com/comment/36192978
has comment: http://stackoverflow.com/comment/36193034

http://stackoverflow.com/q/23456503
has title: android 4 : tunneling whole device to a proxy
answer count: 0
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
score: 3
upvote count: 4
favorite count: 0
tagged with: proxy
tagged with: android
has body: (by proxy I mean HTTP proxy) I wanted to make an application which works like psiphon3 in tunneling whole device through proxy without root needed first please tell me how this tunneling method works, then how can I write a program that works like that for example tunneling device on proxy : localhost:8118 if psiphon isn't tunneling device through proxy then how does it work ? just for android 4 (and without root)

http://stackoverflow.com/q/23571624
type: Question
has body: I found a good library that is absolutely needed for my project, but I failed to implement it. https://github.com/mpetazzoni/ttorrent I download the .zip file and in the library section of netbeans I selected the option "Add JAR/Folder". When I add the library folder to the library section, java does not let me import it to the .java file that I'm working on. I mean, java is not "recognising" the library. I also see this library is different from others that I had previously seen. For example, I tried to implement "jsoup.jar" before and I did the same steps and it worked. I don't know why does these library isn't working. If I'm not clear enough at this point, see the image below: I would want to know what I'm doing wrong. Thank you in advance.
upvote count: 1
has title: having an issue at loading a library java
answer count: 1
has answer: http://stackoverflow.com/a/23572269
accepted answer: http://stackoverflow.com/a/23572269
favorite count: 0
type: AnsweredQuestion
tagged with: netbeans
downvote count: 0
score: 1
tagged with: java

opencv
type: Tag
tags question: http://stackoverflow.com/q/23509060
tags question: http://stackoverflow.com/q/23478909
tags question: http://stackoverflow.com/q/23593443
tags question: http://stackoverflow.com/q/23533074
tags question: http://stackoverflow.com/q/23495258
tags question: http://stackoverflow.com/q/23553053
tags question: http://stackoverflow.com/q/23490438
tags question: http://stackoverflow.com/q/23583011
tag name: opencv
tags question: http://stackoverflow.com/q/23470198
tags question: http://stackoverflow.com/q/23608024
tags question: http://stackoverflow.com/q/23482690
tags question: http://stackoverflow.com/q/23520320
tags question: http://stackoverflow.com/q/23455095
tags question: http://stackoverflow.com/q/23507638
tags question: http://stackoverflow.com/q/23567819
tags question: http://stackoverflow.com/q/23562831
tags question: http://stackoverflow.com/q/23516370

http://stackoverflow.com/a/23520586
answers question: http://stackoverflow.com/q/23491944
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
has body: To resize your stage at initialize you can use following code (i assume you use javafx-2?) //stage.setResizable(true); Screen screen = Screen.getPrimary(); Rectangle2D bounds = screen.getVisualBounds(); stage.setX(bounds.getMinX()); stage.setY(bounds.getMinY()); stage.setWidth(bounds.getWidth()); stage.setHeight(bounds.getHeight()); or you can use fullscreen mode: stage.setFullScreen(true);
score: 2
accepted answer of: http://stackoverflow.com/q/23491944

jsse
tags question: http://stackoverflow.com/q/23591513
tags question: http://stackoverflow.com/q/23590216
type: Tag
tags question: http://stackoverflow.com/q/23516609
tag name: jsse
tags question: http://stackoverflow.com/q/23510568

http://stackoverflow.com/a/23590145
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36207358
has body: when I try to enter in variables into VALUES it all falls apart Statement stmt = con.createStatement(); String SQL = "INSERT INTO Workers VALUES (num, fName, lName, jTitle)"; stmt.executeUpdate(SQL); You're not sending any variables. You have num, fName and the other variables but you're sending them as plain text in your SQL statement. You need to pass the values of your variables into your SQL statement. The best approach to do this is using PreparedStatement: String SQL = "INSERT INTO Workers VALUES (?, ?, ?, ?)"; PreparedStatement pstmt = con.prepareStatement(SQL); p.setInt(1, num); p.setString(2, fName); p.setString(3, lName); p.setString(4, jTitle); pstmt.executeUpdate(); pstmt.close(); You may also use the naive approach of concatenating the values of each variable in your SQL statement, but it is unsafe and allows SQL Injection attacks. So the best bet is to use PreparedStatement. More info: Difference between Statement and PreparedStatement
type: Answer
answers question: http://stackoverflow.com/q/23590116
score: 2
accepted answer of: http://stackoverflow.com/q/23590116
downvote count: 0
has comment: http://stackoverflow.com/comment/36207344
upvote count: 2

http://stackoverflow.com/comment/36203629
score: 0
type: Comment
has text: the declaration of woodCounter before the actionPreformed method is the first time woodCounter is delcared (that is inside the Wood class)
comment on: http://stackoverflow.com/a/23588009
type: AnswerComment

http://stackoverflow.com/a/23530583
answers question: http://stackoverflow.com/q/23530568
type: Answer
accepted answer of: http://stackoverflow.com/q/23530568
has body: The problem is that your Video class variables are static, meaning only one copy of each for the whole class. They get overwritten with each new instance. Video ---&gt; "c" ^ ^ Video --/ / / Video --/ Remove static to make them instance variables, meaning one each per instance of the class. Then the values won't overwrite each other. Video ---&gt; "a" Video ---&gt; "b" Video ---&gt; "c"
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/q/23598387
has answer: http://stackoverflow.com/a/23598403
possible better answer: http://stackoverflow.com/a/23598542
type: Question
tagged with: boolean
has comment: http://stackoverflow.com/comment/36222992
upvote count: 1
tagged with: validation
favorite count: 0
has answer: http://stackoverflow.com/a/23598436
answer count: 4
tagged with: character
linked to: http://stackoverflow.com/q/8204680
downvote count: 0
tagged with: detection
has title: Mail address validation JAVA
has comment: http://stackoverflow.com/comment/36223402
type: AnsweredQuestion
has body: I'm trying to write a little program where I ask the user to enter an email address. And then I verify if its a valid email address or not. Like "example@example.com" would be valid, but "example@@example.com.org" would be invalid. Here's my code, I have made it work to detect if there is an @ and . character in there, but I need to make sure it only appears once, and that the @ appears before the dot (.) import java.util.Scanner; public class email { public static void main(String args[]) { Scanner skanni = new Scanner(System.in); System.out.println("Sládu inn email adressuna thína."); System.out.println("Email: "); String mail = skanni.nextLine(); boolean b1=mail.contains("@") &amp;&amp; mail.contains("."); if (b1) { System.out.println("This email is valid"); }else{ System.out.println("this email is invalid"); } } } If anyone could help, it would be greatly appreciated! EDIT: Thanks everyone for your answers and help. I'm posting the final code below if anyone else will be doing something similar in the future. Oh and you can ignore the comment. You probably won't understand it :) import java.util.Scanner; import java.util.regex.*; public class email { public static void main(String args[]) { Scanner skanni = new Scanner(System.in); System.out.println("Sládu inn email adressuna thína."); System.out.println("Email: "); String mail = skanni.nextLine(); /*Skilgreining á eftirfarandi kóda * ^ táknid er byrjunin á strengnum * thad sem ég set innan sviga á eftir, er thad sem ég legg áherslu á í hverju sinni * [A-Za-z0-9] eru leyfilegir stafir í fyrsta lid emailsins, sbr: (birgir09)dæmi@gmail.com * + á milli táknar ad naesti svigi byrjar, thad er ad segja. (\\-[A-Za-z0-9-]) * *@ táknar ad @ merkid er á milli sviganna * "[A-Za-z0-9] er thad sem kemur fyrir framan punktinn sbr. (gmail).com * (\\.[A-Za-z0-9]) er thad sem kemur fyrir aftan punkt sbr gmail.(com) */ Pattern p = Pattern.compile("^[A-Za-z0-9-]+(\\-[A-Za-z0-9])*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9])"); Matcher m = p…
has answer: http://stackoverflow.com/a/23598434
has answer: http://stackoverflow.com/a/23598542
accepted answer: http://stackoverflow.com/a/23598434
score: 1
tagged with: java

http://stackoverflow.com/q/23601862
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/39584872
tagged with: java
has comment: http://stackoverflow.com/comment/54757928
type: Question
tagged with: android-camera
has title: getCameraIdList() function returns an empty array
has body: I'm trying to work with Android's camera API 2, and I had a bug which I wasn't able to fix. The function getCameraIdList() returns an empty array for some reason, although I do have 2 working cameras on my emulator (I checked it using the Android camera app). I am working on an emulated device with the following details: Device: Nexus S API level: androd 4.4.2, API level 19 CPU: intel atom x86 front &amp; back camera are emulated what do you think? attached is the code. private CameraManager mManager; private String[] mCameraIds; mManager = (CameraManager)getSystemService(Context.CAMERA_SERVICE); mCameraIds = mManager.getCameraIdList();
has comment: http://stackoverflow.com/comment/124929005
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36230458
has comment: http://stackoverflow.com/comment/36232055
has answer: http://stackoverflow.com/a/35439095

http://stackoverflow.com/q/23461802
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35967970
possible better answer: http://stackoverflow.com/a/23461885
has body: I have an Activity with an EditText and some checkboxes. After the user inserts a text the text should be sent to the Service and the Service will run in background showing a Toast from time to time. I am having a really hard time trying to figure out how to send the data(Strings and Boolean values that user inputs through the Activity) to the Service .
has answer: http://stackoverflow.com/a/23461885
answer count: 2
accepted answer: http://stackoverflow.com/a/23461959
has title: Connection between Activity and Service
score: 0
has comment: http://stackoverflow.com/comment/35968038
tagged with: android
linked to: http://stackoverflow.com/q/3293243
tagged with: android-activity
tagged with: service
has answer: http://stackoverflow.com/a/23461959

http://stackoverflow.com/q/23603345
type: UnansweredQuestion
tagged with: spring
type: Question
tagged with: spring-mvc
tagged with: java
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/36232973
has body: i am trying to create a spring MVC project with Intellij, i use java8 and spring 4.0.4 which supported java8. i just create a new project with spring FW and try to run to see 'hello word' words, but it didn't run: HTTP Status 500 - Servlet.init() for servlet mvc-dispatcher threw exception type Exception report message Servlet.init() for servlet mvc-dispatcher threw exception description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet.init() for servlet mvc-dispatcher threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745) root cause java.lang.IllegalArgumentException org.springframework.asm.ClassReader.&lt;init&gt;(Unknown Source) org.springframework.asm.ClassReader.&lt;init&gt;(Unknown Source) org.springframework.asm.ClassReader.&lt;init&gt;(Unknown Source) org.springframework.core.type.classreading.SimpleMetadataReader.&lt;init&gt;(SimpleMetadataReader.java:52) org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80) org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:101) org.springframework.core.type.classre…
has comment: http://stackoverflow.com/comment/36234163
has comment: http://stackoverflow.com/comment/36235348
has title: spring 4.0.4 with java 8 not running
downvote count: 0
has comment: http://stackoverflow.com/comment/36232784
favorite count: 0
has comment: http://stackoverflow.com/comment/36239540
score: 2
has comment: http://stackoverflow.com/comment/36235849
answer count: 0
upvote count: 2

http://stackoverflow.com/comment/36194084
type: AnswerComment
type: Comment
has text: It is working without the "int count = count(line, p);" line, any idea why?
comment on: http://stackoverflow.com/a/23583014
score: 0

http://stackoverflow.com/q/23473729
has body: I am having trouble deserializing a JSON object. The object contains a collection which is being deserialized as a Map, which is the default. I need it to deserialize as a Set. My code is as follows: TaskDetail.java @ManyToMany private Set&lt;RoleDetail&gt; roleDetails = new HashSet&lt;RoleDetail&gt;(); public String toJson() { return new JSONSerializer().exclude("*.class").include("roleDetails").serialize(this); } RoleDetail.java @ElementCollection @Enumerated(EnumType.STRING) private Set&lt;RoleFunction&gt; roleFunctions = new HashSet&lt;RoleFunction&gt;(); public String toJson() { return new JSONSerializer().exclude("*.class").include("roleFunctions").serialize(this); } From the front-end, I submit the data from my form which is received by my controller in the following format: {"name":"Clean Shelves","description":"Clean all shelves in the store","roleDetails":{"description":"A person that counts stock","id":1,"name":"Stock Counter","version":0}} I need the roleDetails object to be deserialized as a HashSet. How can I use the JsonDeserializer to do this? I assume it is something like this in RoleDetail.java: public static RoleDetail fromJsonToRoleDetail(String json) { return new JSONDeserializer&lt;RoleDetail&gt;().use(null, RoleDetail.class).use("roleDetail.values", HashSet.class).deserialize(json); } Or do I also have to code something similare in TaskDetail.java?
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: flexjson
tagged with: spring-roo
answer count: 1
downvote count: 0
favorite count: 0
has title: Deserializing JSON object
has answer: http://stackoverflow.com/a/23474066
score: 2
upvote count: 2

http://stackoverflow.com/comment/36087952
has text: @assylias It may actually be interesting to try, by loading the enum class with a different class loader and then make the class loader garbage collectible. But since the enum cannot have a finalizer, I wonder how could we possible determine if it was gced.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23525993

http://stackoverflow.com/comment/36130765
type: Comment
type: QuestionComment
has text: @Reimeus could you please find me a tutorial or example or such to help? I'm using a BorderLayout and a BoxLayout already
comment on: http://stackoverflow.com/q/23549089
score: 0

http://stackoverflow.com/a/23585223
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23585169
has body: The correct KeyEvent constant for semicolon is VK_SEMICOLON robot.keyPress(KeyEvent.VK_SEMICOLON);

http://stackoverflow.com/comment/36034147
has text: use that line only in `EventClass` `actionPerformed` method, in `MemoControl` constructor leave as is(`label1 = new JLabel(image1);`).
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23497508
score: 1

http://stackoverflow.com/q/23468398
score: 1
favorite count: 0
has body: I have made my own editor by creating an eclipse plugin. I have implemented the code folding successfully and now I want to display instruction/function information on mouseover. For example: There is a instruction/function: print, in one of the file and this is used in other file(or may be same file), then on hovering over print it should display what it contains or may be comment written on top of it. How to achieve this? Also I want to jump to the function print if user presses F3, as it happens in java editor
upvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25291015
tagged with: eclipse
type: Question
has title: Display instruction/function info on mouseover in eclipse editor
downvote count: 0
tagged with: eclipse-plugin
tagged with: eclipse-rcp
accepted answer: http://stackoverflow.com/a/25291015
answer count: 1

http://stackoverflow.com/a/23475012
has comment: http://stackoverflow.com/comment/35991928
has comment: http://stackoverflow.com/comment/35991874
answers question: http://stackoverflow.com/q/23474957
downvote count: 0
has body: You need to initiate hourlyWage: double hourlyWage = 0; // or some other value if(skillInt == 1) { // ...
type: Answer
upvote count: 2
score: 2

http://stackoverflow.com/q/23604528
accepted answer: http://stackoverflow.com/a/23604620
tagged with: unit-testing
type: Question
tagged with: mockito
answer count: 1
has answer: http://stackoverflow.com/a/23604620
score: 4
has title: PowerMockito. Mock static method. why does not PowerMockito#stub work?
has body: I want to mock only one static method in class, all other methods should work like real object. code: public class ArrTest { public static int myMethod (int arr []) { return 777; } } test for this method: public class ArrTestTest { @Test public void myMethodTest(){ PowerMockito.stub(PowerMockito.method(ArrTest.class, "myMethod")).toReturn(0); System.out.println(ArrTest.myMethod(null)); } } in output I see 777 but I want to see 0; What do I wrong?
favorite count: 0
tagged with: powermock
upvote count: 4
tagged with: stubbing
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/a/23459758
answers question: http://stackoverflow.com/q/23458619
score: 0
type: Answer
has body: A shorter alternative String[] spielfeld = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~".split(""); What you have a array which is too big you get the error Error: java: code to large http://vanillajava.blogspot.co.uk/2014/04/java-arrays-wat.html

http://stackoverflow.com/comment/36239129
score: 0
type: Comment
has text: Not a Scala expert, but don't you need a toList or toCharArray in there...?
comment on: http://stackoverflow.com/a/23606586
type: AnswerComment

http://stackoverflow.com/q/23534403
answer count: 3
has answer: http://stackoverflow.com/a/23535404
accepted answer: http://stackoverflow.com/a/23557418
tagged with: datetime
tagged with: timestamp
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23534584
tagged with: java
has answer: http://stackoverflow.com/a/23534584
type: Question
tagged with: date-comparison
has body: I have due_date = 2014-05-09 11:36:41.816. I want to check condition that if today date is same as due_date or 1 day less then due_date then user can renew other wise have to show message that too early to renew. means if I renew on date 8 then user can do but if user do it on date 7 then he is not allowed and display message. I know that to check for same day means date 9, i can use : Timestamp t = new Timestamp(new Date().getTime()); if (t.compareTo(due_date)==0){ //renew book } but i don't know that how to do for 1 day before calculation. So any guidance to do for that.
has title: Date comparison confusion
has answer: http://stackoverflow.com/a/23557418
score: 0

http://stackoverflow.com/a/23466628
has body: By.tagName("text") will not work as "text" is not the HTML Tag name. Use XPATH or better is CSS Selector. You can use javascript also to count the number of names it returned. If you can give the result page HTML I can help you in finding CSS Selectore or Javascript that can return you the result.
score: 0
has comment: http://stackoverflow.com/comment/35978936
type: Answer
has comment: http://stackoverflow.com/comment/35978632
has comment: http://stackoverflow.com/comment/35978610
answers question: http://stackoverflow.com/q/23466267

http://stackoverflow.com/q/23508233
has comment: http://stackoverflow.com/comment/36055119
has comment: http://stackoverflow.com/comment/36054625
tagged with: linked-list
tagged with: java
has comment: http://stackoverflow.com/comment/36055043
has title: remove(int index) LinkedList Self-Implementation
has comment: http://stackoverflow.com/comment/36054725
has comment: http://stackoverflow.com/comment/36054639
type: Question
has comment: http://stackoverflow.com/comment/36054754
has comment: http://stackoverflow.com/comment/36054525
has comment: http://stackoverflow.com/comment/36054614
has body: I am trying to learn performance of LinkedList in comparison to ArrayList I have made my removal method as follows Data In the LinkedList, which is being removed is about 1million elements. My Problem, After Removing All Items: This is the Time Recd. If I Use Java LinkedList remove(int index) Time: 2000 nanoseconds If I Use my Custom remove(int index) Time: 34407000 nanoseconds Could someone please look at my code and tell me where I am going wrong. I am actually suppose to remove the data by index positions, since the comparison I am trying to attain are by index positions for ArrayList. public Object remove(int index) { checkElementIndex(index); return unlink(getNode(index)); } private Object unlink(ListNode node) { final Object element = node.item; final ListNode next = node.next; final ListNode prev = node.prev; if (prev == null) { first = next; } else { prev.next = next; node.prev = null; } if (next == null) { last = prev; } else { next.prev = prev; node.next = null; } node.item = null; size--; return element; } private ListNode getNode(int index) { if (index &lt; (size &gt;&gt; 1)) { ListNode node = first; for (int i = 0; i &lt; index; i++) { node = node.next; } return node; } else { ListNode node = last; for (int i = size - 1; i &gt; index; i--) { node = node.prev; } return node; } } private void checkElementIndex(int index) { if (index &lt; 0 || index &gt;= size) { throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); } } // BOTH THE LIST CONTAIN 1million items. startTime = System.nanoTime(); for (int i = linkedList.size()-1; i &gt;= 0; i--) { linkedList.remove(i); } endTime = System.nanoTime(); duration = endTime - startTime; System.out.println("LinkedList Removal Time: " + duration); // This is the Java Collection LinkedList startTime = System.nanoTime(); for (int i = linkedList.size()-1; i &gt;= 0; i--) { javaLinkedList.remove(i); } endTime = System.nanoTime(); duration = endTime - startTime; System.out.println("My Removal Time: " + …
has comment: http://stackoverflow.com/comment/36054735
has comment: http://stackoverflow.com/comment/36054805
score: 0
has comment: http://stackoverflow.com/comment/36054921
has comment: http://stackoverflow.com/comment/36054552
answer count: 1
has comment: http://stackoverflow.com/comment/36054770
has comment: http://stackoverflow.com/comment/36055098
has comment: http://stackoverflow.com/comment/36054545
has comment: http://stackoverflow.com/comment/36055206
tagged with: doubly-linked-list
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23508826
has comment: http://stackoverflow.com/comment/36054592
has comment: http://stackoverflow.com/comment/36054918

http://stackoverflow.com/comment/36157205
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23559085
type: AnswerComment
has text: Looking at http://stackoverflow.com/questions/23563178/postgresql-connection-java the problem might not be the missing database name, but a missing `/` after the hostname or port.

http://stackoverflow.com/comment/36128194
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23478661
has text: I do use Genymotion, but I got the same error while using my phone which is strange.

biginteger
tags question: http://stackoverflow.com/q/23603513
tag name: biginteger
tags question: http://stackoverflow.com/q/23583173
tags question: http://stackoverflow.com/q/23534496
type: Tag
tags question: http://stackoverflow.com/q/23559862

http://stackoverflow.com/comment/36017652
comment on: http://stackoverflow.com/q/23488619
score: 0
type: Comment
type: QuestionComment
has text: problem with your code is you are creating connection object inside the loop

http://stackoverflow.com/comment/36239971
comment on: http://stackoverflow.com/q/23607640
type: QuestionComment
has text: It's obvious that whatever makes up `array` does not have `[0][i]` valid positon. It will tell you in the exception which one is wrong. (It will actually tell you how much you overflowed)
type: Comment
score: 1

http://stackoverflow.com/q/23485768
has comment: http://stackoverflow.com/comment/36012841
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36012819
has comment: http://stackoverflow.com/comment/36012747
has comment: http://stackoverflow.com/comment/36012832
has comment: http://stackoverflow.com/comment/36012861
has answer: http://stackoverflow.com/a/23486276
score: 1
upvote count: 3
tagged with: stack
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/36012673
has comment: http://stackoverflow.com/comment/36012532
type: Question
has comment: http://stackoverflow.com/comment/36013248
has answer: http://stackoverflow.com/a/23485975
has body: Help me stackoverflow, you're my only hope. I have been trying to make a simple calculator, and finally I've gotten it to WORK! The problem is that only simply expressions are evaluated. For example: 4*5 would give 20.0. (Awesome!) Whenever I give it a more complicated expression like 4*(2+3), the program crashes due to an EmptyStackException. I understand the exception, but I am unable to recreate the problem in my mind when I run through the code manually with my brain and a sheet of paper. Can anyone figure out why it's crashing? Here is the full code. I marked where the code crashes with some bold, all-caps words. (i.e. PROGRAM CRASHES HERE) /** * Human * Project 3: SUPER-DUPER JAVA CALCULATOR */ import java.util.*; import java.util.Stack; import java.lang.String; import java.util.ArrayList; import java.lang.StringBuilder; import java.util.HashSet; import java.lang.Exception; import java.lang.Math; public class InfixEvaluator { public static class SyntaxErrorException extends Exception { /** * Construct a SyntaxErrorException with the specified message. * * @param message The message */ SyntaxErrorException(String message) { super(message); } } /** * This is the stack of operands: * i.e. (doubles/parentheses/brackets/curly braces) */ private static Stack&lt;Double&gt; operandStack = new Stack&lt;Double&gt;(); /** * This is the operator stack * i.e. (+-/*%^) */ private static Stack&lt;String&gt; operatorStack = new Stack&lt;String&gt;(); /** * These are the possible operators */ private static final String OPERATORS = "+-/*%^()[]{}"; private static final String BRACES = "()[]{}"; private static final String NONBRACES = "+-/*%^"; private static final int[] PRECEDENCE = {1, 1, 2, 2, 2, -1, -1, -1, -1, -1, -1}; /** * This is an ArrayList of all the discrete * things (operators/operands) making up an input. * This is really just getting rid of the spaces, * and dividing up the "stuff" into manageable pieces. */ static ArrayList&lt;String&gt; input = new ArrayList&lt;…
has title: Java calculator crashing with input of parentheses
answer count: 2
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/36012679
tagged with: calculator
has comment: http://stackoverflow.com/comment/36012733
favorite count: 0

http://stackoverflow.com/q/23591279
tagged with: arraylist
has comment: http://stackoverflow.com/comment/36209382
type: Question
tagged with: android
has title: ArrayList has same entries multiple times
has comment: http://stackoverflow.com/comment/36209329
has comment: http://stackoverflow.com/comment/36209490
score: 0
answer count: 1
has body: What i am doing:: I am getting data using cursor and adding them as Hashmap Object one-by-one to a ArrayList object and printing in log What is happening:: I am able to move my cursor one by one and put the data into HashMap So there are 5 hashmap objects added to ArryList object in turn ArrayList has 5 rows but the last entry of hashmap object is replaced in all the rows so ex:: HashMap has objects 1,2,3,4,5 Now after the last iteration ArrayList has 5,5,5,5,5 instead it should be 1,2,3,4,5 Please check the logcat &lt;--&gt;ArrayListObject&lt;--&gt; has same entry many times even though i have the hashmap object has different entries, how can i resolve this, i am making some mistake in adding values to arraylist, how can i correct myself mFragSortingHome.java public class mFragSortingHome extends SherlockListFragment implements View.OnTouchListener { Button ratingButtonId,priceButtonId,distanceButtonId; String queryString; ArrayList&lt;HashMap&lt;String, String&gt;&gt; arrayListBuffet=new ArrayList&lt;HashMap&lt;String,String&gt;&gt;(); @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View view=inflater.inflate(R.layout.fragment1, container, false); //Setting the NavigationTag from AppControllerApplication class AppController.CURRENT_FRAGMENT="mFragSortingHome"; setRetainInstance(true); return view; } public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { WillYouQuitAppDialog(); } return false; } public void WillYouQuitAppDialog(){ //GPS-Dialog WillYouQuitAppDialog quitAlert; try { quitAlert = new WillYouQuitAppDialog(); quitAlert.show(getActivity().getSupportFragmentManager(), "GpsAlert_Tag"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); ratingB…
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23591346
accepted answer: http://stackoverflow.com/a/23591346

http://stackoverflow.com/a/23528430
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23528359
has body: It seems like your default Locale uses a comma-based decimal separator for double values. Try using scanner.useLocale(Locale.ENGLISH);
upvote count: 3
answers question: http://stackoverflow.com/q/23528359
type: Answer
score: 3

http://stackoverflow.com/q/23589017
tagged with: static
has title: Static final member initialization on private class
accepted answer: http://stackoverflow.com/a/23589054
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: final
tagged with: java
has answer: http://stackoverflow.com/a/23589054
has body: Consider the following code: public final class Foo { private static final Random random = new Random(); private Foo() {} } This class can not be instantiated so, when random is initialized?
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/23589072
tagged with: initialization
favorite count: 0
possible better answer: http://stackoverflow.com/a/23589072

http://stackoverflow.com/comment/36065581
type: QuestionComment
has text: 1. Examine and debug the relevant Javascript being used to set the value: sounds like something is awry there; 2. You mention that the other checkboxes work: do you mean that `request.getParameter()` is returning values for them?
comment on: http://stackoverflow.com/q/23491086
score: 0
type: Comment

http://stackoverflow.com/a/23508756
downvote count: 0
upvote count: 2
has body: Ummm. That's a directory... how could you read from it just fine? All I notice is that you are missing a file name. File saveLocation = new File("src/database/images/myImage.jpg"); // &lt;-- Use `/`.
answers question: http://stackoverflow.com/q/23508708
type: Answer
score: 2

http://stackoverflow.com/q/23512231
type: Question
tagged with: android-layout
tagged with: java
tagged with: listview
score: 0
answer count: 3
has body: I am a new android Developer and I am using ListView to show all values on List View from database which is Sqlite and I am extending a Main Activity with List Activity. Here is my code: Main Activity package com.example.sqliteapplication; import java.util.List; import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ImageButton; import android.widget.ListView; public class SmsMerge extends ListActivity { private ImageButton imgb; private TemplateOperation templateDBoperation; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sms_merge); templateDBoperation = new TemplateOperation(this); templateDBoperation.open(); List values = templateDBoperation.getAllTemplate(); ListView listview = (ListView)findViewById(android.R.id.list); // Use the SimpleCursorAdapter to show the // elements in a ListView ArrayAdapter adapter = new ArrayAdapter(this, R.layout.row, values); listview.setAdapter(adapter); imgb=(ImageButton)findViewById(R.id.btnaddtemplate); imgb.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Log.d("hy humayoon", "kdmfoskfvodfkbij"); Intent intent = new Intent(SmsMerge.this, SqliteActivity.class); startActivity(intent); } }); } } Here is my activity_sms_merge.xml layout code: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@layout/bg_player_header" android:orientation="vertical" tools:context="com.SMS.smsmerge.SmsMergeActivity$PlaceholderFragment" &gt; &lt;LinearLayout android:id="@+id/player_header_bg" android:layout_width="fill_parent" android:layout_height="60dip" android:background="@layout/bg_player_he…
possible better answer: http://stackoverflow.com/a/23512455
accepted answer: http://stackoverflow.com/a/23512388
has answer: http://stackoverflow.com/a/23512455
has title: Adding image icon in a ListView crashes my app
has answer: http://stackoverflow.com/a/23512480
tagged with: android
has comment: http://stackoverflow.com/comment/36061569
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23512388

http://stackoverflow.com/comment/35967979
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23461511
type: Comment
has text: Sorry, I take it back. I didn't read the question carefully enough. I thought OP was saying they had the error with the code they had actually posted, not the modification they described underneath it. My apologies.

http://stackoverflow.com/q/23458659
tagged with: java
score: -1
type: Question
tagged with: null
answer count: 1
tagged with: arrays
has body: Hi I am trying to create a simple flag quiz app where an image of a flag appears and the user selects the correct answer from 3 options, however the app keeps crashing after two flags are shown. I think this might be something to do with a memory leak in the images array but I can't work out how to stop this. I am trying to set the images to null once they are shown but it shows an error when I try mapPics[i]=null; as shown below. The error says the image can not be set to null because it is an integer. Any help would be much appreciated! public class game1 extends Activity implements View.OnClickListener { static Button next; static ImageView mainpic; static RadioGroup radioGroup; static RadioButton option1; static RadioButton option2; static RadioButton option3; static int[] mapPics = new int[]{R.drawable.america, R.drawable.england, R.drawable.australia, R.drawable.poland, R.drawable.sweden, R.drawable.spain}; static String [] answers= new String[]{"Spain", "Poland", "Sweden", "America", "England", "Australia"}; static int [] correctAnswer= new int[]{2, 1}; static int score=0; static int i=0; static int a=0; static int b=1; static int c=2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.game1); next= (Button)findViewById(R.id.nextButton); mainpic= (ImageView)findViewById(R.id.imageView); mainpic.setImageResource(mapPics[i]); next.setOnClickListener(this); addListenerRadioGroup(); option1.setText(String.valueOf(answers[a])); option2.setText(String.valueOf(answers[b])); option3.setText(String.valueOf(answers[c])); }//On Create public void addListenerRadioGroup(){ option1= (RadioButton)findViewById(R.id.radioButton); option2= (RadioButton)findViewById(R.id.radioButton2); option3= (RadioButton)findViewById(R.id.radioButton3); radioGroup = (RadioGroup)findViewById(R.id.radioGroupAnswers); radioGroup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { radioGroup.…
tagged with: android
favorite count: 0
has title: Set used values in an array to null
has answer: http://stackoverflow.com/a/23458715
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/35962240
has comment: http://stackoverflow.com/comment/35962011

http://stackoverflow.com/q/23569056
has answer: http://stackoverflow.com/a/23569264
upvote count: 13
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23569788
tagged with: java
tagged with: indexoutofboundsexception
tagged with: compile-time
possible better answer: http://stackoverflow.com/a/23569264
has comment: http://stackoverflow.com/comment/36169088
has title: Why isn't the ArrayIndexOutOfBoundsException a compile time error?
type: Question
has answer: http://stackoverflow.com/a/23569593
has answer: http://stackoverflow.com/a/23569248
downvote count: 0
linked to: http://stackoverflow.com/q/846103
tagged with: compilation
answer count: 6
has answer: http://stackoverflow.com/a/23569251
has body: Can someone explain to me why ArrayIndexOutOfBoundsException is a run-time exception instead of a compile-time error? In obvious cases when the indexes are negative or greater than the array size, I don't see why it cannot be a compile-time error. Edited: especially when the size of the array and even the indexing is known at compile time, for example int[] a = new int[10]; a[-1]=5; This should be a compilation error.
has answer: http://stackoverflow.com/a/23569788
has comment: http://stackoverflow.com/comment/36168652
has answer: http://stackoverflow.com/a/23569438
favorite count: 0
score: 13

http://stackoverflow.com/comment/36195727
type: Comment
type: QuestionComment
has text: @LieRyan It is not a duplicate, because I know how to deal with just one variable that I have to deal with. But here I have three of them, so in that case the situation is different and therefore I cannnot deal with it...
comment on: http://stackoverflow.com/q/23583242
score: 0

http://stackoverflow.com/q/23551227
tagged with: file
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/23551843
type: Question
has comment: http://stackoverflow.com/comment/36136048
tagged with: hashmap
has comment: http://stackoverflow.com/comment/36135955
answer count: 1
tagged with: android
has body: i am creating an application for android in eclipse. i have a chat application in which user's contact's images are downloaded in sdcard and are put in a HashMap (url, localAddress), when i want to load contact list, for any contacts I use a function to find address of contacts' pictures on sdcard, three different state may occur 1- image found on sdcard then return path. 2- image don't download before and HashMap return null, then download it. 3- HashMap return a path but user deleted image from sdcard then remove key from Hashmap and download again. my code: public static String findFile(Context ctx, String url, String type) { try { String value = globalVars.addresses.get(url); if(value != null) { File ff = new File(value); if(ff.exists()) return value; globalVars.addresses.remove(url); } globalVars.enqueueJob(ctx, new globalVars.downloadJob(url, url, type)); return null; } catch(Exception ex) { Log.e("Find File", "Start"); Log.e("Find File", ex.toString()); ex.printStackTrace(); return null; } } but when i delete an image it download more and more . function enqueueJob : public static void enqueueJob(Context context, downloadJob dj) { if(inQueue.get(dj.getAddress())!= null &amp;&amp; inQueue.get(dj.getAddress())== true) return; downloads.add(dj); inQueue.put(dj.address, true); FileUtils.doDownload(context); } It work's fine for pictures don't download yet and pictures that download and don't delete yet.
has comment: http://stackoverflow.com/comment/36136404
has answer: http://stackoverflow.com/a/23551843
has title: I don't understand what happens on file.exists() for android on eclipse
has comment: http://stackoverflow.com/comment/36136220
type: AnsweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/q/23486430
has title: SharedPreferences not getting cleared android
score: -2
has answer: http://stackoverflow.com/a/23486568
has body: I have a login functionality in my app. Here when the user logs in for the first time, The user details are saved in a shared preference file. When the user logs in the next time I the user is directed to the second screen directly. This works fine. Now I have implemented a logout functionality. Here I clear the preferences. Then if I login from another account I still get the user details of the first account. Here is my code:- public class SessionManagement { SharedPreferences pref; // Editor for Shared preferences SharedPreferences.Editor editor; // ContextS Context _context; // Shared pref mode int PRIVATE_MODE = 0; // Sharedpref file name private static final String PREF_NAME = "UserDetails"; // All Shared Preferences Keys private static final String IS_LOGIN = "IsLoggedIn"; // User name (make variable public to access from outside) public static final String KEY_EMAILID = "email"; // Email address (make variable public to access from outside) public static final String KEY_DEVICEURL = "deviceurl"; public static final String KEY_ENDPOINTHOST = "endpointhost"; public static final String KEY_DEVICENAME = "devicename"; public static final String KEY_USERSNAME = "usersname"; public static final String KEY_ENCODEDACCOUNTNAME = "encodedaccountname"; public static final String KEY_HOSTURL = "hosturl"; public static final String KEY_DEVICEiD = "deviceid"; public static final String KEY_DEVICEREGISTERED = "deviceregistered"; // Constructor static SessionManagement session = null; public static SessionManagement getInstance(Context context) { _context = context; if(session == null) session = new SessionManagement (); return session; } public SessionManagement() { pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); editor = pref.edit(); } public void createLoginSession(String emailId, String deviceauthurl, String deviceid, String endpointhost, String devicename, String usersname, String encodedaccountname, String hosturl) { // Storing login value as TRUE editor…
answer count: 3
tagged with: logout
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23486485
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23486527
downvote count: 2
tagged with: sharedpreferences
type: Question

http://stackoverflow.com/a/23504827
type: AcceptedAnswer
has body: It is often an issue if a package is available in a bundle and also in the bpot classpath (JDK). It is even a bigger issue if that package is wired from another JDK package and also from a bundle directly. In your case the problem is the following: javax.xml.transform.stax is available only on the boot classpath (JDK) so hibernate.core wires to that package. As javax.xml.transform.stax comes from the boot classpath, it can wire to another package on the boot classpath. It needs javax.xml.stream so it will wire to the package that comes from JDK We have the chain: hibernate.core -&gt; javax.xml.transform.stax -&gt; javax.xml.stream On the other hand, hibernate.core wires to javax.xml.stream directly. Probably it even uses a version in the Import-Package section so it cannot wire to the package that comes from JDK. We have the chain: hibernate.core -&gt; javax.xml.stream This generates a conflict. As hibernate.core uses the javax.xml.stream API with the help of javax.xml.transform.stax, hibernate.core and javax.xml.transform.stax should use the same classes of javax.xml.stream. However, they do not. You have a couple of options to solve your problem: You can install a bundle that contains javax.xml.transform.stax package. That package will be able to wire to the javax.xml.stream package that comes from the bundle and also hibernate.core can wire to the bundle that contains javax.xml.transform.stax. You can pray that the wirings will be always OK. In my experience, the wires are good after the framework is started. As the package versions are higher in the bundles, they will be preferred when the package is imported from other bundles. However, when the bundles are updated and refreshed at runtime, the wiring often goes wrong. I do not know why, it just happens. To avoid every issue, I normally exclude those packages from the boot classpath that are also available in bundles. Your next issue might be that these APIs often use factory classes. When someone uses such a f…
upvote count: 2
has comment: http://stackoverflow.com/comment/36078177
type: Answer
answers question: http://stackoverflow.com/q/23495147
score: 2
has comment: http://stackoverflow.com/comment/36072872
accepted answer of: http://stackoverflow.com/q/23495147
downvote count: 0
has comment: http://stackoverflow.com/comment/36073685

http://stackoverflow.com/q/23592738
has answer: http://stackoverflow.com/a/23592974
has body: I have uploaded a static image (e.g., at location: /images/no-image.jpg) as part of my code that gets used as the default image when there is no specific image available (basically of the type: "no image for this item") Just realized that this image may have to be served at more than one size (I have uploaded -- and want to upload -- just one size). How do I resize this image using Google's Images Service? If I use the example shown at https://developers.google.com/appengine/docs/java/images/#Java_Transforming_images_in_Java , that means having to read the file, apply the transform, then write a servlet to serve up the file... which seems like a lot of work. Is there an easier way? Will it be easier to just upload the image to the BlobStore :-)?
tagged with: google-app-engine
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23594192
tagged with: image
type: Question
answer count: 2
has title: Resize static image file in Google App Engine
possible better answer: http://stackoverflow.com/a/23592974
score: 0
accepted answer: http://stackoverflow.com/a/23594192

http://stackoverflow.com/comment/36204526
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23588527
has text: sum+= recurSum(**target**-array[i]); it should be sum+= recurSum(**val**-array[i]);
score: 0

http://stackoverflow.com/a/23562795
type: Answer
has body: It represent the time to discard the connection if any connection is idle for that much time.
answers question: http://stackoverflow.com/q/23562721
score: 0

http://stackoverflow.com/q/23603281
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23603682
score: 2
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/23603453
type: Question
tagged with: arrays
downvote count: 0
favorite count: 0
has body: I have an array which for example in array[1] will contain however many times one occurred in a list of numbers, likewise array[2] will be however many twos there were. This is what I have tried so far int tot = 0; for(int i=0; i&lt;array.length; i++){ tot += array[i]; } int mid = tot/2; int med = array[mid]; return med; This doesn't work, and I feel like there's a lot more calculations that I haven't done. Any guidance is appreciated. Thanks!
answer count: 3
has title: Getting median from an array of frequencies?
has answer: http://stackoverflow.com/a/23603511

http://stackoverflow.com/comment/46317466
type: Comment
has text: I cannot delete it as it has answers. I need them deleting due to sensitive information and i have used all my flags on otger questions for moderators to delete them
score: 0
comment on: http://stackoverflow.com/q/23495944
type: QuestionComment

http://stackoverflow.com/comment/36222241
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23597763
has text: @Jon Skeet Noticed that, a spark of hope faintly crossed my mind but it kept failing after changing it to Space.gif.
type: Comment

http://stackoverflow.com/a/23512831
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23510648
upvote count: 5
accepted answer of: http://stackoverflow.com/q/23510648
has body: Try this... It will create an Array of Buttons and if you call your getGrid() Method it iterates through this Array of Buttons and adds them to the GridPane. import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.GridPane; import javafx.scene.layout.Pane; import javafx.stage.Stage; public class App extends Application { private Button[] btns = new Button[10]; @Override public void start(Stage primaryStage) { initBtnsArray(); Group root = new Group(); root.getChildren().add(getGrid()); Scene scene = new Scene(root, 800, 600); primaryStage.setTitle("Hello Controller-Array-World!"); primaryStage.setScene(scene); primaryStage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } private Pane getGrid() { int i = 0; GridPane gridPane = new GridPane(); for(Button b : btns) { // do something with your button // maybe add an EventListener or something gridPane.add(b, i*(i+(int)b.getWidth()), 0); i++; } return gridPane; } private void initBtnsArray() { for(int i = 0; i &lt; btns.length; i++) { btns[i] = new Button("Button-"+i); } } } Patrick
score: 5

http://stackoverflow.com/q/23499859
tagged with: object
type: AnsweredQuestion
tagged with: reflection
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36038567
answer count: 2
tagged with: arrays
accepted answer: http://stackoverflow.com/a/23499947
has title: Why can Object be actually Object[]?
possible better answer: http://stackoverflow.com/a/23499970
favorite count: 0
has comment: http://stackoverflow.com/comment/36038590
has answer: http://stackoverflow.com/a/23499970
score: 0
has body: I just came accross this behavior, as I wrote a dumpObject method using Reflection. to reproduce: public static class Tester { private String[] objects = new String[] { "a", "b", "c" }; } public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException { System.out.println("testing Reflection"); Tester tester = new Tester(); Class&lt;? extends Tester&gt; class1 = tester.getClass(); for (Field f : class1.getDeclaredFields()) { System.out.println(f); if (!f.isAccessible()) { f.setAccessible(true); } Object object = f.get(tester); System.out.println(object); } } in this case, the object retrieved via f.get(tester) method is returning an array of String. If an Object can be actually an array, why is this illegal? Object o = new String[]{"a", "b"};
has comment: http://stackoverflow.com/comment/36038750
has comment: http://stackoverflow.com/comment/36038623
upvote count: 1
has answer: http://stackoverflow.com/a/23499947
downvote count: 1
has comment: http://stackoverflow.com/comment/36038773

http://stackoverflow.com/q/23542225
tagged with: http-post
has body: I am getting: IllegalStateException content has been consumed This is my code private String postRequest(String strRequestURL,HashMap<String, Object> dataParams,HashMap<String, Object> headerParams){ String strResponse = "no resp"; HttpPost httpPost; HttpClient httpClient; HttpParams httpParams; try { httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 10*60*1000);//10 min HttpConnectionParams.setSoTimeout(httpParams, 10*60*1000);//10 min httpClient = new DefaultHttpClient(httpParams); httpPost = new HttpPost(strRequestURL);//new HttpPost(requestURL); Iterator iterHeader =headerParams.entrySet().iterator(); //postHeaderParams.entrySet().iterator(); while (iterHeader.hasNext()) { Map.Entry mEntry = (Map.Entry) iterHeader.next(); httpPost.setHeader(mEntry.getKey().toString(), mEntry.getValue().toString()); } Iterator iter =dataParams.entrySet().iterator(); JSONObject objParams = new JSONObject(); while (iter.hasNext()) { Map.Entry mEntry = (Map.Entry) iter.next(); //params.add(new BasicNameValuePair(mEntry.getKey().toString(), mEntry.getValue().toString())); objParams.put(mEntry.getKey().toString(),mEntry.getValue().toString()); } httpPost.setEntity(new StringEntity(objParams.toString(), "UTF-8")); HttpResponse response = httpClient.execute(httpPost); HttpEntity entity = response.getEntity(); StatusLine statusLine = response.getStatusLine(); int statusCode = statusLine.getStatusCode(); if(statusCode==200) { Log.i("log", "connection code status true"); } strResponse = EntityUtils.toString(entity,HTTP.UTF_8); } catch (Exception ex) { ex.printStackTrace(); Common.logError(context , ex.getMessage(), "API call - " + strRequestURL, "postRequest"); } return strResponse; } I am not able to find the exact problem from where the content is consumed. I have followed these links but no luck: IllegalStateException: Content has been consumed IllegalStateException: Content has been consumed using httpPost to get data from server Android HttpResp…
linked to: http://stackoverflow.com/q/10168617
linked to: http://stackoverflow.com/q/4727114
favorite count: 0
upvote count: 2
tagged with: exception
has comment: http://stackoverflow.com/comment/36119531
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/23280278
answer count: 0
has comment: http://stackoverflow.com/comment/36117724
score: 1
has comment: http://stackoverflow.com/comment/36117791
tagged with: java
downvote count: 1
type: Question
has title: IllegalStateException : content has been consumed android
linked to: http://stackoverflow.com/q/15183343
linked to: http://stackoverflow.com/q/7745915
has comment: http://stackoverflow.com/comment/36152141

http://stackoverflow.com/comment/36102700
has text: [There](http://stackoverflow.com/questions/1694885/timezones-in-java) [are](http://stackoverflow.com/questions/9429357/date-and-time-conversion-to-some-other-timezone-in-java) [dozens](http://stackoverflow.com/questions/7670355/convert-date-time-for-given-timezone-java) [of questions](http://stackoverflow.com/questions/6567923/timezone-conversion) AND answers about converting between time zones in general and even between specific time zones.
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23533746

http://stackoverflow.com/comment/36137371
score: 0
comment on: http://stackoverflow.com/q/23551934
type: QuestionComment
type: Comment
has text: you are not initializing your moviews array with the actual object of JLabel, you just created an array of size 20, but you have to initialize each element of an array to a JLabel instance

http://stackoverflow.com/q/23601516
accepted answer: http://stackoverflow.com/a/32475590
upvote count: 2
has comment: http://stackoverflow.com/comment/36270608
tagged with: docx4j
answer count: 3
has body: Is it possible to create new header for every different sections using docx4j? I've seen that MS Word provides functionality to create different headers by creating different sections using section breaks. But I want to implement this functionality using docx4j. For example: If I've to create a docx files that may contains list of products, some terms and conditions, and some other sections. And I want title for each section to be displayed at top with paging (Like Product Summary: Page 1 of 2, Terms &amp; Conditions: Page 3 of 3). Also I'm using MainDocumentPart.addAltChunk() method to write html content in the document for creating Document. Thanks in Advance. -- Regards, Sanshey Sachdeva
has answer: http://stackoverflow.com/a/23801629
favorite count: 0
has answer: http://stackoverflow.com/a/32475590
has comment: http://stackoverflow.com/comment/36231736
has answer: http://stackoverflow.com/a/36012038
possible better answer: http://stackoverflow.com/a/23801629
has comment: http://stackoverflow.com/comment/36305195
has comment: http://stackoverflow.com/comment/36278561
score: 2
has comment: http://stackoverflow.com/comment/36283711
has comment: http://stackoverflow.com/comment/36364146
downvote count: 0
type: Question
has title: Create docx using docx4j with multiple headers
has comment: http://stackoverflow.com/comment/59154911
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36279851

http://stackoverflow.com/comment/36068172
has text: You know, 1000 values is really small. You can iterate over that a few hundred thousand times a second on a laptop.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23516030

http://stackoverflow.com/a/24737373
score: 6
has comment: http://stackoverflow.com/comment/77865903
upvote count: 6
downvote count: 0
answers question: http://stackoverflow.com/q/23561736
type: Answer
has comment: http://stackoverflow.com/comment/94435970
has body: Not sure if you still need help. I think setting the "hadoop.security.authentication" property is missing from your snippet. I am using following code snippet to connect to secure HBase (on CDH5). You can give a try. config.set("hbase.zookeeper.quorum", zookeeperHosts); config.set("hbase.zookeeper.property.clientPort", zookeeperPort); config.set("hadoop.security.authentication", "kerberos"); config.set("hbase.security.authentication", "kerberos"); config.set("hbase.master.kerberos.principal", HBASE_MASTER_PRINCIPAL); config.set("hbase.regionserver.kerberos.principal", HBASE_RS_PRINCIPAL); UserGroupInformation.setConfiguration(config); UserGroupInformation.loginUserFromKeytab(ZOOKEEPER_PRINCIPAL,ZOOKEEPER_KEYTAB); HBaseAdmin admins = new HBaseAdmin(config); TableName[] tables = admins.listTableNames(); for(TableName table: tables){ System.out.println(table.toString()); }

http://stackoverflow.com/a/23470327
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/23470278
has body: Yes, since resultSet and rs are two references pointing to the same object. I wouldn't pass around your resultset normally since you want to control the closure of it (and prevent a resource leak). I would rather get it, iterate through and build a set of objects relating to its results, close the result set and hand back your resultant collection of objects from the database.
score: 2
answers question: http://stackoverflow.com/q/23470278
type: AcceptedAnswer

http://stackoverflow.com/a/23464393
accepted answer of: http://stackoverflow.com/q/23464310
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23464310
score: 6
type: Answer
has body: Outside of the fact that you're passing in an int[], and the ArrayList is bound to any object, the two methods are practically equivalent. Although, the second form can be greatly simplified, as ArrayList has a convenient copy constructor for collections. You can also take a sublist of the passed-in list as well, making this a one-liner which accomplishes the same thing as the iteration piece. public static &lt;T&gt; List&lt;T&gt; leftHalf(List&lt;T&gt; list) { return new ArrayList&lt;T&gt;(list.subList(0, list.size() / 2)); }
has comment: http://stackoverflow.com/comment/35973033
upvote count: 6
has comment: http://stackoverflow.com/comment/35973040
has comment: http://stackoverflow.com/comment/35972987
downvote count: 0
has comment: http://stackoverflow.com/comment/35973028
has comment: http://stackoverflow.com/comment/35973005

http://stackoverflow.com/comment/36036666
comment on: http://stackoverflow.com/a/23496370
score: 0
type: AnswerComment
has text: @tereško, I understand your point regarding MVC, but your quarrel is with those implementations, and not with me. I find myself using the phrase "MVC-like" in relation to web frameworks of this kind, purism be damned - because OPs are more often looking for good-enough solutions than semantic discussions.
type: Comment

http://stackoverflow.com/a/23562448
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/23562308
type: Answer
has body: You are looking at the keys of the map so start with the keySet(); You can then look at the Set interface and see the method retainAll http://docs.oracle.com/javase/8/docs/api/java/util/Set.html#retainAll-java.util.Collection- This gives you: map1.keySet().retainAll(map2.keySet()) However that will modify the map so you should copy the set: new HashSet&lt;&gt;(map1.keySet()).retainAll(map2.keySet())
downvote count: 0

http://stackoverflow.com/comment/36222268
score: 0
type: QuestionComment
has text: Exception in thread "main" java.security.InvalidKeyException: Illegal key size
type: Comment
comment on: http://stackoverflow.com/q/23597984

http://stackoverflow.com/a/23574723
downvote count: 0
has comment: http://stackoverflow.com/comment/36192412
has comment: http://stackoverflow.com/comment/36193040
upvote count: 8
has comment: http://stackoverflow.com/comment/36198889
has comment: http://stackoverflow.com/comment/36194242
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/36193490
has comment: http://stackoverflow.com/comment/73779300
has comment: http://stackoverflow.com/comment/36198967
answers question: http://stackoverflow.com/q/23561551
has comment: http://stackoverflow.com/comment/36186386
has comment: http://stackoverflow.com/comment/36192935
has comment: http://stackoverflow.com/comment/73778970
has body: If you have small p values, you'll like this one better than the naive implementation you cited. It still loops, but the expected number of iterations is O(np) so it's pretty fast for small p values. If you're working with large p values, replace p with q = 1-p and subtract the return value from n. Clearly, it will be at its worst when p = q = 0.5. public static int getBinomial(int n, double p) { double log_q = Math.log(1.0 - p); int x = 0; double sum = 0; for(;;) { sum += Math.log(Math.random()) / (n - x); if(sum &lt; log_q) { return x; } x++; } } The implementation is a variant of Luc Devroye's "Second Waiting Time Method" on page 522 of his text "Non-Uniform Random Variate Generation." There are faster methods based on acceptance/rejection techniques, but they are substantially more complex to implement.
accepted answer of: http://stackoverflow.com/q/23561551
has comment: http://stackoverflow.com/comment/36199477
type: AcceptedAnswer

http://stackoverflow.com/a/23520115
has body: Please refer this page: http://developer.android.com/tools/publishing/app-signing.html Once you obtain your private key(which should be kept very safely and you should not lose it ever, atleast for 25 years) use that key to sign the application and to generate a hash for Facebook dashboard. Refer this for steps: https://developers.facebook.com/docs/android/getting-started/ Under Create a Facebook App search this command that uses your release(google dev key) keytool -exportcert -alias &lt;RELEASE_KEY_ALIAS&gt; -keystore &lt;RELEASE_KEY_PATH&gt; | openssl sha1 -binary | openssl base64 That should do it.
accepted answer of: http://stackoverflow.com/q/23519346
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/36076896
type: Answer
answers question: http://stackoverflow.com/q/23519346
has comment: http://stackoverflow.com/comment/36077179

http://stackoverflow.com/a/23471573
has comment: http://stackoverflow.com/comment/35985509
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23471516
has body: Using Java to get os level system Information will get you started in right direction. Finding Operating System Information How to get System Information using Java

http://stackoverflow.com/comment/36103821
has text: Your title says you want to convert it to an array of "numbers" and in your question you say that you want to print it. What is that you are trying to achieve?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23534496

http://stackoverflow.com/comment/93415736
has text: I get this problem with tomcat 8.0.36 and log4j-api-2.11.0.jar
comment on: http://stackoverflow.com/a/44118296
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/36223040
has text: This won't work . How can he add `Fragment` into `R.id.container` before setting the `Layout` to the `Activity`
comment on: http://stackoverflow.com/a/23598398
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/23613665
answers question: http://stackoverflow.com/q/23612906
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: Use getElementById to retrieve the rom_table from the parsed Document and then get the Elements by tag tr. final Document doc = Jsoup.connect("http://twixkat.altervista.org/download.html").get(); runOnUiThread(new Runnable() { @Override public void run() { Element rootElement = doc.body().getElementById("rom_table"); Elements elements = rootElement.getElementsByTag("tr"); for(Element element : elements){ String titolo = element.select("tr").text(); String descrizione = element.select("a").text(); String urldesc = element.select("a").first().attr("abs:href"); // do your other stuff here to add to List } } });

http://stackoverflow.com/a/23606005
has comment: http://stackoverflow.com/comment/36237086
has comment: http://stackoverflow.com/comment/36237412
upvote count: 2
type: Answer
score: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23605955
has body: Equals and hashcode for entrysets will compare instances of the Map implementation itself, not elements. The normal mechanism is to iterate over an entry set comparing keys or values, like this : for (Map.Entry&lt;String, String&gt; entry : map.entrySet()) { System.out.println(entry.getKey() + "/" + entry.getValue()); myBoolean = entry.getKey().equals(myOtherString); }

http://stackoverflow.com/comment/36158043
score: 0
type: Comment
type: QuestionComment
has text: _"Implementations are free to implement optimizations whereby the equals invocation is avoided, for example, by first comparing the hash codes of the two elements. (The Object.hashCode() specification guarantees that two objects with unequal hash codes cannot be equal.) More generally, implementations of the various Collections Framework interfaces are free to take advantage of the specified behavior of underlying Object methods wherever the implementor deems it appropriate."_
comment on: http://stackoverflow.com/q/23563798

http://stackoverflow.com/q/23577183
answer count: 1
has body: I have the following String: String p = "33,644.234"; How can I convert it to double value? Following gives java.lang.NumberFormatException: For input string: "33,644.234" System.out.println(Double.valueOf(p)); kindly suggest.
has comment: http://stackoverflow.com/comment/36183742
favorite count: 0
has comment: http://stackoverflow.com/comment/36183882
has comment: http://stackoverflow.com/comment/36183683
has comment: http://stackoverflow.com/comment/36184008
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/36183886
has comment: http://stackoverflow.com/comment/36183707
has title: how to get double value of a string with mantissa separator?
linked to: http://stackoverflow.com/q/4885254
has comment: http://stackoverflow.com/comment/36183796
tagged with: java
has answer: http://stackoverflow.com/a/23577201
type: Question
has comment: http://stackoverflow.com/comment/36183944
upvote count: 0
score: -2

http://stackoverflow.com/q/23548368
score: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/36133780
answer count: 0
type: UnansweredQuestion
has body: Hi am trying to test a REST Api using Firefox REST Client. But it does not return me any response. Below is the scenario as to how it should work. When I post an xml file through Rest client, It should send me a response code saying success or error and save the xml file data into the database. This is working in everyone else machine, but am not sure why it is not working in mine. https://localhost:8443/web/services/activities Any help is appreciated.
has comment: http://stackoverflow.com/comment/36131588
tagged with: web-services
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/36133655
has comment: http://stackoverflow.com/comment/36170321
tagged with: java
type: Question
has title: No Response From REST Client for a REST API
has comment: http://stackoverflow.com/comment/36132162
tagged with: jsp

http://stackoverflow.com/comment/36284172
has text: What do you mean by "restart it from zero"? If it starts to count down like 10, 9, 8.. and at that time if you press a button to set it to 0 and to stop counting or?
comment on: http://stackoverflow.com/a/23604635
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23610410
answers question: http://stackoverflow.com/q/23610375
type: Answer
has body: You cannot do better than iterating through all elements. So the solution is pretty simple: List&lt;String&gt; res = new ArrayList&lt;String&gt;(); for (String crtKey : map.keySet()) { Integer value = map.get(crtKey); if ( value != null &amp;&amp; value &gt; 10) res.add(crtKey); } }
upvote count: 3
has comment: http://stackoverflow.com/comment/36245316
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23610375

http://stackoverflow.com/q/23547134
has comment: http://stackoverflow.com/comment/36127341
tagged with: url
tagged with: hudson
type: UnansweredQuestion
answer count: 0
tagged with: jenkins
has comment: http://stackoverflow.com/comment/36131344
tagged with: java
has body: I have a remote server that use basic authentication (HTTP) and i need several calls to different URLs. A example of calling: URL address = new URL ("hhtp://localhost:8080"); HttpURLConnection connection; // open connection connection = (HttpURLConnection) address.openConnection(); String encoding = DatatypeConverter.printBase64Binary((username + ":" + password).getBytes()); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty("Authorization", "Basic " + encoding); // transform result code into an exception int code = connection.getResponseCode(); if ((code &lt; 200) || (code &gt;= 300)) { throw new HttpRetryException(connection.getResponseMessage(), code, address.toString()); } return connection; The problem appear that the server take a lot of time authenticating the user. After this first call, we need another page (a different URL) to the same server. How I can keep the session between different calls? Edit: A clarification, I'm trying to connect to a Jenkins server.
type: Question
has comment: http://stackoverflow.com/comment/36127094
has title: Keep Authentication between different calls to java.net.URL
has comment: http://stackoverflow.com/comment/36127364
has comment: http://stackoverflow.com/comment/36221806
has comment: http://stackoverflow.com/comment/36231913
has comment: http://stackoverflow.com/comment/36129125
has comment: http://stackoverflow.com/comment/36127126
score: 0

http://stackoverflow.com/comment/36102658
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23474373
type: Comment
has text: I know it is impossible but I am waiting for an answer which says it is possible by some hack :)

http://stackoverflow.com/comment/36149903
type: QuestionComment
comment on: http://stackoverflow.com/q/23559300
score: 0
has text: Client approval is the reason.
type: Comment

http://stackoverflow.com/q/23468445
tagged with: maven
linked to: http://stackoverflow.com/q/3539139
type: Question
accepted answer: http://stackoverflow.com/a/26256270
tagged with: java
has body: I have a Grails 2.3.7 project which should use Java 1.7. I am using the Spring GGTS IDE as development tool and it is configured to use a Java 1.7 JDK. I created the project in GGTS and changed the source and target level to 1.7. Then I generate a maven pom file with the create-pom command. So far so good. The project is linked to use a JRE System Library of version 1.7. Then I change the project to be a Maven project in GGTS. What happens now is that in GGTS, the project changes the JRE System Library to become of version 1.6. I can manually switch it back to a java 1.7 library but every time I do a "Maven update project", the 1.6 library is back. What am I doing wrong?
tagged with: sts-springsourcetoolsuite
tagged with: grails
has comment: http://stackoverflow.com/comment/35982181
has title: How to make a Grails Maven project use Java 1.7 in GGTS?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35983978
has comment: http://stackoverflow.com/comment/35984013
has answer: http://stackoverflow.com/a/26256270
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35990216

http://stackoverflow.com/q/23532969
has title: Selenium Creating unique username each and every time when I run the script
score: -1
answer count: 2
has body: I'm creating new user, each and every time I have to create new username. Using below code i can't generate unique username each time when I run the script. Please help me out int i = 0; for(int count1=0; count1 &lt;10000; i++){ driver.findElement(By.id("txtUserName")).sendKeys("classroomuser"+i); i++;
favorite count: 0
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/23534102
type: Question
possible better answer: http://stackoverflow.com/a/23534463
upvote count: 0
has answer: http://stackoverflow.com/a/23534463
accepted answer: http://stackoverflow.com/a/23534102

http://stackoverflow.com/a/23489834
upvote count: 3
has comment: http://stackoverflow.com/comment/83839778
score: 3
downvote count: 0
has body: You have two options: Make your compareTo also compare the number and yearModel fields. Store a collection (array or List) at each node - usually called a MultiSet. So long as your compareTo reports that two items are equal, only one of them will appear in the set.
has comment: http://stackoverflow.com/comment/36020443
answers question: http://stackoverflow.com/q/23489718
type: Answer

http://stackoverflow.com/q/23556472
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/36150621
tagged with: tile
tagged with: algorithm
tagged with: libgdx
has title: Efficiently handling all game tile updates?
score: 0
accepted answer: http://stackoverflow.com/a/23556654
answer count: 1
type: AnsweredQuestion
has body: In my tile-based top down game, somewhat like Terraria, I need to have tiles efficiently update in a certain circumstance. The circumstance I am currently working on is drawing connections between tiles. By connections I mean drawing an overlay on top of each tile depending on its position, so if the tile is on a corner, it will have a corner overlay which connects to other overlays. Somewhat like connected textures in Minecraft rather connected textures in any tile games most likely. The problem I am having right now is how to handle updating the overlay. For example, if I destroy a tile, the overlays of all the adjacent tiles must be updated because there is no longer a tile to connect to. This part is easy because I could just do something like this: updateOverlay(x+1, y); updateOverlay(x-1, y); updateOverlay(x, y+1); updateOverlay(x, y-1); This is where the problem comes in. What happens if when I call the updateOverlay(x+1, y), the overlay of this changes such that the adjacent tiles to this tile require an overlay update, and what happens if one of those adjacent tiles causes the same thing? Then it's a huge string of updates. I tried a recursive implementation somewhat like the following: public boolean updateOverlay(int x, int y){ changeOverlayAccordingly(); if(overlayHasChanged) return true; updateOverlay(x+1, y); updateOverlay(x-1, y); updateOverlay(x, y+1); updateOverlay(x, y-1); return false; } the if(overlayHasChanged) statement was supposed to stop an infinite recursive loop from occuring, but it didn't really do anything because I still got stack overflow errors. Also a recursive solution to the problem probably isn't the best because it wouldn't be that stable. Once again, I understand that I could just update all of the adjacent overlays and be done with it, but what if those updates lead to more updates being required? [2] [6] [1][x][3][5][8] [4] [7] To further illustrate my point, look to the above diagram. if [x] is the original overlay being upd…
tagged with: java
has comment: http://stackoverflow.com/comment/36163935
has answer: http://stackoverflow.com/a/23556654

http://stackoverflow.com/a/23580544
score: 2
has comment: http://stackoverflow.com/comment/43244296
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23580455
answers question: http://stackoverflow.com/q/23580455
upvote count: 2
has comment: http://stackoverflow.com/comment/36192442
type: AcceptedAnswer
has body: I basically never use the deb file for that matter. From experience it is easier to use the archieve version(tgz). Download and extract the tgz under /usr/java, then: sudo ln -sf /usr/java/jdk1.8-version/ /usr/java/default #so that you can change easily the java version in the future sudo rm /usr/bin/java /usr/bin/javac /usr/bin/jar Create symbolic links to java executables sudo ln -sf /usr/java/default/bin/java /usr/bin/java sudo ln -sf /usr/java/default/bin/javac /usr/bin/javac sudo ln -sf /usr/java/default/bin/jar /usr/bin/jar define a global JAVA_HOME sudo bash -l -c "echo export JAVA_HOME=/usr/java/default &gt;&gt; /etc/profile" finally let mint know which java to use sudo update-alternatives --config java and select the right version from a list
type: Answer

http://stackoverflow.com/comment/36079012
has text: Not guaranteed to be unique, of course, but dupes would be "highly unlikely".
score: 2
comment on: http://stackoverflow.com/a/23518431
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23460479
has title: My Switch statement is not working as expected
accepted answer: http://stackoverflow.com/a/23460509
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35965565
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/35965493
tagged with: switch-statement
type: Question
has body: I am currently trying to finish this program, however when I am testing my switch statement, it goes directly to my default case and says that I have entered invalid information. My Task I have to receive a month from the user and send it to my case statement in order to execute my code for the certain case. As you may notice, that each case has a key in it, this key is for personal purposes. Please disregard. My Problem case statement goes directly into my default statement, which issues an invalid information message to the user. My Progress This will be my complete program, everything seems to work properly except that my case statement recognizes every month as invalid input // Import Libraries import javax.swing.*; import java.util.*; import java.io.*; // This is my program. public class DateCalc { public static void main (String[] args) { String month; String day; String inputYear; Scanner keyboard = new Scanner(System.in); // receiving input for my age variable System.out.print( "Please Enter The Month Of The Date :"); month = keyboard.nextLine(); // receiving input for my weight variable System.out.print( "Please Enter The Day Of The Date : "); day = keyboard.nextLine(); // receiving input for my height variable System.out.print( "Please Enter The Year OF The Date : "); inputYear = keyboard.nextLine(); String stringYear = ""+ inputYear.charAt(inputYear.length()-2) + inputYear.charAt(inputYear.length()-1); int year = Integer.parseInt(stringYear); int intDay = Integer.parseInt(day); switch(month) { // I tried to test my program by using my first case " January ", However it goes right through every case directly for my default case. case "January || january" : int janKey = 1; int janQuarter = year / 4; int janSum = year + janQuarter + intDay + janKey; System.out.print( " Date Entered Was : " + month + ","+ day + "" + inputYear); System.out.print( " Last Two Digits Of The Year Were : " + year); System.out.print( " One Quarter Of Last Two Digits : " + janQuarter…
has answer: http://stackoverflow.com/a/23460509
has answer: http://stackoverflow.com/a/23460541
answer count: 3
possible better answer: http://stackoverflow.com/a/23460525
has comment: http://stackoverflow.com/comment/35965462
has answer: http://stackoverflow.com/a/23460525

http://stackoverflow.com/comment/36189068
score: 1
type: AnswerComment
has text: You can use the Animal-Sniffer-Plugin(http://mojo.codehaus.org/animal-sniffer-maven-plugin/) for making sure that you do not use too "new" methods.
type: Comment
comment on: http://stackoverflow.com/a/23580287

http://stackoverflow.com/q/23466772
has body: What is the difference between a WAR and a EAR application? I got this .war vs .ear file but yet no hint. Are there any practical examples which can explain when to use which? Yes I mean if I have an application (say, online shopping cart), why would I package it as a EAR instead of packaging it as a WAR?
upvote count: 4
duplicate of: http://stackoverflow.com/q/1594667
has title: Practical examples for WAR and EAR
tagged with: ear
has answer: http://stackoverflow.com/a/23467160
answer count: 1
has comment: http://stackoverflow.com/comment/35977092
favorite count: 0
tagged with: war
has comment: http://stackoverflow.com/comment/35977117
downvote count: 6
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23467160
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/35977059
score: -2
linked to: http://stackoverflow.com/q/1594667
tagged with: java

http://stackoverflow.com/q/23592748
has answer: http://stackoverflow.com/a/49485747
favorite count: 0
has title: Clear intent action default
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: android-camera
answer count: 2
has body: I am launching the camera app in normal or secure mode depending on what gesture is performed using my app but once the user selects the app and taps Always then there is no option to change the defaults, even from the settings menu in Android. camera_intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA); secure_camera_intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE); camera_intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); secure_camera_intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); this.startActivity(camera_intent); //this.startActivity(secure_camera_intent); Is there a workaround? I want to show the camera selection dialog once again so that the user can change his choice.
has answer: http://stackoverflow.com/a/23596668
downvote count: 0

http://stackoverflow.com/comment/36220547
type: AnswerComment
type: Comment
has text: It seems to me that the OP knows this, but is asking how to know when a carriage return has been scanned from the source file, so that s/he can place it in the output file appropriately.
comment on: http://stackoverflow.com/a/23597093
score: 0

http://stackoverflow.com/a/23614367
has comment: http://stackoverflow.com/comment/36254888
score: 5
type: AcceptedAnswer
upvote count: 5
downvote count: 0
has body: You are trying to use java util logging not log4j. you need to import import org.apache.log4j.Logger; Another thing I see that is wrong in your code is change this: private static Logger logger = Logger.getLogger(FileChooserDemo.class.getName()); To private static Logger logger = Logger.getLogger(TestLogs.class.getName()); Here is a sample package com.vkg; import org.apache.log4j.Logger; public class TestLogs { private static Logger logger = Logger.getLogger(TestLogs.class.getName()); public static void main(String[] args) { logger.info("It works"); TestLogs tls = new TestLogs(); } } A basic log4j config file # Root logger log4j.rootLogger=INFO, file, stdout # Write to file log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.File=[sompath to your log file e.g. C:\\mylog.log] log4j.appender.file.MaxFileSize=50MB log4j.appender.file.MaxBackupIndex=1 log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n # Write to console log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n And output 2014-05-12 13:18:01 INFO TestLogs:9 - It works Image below shows where to keep log4j.properties
answers question: http://stackoverflow.com/q/23614191
type: Answer
accepted answer of: http://stackoverflow.com/q/23614191
has comment: http://stackoverflow.com/comment/36255240
has comment: http://stackoverflow.com/comment/36254677

http://stackoverflow.com/a/23520858
type: Answer
accepted answer of: http://stackoverflow.com/q/23520561
score: 3
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23520561
downvote count: 0
has body: Use this Spring Security configuration: @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().permitAll(); } Make note that this does not disable in Spring Security from the request chain, it just tells Spring Security to allow all requests

http://stackoverflow.com/q/23611420
tagged with: while-loop
answer count: 1
tagged with: user-interface
favorite count: 0
has answer: http://stackoverflow.com/a/23612109
accepted answer: http://stackoverflow.com/a/23612109
upvote count: 2
has comment: http://stackoverflow.com/comment/36247530
tagged with: multithreading
tagged with: swing
has comment: http://stackoverflow.com/comment/36247577
has comment: http://stackoverflow.com/comment/36248484
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36248391
tagged with: java
has comment: http://stackoverflow.com/comment/36247647
has title: What is the correct way to implement this do while?
has comment: http://stackoverflow.com/comment/36248354
type: Question
has comment: http://stackoverflow.com/comment/36248324
has body: I start my GUI like this, which seems correct. javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame gui = new JFrame(); gui.setExtendedState(JFrame.MAXIMIZED_BOTH); gui.setVisible(true); } }); At a certain point in the application, the playTurn() method gets fired. The for loops all turns in the list. for (String turn : controller.getTurns()) { playTurn(turn); } I now load the correct panel with my CardLayout which worked fine. Then I had to write the playTurn() method. So playTurn() gets called. It should do certain things according to some variables. But it should not return until some buttons are disabled. This is what I can't achieve, the program just stops working. I can guess it's in the direction of threads etc.. but can't seem to figure it out. Thanks in advance. public void playTurn(String turn) { if (controller.givePlayers().contains(turn)) { javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { while (!turnFinished) { if (!button1.isEnabled() &amp;&amp; !button1.isEnabled() &amp;&amp; !button1.isEnabled() &amp;&amp; !button1.isEnabled()) { turnFinished = true; } } } }); } else { deletePlayer(turn); } } Sorry for bad formatting. Couldn't find where. EDIT: The GUI stops being responsive. Can't close program either. I tried using a SwingWorker for the while which does not block the GUI but still playTurn() returns. I have even tried creating a new thread where I call the method. The doesn't get blocked anymore but the method still returns. Thread one = new Thread() { public void run() { playTurn(turn); } }; FIXED: Placing the runnable up higher in the stack;
has comment: http://stackoverflow.com/comment/36247465
has comment: http://stackoverflow.com/comment/36247423
has comment: http://stackoverflow.com/comment/36247466
downvote count: 0

http://stackoverflow.com/comment/35955581
type: QuestionComment
comment on: http://stackoverflow.com/q/23454631
type: Comment
has text: The learn to do it properly, perfect practice makes perfect ;)
score: 0

http://stackoverflow.com/a/27303150
has body: Assuming that the client and server projects poms are invalid because of unsatisfied expansion, then the following should work... If the "client" and "server" projects have their dependency on "Framework" defined in a tag, then you can first install "Framework" using the -N option. First, cd to the Framework directory, then: mvn -N clean install The -N option tells maven to only install the root pom in the local repo and to skip the child modules. Now cd to your child project and rerun your install command in your client or server module. The client or server build should now find the parent pom with the properties that it needs in the local repo. You can get the same effect by making an explicit file path reference using the relativePath tag in your child pom's parent tag: ../my-parent
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/23581194
type: Answer

http://stackoverflow.com/comment/36014867
comment on: http://stackoverflow.com/a/23486802
type: AnswerComment
score: 0
type: Comment
has text: @Michael Aron Safyan I see. You're suggesting a dependency injection solution. That is definitely a fourth method but given that we're discouraged from making design changes to operational code for the sake of testing I'm not sure it'll fly in my shop. Personally I like it better than making the array protected.

http://stackoverflow.com/comment/54278126
type: Comment
score: 0
type: AnswerComment
has text: Is there a performance difference between using logger.error(throwable) and catching() and throwing() methods?
comment on: http://stackoverflow.com/a/23466938

http://stackoverflow.com/comment/36082218
comment on: http://stackoverflow.com/q/23523154
type: QuestionComment
has text: this post might help: http://stackoverflow.com/questions/1783793/java-difference-between-the-setpreferredsize-and-setsize-methods-in-compone
score: 0
type: Comment

http://stackoverflow.com/comment/36090964
comment on: http://stackoverflow.com/q/23527295
type: Comment
type: QuestionComment
score: 0
has text: @chrylis: i've changed it to 1.7 and it works again

http://stackoverflow.com/a/23534329
type: Answer
upvote count: 15
downvote count: 0
answers question: http://stackoverflow.com/q/23533695
has body: Try this: Files.write(Paths.get("filename"), bytes);
score: 15
has comment: http://stackoverflow.com/comment/121946186

http://stackoverflow.com/a/23607372
has body: UUID There is a class called java.util.UUID, with a method to generate a random-based UUID. This 128-bit value has 122 of its bits generated randomly. UUID uuid = UUID.randomUUID() ; Call toString to view the value as a hex string in canonical format with hyphens inserted. uuid.toString(): 24b47cf5-fb53-4fb1-a5a2-8b415260304d You can extract the 128 bits as a pair of 64-bit long integer numbers. Call getMostSignificantBits() and getLeastSignificantBits(). long mostSignificant = uuid.getMostSignificantBits() ; long leastSignificant = uuid.getLeastSignificantBits() ; This value may not be appropriate for critical security applications with 4 bits being predictable (not random). But in other practical applications, this handy class may work well. Here is a question which I found on SO with more detailed explanation: Likelihood of collision using most significant bits of a UUID in Java
upvote count: 8
answers question: http://stackoverflow.com/q/23607293
score: 7
has comment: http://stackoverflow.com/comment/71315133
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/46436324
has comment: http://stackoverflow.com/comment/40906310

http://stackoverflow.com/comment/35997228
type: Comment
has text: I will remove my answer if this is not helpful.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23477666

http://stackoverflow.com/a/51798211
score: 7
has comment: http://stackoverflow.com/comment/95284086
downvote count: 0
has comment: http://stackoverflow.com/comment/121024956
answers question: http://stackoverflow.com/q/23533345
type: Answer
has comment: http://stackoverflow.com/comment/94865733
upvote count: 7
has body: Please see the below code sample which explains "Reference to an Instance Method of an Arbitrary Object of a Particular Type" category described in https://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html import java.util.Arrays; class Person{ String name; //constructor public Person(String name){ this.name = name; } //instance method 1 public int personInstanceMethod1(Person person){ return this.name.compareTo(person.name); } //instance method 2 public int personInstanceMethod2(Person person1, Person person2){ return person1.name.compareTo(person2.name); } } class Test { public static void main (String[] args) throws Exception{ Person[] personArray = {new Person("A"), new Person("B")}; // Scenario 1 : Getting compiled successfully Arrays.sort(personArray, Person::personInstanceMethod1); // Scenario 2 : Compile failure Arrays.sort(personArray, Person::personInstanceMethod2); // Scenario 3 : Getting compiled successfully. Person personInstance = new Person("C"); Arrays.sort(personArray, personInstance::personInstanceMethod2); // Scenario 4 : Getting compiled successfully. As the same way as "Scenario 1" String[] stringArray = { "Barbara", "James", "Mary", "John", "Patricia", "Robert", "Michael", "Linda" }; Arrays.sort(stringArray, String::compareToIgnoreCase); } } Scenario 1 and Scenario 4 describes "Reference to an Instance Method of an Arbitrary Object of a Particular Type" category described in https://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html If the method parameter takes a variable in same instance Type as the instance Type of the element, you can call that instance method using Type.(Person::personInstanceMethod1) Compare "personInstanceMethod1" instance method in "Person" class with "compareToIgnoreCase" instance method in "String" class (https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#compareToIgnoreCase-java.lang.String-) to see the similarity. Both are taking a single parameter with the same Type. Com…

http://stackoverflow.com/q/23586723
tagged with: java
tagged with: swing
type: Question
has title: Java work with JFrame and JPanel
score: -1
has body: I have this package gui --Gui.java (JFrame) --Game.java (JPanel) and I want open JPanel(Hra) from JFrame(Gui) after I press button, my code looks like private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // connect: this.setVisible(false); new Hra().setVisible(true); } but when I start Gui and I press button, the program doesn't work and program is still running. Thank you for answer
has comment: http://stackoverflow.com/comment/36201377
has comment: http://stackoverflow.com/comment/36201421
has answer: http://stackoverflow.com/a/23586758
answer count: 1
tagged with: user-interface
downvote count: 1
has comment: http://stackoverflow.com/comment/36201953
has comment: http://stackoverflow.com/comment/36202792
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36201163
upvote count: 0

http://stackoverflow.com/a/23571276
answers question: http://stackoverflow.com/q/23571065
has body: I slightly refactored your code: class Job { String name = null; int[] salary = null; static int jobCount = 0; Job(String name, int... salary){ this.name = name; this.salary = salary; jobCount++; } } public class Test { public static void main(String[] args) { new Job("abc", 1, 2, 3); } } If you want to pass a variable amount of arguments "by hand", it's not really necessary to use an array. Method which actually takes a variable amount of arguments is much more readable. Of course, if your code was just for testing purposes, this lose its sense and Luiggi's answer is absolutely correct. You don't really have to initialize field salary (and create a new instance of array) if you have only one constructor, which will initialize that field anyway. To understand what's happening there (simplified): new instance is created fields are initialized code of constructor is executed Therefore, your initial value of field salary will get overwritten by constructor and you will lose its original value. It will be slow (allocation of memory is usually very slow) with no reason. I also don't understand purpose of jobCount field but it would be probably for a longer discussion.
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/39194084
comment on: http://stackoverflow.com/a/23592269
has text: @jww I didn't say that. I said there is no circumstance in which you would prefer one over the other. TrustManager is part of TLS; HostnameVerifier is part of HTTPS. They're not in competition. You can verify hostnames in a TrustManager if you need to: see the [Javadoc](http://docs.oracle.com/javase/7/docs/api/javax/net/ssl/X509ExtendedTrustManager.html#checkServerTrusted(java.security.cert.X509Certificate[],%20java.lang.String,%20java.net.Socket)), but you're doing so for a different reason, under a different RFC, and at a different phase of the communication.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36136551
has text: Thank you for the response. We are indeed using the QMgr side authorization. It is just that I was running the standalone program with another User. I added this to the permissions list and it resolved the issue.
comment on: http://stackoverflow.com/a/23527100
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36008060
type: Comment
has text: Just add a third if to make it for 3 numbers
comment on: http://stackoverflow.com/a/23482694
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36255058
comment on: http://stackoverflow.com/q/23615094
score: 0
has text: @ajb No error thrown so nothing in catch ...
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36087231
type: Comment
comment on: http://stackoverflow.com/q/23525760
score: 1
has text: What do you think `b.subtract(b)` does?
type: QuestionComment

http://stackoverflow.com/comment/36190195
type: QuestionComment
has text: "what's is the event that I must implement in it?" In the `actionPerformed`, use `textArea.setText` or `textArea.append` with the information as an argument. I suggest you post some code of what you have tried so far.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23580849

http://stackoverflow.com/q/23489669
has answer: http://stackoverflow.com/a/23489888
has body: Recently I started with Solr and I have setup Solr on a Windows 7 machine. I can use Solr to index folders on my pc, but also to index network shares. The problem I have is as following: I need to be able to index an entire c drive on a Windows server. When using \\[servername]\c$ in the Windows explorer address bar, I can see the content. But using the following code will not index the c drive: java -Dauto -Drecursive -jar post.jar \\[Servername]\c$ I do not get an error message, but the indexed files is zero. It's not even working when trying to index my local c drive. How can I index the C drive of a Windows server that is on my network?
has title: How to use Solr to index an entire C drive
type: AnsweredQuestion
tagged with: windows
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/23489888
favorite count: 0
type: Question
upvote count: 1
answer count: 1
tagged with: indexing
tagged with: java
tagged with: solr

http://stackoverflow.com/comment/36184222
score: 0
type: Comment
type: QuestionComment
has text: I just found out i have been thinking completely wrong all along... the next/prevous pointers in the elements inside the list is just there for the internal methods like addLast etc, and that i should as you say just use index in the lists itself to find next/previous elements. I feel so annoyed now thinking for days how to solve somehting i didnt have to in the first place xD Thanks
comment on: http://stackoverflow.com/q/23577060

http://stackoverflow.com/a/23540223
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23539628
answers question: http://stackoverflow.com/q/23539628
upvote count: 2
type: AcceptedAnswer
has body: I don't understand your conditions, you are not using the obtained message at all. I would make the enum as follows: private enum FruitsType { Apple, Orange, Mango } As for the switch block, I would probably do something like: private String getFruitsPrefMsg() { String message = getMessage(); if(message == null) message = getOtherMessage(); try { switch(FruitsType.valueOf(message)) { case Apple: //return something case Orange: //return something case Mango: //return something } } catch(IllegalArgumentException exception) { //Message is not in the enum. //Handle error //You can return something here } //Or return something here } I know the try-catch block is pretty ugly, but that's the easiest solution i'm able to think of. Good luck with that.

http://stackoverflow.com/comment/52135105
has text: Facing same issue. It was due to database version was not matched, current and previous one. Thanks you, you save my lots of time.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23611764

http://stackoverflow.com/comment/36012210
type: Comment
comment on: http://stackoverflow.com/q/23485550
type: QuestionComment
has text: Then I would suggest you to post the relevant codes of hibernate and use hibernate tag
score: 0

http://stackoverflow.com/a/23749025
has body: It's possible if you're willing to try a slightly different approach: Pulling data from an HTML5 app is tricky but pushing data to a native app is easier. Your HTML5 app must have a native container. Does the container API include a way to access native ContentProviders? If not, can you add your own native code to the container to do that? Basically, if you can access ContentProviders then your native app need only implement a ContentProvider with insert privileges (which can be restricted to only your HTML5 app). After an insert, the native app can do whatever it wishes with the data, including broadcasting it to to other devices. If you insist on pulling data from the HTML5 app, this may only be possible if the native and HTML5 app are actually the same app, and that is only possible if your container allows you to add your own native code. Then you will have direct access to the WebView's storage via the WebStorage class.
answers question: http://stackoverflow.com/q/23587074
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36542175
has comment: http://stackoverflow.com/comment/36679955
type: Answer

http://stackoverflow.com/a/23582986
answers question: http://stackoverflow.com/q/23573097
type: Answer
has body: The title bar is NOT a Swing component so you can't receive events when you use a Swing listener. If you want to listen for events then you need to use a JFrame with Swing decorations: JFrame frame = new JFrame(); frame.setUndecorated(true); frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); frame.getRootPane().addMouseListener(...);
upvote count: 1
has comment: http://stackoverflow.com/comment/36202876
has comment: http://stackoverflow.com/comment/36207950
has comment: http://stackoverflow.com/comment/36198283
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36215622

http://stackoverflow.com/comment/36303622
has text: Sure! The short answer is you wouldn't use the distributed cache because that's not what the distributed cache is for! The longer answer is that using the Distributed Cache as a datastore will cause problems with Hadoop's code to data model. The Distributed Cache is intended to deliver static files to which ever nodes in the cluster need them. In my experience this mostly means library Jars and such. This would cause a lot of network problems if what we are sending around is a 2Gb result set.
type: QuestionComment
comment on: http://stackoverflow.com/q/23580319
score: 0
type: Comment

http://stackoverflow.com/a/23512388
has body: This line makes the problem // elements in a ListView ArrayAdapter adapter = new ArrayAdapter(this, R.layout.row, values); Change this to ArrayAdapter&lt;String&gt; adapt = new ArrayAdapter&lt;String&gt;(this, R.layout.row, R.id.YOUR_TEXT_VIEW, values);
type: Answer
accepted answer of: http://stackoverflow.com/q/23512231
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23512231
score: 0

http://stackoverflow.com/comment/36204127
has text: i tried but it still output error .
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23579612
score: 0

http://stackoverflow.com/a/23556407
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23556379
upvote count: 1
answers question: http://stackoverflow.com/q/23556379
score: 1
has body: Try this: driver.findElement(By.id("email")).clear(); driver.findElement(By.id("email")).sendKeys("testing@netexam.com"); driver.findElement(By.id("email")).sendKeys(Keys.RETURN); //Send Enter Key
type: AcceptedAnswer

http://stackoverflow.com/q/23486247
answer count: 1
has comment: http://stackoverflow.com/comment/36013415
has comment: http://stackoverflow.com/comment/36023603
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36013525
has comment: http://stackoverflow.com/comment/36015077
has comment: http://stackoverflow.com/comment/36013561
has comment: http://stackoverflow.com/comment/36013681
score: 0
has comment: http://stackoverflow.com/comment/36013558
tagged with: java
has body: I'm making a web crawler that searches for the first (user inputted) number of links on a page that contains a phrase. I'm crawling just fine, but I'm getting NullPointerExceptions when I try to see if the link contains the phrase. This is the code I'm using to do it: private boolean linkContainsSearchFor(URL url){ boolean ans = false; In urlIn = new In(url); String urlText = ""; //if urlIn is null, get out now to avoid nullpointerexceptions if (urlIn == null) return ans; urlText = urlIn.readAll(); System.out.println("urlText="+urlText); if(urlText.contains(searchFor)){ ans = true; System.out.println("found a match!"); } return ans; } The readAll() method just reads the entire web page in as text and returns it as one giant String. There shouldn't be anything wrong there, but that's the line that's giving me the error. Any ideas? EDIT: Here's the error screen. EDIT #2: This is the readAll() method: /** * Read and return the remainder of the input as a string. */ public String readAll() { if (!scanner.hasNextLine()) return ""; String result = scanner.useDelimiter(EVERYTHING_PATTERN).next(); // not that important to reset delimeter, since now scanner is empty scanner.useDelimiter(WHITESPACE_PATTERN); // but let's do it anyway return result; }
has comment: http://stackoverflow.com/comment/36013393
has comment: http://stackoverflow.com/comment/36013345
has comment: http://stackoverflow.com/comment/36013412
type: Question
has comment: http://stackoverflow.com/comment/36013708
has title: NullPointerException when looking at String
tagged with: url
has comment: http://stackoverflow.com/comment/36013338
tagged with: string
has comment: http://stackoverflow.com/comment/36013811
has comment: http://stackoverflow.com/comment/36013885
has comment: http://stackoverflow.com/comment/36014643
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/23561898

http://stackoverflow.com/q/23472471
tagged with: hornetq
upvote count: 4
answer count: 1
has title: OverlappingFileLockException in tomcat start-up
downvote count: 0
score: 4
tagged with: tomcat
has answer: http://stackoverflow.com/a/25622473
favorite count: 0
has body: I'v added custom jndi-resource factory to my tomcat (jndi-resource for ConnectionFactory of an embedded hornetq). My resource needs some config files; I put them in ${catalina_home}/hornetq folder. I have a test-web-app that uses this resource in tomcat start-up. In tomcat start-up, When test-web-app wants to use my resource, the resource wants to lock config files but it can't, and it throws `OverlappingFileLockException: java.nio.channels.OverlappingFileLockException at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255) at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152) at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1056) at org.hornetq.core.server.impl.FileLockNodeManager.tryLock(FileLockNodeManager.java:266) at org.hornetq.core.server.impl.FileLockNodeManager.isBackupLive(FileLockNodeManager.java:82) at org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreLiveActivation.run(HornetQServerImpl.java:2161) at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:450) at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:485) at org.hornetq.jms.server.embedded.EmbeddedJMS.start(EmbeddedJMS.java:115) at ... Is it possible to disable file locking (files in ${catalina_home}/hornetq directory) in tomcat or OS? Update: My jndi-resource in context.xml file in tomcat (A connection factory with name: /ConnectionFactory is defined in hornetq-jms.xml): &lt;Resource name="jms/ConnectionFactory" auth="Container" type="javax.jms.ConnectionFactory" factory="com.wise.jms.hornetq.embedded.HornetqConnectionFactoryBuilder" cf-name="/ConnectionFactory" singletone="true"/&gt; My factory class: HornetqConnectionFactoryBuilder. I put the jar containing this class in ${catalina_home}/lib directory (The embedded hornetq will be started in the first getObjectInstance method call): public class HornetqConnectionFactoryBuilder implements ObjectFactory{ private EmbeddedJMS embeddedJMS; private static f…
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/35988732
tagged with: java

http://stackoverflow.com/comment/36132292
type: QuestionComment
comment on: http://stackoverflow.com/q/23546779
has text: I personally use a Maven repository manager (Nexus) to manage my ivy dependencies. These repo managers have the ability to proxy remote repository content and maintain search indexes.
score: 0
type: Comment

http://stackoverflow.com/comment/73575301
score: 0
has text: I am getting same problem, I tried using http://mvnrepository.com/artifact/org.jvnet/mimepull/1.6 and still it dint get resolved. Can you check http://stackoverflow.com/questions/43253206/unsupported-media-type-error-in-jersey-api
type: Comment
comment on: http://stackoverflow.com/a/23498188
type: AnswerComment

http://stackoverflow.com/a/23462054
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/35968562
accepted answer of: http://stackoverflow.com/q/23461978
has body: The current ADT is built on Eclipse Keplar base. Eclipse (Keplar), currently, does have built in support for using Java 8 .. but it can be added (here are directions from Eclipse). There are builds of the next Eclipse (Luna) release stream that should have Java 8 "builtin" this week. However, I have not seen any plans to build ADT on top of a pre-release Eclipse (Luna) version. The Android team has typically waited beyond release.
answers question: http://stackoverflow.com/q/23461978
score: 0

sun-coding-conventions
tag name: sun-coding-conventions
type: Tag
tags question: http://stackoverflow.com/q/23557948

http://stackoverflow.com/a/23519457
score: 1
accepted answer of: http://stackoverflow.com/q/23508163
upvote count: 1
has body: This dosen't work, because th line static String command = (Main.line).toString(); in the Commands-class is executed exactly once, when the Commands-class is first referenced. When the second command is send, the class was already referenced, so this line is not executed again. To solve this put the line inside the method, or - much better - pass it as a parameter to the method. P.S.: Have you mixed up the packages? The class with the ServerSocket should be the server and thus be in the MyServer package. :-)
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23508163
type: Answer
has comment: http://stackoverflow.com/comment/36096562

http://stackoverflow.com/q/23566232
tagged with: mouse
score: 2
answer count: 0
tagged with: java
has body: Is there any particular reason why Java cannot detect those two buttons? https://i.sstatic.net/Oggsj.png I have wrote a simple class to check for those buttons. import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JFrame; public class Horizontal_wheel_button_test { public static void main (String [] args) throws Exception { JFrame okno = new JFrame (); okno.setSize (800, 600); okno.setVisible (true); okno.setLocationRelativeTo (null); okno.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); okno.addMouseListener (new MouseListener () { @Override public void mouseReleased (MouseEvent e) { } @Override public void mousePressed (MouseEvent e) { System.out.println (e); } @Override public void mouseExited (MouseEvent e) { } @Override public void mouseEntered (MouseEvent e) { } @Override public void mouseClicked (MouseEvent e) { System.out.println (e); } }); } } When i press standard buttons, Listener reacts, giving me number of buttons from 1 to 3, but when I press the wheel to the left and to the right, it is not able to notify those events. Is it because Java does not support those buttons or maybe it's because of my OS (Windows 7)?
type: Question
has comment: http://stackoverflow.com/comment/36166771
has comment: http://stackoverflow.com/comment/36162880
has title: Detecting Horizontal Mouse Wheel movement in java
downvote count: 0
tagged with: button
has comment: http://stackoverflow.com/comment/36162599
linked to: http://stackoverflow.com/q/14464228
favorite count: 0
has comment: http://stackoverflow.com/comment/83749936
tagged with: listener
upvote count: 2
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/comment/36031527
comment on: http://stackoverflow.com/a/23496191
score: 0
type: AnswerComment
has text: What is the error? Post this on your question as well as the github project lin.
type: Comment

http://stackoverflow.com/comment/36115759
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23541048
score: 0
has text: Ahhh yes that seemed to work, I assumed you had to run activity changes on the UI thread! +50000 if I could, thanks for your help :-)

http://stackoverflow.com/a/23596348
answers question: http://stackoverflow.com/q/23595424
has comment: http://stackoverflow.com/comment/36220361
downvote count: 0
has comment: http://stackoverflow.com/comment/36220162
score: 1
type: Answer
has body: You are calling ResultSet.next() multiple times for each iteration of the rows - once per column, inside the for loop - this ultimately results in the exception, as you try to move way past the end of it. On a more general nore, this is quite an awkward way to iterate a ResultSet. Using the conventional while loop should make your life easier: int rowCount = 0; while (rs.next()) { for(int i = 0; i &lt; columns; i++){ System.out.println("Running While Loop"); results[rowCount][i] = rs.getString(i+1); System.out.println(rowCount+",,,,"+i+" = "+results[rowCount][i]); } rowCount++; }
has comment: http://stackoverflow.com/comment/36219298
upvote count: 1

http://stackoverflow.com/a/23613102
has body: Use ListView.setChoiceMode() and pass it CHOICE_MODE_MULTIPLE. Then you can call getCheckedItemIds(). Your adapter should also implement getItemId(position). If nothing else, you can just return the position argument itself, so at least all the items will have different IDs according to the adapter.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23612946
has comment: http://stackoverflow.com/comment/36358776
has comment: http://stackoverflow.com/comment/36342093
downvote count: 0

http://stackoverflow.com/q/23489448
linked to: http://stackoverflow.com/q/10631425
accepted answer: http://stackoverflow.com/a/23596112
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/36018862
tagged with: back
has comment: http://stackoverflow.com/comment/36019095
has comment: http://stackoverflow.com/comment/36018995
tagged with: webview
downvote count: 1
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/36018829
has answer: http://stackoverflow.com/a/23596112
type: Question
has comment: http://stackoverflow.com/comment/36019009
has comment: http://stackoverflow.com/comment/36019246
upvote count: 0
has title: How to use go back in sites correct?
answer count: 1
has comment: http://stackoverflow.com/comment/36018947
score: -1
has comment: http://stackoverflow.com/comment/36019003
has body: I have my WebViewFragment and of course i want to go back in the site im browsing but i have the error: The method onBackPressed() is undefined for the type Fragment Why? I don´t understand that? What am i doing wrong? Here´s my full webview code i´m using. import android.app.Fragment; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.DownloadListener; import android.webkit.WebChromeClient; import android.webkit.WebView; import android.webkit.WebViewClient; public class WebViewFragment extends Fragment { WebView webView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Retrieving the currently selected item number int position = getArguments().getInt("position"); String url = getArguments().getString("url"); // List of rivers String[] menus = getResources().getStringArray(R.array.menus); // Creating view corresponding to the fragment View v = inflater.inflate(R.layout.fragment_layout, container, false); // Updating the action bar title getActivity().getActionBar().setTitle(menus[position]); //Initializing and loading url in webview webView = (WebView)v.findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadsImagesAutomatically(true); webView.getSettings().setBuiltInZoomControls(true); webView.loadUrl(url); webView.setWebChromeClient(new WebChromeClient()); webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url){ view.loadUrl(url); return true; } }); webView.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.p…
has comment: http://stackoverflow.com/comment/36019204

http://stackoverflow.com/a/23486802
has body: It really depends on what your test is trying to exercise. In general, if you are testing the internal implementation details of your code, you are probably doing the wrong thing with your tests. After all, your tests should be exercising the observable effects of your code, not the implementation details. Tests that exercise implementation details are brittle (needing to be updated whenever the implementation changes) and usually are just a copy of the implementation. Also, because they mirror the implementation, bugs in the implementation are likely to be reflected in the tests, as well, so such tests are typically of dubious value. A better approach for such a thing is to use an interface to represent your database object and to use a mocking framework such as mockito to verify that the data you expect is written to and read from the database, without inspecting the innards of how your code is storing the data internally before writing it to the database. Also, in terms of not writing code differently for tests... in general, it is good practice not to have test-only methods in your production code. However, refactoring code to make it more modular (and therefore more testable), is a generally good coding practice to have.
has comment: http://stackoverflow.com/comment/36014867
upvote count: 2
has comment: http://stackoverflow.com/comment/36014814
has comment: http://stackoverflow.com/comment/36014702
answers question: http://stackoverflow.com/q/23486707
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36014525
downvote count: 0
has comment: http://stackoverflow.com/comment/36014661
has comment: http://stackoverflow.com/comment/36014782

http://stackoverflow.com/q/23497402
has answer: http://stackoverflow.com/a/23703946
tagged with: request
tagged with: getattribute
has body: i'm new in liferay, and now i'm learning Liferay with liferaycookbook. I have a problem with send object from porlet to jsp page here's my porlet,.In LibraryPortlet.java i have a function: public void searchBooks(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException { String searchTerm = ParamUtil.getString(actionRequest, "searchTerm"); if (Validator.isNotNull(searchTerm)) { try { List<LMSBook> lmsBooks = LMSBookLocalServiceUtil .searchBooks(searchTerm); actionRequest.setAttribute("SEARCH_RESULT", lmsBooks); actionRequest.setAttribute("test", "sentence to test"); actionResponse.setRenderParameter("jspPage", LibraryConstants.PAGE_LIST); } catch (SystemException e) { e.printStackTrace(); } } } in file list.jsp, i have List<LMSBook> booksTemp = (List<LMSBook>) request .getAttribute("SEARCH_RESULT"); List<LMSBook> books = Validator.isNotNull(booksTemp) ? ListUtil .copy(booksTemp) : LMSBookLocalServiceUtil.getLMSBooks(0, LMSBookLocalServiceUtil.getLMSBooksCount()); System.out.println("test: "+ request.getAttribute("test")); in list.jsp, booksTemp is null because liferay can't send my object from LibraryPortlet.java to jsp, i try to send the string "sentence to test", but in console, it shows test: null Anybody have had same problem, can you help me, please!
has comment: http://stackoverflow.com/comment/36047347
has comment: http://stackoverflow.com/comment/36053047
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/44480036
type: Question
has comment: http://stackoverflow.com/comment/36055789
has title: Liferay Portal don't send object from process phase to jsp
has comment: http://stackoverflow.com/comment/36060306
score: 0
tagged with: liferay
has comment: http://stackoverflow.com/comment/36062411
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/36053199

http://stackoverflow.com/comment/35969142
type: Comment
comment on: http://stackoverflow.com/a/23462411
score: 0
type: AnswerComment
has text: I understand this, but it always works. It never doesn't work. No matter how many times I run the code it always works.

http://stackoverflow.com/comment/36062269
comment on: http://stackoverflow.com/q/23510624
score: 0
type: Comment
type: QuestionComment
has text: That's not the problem. I can encode the result in JSON as send it but how do I access data from table A or table B given that they are all in the same object?

http://stackoverflow.com/comment/36060285
score: 0
type: Comment
has text: Please clarify some of your expressions (just to be sure to understand you correctly): What do you mean by "I have a war that exposes all these dependencies"? What exactly do you want to do? You want the dependencies from your other pom NOT to appear in your war?
type: QuestionComment
comment on: http://stackoverflow.com/q/23509509

http://stackoverflow.com/q/23474283
has answer: http://stackoverflow.com/a/23474353
type: Question
has body: I want to use Process process = new ProcessBuilder("executable.exe", "InputFile").start() to run executable.exe. After running this file, it has a output file which will be stored in a default location, but I want to make a output file stored in the location I specified. I would like to know how to do it programmatically?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23474353
has comment: http://stackoverflow.com/comment/35990563
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35990507
tagged with: java
has title: how to make the output file in a specified location after running ProcessBuilder("executable.exe", "InputFile").start()

http://stackoverflow.com/q/23491737
tagged with: etl
type: AnsweredQuestion
score: 1
tagged with: java
has title: Talend job doesn't run properly when using several tBufferOuput/tBufferInput couples in in it
type: Question
upvote count: 1
answer count: 1
has body: I'm developing a big job in Talend Open Studio (about 90 components now and minimum 150 at the end of the development). But the number of components is limited in the subjobs because the Java method of a subjob can't exceed the 65536 bytes limit. So I split my job in multiple subjobs using tBufferOuput/tBufferInput couple to pass data between each subjob. And now the problem is that I need to empty the globalBuffer before each tBufferOuput. I've searched on the web and I found a solution with a tJava component using globalBuffer.clear(); in it but when I do that, my job finishes without handling any data.
favorite count: 0
tagged with: talend
tagged with: buffer
has answer: http://stackoverflow.com/a/23492745
accepted answer: http://stackoverflow.com/a/23492745
downvote count: 0

http://stackoverflow.com/q/23510241
has body: I wanted to add attachment using Selenium webdriver. My input tag looks like this. Input tag &lt;input id="5465465456461763_input" type="file" name="_attFile_" multiple="" tabindex="0"/&gt; I am using this code driver.findElement(By.xpath("//input[@name='_attFile_']")).sendKeys("D:/foldername/filename"); Output: 0B uploaded What could be wrong in this method?
has title: How to attach files using selenium webdriver?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26184045
type: UnansweredQuestion
tagged with: java
tagged with: selenium
linked to: http://stackoverflow.com/q/9726005
type: Question
has comment: http://stackoverflow.com/comment/36058916
has answer: http://stackoverflow.com/a/23510788

http://stackoverflow.com/comment/36004351
type: Comment
comment on: http://stackoverflow.com/a/23480565
score: 0
type: AnswerComment
has text: The NPE is due to the reason that this.context is not assigned the value. It can find symbol items as you are passing those items to super class..

http://stackoverflow.com/q/23568253
has comment: http://stackoverflow.com/comment/36172420
has title: Java.lang.NoClassDefFoundError : org/apache/poi/ss/usermodel/Font
has comment: http://stackoverflow.com/comment/36172319
has answer: http://stackoverflow.com/a/23590815
tagged with: spring-mvc
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/36175596
accepted answer: http://stackoverflow.com/a/23590815
has comment: http://stackoverflow.com/comment/36168258
tagged with: excel
type: AnsweredQuestion
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/36168663
has comment: http://stackoverflow.com/comment/36166729
has comment: http://stackoverflow.com/comment/36166690
type: Question
tagged with: runtime-error
score: 5
has comment: http://stackoverflow.com/comment/36179632
has comment: http://stackoverflow.com/comment/36170110
answer count: 1
has body: I'm Using Apache POI to read some Excel files. I've created a console application to do the job, after that I've tried to integrate the code in a Spring MVC webApp (nothing special, I know). I've included the same Jar files to my Classpath, but whenever I try to run the code, I got this error: java.lang.NoClassDefFoundError : org/apache/poi/ss/usermodel/Font I believe that the class Font was found during compilation time, but not at runtime. I'm pretty sure that the problem is not with the ClassPath, but I can't figure out how to solve this. EDIT : When I copy the same code in a new class with main method (in the same web project), and run my web app as a console java app, it works.
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/23583231
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36262527
type: Answer
has body: First, this isn't a good SO question because there's no way to provide references or test my answer with what you've given. So some answers based on theory: Which should be faster and lighter for an android app? Your code should be faster. Two reasons: It is "precompiled." The regex matcher compiles the pattern into an internal code of some kind (a bytecode or tree). This takes time. Your code runs with no such overhead. Most regex matchers - including the Java library's - use a general branch and bound search algorithm. Even if searching is never necessary (it always branches correctly), the capability to search introduces some small overhead. So if your code is running slower than an equivalent regex, your code is not good. There is one caveat: In Android your code is probably written in Java, I am assuming the Android regex library is still Java code. It was last time I wrote to Android, but that's been several versions ago. The Android Java compiler is not yet as good as the native gcc. So if some optimization has been added, you might have to re-implement your code natively to do better than a regex. Very important caveat and educated guess: Reading patterns from the file and compiling (if using regexes) should be done only once during app start-up. If you do this, the speed difference between your code and the regex method will be so tiny that it won't make a difference.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/23581580
accepted answer of: http://stackoverflow.com/q/23581580

http://stackoverflow.com/q/23577060
has comment: http://stackoverflow.com/comment/36183598
tagged with: generics
tagged with: linked-list
score: 0
has comment: http://stackoverflow.com/comment/36184222
has title: Transfer next and previous functions from a generic doublelinked list to a specific
tagged with: java
type: UnansweredQuestion
has body: I am making a card game, but having some problems implementing my double linked list and adding cards etc. I want to store 52 Card(s) from my card class (which is just an object with only the value IndexValue (from 1-52) In a double linked list to represent a deck of cards, and then i want to be able to preform operations like drawing cards from it, which should return the next cards in the deck. My problem is that in the DoubleLinkedList cards I am storing Cards, but when i want to draw the next card (or previous or w/e) i cannot do like currCard.next since currCard is a Card and not an Element and thus it doesn't have any of the next or previous pointers in the element class. I just cant figure out how co transfer those attributes over. I have been stuck for days now been googling around about generics etc but just cant find it My doubleLinkedList class: import java.util.NoSuchElementException; public class DoubleLinkedList&lt;E&gt; { protected transient Element&lt;E&gt; head; protected transient Element&lt;E&gt; tail; protected transient int size; public DoubleLinkedList() { head = null; tail = null; size = 0; } public int size() { return size; } public E removeFirst() { if (size == 0) throw new NoSuchElementException(); Element&lt;E&gt; temp = head; head = head.next; head.previous = null; size--; return temp.indexValue; } public void addFirst(E value) { head = new Element&lt;E&gt;(value, head, null); if(tail == null) tail = head; size++; } public E getFirst() { return head.indexValue; } public void addLast(E value) { tail = new Element&lt;E&gt;(value, null, tail); if(head == null) head = tail; size++; } public E removeLast() { if (size == 0){ throw new NoSuchElementException(); } Element&lt;E&gt; temp = tail; tail = tail.previous; tail.next = null; size --; return temp.indexValue; } public E getLast() { if (size == 0) throw new NoSuchElementException(); Element&lt;E&gt; finger = head; while(finger.next != null) { finger = finger.next; } return finger.indexValue;…
has comment: http://stackoverflow.com/comment/36183505
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/36183422

http://stackoverflow.com/a/23632927
has body: In case of an open source project, use web service for assigning username and password to the user who is using project with there application. To implement this, you need to implement some SOAP base approach with axis-2 in java, if that LIB is build in java and simply call the methods with your business logic. Last but not the least, try to create username and password for the user who download's this LIB so that you don't need to share your username and password with the jar of source files .
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23593763
answers question: http://stackoverflow.com/q/23593763
score: 0
upvote count: 1
type: Answer
downvote count: 1

http://stackoverflow.com/a/23590480
has comment: http://stackoverflow.com/comment/92401047
downvote count: 0
answers question: http://stackoverflow.com/q/23578742
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/115488163
score: 14
has comment: http://stackoverflow.com/comment/92440205
upvote count: 14
accepted answer of: http://stackoverflow.com/q/23578742
has body: When a request comes in to the spring dispatcher, part of the controller mapping/matching is matching accepted media types on the client side to producible media types on the controller side (so you can have controllers that are only distinguishable by their produced media types). The bad news is that springmvc in its default configuration favors the extension of the requested url over any accept header in the request. In your example, when you are requesting abc there is no match on the extension so other contentent negotiation strategies are kicking in eventually resolving to the right type (via accept header). But if you request abc.com spring will derive a mime type of application/octet-stream that doesn't match the produces of your controller and generating a 406 (because there is no matching controller). You can find the default mime matching for path extensions in the spring-context-support.jar in org/springframework/mail/javamail/mime.types (see https://github.com/spring-projects/spring-framework/blob/master/spring-context-support/src/main/resources/org/springframework/mail/javamail/mime.types#L278 ). You can disable this 'feature' in your dispatcher config so spring will not use the path extension to resolve the mime-type: &lt;bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean"&gt; &lt;property name="favorPathExtension" value="false" /&gt; &lt;/bean&gt; If you are using java config have a look at my related question/answer.
has comment: http://stackoverflow.com/comment/61716001

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/23516236
tags question: http://stackoverflow.com/q/23497532
type: Tag
tags question: http://stackoverflow.com/q/23488601

http://stackoverflow.com/comment/35973961
type: Comment
comment on: http://stackoverflow.com/q/23464950
score: 0
type: QuestionComment
has text: Don't: simply check the state (before and) after the signals.

http://stackoverflow.com/q/23609660
score: 0
has answer: http://stackoverflow.com/a/23610009
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: eclipse
has body: Does Eclipse provide executing some commands or batch calls when exporting to JAR, like Post-build-Event in Visual Studio? I want to create jni4net a jar proxy automatically.
answer count: 1
tagged with: jar
has title: Execute a cmd after JAR export in Eclipse

http://stackoverflow.com/comment/36147841
has text: Uh, your inner class isn't static? That is some "news" honestly. Also, what is this model class you are talking about?
type: Comment
comment on: http://stackoverflow.com/q/23554127
score: 0
type: QuestionComment

http://stackoverflow.com/q/23607640
has comment: http://stackoverflow.com/comment/36240137
score: -1
has body: On the line with the "here" comment I get an index out of bounds error for some input data. It does not always occur. It does not occur when the program is run on my machine, even. It occurs when a project teammate runs the project on his laptop. I know there's output from the exception regarding the actual index, but for reasons I don't have that information right now. I might be able to update with the full exception soon. public int getDistance(int[] arrayA, int[] arrayB) { int[][] array = new int[arrayA.length][arrayB.length]; for (int i = 0; i &lt; arrayA.length; i++) array[i][0] = i; for (int i = 0; i &lt; arrayB.length; i++) array[0][i] = i; // Here I cut the method off here as the remainder shouldn't be relevant. As you can see I create a two dimensional array from two single dimensional arrays (arrayA and arrayB) and the width and height of that array equals the length of the two single dimensional arrays. Then I set the "leftmost" column to incrementing numbers and the "uppermost" row to incrementing numnbers. If you need more code, I can post it.
downvote count: 1
accepted answer: http://stackoverflow.com/a/23607836
has title: Unexpected array index out of bounds exception
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36241044
possible better answer: http://stackoverflow.com/a/23607861
tagged with: java
has answer: http://stackoverflow.com/a/23607861
has comment: http://stackoverflow.com/comment/36240224
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/36239971
has comment: http://stackoverflow.com/comment/36240548
favorite count: 0
has answer: http://stackoverflow.com/a/23607836
tagged with: exception

http://stackoverflow.com/q/23464570
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: c#
has body: I'm working on file transfer program between PC &amp; Android Device. but I found a problem in PC server part. First, my android app request connection to PC like below. public void run() { try { InetAddress lServerAddress = InetAddress.getByAddress( new byte[] { (byte)192, (byte)168, (byte)0, (byte)196 }); Socket lClient = new Socket(); lClient.bind(null); lClient.connect(new InetSocketAddress(lServerAddress, 12303), 20000); OutputStream lOutput = lClient.getOutputStream(); lOutput.write(ByteBuffer.allocate(4).putInt(123456).array()); } catch (Exception e) { Log.e(AppManager.msLogTag, e.getMessage()); } } This codes are executed in worker thread. And then server codes in Java. public static void main(String[] args) { try { ServerSocket lServer = new ServerSocket(12303); Socket lClient = lServer.accept(); System.out.println("Accepted."); InputStream lReadStream = lClient.getInputStream(); byte[] lBuffer = new byte[4]; lReadStream.read(lBuffer, 0, lBuffer.length); ByteBuffer lBytes = ByteBuffer.wrap(lBuffer); System.out.println(lBytes.getInt()); lReadStream.close(); lClient.close(); lServer.close(); } catch (Exception e) { e.printStackTrace(); } } It works perfectly. However in C#, TcpListener do not accept client forever. Here is source. static void Main(string[] args) { IPAddress lServerIp = null; foreach (IPAddress lIp in Dns.GetHostAddresses(Dns.GetHostName())) { if (lIp.AddressFamily == AddressFamily.InterNetwork) { lServerIp = lIp; break; } } if (lServerIp != null) { TcpListener lServer = new TcpListener(lServerIp, 12303); Console.WriteLine(lServerIp.ToString()); lServer.Start(); using (Socket lClient = lServer.AcceptSocket()) { Console.WriteLine(((IPEndPoint)lClient.RemoteEndPoint).Address.ToString()); using (Stream lStream = new NetworkStream(lClient)) { byte[] lBuffer = new byte[4]; lStream.Read(lBuffer, 0, lBuffer.Length); int lHead = BitConverter.ToInt32(lBuffer, 0); Console.WriteLine(lHead.ToString()); } } } } Environments are same, port forwarded and reg…
has answer: http://stackoverflow.com/a/23464686
answer count: 1
downvote count: 0
has title: Difference of C# TcpListener & Java ServerSocket
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/23464686
type: AnsweredQuestion

http://stackoverflow.com/a/23470729
has body: Yes you can determine the size of both the memory and disk cache: From the library's documentation ImageLoaderConfiguration config = new ImageLoaderConfiguration .Builder(getApplicationContext()) .discCache(new UnlimitedDiscCache(cacheDir)) And then the author explains more about the other options for discCache: Using discCache(), you can define cash implementation in the file system. You can use ready-made solutions (where the files matching certain URLs are named as hash codes of these URLs): 1 - UnlimitedDiscCache (usual cache, no restrictions) 2 - FileCountLimitedDiscCache (cache with limited files number) 3 - TotalSizeLimitedDiscCache (cache with limited size) You are also able to have your own implementation of the Disk and memory cache, more information on that in the link i provided earlier.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23463830
answers question: http://stackoverflow.com/q/23463830
has comment: http://stackoverflow.com/comment/39830388
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36178235
comment on: http://stackoverflow.com/a/23574169
has text: You should have a class which extends JFrame and where you call add(FileChooserDemo()) to the contentPane, and there you place the above code.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23501529
has body: Your logic is incorrect. You compare your ID with every row. And for each row, if the row'sID doesn't match with the product ID, you add a new row. The logic should be: if (modele.containsId(idprod)) { addProduct(); } else { showError(); } Now you just need to add the containsId() method to your model.
type: Answer
answers question: http://stackoverflow.com/q/23500969
has comment: http://stackoverflow.com/comment/36070574
has comment: http://stackoverflow.com/comment/36062994
score: 0

http://stackoverflow.com/a/23485296
has comment: http://stackoverflow.com/comment/103612263
type: Answer
has comment: http://stackoverflow.com/comment/58706023
score: 11
has comment: http://stackoverflow.com/comment/36046353
answers question: http://stackoverflow.com/q/23478649
downvote count: 0
has comment: http://stackoverflow.com/comment/78083018
has body: This is usually caused by a misconfiguration. Check your /etc/hosts file to ensure that: localhost maps to 127.0.0.1 your real hostname maps to your real host address Some Linux distributions are known to have this back to front. If the problem persists, try setting java.rmi.server.hostname at the server to the IP address the client should use when executing remote method calls. It needs to be set before you export any remote objects, including the Registry. The problem is caused by the IP address embedded in the stub, which ultimately comes from something like InetAddress.getLocalAddress(), which is fallible as above. It is overridden by java.rmi.server.hostname. This is item A.1 in the FMI FAQ, but note that the item is mistitled. It doesn't happen during lookup(), it happens when you call a remote method on the resulting stub.
upvote count: 11
has comment: http://stackoverflow.com/comment/36049761
has comment: http://stackoverflow.com/comment/103612458

http://stackoverflow.com/q/23532132
type: Question
has answer: http://stackoverflow.com/a/23532946
has body: I have recently taken some OOP lessons in java. While implementing it today, I came across " cannot find symbol" error in my program. In the suggestions on the side it says, "expression expected". I have been trying to figure out my mistake for a while now but no luck has met me so far. Can someone help me here? This is my main class: public class Slotmachine { public static void main(String[] args) { int plays; SlotMac machine[] = new SlotMac[3]; // error seems to be somewhere here! SlotMac[0] = new SlotMac(3,35,30); SlotMac[1] = new SlotMac(10,100,60); SlotMac[2] = new SlotMac(4,10,9); plays = machine.firstmachine(machine[0]); } } My other class: public class SlotMac { int win_plays; int times_played; int quarters; public SlotMac(int times_played, int win_plays, int quarters) { this.win_plays = win_plays; this.times_played = times_played; this.quarters = quarters; } public int firstmachine(SlotMac one) { return plays; } } java: cannot find symbol symbol: class SlotMac location: class Slotmachine Same error bunch of time.
linked to: http://stackoverflow.com/q/23532713
score: 0
has answer: http://stackoverflow.com/a/23532195
favorite count: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23532151
upvote count: 1
downvote count: 1
has title: "Expression expected" and "Cannot find symbol" error
has comment: http://stackoverflow.com/comment/36101074
has answer: http://stackoverflow.com/a/23532160
tagged with: java
has answer: http://stackoverflow.com/a/23532149

http://stackoverflow.com/q/23575067
tagged with: java
has body: Suppose I have some async computation, such as: CompletableFuture .supplyAsync(() -&gt; createFoo()) .thenAccept(foo -&gt; doStuffWithFoo(foo)); Is there a nice way to provide a default value for foo if the async supplier times out according to some specified timeout? Ideally, such functionality would attempt to cancel the slow-running supplier as well. For example, is there standard library functionality that is similar to the following hypothetical code: CompletableFuture .supplyAsync(() -&gt; createFoo()) .acceptEither( CompletableFuture.completedAfter(50, TimeUnit.MILLISECONDS, DEFAULT_FOO), foo -&gt; doStuffWithFoo(foo)); Or perhaps even better: CompletableFuture .supplyAsync(() -&gt; createFoo()) .withDefault(DEFAULT_FOO, 50, TimeUnit.MILLISECONDS) .thenAccept(foo -&gt; doStuffWithFoo(foo)); I know about get(timeout, unit), but am wondering if there's a nicer standard way of applying a timeout in an asynchronous and reactive fashion as suggested in the code above. EDIT: Here's a solution that's inspired by Java 8: Mandatory checked exceptions handling in lambda expressions. Why mandatory, not optional?, but unfortunately it blocks a thread. If we rely on createFoo() to asynchronously check for timeout and throw its own timeout exception it would work without blocking a thread, but would place more burden on the creator of the supplier and would still have the cost of creating an exception (which can be expensive without "fast throw") static &lt;T&gt; Supplier&lt;T&gt; wrapped(Callable&lt;T&gt; callable) { return () -&gt; { try { return callable.call(); } catch (RuntimeException e1) { throw e1; } catch (Throwable e2) { throw new RuntimeException(e2); } }; } CompletableFuture .supplyAsync(wrapped(() -&gt; CompletableFuture.supplyAsync(() -&gt; createFoo()).get(50, TimeUnit.MILLISECONDS))) .exceptionally(e -&gt; "default") .thenAcceptAsync(s -&gt; doStuffWithFoo(foo));
has answer: http://stackoverflow.com/a/24457111
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/36462750
favorite count: 0
score: 38
has answer: http://stackoverflow.com/a/39036944
has answer: http://stackoverflow.com/a/35362999
answer count: 5
upvote count: 38
has title: Timeout with default value in Java 8 CompletableFuture
has answer: http://stackoverflow.com/a/23577357
linked to: http://stackoverflow.com/q/14039995
type: UnansweredQuestion
tagged with: java-8

http://stackoverflow.com/q/23538072
has title: Matching ${123...456} and extracting 2 numbers in Java?
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/36110138
has body: What is the simplest succinct way to expect 2 integers from a String when i know the format will always be ${INT1...INT2} e.g. "Hello ${123...456} would extract 123,456?
type: Question
has answer: http://stackoverflow.com/a/23538177
tagged with: java
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/23538177
favorite count: 0
possible better answer: http://stackoverflow.com/a/23538170
has answer: http://stackoverflow.com/a/23538170
tagged with: regex
has comment: http://stackoverflow.com/comment/36110122

http://stackoverflow.com/a/23479048
type: Answer
score: 4
upvote count: 4
has body: Wow! This was obscure, but I figure it out: Taking a look at the source for the doPut()-method in AsyncMemcacheServiceImpl.java, line 505 reads: itemBuilder.setExpirationTime(expires == null ? 0 : expires.getSecondsValue()); And Expiration.getSecondsValue() contains the following line: return (int) (getMillisecondsValue() / 1000); In other words: An expiration value of "0" is equivalent to no expiration (same as null), and the expiration time is converted to seconds, by dividing by 1000. So, if I set an expiration of 1ms, it gets turned into 0 seconds (rounded down when divided by 1000), which is equivalent to no expiration... Blah!!! So, the answer is: Expiration.onDate(new Date(1000)) should expire immediately, unless the memcache server is still living in the 60's... :) Tried it. Works. Done... (These tests were done on the DevServer. I'm hoping that the production server will behave the same.)
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23478588
accepted answer of: http://stackoverflow.com/q/23478588

http://stackoverflow.com/q/23557942
type: Question
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
tagged with: rest
tagged with: spring-el
upvote count: 6
has answer: http://stackoverflow.com/a/23567236
tagged with: spring-mvc
has title: Return JSON on unauthorized REST service request using Spring Security 'hasPermission()'
score: 6
accepted answer: http://stackoverflow.com/a/23567236
type: AnsweredQuestion
tagged with: java
has body: I am implementing method level restriction/authorization (on REST services) using Spring security. I have used the spring expression language and implemented custom Expression Evaluator. It is working fine for me. However, if an unauthorized user tries to access the service, it is responding with a login page. Since my application is REST based only, I want to return only JSON data for all the requests. How do I make it return JSON instead of the login page?(eg: {status : Denied}) Here is the code Snippet: CustomEvaluator public boolean hasPermission(Authentication authentication, Object userId, Object permissionId) { List&lt;String&gt; permList = new MyDAO().getPermissionsForUser((String) userId); if(permList.contains(((String) permissionId))){ return true; }else{ return false; } } Service @PreAuthorize("hasPermission(#userId, '3')") public String testAuthorization(Object obj, String userId){ System.out.println("Has access to the service method...."); return "success"; } Controller public @ResponseBody String testAuthorization(Object o,@RequestParam("userId") String userId){ System.out.println("User ID = "+userId); String abc = service.testAuthorization(o,userId); return "{\"status\":\"success\"}"; } spring-security.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: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/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"&gt; &lt;security:global-method-security secured-annotations="enabled" pre-post-annotations="enabled"&gt; &lt;security:expression-handler ref="expressionHandler"/&gt; &lt;/security:global-method-security&gt; &lt;!-- This is where we configure Spring-Security --&gt; &lt;security:http aut…

http://stackoverflow.com/comment/36214407
comment on: http://stackoverflow.com/a/23585491
score: 0
type: AnswerComment
has text: Okay. And who exactly will invoke those "pure Java" tools? And when? You should probably eliminate JMH from the equation for a time being, and try a simple project which compiles the source code and runs your own annotation processors over it. I think that would be an enlightening exercise. After you are done with that, get the Ant sample from JMH, and redo it in "plain Java". Not sure if that is the problem needing the solution though -- it smells like winding up an ad hoc build system when standard ones are available.
type: Comment

http://stackoverflow.com/comment/36067334
has text: **Surprise....!!!** You question contains answer!!! :)
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/23515644

http://stackoverflow.com/q/23474246
has comment: http://stackoverflow.com/comment/35990535
type: Question
answer count: 2
upvote count: 0
has body: How can I create a file(using Java for Android) in my Application data directory and write an integer in it and then use that integer? I think I would save it in .txt or .xml file.
has answer: http://stackoverflow.com/a/23474398
has answer: http://stackoverflow.com/a/23474349
has comment: http://stackoverflow.com/comment/35990806
has title: Input/output Java Android
has comment: http://stackoverflow.com/comment/35990475
favorite count: 0
linked to: http://stackoverflow.com/q/14376807
has comment: http://stackoverflow.com/comment/35990520
has comment: http://stackoverflow.com/comment/35990631
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35990516
tagged with: android
tagged with: io
score: -3
has comment: http://stackoverflow.com/comment/35990776
tagged with: java
downvote count: 3

http://stackoverflow.com/a/23542205
has body: Create anim directory from res dir and put animation file into anim directory and clean the project then try to access.
answers question: http://stackoverflow.com/q/23540862
score: 0
type: Answer

http://stackoverflow.com/a/23566167
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23565486
has comment: http://stackoverflow.com/comment/36162568
type: Answer
has comment: http://stackoverflow.com/comment/36162429
has comment: http://stackoverflow.com/comment/36206135
upvote count: 1
score: 1
has body: It sounds more like jar issue. JsonObject is the class used across various open source libraries. Download this jar json-rpc-1.0.jar Try this: JSONObject json = new JSONObject(); json.put("value", "aész"); System.out.println(json.toString()); produces : {"Name":"u00e9sz"}
accepted answer of: http://stackoverflow.com/q/23565486

http://stackoverflow.com/comment/36038842
has text: Have the `in()` method return an array of size 2? Bit gnarly, but it'd work.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23499924
type: Comment

http://stackoverflow.com/q/23584443
favorite count: 0
upvote count: 3
tagged with: ubuntu-12.04
has title: Tomcat crashes Eclipse Kepler with "Failed to write core dump."
has body: After upgrading my Ubuntu from 12.04 to 14.04 I've faced some problems on deploying my application with Tomcat in Eclipse. When I run my application, Tomcat starts successfully, and then, before the internal Eclipse web-browser opening, it crashes, giving me the next log file: # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f50a9c90ca9, pid=19115, tid=139985944897280 # # JRE version: Java(TM) SE Runtime Environment (7.0_55-b13) (build 1.7.0_55-b13) # Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode linux-amd64 compressed oops) # Problematic frame: # C [libwebkitgtk-1.0.so.0+0x461ca9] webkit_web_view_get_type+0x2489 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # If you would like to submit a bug report, please visit: # http://bugreport.sun.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x00007f50fc00a000): JavaThread "main" [_thread_in_native, id=19118, stack(0x00007f510474e000,0x00007f510484f000)] siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x0000000000000000 Registers: .... .... .... --------------- S Y S T E M --------------- OS:jessie/sid uname:Linux 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 libc:glibc 2.19 NPTL 2.19 rlimit: STACK 8192k, CORE 0k, NPROC 15837, NOFILE 4096, AS infinity load average:1,41 1,37 1,59 /proc/meminfo: MemTotal: 2048668 kB MemFree: 72176 kB Buffers: 3084 kB Cached: 302944 kB SwapCached: 1704 kB Active: 1308052 kB Inactive: 498300 kB Active(anon): 1213508 kB Inactive(anon): 404816 kB Active(file): 94544 kB Inactive(file): 93484 kB Unevictable: 32 kB Mlocked: 32 kB SwapTotal: 1999868 kB SwapFree: 1877512 kB Dirty: 412 kB Writeback: 0 kB AnonPages: 1498712 kB Mapped: 202…
has answer: http://stackoverflow.com/a/24794424
downvote count: 0
type: UnansweredQuestion
score: 3
tagged with: java
tagged with: ubuntu-14.04
tagged with: eclipse
type: Question
answer count: 1
tagged with: tomcat

http://stackoverflow.com/a/23596623
type: AcceptedAnswer
score: 82
accepted answer of: http://stackoverflow.com/q/23596530
type: Answer
has comment: http://stackoverflow.com/comment/108295809
answers question: http://stackoverflow.com/q/23596530
has comment: http://stackoverflow.com/comment/108295785
has body: This does not work because your input (and your Formatter) do not have time zone information. A simple way is to parse your date as a LocalDate first (without time or time zone information) then create a ZonedDateTime: public static ZonedDateTime convertirAFecha(String fecha) { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); LocalDate date = LocalDate.parse(fecha, formatter); ZonedDateTime resultado = date.atStartOfDay(ZoneId.systemDefault()); return resultado; }
downvote count: 0
upvote count: 82

http://stackoverflow.com/comment/36053896
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23507876
has text: Ever heard of an array?

http://stackoverflow.com/comment/36162862
type: AnswerComment
score: 0
type: Comment
has text: @bloodyshadow Yes sorry, I'm typing without thinking here - it's the original bitmap that is now a different size to the ROI, so one of them has to change. See above for amended answer although I've just guessed the syntax for creating a new bitmap (I'm not a regular java user)....
comment on: http://stackoverflow.com/a/23564847

http://stackoverflow.com/q/23493112
has title: How to use OpenCL put3DRangeKernel?
has body: I want to process an image in OpenCL, using the Jogamp library in Java. CLCommandQueue queue = device.createCommandQueue(); queue.putWriteBuffer(input, true); kernel.putArg(input) .putArg(ouput) .putArg(width) .putArg(height) .putArg(depth); int groupSize = Math.min((int) kernel.getWorkGroupSize(device), 16); queue.put3DRangeKernel(kernel, 0, 0, 0, width, height, depth, groupSize, groupSize, groupSize); queue.flush(); queue.finish(); queue.putReadBuffer(output, true); output.getBuffer().rewind(); queue.release(); However, I'm not sure how to use put3DRangeKernel and always end up with InvalidWorkGroupSizeExceptions. Exception in thread "main" com.jogamp.opencl.CLException$CLInvalidWorkGroupSizeException: can not enqueue 3DRange CLKernel [id: 139725705923824 name: identity] with gwo: null gws: {256, 256, 256} lws: {16, 16, 16} The web is lacking samples. How is put3DRangeKernel used correctly? Update: device.getMaxImage3dWidth shows 2048 (same with height and depth), so the package size is not the problem. To give an example, I took an 256 x 256 x 256 image, the localGroupSize is 16. So globalWorkSize % localWorkSize is 0.
tagged with: opencl
tagged with: java-3d
has answer: http://stackoverflow.com/a/23493423
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23493423
score: 0
answer count: 1

http://stackoverflow.com/comment/36163038
type: Comment
has text: @Jenox that may be for Objective C, but in Java interfaces are types.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23566429

http://stackoverflow.com/comment/36062924
comment on: http://stackoverflow.com/a/23512177
type: AnswerComment
score: 0
type: Comment
has text: Unfortunately there is no real solution. A crappy workaround you could do is this: Open the page in your browser (e.g. Chrome) and go to the developer tools. There you can see all requests the website makes to the server (so all JavaScript requests). Each request is an URL, so you could take those URLs and parse the response.

http://stackoverflow.com/q/23467658
accepted answer: http://stackoverflow.com/a/23467834
type: Question
tagged with: rmi
tagged with: java
has answer: http://stackoverflow.com/a/23467834
has body: I search the web for awhile but did not find an answer to this questions. Why there is the need for a client.policy file? Maybe someone could point me to the Oracle page with that topic. I found abondon sites only. While the server needs to specify the access levels, why I have to put this file in my client too? I would assume that the client tries to connect to the server and the server decides if that access is allowed or not. Putting the definion on the client side fells a little bit odd for me.
score: 0
answer count: 1
has title: RMI - Why there is a client.policy
type: AnsweredQuestion
tagged with: policy

http://stackoverflow.com/comment/36004013
has text: Excuseme, it was `super`, not `parent`. I was mixing languages
type: Comment
comment on: http://stackoverflow.com/a/23481105
score: 0
type: AnswerComment

http://stackoverflow.com/q/23471620
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23473613
type: Question
tagged with: eclipse
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23473613
tagged with: eclipse-rcp
has title: Eclipse 4 reuse toolbar for different parts
has body: I've build about 10-15 Parts in differenet PartStacks. Every Part should have some Handled Tool Item, 4 of them are identical. Because of this I want to reuse this 4 toolbar-items without adding them manually to every part. In Eclipse 3.x we had build these toolbars via inheritance - each view, which should have this toolbar-items extends a class, which adds these items. Is there a proper way to have a "toolbar-template"? Any ideas wanted ;) Cheers, Steffen SOLUTION: (thanks greg) Thank you Greg, the Processor worked. Here is the corresponding code: @Inject @Named("de.test.myperspective") private MPerspective perspective; @Inject private MApplication application; @Execute public void execute(EModelService modelService) { if (perspective != null) { List&lt;MPart&gt; parts = modelService.findElements(perspective, null, MPart.class, null); for (MPart part : parts) { MUIElement snip = modelService.cloneSnippet(application, "de.test.mytoolbarsnippet", null); MToolBar toolbar = (MToolBar) snip; part.getToolbar().getChildren() .addAll(0, toolbar.getChildren()); } } } In the fragment.xmi I added a new ModelFragment to Application->Snippets and added a Toolbar with ID "de.test.mytoolbarsnippet" there.
tagged with: e4
type: AnsweredQuestion

http://stackoverflow.com/comment/36171927
type: AnswerComment
has text: Thanks. I'll check that.
type: Comment
comment on: http://stackoverflow.com/a/23571056
score: 0

http://stackoverflow.com/comment/36054188
has text: rs is just ResultSet rs;
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23507981

http://stackoverflow.com/q/23587805
score: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/36203183
has answer: http://stackoverflow.com/a/23587967
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36203487
tagged with: java
accepted answer: http://stackoverflow.com/a/23587967
type: Question
has title: Pressing a radio button twice, calculates twice
has body: In my code if the user presses the radio button twice it will calculate the value twice. How can I prevent this? I am using a switch statement inside a onClick. @Override public void onClick(View v) { double value; NumberFormat myMileFormat = new DecimalFormat("0.00"); NumberFormat myMeterFormat = new DecimalFormat("0000"); String stringEmptyCheck = edit_distance.getText().toString(); switch (v.getId()) { case R.id.button_minusDis: decrementLength(); break; case R.id.button_plusDis: incrementLength(); break; case R.id.button_done: this.finish(); break; case R.id.radio_miles: if (stringEmptyCheck.matches("")) { Toast.makeText(getApplicationContext(), "Miles or meters cannot be empty", Toast.LENGTH_LONG) .show(); value = 3.50; edit_distance.setText(myMileFormat.format(value)); } else { value = Double.parseDouble(edit_distance.getText().toString()); if ((value /= 1609.00) &gt; DistanceInterval.MAX_LENGTH_MILES) { value = DistanceInterval.MAX_LENGTH_MILES; } edit_distance.setText(myMileFormat.format(value)); } break;

http://stackoverflow.com/a/23610456
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23610375
has body: try this: ArrayList&lt;String&gt; mylist = new ArrayList&lt;String&gt;(); for (String key : map.keySet()) { int value = map.get(key); if (key &gt; 10) { mylist.add(key); } }

http://stackoverflow.com/a/23464962
upvote count: 2
type: Answer
score: 2
has body: Distance from the top would be row, int row = (int)(13/5); // 2 Distance from the left would be column, take the remainder of 13 by 5. int col = (int)(13%5); // 3 Distance from the right would be the column minus total columns (5) int colFromRight = 5-col-1; // 1 Distance from the bottom would be the row minus total rows (5) int rowFromBottom = 5-row-1; // 2 Edit: Heres a little diagram th at may help heres an 1 dimensional array that we want to treat as a 2d array. It has 2 rows and 3 columns for a total of 6 elements. In our program it is a 1d array like this, I am using brackets[] for looks not syntax. [1][2][3][4][5][6] visually it would be like this [1][2][3] [4][5][6] So to get the row of say location 5 we say int location = 5; int row = floor(location/3); As you can see every time the row becomes 1+ a multiple of 3 the row number will increase. for columns its the same thing but with a remainder. int location = 5; int column = location%3; Here every time the location reaches 3 the remainder returns to 0 and the columns start over (essential signaling a new row).
answers question: http://stackoverflow.com/q/23464895
has comment: http://stackoverflow.com/comment/35976754
accepted answer of: http://stackoverflow.com/q/23464895
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/35975038

http://stackoverflow.com/comment/36154508
score: 2
has text: But as you can see here: `http://regex101.com/r/zL6yH3` that `1 2 3` can't become `123` with `(\\d) (\\d)`
comment on: http://stackoverflow.com/a/23561058
type: Comment
type: AnswerComment

http://stackoverflow.com/q/23476836
has comment: http://stackoverflow.com/comment/35996740
has comment: http://stackoverflow.com/comment/35996096
has comment: http://stackoverflow.com/comment/35995358
type: UnansweredQuestion
tagged with: swing
has title: Set jTextArea to visible false by default
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/49024675
type: Question
tagged with: jtextarea
has answer: http://stackoverflow.com/a/23491943
has body: I am making an application that show the information I entered in a textfield, combo box, etc.. into a text area. I want to hide the text area when I started up the application and when I press on a button I want to show with the desired information. I've tried to place &lt;nameOfTextArea&gt;.setVisible(false); in the frame constructor, but it is still visible. How can I start up the frame without seeing this text area? Constructor frame: public StudentInfoFrame() { initComponents(); textAreaVoorOpslaanInfo.setVisible(false); } My button in the frame: private void uitvoerButtonActionPerformed(java.awt.event.ActionEvent evt) { try{ ..... Variables here ..... textAreaVoorOpslaanInfo.setVisible(true); textAreaVoorOpslaanInfo.append("Voornaam: \t\t" + voornaam + "\n" + "Achternaam: \t\t" + achternaam + "\n" + "E-mail adres: \t\t" + email + "\n" + "Geboortedatum: \t" + geboortedatum + "\n" + "Lengte: \t\t" + lengte + "m\n" + "Gewicht: \t\t" + gewicht + "kg\n" + "Geslacht: \t\t" + geslacht + "\n" + "Vooropleiding(en): \t" + vooropleiding + "\n" + "Uitwonend: \t\t" + uitwonend); } catch (Exception e){ System.out.println(e); } }
has answer: http://stackoverflow.com/a/23477134
answer count: 3

http://stackoverflow.com/q/23549426
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/46740172
score: 2
answer count: 0
has body: I have created a client and a server, which both work fine and have no trouble connecting. Now I would like to be able to connect from my android phone to the server. I have imported the kryonet library and copy-pasted the client code into a new android project. The code gave me some errors, but I fixed those. When I tried testing my app, it didn't give me any errors, but my server wasn't getting any connections either. I looked a bit in the LogCat logs, and found out it keeps sticking at "Connecting..". I am totally stuck. This is my android code: public void openSocket(View view){ Log.i(TAG, "test1"); EditText portText= (EditText)findViewById(R.id.port); String parts[] = portText.getText().toString().split(":"); partIP = parts[0]; String partPort = parts[1]; port = Integer.parseInt(partPort); try { client = new Client(); client.start(); register(); pHandler = new PacketHandler(); connect(); } catch (Exception e) { pHandler.checkException(e); } } public static void register() { client.getKryo().register(Packet.class); client.getKryo().register(Packet1Connected.class); client.getKryo().register(String.class); client.getKryo().register(String[].class); client.getKryo().register(Object[].class); } public static void connect() { try { String IP = "*MY IP*:25565"; String[] Ip = IP.split(":"); String ipFinal = Ip[0]; int port = Integer.parseInt(Ip[1]); client.connect(5000, ipFinal, port, port); } catch (IOException e) { try { Thread.sleep(15000); } catch (InterruptedException e2) { e2.printStackTrace(); } System.out.println("Trying to connect."); connect(); } Packet1Connected packet = new Packet1Connected(); packet.id = "Android"; client.sendTCP(packet); } And this is my normal client code: public static void main(String[] args) { try { client = new Client(); client.start(); register(); pHandler = new PacketHandler(); new Main(); } catch (Exception e) { pHandler.checkException(e); } } public static void register() { client.getKryo().register(Packet.class); client.getKryo…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/37839357
has title: Kryonet won't connect from android
downvote count: 0
tagged with: kryonet

http://stackoverflow.com/comment/36064383
comment on: http://stackoverflow.com/a/23513639
type: Comment
has text: It's the actual conversion (JDK 1.7): javap -c
score: 0
type: AnswerComment

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/23534428

http://stackoverflow.com/comment/36188550
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23574977
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete and Verifiable Example). 2) Use a consistent and logical indent for code blocks. The indentation of the code is intended to help people understand the program flow.

http://stackoverflow.com/a/23560213
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23559941
has body: My opinion is that there are two ways to think about this: inputting the File directly just saves time and is simple to understand providing a byte array as input allows more flexibility as to where the content comes from, as long as it is eventually transformed into a byte array, you could eventually have an external service that feeds the content from somewhere else I would go for the second option, and as a suggestion give the Apache Commons IO library a try. It has a FileUtils and IOUtils class that provides some convenient methods for playing around with files and streams.

http://stackoverflow.com/a/63162533
has body: To use JavaFx with Guice : Extend javafx.application.Application & call launch method on that class from the main method. This is the application’s entry point. Instantiate dependency injection container of your choice. E.g. Google Guice or Weld. In application’s start method, instantiate FXMLLoader and set it’s controller factory to obtain controllers from the container. Ideally obtain the FXMLLoader from the container itself, using a provider. Then give it an .fxml file resource. This will create content of the newly created window. Give the Parent object instantiated in previous step to Stage object (usually called primaryStage) supplies as an argument to the start(Stage primaryStage) method. Display the primaryStage by calling it’s show() method. Code Example MyApp.java public class MyApp extends Application { @Override public void start(Stage primaryStage) throws IOException { Injector injector = Guice.createInjector(new GuiceModule()); //The FXMLLoader is instantiated the way Google Guice offers - the FXMLLoader instance // is built in a separated Provider<FXMLLoader> called FXMLLoaderProvider. FXMLLoader fxmlLoader = injector.getInstance(FXMLLoader.class); try (InputStream fxmlInputStream = ClassLoader.getSystemResourceAsStream("fxml\\login.fxml")) { Parent parent = fxmlLoader.load(fxmlInputStream); primaryStage.setScene(new Scene(parent)); primaryStage.setTitle("Access mini Stock App v1.1"); primaryStage.show(); primaryStage.setOnCloseRequest(e -> { System.exit(0); }); } catch (IOException ex) { ex.printStackTrace(); } } public static void main(String[] args) { launch(); } } Then FXMLLoaderProvider.java public class FXMLLoaderProvider implements Provider<FXMLLoader> { @Inject Injector injector; @Override public FXMLLoader get() { FXMLLoader loader = new FXMLLoader(); loader.setControllerFactory(p -> { return injector.getInstance(p); }); return loader; } } Thanks to mr. Pavel Pscheidl who provided us with this smart code at Integrating JavaFX 8 with Guice
has comment: http://stackoverflow.com/comment/113230992
score: 0
has comment: http://stackoverflow.com/comment/112832546
answers question: http://stackoverflow.com/q/23471185
type: Answer

http://stackoverflow.com/comment/36118299
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23542534
has text: Yes. Reading cookie from another domain is secure for me.

http://stackoverflow.com/q/23466904
downvote count: 0
has answer: http://stackoverflow.com/a/23474927
favorite count: 0
type: Question
has body: I'm very new to 3D programming and I'm attempting to implement a camera that will follow my model using LibGDX. I'm having issues with the camera implementation and I would greatly appreciate some advice. As I said, I'm new to this (especially the maths) and the code below will almost certainly not be that great: To rotate my object and camera at the same time I use the following code with inst being the model instance: // right inst.transform.rotate(new Vector3(0,1,0), -1); Common.cam.rotate(Vector3.Y, -1f); // left inst.transform.rotate(new Vector3(0,1,0), 1); Common.cam.rotate(Vector3.Y, 1f); To move my object I use: // forward Common.inst.transform.mul(new Matrix4(new Vector3(0,0,((float)-0.2)), new Quaternion(0,0,0,0), new Vector3(1,1,1))); // back Common.inst.transform.mul(new Matrix4(new Vector3(0,0,((float)0.2)), new Quaternion(0,0,0,0), new Vector3(1,1,1))); My camera is currently setup as follows: Vector3 pos = inst.transform.getTranslation(new Vector3(0,0,0)); pos.z += 5; cam.position.set(pos); This code is working fine, but the problem is that the camera is staying in a fixed position when really it should be adjusting itself to be directly behind the new direction the model is facing. I've probably not articulated this clearly so I've represented this visually: ^ Model (black) and camera (red) with no rotation ^ What is currently happening upon rotation ^ What needs to happen I'd imagine this wouldn't be too difficult to implement if my maths was stronger, but I'm at a complete loss as how to implement this behavior. If someone could point me in the right direction that would be great. Many thanks!
has comment: http://stackoverflow.com/comment/36013869
score: 1
accepted answer: http://stackoverflow.com/a/23474927
upvote count: 1
answer count: 1
tagged with: libgdx
tagged with: camera
has title: LibGDX 3D camera implementation
tagged with: java
has comment: http://stackoverflow.com/comment/36014625
has comment: http://stackoverflow.com/comment/35979834
tagged with: 3d
type: AnsweredQuestion

http://stackoverflow.com/a/23589662
type: Answer
answers question: http://stackoverflow.com/q/23589570
has body: Try this : public class FileLinkList { public static void main(String args[])throws IOException{ String content = new String(); int count=1; File file = new File("abc.txt"); LinkedList&lt;String&gt; list = new LinkedList&lt;String&gt;(); try { Scanner sc = new Scanner(new FileInputStream(file)); while (sc.hasNextLine()){ content = sc.nextLine(); if (content != null &amp;&amp; content.length() &gt; 0)) { list.add(content.trim().split(" ")[0].toLowerCase()); } } sc.close(); } catch(FileNotFoundException fnf){ fnf.printStackTrace(); } catch (Exception e) { e.printStackTrace(); System.out.println("\nProgram terminated Safely..."); } for (String listItem : list) { System.out.println(listItem); } } }
score: 0

http://stackoverflow.com/comment/36157309
comment on: http://stackoverflow.com/a/23563090
has text: @MarkRotteveel But when I export my project and I put the database in the jar and move the jar, the path isn't right anymore... That wouldn't be very useful.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35974726
type: Comment
has text: @user3545312 in you code you have written `if(answer == 0)` as `answer` is 0 so it will execute every time and you will come out from the loop.
comment on: http://stackoverflow.com/a/23465077
type: AnswerComment
score: 0

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/23543247
type: Tag

http://stackoverflow.com/comment/36194951
type: QuestionComment
comment on: http://stackoverflow.com/q/23583460
has text: We were asked to use absolute positioning within each instance, can I use a layout manager for the positioning of each instance?
score: 0
type: Comment

http://stackoverflow.com/q/23505887
upvote count: 0
score: -2
has body: How can we use @service and @ repository stereotype in the same class in Spring? How can we expose the RESTFUL web service as the @Repository stereotype? One way of doing it is @Autowired, but I need a more detailed example of this.
favorite count: 0
tagged with: stereotype
has title: How can we use @service and @ repository stereotype in the same class in Spring?
answer count: 1
has answer: http://stackoverflow.com/a/23505934
type: UnansweredQuestion
downvote count: 2
tagged with: spring
has comment: http://stackoverflow.com/comment/36050424
tagged with: java
type: Question

http://stackoverflow.com/q/23602304
has answer: http://stackoverflow.com/a/23602352
has title: Put values in Hashmap from external methods?
tagged with: hashmap
has answer: http://stackoverflow.com/a/23603616
tagged with: java
has body: I want to do something like in this example. I can't figure out why it is not working. myMap has no value in the main class. But if I put the value in the "putSomethingInTheMap" into the map it has the right value in the main class. Can you give me a suggestion how to handle something like this? public static void main(String[] args) { Map&lt;String, Integer&gt; meineMap = new HashMap&lt;&gt;(); int wert = 1; putSomethingInTheMap(meineMap, wert); System.out.println(meineMap.get("A")); } private static void putSomethingInTheMap(Map&lt;String, Integer&gt; myMap, int value) { myMap = insert(value); } private static Map&lt;String, Integer&gt; insert(int wert) { Map&lt;String, Integer&gt; map = new HashMap&lt;&gt;(); map.put("A", wert); return map; }
has answer: http://stackoverflow.com/a/23602628
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23602541
score: -2
answer count: 4
type: UnansweredQuestion
downvote count: 2
type: Question

http://stackoverflow.com/comment/36225237
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23598445
has text: Are you trying to send a GET with a body using Play or receive a GET with a body?

http://stackoverflow.com/q/23567267
favorite count: 0
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23583917
upvote count: 3
tagged with: java
has title: Why does JPA update the OrderColumn instead of setting it on creation?
tagged with: jpa
has answer: http://stackoverflow.com/a/23583917
linked to: http://stackoverflow.com/q/23545352
tagged with: eclipselink
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/27554102
downvote count: 0
has body: I want to add a NOT NULL constraint to my table on my OrderColumn. Running my code with the constraint I get a constraint violation error. Running without the constraint I see that the row is first inserted without the OrderColumn, and then updated immediately after with the correct OrderColumn. Is there a reason for this behavior? My entity managing the OrderColumn: @Entity @Table(name="INSPECTION") public class Inspection implements Serializable { ... @OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE}, orphanRemoval=true) @OrderColumn(name="LIST_INDEX", nullable=false) @JoinColumn(name="INSPECTION_ID") private List&lt;RecommendationInstance&gt; recommendations; ... } This question stemmed from Why is JPA ignoring my @OrderColumn in a basic use case? where I was confused as to why my OrderColumn wasn't getting inserted. Additional code samples can be seen there.
has answer: http://stackoverflow.com/a/27554102

http://stackoverflow.com/q/23599726
answer count: 2
score: 0
tagged with: http://stackoverflow.com/tag/html
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23599895
tagged with: swing
has body: I have created an application in JSwing that has a button that I want to open the user manual (which is a html file) in a browser. I can successfully open the entire webpage, but I want to link to certain anchors in the document. For example I am trying to use this code: URI uri = new URI("c:/Giggafriggin/user_manual/user_manual.html#h1_3"); Desktop.getDesktop().browse(uri); But this causes an error, claiming the file cannot be found. But if leave off "#h1_3" it opens the page in a browser without a problem. The anchors work when i enter them into the browser manually. Any ideas?
has answer: http://stackoverflow.com/a/23599872
tagged with: anchor
has title: Opening a Webpage at an Anchor in a Browser through Java
tagged with: java
has comment: http://stackoverflow.com/comment/36228786
type: Question

http://stackoverflow.com/comment/35988798
has text: @prabugp Sorry I didn't mean to be agressive!
comment on: http://stackoverflow.com/a/23473084
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23559259
has answer: http://stackoverflow.com/a/23560842
accepted answer: http://stackoverflow.com/a/23560842
has answer: http://stackoverflow.com/a/64142735
has title: Error while running cucumber in junit
type: AnsweredQuestion
tagged with: cucumber-junit
downvote count: 0
has comment: http://stackoverflow.com/comment/36160714
tagged with: java
has comment: http://stackoverflow.com/comment/36149787
type: Question
tagged with: cucumber
has comment: http://stackoverflow.com/comment/36152152
score: 5
has answer: http://stackoverflow.com/a/56764657
possible better answer: http://stackoverflow.com/a/37790399
has answer: http://stackoverflow.com/a/64476479
has answer: http://stackoverflow.com/a/37790399
answer count: 6
has comment: http://stackoverflow.com/comment/36153125
has answer: http://stackoverflow.com/a/52317563
has body: Hi i am new to cucumber java. i am trying to run a simple cucumber feature test. below are my feature file, step definition file and junit runner file. but i am not able to run the test succesfully in cucumber-java,cucumber-junit 1.1.6 version. Feature file Feature: Test if f1 feature is working Scenario: valid scenario Given input1 is "t" When input2 is also "t" Then result should be "pass" Stepdefinition file package cucumberFrameworkPractise; import org.junit.Assert; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; public class CucumberStepDefinitionTest { String input1,input2,result; @Given("input1 is \"([^\"]*)\"$") public void input1(String input1) { this.input1=input1; } @When("input2 is also \"([^\"]*)\"$") public void input2(String input2) { this.input2=input2; } @Then("result should be \"([^\"]*)\"$") public void result(String result) { this.result=result; Assert.fail(); } } Cucumber runner file package cucumberFrameworkPractise; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions(features = "src/test/resources/cucumberFrameworkPractise", format = { "pretty", "html:target/cucumber-htmlreport", "json-pretty:target/cucumber-report.json" }) public class CucumberRunner { } I am getting below error: java.lang.NoSuchMethodError: cucumber.runtime.RuntimeOptions.<init>(Ljava/util/List;)V at cucumber.runtime.RuntimeOptionsFactory.create(RuntimeOptionsFactory.java:24) at cucumber.api.junit.Cucumber.<init>(Cucumber.java:58) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(Ann…
has comment: http://stackoverflow.com/comment/36153078
favorite count: 0
has comment: http://stackoverflow.com/comment/36161733
upvote count: 5

http://stackoverflow.com/comment/36156993
type: QuestionComment
score: 1
has text: If you are using Java 8: Java 8 no longer includes the `JdbcOdbcDriver`
comment on: http://stackoverflow.com/q/23563005
type: Comment

http://stackoverflow.com/a/23565810
type: Answer
has body: Looks like you can use double dispatching. Instead of returning a value (ie, Object), you return void and pass as a parameter a target object you want your result to be put into. interface ResultProcessor { processTypeA(A item); processTypeB(B item); processTypeC(C item); } interface InputProcessor { processInput(ResultProcessor target); } class ConcreteInputProcessorA { processInput(ResultProcessor target) { A result = ...; // Do something target.processTypeA(result); } } class ConcreteInputProcessorB { processInput(ResultProcessor target) { B result = ...; // Do something target.processTypeB(result); } } class ConcreteInputProcessorC { processInput(ResultProcessor target) { C result = ...; // Do something target.processTypeC(result); } } Update: For example with your new edited code you may write: public class AddOp implements IOperation{ private int a; private int b; private int c; public AddOp(int a, int b){ this.a = a; this.b = b; } @Override public void execute(Executor ex) { this.c = this.a + this.b; ex.executeAddOp(this); } } public class Executor { public void executeAddOp(AddOp op) { System.out.println("Executing an AndOp... " + op); } }
score: 5
accepted answer of: http://stackoverflow.com/q/23565632
upvote count: 5
answers question: http://stackoverflow.com/q/23565632
has comment: http://stackoverflow.com/comment/36161875
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36161676
has comment: http://stackoverflow.com/comment/36163305

http://stackoverflow.com/comment/36141112
score: 0
comment on: http://stackoverflow.com/q/23554240
type: Comment
type: QuestionComment
has text: @pkacprzak: I have updated the question. I have explained the whole scenario.

http://stackoverflow.com/q/23495222
tagged with: playframework-2.0
tagged with: java
has comment: http://stackoverflow.com/comment/36736899
type: Question
has title: XHTML 5 from Play 2.2.x using Java
has comment: http://stackoverflow.com/comment/36711030
tagged with: http://stackoverflow.com/tag/xhtml
has body: How do I set the content type to application/xhtml+xml globally and not only on a Result level? (In a Play Framework Java Project) My xhtml5 page looks like this: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"&gt; &lt;head&gt; &lt;meta charset="utf-8"/&gt; &lt;/head&gt; &lt;body&gt;&lt;/body&gt; &lt;/html&gt; The Result is generated by return ok(index.render()). If the content type is not set via response().setContentType("application/xhtml+xml") the play framework will serve text/html which is not correct.
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/23483745
accepted answer of: http://stackoverflow.com/q/23480307
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23480307
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/39797733
score: 6
has body: To use parts of composite primary key in JPA query, you have to address them using its variable names: public Concept findConceptById(BigInteger id) { Query query = this.em.createQuery("SELECT conc FROM Concept conc WHERE conc.conceptPK.id =:cid order by conc.conceptPK.effectiveTime desc"); query.setParameter("cid", id); return (Concept) query.getSingleResult(); } I used Concept as entity name assuming the class with @Entity annotation is also named Concept. This question contains information about similar problem, you may find it useful.

http://stackoverflow.com/comment/36066708
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23515239
score: 0
has text: @Yarh, check JAVA_HOME

http://stackoverflow.com/comment/36125644
has text: That did it! Thank you sir! I will now try to close this question with your answer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23545833
type: Comment

http://stackoverflow.com/comment/36081350
comment on: http://stackoverflow.com/q/23522051
type: Comment
type: QuestionComment
has text: I'm using a Singleton to call the method from the database. The function gets the question objects and and puts them in an ArrayList. The singleton method gets called in a Viewpager activity. I'll add the code in a edit in a few seconds.
score: 0

http://stackoverflow.com/a/23512632
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23512580
has body: It is because you have try catch block around your loop, so when exception is caught it falls out of the loop. Placing try catch block inside while block will solve the problem.
score: 1
answers question: http://stackoverflow.com/q/23512580
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/23509116
has answer: http://stackoverflow.com/a/23509328
upvote count: 3
score: 0
tagged with: java
downvote count: 3
linked to: http://stackoverflow.com/q/11655020
has body: So i'm just learning java, and i'm writing a simple program, however I have found that it is possible for the users to input something that is not an int, so I looked up online and figured that the best way to resolve this would be to use a try and catch block. However, after I did this the rest of the program gave me an error because I declared a variable in the block. So how do I declare this variable inside the block? try{ int guessN = guess.nextInt(); } catch(InputMismatchException err){ System.out.println(err); } finally { int guessN = guess.nextInt(); } //Location of error if(guessN &lt; newN){ log("Wrong! The number is more than your guess"); } Never mind, I just put the code in the try block and it worked XD Sorry!
tagged with: try-catch
has title: Java, how to declare a variable inside a try-catch block
has answer: http://stackoverflow.com/a/23509147
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/23509135
has answer: http://stackoverflow.com/a/23509133
favorite count: 0
has comment: http://stackoverflow.com/comment/36056059
type: Question

http://stackoverflow.com/a/23547760
answers question: http://stackoverflow.com/q/23547488
score: 0
has body: Maven puts the files under /src/main/resouces/ into the default package of your classpath. Hence you can load through the classloader: InputStream in = getClass().getResourcesAsStream("temp.txt") For more information see Class#getResoucesAsStream.
type: Answer
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/36129190

http://stackoverflow.com/a/23659880
has body: The "[sshexec]" tells me you are using some Jenkins plugin to execute a command on a remote host. This usually means Jenkins executes this (or an equivalent thing by implementing the SSH protocol natively): ssh user@remotehost 'jar arg1 arg2...' What happens here is the sshd daemon on the remote host will execute the default shell of the user and ask the shell to execute the command line. The shell is typically not executed as a "login shell", meaning the shell will skip the initialization steps that login shells normally do when the user logs in interactively. You can study man (name of your shell) to see exactly what the difference is between a shell executed with -l option and one executed without it. In the case of bash it essentially means .profile and .bashrc will not be executed, so any PATH modifications you might have there will not take place. I think your best bet is to provide the full path to the jar command when you want to execute it.
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/112533266
type: Answer
answers question: http://stackoverflow.com/q/23538864
score: 5

http://stackoverflow.com/comment/36133610
score: 0
type: QuestionComment
has text: Are you sure the file exists at the given path?
type: Comment
comment on: http://stackoverflow.com/q/23550514

http://stackoverflow.com/comment/36077733
score: 0
type: QuestionComment
has text: Simply escape ? when using regex using \.
type: Comment
comment on: http://stackoverflow.com/q/23520528

http://stackoverflow.com/comment/36015210
comment on: http://stackoverflow.com/a/23481402
has text: I don't understand your down votes - I didn't solve it completely but gave some hints. That answers "I need help with 2 Methods" from the question and "I just need like a starting point" from the comments and also doesn't solve it completely. How can I improve?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/23549376
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23549341
has comment: http://stackoverflow.com/comment/36131256
has body: BigDecimal is immutable. By calling: d.setScale(4); You just create new instance and dont't use it.

http://stackoverflow.com/a/23536719
upvote count: 1
has body: public ArrayList&lt;Double&gt; doubleList = new ArrayList&lt;&gt;(); From Java 1.7, you don't need to write Double while initializing ArrayList, so it's your choice to write Double in new ArrayList&lt;&gt;(); or new ArrayList&lt;Double&gt;(); or not.. otherwise it's not compulsory. Also known as a dynamic array. No need to pre-determine the number of elements up front, just add to the array as we need it
answers question: http://stackoverflow.com/q/23536493
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/23589651
has body: If your token and its POS tag is separated by space : public class FileLinkList{ public static void main(String[] args) { BufferedReader br = null; LinkedList&lt;String&gt; list = new LinkedList&lt;String&gt;(); String word; try { String sCurrentLine; br = new BufferedReader(new FileReader("LEXICON.txt")); while ((sCurrentLine = br.readLine()) != null) { System.out.println(sCurrentLine); word = sCurrentLine.trim().split(" ")[0]; list.add(word.toLowerCase()); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null) br.close(); } catch (IOException ex) { ex.printStackTrace(); } } } }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36206366
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23589570
accepted answer of: http://stackoverflow.com/q/23589570
type: Answer

http://stackoverflow.com/comment/36183390
has text: I'm also puzzled with this issue
comment on: http://stackoverflow.com/a/23576712
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36001021
type: AnswerComment
score: 0
has text: I understand the issues better now. But from a programmer's perspective this still seems unexpected. Shouldn't AccessController.checkPermission() be permissive when no SecurityManager is installed? Probably it has performance penalties? otherwise I can't imagine why it couldn't check whether SecurityManager is installed or not.
type: Comment
comment on: http://stackoverflow.com/a/23478055

http://stackoverflow.com/q/23477974
tagged with: jlabel
linked to: http://stackoverflow.com/q/23455667
has body: So basically I'm trying to make a 2D maze-like game where you can either create a map yourself or load a premade one. You change the tiles of the map by giving the coordinates of the new desired object which can be a wall, grass, enemy, bomb, weapon, the hero, etc, after clicking the corresponding JButton. My question is: up until now I've been using just JLabels to place images of the grass in the map because they're the "basic tiles" on which the hero can move, and then I'm trying to change those to custom objects of the different classes so when the hero moves to one of them it triggers different actions, but it looks like a JLabel can only contain text or images, so how should I do it then? This is the code (I'm sorry it's in spanish): public class Tablero extends JFrame { private int numFilas; private int numColumnas; private int numMuros; public Tablero(final int numFilas, final int numColumnas, final int numMuros) { this.numFilas = numFilas; this.numColumnas = numColumnas; this.numMuros = numMuros; JFrame tablero = new JFrame(); JPanel contenedor = new JPanel(); final JLabel[][] casilla = new JLabel[60][60]; tablero.setSize(1280, 720); contenedor.setSize(1280, 720); tablero.add(contenedor); for (int x = 0; x &lt; this.numFilas; x++) { for (int y = 0; y &lt; this.numColumnas; y++) { casilla[x][y] = new JLabel(); casilla[x][y].setIcon(new ImageIcon("C:\\Users\\Andres\\Desktop\\Programación orientada a objetos\\Juego\\build\\classes\\juego\\pasto.png")); contenedor.add(casilla[x][y]); } } JOptionPane.showMessageDialog(null, "Cree a continuación el héroe"); int coorX = Integer.parseInt(JOptionPane.showInputDialog("Digite la coordenada en x del héroe: ")); int coorY = Integer.parseInt(JOptionPane.showInputDialog("Digite la coordenada en y del héroe: ")); int lives = Integer.parseInt(JOptionPane.showInputDialog("Digite la cantidad de vidas del héroe: ")); final Heroe heroe = new Heroe(coorX, coorY, lives); JButton añadirMuros = new JButton("Añadir muros"); contened…
tagged with: object
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/35997960
type: Question
has comment: http://stackoverflow.com/comment/35999997
upvote count: 1
has comment: http://stackoverflow.com/comment/35999902
has answer: http://stackoverflow.com/a/23481903
accepted answer: http://stackoverflow.com/a/23481903
score: 0
has title: How can I add different objects on a grid using GridLayout?
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/36005584
has text: try them both on small text passage with newline and you will find out which one works.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23481865

http://stackoverflow.com/q/23561704
has answer: http://stackoverflow.com/a/23561817
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36153824
tagged with: maven-3
tagged with: maven-shade-plugin
answer count: 1
type: Question
tagged with: maven
has body: I am working on standalone application using maven. I have tried following scenarios, 1. Using maven shade plugin it unpacking all the dependencies so my signed jars(bcprov-jdk16-1.46.jar) are unpacked. so lost the jar's sign because of this am getting security exception "jce cannot authenticate the provider bc". 2. Using maven assembly plugin (based on assembly.xml) and maven jar plugin (to set class path for all jars) Here i have implemented to move all the dependencies to lib folder and created my project jar without dependencies finally i have grouped as zip file. this logic fixed security exception issue my application working fine. But here i need to move only bcprov-jdk16-1.46.jar into lib folder other jars need to be in my application jar itself. But i need to do the following structure zip | -- MyProject.jar | -- unpacked dependancies (except signed dependancies) | -- lib folder | -- signed jar (bcprov-jdk16-1.46.jar)
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36217044
has title: maven structure issue based on unpacking signed jars
tagged with: maven-assembly-plugin

http://stackoverflow.com/q/23476303
tagged with: message
downvote count: 0
tagged with: trace
has answer: http://stackoverflow.com/a/23481758
linked to: http://stackoverflow.com/q/22957684
favorite count: 0
has body: I'm curious if there is a way to know what Mule flows were executed by either looking at a MuleMessage or enabling some sort of tracing. I'd like to find a quick and easy way to without resorting to inserting 'logger' entries in the mule-config.xml. Mule Studio is not an option unfortunately.
possible better answer: http://stackoverflow.com/a/23481758
has answer: http://stackoverflow.com/a/23494570
has answer: http://stackoverflow.com/a/23477143
upvote count: 1
type: Question
has title: Is there anyway to trace a MuleMessage to know what flows were executed?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36832080
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36787768
tagged with: mule
accepted answer: http://stackoverflow.com/a/23477143
answer count: 3

http://stackoverflow.com/comment/103612458
has text: @panoet And actually that is a misconfiguration, as I described. The fact that Linux does it for you doesn't make it any less a misconfiguration.
comment on: http://stackoverflow.com/a/23485296
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36185813
type: Comment
type: QuestionComment
has text: `currentTimeMillis()` has a whole lot less overhead, but it may not do quite what you need. In any case, the solution is almost certainly to be running separate methods, using configuration to select between them, instead of hard-baking this kind of decision into the code (which will be flaky anyway, since servers are usually on UTC and not local time).
score: 0
comment on: http://stackoverflow.com/q/23576623

http://stackoverflow.com/q/23456860
has body: I'm trying to test a console application that uses jline for handling interaction with the user. I'm starting the application using ProcessBuilder which gives me access to the application's: Standard Input Standard Output Standard Error I was expecting to use a workflow similar to this: Start Application Read Output until I see the application's prompt &gt; Send Input for my test case, e.g. login Read Output until I see the expect response, e.g. Username: and so on However, the test just freezes. Stepping through the code, it appears that jline is freezing on JNI calls to _getch on Windows. I'm guessing that the problem is because I am running Java from ProcessBuilder which is headless so there is no console and that is confusing windows. Setting -Djline.terminal=jline.UnsupportedTerminal as per the Jline docs doesn't help either. I've found a thread discussing Python pexpect for testing a (non-java) readline application. Question: how can I test a jline based application using just java tools?
type: Question
tagged with: processbuilder
has comment: http://stackoverflow.com/comment/45455075
tagged with: java
upvote count: 1
tagged with: jline
answer count: 1
has answer: http://stackoverflow.com/a/28572669
linked to: http://stackoverflow.com/q/22795767
tagged with: testing
has title: how to test a jline based console application
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/28572669
score: 1
has comment: http://stackoverflow.com/comment/45453311
favorite count: 0

http://stackoverflow.com/comment/36024463
type: QuestionComment
has text: @PeterRader... Now tables is created with UPDATE. I think it doesn't even require CREATE until table is absent in database.
comment on: http://stackoverflow.com/q/23491770
score: 0
type: Comment

http://stackoverflow.com/a/23576927
answers question: http://stackoverflow.com/q/23576921
has comment: http://stackoverflow.com/comment/36183232
has comment: http://stackoverflow.com/comment/36183374
accepted answer of: http://stackoverflow.com/q/23576921
type: Answer
has comment: http://stackoverflow.com/comment/36183311
score: 1
has body: You are wrong, the second sentence is correct.
upvote count: 1
has comment: http://stackoverflow.com/comment/36183218
has comment: http://stackoverflow.com/comment/36183243
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/23473650
has comment: http://stackoverflow.com/comment/42940523
score: 4
accepted answer of: http://stackoverflow.com/q/23472175
upvote count: 4
answers question: http://stackoverflow.com/q/23472175
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42941348
has body: You can convert a JSON string to an equivalent Java object using custom Gson JsonDeserializer Assuming you have mapping classes public class Data { private int this_number; private int that_number; private String some_string; private List&lt;DataInfo&gt; objects; } public class DataInfo { private double random_double; private int magic; private int health; private int price; } public class Point { int x ; int y; } CustomDeserializer public class CustomDeserializer implements JsonDeserializer&lt;Data&gt; { @Override public Data deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) throws JsonParseException { final JsonObject jsonObject = json.getAsJsonObject(); final int this_number = jsonObject.get("this_number").getAsInt(); final int that_number = jsonObject.get("that_number").getAsInt(); final String some_string = jsonObject.get("some_string").getAsString(); JsonObject list_of_objects =jsonObject.get("list_of_objects").getAsJsonObject(); Set&lt;Entry&lt;String, JsonElement&gt;&gt; objects = list_of_objects.entrySet(); final Data data = new Data(); List&lt;DataInfo&gt; list = new ArrayList&lt;&gt;(); Gson gson = new Gson(); for (Entry&lt;String, JsonElement&gt; entry : objects) { JsonElement jsonElement = entry.getValue(); DataInfo info = gson.fromJson(jsonElement,DataInfo.class); list.add(info); } data.setObjects(list); data.setSome_string(some_string); data.setThat_number(that_number); data.setThis_number(this_number); return data; } }

http://stackoverflow.com/comment/36119454
score: 0
type: AnswerComment
has text: @themightysapien: the magic is in the Component's source code where it gets notified by the operating system regarding mouse events occurring, and then the Component itself notifies any registered listeners about these changes.
comment on: http://stackoverflow.com/a/23542778
type: Comment

http://stackoverflow.com/q/23472436
has title: libgdx return to menus stage after showing devicecamera
has body: I want to use a qrcode scanner in my game. To render the preview I'm using the code in the following post: How to render Android&#39;s YUV-NV21 camera image on the background in libgdx with OpenGLES 2.0 in real-time? When the qrcode is scanned I want to return to the main menu. When I call destroy on the AndroidDependentCameraController it just freezes on the last image. How do I get my Stage to be shown again? When I remove the following lines, it seems to be able to go back (sometimes) but the preview shows up blue Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_2D, 0, GL20.GL_LUMINANCE, s.width, s.height, 0, GL20.GL_LUMINANCE, GL20.GL_UNSIGNED_BYTE, yBuffer);
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/22456884
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
tagged with: shader
tagged with: java
type: Question
tagged with: android-camera
tagged with: libgdx

http://stackoverflow.com/comment/36006072
type: AnswerComment
type: Comment
has text: @GeoffreyDeSmet: For the same reason you can do e.g. `synchronized(vector)`. It you want to be safe, you should never use a public object (such as `this` itself) for locking.
score: 6
comment on: http://stackoverflow.com/a/23463334

http://stackoverflow.com/comment/35985190
type: Comment
comment on: http://stackoverflow.com/q/23463126
type: QuestionComment
has text: @vas - I asked because the reason will determine what sort of answer is appropriate. For example: you need crytographically-secure randomness. If you just want to reinvent the wheel, then Google turns up lots (2MM+) of results. And since you have no real requirements, you could have picked one arbitrarily.
score: 0

http://stackoverflow.com/a/23543780
has body: Map does not allow duplicate keys of course but allows duplicate values. So I think the answer would be d). The collection that does not allow any duplicates is Set. An example with HashSet: import java.util.HashSet; public class Main { public static void main(String[] args) { HashSet<String> set = new HashSet<String>(); set.add("str1"); set.add("str2"); set.add("str3"); set.add("str4"); set.add("str1"); System.out.println(set); // ["str1", "str2", "str3". "str4"] "str1" is added only once } }
upvote count: 9
has comment: http://stackoverflow.com/comment/129423958
answers question: http://stackoverflow.com/q/23543663
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36121998
type: Answer
accepted answer of: http://stackoverflow.com/q/23543663
score: 9

http://stackoverflow.com/comment/36163548
comment on: http://stackoverflow.com/q/23560119
type: Comment
type: QuestionComment
has text: If you want to use JSF 2.x then RichFaces 3.3.x should be updated to RichFaces 4.3.x
score: 0

junit
type: Tag
tags question: http://stackoverflow.com/q/23506946
tags question: http://stackoverflow.com/q/23609482
tags question: http://stackoverflow.com/q/23486069
tags question: http://stackoverflow.com/q/23470220
tags question: http://stackoverflow.com/q/23563615
tags question: http://stackoverflow.com/q/23605993
tags question: http://stackoverflow.com/q/23609258
tags question: http://stackoverflow.com/q/23601331
tags question: http://stackoverflow.com/q/23474905
tags question: http://stackoverflow.com/q/23566952
tags question: http://stackoverflow.com/q/23464255
tags question: http://stackoverflow.com/q/23551166
tags question: http://stackoverflow.com/q/23609360
tags question: http://stackoverflow.com/q/23545541
tags question: http://stackoverflow.com/q/23552855
tags question: http://stackoverflow.com/q/23522166
tags question: http://stackoverflow.com/q/23467836
tags question: http://stackoverflow.com/q/23565908
tags question: http://stackoverflow.com/q/23510428
tags question: http://stackoverflow.com/q/23521785
tag name: junit
tags question: http://stackoverflow.com/q/23567680
tags question: http://stackoverflow.com/q/23547229
tags question: http://stackoverflow.com/q/23477378
tags question: http://stackoverflow.com/q/23466162
tags question: http://stackoverflow.com/q/23573694
tags question: http://stackoverflow.com/q/23585451
tags question: http://stackoverflow.com/q/23517683
tags question: http://stackoverflow.com/q/23498872
tags question: http://stackoverflow.com/q/23512643
tags question: http://stackoverflow.com/q/23496538
tags question: http://stackoverflow.com/q/23561859
tags question: http://stackoverflow.com/q/23606388
tags question: http://stackoverflow.com/q/23536635
tags question: http://stackoverflow.com/q/23545705
tags question: http://stackoverflow.com/q/23591481
tags question: http://stackoverflow.com/q/23496108
tags question: http://stackoverflow.com/q/23586847
tags question: http://stackoverflow.com/q/23581411
tags question: http://stackoverflow.com/q/23613264
tags question: http://stackoverflow.com/q/23576987
tags question: http://stackoverflow.com/q/23459989
tags question: http://stackoverflow.com/q/23489445
tags question: http://stackoverflow.com/q/23548879
tags question: http://stackoverflow.com/q/23613247
tags question: http://stackoverflow.com/q/23481352
tags question: http://stackoverflow.com/q/23567148

http://stackoverflow.com/q/23496357
favorite count: 0
has title: GlassFish web application suddenly dies without an explicable reason
has comment: http://stackoverflow.com/comment/38108809
tagged with: freeze
has body: I'm developing a web application via Netbeans 8.0,Glassfish server 4 and JavaEE 7. Everything was going great but now I'm facing a strange issue. If the user interrupts uploads or downloads before their completion (by closing browser's windows or simply by pressing esc or X to interrupt), I get an "IOException: Connection closed" into the server console, but the application still works. We are talking about files and photos whose size can vary from 1 MB to 30 MBs, so it's possible that the user simply gets bored and decides to stop the download before its completion. If those interruptions (and related exceptions) happen for 3-4 times, the whole application simply stops and can't be used, until I decide to reset the Glassfish server. This is really a crap. I can't figure what's the problem. Into jvm.log or server.log, there is nothing significative. And yes, I flush and close the streams that I used for uploads/downloads. I'll post exception stacks and source code, if needed. I'm using servlets for downloads (the OutputStream from response)
answer count: 0
type: UnansweredQuestion
tagged with: glassfish-4
tagged with: web-applications
type: Question
score: 1
tagged with: java
tagged with: glassfish
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36089134

http://stackoverflow.com/comment/36153519
has text: By default exceptions are sent to stderr; therefore if you redirect stderr you should get your exceptions wherever it is that you redirected.
comment on: http://stackoverflow.com/q/23561555
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23505802
has body: when I pass my BuyListing object, the object I get on the server side is just "null" If you received a null you sent a null.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/23505329

http://stackoverflow.com/comment/36058778
type: AnswerComment
comment on: http://stackoverflow.com/a/23509072
has text: thank you user I really appreciate you breaking it down sometimes it's just hard to know where to put what while looking at the code
type: Comment
score: 0

http://stackoverflow.com/q/23521521
has body: I have a problem using a method from another class that Extends from an Activity. I have a code that needs to repeat in every single Activity, So i created a class with this code and I get an error when I tryied to use the method at other class For exmple: First Class: public class first extends Activity public void onCreate(){ second s = new second(); s.myMethod(); } Second Class: public class second extends Activity public void myMethod(){} This way I get NullPointerExption. First Class: public class first extends Activity public void onCreate(){ Context context = getApplicationContext(); second s = ((second)context); s.myMethod(context ); } Second Class: public class second extends Activity Context context ; public void myMethod(Context context){ this.context = context; } This way I get InvocationTargetException. This is my code: MainActivity - First Class: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); }//onCreate public void ClickMe(View V) { Toast.makeText(this, "ClickMe", Toast.LENGTH_SHORT).show(); Context context = getApplicationContext(); menuSetup myMenu = ((menuSetup)context); myMenu.SetMenuListView(); } @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 boolean onOptionsItemSelected(MenuItem item) {// Action Bar buttons switch (item.getItemId()) { case R.id.action_settings: SlidingDrawer myS = (SlidingDrawer) findViewById(R.id.slidingDrawer1); myS.animateToggle(); break; } return super.onOptionsItemSelected(item); } } menulList - Second Class: public class menuSetup extends Activity { MenuAdapter adapter; ListView myList; int myPosiition; public void SetMenuListView() { myList = (ListView) findViewById(R.id.listView1); adapter = new MenuAdapter(this); myList.setAdapter(adap…
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36080792
has answer: http://stackoverflow.com/a/23521583
type: Question
linked to: http://stackoverflow.com/q/14956018
score: 0
has title: Using a method from another class that Extends from an Activity
answer count: 1
has comment: http://stackoverflow.com/comment/36085913
tagged with: android
accepted answer: http://stackoverflow.com/a/23521583

http://stackoverflow.com/a/23544417
score: 0
upvote count: 1
has body: The mistakes we're doing while not enclosing brackets.. You have a redundant closing brackets. this.rating = rating; } Please remove it.
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23544361

http://stackoverflow.com/comment/36192618
type: Comment
score: 0
has text: OK so gf is a String[], thought it was a single String, describe its values... for instance what is the value of gf[0]?
comment on: http://stackoverflow.com/a/23582277
type: AnswerComment

jar
tags question: http://stackoverflow.com/q/23505999
tags question: http://stackoverflow.com/q/23487233
tags question: http://stackoverflow.com/q/23470394
tags question: http://stackoverflow.com/q/23499200
tags question: http://stackoverflow.com/q/23609955
tags question: http://stackoverflow.com/q/23596574
tags question: http://stackoverflow.com/q/23527628
type: Tag
tags question: http://stackoverflow.com/q/23466872
tags question: http://stackoverflow.com/q/23561153
tags question: http://stackoverflow.com/q/23505348
tags question: http://stackoverflow.com/q/23500021
tags question: http://stackoverflow.com/q/23589842
tags question: http://stackoverflow.com/q/23607291
tags question: http://stackoverflow.com/q/23578732
tags question: http://stackoverflow.com/q/23590588
tags question: http://stackoverflow.com/q/23593763
tags question: http://stackoverflow.com/q/23506204
tag name: jar
tags question: http://stackoverflow.com/q/23587471
tags question: http://stackoverflow.com/q/23471323
tags question: http://stackoverflow.com/q/23487991
tags question: http://stackoverflow.com/q/23569164
tags question: http://stackoverflow.com/q/23561864
tags question: http://stackoverflow.com/q/23515701
tags question: http://stackoverflow.com/q/23560955
tags question: http://stackoverflow.com/q/23500435
tags question: http://stackoverflow.com/q/23584794
tags question: http://stackoverflow.com/q/23533133
tags question: http://stackoverflow.com/q/23612960
tags question: http://stackoverflow.com/q/23504948
tags question: http://stackoverflow.com/q/23539843
tags question: http://stackoverflow.com/q/23606419
tags question: http://stackoverflow.com/q/23509495
tags question: http://stackoverflow.com/q/23561059
tags question: http://stackoverflow.com/q/23475026
tags question: http://stackoverflow.com/q/23481594
tags question: http://stackoverflow.com/q/23488222
tags question: http://stackoverflow.com/q/23502604
tags question: http://stackoverflow.com/q/23455815
tags question: http://stackoverflow.com/q/23609660
tags question: http://stackoverflow.com/q/23589350
tags question: http://stackoverflow.com/q/23596068

http://stackoverflow.com/comment/36101216
type: Comment
type: QuestionComment
score: 0
has text: what server it is? is it Apache Tomcat? ApacheKaraf? or something else what is it?
comment on: http://stackoverflow.com/q/23532826

http://stackoverflow.com/comment/36093023
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23528528
has text: well just a guess any way it makes the code more readable

http://stackoverflow.com/a/23523829
answers question: http://stackoverflow.com/q/23523661
score: 0
type: Answer
has body: You may want to use a JTable, using a JTable everything is in rows and columns like a spreadsheet. It may require more code than you already have but rest assured it will work (if programmed correctly) To start off with you will need a 2-dimensional array like this: private String[][] data = { {"Example 1", "0.0.1", "Update"}, {"Example 2", "0.0.1", "Installed"} }; Once you have this you will need a array of columns like this: private String[] columns = {"Mod name", "Version", "Installed"}; Once you have both of these you can use this to make the table: JTable table = new JTable(data, columns);

http://stackoverflow.com/q/23585107
has comment: http://stackoverflow.com/comment/36197964
linked to: http://stackoverflow.com/q/6255106
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23619175
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I just started learning about java applets and came upon this error. Can someone help me? import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; public class MakeDots extends Applet implements MouseListener{ private Graphics graphics = null; public void init() { this.addMouseListener(this); } public void paint(Graphics g) { this.setSize(800, 600); g.create(); } public void drawDot(int x, int y) { int r = (int)(Math.random()*256); int b = (int)(Math.random()*256); int g = (int)(Math.random()*256); Color color = new Color(r, g, b); graphics.setColor(color); graphics.fillOval(x, y, 3, 3); } @Override public void mouseClicked(MouseEvent e) { int mouseX = e.getX(); int mouseY = e.getY(); drawDot(mouseX, mouseY); } @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 arg0) { // TODO Auto-generated method stub } @Override public void mouseReleased(MouseEvent arg0) { // TODO Auto-generated method stub } } This error comes up: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at MakeDots.drawDot(MakeDots.java:26) at MakeDots.mouseClicked(MakeDots.java:34) at java.awt.Component.processMouseEvent(Component.java:6417) at java.awt.Component.processEvent(Component.java:6179) at java.awt.Component.dispatchEventImpl(Component.java:4776) at java.awt.Container.dispatchEventImpl(Container.java:2142) at java.awt.Component.dispatchEvent(Component.java:4604) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:717) at java.awt.EventQueue.access$400(EventQueue.java:82) at java.awt.EventQueue$2.run(EventQueue.java:676) at java.awt.EventQueue$2.run(EventQueue.java:674) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControl…
possible better answer: http://stackoverflow.com/a/23585137
has answer: http://stackoverflow.com/a/23585121
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/23585137
has title: Java Applet Error, NullPointerException
accepted answer: http://stackoverflow.com/a/23585121
tagged with: nullpointerexception
answer count: 3
has comment: http://stackoverflow.com/comment/36207217
downvote count: 0
tagged with: applet
favorite count: 0

http://stackoverflow.com/a/23490399
type: Answer
has comment: http://stackoverflow.com/comment/36029817
downvote count: 0
has comment: http://stackoverflow.com/comment/36026679
score: 2
has comment: http://stackoverflow.com/comment/36034176
has comment: http://stackoverflow.com/comment/36029623
upvote count: 2
has comment: http://stackoverflow.com/comment/36026136
has body: You can't do it with parent object reference until an unless method is declared in parent class/interface itself. You have to downcast it to child class because parent class/interface doesn't have any knowledge about the child class other than the contract defined between them. Here contract means abstract methods. you can try in this way where there is no need to put a check it. FooInterface sc =new Child1(); sc.foo(); ... interface FooInterface{ void foo(); } public class Parent { } public class Child1 extends Parent implements FooInterface{ public void foo() { } } public class Child2 extends Parent implements FooInterface{ public void foo() { } }
answers question: http://stackoverflow.com/q/23490151

http://stackoverflow.com/comment/36146091
has text: @SachinMhetre : You can to it from command line, or adding this to bash_profile, or in the build.xml
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23557111
type: AnswerComment

http://stackoverflow.com/comment/107548408
type: AnswerComment
comment on: http://stackoverflow.com/a/30591269
type: Comment
has text: **WARNING** This is absolutely insecure. You are treating a password as a key, and you are using ECB mode to encrypt a plaintext, which is using the platform encoding, which may change. Handling of exceptions is entirely missing. This is taking the shortest route to an insecure solution.
score: 3

http://stackoverflow.com/comment/46435916
comment on: http://stackoverflow.com/a/23634577
type: Comment
type: AnswerComment
has text: Well the simple solution is to setTargetSdkVersion to less than 18 :)
score: 0

http://stackoverflow.com/comment/36172280
comment on: http://stackoverflow.com/q/23570907
has text: Can you provide more information like what computer language you are using and maybe a look at your code?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/35966751
type: AnswerComment
has text: They can not be static. You should replace courseCount and personCount in for loops and delete static variables. Can you do that?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23460641

http://stackoverflow.com/comment/36189982
comment on: http://stackoverflow.com/a/23580564
type: AnswerComment
has text: Yes the problem is that the only classes I can modify are Variable and ILOAD. I thing that ILOAD is quite right but the huge problem is in Varible
score: 0
type: Comment

http://stackoverflow.com/a/23568471
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23568369
accepted answer of: http://stackoverflow.com/q/23568369
score: 1
has body: There were a few errors in your code. I have fixed them, try the below code: String s = strLine; List&lt;String&gt; myList = Arrays.asList(s.split(" ")); List&lt;Integer&gt; intList = new ArrayList&lt;&gt;(); for (int i=0;i&lt;myList.size();i++) { //Check if all the values are integers try { /*Problem area-----&gt;*/ intList.add(Integer.parseInt( (String) myList.get(i))); } catch (Exception e) { throw new FormatException(); } }

http://stackoverflow.com/comment/36254488
comment on: http://stackoverflow.com/q/23615147
type: Comment
type: QuestionComment
score: 2
has text: Every hashmap is a map, but not every map is a hashmap.

http://stackoverflow.com/comment/36127566
has text: Custom input processor is of course your class that implements the interface `InputProcessor`.
type: AnswerComment
comment on: http://stackoverflow.com/a/23546749
score: 0
type: Comment

http://stackoverflow.com/comment/36251042
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23613495
has text: Dunno. Where's your code?

http://stackoverflow.com/comment/36251933
comment on: http://stackoverflow.com/q/23613895
score: 0
type: Comment
type: QuestionComment
has text: Please add some specific changes

http://stackoverflow.com/a/23614091
answers question: http://stackoverflow.com/q/23614016
score: 0
has comment: http://stackoverflow.com/comment/36253680
type: Answer
has comment: http://stackoverflow.com/comment/36254791
has body: Modify this: if("Best".equalsIgnoreCase(b)){ counter = counter + 2; }else if("Good".equalsIgnoreCase(b)){ counter = counter + 1; }else if("Average".equalsIgnoreCase(b)){ counter = 0; }else if("Bad".equalsIgnoreCase(b)){ counter = - 1; }else if("Worst".equalsIgnoreCase(b)){ counter = - 2; } To this: if("Best".equalsIgnoreCase(b)){ counter = counter + 2; }else if("Good".equalsIgnoreCase(b)){ counter = counter + 1; }else if("Average".equalsIgnoreCase(b)){ counter = 0; }else if("Bad".equalsIgnoreCase(b)){ counter = counter - 1; }else if("Worst".equalsIgnoreCase(b)){ counter = counter - 2; } And instead of using: st.executeUpdate("UPDATE cmtcount SET count = count + '"+counter+"' WHERE type='"+a+"' AND rate='"+b+"'"); I'd recommend retrieving the values from SQL first in to variables then adding or subtracting the values and finally updating: st.executeUpdate("UPDATE cmtcount SET count = '"+counter+"' WHERE type='"+a+"' AND rate='"+b+"'"); Another tip, instead of: counter=couter+1; or counter=couter-1; You can do this: counter+=1; or counter-=1;
has comment: http://stackoverflow.com/comment/36252430
has comment: http://stackoverflow.com/comment/36255135

http://stackoverflow.com/q/23463595
has comment: http://stackoverflow.com/comment/35972899
score: 0
has title: Java RMI remote call
tagged with: serialization
type: UnansweredQuestion
has body: I have a doubt in a list of exercises on Java. I have not coded the exercise. If you can help me. Question: The diagram below represents a client / server application in Java RMI. Interfaces A and C are remote and class B is serializable. Diagram : http://oi62.tinypic.com/149s26r.jpg The codes of methods f, g and h are as follows: void f () {System.out.println ("A :: f"); } void g () {System.out.println ("B :: g"); a.f(); } void h (B b) {System.out.println ("C :: h"); b.g (); } What is printed by this program and where (ie at the server or client) when making the following call to the client: s.h (b) My answer: It will be printed C::h (Server) B::g (Client) A::f (Client) Thank you
tagged with: call
answer count: 0
tagged with: rmi
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/68932263
has comment: http://stackoverflow.com/comment/35972089

http://stackoverflow.com/comment/36053890
has text: It could read half-written data, including in ways that make the HashMap break.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23497337

http://stackoverflow.com/comment/36220281
score: 0
type: Comment
type: QuestionComment
has text: Is your database actually up and running?
comment on: http://stackoverflow.com/q/23596896

http://stackoverflow.com/a/23608824
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23608306
type: AcceptedAnswer
downvote count: 0
has body: Id is incremented in your db? Maybe you forgot @GeneratedValue annotation above your id definition. Check this: http://www.objectdb.com/java/jpa/entity/generated
has comment: http://stackoverflow.com/comment/36242053
type: Answer
accepted answer of: http://stackoverflow.com/q/23608306

http://stackoverflow.com/comment/35972958
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23464286
has text: curious, I had ran that exact same code, just instead of using the string input interpretation constructor for BigDecimal, I gave it two Double's instead, which gave me the following: 99.8999999999999999944488848768742172978818416595458984375 99.7999999999999999888977697537484345957636833190917968750 99.6999999999999999833466546306226518936455249786376953125 obviously your solution does solve OP's question, so +1 for that, but still curious.
type: AnswerComment

http://stackoverflow.com/a/23461890
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23461514
score: 1
answers question: http://stackoverflow.com/q/23461514
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Your problem is probably that you're opening a reader using the platform encoding. You should manually specify the encoding whenever you convert between bytes and characters. If you know that the appropriate encoding is UTF-8 you can open a file thus: FileInputStream inputFile = new FileInputStream(myFile); try { FileReader reader = new FileReader(inputFile, "UTF-8"); // Maybe buffer reader and do something with it. } finally { inputFile.close(); } Libraries like Guava can make this whole process easier..

http://stackoverflow.com/comment/36056582
comment on: http://stackoverflow.com/a/23509260
has text: you're confusing variable and object: yes, you're passing a reference to an object (your var `_to`) but as you are updating `_to` to a **new** reference to another object (using `new TestObject()`) then you lose the reference to the former object
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/23481865
has comment: http://stackoverflow.com/comment/36005584
has comment: http://stackoverflow.com/comment/36005497
type: Question
has comment: http://stackoverflow.com/comment/36006883
type: AnsweredQuestion
tagged with: java
downvote count: 5
accepted answer: http://stackoverflow.com/a/23482015
upvote count: 0
score: -5
answer count: 1
has body: If I want to search for a newline in a text using Java, should my regex be "\n" or "\\n", or will either work?
linked to: http://stackoverflow.com/q/4025482
tagged with: regex
has title: Escaping backslashes to indicate a newline
has comment: http://stackoverflow.com/comment/36005666
has answer: http://stackoverflow.com/a/23482015
favorite count: 0

http://stackoverflow.com/comment/36042182
type: Comment
comment on: http://stackoverflow.com/q/23501443
score: 0
type: QuestionComment
has text: @zgc7009 Please check my edit with the log.

http://stackoverflow.com/q/23485745
has comment: http://stackoverflow.com/comment/36057643
has comment: http://stackoverflow.com/comment/36012873
has comment: http://stackoverflow.com/comment/36055818
has comment: http://stackoverflow.com/comment/36038090
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23498123
tagged with: java
has comment: http://stackoverflow.com/comment/36053531
tagged with: tableview
tagged with: sql
tagged with: user-interface
answer count: 1
accepted answer: http://stackoverflow.com/a/23498123
has body: In the database I have 5 records created which are in a tableview. I can select 5 rows but the data is not shown in the tableView. I've tried everything, can anyone help? The code of my problem: initialize public void initialize(URL arg0, ResourceBundle arg1) { colNome.setCellValueFactory(new PropertyValueFactory&lt;ClientRow, String&gt;( "clienteNome")); colRG.setCellValueFactory(new PropertyValueFactory&lt;ClientRow, String&gt;( "clienteRG")); colPlaca.setCellValueFactory(new PropertyValueFactory&lt;ClientRow, String&gt;( "clientePlaca")); colModelo.setCellValueFactory(new PropertyValueFactory&lt;ClientRow, String&gt;( "clienteModelo")); colData.setCellValueFactory(new PropertyValueFactory&lt;ClientRow, String&gt;( "clienteData")); applyList(daoClient.getListDao()); } applyList private void applyList(List&lt;Client&gt; client) { ObservableList&lt;ClientRow&gt; listObservable = FXCollections.observableArrayList(); for (Client p : client) { String nome = p.getNome(); String modelo = p.getModelo(); String placa = p.getPlaca(); String data = p.getDataInicio().toString(); String rg = p.getRg(); listObservable.add(new ClientRow(nome, modelo, placa, data, rg)); } tableClient.setItems(listObservable); } class ClientRow public class ClientRow { public final SimpleStringProperty clientNome; public final SimpleStringProperty clientRG; public final SimpleStringProperty clientPlaca; public final SimpleStringProperty clientModelo; public final SimpleStringProperty clientData; public ClientRow(String clientNome, String clientRG, String clientPlaca, String clientModelo, String clientData) { this.clientNome = new SimpleStringProperty(clientNome); this.clientRG = new SimpleStringProperty(clientRG); this.clientPlaca = new SimpleStringProperty(clientPlaca); this.clientModelo = new SimpleStringProperty(clientModelo); this.clientData = new SimpleStringProperty(clientData); } public String getclientNome() { return clientNome.get(); } public String getclientRG() { return clientRG.get(); …
score: 0
tagged with: javafx-8
has title: How to show data of a database in a tableview?

http://stackoverflow.com/comment/36127686
comment on: http://stackoverflow.com/q/23547482
type: Comment
has text: Can you subclass `FooConfig` and then not include it in your context scan?
type: QuestionComment
score: 0

http://stackoverflow.com/q/23562802
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23563063
type: Question
tagged with: outlook
tagged with: java
has body: I am relatively new to android, and I would like to know if it is possible to read outlook emails in an activity/fragment in my own app I am developping. If yes, can you please provide me with information/examples of what would i need to enable this feature in my application and any working example/code for reading emails in an activity/fragment. Thank you in advance for your assistance,
answer count: 1
score: 0
has title: Android Development: Read outlook emails in own app activity
tagged with: android

http://stackoverflow.com/a/23538940
has body: Your third example should work and is probably a bug, which I've registered as Issue #3255: myDb.selectFrom(TBL) .where(DSL.cast(TBL.COL, MySQLDataType.BINARY) .eq(DSL.cast("foobar ", MySQLDataType.BINARY))) .fetchOne(); As always, if you're missing a feature in jOOQ, or if you've encountered a bug, you can resort to using plain SQL as documented here: http://www.jooq.org/doc/latest/manual/sql-building/plain-sql/ An example to work around In your case: myDb.selectFrom(TBL) .where(TBL.COL .eq(DSL.field("BINARY ?", String.class, "foobar "))) .fetchOne(); Or: myDb.selectFrom(TBL) .where("{0} = BINARY {1}", TBL.COL, DSL.val("foobar ")) .fetchOne();
type: Answer
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/23476062
accepted answer of: http://stackoverflow.com/q/23476062
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23542022
has comment: http://stackoverflow.com/comment/36117994
favorite count: 0
has comment: http://stackoverflow.com/comment/36124695
upvote count: 1
has answer: http://stackoverflow.com/a/23542538
accepted answer: http://stackoverflow.com/a/23556328
tagged with: excel
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/23542538
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/4168689
type: Question
has body: Model class import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="employee_details") public class Employee { @Id @Column(name="emp_id") private int id; @Column(name="emp_name") private String name; @Column(name="location") private String location; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLocation() { return location; } public int getId() { return id; } public void setId(int id) { this.id = id; } public void setLocation(String location) { this.location = location; } } Main Class public class ReadExcel { static List<Employee>empList = new ArrayList<Employee>(); public static void main(String[] args){ List<Employee>employees=readExcel("D:\\test.xls"); persistToDB(employees); } private static List<Employee> readExcel(String filepath) { try { FileInputStream file = new FileInputStream(new File("D:\\test.xls")); // Getting the instance for XLS file HSSFWorkbook workbook = new HSSFWorkbook(file); // Get First sheet from the workbook HSSFSheet sheet = workbook.getSheetAt(0); ArrayList myList = new ArrayList(); // Iterate start from the first sheet of the uploaded excel file Iterator<Row> rowIterator = sheet.iterator(); Employee employee = new Employee(); while (rowIterator.hasNext()) { Row row = rowIterator.next(); if (row.getRowNum() == 0) { continue;// skip to read the first row of file } // For each row, iterate through each columns Iterator<Cell> cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { Cell cell = cellIterator.next(); if (cell.getColumnIndex() == 0 ) { employee.setId((int) cell.getNumericCellValue()); empList.add(employee); System.out.print(cell.getNumericCellValue() + "\t\t"); } else if (cell.getColumnIndex() == 1 ) { employee.setName(cell.getStringCellValue()); empList.add(employee); System.out.print(cell.getStringCellValue() + "\t\t"); } else if (cell.getColumnIndex() == 2 ) {…
has title: I want to read an Excel file and upload the data into a table in PostgresDB
has comment: http://stackoverflow.com/comment/36118242
downvote count: 0
has answer: http://stackoverflow.com/a/23546273
has answer: http://stackoverflow.com/a/23556328
tagged with: postgresql
has comment: http://stackoverflow.com/comment/36124714
answer count: 3

http://stackoverflow.com/comment/36029581
comment on: http://stackoverflow.com/a/23494770
type: Comment
score: 0
type: AnswerComment
has text: @Rico, Can you elaborate why you flag this one as low quality. Keep an eye on above mentioned answers, and compare all ov them honestly,

http://stackoverflow.com/comment/36043227
score: 2
comment on: http://stackoverflow.com/q/23499217
type: Comment
type: QuestionComment
has text: Please add the full stack trace and your controller code to your question.

http://stackoverflow.com/comment/36069005
type: AnswerComment
score: 0
type: Comment
has text: Yes, I'm trying to interrupt a sleeping thread. This "buffer" is actually just a singleton object controlled by the coordinator.
comment on: http://stackoverflow.com/a/23516405

getmethod
tag name: getmethod
tags question: http://stackoverflow.com/q/23465050
type: Tag

http://stackoverflow.com/comment/36022896
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23491725
type: AnswerComment
has text: how to interpret that the amount of heap usage DDMS is showing is considerable and fine?

http://stackoverflow.com/a/25458174
answers question: http://stackoverflow.com/q/23576796
upvote count: 1
downvote count: 1
type: Answer
has body: I've been tinkering with similar settings, and this works for me: @Override public void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); primaryStage.setTitle("Hello World"); primaryStage.initStyle(StageStyle.TRANSPARENT); primaryStage.setOpacity(0.5); primaryStage.setFullScreen(true); Scene scene = new Scene(root, 300, 275); primaryStage.setScene(scene); scene.getStylesheets().add(Main.class.getResource("main.css") .toExternalForm()); primaryStage.show(); } ...and the css .root { -fx-background-color: rgba(0,0,0,0.5); }
has comment: http://stackoverflow.com/comment/69088696
score: 0

http://stackoverflow.com/comment/36371764
has text: Which version of jTDS are you using?
comment on: http://stackoverflow.com/q/23516631
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23604055
tagged with: java
has comment: http://stackoverflow.com/comment/36233992
tagged with: concurrency
has answer: http://stackoverflow.com/a/23604189
score: -9
answer count: 2
has comment: http://stackoverflow.com/comment/36233621
upvote count: 0
favorite count: 0
has title: what is difference between Arraylist and ArrayListBlockingQueue?
has comment: http://stackoverflow.com/comment/36234152
has body: I am trying to learn concurrent package but i have question/doubt about what is difference between Arraylist and ArrayListBlockingQueue? Can somebody explain me.
type: UnansweredQuestion
tagged with: collections
has comment: http://stackoverflow.com/comment/36233427
has answer: http://stackoverflow.com/a/23604180
type: Question
has comment: http://stackoverflow.com/comment/36233505
downvote count: 9

http://stackoverflow.com/a/23518362
answers question: http://stackoverflow.com/q/23517921
has body: Try this: function redirect(elem){ elem.setAttribute("action","somepage.jsp"); elem.submit(); }
accepted answer of: http://stackoverflow.com/q/23517921
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/23505999
has comment: http://stackoverflow.com/comment/36101410
has comment: http://stackoverflow.com/comment/36085594
accepted answer: http://stackoverflow.com/a/23508044
answer count: 1
tagged with: jar
linked to: http://stackoverflow.com/q/17564074
has comment: http://stackoverflow.com/comment/36057240
has body: Hi I have a java eclipse project which I want to execute from command line. I made a jar of it and am running it from command line. I figured out how to access a file in a Jar by using getresourceasstream. Ex: InputStream is = Extractor.class.getResourceAsStream("CompanyNameListModified.txt"); BufferedReader in=new BufferedReader(new InputStreamReader(is));` What I wanna know now is how to access a directory from jar . Currently: Runtime.getRuntime().exec("hadoop fs -get /tmp/stockmarkets/ localfile"); File dir = new File("/home/hadoop/project/localfile");` This gives a filenotfoundexception. What I want to do is File[] directoryListing = dir.listFiles(); if (directoryListing != null) { for (File child : directoryListing) { .... } } Hence goto the directory and loop over each file in that directory.. How should I do it so it works for my JAR.? So I tried this: Runtime.getRuntime().exec("hadoop fs -get /tmp/stockmarkets/ localfile"); File dir =new File(Extractor.class.getResource("/home/hadoop/project/localfile").getPath()); error: Exception in thread "main" java.lang.NullPointerException I checked my directory it does have the local file directory.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23508044
tagged with: eclipse
type: Question
tagged with: hadoop
has title: Reading from a dynamically created directory (in file system) in a jar
score: 0

http://stackoverflow.com/comment/36006883
has text: Can you try this yourself? Then post the answer so that we'll all know.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23481865

http://stackoverflow.com/comment/35986416
has text: What I meant was I don't want to get same people to get the same thing twice. It must be different. Sorry for my grammar mistake. @WhoAmI
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23467987

http://stackoverflow.com/comment/36100307
type: AnswerComment
comment on: http://stackoverflow.com/a/23532045
type: Comment
has text: @ArunChristopher - I have updated the answer check your xml like this and update if necessary and got any problem or error, post me.
score: 0

http://stackoverflow.com/a/23532931
answers question: http://stackoverflow.com/q/23532446
has body: Try to delete like below, // Deleting Single Habit public void deleteHabit(Habit habit) { SQLiteDatabase database = this.getWritableDatabase(); { database.execSQL("delete from " + "TABLE_HABITS" + " where KEY_ID='" + String.valueOf(habit.getID())+ "'"); } database .close(); }
score: 0
has comment: http://stackoverflow.com/comment/36101433
type: Answer

http://stackoverflow.com/q/23457084
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23458371
accepted answer: http://stackoverflow.com/a/23458371
tagged with: java
has comment: http://stackoverflow.com/comment/35960549
has body: I tried SpringMVC example mentioned here- http://javahash.com/spring-4-mvc-hello-world-tutorial-full-example/. I have customised the web.xml and the dispatcher servlet and not getting the results. I am getting the error page as configured under error page tag when I hit the URL-/Spring4MVCHelloWorld/hello/?name=JavaHash However, if I hit the URL - /Spring4MVCHelloWorld/ I am getting the page as specified in the welcome file list, that is the index.jsp page. The expected behaviour is that helloworld.jsp should be loaded when the user hits the first URL. It was working but I changed something in my dispatcher servlet and the web.xml file. Here is my web.xml file - <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> Web Application index.jsp contextConfigLocation /WEB-INF/dispatcher-servlet.xml org.springframework.web.context.ContextLoaderListener dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher / 404 /WEB-INF/errors/404.jsp Here is my dispatcher-servlet file - <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.javahash.spring.controller" /> /WEB-INF/views/ .jsp Here is the controller file - @Controller public class HelloWorldController { @RequestMapping("/hello") public String hello(@RequestParam(value="name", required=false, defaultValue="World") String name, Model model) { model.addAttribute("name", name); return "helloworld"; } } The helloWorld.jsp has the …
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/35960089
score: 0
has comment: http://stackoverflow.com/comment/35960448
has comment: http://stackoverflow.com/comment/35960512
has title: No mapping found for HTTP request with URI [/Spring4MVCHelloWorld/hello/] in DispatcherServlet with name 'dispatcher'

http://stackoverflow.com/comment/36124569
comment on: http://stackoverflow.com/a/23545792
has text: In the above you appear to have a list (of integers). That would appear to me to be an object
type: Comment
type: AnswerComment
score: 2

http://stackoverflow.com/comment/36111788
comment on: http://stackoverflow.com/q/23538748
has text: what is playgame here ? where did u declared it ??
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23455501
has comment: http://stackoverflow.com/comment/35955977
tagged with: android
has comment: http://stackoverflow.com/comment/35955998
has comment: http://stackoverflow.com/comment/35969749
has title: AsyncTask onPostExecute TextView not updating
tagged with: java
has comment: http://stackoverflow.com/comment/35958667
has comment: http://stackoverflow.com/comment/35956036
type: Question
has answer: http://stackoverflow.com/a/23455615
score: 0
answer count: 1
has body: My situation is like this: My main activity has 3 fragments. The first fragment requests data from the server and tries to render it. I use an AsyncTask inner class to get the data and render in onPostExecute. I render using a SimpleCursorAdapter with a ListView. Rendering works fine. After this is done, I try to manipulate the UI (set value of a TextView) but it is not working. getViewById does not return null or any errors but I still cannot change the value for some reason. Any suggestions are highly appreciated. Here is the Fragment Class that I use: public class FeedFragment extends Fragment { @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_feed, container, false); Activity activity = getActivity(); try { new getFeedData(activity,rootView).execute(); } finally{ return rootView; } } private class getFeedData extends AsyncTask&lt;Void, Void, String&gt; { private Context activity; private View rootView; public getFeedData(Context context, View main){ this.activity=context; this.rootView=main; } @Override protected String doInBackground(Void... params) { try { HttpRequest request = HttpRequest.get("http://upinion.us/test/feed_sample/"); String response = ""; if (request.ok()) { response = request.body(); } return response; } catch (HttpRequestException exception) { return null; } } @Override protected void onPostExecute(String response) { String[] columns = new String[] {"_id","title","description"}; int[] viewIds = new int[] {R.id.postId,R.id.title,R.id.description}; JSONArray finalResponse; try { finalResponse = new JSONArray(response); } catch (JSONException e) { e.printStackTrace(); finalResponse = null; } MatrixCursor mc = new MatrixCursor(new String[] {"_id","title","description"}); // properties from the JSONObjects for (int i = 0; i &lt; finalResponse.length(); i++) { JSONObject jsonObject; try { jsonObject = finalResponse.getJSONObje…
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/35956214
type: UnansweredQuestion

http://stackoverflow.com/a/23484617
accepted answer of: http://stackoverflow.com/q/23483884
answers question: http://stackoverflow.com/q/23483884
score: 5
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36010770
has body: There's two parts to this question, now that I understand it, and really the fact that you're working with Multimaps isn't very important. It's valuable to try to break problems into its component parts; when you do the problems often become clearer, even trivial seeming. How do I print successive pairs from a collection? We need to define a function which will take a Collection (this will let us work with arbitrary Multimaps), and generate your pairs: public static &lt;V&gt; List&lt;String&gt; genPairs(Collection&lt;V&gt; col) { List&lt;V&gt; ls = ImmutableList.copyOf(col); List&lt;String&gt; ret = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; ls.size()-1; i++) { for (int j = i+1; j &lt; ls.size(); j++) { ret.add(ls.get(i)+", "+ls.get(j)); } } return ret; } Demo: for(String pair : genPairs(ImmutableList.of(1,2,3))) { System.out.println(pair); } 1, 2 1, 3 2, 3 How do I print successive pairs from the values of a Multimap? This part's easy, you just loop over the value collections and call the above function: for(Collection&lt;String&gt; col : multimap.asMap().values()) { for(String pair : genPairs(col)) { System.out.println(pair); } System.out.println(); }
type: Answer
has comment: http://stackoverflow.com/comment/36010904

http://stackoverflow.com/a/23597040
downvote count: 1
answers question: http://stackoverflow.com/q/23596522
score: 0
type: Answer
upvote count: 1
has body: Let's say: a = -1 b = 0 c = 0 d = 0 These values will skip the first if, the second if and the third if and will go straight to ablehelper(a + b, b, c, d); It turns out -1+0 is -1, and thus, we start over from the beginning and this has no end (but a stack overflow exception). Regarding the complexity, it doesn't make much sense like Marco Acierno pointed out.

http://stackoverflow.com/a/37539959
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/23454952
upvote count: 19
has comment: http://stackoverflow.com/comment/69902889
score: 19
has body: From Oracle tutorial: The purpose of Optional is not to replace every single null reference in your codebase but rather to help design better APIs in which—just by reading the signature of a method—users can tell whether to expect an optional value. In addition, Optional forces you to actively unwrap an Optional to deal with the absence of a value; as a result, you protect your code against unintended null pointer exceptions.
has comment: http://stackoverflow.com/comment/69895181

http://stackoverflow.com/comment/36104279
type: QuestionComment
comment on: http://stackoverflow.com/q/23534528
has text: That sounds like a time machine. You add three days and end up two years back.
type: Comment
score: 1

http://stackoverflow.com/comment/36210693
score: 0
has text: @Lokesh No. The loop in Source execute infinitely.
comment on: http://stackoverflow.com/q/23591935
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23595136
possible better answer: http://stackoverflow.com/a/23643521
tagged with: java
has comment: http://stackoverflow.com/comment/36235441
type: Question
has comment: http://stackoverflow.com/comment/36222603
answer count: 2
has comment: http://stackoverflow.com/comment/36216882
downvote count: 0
accepted answer: http://stackoverflow.com/a/23606688
has comment: http://stackoverflow.com/comment/36222047
has body: In Java 8 it looks like the lambdas of a class are kept in an array. For example, lets say we have this class: public class LambdaFactory { public Supplier&lt;Integer&gt; getOne(){ return () -&gt; 42; } public Supplier&lt;Integer&gt; getTwo(){ return () -&gt; 128; } public Supplier&lt;Integer&gt; getThree(){ return () -&gt; 3; } } and then I print it out like so: System.out.println(factory.getOne()); System.out.println(factory.getOne()); System.out.println(factory.getTwo()); System.out.println(factory.getThree()); the output will be something like examples.LambdaFactory$$Lambda$1@4e515669 examples.LambdaFactory$$Lambda$1@4e515669 examples.LambdaFactory$$Lambda$2@1b9e1916 examples.LambdaFactory$$Lambda$3@ba8a1dc So we can see two thing here. The same lambda called twice gives us the same lambda object (this is not the same as with anon inner classes where we could get a new one every time). We also see that they look like they are being kept in some kind of "Lambda" structure that is part of the class My question is, can I get ahold of the lambdas in a class? I don't have any reason to do so, I just like dissecting things
has comment: http://stackoverflow.com/comment/36216798
has comment: http://stackoverflow.com/comment/36234062
favorite count: 0
has comment: http://stackoverflow.com/comment/36216623
has title: Get a list of classes lambdas
upvote count: 2
has answer: http://stackoverflow.com/a/23643521
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/23606688
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36216612

http://stackoverflow.com/q/23549066
upvote count: 5
has body: I've written an genetic algorithm that tries to find the chromatic number for a given graph. I've been using the DIMACS benchmark graphs to test it. I have to present the results of my algorithm to my faculty at end of the term, but the graphs are not visually interesting. Are there any good libraries out there (in Java hopefully since that is what our GA is in) for dynamically coloring images? I've been looking around and all I've found are GIS stuff (I'm thinking I just don't know what to call this sort of library).
tagged with: visualization
tagged with: graph-coloring
answer count: 1
downvote count: 0
favorite count: 0
has title: Graph Coloring Visualization
type: AnsweredQuestion
tagged with: genetic-algorithm
tagged with: java
has answer: http://stackoverflow.com/a/23549639
accepted answer: http://stackoverflow.com/a/23549639
type: Question
score: 5

http://stackoverflow.com/comment/35982880
comment on: http://stackoverflow.com/a/23467037
type: AnswerComment
has text: Thank you for your answer. I updated the question with the missing information. Anyway I only run one instance of the program at the time and then I successfully kill it: all the processes listed belong to the same single instance of the running program.
score: 0
type: Comment

http://stackoverflow.com/q/23602953
answer count: 4
has answer: http://stackoverflow.com/a/58930530
type: AnsweredQuestion
upvote count: 31
tagged with: java
has answer: http://stackoverflow.com/a/23611139
has body: I would like to get name of scenario to have meaningful logs and to generate custom report at run-time in java. Scenario class have only has getStatus() and getSourceTagNames() methods. I don't find a way to get scenario name. Can someone help me to get this resolved ?
type: Question
score: 31
possible better answer: http://stackoverflow.com/a/43526935
has answer: http://stackoverflow.com/a/43526935
tagged with: cucumber
accepted answer: http://stackoverflow.com/a/23611139
downvote count: 0
has answer: http://stackoverflow.com/a/64692486
favorite count: 0
tagged with: cucumber-jvm
has title: How to get name of scenario in cucumber java?

http://stackoverflow.com/comment/35983198
score: 0
type: Comment
type: QuestionComment
has text: my web.xml is empty, i want to try to define my spring-config.xml in my web.xml.
comment on: http://stackoverflow.com/q/23469695

http://stackoverflow.com/comment/36055119
type: Comment
score: 0
has text: @user3580294 I think profiling would be a good idea. Could you help me on that plea? ( IT is very kind of you to assist me, thank you).
type: QuestionComment
comment on: http://stackoverflow.com/q/23508233

http://stackoverflow.com/q/23574869
type: Question
upvote count: 27
has answer: http://stackoverflow.com/a/59534086
downvote count: 0
has comment: http://stackoverflow.com/comment/36179528
has answer: http://stackoverflow.com/a/34698556
has comment: http://stackoverflow.com/comment/36179286
has comment: http://stackoverflow.com/comment/36179547
has answer: http://stackoverflow.com/a/23575981
has title: 404 error redirect in Spring with Java config
has answer: http://stackoverflow.com/a/26688428
favorite count: 0
answer count: 9
has answer: http://stackoverflow.com/a/54238982
has answer: http://stackoverflow.com/a/39031151
type: UnansweredQuestion
has body: As you know, in XML, the way to configure this is: 404 /my-custom-page-not-found.html But I haven't found a way to do it in Java config. The first way I tried was: @RequestMapping(value = "/**") public String Error(){ return "error"; } And it appeared to work, but it has conflicts retrieving the resources. Is there a way to do it?
has comment: http://stackoverflow.com/comment/72724115
tagged with: spring
has answer: http://stackoverflow.com/a/31436535
linked to: http://stackoverflow.com/q/34279705
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/24509564
linked to: http://stackoverflow.com/q/41607802
tagged with: java
score: 27
has answer: http://stackoverflow.com/a/34973417

http://stackoverflow.com/q/23501960
upvote count: 1
has comment: http://stackoverflow.com/comment/36045322
has title: Why do I have so many errors from the BaseGameUtils library?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36065062
type: Question
has comment: http://stackoverflow.com/comment/36043585
has body: I am following this link https://developers.google.com/games/services/android/init With trying to add leaderboards to an android app but after I follow step 1 and it is added it throws up over 100 errors and a Jar mismatch! Fix your dependencieserror, that I understand why. I have added the google play library no problem and gotten adverts to work by following Google's documentation but the leaderboard documentation seems to be sending me all over the place and not helping at all. Could someone please shed some light on this, thanks!
downvote count: 0
has answer: http://stackoverflow.com/a/23514708
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/23598360
tagged with: mysql
has body: Attempting to create a Joda-Money Money object from a BigDecimal read from a MySQL database throws an error. This code: PreparedStatement p_stmt = ...; ResultSet results = ...; Money amount = Money.of(CurrencyUnit.USD, results.getBigDecimal("amount")); Throws this: java.lang.ArithmeticException: Scale of amount 1.0000 is greater than the scale of the currency USD at org.joda.money.Money.of(Money.java:74) at core.DB.getMoney(DB.java:4821) I have actually solved the error by adding rounding: Money amount = Money.of(CurrencyUnit.USD, results.getBigDecimal("amount"), RoundingMode.HALF_UP); But, I am leery of this solution. Is it the best?. I am using DECIMAL(19,4) to store the money values on the DB as per this SO answer. Honestly, it kind of confused me why the answerer there called for 4 decimal place precision on the DB, but I tend to trust high-valued answers and I assume they know what they're talking about and that I'll regret not following their advice. Yet Joda-Money does not like 4 decimal place precision with US Currency. Maybe DECIMAL(19,4) was an international standard where they need 4 decimal place precision? Not sure.. To make the questions succinct: Is RoundingMode.HALF_UP the ideal solution to solve this error? Should I change the precision on the MySQL DB from DECIMAL(19,4) to DECIMAL(19,2)? Is there a way to change the precision in Joda-Money? If yes: should I?
type: Question
score: 5
upvote count: 5
has answer: http://stackoverflow.com/a/51623740
possible better answer: http://stackoverflow.com/a/23960058
has answer: http://stackoverflow.com/a/23960058
linked to: http://stackoverflow.com/q/628637
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/40249360
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/51623740
type: AnsweredQuestion
has title: ResultSet::getBigDecimal throws scale exception for joda-money
tagged with: java
tagged with: joda-money

http://stackoverflow.com/comment/36260178
type: Comment
has text: This works perfectly fine. Great answer! I believe the registerMapper class is to convert the output of the query to the Product class? Is that correct?
comment on: http://stackoverflow.com/a/23614134
type: AnswerComment
score: 0

http://stackoverflow.com/q/23561059
has comment: http://stackoverflow.com/comment/36152702
tagged with: java
has title: Why does my program not find my java classes?
tagged with: classpath
type: Question
has answer: http://stackoverflow.com/a/23561694
answer count: 1
tagged with: jar
has body: I have a project that I have compiled to a jar with Maven which I named H.jar. The maven command I use is (in eclipse): maven install The jar file has a class called Person in it. I have added the jar file to the classpath on a Windows machine. echo %classpath% Results -> C:\location_to_jar\H.jar But when I try to compile the program I get error: error. Cannot find symbol. I am running the command: javac Main.java The class looks like this: public class Main { public static void main(String[] args) { Person p = new Person("John", "Doe"); p.toString(); } } Should the program not just find the class if I have added it to the classpath?
score: 0
has comment: http://stackoverflow.com/comment/36153045
tagged with: maven-2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36152802
linked to: http://stackoverflow.com/q/574594
tagged with: maven

http://stackoverflow.com/comment/36209384
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23591230
has text: Is there anyway I could determine how much room do I have left to add an icon? I thought there should be enough room because I only use standard android icons.
score: 0

http://stackoverflow.com/q/23464592
tagged with: java
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/23464809
type: Question
has comment: http://stackoverflow.com/comment/35973335
score: -2
tagged with: sorting
possible better answer: http://stackoverflow.com/a/23464688
answer count: 3
linked to: http://stackoverflow.com/q/8938235
tagged with: arrays
has title: I need to sort through an object array and order them highest to lowest
favorite count: 0
has comment: http://stackoverflow.com/comment/35973483
has body: I am a student in a beginning java class, I got some help earlier today on my assignment, which really helped! So I thought I would give it one more try, before I throw in the towel on this last part. I have been able to get everything going, but my sort just doesn't work. I have to use this format, as my professor does not want us to use sort APIs. It processes correctly, meaning I get the same results by hand as when I run it, so I think the problem is in the logic itself. Can anyone see what I am doing wrong and offer any hints or helps. Thanks in advance. Here is my code for my sort loop: int i, j; // used to index into the array double temp; for (i = 1; i &lt; count ; ++i) { temp = students[i].getGPA(); j = i - 1; while (j &gt;= 0 &amp;&amp; temp &lt; students[j].getGPA()) { students[j + 1] = students[j]; j = j - 1; } students[j + 1]= students[i]; }
accepted answer: http://stackoverflow.com/a/23464809
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23464688
has answer: http://stackoverflow.com/a/23465713

http://stackoverflow.com/comment/36169718
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23569846
has text: Just rebuilt the project and cleaned up a java.markbratanov in the web.xml, now it fires perfectly. THANK YOU.
score: 0

http://stackoverflow.com/a/23525268
upvote count: 1
has comment: http://stackoverflow.com/comment/36086802
has comment: http://stackoverflow.com/comment/36088273
type: Answer
has comment: http://stackoverflow.com/comment/36087086
has body: You're using the wrong equality operator. You want .equals, not ==. Whether or not the strings returned by the method calls you're using are the same string objects is an implementation detail; you want .equals to compare their contents.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23525231

http://stackoverflow.com/q/23596393
type: Question
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/140079747
answer count: 1
favorite count: 0
tagged with: java.util.scanner
has title: Scanner won't close
has answer: http://stackoverflow.com/a/23596688
type: UnansweredQuestion
has body: I'm trying to scan String from my input stream, but it won't close. Here is my code: public static String receive(int sid) { Scanner sc = new Scanner(servers[sid].getInputStream(), "UTF-8").useDelimiter("\\A"); String s = sc.next(); sc.close(); return s; }
linked to: http://stackoverflow.com/q/9816965
tagged with: java
tagged with: inputstream
downvote count: 1

http://stackoverflow.com/comment/49249317
score: 0
type: Comment
comment on: http://stackoverflow.com/a/30408699
type: AnswerComment
has text: Your answer bring inside to the problem. But is not viable solution for me. The software I want to deploy consist on hundred of bundles will take weeks to make all of it work with this methodology. Without taking into account that if I re-build the bundle I have to start over again. Anyhow I thank you for your answer.

http://stackoverflow.com/comment/36157129
has text: Actually, that list is only partial, but this should cover most of the reasons.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23563472

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/23455449
tags question: http://stackoverflow.com/q/23593367
type: Tag

http://stackoverflow.com/comment/35970712
type: Comment
type: QuestionComment
has text: @kdgregory I want to write my own random number generation function in java; therefore for I am looking for an algorithm that I can use.
comment on: http://stackoverflow.com/q/23463126
score: 0

http://stackoverflow.com/comment/36018102
comment on: http://stackoverflow.com/q/23488243
score: 0
has text: You may forgot to override ```hashCode``` and ```equals``` even if that is not the answer.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36176642
comment on: http://stackoverflow.com/a/23572188
has text: actually, from a maintenance standpoint it's best to leave off version info in the schema declarations. Spring will pickup the highest available.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23595251
tagged with: java
type: Question
answer count: 2
tagged with: controller
score: 0
has answer: http://stackoverflow.com/a/23595861
has body: I have a custom dispatcher servlet which extends the default DispatcherServlet to do some validation for all requests. Since I will get all the parameters from a request(getInputStream()->Map) to do some validation, I want to pass the params to controller or add the params to the context where I can get them again from the cotroller. Now I just put all the params to a global Map, but I wonder if there are some simple ways. public class CustomDispatcherServlet extends DispatcherServlet { private static final long serialVersionUID = 7250693017796274410L; @Override protected void doDispatch(HttpServletRequest request, HttpServletResponse response) throws Exception { doFilter(request, response); super.doDispatch(request, response); } ... private void doFilter(HttpServletRequest request, HttpServletResponse response) { WLNResponse&lt;String&gt; error = null; try { boolean isSignValid = checkSignValidity(request); ... private boolean checkSignValidity(HttpServletRequest request) throws IOException { // pass this params to controller or somewhere I can get from controller Map&lt;String, Object&gt; params = WebUtils.readParams(request); ...
has answer: http://stackoverflow.com/a/23600563
type: UnansweredQuestion
tagged with: spring-mvc
has title: add custom parameters to spring mvc controller

http://stackoverflow.com/comment/36226329
type: AnswerComment
score: 0
type: Comment
has text: Yes, you are correct. Still in study mode, because just switch from C# to JAVA..And I found the error when debugging..How to add this in debug mode?
comment on: http://stackoverflow.com/a/23600124

http://stackoverflow.com/q/23614212
tagged with: java
type: Question
answer count: 2
has title: How to make an enum constant containing a list of a enums?
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/23615320
has body: Lately I had been trying to make an relativistic energy calculator. I used List&lt;ComponentType&gt; to represent any particle build on ComponentType.ELECTRON, ComponentType.PROTON and ComponentType.NEUTRON, where ComponentType is a enum containing mass. Later I wanted to make an ParticleFactory Class which would correspond to a list of basic particles in GUI drop down list. Like: ParticleFactory(Hydrogen) would give me an Particle object containing {ComponentType.ELECTRON, ComponentType.PROTON} list. This would make the modification easy because ParticleFactory and GUI would use the same enum with basic particles. Problem arisen when I tried to implement it. I know that it has no chance of working with improper syntax but no matter what I do I always get errors. public enum GenericParticleType { ELECTRON({"electron","e"}, new ArrayList&lt;ComponentType&gt;()); private final String[] names; private final List&lt;ComponentType&gt; components; GenericParticleType(String[] names, List&lt;ComponentType&gt; components) { this.names = names; this.components = components; } } The goal is to make enum contain list of other enums. :D Is there any proper way of doing this? Is there perhaps a better way of doing this? A constant HashMap?
possible better answer: http://stackoverflow.com/a/23614515
favorite count: 0
has answer: http://stackoverflow.com/a/23614515
upvote count: 2
type: AnsweredQuestion
tagged with: list
tagged with: enums
has answer: http://stackoverflow.com/a/23615320

http://stackoverflow.com/a/23548766
score: 0
has body: You could go ahead and serialize the build number. because it will be lost every time the application is shut down. Here is a tutorial on how to serialize objects
type: Answer
has comment: http://stackoverflow.com/comment/36130061
answers question: http://stackoverflow.com/q/23548720
has comment: http://stackoverflow.com/comment/36130609

http://stackoverflow.com/comment/36175900
type: QuestionComment
has text: Show us your POJO too.
comment on: http://stackoverflow.com/q/23565445
score: 0
type: Comment

http://stackoverflow.com/comment/36158094
type: QuestionComment
has text: do you wan to convert month to alphabetic one? look on that `M:1 MM:01 MMM:Jan MMMM:January MMMMM:J`
comment on: http://stackoverflow.com/q/23564084
type: Comment
score: 1

http://stackoverflow.com/comment/36034489
has text: The OP wants number of columns rather than number of rows
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23497761

http://stackoverflow.com/comment/36153354
comment on: http://stackoverflow.com/a/23560459
type: Comment
has text: I am not reading text files, the datas in the binary file "abc.bin" which I am reading are encoded in such a way that the first 2 byte will represent an integer value, the next 5 bytes will be the name of the file, the value of next single byte will represent the number of certain object and so on..
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36025002
type: QuestionComment
has text: I don't think /proc/self/fd can get the cache location. I wrote a JNI sample and the c code like this:'int fd; FILE *fp; char path[1024]; char buf[1024]; fp = fopen("temp", "a+"); fd = fileno(fp); sprintf(buf, "/proc/%ld/fd/%d",getpid(), fd); int res; res = readlink(buf, path, sizeof(path));' I have one question when I wrote the sample, how can I get fd?
comment on: http://stackoverflow.com/q/23486419
score: 0
type: Comment

http://stackoverflow.com/comment/36047746
type: QuestionComment
score: 1
has text: From the [JavaDoc for `Vector`](http://docs.oracle.com/javase/7/docs/api/java/util/Vector.html) _If a thread-safe implementation is not needed, it is recommended to use ArrayList in place of Vector_. Don't use `Vector`. Ever.
comment on: http://stackoverflow.com/q/23504552
type: Comment

http://stackoverflow.com/comment/36018955
type: AnswerComment
comment on: http://stackoverflow.com/a/23489367
score: 0
type: Comment
has text: I am pulling data from database having records in order of millions and processing it in batches. I know the set (the range of val) where the issue is occurrring. But am not sure where exactly in processing of the data the issue is occurring. Also the issue seems to be with data only but need to figure out what. So want a way when this batch starts to process, the debugging should start. Conditional breakpoints are causing eclipse to crash/and anyways making a slow process very very slow

http://stackoverflow.com/q/23524900
tagged with: resources
type: Question
tagged with: jersey
has comment: http://stackoverflow.com/comment/36130732
tagged with: servlets
score: 0
has body: I have developed an SDK that uses a Resource in a rest package: package com.example.some.package.rest; ... @Path("/health") public class HealthResource { public HealthResource() { // some code } @GET @Path("/") @Produces(MediaType.TEXT_HTML) public Response getHealth() { // some code to return health } } Then I have another package with an Application implementation: package com.example.different.package.rest; ... public class HealthApplication extends Application { public Set&lt;Object&gt; getSingletons() { return Sets.&lt;Object&gt; newHashSet(new HealthResource()); } } However, this will not work for me. I have to use another wrapper class: package com.example.different.package.rest; ... @Path("") public class WrapperHealthResource extends HealthResource { public WrapperHealthResource() { super(); } } If I use WrapperHealthResource in the HealthApplication instead of HealthResource, then it works fine. I think it's pretty useless to have this extra class. How can I get rid of this complexity?
answer count: 1
has answer: http://stackoverflow.com/a/23592033
type: UnansweredQuestion
tagged with: java
has title: Using Resource from different package in Jersey Application
has comment: http://stackoverflow.com/comment/36173072

http://stackoverflow.com/a/23549391
accepted answer of: http://stackoverflow.com/q/23549341
has body: If I understand you, you've missed the assignment from the result of setScale(); d = d.setScale(4); Edit As for your second question, you can call stripTrailingZeros() - d = d.stripTrailingZeros();
has comment: http://stackoverflow.com/comment/36132324
has comment: http://stackoverflow.com/comment/36132260
has comment: http://stackoverflow.com/comment/36132013
has comment: http://stackoverflow.com/comment/36132067
has comment: http://stackoverflow.com/comment/36131289
type: Answer
has comment: http://stackoverflow.com/comment/36132131
upvote count: 4
has comment: http://stackoverflow.com/comment/36132166
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23549341
score: 4

http://stackoverflow.com/comment/36041579
has text: Make the child window modal. http://www.coderanch.com/t/339276/GUI/java/form-Modal, http://docs.oracle.com/javase/7/docs/api/javax/swing/JDialog.html
comment on: http://stackoverflow.com/q/23501413
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/36190702
comment on: http://stackoverflow.com/a/23580873
has text: Yes, you are right, names could be better. . I think what you are trying to tell me is what I am already trying? Doing this? `select userId, userName from User_table where userName = :id` and returning a List<User> list¿? Because.... I am not able to do that, because the answer is not an object User. Sorry because I think I am getting something wrong probably. If you could write me exacly what you mean would be perfect, thank you for your patience.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/86978382
comment on: http://stackoverflow.com/a/28967294
type: Comment
score: 0
type: AnswerComment
has text: Hi @Laymain - thanks for trying this out! What version are you using? I've tested the code above against the latest version (10.0.0-M7 : compile 'com.oath.cyclops:cyclops:10.0.0-M7') and the main thread blocks on the forEach as expected. A separate thread (possibly the one pushing data to the Queue needs to call queue.close()). Hopefully we don't have a bug in one of our older releases!

http://stackoverflow.com/comment/37733258
type: Comment
has text: You are right that it isn't a problem, but this is not an answer... It also most definitely is not a Cassandra problem.
comment on: http://stackoverflow.com/a/23622813
type: AnswerComment
score: 4

http://stackoverflow.com/comment/36127752
score: 0
comment on: http://stackoverflow.com/q/23547554
type: Comment
type: QuestionComment
has text: You have to ask you first what is the entry point of your program. Then you can just call it from there.

http://stackoverflow.com/a/23483560
upvote count: 2
has body: you get a -2 because the 9 you are looking for would go between the first and second index of the list. That is where it would have been inserted (between 6 and 9if it was sorted). {http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#binarySearch%28int[],%20int%29}
answers question: http://stackoverflow.com/q/23483493
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23483493
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/35984365
type: Comment
comment on: http://stackoverflow.com/a/23470249
score: 0
type: AnswerComment
has text: ohh ya right or u can put it on any folder na that will be also right. contextConfigLocation folder/spring-config.xml

http://stackoverflow.com/comment/36024393
has text: @PostConstruct was the solution
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23491046
type: AnswerComment

http://stackoverflow.com/a/23565964
answers question: http://stackoverflow.com/q/23564962
type: Answer
has body: I found the mistake.. Maven didn't give errors because there was nothing wrong with my maven repo apparently. Eclipse had changed the location of my settings.xml maven file to a "nonexistent" location.. Resulting in all the problems. I manually changed it back and all problems are solved. In Eclipse I did: Window > Preferences > Maven > User Settings: Field User Settings was wrong (eclipse changed it..) put it back to where I first made the settings, applied, cleaned the project and everything was fixed!
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/36162866
type: Comment
has text: Thanks! What if it would have to implement multiple interfaces?
comment on: http://stackoverflow.com/a/23566429
score: 0
type: AnswerComment

http://stackoverflow.com/q/23584066
accepted answer: http://stackoverflow.com/a/23589161
answer count: 3
has answer: http://stackoverflow.com/a/23584263
downvote count: 0
favorite count: 0
has title: Limit the number of characters viewed in textfield in android
tagged with: textfield
tagged with: android
has body: I am still new to android and i am trying to make a notes application i want the user to be able to type anything in the title (text) but only display a few characters (say 15) followed by (...) i tried searching for this but the only thing i found is how to LIMIT size of text ( i do not want to do that i just want to limit what is viewed) i do not want to do the following: android:maxLength="10" so my question is : what is the best way to do that? also is there a way to do it in xml or only in java? Any help is appreciated :)
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26384352
score: 1
has answer: http://stackoverflow.com/a/23589161
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/23584263

http://stackoverflow.com/comment/36102979
score: 0
comment on: http://stackoverflow.com/q/23533952
type: Comment
type: QuestionComment
has text: How can i use Set for this code ,could you please change my code if possible @Leos

http://stackoverflow.com/comment/36209674
comment on: http://stackoverflow.com/q/23591033
type: Comment
type: QuestionComment
has text: You have `runOnUiThread()` in your asynctask. Guess what it does?
score: 1

http://stackoverflow.com/comment/36115648
score: 0
type: Comment
has text: To be honest I'd have to see more exactly what you're doing and play around a bit to really understand it, but there are basically two possibilities: It may be just lucky that after you xor the character you're left with a value that is still valid UTF-16 (the in-memory encoding Java uses internally for chars). Or it may be that Java doesn't validate the value in this case since it only needs to "understand" the character when it's time to convert to or from a specific encoding. In either case you would get out of the string exactly what you put in, which is the real requirement here.
type: AnswerComment
comment on: http://stackoverflow.com/a/23499379

http://stackoverflow.com/q/23550044
tagged with: glassfish-4
has title: Difference between deploy and create-application-ref in GlassFish?
tagged with: java
has answer: http://stackoverflow.com/a/23550130
type: Question
has body: What is the difference between deploying a web-app to GlassFish using the (asadmin) deploy command as opposed to using create-application-ref? I read the documentation in https://glassfish.java.net/docs/4.0/application-deployment-guide.pdf but I am not so clear.
answer count: 1
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/35981458
type: Comment
type: QuestionComment
has text: @Averroes i like that idea! not exactly sure how to do that though! would it look like? this for(int j = 0;j<length-1;j++) { if(toCheck.charAt(j)==words[x].charAt(j)) {count++; if(j==(toCheck.length())-1) break; else if(j==(words[x].length()-1)) break;} }
comment on: http://stackoverflow.com/q/23469116
score: 0

http://stackoverflow.com/q/23502522
has title: Application not closing properly (Java Platform SE Binary won't close)
has comment: http://stackoverflow.com/comment/36045868
tagged with: java
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36054624
linked to: http://stackoverflow.com/q/7799940
has answer: http://stackoverflow.com/a/23526819
has body: I've created a Java application and converted it to an .exe using Launch4j and it runs fine. But when it is closed, the "Java (TM) Platform SE Binary" task remains running in the Windows Task Manager. Each instance of the application I run creates a new task for this and they need to be manually end-tasked. Any ideas why this would happen? I've only been coding in Java for about 3 weeks and this is my first application. Hope it's ok to add links to the application + zipped source code. I can't add the source code directly as it is too long. Thanks for any advice or suggested solutions. Application: http://www.filedropper.com/folderencryptor Source Code: http://www.filedropper.com/folderencryptor_1
has comment: http://stackoverflow.com/comment/36045480
upvote count: 2
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/36044053
downvote count: 1
type: Question

http://stackoverflow.com/comment/52224173
comment on: http://stackoverflow.com/q/23582621
score: 0
type: Comment
type: QuestionComment
has text: @andryr oh damn I noticed your comment only after I answered. Well whatever :)

http://stackoverflow.com/comment/35958347
has text: @skiwi: The overriding argument is not sufficient. Subclasses may override methods that are declared `synchronized` in super classes, effectively removing synchronization. I wouldn't be surprised that not supporting `synchronized` and not supporting `final` is related, though, maybe because of multiple inheritance (e.g. inheriting `void x()` *and* `synchronized void x()`, etc.). But that's speculation. I'm curious about an authoritative reason, if there is one.
comment on: http://stackoverflow.com/q/23453568
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36019504
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23489568
score: 0
has text: @ErwinBolwidt You are not correct, why the second is invalid?

http://stackoverflow.com/comment/36117031
score: 1
has text: Sorry if mentioning ImageJ2 caused confusion, this was meant as an alternative approach. A more straightforward example to integrate with the existing GUI can be found the Trainable Weka Segmentation. I added a link to it in an edit to my answer.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23529450

http://stackoverflow.com/comment/36230797
type: Comment
has text: Your threads aren"t started properly. You need to call start(), not run(). Here you're just calling run as a regular method, it won't execute in another thread of execution.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23602525

http://stackoverflow.com/a/23589406
type: AcceptedAnswer
downvote count: 1
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/23589250
score: 3
has body: One simple solution is to set the url as a parameter for your servlet: YourServlet com.you.YourServlet url /MyWebApp/MvcView.jsp and the in the servlet: public class YourServlet { protected String url = null; public void init(ServletConfig servletConfig) throws ServletException { this.url = servletConfig.getInitParameter("url"); } public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { RequestDispatcher view = request.getRequestDispatcher(url); } } then there is no need to recompile servlet code to chage the url.
answers question: http://stackoverflow.com/q/23589250
has comment: http://stackoverflow.com/comment/36434377

http://stackoverflow.com/a/23586466
has body: As far as I read your code and your text I think you have a int[5][8] Array and you'd like to check whether there is at least one "1" in every row of the array or not. In that case you juse need to change the the Code as followed public boolean isExistWordOfAllOnes() { int counter; for(int i=0;i&lt;5;i++) { counter=0; for(int j=0;j&lt;8;j++) { if(this.allWords.get(i)[i][j]==1) { counter++; } } if(counter &lt; 1) // If there were no 1's then count should still be 0 { // and the method returns false as a row was found return false; // in which there wasn't a 1 } } return true; }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23586328

http://stackoverflow.com/a/23491734
type: Answer
has comment: http://stackoverflow.com/comment/36026930
has body: Reason for NPE is already mentioned in above answer that you are using &amp;, Hence both conditions will be evaluated. Replacing it with &amp;&amp; will solve the issue. You can also use an alternative, to avoid NPE and != null check, if ( "on".equals(request.getParameter("thumbnail")) ) { // Do the rest. }
score: 0
answers question: http://stackoverflow.com/q/23491515
has comment: http://stackoverflow.com/comment/36026447
has comment: http://stackoverflow.com/comment/36025856
has comment: http://stackoverflow.com/comment/36025348

http://stackoverflow.com/a/23579360
score: 1
answers question: http://stackoverflow.com/q/23567123
upvote count: 1
has comment: http://stackoverflow.com/comment/36206751
has comment: http://stackoverflow.com/comment/36208829
has comment: http://stackoverflow.com/comment/36287623
has body: It’s not clear which domain or which cookie is causing trouble. This simple code is working for me: driver.get("https://accounts.google.com"); Cookie cookie = new Cookie("foo", "bar", ".google.com", "/", new Date(), true); driver.manage().addCookie(cookie); driver.get("https://accounts.google.com“); Note that google is returning a wildcard-domain in the cookie. So you must open a valid subdomain before you set the cookie. GoogleMail is also setting cookies for .mail.google.com and plus.google.com. So check all cookies and open a valid domain for each cookie before setting it. This can get tricky because google might redirect you. For instance if I’m opening https://mail.google.com/ and I’m not logged in I’m getting a redirect to https://accounts.google.com.
type: Answer
has comment: http://stackoverflow.com/comment/36206259
downvote count: 0

http://stackoverflow.com/comment/36251844
type: Comment
comment on: http://stackoverflow.com/a/23613666
has text: Surely there isn't, the size of the output *is* `O(N * N!)`. I've never tried, but I think you can't sanely permute more than say 30 elements.
score: 0
type: AnswerComment

http://stackoverflow.com/a/23586237
answers question: http://stackoverflow.com/q/23573994
score: 15
type: AcceptedAnswer
downvote count: 0
has body: It looks like the problem is how the ContentType parameter for the HttpClient's StringEntity constructor is being created. Using the ContentType.APPLICATION_JSON constant as a parameter (which corresponds to the "application/json; charset=utf-8" mime type) makes everything work. Here is an example posting the JSON string to a public http service that echoes the request back to the client: public class HttpClientEncoding { static String TINY_UTF8_DOC = "[{ \"id\" : \"2\", \"fields\" : { \"subject\" : " + "[{ \"name\" : \"subject\", \"value\" : \"Stra\u00DFe\" }] } }]"; public static void main(String[] args) throws IOException { HttpClient httpClient = new DefaultHttpClient(); HttpPost post = new HttpPost("http://httpbin.org/post"); StringEntity entity = new StringEntity(TINY_UTF8_DOC, ContentType.APPLICATION_JSON); //StringEntity entity = new StringEntity(TINY_UTF8_DOC, ContentType.create("application/json; charset=utf-8")); post.setEntity(entity); HttpResponse response = httpClient.execute(post); String result = EntityUtils.toString(response.getEntity()); System.out.println(result); ObjectMapper mapper = new ObjectMapper(); JsonNode node = mapper.readValue(result, JsonNode.class); System.out.println(node.get("json").get(0).get("fields").get("subject").get(0).get("value").asText()); } } Output: { "origin": "46.9.77.167", "url": "http://httpbin.org/post", "args": {}, "data": "[{ \"id\" : \"2\", \"fields\" : { \"subject\" : [{ \"name\" : \"subject\", \"value\" : \"Stra\u00dfe\" }] } }]", "files": {}, "form": {}, "headers": { "Content-Length": "90", "User-Agent": "Apache-HttpClient/4.3.3 (java 1.5)", "Host": "httpbin.org", "Connection": "close", "X-Request-Id": "c02864cc-a1d6-434c-9cff-1f6187ceb080", "Content-Type": "application/json; charset=UTF-8" }, "json": [ { "id": "2", "fields": { "subject": [ { "value": "Stra\u00dfe", "name": "subject" } ] } } ] } Straße
type: Answer
has comment: http://stackoverflow.com/comment/59817159
has comment: http://stackoverflow.com/comment/36259009
upvote count: 15
accepted answer of: http://stackoverflow.com/q/23573994
has comment: http://stackoverflow.com/comment/124562137

http://stackoverflow.com/a/23589685
type: Answer
has body: With Apache Commons IO it is much simpler to read a file into a list of Strings. import org.apache.commons.io.FileUtils; List&lt;String&gt; lines = FileUtils.readLines(new File("abc.txt")); List&lt;String firstWords = new ArrayList&lt;&gt;(); for (String line : lines) { String firstWord = line.split(" ")[0].toLowerCase(); firstWords.add(firstWord); }
score: 0
answers question: http://stackoverflow.com/q/23589570

http://stackoverflow.com/comment/36117261
comment on: http://stackoverflow.com/q/23541692
score: 0
type: Comment
type: QuestionComment
has text: Have you tired to debug a little example?

http://stackoverflow.com/q/23579634
downvote count: 0
favorite count: 0
has body: I am trying to store data in a column of Oracle table which is of URITYPE using JDBC. I learned that to supply data to SYS.URITYPE from java, we need to use java.net.URL. I tried exactly same pstmt.setURL(4, new java.net.URL("http://google.com")); but still i keep on getting this error : java.sql.SQLException: ORA-00932: inconsistent datatypes: expected SYS.URITYPE got CHAR. I cant find useful information related to this. I will appreaciate if someone can share infomation on finxing this issue. Thanks, Suvojit
tagged with: oracle-database
tagged with: jdbc
has title: How to store data in ORACLE table column of type SYS.URITYPE
has comment: http://stackoverflow.com/comment/36187958
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/133744754
has comment: http://stackoverflow.com/comment/36188279

http://stackoverflow.com/q/23530501
has answer: http://stackoverflow.com/a/23530577
has answer: http://stackoverflow.com/a/23530545
type: UnansweredQuestion
score: -4
tagged with: methods
tagged with: coordinates
has comment: http://stackoverflow.com/comment/36096611
tagged with: java
has body: I am trying to write a method to extract the array coordinate that matches a number I have predefined: So here is my code at the moment: public static int matsrch(double[][]B, double S) { int []A = {0, 0}; for (int i=1; i&lt;3; i++) { for (int j=1; j&lt;3; j++) { if (B[i][j] == S) { A = {i, j}; return A; } } } } How do you output an array from a method?
type: Question
answer count: 2
downvote count: 4
has title: Extracting coordinate of an array
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/36096812
has comment: http://stackoverflow.com/comment/36097354
favorite count: 0

http://stackoverflow.com/comment/36149533
has text: My bad, use new String("content".getBytes(), charsetName). Also, the editor console output also needs to have UTF-8 encoding if you are printing the names
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23559007

http://stackoverflow.com/comment/36231898
has text: How many objects are you putting in the hashmap and are they all the same type or not?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23602973

http://stackoverflow.com/comment/36208519
comment on: http://stackoverflow.com/q/23590782
type: Comment
type: QuestionComment
has text: yes, i update first post
score: 0

http://stackoverflow.com/q/23595112
tagged with: android
accepted answer: http://stackoverflow.com/a/23595174
has body: If I try to get the sin and sin-1 of 0.5 degree, I get virtually the same answer. sin-1(0.5) should have been 30. Log.d("XYZ", Math.sin(Math.toRadians(0.5)) +"___"+ Math.asin(Math.toRadians(0.5))); Result: 0.008726535498373935___0.008726757025787037 Any idea what I am doing wrong?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36216797
has title: asin() not working properly in Java
tagged with: java
downvote count: 2
type: Question
score: -2
has answer: http://stackoverflow.com/a/23595174
upvote count: 0
answer count: 1
favorite count: 0

apache
tag name: apache
tags question: http://stackoverflow.com/q/23530027
tags question: http://stackoverflow.com/q/23570480
tags question: http://stackoverflow.com/q/23487991
tags question: http://stackoverflow.com/q/23493893
tags question: http://stackoverflow.com/q/23609494
tags question: http://stackoverflow.com/q/23524949
tags question: http://stackoverflow.com/q/23469193
tags question: http://stackoverflow.com/q/23464650
tags question: http://stackoverflow.com/q/23470305
tags question: http://stackoverflow.com/q/23527426
tags question: http://stackoverflow.com/q/23479409
tags question: http://stackoverflow.com/q/23539843
tags question: http://stackoverflow.com/q/23553413
tags question: http://stackoverflow.com/q/23543569
tags question: http://stackoverflow.com/q/23499079
tags question: http://stackoverflow.com/q/23545198
tags question: http://stackoverflow.com/q/23543978
tags question: http://stackoverflow.com/q/23539934
tags question: http://stackoverflow.com/q/23506368
tags question: http://stackoverflow.com/q/23482290
tags question: http://stackoverflow.com/q/23613557
tags question: http://stackoverflow.com/q/23506238
tags question: http://stackoverflow.com/q/23533886
type: Tag
tags question: http://stackoverflow.com/q/23481809
tags question: http://stackoverflow.com/q/23602002
tags question: http://stackoverflow.com/q/23492218
tags question: http://stackoverflow.com/q/23465810
tags question: http://stackoverflow.com/q/23454590
tags question: http://stackoverflow.com/q/23457027
tags question: http://stackoverflow.com/q/23591219
tags question: http://stackoverflow.com/q/23457963

http://stackoverflow.com/a/23575697
type: Answer
has body: Make the 'reg' variable static. Otherwise it is liable to GC and DGC which will unexport it, which in turn will lead to DGC of the server and its unexporting, which in turn leads to socket closure and listening thread exit.
has comment: http://stackoverflow.com/comment/36181229
has comment: http://stackoverflow.com/comment/36181210
has comment: http://stackoverflow.com/comment/36181280
has comment: http://stackoverflow.com/comment/36181366
has comment: http://stackoverflow.com/comment/36189146
has comment: http://stackoverflow.com/comment/36181287
has comment: http://stackoverflow.com/comment/36181338
has comment: http://stackoverflow.com/comment/36180876
answers question: http://stackoverflow.com/q/23575469
has comment: http://stackoverflow.com/comment/36181145
score: 0

http://stackoverflow.com/comment/36076517
type: QuestionComment
comment on: http://stackoverflow.com/q/23518886
type: Comment
score: 0
has text: I'll do something like that, because I don't have time to do it properly (to complicate things, I'm using JCB in a JTable, which is pretty tricky to modify the JCB content - you can only access the selected items, not the JCB itself - ) I will temporarily change to background to multi-selected items to RED, will do the trick

http://stackoverflow.com/comment/36247310
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23610415
score: 0
has text: Also, your result is weighted, as small shifts will have more valid combinations, so the sum of the correlation rises in absolute value.

http://stackoverflow.com/comment/109114335
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23590046
score: 0
has text: It should just be a matter of selecting a check box associated with the answer.

http://stackoverflow.com/comment/36162429
score: 0
type: AnswerComment
has text: But see, I would like the result TO BE unicoded in the special characters instead. I don't want the result to be: aész, I actually WANT it to be: "a\u00e9sz"
type: Comment
comment on: http://stackoverflow.com/a/23566167

http://stackoverflow.com/a/23498072
accepted answer of: http://stackoverflow.com/q/23491387
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
has body: A element is akin to a step in Spring Batch. While it's not a step, it is a state of a batch job. States are not inheritable in Spring Batch because there is no way to know what the order would be. If jobA had a split in it and jobB had three steps and inherited jobA, where would the split go? At the beginning? At the end? The best way to handle common flows like this is to externalize a flow and reference it from within your job. For example (this example has a flow with steps, but it can contain a split as well): <step id="step3" parent="s3"/> <step id="step1" parent="s1" next="step2"/> <step id="step2" parent="s2"/> <step id="step3" parent="s3"/> You can read more about externalized flows in the documentation here: http://docs.spring.io/spring-batch/reference/html-single/index.html#external-flows
score: 2
answers question: http://stackoverflow.com/q/23491387

http://stackoverflow.com/a/23510114
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23509862
score: 1
has body: Looks good. To make it better you can make the Card properties private and add setter and getter methods. Your IDE does this for free. Let's say you want to make the cost evaluation dynamic you don't have to change Card's API.
answers question: http://stackoverflow.com/q/23509862

http://stackoverflow.com/a/23555579
answers question: http://stackoverflow.com/q/23555553
upvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36143296
downvote count: 1
has comment: http://stackoverflow.com/comment/36143250
score: -1
has body: This is only possible if "myMethodFoundInB" is declared in class A, which I'm guessing it isnt.

http://stackoverflow.com/comment/36059941
type: Comment
has text: Ohh, so even if I get the implementation of the specs, ie the Hibernate Validator, the first piece of code wont work right? It will still print null and not really validate.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23511300

http://stackoverflow.com/a/23516189
type: Answer
has comment: http://stackoverflow.com/comment/47620565
has body: Database systems -- small ones, anyway -- can often run in either of two modes: embedded or server. In embedded mode, the idea is that one program and only one program can read and write to the database at a time. This is quite useful for many applications, and allows the database to dispense with the code necessary to allow access among multiple programs, which eats up time, code, and processing power. In server mode, the database management system itself runs as a separate program, and it is built to have multiple programs access it. Based on the class in the error message above, you have an embedded database, so the answer to your question is "no, you can't do that in this mode". You can switch to using a server mode of neo4j, I expect, but connecting to it will involve some code changes, and you then have the minor problems of making sure your database system is running when your program runs, etc. So you can do it with this database data, but you have to change the mode in which you are running the database management system.
score: 2
answers question: http://stackoverflow.com/q/23515778
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23515778
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/36137852
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23551696
type: Comment
has text: @HovercraftFullOfEels I'm not sure what is considered the best practice in gui design these days. I've tried it both ways in the OPs program and it doesn't seem to make any functional difference.

http://stackoverflow.com/comment/36236175
type: Comment
comment on: http://stackoverflow.com/a/23604163
has text: Goog point @fge. Sorry I must be tired, I forgot to add InputStreamReader. Hope it's fine now
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36244070
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23609793
type: Comment
has text: Effects on images are done on client side. Why are you looking for it in Grails rather than in jQuery for example?

http://stackoverflow.com/q/23546565
has comment: http://stackoverflow.com/comment/36125911
favorite count: 0
downvote count: 3
answer count: 1
upvote count: 0
type: UnansweredQuestion
tagged with: jprogressbar
score: -3
has body: Hey I'm having a problem with 3 lines of coding, and I still don't know what the problem is. public class HealthBar{ int min = 0; int max = 100; JProgressBar PlayerHealth = new JProgressBar(min,max); JProgressBar EnemyHealth = new JProgressBar(min,max); PlayerHealth.setStringPainted(true); }
has title: JProgressBar, Syntax Error on these tokens true
has answer: http://stackoverflow.com/a/23546592
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36125928

http://stackoverflow.com/q/23513434
tagged with: nullpointerexception
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/23514537
has comment: http://stackoverflow.com/comment/36063539
has comment: http://stackoverflow.com/comment/36063551
has answer: http://stackoverflow.com/a/23514696
has comment: http://stackoverflow.com/comment/36064297
type: Question
has body: I've designed app for Android and get occasional reports for crashes: java.lang.NullPointerException at this line in source code : int y = -(int)(fft.freqToIndex(freq)/DrawXStep*DrawXMult); // Calculate bin I'm trying to isolate possible causes for this error. The only one that comes to my mind is that object fft was not properly initialized and method is not accessible. Is there any other possible source for NullPointerException in this line from source code ? Thanks in advance, regards, Bor.
tagged with: java
has title: Android: Weird crash message on method call
score: 0
answer count: 2

http://stackoverflow.com/a/23594583
score: 0
has body: there is several things wrong with your code. Text.words shouldn't be static. Every instance of text consists of a different collection of words. When you make a "Collection of Words", then it should be Collection&lt; Word>. Because every item inside the collection is just a single item. but then again, Collection&lt; Word> is just the same as Collection&lt; String>. So use that. "path", "in" should not be member variables of "Words". Just use them locally in your method. Especially since you never closed "in". you're overwriting whatever is in "inside" for each line in your file that you loop over. When you have your "Collection&lt; String> words", then just do words.addAll(inside); in your loop. Yes, I know this is not an answer, but I'm trying to point you in the right direction. This might help you more in the long run.
answers question: http://stackoverflow.com/q/23594379
type: Answer

http://stackoverflow.com/comment/36111912
has text: Is the JVM heap being paged to disk? Can you try tweaking the survivor ratio? And could you start the JVM with `-XX:+PrintTenuringDistribution`?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23539174
score: 2

http://stackoverflow.com/comment/36078570
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23521369
has text: You couldn't even start the database connection. Post how you're trying to connect. Also, check that your server allows the connection through TCP/IP and you're sending the right parameters/credentials.
score: 0

http://stackoverflow.com/q/23511819
answer count: 1
tagged with: jpct
tagged with: glsurfaceview
has body: I want to display 3D objects with jPCT, so I use a custum GLSurfaceView.Renderer to display what I want. And below, I need to display a camera preview. It's work fine but my problem is when I display the 2 SurfaceView (1 for the object and 1 for the camera preview), I had lag on my software. I test it and it's because I use 2 SurfaceView at the same time. How can I resolve it ? I try to display my 3D object on my camera preview that extends GLSurfaceView : public class CameraView extends GLSurfaceView implements SurfaceHolder.Callback But the objects are never display and some functions don't work (Like search an 3D object in a 2D view ...) Anyone have an idea ?
tagged with: android
has answer: http://stackoverflow.com/a/23528748
has title: Using 2 SurfaceView lag
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23528748
tagged with: java
type: Question
score: 0

http://stackoverflow.com/a/23559696
accepted answer of: http://stackoverflow.com/q/23557562
has comment: http://stackoverflow.com/comment/36151692
type: Answer
has comment: http://stackoverflow.com/comment/36151770
has body: The standard extension in Struts 2 for action name is .action. But it's configurable via using a setting struts.action.extension. It's available in the default.properties, which is used by the default action mapper. You might use a comma separated list, e.g. struts.action.extension=action,xml,whatsoever The blank extension used to map directories treated as action names. Static content is mapped via specifying a blank extension, e.g. struts.action.extension=, or struts.action.extension=a,b,c,,, or struts.action.extension=a,,b,c.
has comment: http://stackoverflow.com/comment/36151830
score: 1
has comment: http://stackoverflow.com/comment/36151461
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23557562

http://stackoverflow.com/comment/36161126
score: 0
comment on: http://stackoverflow.com/a/23564563
type: Comment
has text: I know JPS but I have not used "-lm" option. It is really great. I have learned an other way easier than jmx tool one.
type: AnswerComment

http://stackoverflow.com/a/23607234
score: 0
answers question: http://stackoverflow.com/q/23606939
type: Answer
has comment: http://stackoverflow.com/comment/36250346
has comment: http://stackoverflow.com/comment/36239477
has body: Try BitmapTextureAtlas=new BitmapTextureAtlas(256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA); Instead of final ITexture mainFontTexture = new BitmapTextureAtlas(activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
has comment: http://stackoverflow.com/comment/36239679

http://stackoverflow.com/a/23533054
has comment: http://stackoverflow.com/comment/36102555
answers question: http://stackoverflow.com/q/23532446
has comment: http://stackoverflow.com/comment/36102855
has body: you could try the following: 1.Either change the query to a raw query like this: public void deleteHabit(Habit habit) { SQLiteDatabase db = this.getWritableDatabase(); String sql = "delete from " + TABLE_HABITS + " where " + KEY_ID + "=" + habit.getID(); db.rawQuery(sql,null); db.close(); } 2.Or you could also try this: public void deleteHabit(Habit habit) { SQLiteDatabase db = this.getWritableDatabase(); db.delete(TABLE_HABITS, KEY_ID+ "=" + habit.getID(), null); db.close(); } Hope that helps!
has comment: http://stackoverflow.com/comment/36101541
has comment: http://stackoverflow.com/comment/36102440
score: 0
has comment: http://stackoverflow.com/comment/36103100
type: Answer
has comment: http://stackoverflow.com/comment/36102262

http://stackoverflow.com/q/23545478
linked to: http://stackoverflow.com/q/13005343
possible better answer: http://stackoverflow.com/a/23546724
upvote count: 1
accepted answer: http://stackoverflow.com/a/23545614
downvote count: 1
has answer: http://stackoverflow.com/a/23546724
tagged with: prepared-statement
type: Question
tagged with: java
score: 0
answer count: 2
tagged with: sql
has title: Java Prepared Statement not working with my loop
has comment: http://stackoverflow.com/comment/36124585
favorite count: 0
has comment: http://stackoverflow.com/comment/36124186
has comment: http://stackoverflow.com/comment/36124402
has body: I am new to this and trying to add some dates into a Oracle database using prepared statements. this is my code: CODE REMOVED, code updated. This produces the following: INSERT into TEST_RESULTS12233 (DB_ID, DATED1, DATED2, DATED3, DATED4) values (t1_seq.nextval, to_date(?, 'dd/mm/yyyy hh24.mi'), to_date(?, 'dd/mm/yyyy hh24.mi'), to_date(?, 'dd/mm/yyyy hh24.mi'), to_date(?, 'dd/mm/yyyy hh24.mi')) Event1 Event2 Event3 Event4 Exception in thread "main" java.sql.BatchUpdateException: ORA-01858: a non-numeric character was found where a numeric was expected at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10500) at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:230) at sandpit.testsand.main(testsand.java:85) If i replace pstatement in setString with Event1, the batch executes. Does anyone know how I can get this to work?? Thanks Here is the full code as requested: //MORE CODE AS REQUESTED String inserttotable = "INSERT into TEST_RESULTS12233 (DB_ID"; String stateclose = ")"; String insertvalues =(" values (t1_seq.nextval"); StringBuilder insertBuilder = new StringBuilder(); StringBuilder valueBuilder = new StringBuilder(); int timestoloop = 4; for (i=1; i&lt;=timestoloop; i++) { insertBuilder.append(", DATED"+i); valueBuilder.append(", to_date(?, 'dd/mm/yyyy hh24.mi')"); } String finalinsert = inserttotable + insertBuilder.toString()+ stateclose; String finalvalues = insertvalues + valueBuilder.toString() + stateclose; String insertsql = finalinsert + finalvalues; System.out.println(insertsql); String insertresults = insertsql; PreparedStatement prepState = conn.prepareStatement(insertresults); String Event1 = "22122014 13.26"; String Event2 = "22122014 13.27"; String Event3 = "22122014 13.28"; String Event4 = "22122014 13.29"; for (i=1; i&lt;=timestoloop; i++) { String pstatement = "Event"+i; System.out.println(pstatement); prepState.setString(i, pstatement); } prepState.addBatch(); prepState.ex…
has comment: http://stackoverflow.com/comment/36123931
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23545614

http://stackoverflow.com/comment/36084888
comment on: http://stackoverflow.com/q/23524231
type: QuestionComment
has text: There is a number of characters where the upper case, lower case, or title case are two characters instead of one. This is more apparent for String.
score: 0
type: Comment

http://stackoverflow.com/q/23498033
possible better answer: http://stackoverflow.com/a/23500282
has comment: http://stackoverflow.com/comment/36035576
has answer: http://stackoverflow.com/a/23575252
has answer: http://stackoverflow.com/a/23500282
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/36112413
has answer: http://stackoverflow.com/a/23644902
favorite count: 0
has title: Adding Action Buttons: action_search cannot be resolved or is not a field
tagged with: android
tagged with: android-actionbar
accepted answer: http://stackoverflow.com/a/23575252
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36035345
has comment: http://stackoverflow.com/comment/36039858
upvote count: 1
linked to: http://stackoverflow.com/q/20084125
has body: Note to all: This may be a duplicate question but I could not find a question with an answer that actually helped me out so I was forced to make this. I am folowing the tutorial on how to make an Android application and I am stuck on this section: https://developer.android.com/training/basics/actionbar/adding-buttons.html I am stuck on "Respond to Action Buttons" because action_search cannot be resolved or is not a field in this code: @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle presses on the action bar items switch (item.getItemId()) { case R.id.action_search: openSearch(); return true; case R.id.action_settings: openSettings(); return true; default: return super.onOptionsItemSelected(item); } } public void openSearch(){ } public void openSettings(){ } This line case R.id.action_search: This is hindering the progress of my learning and I would like to know how to fix it. To me it just seems like poor tutorial teaching on Android's part but it could be my fault too. Thanks! EDIT: My XML: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="ifRoom" /&gt; &lt;item android:id="@+id/action_settings" android:title="@string/action_settings" android:showAsAction="never" /&gt; &lt;/menu&gt;
type: Question
has comment: http://stackoverflow.com/comment/36038473
has comment: http://stackoverflow.com/comment/36035153
has comment: http://stackoverflow.com/comment/36035503

http://stackoverflow.com/q/23534492
has title: Why output is incomplete using OutputStreamWriter with GZIPOutputStream?
has answer: http://stackoverflow.com/a/23534959
has comment: http://stackoverflow.com/comment/36104191
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23534959
tagged with: java
has comment: http://stackoverflow.com/comment/36104008
type: Question
answer count: 2
has body: I'm hoping someone can shed light on a problem I'm having with the code below. private static String encode(String data) throws IOException { try ( ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream is = new ByteArrayInputStream(data.getBytes()); BufferedReader br = new BufferedReader(new InputStreamReader(is)); OutputStreamWriter writer = new OutputStreamWriter(new GZIPOutputStream(out)); ) { char[] charBuffer = new char[data.length()]; while (br.read(charBuffer) != -1) { writer.write(charBuffer); } // writer.close(); return new String(Base64.encodeBase64(out.toByteArray())); } } My test value is This is some text that I can test some base64 encoding with. I am getting a strange problem with the encoded value when writer.close is commented out, my output is H4sIAAAAAAAAAA== When it's not commented, my output is H4sIAAAAAAAAACWMzQ2DMBSD70jdwRP0VLED9y7wACuJRJKKZ37GJxTJF/uz/Y3J0eQ1E+IpKJowYLLSvOshozn7D1imOqcScCTF96sbYBmB0p0ZXKuVQPzWOi7M/1b747PjjN2WjRd08DfZcwAAAA== This second output is the correct value and can be decoded back into the original value. It is my understanding that the process is as follows: Try code is executed Return value is evaluated and stored Resources are all closed The return value is returned. Why then does the writer need to be closed for the output to be correct?
tagged with: gzipoutputstream
has comment: http://stackoverflow.com/comment/36103941
possible better answer: http://stackoverflow.com/a/23534771
score: 0
has answer: http://stackoverflow.com/a/23534771
has comment: http://stackoverflow.com/comment/36104331
tagged with: outputstream
has comment: http://stackoverflow.com/comment/36104731
has comment: http://stackoverflow.com/comment/36104120
linked to: http://stackoverflow.com/q/9282909

http://stackoverflow.com/a/23567931
answers question: http://stackoverflow.com/q/23561555
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23561555
has body: I believe there are free tools to do it, but even making your own tool is easy. JVMTI will help. Here is a simple JVMTI agent I made to trace all exceptions: #include &lt;jni.h&gt; #include &lt;jvmti.h&gt; #include &lt;string.h&gt; #include &lt;stdio.h&gt; void JNICALL ExceptionCallback(jvmtiEnv* jvmti, JNIEnv* env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location) { char* class_name; jclass exception_class = (*env)-&gt;GetObjectClass(env, exception); (*jvmti)-&gt;GetClassSignature(jvmti, exception_class, &amp;class_name, NULL); printf("Exception: %s\n", class_name); } JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) { jvmtiEnv* jvmti; jvmtiEventCallbacks callbacks; jvmtiCapabilities capabilities; (*vm)-&gt;GetEnv(vm, (void**)&amp;jvmti, JVMTI_VERSION_1_0); memset(&amp;capabilities, 0, sizeof(capabilities)); capabilities.can_generate_exception_events = 1; (*jvmti)-&gt;AddCapabilities(jvmti, &amp;capabilities); memset(&amp;callbacks, 0, sizeof(callbacks)); callbacks.Exception = ExceptionCallback; (*jvmti)-&gt;SetEventCallbacks(jvmti, &amp;callbacks, sizeof(callbacks)); (*jvmti)-&gt;SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL); return 0; } To use it, make a shared library (.so) from the given source code, and run Java with -agentpath option: java -agentpath:libextrace.so MyApplication This will log all exception class names on stdout. ExceptionCallback also receives a thread, a method and a location where the exception occured, so you can extend the callback to print much more details.
has comment: http://stackoverflow.com/comment/36262200
upvote count: 6
has comment: http://stackoverflow.com/comment/36252618
type: AcceptedAnswer
score: 6
type: Answer

http://stackoverflow.com/comment/36005895
has text: No. Your request does not make sense.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23474979
type: Comment

http://stackoverflow.com/q/23499721
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36039038
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23512857
score: 2
has comment: http://stackoverflow.com/comment/36058095
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: how to parse json array value using json node
type: Question
has body: I have a JsonNode which contains the following JSON. Inside that JsonNode object is an array. In that array there are three fields, one of which, slaid, is a list. The other two are strings. Here is the JSON. { "SLA": [ { "slaid": [ "53637cc144ae8b607e089701" ], "ragindicator": "Red", "name": "r1" }, { "slaid": [ "53637d1844ae8b607e089704" ], "ragindicator": "Amber", "name": "a1" }, { "slaid": [ "53637eac44ae8b607e089706" ], "ragindicator": "Green", "name": "g1" } ] } I want to parse this value. How can I parse it , where slaid's type is List&lt;String&gt;? I have tried some ways but I am still unable to find the solution.
tagged with: jackson
has comment: http://stackoverflow.com/comment/36038298

http://stackoverflow.com/comment/36065746
type: Comment
comment on: http://stackoverflow.com/a/23495267
score: 0
type: AnswerComment
has text: Thank you.. actually this is very close to what I wanted. But what I want exactly is a line border just under the cell. Because as you can see in the image, there is a border around the entire list, and there is line border between the cells. I have a border around a list, and then the border around the cells combines with that around the entire list and makes it thick and ugly. I am attaching a picture of my JList.

http://stackoverflow.com/comment/36238404
type: Comment
type: QuestionComment
has text: what kind of code? do you mean some DAO-code?
score: 0
comment on: http://stackoverflow.com/q/23606041

http://stackoverflow.com/a/23482720
accepted answer of: http://stackoverflow.com/q/23482607
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23482607
type: Answer
has comment: http://stackoverflow.com/comment/36007424
has body: The border type is not createTitledBorder. That is just the name of the static factory method you are using. It returns a TitledBorder. Calling getBorder() on the JTextField only returns a border of type Border, which does not have the getTitle() method, since not all borders have titles. You need to have a reference to the border that is of type TitledBorder so that Java knows that the border has a title: TitledBorder b = null; ... b = BorderFactory.createTitledBorder(new LineBorder(BLACK, 2),title); c.setBorder(b); b = (TitledBorder)c.getBorder(); b.getTitle(); or, if you don't want to keep a reference of type TitledBorder, you could do this: Border b = null; ... b = BorderFactory.createTitledBorder(new LineBorder(BLACK, 2),title); c.setBorder(b); b = c.getBorder(); ( (TitledBorder)b ).getTitle(); EDIT Here is a less verbose way of doing what you have done in your posted answer: Border b; String title; b = c.getBorder(); if(b instanceof TitledBorder) { title = ( (TitledBorder)b ).getTitle(); }
downvote count: 0
score: 1

http://stackoverflow.com/q/23490671
favorite count: 0
has comment: http://stackoverflow.com/comment/36021086
has comment: http://stackoverflow.com/comment/36021484
tagged with: hibernate-mapping
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36021452
has comment: http://stackoverflow.com/comment/36062716
tagged with: java
tagged with: hibernate
score: 0
has comment: http://stackoverflow.com/comment/36062527
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23514417
tagged with: jakarta-ee
has body: I am using a bean object to retrieve data from database, called AudienceInfo. AudienceInfo has two attributes: public String messageBody; public BigDecimal audienceNo; in database messageBody is varchar2 and audienceNo is number. for fetching data in DAO class, everything is ok and data have been selected. but when I pass the object (customer) form Dao class to my main class an error happens. here is my code in main class: Iterator&lt;AudienceInfo&gt; iterator = customer.iterator(); int i = 0; while (iterator.hasNext()) { BigDecimal com = (customer.get(i).getAudienceno()); String msgBody = customer.get(i).getMessageBody(); iterator.next(); ++i; } the error is: Exception in thread "main" java.lang.ClassCastException: java.math.BigDecimal cannot be cast to com.htsc.sms.model.bo.AudienceInfo when I use this code in jdbc, everything is ok and I can see the result set but in hibernate I have this problem.
has title: BigDecimal CastException in hibernate
answer count: 1
accepted answer: http://stackoverflow.com/a/23514417
has comment: http://stackoverflow.com/comment/36021088
has comment: http://stackoverflow.com/comment/36021365

http://stackoverflow.com/comment/36004561
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23479642
has text: @caseyscarborough I'm glad to help. Please spend a little time and include that info in your answer, to make it useful for future readers.

http://stackoverflow.com/a/23575970
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/23574892
downvote count: 0
score: 5
has body: I would suggest asking for the Head of the image request simply because it is faster. Non Picasso : HttpClient client= new DefaultHttpClient(); HttpHead headMethod = new HttpHead(urlToImage); HttpResponse response = client.execute(headMethod); if(response.getStatusLine().getStatusCode== HttpStatus.SC_NOT_FOUND) { // Image does not exist, show a placeholder or something } else { // load image into the view. } Picasso : (nothing to do with the head version, but this is an easy alternative to handle it, also look at the Callback that Picasso can take in to fine tune the success/error) Picasso.with(context).load(urlToImage).into(imageView).placeholder(R.drawable.user_placeholder).error(R.drawable.user_placeholder_error); References: Apache HttpHead from Android's SDK Reference Apache HttpStatus from Android's SDK Reference Square Picasso

http://stackoverflow.com/comment/36177052
type: QuestionComment
has text: What compiler are you using?
comment on: http://stackoverflow.com/q/23573726
score: 2
type: Comment

http://stackoverflow.com/a/23465752
has body: Your main program is running off the end because executeAsync returns immediately without waiting for the request to be sent or the response to come back. What are you trying to accomplish by using executeAsync?
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/35975409
answers question: http://stackoverflow.com/q/23464650
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23464650

http://stackoverflow.com/comment/36219385
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23594936
type: AnswerComment
has text: @Braj, it is like a JTextArea except it supports attributes for the text. See the Swing tutorial on [Text Components Features](http://docs.oracle.com/javase/tutorial/uiswing/components/generaltext.html) for a more complete example of its ability to use attributes.

http://stackoverflow.com/comment/36260843
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/52548/discussion-between-quantico-and-durandal)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/23611085

http://stackoverflow.com/a/23813714
upvote count: 3
downvote count: 0
type: AcceptedAnswer
has body: You will need to generate a valid oauth_signature as per the google documentation See this answer for some useful tips when generating the base string The POST body should only contain 3 params as follows grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Amigration%3Aoauth1&amp; client_id=8819981768.apps.googleusercontent.com&amp; client_secret=xxxxxxxxxx
type: Answer
accepted answer of: http://stackoverflow.com/q/23608326
score: 3
answers question: http://stackoverflow.com/q/23608326

http://stackoverflow.com/q/23481281
tagged with: swing
downvote count: 1
has body: Here is what I have: import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.ScrollPaneConstants; import javax.swing.border.LineBorder; public class Main { // Field members static JPanel panel = new JPanel(); static Integer indexer = 1; static List&lt;JLabel&gt; listOfLabels = new ArrayList&lt;JLabel&gt;(); static List&lt;JTextField&gt; listOfTextFields = new ArrayList&lt;JTextField&gt;(); static JScrollPane scrollPane; public static void main(String[] args) { // Construct frame JFrame frame = new JFrame(); frame.setLayout(new GridBagLayout()); //frame.setPreferredSize(new Dimension(990, 990)); frame.setTitle("My Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Frame constraints //GridBagConstraints frameConstraints = new GridBagConstraints(); // Construct button JButton addButton = new JButton("Add"); addButton.addActionListener(new ButtonListener()); // Add button to frame //frameConstraints.gridx = 0; //frameConstraints.gridy = 0; //frame.add(addButton, frameConstraints); frame.add(addButton); // Construct panel panel.setPreferredSize(new Dimension(1000, 1000)); panel.setLayout(new GridBagLayout()); panel.setBorder(LineBorder.createBlackLineBorder()); scrollPane = new JScrollPane(panel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setPreferredSize(new Dimension(600, 600)); // Add panel to frame //frameConstraints.gridx = 0; //frameConstraints.gridy = 1; //frameConstraints.weighty = 1; //frame.add(panel, frameConstraints); frame.add(scrollPane); // Pack frame frame.pack(); // Make frame visible frame.setVisi…
type: Question
has answer: http://stackoverflow.com/a/23481620
score: -1
tagged with: jscrollpane
upvote count: 0
tagged with: preferredsize
answer count: 1
favorite count: 0
has title: Why so much room to the left of my labels in java?
tagged with: jlabel
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/36162763
comment on: http://stackoverflow.com/a/23562168
type: AnswerComment
has text: Good points with respect to the use of interfaces for DAOs. I find it particularly useful in my builds. Depending on what I'm testing, I might inject a mock, an implementation which connects to an in-memory database such as HSQLDB or an implementation which connects to a test SQL Server instance.
type: Comment
score: 1

http://stackoverflow.com/q/23502050
linked to: http://stackoverflow.com/q/23854259
has comment: http://stackoverflow.com/comment/36046427
has comment: http://stackoverflow.com/comment/36083631
tagged with: lotus-notes
has comment: http://stackoverflow.com/comment/36712213
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23507456
tagged with: java
has comment: http://stackoverflow.com/comment/36047787
has body: I would like to forward emails from my Lotus Notes inbox to my gmail account. Lotus Notes rules and agents are disabled on our server, so I developed external application for that. I am using document.send method and mail successfully arrives to my gmail box. The only problem is that often the email also duplicated in my Lotus Notes inbox. I just found that the reason of that is "CC" and "BCC" fields, which I don't clean up, however, I am looking for the way to forward email as it is - which means keep original CC and BCC and TO fields - exactly on the same way as it is done by forwarding agent. I am using "IBM Notes 9" on Windows 7 64 bit. I've prepared a code sample that demonstrates what I am doing. package com.example; import lotus.domino.*; public class TestMailForwarder { public static void main(String[] args) throws NotesException { NotesThread.sinitThread(); try { Session notesSession = NotesFactory.createSession( (String) null, (String) null, Consts.NOTES_PASSWORD); DbDirectory dir = notesSession.getDbDirectory(Consts.NOTES_SERVER); Database mailDb = dir.openDatabaseByReplicaID(Consts.MAILDB_REPLICA_ID); forwardAllEmails(mailDb); } finally { NotesThread.stermThread(); } } private static void forwardAllEmails(Database mailDb) throws NotesException { View inbox = mailDb.getView("$Inbox"); //noinspection LoopStatementThatDoesntLoop for (Document document = inbox.getFirstDocument(); null != document; document = inbox.getNextDocument(document)) { document.send(Consts.GMAIL_ADDRESS); break; } } }
linked to: http://stackoverflow.com/q/4320100
has answer: http://stackoverflow.com/a/32435977
type: Question
possible better answer: http://stackoverflow.com/a/23507456
has answer: http://stackoverflow.com/a/23523746
has comment: http://stackoverflow.com/comment/36043616
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/32435977
tagged with: email
has title: Lotus Notes Java API. Mail forwarding

http://stackoverflow.com/q/23593167
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/147181
has answer: http://stackoverflow.com/a/23593218
answer count: 2
has comment: http://stackoverflow.com/comment/36213398
linked to: http://stackoverflow.com/q/2272107
has comment: http://stackoverflow.com/comment/36213288
has comment: http://stackoverflow.com/comment/36213347
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/36213361
linked to: http://stackoverflow.com/q/2011664
has comment: http://stackoverflow.com/comment/36213412
has comment: http://stackoverflow.com/comment/36212738
has body: I have a .exe file in my system. that file was developed in java language i have newly installed OS Win XP or any. and i don't have install java software in my system.then the file executed or not in my system ? if executed How ? and where is the JVM is find out in system ? if not executed Why we are saying java is platform indepennt ?
accepted answer: http://stackoverflow.com/a/23593218
has comment: http://stackoverflow.com/comment/36213324
upvote count: 2
has comment: http://stackoverflow.com/comment/36324630
downvote count: 1
has comment: http://stackoverflow.com/comment/36213725
tagged with: platform
possible better answer: http://stackoverflow.com/a/23593253
has title: How the .exe java file is executed in newly installed OS with out having java Software
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36213384
has answer: http://stackoverflow.com/a/23593253
has comment: http://stackoverflow.com/comment/36213619

http://stackoverflow.com/q/23513607
type: Question
tagged with: session
tagged with: java
tagged with: hibernate
has body: Here is some piece of code to create an object of Configuration Class &amp; about the SessionFactory with ServiceRegistry. Configuration cfg = new Configuration().addResource( "employee.hbm.xml").configure(); serviceRegistry = new ServiceRegistryBuilder().applySettings( cfg.getProperties()).buildServiceRegistry(); sessionFactory = cfg.buildSessionFactory(serviceRegistry); What is SessionFactory ? What is ServiceRegistry ? What is the basic difference b/w SessionFactory &amp; ServiceRegistry in Hibernate.
has answer: http://stackoverflow.com/a/23513940
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 1
has title: Hibernate 4 : SessionFactory v/s ServiceRegistry
upvote count: 1

http://stackoverflow.com/comment/36255339
comment on: http://stackoverflow.com/q/23615024
score: 0
type: Comment
has text: Why did you "figure that it will not run"? Did you try it? The only change you should have made was changing `javaw` to `java`, and even that wouldn't strictly be necessary.
type: QuestionComment

http://stackoverflow.com/comment/35958143
has text: Are you passing command line arguments ie value for `args[0]` and `args[1]`?
type: QuestionComment
comment on: http://stackoverflow.com/q/23456742
type: Comment
score: 9

http://stackoverflow.com/comment/36074706
comment on: http://stackoverflow.com/q/23514780
type: Comment
type: QuestionComment
has text: @NathanHughes In this code I am not using multiple response.redirect. I checkfor the hiddenvalue and then asks the code to redirect to same page. it is not the duplicate of "Cannot forward after response has been committed in java servlet"
score: 0

http://stackoverflow.com/a/23509260
score: 3
has comment: http://stackoverflow.com/comment/36056582
has comment: http://stackoverflow.com/comment/36056715
upvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36056463
answers question: http://stackoverflow.com/q/23509216
accepted answer of: http://stackoverflow.com/q/23509216
type: Answer
has body: You are creating a new object inside your method, so your old object is not being updated, modify your code: public void test1() { TestObject to = new TestObject(); to = test2(to); // THIS line, to receive the object you created in test2() to.printValues(); TestObject to2 = null; to2 = test2(to2); to2.printValues(); }
downvote count: 0
has comment: http://stackoverflow.com/comment/36056645

http://stackoverflow.com/comment/36183775
type: AnswerComment
has text: Hmmm actually is doesn't work, It just set the alpha layer black but not transparent : http://puu.sh/8GgaD.png Any ideas? :/
type: Comment
comment on: http://stackoverflow.com/a/23574772
score: 0

http://stackoverflow.com/a/23566100
type: Answer
has body: You can use the result of sourceClass.getName() to produce a string for hashing. For best results, you should either concatenate it with the sourceMethodName and hash the result, or hash the two strings separately and combine them (hash1*31 + hash2 is a common approach`).
score: 0
answers question: http://stackoverflow.com/q/23565905

http://stackoverflow.com/comment/36013572
type: Comment
comment on: http://stackoverflow.com/q/23486188
score: 0
type: QuestionComment
has text: Yes. Pardon me for being a total newbie.

http://stackoverflow.com/comment/36254545
comment on: http://stackoverflow.com/a/23615212
score: 0
type: Comment
has text: i disagree...what if the data fails in between?? you will have to send the whole data again... its always better to send data in chunks of small
type: AnswerComment

http://stackoverflow.com/q/23599606
tagged with: image
has comment: http://stackoverflow.com/comment/36227989
has answer: http://stackoverflow.com/a/23599688
downvote count: 0
answer count: 1
tagged with: keyboard
favorite count: 0
has title: I'm trying to make my image move using KeyListener but it's giving me an error?
has comment: http://stackoverflow.com/comment/36227200
accepted answer: http://stackoverflow.com/a/23599688
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36313346
type: Question
tagged with: actionlistener
has body: I'm trying to make Boy1 move but in the second class I'm getting redlines under setX. Anyone know what's wrong? First Class: import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; public class MyGame extends JPanel implements ActionListener, KeyListener { Timer t = new Timer(5, this); int x = 0, y = 0, velx =0, vely =0; public MyGame() { t.start(); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.RED); g.fillRect(x,y,50,30); } public void actionPerformed(ActionEvent e) { if(x &lt; 0) { velx=0; x = 0; } if(x &gt; 530) { velx=0; x = 530; } if(y &lt; 0) { vely=0; y = 0; } if(y &gt; 330) { vely=0; y = 330; } x += velx; y += vely; repaint(); } public void keyPressed(KeyEvent e) { int code = e.getKeyCode(); if (code == KeyEvent.VK_DOWN){ vely = 1; velx = 0; } if (code == KeyEvent.VK_UP){ vely = -1; velx = 0; } if (code == KeyEvent.VK_LEFT){ vely = 0; velx = -1; } if (code == KeyEvent.VK_RIGHT){ vely = 0; velx = 1; } } public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) { velx=0; vely=0; } public static void main (String arge[]){ JFrame f = new JFrame(); MyGame s = new MyGame(); f.add(s); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(600,400); f.setVisible(true); } } Problem is with this last class. Perhaps it needs to be KeyAdapter? But I tried that and seems like that totally doesn't work.
tagged with: keylistener

http://stackoverflow.com/comment/36035414
comment on: http://stackoverflow.com/q/23498195
has text: how do you know it is not registering correctly?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36206949
comment on: http://stackoverflow.com/a/23589398
score: 0
type: Comment
has text: Yes in fact the ones that gets the marshalling issue is a List of a POJO
type: AnswerComment

http://stackoverflow.com/a/23520718
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/83275140
type: Answer
has comment: http://stackoverflow.com/comment/45032136
score: 6
has comment: http://stackoverflow.com/comment/45028320
accepted answer of: http://stackoverflow.com/q/23505771
upvote count: 6
has body: I have finally solved the problem .I have created a new Empty project and re-written the code by following the Sender App tutorial (Link): MainActivity.java /* Copyright 2014 Charles-Eugene LOUBAO Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package cf.charly1811.android.sample.MediaRouteProvider; import android.support.v4.view.MenuItemCompat; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.support.v7.app.MediaRouteActionProvider; import android.support.v7.media.MediaRouteSelector; import android.support.v7.media.MediaRouter; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.widget.Toast; import com.google.android.gms.cast.CastDevice; import com.google.android.gms.cast.CastMediaControlIntent; public class MainActivity extends ActionBarActivity { /** * This sample shows how to add the Cast Button to the action bar using MediaRouterProvider * @see "https://developers.google.com/cast/docs/android_sender" */ public static final String TAG = MainActivity.class.getSimpleName(); String APP_ID = "F6D3E50B"; MediaRouter mediaRouter; MediaRouteSelector mediaRouteSelector; MediaRouter.Callback mMediaRouterCallback; CastDevice mCastDevice; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mediaRouter = MediaRouter.getInstance(this); mediaRouteSelector = new MediaRouteSelector.Builder() .addControlCategory(CastMediaControlIntent.categoryF…
answers question: http://stackoverflow.com/q/23505771
has comment: http://stackoverflow.com/comment/97800855
has comment: http://stackoverflow.com/comment/42733698

http://stackoverflow.com/a/23507294
type: Answer
answers question: http://stackoverflow.com/q/23506508
score: 3
upvote count: 3
has body: I guess you would need to create a Map that contains the ID and the render color for that ID. So I'm hoping color should change in a mathematical order Maybe you can change the color by changing the "hue" of an HSL Color. See HSL Color for a class that will allow you to use HSL color and modify the "hue" easily. I want to set same color to the purchased item in same invoice ID. Then to render each row you can check out Table Row Rendering for one approach that will allow you to render each row based of the ID of the row. Once you determine the ID for the row you get the rendering color from the Map.
has comment: http://stackoverflow.com/comment/36096470
has comment: http://stackoverflow.com/comment/36102693
downvote count: 0
has comment: http://stackoverflow.com/comment/36098712
has comment: http://stackoverflow.com/comment/36097299
has comment: http://stackoverflow.com/comment/36123108

http://stackoverflow.com/a/23601089
has comment: http://stackoverflow.com/comment/36228197
has comment: http://stackoverflow.com/comment/36228102
has comment: http://stackoverflow.com/comment/36228042
has comment: http://stackoverflow.com/comment/36227996
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23601046
has comment: http://stackoverflow.com/comment/36227967
has body: When you write a scriptlet, it just expects Java programming language. so, you should't put EL in it. You can assign the value to a page scoped attribute and get it in the scriptlet &lt;c:set var="cFormId" value=${cForm.cId}/&gt; &lt;% String i = (String)pageContext.getAttribute("cFormId"); %&gt; Note : Usage of Scriptlets is a bad practice. To solve your problem, just create the URL making use of EL value directly without beating around the bush &lt;img src="/supportcenter/cServlet?sampleImg=${cForm.cId}" width="300px" /&gt;
upvote count: 2
has comment: http://stackoverflow.com/comment/36228017
has comment: http://stackoverflow.com/comment/36228092

http://stackoverflow.com/a/23542917
has body: 1.Add &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; I am not sure whether your code works or not but if you replace below code it works fine 2.In Controller class change the code modify ModelAndView view=new ModelAndView(); view.addObject("stdobj", students); view.setViewName("students"); return view; 3.change the code like this &lt;c:forEach var="o" items="${stdobj}"&gt; &lt;tr&gt; &lt;td&gt;&lt;c:out value="${o.id}"/&gt;&lt;/td&gt; &lt;td&gt;&lt;c:out value="${o.name}"/&gt;&lt;/td&gt; &lt;td&gt;&lt;c:out value="${o.age}"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt;
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23542535
answers question: http://stackoverflow.com/q/23542535
type: Answer

http://stackoverflow.com/comment/35973258
score: 0
comment on: http://stackoverflow.com/a/23464440
type: Comment
has text: I need the smaller words too, I'm afraid. I adjusted the original answer since I didn't make that clear earlier
type: AnswerComment

http://stackoverflow.com/comment/35952327
comment on: http://stackoverflow.com/a/23453530
type: AnswerComment
score: 0
has text: Agh! That's what I get for using a data structure I never use in real life. Editing...now.
type: Comment

http://stackoverflow.com/comment/36122733
comment on: http://stackoverflow.com/q/23544720
score: 0
type: Comment
type: QuestionComment
has text: Side note: in Java you should rarely use arrays. Your primary choice shoud be `List` unless you have a strong reason not to.

http://stackoverflow.com/q/23545352
type: AnsweredQuestion
score: 2
upvote count: 2
possible better answer: http://stackoverflow.com/a/23546723
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36147011
has comment: http://stackoverflow.com/comment/36148866
has title: Why is JPA ignoring my @OrderColumn in a basic use case?
linked to: http://stackoverflow.com/q/23567267
answer count: 2
tagged with: eclipselink
has answer: http://stackoverflow.com/a/23546723
tagged with: jpa
has comment: http://stackoverflow.com/comment/36124798
downvote count: 0
has comment: http://stackoverflow.com/comment/36124387
has comment: http://stackoverflow.com/comment/36124525
accepted answer: http://stackoverflow.com/a/23567110
favorite count: 0
has body: Inspection Entity: @Entity @Table(name="INSPECTION") public class Inspection implements Serializable { ... @OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE}, orphanRemoval=true) @OrderColumn(name="LIST_INDEX", nullable=false) @JoinColumn(name="INSPECTION_ID") private List&lt;RecommendationInstance&gt; recommendations; ... } RecommendationInstance Entity @Entity @Table(name = "RECOMMENDATION_INSTANCE") public class RecommendationInstance implements Serializable { @SequenceGenerator(name="RECOMMENDATION_INST_SEQ_GEN", sequenceName="RECOMMENDATION_INST_SEQ", allocationSize=1, initialValue=100) @Id @GeneratedValue(generator="RECOMMENDATION_INST_SEQ_GEN", strategy=GenerationType.SEQUENCE) private Long id; @Column(name="INSPECTION_ID") private Long inspectionId; @ManyToOne @JoinColumn(name="RECOMMENDATION_ID") private Recommendation recommendation; @Column(name="DESCRIPTION") private String description; ... } And the table is created as follows: CREATE TABLE "RECOMMENDATION_INSTANCE" ( "ID" NUMBER(19,0) NOT NULL, "INSPECTION_ID" NUMBER(19,0) NOT NULL, "RECOMMENDATION_ID" NUMBER(19,0) NOT NULL, "DESCRIPTION" VARCHAR2(4000 BYTE) NOT NULL, "LIST_INDEX" NUMBER(4,0) NOT NULL ) ; When a new RecommendationInstance is created and I attempt to save the InspectionEntity I get the following error: Caused by: org.eclipse.persistence.exceptions.DatabaseException: Internal Exception: java.sql.SQLIntegrityConstraintViolationException: integrity constraint violation: NOT NULL check constraint; SYS_CT_10161 table: "RECOMMENDATION_INSTANCE" column: "LIST_INDEX" Error Code: -10 Call: INSERT INTO RECOMMENDATION_INSTANCE (ID, DESCRIPTION, INSPECTION_ID, RECOMMENDATION_ID) VALUES (?, ?, ?, ?) bind =&gt; [102, Sprinkler System DESCRIPTION, 110, 40] Am I missing some relationship here? It looks as though the list_index is being ignored completely. To give further information, if needed, I did have this working using a join table. However I am doing a refactor since …
has comment: http://stackoverflow.com/comment/36126100
has answer: http://stackoverflow.com/a/23567110

http://stackoverflow.com/q/23535711
tagged with: android
upvote count: 3
tagged with: java
has body: I have an android activity with search box at the top of its layout. below it there is a listView with X items. When the user insert some text to the search box, the soft keyboard appears. Then keyboard overlaps the list and hides the bottom items. A scroll appears in the list. The user can scroll down to reveal lower items but will never be able to see the most bottom 2-3 items (hidden by the keyboard. Is there a way to enable full scroll or is it planed that way assuming the user won't search text and scroll to the lease relevant results?
has comment: http://stackoverflow.com/comment/36106869
type: UnansweredQuestion
score: 3
tagged with: layout
answer count: 0
downvote count: 0
tagged with: keyboard
favorite count: 0
type: Question
has title: cannot scroll all the way down when soft keyboard is visible

http://stackoverflow.com/q/23463265
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35970664
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/23463360
accepted answer: http://stackoverflow.com/a/23463360
answer count: 1
has body: I have a Java(actually Android eventually) program in which I want to call a php script hosted on a server(not localhost to me) and in the script it returns some JSON information, and I was wondering, through Java, what is the best way to get the JSON data, and then how to make that a string or byte array? I know this is a lot so if you can only help with a small piece it all helps, also if you have a link or website I should look at I would love to see them. Thank you very much for all of your help.
has title: How to read a PHP JSON return in Java
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35970633

http://stackoverflow.com/q/23482877
upvote count: 1
type: Question
tagged with: jssc
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23483112
has answer: http://stackoverflow.com/a/23482994
answer count: 2
has title: Writing data to serial port, sends wrong character
downvote count: 0
possible better answer: http://stackoverflow.com/a/23482994
favorite count: 0
linked to: http://stackoverflow.com/q/4063146
accepted answer: http://stackoverflow.com/a/23483112
tagged with: serial-port
has body: When monitoring data sent to device i get this: https://i.sstatic.net/u0kIT.png but i expect one character: F0 ð public void WritingDataToPort() { SerialPort port = new SerialPort("COM26"); try { System.out.println(port.openPort()); port.setParams(9600, 8, 1, 0); port.writeString((char)240+"")); port.closePort(); } catch (SerialPortException ex) { System.out.println(ex); } } I completly don't know how to send this "ð" characater. Tried all ascii codes.
type: AnsweredQuestion

http://stackoverflow.com/comment/66254996
type: AnswerComment
comment on: http://stackoverflow.com/a/23544375
type: Comment
has text: Your web content should be static html containing divs with static IDs. Javascript should interact with REST servers to pull down json data which is then inserted into the dom in an appropriate manner. CSS should style the whole thing.
score: 0

http://stackoverflow.com/q/23581871
has title: Is it possible to elegantly provide instances from Guice assisted injected factories that contain no arguments or equivalent?
has comment: http://stackoverflow.com/comment/36192493
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36191928
tagged with: guice-3
has comment: http://stackoverflow.com/comment/36192617
has body: Okay, so the following code fails. However, if there are multiple potential instances of View, then injecting lots of Provider providers where you want to use them feels clumsy. It may be that this is feasible in my case, however I can imagine that in other cases this isn't great... so I thought I'd ask the question while it was fresh in my mind. One solution I haven't tried yet is adding dummy @Assisted arguments to the method and call like factory.getView1(null), although this also isn't great. Note, I can see why for the guice implementers this would be a corner case, as guice would have to know not to call the constructor (as it seems to) but instead use the provider (which it technically is aware of). Still, it's better to ask if there is a solution than assume that there isn't. :-) import com.google.inject.*; import com.google.inject.assistedinject.Assisted; import com.google.inject.assistedinject.FactoryModuleBuilder; import junit.framework.Assert; import org.junit.Test; public class GuiceTests { static class View1 implements Presenter.View { String name = null; @Override public String getName() { return null; } public void setName(String name) { this.name = name ;} } static class View2 extends View1 {} static class Presenter { interface View {public String getName();} @Inject public Presenter(@Assisted View view //, and other injected services ){} } interface Factory{ Presenter getPresenter(Presenter.View view); View1 getView1(); View2 getView2(); } static class Module extends AbstractModule { @Provides View1 getView1() { View1 view1 = new View1(); //or possibly get this from an xml generator view1.setName("buddy"); return view1; } @Override protected void configure() { install(new FactoryModuleBuilder().implement(Presenter.class, Presenter.class) .build(Factory.class)); } } /** * We're testing the ability here for assisted injected factories * to be used to produce entities provided by the module with NO * assisted arguments. This way they can conveniently …
has comment: http://stackoverflow.com/comment/36191955
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/36193702
type: Question
has answer: http://stackoverflow.com/a/23583176
has comment: http://stackoverflow.com/comment/36193132
has answer: http://stackoverflow.com/a/23581929
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/43115614
type: Comment
has text: Thanks, I've just read a few of your posts to understand your point better. Do you have something I could read to see an example of designing separate tightly-scoped components that separate business logic and third-party interaction?
comment on: http://stackoverflow.com/a/23613252
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36343522
has text: @AndreiStefan I edited my answer with the log
score: 0
comment on: http://stackoverflow.com/q/23595345
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23484747
tagged with: java
has answer: http://stackoverflow.com/a/23487000
tagged with: eclipse
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/23487000
has body: I have installed a new version of Eclipse Kepler and have installed the Google Plugin from "http://dl.google.com/eclipse/plugin/4.3" using "Help/Install new software". However, the "g" button to allow the creation of a web application is not in the menu bar. Also when I go to "File>New" the option "Web Application Project" does not appear (I have checked under "Other". What else do I need to install please? I have used this reference "http://www.gwtproject.org/usingeclipse.html#installing".
score: 0
has title: Eclipse - Can not create a web application project
possible better answer: http://stackoverflow.com/a/23486778
tagged with: gwt
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23486778

http://stackoverflow.com/comment/36132913
type: QuestionComment
comment on: http://stackoverflow.com/q/23545198
has text: Finally yet I did the correct code. I changed `GitHubTokenResponse ` to: `OAuthJSONAccessTokenResponse oAuthResponse = oAuthClient.accessToken(request,OAuthJSONAccessTokenResponse.class);` So, I taked the access_token.
score: 0
type: Comment

http://stackoverflow.com/comment/36141782
has text: Me neither, rather not include new things to the project.
comment on: http://stackoverflow.com/q/23554801
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23605402
tagged with: adabas
has comment: http://stackoverflow.com/comment/36247337
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has body: I'm trying to connect adabas database from java. I have installed adabas database but i couldnty find a driver to connect to this db from java. Can anyone share the link or url where i can download adabasd.jar.
favorite count: 0
type: UnansweredQuestion
tagged with: jdbc
has title: Unable to find adabas jdbc driver
tagged with: mainframe
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23605632

http://stackoverflow.com/q/23463276
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35970773
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23464397
favorite count: 0
possible better answer: http://stackoverflow.com/a/23463442
tagged with: android
has answer: http://stackoverflow.com/a/23463442
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23464397
has title: Look up a state given an area code
has body: Is there anyway to do this? I just want to get "New York" or "NY" when I put in "212", preferably without connecting to some service, and "New Jersey" or "NJ" when I put in "201". Does Android have an API for this? I'm not looking for the location of the user's phone, but rather a lookup table or something to just get the location of a given area code.
tagged with: java

android-nested-fragment
tags question: http://stackoverflow.com/q/23571548
type: Tag
tag name: android-nested-fragment

http://stackoverflow.com/a/23500542
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36071189
answers question: http://stackoverflow.com/q/23498045
upvote count: 1
has body: I assume you are using CXF as JAX-RS implementation then in my opinion image should be uploaded with content type as multipart form data. @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) Response uploadImage(List&lt;Attachment&gt; attachments); Here attachement is a "org.apache.cxf.jaxrs.ext.multipart.Attachment" object . The data can be read as below for (final Attachment attachment : attachments) { String fileName = attachment.getDataHandler().getName(); final InputStream inputStream = attachment.getDataHandler().getInputStream(); ByteStreams.copy(inputStream, outputStream); inputStream.close(); final byte[] image = outputStream.toByteArray(); }
type: Answer

http://stackoverflow.com/comment/36203593
score: 0
has text: @HotLicks This is like arguing about which is right; Advisor or Adviser. Yes, decimal is base 10. Yes, decimal and whole number can be seen as two different things depending on context. The point is, in this case, it could easily confuse people, and it should be referenced differently. No fowl play by the OP, his english is correct, its just not the best way to word things in this situation. Sorry for the misunderstanding, this is why I said "A decimal 'in Java'".
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23587821

http://stackoverflow.com/comment/36272801
has text: yes inside arraylist in my DAO class and getting it in servlet as session.this arraylist has question number,question and 4 options.these all i want to print on jsp.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23622862

http://stackoverflow.com/comment/37151423
score: 20
type: AnswerComment
has text: Well, actually that worked for me. I used `mvn spring-boot:repackage` and got `Source must refer to an existing file`. Using `mvn clean install spring-boot:repackage` made it work.
type: Comment
comment on: http://stackoverflow.com/a/23488152

http://stackoverflow.com/comment/36103394
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23534141
has text: We have specific instructions for this project so I cannot use any other sorting method. I have to use heapSort. My question is what should i be passing into my sort method? the Employee myArray or the String currArray?

size
type: Tag
tags question: http://stackoverflow.com/q/23551719
tag name: size

http://stackoverflow.com/a/23489742
has body: Id add some debug output to your code - p.getProperty("java.home"); To confirm what ant is using. If it is wrong then set it to p.setProperty("java.home", "C:\\Program Files\\jmonkeyplatform\\jdk"); As to why this is occuring - Is your build file changing java.home?
answers question: http://stackoverflow.com/q/23489327
type: Answer
score: 0

http://stackoverflow.com/a/23778900
score: 0
type: Answer
has body: I would say you can remove Dozer, the best mapper code I know is the one you write for yourself. Ok it's painfull but you will know exactly what happens during the mapping proces and be able to debug it. I would recommend using something different like Selma because this library generates the mapping code so you can see what really and have compiler feedback when the mapping for some reason is not working. The best you should do is looking at youre code beacause some refactoring have probably occured. I can also be a proxy issue depending on the ORM you are using.
answers question: http://stackoverflow.com/q/23516185

http://stackoverflow.com/a/23565045
score: 0
has comment: http://stackoverflow.com/comment/36188939
type: Answer
has comment: http://stackoverflow.com/comment/36189295
has comment: http://stackoverflow.com/comment/36189430
has comment: http://stackoverflow.com/comment/36228840
has comment: http://stackoverflow.com/comment/36189202
has comment: http://stackoverflow.com/comment/36188092
has body: Since the Play Services library is not set up for Ant builds, this will not directly work. First, you should copy the Play Services library someplace outside of your Android SDK. Then, run android update project from the library project's main directory to create its own build.xml and project.properties files. That should allow you to build projects that depend upon this library project.
accepted answer of: http://stackoverflow.com/q/23564038
answers question: http://stackoverflow.com/q/23564038
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36183314

http://stackoverflow.com/a/23576513
has comment: http://stackoverflow.com/comment/36182438
has body: To "fix" your code, use a HashSet&lt;Character&gt;, which uses a Hashtable internally, but you don't have to know or worry about that. Just keep adding the chars to the set and you'll be left with a unique set of chars at the end. To achieve the intention more easily: String uniqueChars = str.replaceAll("(.)(?=.*\\1)", "");
answers question: http://stackoverflow.com/q/23576475
score: 0
has comment: http://stackoverflow.com/comment/36184361
type: Answer
has comment: http://stackoverflow.com/comment/36182490

http://stackoverflow.com/comment/36070962
type: AnswerComment
comment on: http://stackoverflow.com/a/23517245
score: 0
type: Comment
has text: @Santosh I disagree. "Return true at the end of the function" (which is essentially what this answer is saying) is a perfectly valid answer. Although it's a bit low quality while it doesn't explain why this is necessary. And in scenario's like this the code may have multiple issues, thus this is only a partial answer, but I feel it's more a problem of a non-useful question than a non-useful / partial answer.

http://stackoverflow.com/comment/63387455
type: Comment
score: 1
type: AnswerComment
has text: About 4, optionals in collections: It is actually sometimes useful to store optionals in `List`s. This is the case when it is important that a certain element is located at a certain index, but the element can be present or not. That is clearly communicated by a `List<Optional<T>>` type. If on the other hand it is only important which objects that are members some some collection then there is not point.
comment on: http://stackoverflow.com/a/27071576

http://stackoverflow.com/comment/36222360
has text: @donfuxx do you have to include anything? (or something similar, to tell android what R is, even though it IS auto generated)
score: 0
comment on: http://stackoverflow.com/q/23598003
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23463141
tagged with: java
has title: OAuth - Jumblr ¿How to change the account that I'm logged in?
downvote count: 0
favorite count: 0
tagged with: oauth
has body: This is the first time that I'm using OAuth throught Tumblr API and although I succesfully log getting the OAUTH TOKEN and OAUTH TOKEN SECRET from this web https://api.tumblr.com/console//calls/user/info I don't know how to get them using the jumblr wrapper to log using any account and put them here: client = new JumblrClient(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET); Thanks for your help.
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: tumblr
upvote count: 1
type: Question

http://stackoverflow.com/q/23574821
has answer: http://stackoverflow.com/a/36827837
accepted answer: http://stackoverflow.com/a/23585811
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/36827837
has comment: http://stackoverflow.com/comment/36197917
has title: libgdx clickable image not working
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/23585811
has comment: http://stackoverflow.com/comment/36199497
has body: I have a menu screen in libgdx and I had a text button that started a new game like this. textButton.addListener(new ChangeListener() { public void changed (ChangeEvent event, Actor actor) { g.setScreen( new level1(g)); } }); It looked like crap so I changed it to an image. playbuttontexture = new Texture(Gdx.files.internal("data/playbutton.png")); playbuttontexture.setFilter(TextureFilter.Linear, TextureFilter.Linear); TextureRegion playbuttonregion = new TextureRegion(playbuttontexture, 0, 0, 512, 256);//powers of 2 playbutton = new Image(playbuttonregion); playbutton.setSize(512,256); playbutton.setBounds(width/2-playbutton.getWidth()/2, height/2-playbutton.getHeight()/2, 512, 256); //playbutton.setOrigin(playbutton.getWidth()/2, playbutton.getHeight()/2); playbutton.setPosition(width/2-playbutton.getWidth()/2, height/2-playbutton.getHeight()/2); and playbutton.addListener(new ChangeListener() { public void changed (ChangeEvent event, Actor actor) { g.setScreen( new level1(g)); } }); Now when I click it nothing happens? What am I doing wrong?
type: Question
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/36185300
answer count: 2

http://stackoverflow.com/comment/36197857
has text: another question. is the second method a recursive method?
comment on: http://stackoverflow.com/a/23584967
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/23498045
favorite count: 0
tagged with: rest
type: UnansweredQuestion
has title: 415 Error while uploading png image on restful webservice
has comment: http://stackoverflow.com/comment/36857900
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23500542
tagged with: web-services
has comment: http://stackoverflow.com/comment/36035350
type: Question
tagged with: jersey
has body: I'm trying to upload a png image (and then download it from another client). I am getting Http Status code 415: what is my mistake? I've read everything here and on google but still not resolved. This is my server code: @Path("/file") public class UploadFileService { @POST @Path("/upload") @Consumes("image/png") public Response uploadPng(File file) throws IOException { String uploadedFileLocation = "C:/Users/Desktop/server/" + file.getName(); DataInputStream diStream = new DataInputStream(new FileInputStream(file)); long len = (int) file.length(); byte[] fileBytes = new byte[(int) len]; int read = 0; int numRead = 0; while (read &lt; fileBytes.length &amp;&amp; (numRead = diStream.read(fileBytes, read, fileBytes.length - read)) &gt;= 0) { read = read + numRead; } // save it writeToFile(diStream, uploadedFileLocation); System.out.println("File uploaded to : " + uploadedFileLocation); return Response.status(200).entity(file).build(); } // save uploaded file to new location private void writeToFile(InputStream uploadedInputStream, String uploadedFileLocation) { try { OutputStream out = new FileOutputStream(new File(uploadedFileLocation)); int read = 0; byte[] bytes = new byte[1024]; out = new FileOutputStream(new File(uploadedFileLocation)); while ((read = uploadedInputStream.read(bytes)) != -1) { out.write(bytes, 0, read); } out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); } } And this is client code: public class FileUploadClient { public static void main(String[] args) { try { File fileToUpload = new File("C:/Users/client/file.png"); ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource resource = client.resource("http://localhost:8080/WS/rest/file/upload"); ClientResponse response = resource.accept("image/png").post(ClientResponse.class, fileToUpload); System.out.println(response.getStatus()); } catch (Exception e) { e.printStackTrace(); } } } EDIT It works like this: public class FileUploadClien…
has comment: http://stackoverflow.com/comment/36035647
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36866218
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/36073933
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23509098
score: 0
has text: Also, Component is an abstract class so I can't really cast it to a Component object.

http://stackoverflow.com/q/23454133
has comment: http://stackoverflow.com/comment/35953476
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47368643
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/35953394
type: Question
has answer: http://stackoverflow.com/a/23454195
has comment: http://stackoverflow.com/comment/35954149
answer count: 3
tagged with: second-level-cache
downvote count: 0
has answer: http://stackoverflow.com/a/38066557
accepted answer: http://stackoverflow.com/a/23454195
has comment: http://stackoverflow.com/comment/134059986
upvote count: 11
favorite count: 0
possible better answer: http://stackoverflow.com/a/38066557
has title: Second level cache vs query cache vs collection cache?
score: 11
has body: As per my understanding, Second level cache will be used when the objects are loaded using their primary key. This includes fetching of associations.I can think of only above session.get(), session.load methods where second level cache will come in to picture. If association is collection or some other entity , how it can be cached ? For example :- @Cacheable public class Department{ private List Employees; private DepatmentDetail detail ; } How can i make association Employees and detail cacheable ? I think i need to mention @cache above associations Employees and detail. But that didn't work? when developer does department.getEmployees(), hibernate will internally fire the query i.e select * from employees where deptId =1; Now if i use query cache where i explicitly make above query and fetch the results, query will be fired again to db. why query is fired again . I think this is related to how hibernate internally stores the result of second level cache and query cache(they may be stored in separate regions). If somebody can throw light on this aspect also, it will be great.

http://stackoverflow.com/a/23612072
type: Answer
downvote count: 6
has body: Do it like this: Connection conn = null; Statement stmt = null; ResultSet rs = null; try { conn = DBUtil.getConnection(DBType.HSQLDB); stmt = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery("SELECT * FROM tours"); } catch (SQLException e) { DBUtil.processException(e); } finally { if(conn != null) { conn.close(); } if(stmt != null) { stmt.close(); } if(rs != null) { rs.close(); } }
has comment: http://stackoverflow.com/comment/122146911
score: -1
has comment: http://stackoverflow.com/comment/36249626
answers question: http://stackoverflow.com/q/23611940
has comment: http://stackoverflow.com/comment/36248557
upvote count: 5

http://stackoverflow.com/comment/36068660
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23516236
has text: Can u just give me link for the sample code?

http://stackoverflow.com/q/23533093
tagged with: postgresql
tagged with: angularjs
has body: I'm using MongoDB and PostgreSQL as database and angularJS for UI in my application. There is a requirement that some fields (columns) may be added dynamically on pages so it's DOM definition will be taken from user with required attributes when he adds this field in the system for some page. Also, the user should be able to disable the existing fields which are fixed on page. (Such fields will have columns in RDBMS i.e. Postgres here) In Postgres, RDBMS should be predefined so I believe it might not be used for fulfilling my requirement though not impossible with that. The only issue which I might face is the performance issue. We have to deal with lacs of data here and as of now, I'm going to use Postgres for storing data. MongoDB allows to have dynamic columns but data is in Postgres. Also, Postgres is used as primary database in my application and MongoDB is used for reports where lacs of data when retrieved or processed, it'd take less time than Postgres. How should I proceed now? What approaches can be taken to fulfill my requirements stated above? Can someone explain to me what should I do here?
type: UnansweredQuestion
downvote count: 2
upvote count: 1
type: Question
tagged with: java
score: -1
has title: Manage Dynamic fields on page - Postgres and MongoDB
has answer: http://stackoverflow.com/a/23533258
tagged with: mongodb
tagged with: sql
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/36142495
comment on: http://stackoverflow.com/a/23555092
has text: @JBNizet I know what you mean. But the idea is to not have too many objects having same hashcode which in turn will result in slower retrievals. So you can say as a good practice :)
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36129069
type: AnswerComment
comment on: http://stackoverflow.com/a/23511818
score: 0
type: Comment
has text: I have done this, had no affect on performance. It has to be something different than just how much of the image is being drawn as it works perfectly on Linux.

http://stackoverflow.com/a/23537591
accepted answer of: http://stackoverflow.com/q/23536554
score: 1
has comment: http://stackoverflow.com/comment/36110764
upvote count: 1
has body: Follow the steps Hope this helps you 1) Remove these lines from onCreateView() method final GridView gridView1 = (GridView)rootView.findViewById(R.id.store_home_gridview); gridView1.setAdapter(new ImageAdapter(rootView.getContext(), MyArrList)); 2)Modify onActivityCreated() as follow @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); new AsyncTask&lt;Void, Void, Void&gt;() { @Override protected Void doInBackground(Void... params) { String url = "http://192.168.1.132/Android/App/good.php"; try { JSONArray data = new JSONArray(getJSONUrl(url)); HashMap&lt;String, String&gt; map; for (int i = 0; i &lt; data.length(); i++) { JSONObject c = data.getJSONObject(i); map = new HashMap&lt;String, String&gt;(); map.put("name", c.getString("name")); map.put("artist", c.getString("artist")); map.put("price", c.getString("price")); map.put("image", c.getString("image")); MyArrList.add(map); } } catch (JSONException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); final GridView gridView1 = (GridView) rootView.findViewById(R.id.store_home_gridview); gridView1.setAdapter(new ImageAdapter(getActivity(), MyArrList)); } }.execute(); }
has comment: http://stackoverflow.com/comment/36111664
has comment: http://stackoverflow.com/comment/36111211
has comment: http://stackoverflow.com/comment/36110859
downvote count: 0
answers question: http://stackoverflow.com/q/23536554
has comment: http://stackoverflow.com/comment/36111915
has comment: http://stackoverflow.com/comment/36110822
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36111403
has comment: http://stackoverflow.com/comment/36111268
has comment: http://stackoverflow.com/comment/36109247
type: Answer
has comment: http://stackoverflow.com/comment/36110948
has comment: http://stackoverflow.com/comment/36111795

http://stackoverflow.com/a/58214154
score: 0
answers question: http://stackoverflow.com/q/23520008
has body: I am also getting the same issue but i cannot use @PostConstruct because i am not using doinit. I have a simple method which is getting the language from lang service. My lang service is null here but in another controller it is not null, it is getting autowired. @Service @Configurable(preConstruction = true, autowire = Autowire.BY_NAME) public class FormSelectLanguageHandler extends SimpleTagSupport { @Autowired private LangService langService; public List&lt;Lang&gt; getLanguages(){ Sessions session = (Sessions) getJspContext().findAttribute("SHLSESSION"); List&lt;Lang&gt; languages=new ArrayList&lt;Lang&gt;(); //List&lt;Lang&gt; allLanguages = langService.findAllLangs(); List&lt;Lang&gt; all =new ArrayList&lt;Lang&gt;(); if (isRenderLangLabel()) { all = langService.findByDisplayOrderAsc(); } else { all = langService.findByNameOrderByNameAsc(); } Long companyId = (null == session || null == session.getCompany())? null:session.getCompany().getId(); } }
type: Answer

http://stackoverflow.com/a/23558437
upvote count: 1
type: Answer
has body: You can use Java Web Start for deploying Java applications over the web. You can read about it here. Java applets allow you to embed java applications in the browser but it has security issues and other stuffs. More over, to use applet your application should extend the Applet class.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23558313

http://stackoverflow.com/comment/36010931
comment on: http://stackoverflow.com/q/23479882
score: 0
has text: The same range -128 to 127 was chosen for Byte, Short, Character, Integer and Long. It appears they used the range of Byte by default to keep it simple.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23540331
has body: In java, a name of a variable is a reference to the variable (if we compare to c++). When you call println on myList you in-fact call the toString() method of ArrayList which is inherited from Object but overridden to give meaningful print. This method is inherited from Object because ArrayList is a class and all classes extend Object and thus have the method toString. You don't have this trait with native arrays which are primitives so what you get is the default object representation (virtual memory address). You can try something like this: public class TestPrint { private String name; private int age; public TestPrint(String name, int age) { this.name = name; this.age = age; } public String getName() { return name;} public int getAge() { return age; } } Then try println(new TestPrint("Test", 20)); - This will print something similar to what you got with the array. Now, add a toString() method: @Override public String toString() { return "TestPrint Name=" + name + " Age=" + age; } And call println(new TestPrint("Test", 20)); again and you'll get TestPrint Name=Test Age=20 as the output. Just to further explain why this happens - the method println has an overload that accepts something of type Object. The implementation of this method calls toString to print the object (this is very schematic explanation of course).
score: 2
accepted answer of: http://stackoverflow.com/q/23540204
upvote count: 2
answers question: http://stackoverflow.com/q/23540204
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36076112
score: 1
has text: @user182944 @geoand If you omit `@ModelAttribute`, a form bean will be exposed as a model attribute using its class name ("employee" in your case) by default. See [this](http://docs.spring.io/spring/docs/3.2.8.RELEASE/spring-framework-reference/html/mvc.html#mvc-ann-arguments) section of the reference manual for details.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23501153

http://stackoverflow.com/comment/36139676
comment on: http://stackoverflow.com/a/23553483
type: AnswerComment
type: Comment
score: 0
has text: I am not saying your answer is untrue. I am saying that as it stays now it doesn't answer OP question because it doesn't say anything about undefined behaviour in C.

http://stackoverflow.com/comment/66730450
has text: Related: http://stackoverflow.com/q/30117134/435605
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23548589

http://stackoverflow.com/comment/36232062
type: AnswerComment
type: Comment
has text: And if I add if(key == KeyEvent.VK_EXCLAMATION_MARK){ Game.getChat().passText("!"); } To it after, it doesn't do a thing for some strange reason.
comment on: http://stackoverflow.com/a/23603138
score: 0

http://stackoverflow.com/q/23612466
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/36388500
has title: I want to find the xpath for the image
has answer: http://stackoverflow.com/a/23612543
downvote count: 0
favorite count: 0
tagged with: xpath
type: UnansweredQuestion
tagged with: selenium-webdriver
has body: This is the html code Tasks I am trying to find the xpath for the image--> src="/img/default/pixel.gif?hash=1106906246" I have tried different combinations e:g //table/tbody/tr/td[5][@class='navItem relative']/a/div[2]/img I have written the following code too. WebDriverWait wait= new WebDriverWait(driver, 20); wait.until(ExpectedConditions.elementToBeClickable(By.linkText("Tasks"))); driver.findElement(By.xpath("//table/tbody/tr/td[5][@class='navItem relative']/a/div[2]/img")).click(); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); It's identifying the element on web page by firepath but after running the script it's not clicking on the element and the console shows "No Such Element Exception". Please answer in java lang only. Can somebody please help me out.??? Thx
has comment: http://stackoverflow.com/comment/36263996
score: 1
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/23620424
upvote count: 1
tagged with: html-parsing

http://stackoverflow.com/comment/36114196
score: 0
type: Comment
has text: there is no result in console eclipse
comment on: http://stackoverflow.com/a/23540001
type: AnswerComment

http://stackoverflow.com/q/23547233
type: Question
has title: CREATE/ALTER PROCEDURE' must be the first statement in a query batch
accepted answer: http://stackoverflow.com/a/23547415
tagged with: sql-server
answer count: 2
tagged with: sql
downvote count: 0
linked to: http://stackoverflow.com/q/6443221
has comment: http://stackoverflow.com/comment/36127607
favorite count: 0
upvote count: 2
has body: How must I construct sql query in java to be able execute several create statements? Here is what I have now : public static String CreateDatabaseOfflinerObjects(boolean createTables){ String result = createTables ? "CREATE TABLE [dbo].[ofLastMessageTime](" + "[id] [int] IDENTITY(1,1) NOT NULL," + "[receiverJid] [nvarchar](max) NOT NULL," + "[senderJid] [nvarchar](max) NOT NULL," + "[lastDeliveredTime] [bigint] NULL," + "[lastReadTime] [bigint] NULL," + "CONSTRAINT [ofLastMessageTime_pk] PRIMARY KEY CLUSTERED " + "(" + "[id] ASC" + ")"+ "WITH ("+ "PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]"+ ")" + "ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] " : ""; result += ( " ; " + "CREATE PROCEDURE [dbo].[UpdateDeliveredStatus] " + "@receiverJid nvarchar(MAX), " + "@senderJid nvarchar(MAX), " + "@lastDeliveredTime bigint " + "AS " + "BEGIN " + "SET NOCOUNT ON; " + "UPDATE ofLastMessageTime " + "SET lastDeliveredTime = @lastDeliveredTime " + "WHERE senderJid = @senderJid " + "AND receiverJid = @receiverJid " + "IF @@ROWCOUNT=0 " + "INSERT INTO ofLastMessageTime ( receiverJid, senderJid, lastDeliveredTime ) " + "VALUES ( @receiverJid, @senderJid , @lastDeliveredTime ) "+ "END" + "; " + "CREATE PROCEDURE [dbo].[UpdateReadStatus] " + "@receiverJid nvarchar(MAX), " + "@senderJid nvarchar(MAX), " + "@lastReadTime bigint " + "AS " + "BEGIN " + "SET NOCOUNT ON; " + "UPDATE ofLastMessageTime " + "SET lastReadTime = @lastReadTime " + "WHERE senderJid = @senderJid " + "AND receiverJid = @receiverJid " + "IF @@ROWCOUNT=0 " + "INSERT INTO ofLastMessageTime ( receiverJid, senderJid, lastReadTime ) " + "VALUES ( @receiverJid, @senderJid , @lastReadTime ) "+ "END" + "; " ); return result; } I know that there must me GO separator and I read somwhere that for java sql I can use semicolon, but this doesnt help me. Thanks.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23547415
score: 2
possible better answer: http://stackoverflow.com/a/23547898
has comment: http://stackoverflow.com/comment/36128012
tagged with: java
has answer: http://stackoverflow.com/a/23547898

http://stackoverflow.com/a/23528442
answers question: http://stackoverflow.com/q/23525610
has comment: http://stackoverflow.com/comment/36093124
accepted answer of: http://stackoverflow.com/q/23525610
type: Answer
has comment: http://stackoverflow.com/comment/36093032
score: 4
has body: The HMAC function should already be keyed. So normally HMAC is shown as HMAC(K, M) where K is the key and M is the message. So candidate 2 does not make sense in that regard; it would mean that the key K is included 3 times in the calculation (as the key is used two times in HMAC itself). Using a cookie with unguessable data does not make sense either, for the same reason. Part of the input of HMAC is the key K, which is already unguessable data. So you would not gain any security, and you would be complicating your protocol. Now AES should be used in CBC or CTR mode. ECB mode of encryption is unsafe. So that means you require a random IV (CBC) or a unique IV (CTR). This IV should be part of the HMAC, otherwise it is still possible for an attacker to alter the plaintext you get after decryption.
upvote count: 4
has comment: http://stackoverflow.com/comment/36093520
has comment: http://stackoverflow.com/comment/36432329
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36093716

http://stackoverflow.com/comment/36076325
comment on: http://stackoverflow.com/q/23519946
type: QuestionComment
has text: I could set the layout params on the relative view inside it and add padding to the relative view instead of adding margin to the webview? or wrap the webview in a relative layout and add margin to that?
score: 0
type: Comment

http://stackoverflow.com/q/23455101
favorite count: 0
type: Question
tagged with: oracle-database
tagged with: java
tagged with: web-applications
upvote count: 1
has title: Architecture for a remote database for a mobile application
tagged with: jakarta-ee
has body: I have a mobile app which needs a secondary persistent store. Locally, it is using both a SQLite3 database and the filesystem. The repository pattern is used to facilitate access to the data stores, thus the app does not know whether data comes from the filesystem or SQLite3. I need to expand the app; so it can use a remote datastore. The app stores both raw data, and short strings. Each 'item' is between 5 and 100 KiB. The total size of the data store is typically less than 200 MiB, but could grow up to 3 GiB in an extreme (rare) case. My current idea is a RESTful webservice. ("Nothing is more dangerous than an idea if it's the only one you have." - Emil-Auguste Chartier.) I am looking for a known architecture and design patterns to guide me. I am unfamiliar with webservices in general, I need documented patterns to guide the design. Ideas?
tagged with: database
answer count: 0
type: UnansweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/q/23588219
has answer: http://stackoverflow.com/a/41093016
tagged with: libgdx
tagged with: java
has title: LibGDX - find out if a given screen resolution is supported on the current device
possible better answer: http://stackoverflow.com/a/41093016
answer count: 2
downvote count: 0
favorite count: 0
has body: So I'm writing some tools for my program to deal with basic configurations, reading settings from a data file, and then making those settings the active configuration. I'm also building in an error checking mechanism to make sure that settings are formatted correctly and have valid values. I want to check to see what the current devices supported resolutions are, and I want to compare that to the resolution specified in the data file. Is there an easy way to do this in libGDX that I'm missing? I know that LWJGL has a function that will give you an array of the supported resolutions, but I don't want to reinvent the wheel. I'm looking for something like: boolean isValidResolutionForDevice(int width, int height) Am I going to have to write this myself? Or does this exist already? It seems to me to be such a useful function that it must have been written into the libraries somewhere.
type: AnsweredQuestion
upvote count: 3
tagged with: lwjgl
has answer: http://stackoverflow.com/a/23590853
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/23590853

http://stackoverflow.com/q/23539541
answer count: 0
has body: I am trying to unmarshall (XMl -> POJO) an object using JAXB. XML: <my_object> foo blah </my_object> Java class: @XmlRootElement(name="my_object") class MyObject { private String uniqueName; private String propertyX; // getters, setters omitted } Unmarshalling works, however in some cases I would like to make the unmarshaller to use an object which is created by me, based on the uniqueName. Something like this (pseudo code): // parse the uniqueName field first MyObject template = myObjectDAO.loadByName(uniqueName); // result can be null if (template == null) { template = new MyObject(); template.setUniqueName(uniqueName); } // carry on with other fields Currently I have solved this by: Always using the default unmarshaller behaviour (letting JAXB to create the template by using public no args constructor) and parsing all fields. Attempting to load the object by uniqueName and if object exists - copying over all fields using BeanUtils.copyProperties(unmarshalled, loaded). The above works but is sub-optimal. Questions: Is there a way to solve this using standard JAXB techniques? If not, would it be possible to solve this if the uniqueName was known in advance (before unmarshalling)? p.s. uniqueName is not an identifier (at least in terms of Hibernate) so using JAXB-Hibernate integration most likely won't work.
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: hibernate
tagged with: jaxb
downvote count: 0
favorite count: 0
has title: Ability to hook context aware object factory when unmarshalling objects with JAXB
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/42377247
type: Answer
answers question: http://stackoverflow.com/q/23578190
has body: Below is the iterative serial version of MergeSort which is indeed faster than the recursive version and also doesnot involve calculation of middle so avoids the overflow error for it. However overflow errors can occur for other integers as well. You can try for parallelizing it if you are interested. protected static int[] ASC(int input_array[]) // Sorts in ascending order { int num = input_array.length; int[] temp_array = new int[num]; int temp_indx; int left; int mid,j; int right; int[] swap; int LIMIT = 1; while (LIMIT &lt; num) { left = 0; mid = LIMIT ; // The mid point right = LIMIT &lt;&lt; 1; while (mid &lt; num) { if (right &gt; num){ right = num; } temp_indx = left; j = mid; while ((left &lt; mid) &amp;&amp; (j &lt; right)) { if (input_array[left] &lt; input_array[j]){ temp_array[temp_indx++] = input_array[left++]; } else{ temp_array[temp_indx++] = input_array[j++]; } } while (left &lt; mid){ temp_array[temp_indx++] = input_array[left++]; } while (j &lt; right){ temp_array[temp_indx++] = input_array[j++]; } // Do not copy back the elements to input_array left = right; mid = left + LIMIT; right = mid + LIMIT; } // Instead of copying back in previous loop, copy remaining elements to temp_array, then swap the array pointers while (left &lt; num){ temp_array[left] = input_array[left++]; } swap = input_array; input_array = temp_array; temp_array = swap; LIMIT &lt;&lt;= 1; } return input_array ; } Use the java executor service, thats a lot faster, even with threads exceeding the number of cores ( you can build scalable multithreaded applications with it ), I have a code that uses only threads but its very very slow, and Im new to executors so cant help much, but its an interesting area to explore. Also there is a cost for parallelism, because thread management is a big deal, so go for parallelism at high N, if you are looking for a serial alternative to merge sort, I suggest the Dual-Pivot-QuickSort or 3-Partition-Quick-Sort as they are known to beat merge sort …
score: 0

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/23482626
tags question: http://stackoverflow.com/q/23542312
tags question: http://stackoverflow.com/q/23500303

http://stackoverflow.com/q/23525968
tagged with: android
tagged with: sensors
tagged with: android-sensors
has comment: http://stackoverflow.com/comment/36087909
answer count: 0
score: 0
tagged with: java
has body: I've managed to implement a simple pedometer application, which seems to be working pretty well. To enhance it, I really need some kind of mechanism to estimate it's velocity, but I have no idea where or how to start doing so. The pedometer uses the sensor changes threshold to detect a step, and I wish to know where to take it from here. Here is the step counter part of it: private SensorEventListener sensorEventListener = new SensorEventListener() { @Override public void onSensorChanged(SensorEvent event) { float x = event.values[0]; float y = event.values[1]; float z = event.values[2]; currentY = y; if(Math.abs(currentY-previousY) &gt; threshould){ numSteps++; stepsTextView.setText(String.valueOf(numSteps)); } xTextView.setText(String.valueOf(x)); yTextView.setText(String.valueOf(y)); zTextView.setText(String.valueOf(z)); previousY = y; } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { // TODO Auto-generated method stub } };
tagged with: sensormanager
has title: How to calculate/estimate velocity on an Android pedometer application
has comment: http://stackoverflow.com/comment/36088047
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36087722
type: Question

http://stackoverflow.com/comment/35984143
comment on: http://stackoverflow.com/q/23460934
has text: How did your code set essaClasse?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36111070
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23538349
has text: Are there possibly any snapshot dependency updates containing the missing classes?
score: 0

http://stackoverflow.com/comment/36270375
comment on: http://stackoverflow.com/a/23559312
has text: Leave this part or remove this part changedListModel.add(record); As changes done in adminNewListModelList and this is used in ZUL I have to Notify Single record of this List i tried BindUtils.postNotifyChange(null, null, record, "*"); but it wont work if i am doing BindUtils.postNotifyChange(null, null, adminNewListModelList , "*"); it is working but i have to Notify Single record not whole List. Any idea we can do this?
type: Comment
score: 0
type: AnswerComment

mongodb
tags question: http://stackoverflow.com/q/23460768
tags question: http://stackoverflow.com/q/23574258
tags question: http://stackoverflow.com/q/23593254
tags question: http://stackoverflow.com/q/23455018
tags question: http://stackoverflow.com/q/23545434
tag name: mongodb
tags question: http://stackoverflow.com/q/23578637
tags question: http://stackoverflow.com/q/23494273
tags question: http://stackoverflow.com/q/23564037
tags question: http://stackoverflow.com/q/23544061
tags question: http://stackoverflow.com/q/23469007
tags question: http://stackoverflow.com/q/23454185
tags question: http://stackoverflow.com/q/23611576
tags question: http://stackoverflow.com/q/23475081
type: Tag
tags question: http://stackoverflow.com/q/23505439
tags question: http://stackoverflow.com/q/23608776
tags question: http://stackoverflow.com/q/23508407
tags question: http://stackoverflow.com/q/23545559
tags question: http://stackoverflow.com/q/23609140
tags question: http://stackoverflow.com/q/23564540
tags question: http://stackoverflow.com/q/23525747
tags question: http://stackoverflow.com/q/23516997
tags question: http://stackoverflow.com/q/23468238
tags question: http://stackoverflow.com/q/23479560
tags question: http://stackoverflow.com/q/23505445
tags question: http://stackoverflow.com/q/23506048
tags question: http://stackoverflow.com/q/23533093
tags question: http://stackoverflow.com/q/23510428
tags question: http://stackoverflow.com/q/23513180
tags question: http://stackoverflow.com/q/23527506
tags question: http://stackoverflow.com/q/23521029
tags question: http://stackoverflow.com/q/23466288
tags question: http://stackoverflow.com/q/23497974
tags question: http://stackoverflow.com/q/23514649
tags question: http://stackoverflow.com/q/23527135

http://stackoverflow.com/q/23591752
possible better answer: http://stackoverflow.com/a/23592159
answer count: 3
has title: JSP Servelet 404 Exception Tomcat
favorite count: 0
linked to: http://stackoverflow.com/q/16683877
has answer: http://stackoverflow.com/a/23591775
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29933937
tagged with: java
upvote count: 1
tagged with: eclipse
has comment: http://stackoverflow.com/comment/36211671
downvote count: 1
accepted answer: http://stackoverflow.com/a/23591775
type: Question
has body: I have a java servelet which is also mapped in web.xml file but when i run it it raises 404 error. Here is my source Code My Form with action is shown below Here is my web.xml file <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> AP Assignment 5 Called to process any forms on the website Form Processing Servlet Checkout Servlets.MyServlet Checkout /Checkout index.jsp Here is my project hierarchy with my servelet code
has answer: http://stackoverflow.com/a/23592159
tagged with: jsp
tagged with: tomcat
score: 0

http://stackoverflow.com/comment/68852245
type: Comment
has text: Add System.exit(); at the end where you wan to exit
comment on: http://stackoverflow.com/a/23507185
type: AnswerComment
score: 1

http://stackoverflow.com/q/23573831
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23573858
possible better answer: http://stackoverflow.com/a/23574180
has answer: http://stackoverflow.com/a/23574180
tagged with: android
accepted answer: http://stackoverflow.com/a/23573858
has body: I am writing a crash code with UiWatcher but my team lead he commented that he needs a "Not an anonymous class. A proper private class." So how can i do that with UiWatcher() private void CrashWatcher() { UiWatcher crash = new UiWatcher() { //comment by my lead: Not an anonymous class. A proper private class. public boolean checkForCondition() { UiObject crashButton = new UiObject( new UiSelector().textStartsWith("Unfortunately,")); if (crashButton.exists()) { log("Found the OK dialog"); UiObject okButton = new UiObject(new UiSelector() .className("android.widget.Button").text("OK")); try { okButton.click(); } catch (UiObjectNotFoundException e) { log("The chance of not having 'OK' button when the application crash is extremely less."); return false; } } return true; } }; // Register watcher UiDevice.getInstance().registerWatcher(CRASH_WATCHER_NAME, crash); }
has title: How to make a proper Private class of UiWatcher()
tagged with: android-uiautomator
type: AnsweredQuestion
tagged with: automation
tagged with: java

http://stackoverflow.com/a/23476994
has body: This question is, to some degree, related to What is the reason why “synchronized” is not allowed in Java 8 interface methods? The key thing to understand about default methods is that the primary design goal is interface evolution, not "turn interfaces into (mediocre) traits". While there's some overlap between the two, and we tried to be accommodating to the latter where it didn't get in the way of the former, these questions are best understood when viewed in this light. (Note too that class methods are going to be different from interface methods, no matter what the intent, by virtue of the fact that interface methods can be multiply inherited.) The basic idea of a default method is: it is an interface method with a default implementation, and a derived class can provide a more specific implementation. And because the design center was interface evolution, it was a critical design goal that default methods be able to be added to interfaces after the fact in a source-compatible and binary-compatible manner. The too-simple answer to "why not final default methods" is that then the body would then not simply be the default implementation, it would be the only implementation. While that's a little too simple an answer, it gives us a clue that the question is already heading in a questionable direction. Another reason why final interface methods are questionable is that they create impossible problems for implementors. For example, suppose you have: interface A { default void foo() { ... } } interface B { } class C implements A, B { } Here, everything is good; C inherits foo() from A. Now supposing B is changed to have a foo method, with a default: interface B { default void foo() { ... } } Now, when we go to recompile C, the compiler will tell us that it doesn't know what behavior to inherit for foo(), so C has to override it (and could choose to delegate to A.super.foo() if it wanted to retain the same behavior.) But what if B had made its default final, and A is n…
type: Answer
has comment: http://stackoverflow.com/comment/36863563
downvote count: 0
has comment: http://stackoverflow.com/comment/36063350
has comment: http://stackoverflow.com/comment/52964111
upvote count: 494
has comment: http://stackoverflow.com/comment/37587138
answers question: http://stackoverflow.com/q/23453287
has comment: http://stackoverflow.com/comment/36052813
has comment: http://stackoverflow.com/comment/140228352
has comment: http://stackoverflow.com/comment/116901888
accepted answer of: http://stackoverflow.com/q/23453287
has comment: http://stackoverflow.com/comment/37587128
type: AcceptedAnswer
score: 494
has comment: http://stackoverflow.com/comment/56710486

http://stackoverflow.com/comment/36040845
score: 0
type: Comment
type: QuestionComment
has text: what parameters you trying insert? your query haven't any parameters
comment on: http://stackoverflow.com/q/23500777

http://stackoverflow.com/q/23538146
accepted answer: http://stackoverflow.com/a/23538411
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36110309
has comment: http://stackoverflow.com/comment/36112355
tagged with: selenium
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23538411
type: AnsweredQuestion
score: 1
tagged with: java
has body: I wanted to select an element through keyboard keys in Firefox. I am using this statement driver.findElement(By.xpath("Element')]")).sendKeys(Keys.ARROW_DOWN); But when I run it, I couldn't see any movement in the page. I am using JAVA to automate. This issue occurs even in BEHAT\MINK Tool. My doubt: is this feature not working because of the developers code? or I need to modify my code to make it work?
has title: Why don't keyboard keys work in Selenium WebDriver?

http://stackoverflow.com/comment/35970937
has text: If they are not important remove them as per [MCVE guidlines](http://stackoverflow.com/help/mcve).
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23462072
type: QuestionComment

http://stackoverflow.com/q/23549708
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/23549821
favorite count: 0
has answer: http://stackoverflow.com/a/23549971
answer count: 3
has body: import acm.program.*; import acm.util.*; public class Order { public int ocode; public String cname ; public String cphone ; public double price ; public double discount ; public int delay; double finalprice ; public Order (int ocode, Item aItems, String cname, String cphone, String odate) { this.cname= cname; this.cphone= cphone; this.odate= odate; this.ocode = ocode; price = aItems.getPrice() ; if (aItems instanceof Peripherals){ discount = price*0.25 ; } else if (aItems instanceof Hardware){ discount = price * 0.3 ; } finalprice = price - discount ; delay = rgen.nextInt(1,40) ; } RandomGenerator rgen= RandomGenerator.getInstance() ; public Item getItem() { return aItems; } public String getCname() { return cname; } public String getCphone () { return cphone; } public String getOdate () { return odate; } public void print() { if(aItems instanceof Monitor){ println( "Order Number: " + "( " + ocode + " )" + " ,Ordered Monitor: " + aItems + " ,Final price: " + finalprice + " ,Customer's name: " + cname + " ,Customers phone: " + cphone + " ,Date of order: " + odate + " and your order will delay " +delay + " days" ); } if(aItems instanceof Mouse){ println( "Order Number: " + "( " + ocode + " )" + " ,Ordered Mouse: " + aItems + " ,Final price: " + finalprice + " ,Customer's name: " + cname + " ,Customers phone: " + cphone + " ,Date of order: " + odate + " " + delay ); } if(aItems instanceof Printer){ println( "Order Number: " + "( " + ocode + " )" + " ,Ordered Printer: " + aItems + " ,Final price: " + finalprice + " ,Customer's name: " + cname + " ,Customers phone: " + cphone + " ,Date of order: " + odate + " " + delay ); } if(aItems instanceof Keyboard){ println( "Order Number: " + "( " + ocode + " )" + " ,Ordered Keyboard: " + aItems + " ,Final price: " + finalprice + " ,Customer's name: " + cname + " ,Customers phone: " + cphone + " ,Date of order: " + odate + " " + delay ); } if(aItems instanceof Proccesor){ println( "Order Number: " + "( " + ocode + " )" + " ,Order…
has title: Javac doesn't recognize strings
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/23549939
has comment: http://stackoverflow.com/comment/36131990
tagged with: java
score: -1

http://stackoverflow.com/a/23583974
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23583837
has body: ... So why don't we refer to it using the outer class' name and dot notation You seem to be unaware of the static imports in Java language. Mostly I like the way you are suggesting, i.e. refer to the inner class using the outer class name and the dot like ViewGroup.LayoutParams, instead of having an static imports. But, in some cases, if you might have to do that too many times then it's just better to have a static import rather than repeating the class name. You will see this kind of cases a lot while using the unit-testing frameworks like JUnit, which comes with class with a lot of static methods. ... In the following statement, what object is "this"? There in your method, by using the keyword - this, you are referring to the current instance of the class in which you have declared/defined the instance method (i.e. the method @Override public void onCreate(Bundle savedInstanceState)).
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23583837

http://stackoverflow.com/comment/36250346
has text: still nothing.the same error pops up.It seems the font isn't getting loaded.
comment on: http://stackoverflow.com/a/23607234
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36204955
comment on: http://stackoverflow.com/a/23588810
score: 0
type: AnswerComment
type: Comment
has text: That's nice. Is there some way to make Eclipse realize that?

http://stackoverflow.com/comment/36005760
has text: Something like [this](http://www.javaworld.com/article/2075004/core-java/speed-up-file-searching-in-jfilechooser.html)?
comment on: http://stackoverflow.com/q/23481887
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23523407
tagged with: ubuntu
tagged with: postgresql
tagged with: windows
has comment: http://stackoverflow.com/comment/36083299
has comment: http://stackoverflow.com/comment/36087803
type: UnansweredQuestion
has body: I have written a program in Java which operates on a Postgres-DB. The problem is, that the execution of the program takes 4058ms on Windows 7 and 11250ms on Ubuntu 12.10. Windows machine: Core i7 with 4x1.6 GHz and 4GB Ram Ubuntu machine: Xeon E3-1230 with 4x3.3GHZ and 32GB Ram I have separately tested java and the db, but the Ubuntu machine is always faster. Measured execution times: Java Program with a lot of loops and no println: Windows 9601ms, Ubuntu 2851ms Postgres function which inserts 1.000.000 entries: Windows: 6045ms, Ubuntu: 2136ms I tested the server with OpenJDK and Oracle Java, whereby OpenJDK is 10% faster. Thanks for your help!
has comment: http://stackoverflow.com/comment/36083518
has title: Java program is faster on Windows than Ubuntu
type: Question
has answer: http://stackoverflow.com/a/23523780
tagged with: performance
has comment: http://stackoverflow.com/comment/36082708
tagged with: java
has comment: http://stackoverflow.com/comment/36083420
score: 0
has comment: http://stackoverflow.com/comment/36083022
has comment: http://stackoverflow.com/comment/36087194
answer count: 1
has comment: http://stackoverflow.com/comment/36083731
has comment: http://stackoverflow.com/comment/36083227
has comment: http://stackoverflow.com/comment/36082698
has comment: http://stackoverflow.com/comment/36105492

http://stackoverflow.com/a/23562362
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/36155080
type: Answer
has comment: http://stackoverflow.com/comment/36154995
upvote count: 0
has body: Problem is, somewhere in the code, theres a class with a global static variable: static float[][] matrix; And then, a method uses it: SomeMethod() { int f = matrix[i][b]; } The solution is to change the way the method obtains the object: float[][] matrix; SomeMethod(float[][] matrix) { int f = matrix[i][j]; }
answers question: http://stackoverflow.com/q/23561745

http://stackoverflow.com/comment/36070897
type: QuestionComment
comment on: http://stackoverflow.com/q/23516749
score: 0
has text: The file type is set in line 6. "client.setFileType(FTP.ASCII_FILE_TYPE)" In this file type, when I write "\n", it doesn't appear in the output file so I assume it's recognizing it, but just not actually going to the next line. Please read my reply above this one for more info about this.
type: Comment

http://stackoverflow.com/q/23613383
has comment: http://stackoverflow.com/comment/36252007
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36252153
has body: I am trying to use read() method in socket programming. in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new PrintStream(socket.getOutputStream(), true, "UTF-8"); while ((s = in.read()) != -1) { char c = (char) s; str = str + c; System.out.println(str); } System.out.println("+++++"); In this code when client sends data to server as I:987. server reads it properly. after reading, it is waiting more inputs. but I want to break loop after reading data. I don't want to use println() method. how can (s = in.read()) return -1.
has comment: http://stackoverflow.com/comment/36254322
has comment: http://stackoverflow.com/comment/36250957
type: UnansweredQuestion
has title: how can read() return -1 value in this code? when client send data to server, server read properly.after reading, read() method not return -1 value
has comment: http://stackoverflow.com/comment/36253659
has answer: http://stackoverflow.com/a/23634536
type: Question
tagged with: sockets
answer count: 1

http://stackoverflow.com/comment/35988842
type: AnswerComment
has text: Thanks for your explanation and code sample, I will try to understand it before implement, it seems very simple the solution, but I am not clever enough for this kind of 'games'...
type: Comment
comment on: http://stackoverflow.com/a/23472801
score: 0

http://stackoverflow.com/q/23453323
has comment: http://stackoverflow.com/comment/35952126
tagged with: java
has comment: http://stackoverflow.com/comment/35952627
has body: I have to develop an java swing application that will take customer details (name, address, contact number) and print each set on information to sticky labels. There are 10 labels per A4 sheet in a 5 x 2 matrix (each cell size 96 x 50.8 mm). Does anyone know if there are other java API's out there designed specificly for printing?
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23453769
has title: Printing Labels in Java swing application
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: swing
type: Question

http://stackoverflow.com/comment/36196522
type: AnswerComment
comment on: http://stackoverflow.com/a/23584007
type: Comment
has text: @user3508182 the picture doesn't contain the stactrace, so I'm unable to spot any error.
score: 0

http://stackoverflow.com/a/23928010
has comment: http://stackoverflow.com/comment/46426966
downvote count: 0
has comment: http://stackoverflow.com/comment/45755070
score: 1
has body: RestEasy works perfectly fine with any Servlet Container with whatever other framework. So This works well without any explicit configuration.
has comment: http://stackoverflow.com/comment/46381616
has comment: http://stackoverflow.com/comment/46619803
has comment: http://stackoverflow.com/comment/46380944
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23498996
has comment: http://stackoverflow.com/comment/46387835
accepted answer of: http://stackoverflow.com/q/23498996
type: Answer

http://stackoverflow.com/comment/36130596
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23549026
has text: Typo in survivor.removeHolder(this)

http://stackoverflow.com/a/23594889
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23594832
upvote count: 1
has body: Pass the reference of Gui to the TimerTest class class TimerTest { static int counter = 0; public TimerTest(final Gui gui) { TimerTask timerTask = new TimerTask() { @Override public void run() { gui.attArea.append("TimerTask executing counter is: " + counter); ... } }; ... } } class Main { public static void main(String[] args) { Gui gui = new Gui(); new TimerTest(gui); } }

http://stackoverflow.com/q/23588733
has comment: http://stackoverflow.com/comment/36485058
has comment: http://stackoverflow.com/comment/36278968
downvote count: 0
tagged with: button
has comment: http://stackoverflow.com/comment/36281900
has answer: http://stackoverflow.com/a/24469656
has comment: http://stackoverflow.com/comment/36285672
favorite count: 0
has answer: http://stackoverflow.com/a/23631998
tagged with: android-4.4-kitkat
score: 9
tagged with: android
has comment: http://stackoverflow.com/comment/36286112
accepted answer: http://stackoverflow.com/a/23631998
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23733248
has comment: http://stackoverflow.com/comment/36286525
has body: The main menu of my app (a game) uses standard Android buttons. It works fine on all my devices except on Nexus 7 with Android 4.4.2. The issue is as follows: The text of a button suddenly disappears in either of these cases: the button is pressed (it happens immediately when I touch it, no need to release it), setEnabled(boolean) is called on the button For example, if I press "Load game", the button is correctly highlighted during the press event, but "Load game" disappears completely (the button has empty text). If I remove all custom styles and behaviors, and use only the default Android buttons with default font etc., the problem still persists. If I decrease targetSdkVersion to 18 (from 19), everything works fine even on Nexus 7. Any idea what has changed in KitKat in this respect? I didn't find anything suspicious. My revalant XML code: Important notes regarding the above code: The game has a two-row main menu (with two buttons in each row, so altogether 4 buttons), and this main menu is positioned on the bottom of the screen Literal texts are placeholders only, because the game has an own file format for texts, and reads data from there when the Activity is created The issue persists even if I completely remove the android:textColor and android:background attributes. In this case, my buttons will have a default appearance (instead of their game specific style), but the issue persists. To emphasize again: the above code works perfectly on all (tested) devices except Nexus 7 (all my devices except Nexus 7 are pre-KitKat devices) Finally, some information about my global styles/themes: In AndroidManifest, I set my Application theme to MyCustomTheme. The content of mycustomtheme.xml: <?xml version="1.0" encoding="utf-8"?> Finally, my styles.xml is as follows (but it seems I don't refer its styles from anywhere, this seems to be old code from the time we made the game fullscreen, or does Android use it anywhere by default?): <?xml version="1.0" encoding="utf-8"?>
has comment: http://stackoverflow.com/comment/36278920
has comment: http://stackoverflow.com/comment/36278810
type: Question
has title: Button texts disappear on KitKat (API level 19)
has comment: http://stackoverflow.com/comment/36286432
upvote count: 9
tagged with: java
possible better answer: http://stackoverflow.com/a/23736602
has answer: http://stackoverflow.com/a/23736602

http://stackoverflow.com/comment/35999838
type: AnswerComment
comment on: http://stackoverflow.com/a/23478932
type: Comment
has text: While I was hoping that there is a magic letter in the format or setting for the formatter, I think this a very good solution here. Thanks.
score: 0

http://stackoverflow.com/comment/36091782
type: Comment
has text: Sorry for not being clear every one, but this answer it what I needed. I had to adjust it slightly using an iterator, much appreciated.
comment on: http://stackoverflow.com/a/23527448
score: 1
type: AnswerComment

http://stackoverflow.com/comment/36266237
comment on: http://stackoverflow.com/q/23576796
type: Comment
type: QuestionComment
has text: @jewelsea so basically without hacking it out its not possible?
score: 0

http://stackoverflow.com/a/23619776
answers question: http://stackoverflow.com/q/23605542
has body: The line series.map(t=&gt;(t._1,new DWTsample().computeDwt(sc,t._2))) references the SparkContext (sc) but SparkContext isn't serializable. SparkContext is designed to expose operations that are run on the driver; it can't be referenced/used by code that's run on workers. You'll have to re-structure your code so that sc isn't referenced in your map function closure.
score: 20
type: Answer
upvote count: 20
downvote count: 0

http://stackoverflow.com/q/23479374
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23479495
type: Question
tagged with: object
possible better answer: http://stackoverflow.com/a/23479495
has body: I know of at least three ways. Pass the object through methods, directly refer to the object, or create a shortcut in the new class to the other class's object. For example, I have a DataOutputStream toServer in Main.java I declare (assume sock already declared) public static DataOutputStream toserver; public static void main() { toServer = new DataOutputStream(sock.getOutputStream() ); } But in another method I need to write to the server. Should I: in Main.java WriteStuff.write(toServer); then in WriteStuff.java public static void write(DataOutputStream toServer) { toServer.writeBytes("Foo\n"); } or in WriteStuff.java static DataOutputStream toServer = Main.toServer; public static void write() { toServer.writeBytes("Foo\n"); } or, again in WriteStuff.java Main.toServer.writeBytes("Foo\n"); What is the recommended convention? Pass the object when invoking the method, referencing the object directly by using Main.objectName or setting a shortcut in the class? Which is faster?
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/36000625
tagged with: pointers
has answer: http://stackoverflow.com/a/23479402
has answer: http://stackoverflow.com/a/23479500
has comment: http://stackoverflow.com/comment/36000594
has comment: http://stackoverflow.com/comment/36039991
accepted answer: http://stackoverflow.com/a/23479402
has title: Java: How should I reference a public object from another class?
tagged with: reference

http://stackoverflow.com/q/23477117
score: -1
tagged with: class
upvote count: 0
has comment: http://stackoverflow.com/comment/35995986
has title: Get static final field of Type T of a class
answer count: 1
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/35996114
has comment: http://stackoverflow.com/comment/35996393
has comment: http://stackoverflow.com/comment/35996429
tagged with: final
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35996919
has body: I have following three class definitions: public class Bounds { public Bounds (int a, int b, int c, int d) { /* ... */ } /* ... */ } public class A { public static final Bounds BOUNDS = new Bounds(1, 2, 3, 4); public A () { /* ... */ } /* ... */ } public class B extends A { public static final Bounds BOUNDS = new Bounds(5, 6, 7, 8); public B () { super(); /* ... */ } /* ... */ } Then I have a method looking like this: public void Foo (Class&lt;? extends A&gt; cls) { cls.getField("BOUNDS").get(null); // Doesn't work } When I try to call Foo(B.class), I get an error saying "incompatible types" while highlighting the get(null). My question is: How can I get the value of BOUNDS using the Class-class? (I don't want to know that I can use A instead of Class&lt;? extends A&gt;) EDIT: If I use getInt(null) for static final integers or getDouble(null) for static final doubles, it works.
downvote count: 1
has answer: http://stackoverflow.com/a/23477205
type: Question
tagged with: java

http://stackoverflow.com/q/23486359
linked to: http://stackoverflow.com/q/17333013
has title: Java: HTTP POST 405 Not Allowed
score: 0
has answer: http://stackoverflow.com/a/23486475
type: UnansweredQuestion
tagged with: http
tagged with: java
has body: I stuck in amazing situation while consuming REST operation. When i run simple java program in IDE then i am able to create HTTP request: 201/Created. SUCCESS. Server receives request When i put same program in Runtime environment(say Mule), i get 405/Method not Allowed. FAILED. Server does not receive anything When i run it through Rest Client(some mozilla or chrome plugin), It accepts request 201/created. SUCCESS. Server receives request On that particular URL, i am getting following Allowed: Allow: GET, POST Is this issue with Runtime? or any settings to be done in Runtime environment? or issue in Code? Following is Code: `URL urlRequest = new URL(url); HttpURLConnection conn = (HttpURLConnection) urlRequest.openConnection(); conn.setRequestProperty("Host", "10.91.17.170:81"); conn.setRequestProperty("User-Agent", "Mozilla/4.0"); conn.setRequestProperty("Accept", "application/atom+xml;q=0.9,*/*;q=0.8"); conn.setRequestProperty("Accept-Language", "en-us,en;q=0.5"); conn.setRequestProperty("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"); conn.setRequestProperty("Keep-Alive", "115"); conn.setRequestProperty("Connection", "keep-alive"); conn.setRequestProperty("Access-Control-Allow-Origin", "*"); conn.setRequestProperty("Content-Type", "application/atom+xml"); conn.setDoOutput(true); conn.setRequestMethod("POST"); DataOutputStream wr = new DataOutputStream(conn.getOutputStream()); wr.writeBytes(requestXML); wr.flush(); wr.close(); System.out.println("Created Request"); System.out.println("Response Code: "+conn.getResponseCode()); System.out.println("Response Status: "+conn.getResponseMessage()); System.out.println("Response Status: "+conn.getContentType()); System.out.println("Request Method: "+conn.getRequestMethod()); ` Unable to get answer on google. Did hit and trials but not successful.
type: Question
answer count: 1

http://stackoverflow.com/q/23509148
has comment: http://stackoverflow.com/comment/36056224
type: Question
tagged with: selenium-webdriver
tagged with: java
has comment: http://stackoverflow.com/comment/36057452
tagged with: selenium
upvote count: 1
answer count: 1
tagged with: webdriver
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36056123
has comment: http://stackoverflow.com/comment/36063797
has answer: http://stackoverflow.com/a/23509289
has comment: http://stackoverflow.com/comment/36056780
downvote count: 0
score: 1
has title: Take screenshot of webpage along with the browser window
favorite count: 0
has body: I am generating custom reports by implementing IReporter. I am able to take screenshot of the entire page using the following code ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); This captures only the HTML webpage, but I want to capture the browser window as well. Use case for this is say, suppose I check for the title of the page and assert fails. So, when I see the screenshot, I can see what the title of the page was at that time.

http://stackoverflow.com/q/23482290
has title: Tomcat app behind an Apache subdomain - virtualhost error
score: 0
tagged with: subdomain
type: UnansweredQuestion
has body: I need to have 2 application on Tomcat behind apache virtualhost. Each app gave own domain. There are my apache virtualhost configs: &lt;VirtualHost *:80&gt; ServerName tomcat.example.net DocumentRoot /var/www/tomcat.example.net ProxyRequests Off ProxyPreserveHost On &lt;Proxy *&gt; Order deny,allow Allow from all &lt;/Proxy&gt; ProxyPass / http://127.0.0.1:8080/ ProxyPassReverse / http://127.0.0.1:8080/ &lt;/VirtualHost&gt; &lt;VirtualHost *:80&gt; ServerName domain.tld DocumentRoot /var/www/tomcat.example.net ProxyRequests Off ProxyPreserveHost On &lt;Proxy *&gt; Order deny,allow Allow from all &lt;/Proxy&gt; ProxyPass / http://127.0.0.1:8080/domain.tld/ ProxyPassReverse / http://127.0.0.1:8080/domain.tld/ &lt;/VirtualHost&gt; By default, all app are accesible through http://tomcat.example.net/APPNAME - it is ok. Second virtualhost is for app with domain domain.tld. If I go to app through http://tomcat.example.net/domain.tld/info/ it works good but if I go throug http://domain.tld/ and click on links on page all links link to http://domain.tld/domain.tld/info/ - I see error page. In JSP page I use c:url so it maybe be good. &lt;c:url value="/info/" /&gt; I use default tomcat7 settings on ubuntu 12.04 server. App on subdomain has subdomain/appName in url. On subdomain it is http://domain.tld/APPNAME/info/ (http://domain.tld/domain.tld/info/) but it must be only http://domain.tld/info/ domain.tld=APPNAME How to config apache/tomcat/my app?
answer count: 0
tagged with: java
tagged with: virtualhost
type: Question
has comment: http://stackoverflow.com/comment/36007269
tagged with: apache
tagged with: tomcat
has comment: http://stackoverflow.com/comment/36006573

http://stackoverflow.com/comment/61495818
type: Comment
has text: Do not post the same answer multiple times. You already posted this here http://stackoverflow.com/a/36969922/1743880.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/36970055

http://stackoverflow.com/a/23537742
has comment: http://stackoverflow.com/comment/36154041
answers question: http://stackoverflow.com/q/23486786
has comment: http://stackoverflow.com/comment/36157320
has comment: http://stackoverflow.com/comment/36239709
has comment: http://stackoverflow.com/comment/36157622
has comment: http://stackoverflow.com/comment/36148222
has comment: http://stackoverflow.com/comment/36158454
accepted answer of: http://stackoverflow.com/q/23486786
has comment: http://stackoverflow.com/comment/36233086
has body: This is very useful question. Step 1 : Make a package com.displaytag.export.views Step 2 : Make a class myExcel2007ExportView.java in the above package. Step 3 : Copy and paste following code in that file package com.displaytag.export.views; import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; import javax.servlet.jsp.JspException; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; import org.displaytag.export.BinaryExportView; import org.displaytag.model.Column; import org.displaytag.model.ColumnIterator; import org.displaytag.model.HeaderCell; import org.displaytag.model.RowIterator; import org.displaytag.model.TableModel; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xssf.usermodel.XSSFFont; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import com.lowagie.text.BadElementException; public class myExcel2007ExportView implements BinaryExportView{ //private static Log log = LogFactory.getLog(myExcel2007ExportView.class); private TableModel model; private boolean exportFull; private boolean header; private boolean decorated; private XSSFWorkbook workbook; private XSSFSheet sheet; private int rowCount=0; private CellStyle normalstyle=null; private CellStyle headerstyle=null; private CellStyle captionstyle=null; private XSSFFont defaultFont; private XSSFFont headerFont; private XSSFFont captionFont; public String getMimeType() { return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; } public void setParameters(TableModel tableModel, boolean exportFullList, boolean includeHeader, boolean decorateValues) { this.model = tableModel; this.exportFull = true; this.header = includeHeader; this.decorated = decorateValues; } public boolean out…
has comment: http://stackoverflow.com/comment/36231027
has comment: http://stackoverflow.com/comment/36157480
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36234556
has comment: http://stackoverflow.com/comment/36155719
has comment: http://stackoverflow.com/comment/36231508
has comment: http://stackoverflow.com/comment/36147691
has comment: http://stackoverflow.com/comment/36152765
has comment: http://stackoverflow.com/comment/36155856
has comment: http://stackoverflow.com/comment/36234041
type: Answer
has comment: http://stackoverflow.com/comment/36113185
has comment: http://stackoverflow.com/comment/36155513
has comment: http://stackoverflow.com/comment/36113701
has comment: http://stackoverflow.com/comment/36154275
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/36113581
has comment: http://stackoverflow.com/comment/36114572

http://stackoverflow.com/comment/36099396
type: QuestionComment
has text: @BevynQ, if I stop the application and do NOT start it immediately and later I try to start the application, I works. So I think it's the socket TIME_WAIT mechanism disallow
comment on: http://stackoverflow.com/q/23531558
score: 0
type: Comment

atomic
type: Tag
tags question: http://stackoverflow.com/q/23544968
tag name: atomic
tags question: http://stackoverflow.com/q/23471053
tags question: http://stackoverflow.com/q/23480346

http://stackoverflow.com/q/23583331
tagged with: gson
upvote count: 1
accepted answer: http://stackoverflow.com/a/23597722
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
tagged with: serialization
has title: Why does GSON produce different JSON for enum at custom TypeAdapter?
type: Question
answer count: 1
has body: I wrote a TypeAdapter for a class that contains an enum attribute. This is the write method, which uses standard GSON serialization for the enum value: @Override public void write(JsonWriter writer, MyClass object) throws IOException { if (object == null) { writer.nullValue(); return; } writer.beginObject(); writer.name("type").value(gson.toJson(object.getType())); //this is the enum writer.endObject(); } When using this TypeAdapter, the produced JSON contains this part for the enum: "type":"\"ENUM_VALUE\"" But when I use gson.toJson(object) on a class which contains this enum without a TypeAdapter, it produces: "type":"ENUM_VALUE" All Gson objects use the standard configuration. It produces the same result in the first version, whether I test the TypeAdapter directly or use a Gson and registering it. Why is there a difference? I guess escaping is not needed here, so I’d like to avoid it. Interestingly, deserialization works for both serialized versions with the TypeAdapter (with gson.fromJson(reader.nextString())). I guess that the problem might occure because gson.toJson(object.getType()) already produces quotes: "ENUM_VALUE" and when adding them to the JsonWriter with writer.value(gson.toJson(object.getType()) it gets escaped. But how to handle this correctly, like GSON does it?
has answer: http://stackoverflow.com/a/23597722
tagged with: java

http://stackoverflow.com/comment/36201568
type: AnswerComment
has text: by opening and passing in scanner are you subjected to resources leaks? and or if you assuming when the method return back to main the try block will close it properly? also it seems like everytime you create a new method by passing in "in" are actually creating a new instance hence resource leaks??
type: Comment
comment on: http://stackoverflow.com/a/23586982
score: 0

http://stackoverflow.com/q/23556394
answer count: 3
has answer: http://stackoverflow.com/a/23594197
tagged with: jruby
possible better answer: http://stackoverflow.com/a/23593731
downvote count: 0
favorite count: 0
has title: Serializing a JRuby CompiledScript in Java
has answer: http://stackoverflow.com/a/23702786
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/23718436
linked to: http://stackoverflow.com/q/1992384
has body: I have a Ruby script that I'd like to run at the startup of my Java program. When you tell the ScriptEngine to evaluate the code for the first time, it takes a while. I'm under the impression that the reason it takes this long is because it first needs to compile the code, right? I found that you can compile Ruby code, and then evaluate it later. The evaluation itself is fast - the compilation part is the slow one. Here I am compiling: jruby = new ScriptEngineManager().getEngineByName("jruby"); Compilable compilingEngine = (Compilable)jruby; String code = "print 'HELLO!'"; CompiledScript script; script = compilingEngine.compile(code); This snippet is what takes a while. Later when you evaluate it, it is fine. So of course, I was wondering if it would be possible to "save" this compiled code into a file, so in the future I can "load" it and just execute it without compiling again.
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/23593731
score: 4
accepted answer: http://stackoverflow.com/a/23702786

http://stackoverflow.com/comment/36120832
type: Comment
type: QuestionComment
has text: Changing `Option` to `String` did not make a difference. And what would be the default package to use, if it's in root?
comment on: http://stackoverflow.com/q/23543192
score: 0

geotools
type: Tag
tags question: http://stackoverflow.com/q/23597434
tag name: geotools

http://stackoverflow.com/comment/35988722
comment on: http://stackoverflow.com/q/23472896
score: 1
type: Comment
type: QuestionComment
has text: if this is a homework/interview task then I guess that is fine, but otherwise makes little sense. If it is a real task, then I'd question the requirements.

http://stackoverflow.com/q/23594080
has body: How can I output a hashmap values by key's input order? In C++11 unordered_map, it's not ordered. Look at the C++ reference page http://www.cplusplus.com/reference/unordered_map/unordered_map/begin/ mymap = {{"Australia","Canberra"},{"U.S.","Washington"},{"France","Paris"}}; std::cout &lt;&lt; "mymap contains:"; for ( auto it = mymap.begin(); it != mymap.end(); ++it ) std::cout &lt;&lt; " " &lt;&lt; it-&gt;first &lt;&lt; ":" &lt;&lt; it-&gt;second; The output sequence is mymap contains: France:Paris Australia:Canberra U.S.:Washington However I expect Australia:Canberra U.S.:Washington France:Paris How do I output above result? And how to implement in Java(I test in HashSet/HashMap, keys are not ordered too)? Thanks!
has title: How to output C++11 unordered_map/unordered_set and Java HashMap/HashSet values by input order?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23611387
upvote count: 1
tagged with: c++11
score: 1
tagged with: java
type: Question
tagged with: hashmap
downvote count: 0
tagged with: unordered-map
answer count: 3
has comment: http://stackoverflow.com/comment/36216701
has answer: http://stackoverflow.com/a/23594916
favorite count: 0
has answer: http://stackoverflow.com/a/23594115

http://stackoverflow.com/comment/39623275
type: AnswerComment
score: 0
type: Comment
has text: Tomcat 7.054 still doesnt support the jdk8 -compiler flag, related question on http://stackoverflow.com/questions/25279729/tomcat-7-annotation-scanner-and-jdk-8-with-parameters-compiler-flag-exceptions
comment on: http://stackoverflow.com/a/23608847

http://stackoverflow.com/a/23541540
answers question: http://stackoverflow.com/q/23540729
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/36116368
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23540729
upvote count: 2
has body: It depends on your Java and Linux version but you can do this: Make a thread dump of your application. First jps to find the process ID, then jstack for a thread dump. The dump will contain nids: "GC task thread#0 (ParallelGC)" prio=10 tid=0x00007f322001f800 nid=0x6bd3 runnable That's the PID of the thread in hex. You can use printf to convert it to decimal: printf "%d\n" 0x6bd3 which gives us 27603. You can now use renice with this PID to change the thread priority. Sources: How to find a Java thread running on Linux with ps -axl? What is Java thread priority? (found in Setting priority to Java&#39;s threads) http://linux.die.net/man/1/chrt
has comment: http://stackoverflow.com/comment/36116316

http://stackoverflow.com/q/23534528
has title: How to add n days to a Date in java without importing Date/Calendar from java API?
has comment: http://stackoverflow.com/comment/36104277
type: Question
has answer: http://stackoverflow.com/a/23534701
answer count: 8
has comment: http://stackoverflow.com/comment/100492263
tagged with: class
has comment: http://stackoverflow.com/comment/36104000
has answer: http://stackoverflow.com/a/51690828
has body: How do I add n days to a date in Java Creating my own java class? For example, my date is (dd/mm/yyyy) = 26/02/2014 Adding 3 days, the output should be 01/03/2014. Without importing Calendar or Date from JAVA API Thank you in Advance. Any Sample code or Pseudo Code or idea will be highly apprecited
has comment: http://stackoverflow.com/comment/36104605
has comment: http://stackoverflow.com/comment/36104233
has answer: http://stackoverflow.com/a/58047781
has comment: http://stackoverflow.com/comment/36103859
favorite count: 0
has comment: http://stackoverflow.com/comment/36103983
has answer: http://stackoverflow.com/a/37365893
has comment: http://stackoverflow.com/comment/36104088
has comment: http://stackoverflow.com/comment/36104016
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36103891
downvote count: 2
has comment: http://stackoverflow.com/comment/36104031
has answer: http://stackoverflow.com/a/23534665
has comment: http://stackoverflow.com/comment/36103802
upvote count: 3
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36104279
has answer: http://stackoverflow.com/a/37227688
has answer: http://stackoverflow.com/a/43746548
has answer: http://stackoverflow.com/a/56977276
tagged with: date

http://stackoverflow.com/q/23553358
tagged with: java
has comment: http://stackoverflow.com/comment/36139073
has comment: http://stackoverflow.com/comment/36139121
tagged with: http://stackoverflow.com/tag/c
linked to: http://stackoverflow.com/q/3346450
type: Question
has comment: http://stackoverflow.com/comment/38583784
answer count: 8
has comment: http://stackoverflow.com/comment/36138987
has title: Why does this expression i+=i++ differs from Java and C?
has comment: http://stackoverflow.com/comment/36139058
has answer: http://stackoverflow.com/a/23553400
possible better answer: http://stackoverflow.com/a/23553829
has comment: http://stackoverflow.com/comment/36139070
favorite count: 0
accepted answer: http://stackoverflow.com/a/23553721
has answer: http://stackoverflow.com/a/23553829
linked to: http://stackoverflow.com/q/9060747
upvote count: 8
linked to: http://stackoverflow.com/q/7911776
has comment: http://stackoverflow.com/comment/36139030
has comment: http://stackoverflow.com/comment/36139583
has comment: http://stackoverflow.com/comment/36139670
has comment: http://stackoverflow.com/comment/36139359
has answer: http://stackoverflow.com/a/23553399
linked to: http://stackoverflow.com/q/11570589
has comment: http://stackoverflow.com/comment/36138977
downvote count: 6
has comment: http://stackoverflow.com/comment/36139080
score: 2
has answer: http://stackoverflow.com/a/23553398
has comment: http://stackoverflow.com/comment/36139131
has comment: http://stackoverflow.com/comment/36139172
has answer: http://stackoverflow.com/a/23553483
has body: I know about the prefix and posfix operation... the difference between ++i and i++ and so. But I think I'm missing something here. Below you can find the code: package test; public class Test { public static void main (String[] args) { int i=0; i+=i++; System.out.println(i); // Prints 0 i = i + (i++); System.out.println(i); // Prints 0 i = i + (i+1); System.out.println(i); // Prints 1 } } So the output is: 0 0 1 I tried the same code in C: #include &lt;stdio.h&gt; #include &lt;string.h&gt; main() { int i=0; i+=i++; printf("%d", i); // prints 1 i = i + (i++); printf("%d", i); // prints 3 i = i + (i+1); printf("%d", i); // prints 7 } and the output was: 1 3 7 Why i+=i++ doesn't increment i while the same code in C it increments the values?
linked to: http://stackoverflow.com/q/13516689
linked to: http://stackoverflow.com/q/17144359
has answer: http://stackoverflow.com/a/23553956
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36139109
has comment: http://stackoverflow.com/comment/36139185
has answer: http://stackoverflow.com/a/23553721
has answer: http://stackoverflow.com/a/23553822

http://stackoverflow.com/a/23538790
type: Answer
has body: You can use request.getSession().getServletContext().getAttribute("your_attribute_name_here") and can access the LinkedHashSet, once you get it you can add/remove/update values in it and again set it back to put updated values like request.getSession().getServletContext().setAttribute("your_attribute_name_here", "update_LinkedHashSet"); As best of my knowledge using EL you can access it but can not put back the updated value in attribute. Note: while accessing the attribute you will need the explicit type casting.
score: 0
answers question: http://stackoverflow.com/q/23537325

http://stackoverflow.com/comment/36093443
has text: Yes, thank you for update. I ran it and it still work!!!. But one issue: when I printing numbers it still request new ones, so I typed letter to stop input. And after it I get number result.
score: 0
comment on: http://stackoverflow.com/q/23527955
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36003405
type: Comment
type: QuestionComment
has text: Use case is: at time of login I need to create a cookie. Which I pass to another .NET application running on some other server. It does the cookie based authentication. Now if session gets timeout I need to delete the cookie.
comment on: http://stackoverflow.com/q/23475960
score: 0

http://stackoverflow.com/comment/36061292
score: 0
type: AnswerComment
type: Comment
has text: Your solution does not consider the ArrayList stuff.
comment on: http://stackoverflow.com/a/23512180

http://stackoverflow.com/q/23600915
answer count: 1
has answer: http://stackoverflow.com/a/23624868
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36270434
has title: Elasticsearch: how to make product name count more than product description in a search?
has comment: http://stackoverflow.com/comment/36235192
tagged with: lucene
type: Question
has body: I am building an e-commerce site. When searching for products with a string, I want to search the name field and the description field, and I want the name field to be more important than description. How can I do this and what terminology should I look at?
tagged with: elasticsearch
linked to: http://stackoverflow.com/q/12427449
score: 0

http://stackoverflow.com/q/23503910
has answer: http://stackoverflow.com/a/36207283
tagged with: spring-mvc
type: AnsweredQuestion
has title: Removing Data Source Connection Spring + JPA
has comment: http://stackoverflow.com/comment/36076424
tagged with: java
has comment: http://stackoverflow.com/comment/36076254
type: Question
tagged with: jpa
accepted answer: http://stackoverflow.com/a/36207283
has comment: http://stackoverflow.com/comment/36077508
score: 0
has comment: http://stackoverflow.com/comment/36046968
tagged with: sql
has body: Hy there folks, i'm facing a problem here where I work, there is a project when initialized works with 1 SQL Server Instance, 2 DB2 instances. The problem is, this project was based on another project to keep the similar structure, but on this new project we don't use the SQL Server instance who is in reference on some xml files, I tried to comment these references, when I start the project on Tomcat, the project show me few errors. As a new on Spring, how can I remove this connection properly?? beans.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:jaxws="http://cxf.apache.org/jaxws" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd"> <jee:jndi-lookup id="IP_ICMS_RJ" jndi-name="java:comp/env/IP_ICMS_RJ" /> <jee:jndi-lookup id="USUARIO_ICMS_RJ" jndi-name="java:comp/env/USUARIO_ICMS_RJ" /> <jee:jndi-lookup id="SENHA_ICMS_RJ" jndi-name="java:comp/env/SENHA_ICMS_RJ" /> <jee:jndi-lookup id="IP_ICMS_SP" jndi-name="java:comp/e…
answer count: 1
tagged with: spring

http://stackoverflow.com/a/23567943
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23563009
has body: I don't know what OBB is but maybe this is a problem of how the file is opened in GraphHopper. I can imagine that raFile = new RandomAccessFile(getFullName(), "r"); instead of the current: raFile = new RandomAccessFile(getFullName(), "rw"); should help. See MMapDataAccess line 68 and recompile. If it helps, please create a new issue on github to make this configurable in GraphHopper.

http://stackoverflow.com/a/23601140
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23601046
has body: you may try this if you simply want to append in the url without extra variable: &lt;td class="value"&gt; &lt;img src="/supportcenter/cServlet?sampleImg=${cForm.cId}" width="300px" /&gt; &lt;/td&gt;
upvote count: 1

http://stackoverflow.com/a/23600201
has body: Please input your name, age, and sex As you need to insert values in specific sequence. Use nextLine() and perform split For Example:"Abc 123 true 12.5 M" String s[]=line.split(" "); And you will have s[0]="Abc" s[1]="123" s[2]="true" s[3]="12.5" s[4]="M" Than parse them to required type. String first=s[0]; int second=Integer.parseInt(s[1].trim()); boolean third=Boolean.parseBoolean(s[2].trim()); double forth=Double.parseDouble(s[3].trim()); char fifth=s[4].charAt(0); As your code suggest and as David said you can change just this name = sc.next();//will read next token age = sc.nextInt(); sex = (sc.next()).charAt(0);//change sex to character for M and F //or //sex = sc.nextInt();//change it to int
has comment: http://stackoverflow.com/comment/36231087
type: Answer
has comment: http://stackoverflow.com/comment/36228009
accepted answer of: http://stackoverflow.com/q/23600172
has comment: http://stackoverflow.com/comment/36230818
answers question: http://stackoverflow.com/q/23600172
has comment: http://stackoverflow.com/comment/36226712
has comment: http://stackoverflow.com/comment/36226685
has comment: http://stackoverflow.com/comment/36227933
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36227162

http://stackoverflow.com/comment/35957610
type: AnswerComment
comment on: http://stackoverflow.com/a/23456411
score: 0
type: Comment
has text: The thing is i have 2 Radio Buttons on a group, and i want the text for the one that the user will select.

http://stackoverflow.com/q/23542530
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23542760
tagged with: windows-8
has comment: http://stackoverflow.com/comment/36118395
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/11825164
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23542760
has body: Is it possible to open and close windows 8 charm bar using java program ?
has title: How to open and close Window 8 Charms Bar from java code?

http://stackoverflow.com/a/23476370
downvote count: 0
answers question: http://stackoverflow.com/q/23476263
type: Answer
upvote count: 1
has body: If you are using a well established language/virtual machine then leaks due to "bugs in the runtime" are extremely unlikely. Spend your time looking for misuse of references in your application code.
score: 1

http://stackoverflow.com/comment/36032685
type: QuestionComment
has text: Sandbox like security in a free floating frame? I will take Java Web Start into consideration.
score: 0
comment on: http://stackoverflow.com/q/23486643
type: Comment

http://stackoverflow.com/a/29034130
downvote count: 0
answers question: http://stackoverflow.com/q/23530956
type: Answer
has body: Perhaps try this. It's for MariaDB, which may be ok, or it might even work with MySQL since they should be largely compatible. https://github.com/vorburger/MariaDB4j
score: 1
upvote count: 1

http://stackoverflow.com/comment/36231027
score: 0
type: Comment
has text: hey parth i made a new project without tiles but still it gives the same exception and i also add the export filter...
comment on: http://stackoverflow.com/a/23537742
type: AnswerComment

http://stackoverflow.com/q/23505083
tagged with: java
has body: I have a SWT Shell that has some type of unknown padding or border that I can't get rid of. Below is a screenshot of what I'm talking about. The border is question is green. How can I get rid of it as my elements would look better pressed directly against the side of the shell? Thanks in advance :D public static void main(String[] args) { Display display = new Display(); Shell rootShell = new Shell(display); rootShell.setBackground(SWTGraphicUtil.getColorSafely(0, 255, 0)); GridLayout rootLayout = new GridLayout(); rootLayout.numColumns = 3; rootLayout.horizontalSpacing = 0; rootLayout.verticalSpacing = 0; rootLayout.marginTop = rootLayout.marginRight = rootLayout.marginBottom = rootLayout.marginLeft = 0; rootShell.setLayout(rootLayout); Label lbl = new Label(rootShell, SWT.NONE); lbl.setText("WHAT WHAT WHAT WHAT WHAT WHAT WHAT"); lbl.setBackground(SWTGraphicUtil.getColorSafely(255, 0, 0)); Label lbl2 = new Label(rootShell, SWT.NONE); lbl2.setText("WHAT WHAT WHAT WHAT WHAT WHAT WHAT"); lbl2.setBackground(SWTGraphicUtil.getColorSafely(255, 0, 255)); Label lbl3 = new Label(rootShell, SWT.NONE); lbl3.setText("WHAT WHAT WHAT WHAT WHAT WHAT WHAT"); lbl3.setBackground(SWTGraphicUtil.getColorSafely(0, 0, 255)); rootShell.pack(); rootShell.open(); while (!rootShell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
tagged with: swt
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23505572
has title: SWT Shell - Internal Padding/Border
accepted answer: http://stackoverflow.com/a/23505572
type: AnsweredQuestion

http://stackoverflow.com/a/23527119
downvote count: 1
has comment: http://stackoverflow.com/comment/36115540
accepted answer of: http://stackoverflow.com/q/23526949
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36095098
has body: This simple math formula will give you the answer: ((10*60 +10) - (9*60 + 25)) So now all you need to do is: Split the 4 digits string into 2 group numbers. Calculate the minutes by Converting the hours into minutes and add them into the minutes new number. Subtract the bigger number from the smaller one. Walla! Code example: public class goFile { public static int SubtractTime(String number1, String number2) { return Math.abs(ConvertTimeToMinutes(number2) - ConvertTimeToMinutes(number1)); } public static int ConvertTimeToMinutes(String number) { return Integer.parseInt(number.substring(0, 2))*60 + Integer.parseInt(number.substring(2, 4)); } public static void main(String[] args) { System.out.println(SubtractTime("0925", "1010")); System.out.println(SubtractTime("1015", "1025")); } }
answers question: http://stackoverflow.com/q/23526949
has comment: http://stackoverflow.com/comment/36089914
type: Answer
has comment: http://stackoverflow.com/comment/36090969
upvote count: 1

http://stackoverflow.com/q/23612864
tagged with: java
score: 45
linked to: http://stackoverflow.com/q/10103861
type: Question
linked to: http://stackoverflow.com/q/25974354
has body: I'm trying to zip a file (for example foo.csv) and upload it to a server. I have a working version which creates a local copy and then deletes the local copy. How would I zip a file so I could send it without writing to the hard drive and do it purely in memory?
accepted answer: http://stackoverflow.com/a/23613145
tagged with: inputstream
tagged with: memory
has answer: http://stackoverflow.com/a/62446726
answer count: 3
possible better answer: http://stackoverflow.com/a/23615096
upvote count: 45
downvote count: 0
has answer: http://stackoverflow.com/a/23615096
favorite count: 0
has title: Create a Zip File in Memory
has answer: http://stackoverflow.com/a/23613145
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/zip

http://stackoverflow.com/q/23569531
type: Question
has body: Prelude I am using Struts 1.1 on a legacy project and I can't upgrade to a newer version: I am getting the following error(s): An error occurred at line: 6,331 in the generated java file mustCodes cannot be resolved An error occurred at line: 6,350 in the generated java file mustDesc cannot be resolved Here are the offending lines of code from the generated JSP source file: Here is the JSP code that generates the code that causes the error: &lt;bean:define id="mustCodes" name="locateVehicleForm" property="mustHaveOptionCodes"/&gt; &lt;bean:define id="mustDesc" name="locateVehicleForm" property="mustHaveOptionDescs"/&gt; Here is line 6,331 mustCodes = (java.lang.Object) _jspx_page_context.findAttribute("mustCodes"); Here is line 6,530 mustDesc = (java.lang.Object) _jspx_page_context.findAttribute("mustDesc"); This is not a duplicate of Need help on pre-compiling legacy JSP pages with taglibs with attributes that aren&#39;t supported in Struts 1.1 That one is about attributes that don't exist in the .tld. This one is about generated code not declaring the types on the reference variable names.
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36172810
tagged with: struts-1
has title: Having trouble with a JSP and the struts bean taglib when precompiling with jspc
has comment: http://stackoverflow.com/comment/36168731
tagged with: taglib
type: UnansweredQuestion
tagged with: struts
has comment: http://stackoverflow.com/comment/36169722
answer count: 0
tagged with: jsp

http://stackoverflow.com/q/23454482
tagged with: mssql-jdbc
has answer: http://stackoverflow.com/a/23455368
score: -2
tagged with: java
type: Question
has body: i am writing code for java mssql connectivity in notepad++ i am not using any ide. can anybody give me code. how to set classpath? jtde or jdbc driver i need code for both driver Thanks in advance
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/35954057
favorite count: 0
tagged with: sql-server
tagged with: dbconnection
tagged with: jdbc
has title: how to set classpath for java mssql connectivity
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/q/23510742
downvote count: 0
answer count: 1
has body: I'm working on a project where i have to use HttpUrlConnection (Android~) for reading the input stream. It turns out that when i'm reading the input stream the data is malformed and has a bigger size from the original content (which is sent by the server). Now, the server response header contains both "Content-Length" and "Transfer-Encoding: chunked", which from what i know is an issue as both of them shouldn't coexist. Aside from that the input stream received from HttpUrlConnection contains all body content (with chunks offset informations). I have two questions: Shouldn't the HttpUrlConnection handle chunked data? How to get the data from input stream without chunked informations?
has title: HttpUrlConnection reading chunked response
favorite count: 0
tagged with: android
score: 1
upvote count: 1
tagged with: http
has answer: http://stackoverflow.com/a/23510826
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23510826
type: Question

http://stackoverflow.com/comment/36017081
has text: _Doesn't work at all_ doesn't really help to know what does happens.
type: QuestionComment
comment on: http://stackoverflow.com/q/23488415
score: 0
type: Comment

http://stackoverflow.com/comment/36071545
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23514691
type: AnswerComment
has text: thanks, so this 'virtual method invocation' is all that is polymorphic for java?

http://stackoverflow.com/comment/36252620
type: Comment
type: QuestionComment
has text: yes i tried this code on a tablet with android 4.1
score: 0
comment on: http://stackoverflow.com/q/23614228

http://stackoverflow.com/comment/36084965
comment on: http://stackoverflow.com/a/23524369
score: 0
type: AnswerComment
has text: @blackrose do you mean; how do I return a value? how do I not take a value?
type: Comment

sql-server
tags question: http://stackoverflow.com/q/23541627
tags question: http://stackoverflow.com/q/23454482
tags question: http://stackoverflow.com/q/23481650
tags question: http://stackoverflow.com/q/23570343
tags question: http://stackoverflow.com/q/23564162
tags question: http://stackoverflow.com/q/23564363
type: Tag
tags question: http://stackoverflow.com/q/23477126
tags question: http://stackoverflow.com/q/23564383
tag name: sql-server
tags question: http://stackoverflow.com/q/23612593
tags question: http://stackoverflow.com/q/23547233
tags question: http://stackoverflow.com/q/23454428
tags question: http://stackoverflow.com/q/23494021
tags question: http://stackoverflow.com/q/23530013

http://stackoverflow.com/comment/36034853
has text: We don't know what you mean when you say you "need the format to be the same". Can you please clarify?
score: 0
comment on: http://stackoverflow.com/q/23497846
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36070177
comment on: http://stackoverflow.com/a/23515551
type: AnswerComment
type: Comment
has text: does it has something to do with android-support-v4.jar because when i remove this jar it launches the application but it does not load ads and throws the following error Could not find class 'android.support.v4.app.FragmentActivity', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.showErrorDialogFragment
score: 0

http://stackoverflow.com/comment/36237569
type: QuestionComment
comment on: http://stackoverflow.com/q/23606110
has text: I think you have a missing brace like @octopus says
score: 0
type: Comment

http://stackoverflow.com/q/23455524
has body: Could someone explain why the following code fragmnent does not compile? public class Main { public static void main(String[] args) { Integer[] integers = {3, 5, 8}; Set&lt;Integer&gt; s1 = new HashSet&lt;Integer&gt;(Arrays.asList(integers)); Double[] doubles = {3.5, 5.5, 8.5}; Set&lt;Double&gt; s2 = new HashSet&lt;Double&gt;(Arrays.asList(doubles)); Set&lt;Number&gt; res1 = union(s1, s1); // -&gt;it does not compile Set&lt;Number&gt; res2 = union(s1, s2); // -&gt;it does not compile } static &lt;E&gt; Set&lt;E&gt; union(Set&lt;? extends E&gt; s1, Set&lt;? extends E&gt; s2) { Set&lt;E&gt; result = new HashSet&lt;E&gt;(s1); result.addAll(s2); return result; } } I have read the error messages: Type mismatch: cannot convert from Set&lt;Integer&gt; to Set&lt;Number&gt; Main.java /TestingGenerics/src/com/al/testinggenerics line 17 Java Problem Type mismatch: cannot convert from Set&lt;Number&amp;Comparable&lt;?&gt;&gt; to Set&lt;Number&gt; Main.java /TestingGenerics/src/com/al/testinggenerics line 18 Java Problem What causes the problem as long as Integer and Double extend from Number?
tagged with: java
accepted answer: http://stackoverflow.com/a/23456273
upvote count: 4
tagged with: java-7
has title: Invoking generic method with wildcards does not compile
tagged with: wildcard
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/23455562
has answer: http://stackoverflow.com/a/23456273
tagged with: generics
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/23455562
answer count: 2
has comment: http://stackoverflow.com/comment/35957123
downvote count: 1

http://stackoverflow.com/q/23500383
accepted answer: http://stackoverflow.com/a/23501309
favorite count: 0
has comment: http://stackoverflow.com/comment/36041044
has comment: http://stackoverflow.com/comment/36039916
has comment: http://stackoverflow.com/comment/36040073
possible better answer: http://stackoverflow.com/a/23501105
linked to: http://stackoverflow.com/q/1195206
has comment: http://stackoverflow.com/comment/36041599
has comment: http://stackoverflow.com/comment/36041925
has comment: http://stackoverflow.com/comment/36041196
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36040852
downvote count: 0
has answer: http://stackoverflow.com/a/23500457
has body: Consider a java project doing lots of floating point operations where efficiency and memory consumption can be important factors - such as a game. If this project targets multiple platforms, typically Android and the desktop, or more generally 32 and 64 bit machines, you might want to be able to build a single and a double precision build of your software. In C/C++ and other lower level languages, this is easily achieved by typedef statements. You can have: typedef float myfloat; and the day you want to go 64 bit just change that to: typedef double myfloat; provided you use myfloat throughout your code. How would one achieve a similar effect in java? A global search and replace of "float" by "double" (or vice-versa) has the huge drawback of breaking compatibility with exterior libraries that only offer one flavor of floating point precision, chief among them certain functions of the java.lang.Math class. Having a high-level polymorphic approach is less than ideal when you wish to remain efficient and keep memory tight (by having lots of primitive type arrays, for instance). Have you ever dealt with such a situation and if so, what is in your opinion the most elegant approach to this problem?
has comment: http://stackoverflow.com/comment/36041465
has answer: http://stackoverflow.com/a/23501305
has comment: http://stackoverflow.com/comment/36039984
has comment: http://stackoverflow.com/comment/36041185
type: Question
linked to: http://stackoverflow.com/q/14208524
score: 3
has comment: http://stackoverflow.com/comment/36040443
has answer: http://stackoverflow.com/a/23501105
tagged with: java
has comment: http://stackoverflow.com/comment/36040338
has comment: http://stackoverflow.com/comment/36040183
has comment: http://stackoverflow.com/comment/36040759
upvote count: 3
has title: Abstracting floating point precision in java projects
has comment: http://stackoverflow.com/comment/36039688
has comment: http://stackoverflow.com/comment/36040414
has answer: http://stackoverflow.com/a/23501309

http://stackoverflow.com/comment/36202320
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23587378
type: Comment
has text: @arshajii, I left that out. Generating that code in Netbeans was extremely cumbersome...

http://stackoverflow.com/q/23564098
tagged with: rtc
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/23564403
type: Question
has title: Cannot set custom attribute value (of type Enumeration) using rtc client libraries
has body: I'm trying to write a Java tool to set a custom attribute on a jazz work item. The custom attribute has following definition: Name: Phase Found Type: HowFound (Enumeration) ID: howfound` Literals for HowFound: Name: Automation Name: Testing This is the Java code which tries to set the custom attribute's value. Note: log.info("Phase found: workitem has attribute"); is printed, so I know it finds the attribute, just cannot set value. public class WorkItemInitialization extends WorkItemOperation { private static Logger log = Logger.getLogger(WorkItemInitialization.class.getName()); public WorkItemInitialization(ICategoryHandle filedAgainst) { super("Initializing Work Item"); } protected void execute(WorkItemWorkingCopy workingCopy, IProgressMonitor monitor) throws TeamRepositoryException { log.info("Executing work item changes."); IWorkItem workItem = workingCopy.getWorkItem(); IWorkItemClient workItemClient = (IWorkItemClient) Main.repo.getClientLibrary(IWorkItemClient.class); IAttribute phaseFound = workItemClient.findAttribute(Main.projectAreaRTC, "howfound", monitor); if (workItem.hasCustomAttribute(phaseFound)){ log.info("Phase found: workitem has attribute"); IEnumeration&lt;? extends ILiteral&gt; myEnumeration = workItemClient.resolveEnumeration(phaseFound, monitor); ILiteral targetLiteral = null; for(ILiteral literal : myEnumeration.getEnumerationLiterals()) { if(literal.getName().equals("Automation")) { targetLiteral = literal; } } workItem.setValue(phaseFound, targetLiteral); } } } This is the error I get when running: Exception in thread "main" java.lang.ClassCastException: com.ibm.team.workitem.common.internal.model.ConfigurationItem incompatible with com.ibm.team.workitem.common.model.Identifier at com.ibm.team.workitem.common.internal.model.impl.WorkItemImpl.setValue(WorkItemImpl.java:2945)
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23564403

http://stackoverflow.com/q/23533133
score: 0
has title: Eclipse makes wrong choice of JAR as project dependency when class presents in more than one library
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/36101570
has comment: http://stackoverflow.com/comment/36101539
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36101463
has comment: http://stackoverflow.com/comment/36101756
tagged with: java
has comment: http://stackoverflow.com/comment/36102078
has body: I work on a big Java application and I'm having problem compiling it under Eclipse Kepler: the application is based on Maven 3.1.0 and successfully compiles there I generate Eclipse configuration (project files) using mvn eclipse:eclipse The problem is that certain classes present in more than one JAR (e.g. imagine a class Http and two versions of this class where newer has more methods) and Eclipse makes a wrong choice of the depending class (older one) for particular project which makes it not compilable. I tried to move Jars up/down in the project dependencies and it helps in certain situations, however, it means that I'm changing configuration changed by Maven. Is it possible to configure Eclipse so that is "smarter"? Is it caused by Maven (POM files, a bug in Maven's eclipse plugin, ...) although maven compiles the project without any problems? Any other suggestion?
tagged with: maven
tagged with: import
type: Question
tagged with: eclipse
has answer: http://stackoverflow.com/a/23533989

http://stackoverflow.com/q/23576558
type: Question
has answer: http://stackoverflow.com/a/23576622
tagged with: java
tagged with: eclipse
has title: How/where to implement an interface
upvote count: 0
answer count: 1
favorite count: 0
tagged with: interface
has body: When I try to compile my code in eclipse, it says "must implement interface DataStructureIterator extends java.util.Iterator.remove()" Please help, I don't know where to implement it and it fails in a continuous loop. public class DataStructure { private final static int SIZE = 15; private int [] arrayOfInts = new int [SIZE]; public DataStructure () { for ( int i = 0; i &lt; SIZE; i++ ) { arrayOfInts[i] = i; } } public void printEven() { DataStructureIterator iterator = this.new EvenIterator(); while (iterator.hasNext()) { System.out.println(); } } interface DataStructureIterator extends java.util.Iterator&lt;Integer&gt; { } private class EvenIterator implements DataStructureIterator { private int nextIndex = 0; public boolean hasNext() { return (nextIndex &lt;= SIZE - 1); } public Integer next() { Integer retValue = Integer.valueOf(arrayOfInts[nextIndex]); nextIndex += 2; return retValue; } }
type: UnansweredQuestion
downvote count: 3
score: -3

http://stackoverflow.com/a/23537542
type: Answer
has comment: http://stackoverflow.com/comment/36114603
has body: You have a typo in your code (the repository declaration in the service): @Autowired private placeRepository placeRepository; Should be: @Autowired private PlaceRepository placeRepository;
answers question: http://stackoverflow.com/q/23514544
score: 0
has comment: http://stackoverflow.com/comment/36116752

http://stackoverflow.com/comment/36154451
type: QuestionComment
type: Comment
has text: No, not with `getBeansOfType` you can use [`getBean`](http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/beans/factory/BeanFactory.html#getBean-java.lang.String-java.lang.Object...-) to pass constructor/reference arguments to a prototype bean or factory method.
comment on: http://stackoverflow.com/q/23561878
score: 0

http://stackoverflow.com/q/23497623
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36034333
has comment: http://stackoverflow.com/comment/36034231
tagged with: jersey
has body: I created a webservice in order to do file upload: The service: package services; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import com.sun.jersey.core.header.FormDataContentDisposition; import com.sun.jersey.multipart.FormDataParam; @Path("/file") public class ServiceResource { @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) { String uploadedFileLocation = "c://" + fileDetail.getFileName(); // save it writeToFile(uploadedInputStream, uploadedFileLocation); String output = "File uploaded to : " + uploadedFileLocation; return Response.status(200).entity(output).build(); } // save uploaded file to new location private void writeToFile(InputStream uploadedInputStream, String uploadedFileLocation) { try { OutputStream out = new FileOutputStream(new File( uploadedFileLocation)); int read = 0; byte[] bytes = new byte[1024]; out = new FileOutputStream(new File(uploadedFileLocation)); while ((read = uploadedInputStream.read(bytes)) != -1) { out.write(bytes, 0, read); } out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); } } } I also have a ApplicationConfig.java file which was generated when I created the service: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package services; import java.util.Set; import javax.ws.rs.core.Application; /** * * @author odjansse */ @javax.ws.rs.ApplicationPath("webresources") public class ApplicationConfig extends Application { @Override public Set<Class<?>> getClasses() { Set<Class<?>> resou…
linked to: http://stackoverflow.com/q/43253206
has answer: http://stackoverflow.com/a/23498188
downvote count: 0
answer count: 1
favorite count: 0
has title: Unsupported media type error while uploading a file (Restfull webservices with jersey, java in netbeans)
tagged with: rest
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23498188
upvote count: 2

http://stackoverflow.com/comment/36214330
type: QuestionComment
has text: Oh I see. Unfortunately that was my only idea. Good luck though!
score: 0
comment on: http://stackoverflow.com/q/23590748
type: Comment

http://stackoverflow.com/comment/36224577
comment on: http://stackoverflow.com/a/23587245
score: 0
type: Comment
has text: @sdeff Yeah, I'll take a look when I get the chance. Hopefully someone else can solve it or yourself in the meantime. Been busy lately.
type: AnswerComment

http://stackoverflow.com/comment/36255716
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23606123
has text: its not like that its doing some other job.. But at this point I cant use equals and hashcode method. As I said this is just an example.. my orignal implementation is something more generic. It code doesnt know which class or object needs to compare. Everything will serve dynamically. I believe I should go with reflection.
score: 0

http://stackoverflow.com/comment/36029439
type: QuestionComment
comment on: http://stackoverflow.com/q/23495167
has text: Java is Java. Please be more explicit, cannot recreate your issue with what you have provided here.
score: 0
type: Comment

http://stackoverflow.com/a/23464786
score: 0
answers question: http://stackoverflow.com/q/23464748
type: Answer
has body: What you could do is store the key as two columns. A char prefix and an auto-incrementing int, both of which are grouped for the primary key. CREATE TABLE myItems ( id INT NOT NULL AUTO_INCREMENT, prefix CHAR(30) NOT NULL, PRIMARY KEY (id, prefix),

http://stackoverflow.com/comment/36126003
score: 0
type: AnswerComment
has text: Wait a sec, can I leave that verifier as is do I need to supply values for it? I think that maybe where my issue is.
type: Comment
comment on: http://stackoverflow.com/a/23538893

http://stackoverflow.com/a/23527918
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23527711
type: Answer
has body: Your question is about "implementing" flush() but your code is not implementing an output stream. I guess you either want to ask about "using" flush() or you miss the fact that getOutputStream() returns an implementation of OutputStream which most likely does have a working flush() (in some cases it is an empty implementation because no special handling is needed if the stream is not buffering). I am not sure what BluetoothSocket you are using, but if it is android.bluetooth.BluetoothSocket then this is returning a BluetoothOutputStream which is forwarding both the write and the flush directly to the BT socket. Typically you need to call flush() at the end of a single message/packet. You should not call it when you pump lots of data into a stream. (Because if you do you might reduce your throughput and reduce the options for the stream implementation to reduce overhead).
score: 3
answers question: http://stackoverflow.com/q/23527711
upvote count: 3

http://stackoverflow.com/q/23602954
answer count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/20718093
has comment: http://stackoverflow.com/comment/36231552
score: 3
has title: Are there any usable Java IDEs for High-DPI computers?
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/51772637
tagged with: eclipse
type: Question
tagged with: intellij-idea
downvote count: 0
tagged with: ide
has comment: http://stackoverflow.com/comment/36236827
linked to: http://stackoverflow.com/q/20718093
has body: I have a Lenovo Yoga 2 Pro that has a QHD display at 3200x1800 resolution. Basically, everything is crystal sharp except in some programs, the majority of which are Java-based. Unfortunately, I have a lot of programming to do that I would prefer to do in Java, but I simply cannot work with the insanely blurry fonts and tiny images in IntelliJ, Eclipse, and Netbeans. If there are any developers in the same boat that I am, what are you using for your Java projects? EDIT: This is not a duplicate question because I'm not asking for a specific "fix" for Eclipse. I'm asking what developers are finding as a solution to a lack of compatibility with Java IDEs in general. FINAL EDIT: IntelliJ has done it. Even for Windows, the soon to be released IDEA 14.1 supports HiDPI on both Mac and Windows (not sure for Linux). I'm impressed, and very happy to use the IDE.
has comment: http://stackoverflow.com/comment/36236486
has comment: http://stackoverflow.com/comment/36232879
favorite count: 0

http://stackoverflow.com/q/23611800
favorite count: 0
has answer: http://stackoverflow.com/a/35515703
type: UnansweredQuestion
has title: Smack - How to read a MultiUserChat's configuration?
tagged with: smack
has body: I tried to create a multiuserchat with Java. I'm using smack library. Here is my code to create multiuserchat: MultiUserChat muc = new MultiUserChat(connection, "roomname@somehost"); muc.create("mynickname"); Form form = muc.getConfigurationForm(); Form submitForm = form.createAnswerForm(); submitForm.setAnswer("muc#roomconfig_roomname", "A nice formatted Room Name"); submitForm.setAnswer("muc#roomconfig_roomdesc", "The description. It should be longer."); muc.sendConfigurationForm(submitForm); muc.addMessageListener(mucMessageListener); // mucMessageListener is a PacketListener Then, I tried to capture the message sent by this room created above using mucMessageListener: private PacketListener mucMessageListener = new PacketListener() { public void processPacket(Packet packet) { if (packet instanceof Message) { Message message = (Message) packet; // this is where I got the problem } } } As the message received by other part (the user who is not the owner of this multiuserchat), can he somehow get the value set in this line above: submitForm.setAnswer("muc#roomconfig_roomname", "A nice formatted Room Name"); You see, getting just the JID of the room is not really good for the view. I expect I could have a String which value is "A nice formatted Room Name". How can we get that?
upvote count: 3
has answer: http://stackoverflow.com/a/23624421
tagged with: java
type: Question
score: 3
answer count: 3
has answer: http://stackoverflow.com/a/49033621
tagged with: xmpp
downvote count: 0
tagged with: multiuserchat

http://stackoverflow.com/comment/55758844
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23742598
type: Comment
has text: Apparently I am also missing some code to trigger the update event. In which method should I call `ICommandService#refreshElements`?

http://stackoverflow.com/a/23606675
type: Answer
has comment: http://stackoverflow.com/comment/36249469
has body: Scala picks the varargs version as more specific because (String, Array[Any]) can be applied to the other signature field(name: String, value: Any). (And not vice-versa.) Given that both methods are in the same class, I'm not sure if there is a canonical workaround besides reflective access: type Picker = { def f(name: String, value: Any): Int } Console println x.f("hi", "high") // varargs Console println (x: Picker).f("hi", "high") // not Disambiguating: public class JOver { public int f(String name, Object value) { return 1; } public int f(String name, Object... values) { return 2; } }
has comment: http://stackoverflow.com/comment/36239048
upvote count: 1
answers question: http://stackoverflow.com/q/23605898
score: 1
has comment: http://stackoverflow.com/comment/36240111
has comment: http://stackoverflow.com/comment/36251346
downvote count: 0
has comment: http://stackoverflow.com/comment/36239687

http://stackoverflow.com/a/58207467
has body: It's working with this code: Scanner input = new Scanner(System.in); System.out.println("Enter Name : "); String name = input.next().toString(); System.out.println("Enter Phone # : "); String phone = input.next().toString();
answers question: http://stackoverflow.com/q/23506429
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/23514691
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23514141
upvote count: 1
has comment: http://stackoverflow.com/comment/36071711
type: Answer
has comment: http://stackoverflow.com/comment/36071545
has body: you can see by doing just reference makes no sense. Flavor comes when you call method on that object where Subclasses of a class can define their own unique behaviors and yet share some of the same functionality of the parent class. The JVM calls the appropriate method for the object that is referred to in each variable. It does not call the method that is defined by the variable's type. This behavior is referred to as 'virtual method invocation' and demonstrates an aspect of the important polymorphism features in the Java language.

http://stackoverflow.com/a/23512515
has comment: http://stackoverflow.com/comment/36065406
has comment: http://stackoverflow.com/comment/36064428
has body: I think the key point would be to let the client of your API create the instance of SlaveWorker (or any subclass), so that he can customize the work() method. IMO you should provide a Worker interface in your API (interface is less constraining than an abstract class): public interface Worker { public void work(Request request, Response response); } And AbstractSlave's method should be like: public abstract class AbstractSlave { private final Worker worker; public AbstractSlave(Worker worker) { this.worker = worker; } final void handle(final Request request, final Response response) // Some operations before starting worker thread. Thread t = new Thread() { public void run() { worker.work(request, response); } }; t.start(); } }
accepted answer of: http://stackoverflow.com/q/23512329
answers question: http://stackoverflow.com/q/23512329
has comment: http://stackoverflow.com/comment/36062188
has comment: http://stackoverflow.com/comment/36062276
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36062186
has comment: http://stackoverflow.com/comment/36064815
has comment: http://stackoverflow.com/comment/36062551
has comment: http://stackoverflow.com/comment/36062344
has comment: http://stackoverflow.com/comment/36065314
type: Answer
has comment: http://stackoverflow.com/comment/36062124
score: 0
has comment: http://stackoverflow.com/comment/36062458

http://stackoverflow.com/a/23508175
answers question: http://stackoverflow.com/q/23506916
type: AcceptedAnswer
has body: The only reason I can think of is that the you Java compliance level set to 1.4. I think it is very probable that this is causing the observed error. Printf didn't exist in Java 1.4 Check that the Compiler compliance level is set to at least 1.5 for your project. This answer shows how to change compliance level in Eclipse
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36054481
accepted answer of: http://stackoverflow.com/q/23506916
downvote count: 0
score: 1

http://stackoverflow.com/comment/36076127
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23520008
has text: possible duplicate of [Why is my Spring @Autowired field null?](http://stackoverflow.com/questions/19896870/why-is-my-spring-autowired-field-null)

http://stackoverflow.com/q/23463802
has comment: http://stackoverflow.com/comment/35977416
has comment: http://stackoverflow.com/comment/35977404
has comment: http://stackoverflow.com/comment/35971959
has body: Sorry first of all if this is basic and I'm missing something obvious, but my professor has given me a bit of an overwhelming project and I need a bit of help. We're supposed to make the board game Trouble (without a GUI). I have a boolean value "playing" that is set to false for the players who are not taking a turn and "true" for the players who are taking a turn. I have methods specific to the player color to check weather the board is clear so that the player can move his/her piece out of the home section when they roll a six, but when I try to run my loop that cycles through the array of players, it tells me that "playing" is set to "true" for all of them. I even manually set "playing" to false right at the beginning of my loop, but that didn't even change it, so maybe something is wrong with my set method? Here is some of my code: public void setPlaying(boolean set) { if (set == false) playing = false; else playing = true; } for (int index = 0; index &lt; totPlayers; index++) { players[index].setPlaying(false); if (players[index].getColor().equals("red") &amp;&amp; players[index].getPlaying()) { Board.checkClearRed(); System.out.println("Player " + index + " is playing"); System.out.println(players[index].getOrder()); } else if (players[index].getColor().equals("blue") &amp;&amp; players[index].getPlaying()) { Board.checkClearBlue(); System.out.println("Player " + index + " is playing"); System.out.println(players[index].getOrder()); } else if (players[index].getColor().equals("green") &amp;&amp; players[index].getPlaying()) { Board.checkClearGreen(); System.out.println("Player " + index + " is playing"); System.out.println(players[index].getOrder()); } else { Board.checkClearYellow(); System.out.println("Player " + index + " is playing"); System.out.println(players[index].getOrder()); } } Pasting seems to have messed up the spacing of my brackets a little bit, but it is still very readable I think. The print methods are in there just for my testing purposes.
tagged with: boolean
has comment: http://stackoverflow.com/comment/35972055
has comment: http://stackoverflow.com/comment/35972215
has title: Why is my boolean value not changing in Java?
type: UnansweredQuestion
answer count: 0
tagged with: java
score: 0
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/35977430

http://stackoverflow.com/comment/36019295
comment on: http://stackoverflow.com/a/23488081
type: Comment
score: 0
type: AnswerComment
has text: Thanks for your answer. Is there any need to check the dependencies or It's all about blindly replace the all .jar files.

http://stackoverflow.com/q/23593980
tagged with: jms
has comment: http://stackoverflow.com/comment/36218880
linked to: http://stackoverflow.com/q/73897990
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/94956546
upvote count: 7
tagged with: spring
has comment: http://stackoverflow.com/comment/36215966
tagged with: activemq-classic
has answer: http://stackoverflow.com/a/23603151
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/36218902
has comment: http://stackoverflow.com/comment/36218861
has comment: http://stackoverflow.com/comment/36230078
has comment: http://stackoverflow.com/comment/36216018
type: Question
answer count: 2
has title: Spring JMS - Exponential message re-delivery policy is ignored
tagged with: spring-jms
downvote count: 0
has body: We're trying to set a re-delivery policy for ActiveMQ using spring jms. We've set an exponential back-off for the re-deliveries, but it seems to be ignored - the intervals between the message re-deliveries are fixed instead of exponentially growing. Does anyone know what might be the problem? This is our spring-jms configuration: &lt;bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" p:brokerURL="${activemq_url}"&gt; &lt;property name="redeliveryPolicy" ref="redeliveryPolicy" /&gt; &lt;/bean&gt; &lt;bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy"&gt; &lt;property name="queue" value="*" /&gt; &lt;property name="initialRedeliveryDelay" value="10000" /&gt; &lt;property name="redeliveryDelay" value="10000" /&gt; &lt;property name="maximumRedeliveries" value="-1" /&gt; &lt;property name="useExponentialBackOff" value="true" /&gt; &lt;property name="backOffMultiplier" value="5" /&gt; &lt;/bean&gt; &lt;bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory" p:targetConnectionFactory-ref="connectionFactory" p:sessionCacheSize="10" /&gt; &lt;!-- A JmsTemplate instance that uses the cached connection and destination --&gt; &lt;bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt; &lt;property name="connectionFactory" ref="cachingConnectionFactory" /&gt; &lt;property name="messageConverter" ref="messageConverter" /&gt; &lt;property name="sessionTransacted" value="true" /&gt; &lt;/bean&gt; &lt;!-- The Spring message listener container configuration --&gt; &lt;jms:listener-container container-type="default" destination-type="queue" connection-factory="connectionFactory" acknowledge="transacted" concurrency="1" cache="consumer"&gt; &lt;jms:listener destination="testQueue" ref="testService" method="onMessage" /&gt; &lt;/jms:listener-container&gt; Thanks! EDIT: This is a log example, the re-deliveries happen every 5 seconds: 11 May 2014 18:52:00 WARN DefaultMess…
has answer: http://stackoverflow.com/a/76304043
favorite count: 0
has comment: http://stackoverflow.com/comment/36215849
has comment: http://stackoverflow.com/comment/36215330

http://stackoverflow.com/q/23472289
has comment: http://stackoverflow.com/comment/35986885
has comment: http://stackoverflow.com/comment/35987066
has title: Extracting zip file with directories in java
tagged with: http://stackoverflow.com/tag/zip
answer count: 0
type: UnansweredQuestion
score: 0
has body: I found some java code online to extract files frop a .zip file. In it, the following snippet occurs: File newFile = new File(entry.getName()); String directory = newFile.getParent(); if (directory == null) { if (newFile.isDirectory()) { break; } } I understand what this piece of code "does" (syntactially speaking), but I don't understand its purpose. Why do you need to break the while loop if there is no parent directory AND the newfile is itself a directory? Also, how can it be there is no parent folder? I thought every file is al created in the working directory and thus always has a "parent"?
tagged with: java
has comment: http://stackoverflow.com/comment/35990170
type: Question

http://stackoverflow.com/q/23598281
has comment: http://stackoverflow.com/comment/36222853
has comment: http://stackoverflow.com/comment/36222949
has comment: http://stackoverflow.com/comment/36223474
has comment: http://stackoverflow.com/comment/36223507
has comment: http://stackoverflow.com/comment/36223146
type: AnsweredQuestion
tagged with: java-2d
has comment: http://stackoverflow.com/comment/36222896
has body: I have several Areas that I need to fill with a color gradient. I have a function that associates a pixel position with its color, like this: (x,y) -&gt; some RGBA color My question is: what part of the Java API would allow me to use such a function to fill my Areas? I have looked into gradients in Java 2D, but I think they are too specific to achieve what I want (they don't accept a function like mine). I tried to understand the Paint/Raster/ColorModel stuff, but it's still very blurry in my mind and I still don't understand if what I want can be represented by a ColorModel. I'm under the impression that the purpose of this class is not to associate a pixel position with its color, but a color representation to another representation, am I right on this? The only viable option I thought of is using a BufferedImage, and use setRGB() on every pixel with my function's value. However, as it's a rectangle, I would have to generate transparent pixels when out of the bounds of my Area, and that might not be the best way regarding performance. Would that be the right way to go, anyway? Are there some more appropriate solutions that I'm missing here? Note: I'm not looking for detailed implementation of a solution, I just want to go in the right direction ;-)
has comment: http://stackoverflow.com/comment/36223528
has comment: http://stackoverflow.com/comment/36222914
type: Question
has comment: http://stackoverflow.com/comment/36222878
tagged with: java
has comment: http://stackoverflow.com/comment/36223576
has comment: http://stackoverflow.com/comment/36222908
has title: How to fill a Shape with pixel->color function in Java 2D?
score: 0
has answer: http://stackoverflow.com/a/23598577
accepted answer: http://stackoverflow.com/a/23598577
has comment: http://stackoverflow.com/comment/36223689
answer count: 1

http://stackoverflow.com/comment/85329998
type: Comment
comment on: http://stackoverflow.com/a/23603511
has text: Lets say the array of numbers is [2 2 3 5 6 7].....the frequency array will be [0 0 2 1 0 1 1 1] ......using your program we get the median as 3...but the correct median is (3+5)/2 = 4
type: AnswerComment
score: 0

http://stackoverflow.com/q/23548198
upvote count: 0
has answer: http://stackoverflow.com/a/23548434
favorite count: 0
has title: how to retrieve datas from database and put them into a multidimensionnal array
has body: i wanted to retrieve all my datas from database and display them in a jtable, i did the retrieving method that return a vector,i displayed them and it worked. but when i want now to create a model that my jtable will use it seems that the model only takes a multidimensionnal array (Object[][] object). the problem is that it was eazy for me to retrive datas and put them in a vector, but now with a multidimensionnal array (Object[][] object) i don't know how to put datas in it and to modify my method so that it return a multidimensionnal array, here is my retrieving method that returns a vector: @SuppressWarnings({ "rawtypes", "unchecked" }) public static Vector recupererListeEtudiant() { Vector vec=new Vector&lt;&gt;(); try { connexion = DriverManager.getConnection(url, login, password); statement = connexion.createStatement(); resultat=statement.executeQuery("select * from Etudiant"); while(resultat.next()) { Vector ligne=new Vector&lt;&gt;(); ligne.add(resultat.getString(1)); ligne.add(resultat.getString(2)); ligne.add(resultat.getString(3)); ligne.add(resultat.getString(4)); ligne.add(resultat.getString(5)); ligne.add(resultat.getString(6)); ligne.add(resultat.getString(7)); ligne.add(resultat.getString(8)); ligne.add(resultat.getString(9)); ligne.add(resultat.getString(10)); ligne.add(resultat.getString(11)); vec.add(ligne); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return vec; }
type: UnansweredQuestion
tagged with: swing
downvote count: 1
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/23548535
type: Question
answer count: 2

http://stackoverflow.com/comment/36016543
comment on: http://stackoverflow.com/q/23465356
score: 0
has text: String timestamp = new Date(System.currentTimeMillis()).toString();
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36052978
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23507380
has text: If you want to print it, use heightarray.toString()

http://stackoverflow.com/a/23507675
score: 6
has comment: http://stackoverflow.com/comment/36053546
has comment: http://stackoverflow.com/comment/36053620
has body: The filter is filtering the stream down to only elements that match the condition number == 7 (i.e. only a single element, which happens to be the Integer 7), then next() returns the first (and only) element. Remember, in order to get the first element from an Iterator, you need to call next() once. If you definitely want the first element after the 7 in this ordered list, you can change your filter to number -&gt; number &gt; 7.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36053495
type: Answer
accepted answer of: http://stackoverflow.com/q/23507660
upvote count: 6
has comment: http://stackoverflow.com/comment/36053659
answers question: http://stackoverflow.com/q/23507660

http://stackoverflow.com/comment/36334059
type: Comment
comment on: http://stackoverflow.com/a/23533832
score: 0
type: AnswerComment
has text: Thanks for your effort.No need to delete your answer.It may help someone else.

http://stackoverflow.com/a/23588181
answers question: http://stackoverflow.com/q/23588081
downvote count: 0
score: 1
upvote count: 1
has body: If you're on a UNIX system, you can pipe the output to /dev/null. Consider a Java file called Test. Usually, you would call this using java Test And thus getting the output send to the screen. Instead of having it sent to the screen, you may just pipe (send) it /dev/null (nothing): java Test &gt; /dev/null
type: Answer

http://stackoverflow.com/comment/108993703
has text: Anyway, the key point here is that a Java storeFence() or loadFence() only has to block compile-time reordering when targeting x86. Just like C++ `std::atomic_thread_fence(std::memory_order_acq_rel)` compiles to zero asm instructions, only a "compiler barrier" that blocks reordering at compile time, Java can only has to do the same thing to get the underlying HW's memory-ordering model. (Related: [When should I use \_mm\_sfence \_mm\_lfence and \_mm\_mfence](https://stackoverflow.com/a/50780314) covers the diff between compile-time vs. runtime ordering.)
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23770837

http://stackoverflow.com/q/23491738
linked to: http://stackoverflow.com/q/13343954
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23494411
tagged with: wildcard-mapping
linked to: http://stackoverflow.com/q/14466733
tagged with: struts2
tagged with: dmi
has body: According this solution Struts2 handle multiple actions... I know the Struts2 DMI can handle multiple acitons in single form easily. Recently, Struts2 turned off DMI mechanism for security issue. Now, we use Wildcard Mappings to map all actions in struts.xml Example: ... In Wildcard Mappings, it has a little problem to deal with mapping multiple actions/methods in single form. <s:form action="actionA/method2" theme="simple" > <s:submit value="lastStep" action="actionA/method1"/> <s:submit value="nextStep" /> </s:form> How can I fix this problem?
has answer: http://stackoverflow.com/a/23494411
answer count: 1
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/36022941
favorite count: 0
has title: How do I handle multiple actions in single form in wildcard action mapping?

http://stackoverflow.com/comment/36167434
has text: each thread extract data from a synchronised queue and pass it to printer. I prepared thread but do not know haw to lauch them after each button press
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23568572

jpype
tag name: jpype
tags question: http://stackoverflow.com/q/23606860
tags question: http://stackoverflow.com/q/23521273
type: Tag

http://stackoverflow.com/q/23469193
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35984153
has comment: http://stackoverflow.com/comment/35984549
tagged with: spring
has comment: http://stackoverflow.com/comment/36015055
has body: It's been a time that I want to deploy my .WAR file on my Tomcat 7 server, in localhost, and every time I want to make it, I have this probleme : SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/my-app-0.1.0]] 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.deployWAR(HostConfig.java:1073) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) I dont know how to bypass this. In fact, I try to create a REST Webservice with Spring. It works fine when I use the tutorial where we have to start the service manually. But when I want to deploy my app witch a war file (with the Spring tutorial build.gradle) it doesnt work... Any idea ? Edit : This is the fully stack-> SEVERE: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/my-app-0.1.0]] 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(StandardHo…
tagged with: java
has comment: http://stackoverflow.com/comment/35990972
has answer: http://stackoverflow.com/a/23519341
type: Question
has title: Deploying War on Tomcat 7 error
tagged with: apache
answer count: 1
tagged with: tomcat
score: 0
tagged with: thymeleaf
has comment: http://stackoverflow.com/comment/36005057
has comment: http://stackoverflow.com/comment/35984757

http://stackoverflow.com/comment/36249401
comment on: http://stackoverflow.com/a/23609113
score: 0
type: Comment
has text: I used the loop above and it fixed everything,thank you.
type: AnswerComment

http://stackoverflow.com/comment/35966971
type: Comment
comment on: http://stackoverflow.com/a/23461166
score: 0
type: AnswerComment
has text: you are doing correct. Where is the issue? what are the inputs?

http://stackoverflow.com/a/23482015
type: Answer
upvote count: 1
has body: You aren't matching a backslahs (\) and an n, you're matching a newline character (represented as \n). There's no need to escape the backslash: Pattern p = Pattern.compile(".*\n.*");
answers question: http://stackoverflow.com/q/23481865
score: 1
accepted answer of: http://stackoverflow.com/q/23481865
has comment: http://stackoverflow.com/comment/36005894
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/a/23525674
type: Answer
has body: Options 2 and 3 are effectively the same assuming the static data is truly unguessable (and the same length etc). If you are seriously concerned about somebody modifying the cookie then option 2 is better as (assuming the secret key is not shared) it would allow you to detect if changes had been made to the cookie and would prevent somebody from changing the cookie and then rerunning the hash to spoof the mac. In practice, if the AES key is not accessible and the data in the cookie has some semantic meaning, you would likely be able to detect modifications to the encrypted cookie as it would decrypt to something meaningless. From a security perspective though, option 2 would provide the greatest assurances that the data hadn't been modified. All of that said, I'm making a number of assumptions about your setup that may or may not be true. Edit I evidently misunderstood the question with regards to the key data and did not clearly state enough of my assumptions. @owlstead's is a better answer.
has comment: http://stackoverflow.com/comment/36094119
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/23525610
score: 0

http://stackoverflow.com/comment/36217330
type: Comment
has text: Thank you for your response, yes, it happens because the thread ends, then the images are shown ( we haven't images yet) and then the images are download! but if I use wait() at the end of the run(), it throws an exception: java.lang.IllegalMonitorStateException: object not locked by thread before wait()
comment on: http://stackoverflow.com/a/23595302
type: AnswerComment
score: 0

http://stackoverflow.com/a/23534883
upvote count: 1
answers question: http://stackoverflow.com/q/23534722
downvote count: 0
type: Answer
has body: There's no special Array-like element in WSDL. WSDL describes XML structure, and in XML any child element can appear many times, so to differ between single elements/array you specify the maxOccurs as more than 1: &lt;xsd:element name="messages" type="xsd:string" maxOccurs="unbounded" minOccurs="0"&gt;&lt;/xsd:element&gt; More about creating contract-first services: Writing Contract-First Web Services
score: 1

http://stackoverflow.com/q/23543003
has body: I want to draw a matrix of rectangles on my ui. The problem is that there is only one rectange, the first one of the matrix, visible. Here is my code: protected void onDraw(Canvas canvas) { Paint p = new Paint(); p.setColor(Color.GRAY); if (w != 0 &amp;&amp; h != 0) { a = w / 11; space = a / 12; System.out.println("w: " + w + ", h: " + h + ", a: " + a + "space: " + space); for (int x = 0; x &lt; 10; x++) { for (int y = 0; y &lt; 15; y++) { System.out.println("canvas.drawRect(new Rect(" + (x*a+(x+1)*space) + ", " + (y*a+(y+1)*space) + ", " + a + ", " + a + "), p);"); canvas.drawRect(new Rect(x*a+(x+1)*space, y*a+(y+1)*space, a, a), p); } } } } This are the fist lines of the output: 05-08 15:04:19.511: I/System.out(26349): w: 1080, h: 1701, a: 98space: 8 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 8, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 114, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 220, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 326, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 432, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 538, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 644, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 750, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 856, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 962, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 1068, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 1174, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 1280, 98, 98), p); 05-08 15:04:19.511: I/System.out(26349): canvas.drawRect(new Rect(8, 1386, 98, 98), p); 05-08 15:04:19.51…
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/23545636
has answer: http://stackoverflow.com/a/23545190
accepted answer: http://stackoverflow.com/a/23545190
has comment: http://stackoverflow.com/comment/36122311
has title: Android Canvas drawRect in loop
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/23545636
has comment: http://stackoverflow.com/comment/36121742
has comment: http://stackoverflow.com/comment/36122753
has comment: http://stackoverflow.com/comment/36123244
type: Question
answer count: 2
tagged with: canvas
has comment: http://stackoverflow.com/comment/36122096
tagged with: android-canvas

http://stackoverflow.com/comment/36019331
comment on: http://stackoverflow.com/a/23489558
type: AnswerComment
score: 0
type: Comment
has text: <util:map id="esbJmsEnvironment"> <entry key="java.naming.factory.initial" value="${jms.factory.initial}" /> <entry key="java.naming.provider.url" value="${esb.jms.provider.url}"/> <entry key="java.naming.security.principal" value="${esb.jms.user.name}"/> <entry key="java.naming.security.credentials" value-ref="jmsPwd"/> </util:map>

http://stackoverflow.com/comment/36192442
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23580544
has text: Thank's for your response.. and that's working exactly.. i try to open sqldeveloper on linux now and work properly

http://stackoverflow.com/q/23473567
linked to: http://stackoverflow.com/q/12157300
upvote count: 1
has comment: http://stackoverflow.com/comment/35989451
favorite count: 0
possible better answer: http://stackoverflow.com/a/23473641
accepted answer: http://stackoverflow.com/a/23473590
has answer: http://stackoverflow.com/a/23473641
has answer: http://stackoverflow.com/a/23473684
answer count: 4
type: AnsweredQuestion
has title: hash map and arrayList
downvote count: 0
has answer: http://stackoverflow.com/a/23473590
score: 1
tagged with: java
has body: look at this small example import java.util.ArrayList; import java.util.HashMap; public class Foo { public static void main(String[] args) { ArrayList&lt;Integer&gt; array = new ArrayList&lt;Integer&gt;(); HashMap&lt;String, ArrayList&lt;Integer&gt;&gt; foo = new HashMap&lt;String,ArrayList&lt;Integer&gt;&gt;(); for (int i = 0; i &lt; 20; i++) array.add(i); foo.put("1", array); // array.clear(); System.out.println(foo.get("1").size()); } } Now, if use array.clear() it automatically delete all values of the arrayList associated with the specified key inside the hashmap how can I prevent this? in such a way that: I can perform array.clear(); (after entering values ​​in hashmap) and only delete the values of ArrayList&lt;Integer&gt; array The values ,​​of the array associated with that key, won't deleted inside the hashmap if you launch this program,it will print 20 without using array.clear();, 0 instead
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/35989503
has comment: http://stackoverflow.com/comment/35989279
has answer: http://stackoverflow.com/a/23473664
tagged with: arraylist

http://stackoverflow.com/q/23585088
possible better answer: http://stackoverflow.com/a/23585302
score: 0
accepted answer: http://stackoverflow.com/a/23585525
answer count: 2
has answer: http://stackoverflow.com/a/23585302
has title: Android Studio Unknown Class
tagged with: android-studio
linked to: http://stackoverflow.com/q/19856865
tagged with: android
has body: When I declare double variables, and later try to assign values to them, it says unknown class . Secondly, any method calls from objects I have created say cannot resolve symbol . My code: private double xCurrentPos, yCurrentPos; private ImageView test = (ImageView) findViewById(R.id.square); xCurrentPos = test.getLeft(); yCurrentPos = test.getTop(); This code says that xCurrentPos and yCurrentPos are both unknown classes and that it cannot resolve getLeft or getTop. Any help would be greatly appreciated. :)
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23585525
tagged with: java
type: Question

postgresql
tags question: http://stackoverflow.com/q/23515259
tags question: http://stackoverflow.com/q/23541571
tags question: http://stackoverflow.com/q/23604713
tags question: http://stackoverflow.com/q/23512643
tags question: http://stackoverflow.com/q/23545362
tags question: http://stackoverflow.com/q/23542022
tags question: http://stackoverflow.com/q/23558568
tags question: http://stackoverflow.com/q/23485663
tags question: http://stackoverflow.com/q/23583088
tag name: postgresql
tags question: http://stackoverflow.com/q/23531713
tags question: http://stackoverflow.com/q/23507119
tags question: http://stackoverflow.com/q/23613724
tags question: http://stackoverflow.com/q/23530658
tags question: http://stackoverflow.com/q/23522400
type: Tag
tags question: http://stackoverflow.com/q/23523407
tags question: http://stackoverflow.com/q/23495990
tags question: http://stackoverflow.com/q/23551326
tags question: http://stackoverflow.com/q/23472299
tags question: http://stackoverflow.com/q/23533093

http://stackoverflow.com/comment/36196913
comment on: http://stackoverflow.com/q/23584537
score: 0
has text: What do you have so far?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23484181
downvote count: 2
upvote count: 1
answers question: http://stackoverflow.com/q/23483899
type: Answer
has body: Please read the following article on "Escape Sequences". http://en.wikipedia.org/wiki/Escape_sequences_in_C Here is a small method in Java: private boolean equalsDoubleQuote(String string) { /* * The compiler will not be able to read three double-quote characters in * align. * In this case, you use a the back-slash character. * It will 'escape' the character after it, allowing the compiler to * read it properly */ return string.equals("\""); } The following encapsulation will not work because the compiler will find the first */ and stop the block comment there, expecting the following the text to be code. This is obviously not the best comparison (because you cannot escape a string, */). The concept should be clear though. void example() { /* * * What does the compiler do when I place * * a */ right here * */ }
score: -1

http://stackoverflow.com/a/23551815
type: Answer
has comment: http://stackoverflow.com/comment/36137086
has comment: http://stackoverflow.com/comment/36172257
has comment: http://stackoverflow.com/comment/36169612
score: 0
has body: You can't use the value you entered, because it is outside of the limit of Integer. Use the radix 2 to convert it on Java 6. This will fail System.out.println(Integer.parseInt("11001001111001010010010010011010", 2)); with Exception in thread "main" java.lang.NumberFormatException: For input string: "11001001111001010010010010011010" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:495) at Test.main(Test.java:7) But this will work System.out.println(Long.parseLong("11001001111001010010010010011010", 2)); the output will be 3387237530
answers question: http://stackoverflow.com/q/23551540

http://stackoverflow.com/comment/36091704
has text: I know, still from my tests I don't trust it and use it as external component instead of using it next to hibernate.
comment on: http://stackoverflow.com/q/23527856
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23600959
tagged with: network-programming
score: 0
has body: I am doing a project on networks and I'm stuck in adding objects to linked list. If I get any assistance I'll be grateful. I have 7 different classes Source,Sink,Node_A,Node_B,Node_C,Node_D,Node_E which extends Node class. I am trying to add the objects of above 7 classes by using LinkedList in util package,but in vain. Also, I want to know whether we can give virtual address to Node, if yes then how? Any assistance will help me to finish this project and I'll be very grateful, thank you in advance. Code Snippet: Node class: import java.util.LinkedList; public class Node{ static LinkedList&lt;Node&gt; List1=new LinkedList&lt;Node&gt; (); } Source class: public class Source extends Node{ Node src=new Source(); Node.List1.addFirst(src); } Node_A class: public class Node_A extends Node{ Node na=new Node_A(); Node.List1.add(na); } Node_B class: public class Node_B extends Node{ Node nb=new Node_A(); Node.List1.add(nb); } Sink class: public class Sink extends Node{ Node snk=new Sink(); Node.List1.addLast(snk); }
has title: How to add objects from different class into a doubly linked list
has comment: http://stackoverflow.com/comment/36337129
has comment: http://stackoverflow.com/comment/36240279
tagged with: doubly-linked-list
has comment: http://stackoverflow.com/comment/36336903
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/36336698
has comment: http://stackoverflow.com/comment/36242473
has comment: http://stackoverflow.com/comment/36426274
has comment: http://stackoverflow.com/comment/36337156
has comment: http://stackoverflow.com/comment/36301802
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36227709
has comment: http://stackoverflow.com/comment/36268670
type: Question
has comment: http://stackoverflow.com/comment/36316813

geometry
tags question: http://stackoverflow.com/q/23554966
tags question: http://stackoverflow.com/q/23548473
type: Tag
tags question: http://stackoverflow.com/q/23543804
tag name: geometry

http://stackoverflow.com/comment/35977594
type: Comment
comment on: http://stackoverflow.com/q/23467112
score: 0
has text: Have you imported the package containing NavUtils ?
type: QuestionComment

http://stackoverflow.com/a/23547741
answers question: http://stackoverflow.com/q/23547718
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/23547718
type: AcceptedAnswer
type: Answer
has body: You are missing quantifier + which would make sure to match 1 or of those characters in your character class: Use this: boolean result = value.matches("[a-zA-Z0-9_-]+"); Or even better: boolean result = value.matches("[\\w-]+"); Since \w is equivalent of [a-zA-Z0-9_]
upvote count: 4

http://stackoverflow.com/comment/36250545
score: 0
type: Comment
type: QuestionComment
has text: What rule creates `TapeLinux.h`? Also your `BasicTapeDevice.h` rule is using a compatibility feature of GNU make and not an primary one. `$*` is the "stem" of the pattern rule that matched. In a non-pattern rule (like yours) it is also defined to be the target name without the (recognized) suffix but that is, according to the manual, a compatibility feature and not one to depend on.
comment on: http://stackoverflow.com/q/23612450

http://stackoverflow.com/comment/36104677
comment on: http://stackoverflow.com/q/23534851
score: 0
has text: Googling for "java integer number too large 08" gives many results from which the answer could easily have been derived. Additionally, there are some duplicate questions on SO. So, why got this question upvoted?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23591222
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23590420
has comment: http://stackoverflow.com/comment/36295104
answers question: http://stackoverflow.com/q/23590420
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/36578811
has comment: http://stackoverflow.com/comment/36503999
has comment: http://stackoverflow.com/comment/36506860
has body: You can use MIME type records to store images on NFC tags. If, for instance, your image is a JPEG image, you would use the MIME type "image/jpeg". You NDEF record could then look like this: +----------------------------------------+ + MB=1, ME=1, CF=0, SR=0, IL=0, TNF=MIME + +----------------------------------------+ + Type Length = 10 + +----------------------------------------+ + Payload Length = N + +----------------------------------------+ + image/jpeg + +----------------------------------------+ + &lt;Your image data (N bytes)&gt; + +----------------------------------------+ On Android, you could create such a record using byte[] myImage = ...; NdefRecord myImageRecord = NdefRecord.createMime("image/jpeg", myImage); Or using the constructor of NdefRecord: byte[] myImage = ...; NdefRecord myImageRecord = new NdefRecord( NdefRecord.TNF_MIME_MEDIA, "image/jpeg".getBytes("US-ASCII"), null, myImage ); Once you have a Tag handle of an NDEF tag (i.e. through receiving and NFC discovery intent), you could then write the NDEF record to the tag: NdefMessage ndefMsg = new NdefMessage(new NdefRecord[] { myImageRecord }); Tag tag = ...; Ndef ndefTag = Ndef.get(tag); if (ndefTag != null) { ndefTag.connect(); ndefTag.writeNdefMessage(ndefMsg); ndefTag.close(); } else { NdefFormatable ndefFormatable = NdefFormatable.get(tag); if (ndefFormatable != null) { ndefFormatable.connect(); ndefFormatable.format(ndefMsg); ndefFormatable.close(); } }
score: 4
has comment: http://stackoverflow.com/comment/36243798

http://stackoverflow.com/comment/36011861
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23485338
has text: I am not sure, but I believe the problem is that you must have some placeholder in your DOM to update with the HTML you're getting from your request. Usually, that's what AJAX is for. To retrieve small portions of data to update in your DOM.
score: 1

http://stackoverflow.com/comment/36229429
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23601443
has text: yea i got it..you are doing calculation and reading text value before entering the values in text so its coming as 0.0/0.0...so move the reading and calculation code inside the ok listener action performed method...see updated same answer

http://stackoverflow.com/a/23509243
has comment: http://stackoverflow.com/comment/36057471
has comment: http://stackoverflow.com/comment/36057812
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36057644
has body: IMHO the above code will STILL NOT compile even if you add the missing brace for main method. In order to make it compile you need to do it like this Without brace for FOR loop class TreeCutter { public static void main ( String [] args ){ TreeCutter TC ; for( int i = 0 ; i &lt; testCaseNum ; i ++ ) TC = new TreeCutter( commandPrompt ); } } With Brace for FOR loop class TreeCutter { public static void main ( String [] args ){ for( int i = 0 ; i &lt; testCaseNum ; i ++ ) { TreeCutter TC = new TreeCutter( commandPrompt ); } } } As far as GC is concerned the scope of the TC is in for loop only. So until you pass the TC out of for loop it will be eligible for GC the moment next iteration of for loop runs
has comment: http://stackoverflow.com/comment/36056786
has comment: http://stackoverflow.com/comment/36056763
answers question: http://stackoverflow.com/q/23509052
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/23509052
has comment: http://stackoverflow.com/comment/36056920
downvote count: 0
has comment: http://stackoverflow.com/comment/36057023

http://stackoverflow.com/comment/36207358
type: AnswerComment
comment on: http://stackoverflow.com/a/23590145
type: Comment
score: 0
has text: @Danrex that was the problem. It happens to all of us when beginning programming.

http://stackoverflow.com/comment/36247752
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23607827
has text: Sorry what do you mean "not subject to be GCed"?

http://stackoverflow.com/comment/36017026
comment on: http://stackoverflow.com/a/23471942
score: 0
type: Comment
has text: this would of course work @Naveen. now the packDemo.class is part of the package itself, i wanted it to be a part of another package only as i have made Simple1 as a public class.
type: AnswerComment

http://stackoverflow.com/q/23458971
favorite count: 0
has comment: http://stackoverflow.com/comment/35962581
tagged with: android
has body: I have been struggling with search feature in android for days. Unable to pinpoint the bug. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_exclude_list); ....... SearchView searchView = (SearchView)findViewById(R.id.options_menu_main_search); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); if(null!=searchManager ) { searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); } handleIntent(getIntent()); } @Override public void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent); handleIntent(intent); } private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); Log.i("q",query); } } searchable.xml &lt;searchable xmlns:android="http://schemas.android.com/apk/res/android" android:hint="@string/search_hint" android:includeInGlobalSearch="false" android:label="@string/app_name" android:searchSettingsDescription="@string/search_hint" /&gt; Menu.xml &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;!-- Search, should appear as action button --&gt; &lt;item android:id="@+id/options_menu_main_search" android:actionViewClass="android.support.v7.widget.SearchView" android:icon="@drawable/ic_action_search" android:showAsAction="always" android:title="Search"/&gt; &lt;/menu&gt; Manifest &lt;activity android:name="com.xyz.Exclude_list" android:label="@string/title_activity_exclude_list" android:screenOrientation="portrait" android:launchMode="singleTop"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.SEARCH" /&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="android.app.searchable" android:resource="@xml/searchable" android:value=".app.Search" /&gt; &lt;/activity&gt; Error Caused by: java.lang.NullPoin…
has comment: http://stackoverflow.com/comment/35962726
accepted answer: http://stackoverflow.com/a/23459126
has comment: http://stackoverflow.com/comment/35962617
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35962688
has comment: http://stackoverflow.com/comment/35962548
has comment: http://stackoverflow.com/comment/35962621
tagged with: android-searchmanager
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35962851
upvote count: 1
has comment: http://stackoverflow.com/comment/35962663
has comment: http://stackoverflow.com/comment/35962715
type: Question
has title: Search in Android not working
has comment: http://stackoverflow.com/comment/35962502
has comment: http://stackoverflow.com/comment/35962912
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/23459126
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/36003443
comment on: http://stackoverflow.com/q/23480792
score: 1
has text: This is not a website where you paste your code and ask for "help". You need to formulate an actual question, posting only the relevant code.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36010193
type: AnswerComment
has text: That works for one result - swapped it to be if(resultSet.next()). What would I do if i had more than one result returned?
type: Comment
comment on: http://stackoverflow.com/a/23484351
score: 0

http://stackoverflow.com/q/23551540
tagged with: type-conversion
upvote count: 2
answer count: 3
tagged with: java-6
has comment: http://stackoverflow.com/comment/36135504
possible better answer: http://stackoverflow.com/a/23552292
favorite count: 0
tagged with: binary
has body: I have this binary value : 11001001111001010010010010011010. In java 7, if I declare: int value = 0b11001001111001010010010010011010; and print the value I get -907729766. How can I achieve this in Java 6 as well?
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/10512699
has comment: http://stackoverflow.com/comment/36135468
has answer: http://stackoverflow.com/a/23551815
type: Question
has comment: http://stackoverflow.com/comment/36135560
linked to: http://stackoverflow.com/q/10961091
has title: Binary value in java 6
has answer: http://stackoverflow.com/a/23551690
accepted answer: http://stackoverflow.com/a/23551690
has comment: http://stackoverflow.com/comment/36135691
has answer: http://stackoverflow.com/a/23552292

http://stackoverflow.com/comment/36194358
comment on: http://stackoverflow.com/a/23582925
type: AnswerComment
has text: JAva as a Stack you don't have to implement it , have a look at the DQueue interface and for parsing a String have a look at the Scanner class
score: 0
type: Comment

http://stackoverflow.com/a/23573813
answers question: http://stackoverflow.com/q/23573545
type: Answer
score: 0
has body: The answer has as much to do with passing by reference or value as it does with which variables are in scope when you attempt to make the change. When you pass "a," or any variable to a method, you pass the value of that variable - in other words a copy of what it represents- and not the actual variable itself. For example: public static void main(String[] args){ int a = 3; addTwo(a); System.out.println(a); } private void addTwo(int a){ a += 2; } In the above example the value 3 is passed to addTwo. The variable "a" in the main method is outside of its scope (i.e. it is localized to the main method) so the addTwo method acts only on the copy of "a," the value 3, and not the variable. The variable "a" remains unchanged. When the method completes the value of a is discarded and the original "a" in the main method remains unchanged. This is the same thing that is happening in your case. It does not matter that you use the same name for two variables. The variable in your main method will not be changed.

http://stackoverflow.com/q/23462188
favorite count: 0
has comment: http://stackoverflow.com/comment/35968646
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36032752
has title: Java Rookie Rocket Scientist
has comment: http://stackoverflow.com/comment/35968697
has comment: http://stackoverflow.com/comment/35968661
tagged with: java
has answer: http://stackoverflow.com/a/23462262
downvote count: 1
has body: I'm starting to learn Java. I have some experience with other languages. With some perseverance this will be the first of many questions. I'm looking for input methods for my Java applications. The following code is the first example of the course book: public static void main(String)[] args) { int num; System.out.println("Write a number: "); num = Entrada.entero(); } } It gives compiling error in "Entrada". I think it's waiting a Class, although there's no description of such class in the textbook I'm following.
has comment: http://stackoverflow.com/comment/35968653
type: Question
has answer: http://stackoverflow.com/a/23462421
score: -1
has comment: http://stackoverflow.com/comment/35968637
has comment: http://stackoverflow.com/comment/35968707
answer count: 2
upvote count: 0

http://stackoverflow.com/q/23543798
tagged with: servlets
tagged with: browser
has body: I am working on jsp/servlet web application. Can browser(jsp page) detect any (exe)application is installed or not on client machine? same as iTune. Requirement: Detect from browser whether any (exe) application is installed on client machine or not. Thanks
tagged with: jsp
has title: How to detect if any exe application is installed on client machine through browser
favorite count: 0
has comment: http://stackoverflow.com/comment/36233861
type: UnansweredQuestion
tagged with: cross-browser
answer count: 0
has comment: http://stackoverflow.com/comment/36120798
score: 0
has comment: http://stackoverflow.com/comment/36122149
upvote count: 1
downvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/a/23512926
has comment: http://stackoverflow.com/comment/36062851
has body: You need to move the ARRAY outside of the for loop List&lt;String&gt; ARRAY = new ArrayList&lt;String&gt;(); // maybe as a class field for (String n2 : number ) { if (!ARRAY.contains(n2)) { Email(n2); ARRAY.add(n2); } }
answers question: http://stackoverflow.com/q/23512895
has comment: http://stackoverflow.com/comment/36063084
has comment: http://stackoverflow.com/comment/36063054
has comment: http://stackoverflow.com/comment/36096640
score: 0
has comment: http://stackoverflow.com/comment/36062911
type: Answer
has comment: http://stackoverflow.com/comment/36063327

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/23605455
tags question: http://stackoverflow.com/q/23604775
tags question: http://stackoverflow.com/q/23601442
tags question: http://stackoverflow.com/q/23555500
tags question: http://stackoverflow.com/q/23519223
tags question: http://stackoverflow.com/q/23579040
tags question: http://stackoverflow.com/q/23553753
tags question: http://stackoverflow.com/q/23466541
tags question: http://stackoverflow.com/q/23545583
tags question: http://stackoverflow.com/q/23513936
tags question: http://stackoverflow.com/q/23524432
tags question: http://stackoverflow.com/q/23475818
type: Tag
tags question: http://stackoverflow.com/q/23517930
tags question: http://stackoverflow.com/q/23604612
tags question: http://stackoverflow.com/q/23589709
tags question: http://stackoverflow.com/q/23522010
tags question: http://stackoverflow.com/q/23523459
tags question: http://stackoverflow.com/q/23574995
tags question: http://stackoverflow.com/q/23577636
tags question: http://stackoverflow.com/q/23548129
tags question: http://stackoverflow.com/q/23458549
tags question: http://stackoverflow.com/q/23527810
tags question: http://stackoverflow.com/q/23458581
tags question: http://stackoverflow.com/q/23495222
tags question: http://stackoverflow.com/q/23543158
tags question: http://stackoverflow.com/q/23565635
tags question: http://stackoverflow.com/q/23491021
tags question: http://stackoverflow.com/q/23599726
tags question: http://stackoverflow.com/q/23466128
tags question: http://stackoverflow.com/q/23608085
tags question: http://stackoverflow.com/q/23541860
tags question: http://stackoverflow.com/q/23532543
tags question: http://stackoverflow.com/q/23474373
tags question: http://stackoverflow.com/q/23516207
tags question: http://stackoverflow.com/q/23500530
tag name: html
tags question: http://stackoverflow.com/q/23527077
tags question: http://stackoverflow.com/q/23457942
tags question: http://stackoverflow.com/q/23517975
tags question: http://stackoverflow.com/q/23615091
tags question: http://stackoverflow.com/q/23489526

http://stackoverflow.com/comment/36229067
has text: Thank you. Your solution helped. If I get some doubts on inserting 4th page and adding components to it. I will post questions here again.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23581785

http://stackoverflow.com/a/25000282
accepted answer of: http://stackoverflow.com/q/23514301
answers question: http://stackoverflow.com/q/23514301
type: AcceptedAnswer
has body: We've had the same problem, but we had to delete and re-import the project in order to fix it: App Engine was enabled in preferences, which made it add a whole bunch of libraries when we checked out Android project from repository. The error wouldn't go away after fixing build path. Our solution (we had a working Android project in repository): Remove App Engine from Eclipse Preferences Delete project Check out the project from repository Re-add App Engine You could also try the following after removing App Engine: Remove project from workspace, then import it again Close and Open project in Eclipse (right-click, close project)
score: 0
type: Answer

http://stackoverflow.com/q/23549262
has comment: http://stackoverflow.com/comment/36131172
has comment: http://stackoverflow.com/comment/36131830
answer count: 3
has body: I have the following auto-generated code: EDIT: It's auto-generated so I'm not allowed to modify it. (If only it were that easy...) abstract class Foo { } class Fuwa extends Foo { String chocolate() {...} String muffin() {...} } class Fuko extends Foo { String chocolate() {...} String cookie() {...} } The chocolate() method in both the child classes are literally (aside from variable names) line-for-line identical and essentially interchanable. Based on client input, I want test the specified children of Foo and validate the response. Currently I have: class FooFactory { Foo createFoo(name) { if (name.equals("fuwa")) { ... // returns a Fuwa object } else if (name.equals("fuko")) { ... // returns Fuko object } } } class MuffinTester extends FooTester { boolean test(Foo inputFoo) { Result x = ((Fuwa) inputFoo).muffin(); return validate(x); } private validate(x) {...} } class CookieTester extends FooTester { boolean test(Foo inputFoo) { Result x = ((Fuko) inputFoo).cookie(); return validate(x); } private validate(x) {...} } class TesterFactory { FooTester createTest(name) { if (name.equals("muffin")) { ... // returns MuffinTester object } else if (name.equals("cookie")) { ... // returns CookieTester object } else if (name.equals("chocolate")) { ... // returns ChocolateTester object } } } The client specifies the Foo and method to be tested and the FooFactory and TestFactory (respectively) instantiate the required objects (there is logic to make sure the request is valid and the Foo contains the method, eg. no testing cookie() on Fuwa). The problem arises when I try to code ChocolateTester: class ChocolateTester extends FooTester { boolean test(Foo inputFoo) { Result x = ((???) inputFoo).chocolate(); return validate(x); } private validate(x) {...} } I can't leave inputFoo as just Foo since the compiler doesn't like that it doesn't have a chocolate() method. And I can't cast inputFoo to Fuwa or Fuko since whichever one I don't cast it to gets annoyed that they're being c…
has comment: http://stackoverflow.com/comment/36131651
has answer: http://stackoverflow.com/a/23550024
score: 0
has answer: http://stackoverflow.com/a/23568956
accepted answer: http://stackoverflow.com/a/23568956
has comment: http://stackoverflow.com/comment/36133069
has answer: http://stackoverflow.com/a/23550699
has comment: http://stackoverflow.com/comment/36131504
has comment: http://stackoverflow.com/comment/36149187
has comment: http://stackoverflow.com/comment/36135368
type: Question
possible better answer: http://stackoverflow.com/a/23550024
type: AnsweredQuestion
has title: How to handle children classes with common method not in parent class?
tagged with: java

http://stackoverflow.com/comment/36043943
type: AnswerComment
type: Comment
has text: We're using maven. It is showing a classpath of nearly 300 entries, of which 4 jars have "jpa" in the name. At first glance, it looks like JPA 2.0 should be the one that wins, but I'd better take a second glance.
comment on: http://stackoverflow.com/a/23502079
score: 0

http://stackoverflow.com/comment/35984820
has text: @IanRoberts. So it means that the following reorderings `volatileInt = 80;nonVolatileInt = 90 ; flag = true` and `flag = true;volatileInt = 80 ; nonVolatileInt = 80` is not possible? In short, Whatever code is written above the volatile write (i.e `volatileInt=80`) can't be reordered with respect to the codes written above it or codes written below it ....
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23470842
type: QuestionComment

http://stackoverflow.com/a/23634820
upvote count: 1
answers question: http://stackoverflow.com/q/23612450
score: 1
has body: Thanks guys for your help I solved the problem modifying the makefile Here the result # Define a variable for classpath CLASS_PATH = ../bin # Define a virtual path for .class in the bin directory vpath %.class $(CLASS_PATH) all : libTape.so # $@ matches the target, $&lt; matches the first dependancy libTape.so : TapeJNI.o gcc -shared -fpic -o $@ $&lt; # $@ matches the target, $&lt; matches the first dependancy TapeJNI.o : TapeJNI.c TapeJNI.h gcc -fpic -I"/home/tanio/DevelopmentEnvironment/jdk1.7.0_51/include" -I"/home/tanio/DevelopmentEnvironment/jdk1.7.0_51/include/linux" -c $&lt; -o $@ # $* matches the target filename without the extension TapeJNI.h : TapeJNI.class javah -classpath $(CLASS_PATH) $* clean : rm TapeJNI.h TapeJNI.o libTape.so I have compiled it with another name sorry if it does not match
has comment: http://stackoverflow.com/comment/65561291
downvote count: 0
type: Answer

communication
tag name: communication
tags question: http://stackoverflow.com/q/23551673
type: Tag

http://stackoverflow.com/comment/36021655
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23477646
has text: I tested on my phone, it is on jelly bean and complex scripts work fine on it. I think I will target the android 4.0+ phones only.

http://stackoverflow.com/a/23535991
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/36108776
has body: You can create your custom Button class by extending JButton. Then you have to rewrite the paintComponent(Grapgics g) mehtod to draw your button like you want.
answers question: http://stackoverflow.com/q/23535310
score: 3
has comment: http://stackoverflow.com/comment/36111056
downvote count: 0

http://stackoverflow.com/comment/35971908
score: 0
has text: This is done to try and stop you from doing what you're trying do ;)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23463773

http://stackoverflow.com/q/23590116
has comment: http://stackoverflow.com/comment/36207199
has comment: http://stackoverflow.com/comment/36207138
score: 0
has comment: http://stackoverflow.com/comment/36207112
tagged with: sql
answer count: 1
tagged with: insert
accepted answer: http://stackoverflow.com/a/23590145
linked to: http://stackoverflow.com/q/3271249
has body: So I am having a slight problem inserting values into a table I created in netbeans. I will show you the code that works and creates a new worker in the table and then show you what goes wrong when I try to change it. This is a method from a class called dbConnect.java public void insertTableRow() { try { Connection con = DriverManager.getConnection(host, uName, uPass); Statement stmt = con.createStatement(); String SQL = "INSERT INTO Workers VALUES (10, 'John', 'Smith', 'Engineer')"; stmt.executeUpdate(SQL); } catch (SQLException err) { System.out.println(err.getMessage()); } } And is here where I call it in the main class. dbConnect test = new dbConnect(); test.insertTableRow(); And then I get a John Smith appears so I know I have the right code. BUT when I try to enter in variables into VALUES it all falls apart. i.e. public void insertTableRow(int id, String firstName, String lastName, String jobTitle) { try { int num = id; String fName = firstName; String lName = lastName; String jTitle = jobTitle; Connection con = DriverManager.getConnection(host, uName, uPass); Statement stmt = con.createStatement(); String SQL = "INSERT INTO Workers VALUES (num, fName, lName, jTitle)"; stmt.executeUpdate(SQL); } catch (SQLException err) { System.out.println(err.getMessage()); } } Combined with - dbConnect test = new dbConnect(); test.insertTableRow(10, "John", "Smith", "Doctor"); System.out.println(test.getTableContents()); The error I get back is:- Column 'NUM' 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 'NUM' is not a column in the target table. So what am doing wrong because I have absolutely no idea?
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/36207187
has title: Insert declared variables into db Table using Java
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/23590145
tagged with: database

http://stackoverflow.com/q/23505367
tagged with: java
tagged with: roboguice
has answer: http://stackoverflow.com/a/23617038
accepted answer: http://stackoverflow.com/a/23617038
has title: Roboguice crasshes app at launch
upvote count: 1
tagged with: guice
answer count: 1
favorite count: 0
tagged with: android
type: AnsweredQuestion
downvote count: 0
has body: This is weird. I used Roboguice 2.0 in all my recent projects with same libs and all seemd fine. I started brand new project and there came some creepy error out of (...) nowhere at the launch of my app. I searched everywhere, starting from SO, but all issues coresponding to this error where old or solutions didn't work. Golden nail from Jaime Lannister's hand for answer to this nightmare! I use Android Studio and libs: - guice-3.0-no_aop - javax.inject-1 - jsr305-1.3.9 - roboguice-2.0 - in other modules there are Spring-for-android-REST and GreenDao libs, if it matters Class extending application: public class JudgementSearcherApp extends Application { @Inject private InitAppCommand initApp; @Override public void onCreate() { super.onCreate(); setup(); } private void setup() { RoboGuice.setBaseApplicationInjector(this, RoboGuice.DEFAULT_STAGE, RoboGuice.newDefaultRoboModule(this), new JSGuiceModule()); RoboGuice.injectMembers(this,this); initApp.execute(JudgementSearcherApp.this); } } Error: com.rudearts.judgementsearcher E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to create application com.rudearts.judgementsearcher.JudgementSearcherApp: com.google.inject.CreationException: Guice creation errors: 1) Error injecting constructor, java.lang.NullPointerException at com.rudearts.judgementsearcher.core.managers.LawCaseManager.(Unknown Source) at com.rudearts.judgementsearcher.core.managers.LawCaseManager.class(Unknown Source) while locating com.rudearts.judgementsearcher.core.managers.LawCaseManager for field at com.rudearts.judgementsearcher.controller.setup.commands.LoadLastUpdateDateCommand.lawCaseState(Unknown Source) while locating com.rudearts.judgementsearcher.controller.setup.commands.LoadLastUpdateDateCommand for field at com.rudearts.judgementsearcher.controller.setup.commands.InitAppCommand.loadDate(Unknown Source) while locating com.rudearts.judgementsearcher.controller.setup.commands.InitAppCommand for field at com.rudearts.ju…
score: 1
tagged with: gradle
type: Question

http://stackoverflow.com/comment/36093612
type: QuestionComment
has text: Yeah, you need to deep copy if you need to deep copy. (And, as far as I know, there is no in-built "deep copy" function in Cloneable, et al.)
comment on: http://stackoverflow.com/q/23528725
score: 0
type: Comment

http://stackoverflow.com/comment/36115156
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23540697
score: 1
has text: That is a very tricky question. I think the downvoters have not thought enough about how to process this exotic input format. Therefore my upvote for the question.

http://stackoverflow.com/comment/35977704
type: AnswerComment
score: 0
has text: @MadProgrammer, Input is in Date not String, so parsing is not required here.
type: Comment
comment on: http://stackoverflow.com/a/23467189

http://stackoverflow.com/comment/92832883
comment on: http://stackoverflow.com/a/49544543
score: 3
has text: Would `application.properties` run if profile is set to `production`?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36210570
has text: If you mean the `while` loop in your first code block, how do you know it's not getting there? Maybe it's just waiting for a connection. `accept` is a blocking operation...
comment on: http://stackoverflow.com/q/23591935
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/23551684
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23550817
answers question: http://stackoverflow.com/q/23550817
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36136081
has comment: http://stackoverflow.com/comment/36138059
has body: how about the following: // assume students.length &gt; 0 static void printMinMax(Student[] students) { Student min = students[0]; Student max = students[0]; for (Student student: students) { if (student.getGrade() &gt; max.getGrade()) max = student; if (student.getGrade() &lt; min.getGrade()) min = student; } System.out.println("Best student: " + max); System.out.println("Worst student: "+ min); } On another note, you should really consider using Collections instead of plain arrays. Especially since you do not really know the number of students beforehand. Above code could be rewritten like this: static void printMinMax(List&lt;Student&gt; students) { Comparator&lt;Student&gt; comparator = new Comparator&lt;&gt;() { @Override public int compare(Student s1, Student s2) { return s1.getGrade() - s2.getGrade(); } }; Student max = Collections.max(students, comparator); Student min = Collections.min(students, comparator); // print stuff } or shorter using java 8 lambdas: static void printMinMax(List&lt;Student&gt; students) { Comparator&lt;Student&gt; comparator = (s1, s2) -&gt; s1.getGrade() - s2.getGrade(); Student max = Collections.max(students, comparator); Student min = Collections.min(students, comparator); // print stuff }
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36137910

tcp
type: Tag
tags question: http://stackoverflow.com/q/23498638
tags question: http://stackoverflow.com/q/23487849
tags question: http://stackoverflow.com/q/23458344
tags question: http://stackoverflow.com/q/23568641
tags question: http://stackoverflow.com/q/23480783
tags question: http://stackoverflow.com/q/23607107
tags question: http://stackoverflow.com/q/23566162
tags question: http://stackoverflow.com/q/23534699
tags question: http://stackoverflow.com/q/23464351
tags question: http://stackoverflow.com/q/23613344
tags question: http://stackoverflow.com/q/23604234
tags question: http://stackoverflow.com/q/23471880
tags question: http://stackoverflow.com/q/23607385
tags question: http://stackoverflow.com/q/23487558
tag name: tcp

http://stackoverflow.com/q/23520149
score: 0
has comment: http://stackoverflow.com/comment/36076199
answer count: 1
tagged with: java
type: UnansweredQuestion
type: Question
tagged with: sockets
has answer: http://stackoverflow.com/a/23534616
has title: Java guessing number with sockets server-client
has body: server socket is created and waits for a client to connect. Once the client connects, it has to guess the number that was generated on the server. If not, will ask the number continuously. SERVER: package pruebas; import java.net.*; import java.io.*; public class server { public static void main(String[] args) throws IOException { int num_aleatorio = generarNumAleatorio(); //genera un número aleatorio int num_usuario=0; int intentos=0; boolean adivinado = false; System.out.println("Generated number: " + num_aleatorio); ServerSocket server_socket = null; //server_socket de tipo sevidor Socket client_socket = null; //server_socket tipo cliente System.out.println("Server OK...\nWaiting players..."); try { server_socket = new ServerSocket(1111); //nuevo socket servidor con puerto 1111 client_socket = server_socket.accept(); //El servidor acepta el socket cliente System.out.println("El cliente se ha conectado"); //Declaramos los emisores/receptores DataInputStream in = new DataInputStream(new BufferedInputStream(client_socket.getInputStream())); DataOutputStream out = new DataOutputStream(new BufferedOutputStream(client_socket.getOutputStream())); while(true) { if(!adivinado){ out.writeBoolean(false); num_usuario = in.readInt(); //recoger num del usuario if(num_usuario == num_aleatorio){ adivinado = true; out.writeBoolean(true); } else if(num_usuario &gt; num_aleatorio) out.writeUTF("El número es menor que " + num_usuario); else if(num_usuario &lt; num_aleatorio) out.writeUTF("El número es mayor que " + num_usuario); intentos++; } else if(adivinado) out.writeUTF("Has acertado! Con un total de " + intentos + " intentos."); else { server_socket.close(); client_socket.close(); } } } catch (IOException e) { System.out.println("Exception caught when trying to listen on port 1111 or listening for a connection"); System.out.println(e.getMessage()); } } private static int generarNumAleatorio() { return (int)(Math.random() * 100 +1); //del 0 al 99 (el +1 hace que sea del 1 al 100…
tagged with: numbers

http://stackoverflow.com/comment/36099513
has text: @AlexandreSantos You mean Aspect Oriented Programming? Do we have to go to such lengths for this?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23531157
score: 0

http://stackoverflow.com/comment/36628936
type: Comment
comment on: http://stackoverflow.com/a/23601893
has text: You can run Oracle ADF application on other servers, like Tomcat.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/36011437
comment on: http://stackoverflow.com/q/23485072
score: 0
type: Comment
type: QuestionComment
has text: sorry,i added the parts , but about minimum example,i don't know if i did it right,it's doesn't give me any errors but still my method of doing the app can be wrong

http://stackoverflow.com/a/65177851
score: -1
answers question: http://stackoverflow.com/q/23487381
downvote count: 1
upvote count: 0
has body: In case anyone cares about C. I tried quicksort before , but got 88% result due to performance issue. So i ended up with an efficient (100%) yet messy code: https://app.codility.com/demo/results/trainingGT8RQR-FBM/ int solution(int A[], int N) { int NEG[3]; NEG[0]=0; NEG[1] = 0; NEG[2]=0; int p=-1; int POS[3]; POS[0] = 0; POS[1] =0; POS[2] = 0; int n=-1; int MAXIM[3]; MAXIM[0]=-1001; MAXIM[1]=-1001; MAXIM[2]=-1001; int m = -1; int i =0; for(i = 0 ; i &lt; N ; i++) { if(A[i] &lt; 0 &amp;&amp; A[i] &lt; NEG[2]) { if(A[i] &lt; NEG[0]) { NEG[2] = NEG[1]; NEG[1] = NEG[0];NEG[0] = A[i];} else if(A[i] &lt; NEG[1]) { NEG[2] = NEG[1]; NEG[1] = A[i];} else if(A[i] &lt; NEG[2]) NEG[2] = A[i]; if(n &lt; 2) n++; } else if(A[i] &gt;= 0 &amp;&amp; A[i] &gt; POS[2]) { if(A[i] &gt; POS[0]) {POS[2] = POS[1]; POS[1] = POS[0]; POS[0]=A[i];} else if(A[i] &gt; POS[1]) {POS[2] = POS[1]; POS[1] = A[i];} else POS[2] = A[i]; if(p &lt; 2) p++; } if(A[i] &lt;= 0 ) { if(A[i] &gt; MAXIM[0]){ MAXIM[2]=MAXIM[1];MAXIM[1]=MAXIM[0]; MAXIM[0]=A[i]; if(m&lt;2)m++;} else if(A[i]&gt;MAXIM[1]){MAXIM[2]=MAXIM[1]; MAXIM[1]=A[i];if(m&lt;2)m++;} else if(A[i]&gt;MAXIM[2]){MAXIM[2]=A[i]; if(m&lt;2)m++;} } } int max =0, val_set =0;; if( n &gt;=1 &amp;&amp; p&gt;=0 ) { int tmp = NEG[0] * NEG[1] * POS[0]; if(val_set == 0) { max = tmp; val_set =1; } else if(tmp &gt; max){ max = tmp; } } if( p &gt; 1 ) { int tmp = POS[0] * POS[1] * POS[2]; if(val_set == 0) { max = tmp; val_set =1; } else if(tmp &gt; max ) {max = tmp;} } else if( n &gt; 1) { int tmp = NEG[0] * NEG[1] * NEG[2]; if(val_set == 0) { max = tmp; val_set =1; } else if(tmp &gt; max ){ max = tmp;} } if(m&gt;1){ int temp = MAXIM[0] * MAXIM[1] * MAXIM[2]; if(val_set == 0) { max = temp; val_set =1; } else if(temp &gt; max){ max = temp;} } return max; }
type: Answer

http://stackoverflow.com/q/23463634
score: 6
has body: I need a Java data structure that I can efficiently add, delete, and access a random object. This is what doesn't work: ArrayList has efficient add (constant time), and random access (just "get" with a random integer), but deletes can take linear time because it has to potentially search the whole list for it. TreeSet or HashSet has efficient add and delete, but I can't figure out how to get a random object. Any ideas? In theory, a B Tree would work, if I could traverse the tree myself with random Lefts or Rights, but I don't think a standard Java class gives me this ability. I'm willing to use a third party library if nothing in the standard Java classes will work. I do not need to support duplicates or nulls, nor does it need to be thread safe. Thanks.
has comment: http://stackoverflow.com/comment/35971986
has comment: http://stackoverflow.com/comment/35972318
linked to: http://stackoverflow.com/q/24077045
downvote count: 1
has comment: http://stackoverflow.com/comment/37280861
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23463959
tagged with: java
upvote count: 7
type: Question
tagged with: search
has comment: http://stackoverflow.com/comment/36089479
has comment: http://stackoverflow.com/comment/35972268
has answer: http://stackoverflow.com/a/23464311
tagged with: data-structures
has title: Java data structure that has efficient add, delete, and random
has answer: http://stackoverflow.com/a/23464161
accepted answer: http://stackoverflow.com/a/23464161
tagged with: random
answer count: 3
possible better answer: http://stackoverflow.com/a/23463959
has comment: http://stackoverflow.com/comment/35972661
favorite count: 0
has comment: http://stackoverflow.com/comment/35971772

wso2
tags question: http://stackoverflow.com/q/23607524
tags question: http://stackoverflow.com/q/23511092
tag name: wso2
type: Tag
tags question: http://stackoverflow.com/q/23507445

http://stackoverflow.com/comment/35998707
score: 0
has text: Stick a `while(true)` into the `Thread`. `await()` the barrier at the end of the loop. When the all the threads are done then `reset()` the barrier and the whole lot begins again...
comment on: http://stackoverflow.com/q/23478358
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23524312
has title: Undecorated JInternalFrame
tagged with: jinternalframe
type: Question
accepted answer: http://stackoverflow.com/a/23524840
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/36085542
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36085357
has comment: http://stackoverflow.com/comment/36085246
has comment: http://stackoverflow.com/comment/36085300
has body: I have create and internal frame which has been added to a frame but when I run it I find that the internal frame does not have any max,min,close,etc. I have not undecorated it and I have tried a couple of things like the look and feel and undecorated but nothing seems to fix it. Here is my code (frame is the internal frame and outFrame is the JFrame): //Adding everything to contentPane. contentPane.add(label); contentPane.add(width); contentPane.add(textWidth); contentPane.add(height); contentPane.add(textHeight); contentPane.add(box); contentPane.add(bOpen); //Adding contentPane to the frame. frame.add(contentPane); frame.setSize(500, 400); //frame.setClosable(true); frame.setVisible(true); //frame.setBorder(border); outFrame.add(frame); outFrame.setVisible(true);
has answer: http://stackoverflow.com/a/23524840
type: AnsweredQuestion

http://stackoverflow.com/a/23524876
downvote count: 0
has comment: http://stackoverflow.com/comment/36085547
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23524737
score: 1
has comment: http://stackoverflow.com/comment/36085589
has comment: http://stackoverflow.com/comment/36085574
has body: did you call it with the class name? If not that is your problem. Class.Coinshare = Class.Coinshare +1; Something similar to that? Since it is static and public you must call it with the class's name that it belongs to first, to access it.

http://stackoverflow.com/q/23562293
has answer: http://stackoverflow.com/a/23562729
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
tagged with: java
has comment: http://stackoverflow.com/comment/36157250
type: Question
has comment: http://stackoverflow.com/comment/36156207
tagged with: for-loop
has comment: http://stackoverflow.com/comment/36156767
answer count: 1
downvote count: 0
favorite count: 0
has title: Receiving PDUs that are sent over a network, and filtering them as received before displaying to user
tagged with: while-loop
has comment: http://stackoverflow.com/comment/36156738
has body: I have the following Java method, which I am trying to use to filter PDU messages that are received over a network, and display only the PDUs which match the filter criteria to the user: public static void displayFilteredPdu(){ try{ EspduReceiver.socket = new MulticastSocket(EspduSender.PORT); EspduReceiver.address = InetAddress.getByName(EspduSender.DEFAULT_MULTICAST_GROUP); EspduReceiver.socket.joinGroup(EspduReceiver.address); while(EspduReceiver.stopCapture == false){ byte buffer[] = new byte[EspduReceiver.MAX_PDU_SIZE]; EspduReceiver.packet = new DatagramPacket(buffer, buffer.length); EspduReceiver.socket.receive(EspduReceiver.packet); Pdu pdu = EspduReceiver.pduFactory.createPdu(EspduReceiver.packet.getData()); if(pdu != null){ System.out.print("Got PDU of type: " + pdu.getClass().getName()); if(pdu instanceof EntityStatePdu){ EntityID eid = ((EntityStatePdu)pdu).getEntityID(); Vector3Double position = ((EntityStatePdu)pdu).getEntityLocation(); System.out.println(" EID:[" + eid.getSite() + ", " + eid.getApplication() + ", " + eid.getEntity() + "] "); System.out.println("Location in DIS coordinates: [" + position.getX() + ", " + position.getY() + ", " + position.getZ() + "] "); /*Add PDU to ArrayList of PDUs */ EspduReceiver.espdu.add(pdu); /* System.out.println(" PDU added to arrayList. "); System.out.println(espdu); /*This is printing out the actual DIS messages (i.e. edu.nps.moves.dis.EntityState...), maybe try adding the 'eid.getSite()', etc to an ArrayList instead. Use Associative arrays/ map/ hashmap */ // if(eid.getSite() != 0){ Filter.sitesToBeFiltered.add(eid.getSite()); System.out.println("Entity Site added to ArrayList. "); // } else if(eid.getApplication() != 0){ Filter.applicationsToBeFiltered.add(eid.getApplication()); System.out.println("Entity Application added to ArrayList. "); Filter.IDsToBeFiltered.add(eid.getEntity()); System.out.println("Entity ID added to ArrayList"); Filter.positionsToBeFilteredX.add(position.getX()); System.out.println("…
score: 2

http://stackoverflow.com/a/23538177
type: AcceptedAnswer
downvote count: 0
has body: I would go with a Pattern with groups and back-references. Here's an example: String input = "Hello ${123...456}, bye ${789...101112}"; // | escaped "$" // | | escaped "{" // | | | first group (any number of digits) // | | | | 3 escaped dots // | | | | | second group (same as 1st) // | | | | | | escaped "}" Pattern p = Pattern.compile("\\$\\{(\\d+)\\.{3}(\\d+)\\}"); Matcher m = p.matcher(input); // iterating over matcher's find for multiple matches while (m.find()) { System.out.println("Found..."); System.out.println("\t" + m.group(1)); System.out.println("\t" + m.group(2)); } Output Found... 123 456 Found... 789 101112
accepted answer of: http://stackoverflow.com/q/23538072
answers question: http://stackoverflow.com/q/23538072
type: Answer
upvote count: 5
score: 5

http://stackoverflow.com/a/39790747
type: Answer
has body: List&lt;WebElement&gt; iframeElements= driver.findElements(By.tagName("iframe")); System.out.println("The total number of iframes are " + iframeElements.size()); driver.switchTo().frame(0); Thread.sleep(3000); System.out.println("it is on frame1");
answers question: http://stackoverflow.com/q/23489986
score: 0
has comment: http://stackoverflow.com/comment/66874495

http://stackoverflow.com/comment/36245674
has text: Why not just make the dictionary a member of MyClass, so you don't have to reload it every time? Although you should think carefully of the trade off. Your way allows the underlying data to change without having to restart the application, which may be a desirable trait.
comment on: http://stackoverflow.com/q/23608733
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36068394
has text: Does that check if they are the same or just have intersecting coordinates? They are never going to be the same, however they may have coordinates that are the same. Anyway I will try what you have suggested. Thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/23516110
type: Comment
score: 0

http://stackoverflow.com/comment/36048806
has text: Which line throws which exceptions? What do you see in your debugger when you step through the code?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23505167
type: QuestionComment

http://stackoverflow.com/comment/36163099
score: 0
type: AnswerComment
has text: @LuiggiMendoza Huh, that feels like a weird concept to me. What is the point of using an interface compared to an abstract superclass then?
comment on: http://stackoverflow.com/a/23566429
type: Comment

http://stackoverflow.com/comment/36075841
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23518450
has text: You can use this plugin for uploading multiplr file. http://hayageek.com/docs/jquery-upload-file.php
score: 0

http://stackoverflow.com/comment/36113870
type: QuestionComment
has text: `System.out.println(int[])` treats every integer as a character, so its outputting char 1, char 2, etc. not '1', '2',....
score: 0
comment on: http://stackoverflow.com/q/23540204
type: Comment

http://stackoverflow.com/a/23545562
upvote count: 1
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/36124070
answers question: http://stackoverflow.com/q/23545394
has body: Once you find out what type method() returns, you should either (1) create a class that extends method()'s type and implements the add() method, initializing myClass to an object of that class. (2) Cast method()'s return object to another type of class that implements add(). I recommend (1) to preserve the other functionalities in method()'s return class.
type: Answer

http://stackoverflow.com/q/23542567
possible better answer: http://stackoverflow.com/a/23576170
tagged with: java
has answer: http://stackoverflow.com/a/23576170
type: Question
accepted answer: http://stackoverflow.com/a/23553378
score: 0
answer count: 2
tagged with: opengl-es
has answer: http://stackoverflow.com/a/23553378
tagged with: android
has title: Place vertices at exact edge of screen on android
has body: I have the following vertices private float vertices[]={ -1.0f,0.0f,0.0f, //V1 Bottom left -1.0f,1.0f,0.0f, //V2 top left 0.0f,0.0f,0.0f, //V3 bottom right 0.0f,1.0f,0.0f //V4 top right }; And the following code in OnSurfaceChanged if(height==0)//prevent a divide by zero by making height equal 1 { height=1; } gl.glViewport(0,0,width,height); //Reset the current viewport gl.glMatrixMode(GL10.GL_PROJECTION); //select the projection matrix gl.glLoadIdentity(); //Reset the Projection Matrix //calculate the aspect ratio of the window GLU.gluPerspective(gl,45.0f,(float)width/(float)height,0.1f,100.0f); gl.glMatrixMode(GL10.GL_MODELVIEW);//select the modelview matrix gl.glLoadIdentity(); //Reset the modelview matrix However if I run my code I can not see the square on the screen until I zoom out using gl.glTranslatef(0.0f,0.0f,-4.0f); I can now see the square but it is a few pixels off the left hand side of the screen and quite a way from the top (I would assume the vertices would mean it would be placed in the top left corner of the screen). Also why do I need to zoom out in order to see anything? Now I am under the impression that the top of the screen is 1.0f and the bottom is -1.0f and the left of the screen is -1.0f and the right is 1.0f. Is this correct? If this is correct then how do we handle rectangular screens? All I want to do is place a small square at the top left corner of my phones screen.....
type: AnsweredQuestion

http://stackoverflow.com/a/23494703
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23494629
has body: change your for loop to this for (x = 0; x &lt; 6; x++) { for (y = 0; y &lt; 3; y++) { System.out.print(sortByDesc[x][y]+"\t"); } System.out.println(""); }
upvote count: 2
type: Answer

http://stackoverflow.com/q/23589018
type: Question
tagged with: awt
score: 0
has body: I have been playing with DesignGridLayout as a layout manager. For the most part it works rather well. However, I have an issue in this sample class: import net.java.dev.designgridlayout.DesignGridLayout; import javax.swing.*; import java.awt.*; public class ConsolePanel extends JPanel { private ConButton oneCon = new ConButton("&gt;"); private ConButton twoCon = new ConButton("&gt;"); private ConButton threeCon = new ConButton("&gt;"); private ConButton fourCon = new ConButton("&lt;"); private ConButton fiveCon = new ConButton("&lt;"); private ConButton sixCon = new ConButton("&lt;"); private JTextArea console = new JTextArea(10,20); private Dimension dim = new Dimension(430,250); private DesignGridLayout layout = new DesignGridLayout(this); public ConsolePanel () { buildConsole(); } private void buildConsole () { layout.row().grid().add(oneCon).add(console,3).add(fourCon); layout.row().grid().add(twoCon).spanRow().add(fiveCon); layout.row().grid().add(threeCon).spanRow().add(sixCon); console.setBackground(Color.BLACK); console.setForeground(Color.GREEN); console.setColumns(20); console.setRows(10); console.setLineWrap(true); console.setWrapStyleWord(true); console.setEditable(false); } @Override public Dimension getPreferredSize() { // comply to contract if set if(isPreferredSizeSet()) return super.getPreferredSize(); // do whatever we want return new Dimension(dim); } public JPanel getConsoleLayout() { return this; } private class ConButton extends JButton { private Dimension dim = new Dimension(10,25); public ConButton (String text) { super(text); } @Override public Dimension getPreferredSize() { // comply to contract if set if(isPreferredSizeSet()) return super.getPreferredSize(); // do whatever we want return new Dimension(dim); } } } I need to be able to resize the "&lt;" and ">" to some smaller size. Then what the layout manager defaults to. I have tried to override the getPreferredSize() method as noted here #21052894. Though, this isn't work quite right. A…
answer count: 1
has answer: http://stackoverflow.com/a/23616141
tagged with: layout-manager
has title: DesignGridLayout Sizing JButtons
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23616141
linked to: http://stackoverflow.com/q/21052894
tagged with: java
tagged with: swing

http://stackoverflow.com/q/23611227
answer count: 1
tagged with: cryptography
type: UnansweredQuestion
score: 0
tagged with: encryption
tagged with: sjcl
has answer: http://stackoverflow.com/a/23611537
tagged with: java
has title: encryption on the server side (using java) and decryption on the client side(using any javascript crypto library)
type: Question
tagged with: javascript
has body: I want to decrypt the data on the client side which is coming from the server side encrypted with java (using asymmetric key), but i do not have any idea that how it will work? do i need to use some jar or something on the server side ? what methods will be used what parameters needs to be supplied ? basically i don't know from where to start? can any one provide me any idea or any working demo or any link how and from where to start this? any help will be greatly appreciated.

http://stackoverflow.com/q/23604744
upvote count: 1
tagged with: classpath
accepted answer: http://stackoverflow.com/a/23711204
has title: Regarding automatic recompilation, I can't spot the difference between javac's -classpath and -sourcepath options
downvote count: 0
possible better answer: http://stackoverflow.com/a/23606272
has answer: http://stackoverflow.com/a/23606272
has body: I'm trying to understand the difference between javac's -classpath and -sourcepath options, regarding automatic recompilation of source code files. I read the Java documentation on the subject of javac, and for its -sourcepath option it stated - Note: Classes found through the class path may be subject to automatic recompilation if their sources are also found I also looked at this webpage (idevelopment.info), to learn more about javac's -classpath and -sourcepath options. In their example, it describes a test project involving two java files called TestFoo.java (a superclass), and TestBaz.java (a dependant subclass). It gave three options on how to compile this test project, two of which are summarized below. Option #2 Add TestFoo to the sourcepath while compiling TestBaz: javac -d baz/classes -sourcepath foo/src baz/src/TestBaz.java Option #3 Put dependencies in both sourcepath and classpath. Then, if the .class file in the classpath goes out of date, the .java file in sourcepath will be recompiled. Unfortunately, I am unable to spot the difference between these two options. For instance, in option #2 (which doesn't use -classpath), if I edit either TestFoo.java or TestBaz.java, then I will get an updated TestFoo.class or TestBaz.class file. In other words, if either .class file goes out of date, then the source code will be recompiled. In option #3 above (which does use -classpath), the same thing will occur. Consequently, I can't see a difference between options #2 and #3. Can someone please outline the structure of one simple example test project where I can see two slightly different javac commands being used with it? One javac example command should use -classpath, while the other should not. When the javac example that includes -classpath is used, automatic recompilation occurs if the edited superclass source file is found. When the javac example that excludes -classpath is used, automatic recompilation does not occur if the superclass source file has been e…
tagged with: javac
type: AnsweredQuestion
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23711204
type: Question
answer count: 2
tagged with: java

http://stackoverflow.com/a/23487251
has body: Ok, I'm still not sure where do you have problems, but I'm posting this because it's too big for a comment. In your current setup, let's assume that you have an EditText where the user will enter the new subject(like math for example). To make the new table you'll need two operations: to insert the math text in the subject table and then actually create the new math table. You'll need to do this in a transaction to make sure this operations either succeed or fail as one( http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#beginTransaction%28%29 ). First, to insert the math text in the subject table you'll use http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#insert%28java.lang.String,%20java.lang.String,%20android.content.ContentValues%29 . Then to create the new math table you'll do: // get the text entered by the user, also trim it for extra spaces String newTableName = editTextInput.getText().trim(); // the entered name should consist only of characters newTableName = newTableName.replaceAll("[^a-zA-Z]", ""); // create the new table sqliteDatabase.execSQL("CREATE TABLE " + newTableName); The way you setup the database is far from ideal. You should avoid creating tables for each of the subject table entries(and for the students as well, I'm assuming a student will be engaged in more than one course), instead you should create a subject table, a students tables(each with a unique id) and one table that joins the two of them(also look at sqlite foreign keys).
has comment: http://stackoverflow.com/comment/36016400
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23486188
answers question: http://stackoverflow.com/q/23486188

http://stackoverflow.com/a/23584007
score: 3
has comment: http://stackoverflow.com/comment/36196314
downvote count: 0
has comment: http://stackoverflow.com/comment/36196260
type: Answer
has comment: http://stackoverflow.com/comment/36196380
has comment: http://stackoverflow.com/comment/36197016
has comment: http://stackoverflow.com/comment/36196283
has comment: http://stackoverflow.com/comment/36196522
has comment: http://stackoverflow.com/comment/36196338
has comment: http://stackoverflow.com/comment/36196056
upvote count: 3
answers question: http://stackoverflow.com/q/23583993
has body: gf is a String[]. You can apply the method in a single String instead: for (String s : gf) { charArrays = s.toCharArray(); } Here's a more concrete example of what you want/need to achieve (IMO): void somefunction(String[] gf) { List&lt;char[]&gt; data = new ArrayList&lt;char[]&gt;(); int wholeSize = 0; for (String s : gf) { char[] charArray = s.toCharArray(); data.add(charArray); wholeSize += charArray.length; } char[] wholeStringIntoCharArray = new char[wholeSize]; int i = 0; for (char[] charArray : data) { for (char c : charArray) { wholeStringIntoCharArray [i++] = c; } } //return wholeStringIntoCharArray; }

http://stackoverflow.com/a/23576041
type: Answer
accepted answer of: http://stackoverflow.com/q/23575982
score: 3
upvote count: 3
has body: I guess the compareTo method works the other way round for Strings, so maybe try while(current != null &amp;&amp; current.lastName.compareTo(lastName) &lt;= 0) But I recommend you to use just the Compareable interface and sort the list by using Collections.sort(yourlist)
has comment: http://stackoverflow.com/comment/36181546
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23575982

http://stackoverflow.com/comment/36192875
type: QuestionComment
comment on: http://stackoverflow.com/q/23582463
type: Comment
score: 2
has text: That code does it. What's the problem?

http://stackoverflow.com/q/23459619
has body: I'm new to Google App Engine so I was hoping that you could help me here. I'm trying to get the source link to a property of an entity (want to download a json), but can't figure out how. This is the code: <%-- //[START all]--%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page import="com.google.appengine.api.users.User" %> <%@ page import="com.google.appengine.api.users.UserService" %> <%@ page import="com.google.appengine.api.users.UserServiceFactory" %> <%-- //[START imports]--%> <%@ page import="com.google.appengine.api.datastore.DatastoreService" %> <%@ page import="com.google.appengine.api.datastore.DatastoreServiceFactory" %> <%@ page import="com.google.appengine.api.datastore.Entity" %> <%@ page import="com.google.appengine.api.datastore.FetchOptions" %> <%@ page import="com.google.appengine.api.datastore.Key" %> <%@ page import="com.google.appengine.api.datastore.KeyFactory" %> <%@ page import="com.google.appengine.api.datastore.Query" %> <%-- //[END imports]--%> <%@ page import="java.util.List" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> Mandatory Assigment 2 Mandatory Assignment 2 This page shows the CSV files uploaded Uploaded CSV files <%-- //[START datastore]--%> <% DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Key guestbookKey = KeyFactory.createKey("Guestbook", "guestbookName"); // Run an ancestor query to ensure we see the most up-to-date // view of the Greetings belonging to the selected Guestbook. Query query = new Query("Greeting", guestbookKey).addSort("date", Query.SortDirection.DESCENDING); List<Entity> greetings = datastore.prepare(query).asList(FetchOptions.Builder.withLimit(5)); if (greetings.isEmpty()) { %> There are no CSV files. Please refresh to reload <% } else { %> CSV files: <% for (Entity greeting : greetings) { pageContext.setAttribute("greeting_content", greeting.getProperty("content")); if (greeting.getProperty("user") == null) { %> An anonymous…
tagged with: http://stackoverflow.com/tag/json
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/23460006
has title: Google App Engine: Get source link to entity property
tagged with: java
type: Question

http://stackoverflow.com/a/23581607
has body: Make sure you have m2e/m2e-wtp installed Make sure Eclipse applies the Maven project nature to the project - Right click project > Configure > Convert to Maven Project. If you edit a file outside Eclipse, make sure Eclipse knows about the change -- you need to enable native hooks -- Preferences > General > Workspace > Refresh using native hooks or polling. Alternatively, you can select the file and hit F5 (refresh) to make sure Eclipse is aware of the change. Hit publish if you're using WST/JST (server tools) and deploying to a server via Eclipse. In my experience if you've done all this, it should publish the changes to your target war as expected. Though, you may need to restart the container if the XML files are used as part of the startup configuration.
type: Answer
accepted answer of: http://stackoverflow.com/q/23578697
answers question: http://stackoverflow.com/q/23578697
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/23469755
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42866835
tagged with: cifs
tagged with: file-permissions
has title: Set up permissions on file in mounted CIFS share - NIO.2
tagged with: nio2
answer count: 0
upvote count: 3
type: UnansweredQuestion
has body: I am trying to add a set of attributes at creation time as in the following example. This code creates a new file on a POSIX file system with specific permissions ("rw-rw-r--") in mounted CIFS share. public static void main(String[] args) { Path new_path = Paths.get("/mnt/test/new_file.txt"); System.out.println(new_path.getFileSystem().supportedFileAttributeViews().contains("posix")); Set&lt;PosixFilePermission&gt; perms = PosixFilePermissions.fromString("rw-rw-r--"); FileAttribute&lt;Set&lt;PosixFilePermission&gt;&gt; attr = PosixFilePermissions.asFileAttribute(perms); try { Files.createFile(new_path, attr); } catch (IOException e) { System.err.println(e); } } After run the simple code, the file was created but the permissions for it looks rwxrwSrwx 1 root root 0 May 5 2014 new_file.txt instead of what I needed (look in the code 'rw-rw-r--') Can someone help me with that issue?
type: Question
score: 3
tagged with: java
tagged with: java-7

http://stackoverflow.com/a/23564124
score: 1
answers question: http://stackoverflow.com/q/23561652
upvote count: 1
has body: I guess you should use WebDriveWait : WebDriverWait waiting = new WebDriverWait(driver, X, Y); WebElement element = waiting.until(ExpectedConditions.visibilityOfElementLocated(By.id("close_bttn"))); This code will check the expected condition (visibility of the close_bttn object) in every Y milliseconds. The wait time is X seconds.
downvote count: 0
type: Answer

http://stackoverflow.com/a/36002140
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: If you use maven,you can use command 'mvn dependency tree' to check you project all jar dependencies,find depend on spring3.1.x and exclusion that.
answers question: http://stackoverflow.com/q/23595958
has comment: http://stackoverflow.com/comment/88224105

http://stackoverflow.com/q/23464124
possible better answer: http://stackoverflow.com/a/23464171
has answer: http://stackoverflow.com/a/23464202
has body: Lets say you have 2 names in a ArrayList Jonh Smith Jane Doe A user enters the name "Jane Doe" and the system prints out 1 (its position in the array?)
has answer: http://stackoverflow.com/a/23464171
tagged with: arrays
has answer: http://stackoverflow.com/a/23464176
favorite count: 0
tagged with: arraylist
score: 0
accepted answer: http://stackoverflow.com/a/23464174
answer count: 5
has comment: http://stackoverflow.com/comment/35972549
upvote count: 1
has answer: http://stackoverflow.com/a/23464197
downvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23464174
tagged with: java
has title: Can you get a index number from arraylist input?

http://stackoverflow.com/comment/36304124
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23573601
has text: I see, you mean that the map has to be declared outside the `<bean>` definition, not inside it?
score: 0

http://stackoverflow.com/q/23500984
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/23501325
has body: I tried hand_gesture_recognition of Blobscanner in Eclipse. There's this line to get a red value of a pixel: int [] Background; void Set(PImage I){ for(int i=0; i&lt;I.width*I.height; i++){ int iP=I.pixels[i]; Background[i*3]=(int)red(iP); } } the last line being the reason for this error: Exception in thread "Animation Thread" java.lang.NullPointerException at processing.core.PApplet.red(Unknown Source) at Test$PBGS.Set(Test.java:475) at Test$PBGS.&lt;init&gt;(Test.java:466) at Test.setup(Test.java:39) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Unknown Source) I'm guessing that this is related to the point where if you implement Processing in Eclipse, you've gotta change color type to int. So, is there any way to change/implement this red() method if you want to use Processing in Eclipse?
favorite count: 0
has title: red(), green(), blue() method in Eclipse
upvote count: 1
has answer: http://stackoverflow.com/a/23501325
type: AnsweredQuestion
tagged with: processing
score: 1
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/36129130
score: 0
type: Comment
has text: Thanks christopfer I will try this
type: AnswerComment
comment on: http://stackoverflow.com/a/23543217

http://stackoverflow.com/comment/36143387
type: Comment
type: QuestionComment
has text: Not sure why you would use such complex regex when you may use `Pattern` and `Matcher` with a regex like `(\\w+|\\.)` and find every `String` in your current `String` and add all the elements in a `List<String>` (more code verbosity but easier to maintain). Note: the *complex* regex was in an already deleted answer: `"(?:(?<!^|[^.]|)|(?=[.])|\\s+)"`.
score: 1
comment on: http://stackoverflow.com/q/23555613

http://stackoverflow.com/a/23562896
upvote count: 2
type: Answer
score: 2
has body: https://code.google.com/p/combinatoricslib/ Simple combinations section illustrates usage of this utility. Combinations with 2 elements will produce what you wanted. // Create the initial vector ICombinatoricsVector&lt;String&gt; initialVector = Factory.createVector( new String[] { "red", "black", "white", "green", "blue" } ); // Create a simple combination generator to generate 3-combinations of the initial vector Generator&lt;String&gt; gen = Factory.createSimpleCombinationGenerator(initialVector, 3); // Print all possible combinations for (ICombinatoricsVector&lt;String&gt; combination : gen) { System.out.println(combination); }
accepted answer of: http://stackoverflow.com/q/23562297
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/23562297

http://stackoverflow.com/a/23522955
score: 0
has comment: http://stackoverflow.com/comment/36082877
answers question: http://stackoverflow.com/q/23522881
type: Answer
has comment: http://stackoverflow.com/comment/36082945
has comment: http://stackoverflow.com/comment/36082830
has body: Always try to place the resources outside the JAVA code to make it more manageable and reusable by other package's class. You can try any one // Read from same package URL url = StaticResource.class.getResource("c.png"); // Read from same package InputStream in = StaticResource.class.getResourceAsStream("c.png"); // Read from absolute path File file = new File("E:/SOFTWARE/TrainPIS/res/drawable/c.png"); // Read from images folder parallel to src in your project File file = new File("images/c.jpg"); // Read from src/images folder URL url = StaticResource.class.getResource("/images/c.png") // Read from src/images folder InputStream in = StaticResource.class.getResourceAsStream("/images/c.png")

http://stackoverflow.com/comment/36017762
type: AnswerComment
has text: But still you will get warning, his question is to remove warnings
type: Comment
score: 2
comment on: http://stackoverflow.com/a/23488615

http://stackoverflow.com/q/23488777
has comment: http://stackoverflow.com/comment/36017675
has comment: http://stackoverflow.com/comment/36017616
has answer: http://stackoverflow.com/a/23488919
has comment: http://stackoverflow.com/comment/36017651
type: Question
has comment: http://stackoverflow.com/comment/36018467
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23488919
has title: Singleton pattern - Server Socket
tagged with: java
accepted answer: http://stackoverflow.com/a/23491064
has comment: http://stackoverflow.com/comment/36017771
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/434718
has body: Im using this code: final int LOCK_PORT= 54321; ServerSocket ss = new ServerSocket(LOCK_PORT); The thing is that in the same port you cannot listen to 2 different applications (teachers theory). This code was implemented into an application and the same instance ran more than 1 time. The objective is that the same instance is not suposed to run more than 1 time in the same port. However this isnt working and it does run... // Edited, more code... public VentanaPropiedades() { initFirst(); initComponents(); //graphic components of Matisse } private void initFirst() { loadProperties(); //just internal values of the program, nothing to do activateInstance(); } private void activateInstance() throws Exception { try { final int LOCK_PORT= 54321; ServerSocket ss = new ServerSocket(LOCK_PORT); } catch (Exception e) { System.out.println(e); throw e; } } private void killProgram() { setVisible(false); dispose(); System.exit(0); } private void validateInstance() { try { activateInstance(); } catch (Exception ex) { killProgram(); } } --------------------------Supposed Solution--------------------------- The error catched when the 2nd instance DOES NOT RUN is this one: java.net.BindException: Address already in use: JVM_Bind However, this error not always happens and you can run more than 1 instance of the same program.
has comment: http://stackoverflow.com/comment/36017711
has answer: http://stackoverflow.com/a/23491064

http://stackoverflow.com/q/23462222
tagged with: eclipse
has comment: http://stackoverflow.com/comment/35968749
downvote count: 4
has title: How do I remove all no math symbols from a string android java stuck
upvote count: 0
has body: How I remove all non-math symbols or numbers from a string. So I want a string to be able to contain + or - or numbers 0-9 But any other symbols or alphabetical characters to be removed. How do I do this, I've tried the below but that removes, - and + string.replaceAll("[^\\d.]", "");
answer count: 1
tagged with: string
favorite count: 0
tagged with: android
tagged with: regex
has answer: http://stackoverflow.com/a/23462252
score: -4
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/23462252

http://stackoverflow.com/comment/36078224
has text: The general idea would be `return (this node is okay) && (left subtree is okay, i.e. recursive call with left child) && (right subtree is okay, i.e. recursive call with right child)`. I hope that helps.
type: AnswerComment
comment on: http://stackoverflow.com/a/23518466
score: 0
type: Comment

http://stackoverflow.com/q/23564162
type: Question
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/23564508
answer count: 1
tagged with: sql-server
score: 0
has body: I am very new to hibernate.I created simple application with hibernate connecting with MSSQL server 2008.While executing the program I got the Exception.Please help me. Thanks in advance. Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491) at org.hibernate.cfg.Configuration.configure(Configuration.java:1425) at com.main.StoreData.main(StoreData.java:15) Caused by: org.dom4j.DocumentException: Connection refused: connect Nested exception: Connection refused: connect at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481) ... 2 more my conf file. employee.hbm.xml <?xml version='1.0' encoding='UTF-8'?> Hibernate config file <?xml version='1.0' encoding='UTF-8'?> <hibernate-configuration> update org.hibernate.dialect.SQLServerDialect jdbc:sqlserver://localhost;databaseName=sampleDB sa sa123 com.microsoft.sqlserver.jdbc.SQLServerDriver <mapping resource="employee.hbm.xml"/> </hibernate-configuration>
has title: Hibernate with MSSQL server 2008
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36158849

distinct
tag name: distinct
tags question: http://stackoverflow.com/q/23539103
tags question: http://stackoverflow.com/q/23516661
type: Tag

http://stackoverflow.com/comment/36101240
comment on: http://stackoverflow.com/a/23532932
score: 0
type: AnswerComment
type: Comment
has text: Thanks blue and haif!

http://stackoverflow.com/a/42371259
upvote count: 1
answers question: http://stackoverflow.com/q/23590613
has comment: http://stackoverflow.com/comment/72523193
downvote count: 0
has body: You must go to Preferences/Build, Execution, Deployment/Debugger and disable the option: "Force Classic VM for JDK 1.3.x and earlier" This works for me
type: Answer
score: 1

http://stackoverflow.com/comment/78358321
has text: @RogerCSWernersson - you can put the annotation on the same line, annotations don't require a following newline.
comment on: http://stackoverflow.com/a/23563811
type: AnswerComment
score: 4
type: Comment

http://stackoverflow.com/comment/36088631
comment on: http://stackoverflow.com/q/23504649
score: 0
type: Comment
has text: @zgc7009 OK, just to test, i set the width to 50, and its still the same width. So clearly theres something wrong with code not logic
type: QuestionComment

http://stackoverflow.com/comment/35994555
has text: Instead you can use `putBoolean` too.
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23476453

http://stackoverflow.com/comment/36079981
type: Comment
type: QuestionComment
has text: You can use getActivity().requestWindowFeature(Window.FEATURE_NO_TITLE);
comment on: http://stackoverflow.com/q/23520892
score: 0

http://stackoverflow.com/a/23523708
has body: javac is not smart enough to realize that the way your conditions are constructed, one of them will always be true. You can rewrite your if-statements to make javac realize one branch will always be triggered: int y; if(x&lt;=0.33) { y=1; } else if(x&gt;0.33 &amp;&amp; x&lt;0.67) { y=2; } else // This only triggers when x &gt;= 0.67, so no need to check { y=3; } Now javac sees that if the first two don't trigger, the last will, so y will always have a value. You can alternatively add an else branch with an error, in case someone breaks the conditions: int y; if(x&lt;=0.33) { y=1; } else if(x&gt;0.33 &amp;&amp; x&lt;0.67) { y=2; } else if(x &gt;= 0.67) { y=3; } else { // This should never happen throw new IllegalArgumentException("Something's gone terribly wrong for " + x); } This also compiles, and if someone later decides to skew the numbers and turns the first condition into x &lt;= 0.2 but forgets to update the other condition, you'll get an exception at runtime.
type: Answer
answers question: http://stackoverflow.com/q/23523539
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36116468
accepted answer of: http://stackoverflow.com/q/23523539
score: 0
has comment: http://stackoverflow.com/comment/36084303
type: AcceptedAnswer

http://stackoverflow.com/a/23539918
answers question: http://stackoverflow.com/q/23537325
has body: You can update attribute like : &lt;%((Set&lt;String&gt;)pageContext.getServletContext().getAttribute("set")).add("Second"); %&gt; &lt;% Set&lt;String&gt; set = (Set&lt;String&gt;) pageContext.getServletContext().getAttribute("set"); %&gt; from servlet context &lt;c:forEach items="${set}" var="s"&gt; &lt;c:out value="${s}"/&gt; &lt;/c:forEach&gt;
has comment: http://stackoverflow.com/comment/36113335
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/36113196

http://stackoverflow.com/q/23553548
has answer: http://stackoverflow.com/a/23553915
type: Question
tagged with: jodatime
has answer: http://stackoverflow.com/a/23553824
tagged with: date
has comment: http://stackoverflow.com/comment/36139744
answer count: 3
has comment: http://stackoverflow.com/comment/36139641
tagged with: converters
has body: I've a problem to convert a data in Java using Joda-Time library. Pratically, the input date have this format: Mon Apr 28 18:57:42 CEST 2014 I would like to see this output: 2014-04-28 I've tried this code, but doesn't works: DateTimeFormatter dtf_out = DateTimeFormat.forPattern("yyyy-MM-dd"); DateTimeFormatter dtf_inp = DateTimeFormat.forPattern("EEE MMM dd HH:mm:ss zzz yyyy"); String a = String.valueOf(dtf_inp.parseDateTime(String.valueOf(resultsJs.get(0).getTimestamp()))); //crash here String b = String.valueOf(dtf_out.parseDateTime(a)); Note: resultsJs.get(0).getTimestamp() is a Date format. Instead, this is the log: ... Caused by: java.lang.IllegalArgumentException: Invalid format: "Mon Apr 28 18:57:42 CEST 2014" at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:873) ...
downvote count: 0
accepted answer: http://stackoverflow.com/a/23553915
favorite count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/16345711
tagged with: datetime
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23554013
has answer: http://stackoverflow.com/a/23554013
tagged with: java
has title: Convert date to other format in JodaTime
has comment: http://stackoverflow.com/comment/36145027

http://stackoverflow.com/a/30823107
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23577175
has body: I was having the same problem and found out that this is because jzmq is not able to find the zeroMQ installation. There will be two jar files one generated by zmq installation residing in /usr/local/share/java/zmq.jar and other by the jzmq installation in the perf folder /path/to/jzmq/src/main/perf/zmq-perf.java so to test the installation use this command $ java -Djava.library.path=/usr/local/lib -cp /usr/local/share/java/zmq.jar local_lat tcp://127.0.0.1:5000 1 100 Note that order of classpath is quite important here which is the reason of error. First the jar file generated by jzmq is to be referenced then the one generated by zmq.

http://stackoverflow.com/a/23495231
has comment: http://stackoverflow.com/comment/36030479
has comment: http://stackoverflow.com/comment/36030236
type: Answer
has comment: http://stackoverflow.com/comment/36031007
has body: Try that answers: here choose the define intent which you want: Customize Android Intent.ACTION_SEND Branching the Android Share Intent extras depending on which method they choose to share Android - How to filter specific apps for ACTION_SEND intent
answers question: http://stackoverflow.com/q/23494624
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/36030732
has comment: http://stackoverflow.com/comment/36030286
score: 0

http://stackoverflow.com/comment/36192935
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23574723
has text: I think that this is OK because `Math.log(Math.random())` is always nonzero negative and nonzero negative/zero = infinity in IEEE arithmetic, but explicitly testing `x < n` before entering the loop would make me less nervous.

http://stackoverflow.com/a/23534918
has body: You don't really need to get the String array. You can just loop through the ResultSet using next(). From the docs: A ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The next method moves the cursor to the next row, and because it returns false when there are no more rows in the ResultSet object, it can be used in a while loop to iterate through the result set. Something like this: ResultSet rs = ... while (rs.next()) { String yourVarCharColumn = rs.getNString("varchar column name"); Date yourDateColumn = rs.getDate("date column name"); // Add to your JTable }
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/23532066
score: 1

http://stackoverflow.com/q/23484359
has comment: http://stackoverflow.com/comment/36010060
has comment: http://stackoverflow.com/comment/36010075
has comment: http://stackoverflow.com/comment/36010383
has title: Java Memory leakage signs
tagged with: windows
has body: i've been making an application and i've been tracking its memory usage. The app's memory is about 58,676 K as seen below. This is my GUI. That close button there has a function that makes that panel not Visible. private final ActionListener closeButtonAL = new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { timeUtilities.getPanel().setVisible(false); } }; I also have a button that makes the panel visible again. private final ActionListener showPanelAL = new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { timeUtilities.getPanel().setVisible(true); } }; The panel has been initialized already before the app starts showing. My problem is that, by just making the GUI appear and closes it again and again increases the memory usage of the application. Isn't this some sort of memory leak? Regardless of the answer, how do I prevent this matter?
has comment: http://stackoverflow.com/comment/36010236
linked to: http://stackoverflow.com/q/15130956
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23484439
has answer: http://stackoverflow.com/a/23484439
has comment: http://stackoverflow.com/comment/36010369
type: Question
has comment: http://stackoverflow.com/comment/36010034
has answer: http://stackoverflow.com/a/23484453
tagged with: java
tagged with: memory
tagged with: desktop
accepted answer: http://stackoverflow.com/a/23484453
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/36010197
has comment: http://stackoverflow.com/comment/36010106

for-loop
tags question: http://stackoverflow.com/q/23575276
tags question: http://stackoverflow.com/q/23595424
tags question: http://stackoverflow.com/q/23562293
tags question: http://stackoverflow.com/q/23597899
tags question: http://stackoverflow.com/q/23573195
tag name: for-loop
tags question: http://stackoverflow.com/q/23488847
tags question: http://stackoverflow.com/q/23499079
tags question: http://stackoverflow.com/q/23529975
tags question: http://stackoverflow.com/q/23614847
tags question: http://stackoverflow.com/q/23469116
tags question: http://stackoverflow.com/q/23471140
tags question: http://stackoverflow.com/q/23482441
tags question: http://stackoverflow.com/q/23550154
tags question: http://stackoverflow.com/q/23495326
type: Tag
tags question: http://stackoverflow.com/q/23565794
tags question: http://stackoverflow.com/q/23608866
tags question: http://stackoverflow.com/q/23598505
tags question: http://stackoverflow.com/q/23537824
tags question: http://stackoverflow.com/q/23521967
tags question: http://stackoverflow.com/q/23577076

http://stackoverflow.com/comment/36097148
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23530658
type: QuestionComment
has text: No, what I have now is the creation of the TABLES in the database (I have to create the database manually using pgAdmin3 before run the application). I want create the DATABASE through java code (to avoid final users have to do this themselves).

http://stackoverflow.com/q/23589709
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/36206515
has comment: http://stackoverflow.com/comment/36206361
has body: At the moment, I'm using HTMLUnit and it's painfully slow (>10s). final WebClient webClient = new WebClient(); HtmlPage page = webClient.getPage(url_with_hash_fragment); out.println(page.getElementById(hash_fragment).asXml()); Ideally, I'd like to do this without adding additional dependencies. (I'm not using HTMLUnit otherwise.) I tried using HTMLEditorKit but couldn't figure out how to use it for outerHTML. I'd rather not use regular expressions, but that's preferred to waiting 10s and bloating my code.
score: 0
has title: get HTML element outerHTML without 3rd-party libraries
tagged with: parsing
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/23539103
has comment: http://stackoverflow.com/comment/67320466
has answer: http://stackoverflow.com/a/44329065
tagged with: java
has answer: http://stackoverflow.com/a/23673373
answer count: 2
tagged with: sql
tagged with: jpa
downvote count: 0
score: 6
favorite count: 0
tagged with: distinct
has body: I was wondering if there's an equivalent of ResultTransformer.DISTINCT_ROOT_ENTITY to use in JPA Specifications? Right now, I'm trying to implement search functionality and I must use JPA Specifications for that (I'm not allowed to use CriteriaQuery or other alternatives). I have to execute a JOIN in the search query because there's a one to many relationship between entities. So, right now, I'm doing this: String type = "admin"; SpecificationBuilder sb = SpecificationBuilder.getInstance(); Specification&lt;WebContentImpl&gt; spec = new Specification&lt;WebContentImpl&gt;() { @Override public Predicate toPredicate(Root&lt;WebContentImpl&gt; root, CriteriaQuery&lt;?&gt; cq, CriteriaBuilder cb) { return cb.equal(root.join("users", JoinType.LEFT).get("type"), type); } }; sb.addSpecification(spec); As you can see, I can include a JOIN. Several users are mapped to a single web content item. However, when there are for example 3 users mapped to 1 web content item, the web content item should only be shown 1 time, but it's shown 3 times. I had this problem in the past, and the flag ResultTransformer.DISTINCT_ROOT_ENTITY helped me out then, but I can't use that functionality now. Sure, I can implement my own solution to leave out the doubles, but it will be terrible for the performance. And I already tried changing the JoinType, but the result was always the same. Anyone out there with some tips to help me? :-) Thanks in advance! Kind regards, K
has title: JPA Specification equivalent of ResultTransformer.DISTINCT_ROOT_ENTITY?
upvote count: 6
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/36255664
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23615626
has text: For the record, the diamond operator is introduced in Java 7, and Guava is targeted at Java 6+. The Guava authors in many cases do suggest using the JDK improvements that have since become available.

http://stackoverflow.com/a/23561665
score: 0
has comment: http://stackoverflow.com/comment/36153616
type: Answer
answers question: http://stackoverflow.com/q/23560777
has body: here is the answer just remove the fonts string and use only font name. Typeface tf = Typeface.createFromAsset(getAssets(),"Roboto-Thin.ttf");
has comment: http://stackoverflow.com/comment/36154015
has comment: http://stackoverflow.com/comment/36153654

http://stackoverflow.com/q/23598783
tagged with: class
has answer: http://stackoverflow.com/a/23598813
favorite count: 0
has title: getConstructor().getInstance(parameter) : java.lang.IllegalArgumentException: wrong number of arguments
type: Question
has comment: http://stackoverflow.com/comment/36223832
score: -2
tagged with: constructor
has answer: http://stackoverflow.com/a/23598820
has body: I can' add parameter with my constructor my code : import inteToM.CreateFileAction; // said not use import import dto.m.CreateFile; //... // code Class&lt;?&gt; dtoClass = Class.forName("dto.mToInte.CreateFile"); DtoM dto = (DtoM) JAXB.unmarshal(sr, dtoClass ); Class&lt;?&gt; actionClass = Class.forName("inteToM.CreateFileAction"); Constructor&lt;?&gt; actionConstruct = actionClass.getConstructor(); //dto.getClass() ActionM aAction = (ActionIM) actionConstruct.newInstance(dto); // not working ActionM bAction = (ActionIM) actionConstruct.newInstance(); // work my class : public class CreateFileAction { import dto.mToInte.CreateFile; public CreateFileAction () { System.out.println(" constructor null"); } public CreateFileAction (CreateFile file) { System.out.println(" constructor not null"); this.file_c= file; } } My error : java.lang.IllegalArgumentException: wrong number of arguments So I don't understand why I can't add parameter with my constructor. edit : If i make this : Constructor&lt;?&gt; actionConstruct = actionClass.getConstructor(CreateFileAction.class); I have this error : java.lang.NoSuchMethodException: inteToM.CreateFileAction.&lt;init&gt;(inteToM.CreateFileAction) If I make this : Constructor&lt;?&gt; actionConstruct = actionClass.getConstructor(CreateFile.class); I have this : java.lang.NoSuchMethodException: inteToM.CreateFileAction.&lt;init&gt;(dto.m.CreateFile) I Modify the dtoClass but I have the same prob. Thanks for help.
answer count: 2
downvote count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/36223806
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/a/38138264
has body: This Code worked for me. private class MyWebChromeClient extends WebChromeClient { //The undocumented magic method override //Eclipse will swear at you if you try to put @Override here // For Android 3.0+ public void openFileChooser(ValueCallback uploadMsg, String acceptType) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); MainActivity1.this.startActivityForResult(Intent.createChooser(i, "File Browser"), FILECHOOSER_RESULTCODE); } //For Android 4.1+ only protected void openFileChooser(ValueCallback&lt;Uri&gt; uploadMsg, String acceptType, String capture) { mUploadMessage = uploadMsg; Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); startActivityForResult(Intent.createChooser(intent, "File Browser"), FILECHOOSER_RESULTCODE); } protected void openFileChooser(ValueCallback&lt;Uri&gt; uploadMsg) { mUploadMessage = uploadMsg; Intent i = new Intent(Intent.ACTION_GET_CONTENT); i.addCategory(Intent.CATEGORY_OPENABLE); i.setType("*/*"); startActivityForResult(Intent.createChooser(i, "File Chooser"), FILECHOOSER_RESULTCODE); } // For Lollipop 5.0+ Devices public boolean onShowFileChooser(WebView mWebView, ValueCallback&lt;Uri[]&gt; filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) { if (uploadMessage != null) { uploadMessage.onReceiveValue(null); uploadMessage = null; } uploadMessage = filePathCallback; Intent intent = null; if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) { intent = fileChooserParams.createIntent(); } try { startActivityForResult(intent, REQUEST_SELECT_FILE); } catch (ActivityNotFoundException e) { uploadMessage = null; Toast.makeText(getApplicationContext(), "Cannot Open File Chooser", Toast.LENGTH_LONG).show(); return false; } return true; } @Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { Log.d("LogTag", message)…
answers question: http://stackoverflow.com/q/23568792
downvote count: 0
has comment: http://stackoverflow.com/comment/98347590
score: 13
type: Answer
has comment: http://stackoverflow.com/comment/98449941
upvote count: 13
has comment: http://stackoverflow.com/comment/98396357

http://stackoverflow.com/q/23538422
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23538870
has answer: http://stackoverflow.com/a/23539524
type: Question
downvote count: 0
has body: Consider I want to println the lines of a list of files, using the Java 8 streams API only. How would I write that? This is not my real case, just a very simplified form of it. File[] files; Arrays.stream(files). // what now? I thought about mapping it from File to Stream&lt;String&gt; but then I got stuck.
favorite count: 0
possible better answer: http://stackoverflow.com/a/23538681
has answer: http://stackoverflow.com/a/23538681
answer count: 3
has title: How to process stream of streams?
accepted answer: http://stackoverflow.com/a/23539524
upvote count: 1
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream

http://stackoverflow.com/comment/36297283
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23634282
has text: Yes all my Spring Libraries are on my classpath. Could you put some more light on what is bootstrap class loader and system loader? The classpath file created by eclipse looks like: <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Spring4.0.0+ApacheCommonsLogging1.1.3"/> <classpathentry kind="output" path="bin"/>

http://stackoverflow.com/a/24835738
type: Answer
has body: You're abusing the event modifiers in new and interesting ways ;) Try the following: if (arg0.getKeyCode() == NativeKeyEvent.VK_5 &amp;&amp; arg0.getModifiers() &amp; NativeInputEvent.CTRL_MASK) { If you are using JNativeHook with Swing/AWT please read the working with swing wiki section for how to properly interact with it. To address the accessibility issue; On OS X &lt; 10.9, the accessibility check box needs to be checked in the system preferences. In 10.9 and later, you must register each application requesting accessibility access independently. Most of the time this will simply need to be the java runtime unless you are using a wrapper to start Java (like eclipse does).
score: 0
answers question: http://stackoverflow.com/q/23466959

http://stackoverflow.com/q/23614475
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/23614659
tagged with: jsp
tagged with: struts2
has body: I am making a survey web app. For each question, I have like this: Question: this is a question. Please select the best choice. This is Option 1; This is Option 2; This is Option 3. *The option list is dynamic. And I am using Struts2 radio So in my Java action class, I have question.addOptions("This is option 1."); question.addOptions("This is option 2."); question.addOptions("This is option 3."); And in my jsp, I have &lt;s:radio label="Please select the best choice" name="answer" list="options"/&gt; where "answer" is an attribute(instance variable) of my action class, to record the selection. So right now as I select one of the options, I can see "answer" record the value as "This is Option x". Not bad. However, here is what I want to achieve. I want "answer" to value "x" instead of "This is Option x." But I have really not found a way to customize this part.
has answer: http://stackoverflow.com/a/23614659
has title: Struts2 Radio: how to customize the value of the input
upvote count: 1
answer count: 1

http://stackoverflow.com/q/23453048
has comment: http://stackoverflow.com/comment/35953493
has body: I am working with the last version of JeasyOpc on a server OPC RSLINX passing information of each tag to a database. Everything works fine, but it falls on the day of running, this depends of the workload. I know i need to handle well the memories, i have tried to optimize, but i need the advice of someone more experienced in java or Jeasyopc. pd. I changee the jre for the 1.7 . this is the log file. Thanks . # # An unexpected error has been detected by Java Runtime Environment: #enter code here # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x03d337d9, pid=4456, tid=5864 # # Java VM: Java HotSpot(TM) Client VM (10.0-b23 mixed mode windows-x86) # Problematic frame: # C [JCustomOpc.dll+0x637d9] # # If you would like to submit a bug report, please visit: # http://java.sun.com/webapps/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x03573400): JavaThread "Thread-4" [_thread_in_native, id=5864, stack(0x03e50000,0x03ea0000)] siginfo: ExceptionCode=0xc0000005, writing address 0xc503d337 Registers: EAX=0x03d55f04, EBX=0xc503d337, ECX=0x03d55f37, EDX=0x03d3a501 ESP=0x03e9f828, EBP=0x03e9f858, ESI=0x0355d9cc, EDI=0x00000007 EIP=0x03d337d9, EFLAGS=0x00010206 Top of Stack: (sp=0x03e9f828) 0x03e9f828: 03cd31cf 03d36eb5 03573400 14eb7f58 0x03e9f838: 00000001 034cb23c 00000001 00000001 0x03e9f848: 0355d9c0 03d55f84 03d55f94 0355d9d8 0x03e9f858: 03e9f878 00b38492 035734f4 03e9f868 0x03e9f868: 14eb7f58 14eb7f58 14eb7f58 00000001 0x03e9f878: 03e9f968 00b45808 00000014 00000000 0x03e9f888: 03e9f8c8 7c91e900 7c9201c0 ffffffff 0x03e9f898: 7c9201bb 7c3416b3 003f0000 00000000 Instructions: (pc=0x03d337d9) 0x03d337c9: e0 e9 cd 21 fa ff b1 37 d3 03 bb 37 d3 03 c5 37 0x03d337d9: d3 03 89 37 d3 03 93 37 d3 03 9d 37 d3 03 a7 37 Stack: [0x03e50000,0x03ea0000], sp=0x03e9f828, free space=318k Native frames: (J=compiled Java code, j=interpr…
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/35951557
has title: Eclipse : fatal error in JeasyOpc
tagged with: eclipse
tagged with: jeasyopc
type: Question
downvote count: 0

http://stackoverflow.com/comment/36016301
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23476523
has text: What's not to understand? The error clearly tells you that you can only use a FormComponent, and your NumberField is not a subclass of FormComponent.

http://stackoverflow.com/a/23613878
type: Answer
has comment: http://stackoverflow.com/comment/36252641
answers question: http://stackoverflow.com/q/23613704
has body: Use Random#nextInt(int) public int[] divideUniformlyRandomly(int number, int parts) { Random random = new Random(); int[] randoms = new int[]; for(int i = 0; i &lt; parts; i++) { randoms[randoms.length] = random.nextInt(number); } return randoms; }
score: 0
has comment: http://stackoverflow.com/comment/36252031
has comment: http://stackoverflow.com/comment/36252659

http://stackoverflow.com/q/23554476
has comment: http://stackoverflow.com/comment/36141161
has answer: http://stackoverflow.com/a/23554536
has title: Java API and interfaces
has answer: http://stackoverflow.com/a/23554799
has comment: http://stackoverflow.com/comment/36141122
has body: interface OperateBicycle What is the difference between Application Programming interface(Java API) and the above interface and the way they are coded/used?
answer count: 2
downvote count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/36141118
score: -3
type: UnansweredQuestion
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/a/23538035
answers question: http://stackoverflow.com/q/23537710
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Your error clearly says that while reading rgb point as code in line img1.getRGB(i, j); it is going out of Array for image RGB. Check the values of i &amp; j inside your inner for loop and check whether something you are doing wrong. As already Hirak pointed may be that you are not initializing your variables properly and so the reason it is going out of height or width.

http://stackoverflow.com/a/23549821
has body: Try System.out.println() rather than println()
type: Answer
answers question: http://stackoverflow.com/q/23549708
has comment: http://stackoverflow.com/comment/36132124
upvote count: 1
has comment: http://stackoverflow.com/comment/36132216
downvote count: 0
score: 1

http://stackoverflow.com/comment/36111878
has text: This is basically what I said [earlier](https://stackoverflow.com/questions/23536074/what-cause-java-util-concurrentmodificationexception-using-collections-synchroni/23536228?noredirect=1#comment36108929_23536815)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23536228
type: Comment

http://stackoverflow.com/comment/35960059
comment on: http://stackoverflow.com/a/23457237
score: 0
type: Comment
has text: I figured out the Else part was to big and should end after the html part, but now I get send for example the jpeg file I want but its damaged and can't be opened
type: AnswerComment

http://stackoverflow.com/comment/35988372
type: Comment
type: QuestionComment
has text: Why use threads if you want a strictly synchronous output?
score: 3
comment on: http://stackoverflow.com/q/23472896

http://stackoverflow.com/comment/35995298
type: Comment
type: QuestionComment
has text: @TomG If I exclude the .metadata folder then when opening the workspace in Eclipse the project doesn't show up. Not controlling anything in .metadata leaves you with the project not showing up. Import won't work directly because the project directory is already there. So you have to check out, move it out of the folder, then re-import it back into the workspace. Its just a cumbersome process which is why I posted the question :) Hoping there was something smoother like a way to tell Eclipse to recognize a project already in the workspace folder or something.
comment on: http://stackoverflow.com/q/23464040
score: 0

http://stackoverflow.com/q/23542358
score: 0
tagged with: java
answer count: 1
has title: ZK NotifyChange Single record from List not whole List?
has answer: http://stackoverflow.com/a/23559312
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21173839
has body: I have below code I want to NotiFy only Single item of he List not whole List as if we will NotiFy whole List it will reload data again which is consuming lots of memory and looks ugly.Anyone know Better way to increase performance of application? @Command public void valueChangedListnerForCombo( @BindingParam("Code") Combobox combobox, @BindingParam("BeanData") Record record, @BindingParam("ColumnName") String columnName) { super.valueChangedListnerForCombo(combobox, record, columnName); if (!adminNewListModelList.contains(record) &amp;&amp; !changedListModel.contains(record)){ changedListModel.add(record); BindUtils.postNotifyChange(null, null, this , "adminListboxViewModel"); } }
type: Question
tagged with: zk
accepted answer: http://stackoverflow.com/a/23559312

http://stackoverflow.com/a/23599872
type: Answer
answers question: http://stackoverflow.com/q/23599726
has body: You -could- have that linking to another html page which goes to the end uri. Unfortunately, Java is not a web browser.
score: 0

http://stackoverflow.com/comment/36001718
comment on: http://stackoverflow.com/q/23477585
score: 4
has text: You need to add the gdx-tools dependency to your game. It has the `TexturePacker` class to do what you want. lol @andengine...
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23546074
type: UnansweredQuestion
has body: I work with autoitx4java in my java project. That works fine until the window title I work with exists multiple times. Imagine I have three windows with the title "MyAppTitle" open: AutoItX x = new AutoItX(); int posX = x.winGetPosX("MyAppTitle"); Obviously a single value is returned. And it's the x-pos of the window "MyAppTitle" that I focused last. It's no problem to get the handles of the windows. But most of the methods autoitx4java provides require the window title as parameter. How can I access the windows with their handle? Or is there a better library I could use? UPDATE: From the official AutoIt website: When you have a handle you may use it in place of the title parameter in any of the function calls that use the title/text convention. But it doesn't work within the autoitx4java library.
has comment: http://stackoverflow.com/comment/36328444
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/36294133
has title: Work with handles in autoitx4java
tagged with: autoit
tagged with: handle
has comment: http://stackoverflow.com/comment/36137500
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36152967
score: 1
tagged with: java
favorite count: 0
has comment: http://stackoverflow.com/comment/36149786

http://stackoverflow.com/a/23610080
accepted answer of: http://stackoverflow.com/q/23609711
score: 2
answers question: http://stackoverflow.com/q/23609711
upvote count: 2
type: AcceptedAnswer
has body: You can change the heap size in jboss startup file, edit bat or sh file and search for -Xms and change it to your required size.
downvote count: 0
type: Answer

http://stackoverflow.com/comment/36101938
comment on: http://stackoverflow.com/q/23533402
type: Comment
type: QuestionComment
has text: It's a replacement(an alternative).
score: 0

http://stackoverflow.com/q/23462476
tagged with: android-activity
tagged with: android-intent
type: Question
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/23462791
score: 0
has body: I need help to reset an entire activity after i am done with it, so that when I comeback to it, everything is back to it's original setting. So, I have an activity named ColorGame and Scoreboard. What I want to happen is to after I finish playing in ColorGame Activity, it will go to Scoreboard (which is working fine). Then in Scoreboard Activity, I have a button that either will go to the main menu or to go back and play again in ColorGame Activity. I have an intent from Scoreboard to the ColorGame activity, however, everytime I click the PLAYAGAIN button to return to play the game again, the points and time is still the same number from the previous game. Could you guys help me? I have these codes. This is my code for ColorGame to ScoreBoard: Intent goScoreBoard = new Intent(ColorGame.this, ScoreBoard.class); goScoreBoard.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); finish(); startActivity(goScoreBoard); and this is my codes for ScoreBoard to ColorGame: Intent playAgain = new Intent(ScoreBoard.this, ColorGame.class); playAgain.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); finish(); startActivity(playAgain);
has title: Reset Entire Activity in Eclipse
answer count: 1
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/23476440
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/23476387
type: Answer
upvote count: 4
has body: Use SharedPreferences for that. You should store a key after the "first time" code is executed and check it on subsequent executions.

http://stackoverflow.com/q/23579290
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36247477
downvote count: 0
tagged with: java
type: Question
has body: Trying to run sample code from here http://tess4j.sourceforge.net/codesample.html I got an error saying Error: Illegal min or max specification! signal_termination_handler:Error:Signal_termination_handler called:Code 5002 I found solution e.g. here https://code.google.com/p/tesseract-ocr/issues/detail?id=228 ppl say that setting locale is enough to get rid of error. My problem is that I write it in Java not C++ and I cannot find anywhere how I can set locale in my code as they did it like that #include &lt;locale.h&gt; setlocale (LC_NUMERIC, "C"); I was trying to use setTessVariable(String, String) method but it didn't work. I will mention that my pdf files, which are on input, are in polish language so if someone know how I should set these locale I would be grateful. I try to run it on linux x64 platform.
score: 5
has answer: http://stackoverflow.com/a/35390563
answer count: 2
has comment: http://stackoverflow.com/comment/36244941
has comment: http://stackoverflow.com/comment/36193995
favorite count: 0
tagged with: linux
upvote count: 5
has answer: http://stackoverflow.com/a/23678145
possible better answer: http://stackoverflow.com/a/35390563
accepted answer: http://stackoverflow.com/a/23678145
has title: Tesseract error. Illegal min or max specification
tagged with: tesseract

http://stackoverflow.com/a/23489330
upvote count: 3
type: Answer
has body: Since you are only reading the elements of the Set, I would recommend a for-each loop, which is basically the same as your code (the first snippet) but has been designed for this kind of situations (and is more readable IMO). HashSet&lt;String&gt; vectors = new HashSet&lt;String&gt;(); for(String temp : vectors){ System.out.println("Next element inside HashSet is " + temp); out.write(temp + "\n"); }
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/23489258
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23489258

http://stackoverflow.com/q/23499690
tagged with: java
has body: I'm trying to create a project with glassfish JSF and JPA, but I'm having trouble with the persistence unit in the persistence.xml file. The error is the following: GlassFish 3.1 at localhost 2014-05-06T12:47:52.326-0300|INFO: Initializing Mojarra 2.1.6 (SNAPSHOT 20111206) for context '/K19-Integracao-JSF-JPA' 2014-05-06T12:47:52.649-0300|SEVERE: WebModule[/K19-Integracao-JSF-JPA]PWC1270: Exception starting filter br.com.k19.filters.JPAFilter java.lang.InstantiationException at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:124) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4685) at org.apache.catalina.core.StandardContext.start(StandardContext.java:5377) at com.sun.enterprise.web.WebModule.start(WebModule.java:498) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2018) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669) at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109) at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085) at com.sun.ente…
tagged with: persistence.xml
has answer: http://stackoverflow.com/a/23500342
answer count: 2
tagged with: jpa
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/23500342
possible better answer: http://stackoverflow.com/a/23499898
has answer: http://stackoverflow.com/a/23499898
has title: Error java.lang.InstantiationException
has comment: http://stackoverflow.com/comment/36038284
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: jsf

http://stackoverflow.com/q/23579155
possible better answer: http://stackoverflow.com/a/23579307
has answer: http://stackoverflow.com/a/23974255
has answer: http://stackoverflow.com/a/23579307
has title: English to Morse code translator
has answer: http://stackoverflow.com/a/23579206
type: AnsweredQuestion
tagged with: java
type: Question
has body: The code is suppose to translate from English to Morse code. Everything works just fine, except in the for loop, it only translates the first letter of the Message(String A). Why? Example, I make string A="America"... Then it becomes "america"(because of the toLowerCase()) but when it goes to the for loop, it will only translate the first "a", and that's it, like this: ".-|||||||" (a= ".-").. My code: import java.util.Scanner; class MORSE3{ public static void main(String[] args){ String A; Scanner bola=new Scanner(System.in); System.out.println("Introdusca la frase: "); A=bola.nextLine(); int B=A.length(); int C,X,Y; Y=1; X=0; System.out.println("Traduccion: "); String Mor[]={".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-..","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."}; A=A.toLowerCase();//Para hacer las letra minusculas; System.out.println(A.charAt(X)); for(C=0;C&lt;B;C++){ switch(A.substring(X,Y)){ case "a": System.out.print(Mor[0]+"|"); X+=1; Y+=1; break; case "b": System.out.print(Mor[1]+"|"); X+=1; Y+=1; break; case "c": System.out.print(Mor[2]+"|"); X+=1; Y+=1; break; case "d": System.out.print(Mor[3]+"|"); X+=1; Y+=1; break; case "e": System.out.print(Mor[4]+"|"); X+=1; Y+=1; break; case "f": System.out.print(Mor[5]+"|"); X+=1; Y+=1; break; case "g": System.out.print(Mor[6]+"|"); X+=1; Y+=1; break; case "h": System.out.print(Mor[7]+"|"); X+=1; Y+=1; break; case "i": System.out.print(Mor[8]+"|"); X+=1; Y+=1; break; case "j": System.out.print(Mor[9]+"|"); X+=1; Y+=1; break; case "k": System.out.print(Mor[10]+"|"); X+=1; Y+=1; break; case "l": System.out.print(Mor[11]+"|"); X+=1; Y+=1; break; case "m": System.out.print(Mor[12]+"|"); X+=1; Y+=1; break; case "n": System.out.print(Mor[13]+"|"); X+=1; Y+=1; break; case "o": System.out.print(Mor[14]+"|"); X+=1; Y+=1; break; case "p": System.out.print(Mor[15]+"|"); X+=1; Y+=1; break; case "q": System.out.print(Mor[16]+"|"); X+=1; Y+=1; break; case "r":…
accepted answer: http://stackoverflow.com/a/23579206
has comment: http://stackoverflow.com/comment/36187062
score: 0
answer count: 3

http://stackoverflow.com/a/50632720
has body: Similar to the accepted answer, I attempted to write a Kotlin extension method for this. Here's the accepted answer in Kotlin @Suppress("DEPRECATION") fun Context.getText(id: Int, vararg args: Any): CharSequence { val escapedArgs = args.map { if (it is String) TextUtils.htmlEncode(it) else it }.toTypedArray() return Html.fromHtml(String.format(Html.toHtml(SpannedString(getText(id))), *escapedArgs)) } The problem with the accepted answer, is that it doesn't seem to work when the format arguments themselves are styled (i.e. Spanned, not String). By experiment, it seems to do weird things, possibly to do with the fact that we're not escaping non-String CharSequences. I'm seeing that if I call context.getText(R.id.my_format_string, myHelloSpanned) where R.id.my_format_string is: ===%1$s=== and myHelloSpanned is a Spanned that looks like hello (i.e. it would have HTML hello) then I get ===hello=== (i.e. HTML ===hello===). That is wrong, I should get ===hello===. I tried to fix this by converting all CharSequences to HTML before applying String.format, and here is my resulting code. @Suppress("DEPRECATION") fun Context.getText(@StringRes resId: Int, vararg formatArgs: Any): CharSequence { // First, convert any styled Spanned back to HTML strings before applying String.format. This // converts the styling to HTML and also does HTML escaping. // For other CharSequences, just do HTML escaping. // (Leave any other args alone.) val htmlFormatArgs = formatArgs.map { if (it is Spanned) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { Html.toHtml(it, Html.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE) } else { Html.toHtml(it) } } else if (it is CharSequence) { Html.escapeHtml(it) } else { it } }.toTypedArray() // Next, get the format string, and do the same to that. val formatString = getText(resId); val htmlFormatString = if (formatString is Spanned) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { Html.toHtml(formatString, Html.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE) } else { …
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/92433030
downvote count: 0
answers question: http://stackoverflow.com/q/23503642
type: Answer

http://stackoverflow.com/q/23506282
type: Question
has body: So I have this enhanced for loop that finds the most frequent, second most frequent, and third most frequent. but if I wanted the like the top 10 most frequent values. What would be the best solution instead of my way?
answer count: 2
has title: Simpler way to find most frequent, second most frequent, and third most frequent value using Maps
score: 0
has answer: http://stackoverflow.com/a/23506327
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23506313

http://stackoverflow.com/q/23591003
score: 1
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/23591552
accepted answer: http://stackoverflow.com/a/23591552
tagged with: second-level-cache
upvote count: 1
favorite count: 0
answer count: 1
has body: i am using both second level cache and query cache. Here is the code snippet //first block session = factory.openSession(); company1=(Company)session.get(Company.class, 1); session.close(); //second block session = factory.openSession(); tx = session.beginTransaction(); Query updateQuery=session.createQuery("update Company set companyName = 'newCompany' where companyId=1"); updateQuery.setCacheable(true); updateQuery.executeUpdate(); tx.commit(); session.close(); //Third block session = factory.openSession(); company1=(Company)session.get(Company.class, 1); // line 1 session.close(); In second block i did update in query . In third block i am getting the company record thru second level cache. What i was expecting i will get the same result(in 3rd block) what i got in first block but i got the updated record (done by query update in 2nd block) i.e "newCompany" at line 1 So looks like query cache and second level cache are in synch with each other as update done by query cache is picked by second level cache. UPDATE:- So How does query and second level cahe works in synch? I mean does query cache first check under second level cache whether there has been any update for the given query parameter?
has title: Does query and second level cache works in synchronization?
tagged with: query-cache
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36209535
downvote count: 0
has comment: http://stackoverflow.com/comment/36209264

http://stackoverflow.com/comment/36082867
comment on: http://stackoverflow.com/q/23523271
score: 0
type: Comment
type: QuestionComment
has text: I have a hunch you can probably just do salesdata[i-1] where i is the input, but we need another couple test cases

http://stackoverflow.com/q/23602151
type: Question
answer count: 1
has body: How to get client's ip behind upstream in nginx? Now I use next configs: # upstream listener upstream ts { server localhost:841 weight=10 max_fails=3 fail_timeout=10s; server 10.1.3.209:8080 backup; } # server listener server { listen 80; server_name 10.9.24.45; location / { proxy_pass http://ts; proxy_set_header Host $host; proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } # app listener server { listen 841; server_name localhost; charset utf-8; access_log /var/log/nginx/access_ts.log; error_log /var/log/nginx/error_ts.log; client_max_body_size 16M; set $www /www; set $root $www/apps/ts/ROOT; include /etc/nginx/sites-available/locations; location / { proxy_pass http://localhost:840; proxy_set_header Host $host; proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; include /etc/nginx/sites-available/location-config; } } In my java app I use X-Real_IP header to get client's ip and all were fine, but after I start use another config with upstream I see only 127.0.0.0. Think this correct, but I need to get a real ip for my app. How can I get a real ip behind nginx upstream? I see some answers like proxy_set_header realip $remote_addr, but what can I do without my java app change.
has answer: http://stackoverflow.com/a/23616082
has comment: http://stackoverflow.com/comment/39033718
tagged with: unix
score: 0
type: UnansweredQuestion
tagged with: nginx
tagged with: java
has title: Get client's real ip behind upstream

http://stackoverflow.com/q/23470459
downvote count: 4
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23486147
favorite count: 0
tagged with: android
tagged with: soap
has body: Android code: SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); PropertyInfo propInfo = new PropertyInfo(); propInfo.type = PropertyInfo.STRING_CLASS; // adding parameters request.addProperty("userID", "18"); //request.addProperty("password", "iprint"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { androidHttpTransport.call(SOAP_ACTION, envelope); Log.e("Object response", "Before response "); resultsRequestSOAP = (SoapObject) envelope.bodyIn; //SoapObject response = (SoapObject) envelope.getResponse(); SoapObject returnObj = (SoapObject)resultsRequestSOAP.getProperty("return"); //Integer id = Integer.valueOf(returnObj.getProperty("id"); //String username = (String)returnObj.getProperty("value"); Log.v("key", returnObj.getProperty(2).toString()); //log.v("values", username); Log.e("Object response",""+resultsRequestSOAP); } catch (Exception e) { e.printStackTrace(); Log.v("error", e.toString()); } Now I'm getting this out : getProfileResponse{ return=Map{ item=anyType{key=firstName; value=Donette; }; item=anyType{key=lastName; value=Foller; }; item=anyType{key=company; value=; }; item=anyType{key=address1; value=34 Center St; }; item=anyType{key=address2; value=; }; item=anyType{key=city; value=Hamilton; }; item=anyType{key=state; value=41; }; item=anyType{key=postcode; value=45011; }; item=anyType{key=country; value=1; }; item=anyType{key=telephone; value=513-570-1893; }; item=anyType{key=mobile; value=513-549-4561; }; item=anyType{key=fax; value=513-570-1893; }; }; } But I need output like this:- firstName,Donette lastName,Foller .. .. .. fax,513-570-1893;
tagged with: http://stackoverflow.com/tag/xml
score: -4
accepted answer: http://stackoverflow.com/a/23486147
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/35983500
has title: How to print SOAP response data separately in Android
type: Question
has comment: http://stackoverflow.com/comment/35983449

http://stackoverflow.com/q/23543459
favorite count: 0
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23543500
has comment: http://stackoverflow.com/comment/36120024
score: 1
tagged with: java
has title: java - how to replace a jPanel based on user clicks
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/23543500
answer count: 1
tagged with: user-interface
has body: i have a jPanel containing 3 menus--lets call it MenuPanel i place it on the top of my jFrame (border_layout top). i have also 3 jPanels (PanelOne, PanelTwo, PanelThree) and i want it to be showed on the bottom of the jFrame (border_layout bottom) based on the menu that the user choose

http://stackoverflow.com/a/45249928
has comment: http://stackoverflow.com/comment/77503503
has comment: http://stackoverflow.com/comment/77499718
downvote count: 0
answers question: http://stackoverflow.com/q/23559789
type: Answer
score: 1
has body: The only way I can think of to detect changes using only MySQL is to parse the binary logs. Since you asked for alternatives to that, you could use a messaging system (e.g. Apache ActiveMQ) to send cache invalidation messages between nodes so that each node can clear its own cache.
upvote count: 1

http://stackoverflow.com/comment/36159423
type: QuestionComment
comment on: http://stackoverflow.com/q/23564363
has text: Please post MCVE (Minimal Complete and Verifiable Example). By the mean time please check the return type of JdateChooser.getDate() if it is java.util.Date then try java.sql.Date sqldate = new java.sql.Date(jDateChooser3.getDate()getTime());
score: 0
type: Comment

http://stackoverflow.com/comment/36057347
comment on: http://stackoverflow.com/a/23509238
has text: Hi Sanjaya Pandey, thanks for the easiest way to tackle the toughest.
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36166231
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23564563
has text: @mmc18 you can add a property to the command line just so you can tell one from another.
type: Comment

http://stackoverflow.com/comment/35981899
has text: ok, i added the stack trace
comment on: http://stackoverflow.com/q/23469583
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36138330
type: QuestionComment
comment on: http://stackoverflow.com/q/23552126
score: 0
has text: What do you mean by "scale it up"? Is there a bufferedImage method to do so? Also, the interpolation would also be useful when zoomed out a lot with the small sprites.
type: Comment

http://stackoverflow.com/q/23468653
upvote count: 1
has comment: http://stackoverflow.com/comment/35980137
tagged with: import
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/23468808
tagged with: javascript
score: -1
tagged with: tomcat
tagged with: ajax
has title: how to import java project into eclipse to run on tomcat server
favorite count: 0
has answer: http://stackoverflow.com/a/23468856
type: UnansweredQuestion
has body: Please Provide steps to import project from outside to run on tomcat server means to get the output in browser, I have an on-line banking project using JSP,AJAX,JavaScript.
tagged with: java
downvote count: 2

http://stackoverflow.com/a/23549857
answers question: http://stackoverflow.com/q/23548372
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23548372
type: Answer
upvote count: 1
has body: "but if I write something to the text box nothing is updating in the class property." You're probably going to want to implement a DocumentListener to listen for changes in the underlying document of the text field. Every time the document changes, for instance the typing in of a letter, a DocumentEvent will be fired. You can see How to Write a DocumentListener
score: 1

http://stackoverflow.com/comment/36210064
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/23591719
has text: find last Index Of / and split from there.
type: Comment

http://stackoverflow.com/q/23608024
has body: I use JavaCV for Gender Classification. My problem is that i have different result on each prediction for the some subject (face). So it's possible to have 2 different results for the some face! example face 1: first prediction -> Male second prediction -> Female My Question is if it's normal to receive different result on each prediction for the same subject? Thanks.
answer count: 1
has comment: http://stackoverflow.com/comment/36244857
tagged with: opencv
has answer: http://stackoverflow.com/a/23608212
has comment: http://stackoverflow.com/comment/36243496
type: UnansweredQuestion
tagged with: javacv
tagged with: prediction
type: Question
has title: OpenCV, JavaCV Random prediction results for the some subject
tagged with: classification
score: 0
tagged with: java

http://stackoverflow.com/comment/36106048
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23513324
type: QuestionComment
has text: I have formatted your code so that it's actually legible. Next time you post a question, do it right the _first_ time - with **formatted** code and an explanation of what you are trying to achieve. If you're lucky and the gods of SO are in a good mood then question should be re-opened.

http://stackoverflow.com/q/23513497
answer count: 2
possible better answer: http://stackoverflow.com/a/23513538
downvote count: 0
has title: Java thread crashes silently - I can't catch the exception
favorite count: 0
tagged with: exception
tagged with: executorservice
score: 2
has answer: http://stackoverflow.com/a/23513571
upvote count: 2
tagged with: executors
tagged with: multithreading
has body: I see a behavior from I can't explain I have a Runnable that it's code is something of: run() { print("start"); try{ doSomething(); print("end"); }catch (Exception e){ print("problem"); } print("method end"); } The behavior is strange because the only print I get is "start" - I would expect to get the "problem" and the "method end" prints also. And if the doSomething handles the exception itself - so the "end" would be printed. But I don't get any of the prints except "start" Now i know that there is some issue with the doSomething method as if I run it not through the executor service, I get "Method Not Found" exception. I think it might be somehow connected to the Executor service that I use - Executors.newFixedThreadPool, but I can't explain it Thanks for your advice!
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23513538
accepted answer: http://stackoverflow.com/a/23513571

http://stackoverflow.com/q/23471234
favorite count: 0
tagged with: weblogic-10.x
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36014641
has comment: http://stackoverflow.com/comment/38779917
score: 1
has answer: http://stackoverflow.com/a/30662193
tagged with: java
has comment: http://stackoverflow.com/comment/37676443
tagged with: jrockit
upvote count: 1
has body: I have installed OCCAS 5.1 (wlserver_10.3) and created a domain. I am using jrockit-jdk1.6.0_45-R28.2.7-4.1.0. When I am starting the weblogic, I am getting the below error. As some answers suggested, I have also configured host_ip , but no luck. Did anybody face this issue? It works when I use Open JDK [root@localhost bin]# ./startWebLogic.sh . . JAVA Memory arguments: -Xms512m -Xmx512m . WLS Start Mode=Development . CLASSPATH=/root/Oracle/Middleware/patch_wls1036/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/root/Oracle/Middleware/patch_occas510/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/root/jrockit-jdk1.6.0_45-R28.2.7-4.1.0/lib/tools.jar:/root/Oracle/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/root/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:/root/Oracle/Middleware/modules/features/weblogic.server.modules_10.3.6.0.jar:/root/Oracle/Middleware/wlserver_10.3/server/lib/webservices.jar:/root/Oracle/Middleware/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/root/Oracle/Middleware/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar:/root/Oracle/Middleware/wlserver_10.3/sip/server/lib/weblogic_sip.jar:/root/Oracle/Middleware/occas_5.1/server/lib/platform/occas_depended.jar:/root/Oracle/Middleware/wlserver_10.3/common/derby/lib/derbyclient.jar:/root/Oracle/Middleware/wlserver_10.3/server/lib/xqrl.jar . PATH=/root/Oracle/Middleware/wlserver_10.3/server/bin:/root/Oracle/Middleware/modules/org.apache.ant_1.7.1/bin:/root/jrockit-jdk1.6.0_45-R28.2.7-4.1.0/jre/bin:/root/jrockit-jdk1.6.0_45-R28.2.7-4.1.0/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin . *************************************************** * To start WebLogic Server, use a username and * * password assigned to an admin-level user. For * * server administration, use the WebLogic Server * * console at http://hostname:port/console * *****************************************…
type: Question
tagged with: weblogic
has title: Assertion 'ia_addressID' failed while starting weblogic/OCCAS
has comment: http://stackoverflow.com/comment/36086226
has comment: http://stackoverflow.com/comment/35997687
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/36149111
type: Comment
comment on: http://stackoverflow.com/a/23508636
score: 0
type: AnswerComment
has text: I recreated the entire class in a different package and now it's working... There must have been something odd going on with eclipse.

http://stackoverflow.com/comment/36229649
has text: Do you have mapping for /ws/simple/Apicode
comment on: http://stackoverflow.com/q/23513815
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36113276
comment on: http://stackoverflow.com/a/23521871
type: AnswerComment
score: 0
has text: @r.bhardwaj: "Also as per android documentation, the url parameter in shouldOverrideUrlLoading method is the new url about to be loaded in the current WebView" -- correct. That means that you are changing the characteristics of the `WebView` for the page that is *currently* loaded, before the `WebView` loads the page indicated by the supplied URL. `WebView` has its own threading model, and I have no idea if they have suspended web workers, etc. while all of this is going on.
type: Comment

http://stackoverflow.com/comment/36058181
type: QuestionComment
score: 2
has text: If not sure in what part the problem is, you could try to first comment all database accesses and and the file copy at the end, than allow separately database and file copy.
comment on: http://stackoverflow.com/q/23510007
type: Comment

http://stackoverflow.com/comment/36249285
has text: @user233552 I forgot a word. I wanted to write : "But if you plan to add ..."
type: AnswerComment
comment on: http://stackoverflow.com/a/23609505
score: 0
type: Comment

http://stackoverflow.com/a/23563446
upvote count: 1
downvote count: 0
has body: If you have a Person class, make a map like: Map&lt;Person, Collection&lt;String&gt;&gt;. Then you can find phone numbers by doing map.get(somePerson), which returns null if the person doesn't exist. You could also consider making a PhoneNumber class, which contains the string value of a validated phone number: Map&lt;Person, Collection&lt;PhoneNumber&gt;&gt;.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/23563343

http://stackoverflow.com/q/23532783
tagged with: java
score: 0
tagged with: javadoc
has answer: http://stackoverflow.com/a/23534022
has body: I am using Eclipse for development, and want class comment to appear in following format(Automatically) . I tried modifying Templates from Preference but it didn't help. Please advice. /*+---------------------------------------------------------------------- || || Class abc.xyz.TestClass || || @author: ABC || || Purpose: XXXXXX || || implements: com.abc.I1, com.abc.I2 || extends: com.abc.xyz.C1 || |+-----------------------------------------------------------------------*/
has title: Need java class comment to appear in following format(Automatically)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36101353
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36102030
has comment: http://stackoverflow.com/comment/36100854

http://stackoverflow.com/a/23496948
has comment: http://stackoverflow.com/comment/44920506
has body: You should add the permissions that you want to use in your android-manifest.xml. Add the following lines to the android-manifest.xml. &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_GPS" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_LOCATION" /&gt;
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36037582
has comment: http://stackoverflow.com/comment/36033509
has comment: http://stackoverflow.com/comment/36037808
answers question: http://stackoverflow.com/q/23496838
has comment: http://stackoverflow.com/comment/45305420
downvote count: 0

http://stackoverflow.com/comment/36102078
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23533133
score: 0
has text: well its all on you i think, you import the class and it will refer the same, even if you use auto import it will ask you if there are same classes available from different packages!

http://stackoverflow.com/comment/36013037
has text: tried @www.sblog.in but still didnt work
score: 0
comment on: http://stackoverflow.com/q/23485916
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23469933
has comment: http://stackoverflow.com/comment/108113241
type: Answer
answers question: http://stackoverflow.com/q/23469784
has comment: http://stackoverflow.com/comment/35982946
has comment: http://stackoverflow.com/comment/35982564
upvote count: 13
has comment: http://stackoverflow.com/comment/139323156
score: 13
has body: You need Setter methods to allow Jackson to set the properties, and you need to change the fields in the json to begin with a lower case letter: public class Response { private Object ResObj; private int ResInt; public Object getResObj() { return ResObj; } public void setResObj(Object ResObj) { this.ResObj = ResObj; } // ... } and: {"resObj":{"clientNum":"12345","serverNum":"78945","idNum":"020252"},"resInt":0} The reason for the JSON change is that the Jackson bean serialisation will reflect over the class, and when it sees getXyz() and setXyz() methods it will map these to a Json field named "xyz" (and not "Xyz"). I think there are several ways to override this behaviour, one is to use the one of the Jackson annotations.
has comment: http://stackoverflow.com/comment/36041947
has comment: http://stackoverflow.com/comment/108273475
downvote count: 0
has comment: http://stackoverflow.com/comment/35983308

http://stackoverflow.com/q/23504649
has comment: http://stackoverflow.com/comment/36088631
has comment: http://stackoverflow.com/comment/36047796
score: 0
has comment: http://stackoverflow.com/comment/36090249
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36133947
has comment: http://stackoverflow.com/comment/36088855
answer count: 0
has comment: http://stackoverflow.com/comment/36087551
has title: Android: Changing a View size
tagged with: java
has body: I have a View, kv which has a parent. I'm trying to move kv so its to the right half of the screen, currently its full width. This is my code kv.getRootView().setPadding(50, 0, 0, 0); LayoutParams lp = kv.getLayoutParams(); lp.width = LayoutParams.MATCH_PARENT; kv.setLayoutParams(lp); idea is to pad the parent then make the kv fill the parent. However, it moves it left 50 pixels, but doesn't change width, so it goes of the screen. Any help? If it matters, the LayoutParams I'm using is android.view.ViewGroup.LayoutParams
type: Question
has comment: http://stackoverflow.com/comment/36087376
has comment: http://stackoverflow.com/comment/36088816

http://stackoverflow.com/comment/36098213
type: Comment
comment on: http://stackoverflow.com/a/23531343
type: AnswerComment
score: 0
has text: To quote the question "but in some cases the SQL command is generated dynamically and this will result in slightly different SQL commands" Therefore I can't make this a constant. And unfortunately no the compiler will not optimize the code as you're suggesting for Strings.

http://stackoverflow.com/a/23460190
has comment: http://stackoverflow.com/comment/35965915
has comment: http://stackoverflow.com/comment/35968185
has comment: http://stackoverflow.com/comment/35966251
has comment: http://stackoverflow.com/comment/35965126
answers question: http://stackoverflow.com/q/23459852
type: Answer
has comment: http://stackoverflow.com/comment/35965287
has comment: http://stackoverflow.com/comment/35965551
has comment: http://stackoverflow.com/comment/35968614
has comment: http://stackoverflow.com/comment/35965148
has comment: http://stackoverflow.com/comment/35966359
has comment: http://stackoverflow.com/comment/35965264
has comment: http://stackoverflow.com/comment/35965999
has comment: http://stackoverflow.com/comment/35965786
has comment: http://stackoverflow.com/comment/35966428
has comment: http://stackoverflow.com/comment/35965003
has comment: http://stackoverflow.com/comment/35965326
has comment: http://stackoverflow.com/comment/35966087
has comment: http://stackoverflow.com/comment/35965872
has comment: http://stackoverflow.com/comment/35966448
has comment: http://stackoverflow.com/comment/35965615
has comment: http://stackoverflow.com/comment/35965043
has comment: http://stackoverflow.com/comment/35966106
has body: Ok, after developing some pseudo and some logic, I have noticed that Andorid doesn't have an exit method in the way that you're hoping. When first reading the question I didn't realise that it was Android as I was multi-tasking. As you may notice, almost every android application doesn't have an exit button, and there is a reason for this. The reason being that Android is supposedly meant to load and unload applications through the OS, hence why you don't do it. If the user wanted to exit the application, they would do what they do with every other, enter the multi-tasking menu and swipe it off. Please read the following for more information: http://android.nextapp.com/site/fx/doc/exit
has comment: http://stackoverflow.com/comment/35968332
score: 0
has comment: http://stackoverflow.com/comment/35965201
has comment: http://stackoverflow.com/comment/35968416

http://stackoverflow.com/q/23555768
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: How to implement a board game like interface in LibGDX using Scene2D
has body: I'm just starting with game development and decided to make a 2048 clone using LibGDX to learn the basics. I started to implement it using a simple 2D array and it works, but the problem is that there aren't any animations. So, for example if there's a tile that is at position [0][0] and after the user swipes the screen it has to move to [0][3], that transition occurs instantly (since I'm basically just updating my 2D array and re-rendering the tiles). I was told this kind of board game-like UI is the perfect scenario to use Scene2D. I can very easily implement the basic 4x4 grid using Actors, but my question is, how do I correctly manage what is essentially a 2D structure using a Scene2D? I already have the algorithms to handle where to move the tiles if the user swipes the board (left, right, top, down) and update a 2D array, but it feels like if I'm using a Scene2D, using this secondary 2D array data structure is overkill. Right now my approach is: Create a 2D array and Scene2D with my tiles When user swipes, update the 2D array with the new position of the tiles Iterate over the actors in the Scene2D and compare it with the tiles I have in my updated 2D array. If there have been changes, animate them (basic transition from the tile's original position to it's final position) I just felslike I have unnecessary steps and also and unnecessary data structure here. What would be the correct way to handle this sort of scenario? Appreciate helpful advices, thanks!
has answer: http://stackoverflow.com/a/23563110
score: 2
tagged with: java
type: Question
tagged with: libgdx
has comment: http://stackoverflow.com/comment/36148547

http://stackoverflow.com/comment/36017200
score: 0
type: Comment
type: QuestionComment
has text: ... what is your question?
comment on: http://stackoverflow.com/q/23488186

java-stream
tags question: http://stackoverflow.com/q/23548589
tag name: java-stream
tags question: http://stackoverflow.com/q/23572318
type: Tag
tags question: http://stackoverflow.com/q/23512819
tags question: http://stackoverflow.com/q/23462209
tags question: http://stackoverflow.com/q/23581058
tags question: http://stackoverflow.com/q/23489993
tags question: http://stackoverflow.com/q/23538422
tags question: http://stackoverflow.com/q/23573274

http://stackoverflow.com/a/23587962
has comment: http://stackoverflow.com/comment/36206076
has comment: http://stackoverflow.com/comment/36263166
has comment: http://stackoverflow.com/comment/36224092
answers question: http://stackoverflow.com/q/23587875
type: Answer
has comment: http://stackoverflow.com/comment/36233408
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36226958
has comment: http://stackoverflow.com/comment/36224315
downvote count: 0
has comment: http://stackoverflow.com/comment/36262792
has comment: http://stackoverflow.com/comment/36224425
has body: You aren't committing the transaction to the database. In order for the changes made by ps.executeUpdate(); to become permanent, you will need to call conn.commit(); after the update. Similarly, in your catch block you should call conn.rollback(); so as to avoid the possibility of dud data being inserted into the database. I can't see the declaration for conn, so I assume it's a member variable whatever class createUser belongs to. You might want to consider changing the Connection to be a local in the method, so that you don't forget to close it once it's no longer needed (which should be once you've committed). Lastly, if you're using Java 7+, you can take advantage of try-with-resources to handle the closing of your PreparedStatement, ResultSet and Connection for you (although you don't appear to be using the ResultSet for anything, so consider removing it from the method). Here are two examples of what I meant (one for Java 6 and below, and one for Java 7 and later utilising try-with-resources: Java 6- public void createUser(String userName, String pass) { PreparedStatement ps = null; Connection conn = null; String pw_hash = BCrypt.hashpw(pass, BCrypt.gensalt()); try { // Acquire a Connection here rather than using a member variable // NOTE: See Braj's answer for a better way of doing this // using his ConnectionUtil class. conn = DriverManager.getConnection( "jdbc:mysql://localhost/awardtracker", "awtrack", "**************"); ps = conn.prepareStatement( "INSERT INTO at_accounts (acc_email_address, acc_password," + " acc_enabled) " + "VALUES (?, ?, ?)"); ps.setString(1, userName); ps.setString(2, pw_hash); ps.setString(3, "1"); ps.executeUpdate(); conn.commit(); } catch (SQLException e) { try { conn.rollback(); } catch (SQLException e2) { System.out.println("Error rolling back transaction."); e2.printStackTrace(); } System.out.println("SQLException createUser 1."); e.printStackTrace(); } finally { if (ps != null) { try { ps.close(); } catch (SQLException e) { Sy…

http://stackoverflow.com/a/23521185
type: Answer
has comment: http://stackoverflow.com/comment/36110625
downvote count: 0
score: 1
has body: I suspect your code is not using the Cassandra connections in a threadsafe manner: care must be taken to only allow one thread to access a connection at a time. I do not know how Kundera approaches this, because JPA will generate incredibly inefficient queries for Cassandra and I do not recommend it. See the data modeling resources here, and use the native CQL java driver.
upvote count: 1
answers question: http://stackoverflow.com/q/23467724

http://stackoverflow.com/q/23524766
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/36085344
has title: Finding Longest Geometric Progression in an Array
tagged with: dynamic-programming
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23525208
tagged with: python
has comment: http://stackoverflow.com/comment/36085649
accepted answer: http://stackoverflow.com/a/23525208
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/36089746
has body: I'm trying to implement a dynamic programming algorithm to find the length of the longest geometric progression in a list. I came across this algorithm: http://www.cs.illinois.edu/~jeffe/pubs/pdf/arith.pdf and tried to modify it for geometric progression. However, I cannot get it to work. My code is: def dp(numbers): numbers = sorted(numbers) n = len(numbers) table = [[2] * n] * n for i in range(n): table[i][n - 1] = 2 largest = 2 for j in range(n - 1, -1, -1): i = j - 1 k = j + 1 while i &gt;= 0 and k &lt;= n - 1: if numbers[j] &gt; math.sqrt(numbers[i] * numbers[k]): k += 1 elif numbers[j] &lt; math.sqrt(numbers[i] * numbers[k]): table[i][j] = 2 i -= 1 elif numbers[j] == math.sqrt(numbers[i] * numbers[k]): table[i][j] = table[j][k] + 1 largest = max(largest, table[i][j]) i -= 1 k += 1 while i &gt;= 0: table[i][j] = 2 i -= 1 return largest For example, if I run print dp([1, 2, 4, 8, 16, 32, 64]) I get 4 when it should be 7. Any help on what I'm doing wrong would be really helpful.
type: Question

http://stackoverflow.com/comment/36207354
score: 0
comment on: http://stackoverflow.com/q/23590049
has text: This question appears to be off-topic because his code actually works.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/23570441
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/36170745
has answer: http://stackoverflow.com/a/23570686
score: 0
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/36170569
has comment: http://stackoverflow.com/comment/36170656
type: UnansweredQuestion
has body: i get error when trying to create a simple table. here is my code thanks for the help it says cannot find symbol... import java.sql.*; import java.sql.Connection; public class test1 { public static void main (String[] args) { try { Class.forName("org.gjt.mm.mysql.Driver"); //Load the driver Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/data", "root", "test"); //Connect conn.createStatment().execute("Create TABLE 'Quiz1' ("+"'eventID' int(64),"+"'startTime' int(64)."+"UNIQUE('eventID'))"); conn.createStatement().execute(" LOAD DATA LOCAL INFILE 'C:\\Users\\Legyptiano\\Downloads\\quiz1.txt' INTO TABLE Quiz1" + "LINES TERMINATED BY '\\N'"); conn.close(); } catch (Exception err) { } } } The error I receive is: C:\Users\Legyptiano\Documents\test1.java:18: error: cannot find symbol conn.createStatment().execute("Create TABLE 'Quiz1' ("+"'eventID' int(64),"+"'startTime' int(64)."+"UNIQUE('eventID'))"); ^ symbol: method createStatment() location: variable conn of type Connection 1 error
has title: error using method createStatment()
tagged with: java

http://stackoverflow.com/comment/36036276
comment on: http://stackoverflow.com/a/23498600
has text: It's best to have `if/then` blocks in braces (as in OP's original code), even if the conditionals are one line.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23555707
tagged with: swing
has title: Swing Timer is only calling two of three methods when it fires
type: Question
has answer: http://stackoverflow.com/a/23556646
score: 0
has body: I'm writing a simple roulette game where a user can add players, place bets and spin the roulette wheel (represented as a JLabel which updates its text to show roulette numbers) public void spin(int wheelSize, int initialDelay, int finalDelay, int delayIncrement, WheelCallback callback) { Random rand = new Random(); int curNo = rand.nextInt(wheelSize) + 1; int finalNo = 0; int count = 10; assert (curNo &gt;= 1); Listener myListener = new Listener(callback, this, curNo); myListener.start(finalDelay); The class Listener: package model; import java.awt.event.*; import javax.swing.*; import model.interfaces.*; import model.GameEngineImpl; import model.WheelCallbackImpl; public class Listener implements ActionListener { WheelCallbackImpl callback; GameEngineImpl engine; Timer timer; int delay, curNo, finalNo; int count = 10; public Listener(WheelCallbackImpl wheelcall, GameEngineImpl newEngine, int number) { callback = wheelcall; engine = newEngine; curNo = number; } public void actionPerformed(ActionEvent e) { if (count == 0) { engine.calculateResult(finalNo); callback.result(finalNo, engine); callback.playback(); timer.stop(); } else { callback.nextNumber(curNo, engine); curNo++; finalNo = curNo; count--; } } public void start(int delay) { timer = new Timer(delay, this); timer.start(); } } Listener communicates with a helper class WheelCallbackImpl, which handles user feedback and communicates with my View: public class WheelCallbackImpl implements WheelCallback { Wheel wcWheel = Wheel.myWheel; public void nextNumber(int nextNumber, GameEngine engine) { String strNo = Integer.toString(nextNumber); assert (nextNumber &gt;= 1); System.out.println(nextNumber); wcWheel.setCounter(strNo); } public void result(int result, GameEngine engine) { System.out.println("callback.Result is running!"); Collection&lt;Player&gt; players = engine.getAllPlayers(); Player[] playerList = players.toArray(new Player[0]); System.out.println("Player list length is " + playerList.length); for (i…
has comment: http://stackoverflow.com/comment/36143630
tagged with: user-interface
answer count: 1
tagged with: awt
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/23594292
has body: I dont know if this way is efficient or not but it's an idea anyway: Date curr = new Date(); Date date = new Date(114, /*114 is 2014 , don't know why*/ 6, 16, 8, 45, 0); System.out.println(curr); System.out.println(date); Date x = new Date(curr.getYear() - date.getYear() , curr.getMonth() - date.getMonth(), curr.getDate() - date.getDate(), curr.getHours() - date.getHours(), curr.getMinutes() - date.getMinutes(), curr.getSeconds() - date.getSeconds() );
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23593697

http://stackoverflow.com/comment/36103128
type: Comment
type: QuestionComment
score: 1
has text: You might take a look at http://stackoverflow.com/questions/683041/java-how-do-i-use-a-priorityqueue
comment on: http://stackoverflow.com/q/23534109

http://stackoverflow.com/a/23577071
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/36185817
accepted answer of: http://stackoverflow.com/q/23576570
has body: private boolean tableExists() { Boolean exists = false; String query = "SELECT * FROM " + TABLE_NOTES; SQLiteDatabase db = this.getWritableDatabase(); try{ Cursor cursor = db.rawQuery(query, null); if(cursor.moveToFirst()){ exists = true; }else{ exists = true; } }catch (Exception e){ } return exists; } This is what I use to check for a table within a database in one of my apps. If you know what the table name is that you are looking for this might work.
answers question: http://stackoverflow.com/q/23576570

http://stackoverflow.com/q/23502963
has comment: http://stackoverflow.com/comment/36045328
has body: I try to send POST request putting into him JSon to my remote MySql database but response answer with "fail". Server side is correct, I have tested her. Here is the source code of Android app: public class MainActivity extends Activity { public static final String TAG = MainActivity.class.getName(); private TextView output; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); startService(new Intent(this.getApplicationContext(), OutSmsService.class)); MessageSaver saver = new MessageSaver(getApplicationContext()); saver.save(); new Thread(new Runnable() { @Override public void run() { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("from_col", "1111"); jsonObject.put("to_col", "2222"); jsonObject.put("body_col", "3333"); jsonObject.put("date_col", "444444"); } catch (JSONException e) { Log.d(TAG, e.getMessage()); } Log.d("JSON", jsonObject.toString()); DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPostReq = new HttpPost("http://secret.com/test.php"); StringEntity stringEntity = null; try { stringEntity = new StringEntity(jsonObject.toString()); } catch (UnsupportedEncodingException e) { Log.d(TAG, e.getMessage()); } if (stringEntity != null) { stringEntity.setContentType("application/json;charset=UTF-8"); stringEntity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json;charset=UTF-8")); } httpPostReq.setEntity(stringEntity); try { HttpResponse httpResponse = httpClient.execute(httpPostReq); HttpEntity entity = httpResponse.getEntity(); InputStream in = entity.getContent(); InputStreamReader reader = new InputStreamReader(in); BufferedReader bufferedReader = new BufferedReader(reader); String tmp = null; while ((tmp = bufferedReader.readLine()) != null) { Log.d(TAG, tmp); } bufferedReader.close(); reader.close(); in.close(); } catch (IOException e) { Log.d(TAG, e.getMessage()); } } }).start(); } } Output of logcat is ("no data" means tha…
answer count: 0
has comment: http://stackoverflow.com/comment/36044907
tagged with: mysql
type: Question
has title: Send POST request + JSon to remote MySql from Android App
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/23515503
has answer: http://stackoverflow.com/a/23515534
downvote count: 0
possible better answer: http://stackoverflow.com/a/23515528
has comment: http://stackoverflow.com/comment/36067196
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23515528
type: Question
upvote count: 1
has title: SQLite (1) no such table
favorite count: 0
answer count: 3
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/36067317
has answer: http://stackoverflow.com/a/23516088
accepted answer: http://stackoverflow.com/a/23515534
has body: When I run my android app I keep getting the error (1) no such table userTable, as far as I am aware I am creating the table in TABLE_CREATE = "create table userTable(" + USER + " text not null, " + PWD + " text not null, );"; I have two other databases in this project and the are working fine, any help is welcome. package com.weightpro.db; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; public class usrPwdDB { public static final String USER = "userName"; public static final String PWD = "password"; public static final String TABLE_NAME = "userTable"; public static final String DATA_BASE_NAME = "userdatabase"; public static final String KEY_ROWID = "_id"; public static final int DB_VERSION = 2; private static final String TABLE_CREATE = "create table userTable(" + USER + " text not null, " + PWD + " text not null, );"; DBHelper WDBHelper; Context mContext; SQLiteDatabase db; public usrPwdDB(Context mContext) { this.mContext = mContext; WDBHelper = new DBHelper(mContext); } private static class DBHelper extends SQLiteOpenHelper { public DBHelper(Context context) { super(context,DATA_BASE_NAME, null, DB_VERSION); } @Override public void onCreate(SQLiteDatabase db) { try{ db.execSQL(TABLE_CREATE); } catch(SQLException e) { e.printStackTrace(); } } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS userTable"); onCreate(db); } } public usrPwdDB open() { db = WDBHelper.getWritableDatabase(); return this; } public void close(){ WDBHelper.close(); } public long insertInfo(String userName, String password){ ContentValues content = new ContentValues(); content.put(USER, userName); content.put(PWD, password); return db.insertOrThrow(TABLE_NAME, null, content); } pu…
type: AnsweredQuestion

sorting
tags question: http://stackoverflow.com/q/23534840
tags question: http://stackoverflow.com/q/23595743
tags question: http://stackoverflow.com/q/23612853
tags question: http://stackoverflow.com/q/23529720
tags question: http://stackoverflow.com/q/23539247
tags question: http://stackoverflow.com/q/23468264
tags question: http://stackoverflow.com/q/23560291
tags question: http://stackoverflow.com/q/23467470
tags question: http://stackoverflow.com/q/23462722
tags question: http://stackoverflow.com/q/23495903
tags question: http://stackoverflow.com/q/23544288
tags question: http://stackoverflow.com/q/23611806
tags question: http://stackoverflow.com/q/23497200
tags question: http://stackoverflow.com/q/23464592
tags question: http://stackoverflow.com/q/23578190
tags question: http://stackoverflow.com/q/23563290
tags question: http://stackoverflow.com/q/23587314
tags question: http://stackoverflow.com/q/23532990
tags question: http://stackoverflow.com/q/23565443
tags question: http://stackoverflow.com/q/23460289
tags question: http://stackoverflow.com/q/23487381
type: Tag
tags question: http://stackoverflow.com/q/23572834
tags question: http://stackoverflow.com/q/23503921
tags question: http://stackoverflow.com/q/23523367
tags question: http://stackoverflow.com/q/23506956
tags question: http://stackoverflow.com/q/23536439
tags question: http://stackoverflow.com/q/23478748
tags question: http://stackoverflow.com/q/23461128
tags question: http://stackoverflow.com/q/23566397
tags question: http://stackoverflow.com/q/23536437
tags question: http://stackoverflow.com/q/23587604
tags question: http://stackoverflow.com/q/23576374
tags question: http://stackoverflow.com/q/23594278
tag name: sorting
tags question: http://stackoverflow.com/q/23598620
tags question: http://stackoverflow.com/q/23546178
tags question: http://stackoverflow.com/q/23456752
tags question: http://stackoverflow.com/q/23599739
tags question: http://stackoverflow.com/q/23480214
tags question: http://stackoverflow.com/q/23608964
tags question: http://stackoverflow.com/q/23528656
tags question: http://stackoverflow.com/q/23595305

http://stackoverflow.com/q/23599658
has answer: http://stackoverflow.com/a/23773811
downvote count: 0
favorite count: 0
tagged with: dalvik
has answer: http://stackoverflow.com/a/43762517
upvote count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/43762517
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23773811
has title: Dalvik Mismatched Stack Depths - Error Code 1
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has body: I'm having an issue with integrating the Aviary SDK. Upon compilation I receive the following error: EXCEPTION FROM SIMULATION: Dx mismatched stack depths Dx underlay stack: overlay stack: stack[top0]: Lcom/aviary/android/feather/headless/moa/MoaAction; ...while merging to block 0048 ...while working on block 0040 ...while working on method clone:()Ljava/lang/Object; ...while processing clone ()Ljava/lang/Object; ...while processing com/aviary/android/feather/headless/moa/MoaAction.class Dx 1 error; aborting Conversion to Dalvik format failed with error I've tried removing all the jars from my Java Build Path->Libraries, cleaning and the re-adding them. Under Order and Export, Android 4.4.2, src, gen, Android Private Libraries, and Android Dependencies are checked. There is nothing under Java Build Path->Projects. The SDK in question is a library, and not a JAR.
score: 2

http://stackoverflow.com/a/23603151
has body: So, I think I found the problem: When I was testing the policy before, I threw JMSException to get the messages to be re-delivered. One I changed the exception that was thrown to Exception/RuntimeException, the exponential back off worked. I'm not sure why JMSException causes the exponential back off policy to be ignored...Does anyone have any ideas?
has comment: http://stackoverflow.com/comment/134556954
downvote count: 0
has comment: http://stackoverflow.com/comment/55898594
answers question: http://stackoverflow.com/q/23593980
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/36131038
has text: The eclipse error went away but I'm getting a force close issue - any ideas/suggestions? http://pastebin.com/e65kyPrZ
comment on: http://stackoverflow.com/a/23548278
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/35966053
type: QuestionComment
score: 0
has text: You should try it. I'd suggest that you draw a tree with pen and paper and try to follow your code with the help of that drawing and see what happens. You might also want to check out graph traversal on wikipedia.
comment on: http://stackoverflow.com/q/23460804
type: Comment

datetime-parsing
tags question: http://stackoverflow.com/q/23542216
tag name: datetime-parsing
tags question: http://stackoverflow.com/q/23488721
type: Tag

http://stackoverflow.com/comment/36083784
score: 0
type: Comment
type: QuestionComment
has text: @peeskillet, sure give me a few minutes while I edit my question
comment on: http://stackoverflow.com/q/23523334

http://stackoverflow.com/comment/36028917
comment on: http://stackoverflow.com/q/23494928
score: 0
type: QuestionComment
type: Comment
has text: post some input and expected output

http://stackoverflow.com/comment/36084606
has text: Whoever downvoted, could you please explain why so i can improve my question?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23524243

http://stackoverflow.com/comment/36277479
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23561122
has text: Comming back to this issue, does anybody know if maybe there is a workaround for using the dragImage functionality in TransferHandler, as opposed to the working solution (proposed by aterai) of display a separate window where the drag image is displayed? I am wondering if we should really reimplement the drag image functionality....

http://stackoverflow.com/a/23611433
type: Answer
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23594081
has body: Your mistake is quite simple: you are calling (well, you were if it worked) invokeLater after you are trying to wait for the result: synchronized (r) { try { … r.wait(); // &lt;- here you are waiting } catch (InterruptedException e) { … } } SwingUtilities.invokeLater(r); // &lt;- never reached, you are waiting above So the obvious fix would be to call SwingUtilities.invokeLater(r); first and wait afterwards. But that is rather obsolete, there is the method SwingUtilities.invokeAndWait(r); which does the job of scheduling a Runnable in the EDT and waiting for its completion. So you don’t need to program your synchronization and notification by yourself. But note that your lines in your main method following your invokeLater are manipulating the UI and hence should be placed within the EDT just like the construction of the JFrame as otherwise you are still violating the Swing’s threading policy and still may get race conditions. Your main thread may execute things concurrently to the EDT and it may wait for the UI construction if you wish. But it should not manipulate the UI itself. Such manipulation would also contradict your statement that you want to have the “logical code outside” as manipulating a JFrame does not belong to “logical code”.
answers question: http://stackoverflow.com/q/23594081

http://stackoverflow.com/a/23520578
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23499217
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23499217
type: Answer
has body: Well, it turned out the problem was due to the missing @ResponseBody annotation in the controller code. @RequestMapping(value = "/getReleases", method = RequestMethod.POST) public @ResponseBody Map&lt;String, Object&gt; getReleases(@RequestBody Project project) { [...] } Adding the @ResponseBody annotation magically fixed the problem for me. I realized the problem by comparing this controller code with the code from similar controllers which were not showing the issue (silly of me not doing this before), after several vain attempts at digging through the Spring code. Thanks all for the answers!

http://stackoverflow.com/q/23546530
upvote count: 4
accepted answer: http://stackoverflow.com/a/23546654
type: AnsweredQuestion
has title: Namespace: javax.xml.bind.UnmarshalException: unexpected element
downvote count: 0
tagged with: kml
has body: For some reason I have to manually parse a KML file which looks like this: <?xml version="1.0" encoding="UTF-8"?> ... 13.38705,52.52715,0 My name Hallo World For mapping it to java I wrote the following class @XmlRootElement(name = "kml", namespace = "http://www.opengis.net/kml/2.2") public class Kml { // Document document; @XmlElement(name = "Document") public Document getDocument() { return document; } public void setDocument(Document document) { this.document = document; } } Using Jaxb I got the following parser. public class JAXBKmlParser { private final Logger logger = LoggerFactory.getLogger(this.getClass()); public Kml klmParser(final String kmlFile) { Kml kml = null; try { JAXBContext jaxbContext = JAXBContext.newInstance(Kml.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(kmlFile); kml = (Kml) unmarshaller.unmarshal(reader); } catch (JAXBException e) { logger.error("JABX Exception corrupted KML", e); } return kml; } } My problem is that the xml namespace attribute is not recognised. If I change the annotation @XmlRootElement(name = "kml", namespace = "http://www.opengis.net/kml/2.2") to @XmlRootElement(name = "kml") and removing the namespace from the header of my KML file then the parsing works without any problem. My question is how to cope this problem without removing the namespace. Notice that the description tag has also a namespace.
favorite count: 0
has comment: http://stackoverflow.com/comment/36125862
type: Question
tagged with: exception
tagged with: http://stackoverflow.com/tag/xml
score: 4
tagged with: java
has answer: http://stackoverflow.com/a/23546654
tagged with: jaxb
answer count: 1

http://stackoverflow.com/a/23476404
upvote count: 1
has body: From your given design, you have a very awful option that is checking the current type of the object and define a logic to know its size: public int size(Object o) { if (o instanceof String) { return ((String)o.)length(); } if (o instanceof Object[].class) { return ((Object[])o).length; } if (o instanceof byte[].class) { return ((byte[])o).length; } //and on and on... //if something isn't defined, just return 0 or another default value return 0; } But note that this is a bad approach since you have a bad design. It would be better if you explain your real problem instead. More info: What is the XY problem?
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/23476052

http://stackoverflow.com/q/23456524
has title: Save a fingerprint template into a database mysql - java
favorite count: 0
possible better answer: http://stackoverflow.com/a/23472932
accepted answer: http://stackoverflow.com/a/23456668
upvote count: 2
has body: I am developing a project with the sdk fingerprint of Griaule , and as a start I'm creating a program without a GUI that allows the user to scan his fingerprint and store it in a mysql database already created earlier. I'm here to ask you a hand with regard to storing the fingerprint in the database. In the program I created, I captured the fingerprint, I extracted the template from the fingerprint through a function I call extract () . After that I should call another function , enroll (), which allows me to save the fingerprint in a database. Even looking at the SDK examples I did not understand how it works, can someone help me? thanks in advance! :) public void enroll() { try { //Inserts the template on the database enrollStmt.setBinaryStream(1,new ByteArrayInputStream(template.getData()), template.getData().length); enrollStmt.executeUpdate(); //Picks the ID generated for it. ResultSet rs = insertedIdStmt.executeQuery(); rs.next(); ui.writeLog("Fingerprint enrolled with id = "+Integer.toString(rs.getInt(1))); } catch (SQLException e) { ui.writeLog("Error enrolling template"); } }
has answer: http://stackoverflow.com/a/37633021
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: database
tagged with: mysql
type: Question
tagged with: fingerprint
has answer: http://stackoverflow.com/a/23456668
downvote count: 0
tagged with: sdk
answer count: 3
has answer: http://stackoverflow.com/a/23472932

http://stackoverflow.com/q/23460934
has answer: http://stackoverflow.com/a/23473433
score: 0
has comment: http://stackoverflow.com/comment/35984143
has body: How can I determine the object properties restrictions for a class in Jena . I have been trying to determinate if a class has a object restriction by using something like this: if (essaClasse.isRestriction()) { System.out.println( "Restriction on property " + essaClasse.asRestriction().getOnProperty() ); } else { System.out.println( "There is not restriction" ); } but I got : "There is not restriction" The owl file has a class (UserModel) which has the following restriction: &lt;owl:Class rdf:about="&amp;geosim2;UserModel"&gt; &lt;rdfs:label xml:lang="en"&gt;UserModel&lt;/rdfs:label&gt; &lt;rdfs:subClassOf rdf:resource="&amp;geosim2;Model"/&gt; &lt;rdfs:subClassOf&gt; &lt;owl:Restriction&gt; &lt;owl:onProperty rdf:resource="&amp;geosim2;hasPeople"/&gt; &lt;owl:minCardinality rdf:datatype="&amp;xsd;nonNegativeInteger"&gt;1&lt;/owl:minCardinality&gt; &lt;/owl:Restriction&gt; &lt;/rdfs:subClassOf&gt; &lt;rdfs:subClassOf&gt; &lt;owl:Restriction&gt; &lt;owl:onProperty rdf:resource="&amp;geosim2;hasPhysicalPlace"/&gt; &lt;owl:minCardinality rdf:datatype="&amp;xsd;nonNegativeInteger"&gt;1&lt;/owl:minCardinality&gt; &lt;/owl:Restriction&gt; &lt;/rdfs:subClassOf&gt; &lt;rdfs:isDefinedBy rdf:datatype="&amp;xsd;string"&gt;http://dit.upm.es/~perez/geosim/0.1.3/ns.owl#&lt;/rdfs:isDefinedBy&gt; &lt;rdfs:comment xml:lang="en"&gt;An instance of this class models a user simulation model.&lt;/rdfs:comment&gt; &lt;/owl:Class&gt;
type: UnansweredQuestion
tagged with: jena
tagged with: java
type: Question
has title: Object Properties restrictions - jena
tagged with: api
answer count: 1

http://stackoverflow.com/comment/36209329
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23591279
score: 2
has text: This is a clear XY problem. Please explain what you want to achieve. A `List` of `Map`s is certainly not what you want.

http://stackoverflow.com/q/23519685
score: 21
tagged with: java
has body: I have a problem in my web.xml. I get the following errors element is not allowed here. Here is my web.xml: Spring MVC Application MySQL Test App DB Connection jdbc/mobile javax.sql.DataSource Container contextConfigLocation /WEB-INF/spring-config.xml springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* org.springframework.web.context.ContextLoaderListener mvc-dispatcher org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring-config.xml 1 mvc-dispatcher / login.jsp I get error in this line. DB Connection jdbc/mobile javax.sql.DataSource Container and in this line. org.springframework.web.context.ContextLoaderListener And that's not all, whenever I startup the project (using Tomcat 8), I don't get any compilation errors. My web application starts up like it's normal. What am I doing wrong here?
has comment: http://stackoverflow.com/comment/62631941
has title: Error in web.xml "Element -- is not allowed here"
downvote count: 0
favorite count: 0
tagged with: web.xml
type: UnansweredQuestion
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
tagged with: spring-mvc
answer count: 0
has comment: http://stackoverflow.com/comment/75002727
has comment: http://stackoverflow.com/comment/80542395
upvote count: 21
has comment: http://stackoverflow.com/comment/36082222
type: Question

http://stackoverflow.com/q/23608017
tagged with: spring
answer count: 1
has answer: http://stackoverflow.com/a/23611555
has title: Cannot find a spring schemalocation
tagged with: java
upvote count: 1
has body: I have to deploy my application to a machine that doesn't have internet connection. and the URLs for some of the Spring xsd files are not accessible I'm using spring 4.0.3 and JDK7 and maven. my applicationContext : <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" 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-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd"> <tx:annotation-driven transaction-manager="transactionManager"/> <context:annotation-config></context:annotation-config> <context:component-scan base-package="com.gestion.projet.dao" /> </beans> When I run it I have this error: Infos: Initializing ProtocolHandler ["ajp-bio-8009"] mai 12, 2014 11:12:48 AM org.apache.catalina.startup.Catalina load Infos: Initialization processed in 392 ms mai 12, 2014 11:12:48 AM org.apache.catalina.core.StandardService startInternal Infos: Démarrage du service Catalina mai 12, 2014 11:12:48 AM org.apache.catalina.core.StandardEngine startInternal Infos: Starting Servlet Engine: Apache Tomcat/7.0.53 mai 12, 2014 11:12:48 AM org.apache.catalina.loader.WebappClassLoader validateJarFile Infos: validateJarFile(C:\Users\Ayman\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Copy\WEB-INF\lib\geronimo-servlet_2.5_spec-1.2.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class mai 12, 2014 11:12:48 AM org.apache.catalina.loader.WebappClassLoader validateJarFile Infos: validateJarFile(C:\Users\Ayman\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\w…
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/23611555
downvote count: 0
type: AnsweredQuestion
tagged with: web
score: 1
has comment: http://stackoverflow.com/comment/36242325
favorite count: 0
has comment: http://stackoverflow.com/comment/36241267
type: Question
has comment: http://stackoverflow.com/comment/36245126
tagged with: maven

http://stackoverflow.com/comment/36065244
comment on: http://stackoverflow.com/q/23514069
score: 0
type: Comment
has text: @schmop, of course, this was just "by-the-way" comment, `slim` is right
type: QuestionComment

arduino
tags question: http://stackoverflow.com/q/23454629
tags question: http://stackoverflow.com/q/23547243
type: Tag
tags question: http://stackoverflow.com/q/23576621
tag name: arduino

http://stackoverflow.com/q/23602332
downvote count: 1
type: Question
upvote count: 0
score: -1
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/23602436
answer count: 1
favorite count: 0
has body: On machine1, I installed apache tomcat 7 listening on port 9999 and copied a sample.html file in ../webapps/dummy folder of tomcat machine.I was able to access the resource with URL http://localhost:9999/dummy/sample.html On machine2, Tomcat is already part of some product listening on port 8080 which i thought of utilising it for my sample test. So, I copied a sample.html file in ../webapps/dummy folder of tomcat machine. I was unable to access the resource with URL http://localhost:8080/dummy/sample.html On machine2, I have existing servlet programming modules running in another folder ../webapps/xyz. My question: I am trying to understand, What are the list of things that i need to verify on machine, which let me know, why i have an issue in accessing the URL(above) on machine2? Is this something to do with http access configuration like basic.user/basic.groups file?
has title: Unable to access the resource from Tomcat server in windows
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23602436

http://stackoverflow.com/comment/36203976
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23588261
has text: But looking at your code, looks like `Connection con` is `null`. Where do you initialize it?
score: 0

http://stackoverflow.com/a/23511352
upvote count: 1
downvote count: 0
has body: I guess that you used the libary in the client side of your GWT application. In this part of your programm you can only use Java classes which can be compiled to JavaScript. And the GWT can only compile a limited number of Java classes. And besides it's not possible afaik to open a file in JavaScript ( which is used in the Client). Do the file I/O in the server part of your application and transfer the content via RPC or with the requestfactory.
answers question: http://stackoverflow.com/q/23511248
type: Answer
score: 1

http://stackoverflow.com/comment/36118838
type: AnswerComment
score: 0
has text: It exists as a resource inside the jar file. It doesn't exist as a file on the end user file system. So, trying to read it with `ImageIO.read(new File("src/res/icon.jpg"))` can't possibly work, since that will load a *file* named icon.jpg, under the directory `res`, under the directory `src`, under the current directory. The end user doesn't have such an src directory on its file system. And you don't know what his current directory is, because he can choose to execute the application from wherever he wants.
type: Comment
comment on: http://stackoverflow.com/a/23541301

http://stackoverflow.com/comment/36175948
has text: Sorry for the delayed reply. But the issue seems to be with having multiple transaction managers in spring config. I cant explain the reason why, but having multiple transaction managers (I have tried combinations hibernate tm- hibernate tm, hibernate tm - DataSourceTM, WebSphereUowTM) fail to rollback on exception.
comment on: http://stackoverflow.com/a/23532045
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36194968
has text: Yes, a layout manager would work great, and be a lot more flexible than absolute positioning.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23583460

http://stackoverflow.com/comment/36160041
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23564835
has text: I can't believe I haven't met this situation before

http://stackoverflow.com/comment/36116752
comment on: http://stackoverflow.com/a/23537542
type: AnswerComment
score: 0
type: Comment
has text: It is true, I stopped reading when sawing the typo. The code seems fine. Maybe a second look at the repository implementation would help. Debugging should also give a better hint... I do not have other ideas

http://stackoverflow.com/comment/36184361
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23576513
has text: @fscore regex matches characters that appear again later in the input, asserted by a look ahead for a back reference to the captured characer
score: 0

http://stackoverflow.com/comment/36206673
comment on: http://stackoverflow.com/a/23589745
has text: Right, but why is Java taking them and not complaining when it normally does? Or so I thought.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/36095882
comment on: http://stackoverflow.com/q/23528503
score: 0
has text: too much code, strange terminology and unclear question. If you can shorten the code and describe the problem more precise the answer may fall on your feet immediatelly :) and you should really not use uppercase methods and variables.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36220477
score: 0
has text: @Craig Distinct customers
comment on: http://stackoverflow.com/q/23589851
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36193286
comment on: http://stackoverflow.com/q/23582541
type: Comment
has text: @Sanjay PMD is a tool that can and should be configured to suit your needs. If you/your colleagues/your project just can't live with `_` in method names, then leave that PMD rule as is and fix your code. If you think that you need `_` than you should just configure the rule accordingly - disable it or change the name pattern.
type: QuestionComment
score: 0

http://stackoverflow.com/a/23473188
downvote count: 4
has comment: http://stackoverflow.com/comment/35988580
type: Answer
score: -2
answers question: http://stackoverflow.com/q/23473149
upvote count: 2
has body: You have to initialize local variable before use..

http://stackoverflow.com/comment/36211796
score: 0
type: AnswerComment
type: Comment
has text: @Braj you got -2 may be for your old answer but you have also updated it.
comment on: http://stackoverflow.com/a/23592159

http://stackoverflow.com/comment/36232724
comment on: http://stackoverflow.com/a/23571666
score: 0
type: AnswerComment
has text: this is perfect solution . I used same as #id input {margin}
type: Comment

http://stackoverflow.com/comment/133036893
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/53162476
has text: WORK!!! just move the [hibernate_file_class_name].hbm.xml to resources directory and re-check hibernate.cfg.xml then it works. Thank you!

jsch
tags question: http://stackoverflow.com/q/23556865
tag name: jsch
tags question: http://stackoverflow.com/q/23540173
tags question: http://stackoverflow.com/q/23462597
tags question: http://stackoverflow.com/q/23492683
type: Tag

http://stackoverflow.com/comment/36233471
has text: I inderstand how to get an image URL, but I don't know how to use this code, or where to insert it? what is jc ?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23602828
type: AnswerComment

http://stackoverflow.com/comment/100742044
comment on: http://stackoverflow.com/a/23551339
type: AnswerComment
score: 0
type: Comment
has text: This does not seem to work, at least for me. I've had the suspicion that the xml file its'nt actually used (also same folder as pom.xml), so I added some invalid code to the exclude xml file and no error message of any kind appears. How would I specify the file location of the exclude file resp. what's the default location?

http://stackoverflow.com/comment/36283711
comment on: http://stackoverflow.com/q/23601516
has text: The link that generates xml is the one you want. Click on an XML element (eg sectPr element, or an element in a header part) and it will generate corresponding code. That leaves creating and adding the actual header parts: maindocumentpart.addPart(headerPart) will return the relId you need to use in the header ref in the sectPr. If this doesn't make sense, I may have time to write a blog post walk through tomorrow.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23509979
accepted answer: http://stackoverflow.com/a/23512190
tagged with: css
type: AnsweredQuestion
score: 0
type: Question
tagged with: gwt
tagged with: java
has comment: http://stackoverflow.com/comment/36059441
tagged with: eclipse
has answer: http://stackoverflow.com/a/23512190
has title: Eclipse GWT Console Warnings
answer count: 1
has body: I am building a GWT Java project in Eclipse Juno and when I run it I get the following Warning (it runs OK): [WARN] 404 - GET /org.AwardTracker.AwardTracker/Upload.css (127.0.0.1) 1405 bytes Request headers Accept: text/css, */* Referer: http://127.0.0.1:8888/AwardTracker.html?gwt.codesvr=127.0.0.1:9997 Accept-Language: en-AU User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; MAAU; rv:11.0) like Gecko Accept-Encoding: gzip, deflate Host: 127.0.0.1:8888 DNT: 1 Connection: keep-alive Response headers Content-Type: text/html;charset=ISO-8859-1 Cache-Control: must-revalidate,no-cache,no-store Content-Length: 1405 I do not know why I get the error as I do not have Upload.css anywhere; or is that the reason? If it is the reason can I just copy an existing css and rename it? As I can not find a reference to it in the code why is it needed? Regards, Glyn

http://stackoverflow.com/comment/36061423
has text: for (String n2 : number ) { List<String> ARRAY = new ArrayList<String>(); if (!ARRAY.contains(n2)) { Email(n2); ARRAY.add(n2); } } if i am using above. Though already email sent with value n2 again it is sending again. For first it has to sent but for second time since it is already in array it should not sent right?
type: AnswerComment
comment on: http://stackoverflow.com/a/23511842
score: 0
type: Comment

http://stackoverflow.com/comment/36184099
comment on: http://stackoverflow.com/q/23577333
has text: Yes, it's JAVA. Sorry, first time posting.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36237697
comment on: http://stackoverflow.com/a/23606257
type: Comment
has text: @@NoXSaeeD, Good design pattern!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/47823572
comment on: http://stackoverflow.com/q/23531558
score: 1
type: Comment
type: QuestionComment
has text: @NeilCoffey netstat does not name a process for "TIME_WAIT" if the process is already finished, e.g. `tcp 0 0 localhost:57525 localhost:3100 TIME_WAIT -`. There are also some questions about SO_REUSEADDR in general (like http://stackoverflow.com/q/3229860/602119) which also mention TIME_WAIT in the answers.

http://stackoverflow.com/comment/35980345
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23468443
has text: Try using geocoder class its designed specifically for this

http://stackoverflow.com/a/23469441
downvote count: 0
has body: Class C2 in your example above is a local Inner class, which means an inner class defined within a method of an outer class, and such classes cannot have static methods inside them because they are associated with objects, (static methods are not dependent upon objects). Moreover, a local inner class must be instantiated within the method it has been created and not outside the method. This is a rule. try modifying your code in following way: public class Class1 { public static void main(String[] args) { Class1 c = new Class1(); c.show(); } public static void show() { class C2 { public void hello() { System.out.println("show class"); } } C2 obj= new C2(); obj.hello(); } } This should work.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23469099

http://stackoverflow.com/q/23489851
tagged with: servlets
type: Question
possible better answer: http://stackoverflow.com/a/23489917
linked to: http://stackoverflow.com/q/13695832
score: 0
has body: I saw a servlet sample code from website , this code is said to be thread unsafe,but I cannot tell why it is thread unsafe and what will happen when I use this code.This code is a servlet code which is used to save each visitor's name. public class UnsafeGuestbookServlet extends HttpServlet { private Set visitorSet = new HashSet(); protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException { String visitorName = httpServletRequest.getParameter("NAME"); if (visitorName != null) visitorSet.add(visitorName); } } Peoper say that if I change the code like this: private Set visitorSet = Collections.synchronizedSet(new HashSet()); thread-unsafe problem will be solved. I know that if this piece of code is thread unsafe, it must be caused by visitorSet,it is a shared data structure.Since String visitorName is a local variable , every thread will make a copy in its own call stack, right?
has answer: http://stackoverflow.com/a/23490267
has title: Why this servlet code sample is thread unsafe?
has answer: http://stackoverflow.com/a/23489966
answer count: 5
accepted answer: http://stackoverflow.com/a/23489966
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23490000
has answer: http://stackoverflow.com/a/23489970
tagged with: java
tagged with: thread-safety
has answer: http://stackoverflow.com/a/23489917

http://stackoverflow.com/q/23498836
has body: I have a string and I want to use some formulas, in which there is a word that is going to be searched. Sometimes that word could be in different place, depending on the user. In order to make substrings work, I have to ensure that when it happens, the code still works. String temp = s;//Temp is a long string text String fehlerspeicher="fehlerspeicher"; if(temp.matches(".*"+fehlerspeicher+".*")){ // i have to find as an integer, how many LETTERS are used till this spesific word }//to make changes in the following code String temp1=temp.substring(0, 15000);//15000 is an example. it can be 5000 or 20000 sometimes. It splits the text up from 15000th letter. String temp2=temp.substring(15000);// It'd be useful to use this integer in these 2 formulas. temp2=temp2.replaceFirst("200", "20_"); temp=temp1+temp2; So, could it be somehow implementable? Thanks.
score: 0
answer count: 1
tagged with: string
accepted answer: http://stackoverflow.com/a/23498952
has comment: http://stackoverflow.com/comment/36036841
has comment: http://stackoverflow.com/comment/36037778
linked to: http://stackoverflow.com/q/4681959
type: AnsweredQuestion
tagged with: java
tagged with: substring
has comment: http://stackoverflow.com/comment/36036592
type: Question
has answer: http://stackoverflow.com/a/23498952
has comment: http://stackoverflow.com/comment/36036609
has title: Is it possible to find how many letters are used in a string?

http://stackoverflow.com/comment/71315133
comment on: http://stackoverflow.com/a/23607372
type: Comment
score: 1
has text: Both comments are correct: In a random-based UUID only, 122 of the 128 bits is randomly generated. So technically not meeting the 128-bits of randomness asked in the Question. But practically speaking, in real-world work, both have have about the same chance of collisions: virtually nil. For critical security applications, the random UUID may not be appropriate, but for other non-critical applications the random UUID works well and is handy with just a short line of code using built-in Java class.
type: AnswerComment

http://stackoverflow.com/comment/36011656
type: QuestionComment
has text: whenever you move your character you should set a destination cell in your grid, if they continue to hold the button after the cell has been reached then move into the next cell etc
comment on: http://stackoverflow.com/q/23485190
score: 0
type: Comment

http://stackoverflow.com/comment/36254151
type: Comment
type: QuestionComment
score: 0
has text: @Reimeus, Error is obviously different.
comment on: http://stackoverflow.com/q/23615024

http://stackoverflow.com/comment/36146992
has text: That may work but would likely just hide the issue. Better to profile and test first to make sure it's needed.
type: Comment
comment on: http://stackoverflow.com/a/23557790
score: 5
type: AnswerComment

http://stackoverflow.com/comment/36132507
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23549817
has text: @Aashish: You are welcome to dump the view hierarchy of your own activity by going to the root view and recursing through the tree of children. This does not require anything from the `uiautomator` framework.

http://stackoverflow.com/a/49825847
downvote count: 0
score: 1
upvote count: 1
has body: I've also found that the built-in word counters give strange counts, but text extraction seems to be more reliable, so I use this solution: public long getWordCount(File file) throws IOException { POITextExtractor textExtractor; if (file.getName().endsWith(".docx")) { XWPFDocument doc = new XWPFDocument(new FileInputStream(file)); textExtractor = new XWPFWordExtractor(doc); } else if (file.getName().endsWith(".doc")) { textExtractor = new WordExtractor(new FileInputStream(file)); } else { throw new IllegalArgumentException("Not a MS Word file."); } return Arrays.stream(textExtractor.getText().split("\\s+")) .filter(s -&gt; s.matches("^.*[\\p{L}\\p{N}].*$")) .count(); } The regex at the bottom can be adjusted if needed, but overall this one has proved fairly resilient.
answers question: http://stackoverflow.com/q/23479409
type: Answer

http://stackoverflow.com/comment/36159950
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23564350
type: Comment
has text: Sorry but I don't see what you mean. You have to different kinds of Objects and you want add one of them to the other. Or same Objects?

http://stackoverflow.com/comment/36025998
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/23493126
score: 0
has text: In fact (rereading) I'd suggest it's closer to teaching *functional* programming. Regardless, it's another technique/tool available for use amongst many, with various pros/cons

http://stackoverflow.com/a/23551130
has comment: http://stackoverflow.com/comment/36170856
has body: Any particular reason you don't want to use the yaml configuration? You could always create your own DataSourceFactory and populate it from another configuration source (or in the code, which I would not recommend): DataSourceFactory factory = new DataSourceFactory(); factory.setUrl(someJdbcUrl); factory.setUser("foo"); factory.setPassword("bar");
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36173780
has comment: http://stackoverflow.com/comment/36166822
accepted answer of: http://stackoverflow.com/q/23550568
has comment: http://stackoverflow.com/comment/36173580
upvote count: 1
answers question: http://stackoverflow.com/q/23550568
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/23615791
upvote count: 4
has body: It should be possible to use a library like Language Dectection for Java and tie it with your PL/SQL. It will probably be more efficient to use SQL to do naive Bayesian filtering and use language profiles derived e.g. from Wikipedia (they are neatly packed here). These are just pointers, not a full solution as requested for the bounty, but should help bounty-seekers.
answers question: http://stackoverflow.com/q/23529123
type: Answer
downvote count: 1
score: 3

http://stackoverflow.com/q/23573303
linked to: http://stackoverflow.com/q/5198856
type: UnansweredQuestion
upvote count: 1
tagged with: typehandler
has title: Send & Retrieve array list to oracle stored procedure
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36177132
type: Question
has body: I'm trying to push "Arraylist" to oracle stored procedure and after making necessary modification, the object it is returned back. I have an oracle stored procedure with an inout parameter which is "AS TABLE OF TYPE". I'm able to make the call using Mybatis by implements TypeHandler and overrides its method public void setParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException But I'm facing issue while retrieving the object. For retrieving I Override the below method. public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { ARRAY array_to_pass = ((OracleCallableStatement) cs).getARRAY(1); /* showing content */ Datum[] elements = array_to_pass.getOracleArray(); for (int i = 0; i &lt; elements.length; i++) { Object[] element = ((STRUCT) elements[i]).getAttributes(); String value = (String) element[0]; System.out.println("array(" + i + ").val=" + value); } } I'm getting the below error java.lang.IllegalAccessError: tried to access class oracle.jdbc.driver.OracleCallableStatement Statement generating the error is ARRAY array_to_pass = ((OracleCallableStatement) cs).getARRAY(1); Any thoughts/help on how to retrieve table of type object from oracle .
tagged with: arrays
downvote count: 0
answer count: 1
tagged with: mybatis
has comment: http://stackoverflow.com/comment/36255261
has answer: http://stackoverflow.com/a/23634190
favorite count: 0
tagged with: oracle-database

http://stackoverflow.com/q/23570936
has answer: http://stackoverflow.com/a/23570973
tagged with: int
downvote count: 4
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/23571379
favorite count: 0
has answer: http://stackoverflow.com/a/23571141
has title: Java filling in an array
answer count: 4
has comment: http://stackoverflow.com/comment/36171778
type: UnansweredQuestion
tagged with: java
score: -4
tagged with: methods
type: Question
has body: How would one go about filling in an array so that, for example, if you had the following array. int[] arr = new int[5]; arr[0] = 1; arr[1] = 3; arr[2] = 7; arr[3] = 2; arr[4] = -4; so it would look like arr = {1, 3, 7, 2, -4}; and you would pass it into your method to get a result of arr = {1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4}; so that you essentially are filling in the numeric gaps. I'd like to make this under the assumption that I don't know how long the array passed in is going to be to make it a more universal method. my current method looks like such right now... public static void fillArray(int[] numbers){ int length = numbers.length; for(int i = 0; i &lt; numbers.length - 1; i ++){ if(numbers[i] &lt;= numbers[i + 1]){ length += numbers[i + 1] - numbers[i]; }else if(numbers[i + 1] &lt; numbers[i]){ length += numbers[i + 1] - numbers[i]; } } } I have length to determine the size of my new array. I think it should work but I'm always down for some input and advice.
has answer: http://stackoverflow.com/a/23571707
has comment: http://stackoverflow.com/comment/36171409
has comment: http://stackoverflow.com/comment/36171421
has comment: http://stackoverflow.com/comment/36171433

http://stackoverflow.com/comment/35971022
score: 0
comment on: http://stackoverflow.com/q/23463212
type: Comment
type: QuestionComment
has text: when I use getSource, I keep getting null. Nevertheless, when I use getActionCommand, I can write any JButton when it is clicked. I feel your approach is wrong, but I do not know how to explain so I will wait for other to explain so I can learn too.

http://stackoverflow.com/a/23483021
has comment: http://stackoverflow.com/comment/36044072
score: 0
answers question: http://stackoverflow.com/q/23482607
type: Answer
has body: This worked: Border b; TitledBorder tb; String title; b = c.getBorder(); if(b instanceof TitledBorder) { c.getBorder(); tb = (TitledBorder)c.getBorder(); title = tb.getTitle(); } No matter what type of border c has, IF it's TitledBorder, I get the title as advertised. If not, proceed as usual. Thanks, gla3dr, for the tip. Does anyone see a less verbose way of accomplishing the task?

http://stackoverflow.com/q/23459966
has title: Android runtime error: error opening trace file: No such file or directory (2)
has comment: http://stackoverflow.com/comment/36302719
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/35964676
type: Question
has body: I did some search and found people who ended up with the same error as I did, but in a completely different context :( So, I'm trying to get my app to gracefully exit when something critical happens. It's an android app that uses camera, and I want the app to quit after showing a toast text, so the users don't get a random crash. (And yes, theoretically I shouldn't end up in the if statement because I require a camera hardware in my manifest, but I like handling error as much as possible) Here's a snippet of the manifest file: &lt;uses-permission android:name="android.permission.CAMERA" /&gt; &lt;uses-feature android:name="android.hardware.camera" android:required="true" /&gt; And here's my code: public class MainActivity extends Activity { /* member variables... */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create an instance of Camera // I forced this to true for testing because the devices I'm testing // against won't reach inside the if statement if (/*!(checkCameraHardware(this) || checkFrontFacingCameraHardware(this))*/ true) { Toast.makeText(getBaseContext(), "Shutting Down! No Camera Detected!", Toast.LENGTH_SHORT).show(); System.exit(0); // This is the last code it reaches } mCamera = getCameraInstance(); // This code isn't reached As you can see, I would like the code to make a toast, then shut down, but it gets stuck in a blank (black) screen instead (at or right after System.exit(0)), repeating the following error in Log Cat instead. Tag: Trace, Text: error opening trace file: No such file or directory (2) Did I miss something? Can I not exit or toast in the OnCreate() function?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7239795
has comment: http://stackoverflow.com/comment/35964590
has comment: http://stackoverflow.com/comment/35964814
tagged with: java
has comment: http://stackoverflow.com/comment/35964432
has answer: http://stackoverflow.com/a/23460070
has comment: http://stackoverflow.com/comment/36302583
has comment: http://stackoverflow.com/comment/36302661
answer count: 1
has comment: http://stackoverflow.com/comment/35964559
has comment: http://stackoverflow.com/comment/36302760
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/35964619
accepted answer: http://stackoverflow.com/a/23460070
favorite count: 0
has comment: http://stackoverflow.com/comment/35964695
has comment: http://stackoverflow.com/comment/35964623
linked to: http://stackoverflow.com/q/2033914

http://stackoverflow.com/comment/36014727
type: Comment
comment on: http://stackoverflow.com/a/23486709
score: 0
type: AnswerComment
has text: @Sammer Kazi, how to you check for existence? You will use MyBatis select to see if it is null or not?

http://stackoverflow.com/q/23574697
has answer: http://stackoverflow.com/a/23574718
score: 0
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/23574721
duplicate of: http://stackoverflow.com/q/513832
has body: In this program below: public class medianTemp { public static void main(String[] args){ int length = args.length; int[] n = new int[length]; n[0] = Integer.parseInt(args[0]); System.out.print(n[0] + " "); for (int i = 1; i &lt; length; i++ ){ String c = args[i]; if (c.equals(".")){ n[i] = n[i-1] + 0; System.out.print(n[i] + " "); } if (c.equals("+")){ n[i] = n[i-1] + 1; System.out.print(n[i] + " "); } if (c.equals("-")){ n[i] = n[i-1] - 1; System.out.print(n[i] + " "); } Inside the for loop and inside the if statements. If I use for example args[i] == "." (instead of converting args[i] to string), the code above doesn't work and only the initial integer is displayed. Can someone please tell me why this happens?
has comment: http://stackoverflow.com/comment/36178903
type: UnansweredQuestion
answer count: 4
tagged with: java
has title: Does "==" only apply to certain data types?
type: Question
has answer: http://stackoverflow.com/a/23574927
has answer: http://stackoverflow.com/a/23574785

http://stackoverflow.com/comment/36226446
has text: I'm pretty sure you can't create a "true" dynamic array in Java, only an array or array-like object (like `ArrayList`) that behaves like a dynamic arrays. Arrays in Java are [defined to have a fixed length](http://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html#jls-10.2)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23599880
type: Comment

http://stackoverflow.com/a/23489072
answers question: http://stackoverflow.com/q/23488985
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/36018961
has body: Without closing bufferwriter you cannot see output on text file try to add this code writer.close()
upvote count: 1
has comment: http://stackoverflow.com/comment/36019291
score: 0

http://stackoverflow.com/a/23552460
has comment: http://stackoverflow.com/comment/36137875
has body: Yes this is possible and is often done, but the devil is in the details. Often you'll have a Control class that responds to user interaction that is completely separate from the View class, the GUI. Options include: Give the view class a public addButtonXActionListener(ActionListener l) method. Give the view property change listener support, and if it subclasses a Swing component, it automatically has this, and then in your JButton's ActionListener, often an anonymous inner class, notify the listeners of a state change. Give the Ciew class a Control instance variable and set it. Then in the JButton's ActionListener, call the appropriate control method. Edit For example, here is a small program with 3 files, 1 for the View that holds the JButton, 1 for the Control, and a 3rd main class just to get things running. Note that there are two JButtons and they both use 2 different ways of notifying outside classes that they've been pressed. The View class has a public method, Button 1 has a method, public void setButton1Action(Action action), that allows outside classes to set the Action of button1, The Control then does this, injecting an AbstractAction that notifies the Control of when button1 has been pressed. The View has an public void addPropertyChangeListener(PropertyChangeListener l) wrapper method that allows outside classes to add in their PropertyChangeListener which then is added to the property change support of the mainPanel object. Then in button2's anonymous inner ActionListener class, the mainPanel's PropertyChangeSupport is asked to notify all listeners of a change in the state of the BUTTON2 property. View then adds a PropertyChangeListener and listens for changes the state of this property and responds. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import javax.swing.*; public class TestButtonPress { private static void createAndShowGui() { View v…
type: Answer
has comment: http://stackoverflow.com/comment/36137484
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/36137538
answers question: http://stackoverflow.com/q/23552345
downvote count: 0

http://stackoverflow.com/q/23577076
type: Question
tagged with: debugging
has title: Debugging variable error with Java
tagged with: java
has comment: http://stackoverflow.com/comment/36183452
has comment: http://stackoverflow.com/comment/36188448
tagged with: char
answer count: 2
tagged with: for-loop
upvote count: 0
possible better answer: http://stackoverflow.com/a/23577093
has comment: http://stackoverflow.com/comment/36189675
favorite count: 0
accepted answer: http://stackoverflow.com/a/23577098
type: AnsweredQuestion
has body: I am trying to do this stuff. If a user enters "C:\Windows\system32\foo.txt" then the program will convert it to "C:\\Windows\\system32\\foo.txt". A front slash needs to be added to every other preceding slash. Here's what I have coded till now (only the section relevant): import javax.swing.*; public class test { public static void main(String[] args){ String path = JOptionPane.showInputDialog(null, "Enter the File path", "Word counter", JOptionPane.INFORMATION_MESSAGE); for (int z=0;z&lt;=path.length()-1;z++) { if (path.charAt(z) == '\\') { path.charAt(z) = "\\\\"; } } System.out.println(path); // For knowing what's going on } } Unfortunately it's not compiling, and I don't have a clue of what to do. Any possible help welcomed. Thank you!
has answer: http://stackoverflow.com/a/23577098
downvote count: 3
score: -3
has answer: http://stackoverflow.com/a/23577093
tagged with: swing

sql
tags question: http://stackoverflow.com/q/23490048
tags question: http://stackoverflow.com/q/23480005
tags question: http://stackoverflow.com/q/23566110
tags question: http://stackoverflow.com/q/23585170
tags question: http://stackoverflow.com/q/23594187
tags question: http://stackoverflow.com/q/23564735
tags question: http://stackoverflow.com/q/23539180
tags question: http://stackoverflow.com/q/23481650
tags question: http://stackoverflow.com/q/23570343
tags question: http://stackoverflow.com/q/23606951
tags question: http://stackoverflow.com/q/23500777
tags question: http://stackoverflow.com/q/23507119
tags question: http://stackoverflow.com/q/23570441
tags question: http://stackoverflow.com/q/23481860
tags question: http://stackoverflow.com/q/23491110
tags question: http://stackoverflow.com/q/23505868
tags question: http://stackoverflow.com/q/23541921
tags question: http://stackoverflow.com/q/23484311
tags question: http://stackoverflow.com/q/23613724
tags question: http://stackoverflow.com/q/23527001
tags question: http://stackoverflow.com/q/23472174
tags question: http://stackoverflow.com/q/23522400
tags question: http://stackoverflow.com/q/23481131
tags question: http://stackoverflow.com/q/23506994
tag name: sql
type: Tag
tags question: http://stackoverflow.com/q/23473662
tags question: http://stackoverflow.com/q/23503910
tags question: http://stackoverflow.com/q/23544055
tags question: http://stackoverflow.com/q/23462769
tags question: http://stackoverflow.com/q/23461332
tags question: http://stackoverflow.com/q/23537080
tags question: http://stackoverflow.com/q/23507981
tags question: http://stackoverflow.com/q/23539427
tags question: http://stackoverflow.com/q/23540593
tags question: http://stackoverflow.com/q/23469373
tags question: http://stackoverflow.com/q/23564383
tags question: http://stackoverflow.com/q/23480684
tags question: http://stackoverflow.com/q/23494064
tags question: http://stackoverflow.com/q/23573327
tags question: http://stackoverflow.com/q/23582123
tags question: http://stackoverflow.com/q/23559639
tags question: http://stackoverflow.com/q/23516447
tags question: http://stackoverflow.com/q/23572289
tags question: http://stackoverflow.com/q/23501796
tags question: http://stackoverflow.com/q/23531261
tags question: http://stackoverflow.com/q/23537938
tags question: http://stackoverflow.com/q/23485745
tags question: http://stackoverflow.com/q/23539103
tags question: http://stackoverflow.com/q/23568914
tags question: http://stackoverflow.com/q/23545362
tags question: http://stackoverflow.com/q/23465522
tags question: http://stackoverflow.com/q/23538791
tags question: http://stackoverflow.com/q/23533093
tags question: http://stackoverflow.com/q/23551934
tags question: http://stackoverflow.com/q/23509903
tags question: http://stackoverflow.com/q/23486547
tags question: http://stackoverflow.com/q/23494021
tags question: http://stackoverflow.com/q/23594656
tags question: http://stackoverflow.com/q/23494918
tags question: http://stackoverflow.com/q/23477918
tags question: http://stackoverflow.com/q/23547233
tags question: http://stackoverflow.com/q/23516661
tags question: http://stackoverflow.com/q/23476547
tags question: http://stackoverflow.com/q/23532066
tags question: http://stackoverflow.com/q/23457045
tags question: http://stackoverflow.com/q/23486847
tags question: http://stackoverflow.com/q/23480307
tags question: http://stackoverflow.com/q/23561789
tags question: http://stackoverflow.com/q/23468018
tags question: http://stackoverflow.com/q/23575110
tags question: http://stackoverflow.com/q/23467531
tags question: http://stackoverflow.com/q/23523777
tags question: http://stackoverflow.com/q/23554337
tags question: http://stackoverflow.com/q/23466740
tags question: http://stackoverflow.com/q/23545478
tags question: http://stackoverflow.com/q/23590116
tags question: http://stackoverflow.com/q/23535138
tags question: http://stackoverflow.com/q/23484223

http://stackoverflow.com/q/23610227
tagged with: bresenham
has comment: http://stackoverflow.com/comment/36245974
type: Question
has answer: http://stackoverflow.com/a/23610435
linked to: http://stackoverflow.com/q/9371961
has comment: http://stackoverflow.com/comment/36244900
score: 0
has comment: http://stackoverflow.com/comment/36251788
answer count: 1
type: UnansweredQuestion
has title: Java Coordinate System
tagged with: swing
has body: i am working on a Bresenham Line drawing algorithm in Java and i have been able to draw the line but i am having a problem with the coordinates. My line starts from the top left corner of the screen and i want it to start from the bottom left corner. I have tried Affine Transform but failed. Here is a sample of my code. public void paintComponent( Graphics g ) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(Color.GREEN); g2d.fillRect(0, 0, getWidth(), getHeight()); int xElemSize = this.getWidth() / this.screenPixel.getSizeX(); int yElemSize = this.getHeight() / this.screenPixel.getSizeY(); int rectX = 0, rectY = 0; for (int i = 0; i &lt; this.screenPixel.getSizeX(); i++) { for (int h = 0; h &lt; this.screenPixel.getSizeY(); h++) { if (screenPixel.matrix[i][h] != 0) { rectX = i * xElemSize; rectY = h * yElemSize; Rectangle2D rect = new Rectangle2D.Double(rectX, rectY, xElemSize, yElemSize); g2d.setColor(Color.GREEN); g2d.fill(rect); g2d.draw (rect); bresenham_Linie(x1, y1, x2, y2); } } } } Thanks for ur help!!
has comment: http://stackoverflow.com/comment/36245095
tagged with: java

http://stackoverflow.com/comment/36137955
score: 0
type: Comment
has text: @azurefrog: no, it won't make a difference here, but it will as soon as he cares about where the button is being pressed. Say for instance if he wants to draw a dot in the main JPanel at the button press location. If you add the MouseListener to the JFrame, you will mess things up. I would venture to guess that 99.9% of the time, in this situation the MouseListener should not be added to the top-level window.
comment on: http://stackoverflow.com/a/23551696
type: AnswerComment

http://stackoverflow.com/comment/36236227
has text: The variable has a different name. When your instance variable has the same name as the parameter in you have to declare which one you want to manipulate.
type: Comment
comment on: http://stackoverflow.com/a/23605587
score: 0
type: AnswerComment

http://stackoverflow.com/q/23469071
has comment: http://stackoverflow.com/comment/35981278
has comment: http://stackoverflow.com/comment/35980942
has title: Adding item to array in java?
tagged with: java
has body: I have an array, defined as below: String[] letters = {"ab", "cd", "ef", "gh"}; How would I go about adding an item to this array?
duplicate of: http://stackoverflow.com/q/5061721
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23469188
answer count: 4
linked to: http://stackoverflow.com/q/2843366
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/23469209
duplicate of: http://stackoverflow.com/q/2843366
favorite count: 0
has answer: http://stackoverflow.com/a/23469104
type: Question
has comment: http://stackoverflow.com/comment/35980921
has answer: http://stackoverflow.com/a/23469196
has comment: http://stackoverflow.com/comment/35980881
score: -2
downvote count: 2
linked to: http://stackoverflow.com/q/5061721

http://stackoverflow.com/comment/36172533
type: QuestionComment
comment on: http://stackoverflow.com/q/23571421
has text: There are no doubles.
score: 0
type: Comment

http://stackoverflow.com/comment/36222158
comment on: http://stackoverflow.com/a/23597471
score: 0
type: AnswerComment
has text: Could you elaborate? How could you use it to solve the problem? Can you give an example? This is the seed of a good answer, but it needs more explanation.
type: Comment

http://stackoverflow.com/comment/36150689
type: Comment
has text: *changing `t0.method()` to `test.method()` will work* -- indeed, but IMO this is a dangerous workaround. It actually makes `this` and `test` the same thing in `method()`'s body, in this very particular case, but that might confuse the OP. @MauricePerry's explanation is clearer for the OP in my opinion. (I'm not downvoting though, because it's a valid answer)
comment on: http://stackoverflow.com/a/23559416
score: 1
type: AnswerComment

http://stackoverflow.com/a/23519642
has comment: http://stackoverflow.com/comment/36080723
has comment: http://stackoverflow.com/comment/36081777
has comment: http://stackoverflow.com/comment/36081587
downvote count: 0
has comment: http://stackoverflow.com/comment/36081018
has comment: http://stackoverflow.com/comment/36406273
has comment: http://stackoverflow.com/comment/123208256
has comment: http://stackoverflow.com/comment/36081640
has comment: http://stackoverflow.com/comment/36083581
upvote count: 6
has comment: http://stackoverflow.com/comment/36407081
has comment: http://stackoverflow.com/comment/36092776
has comment: http://stackoverflow.com/comment/36081416
has comment: http://stackoverflow.com/comment/36081224
has comment: http://stackoverflow.com/comment/123198102
has comment: http://stackoverflow.com/comment/36406529
has comment: http://stackoverflow.com/comment/123724045
has body: I have created some kind of a graphical tutorial. Add Java 8 to Eclipse Install Eclipse Kepler 4.3.2 Eclipse | Help | Install New Software... http://download.eclipse.org/eclipse/updates/4.3-P-builds/ Alternatively, install Eclipse Luna 4.4 M7 and you do not have to install the Eclipse Kepler Java 8 patch. Before the next step, if you still do not have JDK1.8.0 installed, go to Add... button and add your Java 8 JDK to your Eclipse. You may ommit the step of changing the Javadoc location if you have not downloaded it to your local disk, it is just for faster access to Javadoc. Add Java 8 SDK to Installed JREs Eclipse | Window | Preferences Add Java 8 Support to your Project Eclipse | Project | Properties
has comment: http://stackoverflow.com/comment/36087631
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/36110881
answers question: http://stackoverflow.com/q/23502998

http://stackoverflow.com/a/23474495
type: Answer
accepted answer of: http://stackoverflow.com/q/23474159
answers question: http://stackoverflow.com/q/23474159
has comment: http://stackoverflow.com/comment/35994813
has comment: http://stackoverflow.com/comment/35997578
score: 0
has body: I don't think those two loops are doing what you think they are. In the first loop you should eliminate Cars which have the same number, perhaps setting them to null: for (int i = 0; i &lt; this.cars.length; i++) { if (this.cars[i] != null &amp;&amp; this.cars[i].getCarNum() == CarNum) { this.cars[i] == null; } else { count++; } } This will now eliminate duplicates, and keep a count of unique Cars. In the second loop, fill in just the non-null values: CarsLines [] newArr= new CarLines[count]; int index = 0; for(int i = 0; i&lt; this.cars,length; i++) { if (this.cars[i] != null) { // Only pass in the non-null values newArr[index] = this.cars[i]; index++; } } this.cars= newArr; Before you had this creating pretty much an identical copy of your list because you were filling it in on a one-to-one basis i.e. the same index. Another possible way of doing this would be an in place conversion: for (int i = 0; i &lt; this.cars.length; i++) { if (this.cars[i] != null &amp;&amp; this.cars[i].getCarNum() == CarNum) { for (int j = i+1; j &lt; this.cars.length; j++) { // This loop will shift the this.cars[j-1] = this.cars[j]; // whole list down one when } // a duplicate is found, // overwriting it. i--; // sets the index back to recheck the shifted list. this.noOfCars--; // You removed one duplicate by overwriting it } } In response to @Boris The Spiders Comment, you could reduce the complexity of this algorithm by eliminating the inner for loop. I would recommend doing this by tracking the last valid position and using that for updating. int writeIndex = 0; for (int readIndex = 0; readIndex &lt; this.cars.length; readIndex++) { if (this.cars[readIndex] != null &amp;&amp; this.cars[readIndex].getCarNum() == CarNum) { // pass on this because nextIndex should track only the valid cars. } else { this.cars[writeIndex++] = this.cars[readIndex]; } if (writeIndex &lt; readIndex) { this.cars[i] = null; } } The idea is that you keep one index for reading (i) and one index for writing writ…
type: AcceptedAnswer

http://stackoverflow.com/comment/36112222
has text: It would defeat the purpose of having an enum, wouldn't it?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23539226
score: 1

http://stackoverflow.com/comment/36176162
score: 0
type: AnswerComment
type: Comment
has text: too bad. the status code should not always be 200!
comment on: http://stackoverflow.com/a/23572589

http://stackoverflow.com/comment/36106881
type: QuestionComment
has text: 1) Aren't these files directories? 2) Do you have the correct privileges to delete these files?
score: 1
comment on: http://stackoverflow.com/q/23536233
type: Comment

http://stackoverflow.com/comment/35978102
comment on: http://stackoverflow.com/a/23456085
score: 1
has text: I still rest my case. See who's answered my [*other question*](http://stackoverflow.com/a/23463334/521799) :-) It will now forever be clear with an authoritative answer, here on Stack Overflow *why* it was decided not to support `synchronized` on `default` methods.
type: AnswerComment
type: Comment

otto
tag name: otto
type: Tag
tags question: http://stackoverflow.com/q/23582474
tags question: http://stackoverflow.com/q/23543951

http://stackoverflow.com/q/23484247
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23484287
type: Question
tagged with: gridbaglayout
tagged with: user-interface
answer count: 1
tagged with: flowlayout
accepted answer: http://stackoverflow.com/a/23484287
has title: GridBagLayout and FlowLayout: Components appearing at unexpected positions
has body: 1. Question About GridBagLayout:- Inspite of setting gridx=0; for all the components, all of them are aligning in the center of the parent. Please tell me how to fix it and please do tell me why is this unexpected behavior occuring. 2. Question About FlowLayout:- In the start of the example, a panel (added to the top of the parent panel with the GridBagLayout) is using FlowLayout. According to the documentation, in the constructor FlowLayout(FlowLayout.LEFT, 5, 5), FlowLayout.LEFT is for alignment, next two int's are for hgap and vgap. I am using Left alignment but still both the buttons appear in the center. Please tell me why? The vertical inset of all the components is much more than expected. Why is that happening? The same value of 5 is not resulting in so much of an inset on the sides :s EXAMPLE CODE:- Card(){ setLayout(new GridBagLayout()); JPanel panelBtns= new JPanel(); panelBtns.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5)); JButton emailBtn= new JButton("a"); JButton saveBtn= new JButton("b"); panelBtns.add(emailBtn); panelBtns.add(saveBtn); GridBagConstraints c= new GridBagConstraints(); c.gridx=0; c.gridy=0; c.insets= new Insets(5,5,5,5); c.weightx=1; c.weighty=1; add(panelBtns, c); JLabel labelTitle= new JLabel("Title"); labelTitle.setFont(new Font("calibri", Font.PLAIN, 12)); c= new GridBagConstraints(); c.gridx=0; c.gridy=1; c.insets=new Insets(5,5,5,5); c.weightx=0.35; c.weighty=1; add(labelTitle, c); JTextField textField= new JTextField(); Border border = BorderFactory.createLineBorder(Color.GRAY); textField.setBorder(BorderFactory.createCompoundBorder(border, BorderFactory.createEmptyBorder(2,2,2,2))); c= new GridBagConstraints(); c.gridx=0; c.gridy=2; c.insets= new Insets(5,5,5,5); c.fill=c.HORIZONTAL; c.weightx= 1; c.weighty=1; add(textField,c); JLabel bodyLabel= new JLabel("Detail"); bodyLabel.setFont(new Font("calibri", Font.PLAIN, 12)); c= new GridBagConstraints(); c.gridx=0; c.gridy=3; c.insets=new Insets(5,5,5,5); c.weightx=1; c.weighty…
score: 0
tagged with: swing

http://stackoverflow.com/comment/36179608
comment on: http://stackoverflow.com/a/23574984
score: 0
type: AnswerComment
has text: Alright, thanks for the pointer :) I am new to java and trying to rack up those reputation points, thought i got the research right but alright, thanks for the help
type: Comment

http://stackoverflow.com/comment/36177756
score: 1
comment on: http://stackoverflow.com/q/23573994
type: Comment
type: QuestionComment
has text: There's a problem here; here, `ß` is `\u00DF` as an escaped UTF-16 sequence but you read _byte_ 0x65; what is your source?

http://stackoverflow.com/q/23541474
tagged with: liferay
score: 2
downvote count: 0
tagged with: ldap
has title: Mapping LDAP users to Liferay local groups
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: liferay-6
has body: I have setup LDAP authentication with liferay in my application. I have kept LDAP enabled and required as true. This way only users with LDAP account would be able to login to portal. ldap.auth.enabled=true ldap.auth.required=true Now I have requirement to create a local liferay group having certain users from LDAP (belonging to my team). After LDAP authentication, this group would be checked if the user logging in is part of this group then only authentication would be allowed. So basically I need two groups: Team group (containing subset of LDAP) Admin group (Subset of team and will be able to add/remove from team group) I need help on achieving this. The issue is, as my LDAP account do not have admin rights once I login to liferay, I do not see any administration options, and won't be able to create group. Is there anyway I can map some of the LDAP accounts to admin accounts and how do I achieve this in production without doing required flag as false? Thanks in advance!
tagged with: java
has answer: http://stackoverflow.com/a/23596825
type: Question

http://stackoverflow.com/q/23533631
has comment: http://stackoverflow.com/comment/36102356
tagged with: java
answer count: 3
has title: Java default packages
type: UnansweredQuestion
score: -4
tagged with: ubuntu
has answer: http://stackoverflow.com/a/23533676
linked to: http://stackoverflow.com/q/16263556
downvote count: 4
upvote count: 0
has body: I write a small java program to read file and do the string matching in windows 8 by using net beans. But when i compile it on ubuntu by using terminal following message appeared. Is there any default packages in ubuntu , for following packages in the error. The program 'javac' can be found in the following packages: * default-jdk * ecj * gcj-4.6-jdk * gcj-4.7-jdk * openjdk-7-jdk * openjdk-6-jdk Try: sudo apt-get install &lt;selected package&gt; ucsc@ucsc-VirtualBox:~/Desktop/Question$
has answer: http://stackoverflow.com/a/23533672
favorite count: 0
has answer: http://stackoverflow.com/a/23533707
type: Question

http://stackoverflow.com/comment/36064386
comment on: http://stackoverflow.com/a/23512966
score: 1
type: AnswerComment
has text: Any explanation why "-"? Or the question is about number representation? Then the question is completely unrelated to RSA, java and encryption and @Speaky should just learn basics of computing. E.g. start here: http://en.wikipedia.org/wiki/Integer_%28computer_science%29
type: Comment

http://stackoverflow.com/comment/36227736
has text: I ran your code and I ended up with amy,sophie,sarah,claire,john,steve,della,ron,Bob,Rob which looks like the correct order based on your data and code. What order do you expect?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23600097
score: 0

http://stackoverflow.com/comment/36008867
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23483610
has text: The issue was on the server's end. I had it creating the in connection before the out connection. Thanks for the help anyways.
score: 0

http://stackoverflow.com/comment/36027793
has text: @Philipp I've read the first option is the "best practice" and I wanted to know if there is any performance reason for that
comment on: http://stackoverflow.com/q/23494344
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36146864
type: QuestionComment
comment on: http://stackoverflow.com/q/23557656
has text: this code cannot print such output, give us real output and real problem
score: 4
type: Comment

http://stackoverflow.com/a/23588009
has comment: http://stackoverflow.com/comment/36203665
has comment: http://stackoverflow.com/comment/36203629
answers question: http://stackoverflow.com/q/23587953
has body: I think what you want is for the variable to hold it's value. Try making another variable, a boolean, and before you initialize it, make a check to see if you have already done so. Also, declare this boolean in the class where if (Doihavetools==0 &amp;&amp; Stone.StoneCounter&gt;=10 &amp;&amp; Wood.WoodCounter&gt;=50){ is present, at the top. (make it public) so... then you can if(initialized == false) { int WoodCounter; initialized = true; } Either that, or just use Wood.WoodCounter instead of declaring a new variable.
has comment: http://stackoverflow.com/comment/36203692
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36203636
has comment: http://stackoverflow.com/comment/36203787
accepted answer of: http://stackoverflow.com/q/23587953

http://stackoverflow.com/a/23609047
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/36314673
score: 2
upvote count: 2
has body: You will have to provide a Converter and a wrapper class ... @Component public class YourConverter implements Converter<YourIntWrapper, YourDateWrapper> { @Override public YourDateWrapper convert(YourIntWrapper source) { // do your stuff return yourOutWrapper; } } and register it
has comment: http://stackoverflow.com/comment/36277082
answers question: http://stackoverflow.com/q/23608613
has comment: http://stackoverflow.com/comment/36276814
accepted answer of: http://stackoverflow.com/q/23608613
type: AcceptedAnswer

http://stackoverflow.com/comment/35951491
has text: Is the order maintained with a simple HashSet?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23453106

http://stackoverflow.com/a/23552040
has comment: http://stackoverflow.com/comment/36139315
score: 0
type: Answer
has body: Instead of getting all the records in the database each time, try limiting the results to those that match the city and state using a WHERE clause in your SELECT statement: String sql = "SELECT city, state FROM CRAIGSLIST " + "WHERE UPPER(city) = '" + cityInFile.toUpperCase() + "', UPPER(state) = '" + stateInFile.ToUppderCase + "'";
has comment: http://stackoverflow.com/comment/48557622
answers question: http://stackoverflow.com/q/23551705

http://stackoverflow.com/a/25034257
answers question: http://stackoverflow.com/q/23528890
type: Answer
has body: Shai already answered the question, codename one does not support some string functions like replaceAll, split. but you can use the StringUtil class they offered. StringUtil.replaceAll() will do what you want. StringUtil.replaceAll(String source, String pattern, String replace); source - the String source pattern - String to replace in the source replace - replacement String This should work just fine.
score: 0

http://stackoverflow.com/a/23594776
has comment: http://stackoverflow.com/comment/36216353
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23594581
has comment: http://stackoverflow.com/comment/36218912
downvote count: 0
has comment: http://stackoverflow.com/comment/36216837
has comment: http://stackoverflow.com/comment/36227273
has body: The most common and recommended way of unit testing A would be to avoid using Guice at all in your test. Create A with a reference to B that you provide. public class A { private final B b; @Inject public A(B b) { this.b = b; } } In your test code, just create the B (whether it be an actual B or a mock) and then create A yourself; B b = mock(B.class); A testUnit = new A(b); //now you obviously know what b is If you do want to introduce Guice into your testing, you could use a different module configuration where you control how B is instantiated. Since the test will provide the module and the instance of B, it should be trivial to obtain the instance of B in the test.
upvote count: 2
has comment: http://stackoverflow.com/comment/36216188

http://stackoverflow.com/comment/36213295
type: AnswerComment
type: Comment
has text: Good to hear that helped!
comment on: http://stackoverflow.com/a/23589138
score: 0

http://stackoverflow.com/comment/36137810
score: 1
comment on: http://stackoverflow.com/q/23552649
has text: Your `lat1 - lat0` computation is -76.888215 - -76.888694, not the other way round. It doesn't help that your variables go from being 1-based to being 1-based, but that's basically why you're getting a sign different to what you expect.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36352419
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23556772
score: 0
has text: You're missing two commas, otherwise the JSON looks (at first glance) to be valid. As to how to parse it, just parse it (after adding the missing commas). It's an array of 4 JSON objects, very easy to parse and very easy to comprehend.

http://stackoverflow.com/comment/36119571
score: 0
comment on: http://stackoverflow.com/q/23542708
type: Comment
type: QuestionComment
has text: The Module interface is in the classpath and managed by Maven.

http://stackoverflow.com/q/23542776
has comment: http://stackoverflow.com/comment/36120697
has title: Design or pattern for handling background consumer/producer tasks
has comment: http://stackoverflow.com/comment/36154566
upvote count: 1
has comment: http://stackoverflow.com/comment/36120274
tagged with: opengl
score: 1
tagged with: java
has body: Background: I have a 3D engine implemented using LWJGL aimed largely at rendering a large 'world' - terrain, vegetation, animated creatures, weather, day/night cycle, etc. The engine manages the resources that are required for rendering such as the various textures, meshes, models, etc. As the player navigates this world the engine caches the various types of data discarding/releasing resources that are no longer required and loading/caching newly required data on demand. This is handled by a set of background threads that perform I/O tasks (loading images, loading a new terrain 'chunk', building a model mesh, etc) and a queue of tasks to be executed on the OpenGL context (allocating a new texture, uploading data to a VBO, deleting a texture, etc). Current design: This all works nicely with the exception of tasks that have dependencies. I'll illustrate with an example - let's say the engine needs to apply a new texture to an object in the scene. This consists of the following steps: load the texture image from the file system (I/O background task) allocate a texture on the GPU (OpenGL context task) upload the image to the texture (OpengL) attach the texture to the material for the object (OpenGL, not really but avoids rendering issues) There are a few problems to resolve here: Ideally I want these steps (or tasks) to be atomic and re-usable, for example the engine needs to load images for several other parts of the system - the code is exactly the same and therefore can (and should) be encapsulated and re-used. Some of this can be run in parallel (e.g. load image and allocate texture), some of it must be sequential, e.g. cannot upload the image until we have loaded it and allocated the texture. Some of the steps have 'resource dependencies' on previous steps, e.g. in particular the upload step requires the allocated texture ID and the image. The first two turn out to be relatively straight-forward, it's the last one is what I am struggling with - I cannot seem to co…
type: Question
has comment: http://stackoverflow.com/comment/36121158
downvote count: 0
has comment: http://stackoverflow.com/comment/36141865
answer count: 1
has comment: http://stackoverflow.com/comment/36124897
has answer: http://stackoverflow.com/a/23651761
has comment: http://stackoverflow.com/comment/36122068
favorite count: 0
has comment: http://stackoverflow.com/comment/36123281
has comment: http://stackoverflow.com/comment/36123672
type: UnansweredQuestion
tagged with: lwjgl

http://stackoverflow.com/a/23598691
answers question: http://stackoverflow.com/q/23579607
type: Answer
upvote count: 1
score: 1
has body: I did it this way using Liquibase's API: private void migrate(){ DataSourceFactory dataSourceFactory = RULE.getConfiguration().dataSourceFactory; Properties info = new Properties(); info.setProperty("user", dataSourceFactory.getUser()); info.setProperty("password", dataSourceFactory.getPassword()); org.h2.jdbc.JdbcConnection h2Conn = new org.h2.jdbc.JdbcConnection(dataSourceFactory.getUrl(), info); JdbcConnection conn = new JdbcConnection(h2Conn); Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(conn); Liquibase liquibase = new Liquibase("migrations.xml", new ClassLoaderResourceAccessor(), database); String ctx = null; liquibase.update(ctx); } And then I put this in a beforeclass: @BeforeClass public void setup(){ migrate(); } It's probably not the ultimate solution, and it depends a lot on the database you're using, but it works.
downvote count: 0

http://stackoverflow.com/comment/53314748
type: Comment
type: QuestionComment
has text: I'm not using an arbiter node. My question was simplified by purpose
comment on: http://stackoverflow.com/q/23469007
score: 0

http://stackoverflow.com/q/23586907
tagged with: java
type: Question
tagged with: filenotfoundexception
tagged with: libgdx
has comment: http://stackoverflow.com/comment/36204047
has comment: http://stackoverflow.com/comment/36212168
score: 0
has title: Gdxlibrary - FileNotFoundException when loading assets
type: UnansweredQuestion
has body: ===================================== I was able to fix it by selecting the assets folder and choosing "use as source folder". It wasn't shown in the tutorial. ===================================== I am trying to follow along a tutorial series on gdx java graphics programming. But I am stuck trying to load a texture. Error: Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: dataack.PNG at com.badlogic.gdx.graphics.Pixmap.&lt;init&gt;(Pixmap.java:140) at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:64) at com.badlogic.gdx.graphics.Texture.load(Texture.java:130) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:121) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:100) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:92) at com.myGame.Assets.load(Assets.java:17) at com.myGame.MyGame.create(MyGame.java:11) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: dataack.PNG (Internal) at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136) at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:220) at com.badlogic.gdx.graphics.Pixmap.&lt;init&gt;(Pixmap.java:137) ... 9 more And this is the code: public class Assets { public static Sprite sprite_back; public static Texture texture_back; public static void load() { texture_back = new Texture(Gdx.files.internal("data/back.png")); texture_back.setFilter(TextureFilter.Linear, TextureFilter.Linear); sprite_back = new Sprite(texture_back); sprite_back.flip(false, true); } } This is the folder strucure: Assets>data>back.png Gdx.files.internal should start in the folder assets and therefore this should work. The image is in both the desktop and android assets folder and i also refreshed the project ecplo…
answer count: 0
has comment: http://stackoverflow.com/comment/36207893

http://stackoverflow.com/comment/35973161
has text: You are trying to display the jsp in iFrame. I want the server response, which is actually a text file/stream, to be written to the jsp's iFrame. This is my source question stackoverflow.com/q/23464296/3602818. Please look into it. Maybe u will get a better idea of what I'm trying to achieve. Thanks :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23464224

http://stackoverflow.com/comment/36144611
score: 3
has text: What is the **shortest** piece of code you could write that doesn't draw the traffic light when you think it ought to? That's the place to start...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23556371

import
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/23570275
tags question: http://stackoverflow.com/q/23580284
tags question: http://stackoverflow.com/q/23523169
tags question: http://stackoverflow.com/q/23473366
tags question: http://stackoverflow.com/q/23569971
tags question: http://stackoverflow.com/q/23533133
tags question: http://stackoverflow.com/q/23494084
tags question: http://stackoverflow.com/q/23468653
tags question: http://stackoverflow.com/q/23598896
tags question: http://stackoverflow.com/q/23590692

http://stackoverflow.com/comment/35977150
score: 0
has text: @HimanshuBhardwaj That really depends on how you set up the exception mapping, which is what this question is really about: how _should_ exceptions be mapped, and what information should be in them?
comment on: http://stackoverflow.com/q/23466342
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36077561
type: Comment
type: QuestionComment
has text: you could just use AJAX, instead of web sockets. Your question is too broad. How do I know what data you need to pass? Especially since I don't even know the goal of your application.
comment on: http://stackoverflow.com/q/23520194
score: 0

http://stackoverflow.com/a/29987515
type: Answer
answers question: http://stackoverflow.com/q/23531558
score: 0
has body: This could be one workaround: On the remote server you can have two ports: 9999 and 9998 forwarded to 9999. When restarting your application alternate a boolean each time to decide to connect to 9999 or 9998.

http://stackoverflow.com/q/23544973
has comment: http://stackoverflow.com/comment/36132043
has comment: http://stackoverflow.com/comment/36132674
has title: jquery updating java hashmap on every request by user
has comment: http://stackoverflow.com/comment/36129920
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36128295
type: Question
tagged with: javascript
has comment: http://stackoverflow.com/comment/36129965
tagged with: servlets
score: 0
has body: Is it necessary to have data on the browser first and than update using jquery . Can't we direclty update the java objects in servlet . Please suggest , i have explained my scenerio here. Thanks ! In jsp i have written a jquery code which will send the get request to my Java servlet. Here is the jquery code . $.ajax({ url: '&lt;%=portalContext.createTemplateProcessURI()%&gt;' + '?s1=' + $("#networkBox1").val() + '&amp;box1=Box1&amp;tick=add&amp;val1=' + allvs + '&amp;s2=' + $("#networkBox2").val() + '&amp;box2=Box2&amp;val2=' + allvs, type: 'get', dataType: 'text', async: false, success: function (data) { Processbox(data); // This function displaying the result. } }); In my java code i am retrieving all these parameters and manipulating the Hashmap according to the values received. public PortalURI execute(PortalContext portalContext) throws ActionException { HttpServletRequest request = portalContext.getPortalRequest().getRequest(); HttpServletResponse response = portalContext.getPortalResponse().getResponse(); HttpSession session = portalContext.getPortalRequest().getSession(); Map&lt;String, List&lt;List&lt;String&gt;&gt;&gt; mapLeftBOX = new HashMap&lt;String, List&lt;List&lt;String&gt;&gt;&gt;(); Map&lt;String, List&lt;List&lt;String&gt;&gt;&gt; mapRightBOX = new HashMap&lt;String, List&lt;List&lt;String&gt;&gt;&gt;(); if ("add".equalsIgnoreCase(tick)) { mapLeftBOX = (Map&lt;String, List&lt;List&lt;String&gt;&gt;&gt;) session.getAttribute(session,"mapLeft", null); // retrieving the map Left value stored in session in previous servlet mapLeftBOX.put(newkeyfromjquery, newvaluesfromjquery); // updsating the map with new values from jquery session.setAttribute("mapLeft", mapLeftBOX); // setting the new map in session out.write("concatStringsfrom mapLeftBOX"); // retrieve string values from map and write the response back to jquery } } This is my sample code. so, when a request will be fired jquery will get call and my servlet will get executed. The hashmap in the s…
tagged with: jsp
tagged with: jquery
type: UnansweredQuestion

http://stackoverflow.com/q/23505330
upvote count: 3
tagged with: java
downvote count: 3
has title: Best way to implement multiple small classes?
type: Question
has comment: http://stackoverflow.com/comment/36049196
has answer: http://stackoverflow.com/a/23505438
has comment: http://stackoverflow.com/comment/36049515
has comment: http://stackoverflow.com/comment/36049780
has answer: http://stackoverflow.com/a/23505378
has comment: http://stackoverflow.com/comment/36049213
linked to: http://stackoverflow.com/q/2709593
score: 0
has comment: http://stackoverflow.com/comment/36049793
answer count: 3
has comment: http://stackoverflow.com/comment/36049248
has comment: http://stackoverflow.com/comment/36050131
has comment: http://stackoverflow.com/comment/36049292
has body: So, I'll describe my problem. User enters a command. I need to process that command and run a specific function accordingly. I used a switch statement for finding what command was entered by user, but I think that it was getting rather messy. Should I keep going with this approach? I decided to create a class for every possible command, put them into an array and, instead of switch statement, use a loop to check if any of the commands fits and call the function stored in that command object. At the moment I have about 10 commands implemented, but the number will grow. Creating a new file for every new command class looks really bothersome and possibly messy, so I wonder if there is a better way to achieve what I want or perhaps there is a better way to implement everything?
has comment: http://stackoverflow.com/comment/36049276
has comment: http://stackoverflow.com/comment/36049768
favorite count: 0
has answer: http://stackoverflow.com/a/23505839
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36049678
has comment: http://stackoverflow.com/comment/36049326
tagged with: design-patterns

http://stackoverflow.com/comment/36019952
type: AnswerComment
score: 0
has text: I believe the previously mentioned CodeAnalyzer plugin indeed uses AST-based clone detection.
type: Comment
comment on: http://stackoverflow.com/a/23486417

http://stackoverflow.com/comment/35994426
has text: No. There is no need to poll. This a waste of CPU cycles and far less responsive than the watch service approach.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23474070

http://stackoverflow.com/q/23537589
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/23539005
has title: controlling ime_action_done behaviour
type: UnansweredQuestion
tagged with: android
has body: I have two android activities with ime_action_done. Activity A has it on EditText view. There - the soft keyboard "done" closes the keyboard. private void initLayout(){ mInputText.setImeOptions(EditorInfo.IME_ACTION_DONE); } no onEditorAction overriding Activity B has it on a custom view that extends TokenCompleteTextView (com.tokenautocomplete.TokenCompleteTextView extends android.widget.MultiAutoCompleteTextView implements android.widget.TextView$OnEditorActionListener ) There the done action does nothing. completionView.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (completionView.enoughToFilter() &amp;&amp; (adapter != null)) { //some logic. doesn't separate action_done from the other actions. } return true; } }); How can i make the second one close the soft keyboard as well?
tagged with: java
type: Question
tagged with: android-layout
tagged with: layout

http://stackoverflow.com/comment/36211491
comment on: http://stackoverflow.com/q/23587046
type: Comment
type: QuestionComment
score: 0
has text: @RomanC: Doesn't work.

http://stackoverflow.com/q/23578305
possible better answer: http://stackoverflow.com/a/23578482
type: Question
has body: In my project I am facing weird issue with thread. This issue is only occurring when I am running multiple thread at once(load testing). In my project there are multiple Interceptors which intercepts request/response at different level in application and send the request/response to WritetoFile class which writes the details into a flat file using log4j framework. Below is the sample interceptor code. There are multiple interceptor and each can process in parallel. /*we have multiple Interceptor class which will pre-process the request/response and then send it to WritetoFile*/ public class IntercerptorA { // some code ... public synchronized void sendRequestToWritetoFile(IRequest request,IResponse response){ WritetoFile wtf = new WritetoFile(); //this class is responsible for writing request/response information into LOG file wtf.setRequest(request); wtf.setResponse(response); Thread thread=new Thread(wtf, "t1");//**assume wtf.getRequest is having "ABC"** thread.start(); } } Now suppose there 2 more Interceptor and has only single line difference in the code. //For interceptorB Thread thread=new Thread(wtf, "t2");//**assume wtf.getRequest is having "DEF"** //For interceptorC Thread thread=new Thread(wtf, "t3");//**assume wtf.getRequest is having "XYZ"** Below is the code for WritetoFile class -: public class WritetoFile implements Runnable{ private volatile IRequest request; private volatile IResponse response; public synchronized IRequest getRequest() { return request; } public synchronized void setRequest(IRequest request) { this.request = request; } public synchronized IResponse getResponse() { return response; } public synchronized void setResponse(IResponse response) { this.response = response; } @Override public void run() { // I have added synchronized as I was trying to resolve the issue synchronized(WritetoFile.class){ putItInFile(this.request,this.response); } } private synchronized void putItInFile (IRequest request,IResponse response){ // This is the lo…
has title: Threads getting wrong member variable values
has comment: http://stackoverflow.com/comment/36185777
has comment: http://stackoverflow.com/comment/36185596
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/23578580
tagged with: synchronization
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23578688
has answer: http://stackoverflow.com/a/23578482
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/23578580

http://stackoverflow.com/q/23507000
has answer: http://stackoverflow.com/a/23507022
has comment: http://stackoverflow.com/comment/36052255
has comment: http://stackoverflow.com/comment/36053002
tagged with: java
has body: Hey I am supposed to take in a list of cities and x and y coordinates and plot them. I have all the cities in as Vertexes with x and y coordinates. Now I am trying to plot them but I can't seem to see what I am doing wrong and I am not getting an error. This is my first time using GUI so it could be a dumb mistake. import javax.swing.JTextField; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.geom.*; import java.util.Arrays; public class GraphMaker{ public GraphMaker(Vertex[] a ) { JFrame frame = new JFrame(); String start = "Start"; int columns=20; String end = "End"; JTextField startCity = new JTextField(start,columns); JTextField endCity = new JTextField(end,columns); JButton button = new JButton("Find Path"); //button.addActionListener(button); int length = a.length; Vertex current = a[0]; CityComponent cityPanel = new CityComponent(current); /*for(int i=0; i &lt; length; i++){ Vertex current = a[i]; g2.draw(new Line2D.Double(x,y,x,y)); }*/ JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); panel.add(startCity); panel.add(endCity); panel.add(button); frame.setLayout(new BorderLayout()); frame.add(cityPanel,BorderLayout.CENTER); frame.add(panel,BorderLayout.SOUTH); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } public void actionPerformed(ActionEvent e) { return; } } import javax.swing.*; import java.awt.*; public class CityComponent extends JComponent { private Vertex m; private int x = 0; private int y = 0; public CityComponent(Vertex m) { this.m = m; } public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D)g; m.draw(g2); } } import java.awt.*; import java.awt.geom.*; import java.util.*; public class Vertex{ public String element; public Double x; public Double y; public Vertex(String city, String a, String b){ this.element = city; this.x = Double.parseDouble(a); this.y = Double.parseDouble(b); } public void draw(Graphics2D g2){ Point2D.Double r1 = new Po…
type: Question
has comment: http://stackoverflow.com/comment/36052305
score: 0
tagged with: user-interface
answer count: 1
has title: Plotting points in java
type: UnansweredQuestion
tagged with: swing
tagged with: 2d

http://stackoverflow.com/q/23455018
tagged with: spring-data-mongodb
favorite count: 0
tagged with: spring-data
upvote count: 1
accepted answer: http://stackoverflow.com/a/23462637
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23455155
has title: Embedded document index for date is not used
type: Question
tagged with: mongodb
answer count: 2
possible better answer: http://stackoverflow.com/a/23455155
downvote count: 0
has body: I'm newbie using MongoDB and I have a collection for this type of document: { "_id" : { "coordinate" : { "latitude" : 532144, "longitude" : -33333 }, "margin" : "N" }, "prices" : [ { "type" : "GAS_95", "price" : 1370, "date" : ISODate("2014-05-03T18:39:13.635Z") }, { "type" : "DIESEL_A", "price" : 1299, "date" : ISODate("2014-05-03T18:39:13.635Z") }, { "type" : "DIESEL_A_NEW", "price" : 1350, "date" : ISODate("2014-05-03T18:39:13.635Z") }, { "type" : "GAS_98", "price" : 1470, "date" : ISODate("2014-05-03T18:39:13.635Z") } ] } I need to retrieve the prices for specific date, so then I run this query: db.gasStation.aggregate( { "$unwind" : "$prices"}, { "$match" : { "_id" : { "coordinate" : { "latitude" : 532144 , "longitude" : -33333} , "margin" : "N" } , "prices.date" : { "$gte" : ISODate("2014-05-02T23:00:00.000Z") , "$lte" : ISODate("2014-05-03T22:59:59.999Z") } } }); All works fine, I retrieve the documents but I presume that my can be improved, I tried to create an index for _id and prices.date: db.gasStation.ensureIndex( { "_id" : 1, "prices.date" : 1 } ) After that I try to see if the index is being used in my query with the explain option but is not using any index: { "stages" : [ { "$cursor" : { "query" : { }, "plan" : { "cursor" : "BasicCursor", "isMultiKey" : false, "scanAndOrder" : false, "allPlans" : [ { "cursor" : "BasicCursor", "isMultiKey" : false, "scanAndOrder" : false } ] } } }, { "$unwind" : "$prices" }, { "$match" : { "_id" : { "coordinate" : { "latitude" : 532144, "longitude" : -33333 }, "margin" : "N" }, "prices.date" : { "$gte" : ISODate("2014-05-02T23:00:00Z"), "$lte" : ISODate("2014-05-03T22:59:59.999Z") } } } ], "ok" : 1 } is there any reason that my query is not suitable to use the index? I read on MongoDB documentation that the only pipeline that is not using indexes is $group but I'm not using that feature.
has answer: http://stackoverflow.com/a/23462637
tagged with: aggregation-framework

http://stackoverflow.com/comment/36239402
score: 0
type: Comment
type: QuestionComment
has text: I have two elements in my application - GUI and service. They are compiled within one application. Sorry, may be "GameServerData" is wrong name. Is is used only between service and GUI, not by server. So, answer for your question is "yes, they use the same version of .class files"
comment on: http://stackoverflow.com/q/23606233

http://stackoverflow.com/q/23562344
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36155020
upvote count: 1
tagged with: git
has answer: http://stackoverflow.com/a/25357641
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36154931
has body: I have just started using the built in GIT functionality of Eclipse and I have everything set up and working, my problem as of now is that I realized my project that I imported from GIT is not reporting errors in my Java like the local copy would. I've tried the following, Project -> Clean When I right click on the property files of the folder I can't seem to choose a Java Builder.
tagged with: eclipse
linked to: http://stackoverflow.com/q/6760115
type: Question
answer count: 1
downvote count: 0
tagged with: ide
favorite count: 0
has title: Eclipse Error Logging - Not Showing Because of imported from GIT?

http://stackoverflow.com/q/23614228
has body: I tried to get a location for my android app but getLastKnownLocation always returns null and onLocationChanged is never called. I use the following permissions for my app: ACCESS_NETWORK_STATE, ACCESS_FINE_LOCATION ACCESS_COARSE_LOCATION. GPS and internet are turned on, on my device on. Also I tried different values for requestLocationUpdates. locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); locationManager.removeUpdates(this); isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled &amp;&amp; !isNetworkEnabled) { // no network provider is enabled } else { hasGPS = true; location = null; if (isGPSEnabled) { if (location == null) { locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); if (locationManager != null) { location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (location != null) { lat = location.getLatitude(); lng = location.getLongitude(); } } } } if (isNetworkEnabled &amp;&amp; location == null) { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, MIN_TIME_BW_UPDATES, MIN_DISTANCE_CHANGE_FOR_UPDATES, this); if (locationManager != null) { location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (location != null) { lat = location.getLatitude(); lng = location.getLongitude(); } } } }
has title: Android GPS Tracking issue
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36252620
score: -1
has comment: http://stackoverflow.com/comment/36252565
answer count: 2
linked to: http://stackoverflow.com/q/19621882
upvote count: 0
linked to: http://stackoverflow.com/q/1608632
favorite count: 0
has answer: http://stackoverflow.com/a/23619559
has answer: http://stackoverflow.com/a/23614364
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/36252886
tagged with: gps
has comment: http://stackoverflow.com/comment/36252612
tagged with: java

http://stackoverflow.com/q/23495742
has comment: http://stackoverflow.com/comment/36030873
tagged with: model-view-controller
tagged with: java
has body: At the moment I have a zoom method in a View class which resizes an image being displayed. Should this logic be in the View or inside the Controller ? Why so ?
type: Question
score: -1
has comment: http://stackoverflow.com/comment/36036949
downvote count: 2
has answer: http://stackoverflow.com/a/23496370
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Should image manipulation logic go in the Controller or the View?
tagged with: swing

http://stackoverflow.com/comment/76881781
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/23580906
type: Comment
has text: for restful api, you may need use `@RestControllerAdvice` instead.

http://stackoverflow.com/q/23481300
type: Question
upvote count: 0
tagged with: jsp
score: -1
has comment: http://stackoverflow.com/comment/48623370
linked to: http://stackoverflow.com/q/20668868
has answer: http://stackoverflow.com/a/23482041
answer count: 1
has title: Spring 3 MVC: Data not display
favorite count: 0
type: UnansweredQuestion
tagged with: spring
downvote count: 1
tagged with: spring-mvc
tagged with: java
has body: I'm dealing with a problem for some days, this is my problem: I have some JSP page &lt;form id="form1" method="post" action="saveNotaAbono"&gt; I have this, for example: &lt;form:input path="factura.documentoBusqueda" id="facturaBusqueda"/&gt; And I put and object "factura" inside the ModelAndView, after that I'm pretty sure to fill the data "factura.documentoBusqueda" before return to the view. Inside the JSP if I put: ${factura.documentoBusqueda} I can SEE the data that I waiting. But If I BIND the data with: &lt;form:input path="factura.documentoBusqueda" id="facturaBusqueda"/&gt; I cannot see it. This is the header of the controller: @RequestMapping(value = "/storedevrecord/detalle/saveNotaDevolucion", method = RequestMethod.POST) public ModelAndView saveNotaDevolucion( @ModelAttribute("factura") FormularioDev form, HttpSession session) { This is the toStirng of factura just before return ModelAndView. I'm just triying to display "drDoc=3930", but I will go in madness FormularioDev [operacion=null, rec=TDevRec [id=TDevRecPK [drCorrelativo=0, drCor=1, drPai=1, drCia=1, drSuc=3, drDoc=3930, drFechaVta=null, drCtgCodigo=null], drCddCli=null, drCelCli=null, drCtaCcr=null, drDevInt=null, drDireccCli=null, drDptoCli=null, drFecCrea=null, drFecInsMerc=null, drFecRec=null, drFecRecMerc=null, drIdcustomer=null, drNombreCli=null, drNotaAbono=null, drNumdocCli=null, drPagoReem=null, drPerApr=null, drPerInsMerc=null, drPerRecMerc=null, drPrima=null, drRecDevApl=null, drSucDev=null, drTelCli=null, drTotalCre=null, drTotalVta=null, drUbicMerc=null, drUsrCrea=null, drValPendLet=null, drValorPend=null, TCatTipGe=null, TDevRecDetas=null, TDevRecFpags=null, TDevRevMovs=null], formasPago=[MetaTPstpag [selected=false, pago=Pstpag [pstpagPK=com.siman.jpa.model.posdbcorp.PstpagPK[ cortpg=1, paitpg=1, ciatpg=1, suctpg=3, codtpg=7 ], nomtpg=CREDISIMAN, abrtpg=jdisji, ctctpg=ola, ctatpg=3]]], detalle=[TDevRecDeta [id=null, drdCandet=0, drdCantArt=null, drdCodVndr=0, drdDivdet=null, drdS…

http://stackoverflow.com/comment/36162735
score: 0
comment on: http://stackoverflow.com/q/23566079
type: QuestionComment
type: Comment
has text: i answered a question exactly like this the other day. see http://stackoverflow.com/q/23429937/217324

http://stackoverflow.com/q/23592300
has comment: http://stackoverflow.com/comment/36211390
has comment: http://stackoverflow.com/comment/36212983
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: eclipse
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23592752
has body: I am programming client/server game. I am using Eclipse. Client is with GUI by Swing. Until now, I ran server once and then I ran client, right click on class --> run as . Everything was ok. Now i need to run client class twice. I tried when server and client were running, just again rightclick on client -> run as. There was two client processes but only one GUI JFrame. I want to test it this way, run server, run client, run client so two clients are running and then on first client I want to click on first button ( It's new game ) and on second client I want to click second button ( it's existing game connection ) but for me it's unable to run two GUI for two client processes. I have only first GUI for first client and then only running process of second client ( NO GUI ) Thank you very much, Marek EDIT : SERVER - main public static void main(String [] argv) throws IOException,ClassNotFoundException { ServerListen server = new ServerListen(PORT); server.acceptConnection(); } SERVER - acceptConnection(); Socket dataSocket = null; ObjectInputStream readBuffer = null; ObjectOutputStream writeBuffer = null; while( true ) { try{ dataSocket = socket.accept(); System.err.println("!!! Connection !!!"); writeBuffer = new ObjectOutputStream(dataSocket.getOutputStream()); writeBuffer.flush(); readBuffer = new ObjectInputStream((dataSocket.getInputStream())); writeBuffer.writeObject("OKlisten"); writeBuffer.flush(); System.err.println("Client connected"); new Handler(dataSocket,readBuffer,writeBuffer).runGame(list_of_games); } catch (IOException e) { System.err.println(e); System.exit(1); } } } This is running only once. CLIENT - main public static void main(String [] argv) throws IOException, ClassNotFoundException { Client client = new Client(PORT); final Basic frame = new Basic(client); frame.setVisible(true); } P.S - you see the println of !!! Connection !!! and when I do right-click --> run as on client second time there is no second !!! Connection !!! message THANK YOU V…
has comment: http://stackoverflow.com/comment/36211681
has comment: http://stackoverflow.com/comment/36212078
has title: Eclipse running GUI client multiple times
score: 0
has comment: http://stackoverflow.com/comment/36211716
answer count: 1
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/23592752
favorite count: 0
has comment: http://stackoverflow.com/comment/36211273
has comment: http://stackoverflow.com/comment/36212438
tagged with: swing
has comment: http://stackoverflow.com/comment/36212253
has comment: http://stackoverflow.com/comment/36212185

http://stackoverflow.com/comment/36136141
comment on: http://stackoverflow.com/a/23551476
type: Comment
has text: depends on what you are validating and the need
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36222731
type: QuestionComment
comment on: http://stackoverflow.com/q/23598147
score: 0
has text: @Mureinik thank you. I forgot adding that.
type: Comment

http://stackoverflow.com/comment/36140233
comment on: http://stackoverflow.com/a/23527244
type: AnswerComment
has text: So in the link referenced: http://stackoverflow.com/questions/802677/adding-the-current-date-with-maven2-filtering it looks like there isn't anything written to the manifest. How would I access ${buildNumber} or one of the properties alternatives shown?
score: 0
type: Comment

http://stackoverflow.com/comment/36149661
type: Comment
comment on: http://stackoverflow.com/q/23559150
score: 0
type: QuestionComment
has text: Yes when I try them alone everything works

http://stackoverflow.com/q/23574529
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36597516
type: Question
has answer: http://stackoverflow.com/a/23704151
has comment: http://stackoverflow.com/comment/36597478
has body: I am using GWT Generators and want to modify a css file with a Generator. The css file contains constants like the following (test/client/App.css): @def LINE_WIDTH 100px; I defined an interface (test/client/DeviceDensity.java): public interface DeviceDensity extends CssResource { String APP_CSS = "test/client/App.css"; } Using a gwt generator I want to modify the constant LINE_WIDTH to be either 75px, 100px, 150px or 200px; depending on the value of a property phone.density which is defined in a module file as: &lt;define-property name="phone.density" values="lpdi,mdpi,hpdi,xhdpi" /&gt; &lt;property-provider name="phone.density"&gt;&lt;![CDATA[ { var ratio = window.devicePixelRatio; if (ratio == 0.75) { return "lpdi"; } else if (ratio == 1) {return "mdpi"; } else if (ratio == 1.5) {return "hpdi"; } return "xhdpi"; } ]]&gt;&lt;/property-provider&gt; How can I get the value of phone.density in a Generator and how can I modify the css constant LINE_WIDTH?
linked to: http://stackoverflow.com/q/9284168
tagged with: javascript
has comment: http://stackoverflow.com/comment/36596792
upvote count: 2
has comment: http://stackoverflow.com/comment/36596878
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: gwt
score: 2
has comment: http://stackoverflow.com/comment/36596361
has title: How can I use a Generator to modify a css file for a CssResource?

http://stackoverflow.com/comment/36127310
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23546869
has text: place xml of listbox_element in your question.
score: 0

http://stackoverflow.com/q/23544039
tagged with: android-bluetooth
answer count: 1
tagged with: byte
tagged with: android
type: AnsweredQuestion
tagged with: java
has body: I am trying to replace byte array occurrence that contains 0x00 to the 0x30. 1) If byte array is in string form. (Do-able) String bytes = "0x7d 0x44 0x14 0x05 0x0e 0x01 0x11 0x04 0x2b 0x0c 0x00 0x45"; if(bytes.contains("0x00")) bytes = bytes.replace("0x00", "0x30"); 2) If byte array is in byte form. (Problematic) byte[] bytes = new byte[] { (byte) 0x7d, (byte) 0x44, (byte)0x2d, (byte)0x05, (byte) 0x0e, (byte)0x01, (byte)0x11, (byte)0x10, (byte)0x2f, (byte) 0x03, (byte)0x00, (byte)0x48}; try { String myString = new String(bytes, "US-ASCII").trim(); if(myString.contains("0x00")) { myString = myString.replace("0x00", "0x30"); bytes = myString.getBytes(); } } catch (UnsupportedEncodingException e) { e.printStackTrace(); } The above method requires to first convert bytes into string form and then replace all the occurences of 0x00 with 0x30 and then convert the resultant string back to bytes. This seems something not upto the mark. However, despite of that the solution didn't worked.
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/23544252
accepted answer: http://stackoverflow.com/a/23544252
has title: Replace byte array occurrence that contains `0x00` to the `0x30`
score: 0

http://stackoverflow.com/comment/35996814
comment on: http://stackoverflow.com/q/23477462
has text: Looks like a typographical error to me. "TABLEdodajanje" should be "TABLE dodajanje".
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36202185
type: QuestionComment
has text: Sounds like the [Burrows-Wheeler Transform](http://marknelson.us/1996/09/01/bwt/).
score: 0
comment on: http://stackoverflow.com/q/23587314
type: Comment

http://stackoverflow.com/q/23552855
answer count: 3
tagged with: junit
favorite count: 0
has body: I have a simple User class that has first name, last name and email I've marked the email like this @Column(name="email",unique=true) @NotNull @Email private String email; I'm running the following junit test but its failing @Test(expected = org.hibernate.exception.ConstraintViolationException.class) public void testUniqueEmail() throws DaoException{ User uri = new User("uri","naor","a@b.com"); userDao.saveUser(uri); //Session session = sessionFactory.getCurrentSession(); //session.save(uri); //session.flush(); User clone = new User("clone","wars","a@b.com"); userDao.saveUser(clone); //session.save(clone); //session.flush(); } I've tried using the userDao or using the session directly so I can flush either way junit fails saying java.lang.AssertionError: Expected exception: org.hibernate.exception.ConstraintViolationException at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:32) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at…
upvote count: 2
has answer: http://stackoverflow.com/a/23683099
tagged with: spring
downvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/40341920
has answer: http://stackoverflow.com/a/40341920
score: 1
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/23683099
has comment: http://stackoverflow.com/comment/36177112
has comment: http://stackoverflow.com/comment/36138995
has title: Unable to pass junit test for uniqueConstraintException with hibernate
has answer: http://stackoverflow.com/a/23553069

http://stackoverflow.com/a/23474738
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/23474574
has comment: http://stackoverflow.com/comment/35992332
has comment: http://stackoverflow.com/comment/95121615
type: Answer
has comment: http://stackoverflow.com/comment/36014223
has comment: http://stackoverflow.com/comment/35991865
downvote count: 1
accepted answer of: http://stackoverflow.com/q/23474574
upvote count: 5
score: 4
has body: The error is because the Collections class only supports a List. public static &lt;T extends Comparable&lt;? super T&gt;&gt; void sort(List&lt;T&gt; list) To sort your collection, you can try something like: Collection collection=new HashSet(); collection.add("zebra"); collection.add("frog"); collection.add("bison"); collection.add("puma"); ArrayList&lt;String&gt; temp = new ArrayList&lt;String&gt;(collection); Collections.sort(temp); collection = new HashSet(temp); Hope this helps.

http://stackoverflow.com/a/23571828
answers question: http://stackoverflow.com/q/23571613
score: 0
type: Answer
has body: You need to use the Geocoder class to get the Address from the String. Have a look at this answer: How can I find the latitude and longitude from address?
accepted answer of: http://stackoverflow.com/q/23571613
type: AcceptedAnswer

http://stackoverflow.com/comment/35979117
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23466267
has text: This is confusing. What's all this substring about? What are you intending to do? What doesn't it (your code above) do? Aren't these names within elements? Like in a table? You appear to be searching the entire document for a piece of text and then cannot understand how you get from there to another piece. This shows you lack some understanding of how the DOM & the page fits together. You don't just search the entire body for a bit of text.
score: 0

http://stackoverflow.com/a/23557764
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/23557656
has body: Scanner doesn't work on a line basis, but token basis. So, after your first nextInt() (for numStr) the scanner's cursor stays at the end of the input line (not start of next line). Therefore, first nextLine() execution right after that results in empty string. Subsequent calls to nextLine() then works correctly.
accepted answer of: http://stackoverflow.com/q/23557656
has comment: http://stackoverflow.com/comment/36147036

http://stackoverflow.com/comment/36229828
comment on: http://stackoverflow.com/q/23602013
has text: yes I put the jar in bin folder of weblogic server
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36101474
has text: If you cannot control the library nor the client code you'll have to stick with something like AspectJ. If you can control the client side use a decorator or create a facade. But you'll have to touch all places in the code where the library is used if you are not able to easily inject a substitute.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23531157

http://stackoverflow.com/q/23597008
linked to: http://stackoverflow.com/q/11731377
score: 0
answer count: 1
tagged with: jsp
has title: HTTP Status 404 - Requested Resource Is Not Available
has comment: http://stackoverflow.com/comment/36220427
has answer: http://stackoverflow.com/a/23597100
has body: I am working on a small EJB application..I have a JSP page with a form where user fill its details and on button click it is being send to a servlet page where the data is to be added through my entity class.But when I click on the button on JSP page, I am getting the following error HTTP Status 404 - type Status report message descriptionThe requested resource () is not available. GlassFish Server Open Source Edition 3.1.2.2 My servlet page Contactservlet.java is public class Contactservlet extends HttpServlet { @EJB private AbstractFacade cfl; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { String name=request.getParameter("name"); String mail=request.getParameter("mail"); String phn=request.getParameter("phn"); String cmnt=request.getParameter("cmnt"); Contact c=new Contact(); c.setCmnt(cmnt); c.setMail(mail); c.setName(name); c.setPhn(phn); cfl.create(c); } catch(Exception ex) { out.println(ex); } } My web.xml file is : <?xml version="1.0" encoding="UTF-8"?> Contactserv Contactservlet Contactserv /Contactserv 30 index.jsp Code for my JSP file is Name Mail Phone Comment
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/11731377
tagged with: java
type: Question
tagged with: ejb
has comment: http://stackoverflow.com/comment/36220499
has comment: http://stackoverflow.com/comment/36220443
tagged with: servlets

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/23501809
tag name: session-timeout
tags question: http://stackoverflow.com/q/23475960

http://stackoverflow.com/q/23521751
has body: So the problem is the following: I'm generating a contentView in code with multiple for and foreach loops and have all of the listeners for buttons generated dynamically. But if I want to make changes in some TextView or something, I start a new Activity, and I want to listen for on onActivityResult inside a listener. I'm wondering if that's even possible and I could really use some help. Here's my code: Button goliButton = new Button(this); goliButton.setText("+"); goliButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(TekmaLive.this,DodajStrel.class); i.putExtra("MINUTA", currTime /1000 + cetrtina * 15 * 60); i.putExtra("TEKMA", tekmaId); i.putExtra("IGRALKA", Integer.parseInt(igralka[0])); i.putExtra("GOL", true); TekmaLive.this.startActivity(i); //Insted of startActivity I would use startActivityForResult... } });
has title: Listening for onActivityResault in View.OnCLickListener
accepted answer: http://stackoverflow.com/a/23522168
tagged with: android-intent
has answer: http://stackoverflow.com/a/23522098
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/23522168
type: Question
answer count: 2
tagged with: button
possible better answer: http://stackoverflow.com/a/23522098
score: 0
tagged with: android

http://stackoverflow.com/a/23548825
type: Answer
has comment: http://stackoverflow.com/comment/36130926
has comment: http://stackoverflow.com/comment/36130453
has comment: http://stackoverflow.com/comment/36130395
has comment: http://stackoverflow.com/comment/36130361
accepted answer of: http://stackoverflow.com/q/23548645
downvote count: 0
has comment: http://stackoverflow.com/comment/36130569
has comment: http://stackoverflow.com/comment/36130638
answers question: http://stackoverflow.com/q/23548645
score: 3
has comment: http://stackoverflow.com/comment/36130249
has comment: http://stackoverflow.com/comment/36130482
has comment: http://stackoverflow.com/comment/36130510
type: AcceptedAnswer
has body: 1) All of the javax constraints include an implicit "or null" in their pass conditions. If you want to catch blanks you need to either add @NotNull, or reconfigure the web binder to bind blank inputs to empty string instead of null. 2) &lt;context:annotation-config /&gt; does not turn on Spring 3 dispatcher servlet auto-config magic. You need to define your own validator bean if you do that. To enable everything to automagically work you need to use &lt;mvc:annotation-driven /&gt;.
upvote count: 3

http://stackoverflow.com/comment/36197335
score: 0
has text: Node != int. Your PriorityQueue will contains <Node> classes, not integers. That's why it says it cannot convert int to node
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23584621

http://stackoverflow.com/comment/36168121
comment on: http://stackoverflow.com/q/23568914
type: Comment
type: QuestionComment
score: 0
has text: It is better to provide the screenshots for its resolution. This info is not good enough.

http://stackoverflow.com/q/23459651
upvote count: 1
has answer: http://stackoverflow.com/a/23467458
type: Question
has body: I have an EntityManager (and a DataSource) created by spring boot and i want to add flyway. but EntityManager must be created after flyway and flyway after the DataSource. do i have to create whole EntityManager manually only to add 'depends-on' or is there some simpler way?
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/35967168
favorite count: 0
has answer: http://stackoverflow.com/a/23708305
has comment: http://stackoverflow.com/comment/36396209
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35964310
tagged with: spring
has title: Spring boot and flyway integration - init order
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/36376223
score: 1
tagged with: java

httpserver
tags question: http://stackoverflow.com/q/23614731
type: Tag
tag name: httpserver

http://stackoverflow.com/comment/36211250
has text: yes i am using eclipse. my Framlayout is complete with all the closing tags included in the actual xml file
comment on: http://stackoverflow.com/a/23575523
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36176072
type: AnswerComment
has text: These comments are helpful, Thanks!
comment on: http://stackoverflow.com/a/23572985
type: Comment
score: 0

http://stackoverflow.com/comment/36096383
has text: You still haven't posted a `SSCCE` that demonstrates your problem.
comment on: http://stackoverflow.com/q/23483369
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/23533561
type: Answer
has body: It depends on where you have applied Transaction declarative rules. I suppose the example provided is from Service layer. If it is so, it would be wise to apply the transaction declarations to the service layer to maintain the integrity.
answers question: http://stackoverflow.com/q/23533230
score: 0

http://stackoverflow.com/q/23484223
tagged with: sql
accepted answer: http://stackoverflow.com/a/23484249
favorite count: 0
has comment: http://stackoverflow.com/comment/36013814
possible better answer: http://stackoverflow.com/a/23484336
has answer: http://stackoverflow.com/a/23484336
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/25454703
tagged with: java
tagged with: hibernate
upvote count: 1
has body: In a spring mvc app using hibernate and jpa, I am getting an unexpected token error when running the following query: @SuppressWarnings("unchecked") public Collection&lt;Description&gt; findDescriptionsByConceptId(BigInteger id) { Query query = this.em.createQuery("SELECT desc FROM Description desc WHERE desc.concept.conceptPk.id =:cid"); query.setParameter("cid", id); return query.getResultList(); } Here is the error message: Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: desc near line 1, column 8 [SELECT desc FROM myapp.Description desc WHERE desc.concept.conceptPk.id =:cid] How can I resolve this error message? I would post more code, but I have no idea what is causing this error.
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36014535
linked to: http://stackoverflow.com/q/22142224
tagged with: jpa
has comment: http://stackoverflow.com/comment/36009777
has title: unexpected token in select statement
has answer: http://stackoverflow.com/a/23484249
score: 0
answer count: 2

http://stackoverflow.com/a/42444472
upvote count: 1
answers question: http://stackoverflow.com/q/23537475
downvote count: 0
type: Answer
score: 1
has body: Update with the Java 8 answer (Java 8 includes a new time library based on JodaTime): ZoneId timeZone = ZoneId.of("US/Eastern"); //ZoneId timeZone = ZoneOffset.UTC; LocalDate march1985 = LocalDate.of(2017, Month.MARCH, 1); long beginningOfMarch = march1985.atStartOfDay(timeZone) .toInstant() .toEpochMilli(); LocalDate april1985 = march1985.plus(1, ChronoUnit.MONTHS); long endOfMarch = april1985.atStartOfDay(timeZone) .toInstant() .toEpochMilli(); Time Zones The "start of the month" is a function of the time zone, so in this case I've shown how to do it in Eastern time. These java.time classes handle DST automatically, so, for example, if you do the year 2017 instead of 1985, you'll find the difference is 743 hours instead of 744, because in 1985 DST took place in April.

http://stackoverflow.com/q/23453095
linked to: http://stackoverflow.com/q/317687
linked to: http://stackoverflow.com/q/5172392
has comment: http://stackoverflow.com/comment/35951446
tagged with: java
has comment: http://stackoverflow.com/comment/35952759
has answer: http://stackoverflow.com/a/23453244
type: Question
has comment: http://stackoverflow.com/comment/35951501
score: 2
downvote count: 0
has title: how to access property file value in the method of a class in spring
has comment: http://stackoverflow.com/comment/35951470
has comment: http://stackoverflow.com/comment/35951522
answer count: 1
favorite count: 0
has body: I am using spring 4.0.3.RELEASE Here is my applicationContext.xml where i am configuring PropertyPlaceHolder <?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" xmlns:util="http://www.springframework.org/schema/util" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> <mvc:annotation-driven/> <context:component-scan base-package="org.graphsearch.tutor.service.impls, org.graphsearch.tutor.dao.impls, org.graphsearch.tutor.configs, org.graphsearch.tutor.utils"/> /WEB-INF/properties/database/jdbc.properties /WEB-INF/properties/alert/message.properties /WEB-INF/properties/email/mail.properties /WEB-INF/properties/logger/logging.properties </beans> In Email client class i am injecting property values like this @Component public class EmailClient { @Value("${tutor.mail.common.note}") private static String NOTE; @Value("${tutor.mail.common.regards}") private static String REGARDS; @Value("${tutor.mail.from}") private static String FROM; @Autowired private MailSender mailSender; @Autowired private Environment env; public void sendRegisterMail(User user){ SimpleMailMess…
upvote count: 2
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/a/32231630
type: Answer
has comment: http://stackoverflow.com/comment/62168019
has comment: http://stackoverflow.com/comment/81552424
has body: Starting from Dropwizard version 0.8.0, you can access environment variables from the configuration yml file. It also supports setting a default value in case the environment variable is not available. See the docs here. Example // put environment variable inside ${} // use :- operator to provide default value dbHost: ${DB_HOST} dbPort: ${DB_PORT:-1234} // dbPort = 1234, if DB_PORT environment variable has no value Important Note: For this to work you need to set up a SubstitutingSourceProvider with an EnvironmentVariableSubstitutor. // Enable variable substitution with environment variables bootstrap.setConfigurationSourceProvider( new SubstitutingSourceProvider( bootstrap.getConfigurationSourceProvider(), new EnvironmentVariableSubstitutor()) ); Update: 15/Nov/2017 as of dropwizard version 1.1.4 As mentioned by @EFreak in the comments section, new EnvironmentVariableSubstitutor() will throw UndefinedEnvironmentVariableException if the environment variable is not defined, unless you set strict mode to false by using new EnvironmentVariableSubstitutor(false) https://github.com/dropwizard/dropwizard/blob/master/dropwizard-configuration/src/main/java/io/dropwizard/configuration/EnvironmentVariableSubstitutor.java
answers question: http://stackoverflow.com/q/23464451
accepted answer of: http://stackoverflow.com/q/23464451
type: AcceptedAnswer
downvote count: 0
score: 52
upvote count: 52

http://stackoverflow.com/a/23617312
type: Answer
accepted answer of: http://stackoverflow.com/q/23608438
answers question: http://stackoverflow.com/q/23608438
score: 4
upvote count: 4
has body: You can find a deployment checklist for Liferay (EE, but applies to CE as well) in the whitepaper section on liferay.com, with this you'll have a quite good starting point. If you use the bundle, note that tuning (and maintaining) tomcat is still up to you. The bundles are provided for convenience, not assuming maintenance on Liferay's behalf. In case you're using Liferay EE (and depending on where in the world you are), you can also get help from Liferay (the company), making sure you'll follow the best practices in deployment. Edit: You might also want to check my series of blog posts with some (naturally not complete) aspects to take care of when setting up and securing Liferay. Chapter 1/4 is here, the other chapters are linked from there.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/23607433
has title: Getting a class not found error on org/jdesktop/swingx/plaf/ComponentAddon
tagged with: swingx
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23648800
accepted answer: http://stackoverflow.com/a/23648800
type: AnsweredQuestion
has body: I added my first swingX component (a JXTable) to my project, hoping to enjoy its extended features. After a lot of searching I found the swingX 1.6.5-1 jar here. The imports work fine and I don't have any compilation errors. However, runtime instantiation of the JXtable throws a "java.lang.NoClassDefFoundError: org/jdesktop/swingx/plaf/ComponentAddon" error. I'm using Eclipse Kepler on a windows 8.1 machine with JDK 1.6.0.38 as the project builder. Your ideas are appreciated. Thanks
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/36175188
comment on: http://stackoverflow.com/q/23572834
score: 1
has text: *fast enough* - for what purpose, in what circumstances? There is no way to know, fast enough for one purpose, in one context, could be completely unsuitable in another.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36199810
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/23586083
has text: Alternatively, if you don't want to combine the statements, you could maintain a reference to the writer throughout your application.

http://stackoverflow.com/comment/36137368
has text: @christopher: the issue is due to failure to compile with Java 1.5 or higher. Autoboxing is not occurring.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23552303

http://stackoverflow.com/comment/36153115
type: Comment
has text: @user3580294 covariance in this case does not apply (my statement about inheritance was incorrect indeed); that applies when you want to pass a String[] parameter to a method which accepts Object[], or when an assignement is executed. String[] is a subtype of Object[] but that does not mean you can cast an Object[] (containing String instances) to String[]
comment on: http://stackoverflow.com/a/23560741
score: 0
type: AnswerComment

http://stackoverflow.com/q/23480911
has answer: http://stackoverflow.com/a/23480963
has answer: http://stackoverflow.com/a/23481028
has comment: http://stackoverflow.com/comment/36003666
possible better answer: http://stackoverflow.com/a/23480984
has comment: http://stackoverflow.com/comment/36003621
has answer: http://stackoverflow.com/a/23480984
has comment: http://stackoverflow.com/comment/36003626
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/23481051
downvote count: 1
accepted answer: http://stackoverflow.com/a/23480963
type: Question
has answer: http://stackoverflow.com/a/23481046
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23480981
answer count: 6
has body: i have a question here: String s1="9578"; String s2="434"; int len1=s1.length(); int len2=s2.length(); System.out.println(len1); System.out.println(len2); String temp; temp=s1; s1=s2; s2=temp; System.out.println("after swaping: "); System.out.println(len1); System.out.println(len2); The print out will be: 4 3 after swaping: 4 3 The values of len1 and len2 are not changing. len1 should point to the s1 and len2 should point to s2. Why they are not changing?
has title: length of string changes and the int which save the length not changing
tagged with: string
favorite count: 0

http://stackoverflow.com/a/27872346
downvote count: 0
has body: I'm using Spring Boot and this error happened because antlr-2.7.7 used by hibernate-core-4.3.7 was overridden by antlr-2.7.2 used by struts-core-1.3.8. If someone has this issue in Spring Tool Suite IDE, this is what I did: open project's pom.xml in Dependency Hierarchy tab select antlr (2.7.2) in Resolved Dependencies list in same tab in Dependency Hierarchy list right-click on antlr-2.7.7 and select "Lock Transitive Dependency Version..." and click OK. save pom.xml run app again
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/66832081
score: 2
answers question: http://stackoverflow.com/q/23493462

http://stackoverflow.com/comment/36149137
has text: Whenver you are creating a String, use new String("content","UTF-8");
type: Comment
comment on: http://stackoverflow.com/q/23559007
score: 0
type: QuestionComment

http://stackoverflow.com/comment/36188613
type: AnswerComment
type: Comment
has text: Actually I don't mean to create different views, I ended up doing it that way because I wanted to keep the meteorites code separate from the scrolling background.
comment on: http://stackoverflow.com/a/23579841
score: 0

http://stackoverflow.com/comment/36193163
type: AnswerComment
comment on: http://stackoverflow.com/a/23582579
type: Comment
has text: no @Patricia Shanahan....I want the "result" Variable as Velocity .............i.e. Velocity result=v1.sum(v2);
score: 0

http://stackoverflow.com/comment/36194731
type: QuestionComment
has text: Please explain what exactly is the problem and what you have tried. As for now, the question is unclear.
score: 0
comment on: http://stackoverflow.com/q/23583348
type: Comment

http://stackoverflow.com/comment/36149681
type: Comment
type: QuestionComment
has text: See if you can manipulate from this http://tips4java.wordpress.com/2009/05/23/text-component-line-number/
comment on: http://stackoverflow.com/q/23559271
score: 0

http://stackoverflow.com/comment/36200982
comment on: http://stackoverflow.com/q/23586653
type: Comment
has text: Try with `@ElementList(name="list")` annotation or use any name.
score: 0
type: QuestionComment

http://stackoverflow.com/q/23491515
tagged with: servlets
type: Question
score: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/23491571
has body: Want to scale a module of uploading files on server. The skeleton of the project got here. Besides of pictures want to create thumbnails of them. The size of thumbnail is selected on the jsp page and sent to servlet. The problem is that I can't get that parameters via request.getParameter("name"). Point me please, where I am fool. JSP (I think that will be enough) Create thumbnail SMALL(max 100x100px) MEDIUM(max 250x250px) BIG(max 620x620px) Servlet public class FileUploadHandler extends HttpServlet { private final String UPLOAD_DIRECTORY = "g:\\point"; private boolean thumbnail; @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String path1 = ""; String path2= ""; String path = ""; if (request.getParameter("thumbnail")!= null & request.getParameter("thumbnail").equals("on")){ thumbnail = true; } //process only if its multipart content if(ServletFileUpload.isMultipartContent(request)){ try { List<FileItem> multiparts = new ServletFileUpload( new DiskFileItemFactory()).parseRequest(request); for(FileItem item : multiparts){ System.out.println(item.getFieldName()); if(!item.isFormField()){ String name = new File(item.getName()).getName(); if (item.getName().length() < 3 || item.getSize() < 3){ request.setAttribute("message", "File is wrong or not assigned."); request.getRequestDispatcher("/index.jsp").forward(request, response); return; } path1 = UPLOAD_DIRECTORY + File.separator + name; item.write( new File(path1)); if (thumbnail){ path2 = UPLOAD_DIRECTORY + File.separator + "thumbnail_" + item.getName(); ResizePicture resPicture = new ResizePicture(path1, path2, ResizePicture.PictureTemplate.SMALL_IMAGE); resPicture.resize(); } path = path1 + "\n" + path2; } } request.setAttribute("message", "File Uploaded Successfully\n" + path); } catch (Exception ex) { request.setAttribute("message", "File Upload Failed due to " + ex); ex.printStackTrace(); } }else{ request.setAttribute("message", "Sor…
tagged with: nullpointerexception
answer count: 3
linked to: http://stackoverflow.com/q/15775412
type: UnansweredQuestion
has title: Can't get parameters via POST request
has answer: http://stackoverflow.com/a/23491734
tagged with: java
has answer: http://stackoverflow.com/a/23491845

http://stackoverflow.com/comment/36019183
has text: I think you should start with basic understanding about how classloading works in java before going further with this. It's essential to understand the concept of classloaders first. After that, you can experiment with writing a custom classloader. Threads are not relevant in hot deployments, classloaders are.
comment on: http://stackoverflow.com/q/23489499
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/36153287
score: 0
type: AnswerComment
has text: And of course, there are places where the lookaround approach will work but the capture approach can't. Anyway, my point was primarily that the performance was (waves hands) enough the same for most purposes.
comment on: http://stackoverflow.com/a/23561058
type: Comment

http://stackoverflow.com/a/23474329
downvote count: 0
has comment: http://stackoverflow.com/comment/35991989
type: Answer
score: 2
answers question: http://stackoverflow.com/q/23474159
upvote count: 2
has comment: http://stackoverflow.com/comment/35990847
has comment: http://stackoverflow.com/comment/35992675
has comment: http://stackoverflow.com/comment/35990643
has comment: http://stackoverflow.com/comment/35990694
has comment: http://stackoverflow.com/comment/35992043
has comment: http://stackoverflow.com/comment/35990814
has body: Try: // count int count = 0; for(int i = 0 ; i &lt; this.cars.length ; ++i) { if(this.cars[i].getCarNum() == CarNum) { ++count; } } // create new array CarsLines[] newArr = new CarLines[this.cars.length - count]; int index = 0; for(int i = 0 ; i &lt; this.cars.length ; ++i) { if(this.cars[i].getCarNum() != CarNum) { newArr[index++] = this.cars[i]; } } // assign this.cars = newArr;
has comment: http://stackoverflow.com/comment/35991088
has comment: http://stackoverflow.com/comment/35992930

http://stackoverflow.com/comment/36145196
comment on: http://stackoverflow.com/q/23542216
score: 1
has text: Tip: Considering altering your week-of-year format to follow the non-ambiguous format defined by the [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601#Week_dates) standard. Like this: `2014-W19`. The [Joda-Time](http://www.joda.org/joda-time/) library could then help you parse and generate such strings using its formatters built into the [ISODateTimeFormat](http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html) factory.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36194556
has text: Java is pass by value, so assigning a new reference to `int[] result` inside the method won't work.
type: AnswerComment
comment on: http://stackoverflow.com/a/23583285
type: Comment
score: 1

http://stackoverflow.com/q/23583989
tagged with: oop
has answer: http://stackoverflow.com/a/23584180
tagged with: clone
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/36198931
has title: Any simple examples for a Rubyist on how to use java clone the right way and the wrong way?
accepted answer: http://stackoverflow.com/a/23584180
has comment: http://stackoverflow.com/comment/36195858
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36196100
has comment: http://stackoverflow.com/comment/36221227
has comment: http://stackoverflow.com/comment/36220145
type: Question
has body: I'm a rubyist and have started learning java. Came across some dialog that says not to use clone() method in java or if I do, make sure to know what I'm doing with it. Java clone method seems to be a popular topic on stackoverflow but most questions have been about advanced topics related to why cloning is not working or shallow or deep copy etc. Don't know what to make of that. What about a few simple examples of how to use clone the right way and the wrong way? It looks like clone is in the interface of an object but has absolutely no implementation. If there is no implementation why do I have to throw the cloneNotsupported exception? Could someone provide a comprehensive list of examples of how clone can be used the right way as well as the wrong way? thank you in advance.
answer count: 1

http://stackoverflow.com/q/23595832
answer count: 1
favorite count: 0
score: -1
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23595997
has comment: http://stackoverflow.com/comment/36219882
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/36218072
type: Question
has body: I seem to be having issues with the search array function in my swing app , I'm not sure as to what is causing this function not to work, it has a try catch in it to say no matching results but that isn't even working. I also have a section where the user could add their own movie to the arrays, this also seems to not be working at all. I think these issues might be related as they both use the array. Can anyone see the problem ? Thanks in advanced! import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.text.*; public class DVD1 extends JFrame implements ActionListener { //construct components JLabel sortPromt= new JLabel("Sort by:"); JComboBox fieldCombo= new JComboBox(); JTextPane textPane = new JTextPane(); //initalize data in arrays String title[]={"Casablanca", "Citizen Kane", "Singin in the rain", "The wizzard of Oz"}; String studio[]={"Wanner Brothers", "RKO Pictures", "MGM", "MGM"}; String year[]={"1942", "1941", "1952", "1939"}; //construct an instance of DVD public DVD1() { super("Classic on DVD"); } //create the menu system public JMenuBar createMenuBar() { ///create instance of menu bar JMenuBar mnuBar =new JMenuBar(); setJMenuBar(mnuBar); //Construct and Populate the File menu JMenu mnuFile = new JMenu("File",true); mnuFile.setMnemonic(KeyEvent.VK_F); mnuFile.setDisplayedMnemonicIndex(0); mnuBar.add(mnuFile); JMenuItem mnuFileExit =new JMenuItem("Exit"); mnuFileExit.setMnemonic(KeyEvent.VK_E); mnuFileExit.setDisplayedMnemonicIndex(1); //mnuBar.add(mnuFileExit); mnuFile.add(mnuFileExit); mnuFileExit.setActionCommand("Exit"); mnuFileExit.addActionListener(this); //construct and pop the edit menu JMenu mnuEdit = new JMenu("Edit",true); mnuEdit.setMnemonic(KeyEvent.VK_E); mnuEdit.setDisplayedMnemonicIndex(0); mnuBar.add(mnuEdit); JMenuItem mnuEditInsert = new JMenuItem("Insert New DVD"); mnuEditInsert.setMnemonic(KeyEvent.VK_I); mnuEditInsert.setDisplayedMnemonicIndex(1); mnuEdit.add(mnuEditInsert); mnuEditInsert.setActionComma…
tagged with: arrays
has title: Search array and insert new item to array not working on java swing app
has answer: http://stackoverflow.com/a/23595997
upvote count: 0

http://stackoverflow.com/comment/36144870
comment on: http://stackoverflow.com/q/23556477
type: Comment
type: QuestionComment
score: 0
has text: I think it's pretty straight forward. Your `currentCard` is of type `Element<Card>`. According to the variable name I would expect it to be of type `Card` instead, if that was true then you would not see that error.

http://stackoverflow.com/comment/36245365
comment on: http://stackoverflow.com/q/23504782
has text: what for you are using networkinterface? post your code
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23609275
downvote count: 0
has body: Your a[i][j] = a[i][j] + 15; line inside the last of your examples takes the a[i][j] value, and increases it by 15. You have nowhere in your code initialized values of your matrix, so all values are 0. When you understand that a[i][j] points to a new variable every time i or j changes, you will understand everything. This means all values in the matrix are 15. I'd make the loop like this: for (int i = 0; i &lt; 4; i++) { System.out.println(); for (int j = 1; j &lt;= 3; j++) { a[i][j-1] = 15 * (j + (i * 3)) System.out.println(a[i][j-1] + " "); } }
has comment: http://stackoverflow.com/comment/36243269
has comment: http://stackoverflow.com/comment/36243085
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/36245521
has comment: http://stackoverflow.com/comment/36243200
has comment: http://stackoverflow.com/comment/36243111
has comment: http://stackoverflow.com/comment/36243078
has comment: http://stackoverflow.com/comment/36243373
answers question: http://stackoverflow.com/q/23609229
has comment: http://stackoverflow.com/comment/36243171
has comment: http://stackoverflow.com/comment/36244016

http://stackoverflow.com/q/23507638
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/36559863
downvote count: 0
score: 4
favorite count: 0
has title: Java - Opencv VideoCapture.read - Exception in thread java.lang.exception : Unknown Exception
tagged with: exception
has comment: http://stackoverflow.com/comment/36560746
has comment: http://stackoverflow.com/comment/36561502
has comment: http://stackoverflow.com/comment/36560983
has comment: http://stackoverflow.com/comment/36561469
answer count: 0
tagged with: video-processing
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36560562
has comment: http://stackoverflow.com/comment/36560709
has body: I have a java program that runs a webcam and capture images with the use of opencv libraries. My camera is working and eventually stops taking frames. It throws an exception. Exception in thread "Thread-11" java.lang.Exception: unknown exception at org.opencv.highgui.VideoCapture.read_0(Native Method) at org.opencv.highgui.VideoCapture.read(VideoCapture.java:341) at projectana.VideoThread.run(VideoThread.java:59) at java.lang.Thread.run(Thread.java:745) Here is my code: (VideoThread.java) import java.awt.image.BufferedImage; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.highgui.VideoCapture; import org.opencv.objdetect.CascadeClassifier; /** * @author DEV-OJT */ public class VideoThread implements Runnable { static private DoVideo vid; static private boolean running; public VideoThread(DoVideo vid) { this.vid = vid; running = true; } protected static void terminate() { running = false; } @Override public void run() { // CascadeClassifier faceDetector = new CascadeClassifier(this.getClass(). // getResource("/resources/haarcascade_frontalface_alt.xml").getPath()); Mat webcam_image = new Mat(); BufferedImage temp; VideoCapture capture = new VideoCapture(0); if (capture.isOpened()) { System.err.println("Sleeping.."); try { Thread.sleep(1000); } catch (InterruptedException ex) { System.err.println("cant sleep"); } System.err.println("camera opened"); while (running) { System.out.println("entered"); try { Thread.sleep(200); } catch (InterruptedException ex) { System.err.println("cant sleep"); } capture.read(webcam_image); if (!webcam_image.empty()) { // MatOfRect faceDetections = new MatOfRect(); // faceDetector.detectMultiScale(webcam_image, faceDetections); // System.out.println("Number of Faces Detected: "+faceDetections.toArray().length); // for(Rect rect : faceDetections.toArray()){ // System.out.println(rect.toStrin…
tagged with: opencv
tagged with: java
has comment: http://stackoverflow.com/comment/36560441
has comment: http://stackoverflow.com/comment/36561181

http://stackoverflow.com/q/23563340
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/327793
has comment: http://stackoverflow.com/comment/44173303
duplicate of: http://stackoverflow.com/q/3821640
tagged with: java
tagged with: tomcat5.5
has body: I would like to start using JEE6 in the next project that I have to work on at my job, but there is also a limitation (sort of): Tomcat 5.5 My question is, what improvements would bring GlassFish to the table (security/speed) vs the existing Tomcat(5.5) or an upgrade to the newer version 7?
linked to: http://stackoverflow.com/q/3821640
type: Question
tagged with: jakarta-ee
score: 20
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/23563455
accepted answer: http://stackoverflow.com/a/23563455
tagged with: glassfish
has title: GlassFish vs tomcat
linked to: http://stackoverflow.com/q/17181292
tagged with: application-server
favorite count: 0
upvote count: 20

http://stackoverflow.com/comment/36028097
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23494223
has text: the ``save()`` first parameter set the attributes, so i guess something like ``this.model.save({attr1: this.model.get("attr1"), attr2: this.model.get("attr2")}, [...]);`` should work.
score: 0

http://stackoverflow.com/a/23498695
has comment: http://stackoverflow.com/comment/36060720
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23492370
answers question: http://stackoverflow.com/q/23492370
type: Answer
score: 1
upvote count: 1
has body: You can't have multiple instances of the same MockUp subclass at the same time (each such mock-up would simply override the previous one when it got instantiated). Instead, add an Invocation parameter to your @Mock method, and then use the information it provides to distinguish between multiple data sets. For example: @Test public void testClientWithVariedDataFromFastScanners() { new MockUp&lt;FastScanner&gt;() { // some data structure for test data @Mock int nextInt(Invocation inv) { int idx = inv.getInvocationIndex(); FastScanner fs = inv.getInvokedInstance(); // Find the next value by using idx or fs as a lookup index // into the data structures: int i = ... return i; } }; client.doSomethingUsingFastScanners(); } Also, if you want to call whatever methods (including static methods) on a mock-up subclass, just make it a named class rather than an anonymous one.
has comment: http://stackoverflow.com/comment/36080233

http://stackoverflow.com/comment/35970047
comment on: http://stackoverflow.com/q/23457470
type: Comment
type: QuestionComment
has text: Relevant: [Computerphile and timezones](http://youtu.be/-5wpm-gesOY). Just be careful with timezones in general; you're going to find a ***lot*** of idiosyncrasies with time in programming.
score: 0

http://stackoverflow.com/comment/36049683
type: Comment
score: 0
comment on: http://stackoverflow.com/q/23505445
type: QuestionComment
has text: You're going to need to clarify a few things before anyone can help you. You've got "httpresponse" in your tags, does this mean you're asking how to save documents to MongoDB on the server side? Or are you asking for how to structure your client so that it sends requests to a server? Further, what do you mean by "save a clicked image?" Do you mean save to the client? Record that an image was clicked on the server? Or upload the image from the client to the server?

http://stackoverflow.com/comment/37677343
comment on: http://stackoverflow.com/q/23461426
has text: If one of the answers below helped, it would be good to mark one of them as correct, so that future readers can benefit too :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23490895
answers question: http://stackoverflow.com/q/23488222
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23488222
has body: So, as a conclusion from the comments above: You'll need to include all the libraries you reference in the jar export process, otherwise they won't be included in the jar file. Since you're running OSX, you'll either need to use the VM argument -XstartOnFirstThread when starting your jar, or you can create a proper OSX application as described here and here

http://stackoverflow.com/comment/36050564
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23504933
has text: @SteveKuo Regardless of the actual current legal requirements for copyrighting code, while IANAL, the (C) representation is so clear and so widely used that I have trouble believing a court would say it wasn't sufficient.
score: 4

http://stackoverflow.com/a/23467222
type: Answer
has body: The Joda-Time library accepts these ISO 8601 strings directly, parsed with a built-in formatter. DateTime dateTime = new DateTime( "2014-03-20T17:59:03+07:00" ); If you really need a java.util.Date object (best to avoid j.u.Date when you can), convert. java.util.Date date = dateTime.toDate();
answers question: http://stackoverflow.com/q/23465919
score: 0

http://stackoverflow.com/q/23487849
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/36040400
has body: I am trying to write a simple TCP client which sends a request to a remote host using Java Socket. The application is synchronous, so it will first transmit and receive and will block until the response is received. I am able to create a Socket connection with the remote host and it seems I am able to send the request without a problem, however I never receive a response from the server, and so it ends up hanging. Also, a look at Wireshark does not seem to indicate any datagram sent or received to/from the specified host IP (I should add that the host is accessed via VPN, which I have verified that I can ping on the command line). It sounds like this might be a network issue, but just in case I thought it would be worth a sanity check to see if there might be a problem with the code: (defn- receive "Given a reader and a socket, create a DataInputStream and process the server response" [reader socket] (let [byte-in (make-array Byte/TYPE b/max-message-size)] (log/receive socket b/max-message-size) (.read reader byte-in) byte-in)) (defn- transmit "Given a writer, a socket and a message, create a DataOutputStream and send request to the server" [writer socket message] (let [byte-out (r/make-request socket message)] (log/begin-transmit socket byte-out) (.write writer byte-out) (log/end-transmit writer) (.flush writer))) (defn send-request "Given a message, create a Socket and process the request" [msg] (with-open [socket (java.net.Socket. (:host-ip msg) (:host-port msg)) writer (DataOutputStream. (.getOutputStream socket)) reader (DataInputStream. (.getInputStream socket))] (println "Initializing TCP request ...\n") (transmit writer socket msg) (receive reader socket))) Here is the output as well from the Transmission -- it hangs during the Receive function. Note that the Host IP and Host Ports indicated were taken from the fields of the Socket object instance: Transmitting request ------------------------------- Message Size : 123 bytes Host IP : /192.168.xxx.xxx Host P…
has comment: http://stackoverflow.com/comment/36045210
type: UnansweredQuestion
tagged with: sockets
tagged with: clojure
has comment: http://stackoverflow.com/comment/36144588
answer count: 0
tagged with: tcp
has title: Clojure TCP client using Java Socket
type: Question

http://stackoverflow.com/comment/36040885
score: 0
type: Comment
type: QuestionComment
has text: @AlekseiBulgak please read my note:"Note: this is not my full query, my full query is working and contains both parameters."
comment on: http://stackoverflow.com/q/23500777

http://stackoverflow.com/q/23532543
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/23532654
tagged with: servlets
has answer: http://stackoverflow.com/a/23532643
type: Question
upvote count: 2
tagged with: html-table
answer count: 2
has title: Java Servlet to generate an an m by n multiplication table based on user input
has body: Beginner question. I have a basic html form with one user input text box labelled "Enter a number" and a submit button labelled "Create a multiplication table". This is the working with a servlet to display an html formatted multiplication table. Everything else is working fine just the formatting is off; I can't seem to get the top row and far left column to number properly. It should look like this: Instead it looks like this (the input number was 7 in this example): My servlet code is: import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/Main") public class Main extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { static final long serialVersionUID = 1L; public Main() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String title = "Multiplication Table"; out.println(" "); out.println(" "); out.println(" " + title + " "); out.println(" "); out.println("<body"); out.println(" "); out.println(" "); try { int op = Integer.parseInt(request.getParameter("op")); if (op > 10) { out.println(" Enter a number between 1 and 10! "); } else if (op < 10) { for (int i = 1; i <= op; i++) { out.println(" "); for (int j = 1; j <= op; j++) { out.println(" " + i * j + " "); } out.println(" "); System.out.println(); } } } catch (NumberFormatException e) { out.println(" Enter numbers only! "); } } }
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
type: UnansweredQuestion
tagged with: multiplication
score: 2

http://stackoverflow.com/comment/36191364
score: 0
comment on: http://stackoverflow.com/q/23579258
type: Comment
type: QuestionComment
has text: does the document get added in the index?

javafx-2
tags question: http://stackoverflow.com/q/23510648
tags question: http://stackoverflow.com/q/23593926
type: Tag
tags question: http://stackoverflow.com/q/23500303
tags question: http://stackoverflow.com/q/23482840
tags question: http://stackoverflow.com/q/23534716
tags question: http://stackoverflow.com/q/23606933
tags question: http://stackoverflow.com/q/23587279
tags question: http://stackoverflow.com/q/23557861
tags question: http://stackoverflow.com/q/23576796
tag name: javafx-2

http://stackoverflow.com/comment/36196068
comment on: http://stackoverflow.com/a/23584092
score: 0
type: Comment
has text: If he wants it to be dynamic, then he can have ajax call to call the servlet and get the value, based on that he can show or hide the table
type: AnswerComment

http://stackoverflow.com/q/23580782
has comment: http://stackoverflow.com/comment/36209348
tagged with: media-player
answer count: 1
tagged with: service
has comment: http://stackoverflow.com/comment/36190161
has comment: http://stackoverflow.com/comment/36193411
type: UnansweredQuestion
has body: So I'm building my MusicPlayer and so I create a service to manage everything. I call ContextWrapper.bindService() and this should call onServiceConnected and onBind right? But this isn't the case for me. Please tell me if I got anything wrong there. Here is my code: This is my method to bind a Activity to the service (MusicUtils.java) . In my Activity it looks like this: MusicUtils.bindToService(this, this); public static final ServiceToken bindToService(final Context context, final ServiceConnection callback) { Activity realActivity = ((Activity)context).getParent(); if (realActivity == null) { realActivity = (Activity)context; } final ContextWrapper contextWrapper = new ContextWrapper(realActivity); contextWrapper.startService(new Intent(contextWrapper, MediaPlayerService.class)); final ServiceBinder binder = new ServiceBinder(callback); Intent intent = new Intent().setClass(contextWrapper, MediaPlayerService.class); if (contextWrapper.bindService(intent, binder, Context.BIND_AUTO_CREATE)) { mConnectionMap.put(contextWrapper, binder); Log.e("MusicUtils","Bound"); return new ServiceToken(contextWrapper); } return null; } This is my ServiceBinder: public static final class ServiceBinder implements ServiceConnection { private final ServiceConnection mCallback; public ServiceBinder(final ServiceConnection callback) { mCallback = callback; } @Override public void onServiceConnected(final ComponentName className, final IBinder service) { mService = IMusicSlideService.Stub.asInterface(service); if (mCallback != null) { mCallback.onServiceConnected(className, service); } } @Override public void onServiceDisconnected(final ComponentName className) { if (mCallback != null) { mCallback.onServiceDisconnected(className); } mService = null; } } And this is my onBind(MediaPlayerService.java) : @Override public IBinder onBind(Intent intent) { Log.e("Service", "onBind"); return mBinder; } If you need something please tell me! Thanks!!!
tagged with: android
has title: Binding Service doesn't call onBind and onServiceConnected
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/23581655
type: Question
has comment: http://stackoverflow.com/comment/36193329

http://stackoverflow.com/a/23573435
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/36257895
answers question: http://stackoverflow.com/q/23568880
has body: It appears from the blog post you linked that you are using Sqoop2. Unfortunately, Sqoop2 doesn't let you set a delimiter yet. When you run the commandline "sqoop", you are running Sqoop1, which supports more options at this point. You can use Sqoop1 in your java code by following the top answer here: How to use Sqoop in Java Program?

http://stackoverflow.com/a/23546749
score: 52
upvote count: 52
type: Answer
has comment: http://stackoverflow.com/comment/36126790
has body: You need to use an InputMultiplexer to forward the events to both InputProcessors. It will look like this: InputProcessor inputProcessorOne = new CustomInputProcessorOne(); InputProcessor inputProcessorTwo = new CustomInputProcessorTwo(); InputMultiplexer inputMultiplexer = new InputMultiplexer(); inputMultiplexer.addProcessor(inputProcessorOne); inputMultiplexer.addProcessor(inputProcessorTwo); Gdx.input.setInputProcessor(inputMultiplexer); The multiplexer works like some kind of switch/hub. It receives the events from LibGDX and then deletegates them to both processors. In case the first processor returns true in his implementation, it means that the event was completely handled and it won't be forwarded to the second processor anymore. So in case you always want both processors to receive the events, you need to return false.
answers question: http://stackoverflow.com/q/23546544
has comment: http://stackoverflow.com/comment/36126441
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23546544
has comment: http://stackoverflow.com/comment/36127095
has comment: http://stackoverflow.com/comment/36126375
has comment: http://stackoverflow.com/comment/36127566
downvote count: 0

http://stackoverflow.com/q/23560787
tagged with: eclipse
tagged with: eclipse-rcp
score: 0
answer count: 1
tagged with: eclipse-plugin
tagged with: eclipse-gef
type: UnansweredQuestion
tagged with: java
has title: Adding a scrollbar to the eclipse GEF PaletteDrawer
type: Question
has body: I'm creating the GEF editor with palette. I added some palette entries to the PaletteDrawer. Now I want to show a scrollbar in the PaletteDrawer, if there are more palette entries in the PaletteDrawer. By default it is showing the small arrows below the PaletteDrawer, instead of that, I want right side scrollbar. I searched for few hours, but I didn't get any help.
has answer: http://stackoverflow.com/a/24370903

http://stackoverflow.com/q/23548173
tagged with: android
has title: Strange scaling in Libgdx
tagged with: 2d
tagged with: java
upvote count: 1
answer count: 1
tagged with: libgdx
type: AnsweredQuestion
has body: I'm trying to stretch a sprite to screen bounds uniformly. First I set the origin of the sprite to the centre of the screen. Since it's an Android device, I have several pages to scroll through to reach the end. In my experience, width*2 covers the extra distance. mSprite.setOrigin(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/2); //these return 1080 and 960 on my device Next I set the sprite's X and Y relative to the origin: mSprite.setPosition(mSprite.getOriginX()-mSprite.getWidth()/2, mSprite.getOriginY()-mSprite.getHeight()/2); //sprite width and height are 1440 and 1280 Now draw it with mSprite.draw(batch) To a naked eye, it doesn't look off. Having measured the distance, there is no difference. Now I apply a scale: mSprite.setScale(1.2f, 1.2f); Result: As you can see, after scaling, the sprite no longer appears to be in the centre. Why? What am I doing wrong? If this is how it's supposed to work, can anyone please recommend a viable workaround to uniformly scale a sprite? Thanks
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/23551072
type: Question
accepted answer: http://stackoverflow.com/a/23551072

http://stackoverflow.com/q/23465002
has body: I want to write a small admin tool that can start, stop, and monitor other Java non-GUI programs that either run continuously or are expected to complete? This tool would run on the same server as the backend programs. I would have a web front end for the administrator to use (probably with Jetty). I would most likely want the backend programs to run as their own separate processes. What if I wanted to communicate with those programs, such as query some detailed status? The backend programs break up their computational work in ticks and between ticks, I could check for commands that come in.
score: 0
has comment: http://stackoverflow.com/comment/35974164
has title: Java program to monitor other Java programs
answer count: 1
has comment: http://stackoverflow.com/comment/35974133
has comment: http://stackoverflow.com/comment/35974223
has comment: http://stackoverflow.com/comment/35974426
has comment: http://stackoverflow.com/comment/35974110
has answer: http://stackoverflow.com/a/23465534
accepted answer: http://stackoverflow.com/a/23465534
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35974263
tagged with: java
has comment: http://stackoverflow.com/comment/35974157
type: Question

nexus
type: Tag
tag name: nexus
tags question: http://stackoverflow.com/q/23498313

http://stackoverflow.com/comment/36044048
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23502549
type: Comment
has text: I just want to store it locally, no special hardware solutions required here. Should I just store the encrypted data in a database?

http://stackoverflow.com/comment/36136870
type: Comment
comment on: http://stackoverflow.com/a/23549817
score: 0
type: AnswerComment
has text: Ok. Makes sense. Does it mean that the monitor.bat and uiautomatorviewer use same set of APIs as `adb shell uiautomator dump` does? I mean we cannot tweak monitor.bat/uiautomatorviewer to get view heirarchy when device is not connected? Sigh! There is only one way, use the view tree.

http://stackoverflow.com/comment/36181562
type: Comment
type: QuestionComment
score: 0
has text: Could you perhaps quote the exact and complete message? So far what you ask makes no sense.
comment on: http://stackoverflow.com/q/23576079

http://stackoverflow.com/q/23560358
has comment: http://stackoverflow.com/comment/36151880
has title: How to close a mocked connection object in easymock
tagged with: easymock
has comment: http://stackoverflow.com/comment/36156670
type: Question
has comment: http://stackoverflow.com/comment/36152533
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36151608
has body: I have used easymock for creating a java.sql.Connection mock object(con). My doubt is Should i use con=null for cleanup or con.close() for cleanup ? In my opinion it should be the first one but still wanted to clear my doubts.
has comment: http://stackoverflow.com/comment/36152007
has answer: http://stackoverflow.com/a/23560650
accepted answer: http://stackoverflow.com/a/23560650
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/36001213
type: QuestionComment
has text: Like I have a lot of rules and corresponding patterns stored in the hashmap within the class, I don't want to load it every time when I create an instance of the class. Or I actually don't since I'm using the "static"?
score: 0
comment on: http://stackoverflow.com/q/23479446
type: Comment

http://stackoverflow.com/q/23567142
accepted answer: http://stackoverflow.com/a/23570058
score: 0
has body: if I save a Message object content to a file using the writeTo method, is it possible recreate the object from that file content? I know a Message has much more information than the one saved with the writeTo method, like the store, the folder and so on.. but I'm not interested to these information. Should I parse the file in order to retrieve the information and set every field in a new Message object? Or is there an easier way?
has title: Restore a Message object from what was saved with the writeTo method
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23570058
tagged with: java
type: Question
tagged with: jakarta-mail
answer count: 1

http://stackoverflow.com/comment/51264511
type: AnswerComment
has text: @Arturo Torres Sánchez: that’s nothing new. There were times when `enum` and `assert` were legal identifiers…
type: Comment
score: 11
comment on: http://stackoverflow.com/a/23525446

http://stackoverflow.com/a/23527164
downvote count: 1
has body: Please use the official Android Studio provided by Google as it will be a lot easier to search for problems/solutions when you're coding with the Android&amp;Java combination than Android&amp;Pascal
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36095170
accepted answer of: http://stackoverflow.com/q/23527063
answers question: http://stackoverflow.com/q/23527063
type: Answer
score: 0
upvote count: 1

http://stackoverflow.com/q/23563402
has title: Simple JApplet crashing at startup
tagged with: drag-and-drop
tagged with: macos
answer count: 0
type: UnansweredQuestion
has body: I was trying to make drag-n-drop from a JApplet to the Finder work, when I realized something very strange. A simple applet with just a JSlider won't run on Mac OsX! Here is the code (you might be done first creating a new one from scratch...): package sliderApplet; public class SliderApplet extends javax.swing.JApplet { @Override public void init() { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(SliderApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(SliderApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(SliderApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(SliderApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } try { java.awt.EventQueue.invokeAndWait(new Runnable() { public void run() { initComponents(); } }); } catch (Exception ex) { ex.printStackTrace(); } } private void initComponents() { jSlider1 = new javax.swing.JSlider(); 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(56, 56, 56) .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(144, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequent…
tagged with: swing
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36156783
has comment: http://stackoverflow.com/comment/36156907
tagged with: applet

http://stackoverflow.com/q/23478130
has title: Queue exception handling
answer count: 0
tagged with: java
tagged with: queue
type: Question
has comment: http://stackoverflow.com/comment/35998120
has comment: http://stackoverflow.com/comment/35998537
score: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/35998130
has body: This my code for a circularly linked array based queue. public class ArrayQueue{ private Object[] theArray; private int currentSize; private int front; private int rear; static final int DEFAULT_CAPACITY=10; public ArrayQueue(){ theArray=new Object[DEFAULT_CAPACITY]; makeEmpty(); } public void makeEmpty(){ currentSize=0; rear=-1; front=0; } public void enqueue(Object x) throws OverFlow{ if (isFull()) throw new OverFlow("Array size exceeded"); else{ rear=increment(rear); theArray[rear]=x; currentSize++; } } public Object dequeue()throws UnderFlow{ if (isEmpty()) throw new UnderFlow("Empty array"); else{ Object returnValue=theArray[front]; theArray[front]=null;//check if this has to be done front=increment(front); currentSize--; return returnValue; } } public object getFront() throws UnderFlow{ if (isEmpty()) throw new UnderFlow("Empty array"); else return theArray[front]; } public boolean isEmpty(){ if (currentSize==0) return true; else return false; } public boolean isFull(){ if (currentSize==theArray.length) return true; else return false; } public int increment(int x){ if (x+1==currentSize) x=0; else x++; return x; } } When I compiled this I get errors as cannot find symbol throw new OverFlow. How to get rid of this issue.
type: UnansweredQuestion

http://stackoverflow.com/q/23531893
accepted answer: http://stackoverflow.com/a/23532198
tagged with: text
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36099182
has answer: http://stackoverflow.com/a/23532198
has answer: http://stackoverflow.com/a/23532005
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23532181
type: Question
has body: I have a program and am trying to test to see if a file (info.txt) is created and if it is, open the contents into a JTextArea as the program starts up. How would i go about doing this? ive already figured out how to search and see if the file exists, just can not get it to open into the textArea on startup import javax.swing.*; // need it import java.awt.*; //need it also import java.awt.datatransfer.*; import java.util.*; import java.io.*; import java.awt.event.*; //keeps track of events import javax.swing.border.*; // not necessary / already imported ^^ import javax.swing.*; import java.awt.*; import java.awt.datatransfer.*; import java.util.*; import java.io.*; import java.awt.event.*; import javax.swing.border.*; public class finalA extends JFrame implements ActionListener{ private final int WIDTH = 750; private final int HEIGHT = 400; static String theText; private String text; //creates components private JTextArea textArea; private JButton SaveB; private JScrollPane scroll; public finalA(){ setTitle("Super fancy text editor"); setSize(WIDTH,HEIGHT); Container pane = getContentPane(); //Creates button SaveB = new JButton("Save &amp; Exit"); textArea = new JTextArea(); scroll = new JScrollPane(textArea); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); //adds event handler for exit button SaveB.addActionListener(this); //sets pane to null pane.setLayout(null); //location of button and TA (750,400) textArea.setLocation(10,100); SaveB.setLocation(150,320); //set size of TA and Button textArea.setSize(730,200); SaveB.setSize(100,30); //add items to pane pane.add(textArea); pane.add(SaveB); scroll.setBounds(10,100,730,200); scroll.setVisible(true); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); setDefaultCloseOperation(EXIT_ON_CLOSE); }//ends constructor public void openFile()throws Exception{ File f = new File("info.txt"); if(f.exists()){ FileReader reader = null; try{ reader = new FileReader("info.txt"); textArea.re…
tagged with: jtextarea
has title: open file into JTextArea on startup
has comment: http://stackoverflow.com/comment/36099175
tagged with: file-io
possible better answer: http://stackoverflow.com/a/23532005
answer count: 3
upvote count: 1
tagged with: user-interface
favorite count: 0

http://stackoverflow.com/comment/36077658
type: QuestionComment
comment on: http://stackoverflow.com/q/23520892
score: 0
has text: `getWindow()` is a method of Activity class. `http://developer.android.com/reference/android/app/Activity.html#getWindow() .
type: Comment

http://stackoverflow.com/comment/35967375
type: QuestionComment
has text: I am not sure what you are trying to achieve. Could you add some example of input, expected output, and explanation why such output would be expected?
comment on: http://stackoverflow.com/q/23461489
type: Comment
score: 2

http://stackoverflow.com/comment/109997970
comment on: http://stackoverflow.com/a/23517340
has text: For RHEL "/opt/libreoffice6.3" works. 6.3 is installed libreoffice version
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/23502556
has answer: http://stackoverflow.com/a/23504316
downvote count: 0
tagged with: button
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/36046450
type: Question
accepted answer: http://stackoverflow.com/a/23504316
has title: SWT image button on Mac not working
tagged with: swt
upvote count: 1
answer count: 1
tagged with: java
tagged with: eclipse
tagged with: image
has body: So i have a button w/ an image using SWT. The code for it's design is here: final Button button = new Button(shell, SWT.FLAT | SWT.CENTER); button.setBounds(54, 121, 109, 33); button.setImage(SWTResourceManager.getImage(LoginDialog.class, "SignInButton.png")); I want to Have the image take up the whole button with no borders like i can in windows. Does anyone know how to accomplish this? here is an image of what it looks like atm: Essentially i just want the white parts gone.
type: AnsweredQuestion

http://stackoverflow.com/a/23596384
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/23596368
answers question: http://stackoverflow.com/q/23596368
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: I see at least one error: distanceFromOrigin -- you should not create a new Point object, for if you do, the distance will always be 0. Use the x and y you have. Also, your class has no constructor, and you need at least two, one a default constructor that sets x and y to 0, a constructor that takes 2 ints to allow setting of x and y. Also, your x and y variables should be private, and the class should provide getter methods for both, and possibly setter methods, if these are desired. As for your main method, put whatever you want or are required to put in there. I suspect that you'll want to create a few of your Point objects and test their methods. As an aside, if this were my code, I'd rename the class to something else so as to not have a name clash with java.awt.Point.

http://stackoverflow.com/a/23553293
type: Answer
upvote count: 1
score: 1
has body: Here's the text from the official docs: replace - Replace the contents of the if the collection with the collectionName exists. merge - Merge the new result with the existing result if the output collection already exists. If an existing document has the same key as the new result, overwrite that existing document. reduce - Merge the new result with the existing result if the output collection already exists. If an existing document has the same key as the new result, apply the reduce function to both the new and the existing documents and overwrite the existing document with the result. reference: http://docs.mongodb.org/manual/reference/command/mapReduce/#output-to-a-collection-with-an-action
downvote count: 0
answers question: http://stackoverflow.com/q/23521029

http://stackoverflow.com/a/23538785
downvote count: 0
score: 1
has body: I think that is better change the project name of the library and make a copy of this. This allow you to modify the files and dont mix it with your actual project.
answers question: http://stackoverflow.com/q/23467251
upvote count: 1
type: Answer

http://stackoverflow.com/q/23465099
has body: I find two ways to get all GarbageCollectorMXBeans from JVM, First ManagementFactory.getGarbageCollectorMXBeans() which described from JAVA API Second List&lt;GarbageCollectorMXBean&gt; beans = new ArrayList&lt;GarbageCollectorMXBean&gt;(); MBeanServer server = ManagementFactory.getPlatformMBeanServer(); ObjectName gcName = new ObjectName(ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + ",*"); for (ObjectName name : server.queryNames(gcName, null)) { GarbageCollectorMXBean gc = ManagementFactory.newPlatformMXBeanProxy(server, name.getCanonicalName(), GarbageCollectorMXBean.class); beans.add(gc); } I want to know any differences between these two?
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/23544987
answer count: 1
has title: About how to get GarbageCollectorMXBean
type: UnansweredQuestion
tagged with: jmx

http://stackoverflow.com/q/23587279
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/36208494
has comment: http://stackoverflow.com/comment/36209181
tagged with: google-maps
has body: I'm creating a Java Application in which i have to - Show google maps - be able to draw a rectangle at a certain point on the map, and it should move along with the map upon dragging the map. - Another rectangle to be drawn, which will move just like the first rectangle upon dragging the map, BUT will have joystick controls in java application to be able to move independant of map as well. So far: - Showing google maps in a webview using JavaFx. UPDATE - Able to add an overlay rectangle to the map using from here: How to make an overlay on top of JavaFX 2 webview? But the map is no longer taking touches (or has ceased to be draggable).
downvote count: 0
has title: Drawing on top of WebView JavaFx
favorite count: 0
has comment: http://stackoverflow.com/comment/36208146
linked to: http://stackoverflow.com/q/10894903
tagged with: javafx-2
answer count: 0
duplicate of: http://stackoverflow.com/q/10894903
type: UnansweredQuestion

http://stackoverflow.com/q/23609711
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/23610309
has answer: http://stackoverflow.com/a/23610080
has comment: http://stackoverflow.com/comment/36250133
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/23609791
has body: I've got an app which is running on JBoss. The server's RAM is too low (about 2gb), so I need to decrease Java heap size. Also I've got 2 versions of Java : system version(1.4.2) and 1.7.0 for JBoss 7 only. So, how can I decrease Java heap size properly?
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/23609791
accepted answer: http://stackoverflow.com/a/23610080
tagged with: java
has title: How to decrease java heap size?
tagged with: jboss
tagged with: memory
type: Question
has comment: http://stackoverflow.com/comment/36257668

http://stackoverflow.com/q/23505107
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/36048845
linked to: http://stackoverflow.com/q/19554431
type: Question
has comment: http://stackoverflow.com/comment/36048909
has title: Binary search of LinkedList
has comment: http://stackoverflow.com/comment/36048665
has comment: http://stackoverflow.com/comment/36048844
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has body: I am trying to do a binary search on nodes in a sorted linked list. Not only am I struggling with the algorithm I can't seen to get the while loop to fire. I am using the compareto() method to find the item in the list. The rest of the program works fine except this method. Any help or suggestions would be greatly appreciated. public void contNameBinSearch() { int beg = 0; int mid = (contTable.size()/2); int end = contTable.size()-1; int binFind; String findBin; boolean findBinName = false; System.out.print("Please enter contributor's last name for binary search: \r\n"); Scanner sn = new Scanner(System.in); findBin = sn.nextLine(); System.out.println(); findBinName = contTable.get(mid).getLastName().equalsIgnoreCase(findBin); binFind = findBin.compareTo(contTable.get(mid).getLastName()); System.out.print("initial beg " + beg + "\r\n"); System.out.print("initial mid " + mid + "\r\n"); System.out.print("initial end " + end + "\r\n"); while (findBinName = false) { System.out.print("Test Point 1"); if (binFind == 0) { System.out.print("Test Point 2"); findBinName = true; break; } else if (binFind &gt; 0) { System.out.print("Test Point 3"); mid = end -(end - mid)/2; end = mid + mid/2; } else if (binFind &lt; 0) { System.out.print("Test Point 4"); end = mid; mid = mid/2; } } if (findBinName) { System.out.print(contTable.get(mid).getData() + "\r\n"); } else { System.out.print("User " + findBin + " does not exist please try again.\r\n\r\n"); contNameBinSearch(); } System.out.println(); }
favorite count: 0
has comment: http://stackoverflow.com/comment/36048714
has comment: http://stackoverflow.com/comment/36048911
has comment: http://stackoverflow.com/comment/36048875
has answer: http://stackoverflow.com/a/23505142
has comment: http://stackoverflow.com/comment/36048950
has comment: http://stackoverflow.com/comment/36048878

http://stackoverflow.com/a/23474219
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/23474052
answers question: http://stackoverflow.com/q/23474052
upvote count: 3
type: AcceptedAnswer
has body: Your interpolate function isn't correct. If you use 1.0 as value it just adds red and green. Try this code: public String interpolate(float t) { int r = Math.round(ar * (1 - t) + br * t); int g = Math.round(ag * (1 - t) + bg * t); int b = Math.round(ab * (1 - t) + bb * t); return String.format("#%02x%02x%02x", r, g, b); }
type: Answer

http://stackoverflow.com/a/23466999
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: You need to put the package name (or names in a comma-separated list if multiple) in the packages attribute of the Configuration element of your log4j2.xml. E.g. &lt;Configuration status="trace" packages="com.mycomp.myproject.appenders"&gt; ... See the Log4j2 Configuration Documentation for more information.
answers question: http://stackoverflow.com/q/23464221
accepted answer of: http://stackoverflow.com/q/23464221
has comment: http://stackoverflow.com/comment/36884374
upvote count: 1

http://stackoverflow.com/comment/36067862
has text: The exception only occures when using german language.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23510990
score: 0

google-sheets
tags question: http://stackoverflow.com/q/23565275
type: Tag
tag name: google-sheets

http://stackoverflow.com/comment/35997796
score: 0
comment on: http://stackoverflow.com/q/23477930
has text: What version of JDK do you use? Try following class declaration : MinTreeHeap<X, T extends DefaultComparator<X>>
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36336698
type: QuestionComment
type: Comment
has text: @PeterMmm Thanks for the help, i've added all the objects from Node class, i have another question i'm having an object of Node type how to convert it into Socket object. ` `
comment on: http://stackoverflow.com/q/23600959
score: 0

http://stackoverflow.com/q/23501121
has body: Hi I need to connect a Java Application on a Linux server to Progress database. I use to connect an odbc configured on Linux server, it work correctly, from command line can I make querys. The problem is when I try to get the connection connect from Java Application I'm getting a null pointer. Java version 1.6.0_45 OS: CentOS release 6.5 ODBC Progress: working OK This is the body of a method to test de Insert into Progress try { String bd = "dbToWrite"; String url = "jdbc:odbc:" + bd; String user = "root"; String psw = "root"; Connection con; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection(url, user, psw); PreparedStatement ps1 = con.prepareStatement("INSERT INTO PUB.\"mo-chsu\" " + "(\"c-expt\", \"c-tisu\", \"i-cheq\"," + " \"c-a#o\", nombre, apellido, " + "\"n-tarj\", \"c-cat\", varios, " + "\"s-sac\", embar, otros, " + "jubi, \"ti-doc\", \"num-doc\", " + "\"co-min\", \"n-liq\", fonavi," + " club,\"n-mes\", anioe)" + "VALUES (9999,999,9999.99," + "2014,'XXXX','XXXX'," + "999,5,888.88," + "1.0,2.0,3.0," + "4.44,9,99999999," + "1,9,3000," + "30.0,9,2014)"); ps1.execute(); con.close(); } catch (Exception e) { e.printStackTrace(); } The Exception is, doesn't say too much: java.lang.NullPointerException at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436) at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at Main.conexionProgress(Main.java:23) at Main.main(Main.java:10) I think the problem is a library on Java... but I can find witch one. Please give me a hand! Thanks Sorry my english :)
type: UnansweredQuestion
tagged with: progress-db
answer count: 0
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36043119
type: Question
tagged with: java
tagged with: odbc
has comment: http://stackoverflow.com/comment/36067658
tagged with: openedge
upvote count: 1
has title: Linux+Java+Odbc+Progres
has comment: http://stackoverflow.com/comment/36041722
favorite count: 0
tagged with: linux

http://stackoverflow.com/a/23540372
upvote count: 2
has body: In Java everything is a pointer, but depending on what a variable is pointing, the behavior can change. int[] Arr = new int[]{1,2,3,4,5,6,7,8,9,10}; int[] is an array of a primitive type (not of a class type), and it does not contains any information about its 'string representation', so when you want to print the variable as you have done (System.out.println(Arr);), what is printed out it is simply a string representation suitable for any kind of object, like its hashcode (it is not garbage). While with: ArrayList&lt;Integer&gt; myList = new ArrayList&lt;Integer&gt;(); you are creating an object of the (generic) class ArrayList&lt;>: this overrides the method (function in C) toString() that specify how print gracefully the content of the ArrayList itself (the method is really basic: it simply iterate over all the items contained, create a string and print it). When you call System.out.println(myList); the method toString() (which return a String) is implicitly called, and therefore the string created by the method will be printed, as you have shown.
answers question: http://stackoverflow.com/q/23540204
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/comment/84825125
has text: What if someone asks about convention for floats? ;)
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23558058

http://stackoverflow.com/comment/36120299
type: Comment
comment on: http://stackoverflow.com/q/23543482
type: QuestionComment
has text: Yes. I have. I am guessing the error is because, the import of all the xmls happens before the load of property files.
score: 0

http://stackoverflow.com/q/23605577
answer count: 2
has comment: http://stackoverflow.com/comment/36237006
tagged with: jscrollpane
has answer: http://stackoverflow.com/a/23605802
linked to: http://stackoverflow.com/q/16785982
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/36245084
accepted answer: http://stackoverflow.com/a/23605802
tagged with: abstracttablemodel
has comment: http://stackoverflow.com/comment/36237064
tagged with: swing
possible better answer: http://stackoverflow.com/a/23606035
has body: as many other persons, I want my JTable being actualized after adding rows. Here you can see the fragments of my code. ArrayList&lt;&gt; foundR = new ArrayList&lt;FoundResult&gt;(); JTable resultsTable = new JTable(); AbstractTableModel resultsModel = new FoundResultTableModel(foundR);//&lt;- model which contains FoundResults as rows JScrollPane scroller = new JScrollPane(); resultsTable.setModel(resultsModel); scroller.add(resultsTable); this.add(scroller, BorderLayout.CENTER);// a big panel which contains scroller and other components Then a add ActionListener that uses following method: foundR.clear(); foundR.addAll( ...);//&lt;- so the foundR ArrayList is refreshed resultsModel.fireTableDataChanged(); resultsModel.fireTableStructureChanged(); rowCount of results Model shows that the model is refreshed (the number of rows differes from the previeous variant), but the table still doesn't appear. I tried to insert resultsTable.repaint() but it also dind't help. UDP(NB) I discovered, that the problem is concentrated in this scroller Panel. If I add the table directly to the big panel it is refreshed (but I cannot see all the results, since I cannot scroll down) this.add(resultsTable, BorderLayout.CENTER); If I use a scroller, nothing is shown. Do you know why?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23606035
tagged with: java
linked to: http://stackoverflow.com/q/3179136
has title: How to refresh a JTable on JScrollPane
type: Question

http://stackoverflow.com/comment/36012847
has text: give a name attribute to this
score: 0
comment on: http://stackoverflow.com/q/23485916
type: QuestionComment
type: Comment

http://stackoverflow.com/q/23607293
answer count: 2
tagged with: random
downvote count: 0
has body: I want to generate a 128 bit random key in java. I am using the following: byte[] byteBucket = new byte[bytelength]; randomizer.nextBytes(byteBucket); Will my byte array length be 16 as (16*8=128) or 128?
favorite count: 0
has answer: http://stackoverflow.com/a/23607372
has answer: http://stackoverflow.com/a/23607410
type: UnansweredQuestion
score: 7
tagged with: java
upvote count: 7
type: Question
has title: Generating 128 bit random key in java
linked to: http://stackoverflow.com/q/325443

http://stackoverflow.com/a/23463977
type: Answer
has comment: http://stackoverflow.com/comment/35973584
accepted answer of: http://stackoverflow.com/q/23463394
has comment: http://stackoverflow.com/comment/35972428
answers question: http://stackoverflow.com/q/23463394
has comment: http://stackoverflow.com/comment/35973008
has comment: http://stackoverflow.com/comment/35972796
has comment: http://stackoverflow.com/comment/35973503
has comment: http://stackoverflow.com/comment/35972659
has comment: http://stackoverflow.com/comment/35972604
score: 0
type: AcceptedAnswer
has body: Without blurting out the answer, the handle you return when inserting should be the handle of the node you just inserted, not a new one. That way it will get updated when you do the swaps. The node's handle also needs to be initialized to something more relevant than zero. That will get you to the next error ... which is either: A bug in the test program, in the block labelled 'Decrease keys unnecessarily and verify that they still work.'. The wrong 'key' value is being tested. The key in the node has been changed to key+1, so that is what should be tested, not key. The same applies to the block labelled 'Change keys randomly, and check that the values remain attached to handles', only this time the new key is random, not key+1. or that the meaning of decreaseKey() eludes me.

http://stackoverflow.com/q/23487181
answer count: 4
has answer: http://stackoverflow.com/a/23550731
favorite count: 0
tagged with: java-2d
has answer: http://stackoverflow.com/a/23582115
accepted answer: http://stackoverflow.com/a/23582115
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
has title: What's the order of the pixel components returned by Raster.getPixels()?
has answer: http://stackoverflow.com/a/23550053
type: Question
has body: I've written image processing code that copies the pixel data into integer array like this: void processImage(BufferedImage source) { WritableRaster raster = source.getRaster(); int numBands = raster.getNumBands(); int height = raster.getHeight(); int width = raster.getWidth(); int[] pixelRow = new int[width * numBands]; for (int i = 0; i &lt; height; i++) { raster.getPixels(raster.getMinX(), raster.getMinY() + i, width, 1, pixelRow); // do some processing } // create a new image return newImage; } The code works with the images I've tested so far. The pixelRow array seems to always receive the pixel components in the order Red, Green and Blue for images with 3 bands (no alpha channel) and in the order Red, Green, Blue and Alpha for those with 4 bands (with alpha channel). However, I cannot find any description that states this. Is it guaranteed that I will always get the pixel components in that order? Is there any specification that describes this?
tagged with: awt
upvote count: 3
has answer: http://stackoverflow.com/a/23580074
possible better answer: http://stackoverflow.com/a/23550053

http://stackoverflow.com/q/23493828
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36026725
has comment: http://stackoverflow.com/comment/36026904
accepted answer: http://stackoverflow.com/a/23493964
tagged with: http://stackoverflow.com/tag/json
has body: So I'm testing my json validator and have json in my propertis file like: jsonSource = {"kind": "Listing\""} I get it with spring @Value("${jsonSource}") run it through: try { gson.fromJson(jsonSource, Object.class); return true; } catch(com.google.gson.JsonSyntaxException ex) { return false; } or try { new JsonParser().parse(jsonSource); return true; } catch (JsonParseException e) { return false; } And it dosen't validate. I tried jsonSource.replaceAll("\\", "\\\\"); on that string but no use. I get my escaped json from http://www.reddit.com/r/IAmA.json (self_text) part I guess I'm missing something really basic here, like what's happening under the hood with strings or how one should use json.
score: 0
answer count: 1
has title: Json with \" not validating
has answer: http://stackoverflow.com/a/23493964
has comment: http://stackoverflow.com/comment/36026664
tagged with: java

http://stackoverflow.com/comment/36103250
has text: I think the indexing takes care of the name, location, date. So at this moment I can not index the files. The .sh and .sql are scripts. I need to be able to extract the content (with Tika indeed). Thanks for the answer. At least I have a direction where I can search, parsers. If anyone have another idea, I would be pleased to hear (read) it.
type: AnswerComment
comment on: http://stackoverflow.com/a/23532146
score: 0
type: Comment

undertow
type: Tag
tags question: http://stackoverflow.com/q/23540360
tag name: undertow

http://stackoverflow.com/comment/137894647
type: Comment
comment on: http://stackoverflow.com/a/78191908
has text: yes solved my problem. Sorry for confusion. I just wanted to say While I'm implementing Hilt my module occurs this error so I searched and found this solution.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23579589
has comment: http://stackoverflow.com/comment/36187924
downvote count: 0
favorite count: 0
has body: hello everyone well i have this code : import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class ItemIdReader { public int id; public ItemIdReader(){ try { BufferedReader br = new BufferedReader(new FileReader("itemList.txt")); String line = br.readLine(); while (true) { if (line == null) break; String[] split = line.split(" - ", 2); String itemName = split[1]; id= Integer.parseInt(split[0]); } } catch (IOException i ) { i.printStackTrace(); } } public int getId() { return id; } } and when i try to output the id , i get this error : Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "1" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at ItemIdReader.&lt;init&gt;(ItemIdReader.java:19) at Launcher$UI.lambda$new$0(Launcher.java:25) at Launcher$UI$$Lambda$1/455659002.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744) at java.awt.EventQueue.access$400(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:697) at java.awt.EventQueue$3.run(EventQueue.java:691) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) at java.awt.EventQueue.dispatchEvent(EventQueue.java:714) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) here is the .txt file im reading from : 1 - …
has comment: http://stackoverflow.com/comment/36187707
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/23579711
has answer: http://stackoverflow.com/a/23579642
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/23579702
has answer: http://stackoverflow.com/a/23579755
has comment: http://stackoverflow.com/comment/36187904
has title: Weird NumberFormatException that shouldn't come up?
tagged with: numberformatexception

http://stackoverflow.com/q/23477511
possible better answer: http://stackoverflow.com/a/23486417
tagged with: java
tagged with: code-duplication
tagged with: sonarqube
has comment: http://stackoverflow.com/comment/36095137
accepted answer: http://stackoverflow.com/a/23487452
type: Question
has title: Can SonarQube code duplication detector be parameterized to stop on method boundaries?
answer count: 2
has body: I’m using SonarQube on my Java projects, and want to eliminate code duplications from our code as far as possible. My problem is that SonarQube’s code duplication detection doesn’t take into account method boundaries. It lists identical parts of files as duplications, and it often happens that a duplication starts in the middle of a method and ends in the middle of another. These can hardly be refactored. Here is an example. Click on file MavenArtifactRepository.java in the upper right list box, and take a look at the 4th duplication block in the lower part of the page. Is there any way to parameterize the code duplication detector plug-in to show duplications, which are syntactically coherent?
downvote count: 0
favorite count: 0
score: 8
upvote count: 8
has answer: http://stackoverflow.com/a/23486417
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23487452

http://stackoverflow.com/comment/36177363
type: QuestionComment
comment on: http://stackoverflow.com/q/23573937
score: 1
has text: Why are you splitting the line every time? Could you not split the line on comma, put that in a single array, then use that array for the scope of that `while`?
type: Comment

http://stackoverflow.com/a/23465051
has body: You are calling the method setVisible() which is an instance method that means it is attached to an object instance. so, you can't invoke it without a reference to any object which has it. In order to call it, you need to make it as a static method. so, it would become a member of a class, not to any object. You can add the static modifier to the method setVisible(). But,this can't be done since it is an inherited method from Component API. so, you need to make the call from a non-static context. When you want the functionality to be across multiple classes, you can make it as an utility method and move it to a seperate class having all the utility methods
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23464970

http://stackoverflow.com/comment/36184191
has text: I pass it from the main screen that has the listView
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23577482
type: QuestionComment

http://stackoverflow.com/comment/36121893
has text: why the downvote? throw should be written like this. pls the downvoter explain your logic
type: Comment
score: 0
comment on: http://stackoverflow.com/a/23544442
type: AnswerComment

http://stackoverflow.com/a/38843869
upvote count: 0
has comment: http://stackoverflow.com/comment/65781362
has comment: http://stackoverflow.com/comment/65544952
score: -3
type: Answer
answers question: http://stackoverflow.com/q/23596230
downvote count: 3
has comment: http://stackoverflow.com/comment/65542677
has body: I had this problem. If you are on Netbeans right click the page then select fix imports, then change import java.sql.date; to import java.util.date; if you have auto save on. Below is the complete program to print current date and to format the current date import java.util.Date; //don't use java.sql.date here it is a subset of java //util.date and if you don't import this it won't work. import java.text.SimpleDateFormat; import java.text.DateFormat; public class DateFormat { public static void main(String[] args) { //java.util.Date jdate = new java.util.Date(); String Billdate = "dd-MM-yyyy"; DateFormat sdf = new SimpleDateFormat(Billdate); Date dt=new Date(); //current date System.out.println("The current date is="+dt); System.out.println("The Formatted current date is="+sdf.format(dt.getTime())); } }

http://stackoverflow.com/comment/36135669
score: 1
type: Comment
type: QuestionComment
has text: Hard to say, I don't know the requirements. Using AES/GCM (*correctly*) instead of single DES in ECB mode would go a long way of securing the use of the symmetric cipher. Not relying on strings for places where they have no reason to be would help too. And if strings are required, use well defined (character) encodings schemes. Hire somebody who understands Java (e.g. knowing that arrays are automatically initialized to zero would be helpful).
comment on: http://stackoverflow.com/q/23529733

http://stackoverflow.com/comment/36270689
has text: I do not able to understand ? "with an update of a record in the list you can notify the object itself. " Do u want to say I have to notify Whole List? No any other way.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23559312
type: Comment

http://stackoverflow.com/q/23458005
has title: Enum version of singleton: How to implement and its advantages?
downvote count: 1
tagged with: enums
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35960767
has body: Public class Singleton{ //private static ref private Static Singleton uniqueInstance; //private constructor private Singleton(){ } public static Singleton getInstance{ if(uniqueInstance==null){ uniqueInstance= new Singleton(); } return uniqueInstance; } } The above class is my current implementation of the traditional use of singleton. How would I implement the enum version of singleton on this class? And what are its benefits over the traditional? I.e. how does this work: public enum Foo { INSTANCE; }
favorite count: 0
score: 0
tagged with: singleton
answer count: 1
has answer: http://stackoverflow.com/a/23458182
has comment: http://stackoverflow.com/comment/35960868
linked to: http://stackoverflow.com/q/70689
duplicate of: http://stackoverflow.com/q/70689
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/25622473
score: 0
type: Answer
has body: Do you have other deployments in the Tomcat? There is very well chance that once you restart tomcat, some other project gets deployed first which uses the file in the lib folder. Try deploying it in a fresh tomcat installation or remove other folders from the webapps folder in Tomcat.
answers question: http://stackoverflow.com/q/23472471

http://stackoverflow.com/a/23473590
answers question: http://stackoverflow.com/q/23473567
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/35989590
score: 2
has comment: http://stackoverflow.com/comment/35989283
type: AcceptedAnswer
downvote count: 0
has body: It is deleting the maps keys elements because both are same objects. You have to make a shallow copy to make both lists separate Creating a shallow copy is pretty easy though: List&lt;Integer&gt; newList = new ArrayList&lt;Integer&gt;(oldList); Here is the code: public class Foo { public static void main(String[] args) { ArrayList&lt;Integer&gt; array = new ArrayList&lt;Integer&gt;(); HashMap&lt;String, ArrayList&lt;Integer&gt;&gt; foo = new HashMap&lt;String, ArrayList&lt;Integer&gt;&gt;(); for (int i = 0; i &lt; 20; i++) array.add(i); ArrayList&lt;Integer&gt; newList = new ArrayList&lt;Integer&gt;(array); foo.put("1", newList); array.clear(); System.out.println(foo.get("1").size()); } }
has comment: http://stackoverflow.com/comment/35989394
has comment: http://stackoverflow.com/comment/35989438
has comment: http://stackoverflow.com/comment/35989320
accepted answer of: http://stackoverflow.com/q/23473567

http://stackoverflow.com/comment/36414775
type: AnswerComment
has text: @r.bhardwaj you said "values needed in the app during runtime (I can't store them in the device for some privacy issues)" which seems unusual. Normally it's sending data from the device to the server that causes privacy concerns.
comment on: http://stackoverflow.com/a/23521871
type: Comment
score: 0

http://stackoverflow.com/a/23534766
answers question: http://stackoverflow.com/q/23534496
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23534496
type: Answer
has body: Already answered by Evan Knowles and user3322273, but here is another implementation: byte[] digits = b.getBytes(); for (byte digit : digits) { System.out.println (digit &amp; 0xf); } What it does is that it masks the (ASCII) value of the digit. For example: '0' = 48 | In ASCII and Unicode - Decimal = 110000 | In binary Hence, if we obtain the last four bits, then we can get the number. So 48 &amp; 0xf (i.e. 15) = 11 0000 &amp; 00 1111 = 0000 = 0 | Ultimately in decimal.
score: 0

http://stackoverflow.com/comment/36031603
type: Comment
type: QuestionComment
has text: What errors are you getting and at what lines?
comment on: http://stackoverflow.com/q/23496289
score: 1

http://stackoverflow.com/comment/35963083
has text: It's supposed to block. Until you enter something on the console. What did you expect it to do instead?
type: Comment
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/23459205

series
tag name: series
type: Tag
tags question: http://stackoverflow.com/q/23483579

http://stackoverflow.com/a/23509924
has body: Just call windows.open() if you want to do a normal page call. No need to use ajax for that.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23485338
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23485338

http://stackoverflow.com/q/23476431
favorite count: 0
accepted answer: http://stackoverflow.com/a/37054861
tagged with: android
has comment: http://stackoverflow.com/comment/36746643
has body: I want to create an Android FTP Server App with the Apache Mina FTP Server. The problem is the following: I can't import these libraries. I can select between two errors: If the libs aren't selected in "Java Build Path"/"Order and Export", I get this error: "Could not find class 'org.apache.ftpserver.FtpServerFactory' (...)" (Logcat) If they are selected, I get this error: Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/apache/ftpserver/ftplet/FtpException; (Problems / Errors) What's wrong?? My imported libraries: ftplet-api-1.0.6.jar ftpserver-core-1.0.6.jar mina-core-2.0.4.jar (or 2.0.7) slf4j-api-1.5.2.jar (or 1.6.6) slf4j-simple-1.5.3.jar
tagged with: ftp
has comment: http://stackoverflow.com/comment/37653599
upvote count: 1
linked to: http://stackoverflow.com/q/7870265
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/37632449
score: 1
has comment: http://stackoverflow.com/comment/37654059
tagged with: java
has answer: http://stackoverflow.com/a/37054861
has comment: http://stackoverflow.com/comment/40405182
type: Question
tagged with: apache-mina
answer count: 1
has title: Java Apache Mina FTP Server import libraries
downvote count: 0
has comment: http://stackoverflow.com/comment/37665272

http://stackoverflow.com/q/23494928
answer count: 4
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10006165
upvote count: 2
has comment: http://stackoverflow.com/comment/36028962
tagged with: java
has body: I would like to create a method that can cut the word variable and put each letter in the array tab[]. Here is my effort. public class Mot { private String mot; private String tab[]; //getter et setter public String getMot() { return mot; } public void setMot(String mot) { this.mot = mot; } //constructeur plein public Mot(String mot, String[] tab) { this.mot = mot; this.tab = tab; } //constructeur vide public Mot(){ } //methodes public void affichage(){ System.out.println(this.tab[1]); } //placage de chaque lettre dans un tableau public void tableau(){ this.tab = this.mot.split(mot); } }
tagged with: methods
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/23495088
has comment: http://stackoverflow.com/comment/36028790
has comment: http://stackoverflow.com/comment/36029020
linked to: http://stackoverflow.com/q/3413586
has answer: http://stackoverflow.com/a/23495092
has answer: http://stackoverflow.com/a/23495105
tagged with: class
has comment: http://stackoverflow.com/comment/36029080
duplicate of: http://stackoverflow.com/q/3413586
has comment: http://stackoverflow.com/comment/36028876
has comment: http://stackoverflow.com/comment/36028917
possible better answer: http://stackoverflow.com/a/23495092
downvote count: 0
accepted answer: http://stackoverflow.com/a/23495088
has answer: http://stackoverflow.com/a/23495336
favorite count: 0
has title: java split each letter and put it in table
has comment: http://stackoverflow.com/comment/36029005

http://stackoverflow.com/comment/36080025
score: 0
has text: to test your method, use a similar printing messages as described here - http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html - to understand what happens in each iteration. Start with 2 arrays with 3 elements defined in each and add some printing in your code to understand it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23521967

opengl
tags question: http://stackoverflow.com/q/23574702
tags question: http://stackoverflow.com/q/23580245
tags question: http://stackoverflow.com/q/23547772
tags question: http://stackoverflow.com/q/23463149
tags question: http://stackoverflow.com/q/23462125
tags question: http://stackoverflow.com/q/23546265
tags question: http://stackoverflow.com/q/23584908
tags question: http://stackoverflow.com/q/23463583
type: Tag
tags question: http://stackoverflow.com/q/23479265
tags question: http://stackoverflow.com/q/23515501
tags question: http://stackoverflow.com/q/23592436
tags question: http://stackoverflow.com/q/23486563
tag name: opengl
tags question: http://stackoverflow.com/q/23586181
tags question: http://stackoverflow.com/q/23542776

http://stackoverflow.com/comment/36141790
has text: `I've tried debugging it,` then you should be creating a [SSCCE]() to help you debug so you can isolate where the problem is. If you are getting a ClassCastException it sounds like you are trying to add an invalid Object to the combo box. See edit for a simple SSCCE that works.
type: Comment
comment on: http://stackoverflow.com/a/23551266
type: AnswerComment
score: 0

http://stackoverflow.com/a/23571379
score: -3
type: Answer
downvote count: 3
has body: Try import java.util.ArrayList; import java.util.List; public class ArrayGap { public static void main(String[] args) { int[] arr = {1, 3, 7, 2, -4}; int high, low; List&lt;Integer&gt; out = new ArrayList&lt;Integer&gt;(); for(int i=0; i&lt;arr.length - 1; i++){ high = arr[i]; if(arr[i] &lt; arr[i+1]){ for(int j=arr[i]; j&lt;arr[i+1]; j++){ out.add(j); } } else { for(int j=arr[i]; j&gt;=arr[i+1]; j--){ out.add(j); } } } System.out.println(out); } }
upvote count: 0
answers question: http://stackoverflow.com/q/23570936

http://stackoverflow.com/comment/36067341
type: AnswerComment
comment on: http://stackoverflow.com/a/23515534
type: Comment
has text: This is probably the right answer, which teaches you in the future to use the catch clause to actually notify yourself or the user that an error occurred or if you're gonna go with the print stack trace approach, you should look at it :)
score: 0

http://stackoverflow.com/comment/36063973
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23511729
score: 0
has text: You didn't state the problem you're facing. Does it compile? What is the output? and and and ...

http://stackoverflow.com/comment/36225445
type: Comment
has text: I add this into my source code but it causes error. I found out the solution though -- on the loop: for (int colData = 0; colData < data[0].length; rowData++) It's supposed to be colData++ rather than rowData++. Nonetheless, I thank you for taking time out and read my codes. And I appreciate your help ^_^
type: AnswerComment
comment on: http://stackoverflow.com/a/23599183
score: 0

http://stackoverflow.com/q/23535434
has comment: http://stackoverflow.com/comment/103103051
answer count: 3
linked to: http://stackoverflow.com/q/16167646
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/36105472
has comment: http://stackoverflow.com/comment/36105672
favorite count: 0
has comment: http://stackoverflow.com/comment/36105576
has answer: http://stackoverflow.com/a/23535648
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/23535623
has comment: http://stackoverflow.com/comment/36106706
type: Question
linked to: http://stackoverflow.com/q/9518092
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/23535622
has title: How to get windows user name in java
has body: I write a web application I have to do signin in that using the windows username.. I tried to get username using system.get property() but its giving the username of server windows name only.but I want to the username of client system..can any one help me?
linked to: http://stackoverflow.com/q/19990038

http://stackoverflow.com/comment/36087619
type: Comment
has text: yes than in your case that's exactly what it means. You need to check the version of svn executable.
type: AnswerComment
comment on: http://stackoverflow.com/a/23525614
score: 0

http://stackoverflow.com/comment/36089155
comment on: http://stackoverflow.com/a/23526171
type: AnswerComment
type: Comment
score: 0
has text: @Braj Good catch. But your comment about appending `C:` is not entirely right. What if Windows's directories are installed on another drive (represented by a different char) or on a remote location ?

http://stackoverflow.com/q/23456089
tagged with: security
downvote count: 0
tagged with: deployment
favorite count: 0
tagged with: jnlp
type: UnansweredQuestion
score: 3
answer count: 0
upvote count: 3
tagged with: java
tagged with: javafx
has title: Java Security Setting block JavaFX 8 jnlp from running
type: Question
has comment: http://stackoverflow.com/comment/35978912
has body: I developed a javaFX 8 application and i need to view it with Java Web Start. Java security settings keeps blocking my application even after Self signing it. is there a way to resolve this issue?

http://stackoverflow.com/comment/35993088
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23475586
has text: This is full code. I can post the text of the Error if it will help.
type: Comment

http://stackoverflow.com/comment/36090700
has text: it's version 8 update 5, i'm sure
comment on: http://stackoverflow.com/q/23527295
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/23528528
has body: I'm making a snake game. My problem is that the "Game Over" graphic shows up at the beginning of the game, but I want it to only show when the snake runs into itself. This is what I have so far: import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.image.BufferStrategy; import java.util.*; import javax.swing.JFrame; public class Snake extends JFrame implements KeyListener { private static final long serialVersionUID = 1L; private boolean gameOver; private int windowWidth = 800; private int windowHeight = 600; private LinkedList&lt;Point&gt; snake; private int dx; private int dy; private Random generator = new Random(); private Point food; private int points; public static void main(String[] args) { new Snake(); } public Snake() { this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(windowWidth, windowHeight); this.setResizable(false); this.setLocation(100, 100); this.setVisible(true); this.createBufferStrategy(2); this.addKeyListener(this); initGame(); while(true) { long start = System.currentTimeMillis(); gameLoop(); while(System.currentTimeMillis()-start &lt; 40) { //do nothing } } } private void initGame() { // game variables initialized here snake = new LinkedList&lt;Point&gt;(); snake.addFirst(new Point(20,20)); growSnake(5); dx = 0; dy = 0; food = new Point(10,10); points = 0; } private void gameLoop() { // game logic // move the snake moveSnake(dx, dy); // check if snake has eaten food if(snake.getFirst().equals(food)) { moveFood(); growSnake(3); points++; } // go through walls if (snake.getFirst().x &lt;= 0){ snake.getFirst().x = windowWidth/10;//go left, wrap right } else if (snake.getFirst().x &gt;= windowWidth/10){ snake.getFirst().x = 0;//go right, wrap left } else if (snake.getFirst().y &lt;= 0){ snake.getFirst().y = windowHeight/10;//go top, wrap bottom } else if (snake.getFirst().y &gt;= windowHeight/10){ snake.getFirst().y = 0;//go bottom, wrap top } // check if the snake has hit itself for…
possible better answer: http://stackoverflow.com/a/23528630
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23528630
tagged with: java
has comment: http://stackoverflow.com/comment/36092878
has comment: http://stackoverflow.com/comment/36092952
has answer: http://stackoverflow.com/a/23528783
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/23528833
has title: Snake game end game screen
has comment: http://stackoverflow.com/comment/36092985
downvote count: 4
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/36093023
score: -4
accepted answer: http://stackoverflow.com/a/23528833
tagged with: swing

http://stackoverflow.com/a/23561544
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/23557393
answers question: http://stackoverflow.com/q/23557393
has body: I could do it using spring profiles. I just added "master" profile to all listener beans and activated master profile only on master server. Few nice articles to begin with using profiles http://diarmuidmoloney.wordpress.com/2012/04/07/spring-environments/ http://maciejwalkowiak.pl/blog/2012/03/27/spring-3-1-profiles-and-tomcat-configuration/
type: AcceptedAnswer

http://stackoverflow.com/q/23475263
has comment: http://stackoverflow.com/comment/35992469
accepted answer: http://stackoverflow.com/a/23475374
has comment: http://stackoverflow.com/comment/35992343
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23475374
has comment: http://stackoverflow.com/comment/35992655
has comment: http://stackoverflow.com/comment/35992435
has comment: http://stackoverflow.com/comment/35992361
type: Question
has comment: http://stackoverflow.com/comment/35992496
tagged with: java
has comment: http://stackoverflow.com/comment/35992419
tagged with: replace
has comment: http://stackoverflow.com/comment/35992409
has title: Replace method without using .replace()
score: 0
answer count: 1
has body: Ok, so I am required to create a program that will replace a word in a string according to a string, and also given a replacement. (In this case replace UK with United Kingdom) Below is my code, but it doesn't work import java.util.*; public class replace { public static void main(String[]args){ replace("The UK should not be written as uk", "UK", "United Kingdom"); } static void replace(String input, String seed, String replacement){ String s = ""; ArrayList&lt;String&gt; bla = new ArrayList&lt;String&gt;(); for(int i = 0; i &lt; input.length();i++){ if(input.charAt(i) != ' '){ s = s + input.charAt(i); } if(input.charAt(i) == ' ' || i+1 == input.length()){ bla.add(s); s = ""; } } String out = ""; for(int i = 0; i &lt; bla.size(); i++){ if(bla.get(i) == seed){ bla.set(i, replacement); } } for(int i = 0; i &lt; bla.size(); i++){ out = out + bla.get(i)+ " "; } System.out.println(out); } } For some reason it's not replacing my variable with the replacement String out = ""; for(int i = 0; i &lt; bla.size(); i++){ if(bla.get(i) == seed){ bla.set(i, replacement); } } Any ideas why this might be? Thanks in advance

http://stackoverflow.com/a/23516482
type: AcceptedAnswer
upvote count: 3
has body: The classesDirectory is the directory where the compiler plugin stores compiled java classes the resources-plugin copies resources to be included in the file created by the jar-plugin. You have changed it to your java source code directory in the jar-plugin configuration. Therefore, I imagine that your jar now only contains java source files. Is this what you want, or are you just trying to include a second source of resource files? If the latter, then just adding: src/main/resources src/main/second-resources should accomplish what you want without adding any configuration to the jar plugin. Note that the first .. section is needed if you still have stuff you want in the default src/main/resources location.
type: Answer
accepted answer of: http://stackoverflow.com/q/23515701
has comment: http://stackoverflow.com/comment/36069806
has comment: http://stackoverflow.com/comment/36070596
has comment: http://stackoverflow.com/comment/36069644
answers question: http://stackoverflow.com/q/23515701
score: 3
downvote count: 0

http://stackoverflow.com/comment/77500584
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23559789
has text: Sure! I was talking about multiple java servers and multiple mysql. With only one java server, I think you can get massive performance improvements using hibernate cache with little problem.

http://stackoverflow.com/q/23532358
has answer: http://stackoverflow.com/a/23532517
has comment: http://stackoverflow.com/comment/36099938
has comment: http://stackoverflow.com/comment/36100044
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
score: -3
tagged with: ping
has title: send a ping to multiple ip addresses at the same time
tagged with: text
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/36100015
type: Question
has body: i did a code wish send a ping to multiple ip adresses and get the value of time from each ping request and then print write the result in a from of a matrix in a text file....anyway my problem is that after i finished my code i figure out that i should send the ping to these adresses at the same time or in my code i did send it consecutively to the adresses.i really i hope if someone helps me with it... code: import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Formatter; import java.util.List; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; public class Pinggg extends JFrame{ private boolean stop = false; // start or stop the ping public Pinggg(){ Container cp = this.getContentPane(); cp.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 10)); JButton btnStart=new JButton("demarrer le test"); cp.add(btnStart); btnStart.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { stop = false; try { final Formatter x = new Formatter("C:/Users/VAIO/workspace/tcc/gastoon/kkk.txt"); PrintWriter writer; writer = new PrintWriter("C:Users/VAIO/workspace/tcc/gastoon/kkk.txt"); for (int m = 0; m &lt; 10; m++) { if (stop) break; // check if STOP button has been pushed, // which changes the stop flag to true DocumentBuilderFactory BuilderFactory=DocumentBuilderFactory.newInstance(); DocumentBuilder db=Builde…
upvote count: 0

http://stackoverflow.com/a/23597093
has comment: http://stackoverflow.com/comment/36220547
type: Answer
answers question: http://stackoverflow.com/q/23597062
has comment: http://stackoverflow.com/comment/36220752
downvote count: 1
has body: Carriage return is usually the '\n' character (on Unix like systems), or "\r\n" on Windows. m = temp.charAt(i); //gets the next char, sets temp equal to it if(m == '\n') { // Carriage return detected ... }
upvote count: 0
score: -1

ssl-certificate
tags question: http://stackoverflow.com/q/23477866
type: Tag
tags question: http://stackoverflow.com/q/23474373
tags question: http://stackoverflow.com/q/23465472
tags question: http://stackoverflow.com/q/23527426
tags question: http://stackoverflow.com/q/23527615
tag name: ssl-certificate

http://stackoverflow.com/comment/36810316
score: 0
comment on: http://stackoverflow.com/a/23562587
type: AnswerComment
has text: hello sir i know i marked it as solved, but still there is an issue. i am not getting the values from servlet in my jsp. not even a simple string. Is there any problem with my gson() method or with ther url pattern in ajax call ?
type: Comment

http://stackoverflow.com/comment/36059106
type: Comment
comment on: http://stackoverflow.com/a/23509458
score: 0
type: AnswerComment
has text: Thank you for response but still database is not restoring here is my code

http://stackoverflow.com/a/23554846
upvote count: 8
type: Answer
score: 8
accepted answer of: http://stackoverflow.com/q/23554801
answers question: http://stackoverflow.com/q/23554801
has comment: http://stackoverflow.com/comment/85962047
has body: Look at the Calendar object: Calendar Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR_OF_DAY, 10); DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); System.out.println(dateFormat.format(cal.getTime()));
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/140134296

http://stackoverflow.com/a/23533296
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: There is no compulsary rules for using design pattern. But it makes life simpler if applied to correct usecase. You can definitely use Builder pattern in your case. Here are some guidelines: First decide how many of the attributes of the Log object are mandatory (say x number), and how many of the attributes are optional (y). 2.Remove the y attributes from log object and put that in your Builder class through "add" methods. If x&lt;6 , remove the x attributes from log class, put them in the constructor of your Builder class. Now you can get rid of the Log class itself. Else, if x>=6, keep them in the log class and pass the class in the constructor of your Builder class. This is also called "Transfer Object". you can change the deciding number 6 as you wish. Usually a constructor containing 6 or more paramters becomes less readable.
answers question: http://stackoverflow.com/q/23533146

http://stackoverflow.com/a/23511163
score: 5
has body: I'm not sure you really understood how enums are intended to be used. Here is the way you should have implement Command2: public enum Command2 implements CommandI { FORWARD("qwersadd", new String[] { "fd", "forward" }), PENUP("vcvzxcvz", new String[] { "pu", "penup" }); private final String description; private final String[] aliases; private Command2(String description, String[] aliases) { this.description = description; this.aliases = aliases; } @Override public boolean isCommand(String command) { for (String s : aliases) { if (s.equals(command)) { return true; } } return false; } @Override public void execute(Drawer drawer, Creature creature) { throw new UnsupportedOperationException("Not supported yet."); } @Override public String getDescription() { return description; } } The time you want to implement the execute body of FORWARD for example, simply (over-)override it as follow: FORWARD("qwersadd", new String[] { "fd", "forward" }) { @Override public void execute(Drawer drawer, Creature creature) { // specific execute body for FORWARD } }
upvote count: 5
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/23511047
answers question: http://stackoverflow.com/q/23511047

http://stackoverflow.com/comment/36096352
type: Comment
has text: Consider too what happens for `Insert(0, ...)`. After correcting that, consider what is easier: inserting & removing in front or at the end of the list?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/23530284

http://stackoverflow.com/comment/36111092
has text: @MrPigeon anyway i noted that you do not need the while loop for your `matesStore.addProduct(name);` `while (!matesStore.isAProduct(name)){}` loop can be removed as previously you already verify that it should be correct before allowing the user to break out of the loop.
type: Comment
comment on: http://stackoverflow.com/a/23536484
score: 0
type: AnswerComment

http://stackoverflow.com/comment/103229693
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23517431
has text: @Arash - It does indeed do this, but you need to remember that that the transaction is started before the test method is invoked and then rolled back following the completion of the test method.

http://stackoverflow.com/q/23461585
has title: Show files in online directory in ListView - Android
score: 0
tagged with: java
answer count: 1
has body: So basically I want to be able to view all the files that are stored in an online directory I have, mostly just images and textFiles. Is that possible at all? And is the best way to accomplish that to use ListView? Thanks.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23594225
type: Question
tagged with: android-listview
tagged with: android

http://stackoverflow.com/comment/36209812
has text: I am running it as an HTML page
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/23591492

http://stackoverflow.com/comment/36023148
comment on: http://stackoverflow.com/q/23491689
type: Comment
has text: @M.Deinum. Ya tnx for ur quick reply Deinum. Initially I tried with maven dependencies,but the same error occur in that also so, i try as separate project.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/36135995
score: 0
type: Comment
has text: Yup, that worked! Thanks! I actually still have to write something up to find the average now, but that should be easier.
type: AnswerComment
comment on: http://stackoverflow.com/a/23551049

http://stackoverflow.com/q/23515701
tagged with: maven-jar-plugin
has comment: http://stackoverflow.com/comment/36068829
has body: Currently I have a sample maven project with the following build part where I specify a second resource location directory: ... src/main/second-resources org.apache.maven.plugins maven-compiler-plugin 3.1 ${maven.compiler.source} ${maven.compiler.target} org.apache.maven.plugins maven-jar-plugin 2.4 ${artifactId} ${jarBuildPath} I can get my jar packaged with this configuration having my classes and resource files just in right place and with no issue. But when adding the property to my maven-jar-plugin configuration snippet with value src/main/java: org.apache.maven.plugins maven-jar-plugin 2.4 src/main/java ${artifactId} ${jarBuildPath} then when packaging my archive, hell, my resource files are no longer there. From maven official documentation for the classesDirectory property, it says that Directory containing the classes and resource files that should be packaged into the JAR. and that makes all sense for me and it is quite fair that my resource files get disappeared since maven assumes that no file has the right to be packaged unless it is under src/main/java. But my big thought was when specifying my resource files location (with one of the options below), Maven will be aware of the files location even if I had specified the entry. With top level entry src/main/second-resources or via the maven-resource-plugin org.apache.maven.plugins maven-resources-plugin 2.6 src/main/second-resources I can tell you that I'm quite familiar with maven but this issue seemed weird for me: Is it not recommended to have in maven-jar-plugin when you have a some custom resource directory? Can anyone kindly drop some light on this? BR.
tagged with: maven-resources-plugin
has comment: http://stackoverflow.com/comment/36067918
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36068475
tagged with: maven
accepted answer: http://stackoverflow.com/a/23516482
type: Question
has comment: http://stackoverflow.com/comment/36067526
has comment: http://stackoverflow.com/comment/36069403
has comment: http://stackoverflow.com/comment/36067985
tagged with: java
upvote count: 4
answer count: 1
downvote count: 0
tagged with: jar
has comment: http://stackoverflow.com/comment/36067936
score: 4
has answer: http://stackoverflow.com/a/23516482
favorite count: 0
has title: Best practice for packaging resource files and classes with Maven

http://stackoverflow.com/comment/36030829
type: Comment
comment on: http://stackoverflow.com/q/23495415
score: 0
has text: In my thoughts, lambdas could by their nature be executed in an own thread. I get, a lambda is executed as it is called. It is in any case using the same thread as the caller (without using Executor)?!
type: QuestionComment

http://stackoverflow.com/q/23457361
has body: I am trying to remove list element but get this exception Exception in thread "main" java.lang.UnsupportedOperationException at java.util.AbstractList.remove(AbstractList.java:161) at apollo.exercises.ch08_collections.Ex4_RemoveOdd.removeOdd(Ex4_RemoveOdd.java:25) at apollo.exercises.ch08_collections.Ex4_RemoveOdd.main(Ex4_RemoveOdd.java:15) here is my code public class Ex4_RemoveOdd { removeOdd(Arrays.asList(1,2,3,5,8,13,21)); removeOdd(Arrays.asList(7,34,2,3,4,62,3)); public static void removeOdd(List&lt;Integer&gt; x){ for(int i=0;i&lt;=x.size()-1;i++){ if (x.get(i)%2==0){ System.out.println(x.get(i)); }else{ x.remove(i); } } } } So I make new class just to try to remove the element public static void main(String[] args) { List&lt;Integer&gt; x = Arrays.asList(1,2,3,5,8,13,21); x.remove(1); } but still have error Exception in thread "main" java.lang.UnsupportedOperationException at java.util.AbstractList.remove(AbstractList.java:161) at apollo.exercises.ch08_collections.Ex4_RemoveOdd.main(Ex4_RemoveOdd.java:14) FYI:I try to solve this excercise https://github.com/thecodepath/intro_java_exercises/blob/master/src/apollo/exercises/ch08_collections/Ex4_RemoveOdd.java
favorite count: 0
type: AnsweredQuestion
tagged with: list
has answer: http://stackoverflow.com/a/23457371
accepted answer: http://stackoverflow.com/a/23457371
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/35959452
answer count: 1
has title: how to remove list element
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/36315264
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23472263
type: Comment
has text: thanx man @udo ....problem has been solved.Now mouse is working in my laptop .is their any option by which i can implement mouse click in android

http://stackoverflow.com/comment/36184427
type: QuestionComment
comment on: http://stackoverflow.com/q/23577678
has text: Please add the code associated with the error.
score: 0
type: Comment

http://stackoverflow.com/a/23549546
has comment: http://stackoverflow.com/comment/36131665
upvote count: 1
accepted answer of: http://stackoverflow.com/q/23549433
has comment: http://stackoverflow.com/comment/36131567
answers question: http://stackoverflow.com/q/23549433
has body: Can you try this one List&lt;LinkedList&lt;MyEntry&lt;k,v&gt;&gt;&gt; items = new ArrayList&lt;LinkedList&lt;MyEntry&lt;k,v&gt;&gt;&gt;(); or try this one if ArrayList can accept any type of List List&lt;List&lt;MyEntry&lt;k,v&gt;&gt;&gt; items = new ArrayList&lt;List&lt;MyEntry&lt;k,v&gt;&gt;&gt;(); Always code to interface rather than concrete class.
has comment: http://stackoverflow.com/comment/36131699
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36131623
type: Answer
has comment: http://stackoverflow.com/comment/36131827
has comment: http://stackoverflow.com/comment/36131936
has comment: http://stackoverflow.com/comment/36131795
score: 1

http://stackoverflow.com/a/23461377
score: 1
has body: With a return statement, you're giving back data. How the program (or user) deals with that data isn't quite the concern of the method. With a format operation, you're representing data. So long as you have the right data, you can represent it in any way you like. So, strictly speaking, it's not possible to do that, not unless you wanted to use String.format in such a manner that another answer has suggested.
upvote count: 1
has comment: http://stackoverflow.com/comment/35967266
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/23461344

http://stackoverflow.com/comment/36102063
type: Comment
has text: How jdk's `java.util.concurrent.Semaphore` to control thread?
comment on: http://stackoverflow.com/q/23533406
score: 0
type: QuestionComment

http://stackoverflow.com/a/23453605
type: Answer
score: 3
downvote count: 0
has body: What is the purpose of Encapsulation? Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding. Encapsulation doesn't restrict to call public setter/getter. You have to use other techniques such as encryption, security tokens etc. to check for any changes made in the middle of the stream. Please have a look at below links Signing Java Objects for Secure Transfer Secure Coding Guidelines for Java SE
answers question: http://stackoverflow.com/q/23453579
upvote count: 3

http://stackoverflow.com/a/23461644
score: 0
type: AcceptedAnswer
type: Answer
has body: As said Myanimal in his answer's comments, I think you have imported different classes of Fragment. this android.app.Fragment and this android.support.v4.app.Fragment The ActionBar.TabListener you implemented or the TabStrip you are using are not the causes of the issue. When an A class extends/implements a B class, the A class (the subclass) has the "same" properties as B (the base class): public class A extends B ==> B b = new A(); is possible. So try to remove all your imports and do CtrlShiftO to organize the imports. Then chose the same class of Fragments. The issue may disappear.
has comment: http://stackoverflow.com/comment/35980826
accepted answer of: http://stackoverflow.com/q/23460076
answers question: http://stackoverflow.com/q/23460076

self-signed
type: Tag
tags question: http://stackoverflow.com/q/23504819
tag name: self-signed

http://stackoverflow.com/a/23651598
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23516980
has body: Simply do in this way using overriiden paintComponent() method of JPanel JPanel panel = new JPanel() { @Override public void paintComponent(Graphics g) { // don't forget to call it super.paintComponent(g); // set color g.setColor(Color.BLACK); // fill a rect that cover whole panel with specified color g.fillRect(0, 0, getWidth(), getHeight()); } }; Note: There is no need of Thread and BufferedImage in this case.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/36539493
has text: Honestly, I don't know how much it matters in this case, if you pass in a tokenizer set up exactly the same. I don't really know all about how Lucene uses `TokenStreamComponents.source` internally. It may make no difference, for all I know, but it certainly could make a difference (it's passed around a lot, including to things like the `ReuseStrategy`, so there may be places where it assumes they are the same object and relies on state being consistent), and there's no sense in going to the trouble of constructing a new one anyway.
comment on: http://stackoverflow.com/a/23542668
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/36128297
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23547584
type: QuestionComment
has text: @haifzhan Do you really think super/child classes are not related to type?

http://stackoverflow.com/comment/36043599
has text: It does look like we have several versions of JPA in our humongous, convoluted classpath. Now, I just have to figure out how to simplify this mess. Any ideas? ;)
comment on: http://stackoverflow.com/a/23502079
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/23595604
has comment: http://stackoverflow.com/comment/36217910
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/36217959
downvote count: 1
has comment: http://stackoverflow.com/comment/36217797
has comment: http://stackoverflow.com/comment/36218299
has comment: http://stackoverflow.com/comment/36218201
type: Answer
answers question: http://stackoverflow.com/q/23595573
has comment: http://stackoverflow.com/comment/36218136
has body: Both the functions will be calculated in compile-time and would have the same efficiency.

http://stackoverflow.com/a/23519614
upvote count: 1
has comment: http://stackoverflow.com/comment/36076465
answers question: http://stackoverflow.com/q/23519534
has body: Try this instead: class test { A mockA = mock(A.class); B mockB = mock(B.class); when(mockA.getB()).thenReturn(mockB); boolean b = mockA.getB() == null; // Should be false } interface A { B getB(); } interface B {}
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36076872
downvote count: 0
has comment: http://stackoverflow.com/comment/36076991
accepted answer of: http://stackoverflow.com/q/23519534
type: Answer
has comment: http://stackoverflow.com/comment/36076958
score: 1

http://stackoverflow.com/comment/36123281
score: 0
type: Comment
type: QuestionComment
has text: @j-p When you say you can't see any difficulty in 'synchronizing' such tasks what approach are you referring to? Maybe use the `upload` task scenario I tried to describe as an exemplar?
comment on: http://stackoverflow.com/q/23542776

http://stackoverflow.com/a/23486128
has comment: http://stackoverflow.com/comment/36013748
has comment: http://stackoverflow.com/comment/36060455
accepted answer of: http://stackoverflow.com/q/23486005
has comment: http://stackoverflow.com/comment/36060423
has comment: http://stackoverflow.com/comment/36259169
has comment: http://stackoverflow.com/comment/36061862
answers question: http://stackoverflow.com/q/23486005
has body: I would suggest putting a comma-separated list of groups between quotation marks, like the following: userID|groups 1|"group1,group2,group3" 2|"group1,group3" 3|"group5" You can use any other separator for the groups column but the idea is to enclose the list in quotation marks
upvote count: 5
has comment: http://stackoverflow.com/comment/36013459
has comment: http://stackoverflow.com/comment/36013497
has comment: http://stackoverflow.com/comment/36258860
score: 5
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/36013759
type: Answer
has comment: http://stackoverflow.com/comment/36059005
has comment: http://stackoverflow.com/comment/36013482

http://stackoverflow.com/comment/35960799
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23457966
has text: @AlexeyShestakov Yes, I could. That'd be better than a `String[][]` but I was looking for something more statically-typed, to see if it's possible.

http://stackoverflow.com/q/23497428
has title: NetworkChangeReceiver's onReceive method is called multiple times when 3G and WIFI are enable at same time
score: 2
has answer: http://stackoverflow.com/a/24887525
tagged with: java
has body: I'm developing an android application and I have the next problem: I implemented Broadcast receiver for connectivity change and the method onReceive seems to be called 4 times in a row when 3G and Wifi are enabled at the same time. So my question is: Is there a way listen only for internet connection, not for network change? Or is there any way for the method onReceive to be called only once when 3G and Wifi are enable at the same time? Here is my code: public class NetworkChangeReceiver extends BroadcastReceiver { public static final String TAG = "NetworkMonitoring"; @Override public void onReceive(Context context, Intent intent) { if (isOnline(context)) { Log.v(TAG, "Connected!"); // update(context); } else { Log.v(TAG, "Not connected!"); // stopUpdate(context); } } public boolean isOnline(Context context) { ConnectivityManager cm = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if (netInfo != null &amp;&amp; netInfo.isConnected()) return true; return false; } } In the Android Manifest: &lt;receiver android:name="xxxxx.xxxxx.xxxxx.NetworkChangeReceiver" &gt; &lt;intent-filter&gt; &lt;action android:name="android.net.conn.CONNECTIVITY_CHANGE" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; Here is the log: 05-06 16:24:05.985: V/NetworkMonitoring(569): Connected! 05-06 16:24:10.250: V/NetworkMonitoring(569): Connected! 05-06 16:24:10.720: V/NetworkMonitoring(569): Connected! 05-06 16:24:11.031: V/NetworkMonitoring(569): Connected! (Notice the time!)
type: Question
upvote count: 2
tagged with: broadcastreceiver
downvote count: 0
tagged with: 3g
tagged with: android
answer count: 1
tagged with: wifi
favorite count: 0
linked to: http://stackoverflow.com/q/8412714
type: UnansweredQuestion

http://stackoverflow.com/comment/36204002
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23587897
has text: @www.sblog.in how do you do that. Any link for it ?

http://stackoverflow.com/q/23498780
score: 0
type: UnansweredQuestion
has title: How to refresh the markers without refreshing the Google Map in Vaadin?
has body: I am using GoogleMap add on, by tapio, with Vaadin 7. Everything seems to be working fine, except for the refresh. I tried a bean container as follows: BeanContainer&lt;String, GoogleMap&gt; maps; maps = new BeanContainer&lt;String, GoogleMap&gt;(GoogleMap.class); When I want to add or delete a marker, I recreate the GoogleMap and update the Bean Container maps. I tried requestRepaintAll, although it is deprecated. I would appreciate if you can guide me on how to refresh the markers without refreshing the whole page/map. a) is it possible to just refresh the markers without affecting the map? b) if Vaadin is using Ajax to send updates to the client, how can I make it work for the markers? c) is it possible to refresh the map with markers without using javascript location.reload() Thank you
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/23528907
tagged with: google-maps
has comment: http://stackoverflow.com/comment/40271345
answer count: 1
tagged with: vaadin7

http://stackoverflow.com/q/23597763
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36222163
has comment: http://stackoverflow.com/comment/36222088
has comment: http://stackoverflow.com/comment/36222063
tagged with: java
score: -1
tagged with: image
has comment: http://stackoverflow.com/comment/36222019
has comment: http://stackoverflow.com/comment/36221799
answer count: 2
upvote count: 0
linked to: http://stackoverflow.com/q/7954213
has answer: http://stackoverflow.com/a/23597795
favorite count: 0
tagged with: illegalargumentexception
has comment: http://stackoverflow.com/comment/36222241
has answer: http://stackoverflow.com/a/24003321
has comment: http://stackoverflow.com/comment/36221918
has title: Getting error with ImageIO.read(getClass().getResourceAsStream (input==NULL)?
has comment: http://stackoverflow.com/comment/36222228
type: UnansweredQuestion
has body: I keep getting this error when I use the following code: try { image=ImageIO.read(getClass().getResourceAsStream("build/classes/javaproject/Space.gif")); } catch (IOException ex) { lastException=ex; } It gives keeps giving me the "input==null" error. I have already tried to find a solution to this (several answered questions already had the solution actually, but those didn't work for me) but I haven't had any luck. This one for example was very similar to my problem, but I can't seem to find out exactly where to put my image file in. I noticed most of them were solved by simple file placement, and so it's all the more confusing when some people have 'bin' while I have 'build' and 'src' on NetBeans. Also, I realize the path is probably erroneous, but I already tried it many different ways and it hasn't seemed to work with any of them. I would really appreciate any help...
has comment: http://stackoverflow.com/comment/36221800

http://stackoverflow.com/q/23587078
tagged with: java
score: 0
answer count: 1
tagged with: arrays
tagged with: android
has body: I'm stitching a bitmap from a layout array, that puts the a larger bitmap together as a guide. Using multiple bitmaps into one bitmap. What I rotate the whole bitmap, my solution is to restitch it but have the array account for this rotation. The making of the bitmap is determined by the order of the array. The stitching assumes that the array starts from zero and that is the first index or the left top most corner and then goes to the right to the end and goes to beginning of the next row. I would like to have a 90, 180, 270, and 360 functions to call on. I'm thinking 360 is easy I iterate backwards. I'm using 11 by 11 which is constant. For example 0, 1, 3, 4 5, 6, 7, 8, 9, 10, 11, 12 13, 14, 15, 16 when I rotate 90 4, 8, 12, 16 3, 7, 11, 15 1, 6, 10, 14 0, 5, 9, 13
has answer: http://stackoverflow.com/a/23587501
accepted answer: http://stackoverflow.com/a/23587501
type: AnsweredQuestion
tagged with: bitmap
type: Question
has title: Java Iterating into array for different orientations

http://stackoverflow.com/comment/36000805
type: Comment
comment on: http://stackoverflow.com/q/23479456
has text: Where are `first`, `last`, `back`, and `next` defined? One of them is `null`.
score: 0
type: QuestionComment

http://stackoverflow.com/q/23587378
favorite count: 0
has answer: http://stackoverflow.com/a/23594955
type: Question
score: 3
has title: Differentiate between BigDecimal for money and BigDecimal for percentages
has body: I use BigDecimal throughout my application to handle money and percentages. But, I need a way to differentiate usage between the two (for the purpose of rendering them, i.e., in a JTable). So, my initial thought was to write two classes which behave exactly like BigDecimal so that I could do instanceof tests on them. So I wrote this code: DollarValue.java: import java.math.BigDecimal; public class DollarValue extends BigDecimal { } PercentValue.java: import java.math.BigDecimal; public class PercentValue extends BigDecimal { } However, in order to use the constructors (because they cannot be inherited), I you need to manually override every constructor. So, DollarValue.java became a monstrosity: import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; public class DollarValue extends BigDecimal { public DollarValue(char[] in, int offset, int len) { super(in, offset, len); } public DollarValue(char[] in, int offset, int len, MathContext mc) { super(in, offset, len, mc); } public DollarValue(char[] in) { super(in); } public DollarValue(char[] in, MathContext mc) { super(in, mc); } public DollarValue(String val) { super(val); } public DollarValue(String val, MathContext mc) { super(val, mc); } public DollarValue(double val) { super(val); } public DollarValue(double val, MathContext mc) { super(val, mc); } public DollarValue(BigInteger val) { super(val); } public DollarValue(BigInteger val, MathContext mc) { super(val, mc); } public DollarValue(BigInteger unscaledVal, int scale) { super(unscaledVal, scale); } public DollarValue(BigInteger unscaledVal, int scale, MathContext mc) { super(unscaledVal, scale, mc); } public DollarValue(int val) { super(val); } public DollarValue(int val, MathContext mc) { super(val, mc); } public DollarValue(long val) { super(val); } public DollarValue(long val, MathContext mc) { super(val, mc); } } But what's worse, in implementation, this didn't work because I use the static BigDecimal code a lot. To illustra…
has comment: http://stackoverflow.com/comment/36204732
upvote count: 3
answer count: 2
linked to: http://stackoverflow.com/q/1644317
has comment: http://stackoverflow.com/comment/36202293
accepted answer: http://stackoverflow.com/a/23594955
has comment: http://stackoverflow.com/comment/36202591
has comment: http://stackoverflow.com/comment/36202301
tagged with: java
has comment: http://stackoverflow.com/comment/36202357
has comment: http://stackoverflow.com/comment/36202320
has comment: http://stackoverflow.com/comment/36202409
has comment: http://stackoverflow.com/comment/36204715
has comment: http://stackoverflow.com/comment/36202308
has comment: http://stackoverflow.com/comment/100186858
has comment: http://stackoverflow.com/comment/36202397
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36202311
possible better answer: http://stackoverflow.com/a/23587538
downvote count: 0
tagged with: bigdecimal
has comment: http://stackoverflow.com/comment/36203881
has answer: http://stackoverflow.com/a/23587538
tagged with: inheritance

http://stackoverflow.com/a/23527231
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/23526471
answers question: http://stackoverflow.com/q/23526471
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/36090227
has body: Just reading the javadocs: getAttributes NamedNodeMap getAttributes() A NamedNodeMap containing the attributes of this node (if it is an *Element*) or null otherwise. The Document interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree. null.getNamedItem("Amount") ??? Maybe break the steps apart?
upvote count: 1

http://stackoverflow.com/a/23573414
answers question: http://stackoverflow.com/q/23573307
type: Answer
accepted answer of: http://stackoverflow.com/q/23573307
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/36176483
has body: If you just import the two packages with a wildcard, you will get a compilation error when trying to use the unqualified class name, as it would be ambiguous: import package1.*; import package2.*; // snipped // compilation error. // No way to tell if you mean package1.class1 or package2.class1 class1 c = new class1(); One way around this is to fully qualify your usage: // No ambiguity, so no error. package1.class1 c = new package1.class1(); Funnily enough, another way around this is to add an additional import for that specific class. This explicit import takes precedence on any wildcard import, and resolves any ambiguity: import package1.*; import package2.*; import package1.class1; // snipped // This is an instance of package1.class1. class1 c = new class1();
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/23457091
possible better answer: http://stackoverflow.com/a/23458348
has answer: http://stackoverflow.com/a/23458348
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/23459600
linked to: http://stackoverflow.com/q/23174582
has title: OSGi add bundle listener to installed bundle
tagged with: osgi
has answer: http://stackoverflow.com/a/23466818
type: AnsweredQuestion
has body: I have an installed bundle. Now I want to add listener to it (and later to start) to find when it comes to active state. The only way I found is bundle.getBundleContext().addBundleListener(new ...); However getBundleContext() works only if bundle is in starting, stopping, active state. So, can can I do that?
accepted answer: http://stackoverflow.com/a/23459600
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: osgi-bundle

http://stackoverflow.com/comment/36050739
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23506089
has text: Do you want to show the content of text file inside the `JTextArea`? or you are not able to read the file?

http://stackoverflow.com/comment/36184860
type: Comment
has text: where should I create the list? if I create it in the first line every time it will be renewed?
comment on: http://stackoverflow.com/a/23577932
score: 0
type: AnswerComment

http://stackoverflow.com/comment/35997936
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/23477938
has text: i thought it would get all the permutations back. I sitll don't understand why i never get B-A

http://stackoverflow.com/q/23491606
upvote count: 0
has comment: http://stackoverflow.com/comment/36023434
tagged with: java
linked to: http://stackoverflow.com/q/974583
type: Question
score: -2
has answer: http://stackoverflow.com/a/23491830
has title: What is difference between Vector and Linked List?
downvote count: 2
answer count: 3
linked to: http://stackoverflow.com/q/5199359
favorite count: 0
duplicate of: http://stackoverflow.com/q/974583
type: UnansweredQuestion
has body: Why There is support for Primitives data types when everything else in Java is Object . Although Java does provide Wrapper classes of all the primitives data types
has answer: http://stackoverflow.com/a/23491836
has answer: http://stackoverflow.com/a/23491672

http://stackoverflow.com/comment/36188621
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23580131
score: 1
has text: Use a tool tip in the cell renderer. BTW - You forgot to ask a question.

http://stackoverflow.com/comment/36209464
score: 0
type: AnswerComment
has text: even if we defined them outside the if statement still get the error and it is suggested to define the as follow float d1=0; float d2=0; float d3=0; and if i did so the total distance=0 ; how we can solve it plz
type: Comment
comment on: http://stackoverflow.com/a/23591176

http://stackoverflow.com/q/23523648
type: Question
upvote count: 7
answer count: 1
tagged with: awt
has body: I recently found out how to register a TTF font with the local GraphicsEnvironment, s.t., for my use case (SVG-to-PNG transcoding), Apache Batik may recognize the font: import java.awt.Font; import java.awt.FontFormatException; import java.awt.GraphicsEnvironment; // [...] GraphicsEnvironment lge = GraphicsEnvironment.getLocalGraphicsEnvironment(); try { Font font = Font.createFont(Font.TRUETYPE_FONT, fontFile); lge.registerFont(font); } catch (FontFormatException e) { logger.warn(e.getMessage(), e); } catch (IOException e) { logger.warn(e.getMessage(), e); } However, I was wondering if I could unregister any pre-existing fonts in order to guarantee that only the fonts I register will be used in transcoding. There is no GraphicsEnvironment#unregisterFont(...), how could I achieve this instead? PS: I don't want to subclass GraphicsEnvironment, as I cannot assume the presence any specific subclass, like sun.awt.Win32GraphicsEnvironment. EDIT: Some more infos: As sun.font.FontManager changes with Java7 (from class to interface, and whatnot), I'd rather not use any workaround relying on it. My JVM is the Oracle JVM.
tagged with: batik
has answer: http://stackoverflow.com/a/23598644
favorite count: 0
has title: Unregister font with GraphicsEnvironment?
downvote count: 0
tagged with: fonts
type: UnansweredQuestion
score: 7
tagged with: java

http://stackoverflow.com/comment/36043050
comment on: http://stackoverflow.com/q/23500183
type: QuestionComment
has text: put there only one Item there to show, set warning or "no items are available for ...", forgot for disabling a popup, could be L&F and platform sensitive, there is possible to play with selection(moving to next), but one of them must be accesible, you can to play with JLayer(Java7) or GLassPane (doesn't protect against KeyEvents)
score: 0
type: Comment

http://stackoverflow.com/a/23509852
upvote count: 2
downvote count: 0
has body: I assume you have 7 columns and removing them by the index. When removed the index count -1, then you can't use an index value higher than size. Change to jTable5.removeColumn(jTable5.getColumnModel().getColumn(6)); jTable5.removeColumn(jTable5.getColumnModel().getColumn(5));
type: Answer
answers question: http://stackoverflow.com/q/23509737
score: 2

http://stackoverflow.com/q/23458549
has answer: http://stackoverflow.com/a/38195454
tagged with: java
possible better answer: http://stackoverflow.com/a/23458597
tagged with: image
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/35961804
upvote count: 1
linked to: http://stackoverflow.com/q/4931323
has body: I am trying to display an image throw jsp. Image is stored in local path so I wrote a servlet get method to retrive image and in src attribute of image tag I am giving the servlet name and image path as parameter to servlet and here is my code, public class FileServlet extends HttpServlet { private static final long serialVersionUID = 1L; private static final int DEFAULT_BUFFER_SIZE = 10240; // 10KB. private String filePath; public void init() throws ServletException { this.filePath = "/files"; } protected final void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("In do get"); // Get requested file by path info. String requestedFile = request.getPathInfo(); // 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. return; } // Decode the file name (might contain spaces and on) and prepare file object. File file = new File(filePath, URLDecoder.decode(requestedFile, "UTF-8")); // Check if file actually exists in filesystem. if (!file.exists()) { // Do your thing if the file appears to be non-existing. // Throw an exception, or send 404, or show default/warning page, or just ignore it. response.sendError(HttpServletResponse.SC_NOT_FOUND); // 404. return; } // Get content type by filename. String contentType = getServletContext().getMimeType(file.getName()); // If content type is unknown, then set the default value. // For all content types, see: http://www.w3schools.com/media/media_mimeref.asp // To add new content types, add new mime-mapping entry in web.xml. if (contentType == null) { contentType = "application/octet-stream"; } // Init servlet response. response.reset(); response.setBufferSize(DEFAULT_BUFFER_SIZE); response.setContentType(contentType); resp…
tagged with: jsp
has answer: http://stackoverflow.com/a/23458597
favorite count: 0
score: 0
tagged with: http://stackoverflow.com/tag/html
downvote count: 1
answer count: 4
linked to: http://stackoverflow.com/q/21274520
has title: How to display image from local path from jsp
has answer: http://stackoverflow.com/a/42199574
has answer: http://stackoverflow.com/a/23459977
accepted answer: http://stackoverflow.com/a/23459977
type: AnsweredQuestion

http://stackoverflow.com/q/23513113
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23514895
accepted answer: http://stackoverflow.com/a/23514895
possible better answer: http://stackoverflow.com/a/23513727
type: Question
has title: Spring batch when use steps deciders and chunks
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23513727
has body: I am starting to use Spring Batch and I have a question about when using steps, deciders and chunks. Given the following input: <UserAuthorizationEvent> ADD Name1 UPDATE 456 NewName2 789 DELETE </UserAuthorizationEvent> For each of the in the file, I will have different business rules to verify before executing a query on the database depending of the . (Example: for an ADD, verify that the UserName is unique in the database and that it is composed of only letters, or for a DELETE, verify that the id exists in the table) Then the value will determine if I need to INSERT, UPDATE or DELETE a value in the database. (Action could have other values such as UPDATE_RIGHTS or RESET_PASSWORD) What is the best to do ? Do I define a job like that: <chunk reader="itemReader" processor="itemProcessor" writer="itemWriter" commit-interval="2" /> The itemReader will read the xml file and return a one at a time. The itemProcessor will be full of ifs to verify the business rules on the current item depending of its value The itemWriter will persist the item in the database. Do I need to add logics here too if I want to execute some more things before executing the queries? By doing so, I fear that I am not using Spring batch correctly. Is that the right thing to do? Can I use several steps and deciders for implementing all the logic of the batch ? Do you have some examples ?
tagged with: spring-batch

http://stackoverflow.com/q/23573140
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/23573505
has title: how to be aware of database changes without checking from android application
type: Question
has body: I'm Trying to Start an android chat room application , i can check server each 10Sec for new messages , but this is not right as you know. For example when you receive an email , Automatically a Notification message Display How Can I Do This ?!
score: 3
has answer: http://stackoverflow.com/a/23573505
upvote count: 3
answer count: 2
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/23574796
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23574796

http://stackoverflow.com/q/23613247
has title: IllegalStateException - no last call on a mock available
type: Question
has body: I'm trying to use EasyMock to test that a method runs a specific number of times but I keep getting an IllegalStateException error and I don't understand why. I'm new to EasyMock and JUnit and not very familiar with how to use them so I'm not sure what I'm doing wrong. My code is: FileOutputStream mockWriter; Numbers mockByte; @Test public void testNumbers() throws IOException{ mockWriter = createMock(FileOutputStream.class); mockByte = new Numbers(mockWriter); mockByte.initByte(); expect(mockByte.generate()).times(10000); replay(mockWriter); } And these are the methods initByte and generate from my Numbers class: public void initByte() throws IOException{ File outFile = new File("NumbersOutput.txt"); FileOutputStream f = new FileOutputStream(outFile); for(int i = 0; i &lt; 10000; i++){ int b = generate(); f.write(b); } f.flush(); f.close(); } public int generate(){ return rand.nextInt(100001); }
tagged with: java
upvote count: 1
tagged with: easymock
answer count: 1
tagged with: illegalstateexception
type: UnansweredQuestion
tagged with: junit
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/23613386
favorite count: 0

http://stackoverflow.com/comment/36160752
score: 0
comment on: http://stackoverflow.com/q/23563613
type: Comment
type: QuestionComment
has text: Yeah, but it crashed after one successful time (sending and receiving). The exception said something about the connection already being binded and referring to the line with: ds = new DatagramSocket(80); After playing around with it, i unfortunately can't replicate the exception. No matter what i do now the antenna is just waiting for a reply.

http://stackoverflow.com/a/23597105
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36220804
has body: Most likely you're missing the right repository for Spring javax.persistence: Try adding this to your pom.xml: com.springsource.repository.bundles.release SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases http://repository.springsource.com/maven/bundles/release com.springsource.repository.bundles.external SpringSource Enterprise Bundle Repository - External Bundle Releases http://repository.springsource.com/maven/bundles/external
has comment: http://stackoverflow.com/comment/36220619
type: Answer
answers question: http://stackoverflow.com/q/23597021
accepted answer of: http://stackoverflow.com/q/23597021
has comment: http://stackoverflow.com/comment/36220870

http://stackoverflow.com/q/23541128
has comment: http://stackoverflow.com/comment/36116988
favorite count: 0
has title: how to use textfied and button to get results from an if else statement
tagged with: netbeans
has answer: http://stackoverflow.com/a/23542256
has comment: http://stackoverflow.com/comment/36116240
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/23542256
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36115886
has comment: http://stackoverflow.com/comment/36115763
tagged with: java
has body: how to use if else statement using textfield as an input then use a button to show results, I have tried using the code the bellow ,but it does not allow me to use " if else " condition for second condition , below is my code; int x = Integer.parseInt(jTextField1.getText()); if (x&gt;=120&amp;x&lt;200) {JOptionPane.showMessageDialog(null, "select drum : PPJ upwards")}; if else (x&gt;=230&amp;x&lt;=300); {JOptionPane.showMessageDialog(null,"select drum :RRf Upwards");} else {JOptionPane.showMessageDialog(null,"incorrect entry");} } }
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/36116852
answer count: 1

http://stackoverflow.com/a/23604548
has comment: http://stackoverflow.com/comment/36234473
has comment: http://stackoverflow.com/comment/36234298
has comment: http://stackoverflow.com/comment/36234351
has body: Here owner is not a property of the array, but a member of BenchmarkQ[jj], i.e. of the jj-th entry in BenchmarkQ. Please refer to the entry type of queryvalue. queryvalue seems to have some members owner, ext and filesize. Perhaps its definition is inside some library.
answers question: http://stackoverflow.com/q/23604510
has comment: http://stackoverflow.com/comment/36234314
score: 0
has comment: http://stackoverflow.com/comment/36234284
type: Answer

http://stackoverflow.com/a/23609263
answers question: http://stackoverflow.com/q/23581378
type: Answer
score: 11
downvote count: 0
has comment: http://stackoverflow.com/comment/114581781
has body: You need to use the pressure sensor to measure the pressure then use the SensorManager.getAltitude(float, float) call to convert the measures pressure along with a reference sea level pressure to get the altitude. The tricky bit is what to use as the reference pressure. This will change with the weather and will drift over time. Typically you would do some sort of calibration to set this values and possibly update it. It depends on your use case what the right solution is. If properly calibrated pressure based altitude is considerably more accurate then gps based altitude especially if want you are interested in is altitude differences rather than absolute altitudes. With a bit of filtering on the raw pressure sensor values you can easily detect holding the phone at face level or arms length above your head which you want do with gps.
type: AcceptedAnswer
upvote count: 11
has comment: http://stackoverflow.com/comment/114580103
has comment: http://stackoverflow.com/comment/114695210
accepted answer of: http://stackoverflow.com/q/23581378
has comment: http://stackoverflow.com/comment/114650573
has comment: http://stackoverflow.com/comment/114682685

http://stackoverflow.com/a/23562069
upvote count: 2
has body: It is always a good design to separate the Interface from the Implementation. It provides more abstraction and flexibility to your code. The clients of your DAO interface do not need to know how it is implemented, but only the methods it provides. In the end, interfaces are a good practice for maintainability of your code. Just to add, in my experience in Unit Tests via mocks, it is a lot easier to create mock objects when the object you're mocking has an interface. So using interfaces, for me, makes it easier to isolate and test your code.
answers question: http://stackoverflow.com/q/23561939
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/50875665

http://stackoverflow.com/comment/36236295
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23601772
type: AnswerComment
has text: yeah that was it :D, thank you very much for your help Tarik :D

http://stackoverflow.com/a/23595338
type: Answer
answers question: http://stackoverflow.com/q/23595305
score: 0
has body: Collections.sort() can take a Comparator. See the API.

http://stackoverflow.com/comment/36218279
score: 0
type: Comment
has text: Curious. Short files do load as Clips much more quickly than long notes, so there were probably other factors involved. If you are loading new each time, better to use SourceDataLine than Clip. I'd have to see more of the program to try to understand your result. Java can be pretty unruly when it comes to real time sound guarantees, especially when spanning multiple threads. And with Microsoft OS (system clock is only accurate to approximately 15 milliseconds) it gets even worse. E.g., triggering sound via button clicks or mouse movement crosses threads, is difficult to handle well.
comment on: http://stackoverflow.com/a/23574199
type: AnswerComment

http://stackoverflow.com/a/23522019
upvote count: 1
has comment: http://stackoverflow.com/comment/36080032
answers question: http://stackoverflow.com/q/23521967
downvote count: 0
has comment: http://stackoverflow.com/comment/36080159
type: Answer
has comment: http://stackoverflow.com/comment/36079926
has comment: http://stackoverflow.com/comment/36080009
has body: below are the changes needed in your code. Basically you never updated the variable sum after you compute the product of corresponding elements in the two arrays. Also you might wanna use long type to store the result of the sum &amp; the product as the int value might overflow if the elements in the array are sufficiently large. public long weightedSum(int [] a ,int [] b) { long value = 0; long sum = 0 ; for (int i = 0 ; i &lt; a.length ; i++) { value = a[i] * b [i]; sum = sum +value ; } return sum; }
score: 1

http://stackoverflow.com/q/23602871
tagged with: java
has comment: http://stackoverflow.com/comment/36231670
accepted answer: http://stackoverflow.com/a/23603970
has comment: http://stackoverflow.com/comment/36231944
has title: How to add data to JTable
type: Question
linked to: http://stackoverflow.com/q/5621338
tagged with: user-interface
has body: I'm still a little new to Java and a complete noob to Gui's. I can't for the life of me figure out how to add the data from my String array into the Jtable. I tried to read the docs on oracle but it was not making sense to me for my particular situation. If you guys could please point me in the right direction I would appreciate it. Also I'm retrieving my array data from a file. Not sure if that makes a difference. public class TemplateGui extends JFrame { private JTable tableHotelSecurity, securityFlagsTable; private final ButtonGroup buttonGroup = new ButtonGroup(); private JTextField textField; private static String [] sortedRoles_Flags,finalFlagsArr,finalHSArr; private static String finalFlags="",finalHS="",column; public TemplateGui(){ super("Galaxy Template Generator V1.0"); getContentPane().setForeground(new Color(0, 0, 0)); getContentPane().setLayout(null); getContentPane().setBackground(new Color(51, 51, 51)); JScrollPane scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setBounds(10, 170, 189, 186); getContentPane().add(scrollPane); JScrollPane scrollPane_1 = new JScrollPane(); scrollPane_1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); scrollPane_1.setBounds(222, 170, 372, 186); getContentPane().add(scrollPane_1); //radio buttons JRadioButton rdbtnNewRadioButton = new JRadioButton("Central User "); rdbtnNewRadioButton.setFont(new Font("Tahoma", Font.BOLD, 11)); rdbtnNewRadioButton.setBackground(Color.WHITE); buttonGroup.add(rdbtnNewRadioButton); rdbtnNewRadioButton.setBounds(222, 75, 127, 36); getContentPane().add(rdbtnNewRadioButton); final JRadioButton rdbtnPropertyUser = new JRadioButton("Property User"); rdbtnPropertyUser.setFont(new Font("Tahoma", Font.BOLD, 11)); rdbtnPropertyUser.setBackground(Color.WHITE); buttonGroup.add(rdbtnPropertyUser); rdbtnPropertyUser.setBounds(222, 38, 127, 34); getContentPane().add(rdbtnPropertyUser); textField = ne…
tagged with: jtable
has comment: http://stackoverflow.com/comment/36231519
answer count: 1
linked to: http://stackoverflow.com/q/12688068
has comment: http://stackoverflow.com/comment/36233066
score: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/36231360
has answer: http://stackoverflow.com/a/23603970
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/36231649

http://stackoverflow.com/q/23551605
answer count: 1
has answer: http://stackoverflow.com/a/23551687
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/36135717
has title: MediaPlayer.create cannot be resolved to a type
has body: I'm trying to get an mp3 file to play a sound when a button is clicked (Android app). However, despite following tutorials with similar code, I get this error message 'MediaPlayer.create cannot be resolved as a type. I have refreshed the project and cleaned the project and it made no difference. Here is my code: package com.example.h.a.t; import android.media.MediaPlayer; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.widget.Button; public class Hypo_Info extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.hypo_info); final MediaPlayer mediaPlayer = new MediaPlayer.create(this, R.raw.pill_bottle); Button a = (Button) findViewById(R.id.treatment_hypo); a.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(Hypo_Info.this, Hypo_Treatment.class); startActivity(i); mediaPlayer.start(); } }); }
tagged with: android-mediaplayer
tagged with: java
tagged with: eclipse
type: Question
score: 0

http://stackoverflow.com/comment/36068410
type: QuestionComment
comment on: http://stackoverflow.com/q/23515880
has text: How to do that in eclipse?
score: 0
type: Comment

http://stackoverflow.com/q/23532446
has comment: http://stackoverflow.com/comment/36100841
answer count: 5
has answer: http://stackoverflow.com/a/23548288
tagged with: android
has comment: http://stackoverflow.com/comment/36101233
possible better answer: http://stackoverflow.com/a/23532542
has comment: http://stackoverflow.com/comment/36100338
has comment: http://stackoverflow.com/comment/36101296
has answer: http://stackoverflow.com/a/23532542
has answer: http://stackoverflow.com/a/23532971
has answer: http://stackoverflow.com/a/23532931
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23548288
has comment: http://stackoverflow.com/comment/36100983
has title: Android: Listview item not deleting. Id not being retrieved
tagged with: java
has comment: http://stackoverflow.com/comment/36100706
tagged with: database
has body: I am currently trying to add a deleting ability to a ListView onItemLongClick. Unfortunately, for some reason I cannot seem to do this. Whenever I long click, the dialog box appears correctly and when I press yes to delete, nothing at all happens. The item still remains in the Listview and in the database because I call the method to display all the items from the updated database right after I call my delete method. I have been trying to fix this problem for two days now and I have gotten nowhere. It seems as though it is unable to retrieve an Id from the database for each item, but I am not sure why it would be doing this. Here is my habit object class: public class Habit extends Object implements Serializable{ private int day_count; private int _id; private String habit_name, date_started, end_date, day_count_string, id_string; public Habit(){ } public Habit(int id, String name, String startDate, String endDate, int dayCount){ this._id = id; this.habit_name = name; this.date_started = startDate; this.end_date = endDate; this.day_count = dayCount; } public Habit(String name, String startDate, String endDate, int dayCount){ this.habit_name = name; this.date_started = startDate; this.end_date = endDate; this.day_count = dayCount; } public int getID() { return _id; } public int setID(int id) { return this._id; } public String getIDString() { id_string = "" + this._id; return id_string; } public int getDayCount() { return this.day_count; } public String getDayCountString() { day_count_string = "" + this.day_count; return day_count_string; } public int setDayCount(int dayCount) { return this.day_count; } public String getName() { return this.habit_name; } public void setName(String name) { this.habit_name = name; } public String getStartDate() { return this.date_started; } public void setStartDate(String startDate) { this.date_started = startDate; } public String getEndDate() { return this.end_date; } public void setEndDate(String endDate) { this.end_date = endDate; } …
tagged with: listview
type: Question
score: 0
has comment: http://stackoverflow.com/comment/36101048
has answer: http://stackoverflow.com/a/23533054
has comment: http://stackoverflow.com/comment/36101367

http://stackoverflow.com/a/23539835
has body: This should do it: select column_name, generation_expression, is_generated, is_identity, identity_generation, identity_start, identity_increment from information_schema.columns where table_name = 'XXX' and table_schema = 'PUBLIC' and is_identity = 'YES'
type: Answer
has comment: http://stackoverflow.com/comment/36229520
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/36229715
answers question: http://stackoverflow.com/q/23539481
has comment: http://stackoverflow.com/comment/36228390
has comment: http://stackoverflow.com/comment/36229744
downvote count: 0
has comment: http://stackoverflow.com/comment/36238944

null
tags question: http://stackoverflow.com/q/23509079
tags question: http://stackoverflow.com/q/23476939
tag name: null
tags question: http://stackoverflow.com/q/23461240
tags question: http://stackoverflow.com/q/23593111
tags question: http://stackoverflow.com/q/23458659
type: Tag
tags question: http://stackoverflow.com/q/23520063

http://stackoverflow.com/comment/36023886
type: QuestionComment
has text: @eis I don't understand how to start.
comment on: http://stackoverflow.com/q/23489499
score: 0
type: Comment

http://stackoverflow.com/q/23498166
has answer: http://stackoverflow.com/a/26001355
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/36036987
tagged with: wiql
accepted answer: http://stackoverflow.com/a/26001355
score: 0
has body: I'm creating a query using the SDK for Java. I want to get the ID from 2 days ago until today. String wiqlQuery = "Select ID from WorkItems where System.ChangedDate &gt;= @Today-2"; WorkItemCollection workItems = workItemClient.query(wiqlQuery); I've also tried with this example from the MSDN just to test clause the "WHERE" with dates: String wiqlQuery = "Select ID from WorkItems where [System.ChangedDate] &gt;= '1/8/06 GMT'"; I got the following message: Exception in thread "main" java.lang.NullPointerException: timeZone must not be null Reference: http://msdn.microsoft.com/en-us/library/bb130148%28v=vs.90%29.aspx Could anyone help me on that? Thanks in advance.
tagged with: tfs
type: AnsweredQuestion
tagged with: java
has title: Querying workitem tfs sdk - Timezone must not be null

http://stackoverflow.com/comment/69274148
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/23598042
type: Comment
has text: Thannks Amurka, it helped a lot , I did exactly for AES 256 , and increase my " Unlimited Strength Jurisdiction Policy ", and it worked for me

http://stackoverflow.com/a/23605802
accepted answer of: http://stackoverflow.com/q/23605577
type: AcceptedAnswer
score: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/23605577
has body: Add this to your code, resultsTable.revalidate(); Since your model has been changed but the change in model should be notified to the table also.
downvote count: 1

http://stackoverflow.com/a/23547039
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/23546679
type: AcceptedAnswer
downvote count: 0
has body: You need to rotate at the level where there is more than one height difference between the left subtree and the right subtree. BEFORE INSERTING 21 16 /\ 9 30 / / \ 4 23 34 / \ 20 26 AFTER INSERTING 21 16 /\ 9 30 / / \ 4 23 34 / \ 20 26 \ 21 Height difference of 2 at node 30. So rotate right at node 30. AFTER ROTATION 16 / \ 9 23 / / \ 4 20 30 \ / \ 21 26 34 There are single and double rotations. In your case a single rotation is enough. But this might not be the case every time. See how rotations work.
answers question: http://stackoverflow.com/q/23546679
type: Answer

http://stackoverflow.com/comment/36187836
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23579642
has text: try: for (char c : split[0].toCharArray()){

http://stackoverflow.com/a/23624169
has body: element.sendKeys(new String[]{"Hello, selenium"}); My code looks like this, it's working.
downvote count: 1
score: 3
answers question: http://stackoverflow.com/q/23485363
upvote count: 4
type: Answer

http://stackoverflow.com/a/23459478
has comment: http://stackoverflow.com/comment/35964019
upvote count: 1
answers question: http://stackoverflow.com/q/23459371
type: Answer
downvote count: 0
score: 1
has body: try this too to trim beginning myString.replaceAll("^\\s+", ""); and to trim trailing myString.replaceAll("\\s+$", "");

http://stackoverflow.com/a/23590545
has comment: http://stackoverflow.com/comment/36217013
has body: Have your remote object implement the Unreferenced interface, and unexport it in the unreferenced() method implementation, with UnicastRemoteObject.unexportObject(this, true); This will kick in at the expiration of the DGC interval.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/23589676
downvote count: 0
has comment: http://stackoverflow.com/comment/36216096

http://stackoverflow.com/comment/36254791
type: Comment
comment on: http://stackoverflow.com/a/23614091
score: 0
type: AnswerComment
has text: IF I NEED TO SUBSTRACT , WHAT DO I DO?

http://stackoverflow.com/a/23488894
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/36017847
score: 0
type: Answer
has body: You have to use dialog.findViewById, for example: final ListView list_view = (ListView) dialog.findViewById(R.id.list_prod);
accepted answer of: http://stackoverflow.com/q/23488601
answers question: http://stackoverflow.com/q/23488601

http://stackoverflow.com/q/23538861
answer count: 3
linked to: http://stackoverflow.com/q/4212675
tagged with: string
type: UnansweredQuestion
has body: Let us say I have a long string String s1="This is my world. This has to be broken." I am breaking the above string at a fixed interval of string length let's say when it's 10. So the output I get after breaking is This is my world. Thi s has to b e broken. Where as I want that the string should contain complete words and not broken words. Just like this I want the output to be This is my world. This has to be broken. How can I achieve the above output.
has answer: http://stackoverflow.com/a/23539002
has comment: http://stackoverflow.com/comment/36111338
tagged with: java
has answer: http://stackoverflow.com/a/23539368
duplicate of: http://stackoverflow.com/q/4212675
type: Question
has answer: http://stackoverflow.com/a/23539022
has title: Get complete word from string in lines , java?
has comment: http://stackoverflow.com/comment/36111392
score: 0

http://stackoverflow.com/comment/36231456
type: AnswerComment
comment on: http://stackoverflow.com/a/23560605
score: 0
type: Comment
has text: hi friend,it's working fine for displaying bottom of document but i need to increase width of datatable.

http://stackoverflow.com/a/23484439
answers question: http://stackoverflow.com/q/23484359
downvote count: 0
has body: No that may not be a sign of memory leak. Because when you close and open the gui multiple times your app may be creating and discarding some objects. But JVM may not have garbage collected them yet. If you want the real picture use a profiling tool. Take heap dumps over time after the GC runs. This will tell you what is still remaining in the memory. This can help you narrow down your hunt for a possible memory leak. Simplest tools to profile. Netbeans comes with a built in profiler. Jconsole can also help a bit VisualVm can also aid a bit. Also see this link how to analyze heapdumps
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/a/69444951
upvote count: 3
answers question: http://stackoverflow.com/q/23488093
type: Answer
has body: For me, the trick was reinstalling all dependencies. This can be done in two ways: using mvn dependency:purge-local-repository to delete all local dependencies just deleting everything in the m2/repository folder, I suggest you use the mvn command. Then, follow it up by a mvn clean install to load all the dependencies again.
downvote count: 0
score: 3

http://stackoverflow.com/comment/36220179
has text: You need to configure hibernate which dialect to use, for example for mysql ` org.hibernate.dialect.MySQLDialect `
score: 1
comment on: http://stackoverflow.com/q/23596896
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/36018996
score: 4
comment on: http://stackoverflow.com/q/23489568
has text: The difference is that the first statement is valid in Java and the second one is not.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/23544685
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/23544602
has body: You have to subtract 60,000 milliseconds from the long value representing the current time Timestamp date = new Timestamp(new java.util.Date().getTime() - (60 * 1000)); Now, date represents the time dated a minute back
type: Answer

http://stackoverflow.com/comment/36174239
comment on: http://stackoverflow.com/a/23570035
has text: No; they would normally only be idle if there is a period of time with no data. But in any case, your symptoms would indicate the socket is dead, but the client doesn't know it. Again, heartbeats would solve that.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/36138068
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23552779
has text: Someone edited the OP's post. There were no calls to `repaint` initially. Initially, inside the `Ball` class the OP was calling `.paint` on a `JPanel` instance variable.

http://stackoverflow.com/comment/35968117
type: Comment
comment on: http://stackoverflow.com/a/23461345
has text: It was a mistake. My PU name match in my program. Thx you for your interest.
score: 0
type: AnswerComment

http://stackoverflow.com/q/23456065
has title: Eclipse Plugin - Listener for switch file
tagged with: eclipse
type: Question
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/23456444
tagged with: eclipse-plugin
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23456444
has body: I am creating currently an eclipse-plugin that has both an editor and a view, both shell display the same data from an EMF Model... So now my wish is that everytime you change the opened file in the editor, the ViewPart refreshes, too... I have already in the init() function of my editor a call to a method of my view that refresh() its viewer... Problem is just that init() is only called when you open the file. But when you have 2 or more files opened at the same time and you switch between them, init() is not called, so my view doesnt refresh... Anybody a solution for that? Best regards, Anton
tagged with: java

http://stackoverflow.com/q/23492366
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23497895
has title: Duplicated result on bolt reception of storm topology
has body: I'm using a bolt that receives tuples from another bolt (exclamation bolt ) and writes it on a file , the problem I got is that I have duplicated results four times , like when I emit a word , I found the word Written four times . where's the problem possibly could be ? public class PrinterBolty extends BaseBasicBolt { @Override public void execute(Tuple tuple, BasicOutputCollector collector) { try { BufferedWriter output; output = new BufferedWriter(new FileWriter("/root/src/storm-starter/hh.txt", true)); output.newLine(); output.append(tuple.getString(0)); output.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void declareOutputFields(OutputFieldsDeclarer ofd) { } }
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/23497895
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: apache-storm

http://stackoverflow.com/comment/64905533
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23471054
has text: Did you find the solution? I am also facing the same issue. How to fix the orientation of the dialog to portrait?
score: 2

http://stackoverflow.com/comment/36151206
type: QuestionComment
has text: Show us your codes you tried so far.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/23559764

http://stackoverflow.com/q/23469373
type: Question
score: 0
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/23470911
has comment: http://stackoverflow.com/comment/35981683
accepted answer: http://stackoverflow.com/a/23470911
has title: Automatically generated database requests
has comment: http://stackoverflow.com/comment/35981675
linked to: http://stackoverflow.com/q/5321595
has comment: http://stackoverflow.com/comment/35981741
type: AnsweredQuestion
tagged with: java
tagged with: database
has body: How do you implement automatically generated database (let it be SQL) requests? Let us have offline shop with filters: The database is standalone offline. SO if I want to filter items by Price the request would be something like: select Snowboard.Name from Snowboard where Snowboard.Price between 400 and 600; And if I filter by two characteristics e.g. Price from and Camber. There would be: select s.Name, s.Camber from Snowboard s where s.Price between 400 and 600 and s.Camber in ('Rocker', 'Hybrid'); The question is how could it be implemented in Java so that these requests are generated automatically from any combination of filters selected?

http://stackoverflow.com/q/23495247
tagged with: eclipse
type: Question
tagged with: hadoop
has title: Stuck on using Hadoop after completing all the configuration
answer count: 1
has comment: http://stackoverflow.com/comment/36060947
favorite count: 0
has body: I have the running Hadoop environment on localhost with Centos OS. I have installed it following all the steps from different forums and provided documentation. As per my understanding, I have Hadoop running with three localhost. [Screenshots enclosed Furthermore, the configuration on eclipse has also been done, all the options on eclipse are available like (Map Reduce, Run on Hadoop). After the Map reduce program, the structured files are successfully converted in the unstructured form too. Now, I am stuck over here of how to proceed with Hadoop? How to retrieve data? What tools / APIs I can use to query the data? Please share the experience if anyone has worked on it. Thanks.
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/23497106
upvote count: 1
downvote count: 1
tagged with: java

http://stackoverflow.com/a/23535771
has comment: http://stackoverflow.com/comment/36106077
score: 0
type: Answer
answers question: http://stackoverflow.com/q/23535723
has comment: http://stackoverflow.com/comment/36106249
has body: Didn't you try replaceAll? String s = ...; String firstPart = s.replaceAll("[0-9].*", ""); String secondPart = s.substring(firstPart.length());
has comment: http://stackoverflow.com/comment/36106131

http://stackoverflow.com/a/23526409
has comment: http://stackoverflow.com/comment/36088514
has body: Sure. You can use a Unicode escape sequence for this. A lower-case epsilon is "\u03B5". There are plenty of charts of Unicode escape sequences online, to help you find other symbols. There's also a really good tool at http://www.fileformat.info/info/unicode/ where you can search for a symbol by name, and see exactly how to insert it in your Java. There are some excellent answers on Why does Java permit escaped unicode characters in the source code? that describe advantages of this approach.
has comment: http://stackoverflow.com/comment/36088704
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/23526365
has comment: http://stackoverflow.com/comment/36088549
downvote count: 0

http://stackoverflow.com/a/23489787
upvote count: 2
type: Answer
downvote count: 1
score: 1
has body: Set doesn't store duplicated elements. If you want to store both of your cars you should change equals and compareTo methods to compare also number. Then both entries will be different. Remember that equals method should be consistent with compareTo, so I strongly recommend you to override equals method as well.
answers question: http://stackoverflow.com/q/23489718

jakarta-ee
tags question: http://stackoverflow.com/q/23498195
tags question: http://stackoverflow.com/q/23505191
tags question: http://stackoverflow.com/q/23580643
tags question: http://stackoverflow.com/q/23608017
tags question: http://stackoverflow.com/q/23466057
tags question: http://stackoverflow.com/q/23513047
tags question: http://stackoverflow.com/q/23535434
tags question: http://stackoverflow.com/q/23548368
tags question: http://stackoverflow.com/q/23454185
tags question: http://stackoverflow.com/q/23487002
type: Tag
tags question: http://stackoverflow.com/q/23549987
tags question: http://stackoverflow.com/q/23464424
tags question: http://stackoverflow.com/q/23484152
tags question: http://stackoverflow.com/q/23603353
tags question: http://stackoverflow.com/q/23466772
tags question: http://stackoverflow.com/q/23530949
tags question: http://stackoverflow.com/q/23490903
tags question: http://stackoverflow.com/q/23480119
tags question: http://stackoverflow.com/q/23595722
tags question: http://stackoverflow.com/q/23561878
tags question: http://stackoverflow.com/q/23502313
tags question: http://stackoverflow.com/q/23593039
tags question: http://stackoverflow.com/q/23488666
tags question: http://stackoverflow.com/q/23594046
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/23563340
tags question: http://stackoverflow.com/q/23600345
tags question: http://stackoverflow.com/q/23487672
tags question: http://stackoverflow.com/q/23525748
tags question: http://stackoverflow.com/q/23562939
tags question: http://stackoverflow.com/q/23501775
tags question: http://stackoverflow.com/q/23517937
tags question: http://stackoverflow.com/q/23486935
tags question: http://stackoverflow.com/q/23552785
tags question: http://stackoverflow.com/q/23493764
tags question: http://stackoverflow.com/q/23561149
tags question: http://stackoverflow.com/q/23456813
tags question: http://stackoverflow.com/q/23524949
tags question: http://stackoverflow.com/q/23506516
tags question: http://stackoverflow.com/q/23583048
tags question: http://stackoverflow.com/q/23469019
tags question: http://stackoverflow.com/q/23457091
tags question: http://stackoverflow.com/q/23485845
tags question: http://stackoverflow.com/q/23589250
tags question: http://stackoverflow.com/q/23598288
tags question: http://stackoverflow.com/q/23530773
tags question: http://stackoverflow.com/q/23550792
tags question: http://stackoverflow.com/q/23507535
tags question: http://stackoverflow.com/q/23588957
tags question: http://stackoverflow.com/q/23455101
tags question: http://stackoverflow.com/q/23504719
tags question: http://stackoverflow.com/q/23596100
tags question: http://stackoverflow.com/q/23456052
tags question: http://stackoverflow.com/q/23495050
tags question: http://stackoverflow.com/q/23590378
tags question: http://stackoverflow.com/q/23586263
tags question: http://stackoverflow.com/q/23614086
tags question: http://stackoverflow.com/q/23502230
tags question: http://stackoverflow.com/q/23455433
tags question: http://stackoverflow.com/q/23490671
tags question: http://stackoverflow.com/q/23610915
tags question: http://stackoverflow.com/q/23520506
tags question: http://stackoverflow.com/q/23585392
tags question: http://stackoverflow.com/q/23498313
tags question: http://stackoverflow.com/q/23521740
tags question: http://stackoverflow.com/q/23457290
tags question: http://stackoverflow.com/q/23603422

http://stackoverflow.com/a/23522048
type: Answer
has body: Try this: public long dotProduct(int [] a, int [] b) { if (a == null) throw new IllegalArgumentException("a array cannot be null"); if (b == null) throw new IllegalArgumentException("b array cannot be null"); if (a.length != b.length) throw new IllegalArgumentException("arrays must have equal lengths"); long sum = 0L; for (int i = 0; i &lt; a.length; i++) { sum += a[i]*b[i]; } return sum; }
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/23521967
downvote count: 0

http://stackoverflow.com/comment/36125226
comment on: http://stackoverflow.com/q/23546178
score: 5
has text: It's not as simple as "setting the number of threads" - *you* have to work out what each of those threads has to do, and give it a task. I would suggest you start learning about threading in general - and ideally the higher-level abstractions rather than just `Task` - and go from there.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/23491702
has body: You need to edit java security policy file add bauntycasle provider to policy file located in jdk/bin/lib directory
upvote count: 1
answers question: http://stackoverflow.com/q/23491366
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/36101718
type: AnswerComment
has text: Mapping the client ID is like the `MCAUSER` setting mentioned in the answer but uses `CHLAUTH` rules to dynamically map to or from any number of values. Also, if WMQ Explorer is used be sure to install [SupportPac MS0P](http://ibm.co/SupptPacMS0P) and enable authorization events. This tells you the API call that failed, the object involved, the user ID making the call and the exact options used. This helps to debug auths errors so you know, for example, that it is the `OPEN` and not the `CONNECT` that failed or vice versa.
score: 0
comment on: http://stackoverflow.com/a/23527100
type: Comment

http://stackoverflow.com/q/23455449
answer count: 1
has answer: http://stackoverflow.com/a/23455542
tagged with: android
has comment: http://stackoverflow.com/comment/35955880
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23455542
tagged with: onclicklistener
tagged with: java
has comment: http://stackoverflow.com/comment/35955858
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/35978014
has body: I have some codes that I need help with. My plan for this code is simple. I have 3 buttons which are the yellowBar, greenBar and redBar. I also have 3 images that is colored yellow, green and red. What I wanted to do is when I start my app, the images I have will randomly pop out and whichever color comes out, I should be able to click the button with the corresponding color. I also have a time, so basically I want to click correctly as much as possible, but my code only runs it one time. my time continues to go down but this code only runs one time. How can I fix this so that it will continue to pop random color images until the time runs out? while(gameTime &gt; 0){ colorNum = new Random(); colorNumber = colorNum.nextInt(2); switch (colorNumber){ case 0: colors.setDisplayedChild(0); break; case 1: colors.setDisplayedChild(1); break; case 2: colors.setDisplayedChild(2); break; } colors.setVisibility(View.VISIBLE); yellowBar.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ if(colorNumber == 0){ points ++; score.setText(String.valueOf(points)); } } }); greenBar.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ if(colorNumber == 1){ points ++; score.setText(String.valueOf(points)); } } }); redBar.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ if(colorNumber == 2){ points++; score.setText(String.valueOf(points)); } } }); }
score: 0
has title: Nested onClick Listener

http://stackoverflow.com/a/23460984
answers question: http://stackoverflow.com/q/23454221
score: 1
downvote count: 0
has body: To update the label you just need to call label.setText, as you do. If you want to do it when the score is changed, the simplest approach is just to call label.setText in displayScore or in SetScore (the normal Java name would be setScore). This doesn't fit into MVP pattern, but I don't see it in your code anyway.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/35998746
score: 0
has text: @C.B. sorry, iv added the loops to the code
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/23478096

http://stackoverflow.com/q/23536856
has comment: http://stackoverflow.com/comment/36108407
has body: So I've built a small Google Glass application using the GDK which basically fakes a push notification by opening a Thread in the background and polling a RESTful webservice every few seconds. Currently when I open the application it loads and runs the service but the onStart() and onCreate() for the activity (where the Thread is) doesn't get called until the user interacts with the app by opening the menu. I've never done Android development before so I don't know why my activity might not be loading as soon as the user starts the app. Here's an overview of some of the code. public class MainActivity extends Activity { @Override protected void onStart() { super.onStart(); startThread(); } Then the actual thread (I know it's terrible it's a prototype :-P) public void startThread() { thread = new Thread() { @Override public void run() { try { while(true) { sleep(5000); boolean tmp = poll(); } } catch (InterruptedException e) { e.printStackTrace(); } } }; thread.start(); } And the Android Manifest &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.testpack" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="15" android:targetSdkVersion="15" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/logo_box" android:label="Test"&gt; &lt;uses-library android:name="com.google.android.glass" android:required="true" /&gt; &lt;activity android:name="com.testpack.MainActivity" android:theme="@style/MenuTheme" android:enabled="true"/&gt; &lt;service android:name="com.testpack.MainService" android:label="@string/app_name" android:icon="@drawable/logo_box" android:enabled="true"&gt; &lt;intent-filter&gt; &lt;action android:name="com.google.android.glass.action.VOICE_TRIGGER" /&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="com.google.android.glass.VoiceTrigger" android:resource="@xml/hello_show" /&gt; &lt;/service&gt; &lt;/application&gt; &lt;uses-permission android:name="android.pe…
has comment: http://stackoverflow.com/comment/36114005
has comment: http://stackoverflow.com/comment/36109898
has comment: http://stackoverflow.com/comment/36108718
has answer: http://stackoverflow.com/a/23547735
has comment: http://stackoverflow.com/comment/36108496
answer count: 1
downvote count: 0
favorite count: 0
tagged with: google-glass
has comment: http://stackoverflow.com/comment/36123922
tagged with: android
has title: How do I start a Thread as soon as my Google Glass application starts?
accepted answer: http://stackoverflow.com/a/23547735
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/36109358
tagged with: google-gdk
has comment: http://stackoverflow.com/comment/36112712
has comment: http://stackoverflow.com/comment/36116367
type: Question
score: 3

http://stackoverflow.com/comment/36025457
type: QuestionComment
score: 1
has text: one quick question.. Is this code working?
comment on: http://stackoverflow.com/q/23492493
type: Comment

http://stackoverflow.com/a/23508480
has body: A good practice is to place test classes in the same package as the source Java classes so that they have visibility of each another. For example, in Maven, you would have src/main/java, and src/test/java to contain the source Java classes and test classes respectively. These are standard Maven layouts. Say i have a source Java class MyService.java in net/java/service: src/main/java/net/java/service/MyService.java Then i should place the corresponding test class MyServiceTest.java in net/java/service too: src/test/java/net/java/service/MyService.java Assume you have the following public method in MyService.java: public void multiDiv(){ ... } Then you should have the following test method in MyServiceTest.java: @Test public void testMultiDiv(){ MyService service = new MyService(); service.multiDiv(); // assert .... }
answers question: http://stackoverflow.com/q/23506946
score: 0
type: Answer

http://stackoverflow.com/q/23495990
answer count: 3
linked to: http://stackoverflow.com/q/306806
tagged with: postgresql
linked to: http://stackoverflow.com/q/18077327
tagged with: spring
has answer: http://stackoverflow.com/a/23500669
has answer: http://stackoverflow.com/a/23496191
has comment: http://stackoverflow.com/comment/36032319
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/36032309
linked to: http://stackoverflow.com/q/18389124
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/23496132
has comment: http://stackoverflow.com/comment/36031253
has answer: http://stackoverflow.com/a/23496132
type: Question
linked to: http://stackoverflow.com/q/15815372
accepted answer: http://stackoverflow.com/a/23496191
has title: How create the database through Hibernate
has comment: http://stackoverflow.com/comment/36031145
has comment: http://stackoverflow.com/comment/36031241
has body: In my spring project, i am using Hibernate to export my entity classes to a previously created database. But this will require the final user knows how to create a database in the Database manager system (Currently I am using Postgresql). Is there any way of, given only the machine where the postgresql is installed (and the username and password, which is provided when the application is runned the first time), the Hibernate create a new database in the server if it doesn't exist?
score: 0

http://stackoverflow.com/comment/46740172
score: 0
type: Comment
type: QuestionComment
has text: I found that being usb debug connected to Eclipse caused connection problems for Kryonet.
comment on: http://stackoverflow.com/q/23549426

http://stackoverflow.com/comment/35985590
type: Comment
has text: if you maintain proper directory structure between machines (win-dev, linux-compile), there should not be any problems. Can you gives us more information about what eclipse IDE complains?
score: 1
comment on: http://stackoverflow.com/q/23471546
type: QuestionComment