dagger
tags question: http://stackoverflow.com/q/22445724
tags question: http://stackoverflow.com/q/22388978
tag name: dagger
type: Tag
tags question: http://stackoverflow.com/q/22415886

http://stackoverflow.com/a/22415344
has comment: http://stackoverflow.com/comment/34092745
has comment: http://stackoverflow.com/comment/34083872
upvote count: 1
answers question: http://stackoverflow.com/q/22415244
type: Answer
downvote count: 0
score: 1
has body: Replace this line numbers[i-1]=numbers[i-1]+1; with numbers[list[i] - 1] = numbers[list[i] - 1] + 1; Now it will update the count of correct element.

http://stackoverflow.com/comment/34148754
score: 0
type: Comment
has text: Right. It is a new instance of Random() but is assigned to "old" randomGenerator =). The setSeed() function is much nicer, i have forget this one.
comment on: http://stackoverflow.com/a/22452408
type: AnswerComment

http://stackoverflow.com/a/22424024
has body: you could use Date.getTime(), here's an example: public final static long MILLIS_PER_DAY = 24 * 60 * 60 * 1000L; public static void main(String args[]) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date1 = sdf.parse("2009-12-31"); Date date2 = sdf.parse("2010-01-31"); boolean moreThanDay = Math.abs(date1.getTime() - date2.getTime()) &gt; MILLIS_PER_DAY; System.out.println(moreThanDay); }
accepted answer of: http://stackoverflow.com/q/22423961
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 15
upvote count: 15
answers question: http://stackoverflow.com/q/22423961
has comment: http://stackoverflow.com/comment/96147451

http://stackoverflow.com/q/22412035
possible better answer: http://stackoverflow.com/a/22412171
has answer: http://stackoverflow.com/a/22412699
has answer: http://stackoverflow.com/a/22412171
answer count: 3
accepted answer: http://stackoverflow.com/a/22412699
has answer: http://stackoverflow.com/a/22412182
tagged with: string
has comment: http://stackoverflow.com/comment/34077857
has title: Count the Number of String Matches
score: 0
tagged with: regex
has body: I want to get the smallest match of strings in the list. Though I'm successful doing so but the problem is i want to count that how many match counts have been made so: List&lt;String&gt; mylist=new LinkedList&lt;String&gt;(); Set&lt;String&gt; result=new LinkedHashSet&lt;String&gt;(); mylist.add("interpreter"); mylist.add("interprete"); mylist.add("interpret"); mylist.add("developed"); mylist.add("develops"); mylist.add("develop"); mylist.add("interpret"); String small=""; Collections.sort(mylist); Collections.reverse(mylist); for(int i=0;i&lt;mylist.size();i++) { small=mylist.get(i); for(int j=i;j&lt;mylist.size();j++) { if(small.contains(mylist.get(j))) { small=mylist.get(j); } } result.add(small); } for (String string : result) { System.out.println(string); } So that the output should be: interpret=4 develop=4 Problem occurs with the following code i am trying: List&lt;String&gt; mylist=new LinkedList&lt;String&gt;(); Set&lt;String&gt; result=new LinkedHashSet&lt;String&gt;(); mylist.add("interpreter"); mylist.add("interprete"); mylist.add("interpret"); mylist.add("developed"); mylist.add("develops"); mylist.add("develop"); mylist.add("interpret"); mylist.add("crawler"); mylist.add("crawl"); mylist.add("mobile"); mylist.add("mob"); mylist.add("juni"); mylist.add("junis"); Collections.sort(mylist); Collections.reverse(mylist); String small=""; int c=0; for(int i=0;i&lt;mylist.size();i++) { c+=1; small=mylist.get(i); for(int j=i;j&lt;mylist.size();j++) { if(small.contains(mylist.get(j))) { small=mylist.get(j); c+=1; } } result.add(small); } for (String string : result) { System.out.println(string+"="+c); } can somebody help me please!
tagged with: match
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22413668
accepted answer: http://stackoverflow.com/a/22414179
has title: My java program is giving me 99 wrong errors
has comment: http://stackoverflow.com/comment/34080432
score: 0
tagged with: java
tagged with: error-handling
answer count: 1
has comment: http://stackoverflow.com/comment/34080665
has comment: http://stackoverflow.com/comment/34080536
has comment: http://stackoverflow.com/comment/34080581
has answer: http://stackoverflow.com/a/22414179
has comment: http://stackoverflow.com/comment/34080895
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34080313
tagged with: compiler-errors
has body: I am fairly new to programming.I am currently studying java in my first year of college.I was given a group java project.My part of the project is giving me 96 different errors but none of the errors given actually are wrong.The project takes in between 1 and 7 command line arguments. It then does different things depending on what was entered.It overall analyses different parts of a file that represents the Lotto.I compile my program with the command line.I can post all of the errors if it is requested.First off here is my entire code but I had to take out a method so that it would fit in one post.The method I took out is error free as I have that checked already.It was the arguments method. import javax.swing.JOptionPane; import java.util.*; import java.io.*; import java.text.*; import java.lang.*; public class Text1 { public static final String filename = "SampleLottoData.txt"; public static void main(String [] args) throws IOException, ParseException, AssertionError { File Numbers = new File(filename); Scanner in = new Scanner(Numbers); if(Numers.exists()) { ArgumentCheck(args); if(args.length &lt;= 5) int choice = Integer.parseInt(args[0]); if (args.length &gt;= 2 &amp;&amp; args.length &lt;= 5) String drawtype = args[1].toUpperCase(); if(args.length &gt;= 3 %% args.length &lt;= 5) int day = Integer.parseInt(args[2]); if(args.length == 4) int year = Integer.parseInt(args[3]); if(args.length == 1) JackpotOrBonus(args,in,choice); else if(args.length == 2) TypeOfDraw(args,in,choice,drawtype); else if(args.length == 3) DrawOnADay(args,in,choice,drawtype,day); else if(args.length == 4) DrawForAYear(args,in,choice,drawtype,day,year); else if(args.length == 5) BetweenTwoDates(args,in,choice,drawtype,day); } else JOptionPane.showMessageDialog(null,"The file " + filename + " doesn't exist"); } public static void JackpotOrBonus(String [] args,Scanner in,int choice) throws IOException { int [] jackpotnumbers = new int[45], int [] bonusnumbers = new int[45], int [] jackpot…
type: Question
has comment: http://stackoverflow.com/comment/34080571
has comment: http://stackoverflow.com/comment/34080498
has comment: http://stackoverflow.com/comment/34081000

http://stackoverflow.com/comment/33935946
has text: I re-formatted your input.txt file contents to be more readable but I wasn't sure if each pair of data (flight type & miles traveled) should be on a new line or not. Please update accordingly.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22330471
type: QuestionComment

http://stackoverflow.com/comment/34130147
score: 0
type: Comment
has text: you need to do this : `(a + b + c)%mod = a%mod + b%mod + c%mod` and also , since `a*b` can be out of integer range . `(a*b)%mod = (a%mod * b%mod ) %mod` . I thought you were familiar with it , so didn't included it in answer . Also for `a*b` use `long long` .
comment on: http://stackoverflow.com/a/22441445
type: AnswerComment

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

http://stackoverflow.com/comment/34169101
type: AnswerComment
comment on: http://stackoverflow.com/a/22463867
type: Comment
score: 0
has text: Sorry I didn't get it. Please can you explain more about *but you are throwing them away after that.*

http://stackoverflow.com/q/22390653
accepted answer: http://stackoverflow.com/a/22394339
type: Question
tagged with: cdata
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
score: 0
tagged with: java
tagged with: dom
has body: been scratching my head for a while here... So I have a Java application. In this application I need to read an XML file, get the Character Data from an element, pass it into a new DOM Document, change some of the elements, and convert the new Document back into CDATA, reattach it to the original message and send it off. So... Here is the message I need to read in, and the function which reads it in: private static String getCharacterDataFromElement(Node e) { Node child = e.getFirstChild(); if (child instanceof CharacterData) { CharacterData cd = (CharacterData) child; System.out.println(cd.getBaseURI()); System.out.println(cd.getData()); return cd.getBaseURI(); } return "error..."; } And here is the xml file which needs to be changed <RLSOLVE_MSG version="5.0"> <SOURCE_ID>DP01</SOURCE_ID> <TRANS_NUM>000001</TRANS_NUM> <POI_MSG type="interaction"> <AUTH_CODE>06130</AUTH_CODE> <CARD_SCHEME>VISA</CARD_SCHEME> <CURRENCY_CODE>GBP</CURRENCY_CODE> <CUSTOMER_PRESENCE>internet</CUSTOMER_PRESENCE> <FINAL_AMOUNT>1.00</FINAL_AMOUNT> <MERCHANT_NUMBER>8888888</MERCHANT_NUMBER> <PAN_NUMBER>454420******0382</PAN_NUMBER> <PAN_EXPIRY>12/15</PAN_EXPIRY> <TERMINAL_ID>04176421</TERMINAL_ID> 454420bbbbbkqrm0382 <TOTAL_AMOUNT>1.00</TOTAL_AMOUNT> <TRANSACTION_DATA_SOURCE>keyed</TRANSACTION_DATA_SOURCE> <TRANSACTION_DATE>14/02/2014</TRANSACTION_DATE> <TRANSACTION_NUMBER>000001</TRANSACTION_NUMBER> <TRANSACTION_RESPONSE>06130</TRANSACTION_RESPONSE> <TRANSACTION_TIME>17:13:17</TRANSACTION_TIME> <TRANSACTION_TYPE>purchase</TRANSACTION_TYPE> <VERIFICATION_METHOD>unknown</VERIFICATION_METHOD> false </POI_MSG> </RLSOLVE_MSG> When cd.getData() is executed, it returns "\n \t \t \t \t" Aaaany ideas?
has answer: http://stackoverflow.com/a/22394339
has comment: http://stackoverflow.com/comment/34042437
has title: Bug reading CDATA from xml element in Java
has comment: http://stackoverflow.com/comment/34041009
type: AnsweredQuestion

http://stackoverflow.com/comment/34147102
comment on: http://stackoverflow.com/q/22451382
type: Comment
type: QuestionComment
has text: Are you sure the cardinality of the relationship is one to many? It sounds like it is modeled as a many to many in the database. Couldn't a user attend more than one event?
score: 0

http://stackoverflow.com/q/22439352
tagged with: java
upvote count: 1
downvote count: 1
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/22439424
has title: Generic Spring services from external library?
has body: I'd like to define some commonly used or generic service classes that should be used/shared by different projects. These common services should already make use of @Transactional, @Autowired and other Spring related stuff. So, I somehow have to define a spring context for these services to work. Is it possible to put these services in a single external jar library that can then be used/imported by other (child)-projects? How could I create such a "personal framework"?
answer count: 1
favorite count: 0
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22439424

http://stackoverflow.com/comment/34051101
type: Comment
score: 0
has text: @T8Z added more details
type: AnswerComment
comment on: http://stackoverflow.com/a/22396591

http://stackoverflow.com/comment/34192729
score: 0
comment on: http://stackoverflow.com/q/22475737
type: Comment
type: QuestionComment
has text: what's about http://www.javarepl.com ?

http://stackoverflow.com/a/22402489
has comment: http://stackoverflow.com/comment/34068933
type: Answer
has comment: http://stackoverflow.com/comment/34068082
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/22402237
upvote count: 6
has comment: http://stackoverflow.com/comment/34061825
has comment: http://stackoverflow.com/comment/34075403
accepted answer of: http://stackoverflow.com/q/22402237
has body: From Effective Java: Make all fields final. This clearly expresses your intent in a manner that is enforced by the system. Also, it is necessary to ensure correct behavior if a reference to a newly created instance is passed from one thread to another without synchronization, as spelled out in the memory model.
type: AcceptedAnswer

http://stackoverflow.com/a/22454237
accepted answer of: http://stackoverflow.com/q/22453755
upvote count: 6
has body: You can remove elements from the Queue until you reach the needed one. You can re-add the removed elements at the end of the queue or put them in a different queue (and add the rest after you reached the needed element). You really shouldn't be using a Queue like that, though! public static &lt;T&gt; T get(Queue&lt;T&gt; queue, int index) { synchronized (queue) { if (queue == null) { return null; } int size = queue.size(); if (index &lt; 0 || size &lt; index + 1) { return null; } T element = null; for (int i = 0; i &lt; size; i++) { if (i == index) { element = queue.remove(); } else { queue.add(queue.remove()); } } return element; } }
answers question: http://stackoverflow.com/q/22453755
downvote count: 0
type: AcceptedAnswer
type: Answer
score: 6

http://stackoverflow.com/comment/34001760
type: AnswerComment
comment on: http://stackoverflow.com/a/22368183
type: Comment
has text: Are you using any IDE like NetBeans or Eclipse ?
score: 0

http://stackoverflow.com/a/22427371
answers question: http://stackoverflow.com/q/22427302
has body: How are you packaging your application? You could try with maven-assembly-plugin for packaging, there is a descriptor called jar-with-dependencies which adds them to the final artifact, you then call mvn package.
score: 0
type: Answer

http://stackoverflow.com/comment/34058774
type: QuestionComment
has text: Even I have developed a speech to text application using which user can dial the call directly by saying a name from his contact list...application will dial the call for user by taking input as name of the person to call...I will try this thing there and let you know if it works...but i feel there is no issue and should surely work.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22400462

http://stackoverflow.com/comment/33976294
type: QuestionComment
has text: Multiply the vector formed by the mouse coordinates with the inverse of the transformation matrix and see if the result would have been in the original red square (i.e. before you transformed it).
score: 2
comment on: http://stackoverflow.com/q/22353784
type: Comment

http://stackoverflow.com/comment/35568826
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22503750
has text: Could you explain why do we need to remove the header?
score: 0

http://stackoverflow.com/comment/34148285
type: Comment
comment on: http://stackoverflow.com/a/22416682
type: AnswerComment
has text: I'm not sure this is necessarily the ideal solution for every project and going forward (some files like the copyright info might be useful for teams to keep in a VCS) but I think it's the best solution for me, now, so I'm marking it as accepted. Thanks!
score: 1

http://stackoverflow.com/q/22343522
answer count: 1
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has title: How to execute a http request without opening browser in java?
has comment: http://stackoverflow.com/comment/33958669
tagged with: java
type: Question
upvote count: 0
score: -2
has body: I have executed the requests using Runtime.getRuntime().exec() method. But my tool requires that I have to execute the request without opening the browser. Please help. Thanks!
has answer: http://stackoverflow.com/a/22343604
has comment: http://stackoverflow.com/comment/33958522
has comment: http://stackoverflow.com/comment/33958527

http://stackoverflow.com/q/22417456
score: 1
has body: Within Java I have this string: uk\learningAid\UserInputs\UserClass.java:16: error: cannot find symbol player.mvRight(3); I am currently using this regex to match 16 and cannot find symbol: Pattern pattern = Pattern.compile(":(\\d+):\\serror:\\s(.*)"); However, I want to also match player.mvRight(3); which is on a new line. How do I do this? I tried adding this \\n(.*) at the end of the reex, but it failed to match anything.
favorite count: 0
has comment: http://stackoverflow.com/comment/35838612
type: Question
answer count: 2
tagged with: regex
has comment: http://stackoverflow.com/comment/34087137
has answer: http://stackoverflow.com/a/22417711
has comment: http://stackoverflow.com/comment/34087536
has answer: http://stackoverflow.com/a/22417771
tagged with: java
upvote count: 1
has title: Match string after newline
has comment: http://stackoverflow.com/comment/34087869
has comment: http://stackoverflow.com/comment/34087076
tagged with: newline
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34087393
has comment: http://stackoverflow.com/comment/34086996
downvote count: 0

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/22377730
tags question: http://stackoverflow.com/q/22399759
tags question: http://stackoverflow.com/q/22371799
tags question: http://stackoverflow.com/q/22404489
tags question: http://stackoverflow.com/q/22447540
tag name: jfreechart
tags question: http://stackoverflow.com/q/22344048

http://stackoverflow.com/comment/33978477
comment on: http://stackoverflow.com/a/22355062
type: Comment
has text: Darn. I knew I needed another pair of eyes. Good catch and thank you so much!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33999392
has text: You should use [`Process.getInputStream()`](http://docs.oracle.com/javase/7/docs/api/java/lang/Process.html#getInputStream()). You need to read from both sysout and err for the process in two separate threads otherwise their buffers can fill up and the process will block. [This](http://www.javaworld.com/article/2071275/core-java/when-runtime-exec---won-t.html) is an excellent article on running external processes from Java. Personally I would use [Apache commons exec](http://commons.apache.org/proper/commons-exec/) to save yourself some pain.
score: 0
comment on: http://stackoverflow.com/q/22366589
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34169385
has text: well its there i just have trouble filtering all my code finding whats important to include
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22463982

http://stackoverflow.com/a/22381867
has body: person[] pl = new person[10]; will create an array of length 10 with all elements being null. Thus, if you don't initialize all 10 elements your print() method will eventually throw a NullPointerException. You seem to only call add(p) once, i.e. you only intialize element at index 0 to a non-null value and thus when j reaches value/index 1, person[j] will be null. To fix this you should change your loop to for(int j=0;j&lt;i;j++), assuming that print() is a method of class personList (your posts formatting makes it hard to determine). A few side notes: Please check the Java coding conventions and stick to them, since that will make it easier for others to read your code (and it will probably even help you). At least stick to the convention on class names which should be camel case and start with an upper case letter, e.g. PersonList not personList. Instead of using an array and a counter, e.g. Person[] and i, it would be better to use a list or some other collection, e.g. List&lt;Person&gt;. That way the loop could become for( Person p : pl) { p.print() } and you'd also not be restricted to 10 elements.
type: Answer
has comment: http://stackoverflow.com/comment/34025984
upvote count: 2
has comment: http://stackoverflow.com/comment/34025602
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22381789

http://stackoverflow.com/a/22391384
answers question: http://stackoverflow.com/q/22391350
has comment: http://stackoverflow.com/comment/34041760
has comment: http://stackoverflow.com/comment/34047389
downvote count: 0
has comment: http://stackoverflow.com/comment/34041570
type: Answer
has comment: http://stackoverflow.com/comment/34041849
has comment: http://stackoverflow.com/comment/34041605
upvote count: 16
has comment: http://stackoverflow.com/comment/34041685
has comment: http://stackoverflow.com/comment/34041773
score: 16
has body: Use java.util.TreeSet as the actual object. When you iterate over this collection, the values come back in a well-defined order. If you use java.util.HashSet then the order depends on an internal hash function which is almost certainly not lexicographic (based on content).

http://stackoverflow.com/q/22461663
has comment: http://stackoverflow.com/comment/34164994
has answer: http://stackoverflow.com/a/22461914
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/34509877
has answer: http://stackoverflow.com/a/22461730
has answer: http://stackoverflow.com/a/42242813
has answer: http://stackoverflow.com/a/60403742
has answer: http://stackoverflow.com/a/47265988
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am converting InputStream to JSONObject using following code. My question is, is there any simple way to convert InputStream to JSONObject. Without doing InputStream -> BufferedReader -> StringBuilder -> loop -> JSONObject.toString(). InputStream inputStreamObject = PositionKeeperRequestTest.class.getResourceAsStream(jsonFileName); BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStreamObject, "UTF-8")); StringBuilder responseStrBuilder = new StringBuilder(); String inputStr; while ((inputStr = streamReader.readLine()) != null) responseStrBuilder.append(inputStr); JSONObject jsonObject = new JSONObject(responseStrBuilder.toString());
has answer: http://stackoverflow.com/a/25136732
has answer: http://stackoverflow.com/a/63285937
tagged with: inputstream
has answer: http://stackoverflow.com/a/50122877
type: Question
has answer: http://stackoverflow.com/a/32526861
has title: Convert InputStream to JSONObject
upvote count: 55
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/68821590
has answer: http://stackoverflow.com/a/22463078
answer count: 14
has answer: http://stackoverflow.com/a/22461846
score: 55
tagged with: android
has answer: http://stackoverflow.com/a/58091646

http://stackoverflow.com/q/22417184
has body: I'm trying to write a program that checks a user supploed sentence and converts it to Pig Latin. I'm trying to have the program check to see if the first letter is a vowel or not and return that using a boolean expression. Next I'm trying to get the program to cut off the first letter from the word and add it to the end of the word. Finally its supposed to add way if it is a vowel and ay if it not a vowel. Any help or advice will be greatly appreciated. public class PigLatin { public static void main(String[] argv) { if (argv.length &gt; 0) { for (int i = 0; i &lt; argv.length; i++) { char firstLetter = aStringVariable.charAt(0); } } public static boolean isVowel(char c) { char[] vowels = new char[] {'a', 'e', 'i', 'o', 'u', 'y'}; for(int i = 0; i &lt; vowels.length; i++) { if(Character.toString(vowels[i]).equalsIgnoreCase(Character.toString(c))) { return true; } } return false; } public static String makePigLatin(boolean vowel, String word) { String everythingButTheFirstLetter = word.substring(1); String n = everythingButTheFirstLetter + firstLetter; if (true) { System.out.println(n + "way"); } if (false) { System.out.println(n + "ay"); } } }
has comment: http://stackoverflow.com/comment/34086555
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34086968
has answer: http://stackoverflow.com/a/22417631
has answer: http://stackoverflow.com/a/46324927
has comment: http://stackoverflow.com/comment/34086669
has comment: http://stackoverflow.com/comment/34087119
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/34087143
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34087129
type: Question
has comment: http://stackoverflow.com/comment/34086787
has title: How to translate English into PigLatin with java (using boolean and string)
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/34086769
answer count: 2
favorite count: 0

http://stackoverflow.com/a/22456833
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22456636
type: Answer
has body: That method puts the "currently executing thread to sleep". It should not be called against an instance that way. http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#sleep%28long%29
downvote count: 0

http://stackoverflow.com/comment/34183642
type: QuestionComment
has text: @Youngistan I see no insert or update sql, the last query it shows before throwing the exception is: `Hibernate: select next_val as id_val from hibernate_sequence for update`
comment on: http://stackoverflow.com/q/22472292
score: 1
type: Comment

http://stackoverflow.com/a/22369906
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22368909
upvote count: 9
score: 9
has comment: http://stackoverflow.com/comment/93580718
has body: Some possibilities come to mind (OTOH, I haven't seen people actually saying that, so they might mean something else): No pattern matching. No equivalent to Scala's fold or Haskell's fromMaybe: you have to do optional.map(...).orElseGet(...) instead. No monadic syntax. I also wouldn't call any of these "less powerful" myself, since you can express everything you can with the corresponding Scala/Haskell types; these are all conciseness/usability concerns.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22368909

http://stackoverflow.com/comment/106289976
comment on: http://stackoverflow.com/q/22340335
score: 1
type: Comment
type: QuestionComment
has text: Check on sniffer if java is using http1.0 or http1.1. Also check if java is GZIP. Why is c# login each time? Is the connection closing? HTTP uses TCP as the transport layer. The TCP may show a [FIN] which is an indciation the connection closed. You can also use from cmd.exe >Netstat -a to verify the status of the connection to see if it closed.

http://stackoverflow.com/q/22475018
tagged with: java
has comment: http://stackoverflow.com/comment/34188208
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22475094
accepted answer: http://stackoverflow.com/a/22475094
has body: My actual condition in integers is int d = 1; while(true) { if(((e*d)%f)==1) { break; } else d++; } I have written this condition in BigInteger as while(true) { if(((e.multiply(d)).mod(f)).equals(1)) { break; } else d=d.add(BigInteger.ONE); } When I execute the above code in BigInteger, it executes infinitely. But, when I execute the code in integers, it executes perfectly and comes out of the loop. Please tell me what the error is.
has comment: http://stackoverflow.com/comment/34188009
has comment: http://stackoverflow.com/comment/34187905
type: AnsweredQuestion
tagged with: biginteger
has comment: http://stackoverflow.com/comment/34188370
type: Question
has title: Code sample loops indefinitely when using BigIntegers, but works with integers

http://stackoverflow.com/comment/34032845
type: QuestionComment
comment on: http://stackoverflow.com/q/22386495
type: Comment
has text: Looks like a duplicate questions.. http://stackoverflow.com/questions/2573836/how-do-i-find-out-the-jdk-version-eclipse-is-using
score: 0

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

spring
tags question: http://stackoverflow.com/q/22337323
tags question: http://stackoverflow.com/q/22442067
tags question: http://stackoverflow.com/q/22468236
tags question: http://stackoverflow.com/q/22389154
tags question: http://stackoverflow.com/q/22409223
tags question: http://stackoverflow.com/q/22454463
tags question: http://stackoverflow.com/q/22452426
tags question: http://stackoverflow.com/q/22357931
tags question: http://stackoverflow.com/q/22338176
tags question: http://stackoverflow.com/q/22479715
tags question: http://stackoverflow.com/q/22410834
tags question: http://stackoverflow.com/q/22341841
tags question: http://stackoverflow.com/q/22388501
tags question: http://stackoverflow.com/q/22391064
tags question: http://stackoverflow.com/q/22458627
tags question: http://stackoverflow.com/q/22479100
tags question: http://stackoverflow.com/q/22482251
tags question: http://stackoverflow.com/q/22383624
tags question: http://stackoverflow.com/q/22487295
tags question: http://stackoverflow.com/q/22416074
tags question: http://stackoverflow.com/q/22461911
tags question: http://stackoverflow.com/q/22371560
tags question: http://stackoverflow.com/q/22410956
tags question: http://stackoverflow.com/q/22470136
tags question: http://stackoverflow.com/q/22385448
tags question: http://stackoverflow.com/q/22436084
tags question: http://stackoverflow.com/q/22403147
tags question: http://stackoverflow.com/q/22349475
tags question: http://stackoverflow.com/q/22385205
tags question: http://stackoverflow.com/q/22362534
tags question: http://stackoverflow.com/q/22383740
tags question: http://stackoverflow.com/q/22439352
tags question: http://stackoverflow.com/q/22468163
tags question: http://stackoverflow.com/q/22406893
tags question: http://stackoverflow.com/q/22415621
tags question: http://stackoverflow.com/q/22332826
tags question: http://stackoverflow.com/q/22432423
tags question: http://stackoverflow.com/q/22335206
tags question: http://stackoverflow.com/q/22470589
tags question: http://stackoverflow.com/q/22471372
tags question: http://stackoverflow.com/q/22330571
tags question: http://stackoverflow.com/q/22451125
tags question: http://stackoverflow.com/q/22471906
tags question: http://stackoverflow.com/q/22392410
tags question: http://stackoverflow.com/q/22354588
tags question: http://stackoverflow.com/q/22405803
tags question: http://stackoverflow.com/q/22384706
tags question: http://stackoverflow.com/q/22375764
tags question: http://stackoverflow.com/q/22397143
tags question: http://stackoverflow.com/q/22408398
tags question: http://stackoverflow.com/q/22367223
tags question: http://stackoverflow.com/q/22416140
tags question: http://stackoverflow.com/q/22348539
tags question: http://stackoverflow.com/q/22396822
tags question: http://stackoverflow.com/q/22407266
tags question: http://stackoverflow.com/q/22439306
type: Tag
tags question: http://stackoverflow.com/q/22448394
tags question: http://stackoverflow.com/q/22329941
tags question: http://stackoverflow.com/q/22359550
tags question: http://stackoverflow.com/q/22466239
tags question: http://stackoverflow.com/q/22386593
tags question: http://stackoverflow.com/q/22360709
tags question: http://stackoverflow.com/q/22430221
tags question: http://stackoverflow.com/q/22388493
tags question: http://stackoverflow.com/q/22349120
tags question: http://stackoverflow.com/q/22388736
tags question: http://stackoverflow.com/q/22385118
tags question: http://stackoverflow.com/q/22362434
tags question: http://stackoverflow.com/q/22415382
tags question: http://stackoverflow.com/q/22480843
tags question: http://stackoverflow.com/q/22441136
tags question: http://stackoverflow.com/q/22475739
tags question: http://stackoverflow.com/q/22476393
tags question: http://stackoverflow.com/q/22444447
tags question: http://stackoverflow.com/q/22336486
tags question: http://stackoverflow.com/q/22357128
tags question: http://stackoverflow.com/q/22480424
tags question: http://stackoverflow.com/q/22452213
tags question: http://stackoverflow.com/q/22368274

http://stackoverflow.com/comment/34107859
has text: It's not what I'm looking for. It moves all the ImageView and not the image inside it.
comment on: http://stackoverflow.com/a/22427949
type: AnswerComment
score: 0
type: Comment

java
tags question: http://stackoverflow.com/q/22429414
tags question: http://stackoverflow.com/q/22356011
tags question: http://stackoverflow.com/q/22345432
tags question: http://stackoverflow.com/q/22410072
tags question: http://stackoverflow.com/q/22456684
tags question: http://stackoverflow.com/q/22464690
tags question: http://stackoverflow.com/q/22384584
tags question: http://stackoverflow.com/q/22406046
tags question: http://stackoverflow.com/q/22464993
tags question: http://stackoverflow.com/q/22421414
tags question: http://stackoverflow.com/q/22330717
tags question: http://stackoverflow.com/q/22470666
tags question: http://stackoverflow.com/q/22452105
tags question: http://stackoverflow.com/q/22423496
tags question: http://stackoverflow.com/q/22333538
tags question: http://stackoverflow.com/q/22432980
tags question: http://stackoverflow.com/q/22338962
tags question: http://stackoverflow.com/q/22454814
tags question: http://stackoverflow.com/q/22344125
tags question: http://stackoverflow.com/q/22371668
tags question: http://stackoverflow.com/q/22349450
tags question: http://stackoverflow.com/q/22417968
tags question: http://stackoverflow.com/q/22333360
tags question: http://stackoverflow.com/q/22334161
tags question: http://stackoverflow.com/q/22436812
tags question: http://stackoverflow.com/q/22468646
tags question: http://stackoverflow.com/q/22370432
tags question: http://stackoverflow.com/q/22384106
tags question: http://stackoverflow.com/q/22413411
tags question: http://stackoverflow.com/q/22335466
tags question: http://stackoverflow.com/q/22374314
tags question: http://stackoverflow.com/q/22419817
tags question: http://stackoverflow.com/q/22454207
tags question: http://stackoverflow.com/q/22443342
tags question: http://stackoverflow.com/q/22395442
tags question: http://stackoverflow.com/q/22331568
tags question: http://stackoverflow.com/q/22342431
tags question: http://stackoverflow.com/q/22370244
tags question: http://stackoverflow.com/q/22364778
tags question: http://stackoverflow.com/q/22396239
tags question: http://stackoverflow.com/q/22475956
tags question: http://stackoverflow.com/q/22409339
tags question: http://stackoverflow.com/q/22334255
tags question: http://stackoverflow.com/q/22440313
tags question: http://stackoverflow.com/q/22361951
tags question: http://stackoverflow.com/q/22460089
tags question: http://stackoverflow.com/q/22352061
tags question: http://stackoverflow.com/q/22444956
tags question: http://stackoverflow.com/q/22390131
tags question: http://stackoverflow.com/q/22417380
tags question: http://stackoverflow.com/q/22429691
tags question: http://stackoverflow.com/q/22386764
tags question: http://stackoverflow.com/q/22456410
tags question: http://stackoverflow.com/q/22366890
tags question: http://stackoverflow.com/q/22437470
tags question: http://stackoverflow.com/q/22389905
tags question: http://stackoverflow.com/q/22407195
tags question: http://stackoverflow.com/q/22338173
tags question: http://stackoverflow.com/q/22479378
tags question: http://stackoverflow.com/q/22366380
tags question: http://stackoverflow.com/q/22404493
tags question: http://stackoverflow.com/q/22420591
tags question: http://stackoverflow.com/q/22341846
tags question: http://stackoverflow.com/q/22403588
tags question: http://stackoverflow.com/q/22333365
tags question: http://stackoverflow.com/q/22403963
tags question: http://stackoverflow.com/q/22339189
tags question: http://stackoverflow.com/q/22413083
tags question: http://stackoverflow.com/q/22415854
tags question: http://stackoverflow.com/q/22341897
tags question: http://stackoverflow.com/q/22472277
tags question: http://stackoverflow.com/q/22446095
tags question: http://stackoverflow.com/q/22449216
tags question: http://stackoverflow.com/q/22441753
tags question: http://stackoverflow.com/q/22400390
tags question: http://stackoverflow.com/q/22434574
tags question: http://stackoverflow.com/q/22361342
tags question: http://stackoverflow.com/q/22419915
tags question: http://stackoverflow.com/q/22336582
tags question: http://stackoverflow.com/q/22420333

http://stackoverflow.com/comment/34010599
score: 0
type: Comment
type: QuestionComment
has text: @F. Geraerts: Updated the content with web.xml
comment on: http://stackoverflow.com/q/22372741

http://stackoverflow.com/comment/33970374
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22349644
has text: I'm not sure after all it's a good question for SO as the answer would probably be something like *"Well, it seemed a good idea at that time. You know we didn't even think about char encoding, he..."*. Maybe for http://programmers.stackexchange.com/ ?
type: Comment

http://stackoverflow.com/comment/34066116
type: AnswerComment
comment on: http://stackoverflow.com/a/22376315
type: Comment
has text: This solves both issues, the tomcat manager show this servlet as NOT running and it doesnt continue to load the servlet. Thanks
score: 0

http://stackoverflow.com/comment/34092311
type: QuestionComment
comment on: http://stackoverflow.com/q/22420201
score: 0
has text: in the program file in eclipse it says JRE System Library[jre7] and the only jdk i downloaded was version 7
type: Comment

http://stackoverflow.com/a/22426341
type: Answer
accepted answer of: http://stackoverflow.com/q/22426291
has comment: http://stackoverflow.com/comment/34102380
answers question: http://stackoverflow.com/q/22426291
has body: Your approach works if the file is in the working directory of the project (or where you run your ant target from). This is because you are giving the relative file path. Giving the absolute file path should work. If you are trying to read the file from the classpath u should use ClassLoader's getInputStream method.
score: 0
has comment: http://stackoverflow.com/comment/34102690
type: AcceptedAnswer

http://stackoverflow.com/a/22349327
upvote count: 1
answers question: http://stackoverflow.com/q/22348128
type: Answer
downvote count: 0
score: 1
has body: You can use any prefix to represent default namespace, as long as it points to the same uri. Simply add another prefix pointing to default namespace uri (http://september.examples.com/) in the function createContext(), and use it in XPath expression. Related question : https://stackoverflow.com/a/6392700/2998271
has comment: http://stackoverflow.com/comment/33968653

http://stackoverflow.com/comment/34090275
has text: the error is where the new arraylist is populated with randomly picked elements of the 'base' arraylist as I wrote above. I'll add comments in code to make it clearer.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22419123

http://stackoverflow.com/q/22384689
has title: Cassandra, read value of column type map<> using ByteBufferUtil (org.apache.cassandra.utils)
upvote count: 1
answer count: 1
favorite count: 0
tagged with: cassandra
has comment: http://stackoverflow.com/comment/34055946
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I'm developing have Hadoop running on top of Cassandra. It's all running very well, but I have now bumped into a problem I can't find the solution to. One of my columns contains a collection, definition is something similar to: create table productUsage( .... products map, productcategories map )... etc. In my map/reduce map function, I need to read the values from these columns, but can't work out how to convert the column data - which is a byte buffer - into the a usable HashMap variable - the ByteBufferUtil function doesn't seem to help. The map/reduce map code I have that extracts the column values at the moment looks like this... string productid; HashMap products; for (Entry column : columns.entrySet()){ if ("productid".equalsIgnoreCase(column.getKey())){ productid = ByteBufferUtil.string(column.getValue()); } if ("products".equalsIgnoreCase(column.getKey())){ products = ???? //ByteBufferUtil.string(column.getValue()); } } Does anyone have any idea's or can anyone point me in the right direction? Thanks Gerry
type: Question
has comment: http://stackoverflow.com/comment/34145330
has answer: http://stackoverflow.com/a/22459976
accepted answer: http://stackoverflow.com/a/22459976
has comment: http://stackoverflow.com/comment/34076090
tagged with: mapreduce
tagged with: bytebuffer
tagged with: hadoop

http://stackoverflow.com/a/22447201
has comment: http://stackoverflow.com/comment/34140318
downvote count: 0
has comment: http://stackoverflow.com/comment/34140148
has comment: http://stackoverflow.com/comment/34140179
type: Answer
has comment: http://stackoverflow.com/comment/34140166
score: 1
has body: Is there a hello.pdf file in the directory? If not, then you've just created an empty one and it's 0 bytes long.
upvote count: 1
answers question: http://stackoverflow.com/q/22447162

http://stackoverflow.com/q/22441227
tagged with: android
type: AnsweredQuestion
has title: Use array of String Resource IDs with ListAdapter?
has answer: http://stackoverflow.com/a/22441265
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22441265
possible better answer: http://stackoverflow.com/a/22441262
type: Question
has body: I have an array of class "EditableListItem" each containing a string resource id. I want to create a list with the values of all these strings. The problem is that the items on my list end up showing the resource ID instead of the actual string. Class EditableListItem: public class EditableListItem { private int title_id; public EditableListItem(int title_id) { this.title_id = title_id; } //... } My List Activity: // Instantiate the list of samples. EditableListItem[] allItems = new EditableListItem[]{ new EditableListItem(R.string.dialer), new EditableListItem(R.string.clock) }; setListAdapter(new ArrayAdapter&lt;EditableListItem&gt;(this, android.R.layout.simple_list_item_1, android.R.id.text1, allItems)); How can I make my List show the String values instead of their IDs?
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22441262
downvote count: 0
tagged with: listactivity
favorite count: 0

http://stackoverflow.com/comment/37608549
has text: See also http://stackoverflow.com/q/11696521/
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22423677
type: QuestionComment

http://stackoverflow.com/a/22443987
type: Answer
has body: BattleshipBoard bs = new BattleshipBoard(); the above creates an instance called bs by the way i noticed Public when it should be lower case public the next thing is, when you have instance bs instantiated call the method initBoard() such as bs.initBoard() you are telling the instance to call the function into use, the function is initBoard (it is also called method, method/function meh! all the same) also (new) is a keyword designed to allow the creation of a new instance BattleshipBoard() while you didn't explicitly create in the class BattleshipBoard() is automatically generated, it has the same name as the class but is in fact called a constructor method, constructor methods take on the name of the class but can include parameters such as public BattleshipBoard(int width, int height){ } finally, the person above me recommended making it static, static allows a method or field become globally available, this has its pluses and its negatives.
answers question: http://stackoverflow.com/q/22443940
score: 0

http://stackoverflow.com/comment/34109663
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22430278
has text: Receiver Code : count++; inPacket = new DatagramPacket(inBuf, inBuf.length); socket.receive(inPacket); String msg = new String(inBuf, 0, inPacket.getLength()); System.out.println("From " + inPacket.getAddress() + " Msg : " + msg); socket.close(); // Sending TCP apSock = new Socket("131.151.88.165", 6161); System.out.println("Hello2"); respWriter = new PrintWriter(apSock.getOutputStream()); System.out.println("Writing back to the server"); respWriter.println(outBuf); if (respWriter != null) respWriter.close();

http://stackoverflow.com/q/22434012
upvote count: 0
has title: Java convert letter to number in 2D array
has body: I have an array: [[a, b], [c, d], [e, f]] Array value such as a, b, c, d, e and f must be converted to number (integer). Let's say, a = 0, b = 1, c = 2, ..., f = 5. So, the result of converting should be: [[0, 1], [2, 3], [4, 5]] How to do that in Java?
has answer: http://stackoverflow.com/a/22434115
tagged with: integer
favorite count: 0
tagged with: multidimensional-array
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/22434104
has comment: http://stackoverflow.com/comment/34116006
has answer: http://stackoverflow.com/a/22434110
answer count: 4
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/34116202
has answer: http://stackoverflow.com/a/22434125
type: Question

http://stackoverflow.com/q/22330866
has body: I am building a DAQ in a Java based Platform called KMax. This platform, has a design interface to use objects like histograms. Each histogram has a name, which is declared on the design interface. To call the histogram in the code you have to use hist = tlsh.getKmaxHist("DATA"); The string DATA is the name that the user gives in the design interface and hist is the variable that refers to the object. Every histogram object has certain classes it can use. For instance hist.getSum() gives the total sum of the histogram. In my DAQ I have many histograms. My plan is to create a slider box that will pick the histogram, that the user wants to apply some functions(such as getSum()). The slider box has a class(string getProperty("VALUE")) that returns the value that the user has selected. The plan is to use something like sliderBox.getProperty("VALUE").getSum(). Of course something like that is not valid, therefore I was wondering if there is a way to "convert" the string that the getProperty() returns, into a variable already defined in the code.
has comment: http://stackoverflow.com/comment/33936309
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22331107
has answer: http://stackoverflow.com/a/22331334
tagged with: variables
tagged with: string
possible better answer: http://stackoverflow.com/a/22330965
has answer: http://stackoverflow.com/a/22330965
tagged with: converters
answer count: 4
has title: Convert a string into a variable in java
has answer: http://stackoverflow.com/a/22330952
score: 0
accepted answer: http://stackoverflow.com/a/22330952

http://stackoverflow.com/q/22392671
accepted answer: http://stackoverflow.com/a/22393642
has title: ItemRegister Iterator
tagged with: iterator
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34044143
favorite count: 0
tagged with: iteration
has body: I am trying to create an item register to register items inside the rooms. In room class i have a /** * Gets item description */ public ArrayList&lt;Item&gt; getItem() { return items; } and in item register I currently have public class ItemRegister { private HashMap&lt;String,Item&gt; items; /** * Constructor for objects of class ItemRegister */ public ItemRegister() { items = new HashMap&lt;String,Item&gt;(); } /** * register items in hashMap */ public void register(Item a) { items.put(a.getDescription(),a); } public void register(ArrayList&lt;Item&gt; a) { Iterator&lt;Item&gt; i = a.iterator(); while (i.hasNext()) { Room room = i.next(); if (room.getItem() != null &amp;&amp; room.getItem().equals(a)) { } else{ } } } } I am trying to complete the iterator to cycle through room and if it finds an item inside the room it will register it by placing it into hashMap
has comment: http://stackoverflow.com/comment/34044025
has answer: http://stackoverflow.com/a/22393642
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34044375
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34044099

android-fragments
tags question: http://stackoverflow.com/q/22429485
tags question: http://stackoverflow.com/q/22473497
tags question: http://stackoverflow.com/q/22366596
tags question: http://stackoverflow.com/q/22445687
type: Tag
tags question: http://stackoverflow.com/q/22416461
tags question: http://stackoverflow.com/q/22485961
tags question: http://stackoverflow.com/q/22379133
tags question: http://stackoverflow.com/q/22469570
tags question: http://stackoverflow.com/q/22375780
tags question: http://stackoverflow.com/q/22361566
tags question: http://stackoverflow.com/q/22358455
tags question: http://stackoverflow.com/q/22374159
tags question: http://stackoverflow.com/q/22452621
tags question: http://stackoverflow.com/q/22366923
tags question: http://stackoverflow.com/q/22482632
tags question: http://stackoverflow.com/q/22417108
tags question: http://stackoverflow.com/q/22352600
tags question: http://stackoverflow.com/q/22451920
tags question: http://stackoverflow.com/q/22334839
tags question: http://stackoverflow.com/q/22465113
tags question: http://stackoverflow.com/q/22361992
tags question: http://stackoverflow.com/q/22347708
tags question: http://stackoverflow.com/q/22363682
tags question: http://stackoverflow.com/q/22483412
tags question: http://stackoverflow.com/q/22360664
tag name: android-fragments
tags question: http://stackoverflow.com/q/22389933
tags question: http://stackoverflow.com/q/22387769

http://stackoverflow.com/a/22471561
has body: You can call zCard(key) on RedisConnection somehow like this: Long zCard = template.execute(new RedisCallback&lt;Long&gt;() { @Override public Long doInRedis(RedisConnection connection) throws DataAccessException { return connection.zCard(potentiallyExtractBytes(key)); } private byte[] potentiallyExtractBytes(Object key) { return (key instanceof byte[]) ? (byte[]) key : key.toString().getBytes(); } });
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22468640
answers question: http://stackoverflow.com/q/22468640
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/22476499
has body: Unfortunately, it isn't possible to use APNS without a native app on the iOS device. The push notification token is unique for each app on each device - so a token obtained from one app cannot be used with another app on the same device (There is an exception to this, where apps from the same developer can share a token). Further the push notification service relies upon a digital certificate that is managed by the developer using the Apple developer portal. Finally, when a push notification is sent to the iOS device, it is actually delivered to the corresponding app for processing - so if there is no native app on the device, there is nothing to process the notification. You can get the detail on APNS programming in Apple's programming guide
type: Answer
score: 1
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22475503
answers question: http://stackoverflow.com/q/22475503
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34192156
has comment: http://stackoverflow.com/comment/34192076

http://stackoverflow.com/q/22360672
tagged with: swing
has title: JApplet crashing because of a for loop for an Array
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33988329
tagged with: java
has answer: http://stackoverflow.com/a/22365656
type: Question
tagged with: for-loop
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/33988643
score: 0
tagged with: japplet
accepted answer: http://stackoverflow.com/a/22365656
has comment: http://stackoverflow.com/comment/33988600
has body: this is my first post so go easy on me. I'm doing some uni work and im not asking for any help or advice for the whole project. Basically the whole thing does work kinda when i comment out a for loop: for(int i=0;i&lt;words.length;i++) { textArea.append(words[i] + "\n"); } this is designed to work its way through an array but NetBeans keeps telling me to change it into an enhanced for loop but when i do it crashes. The whole program is designed to take an input from a JAplet interface, send it to stringAnalyser in a separate java file, record the length of words and how often words of that length occur, then send them back to the interface and print them onscreen in the centre console. Here are both files i'm using if it helps: package Assignment2; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowListener; import javax.swing.*; import javax.swing.border.BevelBorder; import javax.swing.JPanel; public class GUIAssign extends JApplet { private JPanel pnorth,psouth,pcentre,pwest,peast; private JButton btnEnter,btnReset,btnSave,btnLoad; private JTextField txtEnter; private JLabel label1,label2,header; private JTextArea textArea; private Container c; private paintPanel panelpaint; private String inputString,shape; private int x,y,size; private stringAnalyser tim; @Override public void init() { this.setVisible(true); this.setSize(800,600); initComponents(); initPanels(); initButtons(); initText(); initLabels(); tim=new stringAnalyser(); } public void initComponents() { x=0; y=0; size=0; this.panelpaint=new paintPanel(); } public void initPanels() { pnorth= new JPanel(); pnorth.setBackground(Color.CYAN); this.psouth = new JPanel(); psouth.setBackground(Color.BLUE); this.peast =new JPanel(); peast.setBackground(Color.CYA…

http://stackoverflow.com/comment/34108212
score: 0
comment on: http://stackoverflow.com/q/22429577
type: Comment
type: QuestionComment
has text: possible duplicate of [Java Synchronization](http://stackoverflow.com/questions/1321747/java-synchronization)

http://stackoverflow.com/q/22420427
has comment: http://stackoverflow.com/comment/34092565
tagged with: python
score: 0
tagged with: file
answer count: 1
has answer: http://stackoverflow.com/a/22420583
has body: I'm not sure whether this question is repeated or not.But,I know like to know more about the optimized Levenshtein Distance Algorithm Implementation in R or Java or Python.I have a Text File which contains numerous strings line by line(close to 2000 records as shown below) in alphabetical order which might have some kind of similarity between them.Now,I want to compare all the pairs of strings in the file and output the distance matrix.Also,please let me know how to use this matrix to filter set strings based on my requirement say LD &lt;=2. Get back to me if the question is not clear and you need more information. Sample Text File ---------------- abc abcd abe bac bad back blade cub cube cute dump duke
has comment: http://stackoverflow.com/comment/34100121
tagged with: java
has title: Calculation of Levenshtein distance
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21511801
has comment: http://stackoverflow.com/comment/34093464
tagged with: levenshtein-distance
tagged with: http://stackoverflow.com/tag/r
type: Question

http://stackoverflow.com/a/22417684
type: Answer
answers question: http://stackoverflow.com/q/22417504
downvote count: 0
has comment: http://stackoverflow.com/comment/34087807
has comment: http://stackoverflow.com/comment/34087840
score: 1
has comment: http://stackoverflow.com/comment/34089380
has comment: http://stackoverflow.com/comment/34089656
upvote count: 1
has body: In real life you never get as good a set of specifications as you do in a coding class. Take the problem description and break it up into individual sentences and think about what you have to do to satisfy each and every individual sentence. In a card game, each player's hand is made up of 13 cards. Ok, we're going to have to provide storage for 13 cards. A List will probably suffice. Each hand has a total point value determined by the number of cards that have a point value. Ok, we're going to have to calculate point values. Sounds like some math will be involved. The cards which are worth points are the Ace (4 points), King (3 points), Queen (2 points) and Jack (1 point). The other cards (2, 3, 4, 5, 6, 7, 8, 9, 10) have no point value. Ok, we're going to have to associate cards with points. A Map will probably suffice. There are four of each type of card, one in each of the four suits. The suits are called clubs (C), diamonds (D), hearts (H), and spades (S). Ok, this is a deck of playing cards. I'm familiar with a deck of playing cards. As well, points are assigned for each suit which has a void (3 points), a singleton (2 points), or a doubleton (1 point). A void in a suit means that there are no cards of that suit (e.g. a hand with no spades). A singleton in a suit means that there is only one card in that suit (e.g. a hand with only one diamond). A doubleton in a suit means that there are only two cards in that suit. Whoa, this is a little more complicated. How about I get the rest of the requirements satisfied, and then I can come back to this one. Right now, it looks like I'll have to go through that List of cards and check for these conditions. Write a program to read a set of thirteen cards in the form of a string, then evaluate the number of points in the hand. The suits will appear in increasing alphabetical order. Within each suit there will be no duplicate cards. Ok, I'm going to have a specific String input, that I'm going to have to break up into indi…

http://stackoverflow.com/comment/33953984
has text: Have you tried to do the calculation by hand for 234 to see where your algo is wrong?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22340972

http://stackoverflow.com/a/31515961
upvote count: 7
has comment: http://stackoverflow.com/comment/71120179
has comment: http://stackoverflow.com/comment/71155685
downvote count: 0
has body: Here's the Decoder for Android Here, The Parameter "data" contains the string which you have to scanned pdf417. ==========Properties============= HashMap&lt;String, String&gt; myData = new HashMap&lt;String, String&gt;(); public final String Customer_Family_Name = "DCS", Customer_Given_Name = "DCT", Name_Suffix = "DCU", Street_Address_1 = "DAG", City = "DAI", Jurisdction_Code = "DAJ", Postal_Code = "DAK", Country_Identification = "DCG", Customer_Id_Number = "DAQ", Class = "DCA", Restrictions = "DCB", Endorsements = "DCD", Document_Discriminator = "DCF", Vehicle_Code = "DCH", Expiration_Date = "DBA", Date_Of_Birth = "DBB", Sex = "DBC", Issue_Date = "DBD", Height = "DAU", Weight = "DCE", Eye_Color = "DAY", Control_Number = "ZWA", WA_SPECIFIC_ENDORSMENT = "ZWB", Transaction_Types = "ZWC", Under_18_Until = "ZWD", Under_21_Until = "ZWE", Revision_Date = "ZWF", Customer_Full_Name = "DAA", Customer_First_Name = "DAC", Customer_Middle_Name = "DAD", Street_Address_2 = "DAH", Street_Address_1_optional = "DAL", Street_Address_2_optional = "DAM"; ArrayList&lt;String&gt; allKeys = new ArrayList&lt;String&gt;(); ============Methods after Scaning================ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == SCAN_REQUEST_CODE &amp;&amp; resultCode == Activity.RESULT_OK) { ArrayList&lt;BarcodeResult&gt; barcodes = data.getParcelableArrayListExtra(BarcodeScanActivity.RESULT_EXTRA); Log.e("BARCODE RESULT ", "&lt;&lt;&lt;&gt;&gt;" + barcodes.toString()); String barcodeResult = barcodes.get(0).barcodeString; String lines[] = barcodeResult.split("\\r?\\n"); for (int i = 0; i &lt; lines.length; i++) { String str = lines[i]; if (str.contains("ANSI")) { str = str.substring(str.indexOf("DL")); String str1[] = str.split("DL"); if (str1.length &gt; 1) { str = str1[str1.length - 1]; } } if (str.length() &gt; 3) { String key = str.substring(0, 3); String value = str.substring(3); if (allKeys.contains(key)) { if (!value.equalsIgnoreCa…
score: 7
has comment: http://stackoverflow.com/comment/122851294
answers question: http://stackoverflow.com/q/22374593
has comment: http://stackoverflow.com/comment/51447506
type: Answer

http://stackoverflow.com/a/22395562
has comment: http://stackoverflow.com/comment/106363821
has body: Algorithms 4th Edition by Sedgewick and Wayne proposes the following desired performance characteristics for a graph implementation that is useful for most graph-processing applications: Space usage proportional to V + E Constant time to add an edge Time proportional to the degree of v to iterate through vertices adjacent to v (constant time per adjacent vertex processed) Using a linked list to represent the vertices adjacent to each vertex has all these characteristics. Using an array instead of a linked list would result in either (1) or (2) not being achieved.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22387979

http://stackoverflow.com/comment/33967381
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22347943
score: 0
has text: @Jorge_B , its working when I entered an incorrect username! but why its not working when the database is not live while username or password is correct?

http://stackoverflow.com/a/22467656
has body: First problem: Variables have a scope that's limited to the block in which they're declared. Your variable is declared within the for loop, but you want to use it outside the loop. Declare it outside (ie before) the loop. Second problem: Declare your method to return boolean - judging by the error message, it's currently declared to return void
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22467617
score: 2
downvote count: 0

hibernate
tags question: http://stackoverflow.com/q/22369344
tags question: http://stackoverflow.com/q/22473861
tags question: http://stackoverflow.com/q/22342450
tags question: http://stackoverflow.com/q/22388549
tags question: http://stackoverflow.com/q/22399768
tags question: http://stackoverflow.com/q/22443964
tags question: http://stackoverflow.com/q/22382950
tags question: http://stackoverflow.com/q/22365388
tags question: http://stackoverflow.com/q/22414078
tags question: http://stackoverflow.com/q/22396043
tags question: http://stackoverflow.com/q/22474232
tags question: http://stackoverflow.com/q/22431153
tags question: http://stackoverflow.com/q/22447280
tags question: http://stackoverflow.com/q/22350084
tags question: http://stackoverflow.com/q/22459399
tags question: http://stackoverflow.com/q/22398277
tags question: http://stackoverflow.com/q/22338741
tags question: http://stackoverflow.com/q/22419669
tags question: http://stackoverflow.com/q/22397593
tags question: http://stackoverflow.com/q/22369777
tags question: http://stackoverflow.com/q/22356184
tags question: http://stackoverflow.com/q/22366600
tags question: http://stackoverflow.com/q/22330179
tags question: http://stackoverflow.com/q/22332846
tags question: http://stackoverflow.com/q/22425103
tags question: http://stackoverflow.com/q/22345617
tags question: http://stackoverflow.com/q/22389060
tags question: http://stackoverflow.com/q/22370271
tags question: http://stackoverflow.com/q/22448511
tags question: http://stackoverflow.com/q/22426456
tags question: http://stackoverflow.com/q/22478321
tags question: http://stackoverflow.com/q/22406862
tags question: http://stackoverflow.com/q/22484156
tags question: http://stackoverflow.com/q/22455989
tags question: http://stackoverflow.com/q/22376455
tags question: http://stackoverflow.com/q/22355644
tags question: http://stackoverflow.com/q/22476464
tags question: http://stackoverflow.com/q/22443603
tags question: http://stackoverflow.com/q/22330843
tags question: http://stackoverflow.com/q/22477167
tags question: http://stackoverflow.com/q/22413437
tags question: http://stackoverflow.com/q/22342916
tags question: http://stackoverflow.com/q/22458747
tags question: http://stackoverflow.com/q/22344039
tags question: http://stackoverflow.com/q/22430379
tags question: http://stackoverflow.com/q/22379759
tags question: http://stackoverflow.com/q/22360136
tags question: http://stackoverflow.com/q/22462805
tags question: http://stackoverflow.com/q/22354922
tags question: http://stackoverflow.com/q/22359375
tags question: http://stackoverflow.com/q/22480187
tag name: hibernate
tags question: http://stackoverflow.com/q/22331568
tags question: http://stackoverflow.com/q/22352061
tags question: http://stackoverflow.com/q/22474648
tags question: http://stackoverflow.com/q/22377934
tags question: http://stackoverflow.com/q/22389035
tags question: http://stackoverflow.com/q/22420459
tags question: http://stackoverflow.com/q/22379089
tags question: http://stackoverflow.com/q/22431073
tags question: http://stackoverflow.com/q/22471908
tags question: http://stackoverflow.com/q/22442388
tags question: http://stackoverflow.com/q/22384550
tags question: http://stackoverflow.com/q/22464350
tags question: http://stackoverflow.com/q/22424825
tags question: http://stackoverflow.com/q/22355866
tags question: http://stackoverflow.com/q/22424471
tags question: http://stackoverflow.com/q/22474085
tags question: http://stackoverflow.com/q/22367039
tags question: http://stackoverflow.com/q/22443153
tags question: http://stackoverflow.com/q/22438687
tags question: http://stackoverflow.com/q/22454463
tags question: http://stackoverflow.com/q/22400682
tags question: http://stackoverflow.com/q/22364886
tags question: http://stackoverflow.com/q/22341841
tags question: http://stackoverflow.com/q/22468364
tags question: http://stackoverflow.com/q/22334630
tags question: http://stackoverflow.com/q/22396324
tags question: http://stackoverflow.com/q/22349306
tags question: http://stackoverflow.com/q/22449359

http://stackoverflow.com/a/22376327
has body: Do one thing right click on Question.properties file click on the properties get the Location of the file. Properties pr = new Properties(); pr.load(new FileInputStream("Location of the file"));
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22375840

http://stackoverflow.com/comment/34092685
comment on: http://stackoverflow.com/a/22405678
score: 0
has text: "Somehow made itself checked". Well "with if we could rebuild the world".
type: Comment
type: AnswerComment

internet-radio
tags question: http://stackoverflow.com/q/22444982
tag name: internet-radio
type: Tag

http://stackoverflow.com/a/32844963
answers question: http://stackoverflow.com/q/22399572
has body: after i tried the given answers, i found out another reason for the same Exception, that i had to add the library i'm using manually to my main library through Right click on my main library &gt; Properties &gt; Android &gt; Go to the very bottom of the screen and click (Add) &gt; Select my other library that caused the crash &gt; Apply before this solution, i used the "Fix Project setup" from within the .java file in eclipse, but this did not work, so i had to add it manually here and it worked
upvote count: 3
downvote count: 0
score: 3
type: Answer

http://stackoverflow.com/q/22345738
downvote count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34000624
has answer: http://stackoverflow.com/a/22350639
tagged with: selenium
has title: Selenium : How to retrieve WebDriver's implicitWait time in Java?
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/33963911
tagged with: java
type: UnansweredQuestion
has body: It's convenient to set WebDriver's implicitWait time when webapp contains lots of dynamically loaded contents. But the global implicitWait time turns out to be too long sometimes, in which cases I wish to reduce it temporarily, and then restore it to its previous value. The problem is : How to retrieve the value of the webdriver's current implicitWait time?

http://stackoverflow.com/comment/33954321
has text: Well, the answer is roughly "because that's how C did things", though that of course begs the question...
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22341128

http://stackoverflow.com/q/22410764
tagged with: java
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34078291
has body: I'm trying to make sure I have my design correct (or at least efficient) for what I'm undertaking for a client. I have a lot of the code written for the GUI and for some of the data extraction, except I fear it may take too long to accomplish on one thread. Here is what I'm trying to do: Take a list of Stock Symbols from a txt file; load that into an ArrayList (There are about 20 funds) Lookup a WIDE range of stock stats (about 50 statistical categories) for each fund Write these stats to a spreadsheet this is then loaded to the Main spreadsheet (client wants to keep the same sheet he has) So There are about 70+ values to look up. I have a process that I think might run efficiently, but not sure if it's as efficient as it can be. If anyone can offer any opinions on the design it would be a huge help: MainScreen pulls listOfFunds.txt into an ArrayList&lt;String&gt; listOfFunds Calls a dataPuller (Using WebDriver) dataPuller calls three threads: Thread1 calls statGroup 1 Thread2 calls statGroup 2 Thread3 calls statGroup 3 All three threads then load all stats found into a final ArrayList. Use jexcelapi to write all the Labels out and then write and close the WritableWorkbook. The main problem is: I don't know if I'd be able to have all three threads load to one ArrayList without writing over it. If I can have all three write to the same sheet that would be a HUGE lift! I suppose the main question is, Can you have three threads load to the same sheet? Or am I correct with having them load to an ArrayList? I need to concatenate all the data that is scraped through the WebDriver and it has to be written to the excel sheet.
tagged with: jexcelapi
type: Question
tagged with: multithreading
tagged with: excel
tagged with: selenium-webdriver
has title: Designing a webscraper using selenium webdriver, Jexcelapi and Multithreading
has comment: http://stackoverflow.com/comment/34076503
score: 0

http://stackoverflow.com/q/22479461
has comment: http://stackoverflow.com/comment/34196508
has title: Executing .bat files using jenkins
favorite count: 0
possible better answer: http://stackoverflow.com/a/22494657
has body: I'm trying to run a jar file using a bat command with jenkins. and I want to popup the cmd and execute the jar file. but the problem is jenkins execute commands inside its console. Then i inserted "start" command and hoped it'll work coz it creates a separate cmd to run the jar. here is my bat code start "window_name" java -jar myjarfile.jar but when i executing using it jenkins it doesn't create a separate cmd window but it executes the jar file anyhow. it shows this line, C:\Update&gt;start "window_name" java -jar myjarfile.jar any idea how to solve this? I want to pop up a black window when executing.
tagged with: jenkins
has answer: http://stackoverflow.com/a/22494657
accepted answer: http://stackoverflow.com/a/22526590
has comment: http://stackoverflow.com/comment/34198509
type: AnsweredQuestion
tagged with: java
tagged with: jenkins-plugins
has answer: http://stackoverflow.com/a/22526590
type: Question
linked to: http://stackoverflow.com/q/22602951
score: 0
tagged with: batch-file
answer count: 2
linked to: http://stackoverflow.com/q/5151034
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34195783
tagged with: cmd

http://stackoverflow.com/a/22426852
answers question: http://stackoverflow.com/q/22413581
score: 0
has body: The correction was made- String s="insert into tab1 values(\"abc\",\"xyz\");"; String str[]=new String[100]; StringTokenizer tokenizer= new StringTokenizer(s,"(,); "); while(tokenizer.hasMoreTokens()) { str[count]=tokenizer.nextToken(); System.out.println(str[count]); count++; } Thanks for all the help though.
type: Answer

http://stackoverflow.com/comment/34073291
comment on: http://stackoverflow.com/a/22409740
type: Comment
score: 0
type: AnswerComment
has text: This log is from my test env , and when I tool around 50 people were working on this application. If there was nothing to freed up why java will start full 3 times?

http://stackoverflow.com/a/22462454
has comment: http://stackoverflow.com/comment/34193462
upvote count: 18
has comment: http://stackoverflow.com/comment/34177888
has comment: http://stackoverflow.com/comment/34191930
has comment: http://stackoverflow.com/comment/34168962
has comment: http://stackoverflow.com/comment/34171891
has comment: http://stackoverflow.com/comment/34192895
type: AcceptedAnswer
downvote count: 0
has body: If you want your system to use client-certificate authentication, you'll need the server to request (or require) a client certificate. This is done by setting setWantClientAuth(true) on the server socket (or setNeedClientAuth, respectively). You'll also need the server to advertise the CA it accepts, which is normally done by using a truststore on the server that contains the CA by which the client-certificate chain was issued (this seems to be what you've done by setting javax.net.ssl.trustStore* on the server). the client to be configured with a keystore containing the client certificate (possible the chain if there are intermediate CAs) and its private key. This can be done by setting the javax.net.ssl.keyStore* (which may affect other connections) or by using a KeyManagerFactory in the same way as you've done it on the server side. If you use setWantClientAuth(true), you might still not get an error, since the server will accept connections that don't have a client-certificate (the server would then check the SSLSession's peer certificates to see whether there was a cert or not). setNeedClientAuth(true) would break the connection when the client doesn't present a certificate.
has comment: http://stackoverflow.com/comment/34178716
type: Answer
accepted answer of: http://stackoverflow.com/q/22460781
has comment: http://stackoverflow.com/comment/34192244
answers question: http://stackoverflow.com/q/22460781
has comment: http://stackoverflow.com/comment/34192451
has comment: http://stackoverflow.com/comment/34211346
has comment: http://stackoverflow.com/comment/34255978
has comment: http://stackoverflow.com/comment/34192582
has comment: http://stackoverflow.com/comment/34168100
score: 18
has comment: http://stackoverflow.com/comment/34255275
has comment: http://stackoverflow.com/comment/34167383

http://stackoverflow.com/comment/34188371
type: AnswerComment
comment on: http://stackoverflow.com/a/22475234
has text: @Maroun Can you answer my question?
type: Comment
score: 0

http://stackoverflow.com/a/22399276
type: Answer
answers question: http://stackoverflow.com/q/22399118
score: 0
has body: You can get the first letter of the string and check with API method that if it is letter or not. String input = "jkk ds 32"; String[] array = input.split(" "); for (String word : array) { char[] arr = word.toCharArray(); char c = arr[0]; if (Character.isLetter(c)) { System.out.println( word + "\t isLetter"); } else { System.out.println(word + "\t not Letter"); } } Following are some sample output: jkk isLetter ds isLetter 32 not Letter

http://stackoverflow.com/q/22428205
has answer: http://stackoverflow.com/a/22433204
has comment: http://stackoverflow.com/comment/34105766
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has body: The code I have written does not stop recording when I hit "console stop". I don't understand what I have done wrong. Could you look at the code below and suggest where my error is? Here it is: import java.io.File; import java.io.IOException; import java.util.Scanner; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.TargetDataLine; public class Main { final static int MONO = 1; private static AudioFileFormat.Type fileType = AudioFileFormat.Type.WAVE; public static void main(String[] args) { AudioFormat format = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 16000, 16, MONO, 2, 16000, true); DataLine.Info info = new DataLine.Info(TargetDataLine.class, format); int numb = 1; String files = "C:\\test\\music\\lala" + numb + "." + fileType; File fileOut = new File(files); if (!AudioSystem.isLineSupported(info)) { System.out.println("Line nit supporot!"); } System.out.println("To stop recording a sound lead - stop"); Scanner sc = new Scanner(System.in); String scc; TargetDataLine mike = null; try { mike = (TargetDataLine) AudioSystem.getLine(info); mike.open(format); AudioInputStream sound = new AudioInputStream(mike); mike.start(); AudioSystem.write(sound, fileType, fileOut); scc = sc.nextLine(); if (scc.equals("stop")) { System.out.println("recording is stopped!"); mike.stop(); sound.close(); System.exit(0); } } catch (LineUnavailableException e) { System.out.println("line not avaible"); } catch (IOException e) { e.printStackTrace(); } } } It does not work: import java.io.File; import java.io.IOException; import java.util.Scanner; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; im…
type: Question
accepted answer: http://stackoverflow.com/a/22433204
tagged with: audio
has comment: http://stackoverflow.com/comment/34105699
has comment: http://stackoverflow.com/comment/34108196
has comment: http://stackoverflow.com/comment/34105825
tagged with: java
has comment: http://stackoverflow.com/comment/34105703
upvote count: 1
answer count: 1
has title: Stop recording sound - Java

http://stackoverflow.com/a/22336888
score: 0
has body: Currently it isn't available. But we are planning to release an async programming api in 3.3. So then you will have a mechanism for your callbacks. One of the fundamentals things that need to be in place for that is back pressure to prevent overloading the system with requests and that is something I'm going to work on in the 3.3 release.
answers question: http://stackoverflow.com/q/22331726
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/22378896
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34035700
has comment: http://stackoverflow.com/comment/34035065
has comment: http://stackoverflow.com/comment/103563575
type: Answer
score: 6
downvote count: 0
has body: The properties file needs to go into src/main/resources/com/mycompany/config.
accepted answer of: http://stackoverflow.com/q/22378763
answers question: http://stackoverflow.com/q/22378763
upvote count: 6

http://stackoverflow.com/comment/33948009
type: Comment
has text: what do you mean disable entire list?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22337185

http://stackoverflow.com/q/22350756
has answer: http://stackoverflow.com/a/49764757
has body: I have gone through Demo's but I tried with the QuickStart example in which a image is uploaded. but I am not getting how to upload a audio file in which i will give path to my files or Intent Picker to select the file.I am using createFile() method how to upload a audio file to my drive? I need to convert it to any streams ? why google has made this so much complicated just to upload file? How to Synch Drive files ? How to stream (play audio file from drive)? The Below code just upload file which contains nothing. public class MainActivity extends Activity implements ConnectionCallbacks, OnConnectionFailedListener { private static final String TAG = "android-drive-quickstart"; //private static final int REQUEST_CODE_CAPTURE_IMAGE = 1; private static final int REQUEST_CODE_CREATOR = 2; private static final int REQUEST_CODE_RESOLUTION = 3; private static final int PICKFILE_RESULT_CODE = 1; private static Uri fileUri; private ContentsResult result; private GoogleApiClient mGoogleApiClient; private Bitmap mBitmapToSave; @Override protected void onResume() { super.onResume(); if (mGoogleApiClient == null) { // Create the API client and bind it to an instance variable. // We use this instance as the callback for connection and connection // failures. // Since no account name is passed, the user is prompted to choose. mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(Drive.API) .addScope(Drive.SCOPE_FILE) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); } // Connect the client. Once connected, the camera is launched. mGoogleApiClient.connect(); } @Override public void onConnectionFailed(ConnectionResult result) { // Called whenever the API client fails to connect. Log.i(TAG, "GoogleApiClient connection failed: " + result.toString()); if (!result.hasResolution()) { // show the localized error dialog. showToast("Error in on connection failed"); GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), this, 0).show(); return; } // T…
upvote count: 1
favorite count: 0
has title: Google Drive Android API how to upload a audio file to my drive ? How to sync drive files?
has answer: http://stackoverflow.com/a/23450649
tagged with: android
answer count: 4
tagged with: google-drive-api
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22360251
tagged with: google-drive-android-api
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25214304
type: Question

http://stackoverflow.com/comment/34148595
score: 0
comment on: http://stackoverflow.com/q/22450277
type: Comment
type: QuestionComment
has text: Please post your full pom file and not only excerpts.

http://stackoverflow.com/comment/33999139
comment on: http://stackoverflow.com/a/22366337
score: 0
type: AnswerComment
type: Comment
has text: The challenge is that I want the sensor collection to be running *only* for the specified time period to not drain the battery. So the synchronous method should start the sensor collection thread wait till the timeout, stop sensor thread and then return the average.

http://stackoverflow.com/a/22636468
downvote count: 0
answers question: http://stackoverflow.com/q/22366589
has body: You might take a look at the NuProcess project. Disclaimer: I wrote it. It provides non-blocking I/O from spawned processes. You still have to relay in Java (you receive callbacks), but because it is using epoll() in the case of Linux, I would expect it to preserve the order of the underlying program. Only a single thread is epoll()'ing the pipes so you won't get any thread scheduling order issues. I'm 100% order would be preserved on MacOS X, or any BSD variant, because it uses a kqueue which is definitely ordered. Anyway, you might want to give it a shot, it's trivial to code and test.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/22366138
upvote count: 0
answer count: 1
favorite count: 0
tagged with: binary-search-tree
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22366399
tagged with: tree
has title: Binary search tree into array
tagged with: java
linked to: http://stackoverflow.com/q/2371118
downvote count: 1
type: Question
tagged with: arrays
score: -1
tagged with: binary-tree
has body: I'm stuck with returning BS tree put into an array. I guess the problem is that I'm not passing around the counter to determine where the next free index is (I was planning to make the counter as the first element of array to make it easier). Any suggestions? public int[] returnInOrderTraversal(){ int[] arr = new int[getSize()+1]; if (rootNode != null) { rootNode.returninOrderTraversal(arr); } return arr; } public void returninOrderTraversal(int[] arr){ if(this.getLeftChild() != null) { this.getLeftChild().returninOrderTraversal(arr); } arr[arr[0]++] = this.getValue(); if (this.getRightChild() != null) { this.getRightChild().returninOrderTraversal(arr); } }

http://stackoverflow.com/q/22441683
downvote count: 0
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/13683335
tagged with: icons
has answer: http://stackoverflow.com/a/22441887
has answer: http://stackoverflow.com/a/47540738
upvote count: 2
has answer: http://stackoverflow.com/a/53828271
favorite count: 0
type: UnansweredQuestion
tagged with: windows
has body: I managed to package a java application from Netbeans to an EXE following this article: https://netbeans.org/kb/docs/java/native_pkg.html#tool I could not find a way to set the application Icon. Any tips would be greatly appreciated. Thanks!
tagged with: java-8
answer count: 4
has title: How to set icon for Java8 application packaged in NetBeans 8?
has answer: http://stackoverflow.com/a/44818827
score: 2

http://stackoverflow.com/a/22338368
has body: You allow i to keep incrementing until it is bigger than 4 - and then you exceed the limits of the array. The array does t magically get bigger - you must control your index size! I suspect that you don't (just) want the a!=b condition but also a i&lt;5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22338314
type: Answer
answers question: http://stackoverflow.com/q/22338314
score: 2
upvote count: 2

http://stackoverflow.com/comment/34162664
score: 0
type: Comment
type: AnswerComment
has text: That probably depends on customer demand. If you are interested then you should contact support, tell them about your use-case, and ask for that functionality.
comment on: http://stackoverflow.com/a/22459947

http://stackoverflow.com/comment/34032345
type: QuestionComment
comment on: http://stackoverflow.com/q/22385398
has text: Your PL/SQL program looks like the encoding part (blob -> character file), not the decoding part (character file -> blob).
score: 0
type: Comment

http://stackoverflow.com/comment/34117882
type: Comment
has text: The above is not hard coded and assumes that you are saving the folder in your app directory.
type: AnswerComment
comment on: http://stackoverflow.com/a/22435010
score: 0

http://stackoverflow.com/comment/34195863
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22476103
has text: The new applet is defined like this in the JSP -
type: AnswerComment

http://stackoverflow.com/comment/34188995
comment on: http://stackoverflow.com/a/22409143
score: 0
type: AnswerComment
has text: Thanks a lot for your reply. I will check that definitely. but what about the other errors? What about 'org.apache.catalina.connector.Connector - Protocol handler pause failed java.lang.NullPointerException' ? Can you please help ? thanks in advance
type: Comment

http://stackoverflow.com/comment/34070517
comment on: http://stackoverflow.com/a/22407899
type: Comment
score: 0
has text: yes also put this code myWebview.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // do something here } });
type: AnswerComment

http://stackoverflow.com/q/22425710
has comment: http://stackoverflow.com/comment/34101734
has title: Disable automatic scroll
score: 0
has comment: http://stackoverflow.com/comment/34101552
answer count: 1
type: UnansweredQuestion
tagged with: jtextpane
tagged with: swing
has comment: http://stackoverflow.com/comment/34101763
tagged with: java
has body: I have added a JScrollPane to a JTextPane , i have try to set the vertical bar to zero , thus it will appear as it was not scroll. In fact my aim is to disable the automatic scroll to the right and down . Below is my code JTextPane jtp1 = new JTextPane(); jtp1.setText("bhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhbhbbbbbbbbbbbbbbbbhbbbbbbbbbbbbbbbbbb b"); jtp1.setEditable(false); JScrollPane scrollpane2 = new JScrollPane(jtp1,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollpane2.getVerticalScrollBar().setValue(0);
type: Question
has answer: http://stackoverflow.com/a/22426101
tagged with: jscrollpane
linked to: http://stackoverflow.com/q/7156038

http://stackoverflow.com/a/22663838
has comment: http://stackoverflow.com/comment/34612425
answers question: http://stackoverflow.com/q/22371560
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22371560
type: Answer
has comment: http://stackoverflow.com/comment/34613369
score: 3
has body: this can be achieved by implementing UserSessionRegistry. See the DefaultUserDestinationResolver, which is very simple and keeps the data in memory. It can be replaced with something like Redis in order to make it distributed. This is something that was on my mind to get to. Can you open a request in JIRA so we can track it? Also if you're willing to try to do it I will help you out.
upvote count: 3

http://stackoverflow.com/comment/34035839
comment on: http://stackoverflow.com/a/22387754
has text: Unfortunately I don't have a device. This is what log cat displayed:03-13 20:47:27.539: W/GooglePlayServicesUtil(1375): Google Play services out of date. Requires 4242000 but found 2010110
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34039059
has text: Yes! Sorry, `copyOf` __does__ work. I wanted to avoid the copy though. It's been a long day of work and I am getting confused :/
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22385553

http://stackoverflow.com/a/22398264
answers question: http://stackoverflow.com/q/22398116
type: Answer
downvote count: 0
score: 1
has body: If you are opening it in eclipse, then provide correct path in Windows -> Preferences ->Android-> SDK location bar - put your C:\Path\to\Android\android-sdk
has comment: http://stackoverflow.com/comment/34053645
upvote count: 1

http://stackoverflow.com/comment/33939232
score: 0
type: AnswerComment
has text: I know they show that a lot. How do you build your controllers with your XML file that way?
type: Comment
comment on: http://stackoverflow.com/a/22332731

http://stackoverflow.com/comment/34094124
comment on: http://stackoverflow.com/a/22406373
type: AnswerComment
score: 0
type: Comment
has text: You're welcome @Sumeet. And feel free to check the answer if you liked it.

http://stackoverflow.com/a/22426602
type: Answer
has body: Ebbe's method is called rejection sampling. I sometimes use a simple method, using an inverse cumulative distribution function, which is a function that maps a number X between 0 and 1 onto the Y axis. Then you just generate a uniformly distributed random number between 0 and 1, and apply the function to it. That function is also called the "quantile function". For example, suppose you want to generate a normally distributed random number. It's cumulative distribution function is called Phi. The inverse of that is called probit. There are many ways to generate normal variates, and this is just one example. You can easily construct an approximate cumulative distribution function for any univariate distribution you like, in the form of a table. Then you can just invert it by table-lookup and interpolation.
answers question: http://stackoverflow.com/q/22421459
score: 0

http://stackoverflow.com/comment/34029179
comment on: http://stackoverflow.com/q/22384503
type: Comment
type: QuestionComment
has text: Run Configurations... -> JRE tab
score: 0

http://stackoverflow.com/a/22438359
answers question: http://stackoverflow.com/q/22438277
upvote count: 1
has body: counter += ((PassengerCar) vogn).getPassengerCount(); //This line Hmmm... let's see. If the vogn is an instance of PassengerCar, then it adds the number of passengers in that car to the total number of passengers. So, it is necessary to cast the vogn object to its subclass to access the method getPassengerCount() (which probably isn't present in TrainCar). A better way would be: public int getPassengerCount() { int counter = 0; for (TrainCar vogn : YOLO) { if (vogn instanceof PassengerCar) { //This is easier :-) counter += ((PassengerCar) vogn).getPassengerCount(); } } return counter; }
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/22435010
score: 0
has comment: http://stackoverflow.com/comment/34118057
has comment: http://stackoverflow.com/comment/34118015
has body: Do this: File dir =new File(getActivity().getApplicationContext().getFilesDir()+"/YourFOlderName"); boolean success = deleteDir(dir); Where: getActivity().getApplicationContext().getFilesDir()+"/YourFOlderName" is the path to the folder. And: public static boolean deleteDir(File dir) { if (dir.isDirectory()) { String[] children = dir.list(); for (int i=0; i&lt;children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; } } } return dir.delete(); } The above will delete all the children inside the directory. if your folder is on the External SD Card the path should be mounted like: Never hardcode the sdcard, you must use Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) will let you know if the memory is loaded. Then use: Environment.getExternalStorageDirectory().getAbsolutePath()
type: Answer
has comment: http://stackoverflow.com/comment/34118339
has comment: http://stackoverflow.com/comment/34118183
has comment: http://stackoverflow.com/comment/34118914
answers question: http://stackoverflow.com/q/22434945
has comment: http://stackoverflow.com/comment/34118748
has comment: http://stackoverflow.com/comment/34118669
has comment: http://stackoverflow.com/comment/34117882

http://stackoverflow.com/comment/33953112
comment on: http://stackoverflow.com/q/22340383
score: 0
type: Comment
type: QuestionComment
has text: How about `Integer number = 5;`

http://stackoverflow.com/comment/34048786
score: 0
type: QuestionComment
has text: @Acapulco, Thanks! What if I cannot use an external library?
type: Comment
comment on: http://stackoverflow.com/q/22395398

http://stackoverflow.com/q/22486017
tagged with: java
score: 0
answer count: 2
has title: Need help on redirecting text from console to JTextArea/JTextPane
has comment: http://stackoverflow.com/comment/34207918
has comment: http://stackoverflow.com/comment/34207617
has body: I am trying to display the console output to JTextArea/JTextPane. MY class has several methods that has system.out.println() statements. I have followed several examples but could not get a perfect one that suits my requirement Here is my Code snippet which I have used: private JTextArea textArea = new JTextArea(30, 30); JScrollPane scrollPane = new JScrollPane(textArea); private TextAreaOutputStream taOutputStream = new TextAreaOutputStream( textArea, "Test"); System.setOut(new PrintStream(taOutputStream)); And my TextAreaOutPutStream is as follows: import java.io.IOException; import java.io.OutputStream; import javax.swing.JTextArea; import javax.swing.SwingUtilities; public class TextAreaOutputStream extends OutputStream { private final JTextArea textArea; private final StringBuilder sb = new StringBuilder(); public TextAreaOutputStream(final JTextArea textArea, String title) { this.textArea = textArea; this.title = title; sb.append(title + "&gt; "); } @Override public void flush() { } @Override public void close() { } @Override public void write(int b) throws IOException { textArea.append(String.valueOf((char)b)); textArea.setCaretPosition(textArea.getDocument().getLength()); } } Now my problem is I am getting my output on jtextArea only after the entire program is completed. How can I get this printed one by one when ever the program encounters system.out.println() and print its output to JtextArea immediately. I have seen several examples where they have specified to use swingworker, but here how can I use that when I have several methods?? Please provide your solutions for this.
has answer: http://stackoverflow.com/a/22486708
has comment: http://stackoverflow.com/comment/34207476
has answer: http://stackoverflow.com/a/22486193
linked to: http://stackoverflow.com/q/4443878
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4297729
type: Question

http://stackoverflow.com/comment/33938852
type: AnswerComment
score: 0
has text: what are some examples of numbers you are using?
type: Comment
comment on: http://stackoverflow.com/a/22329294

http://stackoverflow.com/comment/34113413
has text: > "Intuitively, I think that iterating the same collection multiple times should be slower than doing it once" But you are only doing one quarter of the work per iteration, so intuititvely, there should be no large difference. Cache efficiency is probably going to be better with the single pass solution, though. No way to know without trying
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22432268
score: 0

http://stackoverflow.com/comment/34295673
comment on: http://stackoverflow.com/a/22489470
has text: you're right... it did happen in my original code. I've got so many versions of this code right now I've lost track!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34095373
type: QuestionComment
comment on: http://stackoverflow.com/q/22422185
score: 0
has text: @anonymous Thanks for your reply.Could you please explain with an example ?
type: Comment

http://stackoverflow.com/q/22346297
tagged with: iteration
tagged with: entropy
has comment: http://stackoverflow.com/comment/34232939
has comment: http://stackoverflow.com/comment/34247432
has comment: http://stackoverflow.com/comment/34067253
has comment: http://stackoverflow.com/comment/34064326
has comment: http://stackoverflow.com/comment/34021868
has title: Java: Parallelise loop and merge results for calculating entropy
has comment: http://stackoverflow.com/comment/34021971
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34244843
has comment: http://stackoverflow.com/comment/34233118
tagged with: parallel-processing
has comment: http://stackoverflow.com/comment/34239389
has comment: http://stackoverflow.com/comment/34243172
tagged with: java
has body: I have an algorithm that does the following: Given I have an array array of length n It's goal is to merge certain elements based on some condition (it this case entropy). It calculates the entropy e_all of the entire array and calculates the entropy e_merged of the array where element n and n+1 are merged. It does that for each pair of adjacent elements. The pair where the difference in e_all - e_merged is greatest are marged. If there is a merge, the algorithm is applied again on the new array with length n-1. As you can see, this takes in the worst case n^2 - 1 iterations and if n is big it might take minutes or even hours to complete. Therefore I was wondering how I can parallelise this algorithms. Basically it should be able calculate the entropies on i cores and when all the elements are evaluated the results should be merged and a conclusion can be drawn. How can I do such a thing? Which kinds of code pieces or idea's must I implement for it to work this way? Or is there a better way? public double[] applyAlgorithm(double[] array) { boolean merging = false; for (int i = 0; i &lt; array.length - 1; i++) { double[] entropy = getEntropy(array); // returns list of entropy for all adjacent intervals int idx = 0; double max = Double.NEGATIVE_INFINITY; for (int j = 0; j &lt; entropy.length; j++) { if (entropy[j] &gt; max) { max = entropy[j]; idx = j; } } if (max &gt; 0) { array = mergeAdjacentIntervals(array, idx); //merge intervals that have the max entropy, if the entropy is &gt; 0 merging = true; break; } } if (merging) { array = applyAlgorithm(array); } return array; } private double[] getEntropy(double[] array) { double[] entropy = new double[array.length - 1]; double[] tempArray = new double[array.length - 1]; double baseEntropy = calculateEntropy(array); for (int i = 0; i &lt; entropy.length; i++) { tempArray = mergeAdjacentIntervals(array, idx); entropy[i] = baseEntropy - calculateEntropy(tempArray); } return entropy; }
has comment: http://stackoverflow.com/comment/34292061
has comment: http://stackoverflow.com/comment/34242004
has comment: http://stackoverflow.com/comment/34029936
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34233248
has comment: http://stackoverflow.com/comment/34098767

http://stackoverflow.com/q/22364054
has body: The code example I'm referring to is a bit of Android specific code, but I have a feeling the idea is a fundamental one in Java. In the code snippet below I am confused by what is happening from the second line on. It looks like in the setOnClickListener() method a whole new class is being defined. It looks to me like a method is being defined within the arguments of another method, onClick() being defined inside of setOnClickListener(). This whole thing is very confusing to me as I have never seen Java written like this, except in Android. Could someone please explain what I am seeing here? Any help is greatly appreciated! final Button downButton = (Button) findViewById(R.id.button1); downButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //Play key click sound mAudioManager.playSoundEffect(AudioMAnager.FX_KEY_CLICK); if (mVolumne &gt; mVolumeMin) { mVolume -= 2; tv.setText(String.valueOf(mVolume)); } } });
type: Question
has title: Not sure what is happening in this java code example
score: 1
tagged with: java
tagged with: overriding
has answer: http://stackoverflow.com/a/22364242
tagged with: class
answer count: 3
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22364257
has answer: http://stackoverflow.com/a/22364403
accepted answer: http://stackoverflow.com/a/22364403
tagged with: android
possible better answer: http://stackoverflow.com/a/22364242
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/33994651
tagged with: methods

http://stackoverflow.com/comment/34015561
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22376506
type: AnswerComment
has text: @user2464622: are you using `Statement.executeUpdate()` instead of `Statement.executeQuery()` for your update statements?

http://stackoverflow.com/q/22446388
linked to: http://stackoverflow.com/q/7173352
has comment: http://stackoverflow.com/comment/34138987
has answer: http://stackoverflow.com/a/22446433
score: 0
tagged with: exception
has body: I have no idea why this is happening. class Course implements Serializable { private String campus; // the campus on which the course is offered private String course; // the course number, such as CSCI 111 private String section; // the section number private String crn; // the CRN for this section private int credits; // the number od credits for the course private String time; // the time the course is offered, such as 8:00 to 10:00 A.M. private String days; // the Days the course is offered, suhc as MW // constructors Course() { } Course(String course, String section, String crn, int credits) { this.course = course; this.section = section; this.crn = crn; this.credits = credits; } // end Course() initalizing // muatator methods public void setCampus(String cmp) { this.campus = cmp; }// end setCampus() public void setCourse(String crse) { this.course = crse; }// end setCourse() public void setSection(String sect) { this.section = sect; } // end setSection() public void setCRN(String crn) { this.crn = crn; } // end setCRN() public void setCredits(int cr) { this.credits = cr; } // end setCredits() public void setTime(String tm) { this.time = tm; }// end setTime() public void setDays(String days) { this.days = days; }// end setDays() // accessor methods public String getCampus() { return campus; } // end getCampus() public String getCourse() { return course; } // end Course() public String getSection() { return section; } // end getSection() public String getCRN() { return crn; } // end getCRN() public int getCredits() { return credits; } // end getCredits() public String getTime() { return time; } // end getTime() public String getDays() { return days; } // end getDays() // method to compare by CRN using the String class compareTo() public int compareTo(Course other) { return this.crn.compareTo(other.getCRN()); } // end compareTO() // method to return properties as a string for csv file // public String toCSVString() { // // return credits // + campus + "," // + co…
has comment: http://stackoverflow.com/comment/34138980
answer count: 1
linked to: http://stackoverflow.com/q/3569628
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34139035
duplicate of: http://stackoverflow.com/q/7173352
has title: why am I getting java.io.InvalidClassException?
has comment: http://stackoverflow.com/comment/34139297
has comment: http://stackoverflow.com/comment/34139051
tagged with: java
has comment: http://stackoverflow.com/comment/34140272
type: Question
has comment: http://stackoverflow.com/comment/34139161

http://stackoverflow.com/q/22440103
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/22441455
has comment: http://stackoverflow.com/comment/34151287
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22441667
has comment: http://stackoverflow.com/comment/34135534
has comment: http://stackoverflow.com/comment/34133134
has comment: http://stackoverflow.com/comment/34130350
tagged with: erlang
linked to: http://stackoverflow.com/q/6964392
answer count: 3
has comment: http://stackoverflow.com/comment/34138811
downvote count: 0
has title: Erlang takes ages to count?
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22443784
has body: Hi guys I'm trying to make a load generator and my goal is to compare how much of my system's resources are consumed when spawning Erlang processes as compared to spawning threads (Java). I am doing this by having the program count to 1000000000 10 times. Java takes roughly 35 seconds to finish the whole process with 10 threads created, Erlang takes ages with 10 processes, I grew impatient with it because it spent over 4 minutes counting. If I just make Erlang and Java count to 1000000000 without spawning threads/processes, Erlang takes 1 minute and 32 seconds and Java takes a good 3 or so seconds. I know Erlang is not made for crunching numbers but that much of a difference is alarming, why is there such a big difference ? Both use my CPU to 100% but no spike in RAM. I am not sure what other methods can be used to make this comparison, I am open to any suggestions as well. here is the code for both versions -module(loop). -compile(export_all). start(NumberOfProcesses) -&gt; loop(0, NumberOfProcesses). %%Processes to spawn loop(A, NumberOfProcesses) -&gt; if A &lt; NumberOfProcesses -&gt; spawn(loop, outerCount, [0]), loop(A+1, NumberOfProcesses); true -&gt; ok end. %%outer loop outerCount(A) -&gt; if A &lt; 10 -&gt; innerCount(0), outerCount(A + 1); true -&gt; ok end. %%inner loop innerCount(A) -&gt; if A &lt; 1000000000 -&gt; innerCount(A+1); true -&gt; ok end. and java import java.util.Scanner; class Loop implements Runnable { public static void main(String[] args) { System.out.println("Input number of processes"); Scanner scan = new Scanner(System.in); String theNumber = scan.nextLine(); for (int t = 0; t &lt; Integer.parseInt(theNumber); t++) { new Thread(new Loop()).start(); } } public void run() { int i; for (i = 0; i &lt; 10; i++) { for (int j = 0; j &lt; 1000000000; j++); } } }
score: 1

http://stackoverflow.com/q/22332609
possible better answer: http://stackoverflow.com/a/22348018
upvote count: 1
has title: How to suppress deprecation warning on annotation argument
has answer: http://stackoverflow.com/a/22348018
type: Question
has answer: http://stackoverflow.com/a/22347079
accepted answer: http://stackoverflow.com/a/22347079
answer count: 2
downvote count: 0
favorite count: 0
has body: I compile javac 1.7.0_45 using the -Xlint option, the following code causes a deprecation warning. @Deprecated public class Bar {} @SuppressWarnings("deprecation") public class Foo { @XmlElement(type = Bar.class) Object something; } &gt;&gt; Warning: Bar in mavenproject1 has been deprecated I would have expected the @SuppressWarnings to prevent the warning message to be raised. How to avoid this warning ?
type: AnsweredQuestion
tagged with: deprecated
score: 1
tagged with: java

http://stackoverflow.com/a/22451567
upvote count: 1
score: 0
has body: bufferedReader.equals(null) should throw a NullPointerException to check bufferedReaderis null or not you can do bufferedReader != null.
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/34147422
has comment: http://stackoverflow.com/comment/34148384
answers question: http://stackoverflow.com/q/22451394
has comment: http://stackoverflow.com/comment/34176142

http://stackoverflow.com/comment/34086064
comment on: http://stackoverflow.com/a/22415573
has text: @GarethJones you're welcome! I'm glad it worked out:) +1 for a nice question.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22371124
has answer: http://stackoverflow.com/a/22371203
type: Question
type: AnsweredQuestion
tagged with: java
score: 15
has answer: http://stackoverflow.com/a/22371232
has answer: http://stackoverflow.com/a/22371510
has comment: http://stackoverflow.com/comment/34006302
tagged with: android-context
possible better answer: http://stackoverflow.com/a/22371510
has comment: http://stackoverflow.com/comment/34006227
tagged with: android
accepted answer: http://stackoverflow.com/a/22371203
has title: How to get activity context into a non-activity class android?
upvote count: 15
answer count: 4
favorite count: 0
has body: I have a Activity class from where I am passing some information to a helper class(Non-activity) class. In the helper class I want to use the getSharedPreferences(). But I am unable to use it as it requires the activity context. here is my code: class myActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.home); Info = new Authenticate().execute(ContentString).get(); ItemsStore.SetItems(Info); } } class ItemsStore { public void SetItems(Information info) { SharedPreferences localSettings = mContext.getSharedPreferences("FileName", Context.MODE_PRIVATE); SharedPreferences.Editor editor = localSettings.edit(); editor.putString("Url", info.Url); editor.putString("Email", info.Email); } } ANy idea how this can be achieved?
downvote count: 0
has answer: http://stackoverflow.com/a/22371183

http://stackoverflow.com/q/22354839
has answer: http://stackoverflow.com/a/22355021
accepted answer: http://stackoverflow.com/a/22355403
has title: JUNIT test case for JDBC connectivity
score: 0
answer count: 3
tagged with: junit
tagged with: jdbc
has answer: http://stackoverflow.com/a/22355467
tagged with: exception
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22355021
has body: I'm just wondering, how would I test the JDBC connectivity and form a JUNIT test case! Any idea regarding it please?
tagged with: testing
has answer: http://stackoverflow.com/a/22355403

http://stackoverflow.com/comment/34040124
type: QuestionComment
comment on: http://stackoverflow.com/q/22390488
has text: Can you check how much time it takes using the solution suggested here http://stackoverflow.com/questions/2056221/recursively-list-files-in-java
type: Comment
score: 1

graphics
tags question: http://stackoverflow.com/q/22436954
tag name: graphics
tags question: http://stackoverflow.com/q/22361806
tags question: http://stackoverflow.com/q/22370032
tags question: http://stackoverflow.com/q/22434314
tags question: http://stackoverflow.com/q/22331407
tags question: http://stackoverflow.com/q/22363304
type: Tag
tags question: http://stackoverflow.com/q/22328787
tags question: http://stackoverflow.com/q/22476325
tags question: http://stackoverflow.com/q/22428454
tags question: http://stackoverflow.com/q/22360257
tags question: http://stackoverflow.com/q/22339157
tags question: http://stackoverflow.com/q/22481741
tags question: http://stackoverflow.com/q/22341205
tags question: http://stackoverflow.com/q/22403941

http://stackoverflow.com/comment/34379143
type: Comment
type: QuestionComment
has text: @MichaelCMS And if I put the code in the one second loop, where the other code draws an item on Minecraft's framebuffer, would that work?
comment on: http://stackoverflow.com/q/22386939
score: 0

http://stackoverflow.com/comment/33949088
type: Comment
has text: It looks like you're passing a string to the Scanner constructor. Does that do what you expect it to do? Also, it looks like you're only passing the file path, which doesn't include the actual file name. I'm the downvoter, I think those are legitimate issues and don't feel like I'm an idiot for pointing them out.
comment on: http://stackoverflow.com/a/22338116
type: AnswerComment
score: 0

http://stackoverflow.com/a/22445178
score: 15
upvote count: 15
type: AcceptedAnswer
has body: It's all personal preference at this point I think :) but looping through and using charAt(i) would be the most common way of handling this. This question covers it fine: What is the easiest/best/most correct way to iterate through the characters of a string in Java?
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22445104
answers question: http://stackoverflow.com/q/22445104
type: Answer

http://stackoverflow.com/a/22468542
has comment: http://stackoverflow.com/comment/34178033
has comment: http://stackoverflow.com/comment/34177849
has comment: http://stackoverflow.com/comment/34177654
has comment: http://stackoverflow.com/comment/34177679
has body: You have four text fields: fNameTextBoxResults lNameTextBoxResults eMailTextBoxResults signUpTextBoxResults Rather than attempting to validate all of the input at once, let's try to make this code a little more modular. Separate all of the logic pertaining to a specific field and add it as an ActionListener to that field. Example: fNameTextBoxResults.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { //statement that checks to make sure user enters only letters if(fname.matches("[a-zA-Z]+")) { //updates 'Fname' field in db to text that user inputted in 'fname' textfield rs2.updateString("Fname", fname); JOptionPane.showMessageDialog(null, "Customer first name been updated!"); } //statement that prompts user if they enter something other letters else { JOptionPane.showMessageDialog(null, "Please enter first name in correct format!"); fNameTextBoxResults.setText(""); } } }); Rinse and repeat for the other three fields. If you have some finalizing type of action required, then you can do that with updateButtonResults. Otherwise, the button is unnecessary altogether.
has comment: http://stackoverflow.com/comment/34177860
has comment: http://stackoverflow.com/comment/34177644
has comment: http://stackoverflow.com/comment/34177966
has comment: http://stackoverflow.com/comment/34177876
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34178322
has comment: http://stackoverflow.com/comment/34177724
has comment: http://stackoverflow.com/comment/34178050
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22468303
has comment: http://stackoverflow.com/comment/34177881
has comment: http://stackoverflow.com/comment/34178361
accepted answer of: http://stackoverflow.com/q/22468303
has comment: http://stackoverflow.com/comment/34177842

http://stackoverflow.com/comment/34181209
comment on: http://stackoverflow.com/a/22470842
type: Comment
score: 0
type: AnswerComment
has text: sorry when I posted this reply, due to my poor internet connection, your code hadn't loaded yet and my reply was fully based on the text you gave us...

http://stackoverflow.com/q/22401060
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22401176
tagged with: android
has title: Restart application when i click a button
tagged with: android-activity
has answer: http://stackoverflow.com/a/22401118
score: 2
type: UnansweredQuestion
has body: I need that my application restarts when click a button, for more info I need simulate thant I push back key and open application again. I supose that i can close application with finish(); but how can i do to launch onCrete() again? is there other way to do this? thanks
has comment: http://stackoverflow.com/comment/34057797
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22401132
upvote count: 2
answer count: 3
linked to: http://stackoverflow.com/q/15025412

http://stackoverflow.com/a/22377722
has body: The code is just crap because a java.util.Date is always GMT. It is never a local timestamp so trying to convert it from an imaginary local timestamp to GMT is conceptual nonsense. The original intention was probably to misuse a Date as a kind of local timestamp (in contradiction to its specification) that is as thin wrapper around local time millis. Remember following relation: [UTC-millis] + [offset-millis] = [local-millis] I would just have used a long primitive for this calculation, not j.u.Date. So you can see many inconsistencies in the code. The newTime variable appears to be a kind of local millis but is wrapped then as j.u.Date and returned result of a method which pretends to convert to GMT (more chaos is hardly possible). Edit 8 years later when we have now got the java.time-package. An instance of java.util.Date can be converted to a java.time.Instant. New conversion methods had been added to java.util.Date for this purpose. And we should all know that an instant is related to GMT, and nothing else. So will someone try to tell us that following code makes any sense? public static Instant convertToGMTNew(Instant instant) { java.util.Date date = java.util.Date.from(instant); return convertToGMTOld(date).toInstant(); // using the method above } Not really. It is the same error. The new changed!!! instant would indeed be based on a fake calculation. Instant and java.util.Date have no conversion methods involving any zone calculations for a good reason. Both are just related to GMT and not to any "local" instants.
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/22377147
score: -1

http://stackoverflow.com/comment/34129217
type: QuestionComment
has text: @Paul: you're right, I can directly translate my Java program to Scala. But if I do it, what is the point to use Scala anyway? The reason I choose Scala is because of its functional programming paradign, in which mutable object is not encouraged. So, my question is whether there is a way to iterate only once without using mutable object.
type: Comment
comment on: http://stackoverflow.com/q/22432268
score: 0

http://stackoverflow.com/a/22450139
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22446477
has body: Compute the cumulated segment lengths (0, Dab, Dab+Dbc, Dab+Dbc+Dcd... D). Your split points are equally spaced, at (curvilinear) abscissas i.D/N. Using a simple loop, you will find to which segment every split point belongs. Let point i be in segment k of length Dk and cumulated length Lk: the split point is located at the fraction (i.D/n-Lk)/Dk of this segment.

http://stackoverflow.com/a/22402594
type: Answer
has body: I have done something similar when the PRINTER DB25 parallel port is available in the computer. However since the parallel port is no longer comes with PCs, laptops, You can use U"SB to PRINTER DB25 25-Pin Parallel Port Cable Adapter" as a alternative. this parallel port has 8 output lines which can represent from 0 to 255 values in binary. write a c++ library which will pass a byte value to Parallel port output. since java cannot directly access your hardware. Using JNI you can access that library from you java code. Now connect 8 LEDs to parallel port output pins. NOTE: 1 &amp; 2 steps are already done for you. by the following library. http://web.archive.org/web/20080523134328/http://www.geocities.com/Juanga69/parport/ to light up only 1st led, set value 00000001b => 1 decimal to light up only second led 00000010b => 2 decimal to light up 4th and 8th led => 10001000b => 136 decimal
answers question: http://stackoverflow.com/q/22401731
score: 0

http://stackoverflow.com/q/22456029
tagged with: graph
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/25141657
has title: Converting floor plans into hierarchical graphs
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: I'm developing a navigation application for android. I need to convert the floor map into a hierarchical graph. As far as I know after converting the map into a graph this will produce an XML file presenting the rooms as nodes. I have searched about hierarchical graph but all I got was theoretical explanation of the graphs. While searching also I read something about GoogleOpenStreet. I read that it can be used to convert floor plans into graphs but also I didn't find anything about how to do it. Can anyone suggest methods to do this using Java?
accepted answer: http://stackoverflow.com/a/25141657
type: Question

http://stackoverflow.com/a/22475539
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22474648
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22474648
type: Answer
downvote count: 0
score: 1
has body: You will have to create a new class that contains your new function. This class will extend your current dialect, MYSQL5Dialect. public class CustomMySQLDialect extends MySQL5Dialect{ public CustomMySQLDialect() { super(); registerFunction("median", new StandardSQLFunction("median")); } } Now you have to tell hibernate to use your newly created dialect. I assume you have a XML file where you have configured hibernate. com.hibernate.custom.dialect.CustomMySQLDialect For more information you can take a look at Keyur Joshi blog post

http://stackoverflow.com/a/22381357
has comment: http://stackoverflow.com/comment/34024022
has comment: http://stackoverflow.com/comment/34023797
has comment: http://stackoverflow.com/comment/34024537
has comment: http://stackoverflow.com/comment/34049161
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34054596
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22381298
has body: Handle redirect from your php as you are redirecting from your java. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); Also, if you want to see the output from your php, use return-transfer option curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

http://stackoverflow.com/a/22515000
score: 0
has body: Do something like this String orig = Arrays.toString(nameArray); Arrays.sort(nameArray, new LengthCompare()); String sorted = Arrays.toString(nameArray); System.out.println(orig); System.out.println(sorted);
type: Answer
answers question: http://stackoverflow.com/q/22477039

http://stackoverflow.com/a/22331107
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22330866
has comment: http://stackoverflow.com/comment/33937059
has comment: http://stackoverflow.com/comment/33943790
has body: Store it in a map: yourHistogramsMap.get(sliderBox.getProperty("VALUE")).getSum(); Of course, you have to store your histograms there first.

http://stackoverflow.com/comment/34431285
comment on: http://stackoverflow.com/a/22569956
type: AnswerComment
score: 0
type: Comment
has text: the problem is that JPA says that @GeneratedValue cannot be used for non id fields, see in this PDF page 375, it says `[97] Portable applications should not use the GeneratedValue annotation on other persistent fields or properties.` http://code.google.com/p/jgk-spring-recipes/downloads/detail?name=persistence-2_0-final-spec.pdf

nullpointerexception
tags question: http://stackoverflow.com/q/22399159
tags question: http://stackoverflow.com/q/22483089
tags question: http://stackoverflow.com/q/22429785
tags question: http://stackoverflow.com/q/22335466
tags question: http://stackoverflow.com/q/22448781
tags question: http://stackoverflow.com/q/22430731
tags question: http://stackoverflow.com/q/22418230
tags question: http://stackoverflow.com/q/22434031
tags question: http://stackoverflow.com/q/22392732
tags question: http://stackoverflow.com/q/22443701
tags question: http://stackoverflow.com/q/22455662
tags question: http://stackoverflow.com/q/22332904
tags question: http://stackoverflow.com/q/22370879
tags question: http://stackoverflow.com/q/22445631
tags question: http://stackoverflow.com/q/22345280
tags question: http://stackoverflow.com/q/22484478
tags question: http://stackoverflow.com/q/22466409
tags question: http://stackoverflow.com/q/22428044
tags question: http://stackoverflow.com/q/22345786
tags question: http://stackoverflow.com/q/22415576
tags question: http://stackoverflow.com/q/22367818
type: Tag
tags question: http://stackoverflow.com/q/22378147
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/22400296
tags question: http://stackoverflow.com/q/22407629
tags question: http://stackoverflow.com/q/22421197
tags question: http://stackoverflow.com/q/22404280
tags question: http://stackoverflow.com/q/22371075
tags question: http://stackoverflow.com/q/22436834
tags question: http://stackoverflow.com/q/22475745
tags question: http://stackoverflow.com/q/22359924
tags question: http://stackoverflow.com/q/22333412
tags question: http://stackoverflow.com/q/22419123
tags question: http://stackoverflow.com/q/22387466
tags question: http://stackoverflow.com/q/22366832
tags question: http://stackoverflow.com/q/22345891
tags question: http://stackoverflow.com/q/22435081
tags question: http://stackoverflow.com/q/22342314
tags question: http://stackoverflow.com/q/22371631
tags question: http://stackoverflow.com/q/22458180
tags question: http://stackoverflow.com/q/22408730
tags question: http://stackoverflow.com/q/22459322
tags question: http://stackoverflow.com/q/22424854
tags question: http://stackoverflow.com/q/22341480
tags question: http://stackoverflow.com/q/22393843
tags question: http://stackoverflow.com/q/22338203
tags question: http://stackoverflow.com/q/22431392
tags question: http://stackoverflow.com/q/22427507
tags question: http://stackoverflow.com/q/22471809
tags question: http://stackoverflow.com/q/22332776
tags question: http://stackoverflow.com/q/22346843
tags question: http://stackoverflow.com/q/22457208

http://stackoverflow.com/comment/34181996
type: Comment
comment on: http://stackoverflow.com/q/22471407
type: QuestionComment
score: 0
has text: Perhaps `Commons` is null?. Sorry, it's a static method. I'll withdraw the comment.

http://stackoverflow.com/comment/34428496
has text: This is fantastic--thanks! I can't believe I missed MetadataSource as a OXM_METADATA_SOURCE property type. I'll expand on your solution in a different answer.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22516878
type: Comment

maven
tags question: http://stackoverflow.com/q/22443053
tags question: http://stackoverflow.com/q/22438304
tags question: http://stackoverflow.com/q/22406880
tags question: http://stackoverflow.com/q/22347733
tags question: http://stackoverflow.com/q/22437609
tags question: http://stackoverflow.com/q/22415552
tags question: http://stackoverflow.com/q/22337405
tags question: http://stackoverflow.com/q/22375831
type: Tag
tags question: http://stackoverflow.com/q/22426456
tags question: http://stackoverflow.com/q/22420083
tags question: http://stackoverflow.com/q/22484078
tags question: http://stackoverflow.com/q/22406924
tags question: http://stackoverflow.com/q/22342279
tags question: http://stackoverflow.com/q/22446103
tags question: http://stackoverflow.com/q/22452133
tags question: http://stackoverflow.com/q/22379759
tags question: http://stackoverflow.com/q/22342155
tags question: http://stackoverflow.com/q/22419817
tags question: http://stackoverflow.com/q/22481931
tags question: http://stackoverflow.com/q/22418040
tags question: http://stackoverflow.com/q/22336391
tags question: http://stackoverflow.com/q/22335253
tags question: http://stackoverflow.com/q/22442123
tags question: http://stackoverflow.com/q/22363797
tags question: http://stackoverflow.com/q/22451846
tags question: http://stackoverflow.com/q/22432473
tags question: http://stackoverflow.com/q/22357179
tags question: http://stackoverflow.com/q/22387502
tags question: http://stackoverflow.com/q/22427302
tags question: http://stackoverflow.com/q/22487295
tags question: http://stackoverflow.com/q/22374343
tags question: http://stackoverflow.com/q/22364586
tags question: http://stackoverflow.com/q/22404728
tags question: http://stackoverflow.com/q/22424912
tags question: http://stackoverflow.com/q/22450277
tags question: http://stackoverflow.com/q/22469674
tags question: http://stackoverflow.com/q/22444706
tags question: http://stackoverflow.com/q/22483686
tags question: http://stackoverflow.com/q/22373160
tags question: http://stackoverflow.com/q/22332745
tags question: http://stackoverflow.com/q/22383471
tags question: http://stackoverflow.com/q/22475471
tags question: http://stackoverflow.com/q/22467308
tags question: http://stackoverflow.com/q/22464028
tags question: http://stackoverflow.com/q/22400131
tags question: http://stackoverflow.com/q/22384706
tags question: http://stackoverflow.com/q/22389877
tags question: http://stackoverflow.com/q/22408398
tags question: http://stackoverflow.com/q/22425306
tags question: http://stackoverflow.com/q/22478258
tags question: http://stackoverflow.com/q/22405212
tags question: http://stackoverflow.com/q/22376418
tags question: http://stackoverflow.com/q/22485790
tags question: http://stackoverflow.com/q/22351542
tags question: http://stackoverflow.com/q/22417836
tags question: http://stackoverflow.com/q/22334328
tags question: http://stackoverflow.com/q/22431461
tags question: http://stackoverflow.com/q/22454004
tags question: http://stackoverflow.com/q/22338390
tags question: http://stackoverflow.com/q/22388348
tags question: http://stackoverflow.com/q/22487236
tags question: http://stackoverflow.com/q/22422089
tags question: http://stackoverflow.com/q/22350575
tags question: http://stackoverflow.com/q/22468726
tags question: http://stackoverflow.com/q/22455809
tags question: http://stackoverflow.com/q/22421869
tags question: http://stackoverflow.com/q/22410834
tags question: http://stackoverflow.com/q/22334144
tags question: http://stackoverflow.com/q/22434072
tags question: http://stackoverflow.com/q/22395531
tags question: http://stackoverflow.com/q/22462181
tags question: http://stackoverflow.com/q/22458265
tags question: http://stackoverflow.com/q/22457247
tags question: http://stackoverflow.com/q/22450313
tags question: http://stackoverflow.com/q/22353533
tags question: http://stackoverflow.com/q/22447676
tags question: http://stackoverflow.com/q/22460141
tags question: http://stackoverflow.com/q/22452299
tags question: http://stackoverflow.com/q/22438171

http://stackoverflow.com/a/22515419
type: Answer
answers question: http://stackoverflow.com/q/22467370
upvote count: 1
has body: Since MapWritable is implemented in terms of a Map, it is trivial to get this working, but the member is private. You could implement it yourself if you were willing to use reflection. See https://issues.apache.org/jira/browse/HADOOP-6842 for a bug report and potential workaround. A patch has been submitted to Hadoop to delegate the toString method properly, but unfortunately, it hasn't been applied and doesn't seem to have much traction. You could also apply the patch directly to your own copy of Hadoop, but that is not ideal either. I would recommend voting for the bug and maybe commenting on the issue so that the Hadoop maintainers realize this is impacting users. UPDATE: This bug has now been fixed in Hadoop 2.8.0.
downvote count: 0
score: 1

http://stackoverflow.com/comment/33995122
has text: No idea, but I woulkd start with an unpdate for Java (I think you use 7 Update 21 and the actual Version is 7 Update 51.
comment on: http://stackoverflow.com/q/22341464
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/22481601
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22480387
has comment: http://stackoverflow.com/comment/34201518
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22480387
upvote count: 2
has body: I have not tried this, but typically you would create your ObjectInputStream like this FileInputStream fis = new FileInputStream("filename.txt"); ObjectInputStream ois = new ObjectInputStream(fis); From the FileInputStream, you can call getChannel() which returns a FileChannel. On the FileChannel there is a method position() which returns the current file position. I would think as long as you have not buffering input stream in between, position() should return the right value.
type: AcceptedAnswer

http://stackoverflow.com/a/22431155
score: 2
upvote count: 2
has body: Calling clearProperty only removes the entry from a Hashtable. If you don't want to clear the property, remove the line that calls it and run the program again. System Properties: These changes are not persistent.
answers question: http://stackoverflow.com/q/22430999
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34071674
comment on: http://stackoverflow.com/q/22408931
score: 1
has text: What is the question? You want only the output of the mappers?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22386282
has body: I have to work with Solr, which I'll use from another webapp to index and search documents. I thought I could run an instance of it inside Eclipse, alongside my web application, but if I import the Solr war, Eclipse will unpack it in a web project. Is there a way to keep it as a War and just have it deployer inside a Tomcat server instance (in the IDE)? Or is there a better (easier) way to do what I want to do? Basically I want a running instance of Solr to which I can connect and operate from the web application I'm developing.
tagged with: solr
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: setup-deployment
tagged with: java
has answer: http://stackoverflow.com/a/22400663
tagged with: eclipse
type: Question
downvote count: 0
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/22400663
answer count: 1
has title: How to run Solr inside Eclipse?
favorite count: 0

http://stackoverflow.com/q/22415470
answer count: 2
has comment: http://stackoverflow.com/comment/34083671
has body: I am implementing a network application that has an associated set of "types". Namely: /** Universal type **/ INTEGER(0x0002), BIT_STRING(0x0003), OCTET_STRING(0x0004), NULL(0x0005), OBJECT_ID(0x0006), SEQUENCE(0x0010), /** Application specific **/ IP_ADDRESS(0x0040), COUNTER32(0x0041), GAUGE32(0x0042), TIME_TICKS(0x0043), OPAQUE(0x0044), COUNTER64(0x0046), UNSIGNED_INTEGER(0x0047); In my application I have to assign constraints on various types, as well as encode/decode them from a given type. Is there any way around not having to create a separate class for each one? Eg: Unsigned Integer + Gauge32 + Counter32 are all of the type long. They just have different constraints. Integer can be +- LONG.MAX , Gauge can only be positive long values, and counter can only be positive long values as well. Is there a design pattern that can account for these type of details?
has answer: http://stackoverflow.com/a/22415570
has comment: http://stackoverflow.com/comment/34083946
accepted answer: http://stackoverflow.com/a/22415570
possible better answer: http://stackoverflow.com/a/22415637
score: 0
has title: Design implementation
has answer: http://stackoverflow.com/a/22415637
has comment: http://stackoverflow.com/comment/34084020
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
type: Question

http://stackoverflow.com/comment/34087110
type: QuestionComment
comment on: http://stackoverflow.com/q/22417419
has text: As @anttix suggest, adding `@Autowired` annotation to the property will correct your problem additionally, the test is already instanced by the test runner so you do not have to include it in test.xml
score: 0
type: Comment

http://stackoverflow.com/a/22438643
downvote count: 0
type: Answer
has body: You're first idea of adding class2's to string didn't work because to string is not a static method, so you must call it on an object. I don't really see why you can't just make a call to each one individually, but most of your problems stem from trying to make static calls to the to string methods. I wasn't sure from your question , but if class 2 extends class 1 there is an easy fix: add super.toString() as the first line of class 2's to string method.
answers question: http://stackoverflow.com/q/22438551
score: 1
upvote count: 1

http://stackoverflow.com/q/22457756
downvote count: 2
has comment: http://stackoverflow.com/comment/34158298
has comment: http://stackoverflow.com/comment/34158313
type: Question
has comment: http://stackoverflow.com/comment/34158532
has comment: http://stackoverflow.com/comment/34159788
has comment: http://stackoverflow.com/comment/34158245
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/34159703
has comment: http://stackoverflow.com/comment/34158302
has comment: http://stackoverflow.com/comment/34158757
has comment: http://stackoverflow.com/comment/34158020
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34158155
answer count: 2
has body: I'm making a program that adding/removing registered plate numbers but I`m having a trouble when I remove a specific plate number. Here is some parts of my code. ArrayList&lt;String&gt; PlateNumber = new ArrayList&lt;String&gt;(10); System.out.println("Enter your Plate Number : "); Scanner pn = new Scanner(System.in); String PlateNumberxx = pn.nextLine(); System.out.println("Log in / Log out: "); Scanner YoN = new Scanner(System.in); String des = YoN.nextLine(); if(des.equals("log in")) { PlateNumber.add(PlateNumberxx); } if(des.equals("log out")){ PlateNumber.remove(PlateNumberxx); System.out.println("Time log out : " + PlateNumberxx + " " + d); } It doesnt remove what I enter in scanner. What is the problem in my code?
has comment: http://stackoverflow.com/comment/34158480
has comment: http://stackoverflow.com/comment/34159704
has comment: http://stackoverflow.com/comment/34158518
has comment: http://stackoverflow.com/comment/34158311
has answer: http://stackoverflow.com/a/22458109
has title: What is the proper way to remove specific string in arraylist?
favorite count: 0
possible better answer: http://stackoverflow.com/a/22458404
has answer: http://stackoverflow.com/a/22458404
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22458109
tagged with: java

http://stackoverflow.com/comment/34085550
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22416304
has text: You are right. You can go with it.

http://stackoverflow.com/comment/34092426
has text: @user2910237 Check what *source level* you have configured. It can't be 7.
type: Comment
comment on: http://stackoverflow.com/a/22420306
score: 0
type: AnswerComment

http://stackoverflow.com/a/22429850
answers question: http://stackoverflow.com/q/22429556
type: Answer
has body: I'm going to explain this through byte code. First thing to note is that while a reachable reference exists to an object, that object cannot be collected. A important aspect of this is that if a reference value is on the stack in a method's stack frame, the object being referenced is accessible. It therefore cannot be garbage collected. Compile the following program public class Example { public static void main(String[]args) { new Example().sayHello(); } public void sayHello() {} } Running javap -c Example will give you something like public static void main(java.lang.String[]); Code: stack=2, locals=1, args_size=1 0: new #2 // class Example 3: dup 4: invokespecial #3 // Method "&lt;init&gt;":()V 7: invokevirtual #4 // Method sayHello:()V 10: return A index 0, the new byte code instruction, creates a new object and pushes the reference to that object onto the stack. The dup instruction copies that value and pushes it on top of the stack. So you now have two references to that object. invokespecial uses one, invokevirtual uses the other (they pop the reference value they use). Once that is done, there are no more references to the object and it can be garbage collected. For reference, here are the byte code instructions.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/34429239
type: Comment
has text: I use CascadeType.All with orphanRemoval=true however it still throws the same exception...
comment on: http://stackoverflow.com/a/22498923
score: 0
type: AnswerComment

http://stackoverflow.com/q/22465740
has answer: http://stackoverflow.com/a/22465815
has comment: http://stackoverflow.com/comment/34172600
has title: Saving HTML content of any URL in a text file in Java
has answer: http://stackoverflow.com/a/22465806
score: 0
answer count: 2
tagged with: url
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34173283
tagged with: java
has body: I am trying to Save HTML Content of any URL as Text file in java but its not work How save it? My code is import java.io.*; class DemoTest { public static void main(String st[]) { try { FileInputStream fis = new FileInputStream("C:\Users\Admin\Desktop\new.html"); //a.html or pass tha path of html FileOutputStream fos = new FileOutputStream("b.txt");//to writw source in file while (true) { int i = fis.read(); if (i == -1) break; System.out.print((char) i);//display on cmd fos.write(i);// write the source in b.txt } } catch (Exception e) { } } }
type: Question
has comment: http://stackoverflow.com/comment/34172594

http://stackoverflow.com/q/22435907
has answer: http://stackoverflow.com/a/22436068
has answer: http://stackoverflow.com/a/22436265
has comment: http://stackoverflow.com/comment/34119482
type: Question
has body: I am kinda new to Java, and I am trying to write a function that maps all element indexes from an ArrayList into a HashMap, so I can easily see the indexes of duplicate elements. The code below works , but when I try to print the values using the second for, it shows completely different results! Example: 60 [40, 64] What the 2nd for shows 60 [64] more numbers 60 [64] HashMap&lt;Integer,ArrayList&lt;Integer&gt;&gt; table= new HashMap&lt;Integer,ArrayList&lt;Integer&gt;&gt;(); //checking all items in an ArrayList a //and putting their index in a hashTable for(int i=0; i&lt;a.size(); i++){ ArrayList&lt;Integer&gt; indexes = new ArrayList&lt;Integer&gt;(); indexes.add(i); for(int j=i+1; j&lt;a.size(); j++){ //are the items equal? if(a.get(j).equals(a.get(i))){ indexes.add(j); } } //put in the HashMap table.put(a.get(i), indexes); System.out.println(a.get(i) + " " +table.get((a.get(i)))); } //shows completely different results! for(int ix=1;ix&lt;table.size();ix++) System.out.println(a.get(ix) + " " +table.get(a.get(ix)));
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/22436265
answer count: 2
accepted answer: http://stackoverflow.com/a/22436068
has comment: http://stackoverflow.com/comment/34119469
has comment: http://stackoverflow.com/comment/34119346
has comment: http://stackoverflow.com/comment/34119415
tagged with: key
tagged with: key-value
has comment: http://stackoverflow.com/comment/34119477
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34119393
score: 0
has title: HashMap wrong values for keys
tagged with: java

http://stackoverflow.com/comment/33965268
type: AnswerComment
has text: srry sir i did not understood any thing:(
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22347363

jquery
tags question: http://stackoverflow.com/q/22449147
tags question: http://stackoverflow.com/q/22368973
tags question: http://stackoverflow.com/q/22329289
type: Tag
tags question: http://stackoverflow.com/q/22345559
tags question: http://stackoverflow.com/q/22458649
tags question: http://stackoverflow.com/q/22477899
tags question: http://stackoverflow.com/q/22348256
tags question: http://stackoverflow.com/q/22343072
tags question: http://stackoverflow.com/q/22464810
tags question: http://stackoverflow.com/q/22436018
tags question: http://stackoverflow.com/q/22486201
tags question: http://stackoverflow.com/q/22440838
tags question: http://stackoverflow.com/q/22400909
tags question: http://stackoverflow.com/q/22443146
tags question: http://stackoverflow.com/q/22474200
tag name: jquery
tags question: http://stackoverflow.com/q/22443640
tags question: http://stackoverflow.com/q/22378849
tags question: http://stackoverflow.com/q/22480475

http://stackoverflow.com/comment/34179244
has text: Can you add the stack trace and indicate which line caused the NPE? Thanks.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22469570

http://stackoverflow.com/q/22330350
has body: I'm trying to run a java command prompt program that receives a path to a 5GB csv file. While the path is guaranteed to be the right one and I'm running the program as root my program throws: (No such file or directory)ava.io.FileNotFoundException: /data/tmp/NPPES/npidata.csv at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:101) at java.io.FileReader.&lt;init&gt;(FileReader.java:58) ... the java line is: BufferedReader file = new BufferedReader( new FileReader(args[1])); the file listing: -rw-r--r-- 1 root root 4 Mar 11 15:35 empty.csv -rw-r--r-- 1 root root 5097950480 Feb 11 00:36 npidata.csv Then I thought it might be the file size so I created a 4 character file. Still nothing. Has anyone by any chance experienced this before? Update: I modified the java program to list all the receiving arguments and they displayed correctly. I was running the program through a shell script launch.sh with the following content: #!/bin/sh #echo on java -Xmx16000M -XX:MaxPermSize=512M -classpath "../classes:../lib/*" $@ When I ran it directly with java it worked: the file was found. The greatest mistery is that the cmd line params displayed correctly in both situations. I wonder if shell is actually adding some funny unseen chars to those params.
type: UnansweredQuestion
tagged with: centos
answer count: 1
has title: Java can't open file in CentOS 6.5
has answer: http://stackoverflow.com/a/22330532
type: Question
score: 0
tagged with: java

http://stackoverflow.com/q/22442700
upvote count: 3
answer count: 2
has answer: http://stackoverflow.com/a/22443068
accepted answer: http://stackoverflow.com/a/22443068
has comment: http://stackoverflow.com/comment/34133503
has answer: http://stackoverflow.com/a/22443012
has body: The title may be a bit hard to understand, but let me just briefly describe my problem. Let's assume I have an annotation like this: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface Identifier { } Now, I make a class which annotates any of its fields with it: public class Student { private String name; private String surname; @Identifier private String idNumber; ... } Finally, at runtime I want to create a Map with the key type of typeof(field annotated with @Identifier) and the value type of Student. Note that any field can be annotated with @Identifier. Any ideas? EDIT Ok, let me clarify this a bit: class Student { private String name; private String surname; @Identifier private String idNumber; } class Foo { @Identifier private Integer x; } // Now, what I want to have are two maps: SortedMap students; // key type: String // value type: Student SortedMap foos; // key type: Integer // value type: Foo Thanks in advance!
has comment: http://stackoverflow.com/comment/34133176
favorite count: 0
has comment: http://stackoverflow.com/comment/34133391
possible better answer: http://stackoverflow.com/a/22443012
tagged with: generics
has comment: http://stackoverflow.com/comment/34133124
has comment: http://stackoverflow.com/comment/34132451
has comment: http://stackoverflow.com/comment/34132130
type: AnsweredQuestion
has title: Create a generic map using type given at runtime
tagged with: reflection
downvote count: 0
tagged with: collections
type: Question
has comment: http://stackoverflow.com/comment/34132530
score: 3
has comment: http://stackoverflow.com/comment/34133342
has comment: http://stackoverflow.com/comment/34132854
tagged with: java
has comment: http://stackoverflow.com/comment/34132251
has comment: http://stackoverflow.com/comment/34132126
has comment: http://stackoverflow.com/comment/34132253
has comment: http://stackoverflow.com/comment/34132465
has comment: http://stackoverflow.com/comment/34133302
has comment: http://stackoverflow.com/comment/34132227

http://stackoverflow.com/q/22356825
linked to: http://stackoverflow.com/q/7229226
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/33982046
downvote count: 0
has comment: http://stackoverflow.com/comment/33981521
answer count: 1
has body: I have a JPanel inside of a JScrollPane which is nested inside some other containers. My JPanel uses a modified FlowLayout from SO user jxd in this question. This may be information overkill but the full nesting of the panel in question is as follows: JPanel (ModifiedFlowLayout) > JScrollPane > JPanel (GridBagLayout) > JTabbedPane > JPanel (GridBagLayout) > JSplitPane > JPanel (BorderLayout) > JFrame. The problem is that when I call pack() on my JFrame the JScrollPane/JPanel expands horizontally to fill the entire remaining screen space (across multiple monitors). The space used is more than is needed to display all of the components in the JPanel. I tried using setMaximumSize() on my JPanel but it seems to be ignored in this scenario. Ideally I would like the panel to have it's size dictated by space left after sizing the components that surround it. Can/how can this been done?
favorite count: 0
has comment: http://stackoverflow.com/comment/33981886
has title: JPanel inside JScrollPane expanding on pack
upvote count: 2
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/33982028
score: 2
linked to: http://stackoverflow.com/q/3679886
tagged with: java
has answer: http://stackoverflow.com/a/22358916
type: Question

http://stackoverflow.com/a/22434548
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22434479
has body: Why does this project always show me Id 9? The mechanism by which thread ids are generated is not specified ... but if you look at the code you will see that it is done using a simple counter that starts from zero. So if you run the same application again, and the order of thread creation is the same, corresponding threads will have the same ids. However, since this behaviour is unspecified, it would be unwise to rely on it. So, in your example, you are getting the same thread ids because your application is creating them in the same order, from one run to the next. I would estimate [assume?] Id's to be different. There is no basis for this assumption in the javadocs. And in fact it is incorrect.

google-apps
tags question: http://stackoverflow.com/q/22479856
tag name: google-apps
type: Tag

http://stackoverflow.com/a/22431428
score: 0
answers question: http://stackoverflow.com/q/22431241
type: Answer
has body: I am not clear, on what you want you are doing here. I assume that you want to read all the numbers from the file and print the "Whole" Array. Your Integer Array Variable "numbers" has not been initialized with the values read from the file and hence, you will not see any output If you run this code. To Fix, this, you need to assign the int[] variable returned from the method call inputData() to "numbers" Variable. I have updated these changes and tested the code on a sample file containing data 1 2 3 4 5 This worked fine for me. Hope this helps you. Note - Numbers in the Main method and inputData() Methods are different. package test; import java.io.*; import java.util.Scanner; public class test{ public static void main(String[] args) throws IOException{ int[] numbers = inputData(); printArray(numbers); } public static int[] inputData() throws IOException{ Scanner keyboard = new Scanner(System.in); String input; int lines; System.out.println("Please enter a file name: "); input = keyboard.nextLine(); File myfile = new File(input); if (!myfile.exists()){ System.out.println("File not found."); System.exit(0); } Scanner inputFile = new Scanner(myfile); lines = inputFile.nextInt(); //Find the Number of Lines int count = 0; while (inputFile.hasNextLine()){ count++; inputFile.nextLine(); } int[] numbers = new int[count]; inputFile.close(); inputFile = new Scanner(myfile); for (int i=0; i&lt;count; i++){ if (inputFile.hasNextInt()){ numbers[i] = inputFile.nextInt(); } } inputFile.close(); keyboard.close(); return numbers; } public static void printArray(int[] array){ for(int i=0;i&lt;array.length;i++) { System.out.println(array[i]); } } }

http://stackoverflow.com/comment/33978006
has text: "just put log4j.jar and log4j.properties into WEB-INF/lib and WEB-INF/classes of your web application" I have tried that, I get the same error
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22354798

http://stackoverflow.com/a/22443936
answers question: http://stackoverflow.com/q/22443342
has comment: http://stackoverflow.com/comment/34135322
has body: As the exception clearly says classnotfoundexception, which means that it cannot find the class org.apache.commons.logging.LogFactory in the classpath. Download the jars from commons-logging and put it in your classpath.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22443342
type: Answer

http://stackoverflow.com/comment/34178666
comment on: http://stackoverflow.com/q/22469208
type: Comment
type: QuestionComment
score: 1
has text: I think you misunderstand the problem statement or requirements. If you have to return an `ArrayList` then you have to put the result _into_ an `ArrayList` and return that. Also you should not be using unqualified (i.e. raw) generic types. It's an `ArrayList<Someclass>` and it would help to know what `Someclass` is supposed to be. You haven't really provided enough information.

http://stackoverflow.com/comment/34006281
comment on: http://stackoverflow.com/a/22370624
type: AnswerComment
score: 0
has text: if 13 Consecutive digits found i need to take all Consecutive digits and mask and concat beck to normal for input XXXX123456789123456 result should be XX123456%%%%%3456XX
type: Comment

http://stackoverflow.com/comment/33986661
type: QuestionComment
has text: Why ? the same situation is when i use another thread to capture output like: p = builder.start(); StreamGobbler outputGobbler = new StreamGobbler(p.getInputStream()); outputGobbler.start();
score: 0
comment on: http://stackoverflow.com/q/22359731
type: Comment

http://stackoverflow.com/comment/33957397
type: QuestionComment
has text: Actually I am using a lot of class files. These are like libraries. Why I need to create packages foe these files. Why can't I access code from these class files directly.
type: Comment
comment on: http://stackoverflow.com/q/22342431
score: 0

http://stackoverflow.com/a/22431981
accepted answer of: http://stackoverflow.com/q/22431950
answers question: http://stackoverflow.com/q/22431950
has comment: http://stackoverflow.com/comment/34112551
has comment: http://stackoverflow.com/comment/34112573
has comment: http://stackoverflow.com/comment/34114364
type: AcceptedAnswer
score: 0
has body: 1) In the future, please try to be more specific. Always cut/paste the exact error message, and point to the related line of code, if possible. 2) Even when you get past the compile errors, System.out.println(curr) probably isn't what you want. SUGGESTION: 3) Check out this link: Printing out a linked list using toString 'Hope that helps... ========================================================= ADDENDUM: ERROR #1: ----jGRASP exec: javac -g LinkedListDemo.java LinkedListDemo.java:8: set(int,java.lang.String) in LinkedList cannot be applied to () System.out.println("Strings in the Linked List: " + str.set()); CAUSE: You defined your own method, LinkedList.set(), like this: public void set(int index, String d) {...}. So if you want to use it, you need to give it two arguments: an integer index, and a string variable. You called it with zero arguments: str.set(). You need to call it correctly ... or call something else instead. ERROR #2: LinkedListDemo.java:20: listAll(java.lang.String) in LinkedList cannot be applied to () System.out.println("Number of T's in the List: " + str.listAll()); CAUSE: There are two problems here: 1) The + in your System.out.println() is expecting a string, you're giving it a function that returns "void". If "listAll()" returned a "String", that part would work. 2) The second problem is that "LinkedList.listAll()" expects an argument: String d. You're not passing any arguments. This is the same issue as ERROR #` above. ERROR #3: LinkedListDemo.java:27: 'void' type not allowed here System.out.print("Components of the list in Order: " + str.printRev CAUSE: Again, the + in your System.out.println() is expecting a string, you're giving it a function that returns "void". One solution is to change "printRev()" to return a string. A better solution might be to have "printRev()" call System.out.println() itself. Again - 'hope that helps!
type: Answer

http://stackoverflow.com/comment/34182943
score: 0
type: Comment
has text: Actually I think you're right, if the count is for number of duplicates it would start at 0.
type: AnswerComment
comment on: http://stackoverflow.com/a/22471813

http://stackoverflow.com/comment/34078661
has text: Okay, so just use an access token for the "resource owner." As I said, you only have to authorize an app once. After that, the app can keep using the access token. From the tutorial you linked to: "The access token is all you'll need to make API requests on behalf of this user, so you should store it away for safe-keeping (even though we don't for this tutorial). By storing the access token, you won't need to go through these steps again unless the user reinstalls your app or revokes access via the Dropbox website."
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22392860

http://stackoverflow.com/comment/34101954
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22424093
score: 0
has text: How's it `1/(1-c)`? If `getNextSample(...)` runs in `O(n)` (sequential, unfortunately) then the loop would be expected to run `1 + 2 + 3 + ... + m = m(m+1)/2`. If `m = cn` that's easily `O(n^2)`. A binary search would definitely make it more efficient. But I don't think it'll be a wide margin. Since the expected value of the loop would still be `m(m+1)/2`. Am I missing something here?

http://stackoverflow.com/a/22430763
answers question: http://stackoverflow.com/q/22430278
type: Answer
has body: There is no listening in your code. TCP listening in Java is accomplished via a ServerSocket. You aren't using one. Instead you're using Sockets at both ends. So what you have is two clients and no server. No communication is possible between two TCP clients.
score: 0

http://stackoverflow.com/comment/35824425
has text: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/timeouts/implicit_wait
comment on: http://stackoverflow.com/a/22350639
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/110144901
has text: Changing the application name, worked for me when I was trying to run the app on android 4.3
type: Comment
comment on: http://stackoverflow.com/a/47131403
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33948642
has text: @Sakura, many times the bindings aren't compatible. That is why I'm asking for specific library versions.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22333437

http://stackoverflow.com/comment/33954857
score: 1
comment on: http://stackoverflow.com/q/22341480
type: Comment
type: QuestionComment
has text: You can fix it once you understand **what** and **why** [NullPointerException](http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html) occur

http://stackoverflow.com/a/22371645
has comment: http://stackoverflow.com/comment/34008300
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34007213
has body: TableViewerColumn actionsNameCol = new TableViewerColumn(viewer, column); actionsNameCol.setLabelProvider(new ColumnLabelProvider(){ //make sure you dispose these buttons when viewer input changes Map&lt;Object, Button&gt; buttons = new HashMap&lt;Object, Button&gt;(); @Override public void update(ViewerCell cell) { TableItem item = (TableItem) cell.getItem(); Button button; if(buttons.containsKey(cell.getElement())) { button = buttons.get(cell.getElement()); } else { button = new Button((Composite) cell.getViewerRow().getControl(),SWT.NONE); button.setText("Remove"); buttons.put(cell.getElement(), button); } TableEditor editor = new TableEditor(item.getParent()); editor.grabHorizontal = true; editor.grabVertical = true; editor.setEditor(button , item, cell.getColumnIndex()); editor.layout(); } });
answers question: http://stackoverflow.com/q/22371348
downvote count: 0
score: 1

http://stackoverflow.com/comment/34183713
has text: you would guess correctly!! I spent an hour trying to figure it out and made no progress. 1 minutes and you got it. Thanks
comment on: http://stackoverflow.com/a/22472468
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34077560
type: QuestionComment
comment on: http://stackoverflow.com/q/22412133
has text: You have to test if the string length is > 0 before trying to delete a char. If it is, then delete. Otherwise, do nothing.
score: 0
type: Comment

http://stackoverflow.com/comment/34072547
type: QuestionComment
comment on: http://stackoverflow.com/q/22409389
has text: @Matthieu Didn't know it existed, but now I do thanks
score: 0
type: Comment

http://stackoverflow.com/comment/34070920
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22408412
has text: no idea what you're describing there, post a link to an image and I'll add it to the question...:)

http://stackoverflow.com/q/22441537
upvote count: 5
tagged with: indexoutofboundsexception
has body: So I have a question regarding printing arrays. These methods receive data from an array created from a file. The output should be 10 integers long in every row for as many integers are contained in the file. Let's say that the file contains {0, 1, 2, 3, 4, 5}, the output should be: 0 1 2 3 4 5 The first method works completely fine. The second method returns an error which I'll include down below. Can anyone help me figure out what's wrong? I've tried googling it but still don't understand. Here's the code: public static void printArray(int[] array){ System.out.println("Printing array: "); for (int i = 1; i&lt;array.length+1; i++){ System.out.printf("%7d", array[i-1]); if (i%10==0){ System.out.println(); } } System.out.println(); } public static void reverseArray(int[] array){ System.out.println("Printing reversed array: "); int a=0; for (int i = array.length; i&gt;-1; i--){ System.out.printf("%7d", array[i]); a++; if (a%10==0){ System.out.println(); } } System.out.println(); } Here's the error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 5 at Paniagua_ArrayProcessing.reverseArray(Paniagua_ArrayProcessing.java:49) at Paniagua_ArrayProcessing.main(Paniagua_ArrayProcessing.java:8) Thanks for any help! Hopefully it's only a simple problem. Edit: This is in java btw.
tagged with: printing
has comment: http://stackoverflow.com/comment/34129988
tagged with: arrays
has comment: http://stackoverflow.com/comment/36043846
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/44482035
has answer: http://stackoverflow.com/a/22441641
has answer: http://stackoverflow.com/a/22452411
answer count: 4
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22441701
has title: Printing Arrays/Reverse Array
has comment: http://stackoverflow.com/comment/34130065
type: Question
has answer: http://stackoverflow.com/a/22441701
accepted answer: http://stackoverflow.com/a/22441641
score: 5

http://stackoverflow.com/a/22385137
has comment: http://stackoverflow.com/comment/34032113
has comment: http://stackoverflow.com/comment/34034510
has comment: http://stackoverflow.com/comment/34037079
answers question: http://stackoverflow.com/q/22385118
type: Answer
score: 2
upvote count: 2
has body: This usually is a result of failing to close connections when you are done using them. This is known as a connection leak. Are you closing connections when you are done using them?
has comment: http://stackoverflow.com/comment/34032662
downvote count: 0

http://stackoverflow.com/comment/34354453
type: AnswerComment
comment on: http://stackoverflow.com/a/22471501
type: Comment
has text: I've done this myself, and it worked well -- the users really liked it.
score: 0

homoglyph
type: Tag
tags question: http://stackoverflow.com/q/22448369
tag name: homoglyph

http://stackoverflow.com/comment/34127889
comment on: http://stackoverflow.com/q/22439169
score: 0
type: QuestionComment
has text: is there a way to know if the constructor is deprecated using reflection ?
type: Comment

http://stackoverflow.com/a/56508200
downvote count: 0
type: Answer
has body: Parsing a string with date and time into a particular point in time (Java calls it an "Instant") is quite complicated. Java has been tackling this in several iterations. The latest one, java.time and java.time.chrono, covers almost all needs (except time dilation :) ). However, that complexity brings a lot of confusion. The key to understand date parsing is: Why does Java have so many ways to parse a date? There are several systems to measure a time. For instance, the historical Japanese calendars were derived from the time ranges of the reign of the respective emperor or dynasty. Then there is, e.g., the Unix timestamp. Fortunately, the whole (business) world managed to use the same. Historically, the systems were being switched from/to, for various reasons. E.g., from the Julian calendar to the Gregorian calendar in 1582; so, the 'western' dates before that need to be treated differently. And, of course, the change did not happen at once. Because the calendar came from the headquarters of some religion and other parts of Europe believed in other deities, for instance Germany did not switch until the year 1700. ...and why is the LocalDateTime, ZonedDateTime et al. so complicated There are time zones. A time zone is basically a "stripe"*[3] of the Earth's surface whose authorities follow the same rules of when does it have which time offset. This includes summer time rules. The time zones change over time for various areas, mostly based on who conquers whom. And one time zone's rules change over time as well. There are time offsets. That is not the same as time zones, because a time zone may be, e.g., "Prague", but that has summer time offset and winter time offset. If you get a timestamp with a time zone, the offset may vary, depending on what part of the year it is in. During the leap hour, the timestamp may mean two different times, so without additional information, it can't be reliably converted. Note: By timestamp I mean "a string that contains a date and/or t…
upvote count: 46
score: 46
answers question: http://stackoverflow.com/q/22463062

http://stackoverflow.com/q/22468234
type: UnansweredQuestion
tagged with: spring
tagged with: properties
has comment: http://stackoverflow.com/comment/34177173
has comment: http://stackoverflow.com/comment/34177348
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22543071
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34177120
has comment: http://stackoverflow.com/comment/34177327
downvote count: 0
has body: I'm using the Spring ApplicationContextInitializer to add PropertySources to the Enviroment. I have verified that that part is working as in it's loading the properties into the PropertySources. The part that I'm struggling with is figuring out how to access the Property values that were loaded in the ApplicationContextInitializer within the Spring XML configuration as well as the Java code itself. Here is a snippit of my ApplicationContextInitializer: public class ExternalPropertiesApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> { @Override public void initialize(ConfigurableApplicationContext applicationContext) { Properties properties = load_properties_from_external_source(); PropertiesPropertySource propertySource = new PropertiesPropertySource("external", properties); applicationContext.getEnvironment().getPropertySources().addFirst(propertySource); } } So this loads up my Properties which has key,value pairs like: jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/mydb jdbc.username=user jdbc.password=passwd My Spring configuration file looks like this: <context:component-scan base-package="com.example"/> <context:property-placeholder ignore-resource-not-found="true" system-properties-mode="OVERRIDE"/> <property name="driverClassName" value="${jdbc.driverClassName}"/> <property name="url" value="${jdbc.url}"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> This is failing because it doesn't recognize ${jdbc.driverClassName}. I also tried #{external.jdbc.driverClassName} which fails too. The first fails because I'm not explicitly loading jdbc.properties in my Spring configuration file (which is the intent). The latter fails because it can't find the external bean. What step am I missing? How do I expose the property values that were loaded externally? I also have a Java class like so: package com.example; @Component publ…
has comment: http://stackoverflow.com/comment/34220507
answer count: 1
tagged with: applicationcontext
has title: Accessing PropertySources in the Spring 3.1 application xml
favorite count: 0
has comment: http://stackoverflow.com/comment/34177039

http://stackoverflow.com/comment/34049678
has text: Correct if I wrong, but the `g`lobal flag should be used if `replaceAll` or equivalent method is not being used.
comment on: http://stackoverflow.com/a/22395974
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22388580
has comment: http://stackoverflow.com/comment/34036754
tagged with: string
has comment: http://stackoverflow.com/comment/34036823
has comment: http://stackoverflow.com/comment/34037047
score: 0
tagged with: while-loop
tagged with: append
accepted answer: http://stackoverflow.com/a/22388786
type: Question
type: AnsweredQuestion
tagged with: stringbuilder
tagged with: java
has comment: http://stackoverflow.com/comment/34037897
has answer: http://stackoverflow.com/a/22388786
answer count: 1
has title: StringBuilder and String Issues
has body: Given the input... Nathan E Long Jay L Stevens Edna J Jackson Emma Watson Alexa J Ness Charles A Miller I'm attempting to write code that reads it one line at a time, seperates the names into 3 tokens, and then rearrange those tokens to read... Long, Nathan E Stevens, Jay L Jackson, Edna J Ness, Alexa J Miller, Charles A Also if I get less than 3 tokens, I throw that name out completely such as Emma Watson. Code... public class Hmwk { public static void main(String[] args)throws FileNotFoundException { Scanner names = new Scanner(new File("input.txt")); int counter = 0; while (names.hasNextLine()) { String nameIn = names.next(); String delims = ("\t"); String[] tokens = nameIn.split(delims); if (tokens.length != 3) { continue; //returns to while loop and gets next line } String first = tokens[0]; String middle = tokens[1]; String last = tokens[2]; StringBuilder finalName = builder(first,middle,last); System.out.println(finalName); } } public static StringBuilder builder(String f, String m, String l) { StringBuilder theBuilder = new StringBuilder(); theBuilder.append(l); theBuilder.append(','); theBuilder.append(' '); theBuilder.append(f); theBuilder.append(' '); theBuilder.append(m); return theBuilder; } } All names in the file are separated by tabs. My code runs, but it doesn't print out... anything which has me completely confused. Where am I going wrong here?

http://stackoverflow.com/comment/34161586
has text: I think you cannot tell generally that a JPA merge will trigger select: it depends on how the entity looks like, e.g whether it has a `@Version` field or whether the ID is generated by your code.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22459233
score: 0

http://stackoverflow.com/comment/34013901
comment on: http://stackoverflow.com/a/22375852
type: AnswerComment
score: 0
has text: Is it possible for it to be serializable? If so, are there any examples around to implement this?
type: Comment

http://stackoverflow.com/comment/34159547
score: 0
type: AnswerComment
has text: @ErwinSmout Using these operators on booleans is well-defined in the JLS ([see here](http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.22.2)).
type: Comment
comment on: http://stackoverflow.com/a/22440004

http://stackoverflow.com/q/22350903
has comment: http://stackoverflow.com/comment/33971217
score: 0
has comment: http://stackoverflow.com/comment/34005340
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33977628
tagged with: selenium-webdriver
tagged with: internet-explorer
tagged with: java
has body: I am facing the following issue please Help me: When using my computer at the same time the tests are running in the background - it is very easy to make a test fail that would otherwise have passed. The easiest way to duplicate this is during sendKeys - when text is appearing in a text box - if I click on the browser title bar and hold and/or drag the window or try to work on eclipse at the same time - it is easy to break a test. I am using IE 7, Windows XP SP3. Regards, Gorav
has title: Instability When Multi-tasking on Machine for webdriver script
type: Question

http://stackoverflow.com/q/22424107
has comment: http://stackoverflow.com/comment/34098669
has comment: http://stackoverflow.com/comment/34099441
tagged with: exception
accepted answer: http://stackoverflow.com/a/22424195
has body: I keep getting this error whenever I attempt to run a specific jsp on my project I've done everything that i can think of (including recreating the database it needs, checking and rechecking the lines that I assume has the fault, line #165 of Projectbean.java, more specifically the prepared statement part of the public int rowCount() function) If someone could please point me to the right direction, it will be greatly appreciated. Projectservlet.java: import project.Projectbean; import java.io.IOException; import java.io.PrintWriter; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * * @author REY */ @WebServlet(name = "Projectservlet", urlPatterns = {"/Projectservlet"}) public class Projectservlet extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { /* TODO output your page here. You may use following sample code. */ out.println(" "); out.println(" "); out.println(" Servlet Projectservlet "); out.println(" "); out.println(" "); out.println(" Servlet Projectservlet at " + request.getContextPath() + " "); out.println(" "); out.println(" "); } finally { out.close(); } } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String option=request.getParameter("menu"); if(option == null || option.equals("menu")) { RequestDispatcher dr = request.getRequestDispatcher("Menu.jsp"); dr.forward(request, response); } else if(option.equals("stud")) { RequestDispatcher dr = request.getRequestDispatcher("Student.jsp");…
has comment: http://stackoverflow.com/comment/34099233
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34113797
tagged with: java
type: Question
tagged with: jsp
has answer: http://stackoverflow.com/a/22424195
has title: java.lang.NullPointerException on MVC structured program
has comment: http://stackoverflow.com/comment/34098610
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/34098864
has comment: http://stackoverflow.com/comment/34098485
has comment: http://stackoverflow.com/comment/34099157
answer count: 1
tagged with: javabeans

http://stackoverflow.com/q/22438677
has comment: http://stackoverflow.com/comment/34131420
answer count: 3
has comment: http://stackoverflow.com/comment/34124284
has comment: http://stackoverflow.com/comment/34132268
has comment: http://stackoverflow.com/comment/34131376
has comment: http://stackoverflow.com/comment/34124223
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/22438707
has comment: http://stackoverflow.com/comment/34125554
type: Question
has comment: http://stackoverflow.com/comment/34124425
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/34124232
has comment: http://stackoverflow.com/comment/34124729
tagged with: date
has title: Days difference in dates in java giving wrong output
linked to: http://stackoverflow.com/q/3802893
has body: Hi i am trying to calculate difference of two dates in days. The dates are 14 of this month and today. It should be 2. But o/p is 0 always. Code: long today = (new java.util.Date().getTime()); long difference =(long) (today - 1394809789186.0); long daysdifference = difference/(24*3600*1000); System.out.println(daysdifference); o/p: 0. whats wrong? Now i did another trick and it gives perfect answer dont know whats wrong with above code... SimpleDateFormat df = new SimpleDateFormat("dd.mm.yyyy"); long firstdateseconds = df.parse("14.03.2014").getTime(); long today = df.parse("16.03.2014").getTime(); long difference = (today-firstdateseconds); long days = (long)(difference/(24*3600*1000)); System.out.println(days); o/p : 2 // now correct bingo! Guys whats happening?
upvote count: 0
has comment: http://stackoverflow.com/comment/34125363
has comment: http://stackoverflow.com/comment/34124997
has answer: http://stackoverflow.com/a/22438872
favorite count: 0
has comment: http://stackoverflow.com/comment/34124329
has answer: http://stackoverflow.com/a/22442409

http://stackoverflow.com/q/22475745
upvote count: 3
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/22475787
has title: Android Null Pointer Exception Not sure How to fix it
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34189157
tagged with: nullpointerexception
type: Question
score: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/22475787
possible better answer: http://stackoverflow.com/a/22475937
has answer: http://stackoverflow.com/a/22475937
has body: I keep getting an error for a Null Pointer Exception on a line in my code and i'm not sure how to fix it. It's basically just a copy of another method so I don't know why it's giving me the error. Any help would be appreciated: import java.util.Calendar; import android.app.Activity; import android.os.Bundle; import android.widget.TabHost; import android.widget.TabHost.TabSpec; import android.widget.TextView; public class CurrentLesson extends Activity { TabHost th; TabSpec specs; TimingsDb tDb = new TimingsDb(this); Calendar c; String lesson; String week; String day; TextView tvTab1; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.current_lesson_tabs); c = Calendar.getInstance(); tvTab1 = (TextView) findViewById(R.id.textViewCLW1tv1); setupTabs(); int h = c.get(Calendar.HOUR_OF_DAY); int m = c.get(Calendar.MINUTE); int w = c.get(Calendar.DAY_OF_WEEK); if ((h == 9) &amp;&amp; (m &lt;= 50)) { lesson = "1"; } else if (((h == 9)&amp;&amp;((m &gt; 50)&amp;&amp;(m &lt;=59))) || ((h == 10)&amp;&amp;(m&lt;=40))) { lesson = "2"; } else if ((h == 11)&amp;&amp;(m&lt;=50)) { lesson = "3"; } else if (((h == 12)&amp;&amp;((m &gt; 50)&amp;&amp;(m &lt;=59))) || ((h == 13)&amp;&amp;(m&lt;=40))) { lesson = "4"; } else if (((h == 13)&amp;&amp;((m &gt; 40)&amp;&amp;(m &lt;=59))) || ((h == 14)&amp;&amp;(m&lt;=30))) { lesson = "5"; } else if (((h == 14)&amp;&amp;((m &gt; 30)&amp;&amp;(m &lt;=59))) || ((h == 15)&amp;&amp;(m&lt;=20))) { lesson = "6"; } else { lesson = "0"; } switch(w){ case 2: day = "Monday"; break; case 3: day = "Tuesday"; break; case 4: day = "Wednesday"; break; case 5: day = "Thursday"; break; case 6: day = "Friday"; break; default: day = ""; }//end switch week = "1"; String temp; temp = tDb.getCurrent(day,week,lesson); //THIS IS WHERE I GET THE EXCEPTION if(!(temp == null)){ tvTab1.setText(temp); } }// end onCreate public void setupTabs() { th = (TabHost) findV…
has comment: http://stackoverflow.com/comment/34189137

http://stackoverflow.com/comment/33991313
type: Comment
has text: i posted a comment in the main answer
comment on: http://stackoverflow.com/a/22361674
score: 0
type: AnswerComment

http://stackoverflow.com/q/22355130
has answer: http://stackoverflow.com/a/23433357
type: Question
has comment: http://stackoverflow.com/comment/35912509
downvote count: 0
has title: How do I reduce/change delay after crawling?
answer count: 1
favorite count: 0
has body: Has anybody experience with using Crawler4j? I followed the example from the project page to realize my own crawler. The crawler is working fine and crawls very fast. The only thing is that I always have a delay of 20–30 seconds. Is there a way to avoid the waiting time?
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: crawler4j
tagged with: web-crawler

recursion
type: Tag
tags question: http://stackoverflow.com/q/22443098
tags question: http://stackoverflow.com/q/22467691
tags question: http://stackoverflow.com/q/22445917
tags question: http://stackoverflow.com/q/22414624
tag name: recursion
tags question: http://stackoverflow.com/q/22406852
tags question: http://stackoverflow.com/q/22441276
tags question: http://stackoverflow.com/q/22406504
tags question: http://stackoverflow.com/q/22401615
tags question: http://stackoverflow.com/q/22372049
tags question: http://stackoverflow.com/q/22417969
tags question: http://stackoverflow.com/q/22430967
tags question: http://stackoverflow.com/q/22330906
tags question: http://stackoverflow.com/q/22434762
tags question: http://stackoverflow.com/q/22427022
tags question: http://stackoverflow.com/q/22415728
tags question: http://stackoverflow.com/q/22367816
tags question: http://stackoverflow.com/q/22444553
tags question: http://stackoverflow.com/q/22334641
tags question: http://stackoverflow.com/q/22441739
tags question: http://stackoverflow.com/q/22336147
tags question: http://stackoverflow.com/q/22380958
tags question: http://stackoverflow.com/q/22469345
tags question: http://stackoverflow.com/q/22443763
tags question: http://stackoverflow.com/q/22450835

http://stackoverflow.com/comment/34086789
score: 0
has text: Maybe you should consider using a single component and paint in it (override [`paintComponent()`](http://docs.oracle.com/javase/7/docs/api/javax/swing/JComponent.html#paintComponent(java.awt.Graphics)))
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22417290

http://stackoverflow.com/a/22377590
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22377432
accepted answer of: http://stackoverflow.com/q/22377432
has body: This can be done in different way:- try { File file = new File("newfile.txt"); Scanner input = new Scanner(file); while (input.hasNextLine()) { String input1 = input.readLine();// read one line String num[] = input1.split("\\|");// split line by "|" Book k1 = new Book(num[0], num[1]); listofbooks.add(k1); } } catch (FileNotFoundException e) { System.err.format("File does not exist"); }
score: 0

http://stackoverflow.com/comment/34007663
has text: I am handling my javascript as a calendar like this: http://postimg.org/image/spe7u93nh/
comment on: http://stackoverflow.com/a/22371824
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22422553
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/49468982
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/11356237
tagged with: email
answer count: 0
downvote count: 0
score: 1
tagged with: smtp
has body: This is my code public class MailSend { String host, port, emailid,username, password; Properties props = System.getProperties(); Session l_session = null; private static final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; public MailSend() { host = "smtp.mail.yahoo.com"; port = "587"; username = "xxxx@yahoo.com"; password = "xxxxxx"; } public String sendMail(String toaddress,String subj,String msg) { emailSettings(); createSession(); String res= sendMessage("xxxx@yahoo.com", toaddress,subj,msg); return res; } public void emailSettings() { props.put("mail.smtp.host", host); props.put("mail.smtp.auth", "true"); props.put("mail.debug", "true"); props.put("mail.smtp.port", port); props.put("mail.smtp.socketFactory.port", port); props.put("mail.smtp.socketFactory.class", SSL_FACTORY); } public void createSession() { l_session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("xxxx@yahoo.com", "xxxxx"); } }); l_session.setDebug(true); // Enable the debug mode } public String sendMessage(String emailFromUser, String toEmail, String subject, String msg) { try { Address addr = new javax.mail.internet.InternetAddress("xxxxx@yahoo.com","xxxx@yahoo.com"); MimeMessage message = new MimeMessage(l_session); emailid = emailFromUser; message.setFrom(addr); message.addRecipient(Message.RecipientType.TO, new InternetAddress(toEmail)); message.setSubject(subject); message.setContent(msg, "text/html"); Transport.send(message); System.out.println("Mail Sent"); } catch (MessagingException mex) { mex.printStackTrace(); } catch (Exception e) { e.printStackTrace(); }//end catch block return "success"; } public static void main(String args[]) { MailSend m=new MailSend(); m.sendMail("xxxxxxx@yahoo.com", "welcome", "testing"); } when i run this code i got the following exception **com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.1 Authentication required** Exception. but i'm …
favorite count: 0
has title: Java Send Mail Using yahoo
type: Question

http://stackoverflow.com/a/22405689
has body: Rather than "caught vs uncaught" they are called "checked vs. unchecked" exceptions. At compile-time checked exceptions are controlled i.e. compiler warns you if something doesn't comply with the exception contract, but unchecked ones can be thrown at runtime.
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22405626
type: Answer

http://stackoverflow.com/a/22405373
answers question: http://stackoverflow.com/q/22404750
type: Answer
downvote count: 0
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34074542
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22404750
has body: No, folder hierarchy is same but root of sd-card can be mounted somewhere else and your program would not work. Use: File paths = Environment.getExternalStorageDirectory(); to get root of sd-card and your program will work on all phones. EDIT: For example I have CM 11 ROM and Kernel which uses different layout than on other phones.

http://stackoverflow.com/comment/34120738
type: Comment
has text: Check if the file is actually being accessed by the program. Also check if the file is in the proper place.
score: 0
comment on: http://stackoverflow.com/q/22436611
type: QuestionComment

http://stackoverflow.com/comment/34196791
has text: @TLama - post it as an answer, I will delete mine. +1
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22480059

http://stackoverflow.com/comment/34088483
has text: @fge Yes Java 7 and I'll change the exception to IllegalArgumentException then
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22417980

http://stackoverflow.com/comment/34048947
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22362430
has text: But if its possible to change the size in ellipse, what the method use to make a rectangle object?
type: Comment

http://stackoverflow.com/a/22442719
has comment: http://stackoverflow.com/comment/45727108
has comment: http://stackoverflow.com/comment/34144301
has comment: http://stackoverflow.com/comment/74106683
has comment: http://stackoverflow.com/comment/34181588
upvote count: 71
answers question: http://stackoverflow.com/q/22439593
downvote count: 1
has comment: http://stackoverflow.com/comment/34181418
has comment: http://stackoverflow.com/comment/34143151
has comment: http://stackoverflow.com/comment/34167660
has comment: http://stackoverflow.com/comment/66599539
has body: Build Types (debug, release, or custom) can have their own dependencies. To specify a dependency specific to a build type, do the following: dependencies { debugCompile "mydebugdependency" releaseCompile "myreleasedependency" } If your java project and android project are both using gradle, you can do the above in both of their build.gradle files.
has comment: http://stackoverflow.com/comment/52447537
has comment: http://stackoverflow.com/comment/34140830
score: 70
has comment: http://stackoverflow.com/comment/97492935
has comment: http://stackoverflow.com/comment/34141020
type: Answer
has comment: http://stackoverflow.com/comment/38662374

http://stackoverflow.com/comment/34135382
type: Comment
type: QuestionComment
has text: @JBNizet It depends on who the label is laid out. If they are using a `null` layout, it may not...
comment on: http://stackoverflow.com/q/22435029
score: 0

http://stackoverflow.com/a/22445073
has comment: http://stackoverflow.com/comment/34137026
answers question: http://stackoverflow.com/q/22436084
type: Answer
has comment: http://stackoverflow.com/comment/34137040
accepted answer of: http://stackoverflow.com/q/22436084
has body: The cardinal rule of Spring IoC container is to let Spring manage most, if not all, of your dependencies and objects. Your HibernateConfig class is annotated with @Configuration. This is an indication that it should be managed by Spring, which you are doing correctly in your context file &lt;bean class="org.ligadesportiva.resources.HibernateConfig"/&gt; however, you're not using it anywhere. You're also not declaring a UsuarioHome bean. Instead, you are creating these objects yourself UsuarioHome tempHome = new UsuarioHome(); // and private HibernateConfig hibernateConfig = new HibernateConfig(); How do you expect Spring to process them? Go through the documentation of Spring IoC container to understand how to manage these dependencies through your context configuration.
score: 0
type: AcceptedAnswer

jersey
tags question: http://stackoverflow.com/q/22355235
tags question: http://stackoverflow.com/q/22370559
tags question: http://stackoverflow.com/q/22386462
tags question: http://stackoverflow.com/q/22414658
tags question: http://stackoverflow.com/q/22366213
tags question: http://stackoverflow.com/q/22410381
tags question: http://stackoverflow.com/q/22469118
tags question: http://stackoverflow.com/q/22374951
tags question: http://stackoverflow.com/q/22413239
tags question: http://stackoverflow.com/q/22463845
tags question: http://stackoverflow.com/q/22475881
tag name: jersey
tags question: http://stackoverflow.com/q/22427683
tags question: http://stackoverflow.com/q/22433604
tags question: http://stackoverflow.com/q/22472845
tags question: http://stackoverflow.com/q/22483744
tags question: http://stackoverflow.com/q/22333647
tags question: http://stackoverflow.com/q/22469838
tags question: http://stackoverflow.com/q/22346056
tags question: http://stackoverflow.com/q/22449790
tags question: http://stackoverflow.com/q/22364508
type: Tag
tags question: http://stackoverflow.com/q/22434181
tags question: http://stackoverflow.com/q/22339248
tags question: http://stackoverflow.com/q/22357250
tags question: http://stackoverflow.com/q/22342782

http://stackoverflow.com/comment/33947251
type: AnswerComment
type: Comment
has text: @user2342687 please accept my answer as it seems to have helped you. Thanks.
comment on: http://stackoverflow.com/a/22335479
score: 0

http://stackoverflow.com/comment/33966846
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22348024
has text: `it returns true if at least one line is correct` can we see code you are using?
score: 0

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

logback
tags question: http://stackoverflow.com/q/22383166
tags question: http://stackoverflow.com/q/22438231
tags question: http://stackoverflow.com/q/22332198
type: Tag
tags question: http://stackoverflow.com/q/22335441
tag name: logback
tags question: http://stackoverflow.com/q/22423179

http://stackoverflow.com/comment/34174461
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22448225
type: AnswerComment
has text: thanks Alex, I do agree that my code posted is not good practice, but I also think that building UI lists in the servlet is also not good practice. IMHO, I think FreeMarker is much better for view than JSTL, so I will just stick to my stengths on my project and not try to do with JSTL things that it was not meant to do.

http://stackoverflow.com/comment/34128380
type: Comment
comment on: http://stackoverflow.com/q/22440142
score: 0
has text: Does anyone have a better example of this? I found a thread on Stackoverflow - http://stackoverflow.com/questions/10076789/how-to-display-the-database-in-a-listview-android?rq=1 Creating a database and displaying the results within a list in my app.
type: QuestionComment

http://stackoverflow.com/q/22480863
has comment: http://stackoverflow.com/comment/34199757
has comment: http://stackoverflow.com/comment/34199303
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34199539
upvote count: 1
tagged with: spring
tagged with: unit-testing
tagged with: jakarta-ee
has title: Mock an attribute within an HttpServlet through the WebApplicationContext
has comment: http://stackoverflow.com/comment/34200084
score: 1
tagged with: java
tagged with: servlets
type: Question
has body: Suppose I have an HttpServlet with an attribute (MyAttribute). I want to replace the latter with a mock, after the servlet has been initialized. I'm instantiating my attribute in the overridden MyServlet.init() method like this: WebApplicationContext wac = getWebApplicationContext(); this.myAttribute = (MyAttribute) wac.getBean("myAttribute"); Now, in my unit test all I got is a WebApplicationContext object.1 I planned mocking the attribute like this: MyServlet myServlet = (MyServlet) WebApplicationContext.getServletContext().getServlet("myServlet"); myServlet.setMyAttribute(EasyMock.createStrictMock(MyAttribute.class)); Unfortunately, the ServletContext().getServlet() method is deprecated, currently returns always null and will be permanently removed in future versions. Hence my question: How to mock an attribute of an HttpServlet through a WebApplicationContext? 1: This is due to my unit test starting a Tomcat'ish Server instance in an own thread returning me the WebApplicationContext of my application after it's up and running.
downvote count: 0

http://stackoverflow.com/comment/34054019
type: QuestionComment
score: 0
has text: @Kedarnath Not fully tested yet but my AVD is working fine
comment on: http://stackoverflow.com/q/22398116
type: Comment

swing
tags question: http://stackoverflow.com/q/22450884
tags question: http://stackoverflow.com/q/22356011
tags question: http://stackoverflow.com/q/22406046
tags question: http://stackoverflow.com/q/22340967
tags question: http://stackoverflow.com/q/22481052
tags question: http://stackoverflow.com/q/22366890
tags question: http://stackoverflow.com/q/22400390
tags question: http://stackoverflow.com/q/22418159
tags question: http://stackoverflow.com/q/22468491
tags question: http://stackoverflow.com/q/22380555
tags question: http://stackoverflow.com/q/22471530
tags question: http://stackoverflow.com/q/22398710
tags question: http://stackoverflow.com/q/22339157
tags question: http://stackoverflow.com/q/22339329
tags question: http://stackoverflow.com/q/22417797
tags question: http://stackoverflow.com/q/22424869
tags question: http://stackoverflow.com/q/22469574
tags question: http://stackoverflow.com/q/22360471
tags question: http://stackoverflow.com/q/22351534
tags question: http://stackoverflow.com/q/22441720
tags question: http://stackoverflow.com/q/22471796
tags question: http://stackoverflow.com/q/22366378
tags question: http://stackoverflow.com/q/22386693
tags question: http://stackoverflow.com/q/22423125
tags question: http://stackoverflow.com/q/22474969
tags question: http://stackoverflow.com/q/22472357
tags question: http://stackoverflow.com/q/22446261
tags question: http://stackoverflow.com/q/22475350
tags question: http://stackoverflow.com/q/22414942
tags question: http://stackoverflow.com/q/22479566
tags question: http://stackoverflow.com/q/22400348
tags question: http://stackoverflow.com/q/22367938
tags question: http://stackoverflow.com/q/22353639
tags question: http://stackoverflow.com/q/22334058
tags question: http://stackoverflow.com/q/22452426
tags question: http://stackoverflow.com/q/22388925
tags question: http://stackoverflow.com/q/22426813
tags question: http://stackoverflow.com/q/22337053
tags question: http://stackoverflow.com/q/22360457
tags question: http://stackoverflow.com/q/22470814
tags question: http://stackoverflow.com/q/22329956
tags question: http://stackoverflow.com/q/22463157
tags question: http://stackoverflow.com/q/22414811
tags question: http://stackoverflow.com/q/22385429
tags question: http://stackoverflow.com/q/22413136
tags question: http://stackoverflow.com/q/22340360
tags question: http://stackoverflow.com/q/22361198
tags question: http://stackoverflow.com/q/22391531
tags question: http://stackoverflow.com/q/22418175
tags question: http://stackoverflow.com/q/22401837
tags question: http://stackoverflow.com/q/22360672
tags question: http://stackoverflow.com/q/22481748
tags question: http://stackoverflow.com/q/22334749
tags question: http://stackoverflow.com/q/22451425
tags question: http://stackoverflow.com/q/22339123
tags question: http://stackoverflow.com/q/22440733
tags question: http://stackoverflow.com/q/22335134
tags question: http://stackoverflow.com/q/22351026
tags question: http://stackoverflow.com/q/22445502
tags question: http://stackoverflow.com/q/22480870
tags question: http://stackoverflow.com/q/22463308
tags question: http://stackoverflow.com/q/22329253
tags question: http://stackoverflow.com/q/22354451
tags question: http://stackoverflow.com/q/22481338
tags question: http://stackoverflow.com/q/22419350
tags question: http://stackoverflow.com/q/22436779
tags question: http://stackoverflow.com/q/22340699
tags question: http://stackoverflow.com/q/22351753
tags question: http://stackoverflow.com/q/22363829
tags question: http://stackoverflow.com/q/22462275
tags question: http://stackoverflow.com/q/22462859
tags question: http://stackoverflow.com/q/22430879
tags question: http://stackoverflow.com/q/22366853
tags question: http://stackoverflow.com/q/22370448
tags question: http://stackoverflow.com/q/22418640
tags question: http://stackoverflow.com/q/22342500
tags question: http://stackoverflow.com/q/22379395
tags question: http://stackoverflow.com/q/22378051
tags question: http://stackoverflow.com/q/22483189
tags question: http://stackoverflow.com/q/22353733

http://stackoverflow.com/q/22469118
has body: I am currently in the early stages of creating a web application (HTML5, JS, etc.) that uses a REST API on the backend (Java, specifically Jersey v1.18). The nature of the data that will be stored is highly sensitive, so security is something that I’ve started looking at, even though the application is only in the early stages. The eventual goal will be to have native mobile applications as well, and to potentially provide access to the data for external clients via the same API. In my research thus far, I have identified a variety of authentication methods, including HTTP Basic, token-based, session cookie, OAuth, HMAC, etc. The key component here is that the REST API will be primarily accessed by users, rather than other applications or backends. Thus, having a “login/logout” equivalent is important, and this boils down to user level authentication. So far, HMAC authentication looks to be the most promising, as we have no plans to integrate with any OAuth provider at this moment. I have already read through dozens of SO posts, as well as articles such as: http://www.thebuzzmedia.com/designing-a-secure-rest-api-without-oauth-authentication/ http://www.errant.me.uk/blog/2013/04/authenticating-restful-web-applications/ (note: this is clearly bad, as salting with the username is not recommended) Ideally, HMAC seems like the way to go, but I have yet to see a recommended approach to handling the shared secret. The idea of using a resource to validate credentials, which then provides a token/nonce to be used with the HMAC scheme, seems to be an option, but I’m questioning the advantages over just using this token/nonce strictly as a token. I know that HMAC authentication for a REST API has been discussed at length, but when used in conjunction with the authentication details that users have come to expect (username, email, password, etc.), is there any recommended approach that doesn’t require a pre-shared secret key?
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Web App Authentication for REST API Backend
tagged with: jersey
tagged with: hmac
tagged with: security
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22469327
tagged with: rest

http://stackoverflow.com/comment/34041343
type: QuestionComment
has text: How exactly would you create *one* method, when there are two different operations: one to fetch data and one to set it? What would you pass in as the argument if you just wanted to fetch the existing value?
comment on: http://stackoverflow.com/q/22391221
score: 0
type: Comment

http://stackoverflow.com/q/22414886
favorite count: 0
has answer: http://stackoverflow.com/a/22415012
has body: Hi I am having trouble with Scanner to get user input two separate ArrayList. When I run this code I get an IndexOutOfBounds exception after entering the two arrays. The code adds two binary numbers together using logic of a ripple adder. An example of intended user input would be Enter A array: 1 0 1 0 Enter B Array: 0 0 0 1 producing: 1 0 1 1 The code works when arrays are hard coded, how can I get the user to enter the arrays? Code is shown below import java.util.*; public class AdderApp { public static void main(String[] args) { Scanner inputA = new Scanner(System.in); ArrayList&lt;Integer&gt; aList = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; bList = new ArrayList&lt;Integer&gt;(); int c = 0; System.out.println("Enter A array"); aList.add(inputA.nextInt()); Scanner inputB = new Scanner(System.in); System.out.println("Enter B array"); bList.add(inputB.nextInt()); Adder bit1 = new Adder(parseInput(aList.get(3)), parseInput(bList.get(3)), parseInput(c)); Adder bit2 = new Adder(parseInput(aList.get(2)), parseInput(bList.get(2)), bit1.getCout()); Adder bit3 = new Adder(parseInput(aList.get(1)), parseInput(bList.get(1)), bit2.getCout()); Adder bit4 = new Adder(parseInput(aList.get(0)), parseInput(bList.get(0)), bit3.getCout()); if (bit4.getCout() == false) { System.out.println(bit4.toString() + " " + bit3.toString() + " " + bit2.toString() + " " + bit1.toString()); } else { System.out.println("overflow!"); } } public static boolean parseInput(int i) { if (i == 1) { return true; } else { return false; } } } Code for Adder class: public class Adder { private boolean a, b, cin, cout, s; /** * Full Adder contructor */ public Adder(boolean a, boolean b, boolean cin) { this.a = a; this.b = b; this.cin = cin; s = nand(nand(a, b), cin); //sum bit cout = or(and(nand(a, b), cin), and(a, b)); // - carry bit } /** Half adder constructor */ // public Adder (bloolean a, boolean b) { // // this.a = a; // this.b = b; // // s = //} /** * NAND gate */ public boolean nand…
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22417715
tagged with: java
has title: How do I get user input into two separate arrays?
upvote count: 1
has answer: http://stackoverflow.com/a/22415069
has answer: http://stackoverflow.com/a/22414994
type: Question
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22414994
accepted answer: http://stackoverflow.com/a/22417715
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34083265

http://stackoverflow.com/comment/34002443
has text: Yes, with Spring's architecture you can!
comment on: http://stackoverflow.com/q/22368414
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34062311
comment on: http://stackoverflow.com/q/22403843
score: 0
type: Comment
type: QuestionComment
has text: Have a look at this question - http://stackoverflow.com/questions/9370112/getresource-cant-load-content-in-a-jar

http://stackoverflow.com/q/22335680
has comment: http://stackoverflow.com/comment/33944732
score: 1
has title: Start:applet not initialized when trying to open a frame in an applet
favorite count: 0
accepted answer: http://stackoverflow.com/a/22335741
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
has body: I ran across a code in the book java 2 by Herbert Schildt .Here is the code . import java.applet.Applet; import java.awt.; import java.awt.event.; public class SampleFrame extends Frame { public SampleFrame(String title) { super(title); MyWindowAdapter wAdapter = new MyWindowAdapter(this); addWindowListener(wAdapter); } public void paint(Graphics g) { g.drawString("this is in the frame window", 10, 40); } } class MyWindowAdapter extends WindowAdapter { SampleFrame sampleFrame; public MyWindowAdapter(SampleFrame sampleFrame) { this.sampleFrame = sampleFrame; } public void WindowClosing(WindowEvent we) { sampleFrame.setVisible(false); } } class MyApplet extends Applet { Frame f; public void init() { f = new SampleFrame("a frame window"); f.setSize(250, 250); f.setVisible(true); } public void start() { f.setVisible(true); } public void stop() { f.setVisible(false); } public void paint(Graphics g) { g.drawString("this is an applet window", 10, 20); } } according to the book it should start an applet which should start a frame . But when the applet starts in the status bar it say "start:applet not initilized" why so? I did create applets without declaring my derived applet class as public like this import java.applet.Applet; import java.awt.Graphics; import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; class MouseEvents extends Applet implements MouseListener, MouseMotionListener { String msg = ""; int mouseX = 0 ,mouseY = 0 ,count=0; Boolean tPU ; private Point myPoint; public MouseEvents() { myPoint = new Point(); } public void init() { addMouseListener(this); addMouseMotionListener(this); } @Override public void mouseDragged(MouseEvent arg0) { // TODO Auto-generated method stub mouseX = arg0.getX(); mouseY = arg0.getY(); msg = "*"; myPoint = arg0.getPoint(); tPU = arg0.isPopupTrigger(); count = arg0.getClickCount(); arg0.translatePoint(100, 100); myPoint = arg0.getPoint(); showStatus("…
has answer: http://stackoverflow.com/a/22335741
has comment: http://stackoverflow.com/comment/33944997
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33944635

http://stackoverflow.com/comment/33961621
type: AnswerComment
score: 0
type: Comment
has text: just edit your question and put 2-3 lines from your "el.text()" output. That won't hurt us.
comment on: http://stackoverflow.com/a/22345228

http://stackoverflow.com/comment/33991711
has text: that lib is for java config for spring security
comment on: http://stackoverflow.com/a/22361895
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22423063
has body: In the code: System.setProperty("javax.net.ssl.trustStore", cacerts); System.setProperty("javax.net.ssl.trustStorePassword", pwdCacerts); SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket("localhost", port); I obtain a Java Exception: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) at javax.net.ssl.DefaultSSLSocketFactory.throwException(Unknown Source) at javax.net.ssl.DefaultSSLSocketFactory.createSocket(Unknown Source) at PracticaRO.Cliente.main(Cliente.java:24) Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) at java.security.Provider$Service.newInstance(Unknown Source) at sun.security.jca.GetInstance.getInstance(Unknown Source) at sun.security.jca.GetInstance.getInstance(Unknown Source) at javax.net.ssl.SSLContext.getInstance(Unknown Source) at javax.net.ssl.SSLContext.getDefault(Unknown Source) at javax.net.ssl.SSLSocketFactory.getDefault(Unknown Source) at PracticaRO.Cliente.main(Cliente.java:23) Caused by: java.io.IOException: Invalid keystore format at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source) at sun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown Source) at java.security.KeyStore.load(Unknown Source) at sun.security.ssl.TrustManagerFactoryImpl.getCacertsKeyStore(Unknown Source) at sun.security.ssl.SSLContextImpl$DefaultSSLContext.getDefaultTrustManager(Unknown Source) at sun.security.ssl.SSLContextImpl$DefaultSSLContext.&lt;init&gt;(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unk…
tagged with: truststore
tagged with: sslsocketfactory
score: 0
has title: Java Exception on SSLSocket creation
has answer: http://stackoverflow.com/a/22423447
tagged with: keytool
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/36635974
answer count: 4
tagged with: java
has answer: http://stackoverflow.com/a/22423622
type: Question
has answer: http://stackoverflow.com/a/27482642

http://stackoverflow.com/a/22404088
answers question: http://stackoverflow.com/q/22403939
type: Answer
has body: try this: public static void main(String[] args) { ArrayList&lt;Character&gt; list = new ArrayList&lt;Character&gt;(0); list.add('a'); list.add('b'); list.add('c'); list.add('d'); list.add('e'); char c = 'e'; if (list.contains(c)) { System.out.println(c + "already in list"); } else { list.add(c); } System.out.println(list.toString()); }
score: 0

http://stackoverflow.com/comment/34104633
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22426791
type: AnswerComment
has text: Your algorithm seems to work fine when I tried it. At least for a 8x8 board, with the starting point 0,4 (the example on wikipedia).

web-services
tags question: http://stackoverflow.com/q/22422041
tags question: http://stackoverflow.com/q/22472214
type: Tag
tags question: http://stackoverflow.com/q/22470563
tags question: http://stackoverflow.com/q/22456236
tags question: http://stackoverflow.com/q/22466392
tags question: http://stackoverflow.com/q/22407994
tags question: http://stackoverflow.com/q/22479633
tags question: http://stackoverflow.com/q/22342236
tags question: http://stackoverflow.com/q/22346018
tags question: http://stackoverflow.com/q/22471249
tags question: http://stackoverflow.com/q/22450051
tags question: http://stackoverflow.com/q/22436018
tags question: http://stackoverflow.com/q/22379468
tags question: http://stackoverflow.com/q/22368522
tags question: http://stackoverflow.com/q/22349744
tags question: http://stackoverflow.com/q/22425306
tags question: http://stackoverflow.com/q/22358872
tags question: http://stackoverflow.com/q/22474994
tags question: http://stackoverflow.com/q/22438030
tags question: http://stackoverflow.com/q/22427747
tags question: http://stackoverflow.com/q/22386462
tags question: http://stackoverflow.com/q/22346624
tags question: http://stackoverflow.com/q/22472649
tags question: http://stackoverflow.com/q/22357931
tags question: http://stackoverflow.com/q/22414658
tags question: http://stackoverflow.com/q/22450126
tags question: http://stackoverflow.com/q/22390734
tags question: http://stackoverflow.com/q/22430221
tags question: http://stackoverflow.com/q/22333056
tags question: http://stackoverflow.com/q/22435136
tag name: web-services
tags question: http://stackoverflow.com/q/22347402
tags question: http://stackoverflow.com/q/22461745
tags question: http://stackoverflow.com/q/22357644
tags question: http://stackoverflow.com/q/22332829
tags question: http://stackoverflow.com/q/22454427
tags question: http://stackoverflow.com/q/22359274
tags question: http://stackoverflow.com/q/22344669
tags question: http://stackoverflow.com/q/22343771
tags question: http://stackoverflow.com/q/22420958
tags question: http://stackoverflow.com/q/22486927
tags question: http://stackoverflow.com/q/22472242
tags question: http://stackoverflow.com/q/22387641
tags question: http://stackoverflow.com/q/22352344
tags question: http://stackoverflow.com/q/22352174

spring-integration
tags question: http://stackoverflow.com/q/22403811
tags question: http://stackoverflow.com/q/22355929
type: Tag
tags question: http://stackoverflow.com/q/22416223
tag name: spring-integration
tags question: http://stackoverflow.com/q/22371762

http://stackoverflow.com/a/22438150
has comment: http://stackoverflow.com/comment/34127059
type: Answer
score: 6
upvote count: 6
has body: That's not what async does at all. Fundamentally, all the asynch facility in the Java Servlet Spec (which Jersey leverages) does is allow you to separate the incoming request from the initial thread. Normally the request and processing thread are bound together. Facilitating this separation does not, in itself, make anything faster. It's what you do with it that can make it faster. You mini benchmark calls the server 5 times in a row. The sync version puts, the processing on the original request thread, blocks for a second, then resumes. But if you consider this, at no time is your server ever consuming more than one active processing thread, since all of your calls are serialized to the server (i.e. 1, then 2, then 3 ...). Your async call takes the request, then, rather than servicing it directly, it immediately creates a NEW thread, and then that thread finishes the processing. In this case, each request consume part of the initial thread, and then continues with the second thread. However, it has to allocate and dispatch to that new thread, something your original sync code does not. That dispatch takes time, time your sync thread did not take, and thus is "slower". It's slower because it's simply doing more work. (The server is also doing a little more work wrapping your request in the async context and whatever internal bookkeeping that entails). Where async gives you its value is not on an unloaded server. It's on a loaded server. The threading process itself take time in the server, especially when you have 100's or 1000's of requests. At that level, the threading overhead itself is impactful, particularly when loaded. Async lets you better divvy up work off of the request answering threads on to other facilities to do the heavy lifting. The request threads then simply become the reception desks, the "how may I direct your call" operators. Once they're done routing the work, they can move on to accept other requests. Ideally you may notice that many companies…
accepted answer of: http://stackoverflow.com/q/22434181
answers question: http://stackoverflow.com/q/22434181
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22449689
tagged with: jenkins
accepted answer: http://stackoverflow.com/a/22451632
answer count: 5
tagged with: maven
score: 19
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/46103031
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26586446
upvote count: 20
has body: I have this simple maven project, containing a few common test tools. It builds locally, but on jenkins I am getting this strange error (see below). Other info: It builds locally with maven Settings are the same as all our other jenkins projects (very basic) Other jenkins builds work just fine I tried removing the /root/.jenkins/workspace/testtools folder I tried deleting the build and giving it a new name The disk is not full I failed to find any useful infomation elsewhere regarding this specific problem. ** Parsing POMs ERROR: Failed to parse POMs hudson.maven.MavenEmbedderException: 1 problem was encountered while building the effective settings [FATAL] Non-readable settings /root/.jenkins/workspace/testtools: /root/.jenkins/workspace/testtools (Is a directory) @ /root/.jenkins/workspace/testtools** at hudson.maven.MavenEmbedder.&lt;init&gt;(MavenEmbedder.java:128) at hudson.maven.MavenEmbedder.&lt;init&gt;(MavenEmbedder.java:109) at hudson.maven.MavenEmbedder.&lt;init&gt;(MavenEmbedder.java:136) at hudson.maven.MavenUtil.createEmbedder(MavenUtil.java:212) at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1254) at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1058) at hudson.FilePath.act(FilePath.java:909) at hudson.FilePath.act(FilePath.java:882) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.parsePoms(MavenModuleSetBuild.java:920) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:652) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586) at hudson.model.Run.execute(Run.java:1603) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:506) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:247) Caused by: hudson.maven.MavenEmbedderException: 1 problem was encountered while building the effective settings [FATAL] Non-readable settings /root/.jen…
possible better answer: http://stackoverflow.com/a/46103031
has answer: http://stackoverflow.com/a/22451632
has comment: http://stackoverflow.com/comment/34144515
has comment: http://stackoverflow.com/comment/34150485
has answer: http://stackoverflow.com/a/55425526
has answer: http://stackoverflow.com/a/40506374
has comment: http://stackoverflow.com/comment/34148639
has title: Maven fails to parse POMs at jenkins
favorite count: 0

http://stackoverflow.com/q/22379169
possible better answer: http://stackoverflow.com/a/22379268
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22379268
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/34019341
has body: I implemented a java class but come up with two errors which I can't fix. Error1: incompatible types Required: RandomizedQueue&lt;Item&gt; Found: Item Error2: can not find symbol Symbol: valuable last location:valuable next of type Item public class RandomizedQueue&lt;Item&gt; implements Iterable&lt;Item&gt; { private int number=0; private Node First=null; private class Node { Item item; Item next=null; Item last=null; } private Node Random() { double r = Math.random(); int n = (int) (r*number); if(n==0) n=1; Node ob=First; for(int i=0;i&lt;(n-1);i++) { ob = ob.next; //Error1 } return ob; } public RandomizedQueue() { Node empty=new Node(); } public boolean isEmpty() { return number==0; } public int size() { return number; } public void enqueue(Item item) { if(item==null) throw new NullPointerException(); Node oldfirst = First; First = new Node(); First.item = item; First.next = oldfirst; //Error1 oldfirst.last = First; number++; } public Item dequeue() { Node ob=Random(); Item back = ob.item; Node temp = ob.last; temp.next = ob.next; ob.next.last = temp; //Error2 return back; } public Item sample() { return Random(); } public Iterator&lt;Item&gt; iterator() { //Error:cannot find symbol symbol:class Itertor return IndepentRandomIterator(); } private class IndepentRandomIterator implements Iterator&lt;Item&gt; { private RandomizedQueue&lt;Item&gt; iq = new RandomizedQueue&lt;Item&gt;(); Node scan = First; public IndepentRandomIterator() { while(scan != null) { iq.enqueue(scan.item); scan=scan.next; } } public boolean hasNext() { return iq.number &gt;0; } public void remove() { throw new UnsupportedOperationException(); } public Item next() { if(iq.number==0) throw new java.util.NoSuchElementException(); return iq.dequeue(); } } public static void main(String[] args) { RandomizedQueue&lt;String&gt; test = new RandomizedQueue&lt;String&gt;(); test.enqueue("Luo"); test.enqueue("Jiebin"); test.enqueue("is"); test.enqueue("genious"); test.dequeue(); test.dequeue(); StdOut.…
accepted answer: http://stackoverflow.com/a/22379627
type: Question
tagged with: incompatibletypeerror
tagged with: java
has comment: http://stackoverflow.com/comment/34019376
has comment: http://stackoverflow.com/comment/34066631
answer count: 3
has answer: http://stackoverflow.com/a/22379612
has comment: http://stackoverflow.com/comment/34019344
has title: Error:incompatible types in a java class
favorite count: 0
has answer: http://stackoverflow.com/a/22379627
has comment: http://stackoverflow.com/comment/34066556
has comment: http://stackoverflow.com/comment/34019212
score: -1

http://stackoverflow.com/q/22462344
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22464133
tagged with: apache-camel
has body: I want to call https Rest API URL using Apache Camel API. Is this possible to call https Rest API URL using with Apache Camel API without hard code the user name and password of the https URL?
has answer: http://stackoverflow.com/a/22464133
upvote count: 1
answer count: 1
favorite count: 0
has title: HTTPS authentication setup using camel-http?

http://stackoverflow.com/q/22445708
downvote count: 0
has answer: http://stackoverflow.com/a/22446869
favorite count: 0
has title: Change object name
has body: Is there a way to change the object name of a file stored on Google Cloud Storage from a Google App Engine java application? I am using the Google Cloud Storage Client Library and I don't see an API for doing this.
upvote count: 2
type: UnansweredQuestion
tagged with: google-app-engine
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/22445744
tagged with: google-cloud-storage
type: Question
answer count: 2

http://stackoverflow.com/comment/33995471
type: AnswerComment
score: 0
type: Comment
has text: And how can I do it if I want to put my result in a new string? Can't assign char to string.
comment on: http://stackoverflow.com/a/22364033

http://stackoverflow.com/comment/34133512
type: AnswerComment
has text: Ok, but like I said I have it so that my button works for it, but I want it to work with a key . What can I add to that code to make it work with the enter key?
type: Comment
comment on: http://stackoverflow.com/a/22443329
score: 0

http://stackoverflow.com/comment/34122011
type: QuestionComment
comment on: http://stackoverflow.com/q/22437473
score: 1
has text: Not a good type of question? You want us to do your homew... i mean project?
type: Comment

tomcat
tags question: http://stackoverflow.com/q/22479100
tags question: http://stackoverflow.com/q/22366213
tags question: http://stackoverflow.com/q/22344378
tags question: http://stackoverflow.com/q/22411627
tags question: http://stackoverflow.com/q/22463040
tags question: http://stackoverflow.com/q/22487707
tags question: http://stackoverflow.com/q/22445052
tags question: http://stackoverflow.com/q/22475471
tags question: http://stackoverflow.com/q/22441725
tags question: http://stackoverflow.com/q/22345805
tags question: http://stackoverflow.com/q/22413083
tags question: http://stackoverflow.com/q/22448499
tags question: http://stackoverflow.com/q/22356890
tags question: http://stackoverflow.com/q/22464404
tags question: http://stackoverflow.com/q/22385486
tags question: http://stackoverflow.com/q/22454383
tags question: http://stackoverflow.com/q/22376088
tags question: http://stackoverflow.com/q/22385861
tags question: http://stackoverflow.com/q/22337785
tags question: http://stackoverflow.com/q/22386282
tags question: http://stackoverflow.com/q/22375038
tags question: http://stackoverflow.com/q/22425362
tags question: http://stackoverflow.com/q/22369586
tags question: http://stackoverflow.com/q/22475739
tags question: http://stackoverflow.com/q/22439098
tags question: http://stackoverflow.com/q/22332535
tags question: http://stackoverflow.com/q/22400057
tags question: http://stackoverflow.com/q/22364415
tags question: http://stackoverflow.com/q/22344001
tags question: http://stackoverflow.com/q/22384128
tags question: http://stackoverflow.com/q/22439208
tags question: http://stackoverflow.com/q/22439189
tags question: http://stackoverflow.com/q/22335738
tags question: http://stackoverflow.com/q/22400599
tags question: http://stackoverflow.com/q/22423179
tags question: http://stackoverflow.com/q/22354588
tags question: http://stackoverflow.com/q/22458536
tags question: http://stackoverflow.com/q/22396224
tags question: http://stackoverflow.com/q/22416154
tags question: http://stackoverflow.com/q/22426848
tags question: http://stackoverflow.com/q/22476092
tag name: tomcat
tags question: http://stackoverflow.com/q/22357371
tags question: http://stackoverflow.com/q/22387023
tags question: http://stackoverflow.com/q/22390818
tags question: http://stackoverflow.com/q/22374212
tags question: http://stackoverflow.com/q/22388348
tags question: http://stackoverflow.com/q/22440853
tags question: http://stackoverflow.com/q/22328395
tags question: http://stackoverflow.com/q/22401909
tags question: http://stackoverflow.com/q/22457508
tags question: http://stackoverflow.com/q/22422255
tags question: http://stackoverflow.com/q/22409414
tags question: http://stackoverflow.com/q/22472845
tags question: http://stackoverflow.com/q/22409324
tags question: http://stackoverflow.com/q/22398851
tags question: http://stackoverflow.com/q/22368274
tags question: http://stackoverflow.com/q/22438231
tags question: http://stackoverflow.com/q/22433262
tags question: http://stackoverflow.com/q/22473861
tags question: http://stackoverflow.com/q/22397714
tags question: http://stackoverflow.com/q/22400176
tags question: http://stackoverflow.com/q/22420089
tags question: http://stackoverflow.com/q/22412012
tags question: http://stackoverflow.com/q/22362326
tags question: http://stackoverflow.com/q/22446949
tags question: http://stackoverflow.com/q/22356790
tags question: http://stackoverflow.com/q/22459643
tags question: http://stackoverflow.com/q/22408850
tags question: http://stackoverflow.com/q/22424252
tags question: http://stackoverflow.com/q/22421271
type: Tag
tags question: http://stackoverflow.com/q/22420083
tags question: http://stackoverflow.com/q/22478503
tags question: http://stackoverflow.com/q/22340034
tags question: http://stackoverflow.com/q/22450661
tags question: http://stackoverflow.com/q/22452796
tags question: http://stackoverflow.com/q/22341223
tags question: http://stackoverflow.com/q/22410072
tags question: http://stackoverflow.com/q/22358577

http://stackoverflow.com/a/22440531
answers question: http://stackoverflow.com/q/22440231
has body: When the LinkedList is instantiated it creates a new Node and assigns it to start, end and ptr. When the new Node is created next is assigned null: public Node_(T data, int index) { this.data = data; this.index = index; next = null; //assigned null } The add method is then called repeatedly within the body of the loop. During the first iteration, end is assigned the return value of getNext which is null. On the second iteration a method on end is invoked causing a NullPointerException is thrown. public void add(T data) { if (start == null) { start = new Node_&lt;T&gt;(data, 0); end = start; ptr = start; total++; } else { end.set((T) data,(int) total); //end is null on second iteration total++; end = end.getNext(); //Set to null on the first iteration } }
score: 0
type: Answer

http://stackoverflow.com/a/22454048
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22453764
answers question: http://stackoverflow.com/q/22453764
has body: try to put the intent inside the switch case like this case 0: switch(childPosition) { case 0: Intent intent0 = new Intent(getApplicationContext(), SecondActivity.class); movie="The Conjuring"; intent0.putExtra("text1", movie); startActivity(intent0); break; or if(childPosition ==1) Intent intent0 = new Intent(getApplicationContext(), SecondActivity.class); movie="The Conjuring"; intent0.putExtra("text1", movie); startActivity(intent0);

http://stackoverflow.com/q/22440838
has title: create "down" panel in HTML page (split view)
tagged with: cordova
tagged with: java
upvote count: 1
type: UnansweredQuestion
has body: I'm a new in web development, and I'm trying to create app for iphone by use phonegap, I want to be in the home page two split view , i found a "panel" way , but it's create "left" or "right" view only , i want to create "up" and "down" view, i want to be in the first view some paragraph text, and a "button" to open the second view from "down" and the whole page will split to first view in the "up" and the second view in the "down". and create another button in top bar to cancel the second view .. see picture how can i do that ? is it with javascript or jquery mobile ? thanks
answer count: 0
downvote count: 0
score: 1
tagged with: jquery
favorite count: 0
type: Question
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/a/22422615
type: Answer
score: 2
has body: The best practice here would be to use two different stages. Using two stages will simplify design in sense that the viewport management for 2d animation will simplify by a considerable amount. Also the event handling has to be completely different style. Your information panel won't have much relative layout changes in actors as compared to 2d animation. Using same stage would make sense only if both contents overlap each other in some form. I'm sure this is not the case here. Your info panel will always be ABOVE animation (most probably). Hope this helps.
accepted answer of: http://stackoverflow.com/q/22422424
answers question: http://stackoverflow.com/q/22422424
has comment: http://stackoverflow.com/comment/34096565
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/22406245
has comment: http://stackoverflow.com/comment/34066523
has title: Permutations of integer array algorithm
has body: There is a set e.g.(1, 4, 2, 5, 7, 6, 9, 8, 3). We calculate its first difference (FD) the following way: firstDifference[i] = inputArray[i+1] - inputArray[i]. inputArray is original set. In example case is (1, 4, 2, 5, 7, 6, 9, 8, 3). firstDifference is created from inputArray the following way: (2nd element of inputArray) - (1st element of inputArray) and so on. So the FD of given set is (3, -2, 3, 2, -1, 3, -1, -5). The task is to find a number of permutations of given set which first difference is a permutation of the FD. In example case we should find such permutations of (1, 4, 2, 5, 7, 6, 9, 8, 3) that first differences is permutation of (3, -2, 3, 2, -1, 3, -1, -5). Here's my algorithm: Find all permutations of given set. Find the FD of given set. Find all first differences of permutations in our set. choose only such sets, which first differences contains the numbers of FD of given set. Count them. But this algorithm is too slow. Can you help to create faster algorithm? Probably I make some steps that can be eliminated?
tagged with: java
has comment: http://stackoverflow.com/comment/34068008
type: Question
score: 5
tagged with: algorithm
upvote count: 5
answer count: 2
has comment: http://stackoverflow.com/comment/34068524
downvote count: 0
tagged with: permutation
favorite count: 0
has answer: http://stackoverflow.com/a/22406741
has answer: http://stackoverflow.com/a/22412410
type: UnansweredQuestion

http://stackoverflow.com/a/22362162
downvote count: 0
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/22337405
type: Answer
accepted answer of: http://stackoverflow.com/q/22337405
score: 3
has body: I did eventually find a way to do this using MavenResourcesFiltering and MavenResourcesExecution. Document is here: http://maven.apache.org/shared/maven-filtering/usage.html I was able to get this code to do what I wanted: /* Class members */ @Parameter(defaultValue="${project}",required=true, readonly=true) protected MavenProject project; @Parameter( defaultValue = "${session}", required = true, readonly = true ) protected MavenSession session; @Component( role=org.apache.maven.shared.filtering.MavenResourcesFiltering.class, hint="default") protected MavenResourcesFiltering mavenResourcesFiltering; @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" ) protected String encoding; @Parameter protected List resources; ... //Inside my plugin's execute() method: List<String> nonFilteredFileExtensions = new ArrayList<String>(); //resources is a parameter to my plugin, dir and filters are calculated within the plugin MavenResourcesExecution mre = new MavenResourcesExecution(resources, dir, this.project, this.encoding, filters, nonFilteredFileExtensions, session); mavenResourcesFiltering.filterResources(mre); And I define resources in my plugin's configuration the usual way: G:/MyPluginProject/src/test/resources/project-to-test/resources *.DAT true What's odd is that for , absolute paths work fine but I can't seem to get it to work with an expression such as ${basedir}. I'm probably overlooking something obvious here...

http://stackoverflow.com/a/22371841
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22334013
downvote count: 0
has body: Don't do it in a server action. You can read in the OpenERP documentation (the link I already sent you :)) the following The code is executed using the exec function of python, which is run in the dictionary namespace with variables: object,time,cr,uid,ids Well, I think that's not completely true - actions in OpenERP are executed trough the tools.safe_eval.safe_eval() method. From the doc string of this method: """safe_eval(expression[, globals[, locals[, mode[, nocopy]]]]) -&gt; result System-restricted Python expression evaluation Evaluates a string that contains an expression that mostly uses Python constants, arithmetic expressions and the objects directly provided in context. This can be used to e.g. evaluate an OpenERP domain expression from an untrusted source. Throws TypeError, SyntaxError or ValueError (not allowed) accordingly. Without entering in the details, it's a restricted execution. Instead of this do the following: Create your own module Create a class which inherits from mrp.production. I mean, do _inherit = 'mrp.production' inside your class. Override in this class the method executed after "Confirm Production" (whatever this is). Do what you need with your rpc server in this new method. Don't forget to call super()
type: Answer

http://stackoverflow.com/comment/34033107
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22386593
has text: what do you mean by "move this out as a spring bean"? The sample you pasted in fact is a spring bean configuration. Do you mean you want to configure this as `Annotation`?
score: 1

http://stackoverflow.com/comment/34083872
has text: I did that and it runs, but it's only incrementing `numbers[0]` and not any other indexes
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22415344
type: Comment

http://stackoverflow.com/comment/34128622
comment on: http://stackoverflow.com/a/22440710
score: 0
type: Comment
has text: @Slavic_Donut: GridLayout will have its component completely fill each grid cell. If you don't want that to happen, don't use GridLayout in this way.
type: AnswerComment

http://stackoverflow.com/comment/34125170
has text: +1 for addressing other ways to simplify (and **documenting**!). I suggest using character constants ('0', '1', '2') rather than ASCII codes for readability. :)
type: AnswerComment
comment on: http://stackoverflow.com/a/22439101
type: Comment
score: 1

http://stackoverflow.com/q/22459187
has comment: http://stackoverflow.com/comment/34160469
has answer: http://stackoverflow.com/a/22459302
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34160432
linked to: http://stackoverflow.com/q/22457208
tagged with: linked-list
upvote count: 2
type: UnansweredQuestion
has title: nullpointerexception in linkedlist queue input
has comment: http://stackoverflow.com/comment/34161054
tagged with: java
has body: I don't have much problem with other parts of the code but if there is please do highlight to me! The main problem I get is that when I enter in 3 Fish n Chips Chicken Chop Grilled Salmon 9 Order 1 2 1 3 I get this error. Exception in thread "main" java.lang.NullPointerException at ListOrder.addNewOrder(QuickEat.java:30) at QuickEat.main(QuickEat.java:75) I've checked and it's nothing wrong with the dishID-1 but the offer method but the problem persists People have told me that I've instantiated the dishQueues which is an arraylist of queue integer but I never instantiated any queue integer in each addition to the array-list. I've tried it but it still gives me NPE. How can I properly do this? 1 // This program helps staff manage customers' 2 // orders and decide who should be given a ready dish. 3 4 import java.util.*; 5 6 // This class represents all orders of customers 7 class ListOrder { 8 9 // Data member 10 private int numDishes; 11 // All dishes which the restaurant offers 12 private String[] dishes; 13 // Each dish has a queue of customers who ordered this dish 14 // All such queues are put inside an ArrayList called dishQueues 15 private ArrayList&lt;Queue&lt;Integer&gt;&gt; dishQueues; 16 17 // Constructor 18 public ListOrder(int numDishes, Scanner sc) { 19 this.numDishes = numDishes; 20 dishes = new String[this.numDishes]; 21 ArrayList&lt;Queue&lt;Integer&gt;&gt; dishQueues = new ArrayList&lt;Queue&lt;Integer&gt;&gt;(); 22 for(int i=0;i&lt;this.numDishes;i++) { 23 dishes[i] = new String(sc.nextLine()); 24 dishQueues.add(new LinkedList&lt;Integer&gt;()); 25 } 26 } 27 28 // Add new order to the list 29 public void addNewOrder(int dishID, int tag) { 30 dishQueues.get(dishID-1).offer(new Integer(tag)); 31 } 32 33 // Process food when it is ready 34 // Return the customer who currently ordered for the dish 35 // if there is no customer order for this dish return -1 36 public int processReadyFood(int dishID) { 37 int ready=0; 38 if (dishQueues.get(dishID-1).pee…
downvote count: 3
score: -1
tagged with: queue
type: Question

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

http://stackoverflow.com/q/22370879
type: AnsweredQuestion
tagged with: java
has body: Well, as I mentioned in heading, I can't get data from one activity, to another. I am making a really simple RSS reader, that loads data asynchroously, sends them to listview and opens the selected article in new activity's webview. And the problem is, that when i try to start an activity with webview, a can't pass data from the main activity. So here is what I am doing: 1) In first activity (Main activity), i get data from my listview element, that user clicks on: lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { News clicked = (News) adapter.getItem(arg2); String clickedTitle = clicked.title; String clickedLink = clicked.link; System.out.println("Title: " + clickedTitle + " / LINK: " + clickedLink); /*Here I can see my data in logs -&gt; they are correct at this moment*/ Intent intent = new Intent(MainActivity.this, OpenFullArticle.class); intent.putExtra(clickedTitle, "clickedTitle"); intent.putExtra(clickedLink, "clickedLink"); startActivity(intent); } }); So for now everything is okey, but than, when a new activity is started (OpenFullArticle activity), I am doing this: public class OpenFullArticle extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_open_full_article); String title = getIntent().getExtras().getString("clickedTitle"); String link = getIntent().getStringExtra("clickedLink"); System.out.println(title); //Tried link too, simultaneous each one - both ar null } So I'm stuck for this moment and have no idea, what I'm doing wrong. Tried debuger, checked the Intent, and it hadn't extras there, that I added in first activity. Maybe you can give me a clue, what could cause such a strange issue. P.S. If it's necessary, I can provide a full code or a full project in github.
type: Question
has answer: http://stackoverflow.com/a/22370917
has answer: http://stackoverflow.com/a/22370927
upvote count: 0
score: -2
answer count: 6
has answer: http://stackoverflow.com/a/22371020
tagged with: nullpointerexception
tagged with: android-activity
accepted answer: http://stackoverflow.com/a/22370917
has answer: http://stackoverflow.com/a/22371012
favorite count: 0
downvote count: 2
tagged with: android
has title: Unable to recieve data, from Intent in new activity.
possible better answer: http://stackoverflow.com/a/22370919
has answer: http://stackoverflow.com/a/22370926
tagged with: android-intent
has answer: http://stackoverflow.com/a/22370919

http://stackoverflow.com/comment/34147840
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22451428
type: AnswerComment
has text: AhsanInstance Block Hello() Block Instance Block Hello() Block Static Block

http://stackoverflow.com/comment/34210035
has text: Even if it exist but you say that is not accessible in Class B but this method (setz()) call in B class and must access to z to change it !!??
comment on: http://stackoverflow.com/q/22487091
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34108360
has text: The benefit of this approach is that you don't need to place the application into "test" mode, which means when testing, you are testing the actual program as it would run in the wild, producing a more accurate test state.
type: Comment
comment on: http://stackoverflow.com/a/22417536
type: AnswerComment
score: 0

http://stackoverflow.com/q/22345907
has comment: http://stackoverflow.com/comment/33962918
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/22346461
has answer: http://stackoverflow.com/a/22346461
favorite count: 0
has answer: http://stackoverflow.com/a/22346384
accepted answer: http://stackoverflow.com/a/22346384
tagged with: android
has body: In my app I got some activities and a ReceiverThread.class. The Thread is started from two different activities. And everytime I switch to another Activity and recall the former active Activity it starts a new Thread. So if I do some test on my app for about 10 Minutes or the app is simply used for some time, there is a mass of Threads open and all do the same. Most of the time the Threads are on TimedWait. This gives me wrong data and causes the app to lag hard, sometimes its not even responding. Is there a good possibility to stop a thread onPause() or onStop() ? Because many of the methods are deprecated. Or how to resume a previous started Thread and so prevent the Activity from creating a new one? This is my ReceiverThread.run(): public void run() { initiateCAN(); while (true) { try { Thread.sleep(60); mHandler.post(r); } catch (InterruptedException e) { break; } } } If something is not clear or missing, please feel free to ask and I will edit my post, but don't just simply downvote.
has comment: http://stackoverflow.com/comment/33963215
type: AnsweredQuestion
has title: More and more Threads are causing my app to lag
downvote count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33962785
type: Question
score: 1
tagged with: java

http://stackoverflow.com/q/22473455
score: 0
tagged with: android
has title: Force Close missing com.google.android.gms.maps
has comment: http://stackoverflow.com/comment/34185522
tagged with: google-api
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22473934
has comment: http://stackoverflow.com/comment/34185415
tagged with: java
tagged with: eclipse
has body: im using maps API in my app, i get an FC whenever i launch the activity. Source code: package com.spxc.nightclubratings; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import org.apache.http.NameValuePair; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.ActionBar; import android.app.Activity; import android.app.FragmentTransaction; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.location.Address; import android.location.Criteria; import android.location.Geocoder; import android.location.Location; import android.location.LocationManager; import android.os.AsyncTask; import android.os.Bundle; import android.view.MenuItem; import android.widget.Toast; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.GoogleMap.OnInfoWindowClickListener; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.spxc.nightclubratings.adapter.MainMapFragement; import com.spxc.nightclubratings.classes.EventInfo; import com.spxc.nightclubratings.parser.JSONParser; public class MapsActivity extends Activity { private MainMapFragement mapFragment; private HashMap&lt;Marker, EventInfo&gt; eventMarkerMap; private LatLng mPosition; Geocoder geocoder; String bestProvider; List&lt;Address&gt; user = null; double lat, lng; JSONParser jParser = new JSONParser(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; locationList; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_LOCATIONS = "locations"; private static final String TAG_ID = "id"; private static final String TAG_NAME = "name"; private static final String TAG…
type: Question
tagged with: google-maps
answer count: 1

http://stackoverflow.com/comment/34131473
has text: try [this, the Android Volley library](https://developers.google.com/events/io/sessions/325304728)
score: 0
comment on: http://stackoverflow.com/q/22442344
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22416939
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34086269
linked to: http://stackoverflow.com/q/12908412
has title: Print 60 seconds countdown in Java
tagged with: java
has comment: http://stackoverflow.com/comment/34086201
downvote count: 3
tagged with: seconds
has answer: http://stackoverflow.com/a/22417047
has comment: http://stackoverflow.com/comment/34086253
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22417116
possible better answer: http://stackoverflow.com/a/22417006
has answer: http://stackoverflow.com/a/22417006
has body: I've searched everywhere for some simple code to print 60 seconds down, say on a JFrame constructor. So when a JFrame is run, the window title will be shown a countdown from 60-0 seconds (which in my case will shutdown). - No need for code to shutdown. Something on the lines of: JFrame frame = new JFrame("Window will terminate in: " + java.util.Calendar.SECOND); Of course the code above does not make sense because it's printing the current time second. But you get the idea.
tagged with: jframe
upvote count: 3
score: 0
accepted answer: http://stackoverflow.com/a/22417116
type: Question

rdbms
tags question: http://stackoverflow.com/q/22428434
type: Tag
tag name: rdbms

http://stackoverflow.com/a/22421761
has comment: http://stackoverflow.com/comment/34095431
has comment: http://stackoverflow.com/comment/34095388
has comment: http://stackoverflow.com/comment/34095012
has comment: http://stackoverflow.com/comment/34095067
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34095145
type: Answer
answers question: http://stackoverflow.com/q/22421676
has body: With regions of equal length you could specify the result values that correspond to the regions in an array and calculate the array index based on the input value like this: public class Example { private static final int[] MAPPING = {0, 100, 200}; private static final int REGION_LENGTH = 60; public static int encode(int value) { // TODO apply range check to avoid ArrayIndexOutOfBounds return MAPPING[(value / REGION_LENGTH)]; } public static void main(String[] args) { System.out.println(encode(160)); // prints 200 } }
accepted answer of: http://stackoverflow.com/q/22421676
score: 1
upvote count: 1

http://stackoverflow.com/comment/34233142
type: AnswerComment
score: 0
type: Comment
has text: i dont want to use JSON as i m fetching data from the DB in to a list which i have to pass
comment on: http://stackoverflow.com/a/22500910

http://stackoverflow.com/comment/34203280
type: Comment
comment on: http://stackoverflow.com/a/22482338
score: 0
type: AnswerComment
has text: I may be wrong, but doesn't that take the gestures made by the user on the touch screen? What I'm looking for is something that takes the x,y coordinates instead of the gesture itself.

http://stackoverflow.com/a/22398527
score: 4
accepted answer of: http://stackoverflow.com/q/22396919
has body: Use getGeneratedKeys() method from your Statement object to identify the new auto generated values. Iterate the returned ResultSet object to get the newly generated key values in the order of batch statements. Change: stmt.executeUpdate(sql); To: int rowsAffected = stmt.executeUpdate( sql, Statement.RETURN_GENERATED_KEYS ); ResultSet rs = stmt.getGeneratedKeys(); //****************************************************** // in case of batch insert, you can check how many are inserted rs.last(); int rows = rs.getRow(); System.out.println( "Generated keys count: " + rows ); //******************************************************/ int currentRow = 1; rs.beforeFirst(); while( rs.next() ) { System.out.println( /**/( currentRow++ ) + " = " + /**/rs.getInt( 1 ) ); } // while rs Once you have this auto generated key value in a variable, you can use it with other SQL statements, to store in other tables. Note: Call to getGeneratedKeys() may throw java.sql.SQLFeatureNotSupportedException, if the JDBC driver, that you are using, does not support this method.
upvote count: 4
answers question: http://stackoverflow.com/q/22396919
has comment: http://stackoverflow.com/comment/34097674
has comment: http://stackoverflow.com/comment/34098090
has comment: http://stackoverflow.com/comment/34086997
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34096419
type: Answer

http://stackoverflow.com/q/22486201
score: 0
has title: Sending data to Servlet thru AJAX POST Url, but if concurrent users try to send data servlet is not calling
tagged with: jsp
tagged with: jquery
has comment: http://stackoverflow.com/comment/34207757
tagged with: ajax
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34207721
has comment: http://stackoverflow.com/comment/34212576
has comment: http://stackoverflow.com/comment/34207881
answer count: 0
has comment: http://stackoverflow.com/comment/34207825
has body: Please help me on this. I have some html table data on webpage. I am sending two columns data to servlet class through AJAX POST URL by clicking on "Send" button on webpage. In servlet class I am getting data using request.getParameter("xyz"), and setting this value to session context, asI want to send this data to webservice. It is working fine in my local system. But once I deploy on other server (INT or QA servers) and multiple users trying to send data by clicking on send button servlet is not calling at all. Why? The data is coming fine on webpage and tested using alert conditions. But after that no servlet is calling, I tried with debug statements in servlet,but its not working. Please help. I am not sure the below error related to this issue: PWC4011: Unable to set request character encoding to UTF-8 from context , because request parameters have already been read, or ServletRequest.getReader() has already been called|#] If yes, how can fix this to use this application by multiple users.
type: Question
has comment: http://stackoverflow.com/comment/34208743
tagged with: java
tagged with: servlets
has comment: http://stackoverflow.com/comment/34208009

http://stackoverflow.com/comment/100813082
type: Comment
has text: I have a kind of similar problem and I thought there must be a detailed documentation of all possibilities but I found this https://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html which is almost similar. Although your answer is complete in itself.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22357323

http://stackoverflow.com/comment/34030936
type: QuestionComment
score: 0
has text: @helloMundo: Also consider `Math.hypot()`.
comment on: http://stackoverflow.com/q/22381099
type: Comment

http://stackoverflow.com/comment/33952371
comment on: http://stackoverflow.com/a/22340050
type: Comment
has text: maybe the instructor wants to show how hashes are important just forcing the students NOT to use them :-)
score: 1
type: AnswerComment

http://stackoverflow.com/a/22470111
upvote count: 8
answers question: http://stackoverflow.com/q/22470044
has comment: http://stackoverflow.com/comment/34180218
has body: You should have a look at the sort method of the Arrays class public static &lt;T&gt; void sort(T[] a, Comparator&lt;? super T&gt; c) You will need to create a Comparator to tell it how to order your employees http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html Similarly, if you had a List or other type of Collection you could use the sort method of Collections
has comment: http://stackoverflow.com/comment/34180057
type: Answer
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/34180021

http://stackoverflow.com/comment/34096195
comment on: http://stackoverflow.com/a/22422566
type: AnswerComment
has text: Thanks for pointing this out, I looked at a lot of examples but just couldnt wrap my head around setting up the Pattern and Matcher syntax properly. This makes total sense now that I can successfully apply it. Thanks again.
type: Comment
score: 1

http://stackoverflow.com/comment/36277515
has text: This is a known bug for 2.4.8 see https://github.com/yui/yuicompressor/issues/111 and https://github.com/yui/yuicompressor/issues/78.
score: 0
comment on: http://stackoverflow.com/q/22343690
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/49644818
score: 0
type: Comment
type: QuestionComment
has text: @ravi, which library you used to scan driving license? right now i'm using zxing lib for scanning pdf417 barcode, but i think driving license barcode is in encoded format so that its not working via zxing lib.
comment on: http://stackoverflow.com/q/22374593

http://stackoverflow.com/comment/34594587
type: Comment
comment on: http://stackoverflow.com/a/22661621
type: AnswerComment
has text: I can not change the code as i already mentioned. Is there any way through configuration?
score: 0

jscrollpane
tags question: http://stackoverflow.com/q/22386924
tag name: jscrollpane
tags question: http://stackoverflow.com/q/22351021
tags question: http://stackoverflow.com/q/22425710
tags question: http://stackoverflow.com/q/22422806
type: Tag
tags question: http://stackoverflow.com/q/22432705
tags question: http://stackoverflow.com/q/22432677
tags question: http://stackoverflow.com/q/22407493
tags question: http://stackoverflow.com/q/22329956
tags question: http://stackoverflow.com/q/22356825
tags question: http://stackoverflow.com/q/22465989
tags question: http://stackoverflow.com/q/22481741
tags question: http://stackoverflow.com/q/22463157
tags question: http://stackoverflow.com/q/22379973
tags question: http://stackoverflow.com/q/22371039

http://stackoverflow.com/q/22484658
has body: I wonder is there any id or specified label to distinguish a selected class whether it is one of the standard class declarations or test class in run-time? EDIT: I collect the entire classes from the project. I separate abstract classes, interfaces, subclasses by looking the collection, whereas I also want to know how many classes have test behavior. In other words, how many classes are actually test classes. One more thing: I don't know these classes in advance, these are not mine!
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34205665
has comment: http://stackoverflow.com/comment/34205187
has answer: http://stackoverflow.com/a/22485082
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Determining the test classes in a project
upvote count: 1
answer count: 1
tagged with: test-class
tagged with: class
has comment: http://stackoverflow.com/comment/34207717
has comment: http://stackoverflow.com/comment/34207975
has comment: http://stackoverflow.com/comment/34204989

http://stackoverflow.com/a/22364534
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22364479
upvote count: 1
type: Answer
has body: You have Class.forName(), getClass().newInstance(), the prototype pattern, or functional objects as choices. In the latter case, you would supply an object whose sole purpose was to create an instance of the required class (that would be your projectileType variable).

http://stackoverflow.com/q/22405626
has answer: http://stackoverflow.com/a/22405807
has body: Is it possible to tell if an exception class is a checked or unchecked just by looking at the code? I always thought that if it extended Exception, it was checked, but then RuntimeException extends Exception and that is unchecked. RuntimeException may be the only class that bends that rule of thumb, with other unchecked exceptions having to extend Throwable if not extending RuntimeException. However, I do not see how RuntimeException differs from Exception. I wonder if the difference is defined inside the interpreter itself?
type: Question
has title: Java - checked vs unchecked Exception - tell from code alone?
answer count: 8
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22406097
has comment: http://stackoverflow.com/comment/34066679
tagged with: java
has answer: http://stackoverflow.com/a/22406086
has answer: http://stackoverflow.com/a/22405678
has answer: http://stackoverflow.com/a/22405693
has answer: http://stackoverflow.com/a/22406097
possible better answer: http://stackoverflow.com/a/22405678
has comment: http://stackoverflow.com/comment/34065334
has answer: http://stackoverflow.com/a/22405719
upvote count: 6
linked to: http://stackoverflow.com/q/6115896
favorite count: 0
has answer: http://stackoverflow.com/a/22405889
has comment: http://stackoverflow.com/comment/34065731
tagged with: unchecked-exception
has answer: http://stackoverflow.com/a/22405689
downvote count: 0
has comment: http://stackoverflow.com/comment/34065345
score: 6
has comment: http://stackoverflow.com/comment/34065398

http://stackoverflow.com/q/22385005
tagged with: java
has comment: http://stackoverflow.com/comment/34030411
answer count: 1
favorite count: 0
tagged with: android
has body: Bitmap foto = b.getBitmap(); byte[] bytes = null; ByteArrayOutputStream ba = new ByteArrayOutputStream(); foto.compress(Bitmap.CompressFormat.JPEG, 100, ba); foto.recycle(); foto = null; bytes = ba.toByteArray(); String bBytes = Arrays.toString(bytes); I'd like this method to return a String of the Byte values. For example, it would be : "12,23,34 ....".
has title: Convert byte array to a string - - With Performace Android
has answer: http://stackoverflow.com/a/22385171
has comment: http://stackoverflow.com/comment/34030018
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34030140
upvote count: 1
tagged with: bitmap
downvote count: 1
type: Question

http://stackoverflow.com/comment/33946925
has text: @user2824425: JTextFields will use ActionListeners just fine. No JButton needed.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22336542
type: AnswerComment

http://stackoverflow.com/q/22410081
has title: How to sum arrays of textfields on the fly in Java
type: Question
linked to: http://stackoverflow.com/q/14290758
upvote count: 1
accepted answer: http://stackoverflow.com/a/22412273
answer count: 1
favorite count: 0
tagged with: listener
has answer: http://stackoverflow.com/a/22412273
linked to: http://stackoverflow.com/q/14174776
tagged with: documentlistener
has body: I have textfields which I would like to have display the total of several other textfields on the fly. I have never used Listeners before but after some research I found that DocumentListeners are probably what I am looking for. I've spent time reading trough related questions such as this and this and have also read through java docs but still feel shaky in my understanding and how I would accomplish what I need to do, mainly because I am using 1D and 2D arrays. I want to record 3 different types of time (straight time, overtime, and double overtime) worked by 10 workers on each day of the week as well as the total. To accomplish this, I created these variables: private static final int NUMBER_OF_PERSONNEL = 10; private static final int DAYS_OF_THE_WEEK = 7; private JTextField OT2Field[][] = new JTextField[DAYS_OF_THE_WEEK][NUMBER_OF_PERSONNEL]; private JTextField OT1Field[][] = new JTextField[DAYS_OF_THE_WEEK][NUMBER_OF_PERSONNEL]; private JTextField STField[][] = new JTextField[DAYS_OF_THE_WEEK][NUMBER_OF_PERSONNEL]; private JTextField totalOT2Field[] = new JTextField [NUMBER_OF_PERSONNEL]; private JTextField totalOT1Field[] = new JTextField [NUMBER_OF_PERSONNEL]; private JTextField totalSTField[] = new JTextField [NUMBER_OF_PERSONNEL]; So, OT2Field[0][0] through OT2Field[6][0] will = totalOT2Field[0] Would I need a DocumentListener for each type of time worked? Or could I have one DocumentListener and handle the different types and their data in the update methods? If the latter is possible, whats the best way to accomplish this? Please remember to keep in mind that I am new to Listeners.
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/34114095
comment on: http://stackoverflow.com/a/22428543
has text: Thanks Macias. It offers me great help as I expected!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34110792
has text: Yeah I did this initially but it just tells me that it can't make a static reference to the non-static field 'cash'. I'm assuming it just means that there's no variable within that method where cash is defined. The thing is I need for my wagerBet and rewardBet methods to take its cash variables from the Player class. I've no idea how.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22429575
type: Comment

http://stackoverflow.com/comment/34335205
type: AnswerComment
comment on: http://stackoverflow.com/a/22483957
has text: wow thanks. That link has same well made maps. I guess you are right, I just didn't know the power of tiled maps!
score: 0
type: Comment

http://stackoverflow.com/comment/34162975
type: Comment
type: QuestionComment
has text: Note: you should `catch FileSystemException` before `IOException`; this way you'll know whether the error is due to a fs-level problem or I/O-level problem
comment on: http://stackoverflow.com/q/22460367
score: 0

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

http://stackoverflow.com/comment/33991024
type: Comment
comment on: http://stackoverflow.com/q/22361957
score: 0
has text: Well, I don't have any idea which one is that, all I know it is somewhere around that part of the code which configures the binary summing of two binary numbers. I am new to this site so yes , I probably need to be more specific next time, I am sorry if this is confusing. On second thought, the exception appears after I type the second binary number to sum up .
type: QuestionComment

http://stackoverflow.com/comment/34088586
comment on: http://stackoverflow.com/a/22417489
score: 0
type: Comment
has text: I would need more information on what you are trying to do before I could suggest a good practice or implementation
type: AnswerComment

http://stackoverflow.com/comment/33989048
score: 0
comment on: http://stackoverflow.com/q/22359950
type: Comment
has text: What does "gives me nothing" mean? Does it compile? If not, please include the exact error. Does it run without errors? If not, please include a stack trace of the error. Does it not produce the desired output? If so, please include the example input with desired and actual output. In **ANY** the above cases, if you're using your own `Stack` class rather than `java.util.Stack`, please post that as well (and, in fact, **all** code that is required to compile and run your code).
type: QuestionComment

http://stackoverflow.com/a/22422371
score: 0
has comment: http://stackoverflow.com/comment/34099350
type: Answer
answers question: http://stackoverflow.com/q/22421905
has body: I'm not quite sure about what are your intentions, but if you're just saying that you don't want the Jasper Viewer (the window that opens the report as a preview after it's generation) you have only to remove the line: JasperViewer.viewReport(jp, false);

http://stackoverflow.com/q/22486239
has comment: http://stackoverflow.com/comment/34426089
has comment: http://stackoverflow.com/comment/34336143
has comment: http://stackoverflow.com/comment/34241303
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34208075
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34425770
has body: In my program, I am using a basic graphic component, displaying "Bugs in the code", printing lady bugs across the screen. Every time I run, or put a delay between the drawing of the bugs and the image, the bugs print first regardless. Here is my code: import static java.lang.System.*; import static java.lang.Math.*; import javax.swing.*; import java.util.*; import java.awt.*; import java.awt.Graphics.*; import java.awt.event.*; import java.io.*; public class ladyBugs { public static void main(String[]args) { new Windows(); } } class Windows extends Frame implements ActionListener, KeyListener, MouseListener { final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); private double width = screenSize.getWidth(); private double height = screenSize.getHeight(); private int SCWIDTH = (int)width, SCHEIGHT = (int)760; private int whichScreen; private int turn; private Image myPic; private Image myScreen; private Graphics pen; public Windows() { out.println(SCWIDTH +" "+ SCHEIGHT); setSize(SCWIDTH, SCHEIGHT); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); myPic = Toolkit.getDefaultToolkit().getImage("C:\\Users\\s613228\\Pictures\\moby.png"); this.setVisible(true); this.addKeyListener(this); this.addMouseListener(this); gameLoop(); } public void gameLoop() { } public void paint(Graphics pen) { if(whichScreen ==0) { setBounds(0, 0, SCWIDTH, SCHEIGHT); pen.setFont(new Font("verdana", Font.PLAIN, 50)); pen.drawString("Cody's Test Program", SCWIDTH/5+50, SCHEIGHT/6); // Centered pen.drawImage(myPic, SCWIDTH/8, 150, 351, 144, this); pause(1000); whichScreen++; } else doubleBuffer(pen); } public void doubleBuffer(Graphics pen) { Image code = Toolkit.getDefaultToolkit().getImage("c:\\users\\s613228\\pictures\\screenCapJCreator.png"); pen.setColor(Color.WHITE); pen.setFont(new Font("verdana", Font.PLAIN, 50)); pen.drawString("Cody's Test Program", SCWIDTH/5+50, SCHEIGHT/6); // Centered pen.drawImage(code, 0, …
has title: Why is my image delaying when printed? Java
has comment: http://stackoverflow.com/comment/34336277
type: Question
has comment: http://stackoverflow.com/comment/34208566
has comment: http://stackoverflow.com/comment/34208253
has comment: http://stackoverflow.com/comment/34241474

http://stackoverflow.com/a/34581026
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22415650
upvote count: 2
score: 2
has body: Here is the simple java code to implement it: 1)Stack based: public class DynamicArrayStack { public static void main(String[] args) { DynamicStack dstack=new DynamicStack(2); System.out.println("--Pushing--"); dstack.push(1); dstack.push(2); dstack.display(); dstack.push(3); dstack.push(2); dstack.push(5); dstack.display(); System.out.println("--Popping--"); dstack.pop(); dstack.pop(); dstack.pop(); dstack.display(); } } class DynamicStack { private int top; private int capacity; private int[] array; public DynamicStack(int cap) { capacity = cap; array = new int[capacity]; top = -1; } public void push(int data) { if (isFull()){ expandArray(); //if array is full then increase its capacity } array[++top] = data; //insert the data } public void expandArray() { int curr_size = top + 1; int[] new_array = new int[curr_size * 2]; for(int i=0;i&lt;curr_size;i++){ new_array[i] = array[i]; } array = new_array; //refer to the new array capacity = new_array.length; } public boolean isFull() { if (capacity == top+1) return true; else return false; } public int pop() { if (isEmpty()) { System.out.println("Stack is empty"); return -1; } else { reduceSize(); //function to check if size can be reduced return array[top--]; } } public void reduceSize() { int curr_length = top+1; if (curr_length &lt; capacity / 2) { int[] new_array = new int[capacity / 2]; System.arraycopy(array, 0, new_array, 0, new_array.length); array = new_array; capacity = new_array.length; } } public boolean isEmpty() { if (top == -1) return true; else return false; } public void display() { for (int i = 0; i &lt;= top; i++) { System.out.print(array[i] + "=&gt;"); } System.out.println(); System.out.println("ARRAY SIZE:" + array.length); } } OUTPUT: --Pushing-- 1=>2=> ARRAY SIZE:2 1=>2=>3=>2=>5=> ARRAY SIZE:8 --Popping-- 1=>2=> ARRAY SIZE:4 2)Link List based: public class LinkListStack { public static void main(String[] args) { StackList stack = new StackList(); System.out.println("--Pushing--"); stack.push(1); s…

http://stackoverflow.com/q/22420115
type: UnansweredQuestion
has body: I m trying to execute this code &amp; it shows successfull execution but i cant get any value n access database file which i had create. so, please find mistake in my code so that i can get some values in database table. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String filename ="D:\\Database for Mini Project\\Database21(example).mdb"; String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\Database for Mini Project\\Database21(example).mdb"; try (Connection con = DriverManager.getConnection( database ,"","")) { Statement s = con.createStatement(); String b=request.getParameter("uname"); String c=request.getParameter("pass"); String query="insert into A.ABC1(uname,pass) values='"+b+"','"+c+"'"; s.executeQuery(query); s.close();
has answer: http://stackoverflow.com/a/22420122
tagged with: ms-access-2010
tagged with: java
has title: Connecting MS Access Database with my project
type: Question
tagged with: database
score: 0
has answer: http://stackoverflow.com/a/22420132
answer count: 2
tagged with: jsp

http://stackoverflow.com/comment/34010156
comment on: http://stackoverflow.com/a/22373113
type: Comment
has text: I'm not saying they are the same, they are different expressions that do different things, but they evaluate to the same value. `k=i+1` is another completely different operation, but the value of this expression `k=i+1` is yet again `i+1`
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34180989
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22470768
type: AnswerComment
has text: NOTE: Compiler doesn't give warning, but an error for generic type array creation.

http://stackoverflow.com/q/22343349
type: Question
upvote count: 4
accepted answer: http://stackoverflow.com/a/22350454
has comment: http://stackoverflow.com/comment/33958398
answer count: 1
downvote count: 0
score: 4
tagged with: exception
has title: Pick List showing error Property 'name' not found on type java.lang.String
favorite count: 0
has body: I am using primefaces pick list and getting the error as the question stated. Posting only problem relative code. XHTML Page &lt;p:row&gt; &lt;p:column&gt; &lt;p:outputLabel style="font-size:12px;" styleClass="labelCaption" for="bank" value="Bank(s) Name :" /&gt; &lt;/p:column&gt; &lt;p:column colspan="3"&gt; &lt;p:pickList id="bank" style="font-size:12px;" required="true" value="#{eipoIRBean.dualbanks}" var="dbanks" itemLabel="#{dbanks.name}" itemValue="#dbanks}"&gt; &lt;f:facet name="sourceCaption"&gt;Available Banks&lt;/f:facet&gt; &lt;f:facet name="targetCaption"&gt;Selected Banks&lt;/f:facet&gt; &lt;/p:pickList&gt; &lt;/p:column&gt; &lt;/p:row&gt; &lt;p:row&gt; &lt;p:column colspan="4" align="left" styleClass="panelGridFooter ui-widget-header"&gt; &lt;p:commandButton id="submit" ajax="false" style="font-size:12px;" value="Save" action="#{eipoIRBean.submit}" icon="ui-icon-check"&gt; &lt;/p:commandButton&gt; &lt;p:commandButton icon="ui-icon-arrowreturnthick-1-w" style="font-size:12px;" value="Cancel" action="listMyGroupLifeClaim?faces-redirect=true" immediate="true" global="true"&gt; &lt;/p:commandButton&gt; &lt;/p:column&gt; &lt;/p:row&gt; Bean is @ViewScoped @ManagedBean(name = "eipoIRBean") public class InvestorRegistrationBean implements Serializable{ private InvestorSetupBusinessObj businessObj = new InvestorSetupBusinessObj(); private DualListModel&lt;Bank&gt; dualbanks; public DualListModel&lt;Bank&gt; getDualbanks() { return dualbanks; } public void setDualbanks(DualListModel&lt;Bank&gt; dualbanks) { this.dualbanks = dualbanks; } public InvestorSetupBusinessObj getBusinessObj() { return businessObj; } public void setBusinessObj(InvestorSetupBusinessObj businessObj) { this.businessObj = businessObj; } public InvestorRegistrationBean(){ dualList_of_banks(); } public void dualList_of_banks(){ dualbanks = new DualListModel&lt;Bank&gt;(businessObj.getInvestor().getBanks(), new ArrayList&lt;Bank&gt;()); } public void submit() { businessObj.getInvestor().setBan…
has comment: http://stackoverflow.com/comment/33958327
type: AnsweredQuestion
tagged with: jsf
tagged with: primefaces
has answer: http://stackoverflow.com/a/22350454
tagged with: java

http://stackoverflow.com/comment/34037079
comment on: http://stackoverflow.com/a/22385137
score: 0
type: Comment
has text: that's hard to answer without seeing more of your code, but if you get the dataSource from JNDI, are properties you pass in the XML to JndiObjectFactoryBean actually doing anything?
type: AnswerComment

http://stackoverflow.com/q/22364382
accepted answer: http://stackoverflow.com/a/22364627
tagged with: android
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33995349
has body: I'm trying to call Java method from c++. C++ JNIEXPORT void JNICALL Java_ru_sploid_platerecog_RecogActivity_FindFeatures(JNIEnv* env, jobject job, jlong addr_rgba) { Mat&amp; m_rgba = *(Mat*)addr_rgba; try { const pair&lt; string, int &gt; fn = read_number( m_rgba, 10 ); jclass clazz = env-&gt;FindClass("ru/sploid/platerecog/RecogActivity"); jmethodID meth=env-&gt;GetMethodID(clazz,"onGetNumber","(Ljava/lang/String;)V"); env-&gt;CallVoidMethod(job,meth,fn.first.data()); // cv::putText( m_rgba, fn.first.empty() ? string( "not found" ) : fn.first, cv::Point( 20, 100 ), CV_FONT_HERSHEY_PLAIN, 2.0, cv::Scalar( 255, 0, 0, 0 ) ); } catch ( const std::exception&amp; e ) { cout &lt;&lt; "Catch exception: " &lt;&lt; e.what() &lt;&lt; endl; cv::putText( m_rgba, "Exception", cv::Point( 20, 100 ), CV_FONT_HERSHEY_PLAIN, 2.0, cv::Scalar( 255, 0, 0, 0 ) ); } } Java: public void onGetNumber(String plate){ plat=plate; runOnUiThread(new Runnable() { @Override public void run() { if (plat!=null) Toast.makeText(getApplicationContext(), plat, Toast.LENGTH_LONG).show(); else Toast.makeText(getApplicationContext(), "((", Toast.LENGTH_LONG).show(); } }); } And app closes with 03-12 23:33:29.172: A/libc(21987): Fatal signal 11 (SIGSEGV) at 0x323030b9 (code=1) I think that I have error in C++. Thank you
tagged with: android-ndk
type: Question
has comment: http://stackoverflow.com/comment/33995541
has comment: http://stackoverflow.com/comment/33995487
has title: Android ndk Fatal signal code=1
tagged with: java
possible better answer: http://stackoverflow.com/a/22364714
score: 0
has answer: http://stackoverflow.com/a/22364714
answer count: 2
has comment: http://stackoverflow.com/comment/33995447
has answer: http://stackoverflow.com/a/22364627

http://stackoverflow.com/a/22439763
score: 1
has comment: http://stackoverflow.com/comment/34126793
has comment: http://stackoverflow.com/comment/34126978
accepted answer of: http://stackoverflow.com/q/22439665
has comment: http://stackoverflow.com/comment/34127006
answers question: http://stackoverflow.com/q/22439665
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34126410
has comment: http://stackoverflow.com/comment/34126777
type: Answer
has comment: http://stackoverflow.com/comment/34126441
has body: I don't see what the problem is. Gson can serialize Maps just fine. Assuming your class is named Test Test test = new Test(); test.property1 = "some value"; HashMap&lt;String, Integer&gt; map = new HashMap&lt;&gt;(); map.put("one", 1); map.put("fourty two", 42); test.property2.put("property2-key", map); ArrayList&lt;String&gt; strings = new ArrayList&lt;&gt;(Arrays.asList("string1", "string2", "string3")); test.property3.put("property3-key", strings); String[] stringArray = { "array1", "array2", "array3" }; test.property4.put("property4-key", stringArray); Gson gson = new Gson(); String json = gson.toJson(test); System.out.println(json); It generates the following { "property1": "some value", "property2": { "property2-key": { "fourty two": 42, "one": 1 } }, "property3": { "property3-key": [ "string1", "string2", "string3" ] }, "property4": { "property4-key": [ "array1", "array2", "array3" ] } }
upvote count: 1
has comment: http://stackoverflow.com/comment/34129233

http://stackoverflow.com/q/22350015
has comment: http://stackoverflow.com/comment/33970906
score: 2
type: AnsweredQuestion
downvote count: 0
has title: GSON list of list
favorite count: 0
type: Question
upvote count: 2
answer count: 1
has body: How do I deserialize a list of lists using Gson? For example, given the following JSON string: { vars: [ [ 1, 2, 3 ], [ 4, 5 ] ] } I can create the following two POJOs, to try and deserialize it: class ThisDoesNotWork { public List&lt;List&lt;Integer&gt;&gt; vars; } Running gson.fromJson(jsonStr, ThisDoesNotWork.class); throws a com.google.gson.JsonSyntaxException. But the following works (although it's not very usable): class ThisWorks { public List&lt;Object&gt; vars; } If I attach a debugger to the output of gson.fromJson(jsonStr, ThisWorks.class);, I can see that the deserialized vars object contains: vars = {java.util.ArrayList}, size = 2 |-- [0] = {java.util.ArrayList}, size = 3 |-- [0] = {java.lang.Integer}, value = 1 |-- [1] = {java.lang.Integer}, value = 2 |-- [2] = {java.lang.Integer}, value = 3 |-- [1] = {java.util.ArrayList}, size = 2 |-- [0] = {java.lang.Integer}, value = 4 |-- [1] = {java.lang.Integer}, value = 5 So my question is, how do I correctly deserialize lists of lists using Gson?
has answer: http://stackoverflow.com/a/22350307
has comment: http://stackoverflow.com/comment/33971461
has comment: http://stackoverflow.com/comment/33971313
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has comment: http://stackoverflow.com/comment/33973384
accepted answer: http://stackoverflow.com/a/22350307

http://stackoverflow.com/comment/34098144
has text: have you tried it with JPGs instead of PNGs?
comment on: http://stackoverflow.com/q/22423804
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/33990337
comment on: http://stackoverflow.com/q/22361472
has text: Sorry its method, not class..
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34157598
comment on: http://stackoverflow.com/a/22454537
type: AnswerComment
score: 0
type: Comment
has text: I have already shared a code for server client chat in my other posts.

http://stackoverflow.com/comment/34195414
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22479536
has text: echo prints the D:\Program Files\Java\jdk1.7.0_51; I have tried with all combinations possible, just can't figure the issue

http://stackoverflow.com/a/22449792
type: AcceptedAnswer
has body: instead of using InstallCert.java I ended up using manual add certificate and it worked: Digital Certificate: How to import .cer file in to .truststore file using?
type: Answer
accepted answer of: http://stackoverflow.com/q/22440652
answers question: http://stackoverflow.com/q/22440652
score: 0

http://stackoverflow.com/a/22332427
has comment: http://stackoverflow.com/comment/33938757
score: 0
has comment: http://stackoverflow.com/comment/33938841
has comment: http://stackoverflow.com/comment/33938860
type: Answer
has body: array1 = Arrays.copyOf(array1, 99);
answers question: http://stackoverflow.com/q/22332199
has comment: http://stackoverflow.com/comment/33938906

http://stackoverflow.com/q/22357246
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22361455
type: Question
has body: I am having trouble scraping the table of contents on wiki. I am making a simple web scraper for a personal project and I can't figure out how to scrape this data. Here is my attempt at scraping the table of contents from any given wiki page String contentOver = doc.select("#toclimit-3 > li").first().text(); HERE IS THE CODE FROM THE PAGE I want to scrape, how do I get just the word "Chronology"?: 1 Chronology
tagged with: jsoup
has comment: http://stackoverflow.com/comment/33991019
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/7036332
accepted answer: http://stackoverflow.com/a/22361455
favorite count: 0
has title: Jsoup wiki scraper how do I get table of contents box
upvote count: 1
tagged with: web-scraping
type: AnsweredQuestion

http://stackoverflow.com/comment/34186128
comment on: http://stackoverflow.com/q/22472779
has text: *Which* line does it skip over?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22470591
has body: I am trying to implement HDIV to a spring 3.1 application. I have added the dependencies in pom file and listener, filter in web.xml file. I have done the configuration as shown and when I access the application then welcome page is loading but after that if I access any link from the screen then it is redirected to errorpage. I get the error as "HDIV_PARAMETER_NOT_EXISTS" What might be the problem? How to send HDIV parameter in request. Do I need to modify the JSPs to send HDIV parameter in request? web.xml: org.hdiv.listener.InitListener ValidatorFilter org.hdiv.filter.ValidatorFilter ValidatorFilter mvc-dispatcher http://www.springframework.org/tags/form /WEB-INF/lib/spring-form.tld http://www.springframework.org/tags /WEB-INF/lib/spring.tld http://java.sun.com/jsp/jstl/core /WEB-INF/lib/hdiv-c.tld pom.xml: org.hdiv hdiv-core ${org.hdiv-version} org.hdiv hdiv-config ${org.hdiv-version} org.hdiv hdiv-spring-mvc ${org.hdiv-version} org.hdiv hdiv-jstl-taglibs-1.2 ${org.hdiv-version} configuration: <hdiv:config excludedExtensions="css,png,gif,jpeg,jpg,js" errorPage="/errorPage.jsp"> <hdiv:startPages>/,/index.htm</hdiv:startPages> </hdiv:config> <hdiv:validation id="safeText"> <hdiv:acceptedPattern> ^[a-zA-Z0-9@.-_]*$ </hdiv:acceptedPattern> </hdiv:validation> <hdiv:editableValidations> <hdiv:validationRule url="/.*">safeText</hdiv:validationRule> </hdiv:editableValidations> Index.jsp: <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> Freight Management Tool <%@include file="header.jspf"%> <% if (request.isUserInRole("FMT_ADMIN")) { %> <spring:message code = "index.admin"/> <% } if (request.isUserInRole("FMT_NM")) { %> <spring:message code = "index.network.mngt"/> <% } if (request.isUserInRole("FMT_RM")) { %> <spring:message code = "index.revenue.mngt"/> <% } if (request.isUserInRole("FMT_SALES"))…
has comment: http://stackoverflow.com/comment/34195146
tagged with: hdiv
tagged with: spring-security
score: 0
has comment: http://stackoverflow.com/comment/34186583
has comment: http://stackoverflow.com/comment/34189798
answer count: 1
has title: HDIV always redirects to errorpage with error HDIV_PARAMETER_NOT_EXISTS
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34196040
tagged with: spring
has answer: http://stackoverflow.com/a/22507474
tagged with: java
has comment: http://stackoverflow.com/comment/34206498
type: Question

http://stackoverflow.com/comment/35963334
type: AnswerComment
comment on: http://stackoverflow.com/a/22452875
score: 0
type: Comment
has text: What other limitations or caveats exist with this approach? Is streaming less efficient? Please edit your answer to explain more clearly benefits/pitfalls with this approach.

get
tags question: http://stackoverflow.com/q/22336041
type: Tag
tag name: get
tags question: http://stackoverflow.com/q/22456100

http://stackoverflow.com/a/41328274
upvote count: 136
has body: In Java 8 it is even simpler than all of the above: when(mockObject.myMethod(anyString())) .thenAnswer(invocation -&gt; invocation.getArgumentAt(0, String.class));
score: 136
has comment: http://stackoverflow.com/comment/91748552
has comment: http://stackoverflow.com/comment/74390471
downvote count: 0
answers question: http://stackoverflow.com/q/22338536
has comment: http://stackoverflow.com/comment/135336566
has comment: http://stackoverflow.com/comment/114709284
type: Answer
has comment: http://stackoverflow.com/comment/87750796

http://stackoverflow.com/comment/34002182
has text: @Droider,thanks dear friend.now i googling preference tutorials :-)
comment on: http://stackoverflow.com/q/22350012
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22343714
upvote count: 2
has body: You need to use the positional $ operator and $set in order to update what you want. db.collection.update( { _id: &lt;docId&gt;, "stats.employee": "rob" }, { "$set": { "stats.$.stat2": &lt;value&gt; } } ) So you match your document and the required element of the array. The update side uses that array index to know in which element to update. The $set operator only updates the specified field. In Java, Build with BasicDBObject. BasicDBObject query = new BasicDBObject("_id", id); query.append( new BasicDBObject("stats.employee", "rob") ); BasicDBObject update = new BasicDBObject("$set", new BasicDBObject("stats.$.stat2", value)); collection.update(query,update);
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22343342

http://stackoverflow.com/a/22389277
accepted answer of: http://stackoverflow.com/q/22389154
score: 8
answers question: http://stackoverflow.com/q/22389154
downvote count: 0
has comment: http://stackoverflow.com/comment/34038100
type: Answer
has comment: http://stackoverflow.com/comment/34038285
has body: I believe you should define interceptor like this: <property name="basename" value="resources/i18n/messages" /> <property name="defaultEncoding" value="UTF-8" /> <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**" /> <property name="paramName" value="lang" /> </mvc:interceptor> </mvc:interceptors> <property name="cookieName" value="lang" /> <property name="defaultLocale" value="en" /> MVC namespace is defined like this: xmlns:mvc="http://www.springframework.org/schema/mvc" .... xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd" Make sure you use proper xsd version.
has comment: http://stackoverflow.com/comment/34038156
upvote count: 8
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34038037

http://stackoverflow.com/comment/34136863
score: 0
type: AnswerComment
type: Comment
has text: I see, does that mean that I should not initialize them but should check whether object is null or not?
comment on: http://stackoverflow.com/a/22445165

http://stackoverflow.com/q/22474812
has body: I have a simple android application with just a CameraPreview and a button. It should take a photo, convert it into a BinaryBitmap and then decode it so I can read the barcode. I'm using the ZXing library version 2.3 in java with the Android Studio version 0.5.1 I even don't know if I take the bitmap picture the right way. But at the end I just get a NotFoundException when I try to decode the bitmap at this point result = barcodeReader.decode(bMap); Here is my MainActivity.class: public class MainActivity extends Activity { private Camera mCamera; private CameraPreview mPreview; private Bitmap mBitmap; /** A safe way to get an instance of the Camera object. */ public static Camera getCameraInstance(){ Camera c = null; try { c = Camera.open(); // attempt to get a Camera instance } catch (Exception e){ // Camera is not available (in use or does not exist) } return c; // returns null if camera is unavailable } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); load(); } private void load() { // Create instance of Camera mCamera = getCameraInstance(); mCamera.setDisplayOrientation(90); // get Camera parameters Camera.Parameters params = mCamera.getParameters(); // set the focus mode params.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); // set Camera parameters mCamera.setParameters(params); // Create our Preview view and set it as the content of our activity mPreview = new CameraPreview(this, mCamera); FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); preview.addView(mPreview); } /** Check if this device has a camera */ private boolean checkCameraHardware(Context context) { if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)){ // this device has a camera return true; } else { // no camera on this device return false; } } public void takeSnapshot(View view) { Camera.AutoFocusCallback focusCallback = new Camera.AutoFocusCallback() { @Over…
tagged with: java
tagged with: zxing
type: Question
has comment: http://stackoverflow.com/comment/34188608
has title: Barcode Reader with ZXing no Result
has comment: http://stackoverflow.com/comment/34192123
has comment: http://stackoverflow.com/comment/34302524
score: 0
has comment: http://stackoverflow.com/comment/34188451
has comment: http://stackoverflow.com/comment/34189305
has comment: http://stackoverflow.com/comment/34192394
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34192177
has comment: http://stackoverflow.com/comment/34189310
tagged with: android
has comment: http://stackoverflow.com/comment/34191739
has comment: http://stackoverflow.com/comment/34189415
tagged with: bitmap
answer count: 0

http://stackoverflow.com/a/42310837
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22476795
has comment: http://stackoverflow.com/comment/77632391
upvote count: 1
has body: I had the same problem. After reading all the answers, I concluded that the downloaded .exe file was getting corrupt each time I download. Initially I used Internet Edge for the download (like 5 times) and I had the problem every time. The problem got solved when I switched to chrome browser, downloaded and installed again.
downvote count: 0

http://stackoverflow.com/q/22406893
tagged with: http://stackoverflow.com/tag/json
tagged with: mysql
type: Question
answer count: 1
has title: java.lang.StackOverflowError occuring with Hibernate and three tables
has body: I'm building an application that requires that a device can send a request to a webservice asking whether it can run a Jasmine unit test. This bit works. What doesn't work, is if I ask Hibernate to retrieve a full list of data, I get a StackOverFlowError. I've included the three entities. @Entity @Table(name = "device") public class Device { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "device_id") private Integer id; @Column(name = "device_name") private String deviceName; @OneToMany(mappedBy = "device", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set&lt;Test&gt; tests; } @Entity @Table(name = "test") public class Test { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "test_id") private Integer id; @Column(name = "test_name") private String testName; @OneToMany(mappedBy = "test", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set&lt;Test_Case&gt; testcases; @ManyToOne @JoinColumn(name = "device_id") private Device device; } @Entity @Table(name = "test_case") public class Test_Case { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Integer id; @Column(name = "test_case_id") private String testCaseId; @Column(name = "can_run") private String canRun; @ManyToOne @JoinColumn(name = "test_id") private Test test; } So to reiterate. Device contains a set of Test, a Test being something like Barcode, Scanner, etc, and each Test contains a set of Test Cases. A test case being an individual test for Barcode, etc. The schema for the database looks like the following. CREATE TABLE device ( device_id int(11) NOT NULL AUTO_INCREMENT, device_name varchar(100) DEFAULT NULL, PRIMARY KEY(device_id) ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; CREATE TABLE test( test_id int(11) NOT NULL AUTO_INCREMENT, test_name varchar(100) DEFAULT NULL, device_id int(11) NOT NULL, PRIMARY KEY(test_id), INDEX FK_DEVC (device_id), CONSTRAINT FK_DEVC FOREIGN KEY (device_id) REFERENCES dev…
has answer: http://stackoverflow.com/a/22407186
accepted answer: http://stackoverflow.com/a/22407186
score: 0
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/22435099
score: 0
has title: Iterating over String
tagged with: string
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22435180
has body: I have to iterate over the elements of a string and in each iteration to perform some checks. My question is: What is better to use: String or StringBuilder? Is there any difference in running time of String.charAt(i) or StringBuilder.charAt(i)? I do NOT have to modify the string, I just have to iterate over all elements.
answer count: 4
has answer: http://stackoverflow.com/a/22435137
tagged with: java
has answer: http://stackoverflow.com/a/22436234
type: Question
tagged with: indexing
linked to: http://stackoverflow.com/q/6461402
has answer: http://stackoverflow.com/a/22435134

http://stackoverflow.com/comment/112482993
type: Comment
comment on: http://stackoverflow.com/a/22396303
score: 1
type: AnswerComment
has text: @Razi Well, Swing is kind of dated and has seen any love for awhile, so it's not surprising. You could probably still pick up the source code if you needed it

http://stackoverflow.com/q/22420121
has comment: http://stackoverflow.com/comment/34092289
has comment: http://stackoverflow.com/comment/34091938
has comment: http://stackoverflow.com/comment/34091981
tagged with: jlist
has comment: http://stackoverflow.com/comment/34092127
has comment: http://stackoverflow.com/comment/34092212
has answer: http://stackoverflow.com/a/22420418
type: UnansweredQuestion
tagged with: mouselistener
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/34091950
has comment: http://stackoverflow.com/comment/34092259
has title: how to use mouse click event
tagged with: java
has comment: http://stackoverflow.com/comment/34092073
score: -1
has answer: http://stackoverflow.com/a/22425642
type: Question
has comment: http://stackoverflow.com/comment/34092241
answer count: 2
has comment: http://stackoverflow.com/comment/34091913
upvote count: 0
has comment: http://stackoverflow.com/comment/34092327
has body: Hi i have a class where i am using mouseclick event i want to call another class when i click from my mouse MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent mouseEvent) { JList theList = (JList) mouseEvent.getSource(); if (mouseEvent.getClickCount() == 2) { int index = theList.locationToIndex(mouseEvent.getPoint()); if (index &gt;= 0) { Object o = theList.getModel().getElementAt(index); // System.out.println("Double-clicked on: " + o.toString()); String a=o.toString(); LiistSelection.setListIndex(a); System.out.println(LiistSelection.getListIndex()); new MyGui4(); } } } }; i want to call this class when user click on list then new window should open here is my class mygui4.java public class MyGui4 extends JFrame { JLabel jLabel1; Container pane; private static ResultSet resultSet = null; public void Gui( ) { { getContentPane().setBackground(new java.awt.Color(255,153,51)); } this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Container c = getContentPane(); setUndecorated(true); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setBounds(0,0,screenSize.width, screenSize.height); ImageIcon image = new ImageIcon("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\a0.png"); Border border = LineBorder.createGrayLineBorder(); jLabel1 = new JLabel(image); jLabel1.setBorder(border); jLabel1.setBackground(Color.red); c.add(jLabel1); setLayout(null); } public static void main( String[] args ) { final MyGui4 frame = new MyGui4(); frame.Gui(); frame.setVisible(true); } }
tagged with: mouseclick-event
favorite count: 0
has comment: http://stackoverflow.com/comment/34092038

http://stackoverflow.com/a/22482615
has comment: http://stackoverflow.com/comment/34201220
has comment: http://stackoverflow.com/comment/34253125
has comment: http://stackoverflow.com/comment/34257909
answers question: http://stackoverflow.com/q/22482442
score: 0
has comment: http://stackoverflow.com/comment/34201029
has body: a tiled map looks very boxy, and old-fashioned That really depends upon the graphics, not the way of implementation. The cartoony and smooth look can be achieved using tiled maps too. It mostly depends upon the assets. Besides that, libGDX does not force you to use tiled maps. It is just one way to go at it. You can implement some raw stuff if you like, but I'd recommend using tiled maps for rapid prototyping as they are easy to create and manage.
type: Answer

http://stackoverflow.com/comment/34013173
type: QuestionComment
has text: @gawi i am using eclipse for running my code can you tell me how to do add file name
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22374258

http://stackoverflow.com/comment/34176610
comment on: http://stackoverflow.com/a/22467934
type: Comment
has text: Nevermind for the x velocity i got that but the y velocity still doesnt work
type: AnswerComment
score: 0

http://stackoverflow.com/q/22470459
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: text-parsing
has answer: http://stackoverflow.com/a/22470642
has body: I am aware that I can use File Reader class. But I am confused on the implementation when it comes to reading separate sections of text within a line. Each line in the file will have names (first and last name separated by an empty space), but a comma is used to delimited the UKNOWN set of full names. A semicolon is then used to to separate the section within the line. The next section is consisted of names of streets (each street name is delimited by a comma as well). What I want to do is read the full names into an ArrayList of strings, when the semicolon is reached, the street names should be inserted into a separate ArrayList of strings. If I could get a brief example of how to go on about the implementation, I could the entire thing on my own. NOTE: It must read from a text file. Each line will be a separate test case of full names, and street names. EDIT: Here is a sample of the input: James Cooper ,John Evans,Abe Lincoln;Jackson st,No way,Aspen Way Output: The array list of names holds = James Cooper , John Evans, Abe Lincoln (each separated by commas) The array list of street names holds = Jackson st,No way,Aspen Way (each separated by commas)
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/22470757
possible better answer: http://stackoverflow.com/a/22470715
has answer: http://stackoverflow.com/a/22470715
accepted answer: http://stackoverflow.com/a/22470642
favorite count: 0
has title: How to read lines from a file that has commas and semi colons in Java
has comment: http://stackoverflow.com/comment/34180526
has comment: http://stackoverflow.com/comment/34180856
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34180488

http://stackoverflow.com/comment/34180126
comment on: http://stackoverflow.com/q/22461560
has text: It is not being initialized. That is the problem. I think the value is being injected at run time. Is it?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34026960
type: AnswerComment
score: 0
type: Comment
has text: @coolblue2000 it would be better if you edit your question and add your current code below the current content to get better help.
comment on: http://stackoverflow.com/a/22383244

http://stackoverflow.com/a/22340739
has body: Something in your code, or the code your using, is very oddly expecting a non-standard version of a very standard class. You should search the source-code for this import statement: import com.lb.base.util.extra.SimpleDateFormat; or for a class/java file named SimpleDateFormat.java This is pretty difficult to diagnose without having direct access to your computer, but it seems like you are trying to use two classes with exactly the same name. One other thought: Instead of this SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); try explicit package names to bypass import statements: xbn.text.SimpleDateFormat formatter = new xbn.text.SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); I am assuming here that you want to use the standard Java versions. Here is a link with some information that may be instructive: https://www.google.com/search?q=is+already+defined+in+a+single-type+import+%5Bjavac%5D+import
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22340643
has comment: http://stackoverflow.com/comment/33953686
has comment: http://stackoverflow.com/comment/33953673
has comment: http://stackoverflow.com/comment/33953616

http://stackoverflow.com/comment/34179936
comment on: http://stackoverflow.com/q/22469650
score: 0
has text: Shifaza, this means that I'm marking your question as a duplicate because it have already been addressed by another question / set of answers (regardless of the author). Before asking a question always search for similar ones first. Take a look on [How To Ask](http://stackoverflow.com/questions/how-to-ask) for further info.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22389933
accepted answer: http://stackoverflow.com/a/22391553
has comment: http://stackoverflow.com/comment/34041660
type: Question
tagged with: android-viewpager
tagged with: android-fragments
tagged with: java
score: 4
has title: Swiping Tabs inside a Navigation Drawer Fragment
answer count: 1
has body: I have implemented Navigation Drawer by Referring this tutorial and now what I want to do is to display swiping tabs inside a fragment. ie. when i click on an item in navigation drawer, lets say the first one, it should display swiping tabs for that items. If the item1 is Events, when i click on it, then it should display swiping tabs with tabs like todays events, and upcoming events. Im a beginner and I have tried to google for this, the solution i find is using sherlock, but i dont want to use any library. Please point me to a right tutorial. Can i implement view pager inside fragment. Given that view pager will have two more fragments. Thank you.
downvote count: 0
favorite count: 0
tagged with: android
upvote count: 4
has comment: http://stackoverflow.com/comment/34039241
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22391553

http://stackoverflow.com/comment/33936946
type: Comment
comment on: http://stackoverflow.com/a/22331118
score: 1
type: AnswerComment
has text: You have used both `length()` and `chatAt()` methods, so I assume not the best answer!

http://stackoverflow.com/comment/33941884
type: QuestionComment
has text: I know this is not object's equal. That is why I only want to put that specific equal in the wrapper.
comment on: http://stackoverflow.com/q/22334171
type: Comment
score: 0

http://stackoverflow.com/comment/34010788
type: AnswerComment
has text: I would say, it is better to contribute to the Qt Jambi project if it does not work for you. That way, it will be usable for others, too, and the next person will not ask the same question again...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22368653

http://stackoverflow.com/comment/58088238
score: 0
type: AnswerComment
has text: This solution indeed makes glassfish start.... BUT: when I deploy a java 8 war, the app is deployed, but any classes that contain java 8 references are not loaded with a "Exception while visiting xxxx.class of size..." error
comment on: http://stackoverflow.com/a/24106498
type: Comment

http://stackoverflow.com/comment/34007770
type: AnswerComment
score: 0
type: Comment
has text: Are you sure that input elements for the dates are inside the form?
comment on: http://stackoverflow.com/a/22371824

http://stackoverflow.com/q/22467100
type: AnsweredQuestion
upvote count: 3
has body: I am trying to know and understand as many algorithms as I can and I stumbled across a strange algorithm in a contest packet that finds the minimum number of steps to solve a maze (shortest path). I understand it 100%, but I don't know what algorithm it is and the packet did not state the name of it. I would really like to know the name of this algorithm (if it has a name) so I can do more research on it. import java.io.File; import java.util.Scanner; class spot { char type; int distance; spot closest; public spot() { type = '.'; distance = Integer.MAX_VALUE; closest = null; } } public class myalg { public static void main(String args[]) throws Exception { int moves = 0; Scanner keyb = new Scanner(new File("src/mar2014/maze2.txt")); int rows = keyb.nextInt(); int cols = keyb.nextInt(); spot mat[][] = new spot[rows][cols]; keyb.nextLine(); spot startSpot = null; spot endSpot = null; for (int i = 0; i &lt; mat.length; i++) { String line = keyb.nextLine(); for (int j = 0; j &lt; mat[i].length; j++) { mat[i][j] = new spot(); mat[i][j].type = line.charAt(j); if (mat[i][j].type == 'S') { startSpot = mat[i][j]; startSpot.distance = 0; startSpot.type = ' '; } if (mat[i][j].type == 'E') { endSpot = mat[i][j]; endSpot.type = ' '; } } } boolean changeMade = true; while (changeMade) { changeMade = false; for (int i = 0; i &lt; mat.length; i++) { for (int j = 0; j &lt; mat[i].length; j++) { spot thisSpot = mat[i][j]; spot adjacentSpots[] = {null, null, null, null}; if (i &gt; 0) { adjacentSpots[0] = mat[i - 1][j]; } if (i &lt; cols - 1) { adjacentSpots[1] = mat[i + 1][j]; } if (j &gt; 0) { adjacentSpots[2] = mat[i][j - 1]; } if (j &lt; rows - 1) { adjacentSpots[3] = mat[i][j + 1]; } if (thisSpot.type == ' ') { for (int k = 0; k &lt; 4; k++) { if (adjacentSpots[k] != null &amp;&amp; adjacentSpots[k].distance &lt; (thisSpot.distance - 1)) { thisSpot.distance = adjacentSpots[k].distance + 1; thisSpot.closest = adjacentSpots[k]; changeMade = true; } } } } } } spot spot = endSpot; wh…
type: Question
score: 3
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/22467252
answer count: 1
downvote count: 0
favorite count: 0
tagged with: maze
accepted answer: http://stackoverflow.com/a/22467252
has title: What shortest path maze algorithm is this?

http://stackoverflow.com/comment/34097020
type: QuestionComment
has text: @TedBigham that would be `strncpy()` but that's the essence of the problem indeed
comment on: http://stackoverflow.com/q/22423147
score: 0
type: Comment

http://stackoverflow.com/comment/33993639
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22363434
has text: @MikeB ArrayList<String> items=new ArrayList<String>(); String[] gender = {"--Select--","Male","Female"};
score: 0

http://stackoverflow.com/q/22369125
has title: Counting the character 'e'
has comment: http://stackoverflow.com/comment/34003219
possible better answer: http://stackoverflow.com/a/22369312
answer count: 3
has answer: http://stackoverflow.com/a/22369312
favorite count: 0
tagged with: character
has body: Hi I have to create a method that takes the word message, and counts how many times the character e appears this is what I have but I always get 0. any suggestions? public class run { public static void main(String[] args) { String message ="message"; int count=0; for(int i=0; i&gt;=message.length()-1;i++) { char ch = message.charAt(i); char e='e'; if( ch == e) { count = count +1; } } System.out.println(count); } }
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22369143
has comment: http://stackoverflow.com/comment/34003496
type: Question
has answer: http://stackoverflow.com/a/22369177
accepted answer: http://stackoverflow.com/a/22369143
downvote count: 0

http://stackoverflow.com/comment/34059751
score: 0
type: AnswerComment
type: Comment
has text: am using piece of code in DAO with jdbctemplate like this "JdbcTemplate jt=new DbConnection().getJdbctemplate(); String sql="INSERT INTO EMPLOYEE_ROLE(EMP_NUM,ROLE,STATUS)VALUES (?,?,'LOGGEDIN')"; jt.update(sql,new Object[] { empNum,empRole});" here it is executing that jt.update directly now i would like to handle it. so suggest it.
comment on: http://stackoverflow.com/a/22402266

http://stackoverflow.com/comment/33959379
comment on: http://stackoverflow.com/q/22344020
type: Comment
type: QuestionComment
has text: What exception are you getting?
score: 0

http://stackoverflow.com/comment/34001832
has text: Ok.. I am using NetBeans. I ran your code and a window appeared with a button named Test. When I clicked on it Yuup is displayed below. Is that that the way you supposed it to work ?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22368183

http://stackoverflow.com/comment/33998223
type: AnswerComment
has text: The problem is our observations shows the following. We get an element through the cache. It is now managed by the cache. The key is reloaded every 30 seconds through cachloader.reload(). We do not acess the key again. The key is beeing refreshed every 30 seconds and thus never expires.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22360994

jdbc
tags question: http://stackoverflow.com/q/22347030
tags question: http://stackoverflow.com/q/22450184
tags question: http://stackoverflow.com/q/22406417
tags question: http://stackoverflow.com/q/22434068
tags question: http://stackoverflow.com/q/22480675
tags question: http://stackoverflow.com/q/22328395
tags question: http://stackoverflow.com/q/22469360
tags question: http://stackoverflow.com/q/22347943
tags question: http://stackoverflow.com/q/22402349
tags question: http://stackoverflow.com/q/22439233
tags question: http://stackoverflow.com/q/22407180
tags question: http://stackoverflow.com/q/22428404
tags question: http://stackoverflow.com/q/22377753
tags question: http://stackoverflow.com/q/22377551
tags question: http://stackoverflow.com/q/22403083
tags question: http://stackoverflow.com/q/22384710
tags question: http://stackoverflow.com/q/22404419
tags question: http://stackoverflow.com/q/22485574
tags question: http://stackoverflow.com/q/22410236
tags question: http://stackoverflow.com/q/22369212
type: Tag
tags question: http://stackoverflow.com/q/22368801
tags question: http://stackoverflow.com/q/22375951
tags question: http://stackoverflow.com/q/22433462
tags question: http://stackoverflow.com/q/22345621
tags question: http://stackoverflow.com/q/22431984
tags question: http://stackoverflow.com/q/22448713
tags question: http://stackoverflow.com/q/22425444
tags question: http://stackoverflow.com/q/22413437
tags question: http://stackoverflow.com/q/22460824
tags question: http://stackoverflow.com/q/22420594
tags question: http://stackoverflow.com/q/22485162
tags question: http://stackoverflow.com/q/22442623
tags question: http://stackoverflow.com/q/22388107
tags question: http://stackoverflow.com/q/22482418
tags question: http://stackoverflow.com/q/22481699
tags question: http://stackoverflow.com/q/22415022
tags question: http://stackoverflow.com/q/22470150
tags question: http://stackoverflow.com/q/22388233
tags question: http://stackoverflow.com/q/22332826
tags question: http://stackoverflow.com/q/22383762
tags question: http://stackoverflow.com/q/22403933
tags question: http://stackoverflow.com/q/22417968
tags question: http://stackoverflow.com/q/22422241
tags question: http://stackoverflow.com/q/22352173
tags question: http://stackoverflow.com/q/22385486
tags question: http://stackoverflow.com/q/22365753
tags question: http://stackoverflow.com/q/22394079
tags question: http://stackoverflow.com/q/22393476
tags question: http://stackoverflow.com/q/22398008
tags question: http://stackoverflow.com/q/22381922
tags question: http://stackoverflow.com/q/22392277
tags question: http://stackoverflow.com/q/22419395
tags question: http://stackoverflow.com/q/22360730
tags question: http://stackoverflow.com/q/22475529
tags question: http://stackoverflow.com/q/22449837
tag name: jdbc
tags question: http://stackoverflow.com/q/22411691
tags question: http://stackoverflow.com/q/22415916
tags question: http://stackoverflow.com/q/22328517
tags question: http://stackoverflow.com/q/22436711
tags question: http://stackoverflow.com/q/22356079
tags question: http://stackoverflow.com/q/22354839
tags question: http://stackoverflow.com/q/22360721
tags question: http://stackoverflow.com/q/22481205
tags question: http://stackoverflow.com/q/22406321
tags question: http://stackoverflow.com/q/22460092
tags question: http://stackoverflow.com/q/22338598
tags question: http://stackoverflow.com/q/22458237

http://stackoverflow.com/comment/34147363
comment on: http://stackoverflow.com/q/22406630
score: 0
type: QuestionComment
type: Comment
has text: Can you give 5-6 examples of Gazetteer entries you marked as 'Service'? This would help to understand your goal better. An example of 'multiple tokens' you expect after 'Service' would help too.

http://stackoverflow.com/comment/34078447
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22412400
has text: No! I use 7! `thanos@thanos-laptop:~$ java -version java version "1.7.0_51" OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.12.04.2) OpenJDK Server VM (build 24.45-b08, mixed mode)`
score: 0

http://stackoverflow.com/comment/34063785
comment on: http://stackoverflow.com/a/22403969
score: 0
type: Comment
has text: @raj Did you try to run the snippet of code I commented? See http://ideone.com/zinBHy.
type: AnswerComment

http://stackoverflow.com/comment/33943483
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22334505
has text: @Radiodef i thought i had tried to do that with this getContentPane().removeAll(); TaxiCanvas tax = new TaxiCanvas(); add(tax); unfortunatley im very new to this and dont know where to go next

http://stackoverflow.com/comment/34138597
comment on: http://stackoverflow.com/q/22446184
type: Comment
type: QuestionComment
has text: Java is a compiled language, so no
score: 1

http://stackoverflow.com/a/22368098
score: 1
has body: Pretty sure your intended result is public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Please enter the number of courses you have left: "); int size = input.nextInt(); int[] numArr = new int[size]; int totalSum = 0; System.out.println("Enter the number of CUs for each course: "); for (int i=0; i&lt;numArr.length; i++) { numArr[i] = input.nextInt(); totalSum += numArr[i]; } System.out.print("The sum of the numbers is: " + totalSum); } Your other code didn't work mainly because of int totalSum = numArr + totalSum; You can't define totalSum to defines itself! And you can't just use numArr... numArr is an array - you have to access indexes, not the array as a whole!
upvote count: 1
answers question: http://stackoverflow.com/q/22368018
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34003421
has text: A JSP is a `Servlet`.
type: Comment
comment on: http://stackoverflow.com/q/22368689
score: 0
type: QuestionComment

http://stackoverflow.com/a/71790930
has comment: http://stackoverflow.com/comment/126867490
score: 0
type: Answer
has body: It's not allowed to read/write settings by non-system apps from Android 10. https://developer.android.google.cn/about/versions/10/privacy/changes#non-resettable-device-ids Starting in Android 10, apps must have the READ_PRIVILEGED_PHONE_STATE privileged permission in order to access the device's non-resettable identifiers, which include both IMEI and serial number.
answers question: http://stackoverflow.com/q/22436627

http://stackoverflow.com/a/22335588
upvote count: 6
accepted answer of: http://stackoverflow.com/q/22335358
has comment: http://stackoverflow.com/comment/34000421
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33995947
type: Answer
score: 6
answers question: http://stackoverflow.com/q/22335358
has body: Assuming you use CXF and you have a generated class for a service endpoint BookStore BookStore store = JAXRSClientFactory.create("http://bookstore.com", BookStore.class); Books books = store.getAllBooks(); See the following links for details: http://cxf.apache.org/docs/jax-rs-client-api.html http://cxf.547215.n5.nabble.com/How-to-generate-rest-client-with-wadl2java-td5738281.html

http://stackoverflow.com/comment/34081703
score: 0
comment on: http://stackoverflow.com/q/22414361
type: Comment
type: QuestionComment
has text: Sorry, I can't have insights about unposted errors for unposted code.

http://stackoverflow.com/q/22347381
tagged with: locking
answer count: 3
has title: Java - lock acquisition on get method
downvote count: 0
has answer: http://stackoverflow.com/a/22348840
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22347577
tagged with: multithreading
has body: I have recently studied some concurrent classes in Java, such as PriorityBlockingQueue and here is the relevant piece of code: public E peek() { final ReentrantLock lock = this.lock; lock.lock(); E result; try { result = size &gt; 0 ? (E) queue[0] : null; } finally { lock.unlock(); } return result; } Let's consider rewriting this a bit (for a purpose of this question), given that queue[0] is either set or null, therefore becoming simply return queue[0]. Now, I am not sure that in this scenario lock acquisition is actually necessary... Could it be non thread safe without a lock due to some edge-case compiler optimizations?
score: 3
upvote count: 3
tagged with: java
tagged with: concurrency
tagged with: queue
has answer: http://stackoverflow.com/a/22347774
type: Question

http://stackoverflow.com/q/22468976
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22468990
favorite count: 0
upvote count: 1
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22468990
has comment: http://stackoverflow.com/comment/34179707
has title: Trouble calculating percentage
has body: I typed up a election code and I cannot get the percentage of votes for candidates. Here is my code: import java.util.Scanner; public class Voting { public static void main (String [] args) { int candidate1; int candidate2; int Toronto1; int Toronto2; int Mississauga1; int Mississauga2; int Brampton1; int Brampton2; int total_votes1; int total_votes2; int totalall; double percentage1; double percentage2; Scanner input = new Scanner (System.in); System.out.print("Votes for Candidate 1 from Toronto"); Toronto1=input.nextInt(); System.out.print("Votes for Candidate 2 from Toronto"); Toronto2=input.nextInt(); System.out.print("Votes for Candidate 1 from Mississauga"); Mississauga1=input.nextInt(); System.out.print("Votes for Candidate 2 from Mississauga"); Mississauga2=input.nextInt(); System.out.print("Votes for Candidate 1 from Brampton"); Brampton1=input.nextInt(); System.out.print("Votes for Candidate 2 from Brampton"); Brampton2=input.nextInt(); total_votes1=Toronto1+Mississauga1+Brampton1; total_votes2=Toronto2+Mississauga2+Brampton2; totalall=total_votes1+total_votes2; percentage1=(Toronto1+Mississauga1+Brampton1)/(total_votes1+total_votes2); percentage2=(Toronto2+Mississauga2+Brampton2)/(total_votes1+total_votes2); System.out.println("Election Results for Toronto:"); System.out.println("Candidate 1 = " +Toronto1+ ""); System.out.println("Candidate 2 = " +Toronto2+ "\n"); System.out.println("Election Results for Mississauga:"); System.out.println("Candidate 1 = " +Mississauga1+ ""); System.out.println("Candidate 2 = " +Mississauga2+ "\n"); System.out.println("Election Results for Brampton:"); System.out.println("Candidate 1 = " +Brampton1+ ""); System.out.println("Candidate 2 = " +Brampton2+ "\n"); System.out.println("Candidate Vote Percentage\n"); System.out.println("Candidate1 " +total_votes1+ " "+percentage1+"%"); System.out.println("Candidate2 " +total_votes2+ " "+percentage2+"%"); System.out.println("Total Votes " +totalall+""); } } this is the answer: Votes…
downvote count: 0
has comment: http://stackoverflow.com/comment/34178277
score: 1
type: Question

http://stackoverflow.com/q/22487126
tagged with: grails
type: Question
upvote count: 4
answer count: 2
tagged with: groovy
possible better answer: http://stackoverflow.com/a/22488424
has body: I am new working with grails application.I am confusing about this -> operator in grails. Can anyone give me clear concept about this? or Give me any reference about this that can be easy for me. I am already reading online documentation and some books but i am still confusing about this operator and usages.
tagged with: grails-2.0
has answer: http://stackoverflow.com/a/22488424
favorite count: 0
has answer: http://stackoverflow.com/a/22487192
score: 2
has title: what does the -> operator means and usages in grails?
tagged with: grails-orm
downvote count: 2
accepted answer: http://stackoverflow.com/a/22487192
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34209629

http://stackoverflow.com/q/22470570
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22473911
score: 0
answer count: 1
has title: Liferay migration 5.3.2 to 6.2 Database changes
accepted answer: http://stackoverflow.com/a/22473911
tagged with: java
tagged with: database
has body: I am trying to migrate liferay from 5.3.2 to 6.2. As per the documents I understood that , it is not straight forward. First we need to migrate from 5.3.2 to 6.0.6 to 6.1 and finally to 6.2. Now I just started to implement the steps to convert my liferay portal (5.3.2) to 6.0.6 as a first step. My query is, in this process, will it change any schema or structure of the tables in a database in order to support the upgraded version? Any idea on this?
tagged with: liferay

http://stackoverflow.com/q/22344063
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/33167857
has body: I have to design an app in which on click of the neutral button, an image of the alert dialogue gets stored in the sdcard. So I decided to programatically take a screenshot and then use the BitmapDecodeRegion class to crop the image. But when i take the screenshot, the alert dialogue does not appear in it since it's not attached to the window. How can I attach it to the window? here is the code snippet: public void btnClick(View v) { Log.d("", "logger button clicked"); AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setTitle("This is a demo!"); dialog.setMessage("Lets see if this works"); dialog.setCancelable(false); dialog.setNeutralButton("Take Snap", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Bitmap bitmap; View v1 = findViewById(android.R.id.content) .getRootView(); v1.setDrawingCacheEnabled(true); bitmap = Bitmap.createBitmap(v1.getDrawingCache()); GlobalObj.screenImg = bitmap; v1.setDrawingCacheEnabled(false); Intent i = new Intent(MainActivity.this, ViewActivity.class); startActivity(i); } }); AlertDialog newDialog = dialog.create(); newDialog.show(); Kindly help me out.
tagged with: java
type: UnansweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/38805887
linked to: http://stackoverflow.com/q/17393656
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/20136121
tagged with: android
tagged with: android-alertdialog
has comment: http://stackoverflow.com/comment/33962688
has title: show alert dialog in screenshot

http://stackoverflow.com/comment/33997048
comment on: http://stackoverflow.com/q/22365250
has text: I think the only option is the second one :S.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22481495
score: 2
downvote count: 0
has body: Edit Dec. 2014: This issue has been fixed by the developers of JDatePicker. See juanheyns's answer below. After looking into the source code of JDatePicker I think this is not possible without changing the source code of JDatePicker. Implementing that behavior requires some minor changes to the source code of the class net.sourceforge.jdatepicker.impl.JDatePickerImpl (line 209): /** * Called internally to popup the dates. */ private void showPopup() { // This is the replaced code: // if (popup == null){ // PopupFactory fac = new PopupFactory(); // Point xy = getLocationOnScreen(); // datePanel.setVisible(true); // popup = fac.getPopup(this, datePanel, (int) xy.getX(), (int) (xy.getY()+this.getHeight())); // popup.show(); // } // This is new code JPopupMenu pop = new JPopupMenu(); pop.add(datePanel); pop.show(this, this.getX(), this.getY() + this.getHeight()); } Please also have a look at How do you hide a Swing Popup when you click somewhere else for some more details.
answers question: http://stackoverflow.com/q/22476343
accepted answer of: http://stackoverflow.com/q/22476343
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34176259
type: QuestionComment
comment on: http://stackoverflow.com/q/22467153
has text: @SotiriosDelimanolis Debuggers are not panaceas. It most certainly depends on what tools are at your disposal. If you don't have a good user interface for working with the debugger, it would probably be easier to use some `println`s to see what's going on. Even with a debugger at my disposal, I often prefer that method, anyway, since the debuggers I've worked with are often unreliable or confusing things happen when the code is run (like the debugger pausing at an unexpected time with a different state and leaving me thinking something is wrong when it's not).
score: 0
type: Comment

http://stackoverflow.com/q/22366084
tagged with: paintcomponent
linked to: http://stackoverflow.com/q/15302085
favorite count: 0
type: UnansweredQuestion
has title: How to make an animated circle?
tagged with: animation
tagged with: swing
has body: Im still learning GUI, still having some trouble getting my head around threads :/ Im making this GUI in which there are 2 circles, one big (100x100) and one small (50x50). The small one will go to the edge of the big circle and during 0.5seconds, the small circle will go to the center and that it when the user has to click. Whenever the user clicks when the circle is in the middle then the user scores. The only trouble im having is that the circle is not moving about as I suspect its something got to do with my threads, hence the reason why i m using threads, to get to know how to use them. GUI public class gui extends JPanel implements MouseListener, Runnable { Thread t = new Thread(); int score = 0; int rnd; static final int smallcircleposx = 75; static final int smallcircleposy = 75; int circleposx = 75; int circleposy = 75; int mousex, mousey; Random random = new Random(); public gui() { } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.BLUE); g.fillOval(50, 50, 100, 100); g.setColor(Color.RED); g.fillOval(circleposx, circleposy, 50, 50); } // THREAD FOR MOVING THE CIRCLE public void run() { rnd = random.nextInt(999); if (rnd % 5 == 0) { circleposx = circleposx + 25; } else if (rnd % 4 == 0) { circleposx = circleposx - 25; } else if (rnd % 3 == 0) { circleposy = circleposy + 25; } else { circleposy = circleposy - 25; } try { Thread.sleep(500); circleposx = smallcircleposx; circleposy = smallcircleposy; } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void mouseClicked(MouseEvent m) { if (circleposx == smallcircleposx &amp;&amp; circleposy == smallcircleposy) { score++; } } MAIN public class main { public static void main(String[] args) { JFrame frame = new JFrame("Circle enlarger"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400,400); frame.setVisible(true); gui co = new gui(); frame.add(co); frame.addMouseListener(co); Thread x = new Thread(new gui(…
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33998431
type: Question
linked to: http://stackoverflow.com/q/7196889
linked to: http://stackoverflow.com/q/3541373
has answer: http://stackoverflow.com/a/22366246
answer count: 1
tagged with: user-interface
downvote count: 0

http://stackoverflow.com/comment/34139105
type: QuestionComment
type: Comment
has text: @Raghunandan I am aware of that and I have mentioned it in the question in detail. What option do I have?
score: 0
comment on: http://stackoverflow.com/q/22446452

http://stackoverflow.com/q/22434919
has answer: http://stackoverflow.com/a/31429037
tagged with: listview
has body: I'm trying to figure out how to implement an infinitely scrolling list. It will display a calendar and events and it should start from now or selected date. It should be scrollable in both directions, past and future. The solutions with OnScrollListener here seem to work pretty well if I only need to go to future (index just grows bigger). But I don't see how I would go to the past. This solution seems to be very wasteful for my case. getView is called thousands of times. Maybe ListView isn't the solution, and I'll have to go with lower-level code. Any ideas? EDIT: getView being called thousands of times wasn't the fault of the latter solution. However, it still gets called too many times and with wrong values. If I set selection like this: myList.setSelection(Integer.MAX_VALUE/2) I get getView calls with indexes starting from zero. For example, I get getView calls like this: getView pos 0 ... getView pos 26 and then getView pos 1073741823 ... getView pos 1073741847 Which are the correct ones. Then: getView pos 0 ... getView pos 26 again This all happens before I scroll or touch the screen at all. Doesn't seem to make much sense.
downvote count: 0
answer count: 1
has title: Android infinitely scrolling list in both directions
linked to: http://stackoverflow.com/q/19469054
favorite count: 0
has comment: http://stackoverflow.com/comment/34121648
tagged with: infinite-scroll
tagged with: android
has comment: http://stackoverflow.com/comment/34117608
upvote count: 6
has comment: http://stackoverflow.com/comment/34118416
has comment: http://stackoverflow.com/comment/84875187
type: UnansweredQuestion
score: 6
type: Question
linked to: http://stackoverflow.com/q/1080811
has comment: http://stackoverflow.com/comment/34117892
tagged with: java

http://stackoverflow.com/q/22417069
has body: I have searched for this answer everywhere and I cant find it. Would love for someone to help me. I am trying to send strings and an image thru Multipart Entity to a server. The strings are getting to the database but the image is always saying "blob- 0 bytes" Below is my java and php code. ByteArrayOutputStream bos = new ByteArrayOutputStream(); proPic.compress(CompressFormat.JPEG, 75, bos); byte[] data = bos.toByteArray(); entity.addPart("tag", new StringBody("register")); entity.addPart("name", new StringBody(name)); entity.addPart("email", new StringBody(email)); entity.addPart("password", new StringBody(password)); entity.addPart("image", new ByteArrayBody(data,"profileImage.jpg")); and my server php //request type is register new user $name = $_POST['name']; $profiePic = $_FILES['image']['name']; $email=$_POST['email']; $password=$_POST['password']; Can someone please help? I am getting no errors just an empthy field
tagged with: android
upvote count: 1
tagged with: php
type: AnsweredQuestion
tagged with: multipartentity
score: 1
has answer: http://stackoverflow.com/a/22418206
tagged with: java
accepted answer: http://stackoverflow.com/a/22418206
type: Question
has title: Multipart Entity Sending images to php server on Android Application
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34086414
favorite count: 0

http://stackoverflow.com/a/22470479
downvote count: 0
answers question: http://stackoverflow.com/q/22470257
has body: You can use the TYPE Class objects. Each wrapper class has one and it represents the corresponding primitive type. You can also refer to these with a class literal, e.g. char.class. So if you have some class that takes a primitive in a constructor: public class Abc { public Abc(char c) {} } You can get the constructor using the primitive type: Constructor&lt;Abc&gt; ctor; ctor = Abc.class.getConstructor(Character.TYPE); // Character.TYPE and ctor = Abc.class.getConstructor(char.class); // char.class are the same Then you can invoke it with a boxed primitive: Abc abc; abc = ctor.newInstance(Character.valueOf('a')); // invoke with wrapper abc = ctor.newInstance('a'); // or autobox You can use the primitive Class objects anywhere else you need to refer to a primitive type. Fields, Methods, etc.
type: Answer
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22470257
type: AcceptedAnswer

http://stackoverflow.com/comment/34039692
type: Comment
has text: @Peter de Rivaz: Added a patch. Thank you, that slipped away from me.
type: AnswerComment
comment on: http://stackoverflow.com/a/22389860
score: 0

http://stackoverflow.com/q/22486230
favorite count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/35924324
score: 5
linked to: http://stackoverflow.com/q/1080634
has body: I want to change JFileChooser start directory to desktop. So, in my computer I wrote: JFileChooser fc = new JFileChooser("C:\\Users\\LNK\\Desktop"); The problem is, when I compile my code and run program in another computer it doesn't work because there are no C:\\Users\\LNK\\Desktop path. So, is there some kind of "apsolute" path of desktop?
upvote count: 5
has answer: http://stackoverflow.com/a/22486332
has answer: http://stackoverflow.com/a/22486287
answer count: 3
has comment: http://stackoverflow.com/comment/34208013
downvote count: 0
has title: How to change JFileChooser start directory to desktop?

http://stackoverflow.com/comment/34002160
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22368402
has text: that's because you can convert a char to its ascii value

http://stackoverflow.com/q/22375808
answer count: 1
has body: I have an p:inputText field in my JSF 2 form which is mapped to a HashMap&lt;String, Long&gt; values like this: &lt;p:inputText id="input1" value="#{simpleFormTest.longValues['input1']}" /&gt; Now, when I submit a string value in that input text and iterate through my map of Long objects, I can see the string value there. There is no conversion exception ond classCastException. When I submit the form once more I get an exception NumberFormatException. when converting the value. It is interesting that the conversion where I get the exception happens when reading the old value from the map, not when trying to set the new one. Does anyone no, if this is some bug in JSF, or how to avoid it? I've found out that when I explicitelly set the LongConverter for that field it is working, but shouldn't this be done implicitely? Thanks. Here is a simple test: SimpleFormTest.java @Named("simpleFormTest") @ConversationScoped public class SimpleFormTest implements Serializable { private Map&lt;String, Long&gt; longs = new HashMap&lt;String, Long&gt;(); public String submitAction() { log.info("(Long): " + longs.get("test")); } public Map&lt;String, Long&gt; getLongs() { return longs; } public void setLongs(Map&lt;String, Long&gt; longs) { this.longs = longs; } } layout.xhtml: &lt;h:form id="new-form"&gt; &lt;p:inputText value="#{simpleFormTest.longs['test']}" /&gt; &lt;p:commandButton action="#{simpleFormTest.submitAction}" &lt;/h:form&gt; If I submit the form I get following log message: [com.example.SimpleFormTest] (default task-15) (Long): aa
accepted answer: http://stackoverflow.com/a/24076521
has comment: http://stackoverflow.com/comment/34151426
has comment: http://stackoverflow.com/comment/34118932
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34014060
type: Question
has comment: http://stackoverflow.com/comment/34014207
tagged with: primefaces
has answer: http://stackoverflow.com/a/24076521
has title: JSF2 InputText for Long value also takes string
tagged with: jsf-2
score: 0
has comment: http://stackoverflow.com/comment/34013768

http://stackoverflow.com/q/22394627
has title: Get a reference in "for each" java
has answer: http://stackoverflow.com/a/22394645
tagged with: foreach
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34047430
tagged with: java
has answer: http://stackoverflow.com/a/22394709
accepted answer: http://stackoverflow.com/a/22394709
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34047294
has body: I have this code: ArrayList&lt;MyClass&gt; MyArrayList = new ArrayList&lt;MyClass&gt;(); for (int i = 0; i &lt; 10; i++){ MyClass AuxObject = new Myclass(); // Generates an object whit random properties; MyArrayList.add(AuxObject); } /* At this point lets suposse we have the list like this Obj1 obj2 obj3 obj4 obj5 obj6 obj7 obj8 obj9 obj10 */ MyClass MyAuxObject = null; for(MyClass NObject: MyArrayList){ if(NObject.SomeBoolean == true){ MyAuxObject = NObject; // is valid? break; } } My question is "MyAuxObject" will be a reference to some object on my list or gona be null? Can i use "Nobject" to get a reference to an object on the list?
score: 0
tagged with: reference
possible better answer: http://stackoverflow.com/a/22394645

http://stackoverflow.com/q/22378513
score: 3
has body: I try to make simple chat program base on this example. import io.netty.channel.ChannelHandlerContext; public class ChatClientHandler extends ChannelInboundMessageHandlerAdapter&lt;String&gt; { } I get cannot find symbol error. I'd also tried change SimpleInboundHandlerAdapter to SimpleInboundHandlerAdapter but with same result.
has comment: http://stackoverflow.com/comment/34018060
has answer: http://stackoverflow.com/a/39539608
has title: ChannelInboundMessageHandlerAdapter cannot find symbol
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/39539608
tagged with: netty
has comment: http://stackoverflow.com/comment/34018676
type: AnsweredQuestion
tagged with: netbeans
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/34018742
type: Question

http://stackoverflow.com/q/22452691
accepted answer: http://stackoverflow.com/a/22452764
duplicate of: http://stackoverflow.com/q/5235401
has comment: http://stackoverflow.com/comment/34149166
has answer: http://stackoverflow.com/a/22452764
score: 0
answer count: 2
has title: Java : split string to char array using regex
tagged with: regex
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5235401
tagged with: java
possible better answer: http://stackoverflow.com/a/22453130
has body: I know there lots of way splitting a string to array. but i wonder is there a regex that i can use it to split all string chars to a String[] array ? For example : "foo"->String[] { "f","o","o" } String input="foo"; String[] split=input.split( .... )
has answer: http://stackoverflow.com/a/22453130
type: Question

http://stackoverflow.com/q/22368504
favorite count: 0
has comment: http://stackoverflow.com/comment/34002327
has comment: http://stackoverflow.com/comment/34002354
score: 0
has title: JSON to POJO conversion error
has body: I am trying to pass a JSON request to my server where the controller encounters an error while converting the JSON to POJO. JSON Request { "request":[ {"name":"mac"}, {"name":"rosy"} ] } My controller function @RequestMapping(value = "/namelist", method = RequestMethod.POST, consumes = { "application/json" }, produces = {"application/json"}) public ... postNameList(@RequestBody NameList names) {} Public Class NameList extends ArrayList&lt;Name&gt; {} Public Class Name { private name; ...} Error message: "Could not read JSON: Can not deserialize instance of com.abc.xyz.mypackage.NameList out of START_OBJECT token at [Source: org.eclipse.jetty.server.HttpConnection$Input@79aac24b{HttpChannelOverHttp@1d109942{r=1,a=DISPATCHED,uri=/namelist},HttpConnection@2cbdcaf6{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=END,137 of 137}}; line: 1, column: 1] I am not sure what's wrong with the code. I am fairly new to Spring so any help is appreciated.
linked to: http://stackoverflow.com/q/19389723
has answer: http://stackoverflow.com/a/56356158
has comment: http://stackoverflow.com/comment/34002462
type: UnansweredQuestion
upvote count: 1
tagged with: spring
downvote count: 1
has answer: http://stackoverflow.com/a/22374473
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: pojo
type: Question
answer count: 2
tagged with: jackson

http://stackoverflow.com/a/22430397
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34111057
has body: Files are not resources. If you're creating them, writing them, etc, you shouldn't and probably can't read them as resources. Use new FileInputStream() or new FileReader(). Calling createNewFile() before either new FileOutputStream() or new FileWriter is not only redundant but wasteful. Applications should not read their own log files, or each other's. This is a job for a database.
type: Answer
has comment: http://stackoverflow.com/comment/34121642
answers question: http://stackoverflow.com/q/22425501
accepted answer of: http://stackoverflow.com/q/22425501
has comment: http://stackoverflow.com/comment/34122090

http://stackoverflow.com/comment/34066141
has text: If you arc is not too curved, you can try to draw a line that joins the 2 extremities and the draw the isoscele triangle whose 3rd corner touches the arc. Then you can put your label along one of the 2 equal length sides (maybe choose the more horizontal one for easier reading)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22405396

http://stackoverflow.com/comment/34146073
type: QuestionComment
has text: Do you want to order primarily by one attribute, say courseID, and have courses with equal IDs ordered by the other attribute?
type: Comment
comment on: http://stackoverflow.com/q/22450649
score: 0

http://stackoverflow.com/q/22453919
tagged with: java
type: Question
upvote count: 0
answer count: 1
has title: Need to store data in app for sorting
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/22454009
type: UnansweredQuestion
score: -3
downvote count: 3
has body: I am working on an app which will give you all the businesses in a certain location. when the user does a search on “naperville” , the app will receive a json file with: business names, type of business, phone #, zip code the user can then do further sorting on this information, such as: give me only restraunts. what is the best approach to store this data in the app? My idea is using 3 hashmaps , example: Hashmap1: “business name” is key and “type of business” is value Hashmap2: “business name” is key and “phone #” is value Hashmap3: “business name” is key and “zip code” is value This way, I can link all the information just like in a database table.“business name” works as a primary key. because I am a new programmer, I don’t know what is the best approach… if my approach is not good, can you recommend something better ?

http://stackoverflow.com/a/22368427
has comment: http://stackoverflow.com/comment/34047030
has comment: http://stackoverflow.com/comment/34047597
type: Answer
has comment: http://stackoverflow.com/comment/34047831
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22367962
has comment: http://stackoverflow.com/comment/34047677
has comment: http://stackoverflow.com/comment/34002547
downvote count: 0
has comment: http://stackoverflow.com/comment/34047717
has body: The catch block for ParserException is actually malformed. The pipe | is usually used to catch several different exceptions in the same block (because you would handle them in the same way), and not twice the same exception: catch(ParserException | ParserException e) What happens here, is the java runtime matches the first ParserException against the import from ical4j, then looks for another ParserException to match the second one and doesn't find any.

http://stackoverflow.com/a/22392504
has comment: http://stackoverflow.com/comment/34043893
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22392379
has body: These lines Sample s = new Sample(); // Why this doesn't work? for (String string : s.getStringList()) { } do not work because you are using the raw form of the Sample class. When you use the raw form of the class, all generics in the class, even unrelated generics, have type erasure performed. That means that getStringList now just returns a List of Objects, not a List&lt;String&gt; of Strings. This part of Java was introduced with Generics in Java 1.5 so that the old version of classes that now use generics would be backwards compatible. That way, something that iterates over List, which had to use Object before, still can use Object by using the raw form of List. The JLS, Section 4.8 deals with raw types: More precisely, a raw type is defined to be one of: The reference type that is formed by taking the name of a generic type declaration without an accompanying type argument list. and The type of a constructor (§8.8), instance method (§8.4, §9.4), or non-static field (§8.3) M of a raw type C that is not inherited from its superclasses or superinterfaces is the raw type that corresponds to the erasure of its type in the generic declaration corresponding to C. (emphasis mine) The reasoning: The use of raw types is allowed only as a concession to compatibility of legacy code. The use of raw types in code written after the introduction of generics into the Java programming language is strongly discouraged. It is possible that future versions of the Java programming language will disallow the use of raw types.
answers question: http://stackoverflow.com/q/22392379
type: Answer
upvote count: 7
score: 7

http://stackoverflow.com/q/22404750
upvote count: 1
has comment: http://stackoverflow.com/comment/34064478
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/2421826
has body: public static final String paths = "/storage/" ; public ArrayList&lt;HashMap&lt;String, String&gt;&gt; getpaths(){ if (paths != null) { File x= new File(paths); File[] listFiles = x.listFiles(); if (listFiles != null &amp;&amp; listFiles.length &gt; 0) { for (File file : listFiles) { if (file.isDirectory()) { scanDirectory(file); } else { fileFilter(file); } } } } That is my function to list files from /storage. My question is: do all android phones have /storage/a/b/c ?
has comment: http://stackoverflow.com/comment/34064558
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22405373
tagged with: storage
favorite count: 0
has title: Common storage path for all Android devices
has comment: http://stackoverflow.com/comment/34063896
has comment: http://stackoverflow.com/comment/34064882
type: Question
tagged with: android
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22405373

http://stackoverflow.com/comment/33971903
has text: yes .we cant reassign ,not refernce
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22351276
type: Comment

http://stackoverflow.com/a/31957273
answers question: http://stackoverflow.com/q/22360730
upvote count: 2
type: Answer
has body: SqlServer : When SET NOCOUNT is ON, the count is not returned. When SET NOCOUNT is OFF, the count is returned. Connection conn = DriverManager.getConnection(connectDB,user,pwd); String sql = " set nocount off;INSERT INTO test (name) values (1)"; PreparedStatement prepareStatement = conn.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS); System.out.println(prepareStatement.executeUpdate()); ResultSet generatedKeys = prepareStatement.getGeneratedKeys(); if(generatedKeys.next()){ System.out.println(generatedKeys.getString(1)); } Related: set-nocount-on-usage
score: 2
downvote count: 0

http://stackoverflow.com/q/22467231
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34175998
has comment: http://stackoverflow.com/comment/34175259
score: 3
has comment: http://stackoverflow.com/comment/34175461
has comment: http://stackoverflow.com/comment/34175438
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22467411
has answer: http://stackoverflow.com/a/22484950
type: Question
answer count: 2
has title: Get length of base64 decoded data
downvote count: 0
tagged with: base64
has body: I need to calculate the length of base64 decoded data. I have Base-64 data that I am sending the unencoded data as the body of a HTTP response (typo: I meant request, but same idea). I need to send a Content-Length header. In the interest of memory usage and performance I'd rather not actually Base-64 decode the data all at once, but rather stream it. Given base64 data, how do I calculate the length of the decoded data will be? I need either a general algorithm, or a Java/Scala solution. EDIT: This is similar to, but not a duplicate of Calculate actual data size from Base64 encoded string length, where the OP asks ...can I calculate the length of the raw data that has been encoded only by looking at the length of the Base64-encoded string? The answer is no. It is necessary to look at the padding as well. I want to know how the length and the base64 data can be used to calculate the original length.
favorite count: 0
linked to: http://stackoverflow.com/q/6816137
tagged with: scala

http://stackoverflow.com/a/22375240
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34013798
type: Answer
has comment: http://stackoverflow.com/comment/34014731
has comment: http://stackoverflow.com/comment/34013550
has comment: http://stackoverflow.com/comment/34022245
accepted answer of: http://stackoverflow.com/q/22374356
answers question: http://stackoverflow.com/q/22374356
has body: Use an Async task to populate the data and in the onPostExecute method display the listview. While the list is loading you can use the empty view to show a loading animation or text. Could be anything you want, depends on the app your trying to build. Could even be a huge action button if the list is actually empty.(Like the Google Keep app) Edit : Populate data into "users" Arraylist and call the following in onPostExecute adapter.notifyDatasetChanged(); That should refresh the listview.
has comment: http://stackoverflow.com/comment/34014545

http://stackoverflow.com/comment/34077311
has text: If you add an space it must show an space. Check if you have an space there.
comment on: http://stackoverflow.com/a/22411766
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34143018
type: Comment
comment on: http://stackoverflow.com/q/22448834
type: QuestionComment
score: 2
has text: possible duplicate of [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java)

http://stackoverflow.com/comment/34051760
type: Comment
type: QuestionComment
has text: Javascript will let you do something like this. But what exactly is your aim here?
comment on: http://stackoverflow.com/q/22397393
score: 1

arraylist
tags question: http://stackoverflow.com/q/22333365
tags question: http://stackoverflow.com/q/22340989
tags question: http://stackoverflow.com/q/22448331
tags question: http://stackoverflow.com/q/22450649
tags question: http://stackoverflow.com/q/22398008
tags question: http://stackoverflow.com/q/22403573
tags question: http://stackoverflow.com/q/22432039
tags question: http://stackoverflow.com/q/22372410
tags question: http://stackoverflow.com/q/22354059
tags question: http://stackoverflow.com/q/22357869
tags question: http://stackoverflow.com/q/22427843
tags question: http://stackoverflow.com/q/22444255
tags question: http://stackoverflow.com/q/22366463
tags question: http://stackoverflow.com/q/22468498
tags question: http://stackoverflow.com/q/22443672
tags question: http://stackoverflow.com/q/22469366
tags question: http://stackoverflow.com/q/22457756
tags question: http://stackoverflow.com/q/22355116
tags question: http://stackoverflow.com/q/22339900
tags question: http://stackoverflow.com/q/22463538
tags question: http://stackoverflow.com/q/22361748
tags question: http://stackoverflow.com/q/22384662
tags question: http://stackoverflow.com/q/22421316
tags question: http://stackoverflow.com/q/22446594
tags question: http://stackoverflow.com/q/22366454
tags question: http://stackoverflow.com/q/22383520
tags question: http://stackoverflow.com/q/22457950
tags question: http://stackoverflow.com/q/22423302
tags question: http://stackoverflow.com/q/22402516
tags question: http://stackoverflow.com/q/22393477
tags question: http://stackoverflow.com/q/22359561
tags question: http://stackoverflow.com/q/22377335
tags question: http://stackoverflow.com/q/22386513
tags question: http://stackoverflow.com/q/22429971
tags question: http://stackoverflow.com/q/22418408
tags question: http://stackoverflow.com/q/22377038
tags question: http://stackoverflow.com/q/22469387
tags question: http://stackoverflow.com/q/22368963
tags question: http://stackoverflow.com/q/22446435
tags question: http://stackoverflow.com/q/22346320
tags question: http://stackoverflow.com/q/22360886
tags question: http://stackoverflow.com/q/22385040
tags question: http://stackoverflow.com/q/22435945
tags question: http://stackoverflow.com/q/22409679
tags question: http://stackoverflow.com/q/22392135
tags question: http://stackoverflow.com/q/22343798
tags question: http://stackoverflow.com/q/22449967
tags question: http://stackoverflow.com/q/22381099
tags question: http://stackoverflow.com/q/22407154
tags question: http://stackoverflow.com/q/22474702
tags question: http://stackoverflow.com/q/22388828
tags question: http://stackoverflow.com/q/22468421
tags question: http://stackoverflow.com/q/22403939
tags question: http://stackoverflow.com/q/22433085
tags question: http://stackoverflow.com/q/22418524
tags question: http://stackoverflow.com/q/22427661
tags question: http://stackoverflow.com/q/22331085
tags question: http://stackoverflow.com/q/22398281
tags question: http://stackoverflow.com/q/22453436
tags question: http://stackoverflow.com/q/22486590
tags question: http://stackoverflow.com/q/22365669
tags question: http://stackoverflow.com/q/22414361
tags question: http://stackoverflow.com/q/22439087
tags question: http://stackoverflow.com/q/22446120
tags question: http://stackoverflow.com/q/22340439
tags question: http://stackoverflow.com/q/22469208
tags question: http://stackoverflow.com/q/22394503
tags question: http://stackoverflow.com/q/22398119
tags question: http://stackoverflow.com/q/22360011
tags question: http://stackoverflow.com/q/22340826
tags question: http://stackoverflow.com/q/22370032
tags question: http://stackoverflow.com/q/22357803
tags question: http://stackoverflow.com/q/22419678
tags question: http://stackoverflow.com/q/22483233
tags question: http://stackoverflow.com/q/22457761
tags question: http://stackoverflow.com/q/22335544
tags question: http://stackoverflow.com/q/22368321
tags question: http://stackoverflow.com/q/22420345
tags question: http://stackoverflow.com/q/22427891
tags question: http://stackoverflow.com/q/22344611

http://stackoverflow.com/comment/34047145
comment on: http://stackoverflow.com/q/22394144
score: 0
type: Comment
type: QuestionComment
has text: @TejaswiRana XML, easier than JSON? The JSON RFC (RFC 7159) is 12 pages long (reference links included) and describes JSON fully

http://stackoverflow.com/a/59828870
downvote count: 0
score: 4
type: Answer
has body: Your problem is not clear since Writing/reading from properties files is something already available in java. To write to properties file you can use the Properties class as you mentioned : Properties properties = new Properties(); try(OutputStream outputStream = new FileOutputStream(PROPERTIES_FILE_PATH)){ properties.setProperty("prop1", "Value1"); properties.setProperty("prop2", "Value2"); properties.store(outputStream, null); } catch (IOException e) { e.printStackTrace(); } Source and more examples here
answers question: http://stackoverflow.com/q/22370051
upvote count: 4

http://stackoverflow.com/a/68177636
answers question: http://stackoverflow.com/q/22397496
has body: Short and simple solution! int[] result = new int[charArray.length]; Arrays.setAll(result, i -&gt; Character.getNumericValue(charArray[i]));
score: 0
type: Answer

http://stackoverflow.com/a/22696911
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22464181
has body: At some point, you need to call super.dispatchTouchEvent(). If you don't, events will never get dispatched to other views. Looks like instead of "return true;" at the end this should be "return super.dispatchTouchEvent(event);".
accepted answer of: http://stackoverflow.com/q/22464181
type: AcceptedAnswer

http://stackoverflow.com/comment/34189061
type: QuestionComment
comment on: http://stackoverflow.com/q/22475703
has text: run() is a method, the str value belongs to an instance of SyncPipe. If you have reference to an instance of SyncPipe, you can just use public getter
score: 0
type: Comment

http://stackoverflow.com/a/22440598
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22440567
upvote count: 1
has body: As stated in the comments, try-catch -blocks don't loop. Use a for or while if you want looping.
downvote count: 1
has comment: http://stackoverflow.com/comment/34128196

http://stackoverflow.com/a/22478647
accepted answer of: http://stackoverflow.com/q/22478614
answers question: http://stackoverflow.com/q/22478614
type: AcceptedAnswer
upvote count: 6
type: Answer
has body: == does work with long values.
downvote count: 0
score: 6

http://stackoverflow.com/comment/33983182
has text: What is that function trying to do, what should it be doing, what are you seeing instead? SIMPLIFY!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22357491

http://stackoverflow.com/comment/34184120
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22472292
type: Comment
has text: @Gk. Already doing that. My updates in other tables are working.

http://stackoverflow.com/a/45888455
type: Answer
has body: Decrease Height And Width of the Image . This will solve problem . You can see image too large error generated by logcat also
answers question: http://stackoverflow.com/q/22434070
score: 0

http://stackoverflow.com/q/22377097
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/30527503
favorite count: 0
tagged with: tf-idf
type: UnansweredQuestion
score: 2
tagged with: java
type: Question
has title: Tfidf calculation and matrix storage in java
has comment: http://stackoverflow.com/comment/38058211
has body: I have a corpus of txt files where i want to calculate their Tfidf values. I think I have to tokenize the files into words as a first step and then calculate the weight. The output I need of this program is a matrix where the rows will be the files and the columns will be the words and the remaning matrix cells will be the Tfidf values. I am stuck in the matrix part. Here is my try import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class DocumentParser { //This variable will hold all terms of each document in an array. private List&lt;String[]&gt; termsDocsArray = new ArrayList&lt;String[]&gt;(); private List&lt;String&gt; allTerms = new ArrayList&lt;String&gt;(); //to hold all terms private List&lt;double[]&gt; tfidfDocsVector = new ArrayList&lt;double[]&gt;(); private List fileNameList = new ArrayList(); private File[] allfiles; private StringBuilder sb; private BufferedReader in = null; /** * Method to read files and store in array. * @param filePath : source file path * @throws FileNotFoundException * @throws IOException */ public void parseFiles(String filePath) throws FileNotFoundException, IOException { allfiles = new File(filePath).listFiles(); for (File f : allfiles) { if (f.getName().endsWith(".txt")) { fileNameList.add(f.getName()); in = new BufferedReader(new FileReader(f)); sb = new StringBuilder(); String s = null; while ((s = in.readLine()) != null) { sb.append(s); } String[] tokenizedTerms = sb.toString().replaceAll("[\\W&amp;&amp;[^\\s]]", "").split("\\W+"); //to get individual terms for (String term : tokenizedTerms) { if (!allTerms.contains(term)) { //avoid duplicate entry allTerms.add(term); } } termsDocsArray.add(tokenizedTerms); } } } /** * Method to create termVector according to its tfidf score. * @return */ public double tfIdfCalculator(String file, String word) { double tf; //term frequency …
upvote count: 2
tagged with: matrix

http://stackoverflow.com/a/22340861
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33954455
has comment: http://stackoverflow.com/comment/33954250
has comment: http://stackoverflow.com/comment/33955128
accepted answer of: http://stackoverflow.com/q/22340683
has comment: http://stackoverflow.com/comment/33953919
answers question: http://stackoverflow.com/q/22340683
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33954163
type: Answer
has comment: http://stackoverflow.com/comment/33954101
has body: The stacktrace contains "The filename, directory name, or volume label syntax is incorrect" suggesting there are special characters in the name. It looks like you are putting " quotation marks around the name. Enter the file to read from:"studentdata.txt" You would use quotation marks if the filename was a Java string in the source code, but when inputting text via the console, these are not required.

http://stackoverflow.com/comment/34028707
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22384053
type: Comment
has text: Given the calls of `System.out.println` I would worry about the validity of the reported durations. It may be better to gather the text into some sort of string-builder and print that after the `end = System.nanoTime();`.

http://stackoverflow.com/comment/34178430
score: 0
has text: I know because the database is displayed on the device I'm using, I'll insert the code that displays the database
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22466171

http://stackoverflow.com/comment/106392790
has text: My guess is that each instance of WebRequest is creating it's own connection. I don't really see a method to cause it to re-use the connection. Typically I use HttpClient instead and create only one instance per base url. See https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/ for more infor on this.
comment on: http://stackoverflow.com/q/22340335
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22475256
score: 1
type: UnansweredQuestion
tagged with: owasp
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/24640729
has answer: http://stackoverflow.com/a/32654489
type: Question
answer count: 2
tagged with: fortify
downvote count: 0
has title: Often Misused: Authentication - Fortify
favorite count: 0
tagged with: xss
has body: when i do scan using fortify i have got 5 vulnerabilities like "Often Misused: Authentication" at the below code. For this do we have any fix to avoid this issue. this.localAddress = InetAddress.getLocalHost().toString(); When we call the .getLocalHost() fortify complaining as an issue.

http://stackoverflow.com/q/22392083
has comment: http://stackoverflow.com/comment/34043092
has comment: http://stackoverflow.com/comment/34043091
has comment: http://stackoverflow.com/comment/34043090
favorite count: 0
accepted answer: http://stackoverflow.com/a/22392389
has title: How does "this" in work in Java when calling a method?
has comment: http://stackoverflow.com/comment/34043010
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22392330
downvote count: 0
has comment: http://stackoverflow.com/comment/34043136
has comment: http://stackoverflow.com/comment/34042859
has answer: http://stackoverflow.com/a/22392389
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34043009
answer count: 2
has body: How does this.C() work exactly? method C is non-static so it has to be called via an instance. this refers to the current object but what object and how is it created? I didn't explicitly create an object so does compiling implicitly creates one behind the scene?... public class MainActivity extends Activity { public static final String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.C(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if(id ==R.id.action_search){ this.openSearch(); } else if (id == R.id.action_settings) { // openSettings(); } return super.onOptionsItemSelected(item); } public void sendMessage(View view){ Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.edit_message); String message= editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } public void C(){ } public void openSearch(){ getActionBar().hide(); } }
has comment: http://stackoverflow.com/comment/34042901
possible better answer: http://stackoverflow.com/a/22392330
has comment: http://stackoverflow.com/comment/34043138
has comment: http://stackoverflow.com/comment/34043200
tagged with: android

http://stackoverflow.com/a/22393535
answers question: http://stackoverflow.com/q/22393476
downvote count: 0
has comment: http://stackoverflow.com/comment/34045492
score: 1
has body: You don't need the equal sign = in your SQL query insert into users(NOMBRE, PASSWORD, EMAIL, NEWSLETTER) values=(?,?,?,?) Just write this instead insert into users(NOMBRE, PASSWORD, EMAIL, NEWSLETTER) values(?,?,?,?)
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34045540
type: Answer
accepted answer of: http://stackoverflow.com/q/22393476

http://stackoverflow.com/comment/34139367
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22446452
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/49859/discussion-between-raghunandan-and-akshay2000)
score: 0

http://stackoverflow.com/comment/34035586
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22387797
type: AnswerComment
has text: @Someone: It does, you just don't realize it

http://stackoverflow.com/q/22460824
upvote count: 5
has body: Background: As usual we have various life cycles like dev. stage, lt, prod all these are picked at deploy time from environment variable ${lifecycle}. So JNDI setting we stores in ${lifecycle}.properties as variable datasource.jndi.name=jdbc/xxx. As other beans are also using this properties file, it is verified that such variable is loaded & file is in classpath, but somehow I am not able to consume this variable in log4j2.xml in below JDBC Appender. <DataSource jndiName="${sys:datasource.jndi.name}" /> <Column name="event_date" isUnicode="false" isEventTimestamp="true" /> <Column name="log_level" isUnicode="false" pattern="%level" /> <Column name="logger" isUnicode="false" pattern="%logger" /> <Column name="message" isUnicode="false" pattern="%message" /> <Column name="exception_msg" isUnicode="false" pattern="%ex{full}" /> I have tried some option like "${datasource.jndi.name}" too, or is there any way I can fit the solution in get datasource.jndi.name from {lifecycle}.properties
accepted answer: http://stackoverflow.com/a/22472396
possible better answer: http://stackoverflow.com/a/22462076
answer count: 2
tagged with: jdbc
downvote count: 0
has comment: http://stackoverflow.com/comment/35452164
has answer: http://stackoverflow.com/a/22472396
tagged with: log4j
favorite count: 0
tagged with: log4j2
tagged with: logging
has title: log4j2 how to read property variable from file into log4j2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22462076
tagged with: java
type: Question
score: 5
has comment: http://stackoverflow.com/comment/34166248

http://stackoverflow.com/comment/34205110
type: Comment
comment on: http://stackoverflow.com/a/22472888
score: 0
type: AnswerComment
has text: Removing `root = ...` from the predicate did not help. I've edited my question to reflect the changes when I remove `root = ...` from the predicate. I'm actually trying to build a "find greatest id" query. I'm only interested in the greatest `id`. The `findOne(...)` in the `CrudRepository` failed (understandably) when there was more than 1 result filtered by the predicate. To be honest, I'm not entirely sure what the best way to do this is; I'm new to SpringData and still trying to learn how to use it properly.

http://stackoverflow.com/comment/34131935
comment on: http://stackoverflow.com/a/22442235
has text: maybe it would be more beneficial for me if i just worry about that once i get the terrain generation completed. im doing voxels and im thinking about perlin noise so im going to wip up a new thread thx;
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34176038
type: QuestionComment
comment on: http://stackoverflow.com/q/22467645
has text: Have you tried private Map<String, Class<T>> typeMap = new HashMap<>()?
score: 0
type: Comment

http://stackoverflow.com/q/22377335
has answer: http://stackoverflow.com/a/22377405
possible better answer: http://stackoverflow.com/a/22377535
has answer: http://stackoverflow.com/a/60656423
type: Question
answer count: 6
has answer: http://stackoverflow.com/a/22377568
tagged with: arraylist
upvote count: 1
has answer: http://stackoverflow.com/a/22377512
has answer: http://stackoverflow.com/a/22377535
favorite count: 0
has answer: http://stackoverflow.com/a/22377390
accepted answer: http://stackoverflow.com/a/22377390
has body: I am doing a simple Java program and I need to remove all of the contiguous duplicates in a String ArrayList. My String ArrayList is something like this: list = [a,b,c,c,d,a,b,c,d] My goal is removing all (and only!) the contiguous duplicates so that the result would be: [a,b,c,d,a,b,c,d]. As you can see, one of the two contiguous "c" has been removed. I tried something like this: for (int i = 0; i&lt;list.size(); i++) { if (list.get(i).compareTo(list.get(i+1))==0) { positionToRemove.add(i); } } Where positionToRemove will at the end contain all the position of the contiguous elements which I will then remove using list.remove() (still not done) Unfortunately I get java.lang.IndexOutOfBoundsException I am quite positive there is a very simple way to achieve this but I can't remember it at the moment!
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: Removing contiguous duplicates in ArrayList [Java]

http://stackoverflow.com/comment/34187061
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22474050
has text: so now there is an access denied exception.
score: 0

http://stackoverflow.com/a/22422362
downvote count: 0
has comment: http://stackoverflow.com/comment/34095524
has comment: http://stackoverflow.com/comment/34095578
has comment: http://stackoverflow.com/comment/34095397
has comment: http://stackoverflow.com/comment/34095445
has comment: http://stackoverflow.com/comment/34095466
type: Answer
score: 1
has body: A TreeMap sorts the elements by their key, if courseDate is part of the values, you'd have to use a TreeSet, e.g. import java.util.Set; import java.util.TreeSet; public class Example { public static void main(String[] args) { Set&lt;Dummy&gt; example = new TreeSet&lt;&gt;(); example.add( new Dummy(7, "first dummy")); example.add( new Dummy(2, "second dummy")); example.add( new Dummy(3, "third dummy")); System.out.println(example); } static class Dummy implements Comparable&lt;Dummy&gt;{ int courseDate; String name; Dummy(int courseDate, String name) { this.courseDate = courseDate; this.name = name; } @Override public String toString() { return String.format("[Dummy courseDate=%s, name=%s]", courseDate, name); } @Override public int compareTo(Dummy o) { // here you specify how the TreeSet will order your elements return Integer.compare(this.courseDate, o.courseDate); } } }
upvote count: 1
answers question: http://stackoverflow.com/q/22422185

http://stackoverflow.com/a/22431226
has comment: http://stackoverflow.com/comment/34111865
type: Answer
answers question: http://stackoverflow.com/q/22431214
has body: It's a typo: gridBagConstraints constraints; should be GridBagConstraints constraints; (capital G). Good luck!
has comment: http://stackoverflow.com/comment/34111367
score: 0
has comment: http://stackoverflow.com/comment/34111378

http://stackoverflow.com/q/22482170
favorite count: 0
has comment: http://stackoverflow.com/comment/34201332
has body: I'm using to upload a list of files. This works fine as is, but I want the ability to remove individual files before upload, so I'm storing the FileList in a separate object and routing it through xhr. However, it doesn't work. The form looks like this: <form:form commandName="documentsBean" enctype="multipart/form-data"> Attach </form:form> Here's the function that handles it (working version): function buildForm(form){ var formData = new FormData(form); formData.append('testString', "foobar"); var xhr = new XMLHttpRequest(); xhr.open('POST', form.action, true); xhr.send(formData); return false; } And the non-working version, where I try to stick the files into the formData manually: function buildForm(form){ var files = document.getElementById('attachFiles').files; // var tempfiles = []; // for(var i=0; i<files.length; i++){ // tempfiles[i]=files[i]; // } var formData = new FormData(); formData.append('submittedFormAction', "attachDocumentSave"); formData.append('files', files); // still broken with formData.append('files', tempfiles); formData.append('testString', "foobar"); var xhr = new XMLHttpRequest(); xhr.open('POST', form.action, true); xhr.send(formData); return false; } The bean: public class DocumentsBean { private List<MultipartFile> files = Arrays.asList(); private String testString = ""; public List<MultipartFile> getFiles(){ return files; } public void setFiles(List<MultipartFile> files){ this.files = files; } public String getTestString(){ return testString; } public void setTestString(String testString){ this.testString = testString; } } And the controller: @RequestMapping( method = RequestMethod.POST, params = { "submittedFormAction=attachDocumentSave" }) public ModelAndView attachDocumentSave(HttpServletRequest request, @ModelAttribute("documentsBean") DocumentsBean documentsBean, BindingResult errors) throws Exception { // Drilling into documentsBean here with the working version shows: // // files= LinkedList<E> (id=78) // first= LinkedList$Nod…
has comment: http://stackoverflow.com/comment/34200530
has answer: http://stackoverflow.com/a/22484423
tagged with: http://stackoverflow.com/tag/html
tagged with: xmlhttprequest
has comment: http://stackoverflow.com/comment/34204261
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: How do I send an array of files using xhr2 and FormData? (Java + Spring)
type: Question
accepted answer: http://stackoverflow.com/a/22484423
has comment: http://stackoverflow.com/comment/34201621
tagged with: javascript
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34148084
score: 0
comment on: http://stackoverflow.com/q/22451846
type: QuestionComment
type: Comment
has text: I think more code is needed here; in particular the code where you set the proxy to use etc

http://stackoverflow.com/comment/34125969
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22439030
type: Comment
has text: Propably yes :D Thank you one more time :)

http://stackoverflow.com/comment/33999444
has text: One thing I noticed now is: "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}", in my build.gradle dependencies. Could that conflict?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22341252
score: 0

http://stackoverflow.com/comment/34011520
has text: super() is a special use of the super keyword where you call a parameterless parent constructor. In general, the super keyword can be used to call overridden methods, access hidden fields or invoke a superclass's constructor.
comment on: http://stackoverflow.com/q/22374323
score: 0
type: Comment
type: QuestionComment

generics
tags question: http://stackoverflow.com/q/22451226
tags question: http://stackoverflow.com/q/22442700
tags question: http://stackoverflow.com/q/22392379
tags question: http://stackoverflow.com/q/22453727
tags question: http://stackoverflow.com/q/22340090
tags question: http://stackoverflow.com/q/22357190
tags question: http://stackoverflow.com/q/22455381
tags question: http://stackoverflow.com/q/22339348
tags question: http://stackoverflow.com/q/22391964
tags question: http://stackoverflow.com/q/22461019
tags question: http://stackoverflow.com/q/22438557
tags question: http://stackoverflow.com/q/22458904
tags question: http://stackoverflow.com/q/22356417
tags question: http://stackoverflow.com/q/22332656
tags question: http://stackoverflow.com/q/22358292
tags question: http://stackoverflow.com/q/22343975
tags question: http://stackoverflow.com/q/22406135
tags question: http://stackoverflow.com/q/22336205
tags question: http://stackoverflow.com/q/22399355
tags question: http://stackoverflow.com/q/22467645
tags question: http://stackoverflow.com/q/22384054
tags question: http://stackoverflow.com/q/22382705
tags question: http://stackoverflow.com/q/22464738
tags question: http://stackoverflow.com/q/22359772
tags question: http://stackoverflow.com/q/22476370
type: Tag
tags question: http://stackoverflow.com/q/22343723
tags question: http://stackoverflow.com/q/22332293
tags question: http://stackoverflow.com/q/22382738
tags question: http://stackoverflow.com/q/22403151
tags question: http://stackoverflow.com/q/22399458
tags question: http://stackoverflow.com/q/22456684
tags question: http://stackoverflow.com/q/22459357
tags question: http://stackoverflow.com/q/22334967
tags question: http://stackoverflow.com/q/22355432
tags question: http://stackoverflow.com/q/22421023
tags question: http://stackoverflow.com/q/22367870
tags question: http://stackoverflow.com/q/22422564
tags question: http://stackoverflow.com/q/22439972
tags question: http://stackoverflow.com/q/22385322
tags question: http://stackoverflow.com/q/22332435
tags question: http://stackoverflow.com/q/22436944
tags question: http://stackoverflow.com/q/22457900
tags question: http://stackoverflow.com/q/22439585
tags question: http://stackoverflow.com/q/22428879
tags question: http://stackoverflow.com/q/22426047
tags question: http://stackoverflow.com/q/22362815
tags question: http://stackoverflow.com/q/22438417
tags question: http://stackoverflow.com/q/22431364
tags question: http://stackoverflow.com/q/22340383
tags question: http://stackoverflow.com/q/22430965
tags question: http://stackoverflow.com/q/22437870
tag name: generics
tags question: http://stackoverflow.com/q/22481010
tags question: http://stackoverflow.com/q/22390732
tags question: http://stackoverflow.com/q/22467362
tags question: http://stackoverflow.com/q/22433904
tags question: http://stackoverflow.com/q/22412248

http://stackoverflow.com/a/22379170
has comment: http://stackoverflow.com/comment/34019802
score: 2
downvote count: 0
has body: Have a look at Rob Camick's WrapLayout. Example use import java.awt.*; import javax.swing.*; public class TestWrapLayout { public TestWrapLayout () { ImageIcon icon = new ImageIcon(getClass().getResource("/resources/stackoverflow2.png")); JPanel panel = new JPanel(new WrapLayout()); for (int i = 1; i &lt;= 250; i++) { JLabel iconlabel = new JLabel(icon); iconlabel.setLayout(new BorderLayout()); JLabel textlabel = new JLabel(String.valueOf(i)); textlabel.setHorizontalAlignment(JLabel.CENTER); textlabel.setForeground(Color.WHITE); textlabel.setFont(new Font("impact", Font.PLAIN,20)); iconlabel.add(textlabel); panel.add(iconlabel); } JFrame frame = new JFrame(); frame.add(new JScrollPane(panel)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run() { new TestWrapLayout(); } }); } }
has comment: http://stackoverflow.com/comment/34019726
upvote count: 2
answers question: http://stackoverflow.com/q/22378509
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22378509
type: Answer

jpa-2.0
tags question: http://stackoverflow.com/q/22366795
tags question: http://stackoverflow.com/q/22455989
type: Tag
tags question: http://stackoverflow.com/q/22459233
tag name: jpa-2.0

http://stackoverflow.com/q/22331821
tagged with: junit4
score: 0
has answer: http://stackoverflow.com/a/22494259
has body: I have 3 tests defined in 3 different classes Class 1 @Test 1 Class 2 @Test 2 Class 3 @Test 3 I have created another class 'Class Browsers' in which I am creating different browser drivers Now I want to call @Test1,2 &amp; 3 from the browsers class so that these tests are executed in different browsers Is the following right approach? Class Browsers { public static Class1 A =new Class1() public static Class2 B =new Class2() public static Class3 C =new Class3() @Test public void createCromeDriver(){ A.Test1 B.Test2 C.Test3 } @Test public void createIEDriver(){ A.Test1 B.Test2 C.Test3 } } (In the above scenario I am calling tests which belongs to other classes into another class having its own tests.)
answer count: 1
type: UnansweredQuestion
has title: Running tests in different browsers
has comment: http://stackoverflow.com/comment/33937936
tagged with: selenium-webdriver
tagged with: java
type: Question

http://stackoverflow.com/comment/33963237
type: QuestionComment
comment on: http://stackoverflow.com/q/22345444
score: 0
has text: Hi, what dies this mean? custom deserializer?
type: Comment

http://stackoverflow.com/q/22452272
possible better answer: http://stackoverflow.com/a/22452627
type: Question
has answer: http://stackoverflow.com/a/22453844
linked to: http://stackoverflow.com/q/2567416
has body: I have generated an xml file from an excel data base and it contains automatically an element called "offset". To make my new file match my needs, I want to remove this element using java. here is the xml content: 2 Baseline <domain_id>2</domain_id> desctiption value1 value2 value3 value4 value5 <offset/> I made a code that reads(with a buffered reader) and writes the content in a new file and used the condition if: while (fileContent !=null){ fileContent=xmlReader.readLine(); if (!(fileContent.equals("<offset/>"))){ System.out.println("here is the line:"+ fileContent); XMLFile+=fileContent; } } But it does not work
has comment: http://stackoverflow.com/comment/34153652
has answer: http://stackoverflow.com/a/22452628
upvote count: 1
has answer: http://stackoverflow.com/a/22453083
has answer: http://stackoverflow.com/a/22452627
accepted answer: http://stackoverflow.com/a/22452570
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/22452570
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: remove elements from XML file in java

http://stackoverflow.com/q/22348613
possible better answer: http://stackoverflow.com/a/22348963
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22349300
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22348963
answer count: 2
has body: I'm quite new to programming so I don't know the right way to do things and have been just experimenting a bit. I want to create a runnable where I can move back and forth between different content. The following works when run from inside eclipse, but if I export it as a JAR file, once I've moved forward once and then back again, moving forward won't give me the content anymore, but just the back button. I tried something like this: public class TestMain extends JFrame { static PanelClass panel; static boolean inUse = false; public static void main(String[] args) { panel = new PanelClass(); final TestMain test = new TestMain(); final Container container = test.getContentPane(); container.setLayout(new BoxLayout(container, BoxLayout.Y_AXIS)); test.setSize(500, 500); final JButton back = new JButton("Back"); back.setAlignmentX(Component.CENTER_ALIGNMENT); back.setMaximumSize(new Dimension(200, 80)); back.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { test.getContentPane().removeAll(); test.setContentPane(container); test.getContentPane().revalidate(); } }); final JButton exit = new JButton("Exit"); exit.setAlignmentX(Component.CENTER_ALIGNMENT); exit.setMaximumSize(new Dimension(200, 80)); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); JButton problem = new JButton("Problem"); problem.setMaximumSize(new Dimension(200, 80)); problem.setAlignmentX(Component.CENTER_ALIGNMENT); problem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { inUse = true; test.setContentPane(panel); test.getContentPane().add(back); test.getContentPane().revalidate(); } }); container.add(problem); container.add(exit); test.setVisible(true); test.setDefaultCloseOperation(EXIT_ON_CLOSE); test.setLocationRelativeTo(null); while (true) { while (!panel.stop &amp;&amp; !inUse) { } inUse = false; panel = new PanelClass(); test.setContentPane(panel); test.getConten…
tagged with: user-interface
downvote count: 0
tagged with: jar
favorite count: 0
accepted answer: http://stackoverflow.com/a/22349300
has title: Java moving back and forth between content in runnable Jar file

http://stackoverflow.com/comment/34132252
type: AnswerComment
has text: This doesn't compile.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22442593

http://stackoverflow.com/comment/34194147
has text: why do you think `==` does not work comparing long values?
score: 1
comment on: http://stackoverflow.com/q/22478614
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34203994
has text: Plus, try using single quotes instead of doubles for `("user")` and `("toadd")` and `("executing update")` @ASH
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22484048

http://stackoverflow.com/a/22434125
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22434012
has body: use ASCII value, and then take their round off e.g a to z 97 to 122 subtract with sentinel value 97 and you will get your results
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34112022
comment on: http://stackoverflow.com/a/22431665
type: Comment
score: 0
type: AnswerComment
has text: `return ( randomString .contains( pattern ) ) ? true : false;` is pretty pointless. You could just write `return randomString.contains(pattern)`. And why would you invent a new method that does nothing besides wrapping another method?

http://stackoverflow.com/comment/35876258
type: Comment
score: 2
has text: @Drew So the weirdest thing happened. Instead of trying to enable it from Servers->Add Servers I just went to Preference->Servers->Weblogic and clicked on install JPA 2.0 and it works from there. It was all Interface.
type: AnswerComment
comment on: http://stackoverflow.com/a/22426095

http://stackoverflow.com/a/22382089
upvote count: 3
score: 3
has body: Use a SimpleDateFormat - it's just one line: return new SimpleDateFormat("yyyyMMdd").format(new Date()); If you want a different format, use dd/MM/yyyy etc instead. Note that new Date() is the current date, so no need to pass a date in to your method if you want the current date. Also, avoid using Calendar class: It's a bit broken.
downvote count: 0
answers question: http://stackoverflow.com/q/22381930
type: Answer

http://stackoverflow.com/q/22365385
has comment: http://stackoverflow.com/comment/33997136
answer count: 5
has body: I'm trying to make a simple program that will display 20 random numbers between 1 and 100 and then print out which numbers are divisible by 3 and equivalent to 1%3 and 2%3. It seems to work just fine but I've noticed it only works with the very last number in the list. What am I missing to include all the numbers in the search for my math? Thank you in advance for any help I can get! import java.util.Random; public class Lab5 { public static void main(String[] args) { Random rnd = new Random(); int repeat = 19; int n = 0; for(int i=0;i&lt;=repeat;i++){ n = rnd.nextInt(100)+1; System.out.print(n+", "); } System.out.println(); System.out.println("-------------------------------------"); if(n % 3 == 0){ System.out.println("Numbers divisible by three: "+n+(", ")); }else{ System.out.println("Numbers divisible by three: NONE"); } System.out.println("-------------------------------------"); if(n == 1 % 3){ System.out.println("Numbers equivalent to one modulo three: "+n+(", ")); }else{ System.out.println("Numbers equivalent to one modulo three: NONE"); } System.out.println("-------------------------------------"); if(n == 2 % 3){ System.out.println("Numbers equivalent to two modulo three: "+n+(", ")); }else{ System.out.println("Numbers equivalent to two modulo three: NONE"); } } }
has answer: http://stackoverflow.com/a/22365428
has answer: http://stackoverflow.com/a/22365427
type: UnansweredQuestion
tagged with: division
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/33997166
tagged with: random
tagged with: for-loop
has answer: http://stackoverflow.com/a/22365508
tagged with: modulo
has title: Need help using random numbers and modulos
has answer: http://stackoverflow.com/a/22365422
has answer: http://stackoverflow.com/a/22365575

lang
tags question: http://stackoverflow.com/q/22330203
tag name: lang
type: Tag

http://stackoverflow.com/q/22458123
downvote count: 1
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34158654
has comment: http://stackoverflow.com/comment/37157934
has comment: http://stackoverflow.com/comment/34158903
has comment: http://stackoverflow.com/comment/34159076
has comment: http://stackoverflow.com/comment/34159080
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22458972
has comment: http://stackoverflow.com/comment/34158689
linked to: http://stackoverflow.com/q/4231382
linked to: http://stackoverflow.com/q/1732348
tagged with: http://stackoverflow.com/tag/html
tagged with: regex
has title: regular expression to extract text surrounding anchor tag from html page
has body: Is there a way to extract text surrounding anchor tags in an html page? I am working in java and my research needs me to extract data in and around tags. I have tried searching and all I've found is regular expressions to extract only the anchor text and not the words around it.
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34158688

http://stackoverflow.com/comment/33982889
has text: Application context is always an in stance of Application.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22357642

http://stackoverflow.com/q/22425975
favorite count: 0
has body: Is it possible to write a program in java that allows you to type something like "Can you go to google?" and then have the program open your default webbrowser and go to google?
score: -2
accepted answer: http://stackoverflow.com/a/22426034
has comment: http://stackoverflow.com/comment/34101618
tagged with: user-input
has comment: http://stackoverflow.com/comment/34101621
downvote count: 2
type: AnsweredQuestion
tagged with: java
tagged with: httprequest
type: Question
has answer: http://stackoverflow.com/a/22426034
answer count: 2
has title: Java user input to website
linked to: http://stackoverflow.com/q/5226212
upvote count: 0
possible better answer: http://stackoverflow.com/a/22426038
has answer: http://stackoverflow.com/a/22426038

http://stackoverflow.com/q/22401696
answer count: 3
tagged with: jvm
has title: Why JVM uses heap for objects and static variables and Stack for local variables and function call?
has comment: http://stackoverflow.com/comment/34058956
tagged with: memory-management
has answer: http://stackoverflow.com/a/22401856
possible better answer: http://stackoverflow.com/a/22401847
has answer: http://stackoverflow.com/a/22401847
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22401829
score: 0
tagged with: java
has body: As we know JVM stores Class objects, Static variables to heap memory location and Local variables and calls to methods to stack. Why so? why can't we use a single memory type to store everything? What is the need of having two type of memory location, Any advantage?
tagged with: memory
has comment: http://stackoverflow.com/comment/34059217
type: Question
has comment: http://stackoverflow.com/comment/34059420
has comment: http://stackoverflow.com/comment/34058919
accepted answer: http://stackoverflow.com/a/22401829

http://stackoverflow.com/q/22442123
tagged with: war
has title: Failed to load main class while executing war
tagged with: java
has comment: http://stackoverflow.com/comment/34132964
type: Question
upvote count: 4
answer count: 2
has body: I build my project using maven and generated a *.war file with the following content structure: META-INF - maven -- net.avedo.spozz --- Spozz-Webservice ---- pom.properties ---- pom.xml - MANIFEST.MF WEB-INF - classes -- net --- avedo ---- spozz ----- Spozz.class ----- models ------ ... ----- services ------ ... -- psql-custom.properties - lib -- ... - web.xml If I now try to run the generated war file using java -jar spozz.war, I get the following error: Error: Could not find or load main class net.avedo.spozz.Spozz What did I wrong? Please find the Manifest file and the definition of the maven-war-plugin in the pom.xml below. MANIFEST.MF Manifest-Version: 1.0 Built-By: awilhelm Build-Jdk: 1.7.0_51 Class-Path: javax.servlet-api-3.1.0.jar jetty-webapp-9.1.3.v20140225.j ar jetty-xml-9.1.3.v20140225.jar jetty-servlet-9.1.3.v20140225.jar je tty-security-9.1.3.v20140225.jar jetty-server-9.1.3.v20140225.jar jet ty-servlets-9.1.3.v20140225.jar jetty-continuation-9.1.3.v20140225.ja r jetty-http-9.1.3.v20140225.jar jetty-io-9.1.3.v20140225.jar jetty-j sp-9.1.3.v20140225.jar jetty-schemas-3.1.M0.jar javax.servlet.jsp-api -2.3.1.jar javax.servlet.jsp-2.3.2.jar javax.servlet.jsp.jstl-1.2.0.v 201105211821.jar javax.servlet.jsp.jstl-1.2.2.jar javax.el-3.0.0.jar org.eclipse.jdt.core-3.8.2.v20130121.jar jetty-util-9.1.3.v20140225.j ar jettison-1.3.5.jar stax-api-1.0.1.jar resteasy-jaxrs-3.0.6.Final.j ar scannotation-1.0.3.jar javassist-3.12.1.GA.jar jboss-annotations-a pi_1.1_spec-1.0.1.Final.jar activation-1.1.jar jcip-annotations-1.0.j ar resteasy-client-3.0.6.Final.jar async-http-servlet-3.0-3.0.6.Final .jar jaxrs-api-3.0.6.Final.jar resteasy-servlet-initializer-3.0.6.Fin al.jar log4j-1.2.17.jar slf4j-api-1.7.6.jar slf4j-log4j12-1.7.6.jar c ommons-io-2.4.jar ormlite-jdbc-4.48.jar ormlite-core-4.48.jar Created-By: Apache Maven 3.2.1 Main-Class: net.avedo.spozz.Spozz Archiver-Version: Plexus Archiver Extract from pom.xml org.apache.maven.plugins maven-war-plugin ${maven.war.plugi…
downvote count: 0
tagged with: jar
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/34132812
has answer: http://stackoverflow.com/a/22446811
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/22448256

http://stackoverflow.com/a/22463203
downvote count: 0
has comment: http://stackoverflow.com/comment/34171579
type: Answer
upvote count: 13
has body: This might not be the complete answer, as I'm struggling with this a bit myself. I'm using a custom authentication provider and a custom user details service. I see the same behavior as you -- breakpoints get hit in my user details service, but not in my authentication provider. Here is what my entire config class looks like: @Configuration @EnableWebMvcSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private CustomUserDetailsService userDetailsService; @Autowired private CustomAuthenticationProvider customAuthenticationProvider; @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userDetailsService); } @Override protected void configure(HttpSecurity http) throws Exception { AuthenticationProvider rememberMeAuthenticationProvider = rememberMeAuthenticationProvider(); TokenBasedRememberMeServices tokenBasedRememberMeServices = tokenBasedRememberMeServices(); List&lt;AuthenticationProvider&gt; authenticationProviders = new ArrayList&lt;AuthenticationProvider&gt;(2); authenticationProviders.add(rememberMeAuthenticationProvider); authenticationProviders.add(customAuthenticationProvider); AuthenticationManager authenticationManager = authenticationManager(authenticationProviders); http .csrf().disable() .headers().disable() .addFilter(new RememberMeAuthenticationFilter(authenticationManager, tokenBasedRememberMeServices)) .rememberMe().rememberMeServices(tokenBasedRememberMeServices) .and() .authorizeRequests() .antMatchers("/js/**", "/css/**", "/img/**", "/login", "/processLogin").permitAll() .antMatchers("/index.jsp", "/index.html", "/index").hasRole("USER") .antMatchers("/admin", "/admin.html", "/admin.jsp", "/js/saic/jswe/admin/**").hasRole("ADMIN") .and() .formLogin().loginProcessingUrl("/processLogin").loginPage("/login").usernameParameter("username").passwordParameter("password").permitAll() .and() .exceptionHand…
has comment: http://stackoverflow.com/comment/128049378
has comment: http://stackoverflow.com/comment/34557018
score: 13
has comment: http://stackoverflow.com/comment/128049311
has comment: http://stackoverflow.com/comment/34171484
answers question: http://stackoverflow.com/q/22453550
accepted answer of: http://stackoverflow.com/q/22453550
type: AcceptedAnswer

http://stackoverflow.com/comment/34017798
comment on: http://stackoverflow.com/a/22378288
score: 0
type: Comment
type: AnswerComment
has text: @StijnGeukens, yes we also have year limits in our life, but conceptually `Biginteger` has no limit. Yes I agree with your comment, but in this case it is not such actual.

http://stackoverflow.com/comment/34033122
type: AnswerComment
comment on: http://stackoverflow.com/a/22385982
type: Comment
score: 0
has text: @AmitJoki -- From debuggex

http://stackoverflow.com/comment/34133634
comment on: http://stackoverflow.com/q/22443449
score: 1
type: QuestionComment
has text: getAuthor() returns a string and not an Author object.
type: Comment

http://stackoverflow.com/a/60501904
answers question: http://stackoverflow.com/q/22441076
score: 4
type: Answer
has body: I changed the version of MySql like, From 5.1.8 mysql mysql-connector-java 5.1.8 To 8.0.19 mysql mysql-connector-java 8.0.19 It works for me. Thank you.
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/22369184
type: Question
tagged with: sonarqube
has answer: http://stackoverflow.com/a/22392432
score: 0
has comment: http://stackoverflow.com/comment/34003504
has title: major minor exception with sonar
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34003672
has body: I am running an application in jre and jdk 1.4. But when I try to analyse my code through sonar qube it shows the following exception in cmd Exception in thread "main" java.lang.UnsupportedClassVersionError: org/so ner/Main (Unsupported major.minor version 50.0) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.3) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) I think it might be due to the jnm and jre version. But I am not sure and I don't know how to change it.
tagged with: java

http://stackoverflow.com/a/22440710
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34128405
accepted answer of: http://stackoverflow.com/q/22440632
type: Answer
answers question: http://stackoverflow.com/q/22440632
has body: A quick fix: Consider setting your JTextFields's column property. For instance, if you use: ascii = new JTextField("", 5); your ascii JTextField now gets some preferred size width. A better long-term fix: Study, learn and use the layout managers to better advantage. Note that a problem with JApplets is that the size is specified by the HTML code and not by the layout managers (as far as I understand things), and so you must take care to make sure that the GUI's are sized big enough. e.g., with layouts, I got this:
has comment: http://stackoverflow.com/comment/34128622
upvote count: 4
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/34128740

http://stackoverflow.com/comment/34146720
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22451117
has text: @mig-25foxbat there is no exception or error I get..

http://stackoverflow.com/comment/34132253
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22442700
has text: @AdamArold: No, I want to create a `Map` whose key type will be the same as the field which is annotated with `@Identifier` and value type the same as the class which has the annotated field.

http://stackoverflow.com/q/22349450
answer count: 0
tagged with: scala
tagged with: java
has comment: http://stackoverflow.com/comment/34009226
has comment: http://stackoverflow.com/comment/33992773
has comment: http://stackoverflow.com/comment/34003700
has title: Error while running openIE using scala
type: Question
score: 0
has body: i am running openIE in scala. while running sbt run i got error. can any body explain? Set current project to openie (in build file:/home/user_name/Videos/openie-master/) [info] Running edu.knowitall.openie.OpenIECli [error] Exception in thread "main" java.lang.NoSuchFieldError: MODULE$ [error] at scala.util.PropertiesTrait$class.scalaPropOrNone(Properties.scala:65) [error] at scala.util.Properties$.scalaPropOrNone(Properties.scala:16) [error] at scala.util.PropertiesTrait$class.$init$(Properties.scala:77) [error] at scala.util.Properties$.&lt;init&gt;(Properties.scala:16) [error] at scala.util.Properties$.&lt;clinit&gt;(Properties.scala) [error] at scala.compat.Platform$.&lt;init&gt;(Platform.scala:112) [error] at scala.compat.Platform$.&lt;clinit&gt;(Platform.scala) [error] at scala.App$class.$init$(App.scala:42) [error] at edu.knowitall.openie.OpenIECli$.&lt;init&gt;(OpenIECli.scala:29) [error] at edu.knowitall.openie.OpenIECli$.&lt;clinit&gt;(OpenIECli.scala) [error] at edu.knowitall.openie.OpenIECli.main(OpenIECli.scala)
type: UnansweredQuestion

http://stackoverflow.com/comment/34088499
comment on: http://stackoverflow.com/q/22418230
has text: We can't see your parent class, but read into **field hiding**.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34180229
comment on: http://stackoverflow.com/q/22469499
score: 0
type: Comment
type: QuestionComment
has text: see [this][1] may be help in your code..... [1]: http://stackoverflow.com/questions/13672487/how-do-i-call-a-specific-preferencefragment-from-a-preferenceactivity

http://stackoverflow.com/comment/34219799
type: Comment
type: QuestionComment
has text: yep, all the needed dependencies are included in my pom
comment on: http://stackoverflow.com/q/22482251
score: 0

http://stackoverflow.com/q/22388978
possible better answer: http://stackoverflow.com/a/22412927
score: 1
favorite count: 0
has body: I am just beginning with dagger and came across some issues with singleton objects. So the Singleton looks like this:- @Module( injects = {MainActivity.class,SecondActivity.class} ) public class MySingle { //just to count the number of instances of the class public static int thecount=0; //the constructor public MySingle(){ Log.v("testing","created"); thecount++; } @Singleton @Provides public MySingle getSingle(){ return new MySingle(); } } The Application class where the object graph is created :- public class MyApplication extends Application { private ObjectGraph objectGraph; @Override public void onCreate(){ super.onCreate(); objectGraph=ObjectGraph.create(new MySingle()); } public ObjectGraph getObjectGraph(){ return objectGraph; } } The MainActivity.class:- public class MainActivity extends ActionBarActivity { @Inject MySingle mysingle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // MyApplication app=(MyApplication)getApplication(); // app.getObjectGraph().inject(this); Log.v("testing", mysingle.thecount + " mainact"); } } So whenever I run this, the number of instances of the singleton "MySingle" is 1 , which is fine. However when i uncomment these lines:- MyApplication app=(MyApplication)getApplication(); app.getObjectGraph().inject(this); I get the number of instances as 2. I understand from herethat Dagger creates a singleton for every object graph , but from what I understand by using the above 2 lines, I am injecting MainActivity.class into the existing object graph, obviously the use of which is not apparent to me as of now.. i am just experimenting with it.
accepted answer: http://stackoverflow.com/a/22488166
tagged with: android
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34137577
tagged with: java
has title: Object Graphs and Singletons in Dagger
tagged with: dagger
type: Question
has comment: http://stackoverflow.com/comment/34135403
answer count: 2
linked to: http://stackoverflow.com/q/17447531
tagged with: dependency-injection
has answer: http://stackoverflow.com/a/22488166
downvote count: 0
has answer: http://stackoverflow.com/a/22412927

http://stackoverflow.com/q/22468700
tagged with: android-studio
has comment: http://stackoverflow.com/comment/34218940
has comment: http://stackoverflow.com/comment/103796755
has comment: http://stackoverflow.com/comment/34219138
has comment: http://stackoverflow.com/comment/34180730
accepted answer: http://stackoverflow.com/a/26940654
has comment: http://stackoverflow.com/comment/34178842
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34223629
possible better answer: http://stackoverflow.com/a/22485662
has comment: http://stackoverflow.com/comment/34180194
tagged with: java
has answer: http://stackoverflow.com/a/22485662
upvote count: 18
tagged with: google-play-services
type: Question
has body: I have a trouble trying use a Google Play Services on my Android App using Android Studio. I've tried everything and still doesn't work. This is the error. Execution failed for task ':app:dexDebug'. com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Users/jghg/Desktop/My App/Android/SDK/android-sdk-mac_86/build-tools/19.0.1/dx --dex --output /Users/jghg/Desktop/My App/Eureka/UDA/app/build/libs/app-debug.dex /Users/jghg/Desktop/My App/Eureka/UDA/app/build/classes/debug /Users/jghg/Desktop/My App/Eureka/UDA/app/build/dependency-cache/debug /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/classes-08979151dd1373bd3f799299d93376d22d4afa46.jar /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/classes-167b9d3c5d689abe004c3fa5b0bcb945d3f0fc8e.jar /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/google-play-services-ec20f8af7bb457c5095cae1afa0cee722582f198.jar /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/support-v4-13.0.0-473d85b8d55c88bfed3404072e6c132f96543429.jar /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/support-v4-19.0.1-861cc05365a0e9262c764da37d61e3f93dc16de6.jar /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/support-v4-19.0.1-dcc11377c764caea791f711123b8b678f876c3b6.jar /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/twitter4j-async-3.0.5-0904cb320186fb23a9a9bf25a048c5bc4ec07bc2.jar /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/twitter4j-core-3.0.5-41d2d5805e2d90cf77813a126306c4cbe22583ae.jar /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/twitter4j-examples-3.0.5-adc1ee9b037c8061429560e6a5fe89ce8e502db6.jar /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/twitter4j-media-support-3.0.5-37d138cdc631738d13ddb6f4d34c560a9cd8e048.jar /Users/jghg/Desktop/My App/Eureka/UDA/app/build/pre-dexed/debug/twitter4j-stream-3.0.5-c96c138ea216b25631a1a8b47520ecaf33f288d8.jar Error Code: 2 Outp…
has answer: http://stackoverflow.com/a/32660542
linked to: http://stackoverflow.com/q/46562289
downvote count: 0
score: 18
favorite count: 0
has answer: http://stackoverflow.com/a/26940654
answer count: 3
tagged with: android
has title: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define

http://stackoverflow.com/a/22394385
has comment: http://stackoverflow.com/comment/34055068
type: Answer
has body: For history you need to keep two arrays, one for keeping last transaction type (deposit, withdrawal) that changed the balance and another for the amount of the transaction. And tha array size could be constrained by a upper limit as well (say 10). So, that means at most 10 history items you would remember. Then you need to manage the chronology (sequence) of history items within that bounded set.
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/22394301
has comment: http://stackoverflow.com/comment/34046962
upvote count: 0
has comment: http://stackoverflow.com/comment/34055243

http://stackoverflow.com/q/22332614
possible better answer: http://stackoverflow.com/a/22332959
has answer: http://stackoverflow.com/a/22332959
type: Question
linked to: http://stackoverflow.com/q/22313598
tagged with: arraylist
answer count: 2
has answer: http://stackoverflow.com/a/22773044
downvote count: 0
has title: Multi-dimensional array list java
favorite count: 0
has comment: http://stackoverflow.com/comment/33939806
upvote count: 2
has body: I'm trying to do an multi-dimensional ArrayList, so I've come up with the method of doing: int NumberInColumns = (int) Math.floor(listAnswers.size() / NUMBER_OF_COLUMNS); // make higher number of answers on the right if (listAnswers.size() % NUMBER_OF_COLUMNS &gt; 0) NumberInColumns++; ArrayList&lt;HolderAnswer&gt; listAnswers = getAnswers(); ArrayList&lt;ArrayList&lt;HolderAnswer&gt;&gt; listAnswersSorted = new ArrayList&lt;ArrayList&lt;HolderAnswer&gt;&gt;(); int k=0; for (HolderAnswer answer : listAnswers) { ArrayList&lt;HolderAnswer&gt; temp = new ArrayList&lt;HolderAnswer&gt;(); temp.add(answer); if (k % NumberInColumns == 0 ) { listAnswersSorted.add(temp); } else { if (k == listAnswers.size()) { listAnswersSorted.add(temp); } } k++; } The problem I'm having is that with an ArrayList.size() of 7, I'm only getting the first and fifth records when I try and get the information out of the array. What am I missing?
has comment: http://stackoverflow.com/comment/33939461
tagged with: android
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/22773044
tagged with: java

http://stackoverflow.com/a/22403324
downvote count: 0
has body: To get a list of users on your mySQL database, try using: SELECT User FROM mysql.user;
type: Answer
answers question: http://stackoverflow.com/q/22403083
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34061429

http://stackoverflow.com/q/22481140
upvote count: 1
has comment: http://stackoverflow.com/comment/34198764
has answer: http://stackoverflow.com/a/22481723
has answer: http://stackoverflow.com/a/22481799
favorite count: 0
has body: I have 2 classes (BusinessAccount and Projects (shown below) that are mapped to a MySql database) where a 1:M relationship exists between BusinessAccounts and Projects. I am successfully inserting data to the database but am having a problem when it comes to querying the database. The problem that I am having is that I have no getter or setter for the foreign key, 'contractor_id' in the Projects class. The query that I want to carry out is to return the list of the names of all projects for a given BusinessAccount, by searching by the foreign key reference in the Projects table. I can do this no problem in mySQL but as there is no reference to the contractor_id as a java entity in the Projects class, I'm not sure how to do this search from within my java class. (Note: I tried to declare the foreign key along with getters and setters in the Projects class but as I have these mapped by the 1:Many relationship in the class already, it wouldn't compile as they were flagged as duplicate entities.) I'm sure it's something obvious that I'm missing but any help is much appreciated! public List&lt;Projects&gt; getProjectList() { factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME); EntityManager em = factory.createEntityManager(); List&lt;Projects&gt; projectList = new ArrayList&lt;Projects&gt;(); em.getTransaction().begin(); String sessionEmail=Util.getEmail(); Query myQuery = em.createQuery("SELECT u FROM BusinessAccount u WHERE u.email=:email"); myQuery.setParameter("email", sessionEmail); List&lt;BusinessAccount&gt; userList=myQuery.getResultList(); BusinessAccount account =userList.get(0); Query myQuery2 = em.createQuery("SELECT distinct p.* FROM BusinessAccount u " + "INNER JOIN Projects p ON p.contractor_id=:userID"); /*Note p.contractor_id above refers to the entity in the mysql database (and won't work obviously), I want to refer to it's java equivalent but am not sure how to do that*/ myQuery2.setParameter("userID", account.getId()); projectList=…
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
possible better answer: http://stackoverflow.com/a/22481799
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22481723
tagged with: jpa
has title: How to search mySql database table by foreign key using JPA?
tagged with: eclipselink

http://stackoverflow.com/q/22334983
tagged with: tableview
accepted answer: http://stackoverflow.com/a/22335276
linked to: http://stackoverflow.com/q/42856471
type: AnsweredQuestion
score: 3
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25050806
answer count: 2
has title: Java FX: TableView - display simple HTML
has answer: http://stackoverflow.com/a/22335276
has body: I'd like to know, if it is possible to render simple HTML tags in JavaFX TableView (b, i, subscript, supscript). In my code snippet I used default cellValueFactory, but maybe someone could tell me if exists any cell factory which allow me to display html. From code: class Data{ private String row = " Sample data" public String getRow(){ return row; } TableView<Data> tableView = new TableView(); TableColumn<Data,String> column = new TableColumn("Sample Column"); column.setCellValueFactory(new PropertyValueFactory<Data, String>("row")); tableView.getColumns().addAll(column); I wish I could see Sample Data in my table in bold. Thanks in advance! --UPDATE Code that allows me to see my HTML, but resizes table cell, WebView size is ignored and not wrapped tight private class HTMLCell extends TableCell<Component, Component> { @Override protected void updateItem(Component item, boolean empty) { super.updateItem(item, empty); if (!empty) { WebView webView = new WebView(); webView.setMaxWidth(200); webView.setMaxHeight(50); WebEngine engine = webView.getEngine(); // setGraphic(new Label("Test")); setGraphic(webView); String formula = item.getFormula(); engine.loadContent(formula); } } } TableColumn<Component, Component> formulaColumn = new TableColumn<>("Formula"); formulaColumn.setMinWidth(300); formulaColumn.setCellFactory(new Callback<TableColumn<Component, Component>, TableCell<Component, Component>>() { @Override public TableCell<Component, Component> call(TableColumn<Component, Component> param) { return new HTMLCell(); } }); formulaColumn.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Component, Component>, ObservableValue<Component>>() { @Override public ObservableValue<Component> call(CellDataFeatures<Component, Component> param) { return new SimpleObjectProperty<Component>(param.getValue()); } });
possible better answer: http://stackoverflow.com/a/25050806
upvote count: 3
tagged with: java
tagged with: javafx

http://stackoverflow.com/comment/33934582
has text: @mKorbel Why should it be HIDE or NOTHING? Disposal of the frame is what I want to happen when I close. If I do implement a WindowListener in my JFrame class I would call setVisible(false) but I am trying to avoid doing that. If I implement a WindowListener in my custom component it does not seem a good idea to manage the JFrame from there.
comment on: http://stackoverflow.com/q/22329253
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22457293
tagged with: java
has title: how to configure log4j to ignore hierarchy loggers
type: Question
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22463934
has body: I have a log4j configuration file with two loggers and two especific appenders. The file looks how is show below: log4j.rootLogger=DEBUG, CONSOLE Logger to be used with Logger.getLogger(Class) method log4j.logger.foo.bar=ALL, LOGFILE Logger to be used with Logger.getLogger(String) method log4j.logger.foo.bar.dummy.pack.XML=ERROR, LOGERRORXML log4j.appender.LOGERRORXML=org.apache.log4j.RollingFileAppender log4j.appender.LOGERRORXML.append=true log4j.appender.LOGERRORXML.encoding=UTF-8 log4j.appender.LOGERRORXML.file=Log_Error.log log4j.appender.LOGERRORXML.MaxFileSize=52428800 log4j.appender.LOGERRORXML.MaxBackupIndex=10 log4j.appender.LOGERRORXML.layout=org.apache.log4j.PatternLayout log4j.appender.LOGERRORXML.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n log4j.appender.LOGERRORXML.Threshold=ERROR log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender log4j.appender.LOGFILE.append=true log4j.appender.LOGFILE.encoding=UTF-8 log4j.appender.LOGFILE.file=Main_Logger.log log4j.appender.LOGFILE.MaxFileSize=52428800 log4j.appender.LOGFILE.MaxBackupIndex=10 log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n log4j.appender.LOGFILE.Threshold=ERROR And the class look like this package foo.bar.dummy.pack; public class Foo { private static final Logger LOG = Logger.getLogger(Foo.class); private static final Logger LOG_XML = Logger.getLogger(Foo.class.getPackage().getName()+".XML"); } public static void main(String[] args) { LOG.error("Hello "); LOG_XML.error("World!"); } The result of this is: Main_Logger.log [ignore log4j pattern layout] Hello [ignore log4j pattern layout] World! Log_Error.log [ignore log4j pattern layout] World! My idea is just logging the events that i want in separated files but when i call the logger LOGERRORXML the output is in both files, i mean in the file declared for LOGERRORXML appender and LOGFILE appender even when i'm using the LOGERRORXML logger. I think …
tagged with: log4j
favorite count: 0
upvote count: 1
tagged with: logging
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22463934
score: 1

http://stackoverflow.com/comment/34138078
type: Comment
has text: Yeah, for this you would need a `Stack` of `Character`s, for example: `Stack<Character> stack = new Stack<Character>()`, you can then add to the stack with standard stack operations, such as `stack.push(str.charAt(0))` and `stack.pop()`
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22445762

http://stackoverflow.com/a/22391306
type: Answer
downvote count: 0
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22391205
has body: The problem is that your for loop is using your initialize empty ArrayList as the size. Change your loop to this: for (int i = 0; i &lt; numberlist.length; i++) { // your loop logic here } Hope that helps!

http://stackoverflow.com/comment/33947347
comment on: http://stackoverflow.com/q/22337085
type: Comment
type: QuestionComment
score: 0
has text: Frankly, I wouldn't worry about "unnecessary overhead in production code" from doing the check all the time -- null checks are going to be so fast that it really shouldn't make a difference.

java.util.scanner
tags question: http://stackoverflow.com/q/22416769
tags question: http://stackoverflow.com/q/22352703
tags question: http://stackoverflow.com/q/22440339
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/22340738
tags question: http://stackoverflow.com/q/22367836
tags question: http://stackoverflow.com/q/22345244
type: Tag
tags question: http://stackoverflow.com/q/22377432
tags question: http://stackoverflow.com/q/22397693
tags question: http://stackoverflow.com/q/22366014
tags question: http://stackoverflow.com/q/22415053
tags question: http://stackoverflow.com/q/22458575
tags question: http://stackoverflow.com/q/22346306
tags question: http://stackoverflow.com/q/22440362
tags question: http://stackoverflow.com/q/22422258
tags question: http://stackoverflow.com/q/22416585
tags question: http://stackoverflow.com/q/22432620
tags question: http://stackoverflow.com/q/22469792
tags question: http://stackoverflow.com/q/22458353
tags question: http://stackoverflow.com/q/22393560
tags question: http://stackoverflow.com/q/22482870

http://stackoverflow.com/comment/34127575
has text: @JasonC this source file may have two extra lines if it has a package declaration and a extra blank line.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22440231
type: Comment

android
tags question: http://stackoverflow.com/q/22469284
tags question: http://stackoverflow.com/q/22385961
tags question: http://stackoverflow.com/q/22413429
tags question: http://stackoverflow.com/q/22441227
tags question: http://stackoverflow.com/q/22443466
tags question: http://stackoverflow.com/q/22347651
tags question: http://stackoverflow.com/q/22439087
tags question: http://stackoverflow.com/q/22386497
tags question: http://stackoverflow.com/q/22364054
tags question: http://stackoverflow.com/q/22340574
tags question: http://stackoverflow.com/q/22398686
tags question: http://stackoverflow.com/q/22430455
tags question: http://stackoverflow.com/q/22449540
tags question: http://stackoverflow.com/q/22362825
tags question: http://stackoverflow.com/q/22471741
tags question: http://stackoverflow.com/q/22387181
tags question: http://stackoverflow.com/q/22409936
tags question: http://stackoverflow.com/q/22439470
tags question: http://stackoverflow.com/q/22480727
tags question: http://stackoverflow.com/q/22424149
tags question: http://stackoverflow.com/q/22466506
tags question: http://stackoverflow.com/q/22364957
tags question: http://stackoverflow.com/q/22368002
tags question: http://stackoverflow.com/q/22386822
tags question: http://stackoverflow.com/q/22427021
tags question: http://stackoverflow.com/q/22381282
tags question: http://stackoverflow.com/q/22338522
tags question: http://stackoverflow.com/q/22385005
tags question: http://stackoverflow.com/q/22389933
tags question: http://stackoverflow.com/q/22486960
tags question: http://stackoverflow.com/q/22437545
tags question: http://stackoverflow.com/q/22433753
tags question: http://stackoverflow.com/q/22423589
tags question: http://stackoverflow.com/q/22461375
tags question: http://stackoverflow.com/q/22398290
tags question: http://stackoverflow.com/q/22358002
tags question: http://stackoverflow.com/q/22402058
tags question: http://stackoverflow.com/q/22341873
tags question: http://stackoverflow.com/q/22479759
tags question: http://stackoverflow.com/q/22423992
tags question: http://stackoverflow.com/q/22411247
tags question: http://stackoverflow.com/q/22425310
tags question: http://stackoverflow.com/q/22436574
tags question: http://stackoverflow.com/q/22411270
tags question: http://stackoverflow.com/q/22465925
tags question: http://stackoverflow.com/q/22348848
tags question: http://stackoverflow.com/q/22328862
tags question: http://stackoverflow.com/q/22344191
tags question: http://stackoverflow.com/q/22421648
tags question: http://stackoverflow.com/q/22400057
tags question: http://stackoverflow.com/q/22404398
tags question: http://stackoverflow.com/q/22415036
tags question: http://stackoverflow.com/q/22368021
tags question: http://stackoverflow.com/q/22355523
tags question: http://stackoverflow.com/q/22352100
tags question: http://stackoverflow.com/q/22435670
tags question: http://stackoverflow.com/q/22451920
tags question: http://stackoverflow.com/q/22452961
tags question: http://stackoverflow.com/q/22425786
tags question: http://stackoverflow.com/q/22446452
tags question: http://stackoverflow.com/q/22407742
tags question: http://stackoverflow.com/q/22472774
tags question: http://stackoverflow.com/q/22414912
tags question: http://stackoverflow.com/q/22432021
tags question: http://stackoverflow.com/q/22334453
tags question: http://stackoverflow.com/q/22429268
tags question: http://stackoverflow.com/q/22455734
tags question: http://stackoverflow.com/q/22468700
tags question: http://stackoverflow.com/q/22473744
tags question: http://stackoverflow.com/q/22423987
tags question: http://stackoverflow.com/q/22478752
tags question: http://stackoverflow.com/q/22461663
tags question: http://stackoverflow.com/q/22440155
tags question: http://stackoverflow.com/q/22338321
tags question: http://stackoverflow.com/q/22475637
tags question: http://stackoverflow.com/q/22482783
tags question: http://stackoverflow.com/q/22425479
tags question: http://stackoverflow.com/q/22478614
tags question: http://stackoverflow.com/q/22393341
tags question: http://stackoverflow.com/q/22475670

http://stackoverflow.com/q/22485041
tagged with: http://stackoverflow.com/tag/csv
answer count: 7
has answer: http://stackoverflow.com/a/67266361
tagged with: parsing
type: UnansweredQuestion
has body: In my application I use a lot of CSV files which I have to read and build a lists based on them. I'd like to discover an easy way to do this. Do you know any easy framework which does it without using number of config files etc? For instance, I have got a class Person: public class Person { String name; String surname; double shoeSize; boolean sex; // true: male, false:female public Person() { } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public double getShoeSize() { return shoeSize; } public void setShoeSize(double shoeSize) { this.shoeSize = shoeSize; } public boolean isSe) { return sex; } public void setSeboolean sex) { this.sex = sex; } } For this class, I have prepared CSV file: name,surname,shoesize,sex Tom,Tommy,32,true Anna,Anny,27,false How can I do it easily?
has answer: http://stackoverflow.com/a/22546038
tagged with: filereader
downvote count: 1
upvote count: 16
type: Question
linked to: http://stackoverflow.com/q/101100
has answer: http://stackoverflow.com/a/22540988
tagged with: java
score: 15
has answer: http://stackoverflow.com/a/22552186
has title: How to easily process CSV file to List<MyClass>
has answer: http://stackoverflow.com/a/22485178
has comment: http://stackoverflow.com/comment/34205521
has comment: http://stackoverflow.com/comment/34304465
has answer: http://stackoverflow.com/a/22541306
has answer: http://stackoverflow.com/a/22542269
favorite count: 0

http://stackoverflow.com/comment/33939534
comment on: http://stackoverflow.com/a/22332645
score: 0
type: Comment
has text: What a pity. I'm writing a heterogeneous type-safe container and want to add support for generics.
type: AnswerComment

http://stackoverflow.com/a/22450942
type: Answer
has body: Hard coded constants have far less processor overhead than Datastore queries and also use less memory. The memory overhead of Datastore access classes and objects will exceed that of a fairly large number of hard coded constants. The only possible advantage that Datastore may have, in an extreme case, is slightly less memory usage when you need only a small subset of lots of data. A list of countries is not that extreme. The best choice will depend on specific details of your situation. Rather than speculate, measure and compare.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22450690
upvote count: 1

http://stackoverflow.com/q/22453190
tagged with: sendmessage
answer count: 2
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/22453392
has body: I'm trying to send a message from my app using as SMS content the content of a editText. I tryed in this way so far: Uri uri = Uri.parse("smsto:0800000123"); Intent it = new Intent(Intent.ACTION_SENDTO, uri); String content = edit.getText().toString(); it.putExtra("sms_body", content); startActivity(it); but when the activity starts there is no content in the message.. isn't possible do something like that?
has comment: http://stackoverflow.com/comment/34150272
has answer: http://stackoverflow.com/a/22453796
tagged with: android-edittext
has title: Send message using content of a editText
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/34119489
type: Comment
has text: Note that the preference of widening over varargs is desired in cases where you are overloading varargs methods with fixed-args-methods for performance.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22435951

http://stackoverflow.com/q/22337318
has comment: http://stackoverflow.com/comment/33948143
has answer: http://stackoverflow.com/a/22337454
has comment: http://stackoverflow.com/comment/33947518
answer count: 2
tagged with: random
possible better answer: http://stackoverflow.com/a/22337454
accepted answer: http://stackoverflow.com/a/22337516
favorite count: 0
has comment: http://stackoverflow.com/comment/33947655
linked to: http://stackoverflow.com/q/738629
has comment: http://stackoverflow.com/comment/33947482
has body: /** * @return random damage from monster * @param monster of class Monster */ public int getRandomDamage(Monster monster) { int min = monster.getMinDamage(); //this is set to 20 for monsters int max = monster.getMaxDamage(); //this is set to 30 for monsters return randomGenerator.nextInt(max - min + 1) + min; } This return statement don't work, since it always returns the integer 20. Any tip for solving, it should return a random number between 20(int min) and 30(int max). Thx for any help. After some problem solving turned out that getMaxDamage(); returned 20 and not 30, runs good now, thou stupid typing error.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33947638
has comment: http://stackoverflow.com/comment/33947476
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/33947548
downvote count: 1
linked to: http://stackoverflow.com/q/363681
has title: Returning random number between two integers - always the same value
type: Question
has answer: http://stackoverflow.com/a/22337516
tagged with: java

http://stackoverflow.com/a/25322812
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22458265
has body: In my own project I've superseded NetBeans error handler to my own. My example: @ServiceProvider(service = Handler.class, supersedes = "org.netbeans.core.NbErrorManager") public class MyHandler extends Handler { @Override public void publish(LogRecord record) { if (record.getThrown() != null) { record.getThrown(); // do with it something } } @Override public void flush() { } @Override public void close() throws SecurityException { } } See also org.netbeans.core.NbErrorManager and org.netbeans.core.NotifyExcPanel to know how NetBeans uses default handler. You only need to add this class in your project.

http://stackoverflow.com/q/22380555
has answer: http://stackoverflow.com/a/22381289
tagged with: java
tagged with: mysql
tagged with: formatting
tagged with: swing
has comment: http://stackoverflow.com/comment/34024115
has answer: http://stackoverflow.com/a/22381111
accepted answer: http://stackoverflow.com/a/22381111
type: Question
has body: So instead of printing the result of a query into the Jlabel when i click another "show hint" label, the query statement itself is being printed into the jLabel private void jLabel7MouseClicked(java.awt.event.MouseEvent evt) { try { Class.forName("com.mysql.jdbc.Driver"); Connection CC = DriverManager.getConnection( "jdbc:mysql://localhost:3306/pulsedb", "root", "passtheword"); String query = "SELECT hint FROM mstufflogin WHERE username = 'tapiwa'"; PreparedStatement PS = CC.prepareStatement(query); PS.executeQuery(query); jLabel6.setText("HINT: " + query); } output on the label will be.... SELECT hint FROM mstufflogin WHERE username = 'tapiwa'
score: 0
answer count: 2
has title: I'm trying to print an mysql query result into a jLabel
tagged with: jlabel
has comment: http://stackoverflow.com/comment/34022588
possible better answer: http://stackoverflow.com/a/22381289
type: AnsweredQuestion

http://stackoverflow.com/comment/103115544
type: Comment
comment on: http://stackoverflow.com/a/22367824
score: 0
type: AnswerComment
has text: Hey my friend can you tell me this? What is this "user" anyway? I am using Spring Security and my users (username) are email addresses. When each user logs in he gets his JWT token on Spring Security.

http://stackoverflow.com/q/22393823
has body: I have issues installing Developer tools, Google plugin for eclipse[req], GWT Designer for GPE and SDK from ...gle.com/eclipse/plugin/4.3. I have installed Kepler SR2. I have tried updating the software within Eclipse and also through downloading locally. How can I get GWT installation? Are GWT under Window-builder and Google Web toolkit same? Actually, I want a GUI editor for web application. What should I do?
has title: Kepler Eclipse and WindowBuilder GWT
tagged with: java
tagged with: swt
type: Question
tagged with: gwt
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22394177
tagged with: toolkit
has answer: http://stackoverflow.com/a/23482738
type: UnansweredQuestion

http://stackoverflow.com/comment/34177888
type: Comment
comment on: http://stackoverflow.com/a/22462454
score: 2
has text: @Bruno I corrected your 2nd bullet point, please check. NB If he sets `wantClientAuth` or `needClientAuth` before he does any I/O he hasn't done the handshake yet anyway so he doesn't need to invalidate anything.
type: AnswerComment

http://stackoverflow.com/q/22338833
has body: I am currently in the process of making a brainstorm idea and mockup phase in my latest project. I am done with the UI design and the general cloudy thingy idea how all should work. Now i want to start the UML structure planing, and i am stuck on a problem, which is. Find a tool which is as good for code abstraction as Sprax Enterprise Architect, but one which is made for PHP development and easy to use. EA is great, but TOO much clunky and documentation based, and the damn thing always thinks Java is the end of all things and creates a new object always in Java and not PHP format. So my question is: Is there a UML modeling tool which supports UML modeling and PHP code IMPORT/EXPORT??? And which is not so clunky as SPRAX?
answer count: 1
has title: UML code engineering for PHP - is it possible?
has answer: http://stackoverflow.com/a/22349181
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33976374
tagged with: php
has comment: http://stackoverflow.com/comment/33977198
tagged with: java
tagged with: uml
has comment: http://stackoverflow.com/comment/33968122
type: Question
has comment: http://stackoverflow.com/comment/33977890
score: 0

http://stackoverflow.com/q/22360721
tagged with: db2
favorite count: 0
upvote count: 3
answer count: 3
tagged with: jdbc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22760107
tagged with: clob
downvote count: 0
has answer: http://stackoverflow.com/a/22760107
has answer: http://stackoverflow.com/a/22361176
accepted answer: http://stackoverflow.com/a/22361176
has answer: http://stackoverflow.com/a/47595423
type: Question
score: 3
has title: com.ibm.db2.jcc.am.SqlException: [jcc][10120][11936][4.14.88] Invalid operation: Lob is closed. ERRORCODE=-4470, SQLSTATE=null
has body: In our application we are having a simple POJO class that has a Clob attribute within it. I am having issue in getting the String representation of that Clob entity. Say I have already queried and cached the result in the POJO object, now I am trying to get the String value of the Clob as below. int aLength = (int)myPojo.getClobField().length(); String aStringValue = myPojo.getClobField().getSubString(1L, aLength); But the above execution gives me the error, com.ibm.db2.jcc.am.SqlException: [jcc][10120][11936][4.14.88] Invalid operation: Lob is closed. ERRORCODE=-4470, SQLSTATE=null Am I missing something?
tagged with: java

http://stackoverflow.com/comment/33993409
type: Comment
type: QuestionComment
has text: if your extending a view you can use http://developer.android.com/reference/android/view/View.html#onSizeChanged(int, int, int, int) and make fractions of width and height for your drawing, im not sure if thats what your asking
comment on: http://stackoverflow.com/q/22363056
score: 0

http://stackoverflow.com/q/22358478
has body: I need to convert images (mainly JPEG) directly to PDF pages for a PDF document. It may be that the images differ in size. Each PDF page should have the exact dimensions as the images. So each page only contains the image in full resolution. How can this be achieved, that a page is set to the dimensions of the image/content? Because I saw PDF files with different page sizes and orientations but how can this be done with PDFBox?
has answer: http://stackoverflow.com/a/23409518
accepted answer: http://stackoverflow.com/a/23409518
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33985633
score: 16
linked to: http://stackoverflow.com/q/13728606
type: Question
has comment: http://stackoverflow.com/comment/33985396
has title: Java: Create PDF pages from images using PDFBox 1 library
linked to: http://stackoverflow.com/q/10466569
has comment: http://stackoverflow.com/comment/33984374
has comment: http://stackoverflow.com/comment/33984912
tagged with: pdfbox
tagged with: http://stackoverflow.com/tag/pdf
tagged with: java-7
answer count: 1
downvote count: 1
upvote count: 17
has comment: http://stackoverflow.com/comment/33985231
favorite count: 0

http://stackoverflow.com/comment/34032671
score: 0
has text: @VincentMalgrat there you go, I added the decode part as well. Sorry for the delay.
type: QuestionComment
comment on: http://stackoverflow.com/q/22385398
type: Comment

http://stackoverflow.com/a/22389061
answers question: http://stackoverflow.com/q/22388348
has comment: http://stackoverflow.com/comment/34038902
score: 0
has comment: http://stackoverflow.com/comment/34038444
has comment: http://stackoverflow.com/comment/34039375
has body: You need this library (commons-codec) in your WEB-INF/lib folder, not on your build path.
type: Answer
has comment: http://stackoverflow.com/comment/34039521

http://stackoverflow.com/a/22353700
answers question: http://stackoverflow.com/q/22352934
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Using a Set is nice, however you'll have a problem: its .toArray() will return an Integer[], not an int[] (and you cannot have a Set&lt;int&gt;). Here is a solution which still uses a set, but differently: public static int[] onlyUniqueElements(final int[] inputArray) { final Set&lt;Integer&gt; set = new HashSet&lt;&gt;(); final int[] tmp = new int[inputArray.length]; int index = 0; for (final int i: inputArray) if (set.add(i)) tmp[index++] = i; return Arrays.copyOfRange(tmp, 0, index); }

http://stackoverflow.com/a/22455373
score: 1
has comment: http://stackoverflow.com/comment/34157318
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22454954
type: Answer
has body: There are many mistakes in your code. As you showed in your stacktrace, the infinite recursion is in the getData method and not in the getNodeValue method, so you need to post the source code of the getData method. But the getNodeValue method has many bugs as well. Your first two if statements have exactly the same condition: if (node.getData().equalsIgnoreCase(symbol)) { and else if (((String) node.getData()).equalsIgnoreCase(symbol)) { the returns inside these if statements append an empty string to the result of getData(), which already returns String. Replace each of them with: return node.getData(); are just a different way of writing the same, since getData() already returns a String so casting to String again doesn't make a difference. Your next to if statements recursively call getNodeValue on leftChild and rightChild, but they never return anything, so you always end up returning null in your code once you're past the first two identical if statements in your method. You code should probably read: if (node.getLeftChild() != null) { String found = getNodeValue(node.getLeftChild(), symbol); if (found != null) { return found; } } if (node.getRightChild() != null) { String found = getNodeValue(node.getRightChild(), symbol); if (found != null) { return found; } }
upvote count: 1
answers question: http://stackoverflow.com/q/22454954
has comment: http://stackoverflow.com/comment/34157638
has comment: http://stackoverflow.com/comment/34218384
has comment: http://stackoverflow.com/comment/34157200

http://stackoverflow.com/comment/34108461
score: 1
has text: This is the standard circular-linked-list problem, and it's been solved for decades by mark-and-sweep garbage collection.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22429716

http://stackoverflow.com/a/22430862
answers question: http://stackoverflow.com/q/22430801
type: Answer
downvote count: 0
score: 1
has body: new StringBuilder("hello world").reverse().toString(); Maybe much more simpler.
upvote count: 1

http://stackoverflow.com/comment/34236009
comment on: http://stackoverflow.com/a/22486454
has text: There's a class `Context` defined inside the `Cell` interface. And because `TextCell` implements `Cell`, it inherits the nested class. The thing you want to look at is at the top of the page: _“All Implemented Interfaces: `Cell<java.lang.String>`”_
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22427091
has title: is it possible to check what the client is sending to the server using java
has comment: http://stackoverflow.com/comment/34103402
has comment: http://stackoverflow.com/comment/34103401
has comment: http://stackoverflow.com/comment/34103404
has comment: http://stackoverflow.com/comment/34103400
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22427324
type: Question
has body: I am writing a client server based java program. I have two queries I was hoping someone will be able to answer. First query, Is there a way to check what the client has sent to the server? Second query is, is there code that will allow the server to check the file they have received from the client? I have been unable to find answers to this online this is my server code package servers; import java.io.*; import java.net.*; public class Servers { public static void main(String [] args)throws Exception { try { // server variable ServerSocket server=new ServerSocket(9999); Socket client=server.accept(); BufferedReader fromClient=new BufferedReader(new InputStreamReader(client.getInputStream())); String temp=fromClient.readLine(); System.out.println(temp); System.out.println("Recieved files"); server.close(); while ((temp = fromClient.readLine()) != null) { System.out.println(temp); } } catch (Exception ex) { } } } this is my client code package client; import java.io.*; import java.net.*; public class Client{ public static void main(String [] args)throws Exception { try { File file=new File("C:\\Users\\User\\Desktop\\College 2013\\FYP\\Attribute Data\\Alex.txt"); BufferedReader br=new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { System.out.println(line); } Socket socket=new Socket("Localhost", 9999); PrintWriter toServer=new PrintWriter(socket.getOutputStream(),true); BufferedReader fromServer=new BufferedReader(new InputStreamReader(socket.getInputStream())); String toSend,rec=""; if(!file.exists()) { System.out.println("File not found terminating program."); } br.close(); toServer.println("this is the end"); System.out.println("Finished sending file."); System.out.println("Begining to receive Server output."); while (!(rec = fromServer.readLine()).equals("this is the end")) { System.out.println(rec); } toServer.close(); br.close(); socket.close(); return; } catch (Exception e) { } } } Any advice would be greatly apprec…
has answer: http://stackoverflow.com/a/22427256
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22523197
has comment: http://stackoverflow.com/comment/34103403

http://stackoverflow.com/a/22447792
type: Answer
has comment: http://stackoverflow.com/comment/34209830
has body: It looks like you are hiding the class variable 'adView' in the new code by declaring a local variable of the same name. Due to the scope, you're setting convertView to the global adView, which is always null. Just change "AdView adView =" to "adView ="
has comment: http://stackoverflow.com/comment/34157821
answers question: http://stackoverflow.com/q/22366205
has comment: http://stackoverflow.com/comment/34162809
score: 0
has comment: http://stackoverflow.com/comment/34161026
has comment: http://stackoverflow.com/comment/34214042

netbeans
tags question: http://stackoverflow.com/q/22363833
tags question: http://stackoverflow.com/q/22339973
tags question: http://stackoverflow.com/q/22374212
tags question: http://stackoverflow.com/q/22343860
tags question: http://stackoverflow.com/q/22440341
tags question: http://stackoverflow.com/q/22340768
tags question: http://stackoverflow.com/q/22426604
tags question: http://stackoverflow.com/q/22350106
tags question: http://stackoverflow.com/q/22423589
tags question: http://stackoverflow.com/q/22398851
tags question: http://stackoverflow.com/q/22349241
tags question: http://stackoverflow.com/q/22458265
tags question: http://stackoverflow.com/q/22345896
tags question: http://stackoverflow.com/q/22447425
tags question: http://stackoverflow.com/q/22331407
tags question: http://stackoverflow.com/q/22426355
tags question: http://stackoverflow.com/q/22471279
tags question: http://stackoverflow.com/q/22466623
tags question: http://stackoverflow.com/q/22437843
type: Tag
tags question: http://stackoverflow.com/q/22378513
tags question: http://stackoverflow.com/q/22420083
tags question: http://stackoverflow.com/q/22426291
tags question: http://stackoverflow.com/q/22375341
tags question: http://stackoverflow.com/q/22484078
tags question: http://stackoverflow.com/q/22376140
tags question: http://stackoverflow.com/q/22408229
tags question: http://stackoverflow.com/q/22480348
tags question: http://stackoverflow.com/q/22443098
tags question: http://stackoverflow.com/q/22448377
tags question: http://stackoverflow.com/q/22471526
tags question: http://stackoverflow.com/q/22419782
tags question: http://stackoverflow.com/q/22356743
tags question: http://stackoverflow.com/q/22334161
tags question: http://stackoverflow.com/q/22442623
tags question: http://stackoverflow.com/q/22465194
tags question: http://stackoverflow.com/q/22475350
tags question: http://stackoverflow.com/q/22459816
tags question: http://stackoverflow.com/q/22422710
tags question: http://stackoverflow.com/q/22422567
tags question: http://stackoverflow.com/q/22478443
tags question: http://stackoverflow.com/q/22361039
tags question: http://stackoverflow.com/q/22441709
tags question: http://stackoverflow.com/q/22442032
tags question: http://stackoverflow.com/q/22481748
tags question: http://stackoverflow.com/q/22422974
tags question: http://stackoverflow.com/q/22459644
tags question: http://stackoverflow.com/q/22359861
tags question: http://stackoverflow.com/q/22374817
tags question: http://stackoverflow.com/q/22463040
tags question: http://stackoverflow.com/q/22332745
tags question: http://stackoverflow.com/q/22464028
tags question: http://stackoverflow.com/q/22486299
tags question: http://stackoverflow.com/q/22374115
tags question: http://stackoverflow.com/q/22444403
tags question: http://stackoverflow.com/q/22369579
tags question: http://stackoverflow.com/q/22339586
tags question: http://stackoverflow.com/q/22434935
tag name: netbeans
tags question: http://stackoverflow.com/q/22480011
tags question: http://stackoverflow.com/q/22461596
tags question: http://stackoverflow.com/q/22340601
tags question: http://stackoverflow.com/q/22412869
tags question: http://stackoverflow.com/q/22345275
tags question: http://stackoverflow.com/q/22374343
tags question: http://stackoverflow.com/q/22411691
tags question: http://stackoverflow.com/q/22344669

http://stackoverflow.com/a/22374256
type: Answer
has comment: http://stackoverflow.com/comment/67044107
has comment: http://stackoverflow.com/comment/67407288
has body: COde: TextView textView = new TextView(this); textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); textView.setText("Test"); mainlayout.addView(textView );
answers question: http://stackoverflow.com/q/22374117
score: 0

http://stackoverflow.com/comment/34087210
has text: +1 gotta give you an upvote, since it works, but come on... let's try to find a split regex. It's a good exercise.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22417342

http://stackoverflow.com/comment/34072609
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22389785
type: Comment
has text: Then you will need to change the "if" into a "while" to catch prime factors with higher multiplicity. -- Also use `i <= n/i` in the outer loop to avoid checking for numbers that can never be prime factors. -- One could also check for factors 2 outside of the loop and then leave all other even values of i out by starting with 3 and increasing by 2.

http://stackoverflow.com/comment/34120932
score: 0
type: AnswerComment
has text: There are some problem with my internet and part of my code is edited in my question and i have #import org.opencv.video.Video
comment on: http://stackoverflow.com/a/22423016
type: Comment

http://stackoverflow.com/q/22418852
tagged with: api
has body: I am simply trying to call a method, but I'm a bit lost on how to do so with the parameters I need to use from the Bukkit API. The method I'm calling: @EventHandler private void onPlayerMove(PlayerMoveEvent event) { Player player = event.getPlayer(); Location location = loc.get(player.getName()); if (player.getLocation().distance(location) &gt;= 65) { player.sendMessage(ChatColor.AQUA + "Out of reach."); } } The method I'm calling it from: public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) { this.onPlayerMove(PlayerMoveEvent); } Any help is greatly appreciated!
answer count: 1
has answer: http://stackoverflow.com/a/22419245
accepted answer: http://stackoverflow.com/a/22419245
has comment: http://stackoverflow.com/comment/34089738
has comment: http://stackoverflow.com/comment/34089948
has title: Calling PlayerMoveEvent instance method
type: AnsweredQuestion
tagged with: java
tagged with: bukkit
has comment: http://stackoverflow.com/comment/34090092
tagged with: methods
type: Question
score: 0

http://stackoverflow.com/a/22389002
has comment: http://stackoverflow.com/comment/34041227
has comment: http://stackoverflow.com/comment/34039804
has comment: http://stackoverflow.com/comment/34044291
has comment: http://stackoverflow.com/comment/34040662
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34041039
has comment: http://stackoverflow.com/comment/34045042
has body: Here is how you would go through all the rows in the database and modify the mpg column value in the TABLE_GASLOG table. Cursor cursor = getWritableDatabase().rawQuery("select (" + gasLog.getOdometer() + " - y.odometer) / " + gasLog.getGallons() + " as mpg from gasLog x, gasLog y where y.odometer = (select max(z.odometer) from gasLog z where z.odometer &lt; " + gasLog.getOdometer() + ")", null); try { cursor.moveToFirst(); int key = 1; while (true) { mpg = cursor.getString(0); values.put(KEY_MPG, mpg); db.update(TABLE_GASLOG, values, "_id=?", new String[]{String.valueOf(key)}); if (cursor.isLast()) break; cursor.moveToNext(); key++; } } finally { cursor.close(); } db.close(); This code will basically iterate over your entire result set and then extract the mpg value in each row and insert it into your TABLE_GASLOG database. EDIT: This will add more rows to TABLE_GASLOG. From you comment, I understand that you need to update your row. In this case, instead of db.insert() method, please use: update(String table, ContentValues values, String whereClause, String[] whereArgs) your where clause will depend on whatever your condition is.
answers question: http://stackoverflow.com/q/22388088
has comment: http://stackoverflow.com/comment/34039755
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22388088
has comment: http://stackoverflow.com/comment/34045340
has comment: http://stackoverflow.com/comment/34045724
has comment: http://stackoverflow.com/comment/34040337
type: Answer

http://stackoverflow.com/comment/34038251
score: 0
has text: Thanks, how would I do that if I don't know when the thread has finished selecting an answer
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22389231

http://stackoverflow.com/q/22353944
accepted answer: http://stackoverflow.com/a/22354358
has answer: http://stackoverflow.com/a/22354426
tagged with: oop
answer count: 5
has title: How to do different things with subclasses based on subclass type with using instanceof?
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22354321
downvote count: 0
has comment: http://stackoverflow.com/comment/33976969
has answer: http://stackoverflow.com/a/22354171
has answer: http://stackoverflow.com/a/22354358
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/22353994
has body: I have an abstract class A and two subclasses B and C. In some other class I have a list of instances of A's ie: List. The list of A's could of course contain elements that could be instances of B or C. If the instance is B, I want to add it to table A which resides in Class D. If the instance is C, I want to add it to table B which also resides in Class D. Is this possible without using instanceof?
has answer: http://stackoverflow.com/a/22353994
upvote count: 2
tagged with: java

http://stackoverflow.com/q/22351680
has answer: http://stackoverflow.com/a/22352091
type: AnsweredQuestion
tagged with: java
tagged with: calendar
type: Question
accepted answer: http://stackoverflow.com/a/22352091
score: 5
upvote count: 5
has title: Weird IllegalArgumentException in Calendar.getTime()
answer count: 1
downvote count: 0
has body: This perfectly simple test fails with IllegalArgumentException("HOUR_OF_DAY 2 -> 3"), and I see no reason why. You can change any of the hours, days, months, years to any other value and the test succeeds. Fails in any of the JRE's I tested on. Seems to be an internal problem in the GregorgianCalendar implementation? Or am I missing something obvious? import java.util.Calendar; public class DateTest extends TestCase { /** test if 2011/03/27 02:30:00 converts to a valid date. * shouldn't throw any exception, however this throws * IllegalArgumentException("HOUR_OF_DAY 2 -&gt; 3) */ @Test public void testDate() { Calendar cal = Calendar.getInstance(); cal.setLenient(false); cal.clear(); cal.set(Calendar.SECOND, 00); cal.set(Calendar.MINUTE, 30); cal.set(Calendar.HOUR_OF_DAY, 02); cal.set(Calendar.DAY_OF_MONTH, 27); cal.set(Calendar.MONTH, 03 - 1); // needs to be 0-based cal.set(Calendar.YEAR, 2011); cal.getTime(); } }
favorite count: 0
has comment: http://stackoverflow.com/comment/33973070

http://stackoverflow.com/a/22391836
score: 3
has comment: http://stackoverflow.com/comment/34043102
upvote count: 3
has comment: http://stackoverflow.com/comment/34043040
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The number format shows that it's not an integer, but a double. So you should declare val as a double: double val; And use the following line to parse : val = Double.parseDouble(country[4]);
accepted answer of: http://stackoverflow.com/q/22391699
answers question: http://stackoverflow.com/q/22391699

http://stackoverflow.com/q/22402344
has title: java jna probleme Structure invalid access memory
answer count: 0
has comment: http://stackoverflow.com/comment/34067192
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34144501
type: Question
has comment: http://stackoverflow.com/comment/34164371
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/34062523
has body: Sorry for my english, i am from france. I am developing a tool in java and I use JNA to call C code I coded the function, it has the following error there: Exception in thread "main" java.lang.Error: Invalid memory access at com.sun.jna.Native.invokeInt(Native Method) at com.sun.jna.Function.invoke(Function.java:383) at com.sun.jna.Function.invoke(Function.java:315) at com.sun.jna.Library$Handler.invoke(Library.java:212) at $Proxy0.light(Unknown Source) at ApicallIn.getpar.main(getpar.java:285) I use several functions, all functions work, but one where there is a structure, this structure is coded as follows: typedef struct { double a_value; double b_value; int ctatus; } iPoint_Struct; I have to use a function that is: int light( char **light_names, int num_light, int **num_points, iPoint_Struct ***datalightlist); Java: public static class iPoint_Struct extends Structure { public iPoint_Struct() {} public iPoint_Struct(Pointer pointer){ super(pointer); read(); } public List&lt;? &gt; getFieldOrder() { return Arrays.asList("a_value", "b_value", "ctatus"); } public static class sByValue extends getpar.iPoint_Struct implements Structure.ByValue {}; public double a_value; public double b_value; public int ctatus; public static class sByReference extends getpar.iPoint_Struct implements Structure.ByReference {}; } Function: if(libe.light( String param_names, int num_params, IntByReference num_points, PointerByReference data_lists )==1){ System.out.println("Ok") } when I run the function I get the following error: Exception in thread "main" java.lang.Error: Invalid memory access at com.sun.jna.Native.invokeInt(Native Method) at com.sun.jna.Function.invoke(Function.java:383) at com.sun.jna.Function.invoke(Function.java:315) at com.sun.jna.Library$Handler.invoke(Library.java:212) at $Proxy0.light(Unknown Source) at ApicallIn.getpar.main(getpar.java:285) char** is used like this : param_names= (char ) malloc( 3000* sizeof( char * ) ); for( i = 0; i &lt; 3000; i++ ) { param_na…
downvote count: 0
score: 1
favorite count: 0
tagged with: jna
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34076057

http://stackoverflow.com/comment/34197992
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22480749
score: 1
has text: @PeterBratton The accepted answer to your possible duplicate is wrong.

http://stackoverflow.com/a/68731233
answers question: http://stackoverflow.com/q/22409102
upvote count: 1
score: 1
has body: Just use Double.compare (d1,d2). double d1 = -0.0; // or d1 = 0.0 if ( Double.compare (d1, 0.0) < 0 ) System.out.println("negative zero"); else System.out.println("positive zero");
downvote count: 0
type: Answer

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

http://stackoverflow.com/a/25532977
has comment: http://stackoverflow.com/comment/41235764
has comment: http://stackoverflow.com/comment/41225977
type: Answer
has body: As mentioned by aaronfc already, there is an open ticket on hibernate JIRA: https://hibernate.atlassian.net/browse/HHH-8804 So the Problem is an collision with Log4j2 converters, more detailed, the db appender JPA converters. However, the problems occurs with the "fat" jar only... Workaround: If you use maven-shade-plugin to pack your jar - and don't need any log4j2 db appender, you could exclude the colliding Converter classes: org.apache.maven.plugins maven-shade-plugin 2.3 package shade <shadedArtifactAttached>true</shadedArtifactAttached> jar-with-dependencies org.apache.logging.log4j:* org/apache/logging/log4j/core/appender/db/jpa/converter/*
upvote count: 6
score: 6
answers question: http://stackoverflow.com/q/22451599
downvote count: 0

http://stackoverflow.com/comment/34151617
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22454126
has text: Do you want to remove duplicates in the same row or in the whole matrix?
type: Comment

http://stackoverflow.com/q/22413805
favorite count: 0
has answer: http://stackoverflow.com/a/72250455
type: Question
tagged with: http://stackoverflow.com/tag/xml
score: 4
has answer: http://stackoverflow.com/a/22414224
answer count: 3
tagged with: java
has body: I have been working with a simple cd catalog XML file: <?xml version="1.0" encoding="utf-8" standalone="no"?> <TITLE>Empire Burlesque Bob Dylan USA Columbia 10.90 1985 <TITLE>Hide your heart Bonnie Tyler UK CBS Records 9.90 1988 With this method I want to create a new CD element: private static void addCd(File xml) throws ParserConfigurationException, TransformerConfigurationException, TransformerException, SAXException, IOException { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document document = db.parse(xml); Element cd = document.createElement("CD"); document.appendChild(cd); for (int i = 1; i <= 3; i++) { Element title = document.createElement("TITLE"); Element artist = document.createElement("ARTIST"); Element country = document.createElement("COUNTRY"); Element company = document.createElement("COMPANY"); Element price = document.createElement("PRICE"); Element year = document.createElement("YEAR"); title.appendChild(document.createTextNode("mike ")); artist.appendChild(document.createTextNode("oconnor ")); country.appendChild(document.createTextNode("ie ")); company.appendChild(document.createTextNode("dell ")); price.appendChild(document.createTextNode("14 ")); year.appendChild(document.createTextNode("2014 ")); cd.appendChild(title); cd.appendChild(artist); cd.appendChild(country); cd.appendChild(company); cd.appendChild(price); cd.appendChild(year); } TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); DOMSource domSource = new DOMSource(document); StreamResult streamResult = new StreamResult(new File("cdCatalog.xml")); transformer.transform(domSource, streamResult); DOMSource source = new DOMSource(document); } I can create a new CD element, but the new element appears outside my root ( ) element: <?xml version="1.0" encoding="utf-8" standalone="no"?> <TITLE>Empire Burlesque Bob Dylan USA Columbia 10.90 1985 <TITLE>Hide you…
possible better answer: http://stackoverflow.com/a/22414070
tagged with: dom
has answer: http://stackoverflow.com/a/22414070
upvote count: 4
accepted answer: http://stackoverflow.com/a/22414224
type: AnsweredQuestion
downvote count: 0
has title: Add new element to xml file with Java DOM

http://stackoverflow.com/q/22418175
tagged with: paintcomponent
score: 1
has body: I created a maze generator in swing for a class, and it works great. The only thing is, I want to show the maze being created in realtime, but the way I have everything set, it only updates after all the calculations have completed. I am using paintComponent and repaint in my code. How do I have it show the JFrame and draw lines immediately, rather than doing the algorithm and showing them all at the end? Here is the relevant code: public void generateMaze() { Stack&lt;Box&gt; stack = new Stack&lt;&gt;(); int totalCells = Finals.numCol * Finals.numRow, visitedCells = 1; Box currentCell = boxes[0][0]; Box nextCell; stack.add(currentCell); while (visitedCells &lt; totalCells) { nextCell = checkNeighbors(currentCell.xCoord, currentCell.yCoord); if (nextCell != null) { knockWalls(currentCell, nextCell); stack.add(currentCell); currentCell = nextCell; visitedCells++; } else { currentCell = stack.pop(); } } repaint(); } Here is my paintComponent method override public void paintComponent(Graphics g) { for(int x = 0; x &lt; Finals.numRow; x++) { for(int y = 0; y &lt; Finals.numCol; y++) { if(boxes[y][x].top != null) boxes[y][x].top.paint(g); if(boxes[y][x].bottom != null) boxes[y][x].bottom.paint(g); if(boxes[y][x].left != null) boxes[y][x].left.paint(g); if(boxes[y][x].right != null) boxes[y][x].right.paint(g); } } } The knockWalls method sets certain walls equal to null, which causes them to not be drawn in the paintComponent method. I'm still fairly new at a lot of this, so I apologize if some of the code isn't super high quality! Thanks everyone.
favorite count: 0
has comment: http://stackoverflow.com/comment/34089232
has comment: http://stackoverflow.com/comment/34088960
has answer: http://stackoverflow.com/a/22424081
tagged with: maze
has comment: http://stackoverflow.com/comment/34089126
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/22424081
type: Question
tagged with: arrays
has title: Displaying graphics as they paint in swing
has comment: http://stackoverflow.com/comment/34089089
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/35910562
has text: When you say "drag" you mean "move", right?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22398617
score: 0

http://stackoverflow.com/comment/33948191
comment on: http://stackoverflow.com/q/22337568
type: Comment
type: QuestionComment
has text: Okay. Is there a way for me to overwrite what the file says, instead of making new files?
score: 0

http://stackoverflow.com/comment/138836886
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22348632
has text: It's now 10 years later. Ligatures in text extraction should work if it works with PDFBox, and PDFBox is trying to be as good as Adobe Reader.
score: 0

http://stackoverflow.com/a/22460570
type: Answer
score: 1
upvote count: 1
has body: Can you show the exact error messages. It looks like you have a setup error. bnd tries to find your setup relative to your project. This should not be possible if you just apply the defaults though. Your workspace on the file system should look like: cnf/ build.bnd .. my.project src/ bin/ test/ bin_test/ ...
has comment: http://stackoverflow.com/comment/34163881
answers question: http://stackoverflow.com/q/22457854
downvote count: 0

http://stackoverflow.com/comment/33988825
has text: Oh ok so how would that work, if you dont mind showing me?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22360471

http://stackoverflow.com/comment/34005737
comment on: http://stackoverflow.com/a/22348522
type: Comment
score: 1
has text: Actually it's a great tool but it didn't answer my question, I want to change precisely the color of the menu icon, thank you
type: AnswerComment

http://stackoverflow.com/a/22442005
type: Answer
has comment: http://stackoverflow.com/comment/34133470
has comment: http://stackoverflow.com/comment/34133253
has comment: http://stackoverflow.com/comment/34132878
has comment: http://stackoverflow.com/comment/34134965
has comment: http://stackoverflow.com/comment/34131513
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34132107
has comment: http://stackoverflow.com/comment/34135952
answers question: http://stackoverflow.com/q/22441753
has comment: http://stackoverflow.com/comment/34131847
has comment: http://stackoverflow.com/comment/34136227
has comment: http://stackoverflow.com/comment/34135685
has comment: http://stackoverflow.com/comment/34132030
accepted answer of: http://stackoverflow.com/q/22441753
has body: Why do you use an AlertDialog? You can use a simple Dialog which generally causes less problems and is more appropriate for custom layouts. EDIT: Details First create an XML layout file, just like you would do for an Activity. Then create a class that extends Dialog. Say your custom dialog class is called CustomDialog. In public CustomDialog(Context context) call: super(context); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.custom_dialog); // find your views and customize them here EDIT: HOW TO CREATE CUSTOM DIALOG INSTANCE in your xml, also give the ListView a custom id: android:id="@+id/custom_dialog_list" check the comments in the section below // custom Dialog MyCustomDialog dialog = new MyCustomDialog(thisContext); // you DO NOT need to inflate a new view. by dialog.setContentView(v); you *replace* your XML file with another layout. // inflating the custom institutional expandable list layout //LayoutInflater li = (LayoutInflater) thisContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); //View v = li.inflate(R.layout.institutional_info_custom_list, null, false); //dialog.setContentView(v); // dont forget to check this line InstitutionalInfoListView = (ListView) dialog.findViewById(R.id.custom_dialog_list); // set a custom id for your list in the layout final MasterDetailArrayAdapter adapter = new MasterDetailArrayAdapter(HomeComune.this, MasterDetailInstitutionalInfoList); InstitutionalInfoListView.setAdapter(adapter); dialog.show();

http://stackoverflow.com/comment/34166208
has text: But is OpenJDK actually used (ie, the version you see in the output is OpenJDK)?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22459676

http://stackoverflow.com/comment/33952825
has text: ah brilliant! I think I get how to distribute the weight in Y direction now! :D Just struggling with the X, seems like if I change the xweight value of any one of the components they all just fill the container: http://gyazo.com/0e48ea9dd2aeb7e332a0c6def60e1c71 code: http://gyazo.com/99e9ec6e06ec8b8f9941ac41dce93e43
comment on: http://stackoverflow.com/a/22338393
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22480153
type: Question
has comment: http://stackoverflow.com/comment/34196567
has answer: http://stackoverflow.com/a/22480431
tagged with: arrays
has title: Different objects in array
score: 0
answer count: 3
has body: Good time of the day to anybody reading, I would like to ask if the following situation is possible to do in Java: What do I want to do - create a 2D array which can have different objects in it (i.e. in [0][2] I would like to have PreRoom object, in [0][3] - Room object) and would like these object to be accessible (obviously). How am I doing this? 1) Declare 2D array of Object type: Object[][] map = new Object[151][151]; 2) Create an object: map[0][2] = new PreRoom(r, true); 3) But after this I'm unable to use any method of PreRoom/get any its property, i.e. unable to do: map[0][2].x; //or map[0][2].getR; Am I doing this wrong? Or it's impossible to do and therefore the only solution is to create a unified object for current 2? Thanks in advance. EDIT: solution found, thanks for the replies.
has answer: http://stackoverflow.com/a/22480224
possible better answer: http://stackoverflow.com/a/22480431
linked to: http://stackoverflow.com/q/7313559
has answer: http://stackoverflow.com/a/22480221
type: AnsweredQuestion
tagged with: object
accepted answer: http://stackoverflow.com/a/22480221
tagged with: java

http://stackoverflow.com/a/22434474
has body: The 'object of the class implementing run' is necessary so that there's something to run. Otherwise, what code would run in the thread? You don't strictly need a Runnable object - the alternative is to extend Thread instead and override Thread's run method.
upvote count: 2
answers question: http://stackoverflow.com/q/22434463
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34127529
score: 2

http://stackoverflow.com/comment/33951854
type: AnswerComment
type: Comment
has text: It "looks" like you're adding the table (and some other components) to another panel before adding that to the center position of the window, but that doesn't reflect the example code you posted, so it's difficault to be sure
comment on: http://stackoverflow.com/a/22338393
score: 0

http://stackoverflow.com/q/22355725
linked to: http://stackoverflow.com/q/9606585
upvote count: 15
type: AnsweredQuestion
tagged with: maven
tagged with: liquibase
type: Question
has body: I can run Liquibase changelog through maven build (liquibase:update goal) without any problems. Now I'd like Liquibase to use database credentials and URL loaded from a properties file (db.properties) depending on the selected Maven profile: |-- pom.xml `-- src `-- main `-- resources |-- local | `-- db.properties |-- dev | `-- db.properties |-- prod | `-- db.properties `-- db-changelog-master.xml `-- db-changelog-1.0.xml Each of the 3 properties files would look like the following: database.driver = oracle.jdbc.driver.OracleDriver database.url = jdbc:oracle:thin:@<host_name>:<port_number>/instance database.username = user database.password = password123 Now, instead of these properties being defined in the POM file itself (as explained in the accepted answer of this question liquibase using maven with two databases does not work), I'd like them to be loaded from the external properties file. I have tried different approaches to no avail: 1. I used Maven's resource element in the POM file: org.liquibase liquibase-maven-plugin 3.1.0 db.changelog-master.xml true local true src/main/resources/local <liquibase.url>${database.url}</liquibase.url> <liquibase.driver>${database.driver}</liquibase.driver> <liquibase.username>${database.username}</liquibase.username> <liquibase.password>${database.password}</liquibase.password> dev src/main/resources/dev <liquibase.url>${database.url}</liquibase.url> <liquibase.driver>${database.driver}</liquibase.driver> <liquibase.username>${database.username}</liquibase.username> <liquibase.password>${database.password}</liquibase.password> 2. I tried using the Properties Maven plugin: org.codehaus.mojo properties-maven-plugin 1.0-alpha-2 initialize read-project-properties src/main/resources/local/db.properties When I run the liquibase:update maven goal, I get this this error: [ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.1.0:update (default-cli) on project my-project: The driver has not been specified either as a pa…
tagged with: java
score: 15
has title: Loading data from properties file to be used by Liquibase in Maven build
has answer: http://stackoverflow.com/a/22376004
accepted answer: http://stackoverflow.com/a/22376004
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/34077429
type: QuestionComment
has text: I think this is that kind of problem when you miss something simple after a long hard day. BTW, did you clean project and do you have "Build automatically" checkbox under "Project" menu enabled?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22412012

http://stackoverflow.com/comment/34103962
type: QuestionComment
comment on: http://stackoverflow.com/q/22427228
has text: You're right, but I'm just trying to get a feeling of what's going on in this case
score: 0
type: Comment

http://stackoverflow.com/comment/34123047
has text: But can I do this in a separate method? or would I have to have the class extend JFrame?
comment on: http://stackoverflow.com/a/22438082
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22467308
has answer: http://stackoverflow.com/a/22467309
has title: com.mysema.querydsl querydsl-apt plugin does not generate QueryDSL classes
has body: We had configured the generation of QueryDSL in our project using the maven plugin: com.mysema.maven apt-maven-plugin 1.1.0 com.mysema.query.apt.jpa.JPAAnnotationProcessor com.mysema.querydsl querydsl-apt ${querydsl.version} generate-sources process target/generated-sources/java At some point, we made changes in our project, and the generation process begin to fail with this error: cannot find symbol import xxx.xxxx.xxxx.domain.QContact;
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22467309
favorite count: 0
tagged with: querydsl
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: maven
upvote count: 1
type: Question

http://stackoverflow.com/comment/34088614
comment on: http://stackoverflow.com/q/22416829
has text: I disagree that this is "a simple typographical error" (although I don't see a need to reopen it). "Typographical error" implies either your finger slipped on the keyboard or you have a brain fart. However, this problem has occurred so many times that I think there's something more fundamental going on, such as new programmers being taught that "you're supposed to put semicolons at the end of statements" without clarifying that it doesn't apply to `if`, `while`, etc. Not that I know what to do about the problem.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33962303
has text: @DanTemple: An insufficiency of coffee is the only thing I can come up with. :-) Thanks, I've added it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22345699
type: AnswerComment

http://stackoverflow.com/comment/34059205
has text: @JohnDow: See my updated answer for a version which is probably even faster.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22401748
type: Comment

http://stackoverflow.com/q/22462077
tagged with: spring-webflow-2
type: Question
accepted answer: http://stackoverflow.com/a/22486621
answer count: 1
downvote count: 0
favorite count: 0
has title: How can I access Spring Webflow FlowScope elements outside the flow?
score: 6
tagged with: spring
upvote count: 6
type: AnsweredQuestion
has body: EDIT: I didn't get any bites on this question, so I'm adding a little more detail. I have a Spring Webflow app (ver 2.3.2). I need to access multiple FlowScope objects from inside the validation of one of the steps (not inside the flow itself). You would think this would be simple, but I haven't been able to crack it. Spring Webflow provides a series of special EL variables which can be used for accessing the various scopes, but only inside the flow itself. Inside a custom Spring validator, there doesn't seem to be any way to get to them: @Component public class MyObjectValidator { @Autowired ApplicationContext context; public void validateMyObject(MyObject myObject, Errors errors) { FlowScope flowScope = context.someMagicFunction(); // &lt;---- UNKNOWN MyOtherObject otherObject = flowScope.get("otherObject"); if (incrediblyComplexValidation(myObject, otherObject) { errors.rejectValue("myField","validation.fail","Your object failed validation."); } } } As you can see, inside a Spring Webflow Validator there is no direct external linkage to anything except the object you are supposed to validate. I need to get to those other objects in the flowScope. Ideally either through the ApplicationContext or some other environmental feature there must be a way to get to these other objects. Anyone know the answer to this?
tagged with: java
has answer: http://stackoverflow.com/a/22486621

http://stackoverflow.com/q/22439952
score: 33
type: Question
has answer: http://stackoverflow.com/a/22440004
has title: Is there any way to force java to test two condition regardless the first condition?
accepted answer: http://stackoverflow.com/a/22440004
linked to: http://stackoverflow.com/q/20422793
has answer: http://stackoverflow.com/a/22461601
upvote count: 34
favorite count: 0
answer count: 5
possible better answer: http://stackoverflow.com/a/22439976
has answer: http://stackoverflow.com/a/22458268
downvote count: 1
linked to: http://stackoverflow.com/q/17256644
has answer: http://stackoverflow.com/a/22461063
duplicate of: http://stackoverflow.com/q/20422793
type: AnsweredQuestion
tagged with: if-statement
has answer: http://stackoverflow.com/a/22439976
tagged with: java
has comment: http://stackoverflow.com/comment/34126763
has body: let's say I have a statement if(stack.pop() == 1 &amp;&amp; stack.pop() == 1) if top of stack is 0, then the second condition won't be implemented, which means it just pops one value at the top. What I want is to pop both, the top and the value after top. Is there any way to do that without using another if-else statement in it?

http://stackoverflow.com/comment/34158473
score: 0
comment on: http://stackoverflow.com/q/22442247
has text: No, it's not running on AppEngine
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22454231
upvote count: 2
answers question: http://stackoverflow.com/q/22454126
has body: Since you are dealing with int array and values are relatively small I'd suggest you to create temporary boolean array where the numbers from the source array are used as indexes. Then you just have to iterate over the source array, put true to appropriate cell of your temporary array. At the next iteration go over the temporary array and indexes of elements that are true.
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34152001
has comment: http://stackoverflow.com/comment/34151877

http://stackoverflow.com/q/22406751
has comment: http://stackoverflow.com/comment/34336892
has comment: http://stackoverflow.com/comment/34067970
tagged with: ssh
has body: I'm trying to connect to a slave node by using the Launch method: "Launch slave by execution of command on the master". This is the launch command I'm using: ssh -vvvA user@host java -jar /tmp/java/slave.jar Normally, I can do ssh to the host like:- ssh -A user@host And, it works because my keys can be seen in ssh-add's output But, in the case of jenkins, it is somehow not using the keys present in ssh-add. I'm not able to forward my ssh agent as is evident from the text in Bold in the error below:- This is the detailed error I get:- [03/14/14 19:02:36] Launching slave agent $ ssh -vvvA user@host java -jar /tmp/java/slave.jar OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 debug1: Reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: Applying options for * debug1: /etc/ssh_config line 50: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to host [x.x.x.x] port 22. debug1: Connection established. debug1: identity file /Users/user/.ssh/identity type -1 debug1: identity file /Users/user/.ssh/identity-cert type -1 debug1: identity file /Users/user/.ssh/id_rsa type -1 debug1: identity file /Users/user/.ssh/id_rsa-cert type -1 debug1: identity file /Users/user/.ssh/id_dsa type -1 debug1: identity file /Users/user/.ssh/id_dsa-cert type -1 debug1: Remote protocol version 1.99, remote software version Server-VII-hpn13v1 debug1: no match: Server-VII-hpn13v1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.2 debug2: fd 3 setting O_NONBLOCK debug3: load_hostkeys: loading entries for host "x.x.x.x" from file "/Users/user/.ssh/known_hosts" debug3: load_hostkeys: found key type DSA in file /Users/user/.ssh/known_hosts:28 debug3: load_hostkeys: loaded 1 keys debug3: order_hostkeyalgs: prefer hostkeyalgs: ssh-dss-cert-v01@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-dss debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha2…
has title: sshagent forwarding in jenkins is not working
favorite count: 0
has comment: http://stackoverflow.com/comment/34302897
has answer: http://stackoverflow.com/a/22520448
tagged with: jenkins
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/34067905
has comment: http://stackoverflow.com/comment/34067992
has answer: http://stackoverflow.com/a/22572382
score: 1
tagged with: java
tagged with: ssh-agent
tagged with: jenkins-plugins
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/34047574
has text: Sorry, I don't understand what you are saying. What are those two numbers?
type: Comment
comment on: http://stackoverflow.com/a/22393585
score: 0
type: AnswerComment

http://stackoverflow.com/a/22346033
upvote count: 1
type: AcceptedAnswer
has body: First of all you didn't specify the kind of application you want to create, so i'm being a bit general on my response. Also you didn't mention if you've already managed to build your first report (i mean, without taking any user input). So, below i'm showing the needed part for generating a JasperReport: public void generateReport(ActionEvent actionEvent) throws FileNotFoundException { JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(PopulateBean.createBeanCollection()); Map parameters = new HashMap(); try { InputStream is = new FileInputStream(new File("Source path to template.jrxml")); OutputStream os=new FileOutputStream(new File("Resulting report.pdf")); JasperDesign jasperDesign = JRXmlLoader.load(is); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ds); JasperExportManager.exportReportToPdfStream(jasperPrint, os); } catch (JRException e) { e.printStackTrace(); } } This code should be integrated into your application. The part you are asking for is: Map parameters = new HashMap(); You have just to put the input inserted by the user into this map. Example, if you have a JSF page, then you can take the value of it's UI component and store in this map parameters.put("type_code", getTypeCodeUIComponent().getValue()); You'll see on the code above that this map is passed to the report: JasperFillManager.fillReport(jasperReport, parameters, ds); The only thing that remains is to edit your report query, in iReport. First you create a parameter with the exact same name as that inserted into the map (in this example "type_code". Note, it's case sensitive). Second, you should use a WHERE clause where you filter the type column based on this parameter, see below: And here you go some tutorials:1 and 2 Hope these helps!
has comment: http://stackoverflow.com/comment/33966187
type: Answer
accepted answer of: http://stackoverflow.com/q/22345275
downvote count: 0
answers question: http://stackoverflow.com/q/22345275
has comment: http://stackoverflow.com/comment/33967473
score: 1
has comment: http://stackoverflow.com/comment/33965125

http://stackoverflow.com/q/22393528
has title: AES Encryption Java/plsql
has answer: http://stackoverflow.com/a/61675396
tagged with: aes
has answer: http://stackoverflow.com/a/51810681
upvote count: 3
type: UnansweredQuestion
tagged with: encryption
tagged with: java
has body: I need to implement the same encryption/decryption application on Java and plsql(DBMS_CRYPTO for Oracle 10g). The both implementation are working fine but the pb here is that I am getting different output for the encryption of the same plain text. Below the both code used for the encryption/decryption process (Java and PLSQL). I used the same encryption algorithm "AES/CBC/PKCS5Padding" for DBMS_CRYPTO and Java.The problem here is that I am getting different output for the encryption of the same plain text. import java.security.*; import javax.crypto.*; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import sun.misc.*; import org.apache.commons.codec.binary.Hex; public class AESencrp { private static final String ALGO = "AES/CBC/PKCS5Padding"; private static final byte[] keyValue = "MyEncryptionKey1".getBytes(); private static Key key; private static Cipher decryptor; private static Cipher encryptor; public static void init() throws Exception { key = generateKey(); encryptor = Cipher.getInstance(ALGO); IvParameterSpec iv = new IvParameterSpec(Hex.decodeHex("12345678901234567890123456789012".toCharArray())); decryptor=Cipher.getInstance(ALGO); encryptor.init(Cipher.ENCRYPT_MODE, key,iv); decryptor.init(Cipher.DECRYPT_MODE, key,iv); } public static String encrypt(String Data) throws Exception { byte[] encVal = encryptor.doFinal(Data.getBytes()); String encryptedValue = new BASE64Encoder().encode(encVal); return encryptedValue; } public static String decrypt(String encryptedData) throws Exception { byte[] decordedValue = new BASE64Decoder().decodeBuffer(encryptedData); byte[] decValue = decryptor.doFinal(decordedValue); String decryptedValue = new String(decValue); return decryptedValue; } private static Key generateKey() throws Exception { if (key==null) key = new SecretKeySpec(keyValue, "AES"); return key; } public static void main(String[] args) throws Exception { init(); String password = "mypassword"; String passwordEnc = AESencrp.…
has answer: http://stackoverflow.com/a/22397444
type: Question
tagged with: plsql
downvote count: 0
favorite count: 0
answer count: 3
score: 3

http://stackoverflow.com/a/22348575
has body: The JVM ships with a couple of tools that let you look at the contents of the heap ( jhat and jmap ). Using these may allow you to see why you are seeing more than the expected number of loaded classes. I'd start there before trying to see the non-heap memory usage.
has comment: http://stackoverflow.com/comment/33967731
has comment: http://stackoverflow.com/comment/33972708
has comment: http://stackoverflow.com/comment/33976194
answers question: http://stackoverflow.com/q/22348271
has comment: http://stackoverflow.com/comment/33967523
score: 0
type: Answer

http://stackoverflow.com/a/22414734
accepted answer of: http://stackoverflow.com/q/22414078
has comment: http://stackoverflow.com/comment/34091430
has body: Most likely you are seeing this because your JPA/Hibernate session is closed by the time your JSF calls getPreRequisites. You'll need to add this to your web.xml to keep the session open so that the view can load your lazy loaded objects. Spring OpenEntityManagerInViewFilter org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter Spring OpenEntityManagerInViewFilter /*
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22414078

http://stackoverflow.com/a/22368176
has body: There are three different types of declared variables in Java. They are instance, class and local variables. Instance Variables Instance variables are the non-static fields of your class, often referred to simply as fields. Primitive numeric fields initialize to 0. This includes byte, short, int, long, float and double. booleans initialize to false . chars initialize to the null character \u0000. Reference types initialize to null. Class Variables A class variable is a field within a class declared as static, often referred to as a static variable or static field. It is also same initialize as instance variable. Local Variables A local variable is a variable defined within a method, which includes any method parameters. Local variables must be initialized before use. They do not have a default value. Initialization process is done by JVM when method is create.
upvote count: 12
accepted answer of: http://stackoverflow.com/q/22368106
answers question: http://stackoverflow.com/q/22368106
type: AcceptedAnswer
downvote count: 0
score: 12
type: Answer

http://stackoverflow.com/q/22393757
answer count: 1
has body: I've read through many of the threads posted on this topic but none of them have been able to solve my problem. I use a mac and I'm trying to connect a java project to sqlite and I'm having some problems. I have successfully connected to mysql to java. To connect mysql I had to add a mysql.jar file to my system/library/java/extensions folder. Once I did that it was smooth sailing. I have not been to fortunate with sqlite. I went to xerial and tried to use their sqlite jdbc but doing that created a ton of other errors when I ran it. Is there a simple method and an easy jar I can use to connect java to sqlite? something like the process I described above for mysql? If not can anyone offer me some help. Thanks for your help! here is the code I used: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class SQLiteJDBC { public static void main(String[] args) throws ClassNotFoundException { // load the sqlite-JDBC driver using the current class loader Class.forName("org.sqlite.JDBC"); Connection connection = null; try { // create a database connection connection = DriverManager.getConnection("jdbc:sqlite:sample.db"); Statement statement = connection.createStatement(); statement.setQueryTimeout(30); // set timeout to 30 sec. statement.executeUpdate("drop table if exists person"); statement.executeUpdate("create table person (id integer, name string)"); statement.executeUpdate("insert into person values(1, 'leo')"); statement.executeUpdate("insert into person values(2, 'yui')"); ResultSet rs = statement.executeQuery("select * from person"); while(rs.next()) { // read the result set System.out.println("name = " + rs.getString("name")); System.out.println("id = " + rs.getInt("id")); } } catch(SQLException e) { // if the error message is "out of memory", // it probably means no database file is found System.err.println(e.getMessage()); } finally { try { if(connection != null) con…
has answer: http://stackoverflow.com/a/23872719
accepted answer: http://stackoverflow.com/a/23872719
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22106550
downvote count: 0
has comment: http://stackoverflow.com/comment/34050978
tagged with: java
tagged with: database
type: Question
upvote count: 2
has title: issues connecting java to sqlite
favorite count: 0
has comment: http://stackoverflow.com/comment/34045934
tagged with: sqlite

http://stackoverflow.com/comment/34176529
type: Comment
has text: Try using `getInputMap(WHEN_IN_FOCUSED_WINDOW)` and call `addKeyListener` a JoshM has recommended...
comment on: http://stackoverflow.com/q/22467906
score: 0
type: QuestionComment

http://stackoverflow.com/q/22431241
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34111290
has answer: http://stackoverflow.com/a/22431428
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22431428
tagged with: java
has answer: http://stackoverflow.com/a/22431249
has body: So I'm trying to pass the variable numbers into the printArray method but I'm not completely sure how to do it. Obviously I'm not doing it right but could someone please point me in the correct direction? Thanks in advance. import java.io.*; import java.util.Scanner; public class Paniagua_ArrayProcessing{ public static void main(String[] args) throws IOException{ int[] numbers = new int[4]; inputData(); printArray(numbers); } public static int[] inputData() throws IOException{ Scanner keyboard = new Scanner(System.in); String input; int lines; System.out.println("Please enter a file name: "); input = keyboard.nextLine(); File myfile = new File(input); if (!myfile.exists()){ System.out.println("File not found."); System.exit(0); } Scanner inputFile = new Scanner(myfile); lines = inputFile.nextInt(); int[] numbers = new int[lines]; for (int i=0; i&lt;lines; i++){ if (inputFile.hasNextInt()){ int moreLines = inputFile.nextInt(); numbers[i] = moreLines; } } inputFile.close(); return numbers; } public static void printArray(int[] array){ System.out.println(array[3]); } }
has comment: http://stackoverflow.com/comment/34111265
tagged with: int
answer count: 2
accepted answer: http://stackoverflow.com/a/22431249
has title: How to use return with arrays?
tagged with: arrays
downvote count: 0
score: 1

http://stackoverflow.com/comment/104504755
comment on: http://stackoverflow.com/a/59138871
score: 0
type: AnswerComment
type: Comment
has text: When answering an old question, your answer would be much more useful to other StackOverflow users if you included some context to explain how your answer helps, particularly for a question that already has an accepted answer. See: [How do I write a good answer](https://stackoverflow.com/help/how-to-answer).

http://stackoverflow.com/comment/34015002
comment on: http://stackoverflow.com/q/22376455
score: 0
type: Comment
type: QuestionComment
has text: In which dialect it's talking?

http://stackoverflow.com/comment/34083223
has text: Check out these videos: http://www.youtube.com/playlist?list=PLW3Zl3wyJwWOpdhYedlD-yCB7WQoHf-My He implements all of the logic in C++ but no reason you shouldn't be able to implement it in Java. Look at Euler's angles and then Quaternions. This is basic game math stuff. Also this book should help: http://www.amazon.com/Math-Primer-Graphics-Development-Edition/dp/1568817231/ref=dp_ob_title_bk
score: 0
comment on: http://stackoverflow.com/q/22415137
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34087901
comment on: http://stackoverflow.com/q/22417890
type: Comment
type: QuestionComment
has text: Start by taking a look at [Code Conventions for the Java Programming Language](http://www.oracle.com/technetwork/java/codeconv-138413.html) and [Initial Threads](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html) - Won't fix your immeditate problem, but will make you code more easy to read and reduce the potetional for further issues in the future...
score: 0

http://stackoverflow.com/q/22378902
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/34479491
has comment: http://stackoverflow.com/comment/34479490
answer count: 0
type: UnansweredQuestion
tagged with: pageload
tagged with: jsf
score: 0
tagged with: java
type: Question
has body: I am have two JSF pages index.jsf and detalis.jsf . In the index.jsf I am showing a list of links in ADF table that's mapped to some view object. Each link represent the Title attribute in the row. When the user click the link I am getting the value of the key attribute and store it in the session. After that the detalis.jsf should show details information for the row the user selected in the index.jsf. I am achieving that by executing query on the same view object based on the key value coming from the session, this query execution is tacking place in the OnPageLoad() since I am using PagePhaseListener. Problem is when the user click some link in the index.jsf the detalis.jsf is appearing with no data at the first time. But if I go back to index.jsf and press the same link again detalis.jsf is showing the right data. So, the work flow is working at the second try not at the first one. I am using Jdeveloper 11.1.2.3 with ADF Technology
has title: view object data is not showing at the first page loading, it is showing at the second load

http://stackoverflow.com/comment/34072466
type: Comment
comment on: http://stackoverflow.com/a/22409360
type: AnswerComment
score: 0
has text: +1, you got it a minute before me. :P

http://stackoverflow.com/comment/34188291
has text: I have found the answer: http://stackoverflow.com/questions/16593952/java-variable-across-multiple-include-blocks-variable-cannot-be-resolved
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22474770
score: 0

http://stackoverflow.com/comment/34120138
has text: well it is not finding the driver class; wrap your classpath entries with a " (because they have spaces) and retry
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22436361
score: 0

http://stackoverflow.com/q/22378177
has answer: http://stackoverflow.com/a/22378217
possible better answer: http://stackoverflow.com/a/22378206
downvote count: 0
has answer: http://stackoverflow.com/a/22378206
has answer: http://stackoverflow.com/a/22378554
favorite count: 0
answer count: 3
tagged with: crc
has body: public static int getCRC16(byte[] bytes) { CRC16 crc = new CRC16(); crc.reset(); crc.update(bytes, 0, bytes.length); return (int) crc.getValue(); } Tons of threads will hit this method, if I don't synchronize I'll get a wrong crc for a specific thread?
accepted answer: http://stackoverflow.com/a/22378217
has title: If I don't synchronize this method I'll get wrong values?
tagged with: asynchronous
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
tagged with: java

http://stackoverflow.com/q/22443053
tagged with: java
tagged with: jboss
tagged with: eclipse
has answer: http://stackoverflow.com/a/22443205
type: AnsweredQuestion
has body: I'm trying to deploy a war file in JBoss 7 and I'm getting the following error: Caused by: com.sun.faces.config.ConfigurationException: Source Document: ...../jboss-as 7.1.1.Final/bin/content/ITSupportFinal.war/WEB-INF/lib/rewrite-integration-faces-2.0.0.Alpha5.jar/META-INF/faces-config.xml Cause: Class 'org.ocpsoft.rewrite.faces.RewritePhaseListener' is missing a runtime dependency: java.lang.NoClassDefFoundError: org/ocpsoft/rewrite/servlet/event/SubflowTask I have another project with similar Maven dependencies, same pom.xml file and this is succesfully deployed. I have the following dependencies related to prettyfaces: com.ocpsoft ocpsoft-pretty-faces 2.0.3 org.ocpsoft.rewrite rewrite-integration-faces-annotations 2.0.0.Alpha5 org.ocpsoft.rewrite rewrite-servlet 2.0.11.Final org.ocpsoft.rewrite rewrite-config-prettyfaces 2.0.11.Final Am I missing something? Or it's something wrong there? Thanks.
has title: War file not getting deployed in JBoss
type: Question
tagged with: maven
answer count: 1
accepted answer: http://stackoverflow.com/a/22443205
tagged with: jsf
score: 0

http://stackoverflow.com/a/22405487
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22405384
type: Answer
accepted answer of: http://stackoverflow.com/q/22405384
score: 1
upvote count: 1
has body: For now I suspect that you forgot to escape * in split regex. Try maybe String[] resutl = yourString.split("0102\\*\\*"); In case you want * to represent any character then use . instead of * String[] resutl = yourString.split("0102.."); In case you want * to represent any digit use \\d instead String[] resutl = yourString.split("0102\\d\\d");

http://stackoverflow.com/comment/33940633
type: Comment
type: QuestionComment
has text: do you have @Transactional on your DAO ?
score: 0
comment on: http://stackoverflow.com/q/22333406

http://stackoverflow.com/comment/34105962
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22428304
has text: It could be a *fun* project - [apache batik](http://xmlgraphics.apache.org/batik/) might help.
type: Comment

http://stackoverflow.com/comment/34115285
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22433558
has text: Can you show us the code where you initialize the `Player` objects in your array?

http://stackoverflow.com/comment/34208461
type: QuestionComment
has text: in some other SO answer, someone told that you can differenciate the scanner from someone inspecting the speed the string took to be written (but I don't know how to get this from the event)
score: 0
comment on: http://stackoverflow.com/q/22486421
type: Comment

http://stackoverflow.com/comment/34006061
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22370132
has text: Possibly duplicate of this [How to compare dates in hibernate][1] [1]: http://stackoverflow.com/questions/10073893/how-to-compare-dates-in-hibernate
score: 0

http://stackoverflow.com/q/22407941
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22407960
tagged with: jsp
accepted answer: http://stackoverflow.com/a/22407960
score: 0
answer count: 1
has body: I have a simple webapp with a search box visible from all JSP pages. My controller looks like this: @RequestMapping(value = "/search", method = RequestMethod.GET) public String search(Map<String, Object> map, HttpServletRequest request) { /*...*/ return "searchresult"; } In my JSP I use: in order to make the request. So, for example, if I make a request from /myproject/index this works perfect and the resulting URL is /myproject/search. But now, if I do the same but from another level, e.g. /myproject/index/level2, the resulting URL is /myproject/index/search and doesn't work since it doesn't find a controller with that mapping. What I want to do is to map the controller to an absolute path so, in the second case the resulting URL would be /myproject/search and not /myproject/index/search/ In my web.xml I have this: dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher /
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has title: Map controller to an absolute path in Spring MVC

http://stackoverflow.com/q/22443650
has comment: http://stackoverflow.com/comment/34134201
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34134470
has comment: http://stackoverflow.com/comment/34134255
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/22417752
has comment: http://stackoverflow.com/comment/34134596
upvote count: 1
has comment: http://stackoverflow.com/comment/34134442
has body: Is it possible to take existing .class files and a MANIFEST.MF to create a jar file? Is there a library that can create a "valid" jar-file? I tried it manually and it didn't work (using 7zip). ERROR: "Invalid or corrupt jar file" If everything has been compiled before, it should (in my understanding) theoretically work, if you create a new zip file, put all the files in it in the original structure and then rename it to "jar". My idea is to program something like this with java code. A solution where I could add a file to an existing jar, would also be ok. If you're interested in why I want to use this, look at my initial question: Compile javacode out of a running java accpilaction - on a system that hasn&#39;t JDK installed
has answer: http://stackoverflow.com/a/22443785
type: Question
tagged with: compilation
has comment: http://stackoverflow.com/comment/34134139
has comment: http://stackoverflow.com/comment/34134824
has title: Create a jar file using compiled class files and an existing MANIFEST.MF file
answer count: 1
downvote count: 0
tagged with: jar
linked to: http://stackoverflow.com/q/2977663
favorite count: 0

http://stackoverflow.com/q/22340768
has title: NetBeans icon: run project
has comment: http://stackoverflow.com/comment/33953633
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33953759
tagged with: netbeans
has comment: http://stackoverflow.com/comment/33987636
answer count: 0
downvote count: 0
has body: Whenever I press the icon run-project, netbeans runs another project, not the one in the main screen. Does any body know, how to fix it?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33990550
type: Question

http://stackoverflow.com/a/37771365
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22364886
type: Answer
downvote count: 0
has body: you want to change this function:-value="Pizza/pizzalist" @RequestMapping(method=RequestMethod.GET, value="Pizza/pizzalist") public String pizzalist(@ModelAttribute("mypizza") Pizza pizza, Model model) { List&lt;Pizza&gt; pizzas = pizzaDao.getAll(); model.addAttribute("pizzas", pizzas); return "pizzalist/pizzalist"; this will help you.

http://stackoverflow.com/comment/34162000
type: Comment
score: 0
has text: @Conan See the edit. Still my answer is based off an assumption. Correct me if I am wrong, by showing your configuration.
comment on: http://stackoverflow.com/a/22459772
type: AnswerComment

http://stackoverflow.com/comment/34223040
has text: Hi, thanks for your comment. Sorry about the missing assets; I thought I had included everything needed for the code provided. In line 160 bob's velocity has delta applied to it with the line bob.getVelocity().mul(delta); An easy way to recreate the behaviour is by adding a Thread.sleep(100) to the .render function in GameScreen.java
comment on: http://stackoverflow.com/a/22489470
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22487129
answers question: http://stackoverflow.com/q/22487091
downvote count: 0
has body: setz(int a) would not have an error as it is public. Moreover, z still exists in the parent class. B b = new B(); b.z = 1; // Error because z is a private member of A b.setz(1); // No error because setz() is a public method of A
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/a/22407131
has comment: http://stackoverflow.com/comment/34068804
answers question: http://stackoverflow.com/q/22406368
score: 0
has comment: http://stackoverflow.com/comment/34068456
has body: There are at least two problems with your code that will affect its functionality on different platforms: You must specify a character set when calling getBytes() or new String(...). Without this, the results will be different if your platforms have different default charsets. You must fully specify your encryption algorithm, e.g. replace "AES" with "AES/CBC/PKCS5Padding" to avoid differences between providers.
has comment: http://stackoverflow.com/comment/34130892
type: Answer

http://stackoverflow.com/a/22453487
answers question: http://stackoverflow.com/q/22453436
score: 5
has body: Shouldn't it be newTopEnemy.remove(i); ? q looks like an index on ammo.
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/comment/33956619
type: Comment
type: QuestionComment
score: 0
has text: @Biatrixia155 That's what I thought .. see my answer below.
comment on: http://stackoverflow.com/q/22342314

http://stackoverflow.com/comment/34003585
type: Comment
has text: ...it makes it more awesome. I dont see the issue.
type: AnswerComment
comment on: http://stackoverflow.com/a/22369177
score: 0

http://stackoverflow.com/comment/34237294
score: 0
type: AnswerComment
type: Comment
has text: also in the lower part i have written codes to get the username, my manager asked me to make it remember password also, hence i replicated the same codes changing the method names only and replacing the username text box to password text box in this part, if (user!=="") { document.getElementById("password").value = user; } I added this function in the the second function being for password. would this work? am i doing something wrong? or what is the best way to do this? Thank you for the help!
comment on: http://stackoverflow.com/a/22390982

http://stackoverflow.com/a/22469341
has comment: http://stackoverflow.com/comment/34206090
score: 1
has body: First Attempt AudioClip clip1 = Applet.newAudioClip(new URL(new File("E0.wav").getAbsolutePath())); This is not how you construct a URL to a File. Instead, you should use File#getURI#getURL AudioClip clip1 = Applet.newAudioClip(new File("/full/path/to/audio.wav").toURI().toURL()); Second Attempt mediafire is returning a html response, not the audio file...You can test it with... URL url = new URL("http://www.mediafire.com/listen/tok9j9s1hnogj1y/downloads/E0.wav"); try (InputStream is = url.openStream()) { int in = -1; while ((in = is.read()) != -1) { System.out.print((char)in); } } catch (IOException exp) { exp.printStackTrace(); } Third Attempt You open the clip, but never start it... URL url2 = new URL("http://www.villagegeek.com/downloads/webwavs/Austin_Powers_death.wav"); Clip clip2 = AudioSystem.getClip(); AudioInputStream ais2 = AudioSystem.getAudioInputStream(url2); clip2.open(ais2); clip2.start();
answers question: http://stackoverflow.com/q/22469164
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22469164
upvote count: 1

http://stackoverflow.com/a/22379004
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22378509
has body: You can define a custom LayoutManager to position children as you wish in the public void layoutContainer(Container target) method. Similar example is implemented here http://java-sl.com/tip_columns_flow_layout.html
type: Answer
downvote count: 0

fortify
tags question: http://stackoverflow.com/q/22351600
tags question: http://stackoverflow.com/q/22475256
type: Tag
tag name: fortify

http://stackoverflow.com/comment/34202442
has text: @guest86 Your comment sounds exactly like I worry: you just feel it's *wrong* that the JVM allocates all that RAM; you don't have the hard performance data to back it up.
score: 0
comment on: http://stackoverflow.com/a/22482114
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34171140
type: AnswerComment
type: Comment
has text: Even that does not have setup(): http://hadoop.apache.org/docs/r1.2.1/api/org/apache/hadoop/mapred/Mapper.html
comment on: http://stackoverflow.com/a/22463406
score: 0

http://stackoverflow.com/comment/34288977
type: AnswerComment
has text: Sounds like you need to look for other tools. I haven't used them so I don't have recommendations. IBM's Java-based products generally ship bundled with a JRE (partly for this reason, partly to avoid possible incompatibility if the system JRE is a different release level than the one needed by the code).
type: Comment
comment on: http://stackoverflow.com/a/22479724
score: 0

http://stackoverflow.com/comment/34114740
has text: the problem is still there, i have absolutly no idea why
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22433121
type: AnswerComment

http://stackoverflow.com/q/22452403
has comment: http://stackoverflow.com/comment/34162171
favorite count: 0
has comment: http://stackoverflow.com/comment/34164475
type: UnansweredQuestion
tagged with: scala
has answer: http://stackoverflow.com/a/23118505
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34154445
upvote count: 1
has comment: http://stackoverflow.com/comment/34184652
type: Question
has title: How to determine when message was sent in Akka
has comment: http://stackoverflow.com/comment/34183806
has comment: http://stackoverflow.com/comment/34163755
has body: I am wondering if there is the possibility to know when a message has been delivered. Since I want to shutdown the actorsystem right afterwards. The code below connects to a remote actor and then sends a message. But in some cases the local actorsystem seems to be shut down too early. ActorSystem system = ActorSystem.create("Test", config.getConfig("webbackend")); ActorSelection communicator = system.actorSelection("akka.tcp://Midas@127.0.0.1:2555/user/Communicator"); communicator.tell(new TimerTransmissionCmd(channel.getId()), ActorRef.noSender()); //system.shutdown();
tagged with: akka
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34145591
has text: That worked. I had to adjust all my urls to account for it as well as my links. But it does seem to solve my security issue. Thanks a lot, and this does seem like a problem that needs to be filed as a critcal. because I have not found anyway around it aside from your suggestion
type: Comment
comment on: http://stackoverflow.com/a/22441493
score: 0
type: AnswerComment

http://stackoverflow.com/q/22408780
type: Question
has title: How to destroy previous activity when you jumped to next activity
has answer: http://stackoverflow.com/a/22409363
accepted answer: http://stackoverflow.com/a/22409363
score: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/22408805
has comment: http://stackoverflow.com/comment/34071938
tagged with: multithreading
has answer: http://stackoverflow.com/a/22410227
tagged with: android-intent
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22408805
has body: I have activity A, having timer thread. after 5 sec it jumps to activity B via intent. how to destroy activity A when you are on activity B so that back button don't let you go back to activity A.

http://stackoverflow.com/q/22339209
downvote count: 0
has answer: http://stackoverflow.com/a/22339328
tagged with: keyboard
has answer: http://stackoverflow.com/a/53909284
possible better answer: http://stackoverflow.com/a/22339353
favorite count: 0
has answer: http://stackoverflow.com/a/22339353
tagged with: swing
answer count: 4
has answer: http://stackoverflow.com/a/22339259
type: AnsweredQuestion
tagged with: keyevent
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/22339259
has body: I want to be able to end my program when a certain key is pressed (For this example we will say when k is pressed). I know that this could be done by using JFrame and KeyListener but want this my listener to run in the background. My program currently modifies word documents which means the active window would not be JFrame so it would no be recording the keys that are pressed. Also bufferd readers are not an option as previously mentioned, the java program that is running is not the selected window. I have spent many hours researching different ways however all I have found is ways to see if they mouse is pressed using AWTEvents At the very worst case I will check to see if 2nd mouse button is pressed and end my code then, but ideally I would want to just end it on the key pressed. Any help would be great, comment for any clarification.
type: Question
has title: Ending a program when a certain key on the keyboard is pressed
tagged with: keyboard-hook

http://stackoverflow.com/a/22465229
accepted answer of: http://stackoverflow.com/q/22464993
type: AcceptedAnswer
downvote count: 0
has body: A better way would be to have a boolean such as movingRight for each of the directions. Initially movingRight = false. In keyPressed(), check whether or not the right arrow (or D or whatever key) was pressed and set movingRight = true if so. In keyReleased(), do the same but set the boolean to false if the relevant key was released. Then in your main update loop, move the player one pixel to the right if movingRight == true, and so forth for each of the directions. To reiterate, this eliminates the small lag because it doesn't rely on keypress events, but rather just makes sure the key has been pressed and has not yet been released (and so we know it is being held down).
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22464993

http://stackoverflow.com/comment/33939507
comment on: http://stackoverflow.com/a/22330278
type: AnswerComment
score: 0
type: Comment
has text: for(int j=0;j<perslist.length;j++) { System.out.println(perslist[j].getNume()); if(perslist[j].getNume().equals(a) && perslist[j].getPin()==b) I add this ***System.out.println(perslist[j].getNume());*** to see if perslist.getnume is null. And something weird happen. The 4 name are printed in console but after printing I still receive this error: * Exception in thread "main" java.lang.NullPointerException at PersoanaList.cautare(PersoanaList.java:24) at Main.main(Main.java:24)*

http://stackoverflow.com/q/22478006
score: 0
tagged with: file-transfer
has comment: http://stackoverflow.com/comment/34197932
tagged with: sql
tagged with: sqlite
answer count: 0
has comment: http://stackoverflow.com/comment/34196581
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/34193208
has comment: http://stackoverflow.com/comment/34192793
has comment: http://stackoverflow.com/comment/34205725
has body: Can we transfer Database files (.sql, .sqlite or any DB file) through java sockets. I tried transferring a sqlite file through buffer and int but both didn't work. Does any one have any idea? Client and server side OS: Windows
tagged with: java
has title: Transfer DB files through Java sockets
type: Question

teradata
type: Tag
tags question: http://stackoverflow.com/q/22334854
tag name: teradata
tags question: http://stackoverflow.com/q/22383727

http://stackoverflow.com/a/22442409
answers question: http://stackoverflow.com/q/22438677
has body: Perhaps a combined TimeZone and "Time (hours/minutes/seconds)" issue? Case I Different timezones and different day times: public static void main(final String[] args) { final Calendar march14 = Calendar.getInstance(TimeZone.getTimeZone("US/Hawaii")); march14.set(2014, Calendar.MARCH, 14, 23, 59, 0); final Calendar march16 = Calendar.getInstance(TimeZone.getTimeZone("Asia/Tokyo")); march16.set(2014, Calendar.MARCH, 16, 0, 0, 0); final long diffInMs = march16.getTimeInMillis() - march14.getTimeInMillis(); System.out.println("diff = " + diffInMs / (24 * 3600 * 1000)+" day(s)"); } This prints: diff = 0 day(s) Case II However, adjusting the time zone: public static void main(final String[] args) { final Calendar march14 = Calendar.getInstance(TimeZone.getTimeZone("US/Hawaii")); march14.set(2014, Calendar.MARCH, 14, 23, 59, 0); final Calendar march16 = Calendar.getInstance(TimeZone.getTimeZone("US/Hawaii")); // &lt;- CHANGE! march16.set(2014, Calendar.MARCH, 16, 0, 0, 0); final long diffInMs = march16.getTimeInMillis() - march14.getTimeInMillis(); System.out.println("diff = " + diffInMs / (24 * 3600 * 1000)+" day(s)"); } This prints: diff = 1 day(s) Case III And adjusting the time (hours/minutes/seconds): public static void main(final String[] args) { final Calendar march14 = Calendar.getInstance(TimeZone.getTimeZone("US/Hawaii")); march14.set(2014, Calendar.MARCH, 14, 0, 0, 0); // &lt;- CHANGE! final Calendar march16 = Calendar.getInstance(TimeZone.getTimeZone("US/Hawaii")); march16.set(2014, Calendar.MARCH, 16, 0, 0, 0); final long diffInMs = march16.getTimeInMillis() - march14.getTimeInMillis(); System.out.println("diff = " + diffInMs / (24 * 3600 * 1000)+" day(s)"); } This prints: diff = 2 day(s) Conclusions My two advices: Don't use magic numbers, set all parts of your date/calendar objects that are relevant Always set the TimeZone when working with date/time Additional note to SimpleDateFormat By the way: In SimpleDateFormat m is for minutes, M for month in year, se…
score: 0
type: Answer

http://stackoverflow.com/comment/34195698
has text: Use `count` and `group by`.
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22479759

http://stackoverflow.com/a/22339654
has comment: http://stackoverflow.com/comment/33951979
has body: You are connecting to your database each time you go through the loop. Create your database connection outside your loop and consume it with in, so it doesnt getConnection on each iteration. try { BufferedReader br=new BufferedReader(new FileReader("v.csv")); String line; db = DatabaseConnection.ConnectDB(); while((line=br.readLine())!=null){ System.out.println(line); String[]value = line.split(","); System.out.println(value.length); String sql = "INSERT into main ([Ticket #], Status, Priority, Department, [Account Name]) " + "values ('"+value[0]+"','"+value[1]+"','"+value[2]+"','"+value[3]+"','"+value[4]+"')"; System.out.println("test"); PreparedStatement pst = null; try{ pst = db.prepareStatement(sql); pst.executeUpdate(); }finally{ if(pst != null) { pst.close(); } } } br.close(); } catch(Exception e) { JOptionPane.showMessageDialog(null, e); }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33951822
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22339564
upvote count: 2
answers question: http://stackoverflow.com/q/22339564
has comment: http://stackoverflow.com/comment/33951890

http://stackoverflow.com/a/22338393
has comment: http://stackoverflow.com/comment/33951744
type: Answer
has comment: http://stackoverflow.com/comment/33952088
has comment: http://stackoverflow.com/comment/33951429
has comment: http://stackoverflow.com/comment/33951963
has body: There are a number of possible ways to achieve this depending on the desired result. You Could... Use a GridLayout which will allow you to add components into a single column. The downside to this is the width of each component will be the width of the parent container and each component will be given an equal amount of the height (divided amongst the components); sidepanel.setLayout(new GridLayout(0, 1)); sidepanel.add(newgame); sidepanel.add(ticketView); sidepanel.add(moveView); sidepanel.add(turn); sidepanel.add(round); You Could... Use a GridBagLayout which will allow you to control how components fill there column sidepanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); // One component per row... gbc.gridwidth = GridBagConstraints.REMAINDER; // Fill the available column space, this does not mean // fill to fit the available parent container width though gbc.fill = GridBagConstraints.HORIZONTAL; sidepanel.add(newgame, gbc); sidepanel.add(ticketView, gbc); sidepanel.add(moveView, gbc); sidepanel.add(turn, gbc); sidepanel.add(round, gbc); The drawback to this is is that, by default, the GridBagLayout will align all it's components to the center position of the container. There are tricks you can employ to change this, but it's a little messy You Could... Use the VertcialLayout from SwingX libraries
has comment: http://stackoverflow.com/comment/33952846
has comment: http://stackoverflow.com/comment/33952825
has comment: http://stackoverflow.com/comment/33952201
has comment: http://stackoverflow.com/comment/33952874
has comment: http://stackoverflow.com/comment/33951483
accepted answer of: http://stackoverflow.com/q/22337603
has comment: http://stackoverflow.com/comment/33951590
has comment: http://stackoverflow.com/comment/33951854
answers question: http://stackoverflow.com/q/22337603
has comment: http://stackoverflow.com/comment/33952578
score: 0
has comment: http://stackoverflow.com/comment/33952324
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33952668
has comment: http://stackoverflow.com/comment/33951624

http://stackoverflow.com/comment/34195280
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22479014
type: Comment
has text: Your String is wrong - "((a=10) AND ((b=13) AND (c=15))))" has 3 "(" but 4 ")"

http://stackoverflow.com/q/22415053
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/22415278
has comment: http://stackoverflow.com/comment/34082917
score: 0
has answer: http://stackoverflow.com/a/22415090
accepted answer: http://stackoverflow.com/a/22415090
has title: How do I reference a user-entered int?
has body: Easy question (I'm a beginner!)... My java program needs to refer back to the user-entered integers stored as variables "a" and "z". These two variables are initialized using a Scanner and the nextInt() method. Here's my code: Scanner in = new Scanner(System.in); int a; int z; int x; System.out.println("Please provide a lower bound (integer): "); a = in.nextInt(); System.out.println("Please provide an upper bound (integer): "); z = in.nextInt(); So now I need to refer back to these user-entered variables in a for-loop that appears later on, but I do not know the syntax to do this. I need the for-loop to start at "a" and continue one-by-one until "z". for(a ; a &lt;= z ; a++) { //code irrelevant to my question } Java is making it very clear that I cannot just write the variables in the for-loop, so how do I do it? Thanks!
has answer: http://stackoverflow.com/a/22415193
has answer: http://stackoverflow.com/a/22415085
has comment: http://stackoverflow.com/comment/34082882
has comment: http://stackoverflow.com/comment/34082873
possible better answer: http://stackoverflow.com/a/22415085
answer count: 4
tagged with: user-input
type: AnsweredQuestion
tagged with: java.util.scanner
tagged with: java

http://stackoverflow.com/comment/34207153
type: Comment
comment on: http://stackoverflow.com/a/22485627
type: AnswerComment
has text: ok wow you're awesome. Please explain something to me.. So in the statement were setBoolean to the place in DB 11 then getting selected item from the combobox sending object toString that when it " WHen it equals Business? " this part confuses me the end?
score: 0

http://stackoverflow.com/q/22429556
tagged with: garbage-collection
has title: How does java GC work if there is no reference variable?
has answer: http://stackoverflow.com/a/22429582
type: AnsweredQuestion
tagged with: java
type: Question
score: 5
possible better answer: http://stackoverflow.com/a/22429850
has body: I know java GC can destroy an object on the heap if the reference variable that points to the object is manually set to null or set to point to another object: TestObject test = new TestObject(); test.dosomething(); test = null; My question is that if I did not give that object a name (reference variable) when I created it, how do I free the memory that object occupies after I'm done with the object: (new TestObject()).dosomething(); Will this object live on the heap forever before the program ends?
has comment: http://stackoverflow.com/comment/34108972
answer count: 2
has comment: http://stackoverflow.com/comment/34109053
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22429582
upvote count: 5
has answer: http://stackoverflow.com/a/22429850

http://stackoverflow.com/comment/33990865
type: QuestionComment
type: Comment
has text: I already tried with primefaces too, but didn't work.
comment on: http://stackoverflow.com/q/22361924
score: 0

http://stackoverflow.com/q/22474022
has body: I am having a text file which is of very big size. I want to cluster that file, for example if I want to divide the file in 5 cluster then from A to Z the word frequency then the centroid of each cluster should be c,h,m,r,w so the output should be like initially all words are of a,b,c,d,e then f,g,h,i,j then k,l.m.n.o then p,q,r,s,t then u,v,w,x,y and z I want to implement this type of clustering in java. I have searched the code but I could not found word clustering program in java.
favorite count: 0
has comment: http://stackoverflow.com/comment/34274538
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/22475067
tagged with: java
has answer: http://stackoverflow.com/a/22524783
has title: word clustering in java
has comment: http://stackoverflow.com/comment/34224384
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34274954
tagged with: cluster-analysis
score: 0
has answer: http://stackoverflow.com/a/22474165
answer count: 3

http://stackoverflow.com/comment/33943963
type: Comment
comment on: http://stackoverflow.com/q/22335410
score: 0
has text: Where do you initialize your `pb`?
type: QuestionComment

http://stackoverflow.com/a/22331182
has comment: http://stackoverflow.com/comment/33964831
has comment: http://stackoverflow.com/comment/33964487
has comment: http://stackoverflow.com/comment/33964366
has comment: http://stackoverflow.com/comment/33964364
has comment: http://stackoverflow.com/comment/33964389
has comment: http://stackoverflow.com/comment/33964310
has comment: http://stackoverflow.com/comment/33937167
has comment: http://stackoverflow.com/comment/33936988
accepted answer of: http://stackoverflow.com/q/22330892
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22330892
has comment: http://stackoverflow.com/comment/33937420
score: 0
has comment: http://stackoverflow.com/comment/33961957
type: Answer
has body: Instead of using a s*load of annotations, make your class implement JsonSerializable and write a custom deserializer. Here is code using Jackson 2.2.x; 1.9.x should not be very different. First, the Data class (note: it should really be final, its members private and have no setters if you can afford that): import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializable; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import org.joda.time.DateTime; import java.io.IOException; @JsonDeserialize(using = DataDeserializer.class) public class Data implements JsonSerializable { public DateTime dateTime; public Double temperature; public Data(DateTime dateTime, Double temperature){ this.dateTime = dateTime; this.temperature = temperature; } public DateTime getDateTime() { return dateTime; } public long getDateTimeAsUnixTimestamp() { return dateTime.getMillis(); } public void setDateTime(DateTime dateTime) { this.dateTime = dateTime; } public Double getTemperature() { return temperature; } public void setTemperature(Double temperature) { this.temperature = temperature; } @Override public void serialize(final JsonGenerator jgen, final SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartArray(); jgen.writeNumber(temperature); jgen.writeNumber(dateTime.getMillis()); jgen.writeEndArray(); } @Override public void serializeWithType(final JsonGenerator jgen, final SerializerProvider provider, final TypeSerializer typeSer) throws IOException, JsonProcessingException { typeSer.writeTypePrefixForArray(this, jgen); serialize(jgen, provider); typeSer.writeTypeSuffixForArray(this, jgen); } } Then the DataDeserializer class: import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessing…
has comment: http://stackoverflow.com/comment/33964895
has comment: http://stackoverflow.com/comment/33961809

http://stackoverflow.com/a/22365281
answers question: http://stackoverflow.com/q/22365066
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: The serialization mechanism is able to serialize an object without any readObject() and writeObject() methods. But it requires you to specify it objects can or can't be serialized. Some objects hold data, that it makes sense to serialize. Some others don't. For example, serializing a String makes sense, but serializing a Socket or a database Connection doesn't. So you simply mark which objects may be serialized by making their class implement the Serializable interface. If you want more control over the way the state of the object is serialized and deserialized, then you can use these two methods.
has comment: http://stackoverflow.com/comment/33997198
has comment: http://stackoverflow.com/comment/33997045

http://stackoverflow.com/comment/34231637
has text: Prob is jenkins executes everything in its own environment. It can't access the current one. It asks permission to show results (to show the windows that are created by jar. . .etc)
comment on: http://stackoverflow.com/a/22494657
score: 0
type: AnswerComment
type: Comment

windows
tags question: http://stackoverflow.com/q/22357516
tags question: http://stackoverflow.com/q/22356890
tags question: http://stackoverflow.com/q/22467060
tags question: http://stackoverflow.com/q/22412040
tags question: http://stackoverflow.com/q/22373515
tags question: http://stackoverflow.com/q/22360974
tags question: http://stackoverflow.com/q/22416301
tags question: http://stackoverflow.com/q/22457024
tags question: http://stackoverflow.com/q/22376838
tags question: http://stackoverflow.com/q/22434771
tags question: http://stackoverflow.com/q/22476795
tags question: http://stackoverflow.com/q/22412274
tags question: http://stackoverflow.com/q/22328908
type: Tag
tags question: http://stackoverflow.com/q/22373967
tag name: windows
tags question: http://stackoverflow.com/q/22416647
tags question: http://stackoverflow.com/q/22398116
tags question: http://stackoverflow.com/q/22342500
tags question: http://stackoverflow.com/q/22341470
tags question: http://stackoverflow.com/q/22441683

http://stackoverflow.com/comment/34047152
type: Comment
has text: I'm getting the error: Resource is not public. (at 'background' with value '@android:drawable/textfield_activated_holo_light').
comment on: http://stackoverflow.com/a/22394349
type: AnswerComment
score: 0

http://stackoverflow.com/a/22482338
has comment: http://stackoverflow.com/comment/35038902
type: Answer
has comment: http://stackoverflow.com/comment/34580358
answers question: http://stackoverflow.com/q/22481404
has comment: http://stackoverflow.com/comment/35054961
has comment: http://stackoverflow.com/comment/34203280
has comment: http://stackoverflow.com/comment/34204297
has body: You could use Android's built-in GestureDetector (http://developer.android.com/reference/android/view/GestureDetector.html). It will recognize shapes stored in a shape dictionary that you can ship with your app. You will have to seed the dictionary (although there may be some pre-defined alphabet dictionaries for free these days, this functionality has been around since API level 1). You can seed the dictionary by using your development environment and a utility to draw and save pre-defined shapes and map them to expected input. The GestureDetector APIs will give you a probabilistic match between what the detector recognizes vs. what is in the dictionary and you can determine what to do with the input shape. I have used this before in an old app and it works very well. Here's another link to the old Android Dev docs for it: http://docs.huihoo.com/android/2.1/resources/articles/gestures.html
has comment: http://stackoverflow.com/comment/34580081
has comment: http://stackoverflow.com/comment/35042018
has comment: http://stackoverflow.com/comment/34590130
score: 0

http://stackoverflow.com/comment/34087393
type: QuestionComment
has text: Does it have to be with regex? Couldn't you just use the provided `String` methods?
score: 0
comment on: http://stackoverflow.com/q/22417456
type: Comment

http://stackoverflow.com/q/22394674
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22394962
tagged with: radix-sort
type: UnansweredQuestion
has body: My program is meant to take in file in the current format with the top number being the max length of the words, the second number being the number of words that are there, and the rest being the numbers to be sorted. 4 10 437 1807 3218 1791 9058 9322 766 9977 16 7143 And then sort it so from lowest to highest. But every time i try to get it working i generally get the highest number in the first spot and the rest is just a jumbled mess. The final three for loops where meant to resemble this pseudo code: the first power of ten = 10; for each i up to the maximum number of digits+1 1. for each value v in the array, starting at position 0: a. isolate the “ith” digit from v (call this digit d) – use the current power of ten to do this b. add v to bin[d] 2. for each bin (that is, each bin[j], starting with j=0) a. while bin[j] is not empty i. remove the first value from bin[j] and copy it back into the next position in the array 3. Increase the power of ten to the next power of ten Any help would be appreciated. import java.io.*; import java.util.*; public class BinSort { public static void main(String[] args) throws FileNotFoundException { Scanner sc = new Scanner(new File(args[0])); int length = sc.nextInt(); int size = sc.nextInt(); int[] temp = new int[size]; sc.nextLine(); for(int i = 0;i &lt; temp.length;i++){ temp[i] = sc.nextInt(); } sort(temp,size,length); } public static void sort(int[] input, int length,int size){ ArrayList&lt;Integer&gt;[]bin=(ArrayList&lt;Integer&gt;[]) new ArrayList[10]; for(int i = 0;i&lt;length;i++){ bin[i] = new ArrayList&lt;Integer&gt;(); } int power = 10; for(int i = 0;i&lt;size+1;i++){ for(int v = 0;v&lt;input.length;v++){ int d = input[v] % power; if(power&gt;10) d = d/ (power/10); bin[d].add(input[v]); } for(int j = 0;j&lt;10;j++){ while(!bin[j].isEmpty()){ int temp = bin[j].get(0); bin[j].remove(0); input[j] = temp; } } power = power*10; } System.out.println("Final result"); System.out.println(Arrays.toString(input)); } }
type: Question
tagged with: java
tagged with: sorting
has title: Sorting program not sorting correctly

http://stackoverflow.com/a/22446604
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22446583
upvote count: 1
has comment: http://stackoverflow.com/comment/34139308
score: 1
has comment: http://stackoverflow.com/comment/34139299
has body: change this int length c; c = sqrt(a^(2)+b^(2)) to int length;

http://stackoverflow.com/comment/34056702
has text: @Thomas All needed libraries are there in the WEB-INF/lib folder.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22400176

http://stackoverflow.com/a/24870446
answers question: http://stackoverflow.com/q/22429807
has body: I had this problem because Eclipse AGE generates the listmethod as POST, then I care that method doing it a Get, then the client does not need send any post argument. That work for me. Some like this: @ApiMethod(name = "listPlaceIt",httpMethod = HttpMethod.GET) public CollectionResponse&lt;PlaceIt&gt; listPlaceIt( @Nullable @Named("cursor") String cursorString, @Nullable @Named("limit") Integer limit) { }
score: 0
type: Answer

http://stackoverflow.com/q/22458301
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/36822968
tagged with: java
has body: I'm trying to read a CSV file with the following characters: â/ô/etc. My code isn't parsing these characters well. I'm getting the � character/symbol instead of the real character. This is the code I'm using for reading the CSV file: private List&lt;String[]&gt; getRows(File f) throws IOException { //FileReader fileReader = new FileReader(f); InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(f), "UTF-8"); try { CSVReader reader = new CSVReader(inputStreamReader, ';'); try { return reader.readAll(); } finally { reader.close(); } } finally { inputStreamReader.close(); } } Who can help me? Thanks!
has comment: http://stackoverflow.com/comment/34158950
type: Question
has answer: http://stackoverflow.com/a/22460933
downvote count: 0
tagged with: http://stackoverflow.com/tag/csv
answer count: 1
linked to: http://stackoverflow.com/q/11612179
tagged with: utf-8
tagged with: opencsv
has title: OpenCSV CSVReader UTF-8 encoding
favorite count: 0
upvote count: 2

http://stackoverflow.com/a/22430692
answers question: http://stackoverflow.com/q/22430221
accepted answer of: http://stackoverflow.com/q/22430221
upvote count: 1
score: 1
has body: There is a similiar post available for character encoding in JAX-RS - How to set the charset with JAX-RS?
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34110365

http://stackoverflow.com/comment/34065731
has text: I did mean "checked vs. unchecked", thanks.
type: QuestionComment
comment on: http://stackoverflow.com/q/22405626
score: 0
type: Comment

http://stackoverflow.com/comment/33939575
has text: It is the method where I draw the image.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22332776
score: 0

http://stackoverflow.com/q/22357931
type: AnsweredQuestion
has title: How to inject autogenerated classes?
upvote count: 1
tagged with: web-services
tagged with: spring
type: Question
has body: I'm using CXF to autogenerate some webservice client classes. The result looks similar to: @WebServiceClient public class TheService extends Service { } So far I used these services with new TheService(), but as I'm using Spring now I'd like to also inject my autogenerated classes. It is obviously not a good idea to edit the generated classes as they might be regenerated in the future (eg on webservice updates). So I cannot annotate them eg with @Service. But how can I then use @Autowired private TheService service? Is it not possible?
has answer: http://stackoverflow.com/a/22359821
tagged with: java
answer count: 1
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22359821

http://stackoverflow.com/a/22385027
type: AcceptedAnswer
has body: You can do something like this (create a proxy method that will intercept the "old" calls and transfer them to the new method): @RequestMapping(value="/your-mapping", params = {"oldparam1", "oldparam2", ...}) public Whatever yourOldMethod(@RequestParam(value="oldparam1", required=true) String oldParam1, ...){ return yourNewMethod(oldParam1, ...); } @RequestMapping(value="/your-mapping", params = {"newparam1", "newparam1", ...}) public Whatever yourNewMethod(@RequestParam(value="newparam1", required=true) String oldParam1, ...){ //do whatever you need to do here } When you don't need to support the old calls, simply delete yourOldMethod. The beauty here, is using the "params" of @RequestMapping, thus allowing 2 methods to listen to the same "URL" (with different params for each)
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/34041628
downvote count: 0
score: 10
accepted answer of: http://stackoverflow.com/q/22365250
answers question: http://stackoverflow.com/q/22365250

http://stackoverflow.com/a/22420132
has comment: http://stackoverflow.com/comment/34092440
has comment: http://stackoverflow.com/comment/34092607
has comment: http://stackoverflow.com/comment/34091992
answers question: http://stackoverflow.com/q/22420115
has comment: http://stackoverflow.com/comment/34092550
has comment: http://stackoverflow.com/comment/34092584
has comment: http://stackoverflow.com/comment/34092492
has comment: http://stackoverflow.com/comment/34092451
score: 0
has comment: http://stackoverflow.com/comment/34092402
has comment: http://stackoverflow.com/comment/34093087
has comment: http://stackoverflow.com/comment/34092452
has comment: http://stackoverflow.com/comment/34092480
has comment: http://stackoverflow.com/comment/34091979
has comment: http://stackoverflow.com/comment/34092045
has body: Try this Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String filename ="D:\\Database for Mini Project\\Database21(example).mdb"; String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=D:\\Database for Mini Project\\Database21(example).mdb"; String b=request.getParameter("uname"); String c=request.getParameter("pass"); try { // connects to the database Connection con = DriverManager.getConnection( database ,"","")) { Statement s = con.createStatement(); String query="insert into A.ABC1(uname,pass) values(?,?); PreparedStatement statement = conn.prepareStatement(query); s.setString(1, b); s.setString(2, c); int row = s.executeUpdate(); if (row &gt; 0) { message = "Query executed"; } } catch (SQLException ex) { //catch ur msaccess exception..I use mysql message = "ERROR: " + ex.getMessage(); ex.printStackTrace(); } finally { if (con != null) { // closes the database connection try { con.close(); } catch (SQLException ex) { ex.printStackTrace(); } } I use mysql as my database..so wherever there is catch(SQLException ex) replace it with msaccess exception..
type: Answer

http://stackoverflow.com/comment/34020013
type: QuestionComment
score: 2
has text: Please post the stack trace that is being generated for this error.
comment on: http://stackoverflow.com/q/22379367
type: Comment

http://stackoverflow.com/comment/34120973
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22436815
type: QuestionComment
has text: The image is not an icon :) It actually a graph I draw by hand. And yes, I draw it by overriding paintComponent. I would edit a part of my code so you will easily see how it actually drawn on panel

http://stackoverflow.com/comment/34012914
type: Comment
has text: well, you need to copy ``changeImage`` body code from your BrowsePictureActivity into your fragment' s image ``onClick`` block, and copy the ``onActivityResult`` to the fragment, maybe some little syntac error, but it' s not hard to fix it.
comment on: http://stackoverflow.com/a/22374614
score: 0
type: AnswerComment

http://stackoverflow.com/q/22343953
type: Question
duplicate of: http://stackoverflow.com/q/467444
has answer: http://stackoverflow.com/a/22343981
has answer: http://stackoverflow.com/a/22344432
has answer: http://stackoverflow.com/a/22344960
has comment: http://stackoverflow.com/comment/33959696
has comment: http://stackoverflow.com/comment/33959231
tagged with: uuid
upvote count: 2
has comment: http://stackoverflow.com/comment/33960902
has body: I need to create alphanumeric unique IDs of length 7 or 10. Similar to the shorter version of Git commit IDs (7a471b2). I tried UUID, but the generated unique ID is longer than I need. Is there a built-in method / code snippet in Java that can help here?
downvote count: 1
has comment: http://stackoverflow.com/comment/33959212
has title: How to create a 7 characters of alphanumeric unique id?
tagged with: uniqueidentifier
tagged with: java
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/33959843
has comment: http://stackoverflow.com/comment/33959202
score: 1
linked to: http://stackoverflow.com/q/467444
has comment: http://stackoverflow.com/comment/33959875
favorite count: 0
has comment: http://stackoverflow.com/comment/33959410
has comment: http://stackoverflow.com/comment/33959251
has comment: http://stackoverflow.com/comment/33959470
has answer: http://stackoverflow.com/a/22344062

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

http://stackoverflow.com/comment/34130502
type: Comment
has text: One more question, I have got it down to 38000 empty buckets. How does that fair with 81,000 buckets to begin with and 61 thousand entries? Does that sound like a successful hash or is it not?
comment on: http://stackoverflow.com/a/22441445
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34051042
score: 1
comment on: http://stackoverflow.com/q/22396336
has text: @JasonC:now i mention 116 and i did comment ** pictureList.remove(s1); //this is line no 116**.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34025855
comment on: http://stackoverflow.com/a/22382669
score: 0
type: AnswerComment
type: Comment
has text: yep you were right, it works. I did with String.equals() because we told me to this when I compare with a String. Never mind, thanks.

http://stackoverflow.com/comment/34168412
type: Comment
has text: I have updated my code to access `value` element present under `distance` element
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22463384

http://stackoverflow.com/q/22457761
score: 0
has answer: http://stackoverflow.com/a/22457822
answer count: 5
has answer: http://stackoverflow.com/a/22458323
type: UnansweredQuestion
has title: How to invoke methods on an ArrayList
tagged with: methods
has comment: http://stackoverflow.com/comment/34158081
has answer: http://stackoverflow.com/a/22457915
has answer: http://stackoverflow.com/a/22458218
has comment: http://stackoverflow.com/comment/34158197
type: Question
has answer: http://stackoverflow.com/a/22458075
has comment: http://stackoverflow.com/comment/34158251
tagged with: java
tagged with: class
upvote count: 1
downvote count: 1
has body: I'm building a little deck of cards class using an ArrayList. My problem I'm running into is that when I try to invoke my Deck method to populate the list, I'm getting a Cannot Find Symbol. Code below. package deckofcards; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; class Deck{ ArrayList&lt;String&gt; al = new ArrayList&lt;String&gt;(); //test method public void main(String[] args){ Scanner input = new Scanner(System.in); int choice = 9; al.Deck(); //&lt;--Right here is the problem, it gives Cannot Find Symbol //Symbol: method Deck() Location: variable al of type //ArrayList&lt;String&gt; while(choice != 0){ System.out.println("Shuffle - 1 Display - 2 Exit - 0:"); //didn't finish since it gave an error } } private void Shuffle(){ Collections.shuffle(al); } private void Deck(){ al.add(0, "Ace of Spades"); al.add(1, "Two of Spades"); al.add(2, "Three of Spades"); //yadaa yadaa yadaa I simply cannot figure out how to properly invoke my methods on the list. Does anyone know what I'm doing wrong? NOTE: this is a secondary class file, the main class file of the package will simply contain the main test method.
favorite count: 0
tagged with: arraylist

http://stackoverflow.com/comment/33988747
type: Comment
has text: IEDriver initialization added.
comment on: http://stackoverflow.com/q/22338609
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34226323
type: AnswerComment
has text: Thanks for your update. WE used following approach1. Put all the required css inlined to the html in a style tag, create all the default css classes inlined. 2. Use ng-class to load the default inlined css on the component. 3. Load all the user interface settings from database in angularjs controller. 4. Replaced the properties value of the default inlined css class with the project specific css values using ng-style.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22472775

http://stackoverflow.com/q/22391901
has answer: http://stackoverflow.com/a/22392006
accepted answer: http://stackoverflow.com/a/22392006
upvote count: 1
has body: Broadly speaking there are 4 steps involved in embedding a message using DCT: Divide the image into 8x8 blocks Transform each block using DCT mathematical operations Quantitize each DCT block (lossy compression) Embed the message bits from the quantitized coefficients (avoid 0, 1, -1, and the AC) Thats ok, but I am not sure how to extract the data back out. Are you suppose to go through steps 1-3 to quantitize each block in order to extract the LSB of each coefficient? If that's the case, would you not be losing (possible the embedded data) data because it is a lossy technique? Also when I tried to quantitize each block, I am left with the same coefficients from the previous image (as in the LSB change had no effect) ?? Could someone enlighten me on this problem? Thanks
possible better answer: http://stackoverflow.com/a/22392076
favorite count: 0
tagged with: dct
tagged with: http://stackoverflow.com/tag/jpeg
tagged with: text
has title: Steganography using the DCT
type: AnsweredQuestion
tagged with: steganography
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22392076
type: Question
answer count: 2

http://stackoverflow.com/q/22440984
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34128905
has title: Using override method from two classes
has comment: http://stackoverflow.com/comment/34128961
has comment: http://stackoverflow.com/comment/34128884
has comment: http://stackoverflow.com/comment/34129062
has comment: http://stackoverflow.com/comment/34129109
has answer: http://stackoverflow.com/a/22441058
tagged with: tostring
accepted answer: http://stackoverflow.com/a/22441058
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34128957
tagged with: java
tagged with: methods
has body: I gott two toString() and want to print them both, by calling only one of them. I must have objects of class1 as Array and class2 as ArrayList. Main: public static void main(String[] args) { Main main = new Main(); Class1 []class1 = new Class1[2]; ArrayList&lt;Class2&gt; class2List = new ArrayList&lt;Class2&gt;(); for(int i=0; i&lt;class1.length; i++){ class1[i] = getClass1Obj(); class2List.add(getClass2Obj()); } for(int i=0; i&lt;class1.length; i++){ printClass1(class1, i); } } public static void print(Class1[] cls1, int index){ System.out.println(cls1[index].toString()); } Class1: private Class2 class2; @Override public String toString() { return getMethod() + getMethod2() + class2.toString(); } Class2: @Override public String toString() { return getMethod3() + getMethod4(); } This doesn't work. May it be because of the way I create the different objects?
has comment: http://stackoverflow.com/comment/34128971
type: Question
has comment: http://stackoverflow.com/comment/34128883
has comment: http://stackoverflow.com/comment/34128888
tagged with: arrays
tagged with: arraylist

http://stackoverflow.com/a/22425065
type: Answer
answers question: http://stackoverflow.com/q/22424879
score: 0
has body: if(fis.read()!=44) System.out.print((char)fis.read()); You call read() twice, so 2 characters will be read and your code prints only the second character. That's why you are wondering about but after comparing the character for a comma it points to the next character That gives the clou: int readChar; if((readChar = fis.read()) != 44) System.out.print((char)readChar);

http://stackoverflow.com/comment/34029824
score: 0
comment on: http://stackoverflow.com/q/22384503
type: Comment
type: QuestionComment
has text: @PabloLozano `home/non-admin/jdk1.7.0_02/`

http://stackoverflow.com/q/22429589
has answer: http://stackoverflow.com/a/22429655
tagged with: java
type: Question
has title: How convert table into string?
tagged with: string
has answer: http://stackoverflow.com/a/22429658
favorite count: 0
score: 0
has body: I want to convert table into one string: int y [] = {30, 34, 45, 57, 77, 89, 100, 111, 123, 145}; Must be something as this: String y = 30, 34, 45, 57, 77, 89, 100, 111, 123, 145; Far code: public class GraphLoading extends Activity { public static int [] y; int Test; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.loading); int y [] = {30, 34, 45, 57, 77, 89, 100, 111, 123, 145}; } public static int[] x = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; } I must convert that tablo into string then I can save it into SD card. Please can you paste full code? (I am amateur)
possible better answer: http://stackoverflow.com/a/22429647
tagged with: android
has answer: http://stackoverflow.com/a/22429647
has comment: http://stackoverflow.com/comment/34108172
answer count: 4
has answer: http://stackoverflow.com/a/22429706
has comment: http://stackoverflow.com/comment/34108181
accepted answer: http://stackoverflow.com/a/22429658
upvote count: 1
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/22430279
score: 0
has comment: http://stackoverflow.com/comment/34109892
has comment: http://stackoverflow.com/comment/34109852
type: Answer
answers question: http://stackoverflow.com/q/22429967
has body: I'm not sure if I understand the format of your input string. Does this example solve your problems? public static void main(String args[]) throws Exception { String input = "925"; int parsed = Integer.parseInt(input); parsed *= 3; System.out.println(parsed); // prints 2775 }

http://stackoverflow.com/comment/33978052
type: Comment
comment on: http://stackoverflow.com/q/22354420
has text: Just a few tests -- most of the test cases are positive but a few are to verify error handling. Ideally, if a positive test case goes wrong, I should see errors in the test logs, so I'd like to not *totally* disable logging during test execution
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33999731
score: 0
comment on: http://stackoverflow.com/a/22366846
type: Comment
has text: Hello! I get this error: - WiFi.ino: In function 'void loop()': WiFi:54: error: invalid operands of types 'char [10]' and 'int' to binary 'operator*' WiFi:60: error: incompatible types in assignment of 'int' to 'char [10]'
type: AnswerComment

http://stackoverflow.com/q/22399471
downvote count: 0
tagged with: websocket
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/22400367
has comment: http://stackoverflow.com/comment/34055208
score: 4
tagged with: java
has title: Apache Tomcat websockets implementation on localhost
has comment: http://stackoverflow.com/comment/34055550
has body: I am trying to learn websockets. Tried a few examples given on apache tomcat 7 websockets examples -> 'http://tomcat.apache.org/tomcat-7.0-doc/web-socket-howto.html'. I'm done with the client-side code. having a problem with the server-side one which is to be written in a java servlet. I tried to run the examples on my localhost using eclipse and Apache Tomcat 7.0.52. Can anyone help me with some tutorials and examples for the server code. Here is the client side code for a simple echo server: var wsUri = "ws://echo.websocket.org/"; var output; function init() { output = document.getElementById("output"); $('‪#‎send‬').click(function(){ doSend("ja ghari"); }); testWebSocket(); } function testWebSocket() { websocket = new WebSocket(wsUri); websocket.onopen = function(evt) { onOpen(evt);}; websocket.onclose = function(evt) { onClose(evt) ;}; websocket.onmessage = function(evt) { onMessage(evt) ;}; websocket.onerror = function(evt) { onError(evt) ;}; } function onOpen(evt) { writeToScreen("CONNECTED"); doSend("WebSocket rocks"); } function onClose(evt) { writeToScreen("DISCONNECTED"); } function onMessage(evt) { writeToScreen('RESPONSE: ' + evt.data+''); } function onError(evt) { writeToScreen('ERROR: ' + evt.data); } function doSend(message) { writeToScreen("SENT: " + message); websocket.send(message); } function writeToScreen(message) { var pre = document.createElement("p"); pre.style.wordWrap = "break-word"; pre.innerHTML = message; output.appendChild(pre); } window.addEventListener("load", init, false); now i need to write a server side code in java for this I need a server which will communicate with my client using websockets Apache Tomcat 7 or above is a must, server side code to be written in java. Thanks in advance.
type: UnansweredQuestion
tagged with: tomcat
tagged with: servlets
upvote count: 4
answer count: 1

http://stackoverflow.com/q/22343690
score: 5
upvote count: 5
tagged with: yui-compressor
has title: YUI compressor 2.48 windows path error
has comment: http://stackoverflow.com/comment/33969232
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/36277515
has comment: http://stackoverflow.com/comment/33968994
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33969109
has comment: http://stackoverflow.com/comment/33973083
has body: I am using YUI compressor to compress js file, but while passing the full path on Windows7 it is giving error java -jar c:\yui\yuicompressor-2.4.8.jar c:\js\CCOM.js -o c:\js\CCOMA.js gives Error as follows java.io.FileNotFoundException: yuiCCOMA.js:\yui\CCOM.js (The filena me, directory name, or volume label syntax is incorrect) the jar and source file do exist and it works fine when I run it directly from source directory
tagged with: java
has answer: http://stackoverflow.com/a/29697652
type: Question
tagged with: yui

http://stackoverflow.com/comment/34072890
score: 0
comment on: http://stackoverflow.com/q/22396501
type: Comment
type: QuestionComment
has text: @nablex: html but i think some other type of xml parse would work? possibly jsoup as well?

http://stackoverflow.com/comment/33962279
has text: Any reason you've avoided the `Map` and gone with `Parallel Arrays`?
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22345699

http://stackoverflow.com/comment/33944903
has text: Also I tried printing a string "test" after pst.executeUpdate();. It didn't print. Which I think means that this particular connection is runnning into problems not some other
comment on: http://stackoverflow.com/a/22335333
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22418221
has answer: http://stackoverflow.com/a/22447529
accepted answer: http://stackoverflow.com/a/22447529
score: 0
has body: The xmlpullparser doesn't read my second tag term. It always iterates two times: the first time, the inner tag is correctly identified as appname, but the second time, it's null. public static List readConfig(XmlPullParser parser) throws XmlPullParserException, IOException { List terms = null; parser.require(XmlPullParser.START_TAG, ns, "app"); while (parser.next() != XmlPullParser.END_TAG) { if (parser.getEventType() != XmlPullParser.START_TAG) { continue; } String innerTag = parser.getName(); if (innerTag.equals("appname")) { Logger.log("2"); } else if (innerTag.equals("term")) { // terms = readTerm(parser); Logger.log("1"); } } return terms; } My xml File <?xml version="1.0" encoding="UTF-8"?> abdalla term1 the exception Caused by: java.lang.NullPointerException: asset at android.content.res.AssetManager.getAssetRemainingLength(Native Method) at android.content.res.AssetManager.access$300(AssetManager.java:36) at android.content.res.AssetManager$AssetInputStream.available(AssetManager.java:555) at java.io.InputStreamReader.read(InputStreamReader.java:234) at org.kxml2.io.KXmlParser.fillBuffer(KXmlParser.java:1496) at org.kxml2.io.KXmlParser.readValue(KXmlParser.java:1340) at org.kxml2.io.KXmlParser.next(KXmlParser.java:390) at org.kxml2.io.KXmlParser.next(KXmlParser.java:310) at model.XMLParser.readConfig(XMLParser.java:55) at com.example.xmlparser.MainActivity.onCreate(MainActivity.java:47) at android.app.Activity.performCreate(Activity.java:5133)
answer count: 1
tagged with: android
type: AnsweredQuestion
has title: XmlPullParser object doesnt read my second tag
tagged with: java
type: Question

http://stackoverflow.com/q/22426827
has comment: http://stackoverflow.com/comment/34102998
has comment: http://stackoverflow.com/comment/34103053
tagged with: comparator
answer count: 1
has comment: http://stackoverflow.com/comment/34103423
has body: I have this comparator that compares the marks of each subjects overal mark and sorts them from highest to lowest. the only problem is that the subject List is bound within a student object. so for each student there are many subjects. the overal marks are of type double. the comparator isnt working desired. public class RankComparator implements Comparator&lt;Subject&gt; { @Override public int compare(Subject s1, Subject s2) { if (s1.getoveralMark() &lt; s2.getoveralMark()) return -1; if (s1.getoveralMark() &gt; s2.getoveralMark()) return 1; return 0; } } UPDATE : I have added the following code but its still not sorting the subjects by highest overalMark. for (Student student : studentList) { // if (subj.subjectName.contains("English")) { for (Subject subj : student.subject) { Collections.sort(student.subject, new RankComparator()); System.out.println(subj.overalMark); } Collections.sort(studentList, compareByAllSubjects()); for (Student student : studentList) { System.out.println(student.firstName); for (Subject subk : student.subject) { System.out.println(subk.subjectName); System.out.println(subk.overalMark); } } // } } private static Comparator&lt;Student&gt; compareBySubject(final int index) { return new Comparator&lt;Student&gt;() { @Override public int compare(Student student0, Student student1) { Subject subject0 = student0.subject.get(index); Subject subject1 = student1.subject.get(index); if (subject0.getSubjectName() == subject1.getSubjectName()) { double mark0 = subject0.getoveralMark(); double mark1 = subject1.getoveralMark(); return Double.compare(mark0, mark1); } return 0; } }; } private static double computeMaxMark(List&lt;Subject&gt; subjects) { double max = -Double.MAX_VALUE; for (Subject subject : subjects) { max = Math.max(max, subject.getoveralMark()); } return max; } private static Comparator&lt;Student&gt; compareByAllSubjects() { return new Comparator&lt;Student&gt;() { @Override public int compare(Student student0, Student student1) { doub…
has comment: http://stackoverflow.com/comment/34102991
has comment: http://stackoverflow.com/comment/34103232
type: UnansweredQuestion
has title: Comparator not comparing values correctly
has answer: http://stackoverflow.com/a/22427163
has comment: http://stackoverflow.com/comment/34103038
has comment: http://stackoverflow.com/comment/34103142
tagged with: list
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34103146
type: Question
has comment: http://stackoverflow.com/comment/34103078

http://stackoverflow.com/a/22443681
has comment: http://stackoverflow.com/comment/34134282
score: 1
has body: Scanner s = new Scanner(System.in); Employee[] arrayOfEmp = new Employee[2]; //Fields public int index; public int addRecord(int index){ //Add method while(index&lt;arrayOfEmp.length){ Employee e = new Employee(); System.out.println("Please enter Employee Id : "); e.setEmployeeId(Integer.parseInt(s.nextLine())); System.out.println("Please enter Employee Name : "); e.setName(s.nextLine()); this.arrayOfEmp[index++]=e; return index; } to invoke it please use index = addRecord(index); then your variable index will be updated by local index var in method. s.next() changed to nextLine()
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22443626
type: Answer

http://stackoverflow.com/comment/37485074
type: Comment
comment on: http://stackoverflow.com/a/24251078
type: AnswerComment
has text: I installed a driver for my HP scanner (which is flat and batch scanner). when I go to my applet, I found two available sources for the same HP device. One of them cause exactly the issue you mentioned, the other one worked fine
score: 0

http://stackoverflow.com/q/22333412
has answer: http://stackoverflow.com/a/22333508
has answer: http://stackoverflow.com/a/22333562
has comment: http://stackoverflow.com/comment/33940458
tagged with: java
upvote count: 1
has body: I have a method in my project given below: public String fillsubject(String id,int type){ if(id.isEmpty()) return ""; String result=""; String query="select sub_name from subject where sub_id='"+id+"'"; if(type==1) query="select lab_name from lab where lab_id='"+id+"'"; try { ResultSet rs2=st2.executeQuery(query); rs2.first(); result=rs2.getString(1); rs2.close(); } catch (Exception ex) { JOptionPane.showMessageDialog(this, ex); } return result; } I am calling it as written below.. try { rs = st.executeQuery("Select sub1,sub2,sub3,sub4,sub5,sub6,sub7,lab1,lab2,lab3,class_id from class where standard='" + jComboBox32.getSelectedItem().toString() + "' and section='" + jComboBox26.getSelectedItem().toString() + "';"); rs.first(); jTextField39.setText(fillsubject(rs.getString(1),0)); jTextField32.setText(fillsubject(rs.getString(2),0)); jTextField33.setText(fillsubject(rs.getString(3),0)); jTextField40.setText(fillsubject(rs.getString(4),0)); jTextField35.setText(fillsubject(rs.getString(5),0)); jTextField41.setText(fillsubject(rs.getString(6),0)); jTextField38.setText(fillsubject(rs.getString(7),0)); jTextField37.setText(fillsubject(rs.getString(8),1)); jTextField34.setText(fillsubject(rs.getString(9),1)); jTextField36.setText(fillsubject(rs.getString(10),1)); jLabel198.setText(rs.getString(11)); } catch (SQLException e) { JOptionPane.showMessageDialog(DeleteStudent, e); } the problem is when calling rs.getString(), it sometimes have null value in database. In this situation i get an nullpointer exception in fillsubject() method. now my question is how do i tackle with this problem. Thanks in advance.
answer count: 4
has answer: http://stackoverflow.com/a/22333516
has comment: http://stackoverflow.com/comment/33940510
has comment: http://stackoverflow.com/comment/33940503
tagged with: nullpointerexception
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22333591
has title: NullPointerException in calling a Method in java
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33940441
possible better answer: http://stackoverflow.com/a/22333508
type: Question
accepted answer: http://stackoverflow.com/a/22333516

http://stackoverflow.com/comment/81198099
comment on: http://stackoverflow.com/a/22397903
type: Comment
score: 1
has text: If accept your point #1, then all objects should be immutable.
type: AnswerComment

http://stackoverflow.com/comment/34023823
score: 0
type: Comment
type: QuestionComment
has text: Sorry @Dukeling, I figured that'd be the case, but my attempts weren't worth posting given my extremely limited experience with regex, but that's why I post here, to try to get that sorted out. Think I pretty much destroyed my attempts prior to this post.
comment on: http://stackoverflow.com/q/22380682

http://stackoverflow.com/comment/76467113
comment on: http://stackoverflow.com/a/22463063
type: AnswerComment
type: Comment
score: 2
has text: Don't forget the uppercase on MM

http://stackoverflow.com/comment/34178134
comment on: http://stackoverflow.com/q/22462551
score: 0
has text: UPDATE: The button I'm trying to render uses a NinePatch and if I set all the padding/splitting to 0 then the picture renders nicely inside the box but the font is still messed up and huge. There doesn't seem to be a good reason for the pixel areas describing how to scale a NinePatch image to be coupled with the grid I set up in my stage. Given that my picture is rendering fine (i.e. 1 pixel != 1 unit) I don't see why the button should be any different...
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22431966
has body: If you want to use random integers: double sum = 0; for (int i=0; i&lt;n; i++) { sum += random.nextInt(); } double average = sum/n; Otherwise check out the Javadoc on Random for other means of generating random numbers i.e. within a range etc.
downvote count: 0
answers question: http://stackoverflow.com/q/22431939
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/22371464
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22371287
type: Answer
has body: If you are clear that protected member can't accessed outside package without subclass then It doesn't matter where are you creating Nee class object to access its protected method either in its subclass or any where else. Its same thing. Only subclass know about protected member and can be accessed via subclass object.
downvote count: 0

http://stackoverflow.com/comment/34127052
type: QuestionComment
comment on: http://stackoverflow.com/q/22439098
score: 0
has text: @ThomasBroyer Yes they are exactly the same project and were deployed the same way. I'm using a shared tomcat instance and I don't have access to the log.
type: Comment

http://stackoverflow.com/q/22397762
answer count: 1
has answer: http://stackoverflow.com/a/22398247
accepted answer: http://stackoverflow.com/a/22398247
favorite count: 0
upvote count: 5
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34052482
downvote count: 0
tagged with: java
has title: Oracle JDK and OpenJDK in production environment
has body: Is it possible to change from Oracle JDK to OpenJDK in production environment specially for JAVA EE applications?
type: Question
score: 5

http://stackoverflow.com/a/22448805
has body: You must look at this Automation rules and best practices page. Automated retweeting of other users We discourage the automatic retweeting of other users based on a particular keyword and may suspend accounts that engage in this behavior, particularly if they are being frequently blocked and reported as spam. Btw, i guess you must give some function like sleep() to delay for every re-tweet.
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22446492
upvote count: 1

http://stackoverflow.com/comment/34026316
has text: Does it change anything if you set `android:clickable="true"` in the control's properties?
comment on: http://stackoverflow.com/q/22382774
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33989064
type: Comment
has text: hmmm but my xml does have a namespace qualification... as I posted. but you are right, if I remove the namespace from `package-info.java` then it works fine.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22361076

http://stackoverflow.com/a/22437062
has comment: http://stackoverflow.com/comment/34121480
accepted answer of: http://stackoverflow.com/q/22436611
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34123065
type: Answer
answers question: http://stackoverflow.com/q/22436611
has body: Your getCodeBase() checks in the Bin folder of your project. So make sure your file that you want to play is present in the Bin folder. I tested it with the following code: import java.applet.AudioClip; import javax.swing.JApplet; @SuppressWarnings("serial") public class audioPlayer extends JApplet{ AudioClip aClip; public void init(){ System.out.print("Getting audio clip!"); aClip = getAudioClip(getCodeBase(), "tetris.wav"); System.out.print("Looping audio clip!"); aClip.loop(); } } The code above works perfectly fine and plays the sound perfectly.
score: 0

http://stackoverflow.com/comment/33964704
comment on: http://stackoverflow.com/a/22343429
score: 0
type: AnswerComment
type: Comment
has text: When you check web service at that time response is null or not.

http://stackoverflow.com/comment/34423383
comment on: http://stackoverflow.com/a/22404765
type: AnswerComment
score: 0
has text: He can use the assets folder rather than res (and its a better batch) (just to correct the typo in answer above) this isn't under res but admittedly doesn't address his "want".
type: Comment

http://stackoverflow.com/comment/34189848
score: 0
type: Comment
type: QuestionComment
has text: @BoristheSpider while testing they are in project directory, but for security concerns, I wan't to move them out of /webapp directory at all
comment on: http://stackoverflow.com/q/22476092

http://stackoverflow.com/comment/33959277
has text: Sorry @leigero but that explanation is actually wrong. The two images, `1` and `2` are drawn, one after the other but never get removed and thus the statement that the display time for `image2` is "short" is false. The real reason is in both mine and peeskillet's answers
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22343512
type: AnswerComment

http://stackoverflow.com/q/22389235
has answer: http://stackoverflow.com/a/22389483
linked to: http://stackoverflow.com/q/22360709
tagged with: java
score: 0
has body: Here's the error I'm receiving. Caused by: java.lang.IllegalStateException: Cannot convert value of type [code.ProductFieldSetMapper] to required type [org.springframework.batch.item.file.mapping.FieldSetMapper] for property 'FieldSetMapper': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:264) at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:450) ... 23 more Here's my context file (FileReaderConfig.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:batch="http://www.springframework.org/schema/batch" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd"> <chunk reader="reader" writer="writer" commit-interval="100" /> Here's the interface (FieldSetMapper.java) package code; import org.springframework.batch.item.file.transform.FieldSet; import org.springframework.validation.BindException; public interface FieldSetMapper<T> { T mapFieldSet(FieldSet fieldSet) throws BindException; } Here's ProductFieldSetMapper.java package code; import org.springframework.batch.item.file.transform.FieldSet; import org.springframework.validation.BindException; public class ProductFieldSetMapper implements FieldSetMapper<Product> { public Product mapFieldSet(FieldSet fieldSet) throws BindException { // TODO Auto-generated method stub Product product = new Product(); product.setId(fieldSet.readString("PRODUCT_ID")); product.setName(fieldSet.readString("NAME")); product.setDescription(fieldSet.readString("DESCRIPTION")); product.setPrice(fieldSet.readBigDecimal("PRICE")); return product; } } And here's the class that I'm running (Runner.java) package code; import org.omg…
answer count: 3
has title: IllegalStateException: Cannot convert value of type to required type
tagged with: spring-batch
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/22389711
has answer: http://stackoverflow.com/a/22391237
type: Question

http://stackoverflow.com/comment/34097935
has text: apke connection me koi problem ya connection string or other if u provide ur connection string then..
comment on: http://stackoverflow.com/a/22423104
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34071439
type: Comment
has text: Hmm but from what I understand is that I need to include that in order to implement the WebApplicationInitializer. `javax.servlet.ServletContext` is passed as a parameter to `onStartup(ServletContext ctx){}`
type: AnswerComment
comment on: http://stackoverflow.com/a/22406156
score: 0

http://stackoverflow.com/comment/34128033
type: Comment
type: QuestionComment
score: 2
has text: @Mauren I'm so thankful for debuggers!
comment on: http://stackoverflow.com/q/22440231

http://stackoverflow.com/a/22424833
has comment: http://stackoverflow.com/comment/34099849
type: Answer
score: 2
downvote count: 0
has body: Your code looks good.Whats your doubt? try this, n1 is the NodeList for(int i=0;i&lt;nl.getLength();i++){ Node n=nl.item(i); if(n.getNodeType()==Node.ELEMENT_NODE){ System.out.println(n.getNodeName()+"\t"+n.getTextContent()); } }
answers question: http://stackoverflow.com/q/22424712
upvote count: 2
has comment: http://stackoverflow.com/comment/34099689

http://stackoverflow.com/comment/34065755
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22380848
type: QuestionComment
has text: It sounds to me as if you have a static variable for velocity that is shared between bullets and the player when it shouldn't be. Is velocity declared as static in your 'bob' class?

http://stackoverflow.com/comment/34156857
type: Comment
comment on: http://stackoverflow.com/a/22436401
score: 0
type: AnswerComment
has text: Good explaination Ralph. Just to add, keep business layer into parent-context and delegate web-fronted to outer-context(DispathcerServlet Context).

http://stackoverflow.com/q/22367836
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34001430
accepted answer: http://stackoverflow.com/a/22368564
possible better answer: http://stackoverflow.com/a/22368366
type: AnsweredQuestion
has body: I am trying to read a file and take commands depending on what each line of the file says. The file looks like this: Add saw cutting tool Add yen a monetary unit Add pan a dish List public void Load(String fileName) throws FileNotFoundException{ BufferedReader r = new BufferedReader (new FileReader(fileName)); Scanner sc = new Scanner(r); while(sc.hasNextLine()){ while(sc.hasNext()){ String temp =sc.nextLine(); **if(temp.startsWith("Add")){ String word = sc.next().toLowerCase(); String def = sc.nextLine().toLowerCase(); Add(word, def);** }else if(temp.equals("List")){ List(); } } } } It is printing: Add saw cutting tool Add yen a monetary unit Add pan a dish I want it to print out like: saw cutting tool yen a monetary unit pan a dish I know that the problem isn't in the print. The problem is in the ** above. Any suggestions on how I can fix this?
has answer: http://stackoverflow.com/a/22368366
tagged with: java.util.scanner
score: 1
tagged with: java
has title: Commands from file
tagged with: file
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22368564
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/34001291
answer count: 2

http://stackoverflow.com/q/22478974
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34203915
has title: Delete in Java?
has answer: http://stackoverflow.com/a/22479084
has comment: http://stackoverflow.com/comment/34195083
has body: I am making a project and I have some problems. I got a Flight class like this : public class Flight implements Cloneable { private String idFlight; private Horaire hourFlight; private String city; private static Vector&lt;Flight&gt; flights = new Vector&lt;Flight&gt;(); private Hashtable&lt;Integer,Task&gt; tasks = new Hashtable&lt;Integer,Task&gt;(); private Plane thePlane; ... and I have a static method "cancelFlight" like this : public static void cancelFlight(String idFlight){ Flight v=getFlight(idFlight); Iterator&lt;Task&gt; it = v.tasks.values().iterator(); while(it.hasNext) { it.remove(); } int index=flights.indexOf(v); flights.remove(index); But the tasks are also in a Hashtable of another class, Worker. private Hashtable&lt;Integer,Task&gt; tasks = new Hashtable &lt;Integer,Task&gt;(); So, what can I do ? Is there a method which is able to delete a instance of a class ? An other solution that I have is to create a method into the class Worker "removeFromTask(int idTask)" but it's so complicated ... :(
has comment: http://stackoverflow.com/comment/34194627
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34196595
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34196907
tagged with: hashtable
has comment: http://stackoverflow.com/comment/34203267
has comment: http://stackoverflow.com/comment/34195759
has comment: http://stackoverflow.com/comment/34195337
score: 1

mysql
tags question: http://stackoverflow.com/q/22476026
tags question: http://stackoverflow.com/q/22357194
tags question: http://stackoverflow.com/q/22447574
tags question: http://stackoverflow.com/q/22434068
tags question: http://stackoverflow.com/q/22328395
tags question: http://stackoverflow.com/q/22428120
tags question: http://stackoverflow.com/q/22351434
tags question: http://stackoverflow.com/q/22431831
tags question: http://stackoverflow.com/q/22480011
tags question: http://stackoverflow.com/q/22464974
tags question: http://stackoverflow.com/q/22400057
tag name: mysql
tags question: http://stackoverflow.com/q/22367323
tags question: http://stackoverflow.com/q/22439435
tags question: http://stackoverflow.com/q/22429871
tags question: http://stackoverflow.com/q/22483690
tags question: http://stackoverflow.com/q/22412234
tags question: http://stackoverflow.com/q/22414768
tags question: http://stackoverflow.com/q/22487688
tags question: http://stackoverflow.com/q/22397367
tags question: http://stackoverflow.com/q/22384710
tags question: http://stackoverflow.com/q/22346754
tags question: http://stackoverflow.com/q/22378556
tags question: http://stackoverflow.com/q/22381583
tags question: http://stackoverflow.com/q/22435292
tags question: http://stackoverflow.com/q/22440510
tags question: http://stackoverflow.com/q/22402904
tags question: http://stackoverflow.com/q/22389953
tags question: http://stackoverflow.com/q/22335572
tags question: http://stackoverflow.com/q/22481140
tags question: http://stackoverflow.com/q/22429877
tags question: http://stackoverflow.com/q/22471643
tags question: http://stackoverflow.com/q/22350106
tags question: http://stackoverflow.com/q/22341422
tags question: http://stackoverflow.com/q/22423194
tags question: http://stackoverflow.com/q/22384612
tags question: http://stackoverflow.com/q/22385191
tags question: http://stackoverflow.com/q/22436361
tags question: http://stackoverflow.com/q/22460204
tags question: http://stackoverflow.com/q/22403083
tags question: http://stackoverflow.com/q/22448377
tags question: http://stackoverflow.com/q/22399768
tags question: http://stackoverflow.com/q/22443964
tags question: http://stackoverflow.com/q/22363234
tags question: http://stackoverflow.com/q/22397714
tags question: http://stackoverflow.com/q/22433917
tags question: http://stackoverflow.com/q/22386764
tags question: http://stackoverflow.com/q/22474232
tags question: http://stackoverflow.com/q/22452654
tags question: http://stackoverflow.com/q/22358577
tags question: http://stackoverflow.com/q/22398277
tags question: http://stackoverflow.com/q/22356184
tags question: http://stackoverflow.com/q/22334215
tags question: http://stackoverflow.com/q/22422567
tags question: http://stackoverflow.com/q/22410117
tags question: http://stackoverflow.com/q/22445150
type: Tag
tags question: http://stackoverflow.com/q/22368801
tags question: http://stackoverflow.com/q/22364886
tags question: http://stackoverflow.com/q/22468364
tags question: http://stackoverflow.com/q/22433462
tags question: http://stackoverflow.com/q/22422974
tags question: http://stackoverflow.com/q/22481338
tags question: http://stackoverflow.com/q/22346197
tags question: http://stackoverflow.com/q/22387682
tags question: http://stackoverflow.com/q/22386571
tags question: http://stackoverflow.com/q/22385106
tags question: http://stackoverflow.com/q/22387890
tags question: http://stackoverflow.com/q/22448713
tags question: http://stackoverflow.com/q/22413437
tags question: http://stackoverflow.com/q/22342916
tags question: http://stackoverflow.com/q/22369857
tags question: http://stackoverflow.com/q/22418076
tags question: http://stackoverflow.com/q/22404000
tags question: http://stackoverflow.com/q/22389266
tags question: http://stackoverflow.com/q/22354922
tags question: http://stackoverflow.com/q/22383752
tags question: http://stackoverflow.com/q/22418027
tags question: http://stackoverflow.com/q/22381298
tags question: http://stackoverflow.com/q/22420744

http://stackoverflow.com/comment/34043248
comment on: http://stackoverflow.com/q/22392176
type: QuestionComment
has text: From the [Javadoc](http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#nextDouble()) _This method will throw InputMismatchException if the next token cannot be translated into a valid double value_. You need to catch the exception. Or better yet read the value as a `String` then parse it using `Double.parseDouble` after checking.
type: Comment
score: 0

http://stackoverflow.com/q/22340683
has comment: http://stackoverflow.com/comment/33953471
has title: File does not exist? Exception in thread "main" java.io.FileNotFoundException: - Java
has comment: http://stackoverflow.com/comment/33953500
has comment: http://stackoverflow.com/comment/33953612
downvote count: 0
accepted answer: http://stackoverflow.com/a/22340861
answer count: 3
has body: I'm working on a project for class and I'm attempting to create a method that will read a file and fill an array. Inside the method I'm also using another method called from a class I've created. I prompt the user to enter the file to be read and no matter what I seem to do I keep getting an error that the file does not exist. Here is the beginning code I'm working with: public static void main(String[] args) throws Exception { Scanner input = new Scanner(System.in); System.out.print("Enter the file to read from:"); String readFile = input.nextLine(); System.out.print("Enter the number of accounts in the file: "); int size = input.nextInt(); Account[] Accounts = readFile(readFile, size); Account[] invalidAccounts = new Account[34]; for (int i = 0; i &lt; Accounts.length; i++) { String password = Accounts[i].getPassword(); if (isValidPassword(password) == false) { invalidAccounts[i] = Accounts[i]; } } createDistributionList(invalidAccounts); } public static Account[] readFile(String readFile, int size) throws Exception { Account[] Accounts = new Account[size]; File myFile = new File(readFile); Scanner fileInput = new Scanner(myFile); for (int i = 0; i &lt; Accounts.length; i++) { int stuID = fileInput.nextInt(); String name = fileInput.next(); String username = fileInput.next(); String password = fileInput.next(); Accounts[i] = new Account(stuID, name, username, password); } return Accounts; } Here's the trace I'm getting if I use quotes: Enter the file to read from:"studentdata.txt" Enter the number of accounts in the file: 34 Exception in thread "main" java.io.FileNotFoundException: "studentdata.txt" (The filename, directory name, or volume label syntax is incorrect) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146) at java.util.Scanner.&lt;init&gt;(Scanner.java:656) at accountdriver.AccountDriver.readFile(AccountDriver.java:38) at accountdriver.AccountDriver.main(AccountDriver.java:25) Java Result: 1 A…
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/22341002
has comment: http://stackoverflow.com/comment/33954040
has answer: http://stackoverflow.com/a/22341002
has comment: http://stackoverflow.com/comment/33953483
upvote count: 1
has answer: http://stackoverflow.com/a/22340861
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27686766
type: Question
has comment: http://stackoverflow.com/comment/33953494
has comment: http://stackoverflow.com/comment/33953474
has comment: http://stackoverflow.com/comment/33953521
has comment: http://stackoverflow.com/comment/33953636
tagged with: filenotfoundexception

http://stackoverflow.com/a/22342633
has comment: http://stackoverflow.com/comment/33957139
score: 1
has comment: http://stackoverflow.com/comment/33957034
has body: You could install openjdk-7-jdk directly by apt-get install openjdk-7-jdk After that, you could use update-java-alternatives to set it as your default Java update-java-alternatives -l update-java-alternatives -s &lt;jname&gt;
has comment: http://stackoverflow.com/comment/33957256
upvote count: 1
has comment: http://stackoverflow.com/comment/33956875
type: Answer
answers question: http://stackoverflow.com/q/22342145
downvote count: 0

fonts
tags question: http://stackoverflow.com/q/22330683
type: Tag
tags question: http://stackoverflow.com/q/22392058
tags question: http://stackoverflow.com/q/22377730
tag name: fonts

http://stackoverflow.com/a/22386181
type: Answer
accepted answer of: http://stackoverflow.com/q/22385241
upvote count: 1
score: 1
has body: what i got from your question is that you wanted to do the whole task of managing user data along with the login ,registration and all the proecss using xml,JSON thats preety good to do. For that you need to chose java EE frame work . If you are a begineer then its better you start from jsp servelts and read for session.well session in simple words are used to store the present state of something for eg if a user is logged in then you can maintain his data in session variable like HttpSession session =request.getSession(true); session.setAttribute("usrname",username); Also you can set an object in this session object and get it used in any of your jsp page /servlet . after the user logout you can remove that session variables and invalidate you session so that the information is no longer saved in that and user cannot get back to that page.session is maintained through an id which used everywhere . also you can have look at this example for session http://www.roseindia.net/servlets/ListenerSession.shtml
has comment: http://stackoverflow.com/comment/34037394
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22385241

http://stackoverflow.com/comment/34282340
has text: Ok, looks like it is not possible to give developer and friends special access to the app. So i have added a check for the debug signature to check if the app is being started on a developer device.
type: QuestionComment
comment on: http://stackoverflow.com/q/22421648
score: 0
type: Comment

http://stackoverflow.com/q/22460065
has comment: http://stackoverflow.com/comment/34162078
has comment: http://stackoverflow.com/comment/34162032
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22460165
has comment: http://stackoverflow.com/comment/34162109
favorite count: 0
has title: Is it correct to use multiple OR conditions in one if statement, what are alternatives?
has comment: http://stackoverflow.com/comment/34162140
has body: I would like to know which way is more suitable and efficient in achieving something like: checking if text was entered in a field if(text1.equals(&quot;&quot;) || text2.equals(&quot;&quot;) || text3.equals(&quot;&quot;) || text4.equals(&quot;&quot;)) { //Do Stuff } I can see how this gets messy quickly with more than 2 fields, and would like to know if this is a correct way to do this, or do alternatives exist?
accepted answer: http://stackoverflow.com/a/22460165
upvote count: 1
possible better answer: http://stackoverflow.com/a/22460383
type: Question
has comment: http://stackoverflow.com/comment/34162086
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22460383
tagged with: conditional-statements
has comment: http://stackoverflow.com/comment/34162124
has comment: http://stackoverflow.com/comment/34162973
tagged with: if-statement
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34161984
has comment: http://stackoverflow.com/comment/34162035
has comment: http://stackoverflow.com/comment/34162039
has comment: http://stackoverflow.com/comment/34162544

http://stackoverflow.com/comment/34208290
type: AnswerComment
comment on: http://stackoverflow.com/a/22480084
type: Comment
has text: but how if the user that logged in has the id of 2 or 3.. how can i get their First_Name? if i do the WHERE condition ID to 1?
score: 0

http://stackoverflow.com/q/22475757
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34222253
has body: I am using selenium, Firefox driver. My Java code: List&lt;WebElement&gt; act = test.findAllElements(toBasketButton); assertTrue("ToBasket button not found", act != null); WebElement lastBtn = act.get(act.size()-1); assertTrue(lastBtn.isEnabled()); lastBtn.click(); I can see that the button I want to be clicked is focused (color is changed), however, further code is being executed without a click on lastBtn. Why is it so and how can I force this button to be clicked?
has title: Selenium. Button is focused, however, not clicked
has answer: http://stackoverflow.com/a/22475857
tagged with: java
tagged with: selenium
type: Question
tagged with: click
score: 0
has comment: http://stackoverflow.com/comment/34189267

http://stackoverflow.com/comment/34206408
score: 1
has text: @SuperUser I'm not sure "Forget about warnings" is a good message to send. Sure, often times they can be ignored but it is still good to know why you get them and which ones to worry about.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22485467

http://stackoverflow.com/comment/34102340
comment on: http://stackoverflow.com/q/22426398
has text: A JLabel is an ***object***. It is not "simply a representation of an image". Objects have references -- use them.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33956952
comment on: http://stackoverflow.com/a/22342578
type: Comment
score: 0
type: AnswerComment
has text: the value for [B@86fe26 is [-16, 120, -16, -128, -128, 112, -128, -16, -128, -8, 112, 120, -16, -128, -8, 120, -8, -16, 0, 112, -128, 0, -8, 0, -8, 0, 0, 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0....] as my byteArray size is 1024....

http://stackoverflow.com/a/22355629
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22355432
type: Answer
has body: There is no exception because type erasure removes any checking of the Integer type from your code. Since println takes Object the compiler doesn't need to insert a cast, and the code simply erases to: System.out.println(new Generic("one").type); Try the following assignment instead: Integer i = new Generic&lt;Integer&gt;("one").type; In that case you'll get a ClassCastException because the code erases to: Integer i = (Integer)new Generic("one").type; Notice that switching the types behaves differently. This will throw a ClassCastException: System.out.println(new Generic&lt;String&gt;(123).type); That's because the println(String) overload is used, so the code erases to: System.out.println((String)new Generic(123).type);
answers question: http://stackoverflow.com/q/22355432

http://stackoverflow.com/comment/33952310
comment on: http://stackoverflow.com/q/22339463
type: Comment
has text: @MadProgrammer I expect to get the output of 0,1,2, and 3 from the output, but instead I am receiving nothing.
type: QuestionComment
score: 0

http://stackoverflow.com/q/22420335
favorite count: 0
has answer: http://stackoverflow.com/a/34425592
upvote count: 6
possible better answer: http://stackoverflow.com/a/22420649
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22420649
accepted answer: http://stackoverflow.com/a/22420449
tagged with: java
type: Question
tagged with: jodatime
has body: say I have 110 seconds that I want to convert to 01:50 or 00:01:50 or such. How do I do that in joda-time? I load the number into Seconds but then toString is not doing the conversion for me.
score: 6
has title: convert joda-time seconds to formatted time string
answer count: 3
has answer: http://stackoverflow.com/a/22420449
downvote count: 0

javafx-2
tags question: http://stackoverflow.com/q/22435735
tags question: http://stackoverflow.com/q/22359521
tags question: http://stackoverflow.com/q/22432289
tags question: http://stackoverflow.com/q/22360258
type: Tag
tags question: http://stackoverflow.com/q/22413651
tags question: http://stackoverflow.com/q/22448331
tags question: http://stackoverflow.com/q/22465739
tags question: http://stackoverflow.com/q/22379022
tags question: http://stackoverflow.com/q/22390227
tags question: http://stackoverflow.com/q/22463004
tags question: http://stackoverflow.com/q/22392121
tags question: http://stackoverflow.com/q/22384518
tags question: http://stackoverflow.com/q/22414888
tags question: http://stackoverflow.com/q/22410269
tag name: javafx-2

http://stackoverflow.com/comment/54750638
type: QuestionComment
comment on: http://stackoverflow.com/q/22388029
score: 1
type: Comment
has text: I had the same issue. Upgrading to latest hibernate **5.0.2.Final** solved **java.io.StreamCorruptedException: invalid stream header** issue in my case

http://stackoverflow.com/q/22439436
has comment: http://stackoverflow.com/comment/100460438
answer count: 0
tagged with: classloader
upvote count: 3
type: UnansweredQuestion
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/34125758
has comment: http://stackoverflow.com/comment/34125837
type: Question
has body: I'm currently making a Java program that loads classes from a different package. It allows users to delete .class files from a package and prevent a crash. I therefore want to load all these classes using: Class.forName("this.is.a.package.RandomClass"); The only problem is that when I try that it says that the class is not found. If I put the class in the same package it works, but if I wanted to load it from the package "this.is.a" Class.forName("this.is.a.package.RandomClass"), it doesn't work. Any help appreciated! I know I should probably be using URLClassLoaders but I don't know how I would use them to load a file inside a zipped jar.
downvote count: 0
has title: Loading a class from a different package?
favorite count: 0
score: 3

http://stackoverflow.com/comment/34106454
score: 0
comment on: http://stackoverflow.com/a/22428375
type: AnswerComment
type: Comment
has text: @Tyler do you need the sequence or not? It runs much faster without copying the `ArrayList`

http://stackoverflow.com/q/22465537
has comment: http://stackoverflow.com/comment/34174363
has answer: http://stackoverflow.com/a/22465574
has comment: http://stackoverflow.com/comment/34172406
score: 0
tagged with: java
has body: I'm making a simple calculator (I'm a beginner), and I was wondering why when I divide 1 by 4, I get 0. I know it has something to do with the type of number. Here is my code: private static void calc(int a, int b,String op){ if (op.equals("add")){ double ans = a+b; System.out.println(ans); } if(op.equals("subtract")){ double ans=a-b; System.out.println(ans); } if(op.equals("multiply")){ double ans=a*b; System.out.println(ans); } if(op.equals("divide")){ double ans=a/b; System.out.println(ans); } } I can't get my variable (ans) to have more than one decimal spot. And when the answer requires one (like 1/4), it just returns 0. Help please.
answer count: 2
has answer: http://stackoverflow.com/a/22465791
has comment: http://stackoverflow.com/comment/34172697
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34172398
has comment: http://stackoverflow.com/comment/34172103
has title: How do I get more than one decimal spot?
type: Question

http://stackoverflow.com/comment/34073677
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22409614
has text: That hasn't gone as well as planned. That seemed to work on that server, however another server is now giving me no results same grep line single digit that does exist but the line doesn't pick it up
type: AnswerComment

http://stackoverflow.com/a/22338117
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22338063
has body: Based on how you're processing the get request on your server, it sounds like you want a named parameter in the ajax call that has the name "frameID". If that's the case, then the data line in your ajax call needs to change to this: $.ajax({ type: 'GET', url: 'localhost:8080/favoris', data: {"frameID": frameID} }); This will put it into the URL as localhost:8080/favoris?frameID=xxx and then your server side code request.getParameter("frameID"); can fetch it from the URL parameters. Also, in the future "did not work" isn't a very useful description for what happened which tends to make us have to guess what might be wrong. You should explain what you actually observed on the server and what debugging or diagnostic steps you took.

http://stackoverflow.com/comment/33953959
has text: Why does Piece extend JPanel? That seems like an interesting design choice.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22340967
score: 0

64-bit
tags question: http://stackoverflow.com/q/22415054
tag name: 64-bit
type: Tag

http://stackoverflow.com/q/22404592
answer count: 2
score: 2
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/22408719
has body: I am trying load .json files from resources so I can use them in unit tests. I have created a resources file and marked it as a ‘resources root’ directory, and placed my .json files within it. As the files are to be used for tests only, I do not wish to place them in the /res directory as it unnecessarily bloat the app. I am attempting to open the resources file with the following code, however inputStream returns as null. InputStream inputStream = Thread.currentThread().getContextClassLoader() .getResourceAsStream("file.json”); I have set the following in the .iml file that should denote the directory as resources but it seems to have had no effect. &lt;sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /&gt; Does anyone have any ideas where I maybe going wrong? Thanks in advance!
favorite count: 0
has comment: http://stackoverflow.com/comment/34423052
tagged with: android
tagged with: junit
has answer: http://stackoverflow.com/a/22404765
tagged with: android-studio
upvote count: 3
type: UnansweredQuestion
has title: Android Studio load file from resources
downvote count: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/34016475
type: AnswerComment
has text: So you mean I have to use `waiting.notifyAll()` instead of `this.notifyAll()`
type: Comment
comment on: http://stackoverflow.com/a/22377125
score: 0

http://stackoverflow.com/a/22721441
score: 1
has body: I evaluated picketlink and apache shiro. Picketlink is heavy for the application type I am developing. I finally used apache shiro. The tutorial from BalusC was very helpful. Apache Shiro, is it ready for Java EE 6? (a JSF2-Shiro Tutorial) and Securing Your ADF Applications Using Apache Shiro
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22402141
type: Answer

http://stackoverflow.com/comment/33951744
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22338393
has text: Okay, I've set the layout of w to a BorderLayout and added the sidepanel to the east, but still the tables are like this: http://gyazo.com/3b70239da9098d8a0694629299ad04ab
type: AnswerComment

http://stackoverflow.com/q/22452650
has body: I've started to work with Java Swing and I'm asking myself if it is possible to get elements on a generic JPanel, by Id or simply by name. I mean something like 'getElementById("example")', used in javascript. This is a little example, in pseudo-code of what I'd like to get: .... myButton = my_panel.getElementById("xxxxxxx"); // OR BY VARIABLE NAME myButton = my_panel.getElementByVariableName("xxxxxxx"); .... Is that possible in java?
type: Question
has answer: http://stackoverflow.com/a/22452886
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22452830
has comment: http://stackoverflow.com/comment/34149492
has answer: http://stackoverflow.com/a/22453179
favorite count: 0
type: UnansweredQuestion
has title: How can I find elements by name or id, on a JPanel?
upvote count: 1
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/34150759
tagged with: java
has comment: http://stackoverflow.com/comment/34150556
tagged with: jpanel
linked to: http://stackoverflow.com/q/4958600

http://stackoverflow.com/q/22392812
has title: Java org/objectweb/asm/ClassVisitor not found
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/34060274
score: 1
tagged with: rmi
tagged with: java
has answer: http://stackoverflow.com/a/22402815
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34056263
favorite count: 0
has comment: http://stackoverflow.com/comment/34056325
has body: I'm trying to run a project in Eclipse that uses java RMI, but when I run it, it gives me the following error: java.rmi.ServerError: Error occurred in server thread; nested exception is: java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor The asm-3.1.jar library is already in the project classpath and if I try to import the class org.objectweb.asm.ClassVisitor, it is correctly seen. Thus, the problem appears a runtime. Any suggestion? Thank you Edit (Eclipse classpath file): &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;classpath&gt; &lt;classpathentry kind="src" path="src"/&gt; &lt;classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/&gt; &lt;classpathentry kind="lib" path="lib/asm-3.1.jar"/&gt; &lt;classpathentry kind="lib" path="lib/asm-analysis-3.1.jar"/&gt; &lt;classpathentry kind="lib" path="lib/asm-commons-3.1.jar"/&gt; &lt;classpathentry kind="lib" path="lib/asm-tree-3.1.jar"/&gt; &lt;classpathentry kind="lib" path="lib/asm-util-3.1.jar"/&gt; &lt;classpathentry kind="lib" path="lib/asm-xml-3.1.jar"/&gt; &lt;classpathentry kind="lib" path="lib/commons-io-2.4.jar"/&gt; &lt;classpathentry kind="lib" path="lib/java-cup-11a.jar"/&gt; &lt;classpathentry kind="lib" path="lib/jdom.jar"/&gt; &lt;classpathentry kind="lib" path="lib/jmockit_B.jar"/&gt; &lt;classpathentry kind="lib" path="lib/jode-1.1.2-pre1.jar"/&gt; &lt;classpathentry kind="lib" path="lib/junit-4.6.jar"/&gt; &lt;classpathentry kind="lib" path="lib/junit-4.9b2.jar"/&gt; &lt;classpathentry kind="lib" path="lib/ModifiedClasses.jar"/&gt; &lt;classpathentry kind="lib" path="lib/tools.jar"/&gt; &lt;classpathentry kind="lib" path="lib/uispec4j-2.4-jdk16.jar"/&gt; &lt;classpathentry kind="lib" path="lib/uispec4j-jdk6-2.0.jar"/&gt; &lt;classpathentry kind="output" path="bin"/&gt; &lt;/classpath&gt;
has comment: http://stackoverflow.com/comment/34059656
has comment: http://stackoverflow.com/comment/34044332

http://stackoverflow.com/comment/34168909
comment on: http://stackoverflow.com/q/22463795
type: Comment
type: QuestionComment
score: 0
has text: What is the value type of the `HashMap`s inside the `HashMap` of `HashMap`s? Somewhere the chain must stop at a non-generic class.

http://stackoverflow.com/q/22391070
type: Question
answer count: 2
has title: Java program not receiving/sending information to/from server/client
score: 0
tagged with: sockets
has comment: http://stackoverflow.com/comment/34041326
has answer: http://stackoverflow.com/a/22391294
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34041757
has body: I'm trying to write a simple chat program with a server and a single client. I can connect them together just fine with port forwarding and they can each receive a single message. However, once they connect, I want to to be able to send and receive messages at the same time. For some reason this isn't happening at all. Here's my code. Client: // Client class public class Client { public static void main(String [] args) { // Get server name, port number, and username from command line String serverName = args[0]; int port = Integer.parseInt(args[1]); String username = args[2]; try { // Print welcome message and information System.out.println("Hello, " + username); System.out.println("Connecting to " + serverName + " on port " + port); // Create the socket Socket client = new Socket(serverName, port); // Print connected information System.out.println("Just connected to " + client.getRemoteSocketAddress()); // Out to server OutputStream outToServer = client.getOutputStream(); DataOutputStream out = new DataOutputStream(outToServer); // Print message to server out.writeUTF("Hello from " + client.getLocalSocketAddress()); // In from server InputStream inFromServer = client.getInputStream(); DataInputStream in = new DataInputStream(inFromServer); // Print message from server System.out.println("Server says " + in.readUTF()); // Begin reading user input to send to the server Scanner chat = new Scanner(System.in); String lineTo; String lineFrom; // Keep the program open unless the user types endchat while (!chat.nextLine().equals("endchat")) { // Read any messages coming in from the server lineFrom = String.valueOf(in.readUTF()); System.out.println(lineFrom); // Write any messages to the client lineTo = chat.nextLine(); out.writeUTF(lineTo); } // Close the connection client.close(); }catch(IOException e) { e.printStackTrace(); } } } Server: // Server class public class Server extends Thread { private ServerSocket serverSocket; private String username; // Create server publi…
tagged with: java
has answer: http://stackoverflow.com/a/22391448
tagged with: inputstream

http://stackoverflow.com/q/22396336
has comment: http://stackoverflow.com/comment/34050553
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34050322
tagged with: gridview
tagged with: java
linked to: http://stackoverflow.com/q/22402516
type: Question
has comment: http://stackoverflow.com/comment/34051042
tagged with: android-layout
has body: i am developing a project where i compare two item images,So if two items will have same image after clicking these items it should be permanently delete from the GridView. my code is given below and this code encounter a problem. please any one help me. MainActivity.java public class MainActivity extends Activity { Context ctx; int imagesArray[]; GridViewContent adapter; List&lt;Integer&gt; pictures, pictureList; boolean flage = false; int save1, save2; int img1 = -1, img2 = -1; public int OriginalArray[] = { R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3, R.drawable.sample_0, R.drawable.sample_1, R.drawable.sample_2, R.drawable.sample_3 }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); shuffleArray(); final GridView grid = (GridView) findViewById(R.id.gv_memory); grid.setAdapter(new GridViewContent(this)); } private void shuffleArray() { // TODO Auto-generated method stub pictures = new ArrayList&lt;Integer&gt;(); for (int index = 0; index &lt; OriginalArray.length; index++) { pictures.add(OriginalArray[index]); } Collections.shuffle(pictures); } public class GridViewContent extends BaseAdapter { private Context context; private List&lt;Integer&gt; pictureList = new ArrayList&lt;Integer&gt;(); public GridViewContent(Context c) { context = c; for (int i = 0; i &lt; 8; i++) { pictureList.add(R.drawable.question); } } @Override public int getCount() { // TODO Auto-generated method stub return (pictureList.size()); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return pictureList.get(position); } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } @Override public View getView(final int position, final View arg1, final ViewGroup arg2) { // TODO Auto-generated method stub final ImageView myimage = new ImageView(context); myimage.setImageResource(pictureList.get(posi…
has title: Remove GridView items at run time if two items have same images
has comment: http://stackoverflow.com/comment/34050736
accepted answer: http://stackoverflow.com/a/22398368
score: 0
has comment: http://stackoverflow.com/comment/34053417
has comment: http://stackoverflow.com/comment/34050570
has comment: http://stackoverflow.com/comment/34052628
answer count: 1
has comment: http://stackoverflow.com/comment/34050629
has answer: http://stackoverflow.com/a/22398368
tagged with: android
has comment: http://stackoverflow.com/comment/34051112
has comment: http://stackoverflow.com/comment/34050474

http://stackoverflow.com/q/22441131
has answer: http://stackoverflow.com/a/22441174
has body: I am currently developing a music app for Android. The problem is though that the App stops sometimes if i have open some other Apps and switch to them. I would love to have it still running or even better have it in the Notification Bar like the Google Play Music App. Can somebody hint me into the right direction? I have not found anything for my problem so far because I have one Activity running and most of the Solutions I found were for Services or just outdated. Thanks in advance.
tagged with: java
score: 0
answer count: 2
has title: making an android music app and keeping the activity alive
possible better answer: http://stackoverflow.com/a/22441197
accepted answer: http://stackoverflow.com/a/22441174
has answer: http://stackoverflow.com/a/22441197
tagged with: android
type: AnsweredQuestion
type: Question

launch-configuration
type: Tag
tags question: http://stackoverflow.com/q/22479976
tag name: launch-configuration

http://stackoverflow.com/comment/34096382
comment on: http://stackoverflow.com/a/22422729
has text: HI ,I already do that but noting was changed,I cannot choose the intel atom in the drop down list...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22331998
type: UnansweredQuestion
tagged with: glassfish-4
has answer: http://stackoverflow.com/a/22522537
tagged with: java
has comment: http://stackoverflow.com/comment/33938511
type: Question
answer count: 2
has body: I upgraded from Glassfish 3 to 4 and now my JSPs are throwing NPEs. I haven't changed any code so it must be a difference in Glassfish. JSP code that used to look like this: &lt;c:when test="${invoke}"&gt; Now gives me a NPE unless I change it to this: &lt;c:when test="${not empty invoke &amp;&amp; invoke}"&gt; I'm wondering why this change is necessary. Can someone tell me what caused this? Why did it used to work before and no longer works?
linked to: http://stackoverflow.com/q/19690794
has title: Why am I getting NullPointerExceptions in my JSPs when I upgrade from Glassfish 3 to 4?
tagged with: jsp
has comment: http://stackoverflow.com/comment/33938095
score: 4
has answer: http://stackoverflow.com/a/23962752
tagged with: glassfish
downvote count: 1
favorite count: 0
tagged with: el
upvote count: 5

http://stackoverflow.com/a/22411973
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/34080548
has comment: http://stackoverflow.com/comment/34081460
has body: Pass your folder path to SelectTypeActivity through putExtra() method of Intent as below... String folderPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/CalendarNote/" + dateN; File folder = new File(folderPath); boolean success = true; if (!folder.exists()) { success = folder.mkdirs(); } if (success) { Toast.makeText(getBaseContext(), "You have successfully created." , Toast.LENGTH_LONG ).show(); Intent w = new Intent(DatePickerActivity.this, SelectTypeActivity.class); w..putExtra("folderpath", folderPath); startActivity(w); } else { Toast.makeText(getBaseContext(), "You have Failed to create." , Toast.LENGTH_LONG ).show(); } Retrieve that folder path from Extra using getStringExtra() method in SelectTypeActivity class as below... //File sdCardDir = Environment.getExternalStorageDirectory(); //File targetFile; //targetFile = new File(sdCardDir.getCanonicalPath() + "/CalendarNote/"+ dateN); String folderPath = getIntent().getStringExtra("folderpath"); File file=new File(folderPath + "/"+title+".txt");
type: Answer
accepted answer of: http://stackoverflow.com/q/22411247
answers question: http://stackoverflow.com/q/22411247

http://stackoverflow.com/comment/34111725
comment on: http://stackoverflow.com/q/22431351
score: 0
type: QuestionComment
type: Comment
has text: I was looking for something a little different. I'm looking to make this react to unique appearances of a character rather than relying on another method if possible. But, I will try to integrate these methods into my function.

http://stackoverflow.com/a/22401893
answers question: http://stackoverflow.com/q/22401892
type: Answer
has comment: http://stackoverflow.com/comment/34290408
has body: Q How to add image in JTable? I have describe easy way to solve my above Question . override the method of getColumnClass () of the table. tblTaskList = new JTable() ; DefaultTableModel dm = new DefaultTableModel(0, 0) { private static final long serialVersionUID = 1L; //override and give class value public Class getColumnClass(int column) { return getValueAt(0, column).getClass(); }; }; //set Image in ImageIcon’s object ImageIcon imgStart = new ImageIcon("start.png"); ImageIcon imgStop = new ImageIcon("stop.png"); ImageIcon imgPause = new ImageIcon("pause.png"); for (int count = 1; count &lt;= 30; count++) { //add row dynamically dm.addRow(new Object[] { count, "Task Title", imgStart, imgPause, imgStop, "Status" }); } tblTaskList.setModel(dm); //Add table in to the JScrollpane JScrollPane jspTasklist = new JScrollPane(tblTaskList); //Add Scroll Pane into the frame frmTaskList.getContentPane().add(jspTasklist);
score: 2
has comment: http://stackoverflow.com/comment/34292842
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/34290784
has comment: http://stackoverflow.com/comment/34273895
has comment: http://stackoverflow.com/comment/34274324
has comment: http://stackoverflow.com/comment/34059148

http://stackoverflow.com/a/22480468
score: 0
accepted answer of: http://stackoverflow.com/q/22480348
upvote count: 1
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/22480348
type: Answer
has comment: http://stackoverflow.com/comment/34196981
has body: Use setVisible(true) at the end and there is no point of calling setVisible() on JLabel object. Just use update method at the end Jpan.update();
has comment: http://stackoverflow.com/comment/34197339

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

http://stackoverflow.com/comment/35067950
has text: Thanks for the feedback. I did end up determining my issue. A dependency in my POM was pulling in jersey client 1.x. This conflict was the source of my issue. As this dependency was critical to our application, we're sticking with jersey 1.x for now.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22962756
score: 2

http://stackoverflow.com/a/22465321
type: Answer
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22465223
has body: So I assume you mean a -&gt; b and c -&gt; d. The classic way to deal with this is a loop that increments two at a time: for(int i = 0; i &lt; myArray.length; i += 2) { final String firstVal = myArray[i]; final String secondVal = myArray[i + 1]; }

http://stackoverflow.com/comment/34002408
type: Comment
type: QuestionComment
score: 0
has text: I use [beanshell](http://www.beanshell.org/download.html) to interactively test java code. Its easier than creating a new file and compiling it when I just want to test some java behaviors.
comment on: http://stackoverflow.com/q/22368435

http://stackoverflow.com/q/22373993
has comment: http://stackoverflow.com/comment/34010990
has title: How to run different instances of same java code
tagged with: jms
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/34013237
score: 0
tagged with: java
has body: I have a JSP page from which I want to call different independent instances of same java code. In the JSP, the user has the option to select and run multiple analyses(on call records) and each analysis uses the same java code as its business logic, So I am looking for the best technique to implement this.Will API like JMS be useful ? Any help will be highly appreciated.
has answer: http://stackoverflow.com/a/22375663
has comment: http://stackoverflow.com/comment/34012870
tagged with: database
tagged with: jsp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34013017
has comment: http://stackoverflow.com/comment/34011070

http://stackoverflow.com/a/22455897
has comment: http://stackoverflow.com/comment/34156292
accepted answer of: http://stackoverflow.com/q/22455726
has body: The basic idea that you can return false (which breaks method execution) once you find stacks are not equal. Otherwise return true: public boolean isPalindrome (Stack a, Stack b) { if (a.size() != b.size()) { return false; } while (a.size() &gt; 0) { if (!a.pop().equals(b.pop())) { return false; } } return true; }
upvote count: 1
has comment: http://stackoverflow.com/comment/34155741
has comment: http://stackoverflow.com/comment/34156912
has comment: http://stackoverflow.com/comment/34158414
has comment: http://stackoverflow.com/comment/34156882
has comment: http://stackoverflow.com/comment/34157379
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34156855
has comment: http://stackoverflow.com/comment/34155823
has comment: http://stackoverflow.com/comment/34155941
has comment: http://stackoverflow.com/comment/34156806
answers question: http://stackoverflow.com/q/22455726
type: Answer
has comment: http://stackoverflow.com/comment/34157662

http://stackoverflow.com/a/22484419
accepted answer of: http://stackoverflow.com/q/22467704
has comment: http://stackoverflow.com/comment/34204362
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22467704
has body: It can be achieved by setting this parameter mapred.textoutputformat.separator in configuration of job to desired delimiter. In your case it will be something like conf.set("mapred.textoutputformat.separator", ":"); . Depending on version of hadoop and distribution the parameter name could be different.
type: Answer

http://stackoverflow.com/a/22346154
has body: instead of request.post(json, String.class); try to use request.type(MediaType.TEXT_PLAIN).post(json, String.class);
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22346056
answers question: http://stackoverflow.com/q/22346056

http://stackoverflow.com/a/22488367
answers question: http://stackoverflow.com/q/22424117
has comment: http://stackoverflow.com/comment/34257097
score: 0
has body: If read() returns -1 it doesn't mean 'server not responding'. It means the peer has closed the connection, and you should do likewise. Instead you aren't closing it at all, so the operating system does a reset, so your server gets this exception.
type: Answer

http://stackoverflow.com/comment/34013688
type: AnswerComment
type: Comment
has text: Map<String,List<String>> is not applicable for the arguments (String, boolean). mapPart.get(colId).add(restOfString) is boolean
comment on: http://stackoverflow.com/a/22375585
score: 0

http://stackoverflow.com/comment/34044025
comment on: http://stackoverflow.com/q/22392671
type: QuestionComment
has text: And what errors do you see? what are you expecting to see instead? can you provide more information on where you are getting stuck? --- Initially I see that you are iterating over an `ArrayList<item> a` but you are getting this `Room room = i.next();` - since this is an array of `items` you will get an error if you try to cast it into `room`
type: Comment
score: 0

http://stackoverflow.com/comment/33976374
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22338833
type: Comment
has text: Yes, documentation is awful, but when you get to know it you start to like it, it can correctly represent most class corelations, reverse engenier a class structure connections and all kinds of crazy stuff. really usful on biger loong living applications

mongodb
tags question: http://stackoverflow.com/q/22353605
tags question: http://stackoverflow.com/q/22429664
tags question: http://stackoverflow.com/q/22396822
tags question: http://stackoverflow.com/q/22371760
tags question: http://stackoverflow.com/q/22443506
tags question: http://stackoverflow.com/q/22351075
tags question: http://stackoverflow.com/q/22343342
tags question: http://stackoverflow.com/q/22392331
tags question: http://stackoverflow.com/q/22381505
tag name: mongodb
tags question: http://stackoverflow.com/q/22375401
tags question: http://stackoverflow.com/q/22361505
tags question: http://stackoverflow.com/q/22374974
type: Tag
tags question: http://stackoverflow.com/q/22381306
tags question: http://stackoverflow.com/q/22479415
tags question: http://stackoverflow.com/q/22364831
tags question: http://stackoverflow.com/q/22366008
tags question: http://stackoverflow.com/q/22466409
tags question: http://stackoverflow.com/q/22382673
tags question: http://stackoverflow.com/q/22369915
tags question: http://stackoverflow.com/q/22383439

http://stackoverflow.com/comment/34045492
type: Comment
has text: ...Im ashamed. Of course, it worked. Thank you, I will upvote when I can do it...
type: AnswerComment
comment on: http://stackoverflow.com/a/22393535
score: 0

http://stackoverflow.com/a/55256696
upvote count: 7
downvote count: 0
answers question: http://stackoverflow.com/q/22358872
type: Answer
has body: import: import com.fasterxml.jackson.databind.ObjectMapper; object: private ObjectMapper mapper = new ObjectMapper(); examples: PremierDriverInfoVariationDTO premierDriverInfoDTO = mapper.convertValue(json, PremierDriverInfoVariationDTO.class); log.debug("premierDriverInfoDTO : {}", premierDriverInfoDTO); or Map&lt;String, Boolean&gt; map = mapper.convertValue(json, Map.class); log.debug("result : {}", map); assertFalse(map.get("eligiblePDJob"));
score: 7

http://stackoverflow.com/a/22375535
answers question: http://stackoverflow.com/q/22375422
score: 0
has comment: http://stackoverflow.com/comment/34013393
has comment: http://stackoverflow.com/comment/34013331
type: Answer
has body: Use mouselistener's java swing. you will get the mouse position. http://www.realapplets.com/tutorial/MouseClickExample.html http://docs.oracle.com/javase/7/docs/api/java/awt/event/MouseEvent.html

http://stackoverflow.com/a/22426363
type: AcceptedAnswer
has body: If you are looking for the official releases from Oracle, check out the Oracle Java Archive: http://www.oracle.com/technetwork/java/javase/archive-139210.html There you can find J2EE 1.4_03 SDK, I do not recall whether "03" was the first patch, but it sounds close enough: http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-eesdk-419427.html#j2eesdk-1_4_03-oth-JPR
type: Answer
answers question: http://stackoverflow.com/q/22425614
accepted answer of: http://stackoverflow.com/q/22425614
score: 0

arrays
tags question: http://stackoverflow.com/q/22402787
tags question: http://stackoverflow.com/q/22332199
tags question: http://stackoverflow.com/q/22450835
tags question: http://stackoverflow.com/q/22357982
tags question: http://stackoverflow.com/q/22427559
tags question: http://stackoverflow.com/q/22427507
tags question: http://stackoverflow.com/q/22445539
tags question: http://stackoverflow.com/q/22356708
tags question: http://stackoverflow.com/q/22400408
tags question: http://stackoverflow.com/q/22477039
tags question: http://stackoverflow.com/q/22467617
tags question: http://stackoverflow.com/q/22471809
tags question: http://stackoverflow.com/q/22389102
type: Tag
tags question: http://stackoverflow.com/q/22420962
tags question: http://stackoverflow.com/q/22428981
tags question: http://stackoverflow.com/q/22332133
tags question: http://stackoverflow.com/q/22433558
tags question: http://stackoverflow.com/q/22335112
tags question: http://stackoverflow.com/q/22423425
tags question: http://stackoverflow.com/q/22445396
tags question: http://stackoverflow.com/q/22391205
tags question: http://stackoverflow.com/q/22342898
tags question: http://stackoverflow.com/q/22465207
tags question: http://stackoverflow.com/q/22476325
tags question: http://stackoverflow.com/q/22333543
tags question: http://stackoverflow.com/q/22427894
tags question: http://stackoverflow.com/q/22446091
tags question: http://stackoverflow.com/q/22436813
tags question: http://stackoverflow.com/q/22455603
tags question: http://stackoverflow.com/q/22329486
tags question: http://stackoverflow.com/q/22440984
tags question: http://stackoverflow.com/q/22467654
tags question: http://stackoverflow.com/q/22471134
tags question: http://stackoverflow.com/q/22441748
tags question: http://stackoverflow.com/q/22445011
tags question: http://stackoverflow.com/q/22348177
tags question: http://stackoverflow.com/q/22412569
tags question: http://stackoverflow.com/q/22348728
tags question: http://stackoverflow.com/q/22436231
tags question: http://stackoverflow.com/q/22358435
tags question: http://stackoverflow.com/q/22389266
tags question: http://stackoverflow.com/q/22469792
tags question: http://stackoverflow.com/q/22485735
tags question: http://stackoverflow.com/q/22454207
tags question: http://stackoverflow.com/q/22442030
tags question: http://stackoverflow.com/q/22425277
tags question: http://stackoverflow.com/q/22347076
tags question: http://stackoverflow.com/q/22367540
tags question: http://stackoverflow.com/q/22455284
tags question: http://stackoverflow.com/q/22471963
tags question: http://stackoverflow.com/q/22445186
tags question: http://stackoverflow.com/q/22384165
tags question: http://stackoverflow.com/q/22352934
tags question: http://stackoverflow.com/q/22458839
tags question: http://stackoverflow.com/q/22471927
tags question: http://stackoverflow.com/q/22414624
tags question: http://stackoverflow.com/q/22398226
tags question: http://stackoverflow.com/q/22358198
tags question: http://stackoverflow.com/q/22396775
tags question: http://stackoverflow.com/q/22464441
tags question: http://stackoverflow.com/q/22432295
tags question: http://stackoverflow.com/q/22468498
tags question: http://stackoverflow.com/q/22470623
tags question: http://stackoverflow.com/q/22429967
tags question: http://stackoverflow.com/q/22470791
tags question: http://stackoverflow.com/q/22415244
tags question: http://stackoverflow.com/q/22418151
tags question: http://stackoverflow.com/q/22366138
tags question: http://stackoverflow.com/q/22343787
tags question: http://stackoverflow.com/q/22355328
tags question: http://stackoverflow.com/q/22431711
tags question: http://stackoverflow.com/q/22418175
tags question: http://stackoverflow.com/q/22469366
tags question: http://stackoverflow.com/q/22446515
tags question: http://stackoverflow.com/q/22360672
tags question: http://stackoverflow.com/q/22427740
tags question: http://stackoverflow.com/q/22421178
tags question: http://stackoverflow.com/q/22443626
tags question: http://stackoverflow.com/q/22414886

http://stackoverflow.com/comment/128049378
type: Comment
has text: And as for Bal, you can add more than one Authentication Provider to your configure Method: @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth .authenticationProvider(new CustomAuthenticationProvider()) .userDetailsService(userDetailsService).passwordEncoder(passwordEncoder()); }
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22463203

http://stackoverflow.com/comment/34127748
type: QuestionComment
has text: @JonSkeet Yes, I did. I actually mean to ask that the job of the constructor is not to ensure that the class has something to run. It's job is to assign some values(passed to it in the constructor call) to the fields of the newly-created/being-created object. Isn't it?
comment on: http://stackoverflow.com/q/22434463
score: 0
type: Comment

http://stackoverflow.com/comment/34030386
has text: @Daan van Hulst Okay I'll try this thanks for suggesting. :)
comment on: http://stackoverflow.com/q/22384584
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34118934
comment on: http://stackoverflow.com/a/22435437
has text: Get is not an option for me here because i am sending password.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34010940
type: QuestionComment
comment on: http://stackoverflow.com/q/22372741
has text: What version of spring do you use ? Can you check in your server if the cxf libs is in your WEB-INF\lib. The application is deployed into you profiles directory (installedApps)
score: 0
type: Comment

http://stackoverflow.com/comment/34059531
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22401496
has text: Yes, I understand but how you will do this because your page is refreshing on button click.On that case you can use ajax or jquery to insert the data where the page will not refresh.
score: 0

http://stackoverflow.com/q/22402254
has comment: http://stackoverflow.com/comment/34059784
has answer: http://stackoverflow.com/a/22402743
has comment: http://stackoverflow.com/comment/34059627
has comment: http://stackoverflow.com/comment/34060094
has answer: http://stackoverflow.com/a/22403254
has comment: http://stackoverflow.com/comment/34059940
has title: Can someone help me to fix this binary tree in Java?
has body: The user must input a key to a node, and pick one of the three order choices. They can press the indicated number to perform an operation. I need this code as soon as possible because finals is coming :( import java.io.*; import java.util.*; public class BinaryTree { public static int choice,listLength; Node root; public void addNode(int key, String name) { Node newNode = new Node(key, name); if (root == null) { root = newNode; } else { Node focusNode = root; Node parent; while (true) { parent = focusNode; if (key &lt; focusNode.key) { focusNode = focusNode.leftChild; if (focusNode == null) { parent.leftChild = newNode; return; } } else { focusNode = focusNode.rightChild; if (focusNode == null) { parent.rightChild = newNode; return; } } } } } public void inOrderTraverseTree(Node focusNode) { if (focusNode != null) { inOrderTraverseTree(focusNode.leftChild); System.out.println(focusNode); inOrderTraverseTree(focusNode.rightChild); } } public void preorderTraverseTree(Node focusNode) { if (focusNode != null) { System.out.println(focusNode); preorderTraverseTree(focusNode.leftChild); preorderTraverseTree(focusNode.rightChild); } } public void postOrderTraverseTree(Node focusNode) { if (focusNode != null) { postOrderTraverseTree(focusNode.leftChild); postOrderTraverseTree(focusNode.rightChild); System.out.println(focusNode); } } public Node findNode(int key) { Node focusNode = root; while (focusNode.key != key) { if (key &lt; focusNode.key) { focusNode = focusNode.leftChild; } else { focusNode = focusNode.rightChild; } if (focusNode == null) return null; } return focusNode; } public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String x; int y; BinaryTree theTree = new BinaryTree(); theTree.inOrderTraverseTree(theTree.root); do { try { System.out.println("Choose: "); System.out.println("[1]Insert "); System.out.println("[2]Delete "); System.out.println("[3]Display "); System.out.println("[4]…
possible better answer: http://stackoverflow.com/a/22402743
has comment: http://stackoverflow.com/comment/34060287
has comment: http://stackoverflow.com/comment/34059804
has comment: http://stackoverflow.com/comment/34061244
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34060061
has comment: http://stackoverflow.com/comment/34065222
accepted answer: http://stackoverflow.com/a/22403254
tagged with: java
has comment: http://stackoverflow.com/comment/34059686
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34059893
score: 0

http://stackoverflow.com/a/22405794
has body: Horner's method for hash generation is as simple as int hash=0; for(int i=0;i&lt;str.length();i++) hash = x*hash + str.charAt(i);
has comment: http://stackoverflow.com/comment/34068198
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/34066345
has comment: http://stackoverflow.com/comment/34065677
has comment: http://stackoverflow.com/comment/34067838
downvote count: 0
answers question: http://stackoverflow.com/q/22405235
has comment: http://stackoverflow.com/comment/34065956
has comment: http://stackoverflow.com/comment/34067359
type: Answer

http://stackoverflow.com/comment/34155875
has text: Oops, I am mistaken... But the `;` is redundant
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22456410

http://stackoverflow.com/comment/34211841
type: AnswerComment
comment on: http://stackoverflow.com/a/22487941
score: 0
type: Comment
has text: Hmmm, re-reading the question it seems maybe you are right, they do write **what does instance method mean here?**

http://stackoverflow.com/a/35894896
answers question: http://stackoverflow.com/q/22368414
has body: I met the same question. The short version You have to register jpaAuditingHandler bean definition using BeanDefinitionRegistry. The long version the org.springframework.data.jpa.domain.support.AuditingEntityListener is a special class which mixed in with aspectj when compiling. see here It need a bean definition to work. see the spring framework document. the org.springframework.data.jpa.repository.config.EnableJpaAuditing you are using will register the bean definition with auditingHandler bind to a jpaAuditingHandler bean. It also will register the jpaAuditingHandler bean definition. If you add a jpaAuditingHandler using @Component, it won't work because Spring prefer another one. see org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader#loadBeanDefinitionsForConfigurationClass So you have to register your bean definition using BeanDefinitionRegistry. public class jpaAuditingHandlerRegistrar implements ImportBeanDefinitionRegistrar { @Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { registry.registerBeanDefinition("jpaAuditingHandler", BeanDefinitionBuilder .rootBeanDefinition(JpaAuditingHandler.class) .addConstructorArgReference("jpaMappingContext") .getBeanDefinition()); } } and add @Import(JpaAuditingHandlerRegistrar.class) to your Configuration class @SpringBootApplication @EnableJpaAuditing @Import(JpaAuditingHandlerRegistrar.class) public class Application { I put sample code https://github.com/macdao/customize-auditing-handler
score: 12
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/133731977
type: Answer

http://stackoverflow.com/q/22392521
answer count: 2
downvote count: 0
favorite count: 0
tagged with: class
has body: I dont really know how to explain myself on this so ill just show you guys what im supposed to do and what i got. My teacher told us to complete the rest of the code so that the main will work. This is what was given to me: public static void main(String args[]) { dog buli=new dog(); cat felix=new cat(); cuckoo wallwatch=new cuckoo(); talks(buli); talks(felix); talks(wallwatch); } } the output should be: guau miau cucu And what ive got(this class animals is where the main is too): public abstract class Animals { public String sound; Animals (String sound){ this.sonido = sound; } public void talks(){ System.out.println(sound); } And just the dog underclass(dog.java) since the three are the same: public class dog extends Animals{ dog (String sound){ sound = "guau"; } } To tell you the truth i have a lot of problems with java I've never had with other languages, i cant seem to understand anything related to classes or objects. :S Thank you.
has comment: http://stackoverflow.com/comment/34043746
has comment: http://stackoverflow.com/comment/34043764
type: UnansweredQuestion
score: 1
has title: giving value from one class to extended one Java
upvote count: 1
tagged with: object
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/22392773
has answer: http://stackoverflow.com/a/22392721
type: Question

http://stackoverflow.com/a/22437988
type: Answer
answers question: http://stackoverflow.com/q/22437752
score: 0
has body: Java isn't very good for this purpose, since this almost directly touches very basics of your machine. You should take a look at "Windows driver kit" and consider using lower level language like C++ for this. Although even then, you will run into obstacles like anti-virus software, trying to block your package sniffing.

http://stackoverflow.com/comment/34143137
comment on: http://stackoverflow.com/q/22448802
score: 0
has text: By looking at this error line - 'Unable to get JNI 1.2 environment, jvm->GetEnv() return code ', it seems its a JVM bug & it is unpredictable. See this link http://bugs.java.com/view_bug.do?bug_id=6476706
type: Comment
type: QuestionComment

http://stackoverflow.com/a/60403742
upvote count: 2
type: Answer
score: 1
downvote count: 1
has body: Here is a solution that doesn't use a loop and uses the Android API only: InputStream inputStreamObject = PositionKeeperRequestTest.class.getResourceAsStream(jsonFileName); byte[] data = new byte[inputStreamObject.available()]; if(inputStreamObject.read(data) == data.length) { JSONObject jsonObject = new JSONObject(new String(data)); }
answers question: http://stackoverflow.com/q/22461663
has comment: http://stackoverflow.com/comment/107871019

base32
tags question: http://stackoverflow.com/q/22385467
tag name: base32
type: Tag

http://stackoverflow.com/a/22467309
upvote count: 3
has body: After some investigation, this problem is caused by a class that has been entirely commented. For example: //package xxx.xxxx.xxxxx; //// //public class Test { //// //} If you put a class like this in your domain package, the generation process fails. Well, on the other hand, this kind of classes wouldn't have to exist in your project.
type: Answer
answers question: http://stackoverflow.com/q/22467308
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22467308
type: AcceptedAnswer

security
tags question: http://stackoverflow.com/q/22448369
tags question: http://stackoverflow.com/q/22364894
tags question: http://stackoverflow.com/q/22460330
tags question: http://stackoverflow.com/q/22386596
tags question: http://stackoverflow.com/q/22458536
tags question: http://stackoverflow.com/q/22432237
tags question: http://stackoverflow.com/q/22419032
tags question: http://stackoverflow.com/q/22363711
tags question: http://stackoverflow.com/q/22428117
tags question: http://stackoverflow.com/q/22395403
tags question: http://stackoverflow.com/q/22330707
tags question: http://stackoverflow.com/q/22399859
tags question: http://stackoverflow.com/q/22469118
tags question: http://stackoverflow.com/q/22372399
tags question: http://stackoverflow.com/q/22339382
tags question: http://stackoverflow.com/q/22347196
tags question: http://stackoverflow.com/q/22443960
tags question: http://stackoverflow.com/q/22456112
tags question: http://stackoverflow.com/q/22378907
tags question: http://stackoverflow.com/q/22336838
type: Tag
tags question: http://stackoverflow.com/q/22447082
tag name: security

http://stackoverflow.com/comment/33956326
comment on: http://stackoverflow.com/a/22342089
score: 0
type: Comment
has text: im sorry to ask this, im just new to java, im trying though. i updated my question part of the drawTurnoverReport class to try and help clarify. I assume that you meant to override the getPreferredSize method in that same class i am just unsure on how to do it. I looked at the links you put in but those both use preset images and i can't determine how to make that work for my case.
type: AnswerComment

http://stackoverflow.com/comment/33935685
type: QuestionComment
has text: What is the error you see?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22330471

http://stackoverflow.com/q/22399173
accepted answer: http://stackoverflow.com/a/22399345
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34054818
has title: Writing data to a file using RandomAccessFile
tagged with: randomaccessfile
has answer: http://stackoverflow.com/a/22399345
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34054915
has comment: http://stackoverflow.com/comment/34054716
has body: I am writing to a file using RandomAccessFile.The data(fields) are stored in fixed field length,e.g every field would alloted space of 16 bytes.I write something by placing the pointer to the appropriate position using seek(). Problem comes when I overwrite some fields,i.e,if "Bangalore" was stored earlier and if overwrite it with "Delhi" the result is "Delhilore". How do I erase "Bangalore" completely prior to writing "Delhi"? If value is the String I want to write and length is the fixed field length(16) byte[] b=new byte[length]; b=value.getBytes(); try { database.seek(offset); database.write(b); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/34054939

http://stackoverflow.com/a/46069076
score: 19
answers question: http://stackoverflow.com/q/22399572
has comment: http://stackoverflow.com/comment/140156935
has comment: http://stackoverflow.com/comment/114329437
upvote count: 19
type: Answer
has body: If the project was compiling just before, you can try to clear the cache using : ./gradlew clean or ./gradlew cleanBuildCache or for windows gradlew cleanBuildCache https://developer.android.com/studio/build/build-cache.html
downvote count: 0

http://stackoverflow.com/comment/34105657
comment on: http://stackoverflow.com/q/22428217
type: Comment
type: QuestionComment
score: 3
has text: Have you tried `System.getProperty("user.home")`?

http://stackoverflow.com/comment/34052718
type: Comment
type: QuestionComment
has text: Yeah, I have it in under my ejb jar's META-INF folder
comment on: http://stackoverflow.com/q/22395759
score: 0

http://stackoverflow.com/comment/33961395
has text: Such a long story without any question mark.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22342896
score: 1

http://stackoverflow.com/q/22466610
upvote count: 1
has body: Creating the array, I am letting the user choose the length: StartNum = scan.nextInt(); int[] NumBox = new int[StartNum]; for (int i = 1; i &lt; NumBox.length+1; i++) {NumBox[i - 1] = i;} NumBox[0]=0; Assuming there are other methods that can change cells in NumBox to 0, how would I use a for loop to check each cells in the array for any divisor? If there are no divisors for the cell in the array, it will then become a 0. For example, if the array is [0,2,0,4,0,6,7,8,9] 9,2 and 7 would become a 0. The code below is what I tired but didn't get far. boolean NoDiv=false; for (int a=1; a &lt; NumBox.length+1; a++) { a++ for (int check=1; a &lt; NumBox.length+1; check++) { if (NumBox[a-1]% check == 0 &amp;&amp; NumBox[a-1] !=0) { NumBox[a-1] = 0; } } }
has comment: http://stackoverflow.com/comment/34174150
type: Question
has answer: http://stackoverflow.com/a/22466659
tagged with: for-loop
has comment: http://stackoverflow.com/comment/34174093
tagged with: arrays
has title: How to check array for possible divisors?
has comment: http://stackoverflow.com/comment/34174087
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34174123
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34174088

http://stackoverflow.com/comment/33995395
has text: @nKn i didn't get it ... I checked Project Structure and I found the library what should i do then? how to import it? or is it already imported?
comment on: http://stackoverflow.com/q/22363787
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22421250
score: 0
accepted answer of: http://stackoverflow.com/q/22421112
type: Answer
has body: You definitely need to have some structure to your code to eliminate uncontrolled coupling. That aside, changing wName does not help, you need to call wNamePiece.setText(). And for this you need to have it as a member variable. Additionally, you need to make this call within Event Dispatcher Thread. If you are not making this call within a separate thread, you are safe.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22421112

http://stackoverflow.com/comment/34190538
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22476464
has text: To load the cities in combobox from database

http://stackoverflow.com/a/22413884
has comment: http://stackoverflow.com/comment/102802443
has comment: http://stackoverflow.com/comment/110064858
upvote count: 18
type: Answer
has comment: http://stackoverflow.com/comment/88752529
has comment: http://stackoverflow.com/comment/102805880
accepted answer of: http://stackoverflow.com/q/22340674
downvote count: 0
answers question: http://stackoverflow.com/q/22340674
has body: My question is in what the performance depends, is there a way how to make PdfBox faster? One major difference is that PDFBox always processes text glyph by glyph while iText normally processes it chunk (i.e. single string parameter of text drawing operation) by chunk; that reduces the required resources in iText quite a lot. Furthermore the event oriented architecture of iText text parsing means a lower burden on resources than that of PDFBox. And PDFBox keeps information not strictly required for plain text extraction available for a longer time, costing more resources. But the way the libraries initially load the document may also make a difference. Here you can experiment a bit, PDFBox not only offers multiple PDDocument.load overloads but also some PDDocument.loadNonSeq overloads (actually PDDocument.loadNonSeq reads documents correctly while PDDocument.load can be tricked to misinterpret PDFs). All these different variants may have different runtime behavior. more about how strategies affect performance? iText brings along a simple and a more advanced text extraction strategy. The simple one assumes text in the page content stream to appear in reading order while the more advanced one sorts. By default the more advanced one is used. Thus, you probably can speed up iText even some more by using the simple strategy. PDFBox always sorts.
score: 18
type: AcceptedAnswer

http://stackoverflow.com/q/22426553
has body: Is there anyway I use one "getentry" to do the different types of searches ( if I put in "title", it searches for row containing title. If i put in "id", it searches for row containing id etc) is that possible? My table (book) has 3 columns Id Author Title ID column is of integer data type Author, Title columns are of string data type Book getentry(int id) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_AppData, new String[] { K_ID, K_AUTHOR K_TITLE }, K_ID + "=?", new String[] { String.valueOf(id) }, null, null, null, ); if (cursor != null) cursor.moveToFirst(); Book entry = new Book(Integer.parseInt(cursor.getString(0)), cursor.getString(1), cursor.getString(2)); return entry; }
type: Question
score: 0
tagged with: sqlite
answer count: 1
has title: Can I use one "Getentry" to do different searches ( if I input "title" ,"author", "id" returns row containing title or author etc) is that possible?
tagged with: android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/34102805
has answer: http://stackoverflow.com/a/22426750
accepted answer: http://stackoverflow.com/a/22426750
type: AnsweredQuestion
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/34058401
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22401075
has text: Yes Apoorv.. my html file is named with task.html..
score: 0

http://stackoverflow.com/a/22492346
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22487110
has comment: http://stackoverflow.com/comment/34353441
answers question: http://stackoverflow.com/q/22487110
has comment: http://stackoverflow.com/comment/34350471
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34340907
has comment: http://stackoverflow.com/comment/54060601
type: Answer
has body: Mule docs for DataMapper state that "DataMapper can parse a 500 MB CSV file using only about 75 MB of RAM" if you set the "streaming" property in DataMapper configuration. Pipe delemited counts as CSV, as you can configure the delimiter. You can also set it to ignore the header row. I would go for DataMapper, post another question if something fails, and only revert to a custom component when all hope is lost.

http://stackoverflow.com/comment/34130764
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22441725
has text: Servlet is a technology, an API, that Java has developed for implementing server/client applications. Servlet applications can only be run within Servlet containers. Tomcat is one such container.
score: 0

http://stackoverflow.com/comment/34164857
type: QuestionComment
comment on: http://stackoverflow.com/q/22461475
has text: How to end the loop and how to restart it so that it re-asks the question after plotting one of the points.
score: 0
type: Comment

http://stackoverflow.com/comment/34088798
score: 0
type: Comment
has text: It's possible. Not sure if thats what he is trying to do though :P
type: AnswerComment
comment on: http://stackoverflow.com/a/22418277

http://stackoverflow.com/a/22406696
answers question: http://stackoverflow.com/q/22406646
score: 0
type: Answer
has body: public static String arrayToString (int[] a) { String result = ""; for (int idx = 0; idx &lt; a.length; idx++) { result = result + a[idx] + " "; } return result; }

http://stackoverflow.com/comment/34144224
comment on: http://stackoverflow.com/q/22449540
score: 0
type: QuestionComment
has text: For monetary values, consider using fixed point integers instead. http://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency
type: Comment

http://stackoverflow.com/comment/34208522
has text: @jwg Inner classes defined inside an interface are by default `static`.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22486484

http://stackoverflow.com/comment/34158745
type: AnswerComment
has text: Yeah, what he means is that the generated bytecode is backwards compatible. So for all intents and purposes the bytecode does not know about generics.
type: Comment
comment on: http://stackoverflow.com/a/22457994
score: 1

http://stackoverflow.com/q/22351911
has answer: http://stackoverflow.com/a/22352067
tagged with: oracle10g
type: Question
type: AnsweredQuestion
has body: I have a View in Oracle. I need to access the data from java. How could I do it? I have tried the following query: select DEBIT_CARD_PAN from pbxhbl.VIEW_VISION_CARD_NUMBER where FRANCHISE_ID = '43215' If I run this query directly from the Oracle then it gives the result but if I invoke it from my Java code then it throws the following error: ORA-00942: table or view does not exist
accepted answer: http://stackoverflow.com/a/22353441
score: 0
answer count: 3
has title: Invoke Oracle View using Java
has answer: http://stackoverflow.com/a/22353441
has answer: http://stackoverflow.com/a/22352092
tagged with: view
possible better answer: http://stackoverflow.com/a/22352067
tagged with: java

http://stackoverflow.com/comment/33988051
has text: Did you include all the the class path? try adding them to the buildpath lib tab. The rquired jar is in your lib folder which is spring-ldap-core-2.0.1.jar
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22359550

http://stackoverflow.com/q/22486446
has answer: http://stackoverflow.com/a/22486690
has comment: http://stackoverflow.com/comment/34557384
has comment: http://stackoverflow.com/comment/34358282
tagged with: jpa
has comment: http://stackoverflow.com/comment/34561478
has comment: http://stackoverflow.com/comment/34345639
has comment: http://stackoverflow.com/comment/34419636
has comment: http://stackoverflow.com/comment/34358057
favorite count: 0
has body: I have a JPA 2 web application (Struts 2, Hibernate 4 as JPA implementation only). The current requirement is to add a (non-id) numeric sequential field, filled for certain rows only, to an existing entity. When inserting a new row, based on a certain condition, I need to set the new field to its highest value + 1 or to NULL. For example: ID NEW_FIELD DESCRIPTION -------------------------------- 1 1 bla bla 2 bla bla <--- unmatched: not needed here 3 bla bla <--- unmatched: not needed here 4 2 bla bla 5 3 bla bla 6 4 bla bla 7 bla bla <--- unmatched: not needed here 8 5 bla bla 9 bla bla <--- unmatched: not needed here 10 6 bla bla In the good old SQL, it would be something like: INSERT INTO myTable ( id, new_field, description ) VALUES ( myIdSequence.nextVal, (CASE myCondition WHEN true THEN myNewFieldSequence.nextVal ELSE NULL END), 'Lorem Ipsum and so on....' ) But I've no clue on how to achieve it with JPA 2. I know I can define callbacks methods, but JSR-000317 Persistence Specification for Eval 2.0 Eval discourages some specific operations from inside it: 3.5 Entity Listeners and Callback Methods - Lifecycle callbacks can invoke JNDI, JDBC, JMS, and enterprise beans. - In general, the lifecycle method of a portable application should not invoke EntityManager or Query operations, access other entity instances, or modify relationships within the same persistence context.[43] A lifecycle callback method may modify the non-relationship state of the entity on which it is invoked. [43] The semantics of such operations may be standardized in a future release of this specification. Summarizing, yes to JDBC (!) and EJB, no to EntityManager and other Entities. EDIT I'm trying to achieve the solution described in the answer from @anttix, but I'm encoutering some problem, so please correct me where I'm wrong. Table MyTable ------------------------- ID number (PK) NEW_FIELD number DESCRIPTION text Main Entity @Entity @Table(name="MyTable") public class MyEntity implements …
has comment: http://stackoverflow.com/comment/34344307
has comment: http://stackoverflow.com/comment/34561698
has comment: http://stackoverflow.com/comment/34540991
has comment: http://stackoverflow.com/comment/34345557
tagged with: sql
has comment: http://stackoverflow.com/comment/34419612
has answer: http://stackoverflow.com/a/22712099
has comment: http://stackoverflow.com/comment/34345707
linked to: http://stackoverflow.com/q/5243711
has comment: http://stackoverflow.com/comment/34358005
has comment: http://stackoverflow.com/comment/34530286
accepted answer: http://stackoverflow.com/a/22486690
answer count: 4
has comment: http://stackoverflow.com/comment/34531440
has comment: http://stackoverflow.com/comment/34536636
has comment: http://stackoverflow.com/comment/34344723
has comment: http://stackoverflow.com/comment/34561018
score: 6
upvote count: 7
linked to: http://stackoverflow.com/q/277630
has answer: http://stackoverflow.com/a/22622817
downvote count: 1
has title: JPA - Increment a numeric field through a sequence programmatically
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34554756
has comment: http://stackoverflow.com/comment/34438108
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/22569956
type: Question
has answer: http://stackoverflow.com/a/22569956
linked to: http://stackoverflow.com/q/2536829

jtable
tags question: http://stackoverflow.com/q/22428161
tags question: http://stackoverflow.com/q/22376462
tags question: http://stackoverflow.com/q/22439289
tags question: http://stackoverflow.com/q/22357794
tags question: http://stackoverflow.com/q/22439435
tags question: http://stackoverflow.com/q/22437998
tags question: http://stackoverflow.com/q/22334463
tags question: http://stackoverflow.com/q/22428031
tags question: http://stackoverflow.com/q/22412719
tags question: http://stackoverflow.com/q/22381583
tags question: http://stackoverflow.com/q/22484944
type: Tag
tags question: http://stackoverflow.com/q/22409515
tags question: http://stackoverflow.com/q/22381305
tags question: http://stackoverflow.com/q/22433917
tags question: http://stackoverflow.com/q/22413780
tags question: http://stackoverflow.com/q/22406819
tags question: http://stackoverflow.com/q/22329956
tags question: http://stackoverflow.com/q/22377808
tags question: http://stackoverflow.com/q/22484011
tags question: http://stackoverflow.com/q/22401892
tags question: http://stackoverflow.com/q/22481338
tag name: jtable
tags question: http://stackoverflow.com/q/22371720
tags question: http://stackoverflow.com/q/22432677
tags question: http://stackoverflow.com/q/22418159
tags question: http://stackoverflow.com/q/22417797
tags question: http://stackoverflow.com/q/22423125
tags question: http://stackoverflow.com/q/22400348
tags question: http://stackoverflow.com/q/22463157
tags question: http://stackoverflow.com/q/22391531
tags question: http://stackoverflow.com/q/22440733
tags question: http://stackoverflow.com/q/22337603
tags question: http://stackoverflow.com/q/22370448
tags question: http://stackoverflow.com/q/22378051
tags question: http://stackoverflow.com/q/22483189
tags question: http://stackoverflow.com/q/22374868
tags question: http://stackoverflow.com/q/22399901
tags question: http://stackoverflow.com/q/22420672

http://stackoverflow.com/comment/69554254
score: 1
has text: Upcoming release should have support for java 8 time API: https://jdbc.postgresql.org/documentation/head/8-date-time.html
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22470650

http://stackoverflow.com/q/22459639
type: Question
has comment: http://stackoverflow.com/comment/34161092
tagged with: externalizable
upvote count: 3
answer count: 1
has title: How to load Serialized Objects in Java by parts
tagged with: deserialization
favorite count: 0
tagged with: serialization
has body: I'm trying to serialize objects of big size in Java using Externalizable interface. Code: public class ResultsData implements Externalizable{ private static final long serialVersionUID = 1L; private ArrayList&lt;ALotOfResults1&gt; results1; private ArrayList&lt;ALotOfResults2&gt; results2; private ArrayList&lt;ALotOfResults3&gt; results3; private int selection; public ResultsData(){ results1=new ArrayList&lt;ALotOfResults1&gt;(); results2=new ArrayList&lt;ALotOfResults2&gt;(); results3=new ArrayList&lt;ALotOfResults3&gt;(); } //Getter and setter omited @Override public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(results1); out.writeObject(results2); out.writeObject(results3); } @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { switch(selection) { case 0: results1 = (ArrayList)in.readObject(); break; case 1: in.readObject(); results2 = (ArrayList)in.readObject(); break; case 2: in.readObject(); in.readObject(); results3 = (ArrayList)in.readObject(); break; } } Those three arrayLists filled up during program execution have very big size (14 MB each one). Code(load/save proccess): public class ResultsManagement { public static ResultsData loadResultsData(String path,ResultsData resultsData) { try { FileInputStream fisProd = new FileInputStream(path+".res"); ObjectInputStream oisProd = new ObjectInputStream(fisProd); resultsData.readExternal(oisProd); fisProd.close(); } catch (IOException ioe) { System.out.println("Error de IO: " + ioe.getMessage()); } catch (ClassNotFoundException cnfe) { System.out.println("Error de clase no encontrada: " + cnfe.getMessage()); } catch (Exception e) { System.out.println("Error: " + e.getMessage()); } return resultsData; } public static void saveResultsData(ResultsData resultsData,String path) { try { FileOutputStream fosProd = new FileOutputStream(path+".res"); ObjectOutputStream oosProd = new ObjectOutputStream(fosProd); resultsData.writeExternal(oosProd); fos…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22462512
score: 3
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34162944
has comment: http://stackoverflow.com/comment/34161420

vaadin
tags question: http://stackoverflow.com/q/22414195
tags question: http://stackoverflow.com/q/22403089
tags question: http://stackoverflow.com/q/22419667
tags question: http://stackoverflow.com/q/22333116
tag name: vaadin
tags question: http://stackoverflow.com/q/22404670
type: Tag
tags question: http://stackoverflow.com/q/22484078
tags question: http://stackoverflow.com/q/22456684
tags question: http://stackoverflow.com/q/22369575

pixel
tags question: http://stackoverflow.com/q/22418408
tags question: http://stackoverflow.com/q/22330675
tags question: http://stackoverflow.com/q/22391353
type: Tag
tag name: pixel

http://stackoverflow.com/comment/34210842
score: 1
comment on: http://stackoverflow.com/q/22487726
type: Comment
type: QuestionComment
has text: No you are wrong. it gives me 15 & 34

http://stackoverflow.com/comment/33981295
type: Comment
type: QuestionComment
has text: try to narrow it to more specific line of code. the bit of code you showed us has many variables that are not defined/assigned to in that part of the code (they might be before, but we can't know this). Use your debugger, where exactly the exception throws?
comment on: http://stackoverflow.com/q/22356711
score: 0

http://stackoverflow.com/comment/33942789
has text: @EJP - agreed regarding the need to have a 0-arg ctor somewhere. I believe that the documentation is directed more toward people who want to implement writeObject and readObject. I would normally consider that to be done by the immediate subclass of the non-serializable class.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22332034

http://stackoverflow.com/a/22355893
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/33979850
score: 1
has comment: http://stackoverflow.com/comment/33980542
has body: What you're looking for is not possible. You only have one instance of a Node object, with pointers to that object in multiple locations. You need to make new Node instances. it would mess up garbage collection and cost a lot of performance If you haven't done performance testing and shown that this is an unacceptable bottleneck, you should not assume this.
has comment: http://stackoverflow.com/comment/33980879
answers question: http://stackoverflow.com/q/22354115
upvote count: 1

http://stackoverflow.com/q/22455781
has comment: http://stackoverflow.com/comment/34156743
tagged with: java
has body: I'm developing multiple applications which need to communicate with each other via socket. First I need them to be able to communicate on localhost. So when I'm running both of them at the same time on my phone they can communicate (I know that there are easier ways to do this on the same phone but in the future they will run on separate phones). My code for socket communication is very similar to this: link Difference is that my apps are running this as foreground services. I've set the ip for the server on the client to 127.0.0.1 but they just won't connect (not in the emulator and not on real phone). What am I missing? UPDATE: I've found an easy way to get the device own IP address, so instead of localhost I use this (with www.google.com domain): answer to "java InetAddress.getLocalHost(); returns 127.0.0.1 … how to get REAL IP?" Maybe it's not too nice but it works.
type: Question
linked to: http://stackoverflow.com/q/2381316
has title: Socket communication on Android localhost
answer count: 1
has answer: http://stackoverflow.com/a/22455892
tagged with: sockets
tagged with: android
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/34158252
tagged with: localhost

http://stackoverflow.com/comment/34152856
has text: Well you could build up a model made of constituent parts which can all be named yes. And if you already have a model yes you can split sections apart to create separate meshes which will require naming. However I don't think that is the best option and you should attempt one model(mesh) and create animations for movements you want.
comment on: http://stackoverflow.com/q/22452572
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34020388
has text: @Andynedine The link you provided is abosuletely untrustworthy, its testing methodology is way off. You can't just write three lines of Java code and call it a microbenchmark.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22379650
type: QuestionComment

http://stackoverflow.com/q/22335441
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22871118
accepted answer: http://stackoverflow.com/a/22871118
has comment: http://stackoverflow.com/comment/34017439
has body: I just do not like Logback's XML or Groovy configuration and would prefer to do the configuration in Java (this is also because I'm going to change the configuration at runtime at various times after initialization). It seems the only way to do Java configuration of Logback is to have some sort of initialization that hijacks the root appender or to have custom system properties that tell logback to not use the default configuration (which is rather annoying for unit tests and deployment). What I would much rather prefer is something like a logback.xml : &lt;configuration javaConfig="com.myco.LogBackConfig" /&gt; Where LogbackConfig either has some established static method that logback calls or it just re-instantiates a Java bean. That is I want a default classpath resource that will tell logback to use Java instead of groovy/xml. Basically I want something akin to the Java ServiceLoader for logback config. Perhaps there is a way to do this in Logback that I am missing? UPDATE: Apparently Log4j2 (the new log4j) does exactly what I want and is very similar to the Java ServiceLoader.
has comment: http://stackoverflow.com/comment/34019899
upvote count: 5
has comment: http://stackoverflow.com/comment/34561669
tagged with: log4j2
tagged with: logging
type: AnsweredQuestion
downvote count: 0
has title: Configure logback to defer to Java configuration aka Plain Java Configuration of Logback
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34564813
score: 5
has answer: http://stackoverflow.com/a/29146141
has answer: http://stackoverflow.com/a/22816756
tagged with: logback
has comment: http://stackoverflow.com/comment/34572516
tagged with: slf4j
possible better answer: http://stackoverflow.com/a/29146141

http://stackoverflow.com/comment/34018878
type: Comment
comment on: http://stackoverflow.com/a/22378905
type: AnswerComment
has text: <access origin="*" /> i have tried this too..but no use
score: 0

http://stackoverflow.com/q/22457149
favorite count: 0
tagged with: velocity
tagged with: scale
has answer: http://stackoverflow.com/a/22457192
accepted answer: http://stackoverflow.com/a/22457192
downvote count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34157651
has comment: http://stackoverflow.com/comment/34157538
score: 1
tagged with: math
tagged with: java
has title: Scaling a Vector to Zero?
has body: In a program i have moving objects. Their velocyties are described with a Vector(x, y). So, i want the Objects to slow down - if they get speed for example because of a collision i scale them down in the next frames (with the factor 0.999) until they stop, because the velocity is so small, you cannot see them moving (java gets to 1e-50 or sth like that). Its working, but actually its not correct because scaling them down they will never stop in theory. So how can i let the velocity go to zero, and let it REACH zero?
tagged with: vector
upvote count: 1
answer count: 1

http://stackoverflow.com/q/22375764
upvote count: 2
tagged with: wicket
tagged with: spring
score: 2
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22375852
tagged with: java.util.concurrent
type: Question
has answer: http://stackoverflow.com/a/22375852
downvote count: 0
has answer: http://stackoverflow.com/a/24061188
has answer: http://stackoverflow.com/a/29968359
has comment: http://stackoverflow.com/comment/34014021
has comment: http://stackoverflow.com/comment/34026071
has title: Why is java.util.concurrent.FutureTask not serializable
accepted answer: http://stackoverflow.com/a/24061188
answer count: 3
has comment: http://stackoverflow.com/comment/34014301
favorite count: 0
has body: I am currently using Apache Wicket. I have some REST calls which take a few seconds each. Wicket allows ajax calls synchronously only, so I was trying to use Future and Callable. This is part of my class: public abstract class GetPrices extends AbstractAjaxTimerBehavior { private static final long serialVersionUID = 1L; private List&lt;Future&lt;List&lt;Result&gt;&gt;&gt; list; public GetPrices(Duration updateInterval, List&lt;Callable&gt; priceCalls) { super(updateInterval); list = new ArrayList&lt;Future&lt;List&lt;Result&gt;&gt;&gt;(); ExecutorService executor = Executors.newFixedThreadPool(priceCalls.size()); for(Callable callable : priceCalls) { list.add(executor.submit(callable)); } executor.shutdown(); } @Override protected void onTimer(AjaxRequestTarget target) { while(list.hasNext()) { Future&lt;List&lt;Result&gt;&gt; future = listIterator.next(); if(future.isDone()) { List&lt;Result&gt; data = future.get(); //Process data } } } //Error handling etc } The List&lt;Callable&gt; priceCalls contains the method calls to the appropriate price calls I receive The object type is not Serializable! against java.util.concurrent.FutureTask list field I am assuming I should design this differently. Could any provide any thoughts on how this should be done? I am using Spring if that helps

http://stackoverflow.com/q/22466519
tagged with: last.fm
upvote count: 1
has title: Api Last.fm: track.getPlaycount() return -1
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22491048
has body: I use the java api for binding last.fm http://www.lastfm.fr/api to extract some information about querlques songs. I search songs according tags and I want to get the playcount of each song that matches the tag that I took, but the playcount me always returns -1. Collection&lt;Track&gt; tracks=Tag.getTopTracks("Believe", key); for (Track track : tracks) { System.out.println("chanson:"+track.getName()); System.out.println("playcount: "+track.getPlaycount()); System.out.println("\n***************************************************"); }
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34169950
type: Comment
score: 0
has text: @armin did you try my suggestion?
comment on: http://stackoverflow.com/q/22429134
type: QuestionComment

http://stackoverflow.com/comment/33945894
has text: I have thought about this, but then I would have to make a return type for every new builder.. which I wanted to avoid and create one generic method
comment on: http://stackoverflow.com/a/22336405
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22369344
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/43729055
type: AnsweredQuestion
tagged with: jpa
linked to: http://stackoverflow.com/q/8925948
has answer: http://stackoverflow.com/a/22370548
type: Question
has answer: http://stackoverflow.com/a/22370723
has body: I am trying to use Criteria API from Hibernate by getting hibernate session from EntityManager as following public org.hibernate.Criteria getCriteria() { HibernateEntityManager hem = em.unwrap(HibernateEntityManager.class); org.hibernate.Session session = hem.getSession(); return session.createCriteria(getEntityBeanType()); } In createCriteria return I am getting "session is closed error". From the same point of code where I call getCriteria if I call createQuery method as getEntityManager().createQuery("....."); It is working fine and I can do select on database. I want to use Hibernate Criteria API becuase I am comfortable with it.
tagged with: createcriteria
possible better answer: http://stackoverflow.com/a/22370723
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/22370548
tagged with: createquery
has title: JPA createQuery working but createCriteria not working session is closed error

http://stackoverflow.com/comment/34112145
score: 0
type: AnswerComment
type: Comment
has text: One more difference is that I removed the redirect:. Why do u need to use redirect anyway?
comment on: http://stackoverflow.com/a/22381126

http://stackoverflow.com/a/22444722
answers question: http://stackoverflow.com/q/22444538
score: 1
upvote count: 1
type: Answer
downvote count: 0
has body: Let's start with the fact that your overriding paint of JPanel and NOT calling super.paint. Instead, you should be overriding paintComponent and ensuring that you are calling super.paintComponent before you do any kind of custom painting. Take a look at Performing Custom Painting Don't rely on static values, especially width and height, instead, your component should be supply size hints back to the system. The problem is, it's very difficult to accurately calculate a frame size which takes into account the different frame decoration requirements. Instead, have your component define it's preferred size and use the frame's pack method to take care of ensuring the frame size. I'd also discourage the use of java.util.Timer in favor of javax.swing.Timer as there is less chance of violation of the single thread rules of Swing and less requirement to ensure that the model is synchorinsed against paints...

http://stackoverflow.com/comment/34012523
comment on: http://stackoverflow.com/q/22374747
score: 0
type: Comment
type: QuestionComment
has text: Same is the case in C++. Why should the order differ there then?

http://stackoverflow.com/q/22434070
has body: I have created a project, targeting android 4.4 - API Level 19, as suggested by eclipse. Anyways, on the emulator everything looks perfect - here is a screenshot: The problems comes when I install it on my real device - running android 4.1.2. Everything is just perfect and working like a charm, excepting the background image. It is showing a white background, like the picture does not exists. Here is my xml: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" 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" android:orientation="vertical" android:gravity="center" android:padding="30dp" android:background="@drawable/wg_blurred_backgrounds_12" &gt; &lt;Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/btnTopJokes" android:onClick="showTopJokes" android:gravity="center" /&gt; &lt;Button android:layout_marginTop="10dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/btnNewJokes" android:onClick="showNewJokes" android:gravity="center" /&gt; &lt;Button android:layout_marginTop="10dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/btnAllJokes" android:onClick="showAllJokes" android:gravity="center" /&gt; &lt;Button android:layout_marginTop="10dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/btnMyFavorites" android:onClick="showFavorites" android:gravity="center" /&gt; &lt;Button android:layout_marginTop="10dp" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/btnCategories" android:onClick="showCatego…
type: Question
has answer: http://stackoverflow.com/a/55803211
has title: Android device is not showing the background image
has answer: http://stackoverflow.com/a/45888455
has answer: http://stackoverflow.com/a/38411085
has answer: http://stackoverflow.com/a/22434215
downvote count: 0
has comment: http://stackoverflow.com/comment/34116159
has answer: http://stackoverflow.com/a/29067760
tagged with: android
has answer: http://stackoverflow.com/a/34741779
tagged with: android-activity
has comment: http://stackoverflow.com/comment/34116239
favorite count: 0
answer count: 9
possible better answer: http://stackoverflow.com/a/29067760
has answer: http://stackoverflow.com/a/50497266
score: 6
has answer: http://stackoverflow.com/a/22434547
upvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/65023890
accepted answer: http://stackoverflow.com/a/22434547
tagged with: java

http://stackoverflow.com/comment/33989793
comment on: http://stackoverflow.com/a/22352724
score: 0
type: AnswerComment
type: Comment
has text: originally was absolute path not a relative. i fixed it in question.

http://stackoverflow.com/comment/34280106
type: AnswerComment
comment on: http://stackoverflow.com/a/22481713
score: 0
type: Comment
has text: Is there anyway to reset the JBoss timezime to other timezone without restarting it ?

http://stackoverflow.com/q/22487155
tagged with: java
type: Question
type: AnsweredQuestion
has title: Ant JUnit job fails to run Spring's tests - Spring class runner not found
tagged with: ant
tagged with: ivy
has comment: http://stackoverflow.com/comment/34209945
has body: I have an Eclipse Spring project with Ivy dependency management library (with jars in local cache). I wrote some JUnit test classes with @RunWith(SpringJUnit4ClassRunner.class) annotation, and I can run them in Eclipse without any problem. Unfortunately I can't run them as Ant jobs. I got following exception: Type org.springframework.test.context.junit4.SpringJUnit4ClassRunner not present java.lang.TypeNotPresentException: Type org.springframework.test.context.junit4.SpringJUnit4ClassRunner not present at com.sun.proxy.$Proxy4.value(Unknown Source) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424) at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138) Caused by: java.lang.ClassNotFoundException: org.springframework.test.context.junit4.SpringJUnit4ClassRunner 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) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at java.lang.Class.initAnnotationsIfNecessary(Class.java:3178) at java.lang.Class.getAnnotation(Class.java:3137) It looks like Ant had not put Ivy's cache into classpath. I tried even putting directory of Ivy's cache into classpath, but with no results. What I should do? My Ivy dependences: <dependency org="org.springframework" name="spring-core" rev="3.2.8.RELEASE"/> <dependency org="org.springfra…
upvote count: 1
answer count: 1
tagged with: junit
favorite count: 0
tagged with: spring
has answer: http://stackoverflow.com/a/22494588
accepted answer: http://stackoverflow.com/a/22494588
downvote count: 0
score: 1

http://stackoverflow.com/comment/34204024
type: AnswerComment
has text: I might be missing something here, but I believe creating a holder for every View actually defeats the purpose of having a holder in the first place.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22483861

http://stackoverflow.com/q/22384757
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34029523
has answer: http://stackoverflow.com/a/22385267
downvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/22384818
has answer: http://stackoverflow.com/a/22385261
tagged with: synchronization
favorite count: 0
accepted answer: http://stackoverflow.com/a/22385267
possible better answer: http://stackoverflow.com/a/22384818
tagged with: multithreading
has title: Java: synchronizing list
has body: I have an ArrayList and I manipulate it ONLY within a synchronized block, should I use Collections.synchronizedList too? Example: List list = Collections.synchronizedList(new ArrayList()); // versus List list = new ArrayList(); synchronized(list) { // my code }
type: AnsweredQuestion
score: 3
tagged with: list
upvote count: 3

http://stackoverflow.com/q/22378687
downvote count: 0
has body: I am testing a class with mockito. It contains these methods: add(Sortable s) List&lt;Sortable&gt; get() The class does several things to the objects internally, and it is dependant on sorting the Sortable objects. The problem is that I am mocking Sortable, which makes compareTo() always return 0. Is there a way to make a Sorting mock that has the original Sortable compareTo() implementation? Or are there other ways to solve this?
score: 1
tagged with: java
tagged with: unit-testing
type: Question
tagged with: mockito
answer count: 1
has title: Sorting mock objects in mockito
has comment: http://stackoverflow.com/comment/34018689
upvote count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22379761
has comment: http://stackoverflow.com/comment/34020942
accepted answer: http://stackoverflow.com/a/22379761

http://stackoverflow.com/q/22410602
upvote count: 3
tagged with: encryption
accepted answer: http://stackoverflow.com/a/22412532
possible better answer: http://stackoverflow.com/a/22412280
linked to: http://stackoverflow.com/q/3451670
downvote count: 1
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34077484
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34080063
has comment: http://stackoverflow.com/comment/34079701
favorite count: 0
has comment: http://stackoverflow.com/comment/34074598
has title: Turn String to 128-bit key for AES
has body: I want to enter my own String variable to then turn it into a key for encryption/decryption for AES algorithm. I have tried many known ways such as UTF-8, base64, some methods doing conversion byte-string and vice versa and some other. Although it's true that all of them work even with some of them not working accurately, all of them turn the string in bytes, but what i want is to enter something like "helloWorld" and get back a 128-bit key for AES. Anything i use it goes for "Invalid key length" since the bytes are not accurate. What do i need to do to get the correct bytes? Also i want to clarify that i want String and not an array of char since i want to make it as a function in my programm later so that the user can change the key at will should it be compromised. UPDATE: i edited the example and this i what i have so far, still throws exception about parameters and key length though public class SHAHashingExample { private static byte[] keyValue; public static void main(String[] args)throws Exception { String password = "123456"; MessageDigest md = MessageDigest.getInstance("SHA-256"); md.update(password.getBytes()); byte byteData[] = md.digest(); keyValue = md.digest(); //convert the byte to hex format method 1 StringBuffer sb = new StringBuffer(); for (int i = 0; i &lt; byteData.length/2; i++) { sb.append(Integer.toString((byteData[i] &amp; 0xff) + 0x100, 16).substring(1)); } System.out.println("Hex format : " + sb.toString()); //convert the byte to hex format method 2 StringBuffer hexString = new StringBuffer(); for (int i=0;i&lt;byteData.length/2;i++) { String hex=Integer.toHexString(0xff &amp; byteData[i]); if(hex.length()==1) hexString.append('0'); hexString.append(hex); } System.out.println("Hex format : " + hexString.toString()); String k = "hello world"; String f = encrypt(k); System.out.println(f); String j = decrypt(f); System.out.println(j); } public static String encrypt(String Data) throws Exception { Key key = generateKey(); Cipher c = Cipher.get…
has answer: http://stackoverflow.com/a/22412280
has answer: http://stackoverflow.com/a/22412532

http://stackoverflow.com/comment/34137787
type: Comment
type: QuestionComment
has text: if you take the 'double' out of: double bet = in.nextDouble(); then bet will be set by rewardBet(); you won't need to return it.
comment on: http://stackoverflow.com/q/22445642
score: 0

nodelist
type: Tag
tags question: http://stackoverflow.com/q/22437734
tag name: nodelist

http://stackoverflow.com/q/22408229
type: AnsweredQuestion
has body: I would like to open file specified by its path in NetBeans editor at specific line and row. I would like the same functionality as is when some Java/C/C++ or any other programming language prints an Exception. As far as I went for now: Write Exception in console By using OutputListener resolve what should be printed as hypertext OutputListener.outputLineAction that defines what to do when clicked on hypertext ---HERE I DONT KNOW WHAT TO DO--- An example of error message I need to resolve: E ERRORCODE: error definition; line=2; column=30; source='file:/C:/...' How can I open file in my plugin in text editor and point to specific line and column?
tagged with: java
accepted answer: http://stackoverflow.com/a/22421536
type: Question
tagged with: netbeans-plugins
answer count: 1
has answer: http://stackoverflow.com/a/22421536
score: 0
has title: NetBeans plugin - open file at specific line and column
tagged with: netbeans
tagged with: plugins

http://stackoverflow.com/a/22408807
has comment: http://stackoverflow.com/comment/34238720
answers question: http://stackoverflow.com/q/22407994
score: 5
has comment: http://stackoverflow.com/comment/34071356
upvote count: 5
has body: Lets try a few things: 1.) Do you know what kind of Authentication the server expects? 2.) When you try to access https://reporting-stage.admp.mtv3.adtlgc.com/admp/ReportingService?wsdl do you see anything? e.g. i assume there is a IP-Whitelist or something and you will enter credentials there or similar? Because i cant see anything there. 3.) When it comes to the code i authenticate to a secured webservice over HTTP this way: ReportingServiceService service new ReportingServiceService(); ReportingService port = service.getReportingServicePort(); BindingProvider binding = (BindingProvider) port; // Configure service endpoint (override defined one of the WSDL) BindingProvider binding = (BindingProvider) port; binding.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https.."); // Add HTTP Basic Authentification credentials to this request binding.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "myuser"); binding.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "mypasswd"); port.getCampaignRowById(14081); Set above endpoint propertie to whatever is stored in your wsdl's wsdl:port... part which i expect to look something like this (and should be the default...): &lt;wsdl:service name="ReportingServiceFoo"&gt; &lt;wsdl:port binding="tns:ReportingServiceFoo" name="ReportingService"&gt; &lt;soap:address location"https://myserver.com/ReportingService"&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt; Edit: The BindingProvider.ENDPOINT_ADDRESS_PROPERTY is used to set the target-endpoint at runtime. So if the webservice has a different endpoint than the one in the wsdl make sure to set it to the actual endpoint this way.
has comment: http://stackoverflow.com/comment/34235765
downvote count: 0
has comment: http://stackoverflow.com/comment/34444516
has comment: http://stackoverflow.com/comment/34239830
has comment: http://stackoverflow.com/comment/34071189
type: Answer

http://stackoverflow.com/comment/34193012
type: AnswerComment
comment on: http://stackoverflow.com/a/22477844
score: 0
type: Comment
has text: public boolean validateIPAddress( String ipAddress ) { String[] tokens = ipAddress.split("\\."); if (tokens.length != 4) { return false; } for (String str : tokens) { int i = Integer.parseInt(str); if ((i < 0) || (i > 255)) { return false; } } return true; }.Try this code.

http://stackoverflow.com/q/22478258
tagged with: android-library
has title: How to include dependencies in android library gradle project?
tagged with: maven
accepted answer: http://stackoverflow.com/a/23598545
possible better answer: http://stackoverflow.com/a/22486198
type: AnsweredQuestion
tagged with: java
tagged with: gradle
type: Question
score: 9
answer count: 2
linked to: http://stackoverflow.com/q/29149359
upvote count: 9
has body: I'm building an android library project with Gradle using Android Studio. It has some local dependencies: compile project(':androidlibrary') with nested, additional external dependencies: compile group: 'com.google.guava', name: 'guava', version: '14.0.1' I managed to build the aar file but no external or local dependencies are included. I expect external dependencies to be mentioned in the POM file when published to maven, but what about the local ones? What is the right way to build such project?
downvote count: 0
has answer: http://stackoverflow.com/a/23598545
tagged with: android
favorite count: 0
has answer: http://stackoverflow.com/a/22486198

http://stackoverflow.com/a/22483015
type: Answer
has body: In your DBHelper() you have the line context=this.context; which is supposed to be this.context = context You are overriding the context parameter with the objects context, which is not initialized at that time. Thus I expect your context is null.
has comment: http://stackoverflow.com/comment/34246650
has comment: http://stackoverflow.com/comment/34244290
accepted answer of: http://stackoverflow.com/q/22482873
upvote count: 4
answers question: http://stackoverflow.com/q/22482873
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/a/45131650
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22486997
type: Answer
has body: Thanks @Nizet's answer, I have written a sample code for some people who want to practice and learn. import java.util.Timer; import java.util.TimerTask; public class TimerTest { public static void main(String args[]){ TimerTest.DelayTask task = new DelayTask(); Timer timer = new Timer(); /** * Use schedule or scheduletAtFixedrate and check the printed result */ timer.schedule(task, 0, 5000); //timer.scheduleAtFixedRate(task, 0, 5000); } public static boolean stop = false; public static void delayOneSec(String status){ try{ System.out.print(status); Thread.sleep(1000); }catch(Exception e){ e.printStackTrace(); } } static class DelayTask extends TimerTask{ int count = 2; @Override public void run() { // TODO Auto-generated method stub stop = true; for(int i = 0; i &lt; count; i++){ TimerTest.delayOneSec("T"); } if(count == 2){ count = 6; }else{ count = 2; } stop = false; new PrintW().start(); } } static class PrintW extends Thread{ @Override public void run(){ while(!stop){ TimerTest.delayOneSec("W"); } } } } The task itself will repeat to take 2 seconds or 6 seconds. Let's see the result of each scenario. When using timer.schedule(task, 0, 5000);, the output is TTWWWTTTTTTTTWWWTTTTTTTTWWWTTTTTTTT. As you can see, the timer follow the rules like below, wait till period time outs if task finishes in time, launch next task immediately if current task lasts more than period. When using timer.scheduleAtFixedRate(task, 0, 5000);, the output is TTWWWTTTTTTTTWWTTTTTTTTWWTTTTTTTTWWTTTTTTTTWWTTTTTTTTWWTTTTTTTT. Things are a little different now. The javadoc two or more executions will occur in rapid succession to "catch up." takes effect here. As you can see, ignoring the first TTWWW, every two tasks will print TTTTTTTTWW and it lasts 10 seconds(two periods). Let's dig into the source code of Timer. public void schedule(TimerTask task, Date firstTime, long period) { if (period &lt;= 0) throw new IllegalArgumentException("Non-positive period."); sched(task, firstTime.getTime(),…
score: 3

http://stackoverflow.com/q/22382829
has comment: http://stackoverflow.com/comment/34036571
has comment: http://stackoverflow.com/comment/34036666
has title: Start an Activity if string match
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34032916
has body: I am try to implement a function for start an activity only if the name of the item inside a list view match. This is the code, but on click, the application crash. What's wrong? lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapter, View view, int position, long arg) { String selectedValue = adapter.getSelectedItem().toString(); if(selectedValue.equalsIgnoreCase("A")) { Intent appInfo = new Intent(MainActivity.this, MapActivity.class); startActivity(appInfo); } } }); and this is the Activity public class MainActivity extends Activity { ListView lv; ArrayAdapter&lt;MyFile&gt; adapter; public void list() { lv = (ListView) findViewById(R.id.listView1); File dir = new File(Environment.getExternalStorageDirectory().getPath() + "/osmdroid/tiles/"); File[] filelist = dir.listFiles(); ArrayList&lt;MyFile&gt; theNamesOfFiles = new ArrayList&lt;MyFile&gt;(); for (File temp : filelist) { theNamesOfFiles.add(new MyFile(temp)); } Collections.sort(theNamesOfFiles, new Comparator&lt;MyFile&gt;() { @Override public int compare(MyFile lhs, MyFile rhs) { return lhs.toString().compareToIgnoreCase(rhs.toString()); } }); adapter = new ArrayAdapter&lt;MyFile&gt;(this, R.layout.list_row,theNamesOfFiles); lv.setAdapter(adapter); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); list(); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapter, View view, int position, long arg) { String selectedValue = adapter.getSelectedItem().toString(); if(selectedValue.equalsIgnoreCase("A")) { Intent appInfo = new Intent(MainActivity.this, MapActivity.class); startActivity(appInfo); } } }); lv.setOnItemLongClickListener(new OnItemLongClickListener() { // setting onItemLongClickListener and passing the position to the // function @Override public boolean onItemLongClick(AdapterView&lt;?&gt; ar…
has comment: http://stackoverflow.com/comment/34037182
score: 0
has answer: http://stackoverflow.com/a/22383076
has comment: http://stackoverflow.com/comment/34026060
has comment: http://stackoverflow.com/comment/34042791
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34040125
tagged with: android

http://stackoverflow.com/a/22389815
type: Answer
has comment: http://stackoverflow.com/comment/34053520
has body: Here is the solutions: Grow the TextArea (height) as user put more text lines Shink the TextArea as user remove lines import com.google.gwt.core.client.EntryPoint; import com.google.gwt.dom.client.Style.Overflow; import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.event.dom.client.KeyPressHandler; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.TextArea; public void onModuleLoad() { final TextArea textArea=new TextArea(); textArea.setStyleName("textboxStyle"); textArea.getElement().getStyle().setOverflow(Overflow.AUTO); textArea.getElement().setAttribute("wrap","off"); textArea.setVisibleLines(1); textArea.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { System.out.println("Value changed"); } }); textArea.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { int lines = 0; final String s = textArea.getText(); for (int i = 0; i != -1; i = s.indexOf("\n", i + 1)) { lines++; } if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { // User hit "Enter" // key lines++; } textArea.setVisibleLines(lines); } }); RootPanel.get().add(textArea); } Should also be able to handle "CTRL + V" and paste text event Yes you can handle it using addChangeHandler method textArea.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { System.out.println("Value changed"); } }); if the text exceeds the width, a scroll left, right bar should show up. textArea.getElement().setAttribute("wrap","off"); css applied .textboxStyle{ font-family: sans-serif; font-size: 12px; font-weight: normal; } screeenshots
answers question: http://stackoverflow.com/q/22388444
accepted answer of: http://stackoverflow.com/q/22388444
has comment: http://stackoverflow.com/comment/34053392
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/44872595

http://stackoverflow.com/comment/34139768
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22446947
has text: I don't know of such a pattern. You can have a back reference. If you try to change it and it's not `null`, throw an `IllegalStateException`
score: 0

http://stackoverflow.com/comment/34040281
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22390113
has text: no, cant find symbol substring because im using list<string>

http://stackoverflow.com/q/22339189
has answer: http://stackoverflow.com/a/22339271
type: Question
has title: Using threading in Java
has body: I have a question about threading in Java. So, I have a gui program which consists of 8 buttons and if you click any one of them, the colors of all the other buttons are changed. But I have to modify it, so that the colors are automatically changed after 5 seconds. So, when you run the program, the colors of all the buttons should change for 5 seconds. And if you click on a button, the timer is reset. I was hoping you guys can give some suggestions on how should I approach it. I have to use threading. Any help would be appreciated. What if I want to do it without the timer?
answer count: 2
tagged with: user-interface
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22339263

http://stackoverflow.com/comment/34017700
type: QuestionComment
comment on: http://stackoverflow.com/q/22377964
has text: Note: code could be optimized... Instead of using `.matches()` on strings, you could create `Pattern` instances instead. `String.matches()` will recreate a `Pattern` each time...
score: 0
type: Comment

http://stackoverflow.com/a/22455713
has comment: http://stackoverflow.com/comment/34154223
has comment: http://stackoverflow.com/comment/34155278
accepted answer of: http://stackoverflow.com/q/22455603
upvote count: 1
has comment: http://stackoverflow.com/comment/34155419
has comment: http://stackoverflow.com/comment/34154514
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34154190
has body: The easiest way will be to: Count the total number of elements Allocate a new array Loop through the arrays adding them to the new one Use Arrays.sort() on the result. You may be able to use the fact the arrays are already sorted to try and do something fancy with insertion but the performance gains will be small and the increase in code complexity will be massive. You are far more likely to add bugs than to gain performance. To do the sorted insertion you would need an array of indexes for each source array. Count the total number of elements Allocate a new array Loop through all the arrays and find the one with the lowest (or highest depending on sort direction) value Insert that value and increment the index for that source array and for the destination array by one. Go back to step 3 until you run out of data in all the source arrays
answers question: http://stackoverflow.com/q/22455603
has comment: http://stackoverflow.com/comment/34154310
type: AcceptedAnswer

http://stackoverflow.com/comment/34193622
score: 0
type: Comment
type: QuestionComment
has text: @MarkoTopolnik thanks again for your reply! I just have 1 more question. So if I open a class file in a hex editor, and in the source file the was the string "a" just on its own. Would I see the hexadecimal value of 0061 or whatever encoding Java uses?
comment on: http://stackoverflow.com/q/22477842

http://stackoverflow.com/comment/33975909
type: Comment
has text: I created this layout for normal screen size, but I also created the other 3 layouts for the other 3 screen sizes. My problem is that if I fill a row with 10 ImageViews in a 4 col or smaller screen size phone, ImageViews will be too small to you can touch them perfectly. You have to be really skillful to touch the ImageView you want and because of this I would like to zoom in.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22351558

http://stackoverflow.com/comment/34175530
score: 1
comment on: http://stackoverflow.com/q/22467362
has text: Perhaps what you have overlooked is [erasure](http://docs.oracle.com/javase/tutorial/java/generics/erasure.html). This is just the way generics are implemented.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34182251
comment on: http://stackoverflow.com/a/22468024
score: 0
type: AnswerComment
type: Comment
has text: I'll be home in about two hours. I'll be able to fix it for you then. Does that give you enough time?

http://stackoverflow.com/q/22357491
score: 0
type: UnansweredQuestion
answer count: 0
has title: Struggling with my procedure in Java
tagged with: java
has comment: http://stackoverflow.com/comment/33983182
has comment: http://stackoverflow.com/comment/33986763
has body: I'm currently struggling to make my procedures to work. I'm having to do this all as objects This is what I have in my main file currently: public static void main(String[] args) { Scanner input = new Scanner(System.in); Room[] myHotel = new Room[6]; //myHotel[x] = new Room(); myHotel[0] = new Room(); myHotel[1] = new Room(); myHotel[2] = new Room(); myHotel[3] = new Room(); myHotel[4] = new Room(); String roomName = null; String choice; int roomNum = 0; initialise(myHotel); while ( roomNum &lt; 5 ) { System.out.println("Hotel Booking Options"); System.out.println("V: To View all rooms"); System.out.println("A: To Add a customer to a room"); choice = input.next(); if (choice.equals("V")) //views all the rooms { view(myHotel, roomName); } if (choice.equals("A")) //To add a customer to a room { System.out.println("Enter room number (0-5) or 6 to stop:" ); roomNum = input.nextInt(); System.out.println("Enter name for room " + roomNum + " : " ) ; roomName = input.next(); myHotel[roomNum].mainName = roomName ; //myHotel[roomNum].setName(roomName); add(myHotel, roomName); System.out.println(" "); } } } private static void initialise( Room hotelRef[] ) { for (int x = 0; x &lt; 5; x++ ) hotelRef[x].mainName = "empty"; System.out.println( "initilise "); } public static void view(Room myHotel[], Room roomName){ for (int x = 0; x &lt;5; x++) { int z = 0; Room Roomname = roomName; myHotel[z]= Roomname; if (myHotel[x].mainName.equals("empty")) System.out.println("room " + x + " is empty"); else { System.out.println("room " + x + " occupied by " + myHotel[x].mainName); //System.out.println("room " + x + " is occupied by "+ myHotel[x]); } } } private static void add(Room myHotel[], String roomName){ for (int x = 0; x &lt;5; x++) { int z = 0; String Roomname = roomName; myHotel[z]= Roomname; if (myHotel[x].mainName.equals("empty")) { System.out.println("room " + x + " is empty"); } else { System.out.println("room " + x + " is occupied by "+ myHotel[x]); } } } } In my other .java fi…
type: Question
has comment: http://stackoverflow.com/comment/33982779
has comment: http://stackoverflow.com/comment/33983361

http://stackoverflow.com/a/22366094
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22366014
has body: NumBox[pick-1] = 0; System.out.println (Arrays.toString(NumBox)); You are constantly setting the value back to 0. The forloop before, the one that prints the values using System.out.println(i) is printing 0's because you never initialized any values after creating the array. (no values are initialized until you're in the infinite while loop) Scanner scan = new Scanner (System.in); System.out.println ("How many number would you like to play with?"); int StartNum = scan.nextInt(); //receive input int score1 = 0; int score2 = 0; int[] NumBox = new int[StartNum]; //create array length of input for (int i = 1; i &lt; NumBox.length+1; i++) { //? } int pick = 0; boolean GG = false; System.out.println ("Playing with " + StartNum + "numbers"); //prints input number System.out.println ("Notice that 0 represnts an unavailable numbers"); for (int i = 1; i &lt; NumBox.length+1; i++) //prints all the values that havent been initialized yet { System.out.println(i); //prints all values in array (none have been set yet, 0s) } while (GG == false) { System.out.println ("Pick an an available number: "); pick = scan.nextInt(); //receives next input if (pick != 0) { score1 = pick + score1; NumBox[pick-1] = 0; //sets a value to 0. the only time a value is set for array System.out.println (Arrays.toString(NumBox)); //prints all the 0s

http://stackoverflow.com/a/27250515
upvote count: 16
has body: I found org.apache.commons.lang3.time.DateUtils is more intuitive and easy to use. For your question Date date = DateUtils.addDays(new Date(), -1); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(date); will do the trick. And it works well also in JDK7 or below.
answers question: http://stackoverflow.com/q/22458042
type: Answer
downvote count: 0
score: 16

http://stackoverflow.com/a/44879634
upvote count: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22381202
score: 2
has body: Check your console. It says java.lang.SecurityException issue. Change your 'package name'. I changed my package name from 'java.assessment' to 'assesment' and it worked for me. If somebody knows the root cause , let me know please.

http://stackoverflow.com/a/22342772
type: Answer
has comment: http://stackoverflow.com/comment/33957382
answers question: http://stackoverflow.com/q/22342663
has body: this will get what you are looking for: public class Launch { public static String[] josh = { "Josh", "mcMc", "16", "grade 11" }; public static void main(String[] args) { Scanner sc = new Scanner(System. in ); System.out.print("Please enter the first name of the person you would love to know about : "); String hisName = sc.next(); printSomeInfoAbout(hisName); } public static void printSomeInfoAbout(String name) { if(name.equals(josh[0])){ System.out.println("My name is " + josh[0] + " " + josh[1] + ". I am " + josh[2] + " " + "Years old and I am currently in " + josh[3] + "."); } } }
score: 0

http://stackoverflow.com/q/22359950
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22360497
has body: includes a pile of cards in a player’s hand and two actions: TAKE and DISCARD. TAKE puts a card on the top of a player’s pile of cards when that player receives a card from a dealer. DISCARD removes a card from the top of a player’s pile of cards when a player plays it against another player in the game. Each player receives 16 cards from the dealer at the beginning of a game........ I tried my code like this which gives me nothing public class play { int noOfCards = 16; static void TAKE(Stack st, int a) { st.push(new Integer(a)); } static void DISCARD(Stack st) { Integer a = (Integer) st.pop(); } public static void main(String args[]) { for(int i=0; i&lt;=16; i++) { Stack st = new Stack(); st.take(); st.discard(); } } } I am new to this concepts ....give me a path to solve this question
answer count: 2
has comment: http://stackoverflow.com/comment/33987682
tagged with: data-structures
has comment: http://stackoverflow.com/comment/33989048
score: 0
has title: To implement pile of cards and manage players
tagged with: playing-cards
has comment: http://stackoverflow.com/comment/33986996
has answer: http://stackoverflow.com/a/22361713
accepted answer: http://stackoverflow.com/a/22361713
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22360497
tagged with: stack

http://stackoverflow.com/a/22464267
type: Answer
has body: One more suggestion. Some of the REST API's endpoints support the Graph Store Protocol and the SPARQL Protocol. You can send turtle to the graph store protocol with any HTTP client... here's the curl for it: curl -Hcontent-type:text/turtle \ -d@'nameofturtlefile.ttl' \ -X PUT URLFORHOST/v1/graphs?graph=nameofgraph. That endpoint takes care of the translation to sem:triple elements; you should never have to see that XML representation of triples. Translate the curl call to Apache HTTP Client and you have a way to ingest turtle. I've also used the Jena API (look up riot) to save turtle to MarkLogic.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22459406
score: 1
answers question: http://stackoverflow.com/q/22459406
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34136951
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22445011
score: 0
has text: @d_ominic, its supposed to be how I'm feeding in the desired values in to the "rows" array, but its feeding in null values instead E: And yes, I noticed that I forgot the {}, thats been fixed and the problem remains.

http://stackoverflow.com/q/22378854
has answer: http://stackoverflow.com/a/22379685
accepted answer: http://stackoverflow.com/a/22379685
has title: how to move an android view up and down smoothly 8 times?
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
tagged with: animation
type: AnsweredQuestion
score: 1
tagged with: android-animation
tagged with: java
has body: how to move an android view up and down smoothly 8 times? Here is my code final TranslateAnimation breathUpTranslateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0F, Animation.RELATIVE_TO_SELF, 0.0F, Animation.RELATIVE_TO_PARENT, 0.0F, Animation.RELATIVE_TO_SELF, -0.05F); breathUpTranslateAnimation.setDuration(TOOLTIP_ANIM_DURATION); //breathUpTranslateAnimation.setInterpolator(new DecelerateInterpolator()); breathUpTranslateAnimation.setRepeatCount(8); breathUpTranslateAnimation.setRepeatMode(Animation.RESTART); breathUpTranslateAnimation.setInterpolator(new DecelerateInterpolator()); //breathUpTranslateAnimation.setFillAfter(true); toolTipLayout.startAnimation(breathUpTranslateAnimation); but in reality, the view is moving up smoothly and return very fast or immediately back to starting point. I want it to be back smoothly as well.
type: Question

storage
tag name: storage
tags question: http://stackoverflow.com/q/22404750
tags question: http://stackoverflow.com/q/22366217
type: Tag

http://stackoverflow.com/a/31795069
upvote count: 1
type: Answer
has body: Replace the below line: Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); with below line: Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding","BC");
answers question: http://stackoverflow.com/q/22427479
score: -1
downvote count: 2

http://stackoverflow.com/comment/34206465
has text: `if (digits = false)` should be `if (digits == false)` or even better `if (!digits)`. `=` for assignment and `==` for comparison
comment on: http://stackoverflow.com/q/22485508
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/q/22406460
score: 1
has answer: http://stackoverflow.com/a/22406788
tagged with: java
tagged with: listview
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34067039
has comment: http://stackoverflow.com/comment/34067084
has answer: http://stackoverflow.com/a/22406648
tagged with: android
accepted answer: http://stackoverflow.com/a/22406648
has body: Hello at all the community, i've a listview with a custom adapter that consists by one textview and one edit text. i set the text for the edit text into the adapter but in my acivity (listview) i want to set the onClickListener at this edit text. ive this code for my getView method @Override public View getView(int position, View view, ViewGroup parent) { if(view == null) { holder = new Holder(); inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.my_adapter, null); holder.textView = (TextView)view.findViewById(R.id.textView); holder.editText = (EditText)view.findViewById(R.id.editText); view.setTag(holder); } else { holder = (Holder)view.getTag(); } holder.editText.setText("My text"); holder.textView.setText("text"); return view; } @Override public boolean isEnabled(int position) { return false; } i disablet the click on listview with the isEnabled method because I will not be able to click on the list. in my activity i've only the listview so if i want to set onclicklistener on the edit text of the adapter how can i do this? public MyAdapterClass(Context context, int textViewResourceId, ArrayList&lt;String&gt; list) { super(context, textViewResourceId, list); // TODO Auto-generated constructor stub this.list = list; this.context = context; }
upvote count: 1
has comment: http://stackoverflow.com/comment/34067027
has comment: http://stackoverflow.com/comment/34067247
has title: set onClickListener edit text listview
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22406788

http://stackoverflow.com/q/22404280
score: 0
accepted answer: http://stackoverflow.com/a/22404405
has answer: http://stackoverflow.com/a/22405028
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22405028
type: Question
answer count: 2
tagged with: nullpointerexception
tagged with: priority-queue
has body: I am implementing a priority queue using a stack, but a NullPointerException is occurring and I can't figure out why. I am trying to add an integer "1" by using the push method in the MyStack class. The error occurs at the add statement. class MyStack&lt;E&gt; { private PriorityQueue&lt;MyNode&lt;E&gt;&gt; pq; int p =0; public void push(int j){ p++; pq.add(new MyNode(j,p)); // error detected here } public MyNode pop(){ if(isEmpty()){ return null; } return pq.poll(); } public boolean isEmpty() { return pq.isEmpty(); } } Edited: Reflects problem encountered in a proper manner :)
has title: Why is a nullpointerexception occuring?
has answer: http://stackoverflow.com/a/22404405

http://stackoverflow.com/comment/34272598
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22522537
type: Comment
has text: The line numbers are to lines in a compiled JSP file. Do you think that would still help you?

http://stackoverflow.com/comment/34053645
type: AnswerComment
type: Comment
has text: I have two instances of the android eclipse each one with different SDK Manager.exe neither of them won't open it will just show the status bar
comment on: http://stackoverflow.com/a/22398264
score: 0

http://stackoverflow.com/comment/33974689
has text: So many questions! All of your answers are here https://developers.google.com/glass/distribute/index
score: 1
comment on: http://stackoverflow.com/q/22352100
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34058598
type: AnswerComment
type: Comment
has text: The difference is that `read` only *promises* to read 1 byte. It might read 100, but it might also only read 1. It returns the number of bytes it did read, you have to check that it returned the number you expected. `readFully()` on the other hand promises to read all the bytes you ask for.
comment on: http://stackoverflow.com/a/22376949
score: 0

http://stackoverflow.com/comment/40530482
score: 0
type: Comment
type: AnswerComment
has text: similar question here: http://stackoverflow.com/questions/19399944/warning-on-permissions-attribute-when-running-an-applet-with-jre-7u45/25895666#25895666
comment on: http://stackoverflow.com/a/25896052

http://stackoverflow.com/a/22384379
type: Answer
has body: System.out.println("converted " + converted); This will use the toString() method of converted. You might want to use your SimpleDateFormat here?
answers question: http://stackoverflow.com/q/22383875
score: 0

jbutton
tags question: http://stackoverflow.com/q/22331641
tags question: http://stackoverflow.com/q/22337603
tags question: http://stackoverflow.com/q/22347697
tags question: http://stackoverflow.com/q/22377588
tags question: http://stackoverflow.com/q/22362240
tags question: http://stackoverflow.com/q/22430970
tags question: http://stackoverflow.com/q/22427074
tags question: http://stackoverflow.com/q/22469157
tags question: http://stackoverflow.com/q/22479052
tags question: http://stackoverflow.com/q/22343268
tags question: http://stackoverflow.com/q/22413984
type: Tag
tags question: http://stackoverflow.com/q/22331978
tags question: http://stackoverflow.com/q/22462275
tags question: http://stackoverflow.com/q/22440183
tags question: http://stackoverflow.com/q/22348685
tags question: http://stackoverflow.com/q/22462753
tags question: http://stackoverflow.com/q/22396572
tags question: http://stackoverflow.com/q/22463982
tags question: http://stackoverflow.com/q/22427057
tag name: jbutton

http://stackoverflow.com/q/22397545
has answer: http://stackoverflow.com/a/22398608
has comment: http://stackoverflow.com/comment/34052296
has comment: http://stackoverflow.com/comment/34052005
score: 1
has comment: http://stackoverflow.com/comment/34052137
tagged with: java
has comment: http://stackoverflow.com/comment/34052158
tagged with: servlets
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34052054
has comment: http://stackoverflow.com/comment/34052181
tagged with: jsp
tagged with: javascript
has title: Creation of Object for Service class is not working
has comment: http://stackoverflow.com/comment/34052709
upvote count: 1
has body: public CI[] getCIDetailsTest(String ci_type,String selectedCI) throws Exception{ String endpoint = getProperty(customerID+"_endpoint"); System.out.println("reached here .......done.."+endpoint); //here failed Service service = new Service(); System.out.println("reached here .......done..........."+service); That is my statements in Java file But, to my surprise it was unable to create Service Object.. It is printing first println statement and not printing second println statement. That means It was unable to creat Service object. Is it jar problem? If it is jar problem, Which jar to be included? Friends, Kindly Help me out to resolve this issue....
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
downvote count: 0
has answer: http://stackoverflow.com/a/22397654
linked to: http://stackoverflow.com/q/9922655
has comment: http://stackoverflow.com/comment/34052196
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34052032

http://stackoverflow.com/comment/33968394
comment on: http://stackoverflow.com/a/22335175
score: 0
type: AnswerComment
has text: You can change `<compilerarg value="-Xlint"/>` to `<compilerarg value="-Xlint:all"/>`. The first turns on all _recommended_ warnings. However, the documentation then states that _all warnings are recommended_ which leads me to believe that `-Xlint` and `-Xlint:all` are the same. I didn't see anything specific about this on the Java Compiler documentation. I saw a bug filed against this issue in [Bugtraq](http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4963930), but no commitment to fix. Findbugs or PMD might be able to track that. Is there a javac option to show this?
type: Comment

http://stackoverflow.com/comment/34121879
type: AnswerComment
comment on: http://stackoverflow.com/a/22437258
score: 0
type: Comment
has text: @Marco13: you fixed the most egregious problems, in particular his use of calling `getGraphics()` on a component, which was tripping him up. By basing your code on his, he'll likely understand it better. I think you've done very well here.

http://stackoverflow.com/comment/34022976
comment on: http://stackoverflow.com/q/22379468
has text: Hm yes it could have a `getRequest()` method that returns a new req object and thus more being a factory. But that does not change the initial question targeting injection or static reference.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34032307
score: 0
type: AnswerComment
has text: @TheGuywithTheHat, anyway, the answer was found, so let's not put too much pressure on that brilliant place :)
type: Comment
comment on: http://stackoverflow.com/a/22385690

for-loop
tags question: http://stackoverflow.com/q/22360672
tags question: http://stackoverflow.com/q/22332730
tags question: http://stackoverflow.com/q/22446594
tags question: http://stackoverflow.com/q/22351427
tags question: http://stackoverflow.com/q/22466610
tags question: http://stackoverflow.com/q/22447926
tags question: http://stackoverflow.com/q/22393932
tags question: http://stackoverflow.com/q/22424122
tags question: http://stackoverflow.com/q/22448921
tags question: http://stackoverflow.com/q/22470791
tags question: http://stackoverflow.com/q/22451247
tags question: http://stackoverflow.com/q/22361522
tag name: for-loop
tags question: http://stackoverflow.com/q/22406646
tags question: http://stackoverflow.com/q/22415053
tags question: http://stackoverflow.com/q/22368120
tags question: http://stackoverflow.com/q/22340965
tags question: http://stackoverflow.com/q/22389825
type: Tag
tags question: http://stackoverflow.com/q/22365087
tags question: http://stackoverflow.com/q/22365385
tags question: http://stackoverflow.com/q/22370032
tags question: http://stackoverflow.com/q/22448616
tags question: http://stackoverflow.com/q/22425277
tags question: http://stackoverflow.com/q/22415244
tags question: http://stackoverflow.com/q/22431351

http://stackoverflow.com/q/22363789
tagged with: java
tagged with: javafx
has body: I have a JavaFX GUI application that has 6 ScatterPlot graphs. My application is reading &amp; plotting data from a serial port. The TextAreas are displaying the raw data with no problem. My only issue is that when the application plots the points, the application freezes. Can someone explain to me what is causing this issue? Is there any way to fix it? Is there any way of plotting the streaming data without making the application freeze? I'd upload my code, but it's too long &amp; exceeds the StackOverflow's limit of 3000 characters. PS: Most of my code is located in the start().
type: Question
has comment: http://stackoverflow.com/comment/33994646
tagged with: scatter-plot
score: 0
tagged with: real-time
accepted answer: http://stackoverflow.com/a/22517930
answer count: 1
tagged with: freeze
has answer: http://stackoverflow.com/a/22517930
type: AnsweredQuestion
has title: JavaFX: ScatterPlots take too long to load

http://stackoverflow.com/a/22434981
upvote count: 2
has body: Finally I found the answer. if I use mysql database, I have to install it in every computer that my program run. otherwise I have to use embedded database like sqlite that can embedded with jar file
answers question: http://stackoverflow.com/q/22434068
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/22408685
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22409586
score: 3
has title: How do I set locale to GWT DateBox
tagged with: java
type: Question
downvote count: 0
has body: I have a GWT DateBox implementation: DateTimeFormat dateFormat = DateTimeFormat.getLongDateTimeFormat(); dateBox.setFormat(new DateBox.DefaultFormat(dateFormat)); I would like to set different locales for the date. For example If Browser language is France the date should be: 2014 Mars 14 If Browser locale is English 2014 March 14 and so on. Thank you in advance!
has answer: http://stackoverflow.com/a/22409365
favorite count: 0
has answer: http://stackoverflow.com/a/22411802
answer count: 3
accepted answer: http://stackoverflow.com/a/22409365
upvote count: 3
possible better answer: http://stackoverflow.com/a/22409586
tagged with: gwt

http://stackoverflow.com/q/22457099
tagged with: database
has body: I need to add a verification in an installer to assure that the current user have privileges to for example add tables and indexes. This application uses Hibernate in the data layer and the installer allows to choose between Oracle, DB2, PostgreSQL and MySQL . I wonder if it is possible to use Hibernate to check it independently of the chosen database or if I will have to write code to each of the options.
type: AnsweredQuestion
has title: How to use Hibernate to check if the necessary privilegies are correctly set in a multiple database application?
type: Question
tagged with: architecture
score: 0
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22466646
answer count: 1
accepted answer: http://stackoverflow.com/a/22466646

http://stackoverflow.com/comment/34141442
score: 0
type: Comment
has text: "You wouldn't need any counters", but isn't the MAX_OBJS exactly the same?
type: AnswerComment
comment on: http://stackoverflow.com/a/22447959

http://stackoverflow.com/comment/34055960
type: AnswerComment
has text: I see. It really was badly worded then :) up vote for Kung Fu interpretation
comment on: http://stackoverflow.com/a/22384989
score: 0
type: Comment

http://stackoverflow.com/q/22374341
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34013473
has comment: http://stackoverflow.com/comment/34023044
score: 2
upvote count: 2
type: UnansweredQuestion
has body: Here is a part of spring xml file: &lt;!-- aop config --&gt; &lt;aop:aspectj-autoproxy /&gt; &lt;bean id="fileService" class="com.test.file.FileService" /&gt; &lt;bean id="throughputManager" class="com.test.mbean.ThroughputManager" /&gt; following with the java code: public class FileService { public long read(Object obj,String id) throws Exception { return 0L; } public long write(Object obj,String id) throws Exception { return 0L; } } @Aspect public class ThroughputManager { public static long TOTAL_READ_THROUGHPUT; public static long TOTAL_WRITE_THROUGHPUT; @AfterReturning( pointcut="execution(* com.test.file.FileService.read(..))", returning="size" ) public void calculateReadThroughput(long size) throws IOException{ TOTAL_READ_THROUGHPUT+=size; } @AfterReturning( pointcut="execution(* com.test.file.FileService.write(..))", returning="size" ) public void calculateWriteThroughput(long size) throws IOException{ TOTAL_WRITE_THROUGHPUT+=size; } } When I debug the program and call the read and write method, the two methods in the ThroughputManager were not invoked. I tried to find the reason but it seems everything about the code are fine. Could anyone help to find out what's wrong with this aop invoking?Thx.
tagged with: spring
tagged with: java
has title: @AfterReturning failed to intercept the method invoking by aspectJ
has answer: http://stackoverflow.com/a/22381914
type: Question
has comment: http://stackoverflow.com/comment/34023231
tagged with: aspectj
answer count: 1

http://stackoverflow.com/a/22421923
has body: If you need lecgrade to be of type int, you probably want to apply some rounding before casting, e.g.: double lecgrade = 1.9d; int result = (int) lecgrade; int resultRounded = (int) Math.round(lecgrade); System.out.println(result); // prints 1 System.out.println(resultRounded); // prints 2 Please note that intValue() is not applicable to primitives, you'd have to box your value first intValue() may truncate your value instead of rounding it Double k = Double.valueOf(1.9d); System.out.println(k.intValue()); // prints 1 for me
type: Answer
answers question: http://stackoverflow.com/q/22421815
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/22475733
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
type: Question
tagged with: notificationservices
tagged with: java
upvote count: 2
has body: I found this fantastic tutorial: http://gmariotti.blogspot.it/search?q=NotificationListenerService and i tried to download the source and use it for my application to read the whatsapp notification but i can't see anything.. It seems so simple but not works for me. The NotificationListenerService: public class SimpleKitkatNotificationListener extends NotificationListenerService { @Override public void onCreate() { super.onCreate(); //android.os.Debug.waitForDebugger(); } @Override public void onNotificationPosted(StatusBarNotification sbn) { Notification mNotification=sbn.getNotification(); if (mNotification!=null){ Bundle extras = mNotification.extras; Intent intent = new Intent(MainActivity.INTENT_ACTION_NOTIFICATION); intent.putExtras(mNotification.extras); sendBroadcast(intent); Notification.Action[] mActions=mNotification.actions; if (mActions!=null){ for (Notification.Action mAction:mActions){ int icon=mAction.icon; CharSequence actionTitle=mAction.title; PendingIntent pendingIntent=mAction.actionIntent; } } } } @Override public void onNotificationRemoved(StatusBarNotification sbn) { } } and the activity: public class MainActivity extends Activity { protected MyReceiver mReceiver = new MyReceiver(); public static String INTENT_ACTION_NOTIFICATION = "it.gmariotti.notification"; protected TextView title; protected TextView text; protected TextView subtext; protected ImageView largeIcon; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Retrieve ui elements title = (TextView) findViewById(R.id.nt_title); text = (TextView) findViewById(R.id.nt_text); subtext = (TextView) findViewById(R.id.nt_subtext); largeIcon = (ImageView) findViewById(R.id.nt_largeicon); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuI…
favorite count: 0
has title: NotificationListenerService not shows anything
tagged with: android
tagged with: android-notifications

http://stackoverflow.com/comment/34178174
score: 0
comment on: http://stackoverflow.com/q/22468906
type: QuestionComment
has text: possible duplicate of [Exported JAR Won't Read Image](http://stackoverflow.com/questions/15992609/exported-jar-wont-read-image)
type: Comment

http://stackoverflow.com/q/22346455
downvote count: 0
favorite count: 0
has title: How I made the XJC ant task use more than one bindings file?
tagged with: xjc
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26181352
score: 1
tagged with: java
tagged with: jaxb
upvote count: 1
tagged with: gradle
type: Question
has body: I am trying to use the XJC ant task to generate some classes in a gradle script. I have no problem to generate them if I use only one bindings file (for class renaming0, but I soon as I try to use more (an episode file), they are royally ignored by the task. To be more clear, this ant.xjc(schema : 'test.xsd', destdir:'destdir', extension: true, package: 'testpackage') { classpath { fileset(dir: project.property('jaxb.home'), includes: 'jaxb-impl.jar') // &lt;== here I include the } binding(dir: project.projectDir) { filename(name:'bindings.xml') //&lt;== this bindings is for classes renaming //filename(name:'previous.episode') //&lt;== this bindings is for classes reusage } arg(value:"-npa") arg(value:"-nv") } works nicely, the classes are renamed just fine, but as soon as I try to include the previous.episode file, the two bindings file are ignored : no more renaming, and of course, no reusage What's drive me crazy is that calling XJC with the cmd line xjc -nv -classpath "&lt;haxb.home&gt;jaxb-impl.jar" -d destdir -p testpackage -b bindings.xml -b previous.episode -extension -npa work like a charm. Additionnaly, if I merge bindings.xml and previous.episode, it also work, but it's not very practical, to say the least. So if someone could help me on this point, it would be wonderful.
tagged with: ant
answer count: 1

http://stackoverflow.com/q/22439112
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22439259
has body: I've done a lot of research, but not much of it makes sense since I'm not familiar with placing in-app ads (this is my first time making an app, and my first time working with ads). Here's my updated MainActivity.java code: package com.me.mygdxgame; import android.os.Bundle; import android.widget.LinearLayout; import android.widget.RelativeLayout; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdSize; import com.google.android.gms.ads.AdView; public class MainActivity extends AndroidApplication { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //Changed it back to main, got rid of an error AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); cfg.useGL20 = true; initialize(new MyGame(), cfg); AdView adView; adView = new AdView(this); adView.setAdSize(AdSize.BANNER); adView.setAdUnitId("My Ad Unit ID (just using this string for posting purposes"); LinearLayout layout = (LinearLayout) findViewById(R.id.normal); //Changed R.id.linearlayout to R.id.normal. After looking at my R.java class, I saw that there was no id.linearlayout, so I changed it to R.id.normal, which did exist. layout.addView(adView); //This is line 44, where the NullPointer is caused AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); } } Here's the updated AndroidManifest XML code: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <action android:name="android.intent.action.MAIN" /> <category android:name="…
possible better answer: http://stackoverflow.com/a/22439295
tagged with: java
has answer: http://stackoverflow.com/a/22439295
has comment: http://stackoverflow.com/comment/34125825
has answer: http://stackoverflow.com/a/22446871
type: Question
tagged with: admob
tagged with: libgdx
has title: Can't get AdMob to work (using Android, LibGDX)
has answer: http://stackoverflow.com/a/22439182
score: 0
tagged with: android
tagged with: ads
accepted answer: http://stackoverflow.com/a/22439182

http://stackoverflow.com/a/22441583
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22441514
has comment: http://stackoverflow.com/comment/34130274
type: AcceptedAnswer
has body: You forgot to call super.onBackPressed() inside onBackPressed() method, you dont need to start a new intent to go back. In your search activity override the onBackPressed() method and call it from wherever you want in the activity. it should be like this. @Override public void onBackPressed(){ super.onBackPressed(); }
accepted answer of: http://stackoverflow.com/q/22441514

http://stackoverflow.com/a/22412343
has body: &lt;? extends Boolean&gt; means any class that extends the Boolean class can be used here. Let's say you have class MyBoolean extends Boolean { ... } Then this MyBoolean class can be used instead of &lt;? extends Boolean&gt; Essentially you could call the changed function like the following ObservableValue&lt;MyBoolean&gt; observable = new ObservableValue&lt;MyBoolean&gt;(); changed(observable ,true, false);
answers question: http://stackoverflow.com/q/22412248
has comment: http://stackoverflow.com/comment/34078141
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34078236
score: 1
has comment: http://stackoverflow.com/comment/34078214
downvote count: 0

http://stackoverflow.com/a/22439976
has comment: http://stackoverflow.com/comment/34161234
has comment: http://stackoverflow.com/comment/34168518
type: Answer
has body: int first = stack.pop(); int second = stack.pop(); if (first == 1 &amp;&amp; second == 1)
score: 102
has comment: http://stackoverflow.com/comment/34157450
has comment: http://stackoverflow.com/comment/34147299
has comment: http://stackoverflow.com/comment/34149305
downvote count: 1
has comment: http://stackoverflow.com/comment/34150680
has comment: http://stackoverflow.com/comment/38533500
answers question: http://stackoverflow.com/q/22439952
has comment: http://stackoverflow.com/comment/34155645
has comment: http://stackoverflow.com/comment/34148940
has comment: http://stackoverflow.com/comment/34146789
upvote count: 103
has comment: http://stackoverflow.com/comment/34160324

http://stackoverflow.com/q/22458649
has comment: http://stackoverflow.com/comment/34184882
has comment: http://stackoverflow.com/comment/34177952
type: UnansweredQuestion
has title: h:commandButton onclick event interrupted by button action
answer count: 0
tagged with: jsf
tagged with: java
has comment: http://stackoverflow.com/comment/34161335
type: Question
has body: My onclick event gets interrupted by button action (full submit). Any ideas? An alternative would be to change the h:commandButton to a4j:commandButton, but I need a full submit in order for the button to work correctly like this. &lt;h:commandButton onclick="trackClick();" action="#{bean.print}" /&gt;
has comment: http://stackoverflow.com/comment/34159768
has comment: http://stackoverflow.com/comment/34161081
tagged with: javascript
tagged with: jquery
score: 0

http://stackoverflow.com/comment/34021630
comment on: http://stackoverflow.com/a/22376041
score: 0
type: Comment
type: AnswerComment
has text: i added file-Read/Write example. It will use c\Test\counter.txt file to store the counter.

http://stackoverflow.com/q/22439656
has comment: http://stackoverflow.com/comment/34126180
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34126173
has comment: http://stackoverflow.com/comment/34126177
type: Question
has body: I have develop my own apps and try to open it in emulator 5556. It is installed successfully. However when I open it, it shut down immediately. I hope someone can help. And here is my androidmainfest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.monkey" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-feature android:glEsVersion="0x20000" android:required="true" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyCi43x8rh1xwonf15SQ2faHLPKCJUkzAn8" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> 03-16 13:01:14.249: D/AndroidRuntime(1138): Shutting down VM 03-16 13:01:14.249: W/dalvikvm(1138): threadid=1: thread exiting with uncaught exception (group=0xb3a3aba8) 03-16 13:01:14.419: E/AndroidRuntime(1138): FATAL EXCEPTION: main 03-16 13:01:14.419: E/AndroidRuntime(1138): Process: com.example.monkey, PID: 1138 03-16 13:01:14.419: E/AndroidRuntime(1138): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.monkey/com.example.monkey.Home}: java.lang.ClassNotFoundException: Didn't find class "com.example.monkey.Home" on path: DexPathList[[zip file "/data/app/com.example.monkey-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.monkey-2, /system/lib]] 03-16 13:01:14.419: E/AndroidRuntime(1138): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) 03…
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/22440060
has comment: http://stackoverflow.com/comment/34126772
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22440060
has title: My apps shut down immediately after opening it
has comment: http://stackoverflow.com/comment/34126286
tagged with: android

http://stackoverflow.com/comment/34033113
type: Comment
type: QuestionComment
has text: and in [here](http://stackoverflow.com/questions/16382108/hide-form-controls-when-printing-an-html-page-with-css)
score: 0
comment on: http://stackoverflow.com/q/22386436

http://stackoverflow.com/comment/34074751
score: 0
has text: Do changing the order of method definitions help?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22410609

http://stackoverflow.com/comment/33950619
type: Comment
has text: haha ok I will use `numerical computing environment` then. The multiple method solution is trivial, but not my question.
comment on: http://stackoverflow.com/a/22339053
score: 0
type: AnswerComment

http://stackoverflow.com/a/22365508
has body: You are putting all the output statements (System.out.println()) outside your loop, so it only outputs the last value. Move your output statements so they are inside your loop: public static void main(String[] args) { Random rnd = new Random(); int repeat = 19; int n = 0; int[] numbers = new int[3]; // To hold how many numbers have modulo 0, 1 or 2 for(int i = 0; i &lt;= repeat; i++) { n = rnd.nextInt(100)+1; System.out.print(n+", "); if(n % 3 == 0) System.out.println("The number " + n + " is divisible by 3"); else System.out.println("" + n + " modulo 3 = " + n % 3); numbers[n % 3]++; } System.out.println("Numbers divisible by 3: " + numbers[0]); System.out.println("Numbers with modulo 3 = 1: " + numbers[1]); System.out.println("Numbers with modulo 3 = 2: " + numbers[2]); }
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22365385
upvote count: 1

http://stackoverflow.com/comment/34007004
has text: Create a new layout file ,Save in Layout folder and then pass reference here e.g. R.layout.your_layout_name.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22371604

http://stackoverflow.com/comment/34113067
comment on: http://stackoverflow.com/q/22432235
type: Comment
type: QuestionComment
has text: An `Integer[]` is not an `int[]`.
score: 1

http://stackoverflow.com/comment/34136415
comment on: http://stackoverflow.com/a/22444690
has text: so that helped, but the last test failed, the one where it should return -1.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22351431
linked to: http://stackoverflow.com/q/655891
tagged with: blackberry-10
answer count: 1
downvote count: 0
has body: We have an Android application that reads the contact details from the native AddressBook application. The character representation works well. The greek letters, the german characters with the umlaut token etc... We ported the Android application to BB10 (BlackBerry) using the eclipse plugin. The problem is that the produced bar file, when installed in the BB10 does not display the non ascii characters correct. We have problems with special character like those that I have mentioned above (german umlaut, greek names etc). Do you know what the problem is? Any suggestions? Some code. In android I get the name from phones adressbook like this: name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); //name is UTF-8.
favorite count: 0
accepted answer: http://stackoverflow.com/a/22546984
has title: Character representation (German, Greek characters) issues in BlackBerry apk2bar
linked to: http://stackoverflow.com/q/652161
has comment: http://stackoverflow.com/comment/34344745
tagged with: android
has comment: http://stackoverflow.com/comment/34066006
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: blackberry
type: Question
has answer: http://stackoverflow.com/a/22546984
tagged with: character-encoding

http://stackoverflow.com/q/22450770
has title: Adding double-click expansion to the Tree Viewer in SWT
has answer: http://stackoverflow.com/a/22453339
tagged with: treeviewer
has comment: http://stackoverflow.com/comment/34149740
type: AnsweredQuestion
tagged with: java
tagged with: swt
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22453339
linked to: http://stackoverflow.com/q/22634047
has answer: http://stackoverflow.com/a/42108150
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/42108150
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34148952
has body: Double-Clicking tree items works completely fine, but when I press CTRL + M on the keyboard then the tree items expand\collapse, can someone please tell me the reason behind this? Is this a bug in Eclipse or why does this double-click functionality get triggered when I press CTRL+M. Thanks.

http://stackoverflow.com/q/22400442
has comment: http://stackoverflow.com/comment/34072189
upvote count: 1
has comment: http://stackoverflow.com/comment/34058086
answer count: 1
has title: Join Two XPath Queries
tagged with: java
type: UnansweredQuestion
tagged with: xquery
downvote count: 0
score: 1
favorite count: 0
has body: Hye there I am new to XML Read I want to Join these Two Queries! /ADOXML/MODELS/MODEL/INSTANCE[@class='Activity'] and /ADOXML/MODELS/MODEL/INSTANCE/ATTRIBUTE[@name='Description' and @type='STRING'] i tried: /ADOXML/MODELS/MODEL/INSTANCE[@class='Activity'] | /ADOXML/MODELS/MODEL/INSTANCE/ATTRIBUTE[@name='Description' and @type='STRING'] But the Problem is that it gives me wrong output using my code as: NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(document, XPathConstants.NODESET); ArrayList&lt;String&gt; text = new ArrayList&lt;String&gt;(); int k; for (k = 0; k &lt; nodeList.getLength(); k++) { String txt=nodeList.item(k).getTextContent(); txt=txt.replace("[","").replace("]","").replace("#","").replace(":", "").replace("•", "").replace("\n", " ") .replace("\u0092", " ").replace("'", "").replace("•", " ").replace("-", " ").replace("’", " ").replace("\n", " "); text.add(txt); } So how can i join the above two Queries
type: Question
has answer: http://stackoverflow.com/a/22400521
has comment: http://stackoverflow.com/comment/34057942
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath

http://stackoverflow.com/a/22341116
accepted answer of: http://stackoverflow.com/q/22339233
score: 0
type: Answer
has body: you have tag it as java. But few syntax are not support for java. public int replace(String oldData, String newData ) { int count = 0; StringNode tmp = head; while( tmp != null) { if(tmp.data.equals(oldData) { tmp.data = newData; count = count + 1; } tmp = tmp.next; } return count; } Try this code in java. It should work. If the data is your own class, you have to override the equals method. Since it is string, it will work.
answers question: http://stackoverflow.com/q/22339233
type: AcceptedAnswer

http://stackoverflow.com/a/22407784
answers question: http://stackoverflow.com/q/22407250
type: Answer
has comment: http://stackoverflow.com/comment/34074023
has body: I think you need to implement HttpStack in volley request. Please check the below link https://github.com/smanikandan14/Volley-demo#integrating-volley-to-your-project
score: 0
has comment: http://stackoverflow.com/comment/34090992

http://stackoverflow.com/comment/114472259
score: 0
has text: See https://github.com/panemu/tiwulfx-dock for a viable solution and see https://github.com/DaveJarvis/PitchDockFX#requirements for a review of frameworks.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22432811

http://stackoverflow.com/q/22400462
has comment: http://stackoverflow.com/comment/34059289
has comment: http://stackoverflow.com/comment/34058355
answer count: 3
has answer: http://stackoverflow.com/a/26264512
downvote count: 0
upvote count: 17
has title: Development of application similar to "Google now" - is it possible to use voice recognition without key input?
tagged with: speech-recognition
favorite count: 0
has comment: http://stackoverflow.com/comment/34058774
has body: I'm trying to develop a cool application that uses the TTS engine and speech recognition. So far it's ok but I want more. I would like to create a service (I think a service is the right way), that is always "listening" and when someone says "ok google" or something else , the speech recognition starts, like google now. For example, if you say "ok google" google now starts. I don't know where to start so I'm asking directly here if it's possible. I tried looking at this thread [here] (Listening for keywords at all times, like "Ok google" on 4.4) and the last answer talked about a service, as I thought. Can someone help me with my code? For example this is the code to start speech recognition by tapping a button: /** * Instruct the app to listen for user speech input */ private void listenToSpeech() { //start the speech recognition intent passing required data Intent listenIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); //indicate package listenIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getClass().getPackage().getName()); //message to display while listening listenIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Say a word!"); //set speech model listenIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); //specify number of results to retrieve listenIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 10); //start listening startActivityForResult(listenIntent, VR_REQUEST); } Do you think it's possible to start that listenIntent only with voice and without pressing any button? This is what i mean.
linked to: http://stackoverflow.com/q/14940657
tagged with: android
has comment: http://stackoverflow.com/comment/34057327
linked to: http://stackoverflow.com/q/20312563
has comment: http://stackoverflow.com/comment/34058960
has answer: http://stackoverflow.com/a/24965851
type: UnansweredQuestion
tagged with: google-now
tagged with: java
tagged with: text-to-speech
score: 17
type: Question
has comment: http://stackoverflow.com/comment/34059527
has answer: http://stackoverflow.com/a/24645065
has comment: http://stackoverflow.com/comment/34070663
has comment: http://stackoverflow.com/comment/34058699

http://stackoverflow.com/comment/98292962
comment on: http://stackoverflow.com/a/23351558
type: AnswerComment
has text: I don't see any `updateConfiguration` defined here. If you talk about "updateLanguage", the only reason I define `updateLanguage` as static is that it does not depend on the class itself, so there is no reason to attach it as a "method" to the class. Things would be different if the context or the language were members of the class.
score: 0
type: Comment

http://stackoverflow.com/comment/76937832
comment on: http://stackoverflow.com/a/22959847
type: Comment
has text: I can't find properties either, anybody figure out how to navigate to the listed page
type: AnswerComment
score: 15

http://stackoverflow.com/comment/34064078
comment on: http://stackoverflow.com/q/22364778
type: Comment
type: QuestionComment
score: 0
has text: Could you try to put ur templates under WEB-INF/classes folder (base source folder in your java project)

http://stackoverflow.com/comment/34359619
has text: You were getting 60fps with SpriteBatch? Can you update question with your new code? Or start a new one if needed.
type: Comment
comment on: http://stackoverflow.com/a/22384774
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33983723
score: 0
type: AnswerComment
type: Comment
has text: Has sound ever played? If you have never been able to get sound to play at all with any of the code I have given you then there is something wrong with your sound file or your resource linking to it
comment on: http://stackoverflow.com/a/22336761

http://stackoverflow.com/comment/33981866
type: QuestionComment
has text: In your example, where would DataVO, CustomerVO and the int come from? Can you include an example of what you want to achieve?
comment on: http://stackoverflow.com/q/22357033
score: 0
type: Comment

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/22429319
tags question: http://stackoverflow.com/q/22389933
type: Tag
tags question: http://stackoverflow.com/q/22345409
tags question: http://stackoverflow.com/q/22345223

http://stackoverflow.com/comment/34072366
comment on: http://stackoverflow.com/q/22409131
score: 0
has text: U can try using picasso (http://square.github.io/picasso/) an image downloading and caching library instead of using your own async task. Implementation is very easy and library works great.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34034258
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22386826
has text: I have managed to set up socket communication so I will be sending already validated data to server. So i think this should do the trick
score: 0

http://stackoverflow.com/comment/34037026
type: Comment
type: QuestionComment
has text: Your manifest is mangled. The `uses-sdk` tag has garbage in it.
score: 0
comment on: http://stackoverflow.com/q/22388708

http://stackoverflow.com/comment/34100383
type: Comment
comment on: http://stackoverflow.com/q/22425240
has text: Take a look at http://commons.apache.org/proper/commons-lang/apidocs/src-html/org/apache/commons/lang3/tuple/MutablePair.html
score: 0
type: QuestionComment

http://stackoverflow.com/a/22475534
has comment: http://stackoverflow.com/comment/34189123
score: 0
has body: You can get device token from this method. put this method in your appdelegate.m class.make sure you are running your iOS app in real device if you are running app in virtual device(Simulator),then you can not find device token, - (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { NSString *token = [[deviceToken description] stringByTrimmingCharactersInSet: [NSCharacterSet characterSetWithCharactersInString:@"&lt;&gt;"]]; token = [token stringByReplacingOccurrencesOfString:@" " withString:@""]; NSLog(@"content---%@", token); }
type: Answer
has comment: http://stackoverflow.com/comment/34188848
answers question: http://stackoverflow.com/q/22475503

http://stackoverflow.com/comment/33990381
type: QuestionComment
comment on: http://stackoverflow.com/q/22361194
has text: Is it possible there's nothing in your iterator? Please provide more code. Specifically what type is the collection you're iterating across?
score: 0
type: Comment

http://stackoverflow.com/a/22400564
has comment: http://stackoverflow.com/comment/34066598
has comment: http://stackoverflow.com/comment/34066880
has comment: http://stackoverflow.com/comment/34067693
has comment: http://stackoverflow.com/comment/34065724
has comment: http://stackoverflow.com/comment/34058899
score: 0
has comment: http://stackoverflow.com/comment/34065961
has comment: http://stackoverflow.com/comment/34103504
has comment: http://stackoverflow.com/comment/34103603
type: Answer
has comment: http://stackoverflow.com/comment/34065423
has comment: http://stackoverflow.com/comment/34090411
has comment: http://stackoverflow.com/comment/34062298
has comment: http://stackoverflow.com/comment/34057514
has comment: http://stackoverflow.com/comment/34058725
answers question: http://stackoverflow.com/q/22397442
has comment: http://stackoverflow.com/comment/34057543
has comment: http://stackoverflow.com/comment/34090522
has body: Are you sure a department can have many parent ? Shouldn't it have many childs instead ? Considering Parent 0..1 ------------- * Childs you want to delete child department when removing it from parent childs collection (orphan removal) bi directionnal @OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, mappedBy = "parentDpt", orphanRemoval = true, fetch = FetchType.LAZY) private final Set&lt;Department&gt; childsDpt = new HashSet&lt;Department&gt;(); @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "parent_id") private Department parentDpt; unidirectionnal @OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}, orphanRemoval = true) @JoinColumn(name = "parent_id", referencedColumnName = "id") private Set&lt;Department&gt; childsDpt ; [edit] Please see What is the difference between DELETE_ORPHAN and DELETE? The fact is that orphan removal will remove the childs entities when removing them from parent's childs collection. Cascade delete will remove the childs when removing the parent. but with bi-directionnal removing the parent won't remove automatically the foreign-key (parentDepartement attribute) in the childs, you must ensure yourself than childs don't have the reference before removing the parent.

http://stackoverflow.com/a/22377450
has comment: http://stackoverflow.com/comment/34016745
has comment: http://stackoverflow.com/comment/34016423
has body: Iterable interface will force your class to have a method iterator() this method must return an object of a class implementing the Iterator interface. So your class ConjuntLlistaOrdenat1 must return an Iterator object which will be use to iterate over your list throught the methods hasNext() and next() You have to implement this class and those two methods. I find difficult to understand your code but I think your Iterator class could be an adapter of your ConjuntLlista.
score: 4
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/34016354
downvote count: 0
answers question: http://stackoverflow.com/q/22377250

http://stackoverflow.com/comment/33944342
has text: "I'd like to generate all possible strings..."
comment on: http://stackoverflow.com/q/22335568
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/22365308
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34014429
answers question: http://stackoverflow.com/q/22364461
has body: Assuming this is your MediaControl, then it is already a Parent subclass, so you don't need to place it in a parent Group. You can use the following code: private static void initFxLater(JFXPanel panel) { MediaPlayer mediaPlayer = new MediaPlayer(new Media(MEDIA_URL)); mediaPlayer.setAutoPlay(true); MediaView mediaView = new MediaView(mediaPlayer); mediaView.setFitWidth(450); mediaView.setFitHeight(200); panel.setScene(new Scene(new MediaControl(mediaPlayer)); } I'm not quite sure what you mean by "resize the media", but the above code will always size the media to fit within the bounding box of size 450x200 (with the default of preserving the size ratio of the media).
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22364461

http://stackoverflow.com/comment/34015166
comment on: http://stackoverflow.com/a/22376720
type: AnswerComment
score: 0
has text: Hi @curtisLoew Can you tell me how can I reset the `mOnReceivedTitleInvoked` to false after my method getCalled once? If I press a url again then `mOnReceivedTitleInvoked` will be true and it will not let my method to run.
type: Comment

http://stackoverflow.com/q/22394495
tagged with: java
tagged with: jpanel
score: -1
tagged with: image
has answer: http://stackoverflow.com/a/22394559
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/22397281
favorite count: 0
tagged with: jframe
has answer: http://stackoverflow.com/a/22394534
type: UnansweredQuestion
has title: Java: Image appearing very small in JPanel
tagged with: swing
downvote count: 1
type: Question
has body: So I have an image being drawn inside a JPanel which itself is added to a JFrame. However when the Image is first drawn it appears to be very small. I'm not sure if this is a problem with the panel or a problem with the image. It is illustrated below: ![enter image description here][1] I have drawn a rectangle around the image. Now the JPanel is supposed to be contained within the JFrame. The JFrame is not supposed to be coloured in as is seen above. The JPanel is meant to be about a quarter of the size of the JFrame and the image is supposed to take up almost all of the JPanel. Could you please tell me if it's the image which is the problem or the Panel. Sorry if it seems obvious. Awaiting SSCCE

http://stackoverflow.com/comment/34129402
type: Comment
has text: This throws an IllegalArgumentException and earns a downvote.
comment on: http://stackoverflow.com/a/22441228
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34119784
comment on: http://stackoverflow.com/q/22436155
score: 0
has text: Does your index template accept a parameter? Show us the first few lines of your `index.scala.html`.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22456297
has body: Short answers: Agenda is a JavaFX calendar component Agenda.Appointment, Agenda.AppointmentGroup are interfaces Agenda.AppointmentGroupImpl, Agenda.AppointmentImpl are default implementations of previously mentioned interfaces Agenda.AgendaSkin, Agenda.WeekSkin are implementations of JavaFX component skins More info on architecture of JavaFX component can be found at http://www.guigarage.com/2012/11/custom-ui-controls-with-javafx-part-1/
type: Answer
accepted answer of: http://stackoverflow.com/q/22453077
has comment: http://stackoverflow.com/comment/34177982
answers question: http://stackoverflow.com/q/22453077
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34175219
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/54759360
has body: If you use Eclipse, ViewRootImpl is invisible. You can use the Android Studio instead.
answers question: http://stackoverflow.com/q/22480966
type: Answer
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/comment/34151825
type: AnswerComment
type: Comment
has text: I see your point, but actually you're not forced to update the switch statement all the time. I did not include it for simplicity's sake, but there are ways to iterate over `enum` values. Maybe I'll complete my answer, but it felt to me a little bit off topic at the time.
comment on: http://stackoverflow.com/a/22452985
score: 0

http://stackoverflow.com/comment/34065800
type: Comment
comment on: http://stackoverflow.com/q/22405771
score: 0
type: QuestionComment
has text: `at com.johntcompas.audio_live_wallpaper.AudioWallpaperService.<init>(AudioWallpaperService.java:37)` What the code at this line?

http://stackoverflow.com/a/77435319
upvote count: 0
score: -2
has body: 10 years late, but I was just looking for the same thing. It looks like since the underlying implementation of a regular queue in java is a linked list you can get a specific indexed element by doing something like: queue.peek()[index]
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22453755

http://stackoverflow.com/a/22406741
type: Answer
has comment: http://stackoverflow.com/comment/34069457
has comment: http://stackoverflow.com/comment/34069737
score: 0
has body: This is a great problem... if I'm understanding you right you need to find all of the permutations of the original set that maintain a permutation of your original FD set. Your algorithm will work except that you are calculating a lot of unnecessary permutations by looking at all permutations of the original set and then all the permutations of those FDs. If you look at all possible permutations of your original FD first, you should be able to eliminate a bunch of permutations of your original set. So in other words: Calculate your original FD Find all possible permutations of the original FD Then linearly begin calculating your permutations of your original set but eliminate those that immediately cannot be calculated. For instance: Set {1,2,3,5} FD {1, 1, 2} In calculating this example, when you get to step 3 you should automatically be able to eliminate any permutations that start with 1, 5 since the difference of 4 will never be in any permutation of your original FD. It will only save you a few calculations in this particular example but once you start working larger sets this algorithm has the potential to save you a significant amount of time.
answers question: http://stackoverflow.com/q/22406245

http://stackoverflow.com/a/22344289
type: Answer
score: 1
has body: There is no syntactical way of calling the method A.sum() inside any method of C. You need to place a bridging method inside B for doing that: public class A { public void sum() { System.out.println("A.sum()"); } } public class B extends A { @Override public void sum() { System.out.println("B.sum()"); } protected final void superSum() { super.sum(); } } public class C extends B { @Override public void sum() { System.out.println("C.sum()"); } public void someMethod() { sum(); super.sum(); superSum(); } } Calling C.someMethd() prints out C.sum() B.sum() A.sum()
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22343982
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22343982

http://stackoverflow.com/comment/34109431
has text: `dice` is unused. Also, there's too much copypasta — maybe you need to go through a good book about programming in general
comment on: http://stackoverflow.com/q/22430181
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/127823270
comment on: http://stackoverflow.com/q/22381202
type: Comment
type: QuestionComment
has text: Is this question specific to Eclipse or not? It is attracting answers about [Gradle](https://en.wikipedia.org/wiki/Gradle), [IntelliJ IDEA](https://en.wikipedia.org/wiki/IntelliJ_IDEA), [NetBeans](https://en.wikipedia.org/wiki/NetBeans), etc.
score: 0

http://stackoverflow.com/a/22480084
has comment: http://stackoverflow.com/comment/34197425
has comment: http://stackoverflow.com/comment/34197643
has comment: http://stackoverflow.com/comment/34199199
has comment: http://stackoverflow.com/comment/34197114
has comment: http://stackoverflow.com/comment/34208688
has comment: http://stackoverflow.com/comment/34199342
has comment: http://stackoverflow.com/comment/34202830
has comment: http://stackoverflow.com/comment/34200932
upvote count: 1
has comment: http://stackoverflow.com/comment/34208290
has comment: http://stackoverflow.com/comment/34208139
has comment: http://stackoverflow.com/comment/34198180
has comment: http://stackoverflow.com/comment/34201886
score: 1
has comment: http://stackoverflow.com/comment/34199681
has comment: http://stackoverflow.com/comment/34196677
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34200226
downvote count: 0
answers question: http://stackoverflow.com/q/22480011
accepted answer of: http://stackoverflow.com/q/22480011
has comment: http://stackoverflow.com/comment/34202147
has comment: http://stackoverflow.com/comment/34198252
type: Answer
has body: You need to execute your query using Statement object: So from statement object : stmt = connect.createStatement(); Execute Your queries like this : rs = stmt.executeQuery("SELECT SUM(Capital_Price) sum FROM item_list"); ResultSet rs object holds the retrieved data from by that query, so you can get the data like: int sum = rs.getInt("sum"); Then what all you have to do, just organize your code based on the above and you will get every thing works just fine.

http://stackoverflow.com/comment/34139365
type: Comment
has text: Better still, populate it with 15 letters and 10 nulls (or empty strings, or some other thing that means "nothing").
comment on: http://stackoverflow.com/a/22446664
type: AnswerComment
score: 0

http://stackoverflow.com/q/22472374
has body: I have the following 2 xmls: Xml1: <G>WCARD_HM</G> INFO 3600 1395118210.1 XML2: <G>WCARD_Off</G> Test 1234 1395derr Now, I want to add xml2 to Sctn tag of Xml1. ie, the resulting xml should be: <G>WCARD_HM</G> INFO 3600 1395118210.1 <G>WCARD_Off</G> Test 1234 1395derr Is there a way to do this without iterating over every element of Xml2 ?
has comment: http://stackoverflow.com/comment/34184469
answer count: 1
has comment: http://stackoverflow.com/comment/34184198
has comment: http://stackoverflow.com/comment/34184271
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/80609
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/5681597
linked to: http://stackoverflow.com/q/648471
has title: Merging to xml in Java
type: Question
has comment: http://stackoverflow.com/comment/34184239
tagged with: xmldom
has answer: http://stackoverflow.com/a/22475979
score: 0
accepted answer: http://stackoverflow.com/a/22475979

http://stackoverflow.com/comment/34133195
type: QuestionComment
has text: It's a modified code of what we've been working on in class. Thanks for the advice, I was taught not to put curly brackets for single line blocks. But will now implement it!
comment on: http://stackoverflow.com/q/22443181
score: 0
type: Comment

http://stackoverflow.com/comment/34210301
has text: What do you know, surprise surprise it works. This is why you can't look at code too long (and don't rely on eclipses quick "fixes")
type: AnswerComment
comment on: http://stackoverflow.com/a/22487463
score: 0
type: Comment

http://stackoverflow.com/comment/33952866
comment on: http://stackoverflow.com/q/22340319
score: 3
type: Comment
has text: Yup, you lost me at `this.setLayout(null);`.
type: QuestionComment

http://stackoverflow.com/a/22479900
has comment: http://stackoverflow.com/comment/34196428
answers question: http://stackoverflow.com/q/22478321
has comment: http://stackoverflow.com/comment/34200704
has comment: http://stackoverflow.com/comment/34200973
score: 0
has comment: http://stackoverflow.com/comment/34211652
type: Answer
has body: Try left join select distinct users from UserEntity as users left join users.rules as rules where users.username like :maybePartialUsername and rules.ruleName like :maybePartialRuleName. It will give you all that's int left side (userEntity in this case).
has comment: http://stackoverflow.com/comment/34239020
has comment: http://stackoverflow.com/comment/34200590

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/22354607
tags question: http://stackoverflow.com/q/22340674
tags question: http://stackoverflow.com/q/22358478
tags question: http://stackoverflow.com/q/22458667
type: Tag
tags question: http://stackoverflow.com/q/22432142
tags question: http://stackoverflow.com/q/22353451

http://stackoverflow.com/comment/34219778
score: 0
comment on: http://stackoverflow.com/a/22483597
type: AnswerComment
has text: Please how do I make a separate venue detail call. Please throw more light on it. I can only call methods in foursquareApi and probably include callbackurl in the constructor.
type: Comment

http://stackoverflow.com/a/22489717
has comment: http://stackoverflow.com/comment/34235537
score: 0
has comment: http://stackoverflow.com/comment/34235287
accepted answer of: http://stackoverflow.com/q/22477899
has comment: http://stackoverflow.com/comment/34234024
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34232892
has body: To pass selected value (if it's selected) use a simple ajax request $.ajax( { type: 'POST', url: '&lt;s:url action="action1"/&gt;', data: { field1 : selectedValue}, //async: false , success: function(data){ alert(data); } }); In the action class create a field named field1 with getter and setter. Then you have an option to return a result type. If json result is used then this field will be serialized and added to the json object you get in the data of your success handler.
has comment: http://stackoverflow.com/comment/34232713
has comment: http://stackoverflow.com/comment/34284818
type: Answer
has comment: http://stackoverflow.com/comment/34255995
has comment: http://stackoverflow.com/comment/34259910
has comment: http://stackoverflow.com/comment/34280889
has comment: http://stackoverflow.com/comment/34283721
answers question: http://stackoverflow.com/q/22477899

http://stackoverflow.com/q/22368120
tagged with: for-loop
tagged with: if-statement
downvote count: 0
has answer: http://stackoverflow.com/a/22368208
has answer: http://stackoverflow.com/a/22368158
has answer: http://stackoverflow.com/a/22368173
has answer: http://stackoverflow.com/a/22368273
has answer: http://stackoverflow.com/a/22368201
favorite count: 0
answer count: 9
has answer: http://stackoverflow.com/a/22368167
has title: Can you use a for loop inside the condition of an if-else statement?
accepted answer: http://stackoverflow.com/a/22368173
type: AnsweredQuestion
has body: Can you use a for loop inside the condition of an if-else statement? For example, something like this... if( for(q = 0; q &lt; 10; q++){ values[q]&gt;=values[q+1]; } ) { done = 0; } This is loading an error I can't seem to place. I want the if statement to check to see if the int[] I called values is in order from greatest to least, and if it is, set int variable done equal to 0. I only just started taking a programming class and I bet this is a very dumb mistake, but I've been trying to figure this out for a while and some help would be absolutely fantastic.
has answer: http://stackoverflow.com/a/22368159
has answer: http://stackoverflow.com/a/22368170
score: 7
tagged with: java
possible better answer: http://stackoverflow.com/a/22368205
upvote count: 7
type: Question
has answer: http://stackoverflow.com/a/22368205

http://stackoverflow.com/a/22487705
answers question: http://stackoverflow.com/q/22485267
score: 0
has comment: http://stackoverflow.com/comment/34232275
has comment: http://stackoverflow.com/comment/34231242
has comment: http://stackoverflow.com/comment/34231272
type: Answer
has body: Here is a solution entirely based on Java 7, using the new WatchService infrastructure: Works, but quite crude... public final class Baz { public static void main(final String... args) throws IOException { // Get paths to the containing directory and the file we want to spy final Path dir = Paths.get("/tmp"); final Path file = dir.resolve("foo.txt"); // Get the watch service for our default filesystem // We are only interested in modifications and deletions final WatchService service = FileSystems.getDefault().newWatchService(); dir.register(service, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE); // Get a charset decoder -- we will be reading bytes from the file, // we will need to decode them to a string final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder() .onMalformedInput(CodingErrorAction.IGNORE) .onUnmappableCharacter(CodingErrorAction.IGNORE); try ( // Open a SeekableByteChannel to the file -- read only final SeekableByteChannel channel = Files.newByteChannel(file, StandardOpenOption.READ); ) { long oldSize; while (true) { // Get the current size of our file oldSize = channel.size(); try { // Grab a key final WatchKey key = service.poll(1L, TimeUnit.SECONDS); if (key == null) // No events... continue; for (final WatchEvent&lt;?&gt; e: key.pollEvents()) { @SuppressWarnings("unchecked") final WatchEvent&lt;Path&gt; event = (WatchEvent&lt;Path&gt;) e; // What kind of event, to whom it applies final WatchEvent.Kind&lt;Path&gt; kind = event.kind(); final Path context = dir.resolve(event.context()); // If not to us, we don't care if (!context.equals(file)) continue; // If our file has disappeared, exit if (kind == StandardWatchEventKinds.ENTRY_DELETE) { System.err.println("File deleted"); System.exit(0); } // OK, so it's a modification, and it is our file: read the tail doRead(oldSize, decoder, channel); } // Reset the key for the next batch of events key.reset(); } catch (InterruptedException e) { // service.poll() interr…

http://stackoverflow.com/q/22465223
has answer: http://stackoverflow.com/a/22465299
has answer: http://stackoverflow.com/a/22465283
has answer: http://stackoverflow.com/a/22465318
score: 5
has body: I have a string array that looks something like ["a","b","c","d"]. Each two consecutive items are pairs and I want to iterate through the array and be able to consider the two strings together. Currently I'm thinking of having a loop and a count to work out where I am in the iteration but is there a simpler/better way?
has answer: http://stackoverflow.com/a/55788295
favorite count: 0
tagged with: iteration
has answer: http://stackoverflow.com/a/22465321
answer count: 5
accepted answer: http://stackoverflow.com/a/22465283
upvote count: 6
possible better answer: http://stackoverflow.com/a/22465321
has comment: http://stackoverflow.com/comment/34171655
has title: Iterating through an array 2 items at a time
tagged with: java
tagged with: loops
downvote count: 1
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/22436726
downvote count: 0
has comment: http://stackoverflow.com/comment/34122003
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22436631
answers question: http://stackoverflow.com/q/22436631
has comment: http://stackoverflow.com/comment/34122039
has body: The quick and dirty way to solve this is to get rid of pack() and subsitute revalidate() and repaint: add(panel); revalidate(); repaint(); // pack(); revalidate tells the layout managers to re-lay out their components. repaint requests that the component be repainted, especially "dirty" regions pack tells the window to re-lay out all components and resize to the optimal size. Much better would be to use a CardLayout, and the window and component size will remain constant, big enough to fit the largest component. ... and avoid all use of null layouts. For example: import java.awt.CardLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class Example2 extends JPanel { public static final String[] COMBO_TEXTS = {"", "a", "b"}; private static final int PREF_W = 400; private static final int PREF_H = PREF_W; private DefaultComboBoxModel&lt;String &gt; comboModel = new DefaultComboBoxModel&lt;&gt;(COMBO_TEXTS); private CardLayout cardLayout = new CardLayout(); public Example2() { setLayout(cardLayout); ComboListener comboListener = new ComboListener(); JComboBox&lt;String&gt; combo = new JComboBox&lt;&gt;(comboModel); combo.addActionListener(comboListener);; JPanel panelBlank = new JPanel(); panelBlank.add(combo); JPanel panelWithText = new JPanel(); combo = new JComboBox&lt;&gt;(comboModel); combo.addActionListener(comboListener);; panelWithText = new JPanel(); panelWithText.add(combo); panelWithText.add(new JLabel("Text")); JPanel panelWithButton = new JPanel(); combo = new JComboBox&lt;&gt;(comboModel); combo.addActionListener(comboListener);; panelWithButton = new JPanel(); panelWithButton.add(combo); panelWithButton.add(new JButton("Hello")); add(panelBlank, COMBO_TEXTS[0]); add(panelWithText, COMBO_TEXTS[1]); add(panelWithButton, COMBO_TEXTS[2]); } @Override public Dimension getPreferredSize() { return new Dimension(PREF_W, PREF_H); } private class ComboListener implements ActionList…
type: AcceptedAnswer

http://stackoverflow.com/q/22340526
tagged with: threadpoolexecutor
has comment: http://stackoverflow.com/comment/33953365
has comment: http://stackoverflow.com/comment/33953431
score: 0
has title: Java ThreadPoolExecutor for sound management exhibits peculiar bug
tagged with: audio
has comment: http://stackoverflow.com/comment/33953310
tagged with: java
has body: I've created a class extending Java's ThreadPoolExecutor that uses its threads to play sounds. This executor receives objects of a Sound class I created to allow some basic manipulation (looping, pausing, resuming). Everything seems to work perfectly at first glance, except for one thing: if I delete the System.out.println call in the code of the Sound class (shown below), my sounds can be paused, but they refuse to resume. If I leave the println in, resuming works perfectly. SoundController class public class SoundController extends ThreadPoolExecutor { public SoundController() { super(2, Integer.MAX_VALUE, 60, TimeUnit.SECONDS, new SynchronousQueue&lt;Runnable&gt;()); setThreadFactory(new SoundThreadFactory()); prestartAllCoreThreads(); } @Override protected void beforeExecute(Thread thread, Runnable target) { super.beforeExecute(thread, target); Sound sound = (Sound) target; SoundThread soundthread = (SoundThread) thread; sound.setLine(soundthread.getLine()); soundthread.setPriority(sound.getPriority()); } protected static class SoundThreadFactory implements ThreadFactory { @Override public SoundThread newThread(Runnable target) { return new SoundThread(target); } } // When a new thread is created, create a new sound line for it to use. private static class SoundThread extends Thread { private SourceDataLine line; public SoundThread(Runnable target) { super(target); setDaemon(true); AudioFormat format = Core.loader().getSoundFormat(); int buffersize = Core.loader().getSoundBufferSize(); try { line = AudioSystem.getSourceDataLine(format); line.open(format, buffersize); line.start(); } catch (LineUnavailableException e) { Core.loader().logException(e); } } public SourceDataLine getLine() { return line; } } } Sound class public class Sound implements Runnable { private enum SoundState { IDLE, FINISHED, PAUSED, PLAYING, } private String url; private int loopcount, priority; private SourceDataLine line; private SoundState state; /** * Creates a new Sound. * @param url…
answer count: 0
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/22491198
score: 1
accepted answer of: http://stackoverflow.com/q/22484078
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22484078
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/49777806
upvote count: 1
has body: Thanks to @AndréSchild comment (thank you) I realized the WAR file wasn't including Bundle.properties. After doing some Google search I have found how to include resources to Maven project by editing pom.xml file in this article. It presents two different ways to solve my problem: Place .properties file inside resources folder By default, Maven will look for your project's resources under src/main/resources. Project |-- pom.xml `-- src `-- main `-- resources This basically states that I could simply place Bundle.properties file inside resources folder and it will be included in WAR file. This file will be located at the root of classpath so I have to do this change in MyVaadinUI.java class: private final ResourceBundle bundle = ResourceBundle.getBundle("Bundle"); Add the folder as resource editing pom.xml file If we want to add some resource which is not placed in src/main/resources folder we can edit pom.xml file adding a resource folder as follows: ... ... [our folder here] ... ... So in my case I could do something like this: ... ... src/main/java/com/mycompany/i18ntest *.properties ... ... When WAR file is generated it will include the content of the specified resource folder (in addition to /src/main/resources fodler content) at the root of classpath. Once again I have to do this change: private final ResourceBundle bundle = ResourceBundle.getBundle("Bundle"); Note: despite NetBeans shows all files in the resource folder, only .properties files will be included in WAR file because of this filter: *.properties

http://stackoverflow.com/a/22355921
has comment: http://stackoverflow.com/comment/33979923
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33980712
accepted answer of: http://stackoverflow.com/q/22354115
has comment: http://stackoverflow.com/comment/33980905
answers question: http://stackoverflow.com/q/22354115
type: Answer
has body: While this is not a direct answer to your question, hopefully it will help you make a good decision The JVM has become very good at re-using objects and you should generally not be afraid to use the new keyword. For more detailed reading, see should-we-avoid-object-creation-in-java
downvote count: 0
score: 1

http://stackoverflow.com/comment/34194660
score: 0
comment on: http://stackoverflow.com/q/22466228
type: Comment
type: QuestionComment
has text: I though that it is working already, that you found the issue. The source code looks OK, I did not find issue (except unused conn1 that is not closed at the end). Make work your request in some tool first.

http://stackoverflow.com/comment/34009695
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22373213
score: 0
has text: Can you provide detail of result and saveP and change .png to png

jacoco
tags question: http://stackoverflow.com/q/22408680
type: Tag
tag name: jacoco

http://stackoverflow.com/q/22346320
type: Question
linked to: http://stackoverflow.com/q/11025187
tagged with: database
has title: ArrayList to Byte and vice versa
tagged with: type-conversion
tagged with: arraylist
has body: Hi I need to store ArrayList in database of my project, for that I need some suggestion to store ArrayList into DB by means of some techniques like ArrayList to Byte[] and store byte[] in DB and retreive my byte[] from DB and convert into my original ArrayList in Java
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22360379
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/34107937
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22429441
has text: I didn't know that `System.out.println(str.replace(" ","\\ "));` works too.Why replaces all whitespaces instead of the first one? Anyway, +1.
type: AnswerComment

http://stackoverflow.com/comment/34187609
has text: no , I have file names with extensions like ....cpu_edt_top_5.6.txt
comment on: http://stackoverflow.com/q/22474702
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22425183
answer count: 1
tagged with: equals
has answer: http://stackoverflow.com/a/22425213
has title: I can't understand a certain line in the following piece of code
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22425213
has body: I can't figure out what the point is of the 'final Person other' line. On the first conditional test a control is executed to check if the parameter isn't null ,which makes sense to me. Secondly ,if the classes are identical so a comparison can be made, which again makes sense to me . But than I'm lost because I don't understand the necessity to create another Person object and use that as a reference. public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Person other = (Person) obj; if (!Objects.equals(this.surname, other.surname)) { return false; } if (!Objects.equals(this.name, other.name)) { return false; } return true; } Thank you for your time :)
score: 0

http://stackoverflow.com/a/22430550
has comment: http://stackoverflow.com/comment/34110070
score: 1
has comment: http://stackoverflow.com/comment/34110013
downvote count: 0
has comment: http://stackoverflow.com/comment/34110122
answers question: http://stackoverflow.com/q/22430490
upvote count: 1
has body: I guess your EditText doesn't contain a well-formated number. Could you provide some examples of the input values? In the meantime check out these examples of Integer.parseInt: public static void main(String args[]) throws Exception { String valid = "925"; int parsed = Integer.parseInt(valid); // works String invalid = "Hello World!"; int error = Integer.parseInt(invalid); // throws NumberFormatException String empty = ""; int error2 = Integer.parseInt(empty); // throws NumberFormatException }
type: Answer
has comment: http://stackoverflow.com/comment/34110086

http://stackoverflow.com/a/22474804
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22474410
score: 1
answers question: http://stackoverflow.com/q/22474410
upvote count: 1
has body: List is an interface. You can't instantiate it. Use any subclass like ArrayList like below List&lt;Client&gt; clientList = new ArrayList&lt;Client&gt;();
type: AcceptedAnswer

http://stackoverflow.com/comment/34174106
comment on: http://stackoverflow.com/q/22338609
has text: I'm available most days (U.S. East Coast business hours) in the #selenium IRC channel on Freenode.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22371631
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34007231
tagged with: servlets
upvote count: 2
has comment: http://stackoverflow.com/comment/34007164
answer count: 2
has answer: http://stackoverflow.com/a/22371824
accepted answer: http://stackoverflow.com/a/22371824
favorite count: 0
possible better answer: http://stackoverflow.com/a/22371872
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/34007233
has body: When I run my servlet I get this error in my Tomcat console. I guess I have to look at my SimpleDateformat, but can anyone see what is wrong here? My code is compiling fine, so I am a little in doubt what to look after: Video of the error: https://www.youtube.com/watch?v=3hdmIkwuB6k&amp;feature=youtu.be Have a nice day/evening to everybody From Julie My Servlet: package WorkPackage; import java.io.*; import java.sql.*; import java.text.SimpleDateFormat; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.*; @WebServlet("/getHoursSQL") public class getHoursSQL extends HttpServlet{ private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ String connectionURL = "jdbc:mysql://localhost/NekiWork"; Connection connection=null; try { //Load database driver Class.forName("com.mysql.jdbc.Driver"); //Connection to the database connection = DriverManager.getConnection(connectionURL, "root", ""); //Getting the data from database String sql = "SELECT *, (Day_hours + (Day_minutes / 60)) AS Allday_hours FROM Workdata " + "WHERE startdate = ? AND endDate = ? "; PreparedStatement pst = connection.prepareStatement(sql); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); java.util.Date util_StartDate = format.parse( req.getParameter("startDate") ); java.sql.Date sql_StartDate = new java.sql.Date( util_StartDate.getTime() ); java.util.Date util_EndDate = format.parse( req.getParameter("endDate") ); java.sql.Date sql_EndDate = new java.sql.Date( util_EndDate.getTime() ); pst.setDate( 1, sql_StartDate ); pst.setDate(2, sql_EndDate ); //Show the result from database ResultSet rs = pst.executeQuery(); float Allday_hours_sum = 0; while (rs.next()){ Allday_hours_sum += rs.getFloat("Allday_h…
has answer: http://stackoverflow.com/a/22371872
linked to: http://stackoverflow.com/q/218384
score: 2
downvote count: 0
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/34007124
has title: java.lang.NullPointerException in servlet
type: Question

http://stackoverflow.com/q/22387494
has comment: http://stackoverflow.com/comment/34034630
has comment: http://stackoverflow.com/comment/34035043
tagged with: button
favorite count: 0
has answer: http://stackoverflow.com/a/22387588
has comment: http://stackoverflow.com/comment/34035145
has comment: http://stackoverflow.com/comment/34035120
type: AnsweredQuestion
upvote count: 0
has body: here is the code section b1=new Button("yes"); b2=new Button("no"); b3=new Button("maybe"); bList=new Button[3]; bList[0]=(Button)add(b1); bList[1]=(Button)add(b2); bList[2]=(Button)add(b3); b1,b2,b3 and bList[] are already declared .The question i am asking is that when bList is of type Button and b1/b2/b3 are of type Button why do i need to cast it to Button when assigning them to bList array?
has comment: http://stackoverflow.com/comment/34034968
tagged with: java
has comment: http://stackoverflow.com/comment/34034704
has comment: http://stackoverflow.com/comment/34034590
type: Question
possible better answer: http://stackoverflow.com/a/22387588
has comment: http://stackoverflow.com/comment/34034679
has answer: http://stackoverflow.com/a/22387906
accepted answer: http://stackoverflow.com/a/22387906
score: -2
has comment: http://stackoverflow.com/comment/34034623
answer count: 2
has title: why cast the result of add(myButton) when assigning it to a Button array
downvote count: 2

http://stackoverflow.com/a/22329013
has comment: http://stackoverflow.com/comment/33934043
downvote count: 0
has comment: http://stackoverflow.com/comment/33933774
has comment: http://stackoverflow.com/comment/33933457
has comment: http://stackoverflow.com/comment/33933995
answers question: http://stackoverflow.com/q/22328787
type: Answer
has comment: http://stackoverflow.com/comment/33934211
score: 1
upvote count: 1
has body: I'm not sure I understand fully, but if what you want to do is display a panel with an image inside a window, you should subclass JPanel (or whatever other panel you'd like), and override the paintComponent method to paint the image. Something along the lines of: public class ImagePanel extends JPanel { private Image image; public ImagePanel(Image image) { this.image = image; } @Override protected void paintComponent(graphics g) { g.drawImage(image, 0, 0, this); } }

http://stackoverflow.com/q/22475783
has comment: http://stackoverflow.com/comment/34227082
has answer: http://stackoverflow.com/a/22476103
score: 0
tagged with: java
type: Question
has title: Removing Java Applet Warning Popup
answer count: 1
tagged with: applet
type: UnansweredQuestion
has body: I have searched around but cannot find the definitive answer to my question. We have a Java Applet we wish to deploy into an internal system. The applets job is to access an external device via a java Socket. I have self signed the certificate of the applet locally for development purposes and the applet works correctly. With the self signed certificate, i get a popup warning asking me if i wish to run the applet. Once the code goes live, it will be used on the same browser for just our internal users. If i get a trusted certificate from somewhere like verisign, etc, will the popup warning be disabled? Ideally, i do not want the user to have to confirm anything or have to check any boxes, etc. Thanks, Mike
has comment: http://stackoverflow.com/comment/34234395

http://stackoverflow.com/q/22430444
has title: Adding and Removing Panels GWT Dynamically
type: Question
tagged with: gwt
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/22430482
type: AnsweredQuestion
has body: I'm trying to add/remove panels in GWT. First I declare panels and some Labels (which act as buttons). DockPanel dockPanel = new DockPanel(); RootLayoutPanel rootLayout = RootLayoutPanel.get(); Label one = new Label("First Button"); Label two = new Label("Second Button"); Then I have this which initialises various panels public void initPanels() { dockPanel.add(one, DockPanel.EAST); rootLayout.add(dockPanel); I add some click handlers which then sends requests to this class, which would then remove a panel and replace it with another, only I can't work out how to do it: public void getActivePanel(String activePanelName){ if (activePanelName==null){ dockPanel.add(one, DockPanel.EAST); } else if (activePanelName == "two"){ //can't figure this bit out //dockPanel.remove(AnotherLabel); //dockPanel.remove((IsWidget) DockPanel.EAST); //dockPanel.add(two, DockPanel.EAST); } }
accepted answer: http://stackoverflow.com/a/22430482

http://stackoverflow.com/q/22407411
score: 1
tagged with: java
has body: I found the following code in a project. It works and can read more than 20MB big files. From how the code is set up it should fail after 5000 bytes. Why does it work? The docs for ByteArrayBuffer indicate nothing like that. I have verified that the read-loop iterates for all bytes of each file. http://developer.android.com/reference/org/apache/http/util/ByteArrayBuffer.html URLConnection ucon = url.openConnection(); ucon.setReadTimeout(10000); // enables throw SocketTimeoutException InputStream is = ucon.getInputStream(); long expectedFileSize = ucon.getContentLength(); Log.d("Downloader", "expected file size: " + expectedFileSize); BufferedInputStream bis = new BufferedInputStream(is); // Read bytes to the Buffer until there is nothing more to read(-1). // This code can read 20MB and bigger mp3-files, ... why?!? ByteArrayBuffer baf = new ByteArrayBuffer(5000); int current = 0; while ((current = bis.read()) != -1) { baf.append((byte) current); } FileOutputStream fos = new FileOutputStream(file); fos.write(baf.toByteArray()); fos.flush(); fos.close();
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22407504
tagged with: urlconnection
has title: Android ByteArrayBuffer holds more bytes than capacity
favorite count: 0
tagged with: android
tagged with: io
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34299569
accepted answer: http://stackoverflow.com/a/22407504
upvote count: 1
has comment: http://stackoverflow.com/comment/34143129
type: Question

http://stackoverflow.com/a/22409350
downvote count: 0
score: 1
has body: you have not given the file extension in your code for your file "D:/one" is it an xls ot xlsx or csv .
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22408299

http://stackoverflow.com/comment/33945663
score: 0
has text: Wow! You are right!Have forgotten about the features from Autoboxing and Unboxing! Thanks for the hint!
type: Comment
comment on: http://stackoverflow.com/a/22335547
type: AnswerComment

http://stackoverflow.com/comment/34154173
comment on: http://stackoverflow.com/a/22455654
score: 0
type: AnswerComment
type: Comment
has text: Well since you need to copy the values to a new array, you will have to access all the values of the 2D array, you cannot do better than that. And since you said that the 2D array is already sorted, if you loop through the 2D array correctly, then the 1D array has to be sorted.

http://stackoverflow.com/comment/34125202
score: 0
has text: `03-16 16:57:42.200: I/HHG(28725): Basic c2NodWsZXI6aGVpbmNA== 03-16 16:57:42.200: I/HHG(28725): Basic c2NodWsZXI6aGVpbmNA==` I'm logging them and they are equal to me. The `.equalsIgnoreCase` returns `false`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22439027

http://stackoverflow.com/a/22454356
has comment: http://stackoverflow.com/comment/34152752
type: Answer
answers question: http://stackoverflow.com/q/22454133
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34372582
has comment: http://stackoverflow.com/comment/34161154
downvote count: 0
has body: You can use NumberFormat to choose the Locale, see the example: String numberToFormat = "1.900,35"; NumberFormat formatter = NumberFormat.getNumberInstance(Locale.GERMAN); Number number = formatter.parse(numberToFormat); BigDecimal decimal = BigDecimal.valueOf(number.doubleValue());

http://stackoverflow.com/q/22398084
has comment: http://stackoverflow.com/comment/34053224
has answer: http://stackoverflow.com/a/22398365
tagged with: number-formatting
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34053014
has body: I have searched for this question on the website but do not understand most of the solutions posted. my question is; i have a method: public static int convertToDecimal(int number, int base) it will receive a number and base, then multiply them thus: (1023, 4) passed to the method will be (1 * Math.pow(4,3)) + (0* Math.pow(4,2))+(2* Math.pow(4,1))+(3* Math.pow(4,0)) will return 75. please I am very new to java and do not yet understand the sophisticated methods of doing this. the goal is to understand how to do the iriteration. thanks
type: UnansweredQuestion
has title: how to convert different number systems to base ten in the simplest way
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22398169

http://stackoverflow.com/q/22450745
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22451441
has body: I have a cURL command I want to translate in Java curl -H "Key: XXX" -d url=http://www.google.com http://myapi.com/v2/extraction?format=json It works fine. I started to do in Java: (CODE EDITED, it works) try { // POST System.out.println("POSTING"); URL url = new URL("http://myapi.com/v2/extraction?format=json"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod("POST"); connection.setRequestProperty("Key", "XXX"); String data = "http://www.google.com"; OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); writer.write("url=" +data); writer.close(); int responseCode = connection.getResponseCode(); System.out.println("\nSending 'POST' request to URL : " + url); System.out.println("Post parameters : " + data); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println("REPOSNE" +response.toString()); if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { // OK } else { // Server returned HTTP error code. } } catch (MalformedURLException e) { // ... } catch (IOException e) { // ... } But I don't know how to set my arguments. Thanks for your help. Jean
type: Question
has comment: http://stackoverflow.com/comment/34146849
answer count: 1
has comment: http://stackoverflow.com/comment/34146914
score: 0
has comment: http://stackoverflow.com/comment/34147050
accepted answer: http://stackoverflow.com/a/22451441
tagged with: arguments
tagged with: curl
has comment: http://stackoverflow.com/comment/34147000
has comment: http://stackoverflow.com/comment/34146659
has title: cURL command to Java

http://stackoverflow.com/comment/33964469
type: QuestionComment
comment on: http://stackoverflow.com/q/22345559
has text: Try yo send the data as , `data : $('#editDocumentForm').serialize() + "&par1=1&par2=2&par3=232"` and let me know.
score: 0
type: Comment

http://stackoverflow.com/a/22422035
has body: If you are not concerning with randomness properties too much then I do it like this: create buffer for pseudo-random numbers double buff[MAX]; // [edit1] double pseudo random numbers MAX is size should be big enough ... 1024*128 for example type can be any (float,int,DWORD...) fill buffer with numbers you have range of numbers x = &lt; x0,x1 &gt; and probability function probability(x) defined by your probability distribution so do this: for (i=0,x=x0;x&lt;=x1;x+=stepx) for (j=0,n=probability(x)*MAX,q=0.1*stepx/n;j&lt;n;j++,i++) // [edit1] unique pseudo-random numbers buff[i]=x+(double(i)*q); // [edit1] ... The stepx is your accuracy for items (for integral types = 1) now the buff[] array has the same distribution as you need but it is not pseudo-random. Also you should add check if j is not &gt;= MAX to avoid array overruns and also at the end the real size of buff[] is j (can be less than MAX due to rounding) shuffle buff[] do just few loops of swap buff[i] and buff[j] where i is the loop variable and j is pseudo-random &lt;0-MAX) write your pseudo-random function it just return number from the buffer. At first call returns the buff[0] at second buff[1] and so on ... For standard generators When you hit the end of buff[] then shuffle buff[] again and start from buff[0] again. But as you need unique numbers then you can not reach the end of buffer so so set MAX to be big enough for your task otherwise uniqueness will not be assured. [Notes] MAX should be big enough to store the whole distribution you want. If it is not big enough then items with low probability can be missing completely. [edit1] - tweaked answer a little to match the question needs (pointed by meriton thanks) PS. complexity of initialization is O(N) and for get number is O(1).
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34106886
answers question: http://stackoverflow.com/q/22421459
upvote count: 1
has comment: http://stackoverflow.com/comment/34098673

http://stackoverflow.com/a/22450408
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22450118
has comment: http://stackoverflow.com/comment/34145829
has body: Yes, create a library project and keep the content of the lib or any other project folder you want in this library project. Reference this project in your other project. This will allow you to have a common path across all project for any project folder like lib, SRC, asset Any content with same name and project folder in referencing project will over write that particular content of library project.

http://stackoverflow.com/comment/34037640
has text: @HotLicks How do you figure? If I make a class Character, I can surely make a generic List of them...
type: Comment
comment on: http://stackoverflow.com/a/22388924
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34138912
has text: Or `while(!stack.isEmpty())` : )
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22446324

http://stackoverflow.com/a/22351738
score: 1
has body: When first time you are reading by fr.read(cbuff) then it's reading characters in the file and total char are 67 so it's showing 67 now cursor moves to end of file next time when you are reading then it found EOF that's why returning -1.
upvote count: 1
answers question: http://stackoverflow.com/q/22351536
type: Answer
downvote count: 0

http://stackoverflow.com/comment/34183720
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22472428
has text: but then I have use varargs also,so that i do not have to pass it as an array

http://stackoverflow.com/comment/34049733
type: Comment
comment on: http://stackoverflow.com/a/22396025
has text: @Santhosh.S: Make sure this only matches one element. If there are other elements with same text, you need provide more HTML. Answer above provides **exact** match.
type: AnswerComment
score: 0

eclipse
tags question: http://stackoverflow.com/q/22364957
tags question: http://stackoverflow.com/q/22446304
tags question: http://stackoverflow.com/q/22433604
tags question: http://stackoverflow.com/q/22375142
tag name: eclipse
tags question: http://stackoverflow.com/q/22329372
tags question: http://stackoverflow.com/q/22468906
tags question: http://stackoverflow.com/q/22352633
tags question: http://stackoverflow.com/q/22457326
tags question: http://stackoverflow.com/q/22363612
tags question: http://stackoverflow.com/q/22367331
tags question: http://stackoverflow.com/q/22425310
tags question: http://stackoverflow.com/q/22387649
tags question: http://stackoverflow.com/q/22375515
tags question: http://stackoverflow.com/q/22400333
tags question: http://stackoverflow.com/q/22454296
tags question: http://stackoverflow.com/q/22469319
tags question: http://stackoverflow.com/q/22387759
tags question: http://stackoverflow.com/q/22446583
tags question: http://stackoverflow.com/q/22349972
tags question: http://stackoverflow.com/q/22422375
tags question: http://stackoverflow.com/q/22335131
tags question: http://stackoverflow.com/q/22385457
tags question: http://stackoverflow.com/q/22407742
tags question: http://stackoverflow.com/q/22405892
tags question: http://stackoverflow.com/q/22403083
tags question: http://stackoverflow.com/q/22448377
tags question: http://stackoverflow.com/q/22335089
tags question: http://stackoverflow.com/q/22469479
tags question: http://stackoverflow.com/q/22452133
tags question: http://stackoverflow.com/q/22451092
tags question: http://stackoverflow.com/q/22384503
tags question: http://stackoverflow.com/q/22353307
tags question: http://stackoverflow.com/q/22387771
tags question: http://stackoverflow.com/q/22456406
tags question: http://stackoverflow.com/q/22394910
tags question: http://stackoverflow.com/q/22424993
tags question: http://stackoverflow.com/q/22400176
tags question: http://stackoverflow.com/q/22434377
tags question: http://stackoverflow.com/q/22430450
tags question: http://stackoverflow.com/q/22459320
tags question: http://stackoverflow.com/q/22416098
tags question: http://stackoverflow.com/q/22353203
tags question: http://stackoverflow.com/q/22386495
tags question: http://stackoverflow.com/q/22367564
tags question: http://stackoverflow.com/q/22485162
tags question: http://stackoverflow.com/q/22337895
tags question: http://stackoverflow.com/q/22452999
tags question: http://stackoverflow.com/q/22331520
tags question: http://stackoverflow.com/q/22391425
tags question: http://stackoverflow.com/q/22402977
tags question: http://stackoverflow.com/q/22457587
tags question: http://stackoverflow.com/q/22443289
tags question: http://stackoverflow.com/q/22474092
tags question: http://stackoverflow.com/q/22348968
tags question: http://stackoverflow.com/q/22477324
tags question: http://stackoverflow.com/q/22442106
tags question: http://stackoverflow.com/q/22480150
tags question: http://stackoverflow.com/q/22371688
tags question: http://stackoverflow.com/q/22478443
tags question: http://stackoverflow.com/q/22384940
tags question: http://stackoverflow.com/q/22415552
tags question: http://stackoverflow.com/q/22353727
tags question: http://stackoverflow.com/q/22417157
tags question: http://stackoverflow.com/q/22428304
tags question: http://stackoverflow.com/q/22347485
tags question: http://stackoverflow.com/q/22459531
tags question: http://stackoverflow.com/q/22415022
tags question: http://stackoverflow.com/q/22468704
tags question: http://stackoverflow.com/q/22393962
tags question: http://stackoverflow.com/q/22361235
tags question: http://stackoverflow.com/q/22368609
tags question: http://stackoverflow.com/q/22330982
tags question: http://stackoverflow.com/q/22333654
tags question: http://stackoverflow.com/q/22331051
tags question: http://stackoverflow.com/q/22426456
tags question: http://stackoverflow.com/q/22462339
tags question: http://stackoverflow.com/q/22434908
tags question: http://stackoverflow.com/q/22451368
tags question: http://stackoverflow.com/q/22462668

http://stackoverflow.com/comment/73120678
score: 39
type: Comment
has text: I cannot find Properties from right click of project. May be I am stupid. :(
type: AnswerComment
comment on: http://stackoverflow.com/a/22959847

http://stackoverflow.com/comment/33958056
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22343238
has text: [8601 surely?](http://en.wikipedia.org/wiki/ISO_8601) - Have a look [here](http://stackoverflow.com/questions/2201925/converting-iso8601-compliant-string-to-java-util-date)
score: 0

http://stackoverflow.com/a/22441752
has body: You could also try "Limited Depth-first search" A recursive implementation in Java using part of your code could be: class Tree { Node root; int level,cLevel; Tree() { root=null; level=0; cLevel=level-1; } protected void add(int data) { System.out.println("data k: "+ data); Node t; if(root==null) { root=new Node(data); level++; } else { cLevel = 0; boolean added = add(data, root); //Couldn't add to current level, add new level if (!added){ level++; cLevel = 0; add(data, root); } } } private boolean add(int data, Node node) { cLevel++; boolean added; //Depth limited if (cLevel&lt;=level){ added = true; //Try to add to current node if (node.left == null) node.left = new Node(data); else if (node.right == null) node.right = new Node(data); else if (!add(data, node.left)) //Recursively trying to add to children added = add(data, node.right); } else { added=false; } cLevel--; return added; } } Hope it helps.
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22440564

http://stackoverflow.com/q/22334358
has comment: http://stackoverflow.com/comment/33943053
type: UnansweredQuestion
tagged with: io
has comment: http://stackoverflow.com/comment/33942179
has comment: http://stackoverflow.com/comment/33942077
has comment: http://stackoverflow.com/comment/33942407
has comment: http://stackoverflow.com/comment/33942320
has comment: http://stackoverflow.com/comment/33942668
has comment: http://stackoverflow.com/comment/33942128
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/33942326
has comment: http://stackoverflow.com/comment/33942594
type: Question
has body: I've written Java code for writing String into a file. Size of string will be hardly 10KB. Below is the code I've written to write files. I've written 3 ways to write into a file. void writeMethod(String string, int m) { if (m == 1) { FileChannel rwChannel = new RandomAccessFile(filePath, "rw").getChannel(); ByteBuffer wrBuf = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, string.length() * 1); wrBuf.put(string.getBytes()); rwChannel.close(); } if (m == 2) { FileOutputStream fileOutputStream = new FileOutputStream(filePath); fileOutputStream.write(string.getBytes()); fileOutputStream.close(); } if (m == 3) { FileWriter bw new FileWriter(filePath); bw.write(string); bw.close( ); } } **Ignore errors I call the above function from 3 threads, one method per thread. I'm not sure which one is the fastest. If not among these ways, which one is good. I've to write 17,000,000 files.
has answer: http://stackoverflow.com/a/22334628
has comment: http://stackoverflow.com/comment/33942097
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33942107
has comment: http://stackoverflow.com/comment/33942248
has comment: http://stackoverflow.com/comment/33942878
has title: Write humongous number of tiny files

http://stackoverflow.com/comment/34007764
type: QuestionComment
has text: On a unrelated note why are you forcing to use a milestone/release (Spring Orm 4.0.0.RC1) candidate whereas already Spring 4.0.2 is out (and referenced by your starter projects).
score: 1
comment on: http://stackoverflow.com/q/22369033
type: Comment

http://stackoverflow.com/a/22411385
upvote count: 1
answers question: http://stackoverflow.com/q/22411299
score: 1
downvote count: 0
type: Answer
has body: The easiest solution is to zero pad all digits lower than 10. Like job01.script instead of job1.script This assumes no more than 100 files. With more, simply add more zeros. Otherwise, you'll need analyze and breakdown each file name, and then order it numerically. Currently, it's being ordered by character.

http://stackoverflow.com/comment/82882631
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/31577152
type: Comment
has text: Elaborated on using `determineUser` & `DefaultHandshakeHandler` here : https://stackoverflow.com/questions/37853727/where-user-comes-from-in-convertandsendtouser-works-in-sockjsspring-websocket

http://stackoverflow.com/comment/34047734
has text: @PaulDraper Thank you. I think I understand it a little better. The most confusing part for me is understanding why y[0]=x.clone() does not point to the x array in the first example while it does in the second example.
comment on: http://stackoverflow.com/a/22394752
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22454133
upvote count: 14
has body: Why does the code below throw a java number format exception? BigDecimal d = new BigDecimal("10934,375");
tagged with: java
score: 13
downvote count: 1
possible better answer: http://stackoverflow.com/a/22454331
type: Question
has answer: http://stackoverflow.com/a/22454331
has answer: http://stackoverflow.com/a/22454134
tagged with: bigdecimal
has answer: http://stackoverflow.com/a/22454356
accepted answer: http://stackoverflow.com/a/22454134
linked to: http://stackoverflow.com/q/177506
answer count: 3
has title: Java big decimal number format exception
favorite count: 0
tagged with: exception
type: AnsweredQuestion

http://stackoverflow.com/comment/34100753
type: Comment
has text: as for the i18n, you can load stuff from MessageSource also in the controller method, not only in JSPs. Sorry that I didn't help
score: 1
comment on: http://stackoverflow.com/a/22422519
type: AnswerComment

http://stackoverflow.com/a/22458471
has comment: http://stackoverflow.com/comment/34185148
type: Answer
downvote count: 0
score: 1
has body: You'd pass a reference for that instance to the method being called. For example, say you have two objects: class ObjectA { public void methodA() { new ObjectB().methodB(); } } class ObjectB { public void methodB() { // How can I know who called me? } } If MethodB needs to know which instance of ObjectA called it, then it would accept that information as a parameter: class ObjectA { public void methodA() { new ObjectB().methodB(this); } } class ObjectB { public void methodB(ObjectA caller) { // "caller" is who called me } } There are lots of ways to tweak this. For example, maybe any given instance of ObjectB should have a reference to the ObjectA which created it: class ObjectA { public void methodA() { new ObjectB(this).methodB(); } } class ObjectB { private final ObjectA caller; public ObjectB(ObjectA caller) { this.caller = caller; } public void methodB() { // "caller" called me } } Or perhaps you don't want to couple the two objects together and want a more generic approach. You claim that the objects have some kind of identifier, what is that identifier? A String perhaps? class ObjectA { private String identifier; // other code public void methodA() { new ObjectB().methodB(identifier); } } class ObjectB { public void methodB(String callerID) { // "callerID" identifies who called me } }
answers question: http://stackoverflow.com/q/22458293
upvote count: 1

http://stackoverflow.com/comment/33961788
type: AnswerComment
has text: Program doesn't continue. Its continues within the while. EX: Enter the service number : 1 input input input
comment on: http://stackoverflow.com/a/22345414
type: Comment
score: 0

http://stackoverflow.com/a/22343245
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/33983150
has comment: http://stackoverflow.com/comment/33997100
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22343047
has body: In the mousePiece method, what does he mean by: chessPiece = null is he saying that if the JLabel chessPiece has a image in it then it should be changed to null? I assume you mean mousePressed. By using chessPiece = null, the author is de-referencing the variable, so what ever was assigned to it is no longer reachable through the is variable Is chessBoard.findComponentAt(e.getX(), e.getY()) returns the JPanel square? This depends. findComponentAt can search the current container and it's any of it's child containers until it finds a component at the specified position. Technquial, the author is ignoring the component that triggered the event (which should layeredPane) and is walking the chessBoard instead. I suspect they are doing this because if they used layeredPane it would return chessBoard instead. The method is capable of returning JPanel, JLabel and possibly even null, but given the way that the components are laid out, it's a lower probability. and lastly, when Component c gets its parent, who is the parent? This depends. Based on my understanding of the code, I would say it's return a JPanel underneth the JLabel piece. Have to say, there are easier ways to achieve the same result though...
accepted answer of: http://stackoverflow.com/q/22343047

email
tags question: http://stackoverflow.com/q/22416891
tags question: http://stackoverflow.com/q/22422553
tags question: http://stackoverflow.com/q/22388501
tags question: http://stackoverflow.com/q/22378844
tags question: http://stackoverflow.com/q/22446483
tags question: http://stackoverflow.com/q/22447606
tags question: http://stackoverflow.com/q/22401177
tags question: http://stackoverflow.com/q/22438231
tags question: http://stackoverflow.com/q/22448369
tags question: http://stackoverflow.com/q/22455767
tags question: http://stackoverflow.com/q/22441922
type: Tag
tag name: email

http://stackoverflow.com/q/22476376
tagged with: sockets
has comment: http://stackoverflow.com/comment/34199307
type: AnsweredQuestion
tagged with: tcp
tagged with: java
has answer: http://stackoverflow.com/a/22476643
type: Question
has answer: http://stackoverflow.com/a/22476473
has title: Socket communication between Java and C: Good buffer size
tagged with: http://stackoverflow.com/tag/c
possible better answer: http://stackoverflow.com/a/22476473
has comment: http://stackoverflow.com/comment/34191283
score: 0
has body: I have to implement a socket communicatio between a Server written in Java and a Client written in C. The maximum amount of data that I will have to transmit is 64KB. In the most socket communication tutorials they are working with buffer sizes of about 1024 Byte or less. Is it a (maybe performance) problem to set the buffer to 64KB? The two software parts will run on the same machine or at least in the same local area network. And if it is a problem: How to handle messages that are bigger than buffer in general?
answer count: 2
accepted answer: http://stackoverflow.com/a/22476643
tagged with: buffer

keystroke
type: Tag
tag name: keystroke
tags question: http://stackoverflow.com/q/22484944

http://stackoverflow.com/a/22436638
has comment: http://stackoverflow.com/comment/34228177
has comment: http://stackoverflow.com/comment/34126152
score: 265
has comment: http://stackoverflow.com/comment/102188569
type: AcceptedAnswer
has body: As others have already mentioned, the design decision behind this was to prevent the explosion of methods and classes. Still, personally I think this was a very bad decision, and there should, given they do not want to make CharStream, which is reasonable, different methods instead of chars(), I would think of: Stream&lt;Character&gt; chars(), that gives a stream of boxes characters, which will have some light performance penalty. IntStream unboxedChars(), which would to be used for performance code. However, instead of focusing on why it is done this way currently, I think this answer should focus on showing a way to do it with the API that we have gotten with Java 8. In Java 7 I would have done it like this: for (int i = 0; i &lt; hello.length(); i++) { System.out.println(hello.charAt(i)); } And I think a reasonable method to do it in Java 8 is the following: hello.chars() .mapToObj(i -&gt; (char)i) .forEach(System.out::println); Here I obtain an IntStream and map it to an object via the lambda i -&gt; (char)i, this will automatically box it into a Stream&lt;Character&gt;, and then we can do what we want, and still use method references as a plus. Be aware though that you must do mapToObj, if you forget and use map, then nothing will complain, but you will still end up with an IntStream, and you might be left off wondering why it prints the integer values instead of the strings representing the characters. Other ugly alternatives for Java 8: By remaining in an IntStream and wanting to print them ultimately, you cannot use method references anymore for printing: hello.chars() .forEach(i -&gt; System.out.println((char)i)); Moreover, using method references to your own method do not work anymore! Consider the following: private void print(char c) { System.out.println(c); } and then hello.chars() .forEach(this::print); This will give a compile error, as there possibly is a lossy conversion. Conclusion: The API was designed this way because of not wanting to add CharSt…
has comment: http://stackoverflow.com/comment/34228198
accepted answer of: http://stackoverflow.com/q/22435833
type: Answer
has comment: http://stackoverflow.com/comment/34227600
answers question: http://stackoverflow.com/q/22435833
downvote count: 3
has comment: http://stackoverflow.com/comment/34187039
has comment: http://stackoverflow.com/comment/111598196
upvote count: 268

http://stackoverflow.com/a/22395703
has comment: http://stackoverflow.com/comment/36914962
answers question: http://stackoverflow.com/q/22393785
has body: I dug into the source code of exec-maven-plugin and found this snippet. From the source of ExecMojo#getExecutablePath: CommandLine toRet; if ( OS.isFamilyWindows() &amp;&amp; exec.toLowerCase( Locale.getDefault() ).endsWith( ".bat" ) ) { toRet = new CommandLine( "cmd" ); toRet.addArgument( "/c" ); toRet.addArgument( exec ); } else { toRet = new CommandLine( exec ); } I compared this to another plugin that ran grunt tasks from maven, and found this if (isWindows()) { command = "cmd /c " + command; } ... and that worked for me. So essentially the latter worked because all commands in WIndows were prepended with cmd /c, whereas the exec-maven-plugin did not, because it only did so for file ending in .bat. Looking in C:\Users\USER\AppData\Roaming\npm, I see: node_modules (folder) grunt (unix script file) grunt.cmd (windows script file) When I rename grunt.cmd --> grunt.bat, this solves the problem, and exec-maven-plugin is able to run this command. (this also applies to other executables created using npm install -g, such as bower and yo)
type: Answer
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/64912056
has comment: http://stackoverflow.com/comment/36719183
has comment: http://stackoverflow.com/comment/36732164
score: 12
has comment: http://stackoverflow.com/comment/36714643

http://stackoverflow.com/comment/115238899
comment on: http://stackoverflow.com/a/48840927
type: AnswerComment
score: 0
type: Comment
has text: @DevAmitabh I never mentioned "the language is not secure enough", I just mentioned several secrets are stored using string and they are passed in between different methods and if String objects are not immutable then some improper code in one those methods can accidentally modify those secrets and cause problems to their caller method.

http://stackoverflow.com/q/22403705
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
tagged with: jenkins
score: 1
has body: My setup is of Selenium + Junit + Ant + Jenkins Trying to get a perfect way to create multiple Jenkins job where each job is reading different property file using ant. I am thinking of creating multiple property.xml file in my project and all the property file is configured in build.xml. I can create multiple target in build.xml but every target need different property file, how to initialize individual property file for individual target? Please help me on this, so that I can build a standard integrated framework.
tagged with: java
tagged with: selenium
upvote count: 1
has answer: http://stackoverflow.com/a/22406146
has title: Read multiple property file in build.xml
type: Question
tagged with: ant
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/33963981
comment on: http://stackoverflow.com/q/22346559
score: 0
type: Comment
type: QuestionComment
has text: Can you include the stacktrace (running gradle in debug mode)?

http://stackoverflow.com/comment/34066052
has text: and what's the difference?
comment on: http://stackoverflow.com/q/22405999
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/34137702
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22445631
has text: possible duplicate of [What is a Null Pointer Exception?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception)
type: Comment

http://stackoverflow.com/a/22438239
has comment: http://stackoverflow.com/comment/34138062
downvote count: 0
has comment: http://stackoverflow.com/comment/34138228
has comment: http://stackoverflow.com/comment/34138016
type: Answer
answers question: http://stackoverflow.com/q/22432289
has comment: http://stackoverflow.com/comment/34139215
score: 1
has body: Create a ParallelTransition. For each piece that you want to move, create a SequentialTransition, a PauseTransition, and the TranslateTransition. The PauseTransitions should be incrementally bigger for each piece, say 0, 25ms, 50ms, 75ms, etc. Add the PauseTransition and the TranslateTransition to the SequentialTransition. Add each SequentialTransition to the ParallelTransition. Then play the ParallelTransition. No need to create any Threads or mess with Platform.runLater(...).
upvote count: 1

http://stackoverflow.com/comment/34134072
type: QuestionComment
comment on: http://stackoverflow.com/q/22443662
has text: Please format your code properly.
score: 0
type: Comment

http://stackoverflow.com/q/22339900
score: 0
has answer: http://stackoverflow.com/a/40832355
tagged with: java
tagged with: bukkit
type: Question
has answer: http://stackoverflow.com/a/22340317
has answer: http://stackoverflow.com/a/22340171
tagged with: arraylist
answer count: 3
has body: I have a String named listOfItemsBanned, and an ArrayList named itemsBanned. Let's say the ArrayList itemsBanned contains 3 things: TNT, EnderPearl, and Sand. I would want the String to be "TNT, EnderPearl, Sand". And when something is removed from itemsBanned, it would remove it from the string, too. So.. I want to be able to get every item included in an ArrayList and put it into one String with each item separated by commas.
has title: How to make a String contain each item in an ArrayList? (JAVA)
has comment: http://stackoverflow.com/comment/33952133
type: UnansweredQuestion

http://stackoverflow.com/a/30910890
type: Answer
answers question: http://stackoverflow.com/q/22407585
score: 0
has body: You don't need javascript here, go with basic html form tag to submit the details. Also don't use scriplets as you are already aware of jstl. Note below code is only implemented for add, you need to write your code for remove. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> <sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/products" user="root" password="170293m" /> BestWholesaler LTd. Welcome to BestWholesaler Ltd. Online Ordering Items Currently in Stock <c:if test="${null != param.add}"> <c:catch var="error"> <sql:update dataSource="${snapshot}" scope="page" var="result"> INSERT INTO sales (code, quantity, price, name) VALUES (?, ?, ?, ?) <sql:param value="${param.code}" /> <sql:param value="${param.quantity}" /> <sql:param value="50" /> <sql:param value="aw ras" /> </sql:update> </c:catch> </c:if> <c:if test="${null != error}"> Failed to save stock details </c:if> <c:catch var="error"> <sql:query dataSource="${snapshot}" var="result"> SELECT Name, Code, PricePU, Quantity from productinfo; </sql:query> </c:catch> <c:if test="${null != error}"> Failed to get stock details </c:if> <c:if test="${null == error}"> Name Code Price/Unit Quantity Available <c:forEach var="row" items="${result.rows}"> <c:out value="${row.Name}" /> <c:out value="${row.Code}" /> <c:out value="${row.PricePU}" /> <c:out value="${row.Quantity}" /> </c:forEach> </c:if> Enter Code: Enter Quantity:

http://stackoverflow.com/comment/33988711
type: Comment
comment on: http://stackoverflow.com/a/22360872
has text: THAAAAAAAAAAAANKS! :D It's named `F_BANKNUM` so I mistyped it! I have to learn how to read exceptions.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34128753
score: 0
type: Comment
type: QuestionComment
has text: I've tried variations of enabling selections. I've updated the question with more details.
comment on: http://stackoverflow.com/q/22440733

http://stackoverflow.com/q/22434266
accepted answer: http://stackoverflow.com/a/22434286
has body: class MultiplyTable1 { synchronized void printTable(int n) { for (int i = 1; i &lt;= 5; i++) { System.out.println(n * i); try { Thread.sleep(500); } catch (Exception e) { System.out.println(e); } } } } class ThreadOne1 extends Thread { MultiplyTable1 mtObj = new MultiplyTable1(); public void run() { mtObj.printTable(2); } } class ThreadTwo2 extends Thread { MultiplyTable1 mtObj = new MultiplyTable1(); public void run() { mtObj.printTable(100); } } public class ThreadDemoDupe { public static void main(String[] args) { ThreadOne1 t1 = new ThreadOne1(); ThreadTwo2 t2 = new ThreadTwo2(); t1.start(); t2.start(); } } OUTPUT: 100 2 200 4 300 6 8 400 10 500 What shall be my code to get the output as: 2 4 6 8 10 100 200 300 400 500 or 100 200 300 400 500 2 4 6 8 10 I don't have any more details to give.
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: multithreading
has title: My java code does not synchronize
type: Question
has answer: http://stackoverflow.com/a/22434286
answer count: 1
tagged with: synchronization

http://stackoverflow.com/a/22452532
has comment: http://stackoverflow.com/comment/34149286
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34389108
type: Answer
answers question: http://stackoverflow.com/q/22452190
has body: The contract of toString(): toString method returns a string that "textually represents" this object The general purpose of toString() is to provide a human-readable representation of the object. Some classes go further and specify the detailed format of toString(), which is not generally advisable, and if so, then only for the "value objects" (date, time, number). Unless specified in the class's javadoc, you should never rely on a specific format of the text returned by toString(). The general recommendation: if your class wants to introduce a specific persistent text representation, it should be provided by a separate method. Thus you are never unpleasantly surprised if the implementation of toString() changes later.
accepted answer of: http://stackoverflow.com/q/22452190
score: 5
upvote count: 5

http://stackoverflow.com/comment/34121320
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22437026
has text: @LutzHorn It doesn't apply operator precedence rules at all, let alone correctly.
score: 0

http://stackoverflow.com/a/22419447
downvote count: 0
has comment: http://stackoverflow.com/comment/34090897
answers question: http://stackoverflow.com/q/22419385
type: Answer
has comment: http://stackoverflow.com/comment/34090815
has body: A Walker is a person who can walk and breed, A Talker is a person who can talk and breed, A Swimmer is a person who can swim,talk,walk and breed. I would use interfaces to represent the traits, and use concrete classes to represent the types, e.g.: public interface IWalker { public void walk (); } public interface IBreeder { public void breed (); } public interface ITalker { public void talk (); } public interface ISwimmer { public void swim (); } public class Person { } public class Walker extends Person implements IWalker, IBreeder { @Override public void walk () { ... } @Override public void breed () { ... } } public class Talker extends Person implements ITalker, IBreeder { @Override public void talk () { ... } @Override public void breed () { ... } } public class Swimmer extends Person implements ISwimmer, ITalker, IWalker, IBreeder { @Override public void swim () { ... } @Override public void walk () { ... } @Override public void talk () { ... } @Override public void breed () { ... } } This way you can, say, use IWalker everywhere that anything that can walk is expected, or Swimmer anywhere a specific type of person is expected, or Person anywhere a generic person is expected. For the record, I don't particularly like the I* naming scheme for interfaces; but I picked them to be unique given the word choices.
upvote count: 1
has comment: http://stackoverflow.com/comment/34090924
score: 1
has comment: http://stackoverflow.com/comment/34090789

http://stackoverflow.com/comment/45075990
type: Comment
comment on: http://stackoverflow.com/a/22376524
has text: @MickaëlGauvin Thanks for your efforts, but please see my updated answer regarding your comment.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22428387
type: Answer
has comment: http://stackoverflow.com/comment/34106286
has comment: http://stackoverflow.com/comment/34106680
has comment: http://stackoverflow.com/comment/34106633
has body: Use a temporary variable to store old V[i] //a temp var to store found V[i] Values Double old_Vi; for(int i=0;i<n;i++) { if("some_statement") { //find V[i] //now compare if(old_Vi !=null && (V[i]-old_Vi)<0.00005) break; //store new V[i] as old Vi old_Vi=V[i]; } else if("some_statement") { //find V[i] //now compare if(old_Vi !=null && (V[i]-old_Vi)<0.00005) break; //store new V[i] as old Vi old_Vi=V[i]; } }
answers question: http://stackoverflow.com/q/22428270
score: 0
has comment: http://stackoverflow.com/comment/34106688
has comment: http://stackoverflow.com/comment/34106582
has comment: http://stackoverflow.com/comment/34106391
has comment: http://stackoverflow.com/comment/34106241

http://stackoverflow.com/comment/34009643
score: 0
comment on: http://stackoverflow.com/q/22371760
has text: How would you suggest me to do?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22471630
type: Question
linked to: http://stackoverflow.com/q/1570416
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22471738
has comment: http://stackoverflow.com/comment/34182419
has comment: http://stackoverflow.com/comment/34182443
tagged with: primitive-types
has comment: http://stackoverflow.com/comment/34182387
has body: Is it correct that there are predefined Class object representing all the 8 primitive types and void?? please tell whether I am correct or wrong?
has title: Am I correct on this Statement?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22471738
tagged with: java

http://stackoverflow.com/comment/33996255
comment on: http://stackoverflow.com/q/22364849
type: QuestionComment
score: 1
has text: @Balk I don't think you understand the problem :P
type: Comment

http://stackoverflow.com/q/22444169
type: Question
has answer: http://stackoverflow.com/a/22444217
tagged with: sorting
linked to: http://stackoverflow.com/q/16934613
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22444217
upvote count: 2
has answer: http://stackoverflow.com/a/22444218
type: AnsweredQuestion
has body: I created a class called Course which have a courseID field that I want to sort by. I'm having trouble getting it to even compile. Here's part of my class: class Course implements Comparable&lt;Course&gt; { private String courseName; private int courseID; public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; } public int getCourseID() { return courseID; } public void setCourseID(int courseID) { this.courseID = courseID; } } Now from my understanding I need to implement how to sort it, so I start writing this: class IDSorter implements Comparator&lt;Course&gt;{ public int compare(Course course1, Course course2) { return course1.getCourseID().compareTo(course2.getCourseID()); //no good here already } } Compiler complains, "Cannot invoke compareTo(int) on the primitive type int" So I can't use compareTo on primitive types.... so how would I fix this?
score: 2
has comment: http://stackoverflow.com/comment/34135037
tagged with: java
has title: How to use sort an ArrayList using Comparator? The variable i'm sorting by is an int
possible better answer: http://stackoverflow.com/a/22444218

http://stackoverflow.com/a/22426750
has comment: http://stackoverflow.com/comment/34103073
score: 0
answers question: http://stackoverflow.com/q/22426553
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34103537
type: Answer
accepted answer of: http://stackoverflow.com/q/22426553
has body: This will return a book based on the string value, that is contained in column columnName. Book getentry(String value,String columnName) { SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.query(TABLE_AppData, new String[] { K_ID, K_AUTHOR K_TITLE }, columnName + "=?", new String[] { value }, null, null, null, ); if (cursor != null) cursor.moveToFirst(); Book entry = new Book(Integer.parseInt(cursor.getString(0)), cursor.getString(1), cursor.getString(2)); return entry; Basically what you have to change is the third parameter, and the fourth parameter of db.query method. The third one let's you specify which columns you want to sort by. The fourth one is the array of parameters that get replaced by the ? sign in the third one. The first parameter is the DB name and the second one are the returned columns. Edit : Make sure column name is equal to K_AUTHOR K_TTITLE or K_ID

http://stackoverflow.com/comment/34176134
type: Comment
type: QuestionComment
score: 3
has text: It appears `(int)((b - a) + 1)` results in a value < 1.
comment on: http://stackoverflow.com/q/22467727

http://stackoverflow.com/a/22356602
downvote count: 0
answers question: http://stackoverflow.com/q/22356442
type: Answer
has body: A trait is similar to a Java interface in a sense that it is not a concrete constructor. From Scala: class IndexImpl extends Index[SomeParamtersHere] {} val x = new ClassImpl x.make(..) Or use an object: object Index extends Index {} Index.make(..) From Java: Traits with concrete implementations will compile to the appropriate abstract class. If certain members don't have concrete implementation, you have to implement them. import org.saddle.Index public class TraitImpl extends Index$class { }
upvote count: 5
score: 5
accepted answer of: http://stackoverflow.com/q/22356442
type: AcceptedAnswer

listview
tags question: http://stackoverflow.com/q/22345535
tags question: http://stackoverflow.com/q/22406460
tags question: http://stackoverflow.com/q/22375780
tags question: http://stackoverflow.com/q/22407058
tag name: listview
tags question: http://stackoverflow.com/q/22439341
tags question: http://stackoverflow.com/q/22438996
tags question: http://stackoverflow.com/q/22357697
tags question: http://stackoverflow.com/q/22389701
tags question: http://stackoverflow.com/q/22380781
tags question: http://stackoverflow.com/q/22439719
tags question: http://stackoverflow.com/q/22385757
tags question: http://stackoverflow.com/q/22409131
tags question: http://stackoverflow.com/q/22338929
tags question: http://stackoverflow.com/q/22432021
tags question: http://stackoverflow.com/q/22437875
tags question: http://stackoverflow.com/q/22328710
tags question: http://stackoverflow.com/q/22332389
type: Tag
tags question: http://stackoverflow.com/q/22434919

http://stackoverflow.com/q/22407751
score: 1
tagged with: java
has body: I have a Google App Engine web application where I'm using JDO to communicate with a Cloud SQL instance. In my database I have a table "User" and a table "Entity". Any user should be able to "like" one or more entities. So i have created a join table with userID and entityID as composite primary key. I'm new to all this and I'm wondering how I should approach this with regards to saving and loading of the "likes". When saving a like I would just send the userID and the entityID to the server and store it directly in the join table. When loading, I figured I'd just do a join, but it seems difficult using JDOQL. I've read about M-N-relationship in JDO and wonder if I should model my entity classes with the @Join annotation instead and have a list in both User and in Entity. It's not clear to me yet how all this works. For fetching, I guess lazy loading is the correct way. So if I understand correctly, when I want to retrieve a list of users that have liked an entity, I can just load the Entity-object and then call getUsers() on the entity while still within the transaction and it will fetch the users mapped in the join table? If I update an existing Entity with null or empty list for Users, won't any existing relations in the join table then be deleted?
type: Question
has comment: http://stackoverflow.com/comment/34592244
tagged with: datanucleus
downvote count: 0
favorite count: 0
answer count: 0
has title: The correct way to save and query values from a join table in JDO?
type: UnansweredQuestion
upvote count: 1
tagged with: jdo
has comment: http://stackoverflow.com/comment/34093440

http://stackoverflow.com/q/22420547
has comment: http://stackoverflow.com/comment/34092878
score: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34113637
has comment: http://stackoverflow.com/comment/34163846
has title: Toast message shows time in EST
has body: Why below code in Android activity shows a toast message with timestamp in EST instead of local timezone? I'm in PST &amp; my PC clock is also in PST but toast message shows up in EST long time = new GregorianCalendar().getTimeInMillis() + 10000l; Intent intentAlarm = new Intent(context, AlarmReceiver.class); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.RTC_WAKEUP, time, PendingIntent.getBroadcast(context, 1, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT)); Toast.makeText(context, "Next Weekly Check Scheduled at " + new Timestamp(time), Toast.LENGTH_LONG).show(); Note: It shows EST in emulator. If I uncheck the auto select timezone &amp; set it manually to PST in emulator, then it works but I don't want to set it manually every time since I wipe emulator data. Any solution to this? Not sure if this is a bug in emulator.
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34113503

http://stackoverflow.com/comment/34186076
comment on: http://stackoverflow.com/a/22473392
type: Comment
score: 1
type: AnswerComment
has text: @trojantale Yes, but it has *nothing* to do with `new String`. It is added *because and only because* `"bbb"` is a *string literal*. As in my example, `String _b = "bbb";`. There, that is *when/why* it is added to the string pool..

http://stackoverflow.com/q/22448511
has comment: http://stackoverflow.com/comment/38454177
answer count: 1
tagged with: jpa
downvote count: 0
has title: Spring data internationalization best practice
has comment: http://stackoverflow.com/comment/98283754
has body: I have a spring mvc project with spring data, jpa and hibernate. I have a multilanguage database. I designed my database and entity. I am looking for a best practice to query my tables by language. Do I have to write custom jpa query, or is there a generic way to query my tables. If I have a mistake on db or entity design, please warn me. Database: CREATE TABLE translation ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)); CREATE TABLE translation_text ( translation_id BIGINT UNSIGNED NOT NULL, lang VARCHAR(2), text VARCHAR(1000)); ALTER TABLE translation_text ADD FOREIGN KEY (translation_id) REFERENCES translation(id); CREATE TABLE category ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, category_name BIGINT UNSIGNED NOT NULL, PRIMARY KEY (id)); ALTER TABLE category ADD FOREIGN KEY (category_name) REFERENCES translation(id); LocalizedString Entity: @Embeddable public class LocalizedString { private String lang; private String text; //Constructors and getter setters... } MultilingualString Entity: @Entity @Table(name = "translation") public class MultilingualString { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private long id; @ElementCollection(fetch = FetchType.EAGER) @MapKeyColumn(name = "lang_key") @CollectionTable(name = "translation_text", joinColumns = @JoinColumn(name = "translation_id")) private final Map&lt;String, LocalizedString&gt; map = new HashMap&lt;String, LocalizedString&gt;(); public MultilingualString() { } public MultilingualString(String lang, String text) { addText(lang, text); } public void addText(String lang, String text) { map.put(lang, new LocalizedString(lang, text)); } public String getText(String lang) { if (map.containsKey(lang)) { return map.get(lang).getText(); } return null; } public long getId() { return id; } public void setId(long id) { this.id = id; } } Category Entity: @Entity @Table(name = "category") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Category e…
linked to: http://stackoverflow.com/q/10693508
favorite count: 0
type: UnansweredQuestion
tagged with: spring-data
score: 16
tagged with: spring
upvote count: 16
type: Question
has comment: http://stackoverflow.com/comment/82223537
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/56498080

late-binding
type: Tag
tags question: http://stackoverflow.com/q/22391915
tag name: late-binding

http://stackoverflow.com/a/22375990
downvote count: 0
has body: For creating HUDs, you could generally use multiple Stages on your screen, which are being rendered on top of each other. You can even have more than two, e.g. for a Pause-Dialog which is rendered on top of the HUD when the Application is paused and resumed... You just need to make sure that within the render()-method they are drawn an in the right order: public void render(float delta) { scene.act(delta); hud.act(delta); pauseDialog.act(delta); scene.draw(); hud.draw(); pauseDialog.draw(); } This way you can create different coordinate systems however you like. Especially when working with Fonts and Labels in your HUD, it should have a coordinate system that matches the pixel size, e.g. setViewport(1280,768,true); or alike, whereas your Scene can have a completely different one.
has comment: http://stackoverflow.com/comment/34016624
has comment: http://stackoverflow.com/comment/52207941
type: Answer
upvote count: 13
answers question: http://stackoverflow.com/q/22357674
has comment: http://stackoverflow.com/comment/52200781
score: 13
has comment: http://stackoverflow.com/comment/34019463

yui-compressor
tags question: http://stackoverflow.com/q/22343690
type: Tag
tag name: yui-compressor

http://stackoverflow.com/q/22480841
has answer: http://stackoverflow.com/a/30766617
downvote count: 1
has answer: http://stackoverflow.com/a/22598407
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34199007
has comment: http://stackoverflow.com/comment/34197747
type: Question
upvote count: 4
has body: The problem is to find the numbers of squares between two numbers. The code below works small numbers but fails for huge numbers. How can I correct this? import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class NumOfSqrs { public static void main(String[] args) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input; int line = 0; int testCases; int numOfSqrt = 0; int j = 0; while((input=br.readLine())!=null){ if(line == 0){ testCases = Integer.parseInt(input); line = line +1; } else{ String[] splitter = input.toString().split(" "); //Here splitter gives two numbers, we need to find no of sqrs b/w these numbers for eg say 3 and 9 for(int i = Integer.parseInt(splitter[0]); i&lt;=Integer.parseInt(splitter[1]) ; i++){ String value = ""+Math.sqrt(i); String[] isSqrt = value.toString().split("\\."); //System.out.println(""+isSqrt[0] + "" + isSqrt[1]); //Here lets say if 'i' is 4 (i.e 2.0) then isSqrt[0] = 2, isSqrt[1] = 0 and if isSqrt[1] != 1 then its obvious that its not a perfect square if(isSqrt[1].length() == 1){ numOfSqrt++; } } System.out.println(""+numOfSqrt); } numOfSqrt = 0; } }catch(IOException io){ io.printStackTrace(); } } }
has comment: http://stackoverflow.com/comment/34198029
has title: Computing number of squares between two numbers, works only with small numbers, why?
accepted answer: http://stackoverflow.com/a/22598407
favorite count: 0
has comment: http://stackoverflow.com/comment/34203920
has comment: http://stackoverflow.com/comment/34197789
answer count: 3
score: 3
has answer: http://stackoverflow.com/a/22481001
has comment: http://stackoverflow.com/comment/34197944
has comment: http://stackoverflow.com/comment/34199231
possible better answer: http://stackoverflow.com/a/30766617

http://stackoverflow.com/comment/34177719
comment on: http://stackoverflow.com/a/22455860
has text: Thanks, that seemed to solve the problem. Except, now I can read the ArrayList from any class but I cannot write back to it (i.e. update it)... so that I can add stuff in one scene and different scenes will be able to see those changes... how would I go about doing this?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22476985
has answer: http://stackoverflow.com/a/22477277
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22477137
has title: Date to String conversion - input format of date
has body: I want to convert a java.util.date object to a String in Java. The format is "Sat Mar 22 16:07:12 IST 2014". Can any one suggest me, what should be the Input format to be passed into SimpleDateFormat() when its instance is created?
tagged with: java
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22477407
type: Question
score: -1
tagged with: date
answer count: 3
has comment: http://stackoverflow.com/comment/34191173

http://stackoverflow.com/comment/34004404
type: QuestionComment
comment on: http://stackoverflow.com/q/22369588
score: 0
type: Comment
has text: [Using Preapred Statements](http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html)

http://stackoverflow.com/a/22376907
upvote count: 3
has body: If you want to throttle how often a method call causes another method call you can do so for example via a Handler. The simplest version enqueues a delayed message on the first call and any subsequent call while there is an enqueued message will not enqueue a new one. That results in 1 call every X time to go though - but it take at least that amount of time until the first action happens. Example implementation (you can put that class unmodified somewhere in your code) public abstract class ThrottleExecutor { private final long mMinDelay; public ThrottleExecutor(long minDelay) { mMinDelay = minDelay; } /** Implement to do something */ public abstract void doThrottled(); public final void scheduleExecution() { if (mHandler.hasMessages(0)) { // message already enqueued, do nothing } else { // otherwise enqueue a message for later mHandler.sendEmptyMessageDelayed(0, mMinDelay); } } public final void cancelExecution() { mHandler.removeMessages(0); } private final Handler mHandler = new Handler(Looper.getMainLooper()) { @Override public void handleMessage(Message msg) { doThrottled(); } }; } And then use it for example like so class Usage { private ThrottleExecutor mThrottle = new ThrottleExecutor(2000) { @Override public void doThrottled() { // happens at most every 2000ms methodToBeThrottled(); } }; void methodThatHappensTooOften() { mThrottle.scheduleExecution(); } void methodToBeThrottled() { Log.d("TAG", "triggered at 2000ms before"); } }
score: 3
answers question: http://stackoverflow.com/q/22376156
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33989832
comment on: http://stackoverflow.com/a/22360979
type: Comment
type: AnswerComment
has text: Lool your comment was after my edit, so i asked you that are you sure, then you insisted that it throw a warring.
score: 0

jakarta-ee
tags question: http://stackoverflow.com/q/22367564
tags question: http://stackoverflow.com/q/22485162
tags question: http://stackoverflow.com/q/22356183
tags question: http://stackoverflow.com/q/22356790
tags question: http://stackoverflow.com/q/22408850
type: Tag
tags question: http://stackoverflow.com/q/22452593
tags question: http://stackoverflow.com/q/22386378
tags question: http://stackoverflow.com/q/22349179
tags question: http://stackoverflow.com/q/22368258
tags question: http://stackoverflow.com/q/22384297
tags question: http://stackoverflow.com/q/22483236
tags question: http://stackoverflow.com/q/22458747
tags question: http://stackoverflow.com/q/22345432
tags question: http://stackoverflow.com/q/22342431
tags question: http://stackoverflow.com/q/22450659
tags question: http://stackoverflow.com/q/22422160
tags question: http://stackoverflow.com/q/22344454
tags question: http://stackoverflow.com/q/22356681
tags question: http://stackoverflow.com/q/22367246
tags question: http://stackoverflow.com/q/22473301
tags question: http://stackoverflow.com/q/22407801
tags question: http://stackoverflow.com/q/22448445
tags question: http://stackoverflow.com/q/22389154
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/22360547
tags question: http://stackoverflow.com/q/22400996
tags question: http://stackoverflow.com/q/22463902
tags question: http://stackoverflow.com/q/22364415
tags question: http://stackoverflow.com/q/22395119
tags question: http://stackoverflow.com/q/22342916
tags question: http://stackoverflow.com/q/22481540
tags question: http://stackoverflow.com/q/22472469
tags question: http://stackoverflow.com/q/22348539
tags question: http://stackoverflow.com/q/22363925
tags question: http://stackoverflow.com/q/22480863
tags question: http://stackoverflow.com/q/22339973
tags question: http://stackoverflow.com/q/22374212
tags question: http://stackoverflow.com/q/22448404
tags question: http://stackoverflow.com/q/22422089
tags question: http://stackoverflow.com/q/22472649
tags question: http://stackoverflow.com/q/22346628
tags question: http://stackoverflow.com/q/22350575
tags question: http://stackoverflow.com/q/22455809
tags question: http://stackoverflow.com/q/22426637
tags question: http://stackoverflow.com/q/22374343
tags question: http://stackoverflow.com/q/22439189
tags question: http://stackoverflow.com/q/22442028
tags question: http://stackoverflow.com/q/22412012
tags question: http://stackoverflow.com/q/22376632
tags question: http://stackoverflow.com/q/22365699
tags question: http://stackoverflow.com/q/22487516
tags question: http://stackoverflow.com/q/22422255
tags question: http://stackoverflow.com/q/22361211
tags question: http://stackoverflow.com/q/22452137
tags question: http://stackoverflow.com/q/22409324
tags question: http://stackoverflow.com/q/22345631
tags question: http://stackoverflow.com/q/22436046
tags question: http://stackoverflow.com/q/22375401
tags question: http://stackoverflow.com/q/22394910
tags question: http://stackoverflow.com/q/22405384

http://stackoverflow.com/comment/34163419
has text: OK, but how? Can you give an example of two JSON texts and the expected merged JSON text?
score: 0
comment on: http://stackoverflow.com/q/22460163
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33938321
has text: Post your code...without code it hard to say anything.
comment on: http://stackoverflow.com/q/22332017
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33989954
has text: do you have any other security config classes ?
comment on: http://stackoverflow.com/q/22361365
score: 0
type: Comment
type: QuestionComment

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/22417180
tags question: http://stackoverflow.com/q/22467906
tags question: http://stackoverflow.com/q/22451425
tags question: http://stackoverflow.com/q/22480551
type: Tag
tags question: http://stackoverflow.com/q/22369212
tags question: http://stackoverflow.com/q/22333944
tags question: http://stackoverflow.com/q/22347269

http://stackoverflow.com/a/22422794
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34096312
has body: Try this: private Category category; And then, @ManyToOne @JoinColumn(name = "category_id", nullable = false) public Category getCategory() { return category; } public void setCategory(Category category) { this.category = category; } And then access the id using category.getId();
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22422661
answers question: http://stackoverflow.com/q/22422661
has comment: http://stackoverflow.com/comment/34096257
type: Answer
upvote count: 1

multithreading
tags question: http://stackoverflow.com/q/22383781
tags question: http://stackoverflow.com/q/22346385
tags question: http://stackoverflow.com/q/22368934
tags question: http://stackoverflow.com/q/22356082
tags question: http://stackoverflow.com/q/22416304
tags question: http://stackoverflow.com/q/22387608
tags question: http://stackoverflow.com/q/22464915
tags question: http://stackoverflow.com/q/22462722
tags question: http://stackoverflow.com/q/22347131
type: Tag
tags question: http://stackoverflow.com/q/22351467
tags question: http://stackoverflow.com/q/22408780
tags question: http://stackoverflow.com/q/22441225
tags question: http://stackoverflow.com/q/22423654
tags question: http://stackoverflow.com/q/22381141
tags question: http://stackoverflow.com/q/22441310
tags question: http://stackoverflow.com/q/22471121
tags question: http://stackoverflow.com/q/22337441
tags question: http://stackoverflow.com/q/22441671
tags question: http://stackoverflow.com/q/22351294
tags question: http://stackoverflow.com/q/22463266
tags question: http://stackoverflow.com/q/22365312
tags question: http://stackoverflow.com/q/22365905
tags question: http://stackoverflow.com/q/22429577
tags question: http://stackoverflow.com/q/22381153
tags question: http://stackoverflow.com/q/22437064
tags question: http://stackoverflow.com/q/22333509
tags question: http://stackoverflow.com/q/22378954
tags question: http://stackoverflow.com/q/22434266
tags question: http://stackoverflow.com/q/22405299
tags question: http://stackoverflow.com/q/22476008
tags question: http://stackoverflow.com/q/22333538
tags question: http://stackoverflow.com/q/22418632
tags question: http://stackoverflow.com/q/22481073
tags question: http://stackoverflow.com/q/22367818
tags question: http://stackoverflow.com/q/22393604
tags question: http://stackoverflow.com/q/22419019
tags question: http://stackoverflow.com/q/22422722
tags question: http://stackoverflow.com/q/22457573
tags question: http://stackoverflow.com/q/22385861
tags question: http://stackoverflow.com/q/22387835
tags question: http://stackoverflow.com/q/22466383
tags question: http://stackoverflow.com/q/22406237
tags question: http://stackoverflow.com/q/22442344
tags question: http://stackoverflow.com/q/22452426
tags question: http://stackoverflow.com/q/22477410
tags question: http://stackoverflow.com/q/22476221
tags question: http://stackoverflow.com/q/22431586
tags question: http://stackoverflow.com/q/22395286
tags question: http://stackoverflow.com/q/22470200
tags question: http://stackoverflow.com/q/22481878
tags question: http://stackoverflow.com/q/22414087
tags question: http://stackoverflow.com/q/22412189
tags question: http://stackoverflow.com/q/22345437
tags question: http://stackoverflow.com/q/22480870
tags question: http://stackoverflow.com/q/22329304
tags question: http://stackoverflow.com/q/22438493
tags question: http://stackoverflow.com/q/22416826
tags question: http://stackoverflow.com/q/22386666
tags question: http://stackoverflow.com/q/22440103
tags question: http://stackoverflow.com/q/22364309
tags question: http://stackoverflow.com/q/22361522
tags question: http://stackoverflow.com/q/22409768
tags question: http://stackoverflow.com/q/22474961
tags question: http://stackoverflow.com/q/22376032
tags question: http://stackoverflow.com/q/22353868
tags question: http://stackoverflow.com/q/22421806
tags question: http://stackoverflow.com/q/22448341
tags question: http://stackoverflow.com/q/22440064
tags question: http://stackoverflow.com/q/22386012
tags question: http://stackoverflow.com/q/22361806
tags question: http://stackoverflow.com/q/22439547
tags question: http://stackoverflow.com/q/22401177
tags question: http://stackoverflow.com/q/22463974
tags question: http://stackoverflow.com/q/22472501
tags question: http://stackoverflow.com/q/22469395
tags question: http://stackoverflow.com/q/22435226
tags question: http://stackoverflow.com/q/22353568
tags question: http://stackoverflow.com/q/22347381
tags question: http://stackoverflow.com/q/22427063

http://stackoverflow.com/comment/34078897
score: 0
comment on: http://stackoverflow.com/q/22412865
type: Comment
type: QuestionComment
has text: What is `csvFile`? Is it a `File`, a `String`? Also, why don't you specify the encoding?

http://stackoverflow.com/q/22411891
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22412055
type: Question
tagged with: java
tagged with: junit
answer count: 1
has title: JUnit: Is there any difference between running a Suite, and running tests individually?
score: 0
has comment: http://stackoverflow.com/comment/34077000
has body: I am having a problem, one test class seems to be interfering with the other in my test suite. I have a suite, which executes two classes, one is called MergeTestSuite.java (which is another Suite), and the other is called RecordTest.java. RecordTest extends one class already tested by MergeTestSuite.java I created another suite as follows: @RunWith(Suite.class) @Suite.SuiteClasses( { MergeTestSuite.class, RecordTest.class }) public class CoreTestSuite { @BeforeClass public static void install() throws Throwable { RegistryUtils.cleanupResources(); } } Both MergeTestSuite.class and RecordTest.class run fine individually. If I run CoreTestSuite, the second test will fail, unless I remove MergeTestSuite.class from the list.

http://stackoverflow.com/q/22439167
has title: Why do I need try-catch with throws in my example?
has answer: http://stackoverflow.com/a/22439302
has answer: http://stackoverflow.com/a/22439194
favorite count: 0
possible better answer: http://stackoverflow.com/a/22439302
tagged with: multithreading
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22439194
has comment: http://stackoverflow.com/comment/34125211
upvote count: 1
has body: Could someone please help me to understand why do I need to use (inner) try catch if the method is declared as throwing the same exception. public static void main(String[] args) throws InterruptedException { Thread t1 = new Thread(new Runnable() { public void run() { // TODO Auto-generated method stub try { producer(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); t1.start(); t1.join(); } syntax of producer() is private static void producer() throws InterruptedException
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/a/22365739
has comment: http://stackoverflow.com/comment/34012168
accepted answer of: http://stackoverflow.com/q/22364894
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22364894
upvote count: 2
has comment: http://stackoverflow.com/comment/34005398
type: Answer
score: 2
has body: you need to decode base64 if your key is in the base64 representation: KeySpec ks = new PKCS8EncodedKeySpec(Base64.decodeBase64(newKey)); you can use org.apache.commons.codec.binary.Base64 to do this. if you want to generate keyPair you can you this code: KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); keyPairGenerator.initialize(1024); KeyPair keyPair = keyPairGenerator.genKeyPair(); // extract the encoded private key, this is an unencrypted PKCS#8 private key byte[] encodedprivkey = keyPair.getPrivate().getEncoded(); System.out.println(Base64.encodeBase64String(encodedprivkey));

http://stackoverflow.com/q/22441514
answer count: 1
has title: How to navigate back to main activity without a button
tagged with: android
accepted answer: http://stackoverflow.com/a/22441583
type: AnsweredQuestion
tagged with: java
has body: I'm accustomed to using an intent to launch a new activity when a button is pressed. But the app that I'm making uses a list view, which means I want to be able to go back from my searching activity to the main activity by using the phone's back button. I was reading and experimenting with different types of android methods, this one in particular which seemed simple but doesn't work, or perhaps I'm doing something completely different. public void onBackPressed() { Intent setIntent = new Intent(this,MainActivity.class); startActivity(setIntent); finish(); } Doesn't Android's onBackPressed method respond to any android phone's back button? Thank you for your help.
type: Question
has answer: http://stackoverflow.com/a/22441583
score: 0

http://stackoverflow.com/q/22448921
has answer: http://stackoverflow.com/a/22448980
tagged with: arrays
has title: Why won't this print in Reverse?
has answer: http://stackoverflow.com/a/22450456
answer count: 4
accepted answer: http://stackoverflow.com/a/22448955
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22448951
has answer: http://stackoverflow.com/a/22448951
has body: I have a very simple problem but I can't seem to solve it. I'm getting an out of bounds error on this code int c = 0; System.out.println(); System.out.println("Printing array in Reverse order:"); for (int i = array.length ; i &gt;= -1; i--) { System.out.println(array[i] +" "); c++; if(c == 10) { System.out.println(); c=0; } } What's the deal?
type: Question
tagged with: java
tagged with: indexoutofboundsexception
score: 0
has answer: http://stackoverflow.com/a/22448955
tagged with: for-loop

http://stackoverflow.com/comment/33935210
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22330092
has text: If you know they will all be Cloneable types, and you just want to clone them, I don't see why you couldn't you get away with Object o = ((Cloneable)p).clone();. Polymorphism FTW!

http://stackoverflow.com/comment/34110615
score: 0
comment on: http://stackoverflow.com/a/22430822
type: Comment
has text: @SeahawksRdaBest Don't you think this information should be part of your answer? Giving solution and explaining problem are two different things.
type: AnswerComment

http://stackoverflow.com/a/22444047
score: 4
has body: You are creating a method in your own click instead of calling the method. you should put the isConntectedToServer method in an asynctask and call the AsyncTask in the onClick final Button mbutton = (Button) findViewById(R.id.httpcheck); mbutton.setOnClickListener(new View.OnClickListener(){ public void onClick(View v){ //call asynctask containing isConntectedToServer method here } }); //put this code in an asynctask and call it there public boolean isConnectedToServer(String url, int timeout) { try{ URL myUrl = new URL("http://www.google.co.uk"); URLConnection connection = myUrl.openConnection(); connection.setConnectTimeout(timeout); connection.connect(); return true; } catch (Exception e) { return false; } }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/68529369
has comment: http://stackoverflow.com/comment/34134946
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/34135497
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22443853
answers question: http://stackoverflow.com/q/22443853

http://stackoverflow.com/a/22451428
type: Answer
has comment: http://stackoverflow.com/comment/34147510
has comment: http://stackoverflow.com/comment/34147840
answers question: http://stackoverflow.com/q/22451406
has comment: http://stackoverflow.com/comment/34147414
score: 0
has body: A static block is always executed first but only after an instance block, this is false. It is true other way around. A static block will be executed when the class is loaded and only for once. Instance block will be executed after instance creation. The Java compiler copies initializer blocks into every constructor.

http://stackoverflow.com/comment/33942844
has text: I have data like props.put(List<String>,List<String>).but i tried what you said i didn't get all the values.i am getting only last value
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22334656
type: Comment

http://stackoverflow.com/comment/34152337
type: QuestionComment
has text: As no one even tried. I converted the solution to android.support.v4 version, and it works much better.
comment on: http://stackoverflow.com/q/22352600
score: 0
type: Comment

http://stackoverflow.com/comment/34119081
type: Comment
type: QuestionComment
score: 0
has text: @curtisLoew shared. please help me check if `(getResources(R.drawable.ic_coffee))` it call out the ic_coffee and rotate to 45. But I wish the image in image view to be rotate not hard coded.
comment on: http://stackoverflow.com/q/22435670

http://stackoverflow.com/a/22334435
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22334328
upvote count: 2
type: AcceptedAnswer
has body: Maven conventions specify that tests have to be placed under src/test/java not src/main/java Test scoped dependencies are not available for files under src/main/java
type: Answer
has comment: http://stackoverflow.com/comment/33942244
answers question: http://stackoverflow.com/q/22334328

http://stackoverflow.com/comment/34091920
has text: This is only available in 2.12, but you can have it right now by downloading it and then building a new tar file.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22360885
type: Comment

http://stackoverflow.com/comment/34027634
comment on: http://stackoverflow.com/q/22383676
has text: Have you tried debugging your program to figure out what index you're trying to access at that line?
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/22427584
has comment: http://stackoverflow.com/comment/34105025
score: -1
has body: I am working on a mod for Minecraft but there is 1 last piece of code giving me trouble. I am not very knowledgeable about this code so i cant work through the error as normal and Eclipse dose not give any option to fix it. I am trying to grab a Value from the Config B:CreativeBiomeConfig = false When this is set to true is should Register the Biome GameRegistry.addBiome(CreativeBiome); The current code I am using is a boolean but gives the following error The operation == is undefined for the argument type(s) int, boolean if (this.CreativeBiomeConfig == true){ GameRegistry.addBiome(CreativeBiome); } Pastbin for Classes http://pastebin.com/hR5zpbE3 http://pastebin.com/4iVjxvXS http://pastebin.com/iEJ4M32f
has comment: http://stackoverflow.com/comment/34104985
upvote count: 0
answer count: 1
favorite count: 0
has title: Grabbing a value from Config using Java
accepted answer: http://stackoverflow.com/a/22428427
type: AnsweredQuestion
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/22428427
has comment: http://stackoverflow.com/comment/34104439
type: Question
tagged with: minecraft

http://stackoverflow.com/comment/34137481
comment on: http://stackoverflow.com/q/22445407
type: Comment
type: QuestionComment
has text: Correct, but you're producing it out of the input array, which would also assume there are no duplicates or specify if duplicates break the sequence. The OP needs to clarify if the question is 'largest consecutive sequence you can make out of the numbers contained in the input array', or 'largest consecutive sequence present in the input array'.
score: 0

http://stackoverflow.com/q/22346385
type: Question
upvote count: 3
has comment: http://stackoverflow.com/comment/33964877
tagged with: volatile
answer count: 1
has answer: http://stackoverflow.com/a/22346702
accepted answer: http://stackoverflow.com/a/22346702
favorite count: 0
has body: I used to think there are only two multithreading hazards: Race condition: a thread reads x, and before it can write back another thread write x. Unstable state: a thread writes x and y, but between those two writes another thread reads x's new value and y's old value even though those variables should change together. I figured that if I can reason these things can't happen, I don't need to synchronize. But from an argument over the D language forums I learned there can be other hazards from how the compiler, the CPU and the memory work behind the scenes: Both compiler and CPU can change the order of instruction in a way that does not affect single-threading execution but can break my reasoning about non-synchronized thread safety. For example, an object can be allocated and assigned to the thread-shared variable and only then the constructor will be called. It shouldn't matter in single-threading, but with multithreading another thread can now access the uninitialized object. Caching means that even if the order of operations is correct, the synching between the global memory and the local caches both threads use can mess with the order one thread can see another thread's changes. Unaligned pointer-sized writes are not atomic, and in some architectures even aligned ones might not be atomic, so the pointer itself might be corrupted(=in unstable state) when the other thread reads it, because the thread that written it only written half it's bytes. I now work on an Android project and once again I face a similar problem - I can reason about some functions being safe from race conditions and unstable states, but not about those three behind-the-scenes hazards. I've encountered the Java volatile member fields, and from what I gather it uses memory barriers to prevent the CPU from messing with order of execution(and obviously the compiler won't mess with it if it prevents the CPU from doing so) so it should solve the first hazard. But what about the other two? Does it s…
tagged with: android
downvote count: 0
tagged with: multithreading
has title: Will volatile protect me from all behind-the-scenes multi-threading hazards?
linked to: http://stackoverflow.com/q/6259745
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33963960
has comment: http://stackoverflow.com/comment/33966244

http://stackoverflow.com/comment/34008176
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22367257
has text: Don't forget the initialization of `unrlzdPnl` and the final multiplication by `200` before comparing the results. Also, I implicitly assumed that unrlzdPnl is an `integer`, but if that's not the case, you should use the appropriate type and initialization.

http://stackoverflow.com/comment/34065511
has text: My problem was that the speed of tiles changed depending if I jumped or not. Now I have set the speed of the tiles the same. Now I don't get the problem.
type: AnswerComment
comment on: http://stackoverflow.com/a/22405053
score: 0
type: Comment

http://stackoverflow.com/comment/33937558
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22329157
has text: It has been recommended that you use `31 * hashcode(string1) + hashcode(string2)` -- however it's not the end of the world if there's a hash collision. Algorithms that use the hashcode always then use equals() to double check.

http://stackoverflow.com/q/22374656
has comment: http://stackoverflow.com/comment/34015813
has comment: http://stackoverflow.com/comment/34016380
tagged with: java
has comment: http://stackoverflow.com/comment/34015459
tagged with: eclipse
linked to: http://stackoverflow.com/q/4820554
has title: How to add Android X.X in Project -> Properties -> Java BuildPath
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22374843
has comment: http://stackoverflow.com/comment/34015941
has comment: http://stackoverflow.com/comment/34016272
score: 0
has body: I think the title is very clear. Sometimes I have some build errors, and in the Libraries tab of Java Build Path, I add/remove libraries, etc ... but when I delete the Android X.X "folder", I can't bring it back. What I do is to delete the project from the Workspace and Import it again as Existing Android Project. Is there a way to add it directly without deleting-importing a project? How does eclipse generate it? for what purpose? Why if missing eclipse doesn't show errors before building? Please help me understand all these!
tagged with: android
has answer: http://stackoverflow.com/a/22374843
possible better answer: http://stackoverflow.com/a/22375271
has comment: http://stackoverflow.com/comment/34015669
has answer: http://stackoverflow.com/a/22375271
has comment: http://stackoverflow.com/comment/34016165
tagged with: build
type: AnsweredQuestion

http://stackoverflow.com/q/22386317
favorite count: 0
downvote count: 2
tagged with: java-3d
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22442075
tagged with: java
has answer: http://stackoverflow.com/a/22386721
type: Question
has comment: http://stackoverflow.com/comment/34032988
score: -2
has comment: http://stackoverflow.com/comment/34033893
tagged with: svn
possible better answer: http://stackoverflow.com/a/22386721
has body: I know this question has already ask many times in other context, but I can't find a solution. Why SVN doesn't commit my external library? First, I'm working with a team and we don't want to add my external library each time we import the project from SVN. We don't work on the same computer each times. Second, the library that I created contain the link (I add externals JAR) for j3dcore, j3dutils and vecmath that I put in a folder in my project. Also I set the native location to the bin folder (of java 3D) that I also put in my project. With that, we don't have to install Java 3D each time we use a new computer. It works very well, but the problems is there, SVN doesn't commit it. Can you help me please?
has title: Why SVN doesn't commit my external library?
answer count: 2
has comment: http://stackoverflow.com/comment/34032481
upvote count: 0
has answer: http://stackoverflow.com/a/22442075
has comment: http://stackoverflow.com/comment/34032780

http://stackoverflow.com/comment/68836974
type: Comment
has text: @Squizer, your URL is broken, I've edited it. Please update it again if it is not the one that you wanted.
score: 1
comment on: http://stackoverflow.com/a/22476615
type: AnswerComment

http://stackoverflow.com/a/22404883
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22403843
has body: The problem was that I was going a step too far in calling the parse method of XMLReader. The parse method accepts an InputSource, so there was no reason to even use a FileReader. Changing the last line of the code above to xr.parse( new InputSource( filename )); click this link Another one sample code: Sometimes it is useful to distribute an application in a jar file through Java Web Start or any other way. So, you could have to read some resource (images or properties file) from inside a jar. How can you do it ? It’s very simple, here’s an example to retrieve an image: ImageIcon image = (new ImageIcon(getClass().getResource("yourpackage/mypackage/image.gif"))); In general, you can retrieve an InputStream in the following way: InputStream is = this.getClass().getClassLoader().getResourceAsStream("yourpackage/mypackage/myfile.xml");

http://stackoverflow.com/comment/33938091
comment on: http://stackoverflow.com/a/22331902
type: AnswerComment
score: 0
type: Comment
has text: I still got cuncurrentModificatinoException.

http://stackoverflow.com/q/22444454
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/34137052
type: Question
has answer: http://stackoverflow.com/a/22444474
score: 1
tagged with: c++
has answer: http://stackoverflow.com/a/22444549
linked to: http://stackoverflow.com/q/11521830
answer count: 2
has body: How do I get the following int to a byte array. I have been reading other SO questions and everything is confusing, could someone explian what is happening in the code. int val = 1023; // the int will vary from 0 to 1023 (it's the analogRead value from an Arduino board) the purpose of me wanting this as a byte array is so that i can use it for Arduino's server.write(). This is what I've come up with so far: int val = analogRead(A0); Serial.println(val); byte value[2]; value[1] = val &amp; 0x000000ff; value[0] = (val &amp; 0x0000ff00) &gt;&gt; 8; server.write(value[0]); server.write(value[1]); I am trying to communicate TCP with an Android application I have written, here is the recieving end: mmInStream = mmSocket.getInputStream(); final byte[] buffer = new byte[16384]; // two bytes int bytes; bytes = mmInStream.read(buffer); Log.d(null,buffer[0]+buffer[1]); is this correct? The Arduino console is spitting out the values, example: 870 870 870 872 However my Android application is spitting out the following, example: 3102 3105 1033 1035 I must be doing something wrong here! ANSWER: Arduino sends unsigned bytes, java recieves only signed bytes. I fixed it with a little code on the java end.
upvote count: 1
tagged with: java
has title: C++/Java - int(0 - 1023) to byte Array (two bytes only)
has comment: http://stackoverflow.com/comment/34135777
has comment: http://stackoverflow.com/comment/34135662
tagged with: arrays
downvote count: 0

http://stackoverflow.com/a/22391906
type: Answer
has comment: http://stackoverflow.com/comment/34043443
downvote count: 0
upvote count: 45
has comment: http://stackoverflow.com/comment/119401745
has comment: http://stackoverflow.com/comment/88243052
answers question: http://stackoverflow.com/q/22391353
score: 45
has comment: http://stackoverflow.com/comment/34042818
has body: import java.io.*; import java.awt.*; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; public class GetPixelColor { public static void main(String args[]) throws IOException { File file = new File("your_file.jpg"); BufferedImage image = ImageIO.read(file); // Getting pixel color by position x and y int clr = image.getRGB(x, y); int red = (clr & 0x00ff0000) >> 16; int green = (clr & 0x0000ff00) >> 8; int blue = clr & 0x000000ff; System.out.println("Red Color value = " + red); System.out.println("Green Color value = " + green); System.out.println("Blue Color value = " + blue); } } Of course, you have to add a for loop for all pixels.
has comment: http://stackoverflow.com/comment/34043273
has comment: http://stackoverflow.com/comment/34043222

http://stackoverflow.com/q/22410941
has comment: http://stackoverflow.com/comment/34078149
tagged with: draw
score: 0
has comment: http://stackoverflow.com/comment/34075332
has answer: http://stackoverflow.com/a/22447948
has title: Java drawLine command doesn't draw on screen
answer count: 1
has comment: http://stackoverflow.com/comment/34075314
type: UnansweredQuestion
tagged with: java
type: Question
has body: So I am making a paint program that draws by imputing commands from an IRC server chat room. So everything but the drawing works and I checked it (you can see the checking system out :P) but the drawLine() command doesn't do its thing. Please help! PS:This is a class file in a project, everything else works sending to here trust me! code: import java.awt.*; import java.awt.event.*; import javax.swing.*; class PadDraw extends JComponent { //this is gonna be your image that you draw on Image image; //this is what we'll be using to draw on Graphics2D graphics2D; //these are gonna hold our coordinates int currentX = 0, currentY = 0, oldX = 0, oldY = 0; public PadDraw() { } public void onCommand(String msg) { if(msg.equalsIgnoreCase("up")) { if(oldY &gt; 0) { currentY = currentY - 30; if(graphics2D != null) graphics2D.drawLine(oldX, oldY, currentX, currentY); repaint(); oldX = currentX; oldY = currentY; } } if(msg.equalsIgnoreCase("down")) { if(oldY &lt; 861) { System.out.println(msg); System.out.println("Starting Y: " + currentY); currentY = currentY + 30; System.out.println("Ending Y: " + currentY); if(graphics2D != null) graphics2D.drawLine(oldX, oldY, currentX, currentY); repaint(); oldX = currentX; oldY = currentY; System.out.println("Old Y: " + oldY); } } if(msg.equalsIgnoreCase("left")) { if(oldX &gt; 0) { currentX = currentX - 30; if(graphics2D != null) graphics2D.drawLine(oldX, oldY, currentX, currentY); repaint(); oldX = currentX; oldY = currentY; } } if(msg.equalsIgnoreCase("right")) { if(oldX &lt; 847) { currentX = currentX + 30; if(graphics2D != null){ graphics2D.drawLine(oldX, oldY, currentX, currentY); repaint(); } oldX = currentX; oldY = currentY; } } } public void paintComponent(Graphics g) { if(image == null) { image = createImage(getSize().width, getSize().height); graphics2D = (Graphics2D)image.getGraphics(); graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); clear(); } g.drawImage(image, 0, 0, null); }
has comment: http://stackoverflow.com/comment/34075445

http://stackoverflow.com/comment/34066966
type: Comment
type: QuestionComment
has text: Please post full stacktrace, including the nested "caused by" exceptions.
comment on: http://stackoverflow.com/q/22406493
score: 0

http://stackoverflow.com/q/22329883
has title: String to ArrayList with HashMAP
has comment: http://stackoverflow.com/comment/33962102
tagged with: arraylist
has comment: http://stackoverflow.com/comment/33956750
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
tagged with: list
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22346412
type: Question
accepted answer: http://stackoverflow.com/a/22346412
type: AnsweredQuestion
has body: I have a string [{Label_0=Mobile, Phone_0=+212131231}], stored in ArrayList within HashMap, I need to assign it to another Arraylist to fetch values but getting a syntax error List&lt;HashMap&lt;String, String&gt;&gt; phonesArr = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); HashMap&lt;String, String&gt; phoneDict = new HashMap&lt;String, String&gt;(); phoneDict.put(String.format("Label_%d", locali1),PTYPE); phoneDict.put(String.format("Phone_%d", locali1),phoneNumber); phonesArr.add(phoneDict); There is a reason why I am storing it in a array because phone Numbers can be multiple for one contacts. ArrayList&lt;HashMap&lt;String, String&gt;&gt; _allPeoplesDictArr = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); HashMap&lt;String, String&gt; personDict = new HashMap&lt;String, String&gt;(); personDict.put("PhoneNumbers", phonesArr.toString()) //// Value stored as array to string // [{Label_0=Mobile, Phone_0=+212131231}] _allPeoplesDictArr.add(personDict); for (int j = 0; j &lt; _allPeoplesDictArr.size(); j++) { String localPhoneStr = _allPeoplesDictArr.get(j) .get("PhoneNumbers"); Log.d("localPhoneStr", localPhoneStr); /// I dont want to retrieve it as string List&lt;HashMap&lt;String, String&gt;&gt; localPhoneArr = _allPeoplesDictArr.get(j).get("PhoneNumbers"); //// I want to retrieve it as array but getting syntax error. if (localPhoneArr.size() &gt; 0) { for (int k = 0; k &lt; localPhoneArr.size(); k++) { HashMap&lt;String, String&gt; userDict = new HashMap&lt;String, String&gt;(); userDict.put( "label", localPhoneArr.get(k).get( String.format("Label_%d", k))); userDict.put( "value", localPhoneArr.get(k).get( String.format("Phone_%d", k))); } } } I am getting syntax error at grabing values that is now as a JSON `[{Label_0=Mobile, Phone_0=+212131231}]` List&lt;HashMap&lt;String, String&gt;&gt; localPhoneArr = _allPeoplesDictArr.get(j).get("PhoneNumbers");
has comment: http://stackoverflow.com/comment/33935040
has comment: http://stackoverflow.com/comment/33935115
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/22407493
type: AnsweredQuestion
tagged with: graphics2d
type: Question
has body: I'm working right now on a project, and I can't find a solution for my problem. So here is my problem: I have a JFrame, then I add a container JPanel, and I add 2 other JPanel to this container panel , first panel (InputPanel) is for user input, second panel (Board) for displaying the specified algorithm based on the user input. But the displayed algorithm is too large, so I thought I will add a JScrollPane to the DisplayPanel, but it didn't worked like I thought it would have. Here is a picture, the red rectangle is the area what changed after I added the JScollPane: Notice that at my Board class I override the paintComponent(Graphics g) to draw the algorithm. My code in the main frame: container = new JPanel(); container.setLayout(new BorderLayout()); board = new Board(); container.add(board, BorderLayout.CENTER); inputPanel = new InputPanel(board); container.add(inputPanel, BorderLayout.SOUTH); pane = new JScrollPane(board); pane.setViewportView(board); pane.setPreferredSize(new Dimension(700, 0)); container.add(pane, BorderLayout.WEST); add(container); My initial plan was to add a horizontal scrollpane to the Board panel. Can somebody post an example code, or point out for my problem pls?
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/22407851
score: 0
tagged with: java
tagged with: jpanel
has title: Java Graphics2D, JPanel, JScrollPane
accepted answer: http://stackoverflow.com/a/22407851
tagged with: jscrollpane

http://stackoverflow.com/a/22415573
score: 3
has comment: http://stackoverflow.com/comment/34085209
answers question: http://stackoverflow.com/q/22414942
has comment: http://stackoverflow.com/comment/34084419
has comment: http://stackoverflow.com/comment/34085998
has comment: http://stackoverflow.com/comment/34085806
has comment: http://stackoverflow.com/comment/34083959
type: AcceptedAnswer
downvote count: 0
has body: paintComponent() passes Graphics to drawCharactor(). drawCharactor() should not disposes that Graphics object unless you made a copy, this Graphics is shared. Also, do not call repaint() from drawCharactor(). repaint() schedules another paint cycle. You already do call repaint() from a timer. Do not use java.util.Timer use javax.swing.Timer for Swing painting. See How to Use Swing Timers For more information and examples Performing Custom Painting and Painting in AWT and Swing. Consider posting a minimal example.
has comment: http://stackoverflow.com/comment/34084473
has comment: http://stackoverflow.com/comment/34085963
has comment: http://stackoverflow.com/comment/34084781
has comment: http://stackoverflow.com/comment/34086031
has comment: http://stackoverflow.com/comment/34086064
type: Answer
has comment: http://stackoverflow.com/comment/34083901
accepted answer of: http://stackoverflow.com/q/22414942
has comment: http://stackoverflow.com/comment/34084450
has comment: http://stackoverflow.com/comment/34084705
upvote count: 3

http://stackoverflow.com/q/22445631
type: Question
has comment: http://stackoverflow.com/comment/34137661
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
score: 0
has answer: http://stackoverflow.com/a/22445669
accepted answer: http://stackoverflow.com/a/22445669
has comment: http://stackoverflow.com/comment/34137702
answer count: 1
tagged with: nullpointerexception
has body: I am not sure why I am getting a NullPointerException on the line containing the while loop. Originally when the String[] input is created. It is filled with null so maybe that is why I was getting the error. I tried to fix this by adding this bit of code to change that: for (String k : input) { k = "empty"; } This is probably the wrong approach so I am still getting the error. code: String[] input = new String[3]; while(!input[0].equals("exit")) { Scanner sc = new Scanner(System.in); input = sc.nextLine().split(" ", 3); switch(input[0]) { // vi case "vi": System.out.println("hi"); break; // ls case "ls": break; // mkdir case "mkdir": break; // pwd case "pwd": break; } }
tagged with: java
has title: Null pointer exception in String[]

http://stackoverflow.com/comment/34163924
type: Comment
comment on: http://stackoverflow.com/a/22451668
score: 0
type: AnswerComment
has text: My situation is that I have a map system on which overlays are drawn. For historical reasons (aka "massive change of scope") the system is written in Java in the first place instead of a more "appropriate language". Now the feature request "make the elements on the map controlable" forces me to somehow squeeze UI elements in while maintaining map properties like panning and zooming. I will look into your link and see whether it can be applied to my problem

http://stackoverflow.com/q/22411869
type: UnansweredQuestion
has title: when open an android project on eclipse i got some errors
tagged with: android
has comment: http://stackoverflow.com/comment/34078537
type: Question
has body: I update my os to win 8.1.Then i installed adt bundle.When i create a project on eclipse it creates project without any activity.I mean the src file is empty and also there is no xml file like main_activity.xml.Btw i can debug my old applications that i developed on win7. Then i update my sdk.This time it creates activities but as an actionBarActivity.I mean MainActivity extedns ActionBarActivity.Also when the project created on folder appcompatv_7 is automatically created on my workspace.Then i code something it doesnt work on my phone but i know the code is totaly true.Help me please. I removed the adt and reinstall it. I check the updates.Eclipse didnt found any update. My sdk manage looks like
score: 0
has comment: http://stackoverflow.com/comment/34077947
answer count: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22412243

http://stackoverflow.com/comment/34038085
score: 0
comment on: http://stackoverflow.com/q/22389322
type: Comment
type: QuestionComment
has text: Are you sure that's the version of Java you're actually compiling with? How are you compiling, exactly?

http://stackoverflow.com/a/22408427
type: Answer
has comment: http://stackoverflow.com/comment/34070615
score: 2
has comment: http://stackoverflow.com/comment/34073130
has comment: http://stackoverflow.com/comment/34074876
has comment: http://stackoverflow.com/comment/34070745
has body: Negative values are caused by integer overflow. Any integer number with the most significant bit set to 1 is interpreted as a negative number. Hash codes do not signify anything in particular: all that is required of them is to be the same for equal values, and try to be as different as possible for non-equal values. That is why integer overflow can be safely ignored when dealing with hash codes.
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22408313

http://stackoverflow.com/a/37886153
has body: public int getFileSizeInBytes(String path){ try { URL url=new URL(path); URLConnection urlConnection=url.openConnection(); urlConnection.connect(); int file_size=urlConnection.getContentLength(); return file_size; } catch (MalformedURLException e) { }catch (IOException e){ } return -1; }
answers question: http://stackoverflow.com/q/22433264
score: 0
type: Answer

http://stackoverflow.com/a/22381987
has body: UTF-8 uses a different amount of bytes depending on the character being represented. The first byte uses the 7 bit ASCII convention for backwards compatibility. Other characters (like chinese signs) can take up to 4 bytes. As the linked article in wikipedia states, the character you referenced is in the range of the 3 byte values.
answers question: http://stackoverflow.com/q/22381379
type: Answer
score: 0

http://stackoverflow.com/comment/34097588
type: Comment
comment on: http://stackoverflow.com/a/22418211
has text: I have handled ~ + : " ? characters also and have updated in my answer. but still I Have a question that how are you handling other characters such as ` = / ; ' etc.? This **[Link](http://stackoverflow.com/questions/1248510/convert-string-to-keyevents?answertab=votes#tab-top)** might help you to understand key codes.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22347445
has comment: http://stackoverflow.com/comment/33985562
has comment: http://stackoverflow.com/comment/34027445
type: Question
has comment: http://stackoverflow.com/comment/33973589
has answer: http://stackoverflow.com/a/22391261
accepted answer: http://stackoverflow.com/a/22391261
has comment: http://stackoverflow.com/comment/34024700
tagged with: culling
tagged with: 3d
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34027657
has comment: http://stackoverflow.com/comment/34035830
has comment: http://stackoverflow.com/comment/34026564
linked to: http://stackoverflow.com/q/21908241
has comment: http://stackoverflow.com/comment/34006667
has comment: http://stackoverflow.com/comment/33980188
has comment: http://stackoverflow.com/comment/34029420
has comment: http://stackoverflow.com/comment/33969426
has comment: http://stackoverflow.com/comment/33979901
upvote count: 1
linked to: http://stackoverflow.com/q/22089088
type: AnsweredQuestion
has body: To start with,I am pretty new to 3D programming and libgdx. I looked at a few tutorials and I already render the scene I want. I have some 1x1x1 blocks, created with ModelBuilder.createRect() for every visible face, so if another block covers a face of this block, there is no rect created for this block. Also the top and bottom rect is not needed, as I can never see them (except for the floor). So I thought, that this is pretty efficient. I also have Backface culling enabled and I do Viewfrustum culling. However, if I look in a direction, where many blocks are in my viewfrustum the FPS go down to 15-20. This is still okay for me, as my laptop is over 5 years old and its performance is not the best, but this answer made me think. "ModelBuilder is used for debug only". Okay, but how should i then create my boxes? Why should i create a Model in a Modeling app (like Blender), for simple squares? By doing this i couldn't even cull the faces, which are occupied by other blocks. So my question is: How can i create and render those boxes the most efficient way?
has title: Efficient 3D block rendering with Libgdx
tagged with: performance
tagged with: libgdx
score: 1
tagged with: java

http://stackoverflow.com/comment/34015110
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22375780
score: 0
has text: It would help to know the kind of exception that happens on line 47.

http://stackoverflow.com/a/22468986
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22468921
has body: The first if encapsulates your entire function: public void actionPerformed(ActionEvent event) { if (event.getSource() == newProj || event.getSource() == newFlick) { if (nameProj != null) { } if (option == JFileChooser.APPROVE_OPTION) { } else if (event.getSource() == loadProj || event.getSource() == loadFlick) { if (option == JFileChooser.APPROVE_OPTION) { if (config.exists()) { } else { } } } } } I don't think this is as you intend, and would certainly explain why no inner blocks are being reached when the first if evaluates to false.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22468921
downvote count: 0
has comment: http://stackoverflow.com/comment/34178270
has comment: http://stackoverflow.com/comment/34178259
type: Answer
score: 1

http://stackoverflow.com/a/22465465
has comment: http://stackoverflow.com/comment/139424792
downvote count: 0
score: 23
answers question: http://stackoverflow.com/q/22464955
type: Answer
has body: Ok I just found out how I can get the information that I want. public void certInformation(String aURL) throws Exception{ URL destinationURL = new URL(aURL); HttpsURLConnection conn = (HttpsURLConnection) destinationURL.openConnection(); conn.connect(); Certificate[] certs = conn.getServerCertificates(); for (Certificate cert : certs) { System.out.println("Certificate is: " + cert); if(cert instanceof X509Certificate) { X509Certificate x = (X509Certificate ) cert; System.out.println(x.getIssuerDN()); } } }
upvote count: 23

http://stackoverflow.com/q/22417989
tagged with: android
tagged with: action
downvote count: 0
type: UnansweredQuestion
tagged with: drawer
type: Question
has answer: http://stackoverflow.com/a/22692194
score: 1
tagged with: java
tagged with: navigation
has comment: http://stackoverflow.com/comment/34134686
upvote count: 1
answer count: 1
favorite count: 0
has title: Android Navigation Drawer / DrawerLayout...toggle not working correctly
has body: I don't understand, I've followed every single tutorial still with the same problem. In some devices, I get the ic_drawer (the 3 lines icone) as a button to open the menu, in the other hand; most of the other devices I get the Up caret (Arrow) icone. I really don't understand what's the problem. Here's the code: MainActivity: protected void onCreate(Bundle savedInstanceState) { DrawerLayout drawer = (DrawerLayout)findViewById(R.id.DrawerLayout); ListView menu = (ListView)findViewById(R.id.Menu); String[] listElements = getResources().getStringArray(R.array.listElements); ActionBarToggle toggle = new ActionBarDrawerToggle( this, drawer, R.drawable.ic_drawer, R.string.open, R.string.close){ public void onDrawerClosed(View v){ super.onDrawerClosed(v); getActionBar().setTitle(title); invalidateOptionsMenu(); } public void onDrawerOpened(View v){ super.onDrawerOpened(v); getActionBar().setTitle("Menu de l'application"); invalidateOptionsMenu(); } }; drawer.setDrawerListener(toggle); getActionBar().setDisplayHomeAsUpEnabled(true); getActionBar().setHomeButtonEnabled(true); } @Override protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); // Sync the toggle state after onRestoreInstanceState has occurred. toggle.syncState(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); toggle.onConfigurationChanged(newConfig); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Pass the event to ActionBarDrawerToggle, if it returns // true, then it has handled the app icon touch event if (toggle.onOptionsItemSelected(item)) { return true; } // Handle your other action bar items... return super.onOptionsItemSelected(item); } Drawer! <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/DrawerLayout" android:layout_width="match_parent" android:layout_height="match_parent" > <include android:id="@+id/Con…

http://stackoverflow.com/q/22471472
type: Question
tagged with: java
downvote count: 0
answer count: 1
has title: How to Handle the misfire in Quartz
favorite count: 0
has body: I am working with Quartz I have set CronTrigger trigger = newTrigger(). withIdentity(triggerKey). withSchedule( cronSchedule(cronExpression). withMisfireHandlingInstructionDoNothing() //or other ).build(); This is behaving when i restart the server. It's continuously printing info message that "Handling the first 20 triggers that missed their scheduled fire-time. More misfired triggers remain to be processed and not able to trigger the previously scheduled jobs. if i create a new schedule it triggers the only new job for old jobs it's keep on showing the above massage. Any one please help me to solve this
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: quartz-scheduler
has answer: http://stackoverflow.com/a/24801119

http://stackoverflow.com/q/22475956
type: Question
accepted answer: http://stackoverflow.com/a/22475957
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has body: Why? Need to know the reason. Console shows when building the project. Android Application. When i try to Build the app this error is shown in the console. Anybody know the fix please help. And one main thing is its showing only for one project all other projects are working correctly.I think its the problem with "Android Build Tools" UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.NullPointerException at com.android.dx.util.ByteArray.&lt;init&gt;(ByteArray.java:76) at com.android.dx.cf.direct.DirectClassFile.&lt;init&gt;(DirectClassFile.java:206) at com.android.dx.command.dexer.Main.processClass(Main.java:661) 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.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:187) at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:786) at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:597) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726) at org.eclipse.core.runtime.SafeRunner.run(Sa…
has answer: http://stackoverflow.com/a/22475957
upvote count: 3
has title: Android APK Build Error. Showing an Interesting Error
tagged with: apk
tagged with: build
type: AnsweredQuestion
score: 3
tagged with: java

http://stackoverflow.com/comment/34089232
comment on: http://stackoverflow.com/q/22418175
type: Comment
type: QuestionComment
has text: Sorry, I can't help with this piece of code.
score: 0

http://stackoverflow.com/a/22443340
has body: Why don't you simply declare your HttpURLConnection object outside of your while loop ? It will then not open a connection at each call inside the loop.
has comment: http://stackoverflow.com/comment/34133560
answers question: http://stackoverflow.com/q/22443228
has comment: http://stackoverflow.com/comment/34133493
score: 0
has comment: http://stackoverflow.com/comment/34134052
has comment: http://stackoverflow.com/comment/34133972
type: Answer

http://stackoverflow.com/comment/34037565
type: Comment
comment on: http://stackoverflow.com/q/22388434
score: 0
type: QuestionComment
has text: One second, I'm taking a look at Nova launcher's source code (shhh!)

http://stackoverflow.com/q/22380001
has comment: http://stackoverflow.com/comment/34021897
downvote count: 1
has comment: http://stackoverflow.com/comment/34021066
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34021791
has answer: http://stackoverflow.com/a/22381039
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34021339
has title: Some byte comparison works only if I log the values first in Java
has comment: http://stackoverflow.com/comment/34020768
has comment: http://stackoverflow.com/comment/34021749
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34021319
has body: I have a super weird problem. public enum MyCmd { CMD_UP((byte) 0x80), CMD_DOWN((byte) 0x81); UNKNOWN((byte) 0xFF); public static MyCmd getCmd(byte b) { for (MyCmd cmd : MyCmd.values()) { if (cmd == b) return cmd; } return UNKNOWN; } } void f(byte b) { _logger.debug("in:" + b); // remove or not ? MyCmd cmd = MyCmd.getCmd(b); switch (cmd) { CMD_UP: _logger.debug("up"); break; CMD_DOWN: _logger.debug("down"); break; default: _logger.debug("unknown"); break; } } // with log f((byte)(0x80)) in: -127 up // without log f((byte)(0x80)) unknown When f is called with b=-127, it goes to the "unknown" case. But if I log b before entering the switch, then things are ok. Any idea ? One thing that I was thinking of : 0x80 is 128 and with bytes I don't know where it goes and if there is a conflict with 0xFF and depending on the log the compiler does one thing or another ?
has comment: http://stackoverflow.com/comment/34021196
upvote count: 2

http://stackoverflow.com/q/22403083
has answer: http://stackoverflow.com/a/22403324
has comment: http://stackoverflow.com/comment/34061219
has title: How can I grant access of my database to a user with a certain username and password which I am not using?
type: Question
has body: I am working on a web app using java Servlets on eclipse. I have created a database in MySQL and what I want to do now is that I want my this database to be accessible with a different username and password as well, so that other users login with the 2nd username and password and my personal username and password remains unexposed and hidden. I have Googled but am not getting satisfying answer, I would appreciate a solution which can run on my MySQL Workbench 6.0. Thanks in advance for your time!
answer count: 2
tagged with: jdbc
possible better answer: http://stackoverflow.com/a/22403324
accepted answer: http://stackoverflow.com/a/22403465
score: 0
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/34061110
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34061064
tagged with: servlets
has comment: http://stackoverflow.com/comment/34060978
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22403465
has comment: http://stackoverflow.com/comment/34061308
has comment: http://stackoverflow.com/comment/34061158

http://stackoverflow.com/a/22450677
has comment: http://stackoverflow.com/comment/34305496
has body: A LogAxis with the default tick units seems to work. This related example uses integer tick units. import java.awt.Dimension; import java.awt.EventQueue; import javax.swing.JFrame; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.LogAxis; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; /** * @see https://stackoverflow.com/a/22450677/230513 * @see https://stackoverflow.com/a/10353270/230513 */ public class Test { private static final int N = 7; private void display() { XYSeries series = new XYSeries("Series"); for (int i = 0; i &lt;= N; i++) { series.add(i, Math.pow(10, i)); } NumberAxis xAxis = new NumberAxis("X"); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LogAxis yAxis = new LogAxis("Y"); XYPlot plot = new XYPlot(new XYSeriesCollection(series), xAxis, yAxis, new XYLineAndShapeRenderer(true, false)); JFreeChart chart = new JFreeChart( "Chart", JFreeChart.DEFAULT_TITLE_FONT, plot, false); JFrame f = new JFrame("Test"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new ChartPanel(chart) { @Override public Dimension getPreferredSize() { return new Dimension(480, 240); } }); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { new Test().display(); } }); } }
has comment: http://stackoverflow.com/comment/34300267
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22447540
has comment: http://stackoverflow.com/comment/34175307
answers question: http://stackoverflow.com/q/22447540
score: 1
has comment: http://stackoverflow.com/comment/34153393
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34307988
has comment: http://stackoverflow.com/comment/34302107

http://stackoverflow.com/comment/102721792
type: Comment
comment on: http://stackoverflow.com/a/57796364
score: 0
type: AnswerComment
has text: This worked for me but I left Java 8 on the system and I had to change the properties of the project to use Java 12. No more JNI error.

http://stackoverflow.com/comment/34199553
has text: @Patton, really, my project is don't equals this post, but what I want is create a generic class that extend JPAContainer passing the type of bean as parameter, can you understand ? example: public class PersistJPAContainer extends JPAContainer<T>{}
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22456684
type: Comment

http://stackoverflow.com/comment/84875187
has text: Almost a year later, what did you end up using @auramo ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22434919

http://stackoverflow.com/comment/34035109
type: AnswerComment
has text: @user3239652 You'll have to handle the interruption. See the tutorial I posted for ways to do that.
type: Comment
comment on: http://stackoverflow.com/a/22387689
score: 1

http://stackoverflow.com/comment/33945314
type: Comment
has text: Past your entire activity please, I've used Google Maps quite a bit and Zooming I seem to know a lot about. The code you pasted in your question seems correct. So please paste your entire activity so I can see how you're implementing it.
comment on: http://stackoverflow.com/a/22333500
type: AnswerComment
score: 0

http://stackoverflow.com/q/22434653
type: UnansweredQuestion
has title: Why does my onClick not work inside my activity?
tagged with: android
has comment: http://stackoverflow.com/comment/34117325
upvote count: 1
has comment: http://stackoverflow.com/comment/34117277
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34117361
type: Question
has comment: http://stackoverflow.com/comment/34117290
has comment: http://stackoverflow.com/comment/34117381
downvote count: 0
has comment: http://stackoverflow.com/comment/34117249
has body: I have tried EVERYTHING under the damn sun to get this to work and I can't figure it out. My activity responds to onTouchEvent but not to onClick I've tried implements View.OnClickListener I've tried every other thing to get my activity to accept a click but nothing happens. What I have currently is this code @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //removes title bar requestWindowFeature(Window.FEATURE_NO_TITLE); //sets view to full screen getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); RelativeLayout rl = (RelativeLayout) findViewById(R.id.muhLayout); rl.setOnClickListener(this); } My problem with the above code is when I access the RelativeLayout, I get a nullpointerexception. I don't know why.. my layout exists, it is &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;/RelativeLayout&gt; in XML. I tried adding @+id/.... and referencing it that way, same thing, I get an NPE. my onClick method looks like this @Override public void onClick(View event) { // TODO Auto-generated method stub x = event.getX(); y = event.getY(); pixelColor = Color.RED; PixelParticle pp = new PixelParticle(this, x, y, 50, 50, pixelColor); setContentView(pp); } PixelParticle extends a View and uses onDraw method override to draw. This all works perfectly when I use onTouchEvent. But I need onClick to work. Can someone help me figure this out? One last thing.. when I use onTouchEvent and my bitmap is drawn, what exactly is it drawn on? The image being drawn is a View since…
favorite count: 0
answer count: 0

http://stackoverflow.com/comment/34108960
type: AnswerComment
has text: I changed my code to reflect this, im still getting class not found
type: Comment
comment on: http://stackoverflow.com/a/22429902
score: 0

http://stackoverflow.com/q/22439959
tagged with: output
type: Question
tagged with: runtime
score: 0
has body: I want to run this cmd command in my java program dir c:\windows\fonts\* &gt; c:\users\public\fonts.txt but this code that I am using is not working Runtime.getRuntime().exec("cmd /c start c:\\windows\\fonts\\* &gt; c:\\users\\public\\fonts.txt");
has comment: http://stackoverflow.com/comment/34126843
has title: Output file names to txt using getRuntime().exec() Java
has comment: http://stackoverflow.com/comment/34143182
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34127276
tagged with: filenames
answer count: 0
tagged with: runtime.exec
tagged with: java

http://stackoverflow.com/comment/34196599
comment on: http://stackoverflow.com/q/22462061
score: 0
has text: @Chris, I added the class definitions as well as the table definition of the auto generated table
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22455113
favorite count: 0
has comment: http://stackoverflow.com/comment/34153197
tagged with: android
type: AnsweredQuestion
tagged with: listener
has comment: http://stackoverflow.com/comment/34153145
tagged with: view
tagged with: onclicklistener
upvote count: 2
score: 1
has title: how to add onClickListener instead of replacing listener?
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22455295
tagged with: java
has body: I try to add on click listener to my android view. however, when I add with this code: public interface SwipeableButtonListener { public void onClick(); public void onSwipe(); } private SwipeableButtonListener listener = null; public void setOnClickListener(SwipeableButtonListener listener) { this.listener = listener; } the current listener is replaced and not a new one is added to the registered one. how can I change this? creating listener ArrayList is the only way? does native addOnClickListener override existing listener or adds to a built-in listener list?
has answer: http://stackoverflow.com/a/22455327
accepted answer: http://stackoverflow.com/a/22455327
answer count: 2
has comment: http://stackoverflow.com/comment/34154748
has answer: http://stackoverflow.com/a/22455295

http://stackoverflow.com/comment/34014787
score: 0
type: QuestionComment
type: Comment
has text: You mean put Thread.spleep in `onReceivedTitle` and `callAMehod();` after that?
comment on: http://stackoverflow.com/q/22376156

http://stackoverflow.com/a/22337882
has body: But i think objects of string class are final. As once initialized their state can not change. No, they're not final in the Java sense. They're immutable, but final relates purely to variables/data members, not objects. Here's an example: final String a = "foo"; String b = "bar"; b = "updated bar"; // Compiles and works, `b` (the variable) can be changed a = "updated foo"; // Won't compile, you're not allowed to change the `a` variable final is about whether a "variable"'s value can be changed, not about whether the state of an object can be changed. Here's an example with a final variable referring to a mutable object: final Map a = new HashMap(); a.add("foo", "bar"); // Works; we're not changing `a`, we're changing the state // of the object `a` refers to And just to take objects out of it entirely: final int a = 5; a = 6; // Won't compile, because we aren't allowed to change `a`
has comment: http://stackoverflow.com/comment/33948570
has comment: http://stackoverflow.com/comment/33948805
upvote count: 4
answers question: http://stackoverflow.com/q/22337813
has comment: http://stackoverflow.com/comment/33948742
has comment: http://stackoverflow.com/comment/33948775
accepted answer of: http://stackoverflow.com/q/22337813
has comment: http://stackoverflow.com/comment/33949192
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33949408
has comment: http://stackoverflow.com/comment/33948936
has comment: http://stackoverflow.com/comment/33948609
type: Answer
score: 4

http://stackoverflow.com/comment/34033749
comment on: http://stackoverflow.com/q/22386824
type: Comment
type: QuestionComment
score: 1
has text: Have you tried looking up that error? You're honestly showing no effort at all.

http://stackoverflow.com/q/22349644
has comment: http://stackoverflow.com/comment/33969095
tagged with: java
upvote count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/33970374
has comment: http://stackoverflow.com/comment/33969028
tagged with: standard-library
has comment: http://stackoverflow.com/comment/33968921
answer count: 0
downvote count: 0
type: UnansweredQuestion
has title: Why do we need Boolean(String) constructor?
type: Question
score: 3
has body: I'm wondering because I think that behaviour of this constructor isn't as obvious as other wrappers constructors. It's not difficult but more clear to use bool constructor new Boolean ("true".equalsIgnoreCase(str)) as for me. So, is there any common use-case for it (maybe somewhere inside standard library) or was it written only for uniformity with other wrappers?

http://stackoverflow.com/comment/34181988
comment on: http://stackoverflow.com/q/22464537
score: 0
type: Comment
type: QuestionComment
has text: What are you looking at and stating that input is being read twice? Can you share more details?

http://stackoverflow.com/q/22427559
tagged with: arrays
tagged with: http://stackoverflow.com/tag/c
has title: How can I find line of the same elements in a 2D matrix?
has comment: http://stackoverflow.com/comment/34104492
accepted answer: http://stackoverflow.com/a/22431116
tagged with: matrix
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/20528602
has comment: http://stackoverflow.com/comment/34104897
has comment: http://stackoverflow.com/comment/34104953
has body: I have custom size matrix and should find line of with specified length. I need coordinates of first and last elements in this line. For example: Line length is 3. My matrix is 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 So my answer is [0, 3], [2, 3]. If line length is 4. My matrix is 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 My answer is [0, 4], [3, 1]. Elements can has any type (number, char, string, objects, etc.). It does not matter what programming language I use, because I just want to understand algorithm. Sorry for my bad English. Thanks for help.
score: -1
tagged with: c++
type: AnsweredQuestion
tagged with: java
downvote count: 2
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34104840
has answer: http://stackoverflow.com/a/22431116

http://stackoverflow.com/a/22463631
upvote count: 5
has comment: http://stackoverflow.com/comment/34734687
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34751474
has body: If you are using the command line version of Checkstyle, the easiest way would be to look at the XML output report. Use -f xml to tell Checkstyle to output XML. Violation messages in XML look like this: &lt;error line="0" severity="error" message="Missing package-info.java file." source="com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocPackageCheck"/&gt; So here, the check name for use by the suppression filter is JavadocPackage. For manual lookup, you have some further options: You could manually go to the list of available checks and search it for keywords from your violation message. (Thanks @crasp for pointing this out in the comments.) If you are using Eclipse, you can check the "Include rule names in violation messages" checkbox as described here to see the rule name in Eclipse. If you are using SonarQube, you can see the rule name by clicking on the issue.
accepted answer of: http://stackoverflow.com/q/22462362
answers question: http://stackoverflow.com/q/22462362
score: 5
type: AcceptedAnswer

http://stackoverflow.com/q/22441922
answer count: 3
tagged with: email
linked to: http://stackoverflow.com/q/624581
has comment: http://stackoverflow.com/comment/34130754
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22451965
tagged with: spring
has body: my problem is that in below code as long as to has the @ in it there is no error! For example if I enter x@y there is no error! How can I show an error when the email address doesn't exists or domain name is incorrect? public void sendMail(String content, String to, String subject) { MimeMessage message = mailSender.createMimeMessage(); try{ MimeMessageHelper helper = new MimeMessageHelper(message, true); helper.setFrom(simpleMailMessage.getFrom()); helper.setTo(to.split(",")); helper.setSubject(subject); helper.setText(String.format(simpleMailMessage.getText(), content)); }catch (MessagingException e) { e.printStackTrace(); } mailSender.send(message); System.out.rpint("email was sent to "+to+" successfully"); }
tagged with: java
tagged with: error-handling
type: Question
has answer: http://stackoverflow.com/a/22442169
has title: sending email using Java Spring email
has answer: http://stackoverflow.com/a/22442139
score: 0

http://stackoverflow.com/a/22459603
has body: Your num is an int[4] which means it has indexes in the range [0,3], yet you try to access num[4] which is invalid.
answers question: http://stackoverflow.com/q/22459531
upvote count: 1
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/139288518
type: AnswerComment
has text: Maybe yes, maybe no. All depends on the type of CSV you are dealing with. My only say is to hold-back on 'Battle-Tested' library if you aren't in the battle of unexpected CSVs.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22552186

http://stackoverflow.com/comment/34064142
has text: k1 should have its mapping removed and then `k2 -> k3` and `k3 -> k2`. Which my example wont do. Thank you for pointing this out.
comment on: http://stackoverflow.com/q/22404463
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34146828
has text: It seems that I need to specify Host at server.xml. I tried to do it but nothing works anyway.
comment on: http://stackoverflow.com/a/22451084
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34111710
type: QuestionComment
has text: @G.Bach I'm not quite understanding disjoint. The graph is connected completely in the minimum number of pairwise edges. (N-1) One example would be a straight line with two end nodes
comment on: http://stackoverflow.com/q/22429680
score: 0
type: Comment

http://stackoverflow.com/comment/34143581
type: QuestionComment
comment on: http://stackoverflow.com/q/22444982
has text: I added the OnCreate Event and the init() function
score: 0
type: Comment

http://stackoverflow.com/comment/34053368
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22398281
score: 0
has text: show your jsp source code

http://stackoverflow.com/q/22449951
linked to: http://stackoverflow.com/q/4362786
tagged with: java
has answer: http://stackoverflow.com/a/22450040
has title: Is there a way to get Root Directory in Java in a given File
type: Question
has body: Background I'm creating an upload file functionality. I want to save the file in a given folder ("/uploadFiles"). I am currently testing in Windows but will run it in Linux. I know I can get the current working TOMCAT directory. Is there a way to get the root system directory of TOMCAT directory? Say if the current directory is "D:\apache\sample_web_project" it will get "D:\" then I can append the "D:\uploadFiles" then if its in Linux it will get "/etc/apache/sample_web_project" it will get "/etc"
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34144778
has comment: http://stackoverflow.com/comment/34144783
has answer: http://stackoverflow.com/a/22451600
type: UnansweredQuestion

http://stackoverflow.com/comment/34193403
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22478224
score: 0
has text: I'm sending a .so file. When I try to open it using "dlopen", it produces an error. "dlopen" works fine on the original file.

http://stackoverflow.com/q/22479762
has comment: http://stackoverflow.com/comment/34196195
answer count: 1
has comment: http://stackoverflow.com/comment/34197264
score: -3
downvote count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34197176
tagged with: java
has comment: http://stackoverflow.com/comment/34195883
accepted answer: http://stackoverflow.com/a/22479790
linked to: http://stackoverflow.com/q/7101992
type: Question
has comment: http://stackoverflow.com/comment/34195993
has body: I was thinking if we could use 'or' or anything like that in Java Eclipse Android Development when I write this code if (strName.contentEquals("Hi" or "Hello") { } Can I do something like this?
upvote count: 1
has answer: http://stackoverflow.com/a/22479790
has comment: http://stackoverflow.com/comment/34195733
favorite count: 0
has title: Can I use any 'or' like word in an if else statement (in contentEquals() )
has comment: http://stackoverflow.com/comment/34197420
tagged with: android

http://stackoverflow.com/q/22454839
has answer: http://stackoverflow.com/a/51734316
has answer: http://stackoverflow.com/a/65678192
has answer: http://stackoverflow.com/a/51953932
has answer: http://stackoverflow.com/a/22454973
has answer: http://stackoverflow.com/a/22454966
has answer: http://stackoverflow.com/a/67856091
has answer: http://stackoverflow.com/a/39206916
has body: I have designed a simple layout.I have finished the design without animation, but now I want to add animations when textview click event and I don't know how to use it. Did my xml design looks good or not? Any suggestions would be appreciated. My XML <?xml version="1.0" encoding="UTF-8"?> <TextView android:id="@+id/Information1" android:layout_width="match_parent" android:layout_height="1dp" android:text="Child Information" android:background="#0390BE" android:layout_weight="0.75" android:textColor="#FFFFFF" android:layout_gravity="center|fill_horizontal"/> <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="match_parent" android:text="TextView" /> <TextView android:id="@+id/Information2" android:layout_width="match_parent" android:layout_height="0dp" android:text="Parent Information" android:background="#0390BE" android:layout_weight="0.75" android:textColor="#FFFFFF" android:layout_gravity="center|fill_horizontal"/> <TextView android:id="@+id/textView2" android:layout_width="match_parent" android:layout_height="match_parent" android:text="TextView" /> <TextView android:id="@+id/Information3" android:layout_width="match_parent" android:layout_height="0dp" android:text="Siblings" android:background="#0390BE" android:layout_weight="0.75" android:textColor="#FFFFFF" android:layout_gravity="center|fill_horizontal"/> <TextView android:id="@+id/textView3" android:layout_width="match_parent" android:layout_height="match_parent" android:text="TextView" /> <TextView android:id="@+id/Information4" android:layout_width="match_parent" android:layout_height="0dp" android:text="Teacher Information" android:background="#0390BE" android:layout_weight="0.75" android:textColor="#FFFFFF" android:layout_gravity="center|fill_horizontal"/> <TextView android:id="@+id/textView4" android:layout_width="match_parent" android:layout_height="match_parent" android:text="TextView" /> <TextView android:id="@+id/Information5" android:layout_width="match…
type: AnsweredQuestion
tagged with: android-animation
tagged with: java
accepted answer: http://stackoverflow.com/a/22454966
answer count: 11
type: Question
has answer: http://stackoverflow.com/a/55648103
upvote count: 352
downvote count: 0
linked to: http://stackoverflow.com/q/29846458
favorite count: 0
has answer: http://stackoverflow.com/a/77481975
score: 352
has answer: http://stackoverflow.com/a/65822476
possible better answer: http://stackoverflow.com/a/55648103
has title: Android adding simple animations while setvisibility(view.Gone)
has answer: http://stackoverflow.com/a/77340597
tagged with: android

http://stackoverflow.com/a/25473563
upvote count: 1
has body: This seems to be a known problem with Hibernate Envers (HHH-9042). A simple workaround would be a manual invocation of the Convter and an additional transient field, like this: @Entity public class Party { protected Name name; @Transient protected String nameString; //... public void setName(Name name) { this.nameString = (new NametoStringConverter()).convertToDatabaseColumn(name); this.name = name; } //... public void setNameString(String nameString) { this.name = (new NametoStringConverter()).convertToEntityAttribute(nameString); this.nameString = nameString; } } Depending on the conversion functions, the code could be further simplified by making them staticand importing them.
answers question: http://stackoverflow.com/q/22358912
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/39771658
has comment: http://stackoverflow.com/comment/46724604
has comment: http://stackoverflow.com/comment/39759643
type: Answer

http://stackoverflow.com/comment/34125363
type: QuestionComment
has text: I dont know why people just downvote instead of directly showing the mistakes.
comment on: http://stackoverflow.com/q/22438677
score: 0
type: Comment

http://stackoverflow.com/a/44773897
has body: this is javascript alternative function getRandomNos(m,n) { var nums=[]; var i; for (i = 0;i&lt;n;i++) { nums[i] = Math.random(); } var factor = (m-n) / nums.reduce(add, 0); for (i = 0;i&lt;nums.length;i++) { nums[i] = parseInt(nums[i] * factor) + 1; } var fudge = m - nums.reduce(add, 0); for (i=0;i&lt;fudge;i++) { nums[i] = nums[i] + 1; } console.log(nums); console.log(nums.reduce(add, 0)); } function add(a, b) { return a + b; }
type: Answer
answers question: http://stackoverflow.com/q/22380890
score: 0

http://stackoverflow.com/comment/38506312
type: QuestionComment
type: Comment
has text: @Ryan One-per-line abides by Java conventions (see the answer below that states Checkstyle will flag multiple declarations). It's considered to have less potential for confusion.
score: 0
comment on: http://stackoverflow.com/q/22360085

http://stackoverflow.com/a/22361895
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/33991631
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33990924
answers question: http://stackoverflow.com/q/22361365
has body: try to disable anonymous authentication and change to fully authentication to your security rule. something like this : http .addFilterBefore(authenticationTokenFilter, BasicAuthenticationFilter.class) .antMatcher("/token") .authenticationProvider(tokenAuthenticationProvider) .authorizeUrls().anyRequest().fullyAuthenticated() .and() .anonymous().disable()
has comment: http://stackoverflow.com/comment/33991711

linux
tags question: http://stackoverflow.com/q/22435318
tags question: http://stackoverflow.com/q/22408389
tags question: http://stackoverflow.com/q/22412274
tags question: http://stackoverflow.com/q/22376536
tags question: http://stackoverflow.com/q/22481534
tags question: http://stackoverflow.com/q/22472511
type: Tag
tags question: http://stackoverflow.com/q/22375951
tags question: http://stackoverflow.com/q/22445375
tags question: http://stackoverflow.com/q/22369842
tag name: linux
tags question: http://stackoverflow.com/q/22444174
tags question: http://stackoverflow.com/q/22375873
tags question: http://stackoverflow.com/q/22360974
tags question: http://stackoverflow.com/q/22366213
tags question: http://stackoverflow.com/q/22371167
tags question: http://stackoverflow.com/q/22341313
tags question: http://stackoverflow.com/q/22487707
tags question: http://stackoverflow.com/q/22342145
tags question: http://stackoverflow.com/q/22376838
tags question: http://stackoverflow.com/q/22472844
tags question: http://stackoverflow.com/q/22365753
tags question: http://stackoverflow.com/q/22485267
tags question: http://stackoverflow.com/q/22472743
tags question: http://stackoverflow.com/q/22355207
tags question: http://stackoverflow.com/q/22353533

http://stackoverflow.com/comment/33971505
has text: i think you should go with this solution .
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22350794
type: Comment

http://stackoverflow.com/a/22418277
has comment: http://stackoverflow.com/comment/34088798
has comment: http://stackoverflow.com/comment/34088716
has comment: http://stackoverflow.com/comment/34088859
upvote count: 2
has comment: http://stackoverflow.com/comment/34088847
type: Answer
has comment: http://stackoverflow.com/comment/34088818
has comment: http://stackoverflow.com/comment/34088768
has comment: http://stackoverflow.com/comment/34088770
has comment: http://stackoverflow.com/comment/34088916
accepted answer of: http://stackoverflow.com/q/22418230
has body: I think you are accidentally redeclaring shape as an uninitialized field. The shape you are calling setRect on has not been initialized the way you think it has. If you have a shape in the parent class that you are trying to access, simply set its modifier to protected and remove the private shape declaration in the class you posted. /* REMOVE THIS */ private Rectangle2D.Double shape; // uninitialized! // constructor public Brick(int x, int y, int w, int h) { super(new Rectangle2D.Double(x, y, w, h)); //set brick x, y, width, and height xPos = x; yPos = y; width = w; height = h; // update shape // This now references a protected instance variable inherited from the parent. shape.setRect((double)xPos, (double)yPos, (double)width, (double)height); } However looking through this constructor, it seems rather off. If it is the case that the parent class has a shape itself, why do you need to set the rectangle any differently than the way you set it in the parent class? For example, this code appears to be logically equivalent. // Call the parents constructor to set the shape of this brick.. public Brick(int x, int y, int w, int h) { super(new Rectangle2D.Double(x, y, w, h)); }
answers question: http://stackoverflow.com/q/22418230
has comment: http://stackoverflow.com/comment/34088868
has comment: http://stackoverflow.com/comment/34088772
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22462551
upvote count: 5
has body: I'm using libgdx to make a simple game and I want to use scene2Dui and a stage and skin to simplify a lot of my positioning/sizing code. To further simplify the positioning of everything, I also want to define a custom coordinate system so that regardless of the screen size in pixels, the code will automatically create a grid overlay and position/size all of my elements on it correctly. The problem I'm having relates to this new coordinate system and how it works with the skin. Basically, I create a button based off the style in the skin and put it in a table to be sized according to my coordinates. I also create an image but this time load the region directly and position it myself. The debug lines show that the button itself works fine and it behaves as expected regarding clicks; if I click outside the table, there is no reaction despite the fact that the image is blown up. Resizing the window also behaves as expected. Somewhere, the stage must be asking the skin how big the button's picture is and it's answering in pixels where it should be answering in my coordinates. Is there a way to scale the skin down to my coordinates, and update it when a window is resized? Here's the relevant code: // *** Layout Coordinates ***// // Use the pixels per unit to define a grid and orient // all the elements of the screen based on that grid. private static final float CAMERA_WIDTH = 5f; // how many boxes wide the screen is private static final float CAMERA_HEIGHT = 8f; // how many boxes high the screen is // Button in the table, all in my coordinate system private static final float BUTTON_HEIGHT = 1.0f; private static final float BUTTON_WIDTH = 3.0f; private static final float TABLE_PADDING_LEFT = 1.0f; private static final float TABLE_PADDING_TOP = 1.0f; // Floating image, all in my coordinate system private static final float IMAGE_HEIGHT = 4.0f; private static final float IMAGE_WIDTH = 3.0f; private static final float IMAGE_ORIGIN_X = 1.0f; private static final float IMAGE…
has answer: http://stackoverflow.com/a/26575329
downvote count: 0
type: UnansweredQuestion
tagged with: coordinates
tagged with: libgdx
tagged with: scene2d
has title: LibGDX: Skin + Custom Coordinates Draw Incorrectly
tagged with: java
type: Question
score: 5
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34178134

http://stackoverflow.com/comment/34082191
comment on: http://stackoverflow.com/a/22413465
type: AnswerComment
score: 0
type: Comment
has text: The data is not in a CSV file it is in a string.

http://stackoverflow.com/comment/34152727
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22454835
has text: how much bit a co-processor will be??

http://stackoverflow.com/comment/34004116
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22369535
type: QuestionComment
has text: Looks like it's expressed in degrees. 60 minutes = 1 degree and 60 seconds = 1 minute. So 34.102709 = 34 degrees, 6' and 9.7524"

http://stackoverflow.com/q/22437058
has title: Import nested Json into cassandra
score: 1
has comment: http://stackoverflow.com/comment/34121215
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22519952
has body: I have list of nested Json objects which I want to save into cassandra (1.2.15). However the constraint I have is that I do not know the column family's column data types before hand i.e each Json object has got a different structure with fields of different datatypes. So I am planning to use dynamic composite type for creating a column family. So I would like to know if there is an API or suggest some ideas on how to save such Json object list into cassandra. Thanks
type: Question
tagged with: cassandra
downvote count: 0
answer count: 1
favorite count: 0
tagged with: cassandra-cli
type: UnansweredQuestion
upvote count: 1
tagged with: python

http://stackoverflow.com/comment/34044668
comment on: http://stackoverflow.com/q/22392135
type: Comment
type: QuestionComment
has text: @Pshemo It's why I suggested looping through `foo` to get to Strings it would contain.
score: 0

http://stackoverflow.com/q/22352100
has title: Deploying glassware on Google Glass
has answer: http://stackoverflow.com/a/22353834
accepted answer: http://stackoverflow.com/a/22353834
answer count: 1
downvote count: 0
favorite count: 0
tagged with: google-glass
tagged with: android
tagged with: deployment
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33974977
has body: Regarding deployment: What do I deploy my glassware as? JAR? APK? Something else? Since the GDK hasn't been officially released yet it's tough to decipher what glassware builds as. How do I actually install glassware on a Glass device? Is MyGlass the only option? Same question above, but for testing &amp; development...how can I deploy a dev/qa/demo version of my glassware to an in-house (test) Glass device before launching live? The Android SDK contains a software emulator that you can deploy Android apps to. Does the GDK offer something similar? Or do I have to physically deploy my glassware to a Glass device to test it? How do I manage updates to my glassware for my users? If they purchase v1.0 of my glassware, how do I get them v1.0.1, etc.?
has comment: http://stackoverflow.com/comment/33974689
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: google-gdk

jcomponent
tags question: http://stackoverflow.com/q/22362625
tags question: http://stackoverflow.com/q/22451425
tag name: jcomponent
type: Tag

http://stackoverflow.com/a/22356213
has comment: http://stackoverflow.com/comment/33980992
has comment: http://stackoverflow.com/comment/33981461
has comment: http://stackoverflow.com/comment/33980431
has comment: http://stackoverflow.com/comment/33980643
answers question: http://stackoverflow.com/q/22356082
score: 0
has body: Because Thread.interrupted(), as documented, doesn't throw InterruptedException at all. It returns true or false, and clears the interrupt status that has been set by the call to Thread.interrupt(). Note that Thread.interrupt() doesn't cause an InterruptedException to be thrown either It simply sets the interrupt status.
type: Answer

http://stackoverflow.com/comment/34092223
has text: i checked and both are 7
comment on: http://stackoverflow.com/q/22420201
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22454563
has body: Will I'm working on project using JnetPcap API,I was able to list to run the ClassicPcapExample successfully public class ClassicPcapExample { /** * Main startup method * * @param args * ignored */ public static void main(String[] args) { List&lt;PcapIf&gt; alldevs = new ArrayList&lt;PcapIf&gt;(); // Will be filled with NICs StringBuilder errbuf = new StringBuilder(); // For any error msgs /*************************************************************************** * First get a list of devices on this system **************************************************************************/ int r = Pcap.findAllDevs(alldevs, errbuf); if (r == Pcap.NOT_OK || alldevs.isEmpty()) { System.err.printf("Can't read list of devices, error is %s", errbuf .toString()); return; } System.out.println("Network devices found:"); int i = 0; for (PcapIf device : alldevs) { String description = (device.getDescription() != null) ? device.getDescription() : "No description available"; System.out.printf("#%d: %s [%s]\n", i++, device.getName(), description); } PcapIf device = alldevs.get(0); // We know we have atleast 1 device System.out .printf("\nChoosing '%s' on your behalf:\n", (device.getDescription() != null) ? device.getDescription() : device.getName()); /*************************************************************************** * Second we open up the selected device **************************************************************************/ int snaplen = 64 * 1024; // Capture all packets, no trucation int flags = Pcap.MODE_PROMISCUOUS; // capture all packets int timeout = 10 * 1000; // 10 seconds in millis Pcap pcap = Pcap.openLive(device.getName(), snaplen, flags, timeout, errbuf); if (pcap == null) { System.err.printf("Error while opening device for capture: " + errbuf.toString()); return; } the problem I m having now , is my wireless interface is not listed among the interfaces , so I can sniff HTTP Packets . Here is the Output of this program : Network devices found: #0: \Device\NPF…
favorite count: 0
type: Question
tagged with: winpcap
tagged with: jnetpcap
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/35012117
tagged with: java
tagged with: libpcap
type: UnansweredQuestion
has title: JnetPcap Wireless Interface
score: 2
has answer: http://stackoverflow.com/a/31358520
downvote count: 0
tagged with: jpcap

http://stackoverflow.com/a/22408545
upvote count: 1
has body: Can I do it from the listener itself ? Yes you can. For instance: JComboBox comboBox = new JComboBox(); comboBox.addItemListener(new ItemListener() { Object previousSelection = null; @Override public void itemStateChanged(ItemEvent e) { if(e.getStateChange() == ItemEvent.DESELECTED) { previousSelection = e.getItem(); } else if(!isValid(e.getItem())) { JComboBox cb = (JComboBox)e.getSource(); cb.setSelectedItem(previousSelection); } } }); Where isValid(Object obj) method should validate selected item. Would that lead to recursive calls to my listener ? Sure but the previous selected item was valid so it will be called 2 times top: First time when user attempts to select an invalid item. Second time when listener sets the previous item as the selected one.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22404613
score: 1

http://stackoverflow.com/q/22344369
has comment: http://stackoverflow.com/comment/33960105
has answer: http://stackoverflow.com/a/22344447
type: AnsweredQuestion
has body: My use case is to develop a telecom billing in Java. Knowing that i must calculate 60 000 bills per day, i need to distribute the load of the calculation on several(three or four) servers. That is called Clustering ( correct me if it's wrong). My Solution is to develop a middleware that will distribute for each server a list of client who should be charged, and then each server will calculate the bill and generate a PDF file. Could you give me some more ideas, for example which Java class do i need, or which methods shall i use. Thank you
downvote count: 0
has answer: http://stackoverflow.com/a/22344531
has title: how to distribute the load in a billing system?
score: 1
favorite count: 0
tagged with: billing
type: Question
possible better answer: http://stackoverflow.com/a/22344531
has comment: http://stackoverflow.com/comment/33959954
accepted answer: http://stackoverflow.com/a/22344447
has comment: http://stackoverflow.com/comment/33960329
has comment: http://stackoverflow.com/comment/33961822
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22344645
tagged with: cluster-computing
tagged with: performance
tagged with: java

http://stackoverflow.com/q/22338870
tagged with: visibility
downvote count: 0
tagged with: button
score: 1
tagged with: android-activity
favorite count: 0
tagged with: android
upvote count: 1
accepted answer: http://stackoverflow.com/a/22339003
linked to: http://stackoverflow.com/q/10407159
type: AnsweredQuestion
tagged with: java
has body: I have buttons V1-V8 visible and R1-R8 invisible initially in my activity_main.xml file My MainActivity.java file package com.example.buttonvtor; import com.example.buttonvtor.MainActivity; import com.example.buttonvtor.Payment1Activity; import com.example.buttonvtor.Payment2Activity; import com.example.buttonvtor.Payment3Activity; import com.example.buttonvtor.Payment4Activity; import com.example.buttonvtor.Payment5Activity; import com.example.buttonvtor.Payment6Activity; import com.example.buttonvtor.Payment7Activity; import com.example.buttonvtor.Payment8Activity; import com.example.buttonvtor.R; import android.os.Bundle; import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener{ Button bv1; Button bv2; Button bv3; Button bv4; Button bv5; Button bv6; Button bv7; Button bv8; Button br1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); bv1 = (Button)findViewById(R.id.button1); bv2 = (Button)findViewById(R.id.button2); bv3 = (Button)findViewById(R.id.button3); bv4 = (Button)findViewById(R.id.button4); bv5 = (Button)findViewById(R.id.button5); bv6 = (Button)findViewById(R.id.button6); bv7 = (Button)findViewById(R.id.button7); bv8 = (Button)findViewById(R.id.button8); br1 = (Button)findViewById(R.id.r1); bv1.setOnClickListener(this); bv2.setOnClickListener(this); bv3.setOnClickListener(this); bv4.setOnClickListener(this); bv5.setOnClickListener(this); bv6.setOnClickListener(this); bv7.setOnClickListener(this); bv8.setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); retu…
has title: How to make a button visible frominvisible on a successful event happend in another activity
type: Question
possible better answer: http://stackoverflow.com/a/22338983
answer count: 2
has answer: http://stackoverflow.com/a/22338983
has answer: http://stackoverflow.com/a/22339003

http://stackoverflow.com/comment/34150384
has text: too many problems to sort out in 7 lines of code...hardly...either help or don't comment.... no one forced you to type on your keyboard.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22453296

http://stackoverflow.com/comment/33967208
type: AnswerComment
comment on: http://stackoverflow.com/a/22347218
has text: do I call cancel() before timer.scheduleAtFixedRate(new TimerTask()? In case I have set schedule for more then 1, then how about the other?
score: 0
type: Comment

http://stackoverflow.com/comment/34186940
type: AnswerComment
has text: OK, then yes, `new String("a")` does create a String in the pool. It's the `"a"` that's in the pool.
type: Comment
comment on: http://stackoverflow.com/a/22473252
score: 0

http://stackoverflow.com/a/22368820
has body: In the very rare event that a location's standard time changes, this will account for it. The best example I can think of is when Alaska changed from being part of Russia to being part of USA (and literally hopped across the international dateline, which used to run down the border of Canada and Alaska). A DateTimeZone representing Alaska would have a different standard offset before and after that date.
has comment: http://stackoverflow.com/comment/34016365
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22368759
answers question: http://stackoverflow.com/q/22368759

http://stackoverflow.com/q/22388493
has answer: http://stackoverflow.com/a/22391366
has title: Could not generate CGLIB subclass of class - Common causes ... final class
tagged with: eclipse
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34037054
has comment: http://stackoverflow.com/comment/34036678
accepted answer: http://stackoverflow.com/a/22391366
has body: i am using pointcut regex pattern to monitor execution of some of my methods. one of the Util classes i am using is declared final. because of that i get the error while Spring config is loading up. i am not able to write a pointcut regex pattern to exclude final classes. i am unaware of the syntax and not able to find one to avoid final on net too. can i avoid this problem in a way without using pointcut pattern (to exclude final classes) at all ? i am using @Configuration and defining my config in there.
tagged with: spring
tagged with: regex
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34037101
tagged with: java
type: Question

http://stackoverflow.com/q/22389957
tagged with: string
has answer: http://stackoverflow.com/a/22390093
possible better answer: http://stackoverflow.com/a/22390017
has answer: http://stackoverflow.com/a/22390043
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34039226
has comment: http://stackoverflow.com/comment/34039132
tagged with: java
has answer: http://stackoverflow.com/a/22390255
tagged with: match
type: Question
has body: I have a string in java: String text = "A, B, C, D, "; How I can to get "A, B, C and D"? I have "A, B, C, D" as well: text.substring(0, text.lastIndexOf(",")), but how do I get the result I want? Thanks!!!
has answer: http://stackoverflow.com/a/22390273
has comment: http://stackoverflow.com/comment/34039122
has title: Replacing last character given in a string
answer count: 6
linked to: http://stackoverflow.com/q/10631715
score: 0
accepted answer: http://stackoverflow.com/a/22390255
has answer: http://stackoverflow.com/a/22390260
has answer: http://stackoverflow.com/a/22390017

http://stackoverflow.com/a/22439935
type: Answer
has body: open www.google.com write "download javax.xml.rpc library" download jar file. Place the jar file in plugin folder of eclipse. Right click on your java project->Build path->Add library-> browse the jar from plugin folder.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22438030
has comment: http://stackoverflow.com/comment/34128154
accepted answer of: http://stackoverflow.com/q/22438030
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34086269
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22416939
score: 1
has text: But you can easily adapt it for your needs. Send notification every one second and there you are!

http://stackoverflow.com/comment/34178013
has text: The HTTP library is trying to store your whole upload in memory. I don't know why that is, but hopefully someone else does.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22468763

http://stackoverflow.com/a/22466830
downvote count: 0
type: Answer
score: 3
has body: A Map stores key/value pairs, with only one value per key. So if you're calling put with the same key multiple times, then it will correctly stick to the same size, only having a single entry for that key.
has comment: http://stackoverflow.com/comment/122944600
accepted answer of: http://stackoverflow.com/q/22466765
upvote count: 3
answers question: http://stackoverflow.com/q/22466765
has comment: http://stackoverflow.com/comment/122944642
type: AcceptedAnswer

http://stackoverflow.com/a/22453339
has comment: http://stackoverflow.com/comment/34307223
has body: Use TreeViewer.addDoubleClickListener to listen for tree double clicks not a mouse listener. You could use something like this: private class DoubleClickListener implements IDoubleClickListener { @Override public void doubleClick(final DoubleClickEvent event) { final IStructuredSelection selection = (IStructuredSelection)event.getSelection(); if (selection == null || selection.isEmpty()) return; final Object sel = selection.getFirstElement(); final ITreeContentProvider provider = (ITreeContentProvider)treeViewer.getContentProvider(); if (!provider.hasChildren(sel)) return; if (treeViewer.getExpandedState(sel)) treeViewer.collapseToLevel(sel, AbstractTreeViewer.ALL_LEVELS); else treeViewer.expandToLevel(sel, 1); } } Update: Using TreeViewer.addDoubleClickListener is the preferred way to do double click handling for all classes derived from StructuredViewer. Each double click listener is run using SafeRunnable which deals with any exceptions that the listener may throw, this safeguards the rest of the code for errors in the listeners. The DoubleClickEvent provides direct access to the model object data so it is not necessary to deal with Tree or TreeItem objects to work out selections. The double click code in the TreeViewer interfaces correctly with the OpenStrategy single / double click to open code.
has comment: http://stackoverflow.com/comment/34184717
has comment: http://stackoverflow.com/comment/34151034
accepted answer of: http://stackoverflow.com/q/22450770
answers question: http://stackoverflow.com/q/22450770
has comment: http://stackoverflow.com/comment/34805344
has comment: http://stackoverflow.com/comment/34235976
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34232523
has comment: http://stackoverflow.com/comment/36325139
has comment: http://stackoverflow.com/comment/34469584
has comment: http://stackoverflow.com/comment/34150665
type: Answer
has comment: http://stackoverflow.com/comment/34166858
has comment: http://stackoverflow.com/comment/34180648
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/34307047
has comment: http://stackoverflow.com/comment/34166313

http://stackoverflow.com/a/22335067
upvote count: 1
answers question: http://stackoverflow.com/q/22335036
has comment: http://stackoverflow.com/comment/33943526
has comment: http://stackoverflow.com/comment/33943885
has comment: http://stackoverflow.com/comment/33943645
type: Answer
has comment: http://stackoverflow.com/comment/33944119
has comment: http://stackoverflow.com/comment/33944095
has comment: http://stackoverflow.com/comment/33944041
downvote count: 0
score: 1
has body: Include W|L in parentheses: (W|L) If you want to include space characters before and after the minus, add \s or a space before and after - "((W|L)\\s)?\\([1-9]*\\s-\\s[1-9]*\\)" If you already know that there will be at least one digit, use + instead of *, as * matches zero or more, whereas + matches 1 or more. The pattern given above matches with and without a W or L in front. Here's a pattern that matches with and without space around the - and with or without W or L in front. Additionally, it also captures numbers containing 0, which you excluded in your original regular expression. "((W|L)\\s)?\\(\\d+\\s?-\\s?\\d+\\)"
has comment: http://stackoverflow.com/comment/33944055
has comment: http://stackoverflow.com/comment/33943853

http://stackoverflow.com/comment/59545779
comment on: http://stackoverflow.com/a/22454966
score: 5
type: Comment
has text: Is good but the inverse not works correctly why ? view.setVisibility(View.VISIBLE); WITH alpha(1.0f), appear with 100 padding top ...
type: AnswerComment

http://stackoverflow.com/q/22454650
has title: How do I call on information entered into a dialogue box as part of action listener?
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22454750
has comment: http://stackoverflow.com/comment/34153742
has body: I have an action listener attached to a JButton in my program. When the button is clicked, a dialogue box opens that requests the user to enter a number, then click ok. This part works fine, what I am having trouble doing is calling upon that number that the user has entered to use as part of an if statement. Could someone please tell me how I call upon this number that the user has enterd, here is my code so far. public void actionPerformed(ActionEvent e) { if (e.getSource() == t1) { String Message = "Enter an Amount "; String number = JOptionPane.showInputDialog(null, Message, JOptionPane.QUESTION_MESSAGE); } if () { // ideally here i would want to say if the user number is bigger // than 0 then do this... } } after the changes my code now looks like this public void actionPerformed(ActionEvent e) { if (e.getSource() == t1) { String Message = "Enter an Amount "; String number = JOptionPane.showInputDialog(null, Message, JOptionPane.QUESTION_MESSAGE); if(Integer.valueOf(number) &gt; 0) { String s = a.gettext(); getContentPane().removeAll(); repaint(); new TaxiFrame(Integer.parseInt(s)); } else{} } else{} } }
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22454750
favorite count: 0

http://stackoverflow.com/q/22485790
tagged with: nexus
type: UnansweredQuestion
tagged with: maven
tagged with: deployment
has title: Specifying an explicit type for maven deploy
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: izpack
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22486209
has body: I am using the IzPack-maven-plugin with its own "izpack-jar" packaging type to create an installer artifact. The plugin creates this artifact locally as a .jar file, but deploys it as type izpack-jar. Therefore it will get an .izpack-jar extension when fetching that artifact from nexus. In code of the plugin contains the following lines: project.getArtifact().setFile(jarFile); [...] file = new File(outputDirectory, finalName + localClassifier + ".jar"); The second one creates the file explicitly as a .jar file and the first one simply sets this file as the main artifact. Is it generally possible to build an artifact with one packaging type but deploy it with another type?
favorite count: 0

http://stackoverflow.com/q/22364347
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/33995390
has body: I am working on an Android application using SQLite, and I have a Contract class defined for my table and column names, suggested per the Android developer tutorial. I have run into some strange behavior where an extra set of enclosing quotes is being added to all of my Strings in this contract. eg: public final class Contract { public Contract() {}; public static abstract class TABLE_Entry implements BaseColumns { public static final String COLUMN_NAME_TIMESTAMP = "timestamp"; } } The problem is that when I am debugging this application, the string COLUMN_NAME_TIMESTAMP is a String with the value ""timestamp"", with a length of 11 and where the first and last characters are double quotes, rather than simply "timestamp" (length of 9, no quotes in string). This works fine when used in SQL statements, but I would like to be able to use these String elsewhere. I have already implemented a workaround, but I want to know why this is occurring in the first place.
answer count: 0
has title: Extra quotes appearing in Java String at runtime
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33995633
has comment: http://stackoverflow.com/comment/33995267
type: Question
has comment: http://stackoverflow.com/comment/34027249
tagged with: java
tagged with: string

http://stackoverflow.com/a/22482681
has body: You should look at the format function for SimpleDateFormat A quick example would be public final static String getConvertedDate(String userDate) { DateFormat userFormat = new SimpleDateFormat(MM-dd-yyyy); DateFormat neededFormat = new SimpleDateFormat(yyyy-MM-dd); // Turn the String of the userDate into a date with the first format Date formatUserDate = userFormat.parse(userDate); // Now format that date into the correct format you want to return return neededFormat.format(formatUserDate); }
answers question: http://stackoverflow.com/q/22482558
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34201349
score: 1
has comment: http://stackoverflow.com/comment/34201256
upvote count: 1

http://stackoverflow.com/a/22368134
answers question: http://stackoverflow.com/q/22368050
has comment: http://stackoverflow.com/comment/34004046
has body: a simply search for a java echo server shows this public class EchoServer { public static void main(String[] args) throws Exception { // create socket int port = 4444; ServerSocket serverSocket = new ServerSocket(port); System.err.println("Started server on port " + port); // repeatedly wait for connections, and process while (true) { // a "blocking" call which waits until a connection is requested Socket clientSocket = serverSocket.accept(); System.err.println("Accepted connection from client"); // open up IO streams In in = new In (clientSocket); Out out = new Out(clientSocket); // waits for data and reads it in until connection dies // readLine() blocks until the server receives a new line from client String s; while ((s = in.readLine()) != null) { out.println(s); } // close IO streams, then socket System.err.println("Closing connection with client"); out.close(); in.close(); clientSocket.close(); } } } see http://introcs.cs.princeton.edu/java/84network/EchoServer.java.html
has comment: http://stackoverflow.com/comment/34004111
has comment: http://stackoverflow.com/comment/34142892
has comment: http://stackoverflow.com/comment/34004094
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34003939

http://stackoverflow.com/q/22419332
type: Question
has body: In my current project, I am trying to transmit a string from one computer to another, and after finding and learning from numerous examples I have managed to get a basic form of communication working. The issue I am having is if one computer tries sending a message that is too long, it seems to get broken up into multiple parts (roughly 3700 characters), and my parsing method fails. I am using a Selector to iterate through all of the channels. Here is the relevant code: if(key.isReadable()) { // Get the channel and read in the data SocketChannel keyChannel = (SocketChannel)key.channel(); ByteBuffer buffer = buffers.get(keyChannel); int length = 0; try { length = keyChannel.read(buffer); } catch ( IOException ioe) { closeChannel(keyChannel); } if(length &gt; 0) { buffer.flip(); // Gather the entire message before processing while( buffer.remaining() &gt; 0) { byte[] data = new byte[buffer.remaining()]; buffer.get(data); fireReceiveEvent(keyChannel, data);//Send the data for processing } buffer.compact(); } else if (length &lt; 0) { closeChannel(keyChannel); } } How can I guarantee that the entire message (regardless of length) is read at once before passing it along?
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/34090725
has comment: http://stackoverflow.com/comment/34090776
accepted answer: http://stackoverflow.com/a/22429280
tagged with: sockets
has title: Java SocketChannel Read Entire String
type: AnsweredQuestion
tagged with: network-programming
has answer: http://stackoverflow.com/a/22429280
tagged with: java

http://stackoverflow.com/q/22347101
answer count: 1
has answer: http://stackoverflow.com/a/22347363
accepted answer: http://stackoverflow.com/a/22347363
has title: pass parameters via http post method
has body: I have two text boxes, 1 for username and the other for password. I wanted to pass what the user enters into the edit texts with the post method String request = "https://beta135.hamarisuraksha.com/web/webservice/HamariSurakshaMobile.asmx/getIMSafeAccountInfoOnLogon"; URL url; try { url = new URL(request); HttpURLConnection connection = (HttpURLConnection) url .openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setInstanceFollowRedirects(false); connection.setRequestMethod("POST"); connection.setRequestProperty("Connection", "Keep-Alive"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;");// boundary="+CommonFunctions.boundary connection.setUseCaches(false); DataOutputStream wr = new DataOutputStream( connection.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); int responseCode = connection.getResponseCode(); /* * System.out.println("\nSending 'POST' request to URL : " + * url); System.out.println("Post parameters : " + * urlParameters); */ System.out.println("Response Code : " + responseCode); InputStream errorstream = connection.getErrorStream(); BufferedReader br = null; if (errorstream == null) { InputStream inputstream = connection.getInputStream(); br = new BufferedReader(new InputStreamReader(inputstream)); } else { br = new BufferedReader(new InputStreamReader(errorstream)); } String response = ""; String nachricht; while ((nachricht = br.readLine()) != null) { response += nachricht; } // print result // System.out.println(response.toString()); return response.toString(); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (ProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } }
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
tagged with: http-post

http://stackoverflow.com/q/22400599
has comment: http://stackoverflow.com/comment/34057071
tagged with: spring
possible better answer: http://stackoverflow.com/a/22400779
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22400779
tagged with: java
has comment: http://stackoverflow.com/comment/34057131
has answer: http://stackoverflow.com/a/22400851
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/22400712
tagged with: tomcat
has title: Application startup difference eclipse and tomcat?
score: 0
accepted answer: http://stackoverflow.com/a/22400712
answer count: 3
has body: When I develop my application I start it on a tomcat from within eclipse. Everyhing runs fine. But when I deployed the war file to tomcat and use the startup.bat of tomcat, I'm constantly getting java.lang.OutOfMemoryError: Java heap space error. This occurs during creating of Spring @Bean definitions. It also takes very much time to start at all. Why is there obviously a difference between starting the app from eclipse and manually in tomcat? And how can I solve this?
has comment: http://stackoverflow.com/comment/34057459
tagged with: deployment

http://stackoverflow.com/q/22458278
tagged with: google-compute-engine
has body: i write a code to create instance in GCE using java API but this code does not work i get the following error 403 Forbidden { "code" : 403, "errors" : [ { "domain" : "global", "message" : "Insufficient Permission", "reason" : "insufficientPermissions" } ], "message" : "Insufficient Permission" } my code is posted bellow does it has any error or does it need any library to import please help me the library that i import are import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp; import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.util.store.DataStoreFactory; import com.google.api.client.util.store.FileDataStoreFactory; import com.google.api.services.compute.Compute; import com.google.api.services.compute.ComputeScopes; import com.google.api.services.compute.model.Instance; import com.google.api.services.compute.model.InstanceList; import com.google.api.services.compute.model.NetworkInterface; import com.google.api.services.compute.model.Operation; import com.google.api.services.compute.model.Zone; import com.google.api.services.compute.model.ZoneList; private static void createInstance(String projectId, JsonFactory jsonFactory,Compute compute) throws IOException { Instance instance = new Instance(); instance.setFactory(jsonFactory); // Select a machine type. String machine = "https://www.googleapis.com/compute/v1/projects/hindproj/global/machineTypes/n1-standard-1"; instance.setMachineType(machine); // Get a name from the user. String name = "v1"; instan…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/36407059
upvote count: 1
type: Question
tagged with: api
has title: insert new instance using API of GCE
has comment: http://stackoverflow.com/comment/36574461
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23506050
type: UnansweredQuestion

http://stackoverflow.com/q/22347651
has comment: http://stackoverflow.com/comment/33965955
favorite count: 0
tagged with: android-asynctask
tagged with: android
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22347965
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33965646
upvote count: 1
has body: I have MainActivity class and separate AsyncTask class, which i am executing from my main activity class. I am trying to display dialog box on Main Activity layout which should be called from AsyncTask class onPreExecute method. I am trying to implement this code, no dialog box is showing on main layout and app stops. plz help :) here is what code looks like MainActivity class public class MainActivity extends Activity implements LoginResponse { public static Context context_main; LoginThread login = new LoginThread(context_main); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); login.execute(); } . . . } and LoginThread Class public class LoginThread extends AsyncTask<Void, Void, RequestToken> { . . . public LoginThread(Context context) { this.context= context; } protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(context); pDialog.setMessage(Html.fromHtml("Logging In Please wait...")); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } . . . } this is logcat msgs 03-12 15:02:10.838: E/Error(32517): I got error 03-12 15:02:10.838: E/Error(32517): java.lang.NullPointerException 03-12 15:02:10.838: E/Error(32517): at android.app.AlertDialog.resolveDialogTheme(AlertDialog.java:143) 03-12 15:02:10.838: E/Error(32517): at android.app.AlertDialog.<init>(AlertDialog.java:98) 03-12 15:02:10.838: E/Error(32517): at android.app.ProgressDialog.<init>(ProgressDialog.java:77) 03-12 15:02:10.838: E/Error(32517): at pack.locationinfo.LoginThread.onPreExecute(LoginThread.java:87) 03-12 15:02:10.838: E/Error(32517): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586) 03-12 15:02:10.838: E/Error(32517): at android.os.AsyncTask.execute(AsyncTask.java:534) 03-12 15:02:10.838: E/Error(32517): at pack.locationinfo.MainActivity.TwitterLogin(MainActivity.java:53) 03-12 15:02:10.838: E/Error(32517): at java.lang.reflect.Method.invokeNative(Na…
has answer: http://stackoverflow.com/a/22348115
type: Question
has title: Dialogbox not displaying on MainActivity called from AsyncTask class
has answer: http://stackoverflow.com/a/22347912
accepted answer: http://stackoverflow.com/a/22347912
has comment: http://stackoverflow.com/comment/33966177
has comment: http://stackoverflow.com/comment/33967003
possible better answer: http://stackoverflow.com/a/22347965
downvote count: 0
has answer: http://stackoverflow.com/a/22348136
has comment: http://stackoverflow.com/comment/33965791

http://stackoverflow.com/q/22350728
has body: Working on my first java swt program and I am having trouble, possibly a stupidity issue! I am trying to create a basic network program to listen for connections, i have a button and I want to start the socket then change a label to display " server listening" or whatever Here is the button Button startServerBtn = new Button(shlChattybox, SWT.NONE); startServerBtn.addSelectionListener(new SelectionAdapter() { ServerSocket serversocket = new ServerSocket(PORT); Can I not change the text of a label here ?? serverStatusLbl2.setText("listening!"); public void widgetSelected(SelectionEvent e) { } }); startServerBtn.setFont(SWTResourceManager.getFont("Segoe UI", 16, SWT.BOLD)); startServerBtn.setBounds(53, 63, 260, 75); startServerBtn.setText("Start Server"); listeningPortTxt = new Text(shlChattybox, SWT.BORDER); listeningPortTxt.setBounds(143, 26, 76, 21); Label listeningPortLbl = new Label(shlChattybox, SWT.NONE); listeningPortLbl.setBounds(53, 29, 84, 15); listeningPortLbl.setText("Listening Port: "); Label serverStatusLbl1 = new Label(shlChattybox, SWT.NONE); serverStatusLbl1.setBounds(53, 157, 84, 15); serverStatusLbl1.setText("Server Status:");
linked to: http://stackoverflow.com/q/4732544
accepted answer: http://stackoverflow.com/a/22351705
tagged with: sockets
type: AnsweredQuestion
tagged with: java
tagged with: swt
type: Question
has comment: http://stackoverflow.com/comment/34003301
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22351705
has title: changing label text in java swt

http://stackoverflow.com/a/22418962
has body: If I'm understanding this correctly, you're trying to extract data from ALL tags that exist within your XML fragment. There are multiple solutions to this. I'm listing them below: XPath: If you know exactly what your XML structure is, you can employ XPath for each node=CRAWL to find data within tags: // Instantiate XPath variable XPath xpath = XPathFactory.newInstance().newXPath(); // Define the exact XPath expressions you want to get data for: XPathExpression name = xpath.compile("//top/CRAWL/NAME/text()"); XPathExpression price = xpath.compile("//top/CRAWL/PRICE/text()"); XPathExpression desc = xpath.compile("//top/CRAWL/DESC/text()"); XPathExpression prod_img = xpath.compile("//top/CRAWL/PROD_IMG/text()"); XPathExpression url = xpath.compile("//top/CRAWL/URL/text()"); At this point, each of the variables above will contain the data for each of the tags. You could drop this into an array for each where you will have all the data for each of the tags in all elements. The other (more efficient solution) is to have the data stored by doing DOM based parsing: // Instantiate the doc builder DocumentBuilder xmlDocBuilder = domFactory.newDocumentBuilder(); Document xmlDoc = xmlDocBuilder.parse("xmlFile.xml"); // Create NodeList of element tag "CRAWL" NodeList crawlNodeList = xmlDoc.getElementsByTagName("CRAWL"); // Now iterate through each item in the NodeList and get the values of // each of the elements in Name, Price, Desc etc. for (Node node: crawlNodeList) { NamedNodeMap subNodeMap = node.getChildNodes(); int currentNodeMapLength = subNodeMap.getLength(); // Get each node's name and value for (i=0; i&lt;currentNodeMapLength; i++){ // Iterate through all of the values in the nodeList, // e.g. NAME, PRICE, DESC, etc. // Do something with these values } } Hope this helps!
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22372000
answers question: http://stackoverflow.com/q/22372000
type: Answer
has comment: http://stackoverflow.com/comment/76577429
upvote count: 2

http://stackoverflow.com/a/22451174
has comment: http://stackoverflow.com/comment/34146929
has comment: http://stackoverflow.com/comment/34146902
has comment: http://stackoverflow.com/comment/34147652
score: 0
accepted answer of: http://stackoverflow.com/q/22451133
has comment: http://stackoverflow.com/comment/34147005
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22451133
type: Answer
has body: Change this line of code, android:name="info.androidhive.googlemapsv2.MainActivity" to: android:name="info.androidhive.info.MainActivity" because package name is package info.androidhive.info; Remove: class="com.google.android.gms.maps.SupportMapFragment"

http://stackoverflow.com/comment/34019162
has text: By the way, what have you tried so far ?
type: Comment
comment on: http://stackoverflow.com/q/22379182
type: QuestionComment
score: 1

http://stackoverflow.com/a/22362308
accepted answer of: http://stackoverflow.com/q/22361957
type: Answer
has comment: http://stackoverflow.com/comment/33991611
has comment: http://stackoverflow.com/comment/33991956
has body: public static void main(String[] args) { int size; int tineminte = 0; Scanner input = new Scanner(System.in); System.out .println("Input number of bits:"); size = input.nextInt(); int counter = 0; Vector&lt;Integer&gt; A = new Vector&lt;Integer&gt;(); System.out.println("Input First number in binary"); while (counter &lt; size) { A.add(counter, input.nextInt()); counter++; } System.out.println("First number in binary (output):"); for (counter = 0; counter &lt; size; counter++) System.out.println(A.elementAt(counter)); counter = 0; Vector&lt;Integer&gt; B = new Vector&lt;Integer&gt;(); System.out.println("Input second number in binary:"); while (counter &lt; size) { B.add(counter, input.nextInt()); counter++; } System.out.println("Second number in binary (output):"); for (counter = 0; counter &lt; size; counter++) System.out.println(B.elementAt(counter)); Vector&lt;Integer&gt; C = new Vector&lt;Integer&gt;(); counter = size - 1; while (counter != -1) { if (A.elementAt(counter) == 1 &amp;&amp; B.elementAt(counter) == 0) { if (tineminte == 1) C.add(0); else C.add(1); counter--; } else if (A.elementAt(counter) == 0 &amp;&amp; B.elementAt(counter) == 1) { if (tineminte == 1) { C.add(0); } else C.add(1); counter--; } else if (A.elementAt(counter) == 0 &amp;&amp; B.elementAt(counter) == 0) { if (tineminte == 1) { tineminte = 0; C.add(1); } else C.add(0); counter--; } else if (A.elementAt(counter) == 1 &amp;&amp; B.elementAt(counter) == 1) { if (tineminte == 1) { C.add(1); } else C.add(0); tineminte = 1; counter--; } } // You forgot the last bit if (tineminte==1) C.add(1); System.out.println("Suma:"); for(int i=C.size()-1;i&gt;=0;i--) { System.out.println(C.elementAt(i)); } } Note: I've tried to change only the necessary parts of your code.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33991959
has comment: http://stackoverflow.com/comment/33992031
has comment: http://stackoverflow.com/comment/33991895
has comment: http://stackoverflow.com/comment/33992060
has comment: http://stackoverflow.com/comment/33991720
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22361957

http://stackoverflow.com/a/22427468
has comment: http://stackoverflow.com/comment/34112029
type: Answer
accepted answer of: http://stackoverflow.com/q/22424471
answers question: http://stackoverflow.com/q/22424471
has comment: http://stackoverflow.com/comment/34108845
upvote count: 3
has comment: http://stackoverflow.com/comment/34113057
score: 3
has body: Your error is caused by (SessionFactory) new InitialContext().lookup("SessionFactory"). Since you're using spring framework, I would recommend you to go with the IoC approach instead of using InitialContext. =) To use SessionFactory, you need to initialise this class with several properties, such as the dataSource, hibernateProperties, entities, etc.. And it is usually done either with the XML or Annotation-Driven approach. You would configure SessionFactory and let it live in your IoC container, then inject it into your UsuarioHome class. http://www.javacodegeeks.com/2013/05/hibernate-3-with-spring.html The above link show both methods (XML and Annotation). Trying following it and set up beans. =D UPDATE: This mkyong's tutorial contains step-by-step tutorial and pretty clear as well! http://www.mkyong.com/spring/maven-spring-hibernate-mysql-example/
has comment: http://stackoverflow.com/comment/34117626
has comment: http://stackoverflow.com/comment/34122900
has comment: http://stackoverflow.com/comment/34119630
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22355328
tagged with: arrays
has body: I'm trying to parse the json data that I get back from lastfm. The method I'm interested in is album.search The documentation requires there to be a search term for the album name, and an api key, which I've done here: String api_key = "x"; String url = "http://ws.audioscrobbler.com/2.0/?method=album.search" + "&amp;album=" + query + "&amp;apikey=" + api_key + "&amp;format=json"; Then my issue was trying to iterate through the json data so I can get to the value that I wanted, in my case, name, so I made an array to loop through the json file. boolean error = false; HttpClient httpclient = null; try { httpclient = new DefaultHttpClient(); HttpResponse data = httpclient.execute(new HttpGet(url)); HttpEntity entity = data.getEntity(); String result = EntityUtils.toString(entity, "UTF8"); for ( int i = 0; i &lt; results.length(); i++) { JSONObject row = new JSONObject(result); albummatches = row.getString("albummatches"); album = row.getString("album"); name = row.getString("name"); results.getJSONObject(i).get("album"); I have this method which returns results. public JSONArray getResults() { return results; } Now in my other class, I'm trying to attach the name of the album to my adapter list view through this method. public void ServiceComplete(AbstractService service) { if (!service.hasError()) { AlbumSearchService albumService = (AlbumSearchService)service; String[] result = new String[albumService.getResults().length()]; for (int i = 0; i &lt; albumService.getResults().length(); i++) { try{ result[i] = albumService.getResults().getJSONObject(i).getString("name"); } catch (JSONException ex) { result[i] = "Error"; } } setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.album_list_cell, R.id.text, result)); } But unfortunately, when I try to run the app, and search for an album, it just stays stuck on 'searching...', and doesn't display any results in my list view. I don't know where I'm going wrong :( Help someone!
score: 0
has comment: http://stackoverflow.com/comment/33980208
has title: Parsing issue with json
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33979732
has comment: http://stackoverflow.com/comment/33979823
type: Question
has comment: http://stackoverflow.com/comment/33979604

http://stackoverflow.com/comment/34098334
comment on: http://stackoverflow.com/a/22424046
has text: Nope.. extends `Activity`..have i to extends FragmentActivity in any case?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22446516
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22446435
downvote count: 0
has body: You can use ArrayList#removeAll(Collection c), e.g. items.removeAll(addedItems). If you want it to run faster, make a HashSet from one collection, then call its removeAll() method.
type: Answer

http://stackoverflow.com/comment/34225613
has text: Im still not quite understanding how the the UTF-8 values for each character in "test", 116,101,115,116 respectively come together to form 1952805748?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22433021

http://stackoverflow.com/a/22346479
has comment: http://stackoverflow.com/comment/33990640
answers question: http://stackoverflow.com/q/22346306
score: 0
has comment: http://stackoverflow.com/comment/33963811
upvote count: 1
has body: Try something like this: BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter loop value"); String a[] = new String[Integer.parseInt(br.readLine())]; for (int i = 0; i &lt; a.length; i++) { a[i] = br.readLine(); }
downvote count: 1
has comment: http://stackoverflow.com/comment/33963777
type: Answer
has comment: http://stackoverflow.com/comment/33963566
has comment: http://stackoverflow.com/comment/33963939
has comment: http://stackoverflow.com/comment/33990880
has comment: http://stackoverflow.com/comment/33963734

http://stackoverflow.com/q/22380201
answer count: 1
has title: Shell script to run multiple jar files
tagged with: unix
favorite count: 0
has comment: http://stackoverflow.com/comment/34021396
has answer: http://stackoverflow.com/a/22380670
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34022542
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34026208
has body: I have created three jar files (SSS_Infinite.jar, SSS_Lwindow.jar, SSS_LwindowExe.jar) as part of requirement. Need to design a shell script to run all three in a single one sequentially. Can you please help on this, i dont find any help for executign multiple jar files in a single shell script. Regards, Vidhya C
score: 0

http://stackoverflow.com/q/22390818
has answer: http://stackoverflow.com/a/74455280
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34041761
linked to: http://stackoverflow.com/q/6120831
has comment: http://stackoverflow.com/comment/34041677
tagged with: java
accepted answer: http://stackoverflow.com/a/22390941
has comment: http://stackoverflow.com/comment/34040728
possible better answer: http://stackoverflow.com/a/49878025
has answer: http://stackoverflow.com/a/49878025
type: Question
has comment: http://stackoverflow.com/comment/34142917
upvote count: 5
has comment: http://stackoverflow.com/comment/34041721
has comment: http://stackoverflow.com/comment/34041594
tagged with: tomcat6
has comment: http://stackoverflow.com/comment/34041651
has comment: http://stackoverflow.com/comment/131435927
answer count: 3
score: 5
has comment: http://stackoverflow.com/comment/34050791
downvote count: 0
has comment: http://stackoverflow.com/comment/34041003
tagged with: tomcat
favorite count: 0
has body: Is there any mechanism, lifecycle event or callbacks, in Spring or Tomcat to notify once Tomcat server startup is completed? (I have 8 web applications and queues configured. I would prefer to get notification back to each application once all the applications are started.) I know Spring has the application listener, which can be used once the web application is initialized. But I cannot use it in my case because I would prefer to get a notification once all the web apps are initialized. EDITED* I've implemented a Tomcat listener to log the message, but I have absolutely no idea where to hook this listener. I tried to create this bean using Spring and also adding the listener to web.xml both did not work. Here is my code: public class KPTomcatListener implements LifecycleListener { private static final Logger LOG = LoggerFactory.getLogger(KPTomcatListener.class); /** * All the events of tomcat * See: https://tomcat.apache.org/tomcat-10.0-doc/api/constant-values.html * AFTER_DESTROY_EVENT "after_destroy" * AFTER_INIT_EVENT "after_init" * AFTER_START_EVENT "after_start" * AFTER_STOP_EVENT "after_stop" * BEFORE_DESTROY_EVENT "before_destroy" * BEFORE_INIT_EVENT "before_init" * BEFORE_START_EVENT "before_start" * BEFORE_STOP_EVENT "before_stop" * CONFIGURE_START_EVENT "configure_start" * CONFIGURE_STOP_EVENT "configure_stop" * PERIODIC_EVENT "periodic" * START_EVENT "start" * STOP_EVENT "stop" */ private static int counter; @Override public void lifecycleEvent(LifecycleEvent arg0) { String event = arg0.getType(); LOG.debug("Tomcat Events: " + (++counter) + " :: " + event); if(event.equals(org.apache.catalina.Lifecycle.AFTER_START_EVENT)) { // or "after_start" LOG.debug("Hey I've started"); } } }
has title: Callback on Tomcat server startup complete
tagged with: spring
has answer: http://stackoverflow.com/a/22390941

http://stackoverflow.com/q/22412719
has comment: http://stackoverflow.com/comment/34079034
accepted answer: http://stackoverflow.com/a/22413401
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22413465
tagged with: arrays
has answer: http://stackoverflow.com/a/22413465
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/34078879
has comment: http://stackoverflow.com/comment/34078949
has body: I've started a little side project to learn how to extract web data and learn how to use tables with Java. First time working with tables and 2D arrays so I may be going about this the wrong way.. I am trying to extract data from a site and input it into a table and so far I have been able to get the data. I input the data into a single string separated by commas and new lines(csv) called scheduleCsv Sun 02-16-14 09:45 PM,1,REAL TIRED,JUST WACK AT IT,2 - 4, Sun 02-23-14 08:10 PM,1,BALLERS,REAL TIRED,4 - 11, Sun 03-02-14 09:00 PM,1,REAL TIRED,EL TRI,1 - 7, Sun 03-09-14 05:50 PM,1,GO GO POWER RANGERS,REAL TIRED,4 - 9, Sun 03-16-14 06:40 PM,1,REAL TIRED,GAME OF GROANS, Sun 03-23-14 09:00 PM,1,HUNGOVER HAT TRICKS,REAL TIRED, Sun 03-30-14 07:25 PM,1,REAL TIRED,PRESTIGE WORLD WIDE, Sun 04-06-14 04:20 PM,1,REAL TIRED,BALLERS, Is it possible to input this data into a JTable? I have tried a few different methods from searching around and so far have been unsuccessful. I have another array the specifies column names String[] columnNames = {"Date","Field", "Home Team","Visitor Team", "Score"}; and my table is set up as so final JTable scheduleTable = new JTable(data,columnNames); I believe the "data" should be a 2D array..?
has title: How to convert data into 2D Array to put into a table
tagged with: swing
has answer: http://stackoverflow.com/a/22413401
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22429774
has comment: http://stackoverflow.com/comment/34108737
has comment: http://stackoverflow.com/comment/34108593
accepted answer: http://stackoverflow.com/a/22429938
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/52708931
has comment: http://stackoverflow.com/comment/34108723
favorite count: 0
has body: In my module xml file I have this: &lt;module rename-to="UIGenerator"&gt; &lt;inherits name="com.google.gwt.http.HTTP" /&gt; &lt;inherits name="com.google.gwt.xml.XML" /&gt; &lt;inherits name="com.google.gwt.i18n.I18N" /&gt; &lt;inherits name="com.google.gwt.i18n.CldrLocales" /&gt; &lt;set-configuration-property name="locale.useragent"value="Y" /&gt; &lt;extend-property name="locale" values="de" /&gt; &lt;extend-property name="locale" values="fr" /&gt; &lt;set-property name="locale" value="de, fr" /&gt; &lt;set-property-fallback name="locale" value="de" /&gt; &lt;entry-pointclass="mypackage.UIGeneratorEntryPoint" /&gt; &lt;/module&gt; But every time when I try to use locales it returns me default one which is English. LocaleInfo.getAvailableLocaleNames(); this return Array of String with only one value - default IF I set It works but only for German without others! Thank you in advance!
type: Question
has answer: http://stackoverflow.com/a/22429841
score: 3
possible better answer: http://stackoverflow.com/a/22429841
upvote count: 3
has title: Setting locales in gwt.xml do not work
answer count: 3
has comment: http://stackoverflow.com/comment/34108816
tagged with: gwt
linked to: http://stackoverflow.com/q/22408685
tagged with: java
has answer: http://stackoverflow.com/a/22429938

http://stackoverflow.com/comment/34066304
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22406127
has text: http://codereview.stackexchange.com/

http://stackoverflow.com/comment/62787141
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/33331557
type: Comment
has text: I have tried this with SBT but it doesn't seem to work. Did you ever do this with SBT?

http://stackoverflow.com/comment/33935139
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22329798
score: 0
has text: That's extremely odd. I can reproduce it every time as the above output on my machine.

http://stackoverflow.com/q/22480470
tagged with: jena
tagged with: pagination
score: 0
linked to: http://stackoverflow.com/q/19537789
has title: Write to Jena RDF model through pagination
answer count: 1
tagged with: outputstream
tagged with: http://stackoverflow.com/tag/rdf
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22481800
has body: I intend to convert the data in an SQL database into an RDF dump. I have a model and an ontology defined. Model model = ModelFactory.createDefaultModel(); OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM, model); The ontModel has many classes defined in it. Now let us suppose I have 10000 records in my SQL db and I want to load them into the model and write it into a file. However, I want to paginate in case of a memory overflow. int fromIndex = 0; int toIndex = 10; while(true) { //1. get resources between fromIndex to toIndex from sql db // if no more resources 'break' //2. push these resources in model //3. write the model to a file RDFWriter writer = model.getWriter(); File file = new File(file_path); FileWriter fileWriter = new FileWriter(file, true); writer.write(this.model, fileWriter, BASE_URL); model.close(); from = to+1; to = to+10; } Now, how does one append the new resources to the existing resources in the file. Because currently I see the ontology getting written twice and it throws an exception org.apache.jena.riot.RiotException: The markup in the document following the root element must be well-formed. Is there a way to handle this already?
tagged with: java
type: Question

http://stackoverflow.com/comment/33966985
score: 0
has text: @Jorge_B JDBC_DRIVER = "com.mysql.jdbc.Driver" ,yes I am sure there no problem of classpath!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22347943

forms
tags question: http://stackoverflow.com/q/22349475
type: Tag
tags question: http://stackoverflow.com/q/22440864
tags question: http://stackoverflow.com/q/22421775
tags question: http://stackoverflow.com/q/22459220
tag name: forms
tags question: http://stackoverflow.com/q/22382409
tags question: http://stackoverflow.com/q/22390513

http://stackoverflow.com/comment/34120638
comment on: http://stackoverflow.com/a/22423016
has text: I am a freshman here.i don't know how to show my code professionaly Mat preFrame, curFrame; Mat T=estimateRigidTransform(preFrame,curFrame,false);
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33954481
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22341224
type: Comment
has text: I want to draw append. previos oval doesn't disappear

http://stackoverflow.com/comment/33982360
comment on: http://stackoverflow.com/a/22344392
type: Comment
has text: It is there and also the MRSearcher is in the compiled jar that resides in the /WEB-INF/lib file. Everything is public.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34166155
type: Comment
has text: Well it will have, yes, since in all methods you will have to check for nulls. So you might as well truncate the array. Look at the post edit
type: AnswerComment
comment on: http://stackoverflow.com/a/22461237
score: 0

http://stackoverflow.com/q/22476325
has answer: http://stackoverflow.com/a/22524503
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: input
tagged with: drawing
tagged with: java
has body: Hello I was given an assignment in which I have to draw 3 circles using their center coordinates and radii which is input by the user. The assignment specifically states that I must input the center and radius, I cannot input the x and y coordinates separately. They must be input as a coordinate pair (x,y). Here is my code. import java.util.*; import java.awt.*; public class Circles { static Scanner CONSOLE = new Scanner(System.in); public static final int PANEL_HEIGHT = 300; public static final int PANEL_WIDTH = 400; public static void main (String [] args) { DrawingPanel panel = new DrawingPanel (PANEL_HEIGHT,PANEL_WIDTH); Graphics g = panel.getGraphics(); System.out.println(); System.out.println("Red Circle data"); System.out.println("Input center of Red circle: "); int center1 = CONSOLE.nextInt(); System.out.println("Input radius of Red circle: "); int radius1 = CONSOLE.nextInt(); System.out.println(); System.out.println("Blue Circle data"); System.out.println("Input center of Blue circle: "); int center2 = CONSOLE.nextInt(); System.out.println("Input radius of Blue circle: "); int radius2 = CONSOLE.nextInt(); System.out.println(); System.out.println("Green Circle data"); System.out.println("Input center of Green circle: "); int center3 = CONSOLE.nextInt(); System.out.println("Input radius of Green circle: "); int radius3 = CONSOLE.nextInt(); g.setColor(Color.RED); g.fillOval(center1 -radius1 ,center1-radius1 ,radius1 ,radius1); g.setColor(Color.BLUE); g.fillOval(center2 -radius2 ,center2-radius2 ,radius2 ,radius2); g.setColor(Color.GREEN); g.fillOval(center3 -radius3 ,center3-radius3 ,radius3 ,radius3); } } My problem is that I don't know how to properly input and store the x and y coordinates as one int. As it is currently it just takes one data point, stores it, and uses it as both x and y. System.out.println("Red Circle data"); System.out.println("Input center of Red circle: "); int center1 = CONSOLE.nextInt(); Here is where I know java must ask for the valu…
has title: Regarding input for creating circles using center coordinates
type: Question
tagged with: graphics
tagged with: arrays

http://stackoverflow.com/comment/34137478
type: QuestionComment
has text: possible duplicate of [Saving Activity state in Android](http://stackoverflow.com/questions/151777/saving-activity-state-in-android)
comment on: http://stackoverflow.com/q/22445522
score: 0
type: Comment

http://stackoverflow.com/comment/34098400
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22423967
type: Comment
has text: Why do you need to have two separate forms on the same JSP here?

http://stackoverflow.com/a/30778880
has body: java.net.BindException: Address already in use: JVM_Bind You get this error because on the mentioned port there is already one server running. May be you run your code again without stopping the server you started it at first instance.
type: Answer
answers question: http://stackoverflow.com/q/22480748
score: 0

http://stackoverflow.com/comment/34173323
score: 0
has text: I can see nothing wrong with the way you are inserting records Perhaps the issue is in the way they are being displayed?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22466171

http://stackoverflow.com/comment/33971217
type: Comment
comment on: http://stackoverflow.com/q/22350903
has text: Ideally you should not be interfering with tests that run on a browser. Dedicate a separate machine for your tests to run.
score: 0
type: QuestionComment

http://stackoverflow.com/a/22366884
has body: Call, JFrame#pack, it will pack the frame based on the needs of the frame decorations and the preferred size of the frames content.
has comment: http://stackoverflow.com/comment/33999745
answers question: http://stackoverflow.com/q/22366853
type: Answer
accepted answer of: http://stackoverflow.com/q/22366853
upvote count: 4
score: 4
has comment: http://stackoverflow.com/comment/33999921
has comment: http://stackoverflow.com/comment/33999768
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33999650

http://stackoverflow.com/a/22443459
score: 0
answers question: http://stackoverflow.com/q/22443185
type: Answer
has body: There is no code to refer and see if you have gone out of range. Maybe you want to post your code for reference. As long as your index is not of negative value and 1 value under the length of your array, you will be within bounds of your array. For example an array of length 10, you have to minus 1 and able to call indexes between 0 - 9. for(int x=0; x &lt; yourArray.length; x++){ //this for loop will nicely loop without going out of bounds unless your //loop body contains something that will trigger the error. }

http://stackoverflow.com/comment/34205605
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22485072
has text: Next time, post only the relevant portion of code

http://stackoverflow.com/q/22454463
type: UnansweredQuestion
score: 0
tagged with: spring
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/22456568
has title: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined Using Spring 4
tagged with: hibernate-mapping
answer count: 1
has body: How to i add the entity manager factory into the my configuration xml file. ${jdbc.dialect} true create <tx:annotation-driven transaction-manager="transactionManager" />

http://stackoverflow.com/q/22450051
has body: I'm using CXF (v2.7.10) in a client that is consuming the MS Exchange Web Service (EWS). I'm finding that one of the elements returned by EWS (UniqueHash) contains characters that are invalid in XML v1.0. As I have no control over this I'm trying to use an inbound interceptor to drop the UniqueHash elements (I don't need them) like this: Map&lt;String, String&gt; inTransformMap = Collections.singletonMap( "{http://schemas.microsoft.com/exchange/services/2006/types}UniqueHash", ""); TransformInInterceptor transformInInterceptor = new TransformInInterceptor(); transformInInterceptor.setInTransformElements(inTransformMap); client.getInInterceptors().add(transformInInterceptor); I can see that the transform (TransformInInterceptor) is running nice and early (post-stream): FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@be78549 was created. Current flow: receive [PolicyInInterceptor, LoggingInInterceptor, AttachmentInInterceptor] post-stream [TransformInInterceptor, StaxInInterceptor] read [WSDLGetInterceptor, ReadHeadersInterceptor, SoapActionInInterceptor, StartBodyInterceptor] pre-protocol [MustUnderstandInterceptor] post-protocol [CheckFaultInterceptor, JAXBAttachmentSchemaValidationHack] unmarshal [DocLiteralInInterceptor, SoapHeaderInterceptor] post-logical [WrapperClassInInterceptor] pre-invoke [SwAInInterceptor, HolderInInterceptor] But even though it appears to be working as intended stepping through the code, when DocLiteralInInterceptor fires later on it throws this unmarshalling error (0x4 in this case is within the UniqueHash element I thought I'd dropped): org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character entity: expansion character (code 0x4 at [row,col {unknown-source}]: [1,2230] at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881) at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702) at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:160) at org.apache.c…
has title: How do I drop an inbound XML element with a Transform in CXF?
upvote count: 5
tagged with: java
possible better answer: http://stackoverflow.com/a/52067215
has answer: http://stackoverflow.com/a/22468481
has answer: http://stackoverflow.com/a/52067215
type: Question
linked to: http://stackoverflow.com/q/4237625
answer count: 2
score: 5
downvote count: 0
favorite count: 0
tagged with: exchangewebservices
accepted answer: http://stackoverflow.com/a/22468481
tagged with: http://stackoverflow.com/tag/xml
tagged with: web-services
type: AnsweredQuestion
tagged with: cxf

http://stackoverflow.com/a/22516080
has comment: http://stackoverflow.com/comment/34804950
has comment: http://stackoverflow.com/comment/34804916
has comment: http://stackoverflow.com/comment/34805438
answers question: http://stackoverflow.com/q/22429483
has body: I realize you're asking for a solution using JAXB, but I would urge you to consider an RDF-based solution as it is more flexible and robust. You're basically trying to reinvent what RDF parsers already have built in. RDF/XML is a difficult format to parse, it doesn't make much sense to try and hack your own parsing together - especially since files that have very different XML structures can express exactly the same information: this only becomes apparent when looking at the level of the RDF. You may find that your JAXB parser workaround works on one CIM/RDF file but completely fails on another. So, here's an example of how to process your file using the Sesame RDF API. No inferencing is involved, this just parses the file and puts it in an in-memory RDF model, which you can then manipulate and query from any angle. Assuming the root element of your CIM file looks something like this: &lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:cim="http://example.org/cim/"&gt; (only a guess of course, but I need prefixes for a proper example) Then you can do the following, using Sesame's Rio RDF/XML parser: String baseURI = "http://example.org/my/file"; FileInputStream in = new FileInputStream("/path/to/my/cim.rdf"); Model model = Rio.parse(in, baseURI, RDFFormat.RDFXML); This creates an in-memory RDF model of your document. You can then simply filter-query over that. For example, to print out the properties of all resources that have _37C0E103000D40CD812C47572C31C0AD as their SubGeographicalRegion.Region: String CIM_NS = "http://example.org/cim/"; ValueFactory vf = ValueFactoryImpl.getInstance(); URI subRegion = vf.createURI(CIM_NS, "SubGeographicalRegion.Region"); URI res = vf.createURI("http://example.org/my/file#_37C0E103000D40CD812C47572C31C0AD"); Set&lt;Resource&gt; subs = model.filter(null, subRegion, res).subjects(); for (Resource sub: subs) { System.out.println("resource: " + sub + " has the f…
type: Answer
has comment: http://stackoverflow.com/comment/34804968
has comment: http://stackoverflow.com/comment/34805222
score: 0
has comment: http://stackoverflow.com/comment/34805232
has comment: http://stackoverflow.com/comment/34805116

oracle-adf
tags question: http://stackoverflow.com/q/22449216
tags question: http://stackoverflow.com/q/22371668
type: Tag
tag name: oracle-adf

http://stackoverflow.com/comment/34014839
has text: Great ! I checked and saw these Unsafe methods aren't available on android. Is there some other way to do the same on android ?
comment on: http://stackoverflow.com/a/22375491
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22443784
has comment: http://stackoverflow.com/comment/34151590
has comment: http://stackoverflow.com/comment/34151167
has comment: http://stackoverflow.com/comment/34153091
type: Answer
has body: RichardC answer gives some clue to understand the difference of execution time. I will add also that if your java code is compiled, it may benefits a lot from the predictive branching of the microprocessor, and thus make a better use of the cache memories. But the more important in my opinion is that you are not choosing the right ratio of Process/processing to evaluate the cost of process spawning. The test use 10 processes that does some significant work. I would have chosen a test where many processes are spawned (some thousands? I don't know how much threads the JVM can manage) each process doing very few things, for example this code which spawn at each step twice the number of process and wait for the deepest processes to send back the message done. With a depth of 17, which means 262143 processes in total and 131072 returned messages, it takes less than 0.5 s on my very slow PC, that is less than 2µs per process (of course the dual core dual thread should be used) -module (cascade). -compile([export_all]). test() -&gt; timer:tc(?MODULE,start,[]). start() -&gt; spawn(?MODULE,child,[self(),17]), loop(1024*128). loop(0) -&gt; done; loop(N) -&gt; receive done -&gt; loop(N-1) end. child(P,0) -&gt; P ! done; child(P,N) -&gt; spawn(?MODULE,child,[P,N-1]), spawn(?MODULE,child,[P,N-1]).
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34151320
answers question: http://stackoverflow.com/q/22440103
has comment: http://stackoverflow.com/comment/34155154
upvote count: 2

http://stackoverflow.com/comment/34094444
has text: The problematic characters are some capital letters in cyrillic. I've found the problem was in a bug of the framework stripes we're using, it didn't recognize some characters in the filename. the bug is solved in the new version of stripes 1.5.
type: Comment
comment on: http://stackoverflow.com/q/22350962
type: QuestionComment
score: 0

http://stackoverflow.com/a/22368173
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34001960
has comment: http://stackoverflow.com/comment/34001830
type: Answer
has comment: http://stackoverflow.com/comment/34002026
has comment: http://stackoverflow.com/comment/34001911
score: 10
upvote count: 11
has comment: http://stackoverflow.com/comment/34001798
has comment: http://stackoverflow.com/comment/34001814
accepted answer of: http://stackoverflow.com/q/22368120
has comment: http://stackoverflow.com/comment/34002399
has comment: http://stackoverflow.com/comment/34001992
answers question: http://stackoverflow.com/q/22368120
has comment: http://stackoverflow.com/comment/34001932
downvote count: 1
has body: You should work out your condition first (ie is your array in order), and then feed that in to your if statement. Like so... boolean isOrdered = true; for(q = 0; q &lt; 10; q++){ if (values[q]&gt;=values[q+1]){ // in order } else { // not in order isOrdered = false; break; // we have found a false, so we can quit out of the for loop } } if (isOrdered){ // do something if the array is in order; }

http://stackoverflow.com/q/22336521
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22340867
type: Question
answer count: 1
has body: This is from Hibernate Recipies book at chapter 3 first question when I am trying to run I am getting the following error Exception in thread "main" org.hibernate.MappingException: Repeated column in mapping for entity: com.fun.hibernate.auto.idgen.Order column: address (should be mapped with insert="false" update="false") Here is the code @Entity @org.hibernate.annotations.Entity(dynamicInsert=true, dynamicUpdate=true) @Table(name="ORDERS") public class Order { @Id @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="orderSequence" ) @SequenceGenerator(name="orderSequence",sequenceName="ORDERSEQ") private Long id; private Contact weekdayContact; private Contact holidayContact; public Order() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Contact getWeekdayContact() { return weekdayContact; } public void setWeekdayContact(Contact weekdayContact) { this.weekdayContact = weekdayContact; } @Embedded @AttributeOverrides({ @AttributeOverride(name="recipient",column=@Column(name ="HOLIDAY_RECIPIENT")), @AttributeOverride(name="phone",column=@Column(name ="HOLIDAY_PHONE")), @AttributeOverride(name="address",column=@Column(name ="HOLIDAY_ADDRESS")) }) public Contact getHolidayContact() { return holidayContact; } public void setHolidayContact(Contact holidayContact) { this.holidayContact = holidayContact; } } Embeddable Object @Embeddable public class Contact { private String recipient; private String phone; private String address; public Contact() { } @Column(name = "WEEKDAY_RECIPIENT") public String getRecipient() { return recipient; } public void setRecipient(String recipient) { this.recipient = recipient; } @Column(name ="WEEKDAY_PHONE") public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } @Column(name ="WEEKDAY_ADDRESS") public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } } Any ideas how to solve this??????????…
score: 0
type: UnansweredQuestion
has title: @AttributeOverrides and @Embeddable not working

http://stackoverflow.com/comment/34170704
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22463902
score: 0
has text: @NamedQueries( @NamedQuery(name="GameMap.findall", query="SELECT map FROM GameMap map")) It does work, but the List contains no Elements. The Rest works fine :)

http://stackoverflow.com/comment/34147115
type: Comment
score: 2
has text: Like [this](http://stackoverflow.com/q/4637215/230513)?
comment on: http://stackoverflow.com/q/22451389
type: QuestionComment

http://stackoverflow.com/a/22388910
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34050679
answers question: http://stackoverflow.com/q/22388079
type: Answer
accepted answer of: http://stackoverflow.com/q/22388079
has comment: http://stackoverflow.com/comment/34766443
has comment: http://stackoverflow.com/comment/34860972
has body: Want someone else to do your CS homework eh? ;) Depending on the language the exact implementation will be different (how it's stored in memory), but the general concept is the same. You have your stack memory and your heap memory, the local variables and parameters go on the stack, and whenever you new something it goes into the heap. It's called a stack because values are pushed onto it when you declare it or call a function, and popped off and they go out of scope. +--------------+ | | | | | | | | | | | | | | | | | | | | | | | | +--------------+ Stack Heap Each instance variable takes up however much memory its type does (depending on the language), the compiler adds it all up and that's the sizeof the type (à la C++). Methods go into code space and does not get newed into the object (I think for now you'll be better off to not consider this in learning about how memory is organized, just think of it as magic). So in your example: Bicycle bicycle = new Bicycle(20,10) bicycle is a reference to the heap memory address, today in most languages/systems it will cost you either 32 and 64 bits on the stack. The new allocates memory in the heap. The compiler figures out the size of Bicycle and creates assembly/machine code that allocates the amount of memory it requires. This is how the memory looks after this line: +--------------+ | | | Bicycle obj | | | |--------------| | | | | | | | | |--------------| | | | bicycle ref | | | +--------------+ Stack Heap More specifically, since the Bicycle class has two instance variables (or fields as they are called in Java) and both are ints, and an int in Java is 32 bits or 4 bytes, the size of your Bicycle object is 4 bytes * 2 fields = 8 bytes. +-------------+ | | 0| gear | | | 4| speed | | | |-------------| | | 8| | |-------------| 12| | | bicycle=0x4 | | | +--------------+ Stack Heap Time complexity to access memory is O(1). The compiler is able to figure out the exact memory address of speed, since as the second int field in …
upvote count: 37
has comment: http://stackoverflow.com/comment/34042125
score: 37
has comment: http://stackoverflow.com/comment/138659743

http://stackoverflow.com/comment/34048659
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22395138
has text: can you tell us how does your installed jre look like now ?
type: AnswerComment

http://stackoverflow.com/comment/34050920
score: 0
type: AnswerComment
type: Comment
has text: @Evgeniy Dorofeev: Thank you very much +1 :). What is the same Integer instance?
comment on: http://stackoverflow.com/a/22396591

http://stackoverflow.com/q/22371121
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22371387
tagged with: android
tagged with: java
type: Question
has body: In my app I am trying to maintain 2 database tables, but my second table does't store values but it show successfully data was store. Here is my DbHelper class, my other java class and log cat..... please help me..... import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class DbHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "sri.db"; private static final int DATABASE_VERSION = 1; public static final String TABLE_NAME = "login"; private static final String TABLE_CREATE ="CREATE TABLE " + TABLE_NAME + "(" + "_id INTEGER PRIMARY KEY AUTOINCREMENT,"+ "username TEXT NOT NULL, password TEXT NOT NULL);"; private static final String DB_ADMIN = "INSERT INTO "+TABLE_NAME+"values(1, admin, password);"; public static final String TABLE_NAME_SAVE="saveinfo"; public static final String KEY_ID="_id"; public static final String KEY_URL="surl"; public static final String KEY_UID="suid"; public static final String KEY_PASS="spassword"; public static final String SCRIPT="CREATE TABLE" + TABLE_NAME_SAVE + "(" + "_id INTEGER PRIMARY KEY AUTOINCREMENT,"+ "surl TEXT NOT NULL, suid TEXT NOT NULL, spassword TEXT NOT NULL);"; public DbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); System.out.println("In constructor"); } @Override public void onCreate(SQLiteDatabase db) { try{ //Create Database db.execSQL(TABLE_CREATE); //create admin account db.execSQL(DB_ADMIN); //System.out.println("In onCreate"); db.execSQL(SCRIPT); }catch(Exception e){ e.printStackTrace(); } } public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { onCreate(db); } SQLiteDatabase db; public Cursor getAllValues() { // TODO Auto-generated method stub SQLiteDatabase db = this.getWritableDatabase(); String[] clumns={KEY_ID,KEY_URL,KEY_UID,KEY_PASS}; return db.query(TABLE_NAME_SAVE, clumns, null, null, null, null, null); } void dele…
score: 0
has title: Maintain 2 database tables in single Dbhelper class
answer count: 1

http://stackoverflow.com/q/22362001
type: Question
has body: Say I have an object @AllArgsConstructor class Foo { String name; int age; } public static void main() { List&lt;Foo&gt; fooList = new ArrayList&lt;Foo&gt;(); ... populate list... List&lt;String&gt; filteredByName = getFilteredList(fooList); } public List&lt;String&gt; getFilteredList(List&lt;Foo&gt; fooList) { List&lt;String&gt; nameList = new ArrayList&lt;String&gt;(); for(Foo foo : fooList) { if("someword".isGreaterThan(foo.getName()) { nameList.add(foo.getName()); } } } I'd like to have a one line representation of getFilteredList. Google Guava/ Apache have Predicates, that can filter a list of objects to a smaller list, not sure if there is something similar to filter out a list of properties alone.
upvote count: 6
answer count: 1
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/22362140
type: UnansweredQuestion
score: 6
has title: Filter list of objects by properties and generate list of properties in java
downvote count: 0
favorite count: 0
tagged with: filter

http://stackoverflow.com/comment/33956770
comment on: http://stackoverflow.com/q/22342500
score: 1
type: Comment
type: QuestionComment
has text: Basically, you need to place some kind of short-cut, batch file or executable within the start up folder of the windows user. You can't just drop a jar file in there as Windows has no idea what to do with. So a shortcut might work or a batch file or if you have access to, some kind of executable wrapper, which will run your Jar file...

http://stackoverflow.com/comment/73592914
type: AnswerComment
comment on: http://stackoverflow.com/a/22518833
has text: ;). Kindred spirits my friend, best of luck to you as well.
type: Comment
score: 0

http://stackoverflow.com/comment/34181942
type: Comment
type: QuestionComment
has text: Ok I moved session.getID(); %> to the line just above %> and now it executes the code and everything but it still displays it in a textpad document and not in the web browser itself.
comment on: http://stackoverflow.com/q/22448499
score: 0

http://stackoverflow.com/q/22479259
linked to: http://stackoverflow.com/q/439485
has body: Is there a specific reason ' ' is used for char in Java programming? It may be a stupid question, but I would like to know exactly why.
has comment: http://stackoverflow.com/comment/34194937
answer count: 4
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22479408
has answer: http://stackoverflow.com/a/22479302
has answer: http://stackoverflow.com/a/22479376
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22479434
has answer: http://stackoverflow.com/a/22479434
has comment: http://stackoverflow.com/comment/34194992
accepted answer: http://stackoverflow.com/a/22479302
has comment: http://stackoverflow.com/comment/34194880
has title: Java Beginner: Why Does char Use ' ' Instead of " "?
score: 2
has comment: http://stackoverflow.com/comment/34194861
favorite count: 0

http://stackoverflow.com/a/22389034
type: Answer
has comment: http://stackoverflow.com/comment/34037633
answers question: http://stackoverflow.com/q/22387502
score: 0
has body: All you have to do is: mvn clean install

http://stackoverflow.com/q/22387492
possible better answer: http://stackoverflow.com/a/24644102
tagged with: dependency-management
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22906806
downvote count: 0
tagged with: java
tagged with: gradle
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/24644102
has body: How can I exclude parent defined compile project dependency? Structure of modules is as follows: - build.gradle - settings.gradle - MAIN_MODULE_1 - build.gradle - MODULE1 - build.gradle - MODULE2 - build.gradle - MODULE3 - build.gradle - MODULE4 - build.gradle And dependency model should be: - MODULE1 &lt;- MAIN_MODULE_1 - MODULE2 &lt;- MAIN_MODULE_1 - MODULE3 &lt;- MAIN_MODULE_1 - MODULE4 &lt;- MAIN_MODULE_1 Which means, having // build.gradle subprojects { apply plugin: 'java' dependencies { compile project('MAIN_MODULE_1') } } // settings.gradle include ':MAIN_MODULE_1' include ':MODULE1' include ':MODULE2' include ':MODULE3' include ':MODULE4' will create circular dependency of MAIN_MODULE_1 on itself, which is wrong. and having the dependency in each module (of total count not 4 but 120) seems wrong to me.
has answer: http://stackoverflow.com/a/22387850
accepted answer: http://stackoverflow.com/a/22387850
answer count: 2
has title: Gradle - subprojects exclude parent defined project dependency
favorite count: 0
score: 8

http://stackoverflow.com/q/22336336
tagged with: locking
has body: I am trying to write a lock class to help with situations where I need to be able to prioritize various thread's acccess to a synchronized resource, but I have run into an issue with meeting the contract for Lock::tryLock(long time, TimeUnit unit). My current method is this: @Override public boolean tryLock(long time, TimeUnit unit) throws InterruptedException { if(super.tryLock(time, unit)) //my class extends `ReentrantLock` if(next.tryLock(time, unit)) return true; else super.unlock(); return false; } While at first glance, this doesn't seem wrong, the issue is that the method, by contract, must time out after time units, while this method could potentially take up to twice that. In order to do that, I need to be able to figure out how much of the time was taken by super.tryLock, and then only give next.tryLock the amount of time left over. I considered using a Timer with a TimerTask that decrements time each TimeUnit: new Timer().scheduleAtFixedRate( new TimerTask(){ @Override public void run() { //Decrement time somehow } }, 0, unit.toMillis(1)); However, this won't work for units smaller than a millisecond, it might take as much as one more unit than specified (which, for all we know, might be TimeUnit.DAYS).
score: 0
accepted answer: http://stackoverflow.com/a/22336337
answer count: 1
has answer: http://stackoverflow.com/a/22336337
type: AnsweredQuestion
has title: Determine amount of time remaining on method that times out
tagged with: contract
tagged with: java
tagged with: timeout
type: Question

http://stackoverflow.com/comment/34155355
has text: Made change : '@ComponentScan({"com.teradata.notification","com.teradata.dal"})'
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22451048
type: Comment

http://stackoverflow.com/a/22462655
has comment: http://stackoverflow.com/comment/34167591
has body: I'm not sure a builder pattern would be relevant in this case. You're building a tree, and builders are not very suitable for building trees. I would use instead some static factory methods instead: Math.multiply( Math.add(3, 4), Math.someFunc(2, 6, 9) ); That would be equivalent to: new Multiply(new Add(3, 4), new SomeFunc(2, 6, 9)); PS: don't use DefaultMutableTreeNode: it is a Swing framework class, and you don't want to depend on a UI framework for making a mathematic expression framework. And worst, it is mutable. Create your own structure.
has comment: http://stackoverflow.com/comment/34167852
has comment: http://stackoverflow.com/comment/34167276
answers question: http://stackoverflow.com/q/22461333
type: Answer
has comment: http://stackoverflow.com/comment/34168042
score: 0
has comment: http://stackoverflow.com/comment/34167374
has comment: http://stackoverflow.com/comment/34166848

http://stackoverflow.com/comment/34025343
type: QuestionComment
score: 2
has text: safest could be loop/iterating inside container
comment on: http://stackoverflow.com/q/22382409
type: Comment

http://stackoverflow.com/q/22426277
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/59192243
type: Question
has comment: http://stackoverflow.com/comment/59240465
has title: "No enclosing instance of type Hra is accessible."
downvote count: 0
linked to: http://stackoverflow.com/q/7901941
tagged with: abstract-class
answer count: 1
score: 1
has body: I have this problem with my code and I don't know how to resolve it please help me. No enclosing instance of type Hra is accessible. Must qualify the allocation with an enclosing instance of type Hra (e.g. x.new A() where x is an instance of Hra)." public class Hra { public static void main(String[] args) { Hrac h = new Cerveny(1); // there is that error int result = h.zautoc(55, 30); System.out.print(0); } public Hrac[] pole; private int counter; public Hra() { this.pole = new Hrac[100]; this.counter = 0; } public void pridajHraca(Hrac h) { this.pole[counter] = h; } public abstract class Hrac{ protected double zivot; public int tim; public int zautoc(int velkost, int mojaPozicia){ if (tim == 1){ if (mojaPozicia &gt;= 7) return (mojaPozicia -7); else return (velkost - 7 - mojaPozicia); } if (tim == 2){ if (mojaPozicia +3 &lt;= velkost) return (mojaPozicia +3); else return (mojaPozicia -velkost +3 ); } return 0; } } public class Cerveny extends Hrac{ public Cerveny(double _zivot) { super.zivot = _zivot; super.tim = 1; } } public class Cierny extends Hrac{ public Cierny(double _zivot) { super.zivot = _zivot; super.tim = 2; } } }
favorite count: 0
linked to: http://stackoverflow.com/q/9560600
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22426346

http://stackoverflow.com/q/22487585
score: 1
favorite count: 0
has body: When I have a simple json it is easy, take {"type":"simple","content":"i love apples"} I just create a pojo: public class Example { public Object type; public Object content; } Then doing: ObjectMapper mapper = new ObjectMapper(); Example ex = mapper.readValue(getInputStream(),Example.class) will do the job. But now suppose I have something more complicated, a multilevel json { "type": "complicated", "params": [ { "type": "simple", "content": "i still love apples" }, { "type": "simple", "content":"i love spam too" } ] } As you can see the "params" field of this new Object is a json array, and each element of this array could be mapped to my Example pojo class. Is there a way to do this? Sorry if it could seem trivial, but I can't find any good documentation about jackson... it just talks about simple cases.
type: Question
answer count: 4
has answer: http://stackoverflow.com/a/22488337
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34211241
has comment: http://stackoverflow.com/comment/34211562
has answer: http://stackoverflow.com/a/22487766
has answer: http://stackoverflow.com/a/22488020
has title: Is it possible do serialize/deserialize multilevel json objects?
has answer: http://stackoverflow.com/a/22487649
tagged with: jackson
possible better answer: http://stackoverflow.com/a/22488020
has comment: http://stackoverflow.com/comment/34211717
accepted answer: http://stackoverflow.com/a/22488337
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/33658535
upvote count: 11
has comment: http://stackoverflow.com/comment/58327199
score: 11
has body: I recognize this question is old but others may be interested to know. I created a lightweight docking library for JavaFX for both proprietary and non-proprietary uses under the LGPL license. https://github.com/RobertBColton/DockFX
has comment: http://stackoverflow.com/comment/58284318
has comment: http://stackoverflow.com/comment/58263756
has comment: http://stackoverflow.com/comment/58328181
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22432811
downvote count: 0
answers question: http://stackoverflow.com/q/22432811
has comment: http://stackoverflow.com/comment/58215591
type: Answer

http://stackoverflow.com/a/22392897
has comment: http://stackoverflow.com/comment/34044388
answers question: http://stackoverflow.com/q/22392874
has body: Replace String[] testSplit = test.split( "" ); with: String[] testSplit = test.split("\\s+"); That way, the split is made with an arbitrary number of spaces. However, it won't retain how many spaces were between each word.
score: 0
has comment: http://stackoverflow.com/comment/34044606
type: Answer

http://stackoverflow.com/a/22478291
accepted answer of: http://stackoverflow.com/q/22478223
has comment: http://stackoverflow.com/comment/34195142
answers question: http://stackoverflow.com/q/22478223
has comment: http://stackoverflow.com/comment/34195128
has comment: http://stackoverflow.com/comment/34195323
has comment: http://stackoverflow.com/comment/34195327
has comment: http://stackoverflow.com/comment/34195213
has comment: http://stackoverflow.com/comment/34193321
has body: There is a androidmanifest.xml file in your project. Just open that file and write following line init. &lt;uses-permission android:name="android.permission.INTERNET" /&gt; You need to write this line after &lt;uses-sdk tag and before &lt;application&gt; tag. See the image below,
has comment: http://stackoverflow.com/comment/34193217
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34195297
score: 4
has comment: http://stackoverflow.com/comment/34195391
has comment: http://stackoverflow.com/comment/34194084
type: Answer
has comment: http://stackoverflow.com/comment/34195178
has comment: http://stackoverflow.com/comment/34195376
has comment: http://stackoverflow.com/comment/34194973
upvote count: 4
has comment: http://stackoverflow.com/comment/34195163
downvote count: 0

http://stackoverflow.com/comment/34176307
has text: @Neurone It is (was) a compatibility issue with the existing Java *types* and byte-code. When .NET introduced generics in 2.0 they chose a different approach (with "reified types"), but it also means `List` and `List<T>` are two *different* types and moving from .NET 2.0 from .NET 1.1 was a *non-backwards compatible change* (even though the ancient C#1 *source* can be compiled for .NET 2).
comment on: http://stackoverflow.com/a/22467462
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22395905
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22395974
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22396058
has title: Deleting all words matching a regex pattern
tagged with: regex
possible better answer: http://stackoverflow.com/a/22396058
score: 2
has body: I would like to remove the character sequences like "htsap://" or "ftsap://" from a String. Is it possible? Let me illustrate my needs with an example. Actual input String: "Every Web page has a http unique address called a URL (Uniform Resource Locator) which identifies where it is located on the Web. For "ftsap://"example, the URL for CSM Library's home page is: "htsap://"www.smccd.edu/accounts/csmlibrary/index.htm The basic parts of a URL often provide \"clues\" to htsap://where a web page originates and who might be responsible for the information at that page or site." Expected resulting String: "Every Web page has a http unique address called a URL (Uniform Resource Locator) which identifies where it is located on the Web. For example, the URL for CSM Library's home page is: www.smccd.edu/accounts/csmlibrary/index.htm The basic parts of a URL often provide \"clues\" to where a web page originates and who might be responsible for the information at that page or site." Patterns I tried: (not very sure it is a right way) ((.*?)(?=("htsap://|ftsap://"))) and: ((.*?)(?=("htsap://|ftsap://")))(.*) Could anyone please suggest here?
upvote count: 2
has answer: http://stackoverflow.com/a/22395974
type: AnsweredQuestion

http://stackoverflow.com/q/22334144
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/36002137
has body: I'm migrating an application from Glassfish 2.1 to Jboss eap 6.0.1. Now I deploy my app in Jboss correctly but it doesn't work. I have made debug and I saw the problem. When the code arrives to this line: OutputFormat format = OutputFormat(doc); It fails. I made a new watch of "OutputFormat(doc)" and in the value appears this: Unknown type "org.apache.xml.serialize.OutputFormat"&lt; This class is inside xerces library. This library is installed as a module in my jboss. I have tried many things: 1.- Exclude jboss library and included the library in my war. Not deploy. 2.- Include my library (no JBoss' library) as a new module and, in the manifest, add this line: Dependencies: myModuleName. It deploys, but it doesn't work. 3.- The before "solution", and exclude jboss library. Not deploy. This ocurred when the code arrives at the following line, and I have tried the same solutions: XPathAPI.selectSingleNode( xmlTempDoc,"//a" ) The error at this time is: Unknown type "org.apache.xpath.XPathAPI" This packages are in xercesImpl-2.9.1 and xalan-2.7.1 libraries respectively. Can you help me, please? Thanks, Regards.
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: maven
score: 2
has answer: http://stackoverflow.com/a/22349926
tagged with: java
tagged with: jboss
has title: xalan and xerces in jboss eap 6.0.1

http://stackoverflow.com/comment/35995223
type: Comment
has text: I don't want to use android:singleLine="true" or line-break.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23476500

http://stackoverflow.com/comment/34146927
comment on: http://stackoverflow.com/q/22450819
score: 0
type: Comment
has text: @user2931409 Not a duplicate. as I asked explicitly for a Java library. The other question asks for Python and RegExes are given as answers...
type: QuestionComment

http://stackoverflow.com/a/22391122
downvote count: 0
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22390740
answers question: http://stackoverflow.com/q/22390740
has body: The issue is most likely due to queryNorm. See: http://lucene.472066.n3.nabble.com/QueryNorm-and-FieldNorm-td1992964.html As long as you are not comparing results based on scores from different queries, the relevance ordering within a single search should be fine.
type: AcceptedAnswer

http://stackoverflow.com/a/22487192
answers question: http://stackoverflow.com/q/22487126
score: 11
upvote count: 11
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34210536
has comment: http://stackoverflow.com/comment/34211486
has comment: http://stackoverflow.com/comment/88574989
type: Answer
has body: This is the parameter indicator in a Groovy closure. You can find out more about closures here. -&gt; is a symbol indicating the end of parameters list for a closure in Groovy. In the first example (given in comments) you have a closure called printSum and it takes two parameters; a and b: def printSum = { a, b -&gt; print a+b } In the second example (given in the comments) you have a named criteria called oldPublicationsLargerThan and it takes one parameter called pageCount. oldPublicationsLargerThan { pageCount -&gt; def now = new Date() lt 'datePublished', now - 365 gt 'numberOfPages', pageCount }
accepted answer of: http://stackoverflow.com/q/22487126
has comment: http://stackoverflow.com/comment/34210231
downvote count: 0

http://stackoverflow.com/comment/36325139
has text: I have an issue. Double-click works fine on the tree items but even When I press CTRL + M the tree items expand\collapse but I don't want that to happen, What's the reason behind this CTRL+M functionality?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22453339

http://stackoverflow.com/a/22332554
has body: You can simplify your code a little by excluding the if. Unfortunately, the loop has to stay - arrays provide contiguous storage, so you need to move the data if you are to delete an item in the middle of the array. public static String remove(int index) { // Note the use of "index" instead of "name" if (index &lt; 0 || index &gt;= array1.length) { // A more common approach is to throw an exception, // but your code returns null for out-of-range index return null; } for (int i = index; i &lt; array1.length-1 ; i++) { array1[i] = array1[i+1]; } // Unconditionally set null in the last element of the array array1[array1.length-1] = null; return array1[index]; }
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22332199
answers question: http://stackoverflow.com/q/22332199

http://stackoverflow.com/comment/34033750
type: AnswerComment
comment on: http://stackoverflow.com/a/22386926
score: 0
type: Comment
has text: @Heuster: Just as sorting, which OP seems not to have implemented themselves

http://stackoverflow.com/comment/33998637
comment on: http://stackoverflow.com/a/22357639
type: Comment
has text: You forgot to add the params map to the execute call. And usually you would only use Literals for really fixed values, i.e. constants.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/64997871
has text: Yes, I didn't see he/she is using sql server 2008. Actually i am also facing same Exception. I thing the problem in SID only
type: Comment
comment on: http://stackoverflow.com/a/38812887
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34101332
type: QuestionComment
has text: Please can you share code for `SectionStackSections`. Its not clear from this code.
comment on: http://stackoverflow.com/q/22425459
score: 0
type: Comment

http://stackoverflow.com/a/22342723
type: Answer
answers question: http://stackoverflow.com/q/22342450
score: 1
upvote count: 1
downvote count: 0
has body: The getCurrentSession() method would return an implementation of the session interface. Looking up the javadocs from 3.6 and further for Hibernate. It supports 2 methods for deletion void delete(Object object) Remove a persistent instance from the datastore. void delete(String entityName, Object object) Remove a persistent instance from the datastore. In your accountsDAO.delete() method, you are passing in a String id to the delete method. You would have to fetch the Account that you want to delete and pass the Account object for deletion. What Jiang mentioned would work too.

http://stackoverflow.com/comment/34108842
type: AnswerComment
has text: There are weak references (plus soft and phantom) in java, but I was just talking about two objects referencing each other but not referenced by **anything else**.
type: Comment
comment on: http://stackoverflow.com/a/22429582
score: 0

http://stackoverflow.com/q/22438551
score: 1
tagged with: java
upvote count: 1
has body: I got two classes, both with one toString() each. In a third class (Main), i want to print the information from the toString()'s by only calling one of the toString()'s. Some help would be fantastic! Main: public static void print(Class1[] cls1, int index){ System.out.println(cls1[index].toString()); } Class1: @Override public String toString() { return getMethod() + getMethod2(); } Class2: @Override public String toString() { return getMethod3() + getMethod4(); } One alternative I thought of was adding Class2.toString() to Class1 (I couldn't make it work): @Override public String toString() { return getMethod() + getMethod2() + Class2.toString(); } Another idea i had was to just add the getters right into the toString in Class1 instead of using a toString (this did not work either): @Override public String toString() { return getMethod() + getMethod2() + Class2.getMethod3() + Class2.getMethod4(); }
type: Question
has answer: http://stackoverflow.com/a/22438614
has comment: http://stackoverflow.com/comment/34124017
has answer: http://stackoverflow.com/a/22438643
answer count: 3
downvote count: 0
has title: Print toString()'s from separate classes
favorite count: 0
has answer: http://stackoverflow.com/a/22438638
type: UnansweredQuestion
tagged with: tostring
has comment: http://stackoverflow.com/comment/34124006

http://stackoverflow.com/q/22448487
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/22448666
has body: I have a restlet resource which looks like this: @Get("json") public List&lt;String&gt; retrieve() { MyCityService nh = (MyCityService)getContext().getAttributes().get(MyCityService.class.getCanonicalName()); return nh.getReport(); } as you can see it returns a List of Strings. And I try to get the returned value in a remote class using the following code: ClientResource client = new ClientResource("http://remoteserver.com/mycity/nh/json"); System.out.println(client.get().getText()); The getText() method returns the whole content of the List as one string but I want to get each of the string values added in the List separately. Is there a way to do this?
score: 0
type: UnansweredQuestion
tagged with: java
tagged with: eclipse
has title: How to invoke a restlet resource

http://stackoverflow.com/comment/34010837
comment on: http://stackoverflow.com/q/22373515
score: 0
type: Comment
type: QuestionComment
has text: I have whole project which contain Numbers of class files, but It successfully Run on Window OS. But it doesn't run in MAC OS.

http://stackoverflow.com/q/22460788
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22461237
tagged with: arrays
has title: Reading text file into an array in Java
accepted answer: http://stackoverflow.com/a/22461237
has comment: http://stackoverflow.com/comment/34163411
has answer: http://stackoverflow.com/a/22460938
has body: I'm pretty new to Java (currently enrolled in my first programming class), so the answer to my question could be right in front of me. My goal is to read in a text file that reads as follows: 4563123,112211324135412 2312311,222121324135211 2312345,112211324135421 5527687,212111313124412 7867567,111111111111111 where the first set of numbers is an ID, and the second set is a set of answers to a test (of which I have the key). Once I've read in the answers I need to store them in an array (and I assume just an array, as my class has not covered ArrayLists yet). All of this data would need to be stored in one array, since I need to return it at the end of the method. Here is the code that I have so far: public static String[] readFile(String filename)throws IOException{ Scanner inFile = new Scanner(filename); String line; String[] results = new String[101]; int i = 0; while (inFile.hasNextLine()){ line = inFile.nextLine(); String[] incoming = line.split(","); String wid = incoming[0]; String answer = incoming[1]; results[i] = wid; results[i + 1] = answer; i += 2; } inFile.close(); return results; } It's safe to ignore the String filename, it was passed in from the main. Every time I run this method, I keep running into an ArrayOutOfBoundsException, mainly when I try to assign incoming[1] to answer. I've been staring at this code longer than what is probably good for me, but it seems that I just can't wrap my head around it. Any help would be appreciated, whether that be telling me what is wrong or what I can do to improve.
possible better answer: http://stackoverflow.com/a/22460938
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34163477
type: Question

http://stackoverflow.com/a/57873644
upvote count: 3
downvote count: 1
has body: My understanding is that Oracle JDK can't be used in production, therefore I cannot legally use it (without paying), for the web application I am building for my company. I have to use OpenJDK. Please correct me if I am wrong! From this article. Starting with Java 11, the Oracle JDK is restricted to development and testing environments. Oracle JDKs may only be used in production if you buy the commercial support. Instead, Oracle will provide Java builds based on OpenJDK for free which can be used in production. But for the official Oracle JDK the real roadmap will look like this: UPDATE: I'm wrong. I can use Oracle JDK for free but won't get security updates after 6 mos and we'll have to assume the risk. Look at the above linked article section "What does the new release train mean to my company?".
type: Answer
answers question: http://stackoverflow.com/q/22358071
score: 2
has comment: http://stackoverflow.com/comment/106759942
has comment: http://stackoverflow.com/comment/104916430

http://stackoverflow.com/comment/34001402
comment on: http://stackoverflow.com/a/22367943
type: Comment
has text: I was going to say that there's no straightforward way, e.g. without creating a backing class.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34157672
score: 0
comment on: http://stackoverflow.com/q/22457525
type: QuestionComment
type: Comment
has text: What encoding are you using? Have you tried `uft-8`?

http://stackoverflow.com/q/22344344
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/33961943
upvote count: 9
tagged with: java
score: 9
answer count: 3
downvote count: 0
has title: How to play live streaming in android application?
has answer: http://stackoverflow.com/a/22346015
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/22346293
has answer: http://stackoverflow.com/a/22347139
has body: I want to make application for cricket live streaming. I want to know following things : From where I can found the links to play cricket streaming ? Which type of links are these ? Is there any player to play this type of videos ? Currently, I have implemented web page but I am looking for other alternative. Below is my code : link1 = (RelativeLayout) findViewById(R.id.link1); link2 = (RelativeLayout) findViewById(R.id.link2); link3 = (RelativeLayout) findViewById(R.id.link3); link4 = (RelativeLayout) findViewById(R.id.link4); link5 = (RelativeLayout) findViewById(R.id.link5); link6 = (RelativeLayout) findViewById(R.id.link6); link7 = (RelativeLayout) findViewById(R.id.link7); link1.setOnClickListener(this); link2.setOnClickListener(this); link3.setOnClickListener(this); link4.setOnClickListener(this); link5.setOnClickListener(this); link6.setOnClickListener(this); link7.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.link1: linkFunction("http://changevssame.blogspot.com/2014/03/willow-cricket-hd-live-streaming.html"); break; case R.id.link2: linkFunction("http://changevssame.blogspot.com/2014/03/foxsports-live-streaming.html"); break; case R.id.link3: linkFunction("http://changevssame.blogspot.com/2014/03/sky-sports-live-streaming.html"); break; case R.id.link4: linkFunction("http://changevssame.blogspot.com/2014/03/ten-sports-live-streaming.html"); break; case R.id.link5: linkFunction("http://changevssame.blogspot.com/2014/03/star-cricket.html"); break; case R.id.link6: linkFunction("http://changevssame.blogspot.com/2014/03/icc-t20-world-cup-2014-live-streaming.html"); break; case R.id.link7: linkFunction("http://changevssame.blogspot.com/2014/03/ptv-sports.html"); break; default: break; }

http://stackoverflow.com/comment/34052928
comment on: http://stackoverflow.com/q/22397848
score: 0
type: QuestionComment
type: Comment
has text: yes, that change has been done by me. is the above SET SCHEMA command compatible with ORACLE??

http://stackoverflow.com/q/22345087
type: Question
has comment: http://stackoverflow.com/comment/33963130
has comment: http://stackoverflow.com/comment/33961353
favorite count: 0
upvote count: 2
has title: OpenCV face detection can not find any
answer count: 1
tagged with: opencv
has comment: http://stackoverflow.com/comment/33961193
has body: I have followed online tutorials and managed to write a simple class like this: public class FaceDetector { public static void detect(String imageFile) { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); System.out.println("\nRunning FaceDetector"); CascadeClassifier faceDetector = new CascadeClassifier(FaceDetector.class.getResource("haarcascade_frontalface_alt.xml").getPath()); Mat image = Highgui.imread(imageFile); MatOfRect faceDetections = new MatOfRect(); faceDetector.detectMultiScale(image, faceDetections); int faceCount = faceDetections.toArray().length; System.out.println(String.format("Detected %s faces", faceCount)); for (Rect rect : faceDetections.toArray()) { Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0)); } String filename = imageFile+"_output.png"; System.out.println(String.format("Writing %s", filename)); Highgui.imwrite(filename, image); } } However I have tried this with over 200 profile pictures and it could not detect a single one. Since it rewrites the image file untouched, I know it reads image correctly. It is not giving any errors so. What should I do now? Any redirections? Where should I read? what am I missing?
tagged with: java
has answer: http://stackoverflow.com/a/22346134
has comment: http://stackoverflow.com/comment/33961151
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: face-detection

http://stackoverflow.com/a/22437543
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22437471
has body: Your Constructor is parameteris constructor You must pass value to parameteris Construcor You Can Call With differnt of type int i=10; int j=5; Calculate2 gcd = new Calculate2(i,j); or new Calculate2(10,20); or Calculate2 gcd = new Calculate2(10,20); or Calculate2 gcd; gcd = new Calculate2(15,20);

http://stackoverflow.com/a/22420272
answers question: http://stackoverflow.com/q/22420181
has comment: http://stackoverflow.com/comment/34092824
has comment: http://stackoverflow.com/comment/34092118
upvote count: 1
has comment: http://stackoverflow.com/comment/34092160
has body: The maximum size of a List is limited by the maximum value of a Java integer, because integers are used to index the list and to return the size of the list in the method int size();. The maximum value of an int in Java is Integer.MAX_VALUE which is 2147483647. A particular implementation of List could have a lower limit, but for java.util.ArrayList, that is the limit. Of course you could run out of memory long before that, that really depends on the memory of your computer and whether you are using a 64-bit version of the JVM or the 32-bit version. For your second question: the time it takes to transfer data from the database is almost always far higher than the time taken to store the data in the memory of the computer, so if you only worry about the time it takes to store the data in the list, then you should not worry. If you however are thinking about the time it takes to retrieve the data, then it really depends on how you are retrieving the data from the collection (using a particular key for example). In many cases, an implementation of java.util.Map such as java.util.HashMap will have better performance when you are retrieving data by a particular key.
score: 1
has comment: http://stackoverflow.com/comment/34092102
has comment: http://stackoverflow.com/comment/34092083
downvote count: 0
has comment: http://stackoverflow.com/comment/34092117
type: Answer

http://stackoverflow.com/comment/34180254
comment on: http://stackoverflow.com/a/22470244
type: Comment
has text: Thanks. Seems my problem is solved in http://stackoverflow.com/questions/20770240/how-to-put-jsp-files-in-a-separate-folder
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34010789
comment on: http://stackoverflow.com/q/22373824
score: 0
type: Comment
type: QuestionComment
has text: do you have `libGtfNativeActivity.so` inside `libs/armeabi` ?

http://stackoverflow.com/q/22332154
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33940420
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22335707
accepted answer: http://stackoverflow.com/a/22335707
type: Question
score: 0
has title: how to select an object from a list which is an attribute of another object in a database with spring
has comment: http://stackoverflow.com/comment/33939216
answer count: 1
has comment: http://stackoverflow.com/comment/33938871
tagged with: spring
has body: I have two classes where one of them contains a Map of objects of the second class, and I want to make a query to find one object by its id. here's my code: @Entity @Table(name="objectx", uniqueConstraints=@UniqueConstraint(columnNames={"objectxId"})) public class Objectx { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; private int objectxId; @ManyToMany(cascade=CascadeType.ALL) @JoinTable(name = "objectx_objecty", joinColumns = @JoinColumn(name = "objectxId") , inverseJoinColumns = @JoinColumn(name = "objectyId") ) @MapKeyColumn(name="objecty_name") private Map&lt;String, objecty&gt; objectyMap; in the objectyRepository, I have: public interface ObjectyRepository extends CrudRepository&lt;Objecty, Long&gt; { public static final String FIND_OBJECTY_BY_OBJECTYID_OBJECTXID = "SELECT y from Objecty y " + "JOIN y.Objectx x " + "WHERE x.objectxId =:objectxId " + "AND y.objectyId =:objectyId"; @Query(FIND_OBJECTY_BY_OBJECTYID_OBJECTXID) public Objecty findObjectyByObjectyIdAndObjectxId(@Param("ObjectxId") int ObjectxId, @Param("ObjectyId") String ObjectyId); Can anyone tell me how to get the needed result, please? I'm working with eclipse Kepler and using spring and hibernate the error I get is: Caused by: org.hibernate.QueryException: could not resolve property: Objectx of: com.domain.Objecty at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:83) at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:77) at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1978) at org.hibernate.hql.internal.ast.tree.FromElementType.getPropertyType(FromElementType.java:367) at org.hibernate.hql.internal.ast.tree.FromElement.getPropertyType(FromElement.java:500) at org.hibernate.hql.internal.ast.tree.DotNode.getDataType(DotNode.java:649) at org.hibernate.hql.internal.ast.tree.DotNode.prepareLhs(DotNode.java:272) at org.hibernate.hql.inte…
has comment: http://stackoverflow.com/comment/33938579
has comment: http://stackoverflow.com/comment/33942449

http://stackoverflow.com/comment/33960698
comment on: http://stackoverflow.com/q/22340034
has text: There should be another log file, localhost.yyyy-mm-dd.log, which records output from the JVM, including errors, as opposed to localhost_access_log.yyyy-mm-dd.log, which just records HTTP transactions. Can you check that?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34072455
type: Comment
comment on: http://stackoverflow.com/q/22409389
score: 0
type: QuestionComment
has text: @fedorqui didn't you forget the trailing `"` (which would protect the `$`)?

http://stackoverflow.com/comment/34158192
has text: again i say there wont be a a case where dishID = 0 because the orders are 1, 2, 3 etc.
type: AnswerComment
comment on: http://stackoverflow.com/a/22457266
score: 0
type: Comment

http://stackoverflow.com/comment/34114722
score: 1
has text: These two examples worked; however, Maureen answered first and I cannot vote-up yet. Thanks for the help!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22433145

http://stackoverflow.com/comment/34110826
type: QuestionComment
has text: @SotiriosDelimanolis in the second line of the second piece of code, when I try to call the class
comment on: http://stackoverflow.com/q/22430965
score: 0
type: Comment

http://stackoverflow.com/comment/33981312
type: Comment
comment on: http://stackoverflow.com/q/22356547
score: 0
has text: @sakura "This works as it should, but now this User should be converted to a Official." The User has to be converted to an Official -> the second dozer file.
type: QuestionComment

ant
tags question: http://stackoverflow.com/q/22335253
tags question: http://stackoverflow.com/q/22487155
tags question: http://stackoverflow.com/q/22331126
tags question: http://stackoverflow.com/q/22346628
tags question: http://stackoverflow.com/q/22445155
tags question: http://stackoverflow.com/q/22333468
tags question: http://stackoverflow.com/q/22465157
tags question: http://stackoverflow.com/q/22403705
type: Tag
tags question: http://stackoverflow.com/q/22346457
tags question: http://stackoverflow.com/q/22465271
tags question: http://stackoverflow.com/q/22481660
tags question: http://stackoverflow.com/q/22445245
tags question: http://stackoverflow.com/q/22380712
tags question: http://stackoverflow.com/q/22346455
tags question: http://stackoverflow.com/q/22478807
tag name: ant
tags question: http://stackoverflow.com/q/22352991
tags question: http://stackoverflow.com/q/22397075
tags question: http://stackoverflow.com/q/22379630
tags question: http://stackoverflow.com/q/22361198
tags question: http://stackoverflow.com/q/22345432

http://stackoverflow.com/q/22403151
type: Question
has comment: http://stackoverflow.com/comment/34061142
linked to: http://stackoverflow.com/q/13845468
answer count: 1
has answer: http://stackoverflow.com/a/22403181
has comment: http://stackoverflow.com/comment/34061563
tagged with: generics
has title: Static field generic constraints
duplicate of: http://stackoverflow.com/q/13845468
has body: I am assuming its not possible, but is there a way of having a static field defined as such: private final static Map&lt;Class&lt;T&gt;, Class&lt;? extends XmlAdapter&lt;T, ?&gt;&gt;&gt; Such that it is know that if you get Class it will be a class that extends XmlAdapter? Or would this map need to be wrapped in a class with generic methods to ensure this constraint is maintained?
type: UnansweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/34138281
comment on: http://stackoverflow.com/q/22445986
has text: @SotiriosDelimanolis 1
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33997796
type: QuestionComment
score: 2
has text: Are you trying to execute Passenger? (if so, you need a static Main(String[] args) method declared.)
comment on: http://stackoverflow.com/q/22365721
type: Comment

http://stackoverflow.com/q/22469284
has title: How to grab JSON Array and use gson to parse each json object? (Retrofit)
downvote count: 0
favorite count: 0
has body: I am returning an array of results with my json Objects, and I am trying to use my customObjectResponse class to pull out each of the fields within each of the objects... the problem it is expecting an object so how do I edit my class to allow it to take in an array of object to be able to then call the fields of each object... I am confused as to what needs to be added: Here is a response example of what is being passed to be used: [ { itemId: 'dfsdfsdf343434', name: 'tests', picture: '6976-7jv8h5.jpg', description: 'testy.', dateUpdated: 1395101819, } ] Here is my response Object Class: public class ObjResponse{ private String itemId; private String name; private String picture; private String description; private String location; private int dateUpdated; private String msg; //gridview constructor public ObjResponse(String picture) { this.picture = picture; } //public constructor public ObjResponse() { } public String getItemId() { return itemId; } public void setItemId(String itemId) { this.itemId = itemId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPicture() { return picture; } public void setPicture(String picture) { this.picture = picture; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public int getDateUpdated() { return dateUpdated; } public void setDateUpdated(int dateUpdated) { this.dateUpdated = dateUpdated; } public String getMsg() { return msg; } } what I am trying, but is not working, even if I separate the classes into their own files: Data passed in: items: [{obj1: "A", obj2: ["c", "d"]}, {etc...}] public class Response { public class List&lt;Custom&gt; { private List&lt;Custom&gt; items; } public class Custom { private String obj1; private List&lt;Obj2&gt; obj2; } publi…
has comment: http://stackoverflow.com/comment/45253550
tagged with: android
has answer: http://stackoverflow.com/a/22479711
answer count: 4
has answer: http://stackoverflow.com/a/26849785
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
score: 23
possible better answer: http://stackoverflow.com/a/39774297
upvote count: 23
type: Question
has answer: http://stackoverflow.com/a/39774297
has comment: http://stackoverflow.com/comment/34178873
accepted answer: http://stackoverflow.com/a/22479711
linked to: http://stackoverflow.com/q/28443468
has answer: http://stackoverflow.com/a/22469389
tagged with: retrofit

http://stackoverflow.com/comment/33943928
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22335037
type: AnswerComment
has text: Oops. I didn't mention. You will also need to refactor the signatures of your method to `public Class<List> getKlass()`

http://stackoverflow.com/comment/34073415
score: 0
has text: .........No both wound up working, now... I have the "l" as a 1 (number one). Changed that and that part is working now. Hooray for L's looking like ones!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22370321

http://stackoverflow.com/comment/34181333
type: AnswerComment
type: Comment
has text: was asking what is Integer.TYPE and int.class then?
comment on: http://stackoverflow.com/a/22471019
score: 0

http://stackoverflow.com/comment/34156451
type: Comment
score: 0
has text: Guys, he knows that he may use Mockito! What he asks is if Mockito can mock a class which does not implement an interface.
comment on: http://stackoverflow.com/q/22456450
type: QuestionComment

http://stackoverflow.com/a/22506944
has body: I'm not sure why you are fetching a collection to get a single result. Correct me if I'm wrong but the solution to your problem, as I interpreted it, is very easy to solve using @Query. Add the following to your repository interface. @Query("SELECT max(t.id) FROM #{#entityName} t") Integer getMaxId();
type: Answer
answers question: http://stackoverflow.com/q/22465018
downvote count: 0
score: 13
has comment: http://stackoverflow.com/comment/34254092
has comment: http://stackoverflow.com/comment/34252038
upvote count: 13

http://stackoverflow.com/q/22434762
type: AnsweredQuestion
tagged with: arrays
has title: how to search elements in a 2d array using recursion
type: Question
has answer: http://stackoverflow.com/a/33355406
accepted answer: http://stackoverflow.com/a/22434840
has answer: http://stackoverflow.com/a/22434856
possible better answer: http://stackoverflow.com/a/22434813
has answer: http://stackoverflow.com/a/22434813
has comment: http://stackoverflow.com/comment/34117364
tagged with: recursion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22434840
has body: I have a 2d char array and I'm trying to find a specific character using recursion. public class Test { char arry [][] = {{'1',' ','B'}, {'C','K','M'}, {'H','R','P'} }; public Test(){ recursion(0,0,arry[0][0]); } private void recursion(int row, int col, char c) { if(c==' '){ System.out.print("Location: " + row + " " + col ); }else { if(col+1&lt;arry[0].length){ recursion(row,col,c); } //System.out.print(arry[0][1]); } } public static void main(String[] args) { new Test(); } } but this is giving me a stack overflow. how can I find an element in a 2d array using recursion.
answer count: 4

http://stackoverflow.com/comment/134431739
comment on: http://stackoverflow.com/a/22384781
score: 0
has text: `Class.forName` has not been needed for many years now. In modern Java, JDBC drivers are automatically loaded via [*Java Service Provider Interface*](https://en.wikipedia.org/wiki/Service_provider_interface).
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34096826
type: Comment
type: QuestionComment
has text: Have you tried a custom `Comparator`?
score: 0
comment on: http://stackoverflow.com/q/22423125

http://stackoverflow.com/comment/34035805
comment on: http://stackoverflow.com/a/22387797
score: 0
type: AnswerComment
type: Comment
has text: @GIJoe **Why** is it not true that the cape variable is local to each case, but instead to the switch statement? I'm not asking how I can stop getting the error.

http://stackoverflow.com/q/22362534
has comment: http://stackoverflow.com/comment/48542743
tagged with: java
has answer: http://stackoverflow.com/a/37125100
tagged with: spring-data
score: 17
has comment: http://stackoverflow.com/comment/34021557
has comment: http://stackoverflow.com/comment/34033844
type: Question
has title: Can I use Spring Data JPA Auditing without the orm.xml file (using JavaConfig instead)?
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/48526289
favorite count: 0
has comment: http://stackoverflow.com/comment/48541078
answer count: 3
has answer: http://stackoverflow.com/a/29423596
has comment: http://stackoverflow.com/comment/34009339
tagged with: audit
has answer: http://stackoverflow.com/a/26240077
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/48546516
tagged with: spring
upvote count: 17
has body: I'm trying to get Spring Data Auditing to work in my Spring 3.2.8 / Spring Data 1.5 / Hibernate 4 project. As per the Spring Data Auditing docs, I've added the @CreatedBy, etc annotations to my entities, created by AuditorAware implementation, and instantiated it from within my JavaConfig. However, it never seems to fire. I find the docs a little confusing. It appears that the JavaConfig entry replaces the xml entry, but I am not sure. I don't currently have any orm.xml file in my application. To be entirely honest, I'm not even sure where/how to configure it, or why I need it. All my entities are using annotations. I have tried adding @EntityListeners(AuditingEntityListener.class) to the entity, but that has not helped. My current entity manager is defined without a persistence.xml file: org.hibernate.dialect.MySQL5InnoDBDialect true '1', false '0' true false true update org.hibernate.cfg.ImprovedNamingStrategy UTF-8 JavaConfig: @Configuration @EnableJpaAuditing public class AuditConfig { @Bean public AuditorAware<User> auditorProvider(){ return new SpringSecurityAuditorAware(); } } Entity: @EntityListeners({AuditingEntityListener.class}) @Entity public class User { @TableGenerator(name="UUIDGenerator", pkColumnValue="user_id", table="uuid_generator", allocationSize=1) @Id @GeneratedValue(strategy=GenerationType.TABLE, generator="UUIDGenerator") @Column(name="id") private Long id; @NotNull private String username; @CreatedDate @NotNull @Temporal(TemporalType.TIMESTAMP) @Column(name="created_date", nullable=false) private Date createdDate; @LastModifiedDate @NotNull @Temporal(TemporalType.TIMESTAMP) @Column(name="last_modified_date", nullable=false) private Date lastModifiedDate; @CreatedBy @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="created_by") private User createdBy; @LastModifiedBy @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="last_modified_by") private User lastModifiedBy; private String password; private Boolean enabled; ... } I've put a breakpoint…
has comment: http://stackoverflow.com/comment/34206485

http://stackoverflow.com/comment/34173961
type: AnswerComment
score: 0
has text: where do I put the function call to popitup()?
type: Comment
comment on: http://stackoverflow.com/a/22373252

http://stackoverflow.com/comment/34104549
score: 1
comment on: http://stackoverflow.com/a/22427217
has text: Glad this path is helping you move forward
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22366961
score: 1
tagged with: java
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22366993
has title: Sorting a list using a comparator
downvote count: 0
has answer: http://stackoverflow.com/a/22367002
has body: import java.util.*; public class CW3 { private static HashMap &lt; String, Integer &gt; map = new HashMap &lt; String, Integer &gt; (); int comp(String s1, String s2) { int i1 = map.get(s1); int i2 = map.get(s2); if (i1 &lt; i2) return -1 ; else if (i1 == i2) return 0; else return 1; } void sort(List l) { Comparator c = new Comparator() { public int compare(Object o1,Object o2) { String a = (String)o1; String b = (String)o2; int result = new CW3().comp(a,b); return result; } }; // this is where I need help } } How would I use the comparator to sort the list?? I was thinking maybe something along the lines of Collections.sort(l, c)
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/34057763
comment on: http://stackoverflow.com/q/22401075
has text: Post logcat error and also layout xml file.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34178717
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22469032
has text: wow you are awesome. reviewing the doc now and will also post our tomcat config. thanks again!
type: AnswerComment

http://stackoverflow.com/comment/33957103
comment on: http://stackoverflow.com/q/22342209
type: QuestionComment
has text: someFun() function takes how many arguments? is that fixed or varying as per the hashmap size?
score: 0
type: Comment

http://stackoverflow.com/comment/34157034
comment on: http://stackoverflow.com/q/22457104
type: Comment
type: QuestionComment
score: 1
has text: You have a stack-overflow occurring in a different function than the one you've posted here.

http://stackoverflow.com/a/22439030
has comment: http://stackoverflow.com/comment/34125631
answers question: http://stackoverflow.com/q/22437609
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22437609
has comment: http://stackoverflow.com/comment/34125815
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/34125969
has body: As i See...It fail every download...So i think is a connection problem! Are you sure you have an active internet connection, are you using a Proxy.. Can you post the settings.xml configuration?
has comment: http://stackoverflow.com/comment/34125877
has comment: http://stackoverflow.com/comment/34125796

http://stackoverflow.com/comment/34011543
has text: Load your `Adapter` into `AsyncTask onPostExecute(..)` method
comment on: http://stackoverflow.com/q/22374356
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22440809
answer count: 2
tagged with: sdk
has title: Unknown Installation Error in Eclipse
type: UnansweredQuestion
tagged with: android
has body: My console is giving the following error when trying to run an Android Project in Eclipse. WARNING: Application does not specify an API level requirement! Device API version is 15 (Android 4.0.4) Installation error: Unknown failure Please check logcat output for more details. Launch canceled! I checked the logcat as suggested and there doesn't really seem to be that information in there. All it says is: D/AndroidRuntime( 5039): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit &lt;&lt;&lt;&lt;&lt;&lt; D/AndroidRuntime( 5039): CheckJNI is OFF I/ethernet( 5039): Loading ethernet jni class D/AndroidRuntime( 5039): Calling main entry com.android.commands.pm.Pm D/AndroidRuntime( 5039): Shutting down VM D/dalvikvm( 5039): GC_CONCURRENT freed 97K, 83% free 444K/2560K, paused 0ms+0ms D/dalvikvm( 5039): Debugger has detached; object registry had 1 entries I/AndroidRuntime( 5039): NOTE: attach of thread 'Binder Thread #1' failed Would you guys have any suggestions on what I could do to get this sorted out? I'm really new to Java/Android development but trying to learn.
tagged with: java
has answer: http://stackoverflow.com/a/22441013
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/22440858
score: 0

http://stackoverflow.com/comment/34016685
type: QuestionComment
has text: If there would be 6 columns would you need also all combinations of 4 and 5 of them, or combinations of 2 and 3 of them are all you need?
comment on: http://stackoverflow.com/q/22377606
score: 0
type: Comment

http://stackoverflow.com/q/22412350
has comment: http://stackoverflow.com/comment/34078153
tagged with: actionlistener
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22412762
accepted answer: http://stackoverflow.com/a/22412762
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/34077985
tagged with: awt
has title: Manager Class Issues in Student/GradStudent Program
has comment: http://stackoverflow.com/comment/34077927
score: 0
has body: The goal of this project is to create four classes: a Student class, a GradStudent class, a Manager class, and a GUI class. Within the GUI there are two radio buttons: one for Student and one for GradStudent. Depending on which one is selected, the Manager class is supposed to be responsible for creating and storing the Student or GradStudent objects by use of two arrays. I have all of my classes programmed out, but when I select either one of the radio buttons, I get errors in Manager.getLastGradStudent which in turn gives me an error in my JRBListener class. I will post the GUI and Manager classes below. Any help would be greatly appreciated! MANAGER CLASS: public class Manager { private Student[] students = new Student[50]; private int counter1 = 0; private GradStudent[] gradStudents = new GradStudent[50]; private int counter2 = 0; public Manager() { } public void addStudent(String name, String address, String balance, String major) { Student student1 = new Student(name, address, balance, major); students[counter1] = student1; counter1++; } public String getLastStudent() { return "Student added: " + students[counter1-1] +"\n"; } public void addGradStudent(String name, String address, String balance, String major) { GradStudent student2 = new GradStudent(name, address, balance, major); gradStudents[counter2] = student2; counter2++; } public String getLastGradStudent() { return "Graduate Student added: " + gradStudents[counter2-1] +"\n"; } } GUI CLASS: 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.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.JRadioButton; import javax.swing.ButtonGroup; public class GUI extends JFrame { private JRadioButton jrbStudent = new JRadioButton("Student"); private JRadioButton jrbGraduate = new JRadioButton("Gradua…
tagged with: swing

http://stackoverflow.com/comment/34213532
score: 0
comment on: http://stackoverflow.com/q/22487688
has text: `FAILED: Error in metadata: MetaException(message:file:/user/hive/warehouse/student is not a directory or unable to create one)` basically means that you want to access the table "student" but it hasn't been created
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34164951
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22461532
has text: I know what you are telling me but My code is a bit different and OUTPUT is completely different..Have a look @ the output of this code

http://stackoverflow.com/a/22447032
has comment: http://stackoverflow.com/comment/34140559
upvote count: 1
type: Answer
has body: You are correct to think of using HashMap. You can use the characterClass String names as keys and the characterClasses as values. You can then use your getter methods to access your specific fields i.e. classList.get("warrior").getBase_HP(); You could also forget maps entirely since these stats seem constant by using inheritance public class Character { int hp; int attack; int defense; public Character (int hp, int attack, int defense) { this.hp = hp; this.attack = attack; this.defense = defense; } public int getHP() { return hp; } ... } For your Character subclasses, you can preset those values in the constructor public class Warrior extends Character { public Warrior() { super(2, 10, 8); } public int getHP() { return super.getHP(); } } public class Wizard extends Character { public Wizard() { super(10, 3, 1); } public int getHP() { return super.getHP(); } } This way all your Warrior and Wizard Objects will have the same stats that can be accessed any time simply by invoking their getters.
accepted answer of: http://stackoverflow.com/q/22446985
downvote count: 0
answers question: http://stackoverflow.com/q/22446985
score: 1
has comment: http://stackoverflow.com/comment/34140324
has comment: http://stackoverflow.com/comment/34140249
has comment: http://stackoverflow.com/comment/34140599
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34153022

http://stackoverflow.com/q/22458042
linked to: http://stackoverflow.com/q/2244444
has answer: http://stackoverflow.com/a/22458176
linked to: http://stackoverflow.com/q/3006150
has answer: http://stackoverflow.com/a/27250515
has comment: http://stackoverflow.com/comment/65655359
tagged with: simpledateformat
tagged with: java
has body: I have wrote a method to get the current date in the format of yyyy-MM-dd and want to be able to also create another method for getting yesterday's date, the day before the current date. All this needs is the date and not the timestamp. I am not trying to use Calendar as well. I have set up the current date this way: public class DateWithNoTimestamp { private static final String CURRENT_DATE_FORMAT = "yyyy-MM-dd"; public final static String getCurrentDate() { DateFormat dateFormat = new SimpleDateFormat(CURRENT_DATE_FORMAT); Date date = new Date(); return dateFormat.format(date); } } This works to get the current date, now the separate method getYesertdayDate() I'm having trouble with. How can I set it up in a similar way as I did with getCurrentDate() while subtracting one day ?
tagged with: date
has answer: http://stackoverflow.com/a/22458314
type: Question
upvote count: 22
has title: How can I get yesterday's date without using Calendar in Java and without a timestamp just the date?
duplicate of: http://stackoverflow.com/q/3006150
has answer: http://stackoverflow.com/a/39153442
downvote count: 0
has answer: http://stackoverflow.com/a/22603855
answer count: 6
score: 22
linked to: http://stackoverflow.com/q/11425236
has answer: http://stackoverflow.com/a/22458148
tagged with: date-format
has comment: http://stackoverflow.com/comment/34158730
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/22406046
has comment: http://stackoverflow.com/comment/34066102
has comment: http://stackoverflow.com/comment/34066217
has comment: http://stackoverflow.com/comment/34066202
upvote count: 1
possible better answer: http://stackoverflow.com/a/22406110
has answer: http://stackoverflow.com/a/22407003
favorite count: 0
has answer: http://stackoverflow.com/a/22406110
tagged with: jframe
tagged with: swing
answer count: 4
type: AnsweredQuestion
has title: Error while Exiting Jframe window
has body: I have one window of class Jframe and it contains one button. On Clicking that button the second window of class Jframe is opened. On Clicking the close or the exit button of second window then the first window is also closed along with second window. Why is this happening? below is my code : // this is my first file class Frame1 extends JFrame { Frame1() { super("hello this is window 1"); setVisible(true); setSize(400,400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); JButton btn = new JButton("open second window"); btn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("button clicked"); Frame2 obj2 = new Frame2(); } }); add(btn); } public static void main(String args[]) { Frame1 obj = new Frame1(); } } // this is my second file class Frame2 extends JFrame { Frame2() { super("hello this is window 2"); setVisible(true); setSize(400,400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); } }
has answer: http://stackoverflow.com/a/22406178
has comment: http://stackoverflow.com/comment/34066106
linked to: http://stackoverflow.com/q/1234912
downvote count: 0
has answer: http://stackoverflow.com/a/22406475
score: 1
accepted answer: http://stackoverflow.com/a/22406475
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34066277

http://stackoverflow.com/comment/33940921
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22332017
has text: then please, post your layout.

http://stackoverflow.com/q/22406759
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34105161
answer count: 1
has comment: http://stackoverflow.com/comment/34073525
tagged with: eclipse
has answer: http://stackoverflow.com/a/22434039
has comment: http://stackoverflow.com/comment/34152872
has comment: http://stackoverflow.com/comment/34070752
type: AnsweredQuestion
has title: OSGI bundle is unable to start
has comment: http://stackoverflow.com/comment/34067820
has comment: http://stackoverflow.com/comment/34067584
type: Question
tagged with: osgi
has body: I have an OSGI bundle which gets to the RESOLVED state, but never reaches the ACTIVE state. When I run my application, this is the stacktrace I am obtaining: http://tny.cz/fa949f16 Afterwards, when I try to start the bundle explicitly through the OSGI console, I get this error: start 53 gogo: BundleException: The activator rsy.home.mac.sm.schedule.service.win.WinServiceActivator for bundle rsy.home.mac.sm.schedule.service.win is invalid Notice that in the end of the stacktrace ouput, there's the following message: !ENTRY org.eclipse.osgi 4 0 2014-03-14 10:52:50.984 !MESSAGE Bundle rsy.home.mac.sm.schedule.service.win_1.0.0 [53] is not active. Here's the code from WinServiceActivator: package rsy.home.mac.sm.schedule.service.win; import java.util.HashMap; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleEvent; import org.osgi.framework.BundleListener; public class WinServiceActivator implements BundleActivator { private static BundleContext context; @Override public void start(BundleContext context) throws Exception { ServiceActivator.context = context; ScheduleService schedServ = new ScheduleService(); schedServ.setTdMapping(new HashMap&lt;String, String&gt;()); schedServ.setHtMapping(new HashMap&lt;String, String&gt;()); schedServ.setDoMapping(new HashMap&lt;String, String&gt;()); context.registerService(ScheduleService.class.getName(), schedServ, null); } @Override public void stop(BundleContext context) throws Exception { context.ungetService(context.getServiceReference(ScheduleService.class.getName())); ServiceActivator.context = null; } } And this is my MANIFEST file: Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: SM Schedule Query Service Bundle-SymbolicName: rsy.home.mac.sm.schedule.service.sm;singleton:=true Bundle-Version: 1.0.0 Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Service-Component: OSGI-INF/sm_schedule_service.xml Require-Bundle: rsy.home.mac.sm.jaxrs.lib;bundle-ve…
accepted answer: http://stackoverflow.com/a/22434039
has comment: http://stackoverflow.com/comment/34067963
has comment: http://stackoverflow.com/comment/34068677

http://stackoverflow.com/comment/33993670
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22363434
has text: You'll want to work with the actual `Spinner` object that the array backs instead of the array itself.

midlet
tags question: http://stackoverflow.com/q/22378954
tag name: midlet
type: Tag

http://stackoverflow.com/q/22403147
score: 1
tagged with: java
has title: How to hide request parameter value in url using Spring MVC
type: Question
has body: I'm working on language changes for my page.when the client clicks on any language, page should load in that particular language. For that I configured springs.xml like this The page was loading fine, when I'm give the url like this, site/companykey?lang=french, Now my problem is , I want to hide the param value which I have given ?lang=french. Is there any way to hide that value from the url ??
upvote count: 1
has answer: http://stackoverflow.com/a/22403381
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22403381
tagged with: url
favorite count: 0
tagged with: google-app-engine
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/comment/33942831
type: QuestionComment
type: Comment
has text: http://docs.oracle.com/javase/tutorial/uiswing/events/windowlistener.html
comment on: http://stackoverflow.com/q/22334749
score: 0

http://stackoverflow.com/q/22448616
has comment: http://stackoverflow.com/comment/34143099
has comment: http://stackoverflow.com/comment/34142514
has body: static int bookNum; I did do some stuff to bookNum in other code prior to this one so it has a value and I already defined it at the beginning. public static void processtrans()throws FileNotFoundException{ Scanner input = new Scanner(transFile); String line = input.nextLine(); double dollar = 0; int transNum = 1; while (input.hasNextLine()) { int Space = line.indexOf (" "); int Space2 = line.indexOf (" ", Space + 1); String action = line.substring(0,Space); if (action == "ORDER"){ int Space3 = line.indexOf (" ", Space2 + 1); String isbn = line.substring(Space + 1, Space2); int num = Integer.parseInt(line.substring(Space2 + 1, Space3)); int custNum = Integer.parseInt(line.substring(Space3 + 1)); for (int x = 0; x &lt; bookNum; x++){ if (bookarray[x][0] == isbn){ int stock = Integer.parseInt(bookarray[x][2]); if (stock &gt;= num){ stock -= num; bookarray[x][2] = Integer.toString(stock); System.out.println("Order filled"); } } } } line = input.nextLine(); } } This code compiled but didn't print anything so I started debugging it and realized that the program doesn't execute for loop, it jumps from: int custNum = Integer.parseInt(line.substring(Space3 + 1)); to: line = input.nextLine(); Can someone help me?
score: 0
type: UnansweredQuestion
has title: skipping running for loop
has comment: http://stackoverflow.com/comment/34142727
tagged with: java
has comment: http://stackoverflow.com/comment/34142643
has answer: http://stackoverflow.com/a/22448719
type: Question
tagged with: for-loop
answer count: 1
has comment: http://stackoverflow.com/comment/34143842

http://stackoverflow.com/a/22463529
upvote count: 1
downvote count: 0
type: AcceptedAnswer
has body: Are dollars and cents primitive long types? You'd want to use (dollars == otherObject.dollars) &amp;&amp; (cents == otherObject.cents) if they are. You can't call a method (such as equals()) on a primitive.
type: Answer
answers question: http://stackoverflow.com/q/22463171
score: 1
accepted answer of: http://stackoverflow.com/q/22463171

http://stackoverflow.com/comment/34186937
has text: if you are using the value in your MainActivity I guess you can use it like `RalaAlertDialog.onClick`. Also, you could make a public method that returns dialog.isShowing() so you can loop in your main activity...
type: Comment
comment on: http://stackoverflow.com/q/22466506
score: 0
type: QuestionComment

http://stackoverflow.com/a/22445346
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22445262
has body: The declaration of ImmutableMap.of() looks like this: public static &lt;K, V&gt; ImmutableMap&lt;K, V&gt; of(K k1, V v1, ...) It will therefore return by default the inferred type of the key and value, and generics are invariant (so &lt;String, PostType&gt; is not a subtype of &lt;String, Object&gt;). To force it into a Map&lt;String, Object&gt;, all you need to do is use (the ugly) explicit types: Map&lt;String, Object&gt; model = ImmutableMap.&lt;String, Object&gt;of("post", post)
type: Answer

http://stackoverflow.com/a/22373558
score: 3
type: AcceptedAnswer
downvote count: 0
has body: for(int i=0; i&lt;number.length-1; i++){ System.out.println(number[i]); } Should be // no '-1' // V for(int i = 0; i &lt; number.length; i++) { System.out.println(number[i]); } Why? Let's see what happens if there are 5 elements in the array, then they are indexed as follows: 0, 1, 2, 3, 4 If we use i &lt; 5-1 (or i &lt; 4), once i becomes 4, before the next iteration of the loop runs, it will stop, skipping the last index. In case the above doesn't explain it, note the order in which things happen in a for-loop: First the initialization occurs Then the following is repeated until the condition is false: The condition is checked A loop iteration is run The increment happens The most applicable part here is that a loop iteration will never run if the condition is false.
type: Answer
answers question: http://stackoverflow.com/q/22373348
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22373348

http://stackoverflow.com/comment/34095388
score: 0
type: Comment
has text: Would there be a mathematical relation between the input regions and the resulting labels?
type: AnswerComment
comment on: http://stackoverflow.com/a/22421761

http://stackoverflow.com/comment/34099168
type: Comment
type: QuestionComment
has text: @wahid_cse: Which part of the code is line `106`? Is it `stmt2.executeUpdate( sql2 );`
comment on: http://stackoverflow.com/q/22423194
score: 0

http://stackoverflow.com/a/22483714
answers question: http://stackoverflow.com/q/22483575
type: Answer
score: 0
has body: By synchronizing on the entire collection like that you are essentially replacing the fine-grained synchronization within the concurrent collection with your own blunt-force approach. If you aren't using the concurrency protections elsewhere then you could just use a standard HashMap for this and wrap it in your own synchronization. Using a synchronizedMap may work, but wouldn't cover multi-step operations such as above where you put, check, put.

http://stackoverflow.com/q/22476221
has comment: http://stackoverflow.com/comment/34193199
has title: number of cores effecting multithreading OS
answer count: 1
has comment: http://stackoverflow.com/comment/34192420
has comment: http://stackoverflow.com/comment/34191979
has comment: http://stackoverflow.com/comment/34189987
has comment: http://stackoverflow.com/comment/34192967
tagged with: operating-system
tagged with: context-switch
tagged with: multithreading
tagged with: process
has comment: http://stackoverflow.com/comment/34195035
has comment: http://stackoverflow.com/comment/34194413
has answer: http://stackoverflow.com/a/22479209
accepted answer: http://stackoverflow.com/a/22479209
has body: I'm trying to determine something regarding the way that my PC works, I have a dual core PC, and I'm trying to test it with a code I wrote, The program multiplies two matrices using threads (in java) when every thread handles matrix rows divided by the number of threads. So, testing my code on two 1024 X 1024 matrices I got this results - (all results are medians of 10 runs) 1 thread - 9.878 seconds\\\ 2 threads - 5.944 seconds\\\ 3 threads - 5.062 seconds\\\ 4 threads - 4.895 seconds \\\ 5 to 1024 threads , time varies between 4.8 to 5.3 seconds\\\ . What I'm trying to figure out is why the decline in time is lower with each of the first 4 threads? shouldn't the the work be divided equally between the cores? so that 1 thread 10 seconds 2 threads 5 seconds and the rest just take longer for I only have 2 cores and adding more threads is just creating more context switching . The second thing that I cant understand, assuming that after the 4th thread my PC just switches between threads which doesn't really split the job but rather just switches which thread does A certain job , shouldn't the time increase drastically with 1024 threads just because I'm making it do a lot of context switches ? Thanks in advance to any response in the matter add code - /** * A class representing matrix multiplying threads , implements runnable * used to test the time difference according to changes in amount of * threads used in the program ! * * @author R.G */ public class MatrixMultThread implements Runnable{ //Thread fields and constants private static final String INT_ERROR = "An error has occured during thread join"; private static final String THREAD_COUNT_ERROR = "Invalid number of threads"; static final int MATRIX_ROW = 1024; static final int MATRIX_COL = 1024; static final int UPPER_THREAD_LIMIT = MATRIX_ROW; private int startRow; private int endRow; private float[][] target; private float[][] sourceTwo; private float[][] sourceOne; /** * MatrixMultThread constructor - construct…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34191839
has comment: http://stackoverflow.com/comment/34194022
has comment: http://stackoverflow.com/comment/34190094
tagged with: java
has comment: http://stackoverflow.com/comment/34190351
has comment: http://stackoverflow.com/comment/34189974
has comment: http://stackoverflow.com/comment/34193280
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34190445

crash
tags question: http://stackoverflow.com/q/22460190
tag name: crash
tags question: http://stackoverflow.com/q/22413329
type: Tag
tags question: http://stackoverflow.com/q/22366559
tags question: http://stackoverflow.com/q/22340034
tags question: http://stackoverflow.com/q/22455662
tags question: http://stackoverflow.com/q/22354167

http://stackoverflow.com/q/22405346
type: AnsweredQuestion
tagged with: java
has body: I'm using io.netty-3.9.0.Final with protobuf to create and send messages with large size. I noticed that serialization and writing to CodedOutputStream takes a lot of time, and slows down my application thread. I expected this kind of work to be processed in Netty's IO worker threads. The Channel.write(Object) documentation says: "Sends a message to this channel asynchronously." Besides, upstream messages decoding occurs in I/O worker thread. So how can I move encoding from Channel.write() invokation thread to Netty's IO worker threads? The ChannelPipelineFactory#getPipeline() method looks like this: public ChannelPipeline getPipeline() throws Exception { final ChannelPipeline pipeline = Channels.pipeline(); // Decoder pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(MAX_FRAME_LENGTH, LENGTH_FIELD_OFFSET, LENGTH_FIELD_LENGTH, LENGTH_ADJUSTMENT, INITIAL_BYTES_TO_STRIP)); pipeline.addLast("protobufDecoder", new ProtobufDecoder(MessageProto.pMessage.getDefaultInstance())); pipeline.addLast("protoMessageDecoder", new ProtoMessageDecoder()); // Encoder pipeline.addLast("frameEncoder", new LengthFieldPrepender(LENGTH_FIELD_LENGTH)); pipeline.addLast("protobufEncoder", new ProtobufEncoder()); pipeline.addLast("protoMessageEncoder", new ProtoMessageEncoder()); pipeline.addLast("handler", upstreamHandler); return pipeline; }
type: Question
answer count: 1
score: 0
has title: Encode downstream messages in Netty's IO worker threads
tagged with: netty
has answer: http://stackoverflow.com/a/22425154
accepted answer: http://stackoverflow.com/a/22425154

http://stackoverflow.com/comment/34037760
type: Comment
has text: Yes, removing is pretty much an O(1) operation (not counting the queue management stuff, but I believe JDK authors have done a good job here too)
type: QuestionComment
comment on: http://stackoverflow.com/q/22388769
score: 0

http://stackoverflow.com/a/22468165
has body: You could store the value in a class instance variable and make it accessible via an accessor. public class Building{ private int floor = 0; private ArrayList&lt;Floor&gt; floors = new ArrayList&lt;Floor&gt;(); public Buliding(){ Floor floor1 = new Floor(this); this.floors.add(floor1); } public Floor floor(int floorNumber) { this.floor = floorNumber; return floors.get(floorNumber); } public int getFloor(){ return floor; } } If you add a constructor for Floor that accepts an instance of building and stores it as an instance variable you can access floor at any time. public class Floor{ private Building building; public Floor(Building building){ this.building = building; } public void waitForElevator(){ int floor = this.building.getFloor(); } } Another Solution Simply pass the int to waitForElevator as an argument. public class Floor{ public void waitForElevator(int floor){ System.out.println(floor); } } //Usage building.floor(3).waitForElevator(3); Note This solution is not as great because the client could invoke as building.floor(3).waitForElevator(4);
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22468126
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22468126
type: Answer
score: 2

http://stackoverflow.com/a/22415874
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34085809
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22414888
accepted answer of: http://stackoverflow.com/q/22414888
has body: If you're using a StackPane, and the pane in the front has a transparency set, then you can apply effects to the one in the back (i.e. the moving part). backPane.setRotateAxis(Rotate.Z_AXIS); backPane.setRotate(degrees); This is a simple effect, with no animation. For animating the whole thing, you'll have to use a Timeline + KeyFrame and KeyValue (look up examples), OR use the RotateTransition directly (JavaFX 2.x). For the later solution, use setCamera(new PerspectiveCamera()) on the scene.
upvote count: 1

http://stackoverflow.com/comment/34058396
type: QuestionComment
comment on: http://stackoverflow.com/q/22401177
score: 0
has text: I suppose first one would be faster.. but without some benchmark data its difficult to say.. By the way, what language your time-critical application will use?
type: Comment

http://stackoverflow.com/q/22359731
possible better answer: http://stackoverflow.com/a/22360956
tagged with: java
accepted answer: http://stackoverflow.com/a/22373709
has answer: http://stackoverflow.com/a/22360956
tagged with: process
type: Question
has title: Process (python script -> py2exe ) InputStream is NULL until Process ends
has comment: http://stackoverflow.com/comment/33986661
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/230751
has comment: http://stackoverflow.com/comment/33986726
has answer: http://stackoverflow.com/a/22373709
tagged with: py2exe
has comment: http://stackoverflow.com/comment/33986504
tagged with: multithreading
tagged with: python
has body: I am trying to catch on fly Process output like below: new Thread() { public void run() { final ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c", "myexec.exe"); p = builder.start(); InputStream i = p.getInputStream(); Reader r = new InputStreamReader(i, "US-ASCII"); int ch = 32; do { System.out.print(ch); } while ((ch = r.read()) != -1); } }.start(); As I see, while Process is running ch == null, when Process is terminated all missing chars are suddenly printed. How can I read output during Process running?
type: AnsweredQuestion

http://stackoverflow.com/comment/34145826
type: Comment
comment on: http://stackoverflow.com/q/22450125
has text: @Maverik It depends on how Task, Operation, and TaskFactory work. If you created them, you can probably sort something out, but I'm not sure if you'll be able to actually inject methods and fields without some sort of "instrumentation", which I'm afraid I can't help with.
score: 0
type: QuestionComment

http://stackoverflow.com/q/22484848
accepted answer: http://stackoverflow.com/a/22507112
type: Question
has comment: http://stackoverflow.com/comment/34206536
tagged with: servlets
has comment: http://stackoverflow.com/comment/34207497
has comment: http://stackoverflow.com/comment/34208006
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22507112
tagged with: http://stackoverflow.com/tag/zip
has comment: http://stackoverflow.com/comment/34206356
has title: Zip file created in servlet, but filename is only correct sometimes
has body: I am generating pdf's based on a user's choice and zipping them together in a servlet. I give the zip folder a file name, but when I use the web app to download the zip folder, the zip folder's file name is not always the file name that I gave to it. When I download the folder, it either (1) has the correct name (happens most of the time) or (2) it has the name of the servlet without the .zip suffix. In either case, the contents of the folder are correct. Scenario (2) is only happening in two particular cases. (i.e., when trying to bundle specific pdfs together.) During the debugging process, I checked to make sure that the file name is indeed correct. Also, no exceptions are being thrown, so I cannot even begin to understand what is wrong. Code java.util.zip.ZipOutputStream myZOS = new java.util.zip.ZipOutputStream(response.getOutputStream()); java.util.List&lt;String&gt; cIDs = Arrays.asList(request.getParameterValues("cID")); String rID = request.getParameter("rID"); String rName = ""; String cNames = ""; for(Integer i = 0; i &lt; cIDs.size(); i++) { if(!cNames.equals("")) //separate names with _ cNames += "_"; Foo myFoo = new Foo(Integer.valueOf(rID),Integer.valueOf(cIDs.get(i))); rName = myFoo.getName(); cNames += myFoo.getCID(); PDFDoc myPDFDoc = new PDFDoc(myFoo, request.getServerName()); java.util.zip.ZipEntry myZE = new java.util.zip.ZipEntry(myPDFDoc.getFilename()); myZOS.putNextEntry(myZE); myZOS.write(myPDFDoc.getPDF()); } logger.log(java.util.logging.Level.SEVERE, "rName: ".concat(rName).concat("; cNames: ").concat(cNames)); //correct name response.setContentType("application/zip"); response.setHeader("Content-disposition", "attachment; filename=\"" + rName + "_" + cNames + ".zip\""); response.getOutputStream().flush(); myZOS.close();
has comment: http://stackoverflow.com/comment/34206682
has comment: http://stackoverflow.com/comment/34215049
type: AnsweredQuestion
tagged with: filenames
has comment: http://stackoverflow.com/comment/34212691
tagged with: java

http://stackoverflow.com/comment/34197374
type: Comment
type: QuestionComment
score: 1
has text: Are there any exceptions in the stacktrace listed before VM aborts?
comment on: http://stackoverflow.com/q/22480237

http://stackoverflow.com/comment/127823057
type: AnswerComment
has text: What ***exact*** error message did you get? Please respond by [editing (changing) your answer](https://stackoverflow.com/posts/56866792/edit), not here in comments (***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/56866792

http://stackoverflow.com/q/22352015
tagged with: spring-3
score: 0
tagged with: java
has body: I have an application which suports login via linkedin and normal signin.For normal signin spring security is used and for linkedin signin spring social is using.If a user signup with linkedin password field in user table will be null.When that user tries to login through normal signin process an Http 500 error is occuring the exception details is as follows... java.lang.IllegalArgumentException: Encoded password cannot be null or empty org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder.matches(BCryptPasswordEncoder.java:77) org.springframework.security.authentication.dao.DaoAuthenticationProvider$1.isPasswordValid(DaoAuthenticationProvider.java:148) org.springframework.security.authentication.dao.DaoAuthenticationProvider.additionalAuthenticationChecks(DaoAuthenticationProvider.java:84) org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:149) org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156) org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:174) org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:94) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:195) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:3…
type: Question
has answer: http://stackoverflow.com/a/22381226
tagged with: spring-social
answer count: 1
tagged with: spring-security
has title: Supporting authentication with spring security and Linkedin login via spring social
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/22434622
answer count: 1
downvote count: 0
has title: FacesServlet URL Patterns
favorite count: 0
upvote count: 2
tagged with: java-ee-7
score: 2
type: AnsweredQuestion
tagged with: jsf
has body: I am not sure what I am doing wrong here but when I put the faces context twice in the URL it bypasses all of my Realm Securities. My URL Pattern: Faces /faces/* Security Constraint ADMIN <web-resource-collection> Protected Admin Area <description/> /faces/admin/* </web-resource-collection> <description/> ADMIN <description/> NONE So when i goto: http://domain.com/faces/admin/index.xthml i do get the proper response i am looking for. But if i goto: http://domain.com/faces/faces/admin/index.xhtml it completely lets me in regardless of the fact that the servlet is slated to be at /admin* I am assuming the * at the end of admin is what is causing it. But how can I solve this to where domain.com/faces/faces is invalid, and only domain.com/faces is valid? I cannot seem to find anyone else facing this issue. So i must be doing something wrong. Thank you
tagged with: java
has answer: http://stackoverflow.com/a/22441493
type: Question
accepted answer: http://stackoverflow.com/a/22441493

http://stackoverflow.com/comment/99530332
has text: spring-websocket is post 4.0, not spring 3.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/43647743
type: Comment

http://stackoverflow.com/a/22401496
has comment: http://stackoverflow.com/comment/34059151
score: 0
answers question: http://stackoverflow.com/q/22398977
has comment: http://stackoverflow.com/comment/34059531
has body: In your case if you need show the error as alert, then you can use javascript alert(). You can try alert(&lt;%=msg%&gt;). Hope it will help you.
type: Answer
has comment: http://stackoverflow.com/comment/34059242
has comment: http://stackoverflow.com/comment/34059091

svd
type: Tag
tags question: http://stackoverflow.com/q/22404743
tag name: svd

http://stackoverflow.com/comment/33999102
type: QuestionComment
has text: @ajb Ahh is that why nothing works, I'll try some C++ thanks for the tip
type: Comment
comment on: http://stackoverflow.com/q/22366477
score: 0

http://stackoverflow.com/comment/33955410
comment on: http://stackoverflow.com/q/22341518
score: 0
type: Comment
type: QuestionComment
has text: You're making at least three major mistakes. (1) You're creating object streams in the accept thread. They should be created in the `run()` method of the handler thread. Otherwise you can block the accept loop. (2) You're testing `readObject()` for returning `null.` It doens't return `null` unless you wrote `null,` and that isn't necessarily a signal to stop reading objects. You should be catching `EOFException` instead to detect end of stream. (3) You're creating the `ObjectInputStream` before the `ObjectOutputStream.` That can cause a deadlock. The `ObjectOutputStream` must be created first.

http://stackoverflow.com/comment/34151619
has text: I am running a 32 bit version of Erlang.
comment on: http://stackoverflow.com/a/22441667
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34086142
score: 1
type: AnswerComment
type: Comment
has text: +1 There's also a good existing post on using AtomicInteger an a sequence: http://stackoverflow.com/questions/14338533/atomicinteger-and-volatile
comment on: http://stackoverflow.com/a/22416927

http://stackoverflow.com/comment/33971967
score: 0
type: Comment
type: QuestionComment
has text: Check this for more infos, if works for you upvote ;) http://stackoverflow.com/questions/22203162/images-not-loading-when-running-jar-file/22203605#22203605
comment on: http://stackoverflow.com/q/22351377

http://stackoverflow.com/a/31957719
answers question: http://stackoverflow.com/q/22349772
has body: I think session.getQueryParameterString(); not work in this case. If you using POST, PUT, you should want to try this code: Integer contentLength = Integer.parseInt(session.getHeaders().get("content-length")); byte[] buffer = new byte[contentLength]; session.getInputStream().read(buffer, 0, contentLength); Log.d("RequestBody: " + new String(buffer)); In fact, I tried IOUtils.toString(inputstream, encoding) but it cause Timeout exception!
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/63529720
score: 12
type: Answer
has comment: http://stackoverflow.com/comment/110252133

awt
tags question: http://stackoverflow.com/q/22339157
tags question: http://stackoverflow.com/q/22339329
tags question: http://stackoverflow.com/q/22467906
tags question: http://stackoverflow.com/q/22444789
tags question: http://stackoverflow.com/q/22432161
tags question: http://stackoverflow.com/q/22397970
tag name: awt
tags question: http://stackoverflow.com/q/22368610
tags question: http://stackoverflow.com/q/22349190
tags question: http://stackoverflow.com/q/22458088
tags question: http://stackoverflow.com/q/22467544
tags question: http://stackoverflow.com/q/22375422
tags question: http://stackoverflow.com/q/22417890
tags question: http://stackoverflow.com/q/22412350
type: Tag
tags question: http://stackoverflow.com/q/22423804
tags question: http://stackoverflow.com/q/22371799
tags question: http://stackoverflow.com/q/22394845
tags question: http://stackoverflow.com/q/22471530

http://stackoverflow.com/q/22371760
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34009643
has body: This there anything wrong with my code? I'm new to Java and i'm trying to import a file into MongoDB. However there is a error that i have no idea what is it. I am using Eclipse. import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import com.mongodb.DB; import com.mongodb.DBCollection; import com.mongodb.DBCursor; import com.mongodb.DBObject; import com.mongodb.Mongo; import com.mongodb.util.JSON; import com.mongodb.util.JSONParseException; public class readwrite { public static void main(String[] args) throws FileNotFoundException,IOException,JSONParseException{ Mongo mongo = new Mongo("localhost", 27017); DB db = mongo.getDB("actualdata"); DBCollection collection = db.getCollection("metadata"); String line = null; StringBuilder sb = new StringBuilder(); try { FileInputStream fstream = null; try { fstream = new FileInputStream("/home/Output/json1-100000-all"); } catch (FileNotFoundException e) { e.printStackTrace(); System.out.println("File does not exist, exiting"); return; } BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fstream)); while((line = bufferedReader.readLine()) != null) { System.out.println(line); DBObject dbObject; sb.append(dbObject = (DBObject) JSON.parse(bufferedReader.readLine())); collection.insert(dbObject); DBCursor cursorDoc = collection.find(); while (cursorDoc.hasNext()) { System.out.println(cursorDoc.next()); } } bufferedReader.close(); } catch(FileNotFoundException ex) { System.out.println("Unable to open file"); } catch(IOException ex) { System.out.println( "Error reading file"); } } } This is the error that is displayed [ Exception in thread "main" com.mongodb.util.JSONParseException: { ^ at com.mongodb.util.JSONParser.read(JSON.java:272) at com.mongodb.util.JSONParser.parseObject(JSON.java:230) at com.mongodb.util.JSONParser.parse(JSON.java:195) at com.mongodb.util.JSONParser.parse(JSON.java:145) at co…
type: Question
tagged with: mongodb
has title: The source attachment does not contain the source for the file JSON.class
has comment: http://stackoverflow.com/comment/34008213
answer count: 1
has comment: http://stackoverflow.com/comment/35775342
has answer: http://stackoverflow.com/a/22372412
type: UnansweredQuestion
score: 0

http://stackoverflow.com/q/22452593
answer count: 2
has comment: http://stackoverflow.com/comment/34150643
has body: I am stuck with hibernate configuration file exception, this is my hibernate.cfg.xml file: <?xml version='1.0' encoding='utf-8'?> <hibernate-configuration xmlns="http://www.hibernate.org/xsd/hibernate-configuration" xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration hibernate-configuration-4.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> org.postgresql.Driver jdbc:postgresql://localhost:5432/hibernatedb postgresql password 1 org.hibernate.dialect.PostgresPlusDialect thread org.hibernate.cache.internal.NoCacheProvider true update <mapping resource="org.person.PersonModel"/> </hibernate-configuration> I am using hibernate-core-4.1.12.Final.jar, I am getting the following exception: INFO: HHH000040: Configuration resource: /hibernate.cfg.xml Exception in thread "main" org.hibernate.MappingException: invalid configuration at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2022) at org.hibernate.cfg.Configuration.configure(Configuration.java:1939) at org.hibernate.cfg.Configuration.configure(Configuration.java:1918) at org.person.PersonPersistance.main(PersonPersistance.java:14) Caused by: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 25; Document is invalid: no grammar found. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) By seeing the respective exception I came to know that I have some mistake in my configuration file. I want to know what mistake I have done in my configuration file.
has title: Exception in thread "main" org.hibernate.MappingException: invalid configuration in hibernate4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26489278
has answer: http://stackoverflow.com/a/32265057
tagged with: hibernate-4.x
has comment: http://stackoverflow.com/comment/34149533
tagged with: java
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/12288516
score: 0

http://stackoverflow.com/q/22417755
favorite count: 0
tagged with: resultset
has body: I'm trying to compare a resultset to a string, but can't seem to get it to work. This is is what I'm trying: if(resultset.getString("name").equals("George")) When I printout resultset.getString("name") I get George. So they should be equal? I also have a comparator using resultset.getInt("Age") that works, so I thought maybe I could be clever and use compareTo instead of equeals, but when I try, if(resultset.getString("name").comparesTo("George")) I was expecting to get 0, but I get 93??? What am I missing?
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34087651
has answer: http://stackoverflow.com/a/22417795
upvote count: 2
has comment: http://stackoverflow.com/comment/34087605
type: Question
has title: How to compare Resultset.getString() to String in Java?
tagged with: java
accepted answer: http://stackoverflow.com/a/22417795
answer count: 1
downvote count: 0
tagged with: string

http://stackoverflow.com/comment/34194514
comment on: http://stackoverflow.com/q/22442247
type: QuestionComment
type: Comment
has text: you seem to be confused between compute engine, app engine, and your local shell..
score: 0

http://stackoverflow.com/q/22478570
has answer: http://stackoverflow.com/a/28031987
tagged with: bamboo
has title: Bamboo plugin for cucumber reports?
accepted answer: http://stackoverflow.com/a/28031987
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: cucumber
has body: I have used Cucumber with Jenkins in the past and jenkins-cucumber-jvm-reports-plugin-java is fantastic. All I need to do is to generate a cucumber json output to get a beautiful report. My new project uses Bamboo and I could not find anything similar or atleast something closer. Has any one have experience using Cucumber and Bamboo? Could use some helpful pointers. As this exercise is POC, either Ruby or Java would be great.
tagged with: cucumber-jvm
answer count: 1
downvote count: 0
favorite count: 0
tagged with: ruby

http://stackoverflow.com/q/22452190
accepted answer: http://stackoverflow.com/a/22452532
possible better answer: http://stackoverflow.com/a/22452361
tagged with: string
has title: What is the difference between getRichStringCellValue().getString() and getRichStringCellValue().toString()
type: AnsweredQuestion
tagged with: apache-poi
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22452532
tagged with: excel
type: Question
has body: I am currently using Apache POI for handling MS Excel files, and I came across something that seemed weird to me. The HSSFCell class has a method called getRichStringCellValue() that returns a HSSFRichTextString object. In order to convert this to a normal string, we use getString(). Looks like this: cell.getRichStringCellValue().getString() Now what got me wondering is, why is there a getString() in the first place, when toString() does essentially the same thing, i.e. returns the string equivalent? Does anyone know why?
has answer: http://stackoverflow.com/a/22452361
answer count: 2

http://stackoverflow.com/a/22393900
type: Answer
answers question: http://stackoverflow.com/q/22393755
has body: It depends. If all your code is just in the main method, then declare the variables in the method. However, if other methods or classes need access to them, then they need to be declared globally. In this case it is better to make the fields local instead of global. P.S. If you want your variables to not be static you could always create an instance of the class. public class Copy { public Scanner scanInput = new Scanner(System.in); public String captureString; public static void main(String[] args){ new Copy(); } public Copy() { System.out.println("Please enter some words.."); captureString = scanInput.nextLine(); System.out.println("You entered: " + captureString); } } This way you will waste memory creating static fields.
score: 0

http://stackoverflow.com/comment/33938472
type: Comment
has text: what do you mean by "file" do you mean FileInputStream?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22332227

http://stackoverflow.com/comment/64441692
has text: by default mysql listen to port 3306
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/32323382
type: Comment

http://stackoverflow.com/a/22468426
answers question: http://stackoverflow.com/q/22468069
has body: I'm trying to resize a label in MouseEntred, Define "resize". You are adding your JLabels to a panel using a GridLayout. All the labels are already set to the maximum size permitted by the space available to the panel, so what do you expect the resize to do? If you want it to appear that the label is getting bigger, then maybe you can assign a MatteBorder to each label. You can make the MatteBorder whatever size you want and then set the color equal to the background color of the panel. If you want to animate then then you can use a Swing Timer. In the mouse#ntered you start the Timer. Every time the Timer fires you change the MatteBorder to be one less pixedl until the size is zero and you stop the Timer. On mouseExited, you just restore the default Border. See the sections from the Swing tutorial on How to Use Timers and How to Use Borders for more information.
score: 1
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/22399454
has answer: http://stackoverflow.com/a/22399764
has answer: http://stackoverflow.com/a/22399750
tagged with: dynamic
has body: Hello well I made a code that will download an app, and that's all working fine. My question is I want to display on the frame "Please wait until the jar is done downloading...50% done" I want the 50% to change with the % left of the file being downloaded. I got that all set but the part where it changes is what is not working. Heres my code: while(( length = inputstream.read(buffer)) &gt; -1) { down += length; bufferedoutputstream.write(buffer, 0 , length); String text = clientDL.label1.getText(); text += getPerc() + "%"; } And here is my getPerc() method: private int getPerc() { return (down / (sizeOfClient + 1)) * 100; } Thanks.
possible better answer: http://stackoverflow.com/a/22399750
type: Question
has answer: http://stackoverflow.com/a/22399850
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22399995
has comment: http://stackoverflow.com/comment/34056544
has title: How would I make text dynamic from events?
score: 0
has answer: http://stackoverflow.com/a/22399903
answer count: 5
accepted answer: http://stackoverflow.com/a/22399995

soa
type: Tag
tag name: soa
tags question: http://stackoverflow.com/q/22420239

http://stackoverflow.com/comment/34074600
has text: @LuiggiMendoza sorry, it's hard possible to get necessary information in search with my bad english, i don't know what i need to search sometimes
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22410548

http://stackoverflow.com/a/22394378
upvote count: 4
has comment: http://stackoverflow.com/comment/34086641
has comment: http://stackoverflow.com/comment/34113649
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22394358
has comment: http://stackoverflow.com/comment/34113628
answers question: http://stackoverflow.com/q/22394358
score: 4
has comment: http://stackoverflow.com/comment/34088615
has comment: http://stackoverflow.com/comment/34064325
has comment: http://stackoverflow.com/comment/34111903
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34075865
has comment: http://stackoverflow.com/comment/34113232
has comment: http://stackoverflow.com/comment/34088060
has comment: http://stackoverflow.com/comment/34050572
has comment: http://stackoverflow.com/comment/34074262
has body: Yes, relative placement of components is easily achieved with use of layout managers. Yes, all components have a setEnabled(...) and a setVisible(...) method either of which can be called at any time during a program's run. The former helps you activate/inactivate components and the latter helps make them visible/invisible. If you want to swap complete "views", use a CardLayout. Regarding: Can someone suggest me whether we can achieve them through some examples. Please, you first as I strongly believe that the onus of effort here should be yours, the questioner's, since you're the one asking the questions, and the one with the most to learn by coding as much as possible. Let's see your attempts and we can help you with them. Otherwise the best examples are to be found at the Swing Tutorials. For links, please look here: Swing Tag Info. Edit You ask: I tried the above posted code,conditionally disabling the text field works well but getting a label doesn't work. Can you please suggest on that? I don't see you adding your JLabel to any component. If you are going to create a component on an event, you must add it to a component whose ancestor hierarchy eventually reaches a visible top-level component such as a JFrame. Then after adding a component to a container (say a JFrame), you must call revalidate() on the container to have its layout managers re-layout its components, and then repaint() to repaint any "dirty" pixels. I again will re-iterate that you're far better off not using null layout and absolute positioning, but rather using layout managers and relative positioning. If you want a label with and without visible text, it's often best to add an empty JLabel to the GUI on GUI creation, and just set its text when needed, as long as the label is located somewhere that allows its text to shrink and expand. Also, as to your current problem, you might wish to show a picture of what you're trying to achieve, and what you're getting. Or if you can't post a picture he…
has comment: http://stackoverflow.com/comment/34075766
type: Answer
has comment: http://stackoverflow.com/comment/34086941

http://stackoverflow.com/a/22479484
has body: I want to run a program with multi-core support. Front end is in java. But java VM doesn't support parallel programming. Only one thread will run at a time. Elixier is better in parallel programming. So I tried to create the back end using elixir. I need help on calling the elixir methods. In this case, to use the power of concurrency, you should implement the Java front end as a TCP client. And implement the Elixir backend as a TCP server, that is handling client requests and respond with messages.
type: Answer
answers question: http://stackoverflow.com/q/22478053
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22478053
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/34227937
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22474276
has text: Hey fge, I used priorities, just to make my class more understandable that which test case is executing first, if I don't use it, the test cases will still execute in the same manner from top to bottom. I think method dependencies doesn't have their own priorities and it depends on us when we want to execute dependent methods by giving them priorities. I'm still not sure why this issue is arising.

http://stackoverflow.com/a/22368992
answers question: http://stackoverflow.com/q/22368801
upvote count: 1
downvote count: 0
has body: The exception is due to the incorrect formation of SQL query, Try to put your Strings in the single qoute, for e.g. +"'ebmdevii.messagebroadcast.com'"+
type: Answer
score: 1

http://stackoverflow.com/a/22480802
has body: I'm not fully understanding the question. Why is the server sending the first message? Shouldn't the client be requesting for a web service via HTTP initially? From what I understand, SOAP requests are wrapped within an http message. HTTP messages assumes a TCP connection and requires a response. This suggests that a client must respond when the server sends an http header. Basically whatever one end sends to another, the other end must reply. The ACK return from you step 2 will always be present. EDIT: I think the reason for the difference in time when requesting via local and remote is simply the routing that happens in the real network versus on your local machine. It's not the number of steps taken in your SOAP request and response.
has comment: http://stackoverflow.com/comment/34198803
has comment: http://stackoverflow.com/comment/34198536
score: 0
answers question: http://stackoverflow.com/q/22479633
type: Answer
has comment: http://stackoverflow.com/comment/34198636

http://stackoverflow.com/comment/34103858
comment on: http://stackoverflow.com/q/22426887
type: Comment
has text: Start by reading up on the APIs available in Java for manipulating XML documents. I'd suggest either DOM or SAX -- DOM might be easier for a beginner. The JAXP APIs, which ship with Java, provide XML parsers (for input) and serializers (for output) for either of those options.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34041832
has text: could you help me on how to do this?
comment on: http://stackoverflow.com/a/22391505
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22416585
has comment: http://stackoverflow.com/comment/34088314
has answer: http://stackoverflow.com/a/22416697
has body: Using my Computer class my computer class in the last project,I am supposed to write a program in Java that reads a file of computer data name computers.txt, and creates an array of Computer objects and so far I have this. package project5; import java.util.Scanner; import java.io.*; public class Project5 { public static void main(String[] args){ String[][] compArray = new String[50][50]; String line = ":"; String [] temp; Scanner file =null; try { file = new Scanner(new File("computers.txt")); } catch(FileNotFoundException e) { System.out.println("Could not open file " + "computers.txt"); System.exit(200); } int i = 0; while ((line = file.nextLine())!= null){ temp = line.split(":"); for (int j = 0; j&lt;compArray[i].length; j++) { compArray[i][j] = temp[j]; } i++; } System.out.println(compArray[0][0]); } } Now I get an error. I did System.out.println(compArray[0][0]); to see if it was working but i got that error Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8 at project5.Project5.main(Project5.java:44) the computers.txt file looks like this Dell Computers Inc.:Inspiron 15 Touch:6:500:Intel Core i5:CD/DVD+-RW:Windows 8.1:649.99 Dell Computers Inc.:Inspiron 17:4:500:Intel Core i3:CD/DVD+-RW:Windows 7:549.99 Dell Computers Inc.:Alienware 18:16:1000:Intel Core i7:Dual Layer Blu-ray:Windows 7:2999.99 Acer Computers Inc.:Aspire AT3-600:6:2000:Intel Core i5:BlueRay:Windows 8:599.99 I need help with creating an array when reading the file
has comment: http://stackoverflow.com/comment/34087986
downvote count: 0
tagged with: text-files
favorite count: 0
has answer: http://stackoverflow.com/a/25103231
tagged with: java.util.scanner
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34088993
has comment: http://stackoverflow.com/comment/34089017
upvote count: 1
has comment: http://stackoverflow.com/comment/34087745
has comment: http://stackoverflow.com/comment/34087913
has comment: http://stackoverflow.com/comment/34088240
score: 1
has comment: http://stackoverflow.com/comment/34088085
tagged with: java
has title: Create an array of object when scanner reads a text file
type: Question
has comment: http://stackoverflow.com/comment/34088106
answer count: 2

http://stackoverflow.com/comment/34096853
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22422974
has text: can you tell me how? because our teacher didnt explain that code to us.. and i don't know how to debug that code.. can you help me?
score: 0

http://stackoverflow.com/comment/34188370
comment on: http://stackoverflow.com/q/22475018
score: 0
type: Comment
type: QuestionComment
has text: You can optimise e * d % f as `(e % f) * (d % f) % f` The significance of this is that you can make the expressions smaller and you can be assured that you only need to consider `d` to `d + f - 1`

http://stackoverflow.com/comment/33951616
score: 0
type: Comment
type: QuestionComment
has text: @ErstwhileIII Is there in way in generics we can do it by using super keyword like <T super Animal> ??
comment on: http://stackoverflow.com/q/22339348

http://stackoverflow.com/q/22416304
has answer: http://stackoverflow.com/a/22416567
has comment: http://stackoverflow.com/comment/34085231
has comment: http://stackoverflow.com/comment/34085550
score: 0
tagged with: java
has body: I am creating a multhreaded Client -Server chat application in Java. I want to store all the messages into a data structure and write it to a file (means I want to create logs of messages). Will StringBuffer be a good option? Or there are any other better alternatives ?
has comment: http://stackoverflow.com/comment/34085211
type: Question
has comment: http://stackoverflow.com/comment/34085423
has comment: http://stackoverflow.com/comment/34085190
tagged with: chat
has title: Java - Multiithreaded Chat Service- Store Messages
answer count: 2
has answer: http://stackoverflow.com/a/22416530
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/33999747
comment on: http://stackoverflow.com/a/22362706
has text: This will indeed work, although I guess the `HashMap` (`Map` is an interface), will create a large amount of overhead. Furthermore it is even possible that the memory overhead will be larger (as a `HashMap` stores the keys and some kind of `LinkedList` as well).
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22403537
answer count: 1
tagged with: jax-rs
has title: Does RESTEasy have any helper to create Application configuration?
favorite count: 0
tagged with: resteasy
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34062712
downvote count: 0
score: 1
tagged with: java
type: Question
has body: Using Jersey I can configure my application by extending the ResourceConfig class which in turn extends javax.ws.rs.core.Application. public class MyApplication extends ResourceConfig { public MyApplication() { super(JacksonJaxbJsonProvider.class); packages(MyApplication.class.getPackage().getName()); } } Is there any similar helper class in RESTEasy? I need especially to scan packages in order to find resource classes. I know that it's possible in web.xml but I'd like to do it inside the code.
has answer: http://stackoverflow.com/a/22405668
upvote count: 1

http://stackoverflow.com/q/22459614
type: UnansweredQuestion
has body: Hy! A similar questions have been asked on this platform (stackoverflow) like this, etc. But I need to get the mobile details upon when an Iphone,Ipad or an Ipod user will visit my site I will get his details using Javascript, or Java/Jsp/Servlets. The details I need are as follows: Model Name // IPhone 3g, Iphone 4s, IPhone 5s, Iphone 5c, IPad 1 , etc OS Type //IOS OS Version //6.1.1 or 6.1.2 etc According to my research many users have done through javascript but they only just detect Model not complete with 4s etc. Also I came across this which give specific code against UserAgent of different Iphone/Ipad/Ipod but when I tested through online simulators there were 50% chances of there correction. Kindly guide. Edit: There is a correction! I came to know that in user-agent there is a build version (Build Version of an OS) included through which we can check that that a specific OS say 6 was released for multiple devices say Iphone 3gs, 4s , Ipad and so on. But is there a build for hardware specific firmware which uniquely identifies the device?
has comment: http://stackoverflow.com/comment/34173424
linked to: http://stackoverflow.com/q/11197509
tagged with: java
type: Question
tagged with: iphone
tagged with: ios
tagged with: jsp
has title: Detecting IPhone, IPad, IPod
score: 0
has comment: http://stackoverflow.com/comment/34181402
tagged with: user-agent
has comment: http://stackoverflow.com/comment/34182227
answer count: 0

http://stackoverflow.com/a/22369845
has comment: http://stackoverflow.com/comment/34004623
score: 2
downvote count: 0
has body: Call a query to retrieve image and use something like this. byte[] imgData = null; if (rs.next ()) { Blob img = rs.getBlob(1); imgData = img.getBytes(1,(int)img.length()); BufferedImage image = ImageIO.read(new ByteArrayInputStream(imgData)); yourJLabelInstance.setIcon(new ImageIcon(image)); } The yourJLabelInstance is a JLabel created and added to your frame.
answers question: http://stackoverflow.com/q/22369588
has comment: http://stackoverflow.com/comment/34011753
accepted answer of: http://stackoverflow.com/q/22369588
has comment: http://stackoverflow.com/comment/34011656
has comment: http://stackoverflow.com/comment/34004468
has comment: http://stackoverflow.com/comment/34012359
has comment: http://stackoverflow.com/comment/34004540
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34010495
has comment: http://stackoverflow.com/comment/34010611
type: Answer

http://stackoverflow.com/comment/34075043
score: 0
type: Comment
has text: What do you mean, "compact way"? It depends on what your requirements for `equals` is. If you don't need it all, delete some. IIRC there are some reflective ones as well, alternate generators, and ways to choose which fields are used.
type: QuestionComment
comment on: http://stackoverflow.com/q/22410847

http://stackoverflow.com/comment/33937973
type: Comment
has text: He is not trying to add to the `Set` he is just calling a method on each element.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22331902

http://stackoverflow.com/a/22427745
has body: You're doing two things wrong: Generating a key from a password by using the key to seed a PRNG is a bad idea. Use password-based-encryption instead. Java has an implementation of PKCS#5 that will generate a key from a password. You need to use a new strong-random IV for each encryption: When you encrypt, don't specify an IV in cipher.init(). A new one will be generated for you. encrypt() needs to serialise both the IV (cipher.getIV()) and the ciphertext into a byte array. decrypt(): separate the IV from the ciphertext, build an IvParameterSpec from it and feed into cipher.init() as you currently do.
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22427479
answers question: http://stackoverflow.com/q/22427479
upvote count: 2

http://stackoverflow.com/q/22455269
tagged with: java-5
tagged with: java-7
answer count: 1
score: 0
has body: For a University assignment, I need to write a program but use Java 5 for this reason: Please use Java5: each time you call the System.out.write() method it issues one write system call. Do not use Java6 or Java7 for this exercise! Its implementation is very different. I already have Java 7 installed. I'm afraid that if I uninstall it, and then install Java 5, there will be frustrating issues coming up that I need to solve. Can I easily install Java 5 beside Java 7? What's the best way to do this without confusing myself or my computer? I only need Java 5 installed very briefly (few days).
has comment: http://stackoverflow.com/comment/34153492
type: UnansweredQuestion
has title: Temporarily downgrading to Java5 as smoothly as possible
tagged with: java
has answer: http://stackoverflow.com/a/22455625
type: Question

http://stackoverflow.com/comment/34175811
type: Comment
comment on: http://stackoverflow.com/a/22467536
has text: thats the thing it outputs 16 instead of 14
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34066247
comment on: http://stackoverflow.com/q/22405399
type: QuestionComment
type: Comment
score: 0
has text: Im using Textpad right now cause I want to learn how to write the whole code myself ..I dont rather using Eclipse and I dont have its software now ,,,

http://stackoverflow.com/a/22463078
has body: If you don't want to mess with ready libraries you can just make a class like this. public class JsonConverter { //Your class here, or you can define it in the constructor Class requestclass = PositionKeeperRequestTest.class; //Filename String jsonFileName; //constructor public myJson(String jsonFileName){ this.jsonFileName = jsonFileName; } //Returns a json object from an input stream private JSONObject getJsonObject(){ //Create input stream InputStream inputStreamObject = getRequestclass().getResourceAsStream(jsonFileName); try { BufferedReader streamReader = new BufferedReader(new InputStreamReader(inputStreamObject, "UTF-8")); StringBuilder responseStrBuilder = new StringBuilder(); String inputStr; while ((inputStr = streamReader.readLine()) != null) responseStrBuilder.append(inputStr); JSONObject jsonObject = new JSONObject(responseStrBuilder.toString()); //returns the json object return jsonObject; } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } //if something went wrong, return null return null; } private Class getRequestclass(){ return requestclass; } } Then, you can use it like this: JSONObject jObject = new JsonConverter(FILE_NAME).getJsonObject();
type: Answer
upvote count: 11
downvote count: 1
score: 10
answers question: http://stackoverflow.com/q/22461663

http://stackoverflow.com/q/22382453
has title: Java 8 Streams FlatMap method example
tagged with: java-stream
has answer: http://stackoverflow.com/a/42157326
has comment: http://stackoverflow.com/comment/61706352
score: 96
tagged with: java
linked to: http://stackoverflow.com/q/26684562
has answer: http://stackoverflow.com/a/22384113
has body: I have been checking the upcoming Java update, namely: Java 8 or JDK 8. Yes, I am impatient, there's a lot of new stuff, but, there is something I don't understand, some simple code: final Stream&lt;Integer&gt;stream = Stream.of(1,2,3,4,5,6,7,8,9,10); stream.flatMap(); the javadocs are public &lt;R&gt; Stream&lt;R&gt; flatMap(Function&lt;? super T,? extends Stream&lt;? extends R&gt;&gt; mapper) Returns a stream consisting of the results of replacing each element of this stream with the contents of a mapped stream produced by applying the provided mapping function to each element. Each mapped stream is closed after its contents have been placed into this stream. (If a mapped stream is null an empty stream is used, instead.) This is an intermediate operation. I would appreciate if somebody created some simple real-life examples about flatMap, how you could code it in previous java versions Java[6,7] and how you can code the same routines using Java 8.
has comment: http://stackoverflow.com/comment/34028444
has answer: http://stackoverflow.com/a/40433825
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/22384113
has comment: http://stackoverflow.com/comment/34028161
has answer: http://stackoverflow.com/a/22384132
has answer: http://stackoverflow.com/a/28402445
has answer: http://stackoverflow.com/a/26106616
favorite count: 0
has comment: http://stackoverflow.com/comment/34027464
type: Question
has answer: http://stackoverflow.com/a/47335996
upvote count: 96
has comment: http://stackoverflow.com/comment/34025550
accepted answer: http://stackoverflow.com/a/22384132
tagged with: flatmap
tagged with: java-8
answer count: 7
has comment: http://stackoverflow.com/comment/50448882

http://stackoverflow.com/a/22352114
has body: String listwords = ""; for(int i = 0; i &lt; 50; i++){ char randomChar = (char)((Math.random()*255)+32); System.out.print(randomChar); listwords = listwords + randomChar; } System.out.print(listwords);
answers question: http://stackoverflow.com/q/22352022
has comment: http://stackoverflow.com/comment/33974239
score: 0
type: Answer

securesocial
tags question: http://stackoverflow.com/q/22462967
type: Tag
tag name: securesocial
tags question: http://stackoverflow.com/q/22445461

http://stackoverflow.com/a/22438082
accepted answer of: http://stackoverflow.com/q/22437966
has comment: http://stackoverflow.com/comment/34123312
answers question: http://stackoverflow.com/q/22437966
has comment: http://stackoverflow.com/comment/34123081
has comment: http://stackoverflow.com/comment/34123047
has comment: http://stackoverflow.com/comment/34123061
has comment: http://stackoverflow.com/comment/34123189
type: AcceptedAnswer
upvote count: 6
has comment: http://stackoverflow.com/comment/34123221
type: Answer
has body: If your have the referee of JFrame then you can do it in this way. int count = 0; for (Component comp : frame.getContentPane().getComponents()) { System.out.println(comp.getBackground()); if (count == 6) { comp.setBackground(Color.GREEN); } count++; } Here 6 represent 2nd row and 3rd column as in the same order the JPanel are added in JFrame. Complete Sample Code [EDITED] import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridLayout; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; public class Maze { private JFrame frame = null; public Maze(int length) { frame = new JFrame(); JPanel panel = new JPanel(new GridLayout(length, length, 5, 5)) { private static final long serialVersionUID = 1L; @Override public Dimension getPreferredSize() { return new Dimension(500, 500); } }; for (int i = 0; i &lt; length; i++) { for (int j = 0; j &lt; length; j++) { JPanel p2 = new JPanel(); p2.setBackground(Color.red); panel.add(p2); } } frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("Maze Game"); frame.setContentPane(panel); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } public void setPanelColor(int index) { frame.getContentPane().getComponents()[index].setBackground(Color.GREEN); } public static void main(String[] a) { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { } Maze maze = new Maze(4); maze.setPanelColor(6); } }); } } Edits: EventQueue.invokeLater() All GUI related things in java should always go through a single thread. The thread is our legendary AWT-EventQueue . Hence all GUI related actions should necessarily go through the AWT Event thread. If not so you may end up in a deadlock. Read more Should we use EventQueue.invokeLater for any GUI update in a Java desktop application? UIManager.setLookAndFeel() UIManager manages the …
has comment: http://stackoverflow.com/comment/34123079
downvote count: 0
has comment: http://stackoverflow.com/comment/34123254
score: 6
has comment: http://stackoverflow.com/comment/34123111

http://stackoverflow.com/a/22339143
has body: You cannot have multiple catch blocks with the same class i.e. Exception If you have multiple Exceptions you need to create a separate class for each one and make your catch block for a specific class Just be aware the order of your catch block must go from the more specific to the more generic class e.g. try { } catch (FileNotFoundException e) { System.err.println("FileNotFoundException: " + e.getMessage()); } catch (IOException e) { System.err.println("Caught IOException: " + e.getMessage()); } catch (Exception e) { System.err.println("Caught Exception: " + e.getMessage()); } catch (Throwable e) { System.err.println("Caught Throwable: " + e.getMessage()); } So in the above code if the exception is of FileNotFoundException only the first catch will be executed. Otherwise the catch block with Exception is going to be executed for any instance of Exception class that was not caught in the previous catch blocks At the end Throwable will catch anything that does not inherent from Exception such as Error
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/33950755
score: 1
answers question: http://stackoverflow.com/q/22339052
upvote count: 1

http://stackoverflow.com/comment/34147983
comment on: http://stackoverflow.com/a/22451945
score: 0
type: AnswerComment
has text: but this method return all the hyperlinks in that page. what i need is the relevant links only
type: Comment

http://stackoverflow.com/comment/34049837
score: 0
comment on: http://stackoverflow.com/q/22396043
type: Comment
type: QuestionComment
has text: Something is wrong here, does one department have only one parentdepartment? If you are deleting parentdepartment, first remove all the references in the department table, i think many other rows has reference to the parentdepartment which you are trying to delete, that could be the reason. Try to see the department table, ifany other row has this parentdept id. If so, you may have to use many to one relation instead of one-one

http://stackoverflow.com/a/22333682
has body: when you use synchronized(Singleton.class) the synchronization gets applied only until the first time an instance is created, and its used when we have a scenario where their is possibility of multiple thread running thru our code. Your if loop will take care of not creating another instance when already one is available, by using this way of synchronization we reduce a lot of over head since we know synchronized classes add over head in terms of time/wait.
answers question: http://stackoverflow.com/q/22333514
type: Answer
score: 0

http://stackoverflow.com/a/22440974
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34668326
answers question: http://stackoverflow.com/q/22440826
has body: We will assume that you use Java 7, since this is 2014. Here is a method which will return a List&lt;String&gt; where each element is an ISDN: private static final Pattern ISDN = Pattern.compile("ISDN=(.*)"); // ... public List&lt;String&gt; getISDNsFromFile(final String fileName) throws IOException { final Path path = Paths.get(fileName); final List&lt;String&gt; ret = new ArrayList&lt;&gt;(); Matcher m; String line; try ( final BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8); ) { while ((line = reader.readLine()) != null) { m = ISDN.matcher(line); if (m.matches()) ret.add(m.group(1)); } } return ret; }
has comment: http://stackoverflow.com/comment/34668639
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22440826

http://stackoverflow.com/a/22453034
upvote count: 4
downvote count: 0
score: 4
has body: What does return; mean? return; really means it returns nothing void. That's it. why return; or other codes can write below the statement of System.exit(0); It is allowed since compiler doesn't know calling System.exit(0) will terminate the JVM. The compiler will just give a warning - unnecessary return statement
answers question: http://stackoverflow.com/q/22452930
type: Answer

http://stackoverflow.com/comment/76818408
comment on: http://stackoverflow.com/q/22399572
score: 0
has text: when i did a signed apk this error did not happen. just debug
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34157342
score: 1
comment on: http://stackoverflow.com/q/22457104
has text: @user3251142 You have an infinite recursion - go through it with a debugger and find out why the recursion does not end.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22407269
score: 2
answers question: http://stackoverflow.com/q/22407154
has body: You can create a class to handle this: class Book { private int id; private String name; //other stuff } Then just add a new Book to your list: al.add(new Book(1,"Romeo and Juliet")); And just sort it using a custom comparator: Collections.sort(al, new Comparator&lt;Book&gt;(){ @Override public int compare(Book b1, Book b2) { return Integer.compare(b1.getId(), b2.getId()); } }; Another way would be to use a TreeMap&lt;Integer, String&gt; where each id is mapped to one book name. If you really want to continue with your current approach (which I don't recommend) you could split your String by whitespaces and take the first element in the array returned by split (which assumed that your String is always in the format (number whateverIsAfter)). Collections.sort(al, new Comparator&lt;String&gt;(){ @Override public int compare(String b1, String b2) { String s1 = b1.split("\\s+")[0]; String s2 = b2.split("\\s+")[0]; return Integer.valueOf(s1).compareTo(Integer.valueOf(s2)); } });
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/q/22444822
has body: Here I am trying to have my 'cash' variable from the Player method be included in an equation in my wagerBet() method. Currently Eclipse is telling me that variable 'cash' cannot 'make a static reference to the non-static field cash'. I tried looking for explanations as to what this problem means but I'm just getting explanations that use even more programming terminology I don't understand being that I'm a rookie at this stuff. class Player { private ArrayList&lt;Card&gt;hand; private double cash, bet; public Player(double theCash) { cash = theCash; //'cash' variable here hand = new ArrayList&lt;Card&gt;(); } public static double wagerBet() { Scanner in = new Scanner(System.in); System.out.print("Wager a bet: "); double bet = in.nextDouble(); cash = cash - bet; // needs to be transferred here System.out.println("You wagered " + bet + ". " + "Now you have " + cash + " cash left."); return bet; } public void rewardBet(double bet) { cash = cash + (bet * 2); //cash and bet variable needs to be transferred here as well System.out.println("You now have " + cash + "cash."); } Any suggestions?
has answer: http://stackoverflow.com/a/22444897
possible better answer: http://stackoverflow.com/a/22444926
answer count: 4
upvote count: 2
score: 0
downvote count: 2
linked to: http://stackoverflow.com/q/8101585
has comment: http://stackoverflow.com/comment/34137228
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22444866
accepted answer: http://stackoverflow.com/a/22444897
tagged with: java
type: Question
has title: How do I get the variable of one method to be a variable in another method for Java?
has answer: http://stackoverflow.com/a/22444850
favorite count: 0
has answer: http://stackoverflow.com/a/22444926

http://stackoverflow.com/q/22416826
has comment: http://stackoverflow.com/comment/34086214
type: UnansweredQuestion
has body: I am planning to write a sequence generator which will be used in my REST resource implementation class during post to generate unique id. Since every post request is handled by separate thread, I made the variable volatile and method synchronized. I don't have option to use sequences or something which traditional RDBMS provides. public class SequenceGen { volatile static int n = 0; public synchronized int nextNum(){ return n++; } } this is what I have so far, and planning to create a variable of SequenceGen in my REST Implementation. My actual question is will it break somewhere ? I tested with two threads and I dont see any value repeated.
has answer: http://stackoverflow.com/a/22417038
score: 14
has comment: http://stackoverflow.com/comment/34085936
downvote count: 0
tagged with: sequence
has answer: http://stackoverflow.com/a/22416927
favorite count: 0
has title: Sequence Generator in Java for Unique Id
type: Question
has comment: http://stackoverflow.com/comment/34086047
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34086038
has comment: http://stackoverflow.com/comment/34085973
has answer: http://stackoverflow.com/a/35697336
has comment: http://stackoverflow.com/comment/34086422
has comment: http://stackoverflow.com/comment/34086468
has comment: http://stackoverflow.com/comment/34086198
has comment: http://stackoverflow.com/comment/78399913
has comment: http://stackoverflow.com/comment/34085953
upvote count: 14
tagged with: java
answer count: 3
linked to: http://stackoverflow.com/q/14532976
has comment: http://stackoverflow.com/comment/34085945
has comment: http://stackoverflow.com/comment/34086507
linked to: http://stackoverflow.com/q/14338533
linked to: http://stackoverflow.com/q/1186387

http://stackoverflow.com/comment/34030324
comment on: http://stackoverflow.com/q/22384791
type: Comment
type: QuestionComment
has text: @NawedShaikh It's unlikely it's working as the OP expects, however, because the text field that's being updated isn't the one added to the frame.
score: 0

http://stackoverflow.com/comment/80841084
score: 0
type: Comment
has text: Good work.. But actually mComparatorImage need to be gray scalled.. right ?
type: AnswerComment
comment on: http://stackoverflow.com/a/22431220

http://stackoverflow.com/comment/33983284
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22357100
has text: you have not mentionned anything about your second file and how it is linked to your first file. On your first file, simply read it line by line, then use regular expressions or simply String.split to extract the information it has.
score: 0

http://stackoverflow.com/comment/34050505
comment on: http://stackoverflow.com/q/22396572
has text: I see `setLayout(null);` and aren't surprised you're having issues...use an appropriate [layout manager](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html), no execuses
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22460834
has answer: http://stackoverflow.com/a/22461092
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/34163524
has body: I'm currently trying to fill a JPanel (using GridLayout) with Buttons. These Buttons should be squares having a set width. The programm should be able to resize the playing field (n*m buttons). Problem is, the buttons are automatically stretched to completely fill the JScrollpane, completely ignoring the set height and width. Thus making the scrollbars unnecessary. Here is my code: Creating the panels: panel_game = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(panel_game); Trying to resize the JPanel: (where x and y are the number of buttons and zoomlvl the size) panel_game.setLayout(new java.awt.GridLayout(x, y)); panel_game.setBounds(panel_game.getX()+5,panel_game.getY()+5,x*zoomlvl-5,y*zoomlvl); panel_game.setPreferredSize(new Dimension(x*zoomlvl,y*zoomlvl)); And adding the buttons: (f is my playfield, a 2D-Array)(buttons is a Arraylist, containing my buttons) for(int i=0; i&lt;f.getSize()[0]*f.getSize()[1];i++){ buttons.add(new JButton()); buttons.get(i).setSize(zoomlvl, zoomlvl); buttons.get(i).setPreferredSize(new Dimension(zoomlvl,zoomlvl)); panel_game.add(buttons.get(i)); } I have no clue how I can tell Java to stop resizing my buttons etc. automatically. Help would be appreciated :)
tagged with: java
has answer: http://stackoverflow.com/a/22461198
upvote count: 1
type: Question
answer count: 2
has title: JPanel filled with Buttons inside a JScrollPane
downvote count: 0
tagged with: layout-manager
score: 1
favorite count: 0

http://stackoverflow.com/comment/35281007
comment on: http://stackoverflow.com/a/22507474
has text: Even after adding the spring:url the same is occurred. request.getParameter(hdivParameter) is returning Null in the restoreState(HttpServletRequest request, String target) method of ValidatorHelperRequest class
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34194376
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22457979
has text: @user3428776 Writing a client is up to you. You can test it using CURL command line tool, in PHP, or whatever, just make sure to set proper content negotiation headers in each request. You didn't provide any client information, so it is hard to provide an answer to your comment.
type: AnswerComment

http://stackoverflow.com/comment/34196116
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22472271
has text: @Sotirios Is there any way I can read properties from spring configuration file, before all the beans are initialized?

http://stackoverflow.com/q/22378509
tagged with: java
tagged with: swing
has body: Considering 100(dynamic) JLabel Object, and I want to show them inside a resizable JPanel. Currently I use grid bag layout (2 columns and 50 rows), but when user resizes and expands the form, I want to have(for example) 4 columns and 25 rows, and same for small form(1 column, and 100 rows), in other way fill up the whole panel(no any white spaces). I know this is should be done manually, currently I redraw(repaint) all members once user resize the form, but I just was wondering if there is any prepared solution to do so. Thanks in advanced.
type: Question
tagged with: gridbaglayout
possible better answer: http://stackoverflow.com/a/22379004
tagged with: jpanel
has comment: http://stackoverflow.com/comment/34018667
has answer: http://stackoverflow.com/a/22379170
accepted answer: http://stackoverflow.com/a/22379170
score: 0
answer count: 2
tagged with: jlabel
has answer: http://stackoverflow.com/a/22379004
has title: Swing dynamic(auto) fit-layouting
type: AnsweredQuestion

http://stackoverflow.com/q/22453764
tagged with: onclick
tagged with: java
has comment: http://stackoverflow.com/comment/34151783
accepted answer: http://stackoverflow.com/a/22454048
tagged with: eclipse
has title: ExpandableListView OnClick go to the activity does not work
tagged with: switch-statement
type: Question
score: 0
has body: I have got ExpandableListView. It looks like this http://www.androidhive.info/wp-content/uploads/2013/07/android-expandable-listview.jpg . I just want to OnChildClick for example Despicable Me 2 go to the SecondActivity and send PutExtra string with "Despicable Me 2". I know how to use PutExtra and GetExtra method. Can someone give me advice how to solve this problem? I tried to go with switches but it does not work it does not do anything(It just stay in ExpandableListView). Here is MainActivity.java: Public string movie; expListView.setOnChildClickListener(new OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { Intent intent0 = new Intent(getApplicationContext(), SecondActivity.class); switch(groupPosition) { //Top250 case 0: switch(childPosition) { case 0: movie="The Conjuring"; intent0.putExtra("text1", movie); startActivity(intent0); break; case 1: movie="Despicable Me 2"; intent0.putExtra("text1", movie); startActivity(intent0); break; } break; //Now Showing case 1: switch(childPosition) { case 0: break; } break; //Coming Soon case 2:switch(childPosition) { case 0: break; } break; } return false; } }); I downloaded this code from http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/ you can see all of xml and activities here except SecondActivity.
answer count: 1
has answer: http://stackoverflow.com/a/22454048
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/a/22470338
type: Answer
upvote count: 19
accepted answer of: http://stackoverflow.com/q/22470316
score: 19
has body: A subclass needs a constructor if the superclass does not have a default constructor (or has one that is not accessible to the subclass). If the subclass has no constructor at all, the compiler will automatically create a public constructor that simply calls through to the default constructor of the superclass. Regarding calling super(): the first thing every constructor must do is either call a different constructor in the same class by calling this() (possibly with some arguments) or call a constructor of its superclass by calling super() (again, possibly with arguments). Neither of those calls can go anywhere else. If a constructor doesn't start with either one, the compiler will automatically insert a call to super() (without any arguments). So if the behavior you want is to call through to the default superclass constructor (and, many times, it is) then you don't need to explicitly call super() yourself. There's also one situation where you do not need to provide a constructor (in fact, you can't provide one) even when the superclass has no default constructor. This case (described in section 15.9.5.1 of the Java Language Sepcification) is when you create an anonymous subclass of a class using a non-default constructor; the compiler will automatically create a constructor with the correct arguments and call up to the corresponding (non-default) superclass constructor. For instance: class X { public X(int value) { ... } // no default constructor! public void foo() { ... } } X myX = new X(3) { @Override public void foo() { ... } }; Then myX will be an instance of an anonymous subclass of X with a compiler-generated constructor that takes an int argument and calls super(intArg). Because you cannot write a constructor for anonymous classes, there's an issue: what if you need to do some object initialization when the object is created? The solution is to use an instance initializer block. For example: X myX = new X(3) { // Field unique to this subclass of X: private…
answers question: http://stackoverflow.com/q/22470316
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22585414
answers question: http://stackoverflow.com/q/22391531
upvote count: 1
has comment: http://stackoverflow.com/comment/34474067
accepted answer of: http://stackoverflow.com/q/22391531
downvote count: 0
has comment: http://stackoverflow.com/comment/34453985
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34452664
has comment: http://stackoverflow.com/comment/34453341
has body: Well, it took me a little while to perfect this as best I could, but here's my working example. Basically, I made a wrapper class called ComparableWrapper that implements Comparable so the sorting for each column could be manipulated. For the table model, I added a setData(Object[][] data) method that automatically wraps all the data values in a ComparableWrapper. The sorted argument in the ComparableWrapper contructor determines whether the value should be sorted as normal, or stay at the top no matter what. You'll have to manually change the class types for the columns in a few places. Anyway, here's my SSCCE: import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.table.AbstractTableModel; import org.jdesktop.swingx.JXTable; public class TableTest extends JFrame { public TableTest() { super("JXTable - first 3 rows aren't sorted"); setLayout(new BorderLayout()); MyTableModel model = new MyTableModel(); JXTable table = new JXTable(); table.setModel(model); Object[][] initialData = { {"Zoe", new Integer(26)}, {"Adam", new Integer(29)}, {"Trisha", new Integer(33)}, {"Reed", new Integer(20)}, {"John", new Integer(3)}, {"Kyle", new Integer(102)}, {"Billy Bob", new Integer(27)}, {"Sandra", new Integer(87)}, {"Steve", new Integer(50)}, {"Guy", new Integer(23)}, {"Kenzie", new Integer(25)}, {"Mary", new Integer(27)}, {"Sally", new Integer(12)}, {"Joe", new Integer(101)}, {"Billy", new Integer(44)}, {"Bob", new Integer(83)}, }; model.setData(initialData); JScrollPane tableScroll = new JScrollPane(table); add(tableScroll, BorderLayout.CENTER); table.setFillsViewportHeight(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400, 600); setVisible(true); setLocationRelativeTo(null); } private class MyTableModel extends AbstractTableModel { String[] columns = { "First Name", "Age" }; Object[][] data = {}; public void setData(Object[][] data) { for (int i=0; i&lt;data.length; i++) { // Don't sort top 3 rows boolean s…
type: Answer
has comment: http://stackoverflow.com/comment/34450756
score: 1

http://stackoverflow.com/comment/33953310
comment on: http://stackoverflow.com/q/22340526
type: Comment
has text: `System.out.println` is `synchronized`. So you have a concurrency issue which gets solved once the synchronization is introduced.
score: 0
type: QuestionComment

http://stackoverflow.com/a/22356249
answers question: http://stackoverflow.com/q/22356082
score: 0
has body: Calling interrupt on a thread does not directly cause the thread to throw an InterruptedException. All it does is set the interrupt flag for that thread. Methods like sleep, wait, or join can reference that flag on the current thread in order to decide whether to throw an InterruptedException. Interruption is cooperative, the thread being interrupted decides how it will respond; this way the thread can do whatever cleanup it needs to do and not get shot down partway through. You should usually use Thread.isInterrupted() because that doesn't change the value of the interrupted flag. Thread.interrupted() resets the flag: The interrupted status of the thread is cleared by this method. In other words, if this method were to be called twice in succession, the second call would return false (unless the current thread were interrupted again, after the first call had cleared its interrupted status and before the second call had examined it). while Thread.isInterrupted() doesn't: Tests whether this thread has been interrupted. The interrupted status of the thread is unaffected by this method. Checking the interrupted flag means your thread can detect whether it's been interrupted without its having to sleep or wait. Neither Thread.isInterrupted() nor Thread.interrupted() throws InterruptedException, the code using it would check the return value. Also, Thread.interrupt doesn't throw InterruptedException. (And any exception thrown would be in the calling thread, not in the thread being interrupted.) The interrupt method is used to set the interrupt flag on another thread. Having a thread interrupt itself is pointless, the thread could return instead.
type: Answer

http://stackoverflow.com/q/22471491
accepted answer: http://stackoverflow.com/a/22471525
tagged with: regex
has body: I'm trying to do some pattern matching in Java: Pattern p = Pattern.compile("(\\d+) (\\.+)"); Matcher m = p.matcher("5 soy milk"); String qty = m.group(1); String name = m.group(2); I want to end up with one string that contains "5" and one string that contains "soy milk". However, this pattern matching code gives me an IllegalStateException.
possible better answer: http://stackoverflow.com/a/22471538
type: AnsweredQuestion
score: 0
type: Question
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/22471525
has title: Why does this pattern matching code not work?
has answer: http://stackoverflow.com/a/22471538

http://stackoverflow.com/comment/34060688
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22402497
has text: Depends on what you want. If it's `delay`, I admit this could become a little complicated ;-)
score: 0

http://stackoverflow.com/comment/34167865
score: 0
type: Comment
type: QuestionComment
has text: my hypothesis is that it is set to true but the code in the screen class is executed at the begining of runtime therfor even though isFullscreen is now true that code is useless.
comment on: http://stackoverflow.com/q/22462753

http://stackoverflow.com/comment/33953577
comment on: http://stackoverflow.com/a/22340723
type: Comment
score: 0
type: AnswerComment
has text: @SieuPhan You are confusing "cast" with "convert". Correct: A banana **is a** fruit. Incorrect: A fruit **is an** orange. Incorrect: A banana **is an** orange. You could attempt `(Orange)myFruit` but if it isn't actually an orange then a `ClassCastException` will result at run time (not at compile time, which is why Eclipse wouldn't complain about it -- besides, think about it: There's no possible way to know that a given fruit was an orange at compile-time; conversely the compiler knows that a given orange is always a fruit).

http://stackoverflow.com/q/22377203
accepted answer: http://stackoverflow.com/a/22380967
has title: jsf hibernate criteria api
tagged with: criteria-api
upvote count: 1
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22380967
favorite count: 0
has body: I have query in Criteria API, that goes like this: CriteriaQuery&lt;XXX&gt; query = builder.get().createQuery(XXX.class).distinct(true); Root&lt;XXX&gt; root = query.from(XXX.class); Fetch&lt;XXX, YYY&gt; fetch = root.fetch(XXX_.yyy, JoinType.LEFT); now the part I'm stuck on: when I got query results, I got list of XXX records, with attached list of YYY records, when they exist. I want to sort my result by NUMBER OF YYY records atatched to XXX object. And so far, I'm closer to paranoia then to that goal. Anyone?
type: AnsweredQuestion
tagged with: jsf
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/39652081
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22369554
has text: @RealCasually No, Not with TouchImageView. Later I switched to [MyImageView](http://stackoverflow.com/questions/12169905/zoom-and-panning-imageview-android/12184210#12184210) and modified it according to my specifications. Though it is not good as TouchImageView, as the zooming jumps sometimes.....
score: 0

http://stackoverflow.com/comment/34154614
has text: I can't find the library for MAC address. But I found some IP address validation class. See [here](http://stackoverflow.com/questions/5667371/validate-ip-address). I think you want like these classes.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22450819

http://stackoverflow.com/a/22389970
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22389825
has body: No. You cannot compare any Object including String with the greater or smaller operators. You can compare strings using a collation, which is language-specific. If you want to compare strings based on the Unicode values of their characters, you can use the compareTo(String) method of the String class. See the Java documentation for the String class.

http://stackoverflow.com/comment/34109714
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22429748
type: AnswerComment
has text: I disagree with the second paragraph. I think it's the **professor** who needs to read up on mark-and-sweep garbage collectors. The OP seems to understand them just fine.

http://stackoverflow.com/q/22350565
has comment: http://stackoverflow.com/comment/33970665
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33971044
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22350751
has title: List object as class field
has answer: http://stackoverflow.com/a/22350751
has comment: http://stackoverflow.com/comment/33972153
has answer: http://stackoverflow.com/a/22351764
has comment: http://stackoverflow.com/comment/33970510
answer count: 3
has answer: http://stackoverflow.com/a/22350984
favorite count: 0
has comment: http://stackoverflow.com/comment/33970640
has comment: http://stackoverflow.com/comment/33970677
accepted answer: http://stackoverflow.com/a/22351764
has comment: http://stackoverflow.com/comment/33970622
has comment: http://stackoverflow.com/comment/33970694
has comment: http://stackoverflow.com/comment/33970918
has comment: http://stackoverflow.com/comment/33970945
has body: I want to set List object as a class field and then use ArrayList() as a concrete class of List. The reason is that I want to call setData method many times in different parts of program and every time it must add data to the same object data, not different ones. Here is the code: import java.util.ArrayList; import java.util.List; public class container { private static List&lt;String&gt; data = ArrayList&lt;String&gt;(); public static List&lt;String&gt; getData() { return data; } public static void setData(String a) { data.add(a); } } I guess this code should cause error. How can I change the code so that it has the similar result with correct syntax? If this code will not cause errors can anyone tell me when(at what part of execution program) will be static data object created? P.S. I am not going to create container object,just want to call container.setData(String a) method many times in program.
score: 0
tagged with: java
upvote count: 1

http://stackoverflow.com/q/22434574
tagged with: uml
type: Question
score: 5
tagged with: inheritance
tagged with: persistence
has title: Visual paradigm, cant use persistence inheritance on a DCD
has answer: http://stackoverflow.com/a/22596926
answer count: 1
favorite count: 0
upvote count: 5
type: UnansweredQuestion
tagged with: visual-paradigm
has comment: http://stackoverflow.com/comment/34390130
has body: I am trying to have a simple inheritance with visual paradigm on a DCD. However every time i try to use update to code it doesn't generate any of the classes used in that inheritance (doesn't generate user, student, bpcoordinator, promotor). It generates everything else fine. Visual paradigm doesn't throw any errors so i assume everything succeeded but this is not the case. User should be a MappedSuperclass and student, bpcoordinator, promotor should be subclasses inheriting from the User superclass.
downvote count: 0
has comment: http://stackoverflow.com/comment/34388148
tagged with: java

http://stackoverflow.com/a/22335040
has comment: http://stackoverflow.com/comment/33947134
has comment: http://stackoverflow.com/comment/33945963
has body: The memory up and down pattern is standard for garbage collection, you only have to worry if it starts being unable to reach the previous low point after a garbage collection as that would indicate a memory leak. It sounds like there might be something you aren't disposing of but why are you disposing anything if you are just going to reload all the same assets? Switch to using the AssetManager. If you call AssetManager.load in your Screen constructor, AssetManager.finishLoading in your Screen.show method and AssetManager.unload in your Screen.hide method you should never unload any of your GameScreen assets because of how AssetManager does reference counting and you would only unload those assets if you navigated to a different screen. Don't forget to call `AssetManager.update in your render method.
answers question: http://stackoverflow.com/q/22333817
has comment: http://stackoverflow.com/comment/33947267
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33948089
has comment: http://stackoverflow.com/comment/33948410
upvote count: 1

http://stackoverflow.com/q/22438102
upvote count: 2
score: 1
tagged with: java
has body: We are trying to collect the instruction trace of a Java program using pin tool. However, we are not able to comprehend certain behaviour of some of the pin tools on the java programs. We tried two sample programs for our comparison: java_helloworld (which is a simple hello world program) and c_simplefork (which is a simple C program which forks a child process). follow_execv command line switch : It executes all the processes spawned by the execv class system calls with Pin. However, it does not work in the expected way for the java programs. We observed a contradictory behaviour in the outputs of inscount and itrace pin tools. However, we even observed an expected linear trend with the inscount tool used with the follow_execv switch on a prime number calculation program which is not the same for the case of itrace tool. Do the inscount and itrace tools take into account different kind of instructions for each of them? PIN_AddFollowChildProcessFunction is supposed to call the helper function when a child is created. In this, if we run c_simplefork, it correctly reports the process id of the child process, however java_helloworld does not. Apparently, java_helloworld should also have shown the correct child process id because it also does a clone system call. We noted the arguments of the clone() system call in the strace output for both the programs. For java_helloworld CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND |CLONE_THREAD |CLONE_SYSVSEM |CLONE_SETTLS | CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID. for c_simplefork - CLONE_CHILD_CLEARTID | CLONE_CHILD_SETTID | SIGCHLD. So, is this behaviour due to the difference in the arguments of clone() call in both the codes? fork_jit_tool : on java_helloworld - with follow_execv - does not go into any of the methods executed at each FPOINTS without follow_execv - same as above on c_simplefork - with follow_execv - goes into all the 3 methods executed at each FPOINTS and prints the correct child process id also. without…
downvote count: 1
type: Question
has title: Pintool with Java
has comment: http://stackoverflow.com/comment/34123302
tagged with: system-calls
has comment: http://stackoverflow.com/comment/34128225
tagged with: jvm
favorite count: 0
tagged with: fork
type: UnansweredQuestion
tagged with: intel
answer count: 0

propertychangesupport
tags question: http://stackoverflow.com/q/22422088
type: Tag
tag name: propertychangesupport

http://stackoverflow.com/q/22401177
has comment: http://stackoverflow.com/comment/34076420
has comment: http://stackoverflow.com/comment/34079409
has body: I'm supposed to send out instant emails to a set of contacts in a time-critical application. Say, I have n contacts in the list. So, i can do either one of the following: i.) send out a single email to all of these n contacts as multiple receivers. ii.)send n emails, separately one for each receiver, in n threads. In the first case, i'm setting up a single connection at my end and just sending it out. In the second, n connections to my smtp server. However, it is concurrent. Which one is faster?
tagged with: multithreading
has title: Instant messaging-- single connection or multithreading on Java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34058396
has comment: http://stackoverflow.com/comment/34061181
tagged with: java
has answer: http://stackoverflow.com/a/22423394
has answer: http://stackoverflow.com/a/22403865
accepted answer: http://stackoverflow.com/a/22423394
type: Question
has comment: http://stackoverflow.com/comment/34076901
has comment: http://stackoverflow.com/comment/34076691
has comment: http://stackoverflow.com/comment/34058570
possible better answer: http://stackoverflow.com/a/22403270
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22403270
tagged with: email

http://stackoverflow.com/comment/34120420
has text: Thanks, already tried to separate but the key information I was lack was the **ContextLoaderListener is parent**. Moving everything to applicationContext.xml solved problem - now I can move some beans to web context for cleanup. **Note that only separating XMLs will not help if you still have all your beans in webspring context**
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22436401
type: AnswerComment

http://stackoverflow.com/q/22446091
has body: I have an JSON array of arrays where none of the elements are named (it's just a pure array) [ ["http://test.com/","rj76-22dk"], ["http://othertest.com/","v287-28n3"] ] In Java, I'd like to parse this JSON into an array of connectionobjs, where the connectionobj class looks like this: public static class connectionOptions { String URL, RESID; } I looked through the GSON documentation, but couldn't seem to find anything pertinent to parsing a JSON array into anything other than another Java Array. I want to parse the JSON array into a Java Object, not an array. Is there a way to do this using Google's GSON?
has answer: http://stackoverflow.com/a/22446267
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34138425
has answer: http://stackoverflow.com/a/22446258
has title: GSON parse array of array into Java array of object
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
accepted answer: http://stackoverflow.com/a/22446258
type: Question
tagged with: arrays
tagged with: javascript
possible better answer: http://stackoverflow.com/a/22446267

http://stackoverflow.com/comment/102701657
score: 1
type: AnswerComment
type: Comment
has text: Very interesting example. Running the code I finally saw how `next()` works in practice, it does ignore the enter key, whereas `nexLine()` accepts it as complete input and it replicates it to console if you echo the value of what was captured. I just added `System.out.println(str[i]);` as a new line below `str[i]=sc.next();` or `str[i]=sc.nextLine();`
comment on: http://stackoverflow.com/a/29690553

joystick
type: Tag
tags question: http://stackoverflow.com/q/22413429
tag name: joystick

http://stackoverflow.com/q/22390600
downvote count: 0
favorite count: 0
has title: How to re-connect to netty channel after disconnect?
type: UnansweredQuestion
tagged with: netty
linked to: http://stackoverflow.com/q/19739054
score: 2
answer count: 0
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/81567080
has comment: http://stackoverflow.com/comment/61980862
type: Question
has body: I am connecting to a host/port as follows :- boostrap.connect(host,port).sync().channel(); Once it gets connected. I shutdown the server at specified host/port. Then again i try to connect using boostrap.connect(host,port).sync().channel(); It throws ClosedChannelException. Any one has idea Why it is throwing this exception even when I am trying to establish new channel ? I donot use same boostrap instance, i create new for every re-connect and new pass instance of Channel initializer like :- Boostrap b = new Boostrap() b.group(1).channel(NioSocketChannel).handler(new ChannelInitializer()); In ChannelInitilizaer I pass new instance of ChannelHandler. Please suggest.

http://stackoverflow.com/q/22333654
has title: Java unresolved JPanel variable?
tagged with: java
type: Question
tagged with: eclipse
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22333693
has body: Why can't aniPanel be resolved to a variable. I've tried AniPanel aniPanel = new AniPanel(); but this doesn't solve the problem. I've also made sure to import java.swing.JPanel This is the class: public class Animation { public JPanel AniPanel; private boolean loop = true; private RenderingHints renderingHints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); @SuppressWarnings("serial") class AniPanel extends JPanel { public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHints(renderingHints); draw(g2d); } } public static void main(String[] args){ Circle C = new Circle(100); JFrame jf = new JFrame(); jf.setTitle("Falling Shapes Animation"); jf.setSize(600,400); aniPanel = new AniPanel(); jf.getContentPane().add(aniPanel); jf.setVisible(true); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.pack(); }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33940842

http://stackoverflow.com/q/22411262
has comment: http://stackoverflow.com/comment/34132438
tagged with: entity
score: 0
tagged with: sql
has title: Java Entity Object of Union Query
answer count: 0
type: UnansweredQuestion
tagged with: dns
has body: I am attempting to create a domain/entity class based on a complex query. The query unions a bunch of tables together and unfortunately I am not able to create a view on the database for this query. I have been trying to set up the entity object but I am unsure of how to ensure that the marshaling works properly (and ensure the entity acts as read-only object). As an example of the query, I am doing something like this: Select U_T.a, U_T.b, U_T.c, C_T.a FROM (select A_T.a, null as b, A_T.c, 1 as ind from A_T UNION select B_T.a, B_T.b, null, 0 as ind FROM B_T ) U_T left outer join C_T on C_T.fk_a = U_T.a; The other issues are that this union can result in instances where there is no unique key column. This is fine as this data is for viewing only, and never editing. However the @Entity annotation wants a column to be listed with the @ID annotation. Another issue is that I do not believe I can use the other entity classes as the goal is to reduce the number of DB transactions from this query (as the actual one can result in hundreds of recursive queries being performed). If I need to give any more information please let me know.
has comment: http://stackoverflow.com/comment/34100045
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/q/22390131
upvote count: 6
answer count: 2
tagged with: image-processing
accepted answer: http://stackoverflow.com/a/22439051
tagged with: opencv
has body: I've got an image as grayscale image using Mat m = Highgui.imread(path, Highgui.CV_LOAD_IMAGE_GRAYSCALE); in Java and now I want to calculate the median value, the mean value and the standard deviation. I'n new to this and I simply don't know how to find out the calculations and stuff... Tried 2 hours of googeling, please give me some basic advise on how to do research on this. I tried keywords like "mean value java opencv" and found this: http://docs.opencv.org/java/2.4.2/org/opencv/core/Core.html#meanStdDev I'm now doing this: MatOfDouble mu = new MatOfDouble(); MatOfDouble sigma = new MatOfDouble(); Core.meanStdDev(m, mu, sigma); But HOW the hell to access the mean/stdev value as a double? Tried things like double d = mu.get(0,0) but there's something wrong. I can't find it out by reading the OpenCV Java docs myself unfortunately as I don't know what to look for/at. I need mean/stdev to calculate the thresholds for the canny filter... Thanks so far in advance
tagged with: java
has title: Java and OpenCV: Calculate Median / Mean / Stdev value of MAT (Gray-Image)
score: 6
tagged with: mat
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/55881423
favorite count: 0
has answer: http://stackoverflow.com/a/55881423
has answer: http://stackoverflow.com/a/22439051
type: Question

http://stackoverflow.com/q/22425362
has title: JSF + Tomcat losing CSS
tagged with: tomcat
type: AnsweredQuestion
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/22637774
favorite count: 0
type: Question
answer count: 2
has body: I'm using JSF 2.2, Netbeans 7.4, Primefaces 3.5 Tomcat 7 and Hibernate 3.6.10. I'm migrating a web project that is finished and works great from normal libraries and glassfish 3.1.2 TO maven and Tomcat 7.0.41.0. Initially everything seems to work fine, the main page starts ok and it can be viewed perfectly with all his CSS and so on, but when I press any of the links to go to another section ALL CSS seems to get lost (even the primefaces style). The navigation continues working ok but no CSS is applied. There's an error in the Tomcat console: Grave: El Servlet.service() para el servlet [Faces Servlet] en el contexto con ruta [/AuPair] lanzó la excepción [javax/servlet/jsp/jstl/core/Config] con causa raíz java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config I have searched about this error over the net with no result and I don't know if it is related or not with my problem. I'm using templates like this: <f:view> <h:head> </h:head> <h:body> <ui:composition template="/plantilla.xhtml"> <ui:define name="cabecera"> <ui:include src="cabecera_vista.xhtml"/> </ui:define> <ui:define name="contenido"> <ui:include src="index_vista.xhtml"/> </ui:define> <ui:define name="pie"> <ui:include src="pie_vista.xhtml"/> </ui:define> </ui:composition> </h:body> </f:view> This is the first page shown "index_vista" (firstly appears ok, but if you leave and come back it doesn't): <f:view locale="#{sesion.idiomaActual}"> <h:head> </h:head> <h:body> <h:form> <p:imageSwitch effect="fade" styleClass="galeria_fotos"> <ui:repeat value="#{index_controlador.listafotos}" var="image"> <p:graphicImage value="/Imagenes/#{image}" /> </ui:repeat> </p:imageSwitch> <p:fieldset legend="#{msjs.inicio_tit1}" styleClass="panel_inicio" > <p:graphicImage value="/Imagenes/inicio1.jpg" styleClass="imagen_panel_inicio1"/> <h:outputText styleClass="texto_panel_inicio" escape="false" value="#{msjs.inicio_text1}" /> </p:fieldset> <p:fieldset legend="#{msjs.inicio_tit2}" styleClass="panel_inicio" > <h:ou…
has answer: http://stackoverflow.com/a/22438135
tagged with: css
tagged with: jsf
possible better answer: http://stackoverflow.com/a/22438135
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22637774

http://stackoverflow.com/comment/34142892
type: AnswerComment
score: 0
type: Comment
has text: Thanks for trying to help. finally it works with me but still I do not know what is the problem was. I will post my code.
comment on: http://stackoverflow.com/a/22368134

http://stackoverflow.com/q/22445350
upvote count: 1
downvote count: 0
favorite count: 0
answer count: 0
has body: I have been writing a motion detection program and have currently got an error (memory insufficient). java.lang.OutOfMemoryError OpenCV Error: Insufficient memory (Failed to allocate 836352 bytes) in cv::OutOfMemoryError, file ........\opencv\modules\core\src\alloc.cpp, line 52 java.lang.RuntimeException: ........\opencv\modules\core\src\alloc.cpp:52: error: (-4) Failed to allocate 836352 bytes in function cv::OutOfMemoryError at com.googlecode.javacv.cpp.opencv_core.cvCreateImage(Native Method) at cv.MotionDetectionUtil.resizeIplImage(MotionDetectionUtil.java:170) at cv.MotionDetectionUtil.grabFrame(MotionDetectionUtil.java:87) at applet.Panel$2.run(Panel.java:153) at java.lang.Thread.run(Thread.java:744) Above is the error I'm getting. They are referring to the following locations. Firstly this one. Referring to the createImage line. private IplImage resizeIplImage(IplImage img, double percent) { double width = ((double) img.width() * percent) / 100; double height = ((double) img.height() * percent) / 100; IplImage dest_img; dest_img = opencv_core.cvCreateImage( opencv_core.cvSize((int) width, (int) height), img.depth(), img.nChannels()); //resize the image opencv_imgproc.cvResize(img, dest_img, opencv_imgproc.CV_INTER_CUBIC); return dest_img; } Then the second line of this: if (REDUCE_TO_PERCENT &gt; 0 &amp;&amp; REDUCE_TO_PERCENT != 100) { lastImage = resizeIplImage(img, REDUCE_TO_PERCENT); } else { lastImage = img; } Finally the first line of this... //update the image img = detector.grabFrame(brightness, contrast); image = img; CameraPanel.updateImage(image); I can't fix this for the life of me, can anyone tell me (in detail) what I am doing wrong? (ideally with an example of some sort). I'm new to java (especially opencv etc). Thanks.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34154620
has comment: http://stackoverflow.com/comment/34148326
tagged with: opencv
has comment: http://stackoverflow.com/comment/34139846
score: 1
tagged with: java
tagged with: iplimage
has comment: http://stackoverflow.com/comment/34137548
has comment: http://stackoverflow.com/comment/34137390
tagged with: memory
has title: cv:OutOfMemoryError Java IplImage
type: Question
tagged with: javacv

http://stackoverflow.com/comment/34518462
type: Comment
has text: @Prabha: This is error from the deployed application in a server.
score: 0
comment on: http://stackoverflow.com/q/22343771
type: QuestionComment

http://stackoverflow.com/q/22443466
tagged with: spinner
possible better answer: http://stackoverflow.com/a/22443656
has body: I am trying to update current credits column of the only row in the database using a drop down spinner which gets values from an arraylist. Very unsure about how to go about doing this operation. Thank you for any help in advance. My database code: package com.example.parkangel; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class UDbHelper extends SQLiteOpenHelper { public static final String KEY_ROWID = "_id"; public static final String KEY_PFNAME = "payeeFname"; public static final String KEY_PSNAME = "payeeSname"; public static final String KEY_CARD = "card"; public static final String KEY_CREDITS = "credits"; private static final String DATABASE_NAME = "UserData.db"; private static final String DATABASE_TABLE = "UserTable"; private static final int DATABASE_VERSION = 1; //private UDbHelper dbHelper; //private final Context ourContext; private static UDbHelper instance; private SQLiteDatabase ourDatabase; public UDbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public static UDbHelper getInstance(Context context) { if (instance == null) { instance = new UDbHelper(context); } return instance; } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" + KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_PFNAME + " TEXT NOT NULL, " + KEY_PSNAME + " TEXT NOT NULL, " + KEY_CARD + " TEXT NOT NULL, " + KEY_CREDITS + " TEXT NOT NULL);"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE); onCreate(db); } public synchronized UDbHelper open() throws SQLException { System.out.println ("running open"); if(ourDatabase == null || !ourDatabase.isOpen()) ourDatabase = getWritableD…
tagged with: android
has answer: http://stackoverflow.com/a/22443750
accepted answer: http://stackoverflow.com/a/22443750
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34133837
type: Question
has answer: http://stackoverflow.com/a/22443656
has title: Updating specific column using a spinner widget
has comment: http://stackoverflow.com/comment/34133789
score: 0
answer count: 2
tagged with: sql-update
tagged with: sqlite

http://stackoverflow.com/q/22417108
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/34087657
type: Question
has title: killing fragment or activity kill background threads?
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22419792
accepted answer: http://stackoverflow.com/a/22419792
score: -1
tagged with: android
has body: I started doing some disk I/O in an asynctask within a fragment. Does opening a new activity/fragment (on top of the previous fragment) kill the background thread? I think not for this action, but if I kill the fragment a different way or finish() an activity does it kill the background thread? I am contemplating putting the I/O in a service with broadcast receivers but it may not be necessary depending on the answers here.
favorite count: 0
tagged with: multithreading
downvote count: 1

http://stackoverflow.com/a/22477260
type: AcceptedAnswer
upvote count: 13
accepted answer of: http://stackoverflow.com/q/22354607
type: Answer
answers question: http://stackoverflow.com/q/22354607
has body: While initially these hints were presented as comments to the original question, they now merit to be formulated as an answer: Code issues While there is too much code to review and fix without spending a considerable amount of time, and while the original absence of a sample PDF was a hindrance, a quick scan of the code revealed some issues: The appendRawCommands(XXXFormStream.createOutputStream(), YYY) calls quite likely cause problems with PDFBox: creating output streams for the same form more than once may be an issue, and also switching back and forth between the forms. Furthermore there does not seem to be a whitespace between the multiple strings written to the same stream giving rise to unknown Qq operators. Furthermore the appendRawCommands method uses UTF-8 which is foreign to PDF. The generateSignedDocument most likely does quite a lot of damage as it assumes it can work with PDFs as if they were text files. That in general is not the case. Result PDF issues The sample result PDF eventually provided by the OP allows to pinpoint some actually realized issues: Comparing the bytes of both documents (Report_08_05_23.pdf and Signed_Report_08_05_23.pdf) one finds that there are many unwanted changes, at first glance especially the replacement of certain bytes by question marks. This is due to using ByteArrayOutputStream.toString() to easily operate on the document and eventually changing it back into a byte[]. E.g. cf. the JavaDocs of ByteArrayOutputStream.toString() * &lt;p&gt; This method always replaces malformed-input and unmappable-character * sequences with the default replacement string for the platform's * default character set. The {@linkplain java.nio.charset.CharsetDecoder} * class should be used when more control over the decoding process is * required. Certain byte values do not represent characters in the platform's default character set and therefore are transformed to the Unicode Replacement Character and in the final transformation into a byte[…
score: 13
downvote count: 0

http://stackoverflow.com/a/22400600
has comment: http://stackoverflow.com/comment/34060576
has comment: http://stackoverflow.com/comment/34079487
upvote count: 1
has body: From Connections REST API documentation: To complete an activity, add this flag. If it is not present, the activity is not completed. So, to mark an activity as incomplete again just update the ActivityNode without adding the "Completed" flag. todoNode = activityService.getActivityNode( "856b9450-b3d2-4b41-a198-46feeb3772a8" ); System.out.println("Title " + todoNode.getTitle()); if ( todoNode.getCategoryFlagCompleted() != null) { todoNode.setFlags(new java.util.ArrayList()); } activityService.updateActivityNode(todoNode);
answers question: http://stackoverflow.com/q/22382036
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34072299

http://stackoverflow.com/comment/34179907
comment on: http://stackoverflow.com/q/22469984
has text: @WhoAmI : I read some recommendations to try `setCurrentDirectory()` but i haven't done it yet. @ajb : If `JFileChooser` is not the right way, so what kind of way that i must take? @Jbueno : Yes. Do you have any suggestion for me? Thanks
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34333123
score: 0
type: AnswerComment
type: Comment
has text: when we dynamically generating data table we will not mention like what u wrote ... in this case how to call
comment on: http://stackoverflow.com/a/22398005

http://stackoverflow.com/comment/34031667
type: Comment
comment on: http://stackoverflow.com/a/22373530
score: 0
type: AnswerComment
has text: Thanks. Unfortunately it didn't solve my problem. The file doesn't seem to be picked up by play. There must be some strange configuration problem.

http://stackoverflow.com/comment/34260229
comment on: http://stackoverflow.com/q/22464690
has text: apparently? So you're confused yourself then. Well, there was nothing contradictory about what I was saying. It's straight forward.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34192420
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22476221
has text: And if it is needed , I have (Intel(R) Core(TM) i5-2430M CPU). Please forgive my lack of knowledge when it comes to hardware
score: 0

http://stackoverflow.com/comment/34081861
has text: I think posted here very similair code search for SwingWorker + Executor + 3-4 JButtons
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22412544

http://stackoverflow.com/q/22475739
has comment: http://stackoverflow.com/comment/34189579
type: Question
has title: Could not initialize class javax.imageio.ImageIO
has comment: http://stackoverflow.com/comment/34192606
score: 10
accepted answer: http://stackoverflow.com/a/22538604
has body: I'm trying to deploy a Spring web app to a Tomcat 7 running on a production environment on Windows Azure (tried Ubuntu and Windows Datacenter VM). Sadly, I get an error while generating thumbnails in use with ImageIo (stack trace below). During development, I used Tomcat 7 too, so I really don't understand, what is different on the production web server. When I try to load the modules by ImageIO.scanForPlugins(); the exakt same thing happens. Isn't ImageIO (or javax.awt in general) included in the standard Java 7 JRE? Ideas that did not work I've read something about setting up a subfolder in META-INF/services/javax.io... or running the JVM in heap mode but nothing fixed the issue below. All fine on DEV machine I think I really walk against a wall right now, because I have no clue how to fix this problem. On local development environment (Windows 8, Java 7 64 bit, Tomcat 7) I did nothing of this hints above (heap mode or class files) and everything worked perfectly. Has this something to do, that the app is running on a server without GPU or something like this? Thanks for every reply in advance =) Log 1 HTTP Status 500 - Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIOException report Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:972) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) javax.servlet.http.HttpServlet.service(HttpServlet.java:…
has comment: http://stackoverflow.com/comment/34190032
tagged with: azure
has answer: http://stackoverflow.com/a/48732764
downvote count: 0
possible better answer: http://stackoverflow.com/a/27545162
tagged with: tomcat
has answer: http://stackoverflow.com/a/27545162
favorite count: 0
has answer: http://stackoverflow.com/a/67769288
has comment: http://stackoverflow.com/comment/34205652
tagged with: spring
tagged with: javax.imageio
answer count: 4
has answer: http://stackoverflow.com/a/22538604
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34232566
upvote count: 10

http://stackoverflow.com/comment/34182209
score: 0
comment on: http://stackoverflow.com/q/22463441
type: Comment
type: QuestionComment
has text: Ok let me check the firewall setup, I will back to you.

http://stackoverflow.com/q/22331469
accepted answer: http://stackoverflow.com/a/22331942
has comment: http://stackoverflow.com/comment/33938434
has comment: http://stackoverflow.com/comment/34033448
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/34033428
tagged with: spring
has title: java.lang.NoClassDefFoundError: org/springframework/context/support/ClassPathXmlApplicationContext
has body: I am using Spring in my Jar file to get the properties from a properties file. I am getting output when I try from my RAD(eclipse). But when I deploy my jar file in server, I keep getting this error. Do I need to include any other XML file ? The error occurs when I get the application context. ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); 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:jee="http://www.springframework.org/schema/jee" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/util http://xml.westfieldgrp.com/public/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/beans http://xml.westfieldgrp.com/public/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/jee http://xml.westfieldgrp.com/public/schema/jee/spring-jee-3.0.xsd" &gt; &lt;bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;property name="location" value="classpath:/config/devint/nimo.properties"/&gt; &lt;/bean&gt; &lt;bean id="nimoConfigurationBean" scope="singleton" class="com.westfieldgrp.filenet.env.NimoConfigurationBean"&gt; &lt;property name="serviceUser" value="${env.user}" /&gt; &lt;property name="servicePass" value="${env.pass}" /&gt; &lt;/bean&gt; &lt;/beans&gt; Call in Java: public class AddEnvProperty { public String envType(String propertyValue) { String returnValue = ""; AddEnvProperty envProps = new AddEnvProperty(); NimoConfigurationBean nimoConfigurationBean = envProps.getConfig(); PluginLogger logger = new PluginLogger(new ResponceFilterPlugin()); logger.logDebug(this, "envType", "Getting Property Value" + propertyValue); try { if (propertyValue == "USER") { returnValue = nimoConfigurationBean.getSer…
type: Question
score: 3
has answer: http://stackoverflow.com/a/22331942
tagged with: java
tagged with: noclassdeffounderror
tagged with: eclipse
tagged with: rad
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/34161443
has text: Also paste your Main.java
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22459644

http://stackoverflow.com/q/22404419
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/42831794
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/61639978
accepted answer: http://stackoverflow.com/a/22404565
possible better answer: http://stackoverflow.com/a/42831794
type: Question
has title: How do I execute a stored procedure without parameters in JDBC?
tagged with: jdbc
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22404870
has answer: http://stackoverflow.com/a/22404565
has body: I'm trying to execute a stored procedure without input variables like : String sql2 = "{call vivek}" ; System.out.println(sql2); System.out.println("Executing procedure without parameters"); stmt = conn.createStatement(); stmt.executeQuery(sql2); But its throwing an error saying : syntax error at or near "{" Position: 1 I'm trying to google it but not able to find anything. How do I do it ? By the way it didn't work with callablestatement also
has comment: http://stackoverflow.com/comment/34063305
upvote count: 1
answer count: 4

http://stackoverflow.com/a/22457532
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22452572
has body: Looking at that it appears that the concept of node is that of scene graph. Your model can be made of parts (MeshPart) and each separate part is a child of a node. Having a separate node means you can apply transforms to it thus moving it independently from any other model part. So it appears that you do want to construct your model as separate parts and load those parts in a hierarchy of nodes to suit your needs. Keep a reference to the node you want to move independently and apply transforms. Node can "contain" a MeshPart (i.e. MeshPart is child of Node) Nodes can contain other nodes. take a look wikipedia for scene graph terminology. Hang on the docs for Model say "A model represents a 3D assets. It stores a hierarchy of nodes. A node has a transform and optionally a graphical part in form of a MeshPart and Material. Mesh parts reference subsets of vertices in one of the meshes of the model. Animations can be applied to nodes, to modify their transform (translation, rotation, scale) over time." Note it says sub set of vertices which implies that the model is one model but you separate them for your needs assigning different sub sets into Nodes. From Xoppa: This tutorial shows how to use the node hierarchy from the modeling application. Here are two tutorials explaining the node structure and how to use it: Theory Practical
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/22452572
has comment: http://stackoverflow.com/comment/34157963

servlets
tags question: http://stackoverflow.com/q/22344001
tags question: http://stackoverflow.com/q/22457065
tags question: http://stackoverflow.com/q/22371973
tags question: http://stackoverflow.com/q/22386596
tags question: http://stackoverflow.com/q/22432423
tags question: http://stackoverflow.com/q/22330571
tags question: http://stackoverflow.com/q/22484683
tags question: http://stackoverflow.com/q/22449076
tags question: http://stackoverflow.com/q/22368770
tags question: http://stackoverflow.com/q/22426848
tags question: http://stackoverflow.com/q/22375133
tags question: http://stackoverflow.com/q/22465572
tags question: http://stackoverflow.com/q/22429905
tags question: http://stackoverflow.com/q/22397545
tags question: http://stackoverflow.com/q/22433604
tags question: http://stackoverflow.com/q/22471965
tags question: http://stackoverflow.com/q/22366465
tags question: http://stackoverflow.com/q/22386436
tags question: http://stackoverflow.com/q/22461712
tags question: http://stackoverflow.com/q/22403843
tags question: http://stackoverflow.com/q/22384128
tags question: http://stackoverflow.com/q/22421541
tags question: http://stackoverflow.com/q/22331474
tags question: http://stackoverflow.com/q/22406776
tags question: http://stackoverflow.com/q/22442028
tags question: http://stackoverflow.com/q/22443328
tags question: http://stackoverflow.com/q/22419667
tags question: http://stackoverflow.com/q/22461362
tags question: http://stackoverflow.com/q/22398382
tags question: http://stackoverflow.com/q/22449218
tags question: http://stackoverflow.com/q/22471407
tags question: http://stackoverflow.com/q/22458536
tags question: http://stackoverflow.com/q/22408850
tags question: http://stackoverflow.com/q/22376632
tags question: http://stackoverflow.com/q/22335437
tags question: http://stackoverflow.com/q/22368619
tags question: http://stackoverflow.com/q/22371631
tags question: http://stackoverflow.com/q/22357371
tags question: http://stackoverflow.com/q/22421775
tags question: http://stackoverflow.com/q/22479407
tags question: http://stackoverflow.com/q/22421271
tags question: http://stackoverflow.com/q/22421155
tags question: http://stackoverflow.com/q/22344356
tags question: http://stackoverflow.com/q/22361235
tags question: http://stackoverflow.com/q/22360119
tags question: http://stackoverflow.com/q/22420083
tags question: http://stackoverflow.com/q/22406910
tags question: http://stackoverflow.com/q/22384297
tags question: http://stackoverflow.com/q/22424107
tags question: http://stackoverflow.com/q/22330843
tags question: http://stackoverflow.com/q/22423967
tags question: http://stackoverflow.com/q/22433262
tags question: http://stackoverflow.com/q/22403083
tags question: http://stackoverflow.com/q/22335089
tags question: http://stackoverflow.com/q/22355945
tags question: http://stackoverflow.com/q/22426548
tags question: http://stackoverflow.com/q/22451033
tags question: http://stackoverflow.com/q/22399471
tags question: http://stackoverflow.com/q/22338445
tags question: http://stackoverflow.com/q/22376031
tags question: http://stackoverflow.com/q/22374299
tags question: http://stackoverflow.com/q/22453855
tags question: http://stackoverflow.com/q/22486201
tags question: http://stackoverflow.com/q/22338520
tags question: http://stackoverflow.com/q/22436195
tags question: http://stackoverflow.com/q/22338063
tags question: http://stackoverflow.com/q/22483236
tags question: http://stackoverflow.com/q/22378849
tags question: http://stackoverflow.com/q/22398977
tags question: http://stackoverflow.com/q/22403386
tags question: http://stackoverflow.com/q/22369857
tag name: servlets
tags question: http://stackoverflow.com/q/22471372
tags question: http://stackoverflow.com/q/22419386
tags question: http://stackoverflow.com/q/22351344
tags question: http://stackoverflow.com/q/22348959
tags question: http://stackoverflow.com/q/22381298
tags question: http://stackoverflow.com/q/22421414
tags question: http://stackoverflow.com/q/22330717
tags question: http://stackoverflow.com/q/22464404

http://stackoverflow.com/a/22381271
has body: I believe passing such parameter to IFrame should be done on the page on server. Not with javascript. According to full scenario this is what should have worked but it is not. I believe the managedbean scope is lost and that is why the id is not set on different page. To make this work probably the scope of managed bean should be session not request or view because you go to different page.
score: 0
answers question: http://stackoverflow.com/q/22376206
type: Answer
has comment: http://stackoverflow.com/comment/34048770

http://stackoverflow.com/q/22470989
tagged with: android
has title: I can't get my ListFragment to Display data android
tagged with: fragment
downvote count: 1
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/22471223
has body: I am working on a small project to help me learn about Android. I made a small ListFragment, but I cannot get it to display anything. I try checking the logs and I don't see any errors. ListFragment public class EspnFragment extends ListFragment { String URL = "url" DefaultHttpClient defaultClient = new DefaultHttpClient(); JSONObject jsonObject; EspnAdapter adapter; EspnObject object = new EspnObject(); private ArrayList&lt;EspnObject&gt; objects = new ArrayList&lt;EspnObject&gt;(); @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); adapter = new EspnAdapter(getActivity(), R.layout.list_item_display); sendRequest(); adapter.addAll(objects); adapter.notifyDataSetChanged(); setListAdapter(adapter); setListShown(true); } private void sendRequest() { new Thread(new Runnable() { @Override public void run() { HttpGet request = new HttpGet(URL); HttpResponse httpResponse = null; try { Log.v("ESPN DATA:", "Getting Data"); httpResponse = defaultClient.execute(request); BufferedReader reader = new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent(), "UTF-8")); String json = reader.readLine(); jsonObject = new JSONObject(json); JSONArray items = jsonObject.getJSONArray("headlines"); for (int i = 0; i &lt; items.length(); i++) { JSONObject jsonObj = (JSONObject) items.get(i); String title = jsonObj.getString("headline"); String date = jsonObj.getString("lastModified"); object.setDate(date); object.setTitle(title); objects.add(object); } Log.v("ESPN DATA:", "Done"); } catch (Exception e) { e.getStackTrace(); Log.v("ESPN DATA:", "Caught Error" + e.getMessage()); } } }).start(); } }
upvote count: 0
tagged with: android-listfragment
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34102658
has text: You should use java enums
comment on: http://stackoverflow.com/q/22426598
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22462722
has comment: http://stackoverflow.com/comment/34166915
answer count: 1
downvote count: 0
favorite count: 0
has body: Ok, so I am trying to learn multi-threading. I am reading a book and I came across this example for synchronized code blocks: class CallMe { void call(String msg) { System.out.print("[" + msg); try { Thread.sleep(1000); } catch (InterruptedException e) { System.out.println("Interrupted"); } System.out.println("]"); } } class Caller implements Runnable { String msg; CallMe target; Thread t; public Caller(CallMe target, String msg) { this.target = target; this.msg = msg; t = new Thread( this ); t.start(); } public void run() { synchronized (target) { target.call(msg); } } } public class Scrap { public static void main(String[] args) { CallMe target = new CallMe(); Caller ob1 = new Caller( target, "Hello"); Caller ob2 = new Caller( target, "Synchronized" ); Caller ob3 = new Caller( target, "World"); try { ob1.t.join(); ob2.t.join(); ob3.t.join(); } catch (Exception e) { System.out.println("Interrupted"); } } } I got the following output from this: [Hello] [World] [Synchronized] Then, since I have done some tutorials online, I know that it is good style (or was told this) to create an instance of Object just for locking. So, I did this and the Caller class became: class Caller implements Runnable { String msg; CallMe target; Thread t; private Object lock = new Object(); public Caller(CallMe target, String msg) { this.target = target; this.msg = msg; t = new Thread( this ); t.start(); } public void run() { synchronized (lock) { target.call(msg); } } } I was a little surprised when I got this as output: [Synchronized[Hello[World] ] ] Of course, this is output where interleaving has taken place and it is not correct. My question is why did this happen? I thought that making the lock Object would give me the same results. Why did it (or why would it) not give me the same output? I thought that creating the Object instance was good style and would work the same in this case, and to be honest I can't see why it would be different locking on "target" versus "lock". I guess wha…
has title: Why is this simple Java synchronized code block example giving me different output, depending on which object I lock on?
has comment: http://stackoverflow.com/comment/34167007
has answer: http://stackoverflow.com/a/22462838
has comment: http://stackoverflow.com/comment/34167033
accepted answer: http://stackoverflow.com/a/22462838
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34166967
has comment: http://stackoverflow.com/comment/34167008
score: 1
tagged with: java
tagged with: multithreading
upvote count: 1
type: Question
tagged with: locking
has comment: http://stackoverflow.com/comment/34167070
has comment: http://stackoverflow.com/comment/34167021
has comment: http://stackoverflow.com/comment/34166895
has comment: http://stackoverflow.com/comment/34166966

http://stackoverflow.com/a/22335306
accepted answer of: http://stackoverflow.com/q/22334940
answers question: http://stackoverflow.com/q/22334940
upvote count: 2
has body: Make sure your component has a preferred size larger than (0, 0): @Override public Dimension getPreferredSize() { return new Dimension(500, 500); }
has comment: http://stackoverflow.com/comment/33972681
score: 2
has comment: http://stackoverflow.com/comment/33973233
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33971714
downvote count: 0
has comment: http://stackoverflow.com/comment/33972129
has comment: http://stackoverflow.com/comment/33973694
type: Answer

http://stackoverflow.com/q/22349669
has title: Topic Modelling mallet: how to interpret the Kullback-Leibler divergence
downvote count: 0
answer count: 1
score: 4
favorite count: 0
has body: After obtaining various probability distributions from various documents in mallet, I have applied the following code to calculate the KL divergence between the first and the second document: Maths.klDivergence(double[] d1,double[] d2); How should I interpret the data obtained? For example, I get: 12.3640... What does this mean? the two distributions are near or far away?
tagged with: mallet
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24267688
tagged with: java
type: Question
upvote count: 4

http://stackoverflow.com/q/22391438
has comment: http://stackoverflow.com/comment/34042795
upvote count: 0
answer count: 1
favorite count: 0
has title: Recalling information form an array in list form
type: UnansweredQuestion
score: -3
has body: I am trying to recall a list of employees from an array in Java. I can either choose to do them individually via their ID number or bring all employee info up at once. I know how to code everything else but I cannot find a clear tutorial on how to recall the data and project it onto the text box I have programmed into my GUI. I have the array already created in a different class but I need to get the information from that one and display it in the GUI. Any help would be appreciated. Thanks. If you want more info just let me know. [The image is a screenshot of the simple GUI I made.]
tagged with: java
has answer: http://stackoverflow.com/a/22392270
downvote count: 3
type: Question
tagged with: arrays

http://stackoverflow.com/a/22480933
type: Answer
score: 1
has body: To avoid freeze use SwingWorker for long running tasks. Also read about Concurrency in Swing
upvote count: 1
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22480870
answers question: http://stackoverflow.com/q/22480870

http://stackoverflow.com/q/22428216
tagged with: jsp
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
has body: My file file storage location is "E:\Records\DOCS\test.html" How can I get Selected file path, following is my jsp tag &lt;form:input path="FileData" type="file"/&gt; I am selecting the test.html from above path and getting the selected file my model class as follows, I am able to get selected file name but along with file name I need full path. How can I get full path in my model class ? private CommonsMultipartFile fileData; public CommonsMultipartFile getFileData() { return fileData; } public void setFileData(CommonsMultipartFile fileData) { System.out.println(fileData.getOriginalFilename()); // it gives output as test.html, I need full path return fileData; }
has title: How can I get selected file path from "file" tag?
type: AnsweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22460878
accepted answer: http://stackoverflow.com/a/22460878
score: 0
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/a/22364332
has comment: http://stackoverflow.com/comment/34041181
has body: What you have here is a consumer. However, the following seems to compile (in Eclipse). public static class G&lt;X, Z extends Y&lt;X&gt;&gt; { public G(Class&lt;? extends X&gt; c, Class&lt;Z&gt; s) {} public void m(X x) {} public static &lt;T, S extends Y&lt;T&gt;&gt; G&lt;T, S&gt; create(Class&lt;? extends T&gt; c) { Class&lt;S&gt; s = null; // find this via some reflection magic return new G&lt;T, S&gt;(c, s); } public static void main(String[] args) { Object o = ""; // irrelevant! create(o.getClass()).m(o); } }
answers question: http://stackoverflow.com/q/22362815
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22362815
has comment: http://stackoverflow.com/comment/34045613
has comment: http://stackoverflow.com/comment/34025814
type: Answer
has comment: http://stackoverflow.com/comment/34021069
score: 1
has comment: http://stackoverflow.com/comment/34011342
upvote count: 1

http://stackoverflow.com/comment/34003950
has text: May I know what actually is count variable doing? And also for list of med size.. where each list is of size 30 and I want 40 such lists then will it be like splitAndReturn(nodes,30).subList(0,40) ?
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22369163

http://stackoverflow.com/q/22395044
has answer: http://stackoverflow.com/a/22395211
has title: A Circular linked list with no pointers
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22395152
has comment: http://stackoverflow.com/comment/34047944
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34048123
has body: I am trying to complete a Circular doubly linked List programming project. We are suppose to create the Link List class with Node&lt;E&gt; Head as the only instant variable. The only instant variable in the inner class is Node current. The Node class had three instant variables, E data, Node&lt;E&gt; next, and Node&lt;E&gt; prev. In a test program that uses our CDLL call we are suppose to use the next() and hasNext() method of the iterator inner class to loop through the entire list once printing out each node. The problem I am having is I can't figure out how the hasNext() method can know when one loop has been completed and every node has been printed. In other words, how can I get hasNext() to return true when current==head on the first iteration of the loop and return false when current==head at the beginning of the second loop. I greatly appreciate any insight that you may have.
tagged with: node.js
tagged with: java
has comment: http://stackoverflow.com/comment/34047978
type: Question
tagged with: iterator
has comment: http://stackoverflow.com/comment/34047946

http://stackoverflow.com/q/22434894
has body: I am trying to make cleaner code in my programs. So I was trying to compress my code to create buttons: Before, I needed to copy this every single time: Dimension JButton_Cryption_Size = JButton_Cryption.getPreferredSize(); JButton_Cryption.setBounds(5, 5, JButton_Cryption_Size.width + 50, JButton_Cryption_Size.height); JButton_Cryption.setFocusPainted(false); JButton_Cryption.addActionListener(this); add(JButton_Cryption); but now I made this method: (Don't pay attention to the button names, they are for testing) public JButton JButton_Testing1, JButton_Testing2, JButton_3; private void addJButton(JButton ButtonName, String Name, int x, int y, int width, int height, String ToolTip, boolean FocusedPainted, boolean Opaque, boolean ContentAreaFilled, boolean BorderPainted){ ButtonName = new JButton(Name); Dimension Button_Size = ButtonName.getPreferredSize(); if(width == 0){ ButtonName.setBounds(x, y, Button_Size.width, height); }if(height == 0){ ButtonName.setBounds(x, y, width, Button_Size.height); }if(width == 0 &amp;&amp; height == 0){ ButtonName.setBounds(x, y, Button_Size.width, Button_Size.height); }if(width != 0 &amp;&amp; height != 0){ ButtonName.setBounds(x, y, width, height); } ButtonName.addActionListener(this); // class: implements ActionListener ButtonName.setToolTipText(ToolTip); ButtonName.setFocusPainted(FocusedPainted); ButtonName.setOpaque(Opaque); ButtonName.setContentAreaFilled(ContentAreaFilled); ButtonName.setBorderPainted(BorderPainted); add(ButtonName); } private void addButtonToFrame(){ addJButton(JButton_Testing1, "Testing 1", 150, 100, 172, 0, null, false, true, true, true); addJButton(JButton_Testing2, "Testing 2", 0, 0, 0, 0, null, false, true, true, true); addJButton(JButton_Testing3, "Testing 3", 200, 150, 250, 100, "YO", false, true, true, true); } But when I want to add an action to the button, it wont work @Override public void actionPerformed(ActionEvent e){ Object src = e.getSource(); if(src == JButton_Testing1){ System.out.println…
accepted answer: http://stackoverflow.com/a/22435409
linked to: http://stackoverflow.com/q/21658144
tagged with: swing
has comment: http://stackoverflow.com/comment/34117648
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
has title: Java Swing clean code with ActionListener
has comment: http://stackoverflow.com/comment/34117612
tagged with: java
possible better answer: http://stackoverflow.com/a/22434978
has answer: http://stackoverflow.com/a/22435409
tagged with: code-cleanup
type: Question
has answer: http://stackoverflow.com/a/22434978
tagged with: actionlistener
answer count: 2
linked to: http://stackoverflow.com/q/5621338
has comment: http://stackoverflow.com/comment/34117670
has comment: http://stackoverflow.com/comment/34117704
score: 0

http://stackoverflow.com/comment/34118473
has text: i know, but i wanted to be very clear on my point, making more question for the same concern , will make on me more confsion , i understand the difficult of the answerer.
comment on: http://stackoverflow.com/q/22435392
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34136476
type: Comment
comment on: http://stackoverflow.com/a/22444871
score: 0
type: AnswerComment
has text: I initially thought that, but Radiodef's answer seems to be correct. The argument is an `MyPerson` object.

http://stackoverflow.com/comment/34249787
type: Comment
type: QuestionComment
has text: I added two sections to my answer below. The most important issue for you right now most likely is the *Hash value calculation issue*.
comment on: http://stackoverflow.com/q/22354607
score: 0

http://stackoverflow.com/comment/34192322
type: AnswerComment
comment on: http://stackoverflow.com/a/22469389
type: Comment
has text: No, this would be in your calling activity class. The class where you are having your webservice call. My reply would be applicable in the response of that webservice call.
score: 0

http://stackoverflow.com/comment/33982060
type: Comment
type: QuestionComment
score: 1
has text: shared with other engineers and everybody use the same dev environment. and different projects use different versions, we have very old project, still in JDK 1.4.
comment on: http://stackoverflow.com/q/22357022

http://stackoverflow.com/comment/33962896
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22331467
type: Comment
has text: I need to replace the default keyboard and I already have found a number of examples and other information in this regard. The problem I am still having is how to make my keyboard look as similar to the standard one as possible.

http://stackoverflow.com/q/22436779
has comment: http://stackoverflow.com/comment/34120901
type: Question
has comment: http://stackoverflow.com/comment/34120760
has comment: http://stackoverflow.com/comment/34124161
has answer: http://stackoverflow.com/a/41979634
score: 0
tagged with: imageicon
answer count: 1
has title: How to add ImageIcon to a JLabel
tagged with: jlabel
type: UnansweredQuestion
tagged with: swing
linked to: http://stackoverflow.com/q/22422031
has body: My first project in java is Deal or No Deal and I am stack at adding a picture to a JLabel which is in the for loop. Here is my code so far: import javax.swing.*; import java.awt.*; import javax.swing.border.Border; import javax.swing.text.html.ImageView; import javax.swing.ImageIcon; /**import java.awt.image.BufferedImage; import java.io.File; import javax.imageio.ImageIO;**/ public class Screen extends JFrame { public Screen(){ //sağ ve sol panel oluşturuldu layoutları belirlendi JPanel sagPanel= new JPanel(); sagPanel.setLayout(new GridLayout(13,1)); sagPanel.setBorder(BorderFactory.createLineBorder(Color.black)); JPanel solPanel= new JPanel(); solPanel.setLayout(new GridLayout(13,1)); solPanel.setBorder(BorderFactory.createLineBorder(Color.black)); //orta panel oluşturuldu ve arka plana resim eklendi JPanel ortaPanel= new JPanel(); JLabel background= new JLabel( new ImageIcon(getClass().getResource("backgroundIcon.png"))); ortaPanel.add(background); //paneller frame eklendi add(sagPanel,BorderLayout.WEST); add(solPanel, BorderLayout.EAST); add(ortaPanel, BorderLayout.CENTER); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.5; c.weighty = 1; // sagPanel ve solPanel para miktarları ekrana yazdırıldı JLabel[] money= new JLabel[26]; money[0]= new JLabel("1 TL"); money[1]= new JLabel("2 TL"); money[2]= new JLabel("5 TL"); money[3]= new JLabel("10 TL"); money[4]= new JLabel("25 TL"); money[5]= new JLabel("50 TL"); money[6]= new JLabel("100 TL"); money[7]= new JLabel("200 TL"); money[8]= new JLabel("300 TL"); money[9]= new JLabel("400 TL"); money[10]= new JLabel("500 TL"); money[11]= new JLabel("750 TL"); money[12]= new JLabel("1000 TL"); money[13]= new JLabel("2500 TL"); money[14]= new JLabel("5000 TL"); money[15]= new JLabel("10000 TL"); money[16]= new JLabel("25000 TL"); money[17]= new JLabel("50000 TL"); money[18]= new JLabel("75000 TL"); money[19]= new JLabel("100000 TL"); money[20]= new JLabel("200000 TL"); m…
tagged with: java
has comment: http://stackoverflow.com/comment/34126688

http://stackoverflow.com/comment/34049805
score: 0
type: AnswerComment
has text: I don't really understand how taking out vital parts of Bob's movement calculations are really going to solve this issue in the long term? The problems will still occur as soon at the formula is expanded back to its current state
type: Comment
comment on: http://stackoverflow.com/a/22386803

http://stackoverflow.com/comment/33990875
type: Comment
score: 1
has text: This question could have been easily avoided...
type: QuestionComment
comment on: http://stackoverflow.com/q/22362020

http://stackoverflow.com/q/22481534
tagged with: java
type: Question
has title: JBoss timezone is getting changed automatically
tagged with: jboss-4.2.x
score: 0
answer count: 1
has body: We are facing one funny and interesting issue with our JBoss app server. The problem is we are running the JBoss in Linux server which is running in different time zone (say, America/Chicago). Also with the same timezone we are starting the JBoss server by setting -Duser.timezone=xxx JVM parameter. Although it's running fine as per the configuration for 5 or 6 days. After that the JBoss app server's time zone is getting changed automatically to some other time zone say (Asia/Kolkata). For this we have analyzed lot but we are not able to figure it out and as of now restart of JBoss is required to get things normal. So I wanted to know, is there any way to restrict this or to reset to old timezone without restarting JBoss?
tagged with: linux
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22481713

http://stackoverflow.com/comment/34176287
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22467153
has text: @user2989139 You will find that a significant portion (a majority, I would say) of yours bugs are caused by this. =)

http://stackoverflow.com/a/22483531
answers question: http://stackoverflow.com/q/22479912
upvote count: 8
score: 7
has body: You can use a custom ID generator to call your stored procedure. Define your @Id as this to point to your custom generator : @Id @GenericGenerator(name="MyCustomGenerator", strategy="org.mytest.entity.CustomIdGenerator" ) @GeneratedValue(generator="MyCustomGenerator" ) @Column(name = "PM_ID", nullable = false, length=12) private long pmId; private Integer field1; private Integer field2; .... your getters and setters .... And create your custom generator implementing IdentifierGenerator and passing properties of your Entity as stored proc parameters: public class CustomIdGenerator implements IdentifierGenerator { private static final String QUERY_CALL_STORE_PROC = "call generateId(?,?,?)"; public Serializable generate(SessionImplementor session, Object object) throws HibernateException { Long result = null; try { Connection connection = session.connection(); CallableStatement callableStmt = connection. prepareCall(QUERY_CALL_STORE_PROC); callableStmt.registerOutParameter(1, java.sql.Types.BIGINT); callableStmt.setInt(2, ((MyObject) object).getField1()); callableStmt.setInt(3, ((MyObject) object).getField2()); callableStmt.executeQuery(); // get result from out parameter #1 result = callableStmt.getLong(1); connection.close(); } catch (SQLException sqlException) { throw new HibernateException(sqlException); } return result; } }
type: AcceptedAnswer
downvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/22479912

http://stackoverflow.com/q/22450226
has answer: http://stackoverflow.com/a/22451609
accepted answer: http://stackoverflow.com/a/22451609
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
has title: How do I get the appointment status in EWS Java API?
has body: I am using the EWS Java API 1.2 and now I need to expand my program to know if an appointment has a certain status (available, busy, out of office). How can I know this? Looking through to documentation of the appointment class did not bring anything at first sight.
answer count: 1
tagged with: ewsjavaapi
tagged with: exchangewebservices

http://stackoverflow.com/a/22428930
upvote count: 2
has comment: http://stackoverflow.com/comment/34129759
has body: I've had success with the following approach. Make sure to compile with -g (use like: javac -g) to enable generation of all debugging information. When starting your application use appropriate debug flags (like so java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1414, the number is the port you connect to) to start a debugging server. Note that you can debug from a remote host (debugger will connect using hostname:port syntax). You don't need to type this all up for Cassandra; you can simply uncomment a relevant line in cassandra-env.sh (in Windows, look in bin/Cassandra.bat or if running Datastax distro, under registry key HKLM\SOFTWARE\[optionally Wow6432Node\]Apache Software Foundation\[Procrun node]\[Cassandra node]\Parameters\Java:Options). Connect to your server from your IDE (I used Eclipse, IntelJ is similar, I'm sure). Open the source code in the IDE and put some breakpoints that would be in play in your use case. Run your scenario. Your breakpoints should hit. For definite confirmation that the setup works, put a breakpoint on something that is guaranteed to be executed during your scenario, rather than on something you believe should. In your case, because you can successfully specify the keyspace, I believe everything is working, and then there is a silent failure when you try to do other steps, possibly introduced by your modifications. To confirm, I would recommend rolling back all your changes and first testing the debugger setup on a clean build. Lastly, and this may be superfluous, CQLSH is a program written in Python, and runs separate from Cassandra in a different process. Therefore you cannot see the actual "command line entry" from a Java debugger. The closest you can get to your raw input is by putting breakpoints somewhere in cql3 package to see CQL statements get passed in (hopefully). Of course you can use a Python debugger to debug CQLSH if this is what you want.
type: Answer
accepted answer of: http://stackoverflow.com/q/22427625
has comment: http://stackoverflow.com/comment/34127164
score: 2
has comment: http://stackoverflow.com/comment/34112363
has comment: http://stackoverflow.com/comment/34107825
downvote count: 0
has comment: http://stackoverflow.com/comment/34139626
answers question: http://stackoverflow.com/q/22427625
type: AcceptedAnswer

http://stackoverflow.com/q/22375568
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
tagged with: gwt
accepted answer: http://stackoverflow.com/a/22378588
score: 0
has title: Hibernate 4.3.4 StandardServiceRegistryBuilder
answer count: 1
has answer: http://stackoverflow.com/a/22378588
has body: I'm getting an error when creating a serviceRegistry. I'm using Hibernate 4.3.4 with GWT and a mySQL DB. The hibernate jar is included and I don't get any errors in the code but when I'm running it I get: com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.Long com.coma.comaexjobb.client.UserService.saveUser(com.coma.comaexjobb.shared.Users)' threw an unexpected exception: java.lang.NoClassDefFoundError: org/hibernate/service/ServiceRegistry My HibernateUtil.java package com.coma.comaexjobb.Util; import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Configuration; import org.hibernate.service.ServiceRegistry; public class HibernateUtil { private static SessionFactory sessionFactory; private static ServiceRegistry serviceRegistry; public static SessionFactory getSessionFactory() { Configuration configuration = new Configuration(); configuration.configure(); serviceRegistry = new StandardServiceRegistryBuilder().applySettings( configuration.getProperties()).build(); sessionFactory = configuration.buildSessionFactory(serviceRegistry); return sessionFactory; } } Anyone knows what to do? Thank you

http://stackoverflow.com/comment/34031394
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22384452
has text: @user3367856 use handler.postDelayed()
score: 0

http://stackoverflow.com/comment/34092296
type: AnswerComment
has text: It's OK but map also is OK.. I don't know but i think it's the same.
type: Comment
comment on: http://stackoverflow.com/a/22420219
score: 0

http://stackoverflow.com/comment/34001714
comment on: http://stackoverflow.com/q/22368166
score: 0
type: Comment
type: QuestionComment
has text: Where are the HTML tags in the String?

http://stackoverflow.com/q/22372517
tagged with: weblogic
score: 0
has title: Web logic 10.3.6 error NoClassDefFoundError
has comment: http://stackoverflow.com/comment/34052955
type: UnansweredQuestion
has body: I`ve deployed an Esri COTS application on top of web logic 10.3.6, it works properly. I updated a class inside a JAR file then recompiled the class and replaced it in the JAR. When I tried to start the Admin server again, I got the following error: java.lang.NoClassDefFoundError: com/esri/gpt/framework/security/identity/SingleSignOnMechanism Note that the class SingleSignOnMechanism exists in the JAR and compiled without errors or warnings. Please advice.
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34034459

http://stackoverflow.com/a/22486166
answers question: http://stackoverflow.com/q/22485784
type: Answer
score: 3
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22485784
upvote count: 3
has body: Only when using sqlplus or a similar tool that translates user input would you need to escape the &amp; character. In a java application calling a stored procedure, the &amp; would be treated as a regular character and wouldn't need escaping.

http://stackoverflow.com/comment/34198476
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22481174
has text: hi @alexander. Thanks for ur reply. i've already verified similar link. [link](http://stackoverflow.com/questions/16251273/can-i-watch-for-single-file-change-with-watchservice-not-the-whole-directory/16251508#16251508). hw could I use an action listener for this.

http://stackoverflow.com/q/22457185
has title: DataOutputStream.writeBytes adds zero-bytes
has comment: http://stackoverflow.com/comment/34160423
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22459479
answer count: 2
has comment: http://stackoverflow.com/comment/34159522
downvote count: 0
has comment: http://stackoverflow.com/comment/34196127
favorite count: 0
has comment: http://stackoverflow.com/comment/34157382
has answer: http://stackoverflow.com/a/22457383
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34157060
tagged with: tcp
upvote count: 1
has body: I have a small TCP server program and a corresponding client, and they communicate via ServerSocket and Socket classes and DataInputStream/DataOutputStream. And I have a problem with sending Strings to the server. connection = new Socket("localhost", 2233); outStream = new DataOutputStream(connection.getOutputStream()); outStream.writeBytes(fileName); fileName is, at this point in time, a hard-coded String with the value "listener.jardesc". The server reads the string with the following code: inStream = new DataInputStream(connection.getInputStream()); String fileName = inStream.readLine(); The string is received properly, but three zero-value bytes have been added to the end. Why is that and how can I stop it from happening? (I could, of course, trim the received string or somehow else stop this problem from mattering, but I'd rather prevent the problem completely)
has comment: http://stackoverflow.com/comment/34157109

http://stackoverflow.com/comment/34183945
comment on: http://stackoverflow.com/q/22471689
type: Comment
has text: post the log. I suspect error at creating **resizedBitmap**
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34061689
type: Comment
has text: great and is there a way to see all those users who have been granted all privileges?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22403465

http://stackoverflow.com/comment/34251389
type: AnswerComment
has text: This way you can use the method in the interface. But how can you achieve the 'name' variable ? I can always put getters in the interface and make changes to the Male class. But the problem arises when you have to change the remaining classes which are dependent on Male class for the 'name' variable. They will have to be modified as well.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22467538

http://stackoverflow.com/comment/34051954
has text: @Boolena Is your URL really "theurl"...? If so, that would certainly explain it. Try adding some temporary print-outs to your code to trace through what is happening (e.g. in the loop to print the number of bytes read each time, etc.).
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22397443

http://stackoverflow.com/a/22383153
answers question: http://stackoverflow.com/q/22383093
has comment: http://stackoverflow.com/comment/34028851
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: Move the close statements out of the while loop (preferably into a finally block) csvFile.close(); jsonFile.close();
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22383093

deserialization
type: Tag
tags question: http://stackoverflow.com/q/22355818
tags question: http://stackoverflow.com/q/22414642
tags question: http://stackoverflow.com/q/22396122
tags question: http://stackoverflow.com/q/22459639
tag name: deserialization
tags question: http://stackoverflow.com/q/22428630
tags question: http://stackoverflow.com/q/22451988

http://stackoverflow.com/comment/33998426
type: QuestionComment
score: 2
has text: I just googled "java using an arraylist", and [this](http://stackoverflow.com/questions/2697182/how-to-use-an-array-list) was the first result....
comment on: http://stackoverflow.com/q/22366126
type: Comment

http://stackoverflow.com/comment/33993897
type: QuestionComment
comment on: http://stackoverflow.com/q/22363434
has text: @mikeB :Can you help me how it will be? code?
score: 0
type: Comment

http://stackoverflow.com/q/22425539
accepted answer: http://stackoverflow.com/a/22425633
score: 0
tagged with: settext
answer count: 2
has comment: http://stackoverflow.com/comment/34100908
has comment: http://stackoverflow.com/comment/34100966
favorite count: 0
has title: GetText() works fine but setText() crashing the app
tagged with: android
upvote count: 1
has body: public TextView name_place; private ImageView foto; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); name_place = (TextView) findViewById(R.id.name); foto = (ImageView) findViewById(R.id.foto); settings = getSharedPreferences("USER_INFO", 0); UserName = settings.getString("USER_NAME",null); UserId = settings.getString("USER_ID",null); ... new Thread(new Runnable() { public void run() { while(true){ setupThings(); try { Thread.sleep(5000); }catch(Exception e){} } } }).start(); } public void setupThings(){ UserName = settings.getString("USER_NAME",null); UserId=settings.getString("USER_ID",null); try { name_place.setText("" + UserName.toString()); }catch(Exception e){ Log.w("LOG",name_place.getText().toString()); } }` My question is why setText() in TRY block doesnt work, but getText() in CATCH block works perfectly fine. (only one xml - activity_main.xml)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34100904
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22425633
possible better answer: http://stackoverflow.com/a/22425628
has answer: http://stackoverflow.com/a/22425628

http://stackoverflow.com/comment/34139034
comment on: http://stackoverflow.com/q/22446400
has text: Why not try it on an Android with 1000 15-character strings and see if it meets your performance requirements? Worst case test would be if no strings contained those characters. 1000x `"aaaaaaaaaaaaaaa"` would do the trick, for example.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/22450411
has comment: http://stackoverflow.com/comment/34151121
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22480223
type: Question
answer count: 1
downvote count: 0
has body: In my app I have listView with about 100 rows. Each rows contains textField with behaviour. Problem is that rendering this page takes too long about 2s. When I remove this behaviour then it takes just couple of ms. My question is why it takes so long and is there option how to make it faster ? add(new ListView&lt;PlayOffGame&gt;("games") { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ListItem&lt;Game&gt; listItem) { listItem.add(new TextField&lt;String&gt;("results").add(new AjaxFormComponentUpdatingBehavior("onchange") { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { // do something } })); } }); UPDATE wicket version: 1.5.9 rendering = method onRender: @Override protected void onRender() { logger.debug("Render start"); long time = System.currentTimeMillis(); super.onRender(); time = System.currentTimeMillis() - time; logger.debug("Render: " + time + " ms"); };
has title: Why rendering textField with Behavior takes so long
favorite count: 0
has comment: http://stackoverflow.com/comment/34153385
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34153819
tagged with: wicket
upvote count: 1

http://stackoverflow.com/comment/34071482
type: Comment
score: 1
has text: @LucianNovac I don't either but look at the error the OP is getting, "it cannot resolve the variable." This is a *compile* error, not *runtime* as you are saying. And look at it, that variable is **clearly** out of scope. You can't do it that way with a 'try/catch`
comment on: http://stackoverflow.com/a/22408630
type: AnswerComment

http://stackoverflow.com/comment/34084507
score: 0
has text: Are you sure? What happens if you change the pattern to /m/partner/list.* ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22415382

http://stackoverflow.com/comment/33938193
has text: did you set the clickListener to your view, I mean the view.setOnClickListener(this);
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22332017
score: 0

http://stackoverflow.com/comment/34153737
type: QuestionComment
has text: Also, you use `.getBytes()`. Don't do that: the encoding is JVM dependent. Use `.getBytes("UTF-8")` instead (if you use Java 7, use `.getBytes(StandardCharsets.UTF_8)`).
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22455173

search-engine
type: Tag
tags question: http://stackoverflow.com/q/22438253
tag name: search-engine

http://stackoverflow.com/comment/36658659
comment on: http://stackoverflow.com/a/23769264
has text: I am trying to read data from [this](http://www.dynament.com/infrared-sensor-data/tds0037.pdf) sensor, which is unpowered. Sorry for the barrage of questions, but do you send a write to the device before you call the read method? Also, are you working with values such as "0x13", it is my first encounter with them and any recommended reading on the subject would be appreciated.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22353936
upvote count: 1
type: Question
has title: Cannot declare private variables in constructor?
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/11832001
has comment: http://stackoverflow.com/comment/33976736
has body: I'm programming in Java and I'm having trouble getting the following code to compile. The error (illegal start of expression) shows up at private final int YA; However, when I remove the private modifier on all the variables, it compiles fine. I haven't been able to find a solution online, and most of my searches end up going toward questions about making constructors private (which I'm not trying to do). What really gets me is I've written another class that follows the same format, private final variables in the constructor, and it compiles without a problem. I'm new to Java, so I could be missing something really boneheaded here. If so, please be gentle. Cheers and thanks. public class IndividualTaxCalculator { IndividualTaxCalculator(int inYearAssessment) { private final int YA; YA = inYearAssessment; switch (YA) { case 2013: private float netEmploymentIncome; // BTC cell H16 private float totalIncome; // BTC cell H27 private float assessableIncome; // BTC cell H31 private float chargeableIncome; // BTC cell H49 private float taxPayableOnChargeable; // BTC cell H51 private float incomeTaxRebate; // BTC cell H53 private float taxPayableAfterRebate; // BTC cell H55 private float parenthoodTaxRebate; // BTC cell H57 private float netTaxPayable; // BTC cell H59 break; } } }
has answer: http://stackoverflow.com/a/22354046
accepted answer: http://stackoverflow.com/a/22353960
downvote count: 0
possible better answer: http://stackoverflow.com/a/22354033
has answer: http://stackoverflow.com/a/22354208
favorite count: 0
has answer: http://stackoverflow.com/a/22353960
has answer: http://stackoverflow.com/a/22354033
answer count: 4
type: AnsweredQuestion
tagged with: constructor

http://stackoverflow.com/q/22402497
has body: Is there any way for 'previewing' sql select statements? What I'm trying to do is to get the names of the columns that are returned by a sql statement without actually running the statement? On application startup i need to know the column names, the problem is that some of the queries can run for awhile.
has answer: http://stackoverflow.com/a/22403207
has comment: http://stackoverflow.com/comment/34060457
tagged with: java
has comment: http://stackoverflow.com/comment/34061011
has comment: http://stackoverflow.com/comment/34060688
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34060580
has title: Preview sql result columns in java
has comment: http://stackoverflow.com/comment/34060096
accepted answer: http://stackoverflow.com/a/22403207
tagged with: sql
has comment: http://stackoverflow.com/comment/34060244
has answer: http://stackoverflow.com/a/22402767
has comment: http://stackoverflow.com/comment/34060828
has comment: http://stackoverflow.com/comment/34061130
has comment: http://stackoverflow.com/comment/34060760
possible better answer: http://stackoverflow.com/a/22402767
has comment: http://stackoverflow.com/comment/34060184
has comment: http://stackoverflow.com/comment/34060055
has comment: http://stackoverflow.com/comment/34060400
type: AnsweredQuestion

http://stackoverflow.com/comment/33988858
has text: Oh I've found something really strange. I just resized the image(simple png) as I've added to my post and suddenly a corner of the image appeared would you please look at the post again and see isn't it due to size or something like that?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22360403

http://stackoverflow.com/a/22466247
has body: You need to use new keyword to initialize your object. balance = new Money(0.00); Read more about how to create an object in Java
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/22466221
accepted answer of: http://stackoverflow.com/q/22466221
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22381306
has answer: http://stackoverflow.com/a/23382647
linked to: http://stackoverflow.com/q/16333549
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/23370068
linked to: http://stackoverflow.com/q/23061611
tagged with: dbobject
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/23370068
tagged with: java
has title: Constructing a Mongo DBObject from single-quote JS object with escaped characters?
type: Question
tagged with: mongodb
possible better answer: http://stackoverflow.com/a/23382647
has body: This question relates to the Java API / Driver, but may also be relevant to interfacing Mongo in other languages. I am new to Mongo and making some assumptions, so please correct me if I'm mistaken. A lot of documentation I'm finding, and references describe creating a DBObject given a structure like this: { foo: "bar", baz: { x : { lorem: "Ipsum" }, y: { dolor : "sit amet" } } } Assume the above object exists (unchanged) in a file called foo.json. Now, as I understand it, the content above is a JavaScript object literal (not valid JSON). Right? However, this is the form referenced as "JSON" in the Mongo documentation. In any case, in my tests, I'm reading the foo.json file into a String and parsing it using (I believe) a fairly standard convention: String fooString = readFile("foo.json"); Object o = com.mongodb.util.JSON.parse(fooString); DBObject dbObj = (DBObject) o; This works just fine. Now, since foo.json isn't valid JSON, I assumed I'd be able to use a similar JavaScript object form: { foo: 'bar', baz: { x : { lorem: 'Ipsum' }, y: { dolor : 'sit amet' } } } Ok, fine, that seems to work. Although, oddly enough in Mongo shell it appears to be stored with double quotes. Since that works, I'm making another assumption that I'd be able to handle the JavaScript object form with escaped single quotes: { foo: 'bar', baz: { x : { lorem: 'Ipsum. Isn\'t working' }, y: { dolor : 'sit amet' } } } However, when I try to parse this object (using com.mongodb.util.JSON.parse(fooString) ), a com.mongodb.util.JSONParseException is thrown. Shouldn't all 3 forms be supported? Note: I'm using the org.mongodb:mongo-java-driver:mongo-java-driver:2.11.2 . Thanks in advance for any/all help.

http://stackoverflow.com/comment/34143099
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22448616
has text: Where is bookNum declared?? If it is declared at class level are you initializing any where,if not it will take default value 0
score: 0

http://stackoverflow.com/q/22421628
has comment: http://stackoverflow.com/comment/47829799
score: 0
answer count: 2
has title: How to get selected item id and value of form:select in a Spring MVC
has answer: http://stackoverflow.com/a/22422359
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has body: I'm new to Spring and I would like to get id and value of selected item of a dropdown. Here is a simple example class MaritalStatus{ private int id; private String status; } class regForm{ private MaritalStatus maritalStatus; ... } //Simple Controller to fill the list @RequestMapping(value = "/save") public String init(Model model){ List&lt;MaritalStatus&gt; maritalList = new ArrayList&lt;MaritalStatus&gt;(); maritalStatus.setId(1) maritalStatus.setStatus("Married") maritalList.add(maritalStatus);// add all status to the list.... model.addAttribute("maritalList",maritalList); ... } jsp page &lt;form:form commandName="regForm" action="save"&gt; &lt;form:select path="maritalStatus.id"&gt; &lt;form:options items="${maritalList}" itemValue="id" itemLabel="status" /&gt; &lt;/form:select&gt; &lt;/form:form&gt; This is where I want to get selected item id and value (1 and Married) @RequestMapping(value = "/save") public String save(Model model,@ModelAttribute("regForm") RegForm regForm){ // here I want to get selected item Id and Status(Label) //regFrom.getMaritalStatus().getId() and regFrom.getMaritalStatus().getStatus() }
type: Question
has answer: http://stackoverflow.com/a/22458457
tagged with: java

http://stackoverflow.com/a/22413787
has comment: http://stackoverflow.com/comment/34080825
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/34081941
has comment: http://stackoverflow.com/comment/34080624
answers question: http://stackoverflow.com/q/22413411
has comment: http://stackoverflow.com/comment/34081631
has body: If you have problems accessing the context from different Views you can do this: Create a class that extends Application (e.g. MyApplication) Declare that class in your manifest as your Application class as shown below: &lt;application android:name="your.project.package.MyApplication" ... Application class is by default a singleton, but you need to create a getInstance method as shown below: public class MyApplication extends Application { private static MyApplication instance; public void onCreate() { instance = this; } public static MyApplication getInstance() { return instance; } } Done, you can access the context from anywhere in your app without passing so many references as follows: MyApplication app = MyApplication.getInstance() Vibrator v = (Vibrator) app.getSystemService(Context.VIBRATOR_SERVICE); There you go, you can not only call vibrator service but any service you want...
type: Answer
score: 2

http://stackoverflow.com/comment/33940396
score: 0
type: QuestionComment
type: Comment
has text: hi, here the proxy I meant what on client side, CXF support creating a rest proxy from an interface. the implemetation just in server side... or did I misunderstand your question?
comment on: http://stackoverflow.com/q/22333056

http://stackoverflow.com/comment/34005345
comment on: http://stackoverflow.com/q/22370032
score: 0
type: Comment
type: QuestionComment
has text: @Tristan "Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem: The method draw() is undefined for the type RacePoly.RacePanel" and then a whole long list of problems

http://stackoverflow.com/a/22375360
has body: Have you tried using ant script to run your test cases, I assume you have written your test case using Junit. Thanks!
answers question: http://stackoverflow.com/q/22375142
score: 0
has comment: http://stackoverflow.com/comment/34013627
type: Answer

http://stackoverflow.com/comment/34100434
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22422814
has text: Also with the Arduino make sure your Baud rate is set correctly as the Ardunio can't operate as fast as your blue tooth likely will go at max speed.

http://stackoverflow.com/q/22453682
answer count: 1
has title: Is there any online tool or any other way to set a certain string compatible to java?
has comment: http://stackoverflow.com/comment/34185714
tagged with: string
has body: I am not very experienced programer and am working on strings. I am facing a problem of setting each and every double quotation marks by entering '\' before it (to make it compatible for java compiler). For example: I am using GSON library to get strings like below: String example = "[{"salesChannelId":1," + ""companyName":"Prüftechnik Condition Monitoring"," + ""country":"DE"," + ""isActive":true," + ""salesChannelContact":[{"salesChannelContactId":40," + ""name":"Hans Muller"," + ""isActive":true}," + "{"salesChannelContactId":41," + ""name":"Peter Pan"," + ""isActive":true},"}]"; and I convert every such string to equaivalent backslashed string: String example = "[{\"salesChannelId\":1," + "\"companyName\":\"Prüftechnik Condition Monitoring\"," + "\"country\":\"DE\"," + "\"isActive\":true," + "\"salesChannelContact\":[{\"salesChannelContactId\":40," + "\"name\":\"Hans Muller\"," + "\"isActive\":true}," + "{\"salesChannelContactId\":41," + "\"name\":\"Peter Pan\"," + "\"isActive\":true},\"}]"; Now the problem is that I have allot of strings and very lengthy too, and I don't want to waste my time in parsing them or writing a separate code for them. Is there any online tool or any shortcut to get rid of it?
favorite count: 0
has comment: http://stackoverflow.com/comment/34150993
has comment: http://stackoverflow.com/comment/34151200
has answer: http://stackoverflow.com/a/22453829
tagged with: regex
has comment: http://stackoverflow.com/comment/34150772
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34150889
type: Question
has comment: http://stackoverflow.com/comment/34187295
has comment: http://stackoverflow.com/comment/34151350
tagged with: java
downvote count: 5
has comment: http://stackoverflow.com/comment/34152346
upvote count: 0
has comment: http://stackoverflow.com/comment/34150756
score: -5

http://stackoverflow.com/a/22388117
answers question: http://stackoverflow.com/q/22387336
has body: Your code LocationClass locationClass = new LocationClass(); does not create it. It just makes an object of it, but it does not tie to the lifecycle and call the methods. You need to start it with an intent to make it appear (and take the entire screen based on skimming your code). Android will fire the appropriate method calls when you do so. Like this: Intent intent = new Intent(this, LocationClass.class); startActivity(intent); More information can be found here: http://developer.android.com/training/basics/firstapp/starting-activity.html#StartActivity It must be defined in your manifest too or it will crash. There are other noticeable oddities things in your code, do you want LocationClass to extend MyActivity and not Activity? Your LocationClass also does not call setContentView() in onCreate, so you're not going to see a UI (as far as I can tell), unless you wanted it through the extends part. EDIT : If you extend subclass and put this intent code in onCreate, you're probably going to crash, as it will call super() in MyActivity (calling onCreate() again as it's the superclass), and will keep making more intents to start the activity. You should not subclass MyActivity if that's what the 'parent' class is. You should only subclass Activity or a global parent activity (e.g. in my project right now, I extend SpiceActivity, as they all use common components related to Spice).
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34037317
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22387336
has comment: http://stackoverflow.com/comment/34036271

http://stackoverflow.com/a/22329618
score: 0
answers question: http://stackoverflow.com/q/22329486
type: Answer
has body: The NullPointerException is not caused by the potentially different lengths of the arrays, but by the fact that keyValue is null. You might add public void createCommonKey(){ keyValue = new byte[b.length]; // <-- This line for(int i=0; i<b.length; i++){ ... to make this error disappear. But still, the arrays have different lengths, which will cause an ArrayIndexOutOfBoundsException when b.length is greater than c.length. I don't know the details of Diffie-Hellman, but a simple approach might be to let the indices "wrap" when they become too large: public void createCommonKey() { int max = Math.max(b.length, c.length); keyValue = new byte[max]; for(int i=0; i<max; i++) { int ib = i % b.length; int ic = i % c.length; keyValue[i]=(byte)(b[ib]+c[ic]); } }

http://stackoverflow.com/comment/34072299
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22400600
has text: I think it's not fully enabled. maybe you should post it on github issue tracker?

http://stackoverflow.com/a/22469076
answers question: http://stackoverflow.com/q/22417969
accepted answer of: http://stackoverflow.com/q/22417969
type: AcceptedAnswer
has body: To answer your question, yes it would make a huge difference if you removed the return statement from your return children.get(i).search(x); line of code. The method signature: public Node search(int x) specifically states that it will return a node value, therefore the end result of this method must return a Node, or a null value. "How does java handle these statements differently?" The method call: children.get(i).search(x); merely runs the method and moves on. This only works if the method has a void return type. Since your method returns a value (in this case a Node) you have to do something with the value. Calling a method that returns a value is like using a variable in a sense. You can't just have a line of code that says: variableX; You need to do something with it. In your case, since your method returns a Node type, you've got to do something with the returned value when you call the method. In order for this algorithm to work, you're taking the value obtained from the called method, and returning it back to the calling method. Using a visual example: Search1 > Search2 > Search3 Search1 calls Search2, Search2 calls Search3 Search3 returns a Node to Search2 Search2 returns that node to Search1 Removing the return key word will only give you errors since you would then have a line of code that amounts to a variable without doing anything with it. children.get(i).search(x); Would evaluate to a Node, which you must use.
score: 0
type: Answer

http://stackoverflow.com/comment/67040315
type: AnswerComment
score: 0
has text: can you tell us what's the versions of Httpclient and Httpcore that makes this code works ?
type: Comment
comment on: http://stackoverflow.com/a/22331092

http://stackoverflow.com/q/22448369
has comment: http://stackoverflow.com/comment/41406452
possible better answer: http://stackoverflow.com/a/33699489
score: 8
favorite count: 0
has answer: http://stackoverflow.com/a/33699489
has answer: http://stackoverflow.com/a/28304327
upvote count: 8
has comment: http://stackoverflow.com/comment/44962423
has title: Homoglyph attack detection in email phishing
type: AnsweredQuestion
tagged with: phishing
linked to: http://stackoverflow.com/q/18060037
has comment: http://stackoverflow.com/comment/41390738
tagged with: java
has comment: http://stackoverflow.com/comment/41406529
has comment: http://stackoverflow.com/comment/44960026
accepted answer: http://stackoverflow.com/a/28304327
type: Question
has body: Main Question I am working on an API in Java that needs to detect the use of brands (e.g. PayPal, Mastercard etc.) in phishing emails. Obviously there are different strategies that the attackers use to target these brands so that they are harder to detect. For instance "rnastercard" looks very similar to "mastercard" and can fool an unsuspecting user. At this time I can easily detect the misspellings of these brands using a form of fuzzy string search. However the problem I am facing is when the attacker uses homoglyps to change the name of a particular brand but maintains the same visual interpretation. A homoglyph attack substitutes a character from the [a-zA-Z] pattern with a character that looks similar but is outside this range. For example, an attacker using a particular character set can use the Greek Letter RHO that looks like P to target PayPal. The PayPal brand name in this sort of attack would become : [Greek character RHO][a][y][Greek character RHO][a][l] Since I have little to no experience with different standards like Unicode or ISO standards and their encodings I am calling upon your advice. Is there a way to programmatically determine the visual equivalent of a character outside the [a-zA-Z] set so that the result would be a character inside the [a-zA-Z] set? Some of your answers might be based on a particular character set, I am looking for a solution that would help me determine such representations for every character set usable inside an email. I have not read the RFC standards for mail exchange but they are on my list, I am asking this question now to save time. Possible but unworkable solutions I have thought of some solutions but they are not workable for my particular case since they are very CPU intensive and of a hack-like nature (read "may be easily broken"). The first solution would be to write the character that is outside [a-zA-Z] in it's form into an image and feed that image to an OCR API to get it's closest [a-zA-Z] representation. …
answer count: 2
has comment: http://stackoverflow.com/comment/38620064
has comment: http://stackoverflow.com/comment/44958589
has comment: http://stackoverflow.com/comment/44958376
tagged with: security
has comment: http://stackoverflow.com/comment/44962174
tagged with: email
downvote count: 0
tagged with: homoglyph

http://stackoverflow.com/a/22465117
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/22460163
has body: After seeing the json you posted i think you are trying to merger two json of with same id but different metadata id. Since the json work on the key value. you can't have two value for the same key such as in this value "color":"blue", "green", "id": "84779jh","84ergfujh" unless you take color as a array. After seeing ur json you create map on the basis of the metadata id and you can add those metadata map to single metadata map import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.type.TypeReference; import com.google.common.collect.ImmutableMap; public class JsonFileMapExample { public static void main(String[] args) { try { ObjectMapper mapper = new ObjectMapper(); // read JSON from a file Map&lt;String, Object&gt; map_json1 = mapper.readValue(new File( "F:/Work/DB/work/workspace/restclient/src/json1.json"), new TypeReference&lt;Map&lt;String, Object&gt;&gt;() { }); Map&lt;String, Object&gt; map_json2 = mapper.readValue(new File("F:/Work/DB/work/workspace/restclient/src/json2.json"),new TypeReference&lt;Map&lt;String, Object&gt;&gt;() { }); System.out.println(map_json1); System.out.println(map_json2); Map&lt;String, Object&gt; map2 = (Map&lt;String, Object&gt;) map_json1.get("metadata"); Map&lt;String, Object&gt; map_json3 = new HashMap&lt;String, Object&gt;(); map_json3 = mergeMyTwoMaps((Map&lt;String, Object&gt;) map_json1.get("metadata"),(Map&lt;String, Object&gt;) map_json2.get("metadata")); System.out.println(map_json3); } catch (Exception e) { e.printStackTrace(); } } static Map&lt;String, Object&gt; mergeMyTwoMaps(Map&lt;String, Object&gt; map1, Map&lt;String, Object&gt; map2) { return ImmutableMap.&lt;String, Object&gt;builder() .putAll(map1) .putAll(map2) .build(); } } Output: json1= {id=16875, position=[1, 2, 5, 7], metadata={id=84779jh, color=blue, more={some=randomdata, absolutly=noStructure}}} json2={id=16875,…
has comment: http://stackoverflow.com/comment/34187301
type: Answer
upvote count: 5
has comment: http://stackoverflow.com/comment/34190401

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/22344125
tag name: android-gridview

http://stackoverflow.com/q/22390482
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/34040080
has answer: http://stackoverflow.com/a/22740731
tagged with: java
score: 0
answer count: 1
has body: I am working on a project where I will get the data from the user's input form (no file processing). To avoid the duplication, I want to use either (fixed-length or fixed block) or (Variable length or Variable block). Which one is the better approach for the user's input data from small length (one liner) to big length (something like blog) ? I am looking in to md5 (fixed length) or sha1 (variable length), are there any better implementations for it?
tagged with: deduplication
has title: Hashbased data dedeuplication

http://stackoverflow.com/comment/34151696
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22454161
has text: Now I receive an error: No WebApplicationContext found: no ContextLoaderListener registered?

http://stackoverflow.com/comment/34652680
type: AnswerComment
comment on: http://stackoverflow.com/a/22459418
type: Comment
has text: On a side note, the convert from letter into number in the main method will only work on an letters a to j as the char '0' + 10 (10 is what k - a equals) is : and not 10 as noted in the follow up question from this - http://stackoverflow.com/questions/22734785/java-character-converting-into-number-in-2d-char-array
score: 0

http://stackoverflow.com/comment/34194230
has text: The browser have to know how to handle the HTTP response stream. I'm going to suggest an answwer.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22475881
score: 0

http://stackoverflow.com/comment/33977760
score: 0
type: AnswerComment
type: Comment
has text: The problem is that notify also needs polling since JDBC does not support an asynchronous mechanism The other application is Erlang; we don't use JPA since we need performance and JPA query cache (in EclipseLink) has very poor performance compared to direct map based caching.
comment on: http://stackoverflow.com/a/22354052

http://stackoverflow.com/comment/34239830
has text: Note that i have to admit i am not sure if there is any difference between how you tried to set the credentials (3 aproaches) and how i set the credentials.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22408807
type: Comment

http://stackoverflow.com/q/22392110
has body: I'm getting this issue when trying to Make my java project. I just uninstalled my 64 bit jdk for various reasons and installed the 32 bit one. I'm getting the error: Cannot run program "C:\Program Files\Java\jdk1.7.0_51\bin\java" (in directory "C:\Users\$username.IntelliJIdea13\system\compile-server"): CreateProcess error=2, The system cannot find the file specified How do I get the compiler to use the jdk in the C:\Program Files (x86) folder which I now have?
accepted answer: http://stackoverflow.com/a/22392702
tagged with: java
upvote count: 15
tagged with: intellij-idea
downvote count: 0
answer count: 1
favorite count: 0
has title: Change jdk path in IntelliJ 13 when compiling from 32 bit program file folder to 64 bit one
has answer: http://stackoverflow.com/a/22392702
type: AnsweredQuestion
score: 15
type: Question
tagged with: 32bit-64bit

http://stackoverflow.com/q/22433643
has comment: http://stackoverflow.com/comment/34115567
has title: Value not printing
favorite count: 0
has comment: http://stackoverflow.com/comment/34115519
has answer: http://stackoverflow.com/a/22433812
has comment: http://stackoverflow.com/comment/34116649
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34115421
has comment: http://stackoverflow.com/comment/34115563
has comment: http://stackoverflow.com/comment/34115776
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34115543
upvote count: 1
has comment: http://stackoverflow.com/comment/34116550
type: Question
has body: I need to find out out why the following code segment doesn't print the value in a swing application and how to resolve it. String text = txtResults.getText(); StringTokenizer token = new StringTokenizer(text); StringBuilder s = new StringBuilder(); while(token.hasMoreElements()) { String value = token.nextElement().toString(); StringBuilder result = new StringBuilder(); for (int index = 0;index &lt; value.length();index += 8) { result.append((char) Integer.parseInt(value.substring(index, index + 8), 2)); s.append(result); } } System.out.println(s);
tagged with: desktop-application
answer count: 1
has comment: http://stackoverflow.com/comment/34115457
downvote count: 0

http://stackoverflow.com/comment/34199663
type: Comment
has text: You simply should not read a 1-2GB file into a `String` - this is going to be a) slow and b) memory intensive. You probably need to carry out some transformation of the file so _stream_ it - read and write it one line at a time. More importantly I would recommend [this article](http://kaioa.com/node/59) on using strings in Java.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22481811

http://stackoverflow.com/comment/34130297
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22441430
has text: I feel like my teacher is getting at the fact that we do need to alter the original object is what I am saying. I'll just e-mail her and ask, but I seriously do not understand why she would word the question like she did if we could just write a 1-liner method.
score: 0

http://stackoverflow.com/a/22436082
score: 1
answers question: http://stackoverflow.com/q/22435930
downvote count: 0
has body: while calling a method compiler first check the method name,parameter lists with datatype to match exactly, like method overloading. if compiler doesn't get exact match for method, it looks for the best match. in your case it first check the method printValue() having three parameters. it chooses public static void printValue(int i, int j, int k) method because - -compiler doesn't get the exact matced method. -it looks for appropriate match like byte->int , char -> int , int->long can be done explicitly.(widening) or autoboxing.** smaller data type can be converted into larger data type value. so it calls printValue(int i, int j, int k).** -your passed value can be easily converted into integer. 9- is also byte,char, integer data type value.
type: Answer
upvote count: 1

http://stackoverflow.com/q/22374271
has body: i am trying to protect my software with a classic serial key the user enters at start. I built something like that for my software some while ago, but our client now wants to handle the licenses himself, thus being able to blacklisting some serial keys. The idea is that the software connects itself every week or so to validate itself with our servers. After half a year without a successfull validation the software is blocked. Well i'd like to use some library for that (writing it myself would be possible but i feel like not reinventing the wheel is a good idea at license validation). Yesterday i played around some hours with license4j but it seems like the java runtime API is solely based on either the License4j proper servers or the floating server activation pattern. The LicenseValidator class doesn't give you methods for any other validation way. What i really want is a basic onlince license key validation - maybe coupled with some "send me back some information about the license" - maybe like enabled features or stuff. That would be nice. Any ideas?
type: Question
has answer: http://stackoverflow.com/a/22422631
has title: Java Online Serial Key Validation Library
tagged with: key
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22422631
tagged with: validation
has answer: http://stackoverflow.com/a/22376702
tagged with: serial-number
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22376702
tagged with: java

http://stackoverflow.com/a/22413677
has body: I think it depends, depends on what? Depends if the List has been marked with @OrderColumn annotation, default is not store the order of the list, but it depends on your model an eclipselink can be configured to store order and be the responsible for the correct update of that field. Also use OrderColumn could be a hit in the performance so use with caution
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22409025

http://stackoverflow.com/comment/33959862
type: Comment
type: QuestionComment
has text: First you will have to call that method from the class `B` using `super.sum()` and create another method in your class `B` and from that method class `B` method call the super class `A` method and in your class `C` you call the class `B` method by creating instance of class `C`. This way it will first call first the class `B` method in which there is already called first class `A` method. This way it can work.
comment on: http://stackoverflow.com/q/22343982
score: 0

http://stackoverflow.com/a/22344349
has body: You would need to register for the foreground dispatch system (or optionally the reader mode system if your app is Android 4.4+ only). See the Android NFC documentation for further information on how to use the foreground dispatch system. With regard to the ndeftools library, the NfcDetectorActivity should do (or be adaptable to) what you want.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22334453

http://stackoverflow.com/q/22469208
has comment: http://stackoverflow.com/comment/34178768
favorite count: 0
tagged with: return
has body: I'm making a little card deck program that uses an ArrayList for the deck. One of the limitations set upon me is that the method in which I "deal" the cards must be an Arraylist type. The problem I'm running into is that I don't know how to return just a specific index value from the ArrayList. See below. public ArrayList deal(int n, boolean up){ Card card0 = new Card(); boolean cardFace = card0.state(up); return al.get(0); //&lt;-- This doesn't work, Netbeans says that it is a string type //not an ArrayList type. The only thing it will actually //allow me to return is: return.al; // But this doesn't work, I don't need to return the whole list, // just the first element, but Netbeans calls that a String type, not // ArrayList So how can I return the first item of the List and still have it be the correct type? The rest of the code doesn't matter, just the Method type and return statement. EDIT: As requested package deckofcards; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Deck{ ArrayList&lt;String&gt; al = new ArrayList&lt;&gt;(); public void shuffle(){ Collections.shuffle(al); } public String displayDeck(){ String returnDeck = ""; for(int i = 0; i &lt; al.size(); i++){ String printDeck = al.get(i); returnDeck += printDeck; } return returnDeck; } public ArrayList deal(int n, boolean up){ Card card0 = new Card(); boolean cardFace = card0.state(up); return al.get(0); } public void populate(){ al.add(0, "Ace of Spades"); al.add(1, "Two of Spades"); al.add(2, "Three of Spades"); //yadaa yadaa
has comment: http://stackoverflow.com/comment/34178661
answer count: 4
has comment: http://stackoverflow.com/comment/34178706
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22469299
has comment: http://stackoverflow.com/comment/34178666
tagged with: java
accepted answer: http://stackoverflow.com/a/22469258
tagged with: methods
has answer: http://stackoverflow.com/a/59038421
type: Question
has comment: http://stackoverflow.com/comment/34178759
has answer: http://stackoverflow.com/a/22469258
score: 4
has answer: http://stackoverflow.com/a/22469302
upvote count: 4
tagged with: arraylist
has title: Return ArrayList from ArrayList method type
possible better answer: http://stackoverflow.com/a/22469299
downvote count: 0

http://stackoverflow.com/comment/107675710
score: 0
comment on: http://stackoverflow.com/q/22400996
type: Comment
type: QuestionComment
has text: This type of problem is solved using Maven. Why don't you use it for dependency management in 2020?

http://stackoverflow.com/comment/34005376
comment on: http://stackoverflow.com/q/22370130
has text: If you have little idea about HQL and other methods to create hiberanate `criteria`, then you would probably know, this much information is not enough to prepare the query for you. Further Hibernate supports native `SQL queries` as well. But that is not recommended. Anyways, if you want to go ahead with `SQL query` with Hibernate, no change required in your query.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33984108
comment on: http://stackoverflow.com/q/22338741
has text: Why don't you delete this question and ask another one?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34056880
score: 0
comment on: http://stackoverflow.com/q/22399572
type: Comment
type: QuestionComment
has text: @SiddharthVyas No , I'm not using external jar files in this.

http://stackoverflow.com/q/22417825
type: Question
tagged with: urlrequest
tagged with: http://stackoverflow.com/tag/html
has title: Code response 302 when trying to read HTML file from a URL
score: 0
answer count: 1
tagged with: http-status-code-302
tagged with: java
has comment: http://stackoverflow.com/comment/34087810
has body: I'm trying to get the html document out of the following URL: http://search.lib.monash.edu/primo_library/libweb/action/search.do?vl%28freeText0%29=java&amp;vid=MON&amp;fn=search The problem is that I'm getting 302 response code! I'm not familiar with the way this request is being handled here (given the function and the parameters) so not really what the appropriate way to read this html is, would appreciate any help to read the html. Thanks
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22417869
has comment: http://stackoverflow.com/comment/34087799

http://stackoverflow.com/q/22356470
has title: How do I store an instance of a class created by a constructor so variables within in can be called later?
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22356657
type: Question
has answer: http://stackoverflow.com/a/22356788
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22356675
has answer: http://stackoverflow.com/a/22356657
score: 0
answer count: 3
has body: For Example: I have a deck of cards, with a constructor Card(char,int). I initialize 52 instances of card. Then using a method within Card, I call GetName() which should return a string of char + int; So if I initialize it as Card c1 = new Card(d,1); and call c1.GetName(); it should return c1. However, the program is choosing a different card and assigning all instances of cards that name. The Code is rather long so I have it copied here: http://pastebin.com/7akeFgs0 I've looked into Garbage Collection and I'm not sure what to do if that is the problem.
tagged with: initialization
tagged with: constructor
has answer: http://stackoverflow.com/a/22356675

http://stackoverflow.com/q/22442541
has comment: http://stackoverflow.com/comment/34131819
has title: Can you save a data type to a variable? (DataType t = Integer)?
type: Question
has body: In the classes I am coding, I tend to have to cast variables to other datatypes quite commonly. I wanted to make a method that could truncate this process. I wanted it to be something like this: public static Object typeCast(Object o, DataType type){ if (o instanceof type){ return (type) o; }else{ return false; } } However, I know of no way to save a data type as a variable. Is this possible?
has answer: http://stackoverflow.com/a/22442593
tagged with: type-conversion
has answer: http://stackoverflow.com/a/22442613
answer count: 2
tagged with: types
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
tagged with: reflection
upvote count: 2
tagged with: java

http://stackoverflow.com/a/22476183
has body: try to use the upgrade version. The latest version like phonegap 3.4.0 it will work
answers question: http://stackoverflow.com/q/22475637
score: 0
type: Answer

http://stackoverflow.com/comment/34083051
comment on: http://stackoverflow.com/a/22415070
type: Comment
has text: Sorry, I think I've been following a tutorial a bit blindly. Thank you for the help!
score: 0
type: AnswerComment

http://stackoverflow.com/a/32087763
downvote count: 0
score: 1
has body: I had a similar problem where in my code, the following line would throw a null pointer exception: title = titleEditText.getText().toString(); From my understanding, the method 'getText()' does not return null so the problem was in the widget 'titleEditText'. I went back to the line where I find the view and place it in the field as follows: titleEditText = (EditText) findViewById(R.id.Title); Ofcourse both of these two lines of code are totally perfect and a null pointer exception should not be thrown. But in my case it was thrown. After much digging, I found out that I was fetching the wrong view in the 'findViewById()' method. R.id.Title was a TextView and NOT an EditText and so 'titleEditText' was not empty; but was not editable. When I tried to fetch the text, a null pointer exception was thrown. So the problem was not in these lines: title = titleEditText.getText().toString(); titleEditText = (EditText) findViewById(R.id.Title); but in the view fetched. So I just changed the view to an EditText and NPE was no longer thrown!
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22345786

http://stackoverflow.com/q/22465989
type: Question
has answer: http://stackoverflow.com/a/22466089
score: 0
answer count: 2
tagged with: jscrollpane
type: UnansweredQuestion
tagged with: overlap
tagged with: java
has answer: http://stackoverflow.com/a/22466080
has body: I've currently got a JScrollPane in which I am placing panels inside of. For some reason the panels are not being placed side by side, rather they are overlapping on each other in the top left hand corner of the JScrollPane. public class UI extends javax.swing.JFrame { ArrayList&lt;LibraryImagePanel&gt; libPanels; /** * Creates new form UI */ public UI() { initComponents(); this.setResizable(false); scrollpane_library.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrollpane_library.add(new LibraryImagePanel()); libPanels = new ArrayList&lt;&gt;(); } ... } class LibraryImagePanel extends JPanel { /** * CTOR */ LibraryImagePanel(){ this.setSize(256, 256); } /** * * @param g Graphics */ @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawLine(0,0,20,20); repaint(); } }
has title: JScrollPane, overlapping panels inside

http://stackoverflow.com/a/22418911
upvote count: 2
downvote count: 0
type: Answer
has body: Because you haven't initialized your Patient object D inside the main() method. Patient D= null; and invoking a method on it. if(D.getPatientName().equalsIgnoreCase(user)){ // Here D is null found=true; System.out.println(D.toString()); } You have to create an object of Patient and initialized variable D like, Patient D= new Patient();
answers question: http://stackoverflow.com/q/22418887
score: 2

http://stackoverflow.com/comment/34032550
has text: `is failing for me` - expand it
comment on: http://stackoverflow.com/q/22386365
score: 0
type: Comment
type: QuestionComment

ebnf
type: Tag
tags question: http://stackoverflow.com/q/22338962
tag name: ebnf

http://stackoverflow.com/q/22342450
score: 2
downvote count: 0
tagged with: maven
tagged with: spring
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22342723
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/22342562
has answer: http://stackoverflow.com/a/22342723
has answer: http://stackoverflow.com/a/48190422
upvote count: 2
has comment: http://stackoverflow.com/comment/33956799
has title: org.hibernate.MappingException: Unknown entity: java.lang.Integer
has answer: http://stackoverflow.com/a/22342562
has answer: http://stackoverflow.com/a/42583924
has body: I am doing a project on spring MVC with maven.I pass my data using Ajax to the controller.it is ok..but when i call the function for delete,i got org.hibernate.MappingException: Unknown entity: java.lang.Integer . below my codes..waiting for your reply web.xml <?xml version="1.0" encoding="UTF-8"?> AccPerSpring org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/servlet-context.xml 1 AccPerSpring / spring-context.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:mvc="http://www.springframework.org/schema/mvc"xmlns:beans="http://www.springframework.org/schema/beans"xmlns:context="http://www.springframework.org/schema/context"xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> <mvc:annotation-driven /> <context:component-scan base-package="com.gerrytan.pizzashop"/> com.gerrytan.pizzashop hibernate.dialect=org.hibernate.dialect.MySQLDialect <mvc:resources mapping="/resources/**" location="/WEB-INF/resources/" /> <tx:annotation-driven transaction-manager="transactionManager"/> </beans> Accountsconttroller .java package com.gerrytan.pizzashop; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframe…
has comment: http://stackoverflow.com/comment/33956531
answer count: 4
favorite count: 0

http://stackoverflow.com/comment/34060094
score: 0
has text: Show us your source for the Node class.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22402254

http://stackoverflow.com/a/22424562
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22424416
has body: This is the error it is talking about: GradeEntry ge = student.getGrades().get(i); Says can't convert from Student to GradeEntry, so I suspected getGrades was actually returning Students and yes that is the case: public ArrayList&lt;Student&gt; getGrades() { return students; //this part is a problem. } I think you meant to return grades: public ArrayList&lt;Grade&gt; getGrades() { return gr; }
score: 1
answers question: http://stackoverflow.com/q/22424416
type: AcceptedAnswer

http://stackoverflow.com/q/22435359
type: Question
has body: I have my vaading application running on /* Here the configuration: @WebServlet(value = "/*", asyncSupported = true) @VaadinServletConfiguration(productionMode = false, ui = ApplicationUI.class, widgetset = "com.myproject.bo.AppWidgetSet") public static class Servlet extends VaadinServlet { } I want to move vaadin app to /vaadin/* but if I change the config to be @WebServlet(value = "/vaadin/*", asyncSupported = true) I got error Failed to load the bootstrap javascript: ./../VAADIN/vaadinBootstrap.js How can I actually move Vaadin app? Thanks
upvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22604969
tagged with: vaadin7
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22604969
downvote count: 0
score: 1
tagged with: java
has title: change root context of Vaadin 7 application

http://stackoverflow.com/comment/34111835
has text: It is hard to answer without seeing any code...
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22431572

http://stackoverflow.com/q/22364663
has comment: http://stackoverflow.com/comment/33998693
has comment: http://stackoverflow.com/comment/33997276
type: Question
has body: I'm trying to construct QImages from data saved as 16-bit integers in a binary file. I'm able to load the data in fine, but my program fails when I use the QImage::loadFromData(QBytearray ba) function (returning false) as follows: QBytearray frame; QImage pic = QImage(256, 256, QImage::Format_RGB888); for(int i = 0; i &lt; height; i++) { for(int j = 0; j &lt; width; j++) { // Access value of pixel at each location datum = store[i][j]; for(int c = 0; c &lt; 3; c++) { // Calculate colour at given pixel col = (255.0f * ((float)datum - (float)min) / ((float)(max - min))); // Assign colour value to the pixel frame[c+3*j+3*i*width] = ((unsigned char)col); } } } pic.loadFromData(frame); I repurposed this from Java code I had previously written which worked perfectly as intended (from the exact same data): BufferedImage image = = new BufferedImage(256, 256, BufferedImage.TYPE_3BYTE_BGR); byte[] data = image.getRaster().getDataBuffer(); for (j=0; j&lt;height; j++) { for (i=0; i&lt;width; i++) { //Find value of the pixels at the location datum=data[j][i]; for (c=0; c&lt;3; c++) { //Calculate the colour at the given pixel col=(255.0f*((float)datum-(float)min)/((float)(max-min))); //Assign the colour value to the pixel data[c+3*i+3*j*width] = (byte)col; } } } Can anybody help me to see where I'm getting this wrong? I've been stumped for days and am all out of ideas.
answer count: 1
tagged with: qimage
upvote count: 1
has comment: http://stackoverflow.com/comment/33996773
favorite count: 0
tagged with: c++
has comment: http://stackoverflow.com/comment/33996867
has comment: http://stackoverflow.com/comment/33997185
downvote count: 0
accepted answer: http://stackoverflow.com/a/22366697
has comment: http://stackoverflow.com/comment/33997408
has comment: http://stackoverflow.com/comment/33996762
has comment: http://stackoverflow.com/comment/33996339
tagged with: qt
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22366697
score: 1
tagged with: java
has title: Creating a QImage from QBytearray
tagged with: bufferedimage

http://stackoverflow.com/a/22433277
upvote count: 1
has body: From http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html If a primitive type or a string is defined as a constant and the value is known at compile time, the compiler replaces the constant name everywhere in the code with its value. This is called a compile-time constant. If the value of the constant in the outside world changes (for example, if it is legislated that pi actually should be 3.975), you will need to recompile any classes that use this constant to get the current value. Therefore despite the fact of having that variable defined after the static q26, the compiler had replaced each place var1 appeared as 5.
score: 1
answers question: http://stackoverflow.com/q/22433122
downvote count: 0
type: Answer

http://stackoverflow.com/q/22471809
has title: 2D advice for nullpointer exception
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34182831
upvote count: 0
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/34182811
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/34184889
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/34183041
has answer: http://stackoverflow.com/a/22476582
has comment: http://stackoverflow.com/comment/34184236
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34183552
has answer: http://stackoverflow.com/a/22471978
downvote count: 1
has comment: http://stackoverflow.com/comment/34184937
has comment: http://stackoverflow.com/comment/34184139
tagged with: java
score: -1
has body: I apologize in advance, I am a java noob. I have this in a statement if(a==0 &amp;&amp; b&lt;4) { value = ((elev[a][b]-elev[a+1][b])*0.00001* double "variable" ) ; } So my main question is would the following.... (elev[a][b]-elev[a+1][b]) return an int value (assuming that the array was initialized and populated with int values, and that for a==0 and b&lt;4 none of the references are null. Sorry in advance if this is silly. Please don't feel inclined to comment, but help would be appreciated. I haven't done a lot of this java stuff. When i populated the array, I printed it's contents to make sure I was populating correctly, and everything is where it should be... Alas, I get a null pointer error wherever that (elev[a][b] - elev[a+1][b]) is first referenced....yet i know that the values are being put there. Next question. When i populate an array, if i want to reference the values, while(input.hasNextInt()) { elev[i][j] = input.nextInt(); &lt;-- this is how i was doing it } of elev[][]... do i need to say elev[i][j] = new input.nextInt(); or is how i was doing it sufficient. When i populated an ArrayList from a file I had to use the "new" prefix So i was trying to figure out why i would get a null there. Like i said I did print the array after reading it from the file and it printed out everything was in its place. Thanks everyone. EDIT ok sorry for simplicity sake i didn't put in the actual code of "value" it is actually double randKg = getRandKg(avgKgNitrogen[z]); double gradient = 0.00001 double under = ((randKg *(elev[a][b] - elev[a+1][b]) * gradient)); 2nd Edit This is the code for how i populated. try{ File file = new File(filename); Scanner input = new Scanner(file); int rows = 30; int columns = 10; int elev[][] = new int[30][10]; for(int i = 0; i &lt; rows; ++i){ for(int j = 0; j &lt; columns; ++j) { while(input.hasNextInt()) { elev[i][j] = input.nextInt(); } } } input.close(); } catch (java.io.FileNotFoundException e) { System.out.println("Error opening "+fi…

http://stackoverflow.com/comment/34157580
comment on: http://stackoverflow.com/a/22454134
has text: @ErwinBolwidt Thanks for the link, Cheers! BTW, which is your country?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22375251
has answer: http://stackoverflow.com/a/22375893
has comment: http://stackoverflow.com/comment/34013543
favorite count: 0
has body: I have to implement the T9 Dictionary . Essentially, when I am pressing any of the 9 keys, it should show me the top 5 words that can be started with that combination of keys. If I type '46', it can give 'hotel' or 'good' depending on whether I intended 'g' or 'h' when I pressed 4. The priority is based on which words are relatively popular - you can use, say, the first 5000 words from the top 100 000 words. The code I am doing is: Import import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.Date; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; T9Dict class public class T9Dict { private static final Runtime s_runtime = Runtime.getRuntime(); public static void main(String[] args) throws Exception { runGC(); long heap1 = usedMemory(); long start = new Date().getTime(); Trie trie = Trie.getInstance(); System.out.println("Creating Dictionary"); File f = new File("C:\\Users\\hp1\\Desktop\\100kfound.txt"); BufferedReader br = new BufferedReader(new FileReader(f)); String s = br.readLine(); int i = 0; do { i++; trie.add(s); s = br.readLine(); } while (s != null); br.close(); long end = new Date().getTime(); long time = (end - start); System.out.println("Loaded Dictionary with " + i + " words in " + time + " msec"); // runGC(); long heap2 = usedMemory(); // take an "after" heap snapshot: System.out.println("Memory used = " + (heap2 - heap1)); String pattern = "4663"; start = new Date().getTime(); String word = trie.getWord(pattern); end = new Date().getTime(); time = (end - start); System.out.println("Found word : " + word + " in " + time + " msec"); } private static void runGC() throws Exception { // for whatever reason it helps to call Runtime.gc() // using several method calls: for (int r = 0; r &lt; 4; ++r) { _runGC(); } } private static void _runGC() throws Exception { long usedMem1 = usedMemory(); long usedMem2 = Long.MAX_VALUE; for (int i = 0; (usedMem1 &lt; usedMem2) &amp;&…
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/39156040
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22376606
has comment: http://stackoverflow.com/comment/71425051
tagged with: t9
type: Question
has comment: http://stackoverflow.com/comment/40352644
tagged with: hashmap
has title: Implement T9 Dictionary using Trie?
upvote count: 2
tagged with: trie
answer count: 2

http://stackoverflow.com/comment/34176927
has text: Not sure why my question was downgraded?
comment on: http://stackoverflow.com/q/22468027
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34042080
has text: You're welcome. This error is among the most vague ones I encountered with Hibernate. It can be really frustrating. Just keep in mind that persisting unknown types, to Hibernate, can cause this issue.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22391325
type: Comment

liferay
tags question: http://stackoverflow.com/q/22369834
tags question: http://stackoverflow.com/q/22457292
tag name: liferay
type: Tag
tags question: http://stackoverflow.com/q/22470570
tags question: http://stackoverflow.com/q/22403237

http://stackoverflow.com/q/22375038
accepted answer: http://stackoverflow.com/a/22376041
has comment: http://stackoverflow.com/comment/34012880
tagged with: file-upload
tagged with: tomcat
has answer: http://stackoverflow.com/a/22375215
has comment: http://stackoverflow.com/comment/34012805
has answer: http://stackoverflow.com/a/22376041
tagged with: singleton
has body: So my Problem is that I have to create a Singleton pattern counter for numeric name giving. For example "1", "2", "3" etc. The idea is that every time i start the application and the Server(tomcat), it gets the last number and when I upload another image it should continue from there. Lets say the last one was "43", so the the next time I start the application it should know it and put "44" for the next image upload. I'm not that good in Java so please give me some patience :) This is my FileUploadServlet. It handles the request from the fileUploadForm.jsp by taking the file from the submit. package upload; import java.io.IOException; import java.io.InputStream; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; import utils.FormatChecker; import utils.UnzipFile; //Servlet for handling the Upload request from the Index.jsp @MultipartConfig public class FileUploadServlet extends HttpServlet { // Instace of the FileUpload object private FileUploader uploader = new FileUploader(); // Instance of the FormatChecker object private FormatChecker checker = new FormatChecker(); // Instance of the UnzipFile object private UnzipFile unzip = new UnzipFile(); private static final long serialVersionUID = 1L; private static final String SAVE_FOLDER = "C:\\Users\\cuche\\Desktop\\tomcat\\apache-tomcat-7.0.47\\webapps\\files"; /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.sendRedirect("error.jsp"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws Ser…
has comment: http://stackoverflow.com/comment/34013319
type: AnsweredQuestion
has title: How can I set an auto numeric name generator for image uploads, using a singleton pattern counter
tagged with: java
has comment: http://stackoverflow.com/comment/34013998
has comment: http://stackoverflow.com/comment/34013255
type: Question
possible better answer: http://stackoverflow.com/a/22375215
has comment: http://stackoverflow.com/comment/34012889
tagged with: servlets
has comment: http://stackoverflow.com/comment/34013307
score: 0
answer count: 2

http://stackoverflow.com/comment/34030882
comment on: http://stackoverflow.com/q/22381970
has text: @JWiley I'm assuming that both computers in question had a database server on them? That's not the case for me, I want to be able to run the program with no setup needed on the user's part
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34128211
type: Comment
has text: @GaryKlasen An answer has been provided below to accept. Just sayin :P
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22440339

http://stackoverflow.com/a/22472398
answers question: http://stackoverflow.com/q/22471963
has comment: http://stackoverflow.com/comment/34199686
has body: I have two suggestions for you, it's up to you which you prefer. Firstly I would suggest converting the array to a list and removing the necessary elements from the list then converting back to the array. Code follows : List&lt;Double&gt; list = new ArrayList&lt;Double&gt;(Arrays.asList(s1)); list.remove(i1); s1 = list.toArray(new Double[0]); Secondly you can shift the specific element of the array to the back and just iterate one position less than the length. This will require you adding an extra int variable to either record the number of elements in the array or to record the amount of deleted elements, the former being the better idea. Code follows : double temp; for(int i = 0; i &lt; test.length - 1; i++){ temp = s1[i]; s1[i] = s1[i + 1]; s1[i + 1] = temp; } nrE = nrE - 1; This will require you to have an int nrE with value of the length of the array(here 10) before your first for loop. Both of these should be implemented inside the for loop at the end of the iteration. From what I've seen my first suggestion is used most. Note : I may misunderstand what you are trying to achieve, but I believe your code for getting the 3 random elements is faulty. If f1=3 and you take element at the position Math.random() * f1 you will always get an element in the range 0 to 3. To fix this you can instead use Math.random() * s1.length
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34228128
has comment: http://stackoverflow.com/comment/34241041

jpanel
tags question: http://stackoverflow.com/q/22371039
tags question: http://stackoverflow.com/q/22465685
tags question: http://stackoverflow.com/q/22339481
tags question: http://stackoverflow.com/q/22440341
tags question: http://stackoverflow.com/q/22392684
tags question: http://stackoverflow.com/q/22437966
tags question: http://stackoverflow.com/q/22386477
tags question: http://stackoverflow.com/q/22332040
tags question: http://stackoverflow.com/q/22351021
tags question: http://stackoverflow.com/q/22421343
tags question: http://stackoverflow.com/q/22466892
tags question: http://stackoverflow.com/q/22348590
tags question: http://stackoverflow.com/q/22364743
tags question: http://stackoverflow.com/q/22394495
tags question: http://stackoverflow.com/q/22427698
tags question: http://stackoverflow.com/q/22439479
tags question: http://stackoverflow.com/q/22452650
tags question: http://stackoverflow.com/q/22406612
tags question: http://stackoverflow.com/q/22413984
type: Tag
tags question: http://stackoverflow.com/q/22432705
tags question: http://stackoverflow.com/q/22435984
tags question: http://stackoverflow.com/q/22394845
tags question: http://stackoverflow.com/q/22398192
tags question: http://stackoverflow.com/q/22378509
tags question: http://stackoverflow.com/q/22407493
tags question: http://stackoverflow.com/q/22463157
tags question: http://stackoverflow.com/q/22438775
tags question: http://stackoverflow.com/q/22462275
tags question: http://stackoverflow.com/q/22396572
tags question: http://stackoverflow.com/q/22402628
tags question: http://stackoverflow.com/q/22341855
tag name: jpanel
tags question: http://stackoverflow.com/q/22454849
tags question: http://stackoverflow.com/q/22445502
tags question: http://stackoverflow.com/q/22428663
tags question: http://stackoverflow.com/q/22445424
tags question: http://stackoverflow.com/q/22436954
tags question: http://stackoverflow.com/q/22420499

http://stackoverflow.com/comment/34150606
has text: What could be the reason for the "requirement" to have such a public constructor when it simply can not be **used**? (That is, it can not be used by any class that could not equally use the same constructor with "default" visibility)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22453319

http://stackoverflow.com/a/22351484
has body: just write if(element&gt;40.0){ that should do the trick. The enhanced for loop gives you the elements of the list/array and not the index.
score: 6
type: Answer
downvote count: 0
type: AcceptedAnswer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/22351427
answers question: http://stackoverflow.com/q/22351427

http://stackoverflow.com/comment/111361896
has text: Hey i know it has been 3 years since you posted this. But do you have any way to translate this script to python?
comment on: http://stackoverflow.com/a/46452894
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22452137
has comment: http://stackoverflow.com/comment/34314566
score: 2
has comment: http://stackoverflow.com/comment/34165374
tagged with: java
has comment: http://stackoverflow.com/comment/34169243
tagged with: cluster-computing
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/22544965
has comment: http://stackoverflow.com/comment/34299970
tagged with: jboss
has comment: http://stackoverflow.com/comment/34155376
has title: Jboss 7 App servers : Dividing work by type of task
has body: Love to know ways to divide up work between clusters. Meaning send Request page A.b, API function 1 and 2 to cluster 1 (jboss app servers); Function 3 &amp; 4 to cluster 2, etc Main domain would be the same, sub url can be different. One way would be to have ejbs and set beans to be alive on a certain clutser/ set of servers only, what are the other ways? Especially interested in ways that can be changed at run time. So if a few nodes go down or load patterns change, we can re define the clusters.. More detailed: We have 3,000 strings per language and more than 120 broad operations that a user can do. The institutional users can (expected to be 50%) do bulk operations. Plus we have 12 languages to support. Expose a web UI and web service API. Suggested we use clusters of servers for specific languages. This is so less data has to be cached per server and we the code can optimize it self when the JVM is warmed up for particular operations. English is the default language. We are okay with the initial txn (login for API/ first page for UI) come to a set of servers that have all the English and the initial text for other languages (the screen where translations will be entered will have a attribute to denote if it should be loaded as part of the default set. Issue we are facing is how to route requests? We can have JMS queues but how do you route the initial request ? We plan to have about 70 Jboss server instances in the app later for initial release. One node will be able to do a all work if needed to (like if another crashes) but in the best case we would like to only send it work of a couple of languages and task types. We will have a web and app layer, separated by a firewall. Question is : code snippets/ techniques samples to route different languages and request types to different app server clusters. Some simple one are : 1. for the lanuage see some cookie or header or form param 2. for work type - besides a big if statement - is there any data driven better wa…
has comment: http://stackoverflow.com/comment/34165422
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/22336620
has body: There is one option you can use in manifest. Add android:largeHeap="true" in you manifest. But it is available in some higher APIs if I am not wrong it is available in 3.0+. Other things you can do is to never let your app goes out of memory by allocating and deallocating memory with care.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22336310
downvote count: 0

http://stackoverflow.com/a/22378675
has comment: http://stackoverflow.com/comment/34018434
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/34018269
answers question: http://stackoverflow.com/q/22378649
has body: It means this function takes variable number of arguments - its arity is variable. For example, all those are valid invocations (assuming this is bound to AsyncTask's instance): this.doInBackground(); // Yes, you could pass no argument // and it'd be still valid. this.doInBackground(url1); this.doInBackground(url1, url2); this.doInBackground(url1, url2, url3); // ... Inside your method body, urls will be basically an array. One interesting thing about varargs is that you could invoke such method in two ways - either by passing an array of arguments, or by specifing each url as a separate method argument. So, those two are equivalent: this.doInBackground(url1, url2, url3); this.doInBackground(new URL[] {url1, url2, url3}); You can use for loop to go through all of them: protected Long doInBackground(URL... urls) { for (URL url : urls) { // Do something with url } } You can of course define similar method on your own, for instance: public void addPerson (String name, String... friends) { // ... } In this example, your method would accept one mandatory argument (name, you cannot ommit this one) and variable number of friends arguments: this.addPerson(); // INVALID, name not given this.addPerson("John"); // Valid, but no friends given. this.addPerson("John," "Kate"); // Valid, name is John and one friend - Kate Not that this construct is available since Java 5. You can find documentation here.
has comment: http://stackoverflow.com/comment/34018470
type: Answer
score: 4

exception
tags question: http://stackoverflow.com/q/22418278
tags question: http://stackoverflow.com/q/22427228
tags question: http://stackoverflow.com/q/22347943
tags question: http://stackoverflow.com/q/22337085
tags question: http://stackoverflow.com/q/22424107
tags question: http://stackoverflow.com/q/22466555
tags question: http://stackoverflow.com/q/22440498
tags question: http://stackoverflow.com/q/22461192
tags question: http://stackoverflow.com/q/22353203
tags question: http://stackoverflow.com/q/22394326
tags question: http://stackoverflow.com/q/22426017
tags question: http://stackoverflow.com/q/22341694
tags question: http://stackoverflow.com/q/22363795
tags question: http://stackoverflow.com/q/22463465
tags question: http://stackoverflow.com/q/22416769
tags question: http://stackoverflow.com/q/22386715
type: Tag
tags question: http://stackoverflow.com/q/22339052
tags question: http://stackoverflow.com/q/22375515
tags question: http://stackoverflow.com/q/22383507
tags question: http://stackoverflow.com/q/22477167
tags question: http://stackoverflow.com/q/22361957
tags question: http://stackoverflow.com/q/22440339
tags question: http://stackoverflow.com/q/22481939
tags question: http://stackoverflow.com/q/22368041
tags question: http://stackoverflow.com/q/22430731
tags question: http://stackoverflow.com/q/22411713
tags question: http://stackoverflow.com/q/22338496
tags question: http://stackoverflow.com/q/22330203
tags question: http://stackoverflow.com/q/22446388
tags question: http://stackoverflow.com/q/22433035
tags question: http://stackoverflow.com/q/22381789
tags question: http://stackoverflow.com/q/22370167
tags question: http://stackoverflow.com/q/22455662
tags question: http://stackoverflow.com/q/22403058
tags question: http://stackoverflow.com/q/22387619
tag name: exception
tags question: http://stackoverflow.com/q/22378147
tags question: http://stackoverflow.com/q/22454133
tags question: http://stackoverflow.com/q/22367962
tags question: http://stackoverflow.com/q/22343349
tags question: http://stackoverflow.com/q/22394280
tags question: http://stackoverflow.com/q/22470255
tags question: http://stackoverflow.com/q/22413239
tags question: http://stackoverflow.com/q/22398290
tags question: http://stackoverflow.com/q/22464022
tags question: http://stackoverflow.com/q/22467829
tags question: http://stackoverflow.com/q/22458265
tags question: http://stackoverflow.com/q/22345896
tags question: http://stackoverflow.com/q/22395082
tags question: http://stackoverflow.com/q/22330310
tags question: http://stackoverflow.com/q/22354839
tags question: http://stackoverflow.com/q/22467090

http://stackoverflow.com/comment/34104390
type: Comment
has text: Ok .. so now implement that "compare algorithm" in your compartor of two lists
type: AnswerComment
comment on: http://stackoverflow.com/a/22427217
score: 0

http://stackoverflow.com/q/22329955
has comment: http://stackoverflow.com/comment/39130437
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33978575
type: Question
tagged with: dll
has title: Unable to load native library java; specified module not found
has comment: http://stackoverflow.com/comment/33935042
score: 0
has body: I'm trying to run a piece of sample code to connect to a specific DVR. I've got the SDK from the DVR manufacturer. The code tries to call a native library like this: DHNetSDKLib INSTANCE = (DHNetSDKLib)Native.loadLibrary("dhnetsdk", DHNetSDKLib.class); But, no matter where I put the dll file, I always get this error: Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'dhnetsdk': Specified module could not be found. This being a piece of demo code, I feel this should work. The dll files are placed in the root folder as standard. I've tried copying them to the windows dll folders, gave them a folder of their own (C:\dll), adding this folder to the PATH variable, editing project properties to include the various folders to the build path, pointing to it like this: DHNetSDKLib INSTANCE = (DHNetSDKLib)Native.loadLibrary("C:\\dll\\dhnetsdk.dll", DHNetSDKLib.class); But nothing works. I've searched a lot but I have yet to find a solution. Most threads I come across however usually don't have the module bit in the error. Perhaps there is something wrong with the dll? I'm trying to do this in java because I want to build an Android application using this dll, but now I'm wondering if that is even possible. The only search results I find are related to native Android code (I think). This project is being run as a standard application for testing purposes however.
has comment: http://stackoverflow.com/comment/33982462
has comment: http://stackoverflow.com/comment/33978408
type: UnansweredQuestion

http://stackoverflow.com/q/22372399
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Errors while configuring ESAPI
linked to: http://stackoverflow.com/q/7696423
tagged with: security
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34009164
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34114731
has body: I see errors when I run the test code from ESAPI documentation. import org.owasp.esapi.ESAPI; public class EsapiTest { public static void main(String[] args) { System.out.println("ESAPI.accessController found: " + ESAPI.accessController()); } } This is the error I get - Loading ESAPI.properties via file I/O failed. Exception was: java.io.FileNotFoundException Attempting to load ESAPI.properties via the classpath. ESAPI.properties could not be loaded by any means. Fail. Exception was: java.lang.IllegalArgumentException: Failed to load ESAPI.properties as a classloader resource. Exception in thread "main" org.owasp.esapi.errors.ConfigurationException: java.lang.reflect.InvocationTargetException SecurityConfiguration class (org.owasp.esapi.reference.DefaultSecurityConfiguration) CTOR threw exception. at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:129) at org.owasp.esapi.ESAPI.securityConfiguration(ESAPI.java:184) at org.owasp.esapi.ESAPI.accessController(ESAPI.java:85) at tools.EsapiIntegrationTest.main(EsapiIntegrationTest.java:3) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.owasp.esapi.util.ObjFactory.make(ObjFactory.java:86) ... 3 more Caused by: org.owasp.esapi.errors.ConfigurationException: ESAPI.properties could not be loaded by any means. Fail. at org.owasp.esapi.reference.DefaultSecurityConfiguration.loadConfiguration(DefaultSecurityConfiguration.java:439) at org.owasp.esapi.reference.DefaultSecurityConfiguration.&lt;init&gt;(DefaultSecurityConfiguration.java:227) at org.owasp.esapi.reference.DefaultSecurityConfiguration.getInstance(DefaultSecurityConfiguration.java:75) ... 8 more Caused by: java.lang.IllegalArgumentException: Failed to load ESAPI.properti…
has comment: http://stackoverflow.com/comment/34031059
answer count: 0

http://stackoverflow.com/comment/34166294
type: QuestionComment
comment on: http://stackoverflow.com/q/22462358
score: 0
has text: There are many, many problems in your code. One example: `yourChoice.toLowerCase();` <-- strings are immutable, so that statement is a no-op
type: Comment

http://stackoverflow.com/comment/34111816
type: QuestionComment
type: Comment
score: 0
has text: Either use the full source path, or (at the very least) start from the root of your program. If your file is in the root folder, along with the sound, use `root/sound.wav`
comment on: http://stackoverflow.com/q/22430970

http://stackoverflow.com/comment/34205227
score: 0
type: Comment
type: QuestionComment
has text: what do you mean by event. If the html document is rendered in a browser, only javascript can be used to detect events and react.
comment on: http://stackoverflow.com/q/22484901

http://stackoverflow.com/comment/34041849
type: AnswerComment
type: Comment
has text: In case you move a `HashSet` to `TreeSet`, your class must implement `Comparable` interface or provide a custom `Comparator`. Otherwise, since you cannot sort a `HashSet`, just convert it into a `List` and sort it.
score: 1
comment on: http://stackoverflow.com/a/22391384

http://stackoverflow.com/q/22352991
has body: I've got a problem on an older Mac with OS X 10.5.8 "Leopard". Loading a specific java class is failing with Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file and I know that this normaly states that the java classes are compiled for a higher JVM than the one currently installed. However, I compiled the classes for Java 6 using JDK 6 and the Mac got Java 6 installed! This is what java -version says on the Mac: bih37-4:~ bih37$ java -version java version "1.6.0_26" Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-9M3425) Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode) And this is how i compiled the java classes with ant 1.7 on a windows system with JDK 1.6.0_43: &lt;target name="compile" depends="clean"&gt; &lt;javac srcdir="src" destdir="bin" target="1.6" encoding="utf-8"&gt; &lt;classpath refid="classpath.base" /&gt; &lt;/javac&gt; &lt;/target&gt; AFAIK everything should run very smooth, and so it does on Windows 7 and on OS X Mavericks but NOT on OS X 10.5 "Leopard". To be sure I don't forget something: This is a screenshot of the Java settings on the "Leopard" system: Any ideas?
tagged with: ant
has comment: http://stackoverflow.com/comment/33979384
tagged with: osx-leopard
score: 0
has answer: http://stackoverflow.com/a/22355905
tagged with: javac
answer count: 1
tagged with: macos
has title: Java error "Bad version number in .class file" on Mac OS X 10.5
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22355905
has comment: http://stackoverflow.com/comment/33975056
tagged with: java
type: Question

http://stackoverflow.com/a/22381565
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22381153
downvote count: 0
has body: Synchronization in Java is cooperative, not mandatory. What I mean is, you want synchronization to protect your data, but the language only lets you synchronize the blocks of code that manipulate your data. It's your responsibility to make sure that all of the code that can touch your data is synchronized. (That's what some of the other answers mean when they say, "synchronization is code-level, not object-level.) In your example, you wrote a synchronized block of code that manipulates your list. That will prevent two or more threads from entering that block of code at the same time, but it will not generally prevent other threads from concurrently manipulating the list from within other blocks of code even if one thread is in the synchronized block. Also note: The monitor object (the Object on which you synchronized) need not be part of the data that you are trying to protect. You might for example, have two Lists; and you might want to guarantee a certain relationship between the two lists (e.g., both must be the same length). In that case, which List do you synchronized on? The answer may be neither. E.g., private Object lock = new Object(); private List&lt;Foo&gt; fooList = ...; private List&lt;Bar&gt; barList = ...; ... doSomethingFascinating(...) { synchronized(lock) { //Use your shameful imagination here. } }
score: 1

http://stackoverflow.com/a/22468599
downvote count: 0
score: 40
answers question: http://stackoverflow.com/q/22467645
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22467645
upvote count: 40
has body: The reason what you've shown is unsafe is that with this assignment: Class&lt;T&gt; type = typeMap.get(key); T does not need to have anything to do with the Class retrieved from the map. T is always inferred from the surrounding context of the call to get. For example I can do this sequence of calls: // T is inferred from the arguments as String (which is fine) example.put("k", "v"); // T is inferred from the return value target type as Integer Integer i = example.get("k"); Inside the get method, String.class is correctly retrieved from the type map, but an unchecked conversion is made to Class&lt;Integer&gt;. The call to type.cast(...) doesn't throw, because the value retrieved from the data map is a String. An implicit checked cast then actually happens to the return value, casting it to Integer and a ClassCastException is thrown. This strange interaction is due to type erasure. So, when we are storing multiple types in a single data structure, there are a number of ways to approach it, depending on what our needs are. 1. We can forego compilation checks if there is no way to perform them. Storing the Class is pointless for the most part here because, as I showed above, it doesn't perform a useful validation. So we could redesign the map along the following lines: class Example { private final Map&lt;String, Object&gt; m = new HashMap&lt;&gt;(); void put(String k, Object v) { m.put(k, v); } Object getExplicit(String k) { return m.get(k); } @SuppressWarnings("unchecked") &lt;T&gt; T getImplicit(String k) { return (T) m.get(k); } } getExplicit and getImplicit do a similar thing but: String a = (String) example.getExplicit("k"); // the generic version allows an implicit cast to be made // (this is essentially what you're already doing) String b = example.getImplicit("k"); In both cases we're just relying on our own awareness as a programmer to not make mistakes. Suppressing warnings isn't necessarily bad, it's just important to understand what they actually mean and …
type: Answer

http://stackoverflow.com/q/22426089
has comment: http://stackoverflow.com/comment/34101727
has comment: http://stackoverflow.com/comment/34101821
has comment: http://stackoverflow.com/comment/34101793
answer count: 0
type: UnansweredQuestion
has title: Submit a form without Reloading on a JSP
tagged with: java
has comment: http://stackoverflow.com/comment/34101923
has body: Is it possible to make JSP page that updates without reloading I have search this for a little while now and all of them directs to using AJAX or JQuery... But I need to use JSP is it possible?
type: Question
tagged with: jsp
has comment: http://stackoverflow.com/comment/34173301
score: 0
has comment: http://stackoverflow.com/comment/34103158

http://stackoverflow.com/comment/34153934
has text: Tried. Still same error.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22455154
type: QuestionComment

http://stackoverflow.com/q/22476559
has title: Wiring a Java file to save the Links from a HTML page bu inputting a URl into a dialogue box
has body: This is my code snippet import java.io.*; import java.net.*; import java.util.*; import java.net.URL; import java.util.Scanner; import javax.swing.JOptionPane; public class UrlReader { public static void main(String[] args) throws IOException { String name = JOptionPane.showInputDialog("Enter a URL"); String address = "http://"; URL chula = new URL(address+name); URLConnection yc = chula.openConnection(); //BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream())); Scanner in = new Scanner(new InputStreamReader(yc.getInputStream())); PrintWriter output = new PrintWriter("MynewFile.txt"); while (in.hasNext()) { String inputLine = in.nextLine(); output.println(inputLine); String line = in.next(); if (line.contains("href=\"http://")) { int from = line.indexOf("\""); int to = line.lastIndexOf("\""); System.out.println(line.substring(from + 1, to)); } in.close(); output.close(); } }} For some reason its not saving to the file Mynewfile.txt Does anyone know the reason behind this? I'm new to Java and still learning so i get a bit confused. Also does anyone know how to just save the links in the URL inserted to the file and not the entirety of the HTML code. All help is greatly appreciated and thank you in advance
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/22476845
type: Question
score: 0
answer count: 2
tagged with: url
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/22476995

http://stackoverflow.com/comment/34118035
type: AnswerComment
has text: GroupLayout has been created explicitely for Matisse, which is the wysiwyg GUI designer in Eclipse, which generates the layout code for you. It indeed sucks (IMHO) when you create the code by yourself. If you're looking for an all-purpose layout manager, I would consider MIGLayout or JGoodies layouts (not part of the JDK). But using the layout managers of the JDK and composing complex panels from smaller ones using an appropriate layout manager is perfectly doable.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22434978

http://stackoverflow.com/q/22357644
tagged with: java
has body: I have been contemplating on building a test jar for a community of developers in order to expose a preview of a next release of an API (having stubs returning expected response with exact format etc). We do have both REST and SOAP API. I guess it won't be any problem building the REST Service as the net is flooded with example. It was quite surprising there isn't much of concrete example of how to build SOAP service (JAXWS) with spring boot with embedded jetty. What I expect to achieve is one single jar with both APIs. I am rather comfortable developing a java first services. I have seen a post in stackoverflow but it doesn't clearly outline steps to achieve that. I know it's possible because dropwizard guys have similar project. I will be grateful if there is any resource with example on how to handle SOAP web services in spring boot. Thanks you in advance
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has title: how to build a spring boot jar exposing both rest and soap service
tagged with: soap
linked to: http://stackoverflow.com/q/21115205
tagged with: spring
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/22359925
tagged with: web-services
type: AnsweredQuestion
tagged with: spring-boot
accepted answer: http://stackoverflow.com/a/22359925

http://stackoverflow.com/q/22355927
answer count: 6
has answer: http://stackoverflow.com/a/22356038
has answer: http://stackoverflow.com/a/22356000
favorite count: 0
score: 5
has title: Binary, hex, decimal comparison
upvote count: 6
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22356049
has body: I was playing a bit with numbers, and something interesting came upon me, which I don't quite understand. public static void main(String[] args) { int hexNumber = 0x7A;//decimal: 122 binary:0111 1010 int decNumber = 122; int binNumber = 1111010; System.out.println(hexNumber);//122 System.out.println(Integer.toString(hexNumber, 16)); //7a System.out.println(Integer.toHexString(hexNumber)); //7a System.out.println(Integer.toString(hexNumber, 2)); // 1111010 System.out.println(Integer.toBinaryString(hexNumber)); //1111010 System.out.println(hexNumber==binNumber);//false System.out.println(hexNumber==decNumber);//true System.out.println(decNumber==binNumber);//false } Why do I get "false" at #1 and #3? Doesn't change even if binNumber = 01111010;
possible better answer: http://stackoverflow.com/a/22356020
has answer: http://stackoverflow.com/a/22356020
downvote count: 1
has answer: http://stackoverflow.com/a/22355996
type: Question
accepted answer: http://stackoverflow.com/a/22355996
has answer: http://stackoverflow.com/a/22356341

http://stackoverflow.com/comment/34182619
score: 0
comment on: http://stackoverflow.com/q/22414768
type: QuestionComment
type: Comment
has text: Its not in a package. It is in the top level of my project as follows: PizzaProjectWeb

http://stackoverflow.com/q/22461560
has body: I am trying to access this url for my autocomplete in the search box.. http://localhost:8080/api/v1/catalog/search/products?q=sauce But, I am getting the following error.. It seems here that the @Resource(name = "blExploitProtectionService") protected ExploitProtectionService exploitProtectionService; exploitProtectionService is null And here is the error.. HTTP ERROR 500 Problem accessing /api/v1/catalog/search/products. Reason: Server Error Caused by: java.lang.NullPointerException at org.broadleafcommerce.core.web.api.endpoint.catalog.CatalogEndpoint.findProductsByQuery(CatalogEndpoint.java:190) at com.mycompany.api.endpoint.catalog.CatalogEndpoint.findProductsByQuery(CatalogEndpoint.java:75) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) My web.xml is as follows RESTApiServlet com.sun.jersey.spi.spring.container.servlet.SpringServlet com.sun.jersey.config.property.packages com.mycompany.api.endpoint RESTApiServlet /api/v1/* Next, my applicationContext.xml is <context:component-scan base-package="org.broadleafcommerce.core.web.api"/> and applicationContext-security.xml is <sec:http pattern="/api/**" create-session="stateless"> <sec:http-basic /> <sec:custom-filter ref="blRestCustomerStateFilter" after="REMEMBER_ME_FILTER"/> </sec:http> <bean id="blRestCustomerStateFilter" class="org.broadleafcommerce.profile.web.core.security.RestApiCustomerStateFilter"/> How to solve this problem? How do I make the exploitProtectionService variable not null. How can it be initialized? Thanks in advance.
favorite count: 0
tagged with: rest
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16981467
has comment: http://stackoverflow.com/comment/34180126
score: 2
upvote count: 2
tagged with: java
tagged with: broadleaf-commerce
type: Question
has title: Rest API - NullPointerException in Broadleaf Commerce
has answer: http://stackoverflow.com/a/32985277
has comment: http://stackoverflow.com/comment/34166239
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34111732
comment on: http://stackoverflow.com/a/22429646
type: AnswerComment
score: 0
type: Comment
has text: @EJP I guess you were the one who downvoted: If `Thread1` calls a synchronized method which works on a shared object and the process takes forever then `Thread2`'s call will lead to a deadlock since it can't do its work on it. Excerpt from wikipedia: "Mutual Exclusion: At least one resource must be held in a non-sharable mode.[1] Only one process can use the resource at any given instant of time."

http://stackoverflow.com/comment/34059447
type: Comment
has text: This will work for the first presentation but what about the others ;) Also this is practically a copy of OP's own code.
type: AnswerComment
comment on: http://stackoverflow.com/a/22402147
score: 0

http://stackoverflow.com/comment/34204812
score: 0
type: Comment
type: QuestionComment
has text: ```Please can anybody convert it into NSOUP``` NO. Read the rules http://stackoverflow.com/tour
comment on: http://stackoverflow.com/q/22484510

http://stackoverflow.com/a/22557225
has body: As sqoop options method is deprecated, you can use following code: public static void importToHive() throws Exception{ Configuration config = new Configuration(); config.addResource(new Path("/usr/local/hadoop/conf/core-site.xml")); config.addResource(new Path("/usr/local/hadoop/conf/hdfs-site.xml")); String[] cmd ={"import", "--connect",&lt;connectionString&gt;,"--username", userName, "--password", password,"--hadoop-home", "/usr/local/hadoop","--table",&lt;tableName&gt;, "--hive-import","--create-hive-table", "--hive-table",&lt;tableName&gt;,"-target-dir", "hdfs://localhost:54310/user/hive/warehouse","-m", "1","--delete-target-dir"}; Sqoop.runTool(cmd,config); } Please use the proper hadoop and hive warehouse path, username, password for mysql. Please check your port from core-site.xml (in my case it is 54310)
has comment: http://stackoverflow.com/comment/38737672
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22487688

http://stackoverflow.com/q/22329558
tagged with: jsp
has body: I am trying to get a view.jsp file to display another .jsp file as a popup however I keep getting resource not found errors. Both files reside in the same directory in an Eclipse workspace. I was told that I need to use the files render path. I'm not sure how to find/create a render path for a file. The code activating the popup looks like this: &lt;a href="popupex.jsp" onclick="return popitup('RenderPathGoesHere.jsp')"&gt; &lt;input type="submit" value="Single Issue Upload" name="SingleIssueUpload"&gt;&lt;br&gt; &lt;/a&gt; I'm kinda new to portlet development so any advice would be appreciated. Thanks!
type: UnansweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22373252
type: Question
has title: finding render path for file in eclipse workspace
tagged with: eclipse
tagged with: portlet
answer count: 1

http://stackoverflow.com/q/22436018
type: Question
score: 5
downvote count: 0
tagged with: javascript
tagged with: jquery
has comment: http://stackoverflow.com/comment/34126213
tagged with: ajax
has comment: http://stackoverflow.com/comment/34119636
has answer: http://stackoverflow.com/a/23146523
answer count: 1
has comment: http://stackoverflow.com/comment/34122016
favorite count: 0
has comment: http://stackoverflow.com/comment/34148019
has body: I have a web application with HTML and JQuery, in which it has a login form. When I click the submit button I am using ajax to send the data using Post request to a web service. The web service is built with Java. Here is my html form: The below is my Ajax code to post to my web service $("#mdxLogin").submit(function(e) { e.preventDefault(); var mdxEmail = $("input[name=\"mdxEmail\"]").val(); var mdxPassword = $("input[name=\"mdxPassword\"]").val(); $.ajax({ type: "POST", url:"http://localhost:8080/RestService/rest/loginService/login", dataType:"json", data: $("#mdxLogin").serialize(), success: function(data, textStatus, jqXHR) { // handle your successful response here alert(data); }, error: function(xhr, ajaxOptions, thrownError) { // handle your fail response here alert("Error"); } }); }) And the below is the method in my web service @POST @Path("/login") @Produces(MediaType.TEXT_PLAIN) public String login(@FormParam("mdxEmail") String mdxEmail, @FormParam("mdxPassword") String mdxPassword) { System.out.println(mdxEmail); DBStudent s = new DBStudent(); String url = null; if (s.checkLogin(mdxEmail, mdxPassword)) { url = s.getCalendar(mdxEmail, mdxPassword); } return url; } So far what I managed to do is to post the data to my web service but didn't get any response. My question is how can I access the returned url from my web service with Ajax?
linked to: http://stackoverflow.com/q/3102819
has title: How to return a value in ajax from a Java Rest Web service?
type: UnansweredQuestion
tagged with: web-services
has comment: http://stackoverflow.com/comment/34125832
has comment: http://stackoverflow.com/comment/34122187
has comment: http://stackoverflow.com/comment/34120982
linked to: http://stackoverflow.com/q/17088609
has comment: http://stackoverflow.com/comment/34131826
has comment: http://stackoverflow.com/comment/34158676
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/34120207
has comment: http://stackoverflow.com/comment/34148157

http://stackoverflow.com/comment/33958183
type: Comment
comment on: http://stackoverflow.com/a/22342890
has text: When I generate .jar file, it seems the resources folder is not there. How do I include the resources folder in the .jar file? May I ask how to made a path directly to "text.txt" just in case I didn't do it right? I use Eclipse. Thank you.
score: 0
type: AnswerComment

authorization
tags question: http://stackoverflow.com/q/22478509
tags question: http://stackoverflow.com/q/22403089
tag name: authorization
type: Tag

http://stackoverflow.com/q/22361505
accepted answer: http://stackoverflow.com/a/22379741
has comment: http://stackoverflow.com/comment/33989882
has answer: http://stackoverflow.com/a/22361659
has body: I'm trying ask if a field exist inside a document inside another document in an mongodb database using java driver. The field that I asking for is idMovie. For example, I expect that it print in the console "idMovie value already exist" if idMovie is 2, for example. Or print "not exist" if idMovie is 10, because 10 are not in the document this is my bson object: { "_id" : { "$oid" : "5320aa3c3e468eaeb52dccdc"}, "document" : "movies" , "rateMovies" : [ { "idMovie" : 2 , "average" : "0" , "sum" : "0" , "total" : "0" } , { "idMovie" : 3 , "average" : "0" , "sum" : "0" , "total" : "0" }] } And this is my java code: MongoClient mongo = new MongoClient ("localhost", 27017); DB db = mongo.getDB("DBHC2"); DBCollection movieDocument = db.getCollection("rateMovies"); BasicDBObject searchQuery = new BasicDBObject(); searchQuery.put("idMovie", idMovie); DBCursor cursor = movieDocument.find(searchQuery); /* if is true, the idMovie value already exist in database. */ if(cursor.hasNext()){ System.out.println("idMovie value already exist"); } else{ System.out.println("not exist"); } , but don't works for my. Any help is good received, thank you!!
tagged with: nosql
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33990814
has comment: http://stackoverflow.com/comment/33990678
tagged with: java
possible better answer: http://stackoverflow.com/a/22361659
has answer: http://stackoverflow.com/a/22379741
has comment: http://stackoverflow.com/comment/33991055
has title: looking for a field inside a mongodb document
type: Question
tagged with: mongodb
answer count: 2
tagged with: mongodb-java
score: 0
has comment: http://stackoverflow.com/comment/33990946
has comment: http://stackoverflow.com/comment/33990028

http://stackoverflow.com/comment/34069810
type: Comment
comment on: http://stackoverflow.com/a/22407713
type: AnswerComment
has text: I added some code. If it does not make any sense to you, you should also study HTML and Javascript, besides JSP :)
score: 0

http://stackoverflow.com/q/22368561
downvote count: 0
favorite count: 0
tagged with: logic
tagged with: time
tagged with: android
has answer: http://stackoverflow.com/a/22368769
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22368771
possible better answer: http://stackoverflow.com/a/22368769
upvote count: 3
tagged with: java
type: Question
score: 3
tagged with: libgdx
has body: In LibGdx, is there a way to pause the delta time when user pause the screen/left apps temporary (such an incoming call)? Take for example, when displaying message is going to take 10 secs for user to read the message, normally, I would get the message displayed start time, do the calculation in render() to get the elapsed time (currentTime - MessageStartedTime), if elapsed time > 10secs, then close message, everything works correctly, right. Imaging this scenario, user is reading the message (let assume elapse time is 2 secs), an incoming call that took 20 secs, when the process is brought back to my apps, the elapsed time > 10 secs, and therefore the message will be removed even though the message is only displayed for 2 secs. so, my question is, is there a master time counter that I can implement in my application for this kind of purposes? and what is the best way to implement it?
has title: LibGDX stop time counter on pause
answer count: 2
has answer: http://stackoverflow.com/a/22368771

http://stackoverflow.com/comment/83412351
type: Comment
has text: use a real break
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22344517

http://stackoverflow.com/q/22375515
answer count: 1
tagged with: divide-by-zero
downvote count: 0
has answer: http://stackoverflow.com/a/22375572
favorite count: 0
accepted answer: http://stackoverflow.com/a/22375572
linked to: http://stackoverflow.com/q/4980360
has comment: http://stackoverflow.com/comment/34013330
tagged with: exception
has body: Please check below codes ... // this will produce java.lang.ArithmeticException: / by zero System.out.println(1 / 0); // this will produce Infinity result System.out.println(1.1 / 0); I assume Integer arithmetic will always throws java.lang.ArithmeticException: / by zero. If so , I guess the first statement or System.out.println(Integer.parseInt("1") / 0); should produce compile-time exception. But I didn't get any compile time errors or warnnings on my Eclipse IDE. Or may be I am wrong. Any suggestions ?
type: AnsweredQuestion
has title: Why doesn't compile-time exception division by zero produce at Eclipse IDE?
type: Question
has comment: http://stackoverflow.com/comment/34013356
score: 1
tagged with: java
tagged with: eclipse
upvote count: 1

qt-jambi
tags question: http://stackoverflow.com/q/22354395
type: Tag
tag name: qt-jambi
tags question: http://stackoverflow.com/q/22433135

http://stackoverflow.com/q/22354564
tagged with: java
has comment: http://stackoverflow.com/comment/33978537
has comment: http://stackoverflow.com/comment/33978837
has title: Android: How to pass Serializable object from one activity to another?
type: Question
tagged with: object
score: 0
linked to: http://stackoverflow.com/q/2736389
tagged with: serialization
has comment: http://stackoverflow.com/comment/33978728
type: UnansweredQuestion
tagged with: android
has body: OK so I am passing a Serializable object from one activity to another like this: Intent i = new Intent(GetVariants.this, RoadDetails.class); i.putExtra("Variant", (Serializable)trips[0]); and I receive the object on the other activity like this: trip1 = (HashMap&lt;String, Object&gt;) intent.getSerializableExtra("Variant"); variant1 = new Variant(); variant1.Read(trip1); So far so good things are working great but how can I send variant1 to another activity and how to receive it?
has comment: http://stackoverflow.com/comment/33978681
answer count: 0

http://stackoverflow.com/q/22446947
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/34139823
type: AnsweredQuestion
tagged with: java
has body: Say I have an object named apple Apple apple = new Apple(); And I have a class named AppleHolder that looks like this: class AppleHolder{ private Apple apple; public AppleHolder(Apple apple){ this.apple = apple; } } An Apple instance cannot have more than 1 AppleHolder. But, of course, when I do this: AppleHolder appleHolder1 = new AppleHolder(apple); AppleHolder appleHolder2 = new AppleHolder(apple); This will make it seem as though apple has two holders when it can only have 1. Is there a design pattern to make the second instantiation above return appleHolder1 instead? Thanks.
accepted answer: http://stackoverflow.com/a/22447085
type: Question
answer count: 2
has title: How to enforce one-to-one object reference when instantiating?
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34139803
possible better answer: http://stackoverflow.com/a/22447075
has comment: http://stackoverflow.com/comment/34139768
has answer: http://stackoverflow.com/a/22447085
has answer: http://stackoverflow.com/a/22447075
score: 1
upvote count: 1

http://stackoverflow.com/q/22431831
has title: MySQL Select values in table depending on another table
downvote count: 1
has body: I have a table 'Staff' with details of all Staff. 'StaffID' included. Then I have a table 'StaffRole' which has 'StaffID' and 'RoleID' I want to do something like this: Select * From Staff Where RoleID=1; But I'm not sure if I can do this as RoleID is not in the Staff table. Anyone know the correct syntax? Any feedback is appreciated.
has answer: http://stackoverflow.com/a/22431870
type: Question
possible better answer: http://stackoverflow.com/a/22431870
has answer: http://stackoverflow.com/a/22431863
score: 0
answer count: 2
tagged with: sql
has comment: http://stackoverflow.com/comment/34112296
favorite count: 0
accepted answer: http://stackoverflow.com/a/22431863
linked to: http://stackoverflow.com/q/12475850
type: AnsweredQuestion
tagged with: java
tagged with: mysql
upvote count: 1

http://stackoverflow.com/comment/33940823
type: Comment
score: 0
type: AnswerComment
has text: numbers input would be 0 to 15
comment on: http://stackoverflow.com/a/22329294

http://stackoverflow.com/comment/33969378
type: QuestionComment
has text: Finally, i don't think you need streaming, see my answer.
comment on: http://stackoverflow.com/q/22348988
score: 0
type: Comment

http://stackoverflow.com/comment/34012521
score: 0
comment on: http://stackoverflow.com/a/22374051
type: AnswerComment
type: Comment
has text: Look at `contains` above. It will call `HashMap#getEntry`, which will look it up in `table`.

http://stackoverflow.com/comment/34046272
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22393945
type: AnswerComment
has text: @user3417938: `"this does not work"` tells us little that helps us understand your problem. Assigning a viable StringBuilder object will surely cure you of your primary problem -- your NPE. If you're now seeing another problem, you'd best tell it to us in detail as an edit to your question. Details **are** very important.

http://stackoverflow.com/a/22331915
type: Answer
has body: Actually springMVC is using Front Controller design pattern to remove the code duplicasy problem. So according to the front controller design pattern we need not have to write more than one servlet that is DispatcherServlet. But i will tell you that every request is going through DispatcherServlet only.
score: 0
answers question: http://stackoverflow.com/q/22331474

http://stackoverflow.com/q/22481357
has body: Trying to use Spring 4 WebSocket with STOMP over socket using sockjs. And i faced a problem. My configuration: websocket.xml - part of spring context &lt;websocket:message-broker application-destination-prefix="/app"&gt; &lt;websocket:stomp-endpoint path="/ws"&gt; &lt;websocket:sockjs/&gt; &lt;/websocket:stomp-endpoint&gt; &lt;websocket:simple-broker prefix="/topic"/&gt; &lt;/websocket:message-broker&gt; Controller code: @MessageMapping("/ws") @SendTo("/topic/ws") public AjaxResponse hello() throws Exception { AjaxResponse ajaxResponse = new AjaxResponse(); ajaxResponse.setSuccess(true); ajaxResponse.addSuccessMessage("WEB SOCKET!!! HELL YEAH!"); return ajaxResponse; } Client side: var socket = new SockJS("&lt;c:url value='/ws'/&gt;"); var stompClient = Stomp.over(socket); stompClient.connect({}, function(frame) { alert('Connected: ' + frame); stompClient.send("/app/ws", {}, {}); stompClient.subscribe('/topic/ws', function(response){ alert(response.success); }); }); Output: Opening Web Socket... stomp.js:130 GET http://localhost:8080/ws/info 404 (Not Found) sockjs-0.3.js:807 Whoops! Lost connection to undefined stomp.js:130 What i do wrong? I've found examples in google (TickerStocks or something like that, greeting applications (example of Spring)) and all of them give me the same error. I trying use WebSocket with handshake (without sockjs) - same result). ADDITION INFORMATION: Method public AjaxResponse hello(); placed in IndexController on root context "/". So i can provide full path: http://localhost:8080/ws. To deploy tested tomcat7 and tomcat8.
answer count: 4
has comment: http://stackoverflow.com/comment/34199089
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23086059
tagged with: java
tagged with: sockjs
upvote count: 7
has comment: http://stackoverflow.com/comment/34258254
downvote count: 1
has title: Stomp over socket using sockjs can't connect with Spring 4 WebSocket
type: Question
has answer: http://stackoverflow.com/a/23159923
tagged with: stomp
tagged with: spring-websocket
accepted answer: http://stackoverflow.com/a/23159923
has answer: http://stackoverflow.com/a/38386358
linked to: http://stackoverflow.com/q/21883033
has answer: http://stackoverflow.com/a/58161562
favorite count: 0
has comment: http://stackoverflow.com/comment/34198647
has comment: http://stackoverflow.com/comment/34199163
score: 6
possible better answer: http://stackoverflow.com/a/23086059

http://stackoverflow.com/comment/34145563
score: 0
has text: What are Task, TaskFactory and Operation?
comment on: http://stackoverflow.com/q/22450125
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34048487
comment on: http://stackoverflow.com/q/22395311
type: Comment
type: QuestionComment
score: 1
has text: I've always heard "accessor" being used as synonymous with "getter": a function that basically just returns a value, possibly with some state checking first. But that concept is orthogonal to purity, so I'm not quite sure what you mean by the question. You're assuming a property on a subset of functions ("pure functions must have a return type"), then stating another property on an altogether different subset of functions, and then asking which is correct. There's nothing stopping both from being correct (other than that I've never heard of that definition of accessor).

http://stackoverflow.com/q/22339329
tagged with: java
has body: I am continuously getting the following error when using Plot3DPanel Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at org.math.plot.render.Projection.screenProjection(Unknown Source) at org.math.plot.render.AWTDrawer.drawLine(Unknown Source) at org.math.plot.plotObjects.Line.plot(Unknown Source) at org.math.plot.plotObjects.Axis.plot(Unknown Source) at org.math.plot.plotObjects.BasePlot.plot(Unknown Source) at org.math.plot.canvas.PlotCanvas.paint(Unknown Source) at javax.swing.JComponent.paintToOffscreen(Unknown Source) at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) at javax.swing.RepaintManager.paint(Unknown Source) at javax.swing.JComponent._paintImmediately(Unknown Source) at javax.swing.JComponent.paintImmediately(Unknown Source) at javax.swing.RepaintManager$3.run(Unknown Source) at javax.swing.RepaintManager$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source) at javax.swing.RepaintManager.access$1000(Unknown Source) at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(…
has comment: http://stackoverflow.com/comment/33952930
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/57734239
has comment: http://stackoverflow.com/comment/33951207
has comment: http://stackoverflow.com/comment/33951735
downvote count: 0
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/33952205
has comment: http://stackoverflow.com/comment/33952707
has title: Getting Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException in Plot3DPanel
has answer: http://stackoverflow.com/a/23748625
type: UnansweredQuestion
upvote count: 1
tagged with: swing
tagged with: plot
score: 1

http://stackoverflow.com/comment/34201242
score: 0
has text: Now I am able to mock the class "B" using JMockit without changing of legacy code and trying to do the same with Mockito. If it doesnot work for any reason, I would prefer having a mock class in jar file with same package as you suggested.
type: AnswerComment
comment on: http://stackoverflow.com/a/22457074
type: Comment

http://stackoverflow.com/q/22483728
has title: How to include plain files and folders into Eclipse product/plugin?
tagged with: eclipse-plugin
type: UnansweredQuestion
tagged with: deployment
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/22514343
has comment: http://stackoverflow.com/comment/34203860
has body: I have a plugin, which is using some plain text and binary files when running. This is because plugin is using some third-party code, which works as in conventional application, i.e. taking data from within application directory. When I was running plugin from within Eclipse, these data was just laying inside project directory in some folders. To access this data I was using code like public static final String CorePropertiesPath = "conf/core.xml"; public static URL CorePropertiesURL; //... Bundle bundle = Platform.getBundle(ID); CorePropertiesURL = bundle.getEntry(CorePropertiesPath); try { CorePropertiesURL = FileLocator.resolve(CorePropertiesURL); } catch (IOException e) { e.printStackTrace(); } I.e. to access data from file in "core/core.xml" in my project's directory, I was first converting it with getEntry() method and then with resolve() method. This was working. But when started to create products, I found that my files like "core/core.xml" just absent in target directory. Probably they should reside in my bundle jar, but they are not there. How to force them to come in prescribed place?
tagged with: eclipse-rcp
score: 0
answer count: 1

http://stackoverflow.com/comment/34016106
type: Comment
comment on: http://stackoverflow.com/a/22348415
score: 0
has text: Ok you are right I do deserve that was a rookie mistake. I was not able to write much i.e. which variable i used, as I was limited to characters inside the comment box. Dw I understand variables must reference. I was not diligent enough. The code has been very helpful. The reason why I was considering an 'IF' statement, as I would like to change the x and y diameter during any increase/decrease of 'int free' every four seconds. This is what I cannot find how to change diameter of ellipse by live updated integers.
type: AnswerComment

http://stackoverflow.com/q/22403588
has body: I have a httpClientBuilder instance, I would like to set CoreProtocolPNames.PROTOCOL_VERSION to HttpVersion.HTTP_1_1. How should i set it with httpClientBuilder? I have tried this: HttpClient client = HttpClientBuilder.create().build(); client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1) But this didn't seems to work. Any help!
tagged with: http
downvote count: 1
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22443142
answer count: 1
favorite count: 0
tagged with: groovy
has title: Setting httpVersion with httpClientBuilder
has comment: http://stackoverflow.com/comment/34062084
has comment: http://stackoverflow.com/comment/34101772
has comment: http://stackoverflow.com/comment/34065148
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/22462800
has comment: http://stackoverflow.com/comment/34167379
has answer: http://stackoverflow.com/a/22462947
has body: Whats the difference between this : String [] columns = new String []{KEY_ROWID, KEY_TITLE, KEY_DESC, KEY_TIME}; And This : String [] columns={KEY_ROWID, KEY_TITLE, KEY_DESC, KEY_TIME};
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/22462963
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22462827
has title: difference in declaring your string array
tagged with: string
accepted answer: http://stackoverflow.com/a/22462963
possible better answer: http://stackoverflow.com/a/22462827
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22484831
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22475621
has comment: http://stackoverflow.com/comment/34260611
has body: Only set isDrag = true; if you are a certain distance from your tempx and tempy.
type: Answer
has comment: http://stackoverflow.com/comment/34220587
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22475621

http://stackoverflow.com/q/22416326
score: 0
answer count: 1
tagged with: rest
has answer: http://stackoverflow.com/a/22418266
tagged with: gateway
tagged with: ftp
has body: I have a little problem when I try to download a file with rest. Here is my function : @GET @Produces(MediaType.APPLICATION_OCTET_STREAM) @Path("{directory: (([^/]+[/])+)[^/]+}") public Response getFile(@PathParam("directory") String directory) { Response responseFile = null; try { /*String tmpFileName = "REST_FTP_TMPFile_"+ Math.random(); tmpFileName = tmpFileName.replace(".", ""); File tmpFile = new File(tmpFileName); tmpFile.createNewFile(); //*/ String filename = directory.substring(directory.lastIndexOf("/")+1, directory.length()); File tmpFile = File.createTempFile("REST_FTP_TMPFile_", null); directory = StringEscapeUtils.unescapeHtml4(directory); this.client.getFile(directory, tmpFile); System.out.println("size : " + tmpFile.length()); responseFile = Response.ok(tmpFile, MediaType.APPLICATION_OCTET_STREAM) .header("Content-length", tmpFile.length()) .header("Content-Disposition","attachment; filename="+filename+"") .build(); //A voir quand on peut le supprimer... //tmpFile.delete(); } catch (IOException ex) { Logger.getLogger(GetResource.class.getName()).log(Level.SEVERE, null, ex); } return responseFile; } The function getFile of client use the libapache method : public boolean getFile(String pathname, File file) throws IOException { OutputStream output; output = new FileOutputStream(file); System.out.println("Wanted pathname : "+pathname); boolean status = this.client.retrieveFile("/"+pathname, output); if(status) { output.close(); return status; } else { output.close(); throw new IOException("Cannot retrieve the file : " + pathname); } } When I try to download my web browser says that the download is canceled : I really don't know what I did wrong and nothing on the web helped me out so far (it's been 2 hours..)
type: Question
type: AnsweredQuestion
has title: File transfer is canceled during REST download
accepted answer: http://stackoverflow.com/a/22418266
tagged with: java

http://stackoverflow.com/a/22448236
answers question: http://stackoverflow.com/q/22447989
has body: Assuming that the small description always ends with a colon and that there are no other colons in the string within the items, you could maybe use something like this: The category:\\s*[^:]*:\\s*([^:]*)\\s+The next category: regex101 demo [^:]* matches any character except colons. \\s+ is for newlines. The rest of the regex is pretty literal otherwise.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34142055
score: 1
accepted answer of: http://stackoverflow.com/q/22447989
has comment: http://stackoverflow.com/comment/34142363
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34141957
has comment: http://stackoverflow.com/comment/34142206
downvote count: 0
has comment: http://stackoverflow.com/comment/34142379
has comment: http://stackoverflow.com/comment/34141927

http://stackoverflow.com/a/22484274
type: Answer
upvote count: 6
score: 6
has comment: http://stackoverflow.com/comment/34210616
downvote count: 0
answers question: http://stackoverflow.com/q/22484026
has comment: http://stackoverflow.com/comment/34204363
has body: Unfortunately, the pom.xml cannot tell you everything about how a plugin's goals are bound. A plugin can define a default lifecycle phase to bind to and this will not be reflected in the pom.xml. Looking at the documentation for the jaxws-maven-plugin I see this line for the wsimport goal: Binds by default to the lifecycle phase: generate-sources. You can override the lifecycle phase to bind to by adding a element to the plugin's <execution>. For example, if you wanted the goal to run right before packing the artifact (not sure why you would, but bear with me for this example) you could specify package after the execution <id> I would recommend taking a look at the official Maven guide to configuring plugins for more details. Also you would want to read: The phases's order in standard lifecycles The phases's bindings for lifecycle and packaging types

http://stackoverflow.com/a/24944221
score: 0
has body: I've seen this error when entering negative values into cvSize. Make sure the template you are using is not bigger than the source image you are trying to match. This could be the case if you created your template using something like ms paint. I suggest you use a more suitable image editor like gimp.
answers question: http://stackoverflow.com/q/22483441
type: Answer

http://stackoverflow.com/a/53536389
type: Answer
score: 21
upvote count: 21
has comment: http://stackoverflow.com/comment/122745833
answers question: http://stackoverflow.com/q/22381202
downvote count: 0
has comment: http://stackoverflow.com/comment/107978101
has comment: http://stackoverflow.com/comment/127822976
has body: Running the jar from command line by: C:\folder\where\jar\stored&gt;java -jar JarName.jar I got information which made the problem clearer: main/Main has been compiled by a more recent version of the Java Runtime In this case, the jar was compiled with a version newer than jre supports.
has comment: http://stackoverflow.com/comment/107984356

http://stackoverflow.com/a/22446936
type: Answer
answers question: http://stackoverflow.com/q/22446645
has body: As per my knowledge its a Bytecode Analysis Framework. Definitely Analysis is a class. You can find few code sample here. What is the meaning of first &lt;Analysis&gt; in the method declaration? This type is a generic type of declaration of method. Hope it will help you.
score: 0

http://stackoverflow.com/q/22344498
has comment: http://stackoverflow.com/comment/33960127
duplicate of: http://stackoverflow.com/q/2943556
answer count: 2
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33960209
has comment: http://stackoverflow.com/comment/33960153
favorite count: 0
tagged with: static
has answer: http://stackoverflow.com/a/22344567
type: AnsweredQuestion
has body: I saw the below code in one example, I unable to understand that what they doing and what they representing from same code what is the meaning for below code in java static { variable 1; variable 2; variable 3; variable 4; }
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/22344567
type: Question
possible better answer: http://stackoverflow.com/a/22344577
linked to: http://stackoverflow.com/q/2943556
has answer: http://stackoverflow.com/a/22344577
has title: static keyword and block in java
has comment: http://stackoverflow.com/comment/33960121

http://stackoverflow.com/q/22450407
has answer: http://stackoverflow.com/a/27387501
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22452081
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/43228713
has body: It seems that PHP uses other date format symbols than Java to format a date based on a pattern. E.g. when I want to output a date like this: 17.03.2014 09:50 In PHP, I have to use the date format pattern d.m.Y H:i while in Java, I use the pattern dd.mm.yyyy hh:mm Is there a Java class, that can convert a given input (Java) pattern to the PHP pattern, e.g. convert dd.mm.yyyy hh:mm to d.m.Y H:i? I'm asking, because I have to use a Javascript date picker which uses the PHP date format symbols to format a date.
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34145852
answer count: 2
has comment: http://stackoverflow.com/comment/34146421
possible better answer: http://stackoverflow.com/a/27387501
has title: PHP date format symbols vs JAVA date format symbols
has comment: http://stackoverflow.com/comment/34154482
tagged with: php
accepted answer: http://stackoverflow.com/a/22452081

mocking
tags question: http://stackoverflow.com/q/22443095
tags question: http://stackoverflow.com/q/22427392
tags question: http://stackoverflow.com/q/22357170
tag name: mocking
tags question: http://stackoverflow.com/q/22346396
tags question: http://stackoverflow.com/q/22456450
type: Tag
tags question: http://stackoverflow.com/q/22374215

http://stackoverflow.com/q/22438780
favorite count: 0
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34137531
type: Question
has body: I am having the same issue as this unanswered question my question is: Is there a way to find out if the onCheckedChanged method is called by user input (specifically the user selecting a radio button option) or if it is being called due to device rotation? Thanks,
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10647001
tagged with: java
has comment: http://stackoverflow.com/comment/34136837
upvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/22506848
tagged with: android
has answer: http://stackoverflow.com/a/22506848
has title: Check if onCheckedChanged called by user input and not device rotate

http://stackoverflow.com/comment/34134608
type: QuestionComment
comment on: http://stackoverflow.com/q/22371762
score: 0
has text: I've added the code that writes the file. The stream is closed when existing the try-catch block (using java 7).
type: Comment

http://stackoverflow.com/comment/34390130
has text: I am using Visual Paradigm for UML v10.4. Yes i generate it using the ide integration to netbeans. Files are properly refreshed
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22434574

http://stackoverflow.com/q/22404000
has comment: http://stackoverflow.com/comment/34062925
tagged with: character-encoding
linked to: http://stackoverflow.com/q/138948
score: 0
has answer: http://stackoverflow.com/a/22404473
answer count: 1
tagged with: unicode
has body: I have a string of unicode characters like this:\u4f60\u597d in Java But when I print it to the console the it shows "??". Also when I update a Mysql table with this data it saves the same "??" string. I have set the Mysql charset to utf8 but it is not working
has comment: http://stackoverflow.com/comment/34062630
has comment: http://stackoverflow.com/comment/34063007
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22404473
has comment: http://stackoverflow.com/comment/34062891
tagged with: java
tagged with: mysql
type: Question
has title: unicode support java and mysql

http://stackoverflow.com/q/22362456
type: Question
has answer: http://stackoverflow.com/a/22362533
tagged with: string
linked to: http://stackoverflow.com/q/3988788
favorite count: 0
has comment: http://stackoverflow.com/comment/33991836
score: 0
has title: java.lang.NullPointerException in String.replace()
has answer: http://stackoverflow.com/a/22362482
has answer: http://stackoverflow.com/a/22362493
answer count: 5
duplicate of: http://stackoverflow.com/q/3988788
has comment: http://stackoverflow.com/comment/34002904
has body: I feel like I should give an idea what the code is for. I have this problem where I need to write two functions, one is find() that returns a boolean value if it finds the index of a substring in a given string. The function is supposed to 'save the index values in the index array'. And another method, replace() that replaces all the searched words with the new word, and out put the new string. The index number of the matched words need to be output. import java.util.Scanner; public class findAndReplace { public static void main(String[] args) { String text; String find; String replace = null; String result; int index[]; Scanner scanner = new Scanner(System.in); System.out.print("Enter the line: "); text = scanner.nextLine(); System.out.print("Enter the string to find: "); find = scanner.nextLine(); System.out.print("Enter the string to replace with: "); find = scanner.nextLine(); find(text, find); String result1 = replace(text, find, replace); //!!NUllPointerException System.out.print(result1); } public static boolean find(String text, String find){ //method return a Boolean value if it finds the index of the word that we are trying to find. Saves the index value in the index array. boolean b = false; int index_int; int index[] = null; if (text.indexOf(find)&gt;=0){ b = true; int i = 0; do{ index_int = text.indexOf(find); index[i]=index_int; i++; text.replace(text.charAt(index_int), '0'); System.out.print(index_int); } while (text.indexOf(find)&gt;=0); } return b; } public static String replace(String text, String find, String replace){ //method replaces all search words with new word and prints. String result; result = text.replace(find, replace); //!!NUllPointerException return result; } } Now the problem is, I am finding nullpointer exception at the commented lines. Can you tell me where the problem is? I searched the error to no avail.
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/33992874
has answer: http://stackoverflow.com/a/22362588
has comment: http://stackoverflow.com/comment/33991768
tagged with: java
has answer: http://stackoverflow.com/a/22362590

http://stackoverflow.com/comment/34253125
comment on: http://stackoverflow.com/a/22482615
type: Comment
has text: @TanmayPatil What do you mean with "libgdx tiles"? If you mean all those `Tiled...` features, you don't need to use them, even if you want to create Tile-Based maps with libgdx. You don't need to switch to another Engine/Framework, just because you don't like the `Tiled`support, you can easily manage the tiles yourself (like i did).
type: AnswerComment
score: 0

http://stackoverflow.com/q/22445424
tagged with: java
tagged with: jpanel
has answer: http://stackoverflow.com/a/22445458
type: Question
score: 0
has body: I want to create JPanel as a part of JFrame private void initialize() { frame = new JFrame(); frame.getContentPane().add((new JPanelSql("testName" , "testTxt")) , "cell 1 2,grow"); } class JPanelSql extends JPanel { private String name ; private String txt ; public JPanelSql (String name , String txt ) { this.name = name ; this.txt = txt ; } public void createJPanel () { JLabel lblNewLabel = new JLabel(name); super.add(lblNewLabel); JTextArea textArea = new JTextArea(); textArea.append(txt) ; super.add(textArea); } } However, this does not create any JPanel in the JFrame . How can I create a JPanel dynamically ?
answer count: 1
has title: Creating JPanel dynamically
accepted answer: http://stackoverflow.com/a/22445458
type: AnsweredQuestion

http://stackoverflow.com/comment/48715319
type: Comment
comment on: http://stackoverflow.com/a/22398390
type: AnswerComment
has text: I have this problem, too. I'm trying to do database prep before I set up my tests. My @Parameters method queries the database to find test values. I'd like to set up the database before getting my test values. No, this is not strictly unit testing....
score: 0

http://stackoverflow.com/a/22851050
has body: If you are using a bounded BlockingQueue by passing a capacity value in the constructor, then the producer will block when it attempts to call put() until the consumer removes an item by calling take(). It would help to know more about when or how the program is going to execute to decide how to deal with database connections. Some easy choices are: have the producer and all consumers get an individual connection, have a connection pool for all consumers while the producer holds the a connection, or have all producers and consumers use a connection pool. You can facilitate minimizing the number of connections by using something such as Spring to manage your connection pool and transactions; however, it would only be necessary in some execution situations.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22450405

http://stackoverflow.com/comment/33983436
score: 0
comment on: http://stackoverflow.com/q/22357898
type: Comment
has text: @AntP Static extension methods were introduced in C# to solve the same problem as virtual extension methods do in Java.
type: QuestionComment

http://stackoverflow.com/a/22444184
type: Answer
score: 1
has body: The data should come after a blank line after the header lines, but I think the problem is that the data does not end with a newline character, and therefore, you cannot read it with the .readLine() method. While looping through the header lines, you could look for the "Content-Length" line and get the length of the data. When you have reached the blank line, stop using .readLine(). Instead switch to reading one character at a time, reading the number of characters specified by the "Content-Length" header. I think you can find example code for this in this answer. If you can, I suggest you use a library to help with this. I think the Apache HTTP Core library can help with this. See this answer.
upvote count: 1
answers question: http://stackoverflow.com/q/22443146
has comment: http://stackoverflow.com/comment/34157977
accepted answer of: http://stackoverflow.com/q/22443146
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22431269
has comment: http://stackoverflow.com/comment/34138058
answer count: 1
favorite count: 0
has title: SWT Shell with round corners
type: UnansweredQuestion
tagged with: swt
score: 4
has body: I have been trying to create a SWT Shell with rounded corners with no success. Google does not help much on this area, and I have been trying to set a Region on the shell, but I cannot find a way to make a region that is a round rectangle. If somebody could point me on the right direction would be awesome. Thanks
tagged with: java
has answer: http://stackoverflow.com/a/45330521
type: Question
has comment: http://stackoverflow.com/comment/34119741
downvote count: 0
upvote count: 4

http://stackoverflow.com/comment/34208807
comment on: http://stackoverflow.com/q/22486504
type: QuestionComment
score: 0
has text: Do all now know what i mean?
type: Comment

android-ndk
tags question: http://stackoverflow.com/q/22399572
type: Tag
tags question: http://stackoverflow.com/q/22364382
tag name: android-ndk
tags question: http://stackoverflow.com/q/22373824
tags question: http://stackoverflow.com/q/22446304
tags question: http://stackoverflow.com/q/22436574

http://stackoverflow.com/q/22486270
has title: JAVA GET response for HTTP POST Request
tagged with: http
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22486544
tagged with: post
tagged with: response
score: 0
answer count: 2
has body: How to get the status code or something better to know if an message was sent? I already do this, but off course it don't work. httppost.setEntity(new StringEntity(message.toString())); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); String status = response.getStatusLine().toString(); Log.d(CLASS_TAG + "showOnScreenMessage", "Message sent! "); Log.d(CLASS_TAG + "showOnScreenMessage", "Status : " + status ); // if response == 201 , the message has be received, Set True to acknowledgment_message if ( status == "201"){ Log.d(CLASS_TAG + "showOnScreenMessage", "Message received! "); }else{ // Do nothing already false Log.d(CLASS_TAG + "showOnScreenMessage", "Message not received! "); } Thanks for your suggestions
possible better answer: http://stackoverflow.com/a/22486368
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/22486368
tagged with: android
has comment: http://stackoverflow.com/comment/34207910
has answer: http://stackoverflow.com/a/22486544
type: AnsweredQuestion

http://stackoverflow.com/a/22400663
has comment: http://stackoverflow.com/comment/34058664
has body: We are keeping our Solr configurations together with the according war file within an Eclipse project. I will refer to this project as your project here. That way we keep everything together in one place the war file the index the configurations What you need to do is 1) Create an empty tomcat server within eclipse 2) Add -Dsolr.solr.home=${resource_loc:/&lt;your project here&gt;/solr/home} to the VM arguments of that tomcat 3) Add the solr war file as &lt;Context&gt; to the server.xml of that tomcat
accepted answer of: http://stackoverflow.com/q/22386282
score: 3
answers question: http://stackoverflow.com/q/22386282
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/a/22420579
has comment: http://stackoverflow.com/comment/34092717
type: Answer
has comment: http://stackoverflow.com/comment/34094333
upvote count: 1
has comment: http://stackoverflow.com/comment/34094537
has body: Your client is reading the response until end of stream, which only occurs when the peer closes the socket, which makes it impossible to have multiple exchanges. You need to devise another way to delimit messages. In this case, just sending and receiving lines would be sufficient.
score: 1
has comment: http://stackoverflow.com/comment/34093281
has comment: http://stackoverflow.com/comment/34096621
has comment: http://stackoverflow.com/comment/34140174
answers question: http://stackoverflow.com/q/22420342
downvote count: 0
has comment: http://stackoverflow.com/comment/34092654

http://stackoverflow.com/q/22353568
accepted answer: http://stackoverflow.com/a/22354355
tagged with: pack
tagged with: java
tagged with: multithreading
tagged with: swing
type: Question
possible better answer: http://stackoverflow.com/a/22353708
has answer: http://stackoverflow.com/a/22353708
score: 0
linked to: http://stackoverflow.com/q/7229226
answer count: 2
has title: Using JFrame.pack() in a loop
has answer: http://stackoverflow.com/a/22354355
tagged with: event-dispatch-thread
has body: I would like progressively modify a java JFrame design structure, as in the this simple example. In a loop I'am increasing de preferredWidth of a JPanel and using the method pack(). But apparently the pack method is ignored. If I put the pack out of the loop, using it only one time, it's work. Anyone know the reason and a possible solution? public class Calculadora extends JFrame { private JPanel pnl = new JPanel(); private boolean flag; public Calculadora() { JPanel pnlPrincipal = new JPanel(); pnlPrincipal.setPreferredSize(new Dimension(300, 300)); pnlPrincipal.setBackground(Color.BLACK); JButton btnAnexo = new JButton("Anexo"); btnAnexo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (flag) { closeAnexo(); flag = false; } else { openAnexo(); flag = true; } } }); pnlPrincipal.add(btnAnexo); this.pnl.setBackground(Color.WHITE); this.pnl.setPreferredSize(new Dimension(0, 300)); this.add(pnl, BorderLayout.EAST); this.add(pnlPrincipal, BorderLayout.CENTER); this.pack(); this.setVisible(true); } private void openAnexo() { new Thread () { @Override public void run() { for (int i = pnl.getWidth(); i &lt;= 200; i++) { pnl.setPreferredSize(new Dimension(i, 300)); pack(); } } }.start(); } private void closeAnexo() { new Thread () { @Override public void run() { for (int i = pnl.getWidth(); i &gt;= 0; i--) { pnl.setPreferredSize(new Dimension(i, 300)); pack(); } } }.start(); } public static void main(String[] args) { new Calculadora(); } }
type: AnsweredQuestion

http://stackoverflow.com/a/22412171
has body: ok, first of all, your first code would print interpret develop because you aren´t counting anything and it should be interpret=4 develop=3 anyway. The second block only has one counter 'c'. You should have one counter per each found word. I would suggest using a Map of Strings and Integers. When the String is nonexistent you put(small,1) and when it exists you get the Integer and add one to it. Let us know if that worked (btw, there's no regex in your code, it shouldn't be tagged as such)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22412035

http://stackoverflow.com/comment/33940225
comment on: http://stackoverflow.com/a/22332414
score: 0
type: Comment
type: AnswerComment
has text: I don't think that's a fair assumption for students to make. If only one thread is incrementing, it's safe, if more than one thread is incrementing, it's not safe. They should be teaching you to analyze, not make assumptions.

http://stackoverflow.com/comment/34086639
comment on: http://stackoverflow.com/a/22417237
type: AnswerComment
score: 0
has text: Sure, just examining the contents of the View object is more error prone than having different listener interface implementations for each button.
type: Comment

http://stackoverflow.com/q/22458577
has comment: http://stackoverflow.com/comment/34160526
has comment: http://stackoverflow.com/comment/34159779
has body: The UI has two buttons, browse and submit. I want the user to hit browse to find a file, and then submit to copy it to a different location. However whenever I attempt it, I get this stack trace: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at me.trevor1134.modinjector.ModInjector$3.actionPerformed(ModInjector.java:154) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at …
tagged with: java
has comment: http://stackoverflow.com/comment/34159385
tagged with: stack-trace
has comment: http://stackoverflow.com/comment/34159824
tagged with: swing
has title: How to choose file and then submit in Java swing?
type: Question
has comment: http://stackoverflow.com/comment/34159706
has comment: http://stackoverflow.com/comment/34159525
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34163978
has comment: http://stackoverflow.com/comment/34159407
has comment: http://stackoverflow.com/comment/34160722
has answer: http://stackoverflow.com/a/22459798
has comment: http://stackoverflow.com/comment/34161001
score: 0
has comment: http://stackoverflow.com/comment/34161105
answer count: 1
has comment: http://stackoverflow.com/comment/34159426
has comment: http://stackoverflow.com/comment/34160849
has comment: http://stackoverflow.com/comment/34159418
accepted answer: http://stackoverflow.com/a/22459798

http://stackoverflow.com/comment/34188237
type: Comment
type: QuestionComment
has text: It depends on what `System.out` points to...
score: 2
comment on: http://stackoverflow.com/q/22475209

http://stackoverflow.com/comment/34053019
comment on: http://stackoverflow.com/a/22364632
type: Comment
score: 1
type: AnswerComment
has text: I would use bindConstant() instead of bind(String.class) instead of bind(String.class)

http://stackoverflow.com/comment/34052244
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22397105
has text: See [De Morgan's law](http://en.wikipedia.org/wiki/De_Morgan's_laws) for details. (Rewrite the loop expression with `&&` via DM to illustrate the flaw.)

http://stackoverflow.com/a/29017049
score: 2
has body: Well, you seem to be declaring a RESTful web service using JAX-RS (or Jersey, the reference implementation). As I've posted on another question this exception usually is thrown when there is an initialization error. The fact that you are using some kind of generator (NetBeans wizard) suggest there is some other code thrown arount to do the initialization. JAX-RS is an excellent RESTful specification and Jersey is the reference implementation. It's well written and well documented. So I suggest to go and read the documentation, especially the initialization part, so you can trace your problem to its root.
upvote count: 3
answers question: http://stackoverflow.com/q/22388889
downvote count: 1
type: Answer

http://stackoverflow.com/a/22452282
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/22452048
downvote count: 0
type: Answer
has body: This is the point - similar yes - not identical "GWT shields you from worrying too much about cross-browser incompatibilities. If you stick to built-in widgets and composites, your applications will work similarly on the most recent versions of Internet Explorer, Firefox, Chrome, and Safari. (Opera, too, most of the time.) Whenever possible, GWT defers to browsers' native user interface elements. For example, GWT's Button widget is a true HTML rather than a synthetic button-like widget built, say, from a &lt;div&gt;. That means that GWT buttons render appropriately in different browsers and on different client operating systems " from gwtproject.org

http://stackoverflow.com/a/22398390
accepted answer of: http://stackoverflow.com/q/22391202
answers question: http://stackoverflow.com/q/22391202
has body: This is, unfortunately, working as intended. JUnit needs to enumerate all of the test cases before starting the test, and for parameterized tests, the method annotated with @Parameterized.Parameters is used to determine how many tests there are.
type: Answer
score: 11
has comment: http://stackoverflow.com/comment/48715319
downvote count: 0
has comment: http://stackoverflow.com/comment/34073069
has comment: http://stackoverflow.com/comment/48752223
has comment: http://stackoverflow.com/comment/34381200
has comment: http://stackoverflow.com/comment/49104079
upvote count: 11
has comment: http://stackoverflow.com/comment/49117480
type: AcceptedAnswer

http://stackoverflow.com/q/22332489
has title: Sorting a list of strings
has comment: http://stackoverflow.com/comment/33939128
answer count: 2
possible better answer: http://stackoverflow.com/a/22333026
has answer: http://stackoverflow.com/a/22333026
type: AnsweredQuestion
tagged with: list
score: 0
tagged with: java
has body: I was handed this assignment: Complete the function void sort(List l) that sorts a list l that contains the strings "one","two","three","four" (although not necessarily in that order). You should declare a Comparator, and use this with the Collections.sort function. The comparator should use the comp function described above. The list l will be altered when it is sorted. and the code I have already writen is this: import java.util.*; public class CW3 { private static HashMap &lt; String, Integer &gt; map = new HashMap &lt; String, Integer &gt; (); public CW3() { map.put("one", 1); map.put("two", 2); map.put("three", 3); map.put("four", 4); List listB = Arrays.asList("A", "B", "C"); } public static void main(String[] args) { System.out.println(new CW3().comp("one", "two")); System.out.println(new CW3().comp("two", "one")); System.out.println(new CW3().comp("one", "one")); } int comp(String s1, String s2) { int i1 = map.get(s1); int i2 = map.get(s2); return (i1 &lt; i2 ? -1 : (i1 == i2 ? 0 : 1)); } void sort(List l) { Comparator c = new Comparator() { public int compare(Object o1, Object o2) { return 0; // FIXME change this so it calls comp } }; // now sort l using the comparator c // FIXME complete this line } Any ideas where to start? it says list so I would have to create a list but then how would I sort them?
has answer: http://stackoverflow.com/a/22332758
type: Question
has comment: http://stackoverflow.com/comment/33939119
has comment: http://stackoverflow.com/comment/33939277
has comment: http://stackoverflow.com/comment/33939081
tagged with: sorting
accepted answer: http://stackoverflow.com/a/22332758

http://stackoverflow.com/q/22331871
has comment: http://stackoverflow.com/comment/33985768
upvote count: 1
tagged with: memcached
type: Question
has comment: http://stackoverflow.com/comment/33962770
tagged with: caching
tagged with: jcs
has comment: http://stackoverflow.com/comment/33983789
has title: Cache Regions and Cache memory Groups: Memcache, EhCache, JCS
answer count: 1
downvote count: 0
favorite count: 0
tagged with: ehcache
has comment: http://stackoverflow.com/comment/33939639
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22359835
has comment: http://stackoverflow.com/comment/33941211
has comment: http://stackoverflow.com/comment/121098686
score: 1
tagged with: java
has body: Most of caching service support to cache any object as key and value pair. But I am looking for a way that objects can be cached as regions or groups. That means, caching objects should be able to group. One or more objects are cached to a group. What ever we do (remove, update) to the group, should be affected to the objects in the group. I searched about some caching services and found that JCS supports this. I am supposed to implement a common way as it could be used for most of caching services. Does anyone know any way or supportive resource that can be helpful? Edit: @ cruftex: Assume an Inventory system for small shop. There are stationery items, vegetables, fruits, sweets and their prices and other details are required to be cached. What if I need to clear or do any update only for items that can be eaten (vegetable, fruits, sweets) and not to stationery and any other inedible set of objects that are cached? If there is a way to group like 'edible', 'inedible', I can get or do any changes to the particular group so that all group member instances will be affected.

http://stackoverflow.com/comment/34176186
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22467727
type: QuestionComment
has text: @JoshM : it s got nothing to do with that, I made a test, where I replaced my parameters a with -10 and b with 10 directly inside c = rand.nextInt((int)((b - a) + 1)) + a + rand.nextDouble() and it s working fine

http://stackoverflow.com/q/22407945
has comment: http://stackoverflow.com/comment/34069563
accepted answer: http://stackoverflow.com/a/22419029
has comment: http://stackoverflow.com/comment/34069701
has comment: http://stackoverflow.com/comment/34069718
has comment: http://stackoverflow.com/comment/34069836
has body: My specific problem is that I want to create a static method in a base class which saves away the instances of the subclass in a file. And another static method in the base class which retrieves the data and recreates the instances of the subclass. I have got all of it working except where in my strategy I need to create an instance of the subclass within the static method of the base class. Please see what I mean below. And so the general question is in Java how do you Create an instance of a subclass from within a Static method of the superclass. class Base public static Void saveAllInstances(){ saveAttributesofAllInstancesInFile(); // this works } public static Void retrieveAllInstances(){ destroyAllInstances(); // this works getInstanceAttributesFromFile(); // this works and returns e.g. ArrayList&lt;HashMap&gt; for( instanceAttributes : retrievedInstances ){ // Here is the part I cant figure out: I want to create an instance of // the subclass here sub = new Sub(); sub.setAttributes(instanceAttributes); //this works } } class Sub extends Base{ }
tagged with: java
has title: Java: How to Create an instance of a subclass from with a Static method of the super class
has comment: http://stackoverflow.com/comment/34070234
has comment: http://stackoverflow.com/comment/34070127
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22408273
has comment: http://stackoverflow.com/comment/34069992
type: Question
has comment: http://stackoverflow.com/comment/34069983
possible better answer: http://stackoverflow.com/a/22408273
has answer: http://stackoverflow.com/a/22419029
score: 0
answer count: 2

http://stackoverflow.com/q/22332198
has comment: http://stackoverflow.com/comment/33951158
tagged with: logback
linked to: http://stackoverflow.com/q/7934829
has comment: http://stackoverflow.com/comment/34989631
score: 5
accepted answer: http://stackoverflow.com/a/31273781
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/49966143
has body: Apologies if this is seen as a duplicate. This question is very similar but not the same. I'm interested in controlling the overall number of files (really I want to control the total size used for all logs). I want the following from log back: For the current file, roll over every 12 hours or the file hits 100MB. No matter what, don't use more than 600MB of space total (I could also say this like: don't have more than 5 backup files). The first point seems easy. I'm aware of TimeBasedRollingPolicy, and I know I can limit the per file size, but that's not enough. I need a way of limiting the total number of log files, not just the total number of time periods.
upvote count: 5
has answer: http://stackoverflow.com/a/31273781
has comment: http://stackoverflow.com/comment/50541691
has title: How can I configure logback to rollover based on time or size, with an absolute max on total number of files?
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34840415

http://stackoverflow.com/a/22360534
has body: You have to use property class to access your file within class-path and source folder you can try like: this.getClass().getResourceAsFile("words.txt")
upvote count: 1
score: 0
answers question: http://stackoverflow.com/q/22360408
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33987938
has comment: http://stackoverflow.com/comment/33988067

http://stackoverflow.com/comment/34244290
comment on: http://stackoverflow.com/a/22483015
score: 0
type: AnswerComment
has text: Now I am not getting runtime exception but onCreate method is not executing even though I am changing version. I could not find database in the fileexplorer>package @super-qua
type: Comment

http://stackoverflow.com/a/22440760
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Meaning of limit 1, 5 is, select 2nd row onwards, a total of 5 records, if found. But in your case, for the search criteria, as there exists only one record, and you want from 2nd to 6th record, a total of 5 records, the result was empty. Change: limit 1,5; To: limit 0, 5; -- to fetch first 5 records from the found Or limit 5; -- to fetch first 5 records from the found To find total number of found records, You need to execute select found_rows() when used with SQL_CALC_FOUND_ROWS. Sequence of operations should be: SELECT SQL_CALC_FOUND_ROWS * FROM books where keyword like '%java%' limit 5; SELECT FOUND_ROWS(); The second SELECT returns a number indicating how many rows the first SELECT would have returned had it been written without the LIMIT clause. Refer to: MySQL: Found_Rows()
type: Answer
accepted answer of: http://stackoverflow.com/q/22440694
answers question: http://stackoverflow.com/q/22440694
has comment: http://stackoverflow.com/comment/34128621

http://stackoverflow.com/comment/34141581
has text: Thanks I just tried that and it seems to be working I am just not sure if it is the correct way to do it
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22448064
type: Comment

http://stackoverflow.com/q/22368730
tagged with: webserver
score: -1
type: Question
tagged with: browser
answer count: 2
upvote count: 0
accepted answer: http://stackoverflow.com/a/22368811
has title: How do i make my core java program browser based?
tagged with: jvm
favorite count: 0
possible better answer: http://stackoverflow.com/a/22368937
has answer: http://stackoverflow.com/a/22368937
downvote count: 1
has answer: http://stackoverflow.com/a/22368811
has comment: http://stackoverflow.com/comment/34002652
type: AnsweredQuestion
tagged with: java
has body: link1 is my non-object oriented version of simulation program. link2 is an object oriented version of simulation(modified version of link1). One of the file(simtext.java) in this program produces output on stdout by taking 3 command line arguments. Currently this program is built on eclipse, compiled/interpreted using java 7 tools. Going further, For a single user, I want capability of giving 3 inputs on browser and see the output on browser rather than stdout/stdin respectively. What are the elements that am suppose to think of as an approach to make it browser based? I know this is very basic question, but am new to browser world.

http://stackoverflow.com/comment/34154351
comment on: http://stackoverflow.com/q/22455767
type: QuestionComment
type: Comment
has text: just add a small check , use the **GMail ports** and try on both servers , **IF works THEN** you got some kind of bug at sockets usage at one server , **why i said gmail is -> its a third party mail client\server and has such no bugs reported**
score: 0

http://stackoverflow.com/a/23351558
has comment: http://stackoverflow.com/comment/98292962
type: Answer
answers question: http://stackoverflow.com/q/22402491
upvote count: 29
score: 29
has comment: http://stackoverflow.com/comment/81746546
has body: Although the solution stated in this answer works in the general case, I found myself adding to my preference screen: &lt;activity android:name="com.example.UserPreferences" android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden|screenSize"&gt; &lt;/activity&gt; This is because when the application is in landscape mode and the preference screen in portrait mode, changing the locale and going back to the application might cause trouble. Setting both to be in landscape mode prevent this from happening. General solution You need to change the locale at the Application level, so that its effects are everywhere. public class MyApplication extends Application { @Override public void onCreate() { updateLanguage(this); super.onCreate(); } public static void updateLanguage(Context ctx) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); String lang = prefs.getString("locale_override", ""); updateLanguage(ctx, lang); } public static void updateLanguage(Context ctx, String lang) { Configuration cfg = new Configuration(); if (!TextUtils.isEmpty(lang)) cfg.locale = new Locale(lang); else cfg.locale = Locale.getDefault(); ctx.getResources().updateConfiguration(cfg, null); } } Then in your manifest you have to write: &lt;application android:name="com.example.MyApplication" ...&gt; ... &lt;/application&gt;
has comment: http://stackoverflow.com/comment/46792173
has comment: http://stackoverflow.com/comment/37598021
downvote count: 0
has comment: http://stackoverflow.com/comment/37599574
has comment: http://stackoverflow.com/comment/98200096

http://stackoverflow.com/q/22437906
has body: I have datatable with 30 column , but when printing it was 50% only printed and 50% missing so i want to print it with landscape mode to take all A4 Space . so i don't know which code CSS use and how to implement it in HTML page with prime faces or jsf java . xhtml code: &lt;h:commandButton value="طباعة التقرير" type="button" icon="ui-icon-print"&gt; &lt;p:printer target="hesham" /&gt; &lt;/h:commandButton&gt;
tagged with: jsf-2
score: 0
answer count: 1
has title: Print data table with jsf with lanscap
type: UnansweredQuestion
tagged with: css
has answer: http://stackoverflow.com/a/22453575
tagged with: jsf
tagged with: java
type: Question

http://stackoverflow.com/comment/34154331
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22455603
has text: Are each of the rows sorted in ascending order, and the first element of any of each row is no less than the last element of the previous row? If so, it should not be terribly difficult.
score: 0

http://stackoverflow.com/a/22369782
accepted answer of: http://stackoverflow.com/q/22369579
has comment: http://stackoverflow.com/comment/34004740
answers question: http://stackoverflow.com/q/22369579
has comment: http://stackoverflow.com/comment/34004585
has comment: http://stackoverflow.com/comment/34004695
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34004746
has body: private void createNodes(DefaultMutableTreeNode top) { //illegal start of expression Whoa, from the looks of your image, the method createNodes is inside the constructor, Hence //illegal start of expression. You'll want to take that out of the constructor and put it on the class level. Side Note In Netbeans, make use of Shift + Alt + F to properly indent your code. You may notice errors you wouldn't see otherwise, like maybe this one :) Providing us with actual text code is much more effective than providing a screen shot of your code.
score: 2
has comment: http://stackoverflow.com/comment/34004640
has comment: http://stackoverflow.com/comment/34004693

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/22456029
tags question: http://stackoverflow.com/q/22362426
tags question: http://stackoverflow.com/q/22366892
tags question: http://stackoverflow.com/q/22439341
tags question: http://stackoverflow.com/q/22383740
tags question: http://stackoverflow.com/q/22389431
tags question: http://stackoverflow.com/q/22358935
tags question: http://stackoverflow.com/q/22351744
tags question: http://stackoverflow.com/q/22438996
tags question: http://stackoverflow.com/q/22430383
tags question: http://stackoverflow.com/q/22446794
tags question: http://stackoverflow.com/q/22341252
tags question: http://stackoverflow.com/q/22336550
tags question: http://stackoverflow.com/q/22480114
tags question: http://stackoverflow.com/q/22470119
tags question: http://stackoverflow.com/q/22451482
tags question: http://stackoverflow.com/q/22403705
tags question: http://stackoverflow.com/q/22438978
tags question: http://stackoverflow.com/q/22369612
type: Tag
tags question: http://stackoverflow.com/q/22385241
tags question: http://stackoverflow.com/q/22457999
tags question: http://stackoverflow.com/q/22371862
tags question: http://stackoverflow.com/q/22386593
tags question: http://stackoverflow.com/q/22476939
tags question: http://stackoverflow.com/q/22407801
tags question: http://stackoverflow.com/q/22390653
tags question: http://stackoverflow.com/q/22462920
tags question: http://stackoverflow.com/q/22400442
tags question: http://stackoverflow.com/q/22429483
tags question: http://stackoverflow.com/q/22450126
tags question: http://stackoverflow.com/q/22474535
tags question: http://stackoverflow.com/q/22368021
tags question: http://stackoverflow.com/q/22429262
tags question: http://stackoverflow.com/q/22364106
tags question: http://stackoverflow.com/q/22420880
tags question: http://stackoverflow.com/q/22362607
tags question: http://stackoverflow.com/q/22409131
tags question: http://stackoverflow.com/q/22473333
tags question: http://stackoverflow.com/q/22413329
tags question: http://stackoverflow.com/q/22377773
tags question: http://stackoverflow.com/q/22336839
tags question: http://stackoverflow.com/q/22414704
tags question: http://stackoverflow.com/q/22480273
tags question: http://stackoverflow.com/q/22487110
tags question: http://stackoverflow.com/q/22464763
tags question: http://stackoverflow.com/q/22432901
tags question: http://stackoverflow.com/q/22359510
tags question: http://stackoverflow.com/q/22358241
tags question: http://stackoverflow.com/q/22459200
tags question: http://stackoverflow.com/q/22459643
tags question: http://stackoverflow.com/q/22360885
tags question: http://stackoverflow.com/q/22368577
tags question: http://stackoverflow.com/q/22426887
tags question: http://stackoverflow.com/q/22423862
tags question: http://stackoverflow.com/q/22349923
tags question: http://stackoverflow.com/q/22355752
tags question: http://stackoverflow.com/q/22484198
tags question: http://stackoverflow.com/q/22401087
tags question: http://stackoverflow.com/q/22350741
tags question: http://stackoverflow.com/q/22372000
tags question: http://stackoverflow.com/q/22423289
tags question: http://stackoverflow.com/q/22440902
tags question: http://stackoverflow.com/q/22457508
tags question: http://stackoverflow.com/q/22401933
tags question: http://stackoverflow.com/q/22388697
tags question: http://stackoverflow.com/q/22378880
tags question: http://stackoverflow.com/q/22397075
tags question: http://stackoverflow.com/q/22397545
tags question: http://stackoverflow.com/q/22368002
tags question: http://stackoverflow.com/q/22396501
tags question: http://stackoverflow.com/q/22372533
tags question: http://stackoverflow.com/q/22455734
tags question: http://stackoverflow.com/q/22357539
tag name: xml
tags question: http://stackoverflow.com/q/22444258
tags question: http://stackoverflow.com/q/22452272
tags question: http://stackoverflow.com/q/22444901
tags question: http://stackoverflow.com/q/22390949
tags question: http://stackoverflow.com/q/22348462

http://stackoverflow.com/a/22465641
has comment: http://stackoverflow.com/comment/34175777
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34174065
downvote count: 0
answers question: http://stackoverflow.com/q/22465577
type: Answer
has body: Make sure the gwt-user.jar file is in your build path. It's part of the GWT SDK. It is unable to find gwt-user.jar/com/google/web/bindery/event/Event.gwt.xml

http://stackoverflow.com/q/22397864
downvote count: 0
has comment: http://stackoverflow.com/comment/34052733
favorite count: 0
has comment: http://stackoverflow.com/comment/34052682
has answer: http://stackoverflow.com/a/22398642
has title: How to get particular field name of XML file in JAVA?
tagged with: stax
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
score: 1
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/21963137
has body: Hello i am new to STAX and I have xml file as an example. Like this <?xml version="1.0"?> true false true true true false I want just feild name , whose sensitive value is true. In this example i want just Name,ssn, emailid and bankaccount number. So how can i do. Please anyone help me.
tagged with: java
linked to: http://stackoverflow.com/q/2811001
has answer: http://stackoverflow.com/a/22399781
answer count: 2
tagged with: xml-parsing

http://stackoverflow.com/a/22435150
answers question: http://stackoverflow.com/q/22430383
score: 0
has comment: http://stackoverflow.com/comment/34118461
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34118103
accepted answer of: http://stackoverflow.com/q/22430383
has comment: http://stackoverflow.com/comment/34118838
type: Answer
has comment: http://stackoverflow.com/comment/34118735
has comment: http://stackoverflow.com/comment/34118180
has body: If I understand correctly, this might solve your problem: <requestFocus android:layout_width="match_parent"/> <TextView android:id="@+id/tV_input_snm_txt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/input_snm" android:layout_alignParentLeft="true" android:paddingLeft="@dimen/padding_small" android:paddingRight="@dimen/padding_small" android:paddingTop="@dimen/padding_small" android:text="@string/input_snm" android:textAppearance="?android:attr/textAppearanceMedium"/> <TextView android:id="@+id/tV_input_ipAdresse" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/input_ipAdresse" android:layout_alignParentLeft="true" android:paddingLeft="@dimen/padding_small" android:paddingRight="@dimen/padding_small" android:paddingTop="@dimen/padding_small" android:text="@string/input_ipAdresse" android:textAppearance="?android:attr/textAppearanceMedium"/> <TextView android:id="@+id/tV_Klasse" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:paddingLeft="@dimen/padding_small" android:paddingRight="@dimen/padding_small" android:paddingTop="@dimen/padding_small" android:text="@string/txt_Klasse"/> <TextView android:id="@+id/tV_BitsNetz" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="@dimen/padding_small" android:paddingRight="@dimen/padding_small" android:text="@string/txt_BitsNetz"/> <TextView android:id="@+id/tV_BitsSubnetz" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="@dimen/padding_small" android:paddingRight="@dimen/padding_small" android:text="@string/txt_BitsSubnetz"/> <TextView android:id="@+id/tV_BitsHost" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="@dimen/padding_small" android:paddingRight="@dimen/padding_small" android:text="@string/txt_BitsHost"/> …
has comment: http://stackoverflow.com/comment/34118779
has comment: http://stackoverflow.com/comment/34118149
has comment: http://stackoverflow.com/comment/34117986

http://stackoverflow.com/a/22407618
type: Answer
answers question: http://stackoverflow.com/q/22407538
downvote count: 2
score: -2
has body: public static boolean isSorted (double [] list){ boolean isSorted=true; for(int i=1; i&lt;list.length; i++){ if (list[i] &gt; list[i+1]){ System.out.println("Not Sorted"); isSorted = false; } } return isSorted; }
upvote count: 0

http://stackoverflow.com/a/40252439
downvote count: 0
answers question: http://stackoverflow.com/q/22365365
type: Answer
score: 1
upvote count: 1
has body: Looks like this was fixed in Resin 4.0.42, on 2014-11-03.

http://stackoverflow.com/q/22386254
type: AnsweredQuestion
tagged with: bit-shift
tagged with: java
accepted answer: http://stackoverflow.com/a/22386330
type: Question
has answer: http://stackoverflow.com/a/22386367
has title: Shifted bits values
has answer: http://stackoverflow.com/a/22386358
has body: String message = "1"; byte[] bytes = message.getBytes(); System.out.println(bytes[0] + ": "); for (int i = 0; i &lt; 8; i++) { System.out.print((bytes[0] &gt;&gt; (7 - i)) + " "); } Output: 49: 0 0 1 3 6 12 24 49 So my string is 1 which in ASCII is 49. What I'm trying to understand is why do my bits have values 3,6,12,24 and 49? What's happening behind, why aren't they only 0 and 1 like the first 3?
score: 0
possible better answer: http://stackoverflow.com/a/22386358
has comment: http://stackoverflow.com/comment/34032409
has answer: http://stackoverflow.com/a/22386408
has answer: http://stackoverflow.com/a/22386330
has comment: http://stackoverflow.com/comment/34032816
has comment: http://stackoverflow.com/comment/34032645
answer count: 5
has comment: http://stackoverflow.com/comment/34032354
tagged with: bit
has answer: http://stackoverflow.com/a/22386771

http://stackoverflow.com/comment/34041674
comment on: http://stackoverflow.com/q/22364415
has text: You know that Tomcat [already does this for you](http://www.tomcatexpert.com/blog/2011/04/25/session-fixation-protection), right? After a successful authentication, Tomcat changes the id of your session for you to prevent session-fixation attacks.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/34066102
comment on: http://stackoverflow.com/q/22406046
score: 2
has text: Where is your code? Show us.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34189780
comment on: http://stackoverflow.com/q/22474884
score: 0
type: Comment
type: QuestionComment
has text: I did not look into that you tagged this as `java`. How are you defining and calling this code block in `java`?

http://stackoverflow.com/comment/34186214
score: 0
comment on: http://stackoverflow.com/q/22473931
type: Comment
type: QuestionComment
has text: @AskThakare as my described , `Some were hard to get and some will gain frequently.`

http://stackoverflow.com/comment/85057184
type: QuestionComment
type: Comment
score: 0
has text: I am having same problem. Did you find the solution?
comment on: http://stackoverflow.com/q/22344023

http://stackoverflow.com/q/22371720
downvote count: 1
has body: I want to add the row dynamically in JTable and I have writen the following code for that: tblTaskList = new JTable(); tblTaskList.setShowVerticalLines(false); tblTaskList.setCellSelectionEnabled(true); tblTaskList.setColumnSelectionAllowed(true); tblTaskList.setBorder(new LineBorder(null)); for (int count = 1; count &lt;= 10; count++) { tblTaskList.setModel(new DefaultTableModel(new Object[][] { { count, "title1", "start", "stop", "pause", "status" }, }, new String[] { "status", "Task Title", "Start", "Stop", "Pause", "Status" })); } tblTaskList.getColumnModel().getColumn(0).setPreferredWidth(31); tblTaskList.getColumnModel().getColumn(1).setPreferredWidth(346); tblTaskList.getColumnModel().getColumn(2).setPreferredWidth(33); tblTaskList.getColumnModel().getColumn(3).setPreferredWidth(31); tblTaskList.getColumnModel().getColumn(4).setPreferredWidth(28); tblTaskList.setBounds(93, 34, 614, 160); frmTaskList.getContentPane().add(tblTaskList); The problem is that only the last row is added, i.e. count print the value 10 in first column,,,can anyone explain how to solve the problem?
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22372251
accepted answer: http://stackoverflow.com/a/22372251
score: 17
has answer: http://stackoverflow.com/a/22371948
possible better answer: http://stackoverflow.com/a/22550106
tagged with: jtable
favorite count: 0
has answer: http://stackoverflow.com/a/22550106
has answer: http://stackoverflow.com/a/22371845
upvote count: 18
answer count: 4
type: AnsweredQuestion
tagged with: windowbuilder
has title: How to add row dynamically in JTable
tagged with: swing

http://stackoverflow.com/q/22418632
has comment: http://stackoverflow.com/comment/34089532
has title: Output of Anonymous Thread class is not synchronized
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/22418777
has comment: http://stackoverflow.com/comment/34089442
has body: I have the following code snippet. public class Test { static final StringBuffer sb1 = new StringBuffer(); static final StringBuffer sb2 = new StringBuffer(); public static void main(String args[]) { new Thread() { public void run() { synchronized(this) { try { sb1.append("A"); sb2.append("B"); System.out.println (sb1 + " " + sb2); Thread.currentThread().sleep(5000); h.sb1.append("U"); h.sb2.append("V"); System.out.println (sb1 + " " + sb2); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }.start(); new Thread() { public void run() { synchronized(this) { sb1.append("C"); sb2.append("D"); System.out.println (sb1 + " " + sb2); } } }.start(); /* Line 28 */ new Thread() { public void run() { synchronized(this) { sb1.append("E"); sb2.append("F"); System.out.println (sb1 + " " + sb2); } } }.start(); } } And when I run the program looks like it is not synchronized at object level. The output I'm getting is: A B AC BD ACE BDF ACEU BDFV And I'm expecting the expected output as A B AU BV AUC BVD AUCE BVDF Can someone please clarify what does this keyword refer to? Also if I use synchronize(this.getThreadGroup()) instead of synchronized(this). I get the output the expected output.
type: Question
has comment: http://stackoverflow.com/comment/34089487
has comment: http://stackoverflow.com/comment/34089508
has comment: http://stackoverflow.com/comment/34089720
score: 0
has comment: http://stackoverflow.com/comment/34089636
answer count: 1
has answer: http://stackoverflow.com/a/22418777
has comment: http://stackoverflow.com/comment/34089489

http://stackoverflow.com/q/22422567
score: 0
has answer: http://stackoverflow.com/a/22423023
has comment: http://stackoverflow.com/comment/34095767
answer count: 1
tagged with: netbeans
type: UnansweredQuestion
has title: how to add fields to database and connect to code
has comment: http://stackoverflow.com/comment/34096018
has comment: http://stackoverflow.com/comment/34095904
has body: I'm trying to make a program using netbeans.. login_form.java -2 labels : username & password -1 textfield : username -1 password field : password -3 buttons : login , cancel , register database named : try -table named account table account -2 columns : username & password registration_form.java -2 labels : desired username & desired password -1 textfield : username -1 passwordfield : password -2 buttons : register & back to login what code should i put to connect and add fields in the registration_form to the database and be retrieved in login_form?? i have this code public void addUser(LoginHandler account) { String query = null; try { query = "INSERT INTO users(Username,Password)VALUES('"+account.getUsername()+"','"+account.getPassword()+"')"; stmt.executeUpdate(query); JOptionPane.showMessageDialog(null,"Register Success!",null,JOptionPane.INFORMATION_MESSAGE); } catch(Exception e) { JOptionPane.showMessageDialog(null,"Register Failed!" + e.toString(),null,JOptionPane.ERROR_MESSAGE); } } where am i going to call this? and how? our teacher just gave this code to us.. SOMEONE HELP PLEASE???
tagged with: java
tagged with: database
tagged with: mysql
has comment: http://stackoverflow.com/comment/34096149
type: Question
has comment: http://stackoverflow.com/comment/34096041

http://stackoverflow.com/comment/34089839
comment on: http://stackoverflow.com/q/22418887
has text: `ArrayList PatientList = new ArrayList();` should be `ArrayList<Patient> PatientList = new ArrayList<Patient>();`
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22463171
has body: As per an assignment, I have to create a method called "equals" to do the following: The method compares the instance variables of the calling object with instance variables of the parameter object for equality and returns true if the dollars and the cents of the calling object are the same as the dollars and the cents of the parameter object. Otherwise, it returns false. UPDATE: I made a mistake and put the wrong thing, updated it. Got a new error: Money.java:115: error: long cannot be dereferenced if (dollars.equals(otherObject.dollars) &amp;&amp; ^ Money.java:116: error: long cannot be dereferenced cents.equals(otherObject.cents)) ^ 2 errors With the method: public boolean equals(Money otherObject) { boolean status; if (dollars.equals(otherObject.dollars) &amp;&amp; cents.equals(otherObject.cents)) return status = true; else return status = false; }
favorite count: 0
has comment: http://stackoverflow.com/comment/34168544
has title: Creating an equals method
has answer: http://stackoverflow.com/a/22463352
has comment: http://stackoverflow.com/comment/34167829
has answer: http://stackoverflow.com/a/22463529
accepted answer: http://stackoverflow.com/a/22463529
has comment: http://stackoverflow.com/comment/34167675
has comment: http://stackoverflow.com/comment/34167727
has comment: http://stackoverflow.com/comment/34167804
tagged with: equals
has comment: http://stackoverflow.com/comment/34168050
downvote count: 0
has comment: http://stackoverflow.com/comment/34167708
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34167951
linked to: http://stackoverflow.com/q/27581
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34167738
possible better answer: http://stackoverflow.com/a/22463352
type: Question
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/34167704

http://stackoverflow.com/comment/34041186
type: Comment
comment on: http://stackoverflow.com/a/22390531
has text: The data has a very specific format so the bounds aren't an issue. And returning a double?
type: AnswerComment
score: 0

http://stackoverflow.com/a/22415090
type: AcceptedAnswer
downvote count: 0
has body: You want to do that with a loop counter, let it be i: for (int i = a; i &lt;= z; i++) { //process i } In this way you have i that starts at a and increases up to z.
upvote count: 2
has comment: http://stackoverflow.com/comment/34083018
type: Answer
answers question: http://stackoverflow.com/q/22415053
score: 2
has comment: http://stackoverflow.com/comment/34082971
has comment: http://stackoverflow.com/comment/34083358
accepted answer of: http://stackoverflow.com/q/22415053

http://stackoverflow.com/comment/34042412
type: QuestionComment
score: 0
has text: Why are the animals storing their coordinates at all? (Just asking, seems like they are not really needed). It it valid to assume that they mave not on occupied fields? (A fox moving on a field that is occupied by a hare would make sense ... the other ones... not so much)
type: Comment
comment on: http://stackoverflow.com/q/22391726

http://stackoverflow.com/comment/34131882
type: AnswerComment
comment on: http://stackoverflow.com/a/22439629
score: 0
has text: @user2997369 well stackoverflow is not the place to look for people to do your homework. If you want to learn how to do it, lookup a JFrame tutorial on youtube or search around the questions. There are a lot around this topic (heck even check my questions 2 years back most prob have one like this).
type: Comment

http://stackoverflow.com/q/22465271
answer count: 1
favorite count: 0
tagged with: reference
accepted answer: http://stackoverflow.com/a/22465627
has comment: http://stackoverflow.com/comment/34172303
has body: I have a task inside of my init target that creates a property named "TODAY" : <format property="TODAY" pattern="kk:mm:ss-MM-dd-yyyy" locale="en,US"/> And a property for where I want my built files to reside named "store.dir" : <property name="store.dir" value="target/${TODAY}"/> This is ideally what I want... the store.dir property referring to the TODAY property so that I can retarget where I want my packages to be put by modifying one property instead of going through every single jar task. This doesn't seem to be working though... an echo yields this : [echo] Making dir : target/${TODAY} Am I just using the wrong construct here? If I separate them and put them into the dir paths/etc it seems to resolve the properties fine(as it should). Entire relevant section of my config: <property name="store.dir" value="target/${TODAY}"/> <format property="TODAY" pattern="kk:mm:ss-MM-dd-yyyy" locale="en,US"/> <mkdir dir="bin"/> <mkdir dir="doc"/> Making dir : ${store.dir} <mkdir dir="${store.dir}"/> <exclude name="**/*.launch"/> <exclude name="**/*.java"/> <exclude name="**/*.launch"/> <exclude name="**/*.java"/>
tagged with: properties
has comment: http://stackoverflow.com/comment/34172645
has answer: http://stackoverflow.com/a/22465627
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34172851
tagged with: ant
has title: ant, referring from one property value to another
upvote count: 2

http://stackoverflow.com/q/22447791
tagged with: transactional
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/5936921
has body: This might be a repetitive question for you, but I couldn't find (atleast I couldn't understand) a satisfactory answer, hence asking again. I am working with two data sources (MySQL and Oracle). Following is a flow of execution: Main method-A calls method-B (Which writes into Oracle DB) then it(Method-A) calls method-C (Which writes into mySQL DB) then it(Method-A) calls method-D(Which writes into Oracle DB). If failure occurs at any of place, everything should be rolled back. Currently only changes in Oracle DB are getting rolled back & mySQL DB is not getting rolled back. I have defined two transactional managers. =========> First <========= <tx:annotation-driven transaction-manager="txManager" mode='proxy' proxy-target-class='true’/> ... ORACLE DB Properties <aop:aspectj-autoproxy/> ============================== =========> Second <========= <tx:annotation-driven transaction-manager="txManager2" mode='proxy' proxy-target-class='true'/> <qualifier value="CherryTransaction" /> <aop:aspectj-autoproxy/> ... MYSQL DB Properties ============================== On top of method-A I have used @Transactional annotation On top of method-B I have used @Transactional annotation On top of method-C I have used @Transactional("txManager2") annotation On top of method-D I have used @Transactional annotation Question Is: Why is MySQL changes are not getting rolled back? Is the only way to get this working is to use Global transaction management using JTA? (Its a legacy system, and this is the only place where I need to interact with two DBs) Can you please point me to an example / tutorial where this kind case is handled? Sincerely thanks for reading this!
favorite count: 0
type: Question
has title: Spring transaction management to work with multiple data sources
has answer: http://stackoverflow.com/a/22447983
tagged with: spring
score: 4
answer count: 1
has comment: http://stackoverflow.com/comment/34287671
accepted answer: http://stackoverflow.com/a/22447983
tagged with: java
upvote count: 4

http://stackoverflow.com/comment/34009995
has text: There might not be another workaround for the bug. Maybe you need to discuss this with your performance team as a special case.
comment on: http://stackoverflow.com/q/22373285
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34076768
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22411774
has text: BTW I am connecting to SQL Server 2008 and the link has setting for SQL Server 2012. ?

http://stackoverflow.com/comment/139424792
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22465465
has text: URL protocol is probably `https` !?

http://stackoverflow.com/comment/33947244
type: QuestionComment
comment on: http://stackoverflow.com/q/22337045
has text: @hmashlah Are you suggesting that I learn all of the patterns from that list? Could you suggest more specific ones for the situation I desribed?
score: 0
type: Comment

http://stackoverflow.com/comment/34071189
has text: Thanks for suggestions. Answers to your questions: 1) I do not know what kind of authentication it requires 2) If I enter that URL to my browser I see the popup opening asking me to enter username and password. I enter credentials and then I can see WSDL. And yes, there is probably IP whitelisting so you cannot see this.
type: Comment
comment on: http://stackoverflow.com/a/22408807
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34039534
has text: thanks, JB! the whole day i read the Spring docs and my brain exploded :) so, I asked the question and only after that realized the answer
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22384066
type: AnswerComment

http://stackoverflow.com/q/22459644
has answer: http://stackoverflow.com/a/22463978
favorite count: 0
has comment: http://stackoverflow.com/comment/34162030
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34161443
score: 2
tagged with: netbeans
has body: I tried running the accepted answer in question using netbeans. The class file created but it is not executing. Here is my code import java.io.*; public class Laj { private static void printLines(String name, InputStream ins) throws Exception { String line = null; BufferedReader in = new BufferedReader(new InputStreamReader(ins)); while ((line = in.readLine()) != null) { System.out.println(name + " " + line); } } private static void runProcess(String command) throws Exception { Process pro = Runtime.getRuntime().exec(command); printLines(command + " stdout:", pro.getInputStream()); printLines(command + " stderr:", pro.getErrorStream()); pro.waitFor(); System.out.println(command + " exitValue() " + pro.exitValue()); } public static void main(String[] args) { try { runProcess("javac /home/shibin/NetBeansProjects/JavaApplication3/src/javaapplication3/Main.java"); Thread.sleep(1000); runProcess("java /home/shibin/NetBeansProjects/JavaApplication3/src/javaapplication3/Main"); } catch (Exception e) { e.printStackTrace(); } } } Main.java is just a print statement, public class Main { public static void main(String[] args) { System.out.println("Done"); } } and i am getting error javac /home/shibin/NetBeansProjects/JavaApplication3/src/javaapplication3/Main.java exitValue() 0 java /home/shibin/NetBeansProjects/JavaApplication3/src/javaapplication3/Main stderr: Error: Could not find or load main class .home.shibin.NetBeansProjects.JavaApplication3.src.javaapplication3.Main java /home/shibin/NetBeansProjects/JavaApplication3/src/javaapplication3/Main exitValue() 1
tagged with: java
linked to: http://stackoverflow.com/q/4842684
has answer: http://stackoverflow.com/a/30434473
type: Question
has comment: http://stackoverflow.com/comment/34162692
has answer: http://stackoverflow.com/a/22460394
has title: how to compile & run java program in another java program-netbeans
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/69756430
type: Comment
has text: @rala we can use this everywhere in fragment class
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22544283

http://stackoverflow.com/a/60159755
downvote count: 0
has body: Have you tried using HttpClient instead of WebRequest? I wrote this up with no way to test it so hopefully it's close.... using (HttpClientHandler handler = new HttpClientHandler()) { CookieContainer cookies = new CookieContainer(); handler.CookieContainer = cookies; using (HttpClient httpClient = new HttpClient(handler)) { httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json; charset=UTF-8")); HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Get, m_base_url + "session/login"); requestMessage.Content = new StringContent("{username:xxxxxx,password:yyyyyyy}"); ; HttpResponseMessage loginResponse = await httpClient.SendAsync(requestMessage); // The HttpClient should already have the cookies from the login so // no need to transfer requestMessage = new HttpRequestMessage(HttpMethod.Get, m_base_url + "session/logout"); requestMessage.Content = new StringContent("{}"); HttpResponseMessage logoutResponse = await httpClient.SendAsync(requestMessage); } }
has comment: http://stackoverflow.com/comment/106417452
score: 4
answers question: http://stackoverflow.com/q/22340335
type: Answer
upvote count: 4

http://stackoverflow.com/a/22379685
type: Answer
accepted answer of: http://stackoverflow.com/q/22378854
has comment: http://stackoverflow.com/comment/34182309
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22378854
has comment: http://stackoverflow.com/comment/34155042
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34049810
downvote count: 0
has body: Replace this line breathUpTranslateAnimation.setRepeatMode(Animation.REVERSE);

http://stackoverflow.com/comment/34094250
type: Comment
comment on: http://stackoverflow.com/q/22415916
type: QuestionComment
has text: You don't show us the actual Java code. But #4 is bad coding practice because you rely on implicit data type casting (string to date) which is a bad idea. Anywy in Java use a `PreparedStatement` and instances of `java.sql.Timestamp` or `java.sql.Date` to update a `DATE` column in the database. Don't pass strings for date values.
score: 2

http://stackoverflow.com/comment/34254168
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22484156
has text: You can find getUserRoles presents User.java and getRoleName presents in Role.java
score: 0

http://stackoverflow.com/q/22389004
accepted answer: http://stackoverflow.com/a/22389243
score: 1
tagged with: java
type: Question
has body: In my Android application I have a class that extends Application class and I'm storing some stuff there. Let me just show the code: public class MyApplication extends Application { // Custom class to display toasts public ToastMaker toastMaker = new ToastMaker(); // This class hashes passwords public HashPassword hashPassword = new HashPassword(); // SQLite Database Handler public DBTools dbTools; // Declare the Universal Image Loader for lazy load of images public ImageLoader imageLoader; // Fonts public Typeface font1; public Typeface font2; // Photo Handler custom class containing several methods that deal with images public PhotoHandler photoHandler = new PhotoHandler(this); // Bitmap Options public BitmapFactory.Options bitmapOptions; private static MyApplication singleton; public MyApplication getInstance() { return singleton; } @Override public void onCreate() { super.onCreate(); singleton = this; // Setting up fonts try { font1 = Typeface.createFromAsset(getApplicationContext().getAssets(), C.Fontz.FONT_1); font2 = Typeface.createFromAsset(getApplicationContext().getAssets(), C.Fontz.FONT_2); } catch (Exception e) { e.printStackTrace(); // Nothing can be done here } dbTools = DBTools.getInstance(this); // Create global configuration and initialize ImageLoader with this configuration // https://github.com/nostra13/Android-Universal-Image-Loader ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(this).build(); imageLoader = ImageLoader.getInstance(); imageLoader.init(imageLoaderConfiguration); // Set global bitmap preferences bitmapOptions = new BitmapFactory.Options(); bitmapOptions.inDither = false; bitmapOptions.inPurgeable = true; bitmapOptions.inInputShareable = true; bitmapOptions.inTempStorage = new byte[16 * 1024]; } // End of onCreate And here is how I use something: public MyApplication myApp; myApp = (MyApp) getApplication(); and then, lets say I need some method of the PhotoHandler class myApp.photoHandler.han…
has answer: http://stackoverflow.com/a/22389243
downvote count: 0
has title: Should my global variables, instances and singletons that I have in the Application class be static or not?
has comment: http://stackoverflow.com/comment/34037881
answer count: 3
tagged with: android
favorite count: 0
possible better answer: http://stackoverflow.com/a/22389292
has answer: http://stackoverflow.com/a/22389286
has comment: http://stackoverflow.com/comment/34037759
upvote count: 1
has answer: http://stackoverflow.com/a/22389292
type: AnsweredQuestion

http://stackoverflow.com/comment/34095065
has text: http://stackoverflow.com/questions/420791/what-is-a-good-use-case-for-static-import-of-methods
comment on: http://stackoverflow.com/q/22422108
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34167244
score: 3
has text: The important thing to take away is that it has to be the same instance across all threads.
comment on: http://stackoverflow.com/a/22462838
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22388666
has comment: http://stackoverflow.com/comment/34037005
favorite count: 0
has comment: http://stackoverflow.com/comment/34037202
has comment: http://stackoverflow.com/comment/34036916
has comment: http://stackoverflow.com/comment/34036961
type: AnsweredQuestion
tagged with: object
has body: I'm currently reading the book "Big Java Early Objects". In the section "construction objects in Java" They gave this example below. import java.awt.Rectangle; /** This example demonstrates constructors. */ public class ConstructorDemo { public static void main(String[] args) { // Constructs and prints a rectangle System.out.println(new Rectangle(5, 10, 20, 30)); // Constructs a rectangle and saves it in a variable Rectangle box = new Rectangle(5, 10, 20, 30); System.out.print("box: "); System.out.println(box); // The constructor with no arguments box = new Rectangle(); System.out.print("box: "); System.out.println(box); } } I think this code should print out a Rectangle. But nothing happens, it only prints out this in the Console: java.awt.Rectangle[x=5,y=10,width=20,height=30] box: java.awt.Rectangle[x=5,y=10,width=20,height=30] box: java.awt.Rectangle[x=0,y=0,width=0,height=0] Is something wrong with my Eclipse? How can I make this work?
tagged with: java
has comment: http://stackoverflow.com/comment/34036933
type: Question
has comment: http://stackoverflow.com/comment/34037229
answer count: 2
possible better answer: http://stackoverflow.com/a/22388803
has comment: http://stackoverflow.com/comment/34037681
has answer: http://stackoverflow.com/a/22388803
has answer: http://stackoverflow.com/a/22388912
accepted answer: http://stackoverflow.com/a/22388912
score: 0
has title: Constructing objects in Java
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/34023534
type: Comment
type: QuestionComment
has text: Updated my question with the annotated bean class
score: 0
comment on: http://stackoverflow.com/q/22381239

geotagging
tag name: geotagging
type: Tag
tags question: http://stackoverflow.com/q/22404260

http://stackoverflow.com/q/22373744
downvote count: 1
has comment: http://stackoverflow.com/comment/34010712
has comment: http://stackoverflow.com/comment/34010787
has comment: http://stackoverflow.com/comment/34010663
has answer: http://stackoverflow.com/a/22374259
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
has comment: http://stackoverflow.com/comment/34010893
has comment: http://stackoverflow.com/comment/34010727
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/34010869
has comment: http://stackoverflow.com/comment/34014818
has comment: http://stackoverflow.com/comment/34010552
has comment: http://stackoverflow.com/comment/34010696
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/22373956
has body: Here is Error log: 03-13 10:00:15.778: W/System.err(2558): org.json.JSONException: No value for objects 03-13 10:00:15.778: W/System.err(2558): at org.json.JSONObject.get(JSONObject.java:354) 03-13 10:00:15.778: W/System.err(2558): at org.json.JSONObject.getJSONArray(JSONObject.java:544) 03-13 10:00:15.778: W/System.err(2558): at com.app.Main$ListTask.doInBackground(Main.java:104) 03-13 10:00:15.778: W/System.err(2558): at com.app.Main$ListTask.doInBackground(Main.java:1) 03-13 10:00:15.778: W/System.err(2558): at android.os.AsyncTask$2.call(AsyncTask.java:287) 03-13 10:00:15.778: W/System.err(2558): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 03-13 10:00:15.778: W/System.err(2558): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 03-13 10:00:15.778: W/System.err(2558): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 03-13 10:00:15.778: W/System.err(2558): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 03-13 10:00:15.778: W/System.err(2558): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 03-13 10:00:15.778: W/System.err(2558): at java.lang.Thread.run(Thread.java:856) Activity code package com.app; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.os.AsyncTask; import android.os.Bundle; import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.util.Log; import android.view.Menu; import android.widget.Array…
has title: How to solve JSON Error for Android application ?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34010742
has comment: http://stackoverflow.com/comment/34010835

http://stackoverflow.com/q/22390010
has answer: http://stackoverflow.com/a/22390649
has title: How can I only append only once per line that has a replacement?
tagged with: java
accepted answer: http://stackoverflow.com/a/22390649
tagged with: replace
has comment: http://stackoverflow.com/comment/34040443
type: AnsweredQuestion
tagged with: string
type: Question
has body: I am having trouble just adding "%:" to the lines that replacements occur on. This program goes through the whole alphabet and converts all lower-case letters to upper-case, and upper-case to lower-case. Then, at the end of the file, it is supposed to add "%: a: x:b: y....z: z" where x,y,and z are how many replacements occur on each line. How can I only add the "%:" to lines that have replacements? And also note that there is only one "%:" per line if there is a replacement. Thanks. File file = new File("old.tex"); Scanner scanner = new Scanner(file); PrintWriter writer = new PrintWriter("new.tex"); while(scanner.hasNextLine()){ int numberlc; int numberuc; String line = scanner.nextLine(); line=line+ "%:"; for(char ch='a';ch&lt;='z';ch++){ numberlc=numberOccurances(line, ch); char upperch=Character.toUpperCase(ch); numberuc=numberOccurances(line, upperch); for(int y=0; y&lt;line.length(); y++){ if(line.charAt(y)==ch) line=line.substring(0,y) + upperch + line.substring(y+1); else if(line.charAt(y)==upperch) line=line.substring(0,y) + ch + line.substring(y+1); } if(numberlc&gt;0) line=line + ch + " " + numberlc + ":"; if(numberuc&gt;0) line=line + upperch + " " + numberuc + ":"; } writer.println(line); } writer.close()
score: 0
answer count: 1

http://stackoverflow.com/a/22420583
score: 0
has body: So this can be done in a slightly reversed manner. Create your dictionary d = {word:[] for word in file}. Now: for word in d: for neighbor in edit_distance_1(word): if neighbor in d: d[word].append(neighbor) Now d will be a graph of all words to their edit-distance-1 neighbors. You can trace these edges further to get edit distance 2 words (via other words), which I believe is what you want.
answers question: http://stackoverflow.com/q/22420427
type: Answer

http://stackoverflow.com/comment/34163764
type: Comment
comment on: http://stackoverflow.com/q/22459399
type: QuestionComment
has text: Why would you want to do that? If the assumption that Key.name is a unique attribute ever breaks down you will get unexpected results.
score: 0

http://stackoverflow.com/comment/34093623
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22420988
has text: @JasonC A reference is basically a double pointer (doubled so it can be moved in memory). Assignment of the variable is atomic- all fields update at once because all you're doing is updating a single pointer in memory. It works just fine. Now if the thread that's using it wants to do more than a null check it will need to use more sophisticated locking like wait or a semaphore.

http://stackoverflow.com/a/25174572
score: 0
accepted answer of: http://stackoverflow.com/q/22399768
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22399768
has body: In your mapping, you specified the property cascade with value Cascade.All, which means the ContaBancaria must be inserted/updated/deleted in cascade when the parent entity Proposta is inserted/updated/deleted. The optional attribute set to "true" means that ContaBancaria field in Proposta can be null when inserting or updating, but given that in your case ContaBancaria is not null (but empty), hibernate understands that there is an object (not null) to insert in cascade.

http://stackoverflow.com/q/22481404
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
has body: I'm attempting to make an app for Android and part of it includes the ability for me to convert an array of entries of x,y coordinates in to a character. e.g. if the coordinates form an L shape, it should return the character L. I would assume that something like this exists already as I have seen similar things in other apps, although during my searching I wasn't able to find anything that did what I wanted (or I used the wrong search terms). Does anyone know of any open-source systems that do this, or know of a good method for this? Thanks for any help :)
has answer: http://stackoverflow.com/a/22701225
accepted answer: http://stackoverflow.com/a/22701225
score: -1
has answer: http://stackoverflow.com/a/22481709
has answer: http://stackoverflow.com/a/22482338
tagged with: touch
has title: Java - Convert touch input to text character
answer count: 3
has comment: http://stackoverflow.com/comment/34198732
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34198794
tagged with: android
possible better answer: http://stackoverflow.com/a/22481709
tagged with: text

http://stackoverflow.com/q/22363612
downvote count: 1
has answer: http://stackoverflow.com/a/22364077
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/41998840
tagged with: eclipse
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/33993886
upvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/6881622
tagged with: eclipse-classpath
favorite count: 0
type: UnansweredQuestion
tagged with: java-home
has body: Is it necessary to modify PATH, CLASSPATH, and JAVA_HOME in order to use Eclipse? When writing some code in Eclipse, does one need to change the PATH to add jdk/bin path in Windows environment variables? Does it work if one doesn't set PATH when only developing in Eclipse? Also, are setting CLASSPATH and JAVA_HOME variables likewise needed? If so, why would making these changes be necessary if one only develops java in only Eclipse?
has title: Is it necessary to modify PATH, CLASSPATH, and JAVA_HOME in order to use Eclipse?

http://stackoverflow.com/q/22456653
type: Question
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/34156042
answer count: 1
downvote count: 0
has body: I develop a rest WS that will run on AWS BeanStalk. For the moment, the datasource is configured with property files: database.driverClass=org.postgresql.Driver database.jdbcUrl=jdbc:postgresql://localhost:5432/public database.username=postgres database.password=postgres And in context.xml: &lt;bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"&gt; &lt;property name="driverClass" value="${database.driverClass}" /&gt; &lt;property name="jdbcUrl" value="${database.jdbcUrl}"/&gt; .... But now, I need to have a preprod environnement, using AWS Beanstalk, that expose my system properties like RDS_HOSTNAME, RDS_PORT, RDS_DB_NAME, ... Is there a way to keep the same system, like writing database.jdbcUrl=jdbc:postgresql://#{RDS_HOSTNAME}:#{RDS_PORT}/#{RDS_DB_NAME} In preprod.property? Or to reset database.jdbcUrl with system property in context.xml?
tagged with: amazon-elastic-beanstalk
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
linked to: http://stackoverflow.com/q/7671871
has answer: http://stackoverflow.com/a/22457638
has comment: http://stackoverflow.com/comment/34157759
has comment: http://stackoverflow.com/comment/34156921
has comment: http://stackoverflow.com/comment/34157685
has comment: http://stackoverflow.com/comment/34157336
score: 1
tagged with: java
has title: Overriding properties with System in Spring
has comment: http://stackoverflow.com/comment/34157355

http://stackoverflow.com/q/22475471
possible better answer: http://stackoverflow.com/a/22476952
tagged with: tomcat
has answer: http://stackoverflow.com/a/22536749
tagged with: maven
tagged with: war
tagged with: spring-mvc
type: AnsweredQuestion
has body: I am trying to deploy my war on tomcat 6.I have copied my war to /usr/local/tomcat6/weapps directory. However browsing to localhost:8080/my-app gives me this error: type Exception report message Cannot construct Factory : com.opensymphony.module.sitemesh.factory.DefaultFactory: java.lang.NoSuchMethodException: com.opensymphony.module.sitemesh.factory.DefaultFactory.<init>(com.opensymphony.module.sitemesh.Config) description The server encountered an internal error that prevented it from fulfilling this request. exception com.opensymphony.module.sitemesh.factory.FactoryException: Cannot construct Factory : com.opensymphony.module.sitemesh.factory.DefaultFactory: java.lang.NoSuchMethodException: com.opensymphony.module.sitemesh.factory.DefaultFactory.<init>(com.opensymphony.module.sitemesh.Config) com.opensymphony.module.sitemesh.Factory.getInstance(Factory.java:53) com.opensymphony.sitemesh.webapp.SiteMeshFilter.initContentProcessor(SiteMeshFilter.java:107) com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:54) org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.session.SessionManagementFilter.d…
has title: Tomcat 6 error while deploying spring war
has comment: http://stackoverflow.com/comment/34244012
has answer: http://stackoverflow.com/a/22476952
tagged with: java
has comment: http://stackoverflow.com/comment/34285014
type: Question
has answer: http://stackoverflow.com/a/22592047
accepted answer: http://stackoverflow.com/a/22592047
score: 0
has comment: http://stackoverflow.com/comment/34188704
answer count: 3

java-8
tags question: http://stackoverflow.com/q/22416098
tags question: http://stackoverflow.com/q/22429559
tags question: http://stackoverflow.com/q/22444731
tags question: http://stackoverflow.com/q/22378422
tags question: http://stackoverflow.com/q/22434908
tags question: http://stackoverflow.com/q/22441683
tags question: http://stackoverflow.com/q/22426212
tags question: http://stackoverflow.com/q/22483554
tags question: http://stackoverflow.com/q/22482418
tags question: http://stackoverflow.com/q/22463062
tags question: http://stackoverflow.com/q/22350288
tags question: http://stackoverflow.com/q/22415597
tag name: java-8
tags question: http://stackoverflow.com/q/22357898
tags question: http://stackoverflow.com/q/22485579
tags question: http://stackoverflow.com/q/22345508
tags question: http://stackoverflow.com/q/22375891
type: Tag
tags question: http://stackoverflow.com/q/22382453
tags question: http://stackoverflow.com/q/22379113
tags question: http://stackoverflow.com/q/22435833

http://stackoverflow.com/comment/34036282
comment on: http://stackoverflow.com/a/22363439
type: AnswerComment
has text: No problem. I could just post a whole lot of code, but it wouldn't quite work, because there would be some constants that control the scaling and the amount of rotation. I would need to show you how to tweak those constants to make everything work right, and I'm not sure how to do that in just a single posting. I also don't know how much I need to explain, because I don't know how comfortable you are with trigonometry. I will have some time tomorrow to help you with this, if you're online. Alternatively, you could ask another question, and somebody else might be able to help you.
score: 0
type: Comment

http://stackoverflow.com/comment/34206608
type: Comment
score: 0
type: AnswerComment
has text: You have not explained why you want it in a String so fast so i made an assumption that this was ok. I do understand how to code it without the 0. However, it complicates the code, and makes it slower. E.g. the code pre. allocates the array, so it don't need to check boundaries, and don't need to extend it etc. If you wan't variable length numbers in the output this complicates the logic, therefor making it slower. It's cutting these corners that make above implementation faster than yours.
comment on: http://stackoverflow.com/a/22467332

http://stackoverflow.com/comment/34354517
type: AnswerComment
score: 0
type: Comment
has text: http://db.apache.org/derby/docs/10.5/ref/rrefsetrole.html Check this out. Might be useful!
comment on: http://stackoverflow.com/a/22480786

http://stackoverflow.com/comment/34153340
has text: @user3320956 My bad, you need a java.sql.Date, and DateFormat returns a java.util.Date. Example code updated to account for that.
comment on: http://stackoverflow.com/a/22453634
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33968679
has text: Basically this proxy will act more like router, not doing anything with the request. Even the sample examples for [proxy](http://hc.apache.org/httpcomponents-client-4.2.x/httpclient/examples/org/apache/http/examples/client/ClientExecuteProxy.java) on Apache http client show this usecase of end target being "https" while the proxy being "http". I am not sure how are those cases working.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22344056
type: Comment

http://stackoverflow.com/q/22459613
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22459657
answer count: 4
score: 2
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/72739312
tagged with: testing
has answer: http://stackoverflow.com/a/22508679
has answer: http://stackoverflow.com/a/22466245
upvote count: 2
has title: Generate random but static test data
has body: When designing test cases, I want to be able to use data that is random but static. If I use data that is not random, then I will use trivial examples that are representative of the data I expect, rather than the data I have guarded against in my code. For example, if my code is expecting a string with a max length of 15 characters then I would rather specify these constraints and have the data generated for me, within those constraints, rather than some arbitrary example which may be, due to my expectations, within a more strict set of constraints. If I use data that is not static, then my tests won't be repeatable. It is no good using a string that changes every time the test is run f the test then fails occasionally. It would be much better to use a consistent string and then specify more constraints upon how that string is generated (and obviously make the same checks in my code), if and when a bug is found. Is this a good strategy for test data? If so, then I know how to achieve both of these goals independently. For static, but non-random data I just enter something arbitrary e.g. foo. For something random but not static, I just use apache random utils e.g. randomString(5). How can I get both? Note that when data must be unique, it would also be handy to have some way to specify that two pieces of generated data must be distinct. Randomness does this most of the time but cannot be relied upon, obviously, without having unreliable tests! TL;DR: How can I specify the type of data I want to generate, without having randomised generated data?

http://stackoverflow.com/a/22431409
has body: You're accessing a Resource that couldn't be found, try to illustrate it with this code: InputStream is = getClass().getClassLoader().getResourceAsStream("dictionary.txt"); System.out.println(is == null);
score: 0
has comment: http://stackoverflow.com/comment/34111620
type: Answer
has comment: http://stackoverflow.com/comment/34111609
answers question: http://stackoverflow.com/q/22431392

ibm-mq
tags question: http://stackoverflow.com/q/22355929
tags question: http://stackoverflow.com/q/22387349
type: Tag
tag name: ibm-mq

http://stackoverflow.com/q/22434005
score: 3
tagged with: java
downvote count: 0
favorite count: 0
tagged with: jasypt
has comment: http://stackoverflow.com/comment/79611102
tagged with: bouncycastle
has body: I am using jasypt with the BouncyCastle provider for my encryption and decryption. When I looked into the jasypt code, it does not deal with IV parameters. Does JASYPT use a fixed IV or will BouncyCastle generate a random/fixed IV? If BouncyCastle does that, where can I find the source?
answer count: 0
upvote count: 3
type: UnansweredQuestion
tagged with: encryption
has title: Encryption using bouncy castle without Initialization Vector
type: Question

http://stackoverflow.com/comment/34167119
comment on: http://stackoverflow.com/q/22462668
type: QuestionComment
score: 0
has text: What error do you mean? This is just code.
type: Comment

http://stackoverflow.com/comment/34102031
comment on: http://stackoverflow.com/q/22426222
score: 0
type: Comment
has text: Search for multi tenancy on Google you will find solution for it...
type: QuestionComment

http://stackoverflow.com/comment/34093520
score: 0
type: Comment
has text: yea sorry I missed that. Had applied it to the bullet but not Bob. Ok it seems to work now. I will just do a little more testing and then accept your answer
comment on: http://stackoverflow.com/a/22386803
type: AnswerComment

http://stackoverflow.com/comment/34207337
has text: give http://www.codoid.com/products/view/2/27 a try
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22485769
type: Comment

http://stackoverflow.com/comment/34214575
has text: It's a long time since i was in school but it is to with the representation of real numbers in binary and pivots around the use of 1's complement and 2's compliment method of handling numbers in the machine. In 1's complement the -0 occurs in 2's it is avoided. If you have an HP16c calculator you can switch it to 1's complement and then start subtracting 1's from a number and watch it roll to 1, 0, -0, -1, ... Most disconcerting. But in reality it is just a trick of the light. However makes me wonder even more about Java.
comment on: http://stackoverflow.com/q/22409102
score: 0
type: Comment
type: QuestionComment

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/22486903
tags question: http://stackoverflow.com/q/22359194
tags question: http://stackoverflow.com/q/22332990
tags question: http://stackoverflow.com/q/22350002
tags question: http://stackoverflow.com/q/22388079
tags question: http://stackoverflow.com/q/22480208
type: Tag
tags question: http://stackoverflow.com/q/22480749
tags question: http://stackoverflow.com/q/22405228

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/22427926
tag name: osx-mavericks
tags question: http://stackoverflow.com/q/22346795

http://stackoverflow.com/q/22406776
tagged with: junit
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: http-unit
has title: Junit / HttpUnit poor support on Javascript
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34184250
type: UnansweredQuestion
tagged with: servlets
has body: I have an application where everything starts from a single servlet and then based on some params to initial servlet complete behaviour of application changes, there are lots of things and forwarding which happens until you get response as a HTML. I want to write test cases, where I only change those few initial parameters and get a response either as getText() or getXml() or getHTML(). I used HttpUnit, something like. WebRequest request = new PostMethodWebRequest("http://localhost:9090/xyz/ETransServlet.fsc" ); request.setParameter( "window_id", "1" ); request.setParameter( "screen_id", "4" ); request.setParameter( "nav_to", "something.jsp" ); request.setParameter( "nav_from", "somethingfrom.jsp" ); HttpSession session = sr.getSession(true); WebResponse response = client.getResponse(request);` Now you see I have some parameter set window_id and all. first thing, they are not reaching somehow. secondly, even if I call some page with no params, still it gives error something like can't process script &lt;script&gt; blab bla &lt;/script&gt; It's unable to process javascript code that we are using. I have js.jar and nekohtml.jar in build path and beside I don't want it to validate javascript or html at all. Can anyone tell what's wrong or how to stop javascript to validate or fix it even if it validates or not or some other solution entirely.
has comment: http://stackoverflow.com/comment/34068436

http://stackoverflow.com/a/22413607
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22413259
has body: Use putStringSet() for that: Set&lt;String&gt; quotes = someData.getStringSet("quote_string", new HashSet&lt;String&gt;()); quotes.add(stringData); SharedPreferences.Editor editor = someData.edit(); editor.clear(); editor.putStringSet("quote_string", quotes); editor.commit();

http://stackoverflow.com/comment/34106595
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22428226
has text: I suggest using AsyncHttpClient which has support for http proxies https://github.com/AsyncHttpClient/async-http-client

http://stackoverflow.com/comment/34132634
comment on: http://stackoverflow.com/a/22442019
score: 0
type: AnswerComment
has text: It can create problem if `URL Pattern` are not in same case as defined in `web.xml` and in `RemoteService`.
type: Comment

http://stackoverflow.com/comment/33940925
type: Comment
type: QuestionComment
has text: Thanks a lot all, you guys are right, I should give more specific code. I won't need to though because my question is answered now -- I'll explain under EJP's answer that I will mark as correct.
score: 0
comment on: http://stackoverflow.com/q/22332034

http://stackoverflow.com/comment/34174130
has text: OK thanks. Just out of interest, why is it that sometimes it appears to be working and then others not? Is there a reason behind it, seems pretty random to me at the moment!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22466558

http://stackoverflow.com/comment/34178345
has text: userManager is null. Are you instantiating or injecting it? Show us the full code.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22468766

http://stackoverflow.com/a/22411257
has comment: http://stackoverflow.com/comment/34081149
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22411104
accepted answer of: http://stackoverflow.com/q/22411104
upvote count: 2
has comment: http://stackoverflow.com/comment/34081095
type: AcceptedAnswer
downvote count: 1
has body: Right now you are creating a new buffer for every loop. Depending on your garbage collection some of these may not get recycled/freed from memory and you are then running out. You can call the garbage collector using System.gc() but there is no guarantee that it actually runs at any given time. You could increase the memory allocated to the JVM on the command line when calling your program with the -Xmx and -Xms arguments. Also if you are not on 32bit windows ensure you are using a 64bit JVM as the 32bit has memory limitations that the former does not. Run java -version from the command line to see the current system JVM. You can move the declaration for your byte[] buffer outside your loop (above your while) so that it gets cleared and reused on each iteration. Iterator iter = itemList.keySet().iterator(); numJKLs = 0; byte[] buffer; while (iter.hasNext()) { ... buffer = new byte[] ... ... } How big are the files you are handling? Do you really need to add every one of them to your levels variable? Could you make do with some file info or stats instead? How much RAM has your JVM currently got allocated? To look at the current memory usage at any given time you will need to debug your program as it runs. Look up how to do that for your IDE of choice and you will be able to follow any Object's current state through the program's lifespan.

http://stackoverflow.com/comment/34001923
has text: @user3413471 Right. More formally - every index of the array had null value. When you set an index to a value, it isn't null anymore - it's that value. Point is, whenever you make an array it "initializes" all spaces to null. It just so happens the print function, rather than crashing on a null value, just prints an empty space. Other functions crash or throw the hated NullPointerException - be careful on those nulls!
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22368216
score: 0

http://stackoverflow.com/q/22418284
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/22418364
tagged with: java
type: Question
upvote count: 1
answer count: 1
favorite count: 0
tagged with: javassist
accepted answer: http://stackoverflow.com/a/22418364
has title: Issue while compiling a hello world class using Javassist
has body: I am using Javassist to write a HelloWorld class with main method. When I compile , I get an error as below. I am not sure what's wrong with String[] args in the main method ? javassist.CannotCompileException: [source error] syntax error near "ng[] args)" at javassist.CtNewMethod.make(CtNewMethod.java:78) at javassist.CtNewMethod.make(CtNewMethod.java:44) This is my code public void createClass() { ClassPool cp = ClassPool.getDefault(); CtClass ct = cp.makeClass("HelloClass"); try { CtMethod m = CtNewMethod.make("public void sayHello() { System.out.println(\"Hello World\");}",ct); ct.addMethod(m); String str="public static void main(String[] args)"; CtMethod n = CtNewMethod.make(str,ct); n.setBody("HelloClass a = new HelloClass();a.sayHello();"); ct.addMethod(n); ct.writeFile(); } catch (CannotCompileException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } public static void main(String[] args) { JavaAssistExample inject = new JavaAssistExample(); inject.createClass(); }
type: AnsweredQuestion

http://stackoverflow.com/comment/34148225
score: 0
comment on: http://stackoverflow.com/q/22451915
type: Comment
has text: if i use english no use
type: QuestionComment

http://stackoverflow.com/comment/34029762
score: 0
has text: A JDK contains the JRE...
comment on: http://stackoverflow.com/q/22384503
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22368759
tagged with: java
upvote count: 1
type: Question
has title: In Joda-time 2.1 does the long passed to DateTimeZOne.getStandardOffset matter?
tagged with: jodatime
accepted answer: http://stackoverflow.com/a/22368820
answer count: 1
downvote count: 0
favorite count: 0
tagged with: time
type: AnsweredQuestion
has body: I'm using Joda-time and I'm doing something like this: DateTimeZone timeZone = &lt;Code that gets a TimeZone instance&gt; int offset = timeZone.getStandardOffset(new Date().getTime()); I'm wondering why the call to timezone.getStandardOffset() requires that a number of milliseconds be passed in. My suspicion is that this is to take into account historical variations in a time zone's offset? (e.g. we need to account for that crazy day back in 2005 when Mr. Bush decided that central time would be UTC+13 for just that day, since 13 is a bigger number than -2) Is this correct?
has answer: http://stackoverflow.com/a/22368820
score: 1

http://stackoverflow.com/comment/33934327
type: Comment
type: QuestionComment
has text: do you realize that you have a space between Joke and 7 ?
comment on: http://stackoverflow.com/q/22329548
score: 0

http://stackoverflow.com/q/22344378
has comment: http://stackoverflow.com/comment/33960802
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33959992
has answer: http://stackoverflow.com/a/22344465
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33959950
has body: I created a java web application. In which i created program to resize and upload photos. This stored in a specific folder. When I changes the Photo it doesn't change and remains the old photo. But after restarting the TomCat I can change the photo. Why would this happen? Here is the code to resize and store image public static int createThumbnailNew(String original, String resized, int maxSize) { try { File originalFile = new File(original); ImageIcon ii = new ImageIcon(originalFile.getCanonicalPath()); Image i = ii.getImage(); int iWidth = i.getWidth(null); int iHeight = i.getHeight(null); BufferedImage originalImage = new BufferedImage( i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_RGB); // Copy image to buffered image. Graphics g = originalImage.createGraphics(); // Clear background and paint the image. g.setColor(Color.white); g.fillRect(0, 0, i.getWidth(null), i.getHeight(null)); g.drawImage(i, 0, 0, null); g.dispose(); BufferedImage bufferedImage = null; if (iWidth &gt; iHeight) { bufferedImage = resizeImage(originalImage, BufferedImage.TYPE_INT_RGB,(maxSize * iHeight)/iWidth,maxSize); } else { bufferedImage = resizeImage(originalImage, BufferedImage.TYPE_INT_RGB,maxSize,(maxSize * iWidth) / iHeight); } //BufferedImage croppedImage=cropImage(bufferedImage,crX,crY,crH,crW); File file = new File(resized); FileOutputStream out = new FileOutputStream(file); /* encodes image as a JPEG data stream */ JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); com.sun.image.codec.jpeg.JPEGEncodeParam param = encoder .getDefaultJPEGEncodeParam(bufferedImage); // writeParam = new JPEGImageWriteParam(null); // writeParam.setCompressionMode(JPEGImageWriteParam.MODE_EXPLICIT); // writeParam.setProgressiveMode(JPEGImageWriteParam.MODE_DEFAULT); param.setQuality(1.0f, true); encoder.setJPEGEncodeParam(param); encoder.encode(bufferedImage); } catch(Exception e) { return -1; } return 0; } private static BufferedImage resizeImage(BufferedImage originalImage, in…
tagged with: image
score: 0
answer count: 1
has title: Image file doesn't overwrite unless restart the TomCat
tagged with: tomcat

http://stackoverflow.com/q/22331808
tagged with: java
tagged with: inputstream
score: 0
answer count: 1
has title: Monitoring progress of input stream in command line
tagged with: progress
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22331921
accepted answer: http://stackoverflow.com/a/22331921
type: Question
has body: I am reading a large text file from internet into string and I would like to display some sort of progress. Normally I would use ProgressMonitorInputStream but this program is running strictly in command line so this is not an option. Is there any easy way to get some sort of percentage, bytes remaining or any other kind of feedback? This is my code: URL inUrl = new URL(*URL to be red*); InputStream inStream=inUrl.openStream(); BufferedReader in=new BufferedReader(new InputStreamReader(inStream,Charset.forName("UTF-8"))); while(in.ready()){ string=string+in.readLine(); } in.close();

http://stackoverflow.com/comment/34186841
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22473576
has text: My suggestion is use bouncycastle frame work

http://stackoverflow.com/q/22441748
has answer: http://stackoverflow.com/a/22442554
has title: Adding Noise to a PGM image using 2D arrays and for loops?
tagged with: pgm
type: AnsweredQuestion
tagged with: 2d
tagged with: java
type: Question
tagged with: arrays
accepted answer: http://stackoverflow.com/a/22442554
score: 0
has body: I have an assignment and I am trying to create noise within an image similarly to how I did here: public static short[][] brighten(short[][] orig, short amount) { short[][] returnArray = new short[orig.length][orig[0].length]; for(int i = 0; i &lt; orig.length; ++i){ for(int j = 0; j &lt; orig[0].length; ++j){ returnArray[i][j] = (short)(orig[i][j]+amount); } } return returnArray; } The instructions: public short[][] Noise(short[][], short) - Is passed a 2D array of shorts which represents an image and another short which is the quantity of noise to add or subtract from the image. -Returns a 2D array of shorts which is the darkened image -For each item in the array, randomly either add or subtract a random value up to the short parameter
answer count: 1
tagged with: noise

http://stackoverflow.com/a/22569956
has comment: http://stackoverflow.com/comment/34431419
has comment: http://stackoverflow.com/comment/34431285
has body: This looks like it could be a good case for some AOP. First start by creating a custom field annotation @CustomSequenceGeneratedValue, and then annotate the field on the entity with it: public class MyEntity { ... @CustomSequenceGeneratedValue private Long generatedValue; public void setGeneratedValue(long generatedValue) { } } Then an aspect is created to increment generated values: @Aspect public class CustomSequenceGeneratedValueAspect { @PersistenceContext private EntityManager em; @Before("execution(* com.yourpackage.dao.SomeDao.*.*(..))") public void beforeSaving(JoinPoint jp) throws Throwable { Object[] args = jp.getArgs(); MethodSignature ms = (MethodSignature) jp.getSignature(); Method m = ms.getMethod(); Annotation[][] parameterAnnotations = m.getParameterAnnotations(); for (int i = 0; i &lt; parameterAnnotations.length; i++) { Annotation[] annotations = parameterAnnotations[i]; for (Annotation annotation : annotations) { if (annotation.annotationType() == CustomSequenceGeneratedEntity.class) { ... find generated properties run query and call setter ... ... Query query = em.createNativeQuery("select MY_SEQUENCE.NEXTVAL from dual"); } } } } } Then the aspect is scanned with &lt;aop:aspectj-autoproxy /&gt;, and applied to any Spring DAO saving entities of this type. The aspect would populate the sequence generated values based on a sequence, in a transparent way for the user.
has comment: http://stackoverflow.com/comment/34419737
downvote count: 0
answers question: http://stackoverflow.com/q/22486446
type: Answer
has comment: http://stackoverflow.com/comment/34432052
score: 3
upvote count: 3

http://stackoverflow.com/comment/34148384
score: 0
type: AnswerComment
has text: Of course, if bufferedReader is not null No NullPointerException should throw.
type: Comment
comment on: http://stackoverflow.com/a/22451567

jsr356
tag name: jsr356
type: Tag
tags question: http://stackoverflow.com/q/22435622

http://stackoverflow.com/comment/34089768
score: 0
type: AnswerComment
has text: @Braj is working on windows but not on mac.. why is that?? maybe that has been the problem all this time..
type: Comment
comment on: http://stackoverflow.com/a/22418211

http://stackoverflow.com/comment/34182432
type: Comment
type: QuestionComment
has text: `0.00001` is the same as `1.0e-5` and is not represented exactly in IEEE754. http://floating-point-gui.de/
score: 4
comment on: http://stackoverflow.com/q/22471643

http://stackoverflow.com/comment/34085590
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22416545
has text: Whoops, my mistake, you're right. Is it possible to use enums here?
type: AnswerComment

http://stackoverflow.com/comment/34131378
comment on: http://stackoverflow.com/q/22442118
score: 0
type: Comment
type: QuestionComment
has text: I think you need to study more about layout managers. The default layout manager for a JPanel is FlowLayout, you don't seem to have changed it...

http://stackoverflow.com/comment/86116694
type: Comment
has text: Please mention that this dependency needs to be the first one.
score: 6
type: AnswerComment
comment on: http://stackoverflow.com/a/22409655

http://stackoverflow.com/q/22351467
downvote count: 0
has body: The question was to generate random numbers between 1 and 99 using a thread. However the problem here is I don't know where does the "main thread is stopping" coming from? Doesn't the main thread die in the end? This is the sample output: Main thread stopping Random no = 57 Random no = 47 Random no = 96 Random no = 25 Random no = 74 Random no = 15 Random no = 46 Random no = 90 Random no = 52 Random no = 97 Thread that generates random nos is stopping Mythread class: public class MyThread extends Thread { MyThread() { // default constructor } MyThread(String threadName) { super(threadName); // Initialize thread. start(); } public void run() { // System.out.println(Thread.currentThread().getName()); Random rand = new Random(); int newValue; for (int i = 0; i &lt; 10; i++) { newValue = rand.nextInt(99);// generates any vale between 1 to 99 System.out.println("Random no = " + newValue); } System.out.println("Thread that generates random nos is stopping"); } } Main class: public class HW5ex2a { public static void main(String[] args) throws InterruptedException { MyThread t = new MyThread(); t.start(); t.join();// wait for the thread t to die System.out.println("Main thread stopping"); } }
tagged with: java
score: 7
has comment: http://stackoverflow.com/comment/33974766
type: Question
has comment: http://stackoverflow.com/comment/33972229
has comment: http://stackoverflow.com/comment/33972447
has comment: http://stackoverflow.com/comment/33972273
answer count: 3
upvote count: 7
has answer: http://stackoverflow.com/a/22352117
has comment: http://stackoverflow.com/comment/33972107
has comment: http://stackoverflow.com/comment/33972927
has answer: http://stackoverflow.com/a/22353496
favorite count: 0
has title: when does the main thread die?
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/22351596
linked to: http://stackoverflow.com/q/9467759

http://stackoverflow.com/a/68799050
has body: The main logic is to ensure relevant uniqueness. You can use any parameter if the parameter value will change in every request...Shortly, you can use date or long or another type... JobParameters jobParameters = new JobParametersBuilder() .addString("YOUR_PARAM1", "VALUE-1") .addString("YOUR_PARAM2", "VALUE-2") .addLong("time",System.currentTimeMillis()) .toJobParameters(); The following code block will provide the uniqueness for your request. .addLong("time",System.currentTimeMillis())
answers question: http://stackoverflow.com/q/22455739
upvote count: 5
score: 5
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34023319
score: 0
type: Comment
has text: For a specific number, multiplication by 11 can increase the number by 2 digits instead of just 1. Not sure if OP needs to go that high though. Still a thing worth considering :)
type: AnswerComment
comment on: http://stackoverflow.com/a/22381254

http://stackoverflow.com/comment/34989631
type: QuestionComment
type: Comment
has text: Because that does not do what I want.
score: 0
comment on: http://stackoverflow.com/q/22332198

http://stackoverflow.com/a/22356657
answers question: http://stackoverflow.com/q/22356470
downvote count: 0
has comment: http://stackoverflow.com/comment/33981154
type: AcceptedAnswer
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22356470
has body: Your variables Name, Flip, and SuitNumber should not be static. Otherwise, there's only one Name, Flip and SuitNumber for all your instances. By the way, they should also start with a lowercase letter, but that's not related with the problem.

http://stackoverflow.com/comment/34014545
comment on: http://stackoverflow.com/a/22375240
score: 0
type: AnswerComment
type: Comment
has text: ok i have put that in my post execute and the blank screen is loading but for some reason it is not refreshing This is in my on create: aa = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, users); and this is in my post exectue: aa.notifyDataSetChanged();

http://stackoverflow.com/q/22395095
has body: I'm developing a websocket application by using Netty. I'd like to know if a message is really delivered from a source to a destination. In particular, let's assume that a client and a server have an open channel and exchange some messages for a while. At a certain point, the client goes down, but the channel is still active in Netty. I tried to use isReachable() before sending the message, but this method seems to be buggy in some scenarios (e.g. a machine with Win7 is up, but isReachable() returns false). Now, my idea is to implement a mechanism using ACKs, namely the server sends the message and the client sends back an ack. To do that, I need a timeout to see if, after a certain interval, the corresponding ack does not arrive. Is there something similar in Netty?
has title: How to check if a message is really delivered in Netty using websocket?
score: 0
answer count: 1
tagged with: netty
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21677864
tagged with: java
tagged with: timeout
has answer: http://stackoverflow.com/a/22400975
type: Question
tagged with: client-server
accepted answer: http://stackoverflow.com/a/22400975
tagged with: websocket

http://stackoverflow.com/q/22422506
downvote count: 0
has answer: http://stackoverflow.com/a/22422673
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/22422673
accepted answer: http://stackoverflow.com/a/22422609
type: AnsweredQuestion
has body: Hi I'm new in Android Development. I have doing a lot of research . Everything go rights however there is no any output sound from the text I entered. Did I miss out any important part ? The following bellow is the coding : public class SpeechTextActivity extends Activity implements OnInitListener { private int MY_DATA_CHECK_CODE = 0; private TextToSpeech tts; private EditText inputText; private Button speakButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_speech); inputText = (EditText) findViewById(R.id.edit_speechText); speakButton = (Button) findViewById(R.id.btn_speechOut); speakButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String text = inputText.getText().toString(); if (text!=null &amp;&amp; text.length()&gt;0) { Toast.makeText(SpeechTextActivity.this, "Saying: " + text, Toast.LENGTH_LONG).show(); tts.speak(text, TextToSpeech.QUEUE_ADD, null); } } }); Intent checkIntent = new Intent(); checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); startActivityForResult(checkIntent, MY_DATA_CHECK_CODE); } protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == MY_DATA_CHECK_CODE) { if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) { // success, create the TTS instance tts = new TextToSpeech(this, this); } else { // missing data, install it Intent installIntent = new Intent(); installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA); startActivity(installIntent); } } } @Override public void onInit(int status) { if (status == TextToSpeech.SUCCESS) { Toast.makeText(SpeechTextActivity.this, "Text-To-Speech engine is initialized", Toast.LENGTH_LONG).show(); } else if (status == TextToSpeech.ERROR) { Toast.makeText(SpeechTextActivity.this, "Error occurred while initializing Text-To-Speech engine", Toast.LENGTH_LONG).show(); } } } Just now I test in my tablet it work! …
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34095997
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34095735
has answer: http://stackoverflow.com/a/22422609
answer count: 2
has title: Android java : Text-to-Speech no sound

http://stackoverflow.com/a/25202046
has comment: http://stackoverflow.com/comment/118765317
upvote count: 9
downvote count: 0
answers question: http://stackoverflow.com/q/22360730
score: 9
has body: This particular error can also be caused by an INSERT-trigger, which has a SELECT-statement as a part of the trigger code. To test whether this is the case, you can try: using executeQuery(), instead of executeUpdate() - and display the result. executing the insert in tool like MySQL Workbench, SQL Server Management Studio, or whatever flavour of database design tools are available for your DBMS, to see whether a result is returned. Related: sql server error "A result set was generated for update" I'm hoping this may help others looking at the same error message, as it did for me. My solution was to live with a call to executeQuery(), although it only handles an underlying issue, instead of fixing it.
type: Answer

http://stackoverflow.com/comment/34113817
type: Comment
type: AnswerComment
has text: If i take example of creating user at http://techmytalk.com/2013/06/22/restful-webservices-with-jersey/, here client is having User info object in advance. looks like here producer provided User Info object to consumer manually. Is it the only way ? If yes its too cumbersome . Is n't it? Can you tell me if i am new consumer of this create user service how should i proceed if there is no WSDL or WADL?
score: 0
comment on: http://stackoverflow.com/a/22427794

http://stackoverflow.com/comment/34036152
has text: That approach would be a lot cleaner with a regular expression, e.g. ```\d+\.\d{2}```
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22367295

http://stackoverflow.com/comment/34158822
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22441671
has text: Use a profiler like `JVisualVM`. It will tell you both, total execution time and actual running time. The difference is obviously the blocked time.
score: 0

3d
tags question: http://stackoverflow.com/q/22360173
tags question: http://stackoverflow.com/q/22347445
type: Tag
tags question: http://stackoverflow.com/q/22380807
tag name: 3d
tags question: http://stackoverflow.com/q/22340313
tags question: http://stackoverflow.com/q/22452572

http://stackoverflow.com/a/22487703
score: 1
has body: What you are looking for is the schema describing your JSON. There is a jackson module for just this. It can be used like below: Objects: class Entity { private Long id; private List&lt;Profile&gt; profiles; // getters/setters } class Profile { private String name; private String value; // getters / setters } Code to generate schema: import java.io.IOException; import java.util.List; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.module.jsonSchema.JsonSchema; import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper; public class JacksonProgram { public static void main(String[] args) throws IOException { ObjectMapper mapper = new ObjectMapper(); SchemaFactoryWrapper visitor = new SchemaFactoryWrapper(); mapper.acceptJsonFormatVisitor(Entity.class, visitor); JsonSchema schema = visitor.finalSchema(); System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(schema)); } } Output: { "type" : "object", "properties" : { "id" : { "type" : "integer" }, "profiles" : { "type" : "array", "items" : { "type" : "object", "properties" : { "name" : { "type" : "string" }, "value" : { "type" : "string" } } } } } } Source: Create JSON schema from Java class
upvote count: 1
has comment: http://stackoverflow.com/comment/34214254
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22487138
answers question: http://stackoverflow.com/q/22487138
type: Answer

http://stackoverflow.com/a/22393681
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34045822
has comment: http://stackoverflow.com/comment/34045868
answers question: http://stackoverflow.com/q/22393560
type: Answer
has body: or if your # is always at the beginning of the string: EDIT: while((line = rf.readLine()) != null) { if(line.charAt(0)=='#'){ scan.nextLine(); //use it to suit your need.. //alert the program to prepare for new type of object //do something.. }else { split = scan.nextLine().split(", "); pnumber = Integer.parseInt(split[0]); name = split[1]; age = Integer.parseInt(split[2]); thePerson = new Person(name, age, pnumber); personList.addLast(thePerson); } }
score: 1
has comment: http://stackoverflow.com/comment/34045908
has comment: http://stackoverflow.com/comment/34045925
accepted answer of: http://stackoverflow.com/q/22393560
upvote count: 1

http://stackoverflow.com/q/22392730
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22408280
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/tar
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/34048462
has comment: http://stackoverflow.com/comment/34048311
tagged with: android
has answer: http://stackoverflow.com/a/22408280
tagged with: android-studio
has title: How can I untar a file in an android app?
has body: I have a ".tar" file that my app downloads and I can't figure out how to extract it. I've tried reading it with ZipInputStream, but getNextEntry() returns null even though I can confirm through terminal that the tar file exists. I've been able to untar it manually so I know it's not an issue with the file. Does anyone have any ideas? Thanks for the help!

http://stackoverflow.com/a/22447453
has comment: http://stackoverflow.com/comment/34141059
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22447246
score: 9
accepted answer of: http://stackoverflow.com/q/22447246
has body: Is there a specific reason you are asking for a more efficient solution? Unless this functionality sits in a very tight inner loop somewhere (e.g. in a ray tracer), you might be trying to prematurely optimize your code. If you would like to avoid the array, and if you don't like the "bloat" of an if-statement, you can use the ternary choice operator to pick between the two: int a = 35; int b = 70; int c = random.nextBoolean() ? a : b; where random is an instance of java.util.Random. You can store this instance as a final static field in your class to reuse it. If you don't require true randomness, but just want to switch between the two numbers in each invocation of the given block of code, you can get away with just storing a boolean and toggling it: ... int c = toggle ? a : b; toggle = !toggle; Since I can't comment on other answers, I'd like to point out an issue with some of the other answers that suggest generating a random integer in a bigger range and making a decision based on whether the result is odd or even, or if it's lower or greater than the middle value. This is in effect the exact same thing as generating a random integer between 0 and 1, except overly complicated. The nextInt(n) method uses the modulo operator on a randomly generated integer between -2^31 and (2^31)-1, which is essentially what you will be doing in the end anyway, just with n = 2. If you are using the standard library methods like Collections.shuffle(), you will again be overcomplicating things, because the standard library uses the random number generator of the standard library. Note that all of the suggestions (so far) are less efficient than my simple nextBoolean() suggestion, because they require unnecessary method calls and arithmetic.
type: AcceptedAnswer
upvote count: 9
has comment: http://stackoverflow.com/comment/34141217

http://stackoverflow.com/comment/34148939
score: 1
type: Comment
type: QuestionComment
has text: Java is always signed. No unsigned types in Java
comment on: http://stackoverflow.com/q/22452609

http://stackoverflow.com/a/22487534
has body: Instead of use setOnKeyPressed, now I'm using addEventFilter: private void adicionarProcessadorEventoEnterPressionado(Node elemento) { if(elemento instanceof Pane){ Pane painel= (Pane) elemento; for(Node filho :painel.getChildren()){ if(filho instanceof TextField || filho instanceof ComboBox || filho instanceof CheckBox || filho instanceof DatePicker || filho instanceof BigDecimalField) filho.addEventFilter(KeyEvent.KEY_PRESSED,processadorEnterEmCampo); else if(filho instanceof Button) filho.setOnKeyPressed(processadorEnterEmBotao); else adicionarProcessadorEventoEnterPressionado(filho); } } } As I was suspecting that the implementation of the components was consuming the event before it gets to the handler, addEventFilter was the best bet: The filter is called when the node receives an Event of the specified type during the capturing phase of event delivery.
accepted answer of: http://stackoverflow.com/q/22480551
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22480551
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34203259
has text: @ohtph, works fine for me, I guess you specified the "identifier" incorrectly. The other approach is to get the column from the TableColumnModel. See edit 2.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22482543
type: Comment

http://stackoverflow.com/a/22394177
type: Answer
has comment: http://stackoverflow.com/comment/34099385
has comment: http://stackoverflow.com/comment/34059347
has body: Download and install a fresh copy of Eclipse IDE Java EE Developers and then install the plugin as you did in Eclipse (Help > Install new software) and you wouldn't have a problem. The GWT plugin includes the GWT Designer for the graphic editing. EDIT In order to see if you have GWT Designer installed try: 1) Create a GWT project. 2) Right click on the src package and create a UiBinder file. That will create two files : a Java file et an XML file. 3) Right click on the XML file : Open With > WindowsBuilder Editor.
has comment: http://stackoverflow.com/comment/34068538
has comment: http://stackoverflow.com/comment/34047297
has comment: http://stackoverflow.com/comment/34048039
answers question: http://stackoverflow.com/q/22393823
score: 0
has comment: http://stackoverflow.com/comment/34088740

http://stackoverflow.com/q/22434377
has comment: http://stackoverflow.com/comment/34118286
tagged with: sdk
has comment: http://stackoverflow.com/comment/34118112
has body: I am coding a JAVA project and I want to create an SDK to be used with Eclipse. How could I build one? My project is actually a backbone of 20+ functions. I want to provide and SDK for the developers to develop above this backbone, just like how developers use ANDROID SDK. So how can I make an SDK?
favorite count: 0
has title: How to Build an SDK for my application?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34116772
downvote count: 1
has comment: http://stackoverflow.com/comment/34120641
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34117968
has comment: http://stackoverflow.com/comment/34117389
tagged with: eclipse
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/834763
answer count: 1
has answer: http://stackoverflow.com/a/22435227

http://stackoverflow.com/comment/70687341
type: Comment
comment on: http://stackoverflow.com/q/22439208
score: 0
has text: FuePi im using ubuntu with oracle xe and java 1.7
type: QuestionComment

http://stackoverflow.com/q/22472357
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22473909
accepted answer: http://stackoverflow.com/a/22473909
has title: How to Bind Port In java Class
favorite count: 0
has comment: http://stackoverflow.com/comment/34186547
has comment: http://stackoverflow.com/comment/34186312
tagged with: sockets
tagged with: swing
has comment: http://stackoverflow.com/comment/34185931
has comment: http://stackoverflow.com/comment/34215968
type: AnsweredQuestion
tagged with: serversocket
has comment: http://stackoverflow.com/comment/34230452
score: 1
has comment: http://stackoverflow.com/comment/34186682
tagged with: java
has comment: http://stackoverflow.com/comment/34185944
type: Question
has body: I am using Swing and now i want to Allocate one Special port for the Java class which is running in my swing. so how do i bind that port so every time when user run that so there wont be creating new object it will show message that process is already running!! I need to Bind that port to the Process how to do it? Socket s = new Socket(); s.bind(new InetSocketAddress(9000)); i have bind this address but how to bind it in current class object.?
upvote count: 2
has comment: http://stackoverflow.com/comment/34184965

http://stackoverflow.com/comment/33982773
comment on: http://stackoverflow.com/q/22357535
score: 3
type: Comment
type: QuestionComment
has text: Have you tried `System.out.println`? It's not the same as stepping through with a debugger but it's much better than just staring at a blank console...

http://stackoverflow.com/comment/34164994
has text: What you have is fine. You could extract the `BufferedReader` reading to a static helper method and re-use that. Some 3rd party libraries already do that.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22461663
type: Comment

http://stackoverflow.com/comment/34111050
has text: It will "take" the integer part and show you the equivalent ASCII character. Try this code to see the results :) double y=85.7; System.out.println(y+"= "+(char)y); System.out.println((char)85);
type: Comment
comment on: http://stackoverflow.com/a/22430011
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34048020
comment on: http://stackoverflow.com/a/22395102
has text: Thank you. I should pay more attention next time.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22382262
has comment: http://stackoverflow.com/comment/34025296
type: Question
tagged with: try-catch
has body: So I have the following code: import java.io.*; public class Plagiarism { public static void main(String[] args) { Plagiarism myPlag = new Plagiarism(); if (args.length == 0) { System.out.println("Error: No files input"); } else if (args.length &gt; 0) { try { for (int i = 0; i &lt; args.length; i++) { BufferedReader reader = new BufferedReader (new FileReader (args[i])); simplify (reader); reader.close(); } } catch (Exception e) { System.err.println ("Error reading from file"); } } } public static void simplify(BufferedReader input) throws IOException { String line = null; line = input.readLine(); while (line != null) { line = line.replaceAll ("[^a-zA-Z0-9 ]", ""); line = line.toLowerCase(); } } } The problem with this code is that it compiles, but when i run it and add in the 2 arguments in command line eg. Java Plagiarism text1.txt text2.txt. EDIT: When I run this it just doesn't do anything or even finish, it's like it's stuck somewhere. Thanks for any help.
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22382529
answer count: 2
downvote count: 0
tagged with: bufferedreader
favorite count: 0
has comment: http://stackoverflow.com/comment/34025137
has comment: http://stackoverflow.com/comment/34025119
has comment: http://stackoverflow.com/comment/34025125
has title: Java BufferedReader FileReader issue
possible better answer: http://stackoverflow.com/a/22382529
tagged with: filereader
has answer: http://stackoverflow.com/a/22382397
accepted answer: http://stackoverflow.com/a/22382397
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34025342
upvote count: 1

http://stackoverflow.com/comment/34064392
comment on: http://stackoverflow.com/a/22400439
score: 1
type: AnswerComment
has text: @Achraf Check out the members of the Java Card Forum for a list of companies manufacturing the Java Card OS. Of course you may have to deal with a reseller instead.
type: Comment

http://stackoverflow.com/comment/34020758
type: AnswerComment
type: Comment
has text: I declared those fields as final because I do not expect them to change. You cannot assign a value to a final field after it has been assigned once, additionally you have to assign the value in a static context, or in the constructor. Generally for this code it does not make much of a difference, but for a more complex code marking fields as final can be a big help. On one side because you can be sure that the field has been assigned a value and you can be sure that nobody can change that value.
score: 0
comment on: http://stackoverflow.com/a/22377322

http://stackoverflow.com/a/22458048
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22444174
has body: I don’t think we can use shell script debugger in the Java debugger session. i.e you need to debug java code and shell script code separately in separate debug sessions. You can use basheclipse to debug shell script, this will only work with shell script editor ShellEd. Also check the open tickets for debugging in ShellEd. Note Outside eclipse you can try http://bashdb.sourceforge.net/

http://stackoverflow.com/comment/34078302
type: Comment
has text: I also put a print command before `FileWriter fw = new...` and it doesn't print anything... I also tried to remove the if statement, but no luck...`What is a "stacktrace"?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22411958

http://stackoverflow.com/comment/34045821
type: Comment
comment on: http://stackoverflow.com/a/22392335
score: 1
has text: You can't assume anything that isn't specifically stated in the Javadoc.
type: AnswerComment

http://stackoverflow.com/a/22611589
has comment: http://stackoverflow.com/comment/34440218
has comment: http://stackoverflow.com/comment/34437373
has comment: http://stackoverflow.com/comment/34437282
answers question: http://stackoverflow.com/q/22402058
has body: This error happens when you compile your project with a higher API version than some of your required classes, your target is API 18, but as Guillaume sais, when you use AutoCloseable you're trying to load a class which is not added until API 19. So your application crashes at runtime. You need to modify your minSDK version of your project or consider an alternative.
has comment: http://stackoverflow.com/comment/34438777
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34437907

http://stackoverflow.com/q/22380496
has answer: http://stackoverflow.com/a/22383625
tagged with: ebean
type: AnsweredQuestion
has title: Playframework Ebean.Save() gives Connection Closed
tagged with: java
type: Question
upvote count: 4
score: 4
accepted answer: http://stackoverflow.com/a/22383625
tagged with: playframework
answer count: 1
downvote count: 0
has body: I have a play framework with a simple Address model but upon calling ebean's #save() method I get the following errors. The database is configured correctly I think (I can read models without a problem). My unit tests which run on a in-memory H2 database work fine. Code: Address address = new Address(street, postalcode, location); address.save(); Play output: [error] c.j.b.ConnectionHandle - Database access problem. Killing off this connection and all remaining connections in the connection pool. SQL State = HY000 [error] play - Cannot invoke the action, eventually got an error: javax.persistence.PersistenceException: java.sql.SQLException: Connection is closed! Address class @Entity public class Address extends Model { @Id public int id; public String postalcode; public String street; public String location; @OneToMany(cascade= CascadeType.ALL) public List&lt;Estate&gt; estates; public Address(String street, String postalcode, String location){ this.postalcode = postalcode; this.street = street; this.location = location; } public Address(int id, String street, String postalcode, String location){ this.id = id; this.postalcode = postalcode; this.street = street; this.location = location; } public static Finder&lt;Integer,Address&gt; find = new Finder&lt;Integer, Address&gt;( Integer.class, Address.class ); }
tagged with: playframework-2.2
favorite count: 0

http://stackoverflow.com/comment/34087949
comment on: http://stackoverflow.com/q/22415022
type: Comment
type: QuestionComment
score: 0
has text: If you did not start it then its not started. Check documentation : http://my.safaribooksonline.com/book/databases/hadoop/9781449326944/16dot-hive-thrift-service/_starting_the_thrift_server_html

http://stackoverflow.com/q/22371668
answer count: 1
has comment: http://stackoverflow.com/comment/34015501
type: UnansweredQuestion
tagged with: oracle-adf
tagged with: jdeveloper
has answer: http://stackoverflow.com/a/22407171
tagged with: java
has body: For a project, I need to create a table to read the data from user in UI..and just need to create an XML document from these values which I want to do via calling a method...there is no back end DB for this... What I have done is create a Entity object without existing Schema Object and created an view object from that Entity object.... But when I am running it, it gives an error..."View or table does not exist".. What is wrong with this approach? or can anyone suggest me a better approach for this..
has comment: http://stackoverflow.com/comment/34012866
has comment: http://stackoverflow.com/comment/34101614
type: Question
has title: ADF table from View Object without backend Database
score: 0

http://stackoverflow.com/q/22437470
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34122186
type: Question
has title: How to collect variables from a tree formula
upvote count: 1
favorite count: 0
has body: The question title might be poorly expressed, so I'm sorry for that. I am representing a propositional logic formula as a tree in Java, like so: abstract class Formula { } final class AndFormula extends Formula { private Formula leftChild, rightChild; public AndFormula(Formula leftChild, Formula rightChild) { this.leftChild = leftChild; this.rightChild = rightChild; } // add some getters... } final class OrFormula extends Formula { private Formula leftChild, rightChild; public OrFormula(Formula leftChild, Formula rightChild) { this.leftChild = leftChild; this.rightChild = rightChild; } // add some getters... } final class AtomicFormula extends Formula { private String name; public AtomicFormula(String name) { this.name = name; } // add some getters... } Now let's say I want to collect the names of atomic formulas in a very particular way: I only want names of atomic formulas which never appear on the right hand side of an OrFormula. I have the following: public static Set&lt;String&gt; specialVars(Formula f) { Set&lt;String&gt; ans = new HashSet&lt;String&gt;(); if( f.getClass() == AndFormula.class ) { // Recursively add all special vars from the left child: ans.addAll( specialsVar( f.leftChild ) ); // Recursively add all special vars from the right child: ans.addAll( specialsVar( f.rightChild ) ); } else if( f.getClass() == OrFormula.class ) { // Recursively add all special vars from the left child: ans.addAll( specialsVar( f.leftChild ) ); // Don't add anything from the right child! } else if( f.getClass() === AtomicFormula.class ) { // The base case: ans.add( f.getName() ); } return ans; } This code seems to work, so my question is: is this idiomatic Java? If not, what would be the idiomatic way to write this code? Is there any unexpected behaviour I should be aware of? Thanks!
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34122218

http://stackoverflow.com/q/22445961
has answer: http://stackoverflow.com/a/22446076
tagged with: eclipse
answer count: 2
has title: Eclipse: add a package to a bunch of classes
downvote count: 0
tagged with: packaging
linked to: http://stackoverflow.com/q/5134711
favorite count: 0
has body: Sorta like this question here (But using the solution supplied didn't exactly fix my issue) I'm trying to rearrange a project that had all of its classes in the default package, but I don't want to go through refactoring every class there's about 450+ So how can I use eclipse to automatically put every class in a different package and automatically update the declared package?
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22446057
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22446076
accepted answer: http://stackoverflow.com/a/22446057

http://stackoverflow.com/comment/80149171
has text: This is a solution for the Eclipse IDE. There is no default 'project.properties' file in Android Studio. It can be created though.
type: Comment
score: 20
type: AnswerComment
comment on: http://stackoverflow.com/a/22959847

http://stackoverflow.com/a/22477425
accepted answer of: http://stackoverflow.com/q/22454354
score: 2
answers question: http://stackoverflow.com/q/22454354
downvote count: 0
has body: Your main problem is that the client never closes the connection, it just exits, which causes some OS's to do an abortive close, which yields a 'connection reset' at the receiver. You don't need to use ImageIO just to send a picture. Just read and write the bytes. Using ImageIO just wastes time, a lot of it, and space. The server should be able to read the bytes with ImageIO as an image, whether ImageIO sent them or they came direct from a JPEG file.
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34161054
type: QuestionComment
has text: @EricStein you're a great spoiler (: just trying my best to learn
score: 0
comment on: http://stackoverflow.com/q/22459187
type: Comment

http://stackoverflow.com/comment/46318312
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22491221
has text: Thanks Hoan. Isn't PocketSphinx available to all Android versions from 2.2 up? If so, you may be referring to some other "offline Speech Recognizer" that is only available from JellyBean up. Right? Do you have a specific such offline recognizer in mind? (i.e. can you recommend one?)
score: 0

http://stackoverflow.com/q/22339946
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33952313
has comment: http://stackoverflow.com/comment/33952262
has body: I need to create a program that counts the number of words in a file and the number of unique words....I've figured out how to count the number of words but I'm having trouble figuring out the unique words part. This is my counting total words method. public static int numberWord(File f) throws FileNotFoundException{ Scanner welcome = new Scanner(f); int count=0; while(welcome.hasNext()){ String word=welcome.next(); count++; } return count;
has answer: http://stackoverflow.com/a/22340050
has title: How to count the number of unique words in a text file? Not allowed to use Hash
has comment: http://stackoverflow.com/comment/33952208
has comment: http://stackoverflow.com/comment/33952138
answer count: 1

http://stackoverflow.com/comment/34036075
score: 0
type: QuestionComment
has text: i updated those red marked lines from logcat log.. please check if i am correct
comment on: http://stackoverflow.com/q/22387769
type: Comment

http://stackoverflow.com/q/22334967
has answer: http://stackoverflow.com/a/22335037
has answer: http://stackoverflow.com/a/22335359
has answer: http://stackoverflow.com/a/22335184
type: UnansweredQuestion
tagged with: class
has body: One of the generic classes that I'm extending requires that I return a Class object of the correct generic type. I know how to do this for the normal case, but not when my class contains a generic list. For example, I know how to implement the first method below, but not the second: public Class&lt;String&gt; getStringKlass() { return String.class; } public Class&lt;List&lt;String&gt;&gt; getStringListKlass() { ??? }
tagged with: generics
has comment: http://stackoverflow.com/comment/33943301
type: Question
has title: In Java, how do I implement a method that returns Class<List<String>>
linked to: http://stackoverflow.com/q/2390662
score: 0
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/33943538
linked to: http://stackoverflow.com/q/339699

http://stackoverflow.com/comment/34093731
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22420956
has text: tooltip is the Tooltip class's object --> Tooltip tooltip = new ToolTip(parent.getShell(), SWT.NONE);

http://stackoverflow.com/comment/34099849
type: Comment
comment on: http://stackoverflow.com/a/22424833
has text: that did help a lot but how do I remove the parentNode from display
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33964925
score: 1
has text: @IWillTryToCodeIt thank you, i retry some times, but still get this error
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22346559

http://stackoverflow.com/comment/33997872
comment on: http://stackoverflow.com/q/22365721
has text: All classes are in same package "Passenger"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22468491
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34177540
tagged with: java
type: Question
has body: I have a private String variable called totalCost in my main Window GUI called class PriceCalculator, as well as a getter method called getCost(). I need to access this variable in my secondary window which pops-ups as an event from my main Window. This is my second Window: public class ExtraWindow extends JDialog { public ExtraWindow(JFrame frame) { super(frame, "Calculations", true); this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); getContentPane().setLayout(null); this.setSize(300,300); centerWindow(this); }....... .... As you can see, I think the second Window takes the main window as an argument. This is where I need the totalCost from the first window: JLabel lblCost = new JLabel("Cost: "); Since I need to use the information from the specific frame that it's using, I can't make an anonymous or another PriceCalculator and get it from there. I tried doing frame.getCost(), which lead me to casting frame as a PriceCalculator, but my program wouldn't run. How would I access this variable from the first window, which is an argument for the second? Sorry, forgot to add, where in the first window, the event happens: public class Event implements MouseListener { @Override public void mouseClicked(MouseEvent e) { new ExtraWindow(PriceCalculator.this); }
has answer: http://stackoverflow.com/a/22468557
tagged with: jdialog
has comment: http://stackoverflow.com/comment/34177494
score: 0
has title: Accessing variable from Main window on PopUp window
answer count: 1
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/22468557
tagged with: swing

http://stackoverflow.com/a/22432013
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22431980
upvote count: 1
downvote count: 0
has body: Suggestions: 1) Use a BufferedReader/FileReader so you can use "readLine()": BufferedReader in = new BufferedReader(new FileReader(file)); while (in.ready()) { String s = in.readLine(); ... } in.close(); 2) Use a regex to evaluate whether or not the line meets your condition Lars Vogel: Regex Tutorial 3) Write a line at a time/evaluate/write matching lines

http://stackoverflow.com/a/22474615
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22474543
upvote count: 2
has body: MyTypeface = Typeface.createFromAsset(getContext().getAssets(), "xxx.ttf");

http://stackoverflow.com/q/22449440
tagged with: struts2
has comment: http://stackoverflow.com/comment/34144610
has title: How to use create statement and select statement in a single java action class
tagged with: sql
has body: In my application I really want to execute create statement and select statement in a single execute() method(struts 2) Example: CREATE TABLE TABLE_NAME 1(SELECT * FROM TABLE_NAME 2) and SELECT * FROM TABLE_NAME 1 How can i do this ? please help me.
has comment: http://stackoverflow.com/comment/34144081
type: UnansweredQuestion
answer count: 0
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34143953

http://stackoverflow.com/comment/36243114
type: Comment
has text: thanks for your time, the solution to my specific problem was solved in another way. I upvoted your answer because it's interesting.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23478528

http://stackoverflow.com/comment/34185881
comment on: http://stackoverflow.com/a/22473392
has text: @trojantale x is not "added to the pool". Rather, x merely *represents* a string object (i.e. it's a variable name). This string - as in the case of my example - *was* added to the pool **because** it (`"bbb"`) was a *string literal*. Read the comments next to each line.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33998001
has text: ClassName extends MainClass
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22365870

http://stackoverflow.com/comment/34060161
comment on: http://stackoverflow.com/q/22402470
has text: You need to preserve the selection somewhere. It can be done using `SharedPreferences` or `Database`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22434573
has comment: http://stackoverflow.com/comment/34152913
answers question: http://stackoverflow.com/q/22426018
has comment: http://stackoverflow.com/comment/34155405
score: 0
has comment: http://stackoverflow.com/comment/34154846
has body: Most likely the slash / is messing up the parsing in PG. Turn the parameter into a quoted literal. Unless you are certain that no special characters go into string arguments (i.e. you control the strings), this is always a good idea to avoid SQL injection. query.setParameter("desc", "quote_literal('%unplug /your/ server... enjoy the freedom%')");
type: Answer
has comment: http://stackoverflow.com/comment/34122103
has comment: http://stackoverflow.com/comment/34154180

http://stackoverflow.com/q/22432021
has answer: http://stackoverflow.com/a/22432121
tagged with: android
type: AnsweredQuestion
tagged with: android-edittext
tagged with: java
accepted answer: http://stackoverflow.com/a/22432121
has title: How do I add values from EditText to a custom ListView?
type: Question
has body: I've been struggling with adding entries to a custom ListView. Here is the code so far on the fragment where the ListView is going to be. public class f2 extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_1, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { Bundle pending = getArguments(); String Number = pending.getString("Num"); String Message = pending.getString("Mess"); ArrayList&lt;String&gt; values = new ArrayList&lt;String&gt;(); values.add(Number); ListView yourListView = (ListView) getActivity().findViewById(R.id.listnew); MySimpleArrayAdapter customAdapter = new MySimpleArrayAdapter(getActivity(), android.R.layout.simple_list_item_1, values); yourListView.setAdapter(customAdapter); customAdapter.notifyDataSetChanged(); super.onActivityCreated(savedInstanceState); } public class MySimpleArrayAdapter extends ArrayAdapter&lt;String&gt; { Bundle pending; private final Context context; private final ArrayList&lt;String&gt; values; public MySimpleArrayAdapter(Context context, int simpleListItem1, ArrayList&lt;String&gt; values) { super(context, R.layout.rowlayout); this.context = context; this.values = values; this.pending = getArguments(); } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.rowlayout, parent, false); TextView textViewNum = (TextView) rowView.findViewById(R.id.label); textViewNum.setText(values.get(position)); return rowView; } } } The Bundle is where the values from the EditText are coming from. Oh yeah and the bundle has already been checked to with toast messages and other ways to make sure that the arguments are coming through. If someone could help, it would be greatly appreciated. The problem with the code tha…
tagged with: listview
score: 0
tagged with: android-listview
answer count: 1

http://stackoverflow.com/q/22358638
type: AnsweredQuestion
score: 1
tagged with: java
has title: Regex "inter" text
upvote count: 1
type: Question
has body: I am trying create a properly regex to validate some values, I will explain next: I have to validate this lines with he : $_globalVariables/ns:GlobalVariables/VARIABLENAME/ESB/System $_globalVariables/ns:GlobalVariables/VARIABLENAME2/ESB/System $_globalVariables/ns:GlobalVariables/VARIABLENAME3/ESB/System With this line: $_globalVariables/ns:GlobalVariables/[varname]/ESB/Sistema I tried some combinations, and read about regex, but I am "newbie" in this topic and I cant get the correct result. I think that is some like this: \$_globalVariables/ns:GlobalVariables/(.*?)/ESB/System \$_globalVariables/ns:GlobalVariables/ -> Text to validate in the start (.*?) -> Anything /ESB/System -> End of the math text Sorry my english, if somebody need more info, please ask me.
accepted answer: http://stackoverflow.com/a/22358663
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33984663
has answer: http://stackoverflow.com/a/22358663
tagged with: regex

http://stackoverflow.com/a/22358349
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22356183
type: Answer
answers question: http://stackoverflow.com/q/22356183
upvote count: 1
score: 1
has body: Are you trying the response inside a iframe? If so, first try directly opening the output in a new window and see if it opens. If its opening try mapping your controller to something like abc.pdf so that the url you point to becomes /something/abc.pdf.
type: AcceptedAnswer

http://stackoverflow.com/q/22444255
tagged with: hashset
tagged with: duplicates
tagged with: arraylist
has body: How can I remove duplicates in an ArrayList in Java, except for specific elements? For instance if I have an ArrayList with "a", "b", "c", "d", "d", "a", "b", "b", "d", "c" I only want to remove the duplicates for "a", "b" and "c" and I also need to maintain the order of the elements. The duplicates of "d" cannot be removed. How can I accomplish this?
has answer: http://stackoverflow.com/a/22444439
has answer: http://stackoverflow.com/a/22444389
has answer: http://stackoverflow.com/a/22444330
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22444376
has title: Remove specific duplicates in ArrayList in Java
tagged with: java
score: 0
tagged with: set
type: Question
possible better answer: http://stackoverflow.com/a/22444376
accepted answer: http://stackoverflow.com/a/22444330

http://stackoverflow.com/q/22349339
accepted answer: http://stackoverflow.com/a/22350656
has body: I tried all possible cases but data is not showing in the list from database.my starting activity have list view which is to be empty in starting and when user fill the data and save it from another activity,ans press back button the data should be shown in the first activity which have list view.,but every time data is not show MainActivty.java package com.example.smscampaign; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; public class Campaign_Details extends Activity { private Demo selectedAdapter; private ArrayList<String> list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_demostration); TextView text1=(TextView) findViewById(R.id.text1); TextView text2=(TextView) findViewById(R.id.text1); DataBaseHandler info= new DataBaseHandler(this); info.open(); String data=info.getData(); info.close(); String[] values= new String[]{ data }; //txt.setText(data); // Button next=(Button) findViewById(R.id.next); // Map<String, String[]> storage = new HashMap<String, String[]>(); // String[] tableItems = storage.get("ContactTable"); // next.setOnClickListener(this); // final ListView listview = (ListView) findViewById(R.id.listview); ListView listview1 = (ListView) findViewById(R.id.listview1); // TextView emptyText = (TextView)findViewById(android.R.id.empty); //listview.setEmptyView(findViewById(R.id.empty)); // TextView emptyText = (TextView)findViewById(android.R.id.empty); // listview .setEmptyView(e…
score: 0
has comment: http://stackoverflow.com/comment/34003719
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33968793
tagged with: java
has answer: http://stackoverflow.com/a/22349703
type: Question
has answer: http://stackoverflow.com/a/22350656
has comment: http://stackoverflow.com/comment/33969180
has answer: http://stackoverflow.com/a/22349573
tagged with: android
has title: data is not visible in listview
possible better answer: http://stackoverflow.com/a/22349573
has comment: http://stackoverflow.com/comment/33969216
answer count: 4
has answer: http://stackoverflow.com/a/22350943

http://stackoverflow.com/a/22412032
upvote count: 12
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22355235
has comment: http://stackoverflow.com/comment/123933744
answers question: http://stackoverflow.com/q/22355235
has body: This is a bug in the current JDK implementation which has been fixed in the JDK8 implementation.Checkout this link for details https://bugs.openjdk.java.net/browse/JDK-7157360. There is a way to hack around this but Jersey team decided not to fix it https://github.com/eclipse-ee4j/jersey/issues/1639 2 solutions which I can think of use Apache Http Client which supports HttpPatch method use Jersey Client PostReplaceFilter but the Container code has to be modified and include X-HTTP-Method-Override header with value as PATCH while making a post request. Refer to http://zcox.wordpress.com/2009/06/17/override-the-http-request-method-in-jersey/ ]
score: 12

http://stackoverflow.com/a/22464629
score: 5
accepted answer of: http://stackoverflow.com/q/22464596
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34170638
answers question: http://stackoverflow.com/q/22464596
has comment: http://stackoverflow.com/comment/34170609
type: Answer
has comment: http://stackoverflow.com/comment/34170862
has body: (This problem is not related to generics.) Test does not have a default (i.e. no argument) constructor. Therefore your child class needs to call explicitly the single constructor that you've provided in Test. (The compiler cannot figure out what to do due to this ambiguity - how would it know which argument(s) to pass - so it raises a compile-time error.)
has comment: http://stackoverflow.com/comment/34170613
has comment: http://stackoverflow.com/comment/34170615
upvote count: 5
has comment: http://stackoverflow.com/comment/34170557

http://stackoverflow.com/comment/34142726
has text: Its there in the link shared with u
comment on: http://stackoverflow.com/q/22448467
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22387769
has title: (Need Help) Using OnClickListener in Fragment, On Button Click App Force Closes
score: 0
has comment: http://stackoverflow.com/comment/34036075
answer count: 1
has comment: http://stackoverflow.com/comment/34035263
has comment: http://stackoverflow.com/comment/34035540
has comment: http://stackoverflow.com/comment/34035598
type: AnsweredQuestion
tagged with: onclicklistener
type: Question
has body: I am trying to make an temperature converter. this is a tab fragment class. i have xml specified for this. which includes a button with android:onClick="onClick" Here is the TempFragment.java class source. when i click on button the app force closes. Please help Debug package com.example.converter; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.Toast; public class TempFragment extends Fragment implements OnClickListener { private EditText text; Button b; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_temp, container, false); text = (EditText) view.findViewById(R.id.editText1); b = (Button) view.findViewById(R.id.button1); b.setOnClickListener(this); return view; } // this method is called at button click because we assigned the name to the // "OnClick property" of the button public void onClick(View view) { switch (view.getId()) { case R.id.button1: RadioButton celsiusButton = (RadioButton) view.findViewById(R.id.radio0); RadioButton fahrenheitButton = (RadioButton) view.findViewById(R.id.radio1); if (text.getText().length() == 0) { Toast.makeText(getActivity(), "Please enter a valid number", Toast.LENGTH_LONG).show(); return; } float inputValue = Float.parseFloat(text.getText().toString()); if (celsiusButton.isChecked()) { text.setText(String .valueOf(ConverterUtil.convertFahrenheitToCelsius(inputValue))); celsiusButton.setChecked(false); fahrenheitButton.setChecked(true); } else { text.setText(String .valueOf(ConverterUtil.convertCelsiusToFahrenheit(inputValue))); fahrenheitButton.setChecked(false); celsiusButton.setChecked(true); } break; } } } UPDATE: Red marked lines from Logcat Log 03…
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/22388360
accepted answer: http://stackoverflow.com/a/22388360

http://stackoverflow.com/comment/33959542
has text: You might consider taking a look at [Control Flow Statements](http://docs.oracle.com/javase/tutorial/java/nutsandbolts/flow.html)
comment on: http://stackoverflow.com/q/22344139
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/22436158
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22436093
has body: Your example is in some way a special case. In a non trivial program you can typically not determine the class of the object a certain reference points to better than "it is of the type the reference was declared for or a subtype of it". The whole concept of polymorphism is based on the fact that the concrete class is only known at runtime but not at compile time. This of course means that the compiler must ensure that the methods that are called on a reference will be available on the referenced object at runtime. The only methods for which this holds true are the methods of the class for which the variable was declared (including all inherited methods from the super classes).

http://stackoverflow.com/comment/34157786
comment on: http://stackoverflow.com/a/22457342
type: AnswerComment
score: 0
type: Comment
has text: Timer is a scheduler for threads. You don't need something like that in a draw routine. Some other piece of code in some way will call the repaint of the entire view and the background will react according to it. For me it can't be scheduled.

http://stackoverflow.com/a/22469587
type: Answer
upvote count: 1
score: 1
has body: An alternative solution. This takes advantage of the fact that a Set does not allow duplicate entries, and greatly simplifies your code. public class pb1 { public static void removeDup(int[] theArray) { Set&lt;Integer&gt; hold=new TreeSet&lt;Integer&gt;(); for(int i=0;i&lt;theArray.length-1;i++) { hold.add(theArray[i]); } System.out.println(hold); } public static void main(String[]args) { int[] now={1,1,2,2,3,4,4,4,5,5,5,5}; removeDup(now); } } Output: [1, 2, 3, 4, 5]
answers question: http://stackoverflow.com/q/22469366
has comment: http://stackoverflow.com/comment/34179234
has comment: http://stackoverflow.com/comment/34179255
downvote count: 0

http://stackoverflow.com/comment/34062615
comment on: http://stackoverflow.com/q/22403914
has text: In this type of scenario we should used Fragment.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/34200918
has text: @fortran The larger the heap, the larger the support structures, and the larger the overhead of housekeeping.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22480749
type: Comment

http://stackoverflow.com/a/24801593
has body: Eclipse does not provide this formatting feature out of the box. You can use Checkstyle plugin to check for this and many more coding standards. In Checkstyle configuration file, use module MultipleVariableDeclarations like this, <property name="cacheFile" value="target/cachefile"/> <property name="tabWidth" value="4"/> ... ... If you are OK with command line tool, then astyle and GC GreatCode are two good code formatters. GC GreatCode is given as C/C++ code formatter but it will format your code in this scenario well. In GC the option to split variable declaration is -code_split_decl_style Original code: String fileName, a, b, c; With -code_split_decl_style-1 option: String fileName, a, b, c; With -code_split_decl_style-2 option: String fileName; String a; String b; String c; You can play around with different command line formatting tools and configurations for various languages in one GUI tool using UniversalIndentGUI. Checkstyle: http://checkstyle.sourceforge.net/ Astyle: astyle.sourceforge.net/ GC GreateCode: http://sourceforge.net/projects/gcgreatcode/ UniversalIndentGUI: universalindent.sourceforge.net/
downvote count: 0
answers question: http://stackoverflow.com/q/22360085
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/88721620
type: Comment
has text: One I wrote recently: https://github.com/cretz/javan-warty-pig
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22382818

http://stackoverflow.com/comment/34020672
type: AnswerComment
comment on: http://stackoverflow.com/a/22379761
type: Comment
score: 1
has text: Wow. I dreamed about something like `thenCallRealMethod()`, but didn't expect it to actually exist...

http://stackoverflow.com/comment/33952785
has text: I doubt the blank line is causing the error.
score: 0
comment on: http://stackoverflow.com/q/22329479
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34067195
has text: Just a tip, I would be careful of `"SELECT sino,stationname,distance from station where route ='"+rootSelection+"'";` this can be dangerous for security (injection).
comment on: http://stackoverflow.com/q/22406417
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/a/22439136
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
has body: I could give my class a File field for the selected file, say called selected file: private File selectedFile = null; And then in the first action listener, assign a value to that field: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser chooser=new JFileChooser(); int returnVal = chooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { selectedFile = chooser.getSelectedFile(); String filename=F.getName(); jTextField1.setText(filename); } } And then would use the selectedFile in the next bit of code. Java is complaining that you're trying to initialize a Scanner without catching exceptions, and so you should follow the suggestion of the error message: catch your exceptions. For example: private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { if (selectedFile == null) { return; // no file selected. Get out of here } String token1 = ""; Scanner inFile1 = null; try { inFile1 = new Scanner(selectedFile); } catch (FileNotFoundException e) { e.printStackTrace(); return; } // ..... You most definitely need to read a tutorial or two about how to handle exceptions. Google will help you find these. Edit You state in comment: error: type List does not take parameters List temps = new LinkedList(); I fear that this may be due to your importing java.awt.*. If your code has this line: import java.awt.*; Delete it, because you're confusing the compiler as to just what type of List you are trying to use. You are trying to use a java.util.List but the compiler may be thinking that you're using a java.awt.List. The best way to fix this is to import the specific awt classes that you're using and not use the wild card * for imports. Sometimes you have to forgo the imports altogether and simply use fully specified class names in your code. For example, sometimes you have to go the route: java.util.List&lt;String&gt; myList = new java.util.LinkedList&lt;String&gt;();
type: Answer
accepted answer of: http://stackoverflow.com/q/22437843
answers question: http://stackoverflow.com/q/22437843

http://stackoverflow.com/q/22383727
has comment: http://stackoverflow.com/comment/34027984
has title: insert ResultSet from select query into another database
type: Question
has answer: http://stackoverflow.com/a/32908464
score: 0
answer count: 1
tagged with: teradata
has body: I want to select all the values from a teradata database and insert it to a mysql database. I was thinking of doing this as a java script as that is what i am most familiar with. I am able to get the data like so: // connect to the teradata table and get all the data Class.forName("com.teradata.jdbc.TeraDriver"); Connection teraConnect = DriverManager.getConnection(url,username, password); Statement teraStatement= teraConnect.createStatement(); String query = "select * from mytable"; ResultSet teraResult = teraStatement.executeQuery(query); Now i want to take everything and put it into my mysql database. The table already exists and has the same schema(same column names &amp; types). How do i insert into the mysql db. Here is what i have: // connect to the mysqltable Class.forName("com.mysql.jdbc.Driver"); Connection sqlConnect = DriverManager.getConnection(mysqlUrl,username, password); Statement mysqlStatement= sqlConnect.createStatement(); //??? now what? how to convert a resultset to a query that i can execute I plan to do this via a overnight job. Note: i have no control over the teradata database server as the IT guys control it. Note: the two databases are not on the same machine (if that makes a diff).
has comment: http://stackoverflow.com/comment/34028074
type: UnansweredQuestion
tagged with: java
tagged with: mysql

http://stackoverflow.com/a/22338608
has comment: http://stackoverflow.com/comment/33957685
has body: Your app is crashing because of this line I think pb.setProgress(milliseconds); I looked at it and cleaned it up a little bit. Now this has a working stopwatch for the textView. There is a progress bar that runs for no reason in your app though. I did not clearly understand your question though. Hopefully this gets you a start on your project. import android.app.Activity; import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; import android.os.SystemClock; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; public class MainActivity extends Activity implements OnClickListener{ private CountDownTimer mCountDownTimer; int i=0; private ProgressBar pb; private TextView textTimer; private Button startButton, pauseButton; private long startTime = 0L; private Handler myHandler = new Handler(); long timeInMillies = 0L; long timeSwap = 0L; long finalTime = 0L; int seconds = (int) (finalTime / 1000); int minutes = seconds / 60; int milliseconds = (int) (finalTime % 1000); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textTimer = (TextView) findViewById(R.id.textView1); pb = (ProgressBar) findViewById(R.id.progressBar); // here is the key startButton = (Button) findViewById(R.id.button1); pauseButton = (Button) findViewById(R.id.button2); startButton.setOnClickListener(this); pauseButton.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.button1: startTime = SystemClock.uptimeMillis(); myHandler.postDelayed(updateTimerMethod, 0); textTimer.setText("b1 here showing startTime" + startTime); break; case R.id.button2: timeSwap += timeInMillies; myHandler.removeCallbacks(updateTimerMethod); textTimer.setText("b2 showing timeSwap" + timeSwap); break; } } public Runnable updateTime…
answers question: http://stackoverflow.com/q/22335410
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22335410
type: Answer
has comment: http://stackoverflow.com/comment/33972253

http://stackoverflow.com/q/22397780
tagged with: profiling
answer count: 1
has answer: http://stackoverflow.com/a/22653034
tagged with: garbage-collection
has body: I could see in my application that no of loaded classes keeps on increasing as discussed here. On using yourkit and help from the stack overflow community ,I was able to conclude that the classes getting increased is because of the reflection classes getting dynamically created as listed below: GeneratedConstructorAccessorXX GeneratedMethodAccessorXX GeneratedSerializationConstructorAccessorXX where XX is some number. As per my knowledge and what I have come to know after googling, These are kind of runtime proxies used by reflection to access object information which is stored in the memory.These accessors are cached so that they dont have to be regenerated each time. These class objects are singleton per classloader, and hence we have only one instance of a generated accessor per classloader of a given Class. If this is the case,why I see the increase of loaded classes when I am running the repeat test. Update* On further analysis I have observed that increased load is specifically because of GeneratedSerializationConstructorAccessor.
accepted answer: http://stackoverflow.com/a/22653034
type: AnsweredQuestion
tagged with: performance
tagged with: java
has title: reflection classes keeps on increasing
type: Question
linked to: http://stackoverflow.com/q/22348271
score: 0
tagged with: memory-leaks

http://stackoverflow.com/q/22427843
possible better answer: http://stackoverflow.com/a/22427879
tagged with: sorting
has answer: http://stackoverflow.com/a/22427879
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34104903
score: 0
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/34104977
has comment: http://stackoverflow.com/comment/34104889
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22427992
type: AnsweredQuestion
tagged with: java
has title: How should I sort an ArrayList by some integers contained in it?
accepted answer: http://stackoverflow.com/a/22427992
has body: This is obviously not my work, but an example of it. I've been working for over two hours now on using Comparable, compareTo, compare, Collections, sort, etc. This does not involve sorting it Strings attached to them, but the first numbers should stick with their respective words. The ArrayList has to stay intact, but I've exhausted all other possibilities to the extent of what I know. 6 Worda 8 Wordb 7 Wordc 20 Wordd 2 Worde 5 Wordf 1 Wordg 10 Wordh 1 Wordi 2 Wordj The new ArrayList would be something like: 1 Wordi 1 Wordg 2 Wordj 2 Worde 5 Wordf 6 Worda 8 Wordb 7 Wordc 10 Wordh 20 Wordd
has answer: http://stackoverflow.com/a/22428209

http://stackoverflow.com/q/22379182
has body: I want to verify whether a button is clicked or not with Selenium WebDriver using Java. How can I verify this?
score: 1
has comment: http://stackoverflow.com/comment/34050499
has comment: http://stackoverflow.com/comment/34049513
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/42248947
has comment: http://stackoverflow.com/comment/34019288
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34050519
favorite count: 0
has title: How to verify whether a Button is clicked or not with Selenium WebDriver using Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34019149
upvote count: 1
has comment: http://stackoverflow.com/comment/34019162
tagged with: selenium-webdriver

http://stackoverflow.com/q/22386939
has comment: http://stackoverflow.com/comment/34747621
tagged with: java
tagged with: lwjgl
has title: Creating a transparent PNG using an FBO creates an empty image
has comment: http://stackoverflow.com/comment/34083176
has comment: http://stackoverflow.com/comment/34731186
type: Question
has comment: http://stackoverflow.com/comment/34364272
has comment: http://stackoverflow.com/comment/34237715
has comment: http://stackoverflow.com/comment/34226929
has comment: http://stackoverflow.com/comment/34266618
has body: I'm making a Minecraft mod where i'm trying to render all the icons of blocks to a transparent PNG-image. This is my first time using OpenGL and I just can't find the issue I'm having: the output is just a transparent PNG-image with nothing in it. Note that Minecraft also works with a framebuffer. In the start, this part of the code creates the framebuffer, depthbuffer and texture. // Clear some buffers glClearColor(0.0F, 0.0F, 0.0F, 0.0F); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Create and bind framebuffer int fbo = glGenFramebuffersEXT(); glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); // Create and bind depthbuffer int drb = glGenRenderbuffersEXT(); glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, drb); glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, size, size); glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, drb); // Create and bind texture int tex = glGenTextures(); glBindTexture(GL_TEXTURE_2D, tex); // Specify a texture image glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA8, size, size, 0,GL_RGBA, GL_UNSIGNED_BYTE, (ByteBuffer)null); // Bind texture to framebuffer glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex, 0); This part renders the block or item... (Note that this part renders fine when rendering in the Minecraft Framebuffer) // Render a Minecraft block or item // Commented out code is used for lighting and size glLoadIdentity(); glEnable(GL12.GL_RESCALE_NORMAL); //RenderHelper.enableGUIStandardItemLighting(); //glScalef(10F, 10F, 10F); itemRenderer.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), is, 0, 0); //glScalef(0.1F, 0.1F, 0.1F); //RenderHelper.disableStandardItemLighting(); glDisable(GL12.GL_RESCALE_NORMAL); /* Draw a rectangle - Testing purposes glBegin(GL_TRIANGLES); glColor3f(1.0f, 0.0f, 0.0f); glVertex3f(0, 0, 0); glVertex3f(1, 0, 0); glVertex3f(0, 1, 0); glEnd(); */ // Unbind framebuffer glBindFramebufferEXT(GL_FRAMEBUFFER_EX…
has comment: http://stackoverflow.com/comment/34364504
has comment: http://stackoverflow.com/comment/34588857
score: 2
has comment: http://stackoverflow.com/comment/34731394
downvote count: 0
has comment: http://stackoverflow.com/comment/34322211
has comment: http://stackoverflow.com/comment/34260347
has comment: http://stackoverflow.com/comment/34379143
has comment: http://stackoverflow.com/comment/34264360
favorite count: 0
has comment: http://stackoverflow.com/comment/34315684
has comment: http://stackoverflow.com/comment/34294563
has comment: http://stackoverflow.com/comment/34380271
has comment: http://stackoverflow.com/comment/34045801
upvote count: 2
type: UnansweredQuestion
answer count: 0
tagged with: opengl

http://stackoverflow.com/a/22471188
has body: I found out root cause of the error. In Quartz jar pom.xml the slf4j dependency version was 1.6.1 and my Karaf-2.3.3 inbuilt slf4j dependency is 1.6.6. Changing the quartz pom with the correct version for dependencies helps.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22400131
answers question: http://stackoverflow.com/q/22400131
score: 1

http://stackoverflow.com/q/22425565
upvote count: 4
tagged with: selenium-webdriver
has title: selenium exceptionin java (org.openqa.selenium.remote.UnreachableBrowserException)
has answer: http://stackoverflow.com/a/22428392
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34101721
downvote count: 0
tagged with: java
tagged with: selenium
type: Question
score: 4
has body: I know there are number of threads running but none of them has a solution of this problem. I am trying to get a aspx page using selenum. But it throws UnreachableBrowserException at this line of code WebDriver driver = new ChromeDriver();. An instance of chrome is opening but then later on after few seconds it throws the exception I have mentioned above. Here is my sample code. System.setProperty("webdriver.chrome.driver", "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"); WebDriver driver = new ChromeDriver(); driver.get("http://some aspx page with form"); System.out.println("!!!!! Got the page !!!!!"); driver.close(); driver.quit(); Following is the stacktrace. Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '2.40.0', revision: 'fbe29a9', time: '2014-02-19 20:54:28' System info: host: 'E7D4C9EFE70614', ip: '192.168.1.12', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_45' Driver info: driver.version: ChromeDriver at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:567) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:218) at org.openqa.selenium.chrome.ChromeDriver.startSession(ChromeDriver.java:181) at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:113) at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:117) at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:160) at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:149) at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:106) at HtmlParser.main(HtmlParser.java:31) Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: '2.40.0', revision: 'fbe29a9', time: '…
has comment: http://stackoverflow.com/comment/34102748
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22428392
has comment: http://stackoverflow.com/comment/34101843
has comment: http://stackoverflow.com/comment/34101978

http://stackoverflow.com/comment/34189856
score: 0
type: Comment
has text: @chris I have added an example which allows you to mock a service which is a singleton.
comment on: http://stackoverflow.com/a/22475885
type: AnswerComment

http://stackoverflow.com/comment/34132838
type: AnswerComment
score: 0
has text: I am analyzing this issue and I came to this point that there is some problem in `X-GWT-Module-Base` that is equal to `http://www.tattoon.pt/deployment/deployment/`. Which is wrong. Let me update the screenshot in my answer.
type: Comment
comment on: http://stackoverflow.com/a/22442019

http://stackoverflow.com/comment/34115374
comment on: http://stackoverflow.com/q/22433570
type: Comment
type: QuestionComment
score: 0
has text: At least try a `System.out.println(e.getMessage());` to get a message for debugging and not just ignore the exception.

http://stackoverflow.com/comment/33993321
has text: Yes. Here you have an example of reading and writing : http://stackoverflow.com/a/22074145/3315914
type: Comment
comment on: http://stackoverflow.com/q/22363317
score: 0
type: QuestionComment

http://stackoverflow.com/q/22361924
has comment: http://stackoverflow.com/comment/33992226
has comment: http://stackoverflow.com/comment/33991659
has comment: http://stackoverflow.com/comment/33991633
has answer: http://stackoverflow.com/a/22363009
type: AnsweredQuestion
tagged with: jsf
has body: Well, i have a JS file with a lot of functions. In a specific case i can't call my method. See: <h:form> <h:commandButton value="Montar" actionListener="#{orcamentoMB.montar}" /> </h:form> And my actionListener is: public void montar(){ addInfoMessage("Chamando montagem de odontograma"); RequestContext.getCurrentInstance().execute("montarOdontograma()"); } And my Javascript function: function montarOdontograma() { alert('cool, this works'); } A very simple example, but didn't work. EDIT 1: My whole page <h:head> </h:head> <h:body> <ui:composition template="/templates/template.xhtml"> <ui:define name="content"> <h:form> <p:commandButton value="Montar" actionListener="#{orcamentoMB.montar}" /> </h:form> </ui:define> </ui:composition> </h:body> EDIT 2: Trying use onload to call javascript <h:head> </h:head> <h:body onload="montarOdontograma()"> <ui:composition template="/templates/template.xhtml"> <ui:define name="content"> <h:form id="formManterOrcamento"> <p:remoteCommand process="@this" actionListener="#{orcamentoMB2.montarOdontograma}" name="montarOdontograma" /> SOLVED: The RequestContext.getCurrentInstance().execute() just work with ajax requests. In my case i just change the RequestContext to call directly with a tag, see bellow:
has comment: http://stackoverflow.com/comment/33992271
tagged with: primefaces
has title: Javascript is not called from RequestContext in ManagedBean
has comment: http://stackoverflow.com/comment/33992184
tagged with: java
has comment: http://stackoverflow.com/comment/33990951
has comment: http://stackoverflow.com/comment/33991471
has comment: http://stackoverflow.com/comment/33991715
type: Question
has comment: http://stackoverflow.com/comment/33991035
has comment: http://stackoverflow.com/comment/33990876
has comment: http://stackoverflow.com/comment/33991820
has comment: http://stackoverflow.com/comment/33991591
has comment: http://stackoverflow.com/comment/33990797
accepted answer: http://stackoverflow.com/a/22363009
answer count: 1
tagged with: javascript
has comment: http://stackoverflow.com/comment/33992567
has comment: http://stackoverflow.com/comment/33990828
has comment: http://stackoverflow.com/comment/33992412
has comment: http://stackoverflow.com/comment/33991329
score: 0
has comment: http://stackoverflow.com/comment/33992838
has comment: http://stackoverflow.com/comment/33990787
has comment: http://stackoverflow.com/comment/33991797
has comment: http://stackoverflow.com/comment/33990865

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/22412544
tags question: http://stackoverflow.com/q/22378337
tags question: http://stackoverflow.com/q/22365312
tags question: http://stackoverflow.com/q/22361522

http://stackoverflow.com/comment/34159277
has text: What makes you think that? I'm looking at the 1.6.0_31 source code for ArrayList, and it's clearly using .equals() . Line 423: if (o.equals(elementData[index])) {
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22458404

http://stackoverflow.com/comment/34090857
type: QuestionComment
has text: The word is 'Algorithm'. It's a proper name. No abbreviation.
comment on: http://stackoverflow.com/q/22418075
score: 1
type: Comment

http://stackoverflow.com/comment/34075053
score: 0
has text: Sonar reports a lot of "If Stmts Must Use Braces" warnings. Hashcode is fine, equals is very difficult to read.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22410847

http://stackoverflow.com/a/22420306
answers question: http://stackoverflow.com/q/22420201
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34092543
upvote count: 1
has comment: http://stackoverflow.com/comment/34092165
has comment: http://stackoverflow.com/comment/34092120
has comment: http://stackoverflow.com/comment/34092426
type: Answer
has comment: http://stackoverflow.com/comment/34111281
has body: Why is this happening? You are trying to do a "try-with-resources". That requires Java 7 or later. Make sure your eclipse project is also set to Java 7, not just your local command line JDK. http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22420201
has comment: http://stackoverflow.com/comment/34092128

http://stackoverflow.com/q/22449967
possible better answer: http://stackoverflow.com/a/22450056
type: AnsweredQuestion
downvote count: 0
score: 1
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22450303
has body: I have an ArrayList of object called Course and I'm trying to sort it in 2 ways, by courseID and course start time. class Course implements Comparable&lt;Course&gt; { private int courseID; private String courseBeginTime; // implement the compareTo method defined in Comparable @Override public int compareTo(Course course) { if (getCourseID() &gt; course.getCourseID()){ return 1; } else if(getCourseID() &lt; course.getCourseID()){ return -1; } else { return 0; } } Then I have these comparators: //implement the comparators class IDSorter implements Comparator&lt;Course&gt; { public int compare(Course course1, Course course2) { return Integer.compare(course1.getCourseID(), course2.getCourseID()); } } class startTimeSorter implements Comparator&lt;Course&gt; { public int compare(Course course1, Course course2) { return Integer.compare(Integer.parseInt(course1.getCourseBeginTime()), Integer.parseInt(course2.getCourseBeginTime())); } } I sort them in my main method like this: Collections.sort(courseList, new IDSorter()); Collections.sort(student.getStudentSchedule(), new StartTimeSorter()); The code works, I can get the list sorted by ID or startTime.... but I don't understand why. In the Course class the compareTo method is only comparing getCourseID. How is the StartTimeSorter, which needs to compare courseBeginTime working then? How can I rewrite to make more sense?
has answer: http://stackoverflow.com/a/22450056
has answer: http://stackoverflow.com/a/22450080
upvote count: 1
has title: Comparator works for my ArrayList but code looks wrong?
has answer: http://stackoverflow.com/a/22450303
favorite count: 0
tagged with: arraylist
linked to: http://stackoverflow.com/q/12123960
has answer: http://stackoverflow.com/a/22450037
answer count: 4

http://stackoverflow.com/q/22440141
type: Question
has answer: http://stackoverflow.com/a/25610280
tagged with: arrays
downvote count: 0
answer count: 1
favorite count: 0
has title: Reading from an array list and comparing to an input string
tagged with: character
type: UnansweredQuestion
tagged with: compare
tagged with: list
score: 1
tagged with: java
upvote count: 1
has body: Basically I have been asked to create a small letters game in which the user picks some vowels and consonants and these are added to an array list, once that has happened, we have to print out the contents of the array list e.g. it could look like this, [T,S,I,L,Y,A,R,R,A] and then we prompt the player to input what words they think they can make from the given list of characters. What I am looking for some pointers on is how to make sure the user can only use they characters and also how to compare their answer to a dictionary file. The only code I have so far is reading in my dictionary file. Any help would be greatly appreciated. try { BufferedReader reader = new BufferedReader(new FileReader("dictionary.txt")); String line = reader.readLine(); List&lt;String&gt; words = new ArrayList&lt;String&gt;(); while (line != null) { String[] wordsLine = line.split(" "); for (String word : wordsLine) { words.add(word); } line = reader.readLine(); } System.out.println("Here is your board again: " + genString + "\n"); System.out.println("Please enter your answer!\n"); } catch (Exception e) { System.out.println(e); } genString is my, what would be the list of characters and I have still to place the scanner in for user input.

http://stackoverflow.com/q/22465351
has answer: http://stackoverflow.com/a/22517331
has comment: http://stackoverflow.com/comment/34171818
accepted answer: http://stackoverflow.com/a/22517331
has body: In my software I use @Async to call a certain method from a Bean in the background, on Tomcat startup, and this works as expected. But, under some defined circumstances, what the method does is failing, and the method myUtil.connect() calls itself then to try again. The basic code looks as follows. The bean definition: import org.springframework.context.annotation.Bean; import package.MyService; @Bean(initMethod = "init", destroyMethod = "destroy") MyService myService() { MyService bean = new MyService(); return bean; } And the MyService bean: import javax.inject.Inject; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; @Component public class MyService { @Inject private MyUtil myUtil; @Async public void init() { myUtil.connect(); } } I have tried annotating the method connect() also with @Async believing, since it calls itself, @Async would make it run in background as well, with no success. Is there a way to assure subsequent calls to connect() "remain" in the background ? Edit: Would it be working to make connect() a wrapper around a function which does the real work? This way connect() would just be called once, and the wrapped function would call itself in case of failure.
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34172363
tagged with: asynchronous
favorite count: 0
has title: Spring @Async annotated method blocks when calling itself
tagged with: spring
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34175222

http://stackoverflow.com/comment/34119456
comment on: http://stackoverflow.com/q/22426548
score: 0
type: QuestionComment
type: Comment
has text: I am getting connection refused error on android app side and I am working with a real device.

http://stackoverflow.com/comment/34206877
comment on: http://stackoverflow.com/a/22485668
has text: I seriously doubt that the compiler won't optimize so that run equally fast
type: AnswerComment
score: 3
type: Comment

http://stackoverflow.com/q/22390740
tagged with: apache
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22391122
favorite count: 0
has comment: http://stackoverflow.com/comment/34044255
has comment: http://stackoverflow.com/comment/34043536
type: AnsweredQuestion
has title: Solr multiple boost queries
score: 1
tagged with: solr-boost
tagged with: java
tagged with: solr
has body: What's the best way to boost static values in Solr 3.6.2? Each document has exactly one (KeywordTokenized) source value (information origin) and I want to express some are more important than others. Full content control is possible if it helps. http://localhost:8080/solr/index/select?fl=source,score &amp;defType=edismax &amp;qf=title^4 &amp;q=qux &amp;bq=source:foo^10 &amp;bq=source:bar^14 Unfortunately the additive boost query has virtually no effect. The parsed query looks like this (qux is stemmed to qu) +DisjunctionMaxQuery(((title:qux qu)^4.0))) source:foo^10.0 source:bar^14.0 The debug queries for the top two results which doesn't significantly respect bq=source:foo^10 5.366351 = (MATCH) sum of: 5.366351 = (MATCH) sum of: 2.067319 = (MATCH) weight(title:qux in 4472), product of: 0.5513683 = queryWeight(title:qux), product of: 7.4988675 = idf(docFreq=35, maxDocs=23918) 0.073526874 = queryNorm 3.7494338 = (MATCH) fieldWeight(title:qux in 4472), product of: 1.0 = tf(termFreq(title:qux)=1) 7.4988675 = idf(docFreq=35, maxDocs=23918) 0.5 = fieldNorm(field=title, doc=4472) 3.299032 = (MATCH) weight(title:qu in 4472), product of: 0.69651634 = queryWeight(title:qu), product of: 9.472949 = idf(docFreq=4, maxDocs=23918) 0.073526874 = queryNorm 4.7364745 = (MATCH) fieldWeight(title:qu in 4472), product of: 1.0 = tf(termFreq(title:qu)=1) 9.472949 = idf(docFreq=4, maxDocs=23918) 0.5 = fieldNorm(field=title, doc=4472) 5.281746 = (MATCH) sum of: 4.134638 = (MATCH) sum of: 4.134638 = (MATCH) weight(title:qux in 4402), product of: 0.5513683 = queryWeight(title:qux), product of: 7.4988675 = idf(docFreq=35, maxDocs=23918) 0.073526874 = queryNorm 7.4988675 = (MATCH) fieldWeight(title:qux in 4402), product of: 1.0 = tf(termFreq(title:qux)=1) 7.4988675 = idf(docFreq=35, maxDocs=23918) 1.0 = fieldNorm(field=title, doc=4402) 1.147108 = (MATCH) weight(source:foo^10.0 in 4402), product of: 0.45919293 = queryWeight(source:foo^10.0), product of: 10.0 = boost 2.4980958 = idf(docFreq=5346,…
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/3102895
tagged with: search
has answer: http://stackoverflow.com/a/22391122
has comment: http://stackoverflow.com/comment/34043656

string
tags question: http://stackoverflow.com/q/22352064
tags question: http://stackoverflow.com/q/22404360
tags question: http://stackoverflow.com/q/22469650
tags question: http://stackoverflow.com/q/22387181
tags question: http://stackoverflow.com/q/22342793
tags question: http://stackoverflow.com/q/22366893
tags question: http://stackoverflow.com/q/22355740
tags question: http://stackoverflow.com/q/22350150
tags question: http://stackoverflow.com/q/22419460
tags question: http://stackoverflow.com/q/22330608
tags question: http://stackoverflow.com/q/22465993
tags question: http://stackoverflow.com/q/22368754
tags question: http://stackoverflow.com/q/22392135
tags question: http://stackoverflow.com/q/22406019
tags question: http://stackoverflow.com/q/22342624
tags question: http://stackoverflow.com/q/22363955
tags question: http://stackoverflow.com/q/22390010
tags question: http://stackoverflow.com/q/22330827
tags question: http://stackoverflow.com/q/22370482
tags question: http://stackoverflow.com/q/22389957
tags question: http://stackoverflow.com/q/22437303
tags question: http://stackoverflow.com/q/22345244
tags question: http://stackoverflow.com/q/22395585
tags question: http://stackoverflow.com/q/22384654
tags question: http://stackoverflow.com/q/22416433
tags question: http://stackoverflow.com/q/22367429
tags question: http://stackoverflow.com/q/22445104
tags question: http://stackoverflow.com/q/22422258
tags question: http://stackoverflow.com/q/22474674
tags question: http://stackoverflow.com/q/22458814
tags question: http://stackoverflow.com/q/22362020
tags question: http://stackoverflow.com/q/22449692
tags question: http://stackoverflow.com/q/22362261
tags question: http://stackoverflow.com/q/22412035
tags question: http://stackoverflow.com/q/22451498
tags question: http://stackoverflow.com/q/22378880
tags question: http://stackoverflow.com/q/22429697
tags question: http://stackoverflow.com/q/22339917
tags question: http://stackoverflow.com/q/22435099
tags question: http://stackoverflow.com/q/22362456
tags question: http://stackoverflow.com/q/22392964
tags question: http://stackoverflow.com/q/22485328
tags question: http://stackoverflow.com/q/22412133
tags question: http://stackoverflow.com/q/22377564
tags question: http://stackoverflow.com/q/22439859
tags question: http://stackoverflow.com/q/22348728
tags question: http://stackoverflow.com/q/22356711
tags question: http://stackoverflow.com/q/22381489
tags question: http://stackoverflow.com/q/22450840
tags question: http://stackoverflow.com/q/22435833
tag name: string
tags question: http://stackoverflow.com/q/22345833
tags question: http://stackoverflow.com/q/22427112
tags question: http://stackoverflow.com/q/22357882
tags question: http://stackoverflow.com/q/22436387
tags question: http://stackoverflow.com/q/22452190
tags question: http://stackoverflow.com/q/22364920
tags question: http://stackoverflow.com/q/22346306
tags question: http://stackoverflow.com/q/22485574
tags question: http://stackoverflow.com/q/22395614
tags question: http://stackoverflow.com/q/22330449
tags question: http://stackoverflow.com/q/22360245
tags question: http://stackoverflow.com/q/22384031
tags question: http://stackoverflow.com/q/22397861
tags question: http://stackoverflow.com/q/22477969
tags question: http://stackoverflow.com/q/22402787
tags question: http://stackoverflow.com/q/22388580
tags question: http://stackoverflow.com/q/22388951
tags question: http://stackoverflow.com/q/22392058
tags question: http://stackoverflow.com/q/22339233
tags question: http://stackoverflow.com/q/22352022
tags question: http://stackoverflow.com/q/22436216
tags question: http://stackoverflow.com/q/22389801
tags question: http://stackoverflow.com/q/22471323
tags question: http://stackoverflow.com/q/22389825
type: Tag
tags question: http://stackoverflow.com/q/22429589
tags question: http://stackoverflow.com/q/22420962
tags question: http://stackoverflow.com/q/22422092
tags question: http://stackoverflow.com/q/22451368

http://stackoverflow.com/a/22405069
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34066510
type: Answer
answers question: http://stackoverflow.com/q/22401001
has comment: http://stackoverflow.com/comment/34072678
accepted answer of: http://stackoverflow.com/q/22401001
has comment: http://stackoverflow.com/comment/34073103
has body: example@abc.com is NOT a username but an email- address (that can be used in the username field to login for Webservices / traveler / ldap / etc. if the server is configured accordingly). There are different ways to get an email- address for a given username, the easiest might be the usage of the Directory- Class and its method "lookupNames". Here is an example taken from the Designer Help: Session session = getSession(); AgentContext agentContext = session.getAgentContext(); Directory dir = session.getDirectory("NameOfYourServer"); String userName=session.getUsername(); DirEntryCollection direc = dir.lookupNames("($Users)",userName,"email"); DirEntry dirent = direc.getFirstEntry() while (dirent != null) { String name = dirent.getItemValue("InternetAddress"); System.out.println(InternetAddress); dirent = direc.getNextEntry(); } Designer help can be found in many places (locally installed if Designer is installed) or e.g. here

http://stackoverflow.com/a/35296133
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22485074
score: 16
upvote count: 16
has comment: http://stackoverflow.com/comment/63195036
has body: As of version 2.4, Log4J2 does now, again, support .property files. See here in the documentation for property configuration. Configuration with Properties As of version 2.4, Log4j now supports configuration via properties files. Note that the property syntax is NOT the same as the syntax used in Log4j 1. Like the XML and JSON configurations, properties configurations define the configuration in terms of plugins and attributes to the plugins.

http://stackoverflow.com/comment/34208582
type: QuestionComment
comment on: http://stackoverflow.com/q/22486590
type: Comment
score: 6
has text: If you want index, then why not just use the old traditional `for` loop?

sqlite
tags question: http://stackoverflow.com/q/22478006
tags question: http://stackoverflow.com/q/22340551
tags question: http://stackoverflow.com/q/22383143
tags question: http://stackoverflow.com/q/22340020
tags question: http://stackoverflow.com/q/22388088
tags question: http://stackoverflow.com/q/22410117
type: Tag
tags question: http://stackoverflow.com/q/22339564
tags question: http://stackoverflow.com/q/22406969
tags question: http://stackoverflow.com/q/22459005
tags question: http://stackoverflow.com/q/22417968
tags question: http://stackoverflow.com/q/22361452
tags question: http://stackoverflow.com/q/22393757
tags question: http://stackoverflow.com/q/22376279
tags question: http://stackoverflow.com/q/22462288
tags question: http://stackoverflow.com/q/22416226
tags question: http://stackoverflow.com/q/22480860
tags question: http://stackoverflow.com/q/22443701
tags question: http://stackoverflow.com/q/22431898
tags question: http://stackoverflow.com/q/22415576
tags question: http://stackoverflow.com/q/22411021
tags question: http://stackoverflow.com/q/22426553
tags question: http://stackoverflow.com/q/22466171
tags question: http://stackoverflow.com/q/22481007
tags question: http://stackoverflow.com/q/22387997
tags question: http://stackoverflow.com/q/22479759
tags question: http://stackoverflow.com/q/22475529
tags question: http://stackoverflow.com/q/22335196
tags question: http://stackoverflow.com/q/22425786
tags question: http://stackoverflow.com/q/22393891
tags question: http://stackoverflow.com/q/22422973
tags question: http://stackoverflow.com/q/22450934
tags question: http://stackoverflow.com/q/22482873
tags question: http://stackoverflow.com/q/22443466
tags question: http://stackoverflow.com/q/22449540
tag name: sqlite
tags question: http://stackoverflow.com/q/22473302

http://stackoverflow.com/q/22420239
upvote count: 2
type: UnansweredQuestion
has body: I am getting below error while i test my BPEL(SOA 11g) application on Weblogic . Please provide some inputs if you guys have encountered this before. Thanks [2014-03-15T16:42:34.885+11:00] [AdminServer] [ERROR] [OWS-04115] [oracle.webservices.service] [tid: [ACTIVE].ExecuteThread: '15' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: ] [ecid: 11d1def534ea1be0:6e87597f:144978f1d1e:-8000-00000000000efee7,0] [APP: soa-infra] [composite_name: ExecuteEligibilityFlowControllerBPEL*] An error occurred for port: FabricProvider: javax.xml.rpc.soap.SOAPFaultException.* Complete Logs-- [2014-03-15T16:42:34.828+11:00] [AdminServer] [NOTIFICATION] [] [oracle.wsm.agent.WSMAgent] [tid: [ACTIVE].ExecuteThread: '15' for queue: 'weblogic.kernel.Defau lt (self-tuning)'] [userId: ] [ecid: 11d1def534ea1be0:6e87597f:144978f1d1e:-8000-00000000000efee7,0] [WEBSERVICE_PORT.name: EligibilityManagementPort Type_v1_pt] [APP: soa-infra] [composite_name: ExecuteEligibilityFlowControllerBPEL] [component_name: ExecuteEligibilityFlowController] [component_instance_id: 7 0501] [J2EE_MODULE.name: fabric] [WEBSERVICE.name: EligibilityManagement-v1] [J2EE_APP.name: soa-infra] Message Type is normalized, exiting agent.processFault() [2014-03-15T16:42:34.828+11:00] [AdminServer] [NOTIFICATION] [] [oracle.wsm.agent.WSMAgent] [tid: [ACTIVE].ExecuteThread: '15' for queue: 'weblogic.kernel.Defau lt (self-tuning)'] [userId: ] [ecid: 11d1def534ea1be0:6e87597f:144978f1d1e:-8000-00000000000efee7,0] [WEBSERVICE_PORT.name: EligibilityManagementPort Type_v1_pt] [APP: soa-infra] [composite_name: ExecuteEligibilityFlowControllerBPEL] [component_name: ExecuteEligibilityFlowController] [component_instance_id: 7 0501] [J2EE_MODULE.name: fabric] [WEBSERVICE.name: EligibilityManagement-v1] [J2EE_APP.name: soa-infra] Message Type is normalized, exiting agent.processFault() [2014-03-15T16:42:34.872+11:00] [AdminServer] [NOTIFICATION] [] [oracle.wsm.agent.WSMAgent] [tid: [ACTIVE].ExecuteThread: '15' for queue: 'w…
tagged with: java
has title: An error occurred for port: FabricProvider
type: Question
tagged with: weblogic11g
downvote count: 0
favorite count: 0
tagged with: soa
score: 2
answer count: 0

http://stackoverflow.com/q/22390828
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22392393
tagged with: dom
type: Question
has answer: http://stackoverflow.com/a/22392393
has title: Insert and Update XML with DOM
score: 0
answer count: 1
has body: I'm saving game data on a XML <?xml version="1.0" encoding="UTF-8" standalone="no"?> Player 1 2 1000 Player 2 4 7500 How I can insert a new player node at the end of the xml and then update the xml?

http://stackoverflow.com/q/22332846
answer count: 0
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33942501
type: Question
has comment: http://stackoverflow.com/comment/33963450
has comment: http://stackoverflow.com/comment/33986393
has body: In a spring mvc application using hibernate and jpa, I am having trouble getting an entity to travel from the get method to the post method, which is leading to other downstream problems. Can someone show me how to set things up so that properties of the entity are still visible in the post method? Here are the controller methods: @RequestMapping(value = "/patients/{patientId}/encounters/{encounterId}/providers", method = RequestMethod.GET) public String initUpdateProvidersForm(@PathVariable("encounterId") int encounterId, Model model) { Encounter encounter = this.clinicService.findEncounterById(encounterId); ArrayList<Provider> myproviders = new ArrayList<Provider>(); myproviders.addAll(encounter.getProviders()); System.out.println("............encounter id is: "+encounter.getId()); model.addAttribute("encounter", encounter); return "encounters/addProvidersForm"; } @RequestMapping(value = "/patients/{patientId}/encounters/{encounterId}/providers", method = {RequestMethod.POST}) public String processUpdateProvidersForm(@ModelAttribute("encounter") Encounter encounter, @PathVariable("encounterId") int eid, BindingResult result, SessionStatus status) { Provider provider = this.clinicService.findProviderById(encounter.getProviderSelected()); encounter.addProvider(provider); System.out.println(" :::::: encounter id is: "+encounter.getId()); this.clinicService.saveEncounter(encounter); return "redirect:/encounters?encounterID={encounterId}"; } NOTE: encounter.getId() prints out a number in GET, but prints out null in POST. Why? How can I fix this? Here is the JSP: <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="petclinic" tagdir="/WEB-INF/tags" %> <jsp:include page="../fragments/headTag.jsp"/> <jsp:include page="../fragments/bodyHeader.jsp"/> <c:set var="method" value="post"/> Providers Pati…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33942367
has title: sending entity properties from GET to Post
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/q/22479214
has answer: http://stackoverflow.com/a/23064806
tagged with: ip
type: Question
tagged with: local
tagged with: lan
answer count: 3
has body: I have a Java server where I need to check if an IP is local or public when I get a connection. I can detect it when its my own local IP but I'm having some trouble with other local IPs. Does Java give us a way to do it? I haven't found it, so probably we should convert IP to numbers and check if is in the local IP range. How can I get this range?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22479305
has comment: http://stackoverflow.com/comment/34194874
has title: Detect if an IP is local or public
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22479334

http://stackoverflow.com/q/22370821
type: Question
tagged with: apache
tagged with: tomcat
has comment: http://stackoverflow.com/comment/41427797
score: 0
has title: Exception in retrieving password
answer count: 0
type: UnansweredQuestion
has body: When I am trying to log-in to my application I am getting the following error message : Mar 13, 2014 11:56:56 AM org.apache.catalina.realm.DataSourceRealm getPassword SEVERE: Exception retrieving password for username some configuration: &lt;Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" global="jdbc/ARAIDB" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/ARAIDB" password="" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/arai_prod" username="root"/&gt; &lt;Realm className="org.apache.catalina.realm.DataSourceRealm" dataSourceName="jdbc/ARAIDB" roleNameCol="role_name" userCredCol="password" userNameCol="account_name" userRoleTable="accounts_role" userTable="active_account"/&gt; Thanks in advance
has comment: http://stackoverflow.com/comment/34009824
has comment: http://stackoverflow.com/comment/34008787
tagged with: java

http://stackoverflow.com/a/76435528
score: 0
has body: As many others said, if you are writing something from scratch you may have a wrong approach. I had to refactor a legacy application and for different reasons that I'm not willing to share I've got the same problem. I solved using the following: Queue&lt;String&gt; queue = new LinkedList&lt;&gt;(); String element = new ArrayList&lt;String&gt;(queue).get(desiredIndex); // if you are sure there is no null elements you can do the following String[] element = queue.toArray()[desiredIndex] And I know is not a cheap operation, In my case I'm restricting the size of the queue a &lt; 3 to avoid huge performance hits. The idea of removing and re-adding to queue like others suggested is okay if the order does not matter, but in my specific problem it does.
type: Answer
answers question: http://stackoverflow.com/q/22453755

http://stackoverflow.com/q/22487736
answer count: 1
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/22488044
type: AnsweredQuestion
score: 2
tagged with: java
has title: Open local html file in Google Glass browser
tagged with: google-gdk
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/22488044
has body: I have an HTML file in my res/raw that I want to view in the Google glass browser. This answer suggests either copying to shared storage or using a WebView. I cant seem to make the WebView scroll using the touchpad in the same way the browser does, which renders it useless for my purposes. I tried copying the file to shared storage (i.e. /mnt/sdcard/Android/data/my.namespace/files/page.html) and using Intent i = new Intent(Intent.ACTION_VIEW); File file = new File(f.getAbsolutePath()); String extension = android.webkit.MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(file).toString()); String mimetype = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); i.setDataAndType(Uri.fromFile(file),mimetype); but I get this exception: 03-18 17:58:53.338: E/AndroidRuntime(5315): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///mnt/sdcard/Android/data/my.namespace/files/page.html typ=text/html } I've checked with adb shell and the file is at that location. Any ideas why this may not be working? Is it a glass specific issue? Thanks
tagged with: google-glass
tagged with: android
linked to: http://stackoverflow.com/q/14773336

http://stackoverflow.com/comment/34041940
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22390113
has text: Ok, now it's doing it but has loads of random commas in the blocks?
type: AnswerComment

http://stackoverflow.com/a/22349551
score: 0
has comment: http://stackoverflow.com/comment/33986076
type: Answer
answers question: http://stackoverflow.com/q/22329950
has body: First, you are not using EXTRA_SUBJECT, which is where I would expect a "caption" to go. Second, there is no EXTRA_TITLE in the documentation for ACTION_SEND_MULTIPLE. Third, there is no requirement for any app to necessarily honor EXTRA_SUBJECT for ACTION_SEND_MULTIPLE.

http://stackoverflow.com/a/22479830
downvote count: 0
has comment: http://stackoverflow.com/comment/45379362
type: Answer
has body: The problem appears to be related to the version of javax.servlet I was using. I downloaded version 2.5 from the linked website, and since tried a different version (not sure which one) that was given to me by my prof for this assignment, and it is working.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22469479

http://stackoverflow.com/comment/34032926
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22386492
has text: If you talking about variable String buckwheat = "Buckwheat waffle"; then you only need to write waffleStack.push(buckwheat);
score: 0

http://stackoverflow.com/comment/34156872
type: Comment
has text: @Octopus Most European countries do, except for the Brits. My own country doesn't have a constant in Locale. Examples: http://docs.oracle.com/cd/E19455-01/806-0169/overview-9/index.html
comment on: http://stackoverflow.com/a/22454134
type: AnswerComment
score: 0

http://stackoverflow.com/q/22441720
upvote count: 0
has title: Java Swing JSlider
has answer: http://stackoverflow.com/a/22442235
score: -2
accepted answer: http://stackoverflow.com/a/22442235
answer count: 1
linked to: http://stackoverflow.com/q/19556932
has comment: http://stackoverflow.com/comment/34131268
favorite count: 0
downvote count: 2
tagged with: swing
has body: In my game im currently working on a basic main menu and im looking for a few things. Currently the only way to see which Jslider is which is by hovering over it.. any suggestions? When i change the JSlider brightness or the JSlider audio it doesnt actualy update until i switch tabs and return. When i close the game and reopen it the settings return to default. how to create a variable to preserve settings? all code is here https://github.com/FeatheredOrcian/Kingdomcraft.git if you would rather just see the class that the code is partaining to https://github.com/FeatheredOrcian/Kingdomcraft/blob/master/Kingdomcraft/src/com/pointlight/kingdomcraft/render/Render.java thx
has comment: http://stackoverflow.com/comment/34131064
type: AnsweredQuestion
tagged with: jslider
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34130875

http://stackoverflow.com/q/22447425
tagged with: java
has comment: http://stackoverflow.com/comment/34141026
has title: Get record using JComboBox from database and get another record to textfield following combobox record?
tagged with: swing
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/34150020
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34141062
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34152209
tagged with: jcombobox
tagged with: netbeans
answer count: 0
has body: Can I know how we can get record using JComboBox from database and at the same time get another record from database to JTextField following what we choose in combobox?Both records are in database. Example:Get employees name from database using combo box, make selection using the combo box, then get employee id in text field... Thank you. I'm trying to make a Java frame program having a text area, a combo box link to database which is stock items name and a text field for fill in stock items id. User either use combo box choose items name show items id in text field or fill in items id to show the item name in the combo box automatically. How do I do that actually? try { // Load the driver Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn = DriverManager.getConnection(db); System.out.println("Database connected."); s = cn.createStatement(); ResultSet rs1=s.executeQuery("select StockName from StockDetail"); while (rs1.next()){ itemCombo.addItem(rs1.getString("StockName")); } /*String sl; sl = "select StockID from StockDetail where StockName='" + stockno.getText(); ResultSet rs2 = s.executeQuery(sl); while(rs2.next()){ stockno.setText(rs2.getString("StockID")); }*/ rs1.close(); s.close(); cn.close(); } catch(Exception e) { System.out.println(e.toString()); }

http://stackoverflow.com/comment/34140037
has text: Sorry. My mistake. That means that that "optimization" won't achieve anything at all. Updated. But as I said, this is marginal at best.
comment on: http://stackoverflow.com/a/22446510
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34068496
comment on: http://stackoverflow.com/a/22339860
has text: Thanks. Still need help on the other problem.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34208723
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22486504
score: 0
has text: I mean the button where stands MOBIL and 849 and where the SMS symbol is :)

http://stackoverflow.com/q/22421988
score: 1
tagged with: java
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/22422600
answer count: 3
downvote count: 0
has body: I followed all the steps on pig.apache.org ,but not able to remove this error by setting java variable. I set the variable earlier while installing java jdk but its asking again for the variable.
has title: 'JAVA_HOME is not set' error while installing pig. What to do about it?
favorite count: 0
has answer: http://stackoverflow.com/a/22422218
tagged with: apache-pig
has comment: http://stackoverflow.com/comment/34181169
possible better answer: http://stackoverflow.com/a/22422218
has answer: http://stackoverflow.com/a/22422600
upvote count: 1
has answer: http://stackoverflow.com/a/22425636
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34095036

http://stackoverflow.com/a/55648103
has body: The easiest way to animate Visibility changes is use Transition API which available in support (androidx) package. Just call TransitionManager.beginDelayedTransition method then change visibility of the view. There are several default transitions like Fade, Slide. import androidx.transition.TransitionManager; import androidx.transition.Transition; import androidx.transition.Fade; private void toggle() { Transition transition = new Fade(); transition.setDuration(600); transition.addTarget(R.id.image); TransitionManager.beginDelayedTransition(parent, transition); image.setVisibility(show ? View.VISIBLE : View.GONE); } Where parent is parent ViewGroup of animated view. Result: Here is result with Slide transition: import androidx.transition.Slide; Transition transition = new Slide(Gravity.BOTTOM); It is easy to write custom transition if you need something different. Here is example with CircularRevealTransition which I wrote in another answer. It shows and hide view with CircularReveal animation. Transition transition = new CircularRevealTransition(); android:animateLayoutChanges="true" option does same thing, it just uses AutoTransition as transition.
upvote count: 194
has comment: http://stackoverflow.com/comment/100999038
has comment: http://stackoverflow.com/comment/108186944
type: Answer
score: 194
answers question: http://stackoverflow.com/q/22454839
has comment: http://stackoverflow.com/comment/103188134
downvote count: 0

http://stackoverflow.com/q/22373766
tagged with: statistics
has comment: http://stackoverflow.com/comment/34010803
score: 0
has body: My program listens for incoming data and an estimate of 5 data comes in every second. All the data will be stored in a data structure. When the data structure is of size 360 000, I will need to find the 25th, 50th and 75th percentile among the data stored. Which of the following would be more efficient? Or if you know a better method please help me out. Should I use an order statistics tree? Insert, delete (log n). Or should I wait till it has collected all 360 000 data, then sort it and find the 25th, 50th and 75th percentile from there.
has comment: http://stackoverflow.com/comment/34010951
answer count: 1
has answer: http://stackoverflow.com/a/22374395
has comment: http://stackoverflow.com/comment/34011633
has comment: http://stackoverflow.com/comment/34011217
has comment: http://stackoverflow.com/comment/34010848
tagged with: complexity-theory
has title: 25th, 50th and 75th percentile of a data structure of size 360 000
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34010675
type: Question
accepted answer: http://stackoverflow.com/a/22374395
has comment: http://stackoverflow.com/comment/34011001
tagged with: data-structures

http://stackoverflow.com/comment/34117325
has text: I'm using setContentView in my `onTouchEvent` method, it's how the PixelParticle is displayed. If I use it in the `onCreate` method as you suggest, my Pixel will not display.
score: 0
comment on: http://stackoverflow.com/q/22434653
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22425786
type: UnansweredQuestion
tagged with: android
tagged with: store
has answer: http://stackoverflow.com/a/22425962
has answer: http://stackoverflow.com/a/22425912
tagged with: java
linked to: http://stackoverflow.com/q/11790104
downvote count: 1
has body: I'm modifying this quiz app chuck quiz app i want to know how to store images because i need to display different image every question in that app. Anyone can help me? thanks in advance
has title: android - how to store and retrieve multiple images in sqlite
type: Question
tagged with: database
score: -1
has comment: http://stackoverflow.com/comment/34101398
answer count: 2
upvote count: 0
tagged with: sqlite
has comment: http://stackoverflow.com/comment/34101466
favorite count: 0
linked to: http://stackoverflow.com/q/6341977

http://stackoverflow.com/q/22370620
has body: package fileBrowser; import java.io.File; public class Filewalker { String str=""; public void walk( String path) { File root = new File( path ); File[] list = root.listFiles(); int numfiles=list.length; for (int i=0;i<list.length; i++ ) { if ( list[i].isDirectory() ) { System.out.print(" "+list[i].getName()+"\n "); if(list[i].listFiles().length==0){ System.out.println(" \n "); continue; } walk( list[i].getAbsolutePath()); } else { System.out.println( " "+list[i].getName()+" " ); if(i==numfiles-1){ System.out.println(" "); } } } } public static void main(String[] args) { Filewalker fw=new Filewalker(); System.out.println(" "); fw.walk("C:/test"); System.out.println(" "); } } the nesting of the folders in the ul list is not proper if the the folders have many nested folders when the the method is returning from the inner most folder the closing of the li tag is not happening the output that i am getting is: abc ced New Microsoft Publisher Document - Copy (2).pub New Microsoft Word Document - Copy (2).docx test inner inner2 New Text Document.txt New Bitmap Image.bmp New Microsoft Publisher Document.pub New WinRAR ZIP archive.zip New Microsoft Publisher Document - Copy.pub New Microsoft Publisher Document.pub New Microsoft Word Document - Copy.docx New Microsoft Word Document.docx temp1.txt xyz stud11.txt temp.txt
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/22371773
has answer: http://stackoverflow.com/a/22370720
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22372028
has title: Read in all the files in a particular directory displays the file names in a html list in java
has comment: http://stackoverflow.com/comment/34011352
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34099327

http://stackoverflow.com/a/24878749
upvote count: 1
has body: use s.nextline() instead of s.next() as s.next() read only first token string Scanner sc= new Scanner(System.in); String s = sc.nextLine(); System.out.println(new StringBuilder(s).reverse().toString());
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22430801

http://stackoverflow.com/comment/34194075
has text: When you call an ajax request to the server it should respond with the data that you can use to modify the DOM of your page.
comment on: http://stackoverflow.com/q/22477899
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22389283
answers question: http://stackoverflow.com/q/22388876
score: 0
has body: package com.cisco.staff; public class Staff { private StaffMember[] staffList; public Staff () { staffList = new StaffMember[6]; staffList[0] = new Executive ("Sam", "123 Main Line", "555-0469", "123-45-6789", 2423.07); staffList[1] = new Employee ("Carla", "456 Off Line", "555-0101", "987-65-4321", 1246.15); staffList[2] = new Employee ("Woody", "789 Off Rocker", "555-0000", "010-20-3040", 1169.23); staffList[3] = new Hourly ("Diane", "678 Fifth Ave.", "555-0690", "958-47-3625", 10.55); staffList[4] = new Volunteer ("Norm", "987 Suds Blvd.", "555-8374"); staffList[5] = new Volunteer ("Cliff", "321 Duds Lane", "555-7282"); /* ((Executive)staffList[0]).awardBonus (500.00); ((Hourly)staffList[3]).addHours (40);*/ } public void payday () { double amount; for (int count=0; count &lt; staffList.length; count++) { System.out.println (staffList[count]); amount = staffList[count].pay(); if (amount == 0.0) System.out.println ("Thanks!"); else System.out.println ("Paid: " + amount); System.out.println ("-----------------------------------"); } } public StaffMember[] getStaffList() { return staffList; } public void setStaffList(StaffMember[] staffList) { this.staffList = staffList; } } package com.cisco.staff; abstract public class StaffMember { protected String name; protected String address; protected String phone; //----------------------------------------------------------------- // Constructor: Sets up this staff member using the specified // information. //----------------------------------------------------------------- public StaffMember (String eName, String eAddress, String ePhone) { name = eName; address = eAddress; phone = ePhone; } //----------------------------------------------------------------- // Returns a string including the basic employee information. //----------------------------------------------------------------- public String toString() { String result = "Name: " + name + "\n"; result += "Address: " + address + "\n"; result += "Phone: " + phone; retu…
type: Answer

http://stackoverflow.com/q/22384297
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22384849
tagged with: servlets
type: Question
accepted answer: http://stackoverflow.com/a/22384502
answer count: 2
downvote count: 0
has title: Accessing a Filter object through a WebApplicationContext
has body: I want to call a method on a Filter object after it has been added according to the web.xml definition. All I got is a WebApplicationContext object (let's call it: wac). I'm able to add new Filter objects via: wac.getServletContext().addFilter("otherfilter", otherFilter); Also, I can test successfully for its existence via: wac.getServletContext().getFilterRegistration("myfilter") But how may I access (and possibly modify) Filter objects which have been added before?
favorite count: 0
has answer: http://stackoverflow.com/a/22384502
upvote count: 1
tagged with: servlet-filters
tagged with: spring
has answer: http://stackoverflow.com/a/22384849
tagged with: jakarta-ee

http://stackoverflow.com/a/22422359
upvote count: 2
has comment: http://stackoverflow.com/comment/34098707
score: 2
has body: You can achieve it at least in 2 ways: Send only the id of the selected MaritalStatus (you actually do it in your jsp), bind it directly to regForm.maritalStatusId and then (when you need it) get the MaritalStatus from the maritalList by the selected id (you have to keep the maritalList or create it somewhere, you do it anyway) Bind your select directly to regForm.maritalStatus &lt;form:select path="maritalStatus"&gt; and write a specialized formatter that can convert from id to MaritalStatus object and vice versa. You'll find more information how to do it here: http://docs.spring.io/spring/docs/4.0.0.RELEASE/spring-framework-reference/html/validation.html#format [You could also send the id of the selected field and additionally its value in the hidden field and then try to build from those the MaritalStatus on the server side, but it is not elegant.]
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22421628

http://stackoverflow.com/comment/34003983
comment on: http://stackoverflow.com/q/22363633
score: 0
type: Comment
type: QuestionComment
has text: I don't know how you plan on getting text that's in a canvas like this: http://www.rgraph.net/blog/2013/april/an-example-of-the-html5-canvas-text-function.html It's practically an image.

http://stackoverflow.com/q/22430949
has body: im have and error Ikan is not abstract and does not override abstract method setName class Ikan extends Animal implements Pet and Kucing is not abstract and does not override abstract method setName class Kucing extends Animal implements Pet abstract class Animal { protected int Legs; protected String Eater; Animal (int l,String e) { Legs = l; Eater = e; } abstract public void walk (); abstract public void eat (); int getLegs () { return Legs; } String getEater () { return Eater; } } interface Pet { void setName(); String getName(); void balikNama(); void play(); } class Ikan extends Animal implements Pet { String name,mainan; Ikan (int l,String e) { super(l,e); } void setMainan (String m) { mainan = m; } void getMainan () { System.out.println ("Ikan ini bermain"+mainan); } public void setName (String n) { name = n; } public String getName () { return name; } public void balikNama () { for (String part : name.split(" ")) { System.out.print(new StringBuilder(part).reverse().toString()); System.out.print(" "); } } public void play () { System.out.println (name+" lagi mainan "+mainan); } public void walk () { System.out.println ("Tidak bisa berjalan bisanya renang"); } public void eat () { System.out.println ("Hewan ini memakan "+Eater); } } class Kucing extends Animal implements Pet { String name,mainan; Kucing (int l,String e) { super(l,e); } void setMainan (String m) { mainan = m; } void getMainan () { System.out.println ("Kucing ini bermain"+mainan); } public void setName (String n) { name = n; } public String getName () { return name; } public void balikNama () { for (String part : name.split(" ")) { System.out.print(new StringBuilder(part).reverse().toString()); System.out.print(" "); } } public void play () { System.out.println (name+" lagi mainan "+mainan); } public void walk () { System.out.println ("Berjalan dengan "+Legs+" kaki"); } public void eat () { System.out.println ("Hewan ini memakan "+Eater); } } class Laba extends Animal { String name; Laba (int l,…
has comment: http://stackoverflow.com/comment/34110761
type: UnansweredQuestion
tagged with: interface
has title: Java error = is not abstract and does not override abstract method
tagged with: java
has comment: http://stackoverflow.com/comment/34110799
type: Question
has answer: http://stackoverflow.com/a/22430975
score: 0
answer count: 2
tagged with: abstract
tagged with: arrays
has answer: http://stackoverflow.com/a/22430976

http://stackoverflow.com/q/22397594
has body: I'm developing a employee management system with oracle and java swing. and while writing code for it how to bring the key concepts of object oriented programming namely inheritance,encapsulation,polymorphism,data abstraction.Can you send me a sample program for it or explain how to achieve .Thanks in advance
favorite count: 0
has comment: http://stackoverflow.com/comment/34052173
has comment: http://stackoverflow.com/comment/34052193
tagged with: oracle-database
tagged with: swing
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22397979
has comment: http://stackoverflow.com/comment/34052310
downvote count: 1
has comment: http://stackoverflow.com/comment/34052326
type: Question
upvote count: 0
has title: how can we achieve object oriented concepts in java swing
score: -1
has comment: http://stackoverflow.com/comment/34052116
accepted answer: http://stackoverflow.com/a/22397979
answer count: 1

http://stackoverflow.com/q/22483089
has answer: http://stackoverflow.com/a/22483138
accepted answer: http://stackoverflow.com/a/22483138
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22483129
answer count: 2
tagged with: nullpointerexception
has body: I'm working on making a codebase complaint with a list of PMD rules. These include that you're not allowed to throw or catch NullPointerExceptions. I found this method which requires 2 instance variables to be non-null in order to run. It throws a NullPointerException otherwise: public String build() { if (apiKey == null || url == null) { throw new NullPointerException( "Cannot build: API key and URL must be set"); } What should it be throwing instead? it seems to me that NullPointerException would be the bast call. The only other thing that comes to mind is IllegalArgumentException, but these aren't really arguments, so I don't think it really fits.
upvote count: 1
possible better answer: http://stackoverflow.com/a/22483129
favorite count: 0
has title: Exception to throw when instance variables are null
type: AnsweredQuestion

http://stackoverflow.com/comment/34055212
has text: I solved it, stupidest error, my group member had written code that wrote Truck objects to the local datastore as everything strings, so when my getTruck() method ran, it couldn't get some of the Truck objects b/c String cannot be cast to double(expected). I deleted my local database and it works now.
comment on: http://stackoverflow.com/q/22393628
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33964971
has text: You're right Marco, it's not an exe file. It's jar file. Thanks.
comment on: http://stackoverflow.com/q/22329559
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22333840
upvote count: 2
score: 1
tagged with: java
tagged with: selenium
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33941219
linked to: http://stackoverflow.com/q/18332598
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22333957
has body: Can we verify whether the text which is written in PASSWORD field is being displayed in masked format or not?
type: UnansweredQuestion
has title: can we check that text in password field is displayed masked?
tagged with: selenium-webdriver

http://stackoverflow.com/comment/34079565
has text: Then the file is not where you think it is. Try and `System.out.println(path.toAbsolutePath())` before the `try` block to see where the file is actually created
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22412400

http://stackoverflow.com/comment/34127573
comment on: http://stackoverflow.com/a/22431219
score: 0
type: AnswerComment
has text: read the `4. If unsuccessful, reprompt the user until success` section. You just need to show the dialog once. Then let the user enter login information, if correct dismiss the dialog, otherwise let it shown !!
type: Comment

http://stackoverflow.com/q/22474884
has title: execute anonymous pl/sql block file with values from java
has comment: http://stackoverflow.com/comment/34189120
tagged with: plsql
has comment: http://stackoverflow.com/comment/34188064
tagged with: sql
has comment: http://stackoverflow.com/comment/34188643
answer count: 1
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/34188709
has body: I have an anonymous pl/sql block in an sql file and I want to execute and assign values to it in Java. My sql block looks like this DECLARE someInput1 NUMBER(1); someInput2 NUMBER(2); someString1 VARCHAR(100); BEGIN someInput1 := ‘&amp;1’; someInput2 := ‘&amp;2’; --get name in table A BEGIN SELECT a.value INTO someString1 FROM TABLE_A a WHERE a.id = someInput1; END; UPDATE TABLE_B b SET b.someStringRow = someString1 WHERE b.someIntRow = someInput2; COMMIT; END; / exit; What I am planning to do is load the sql file in a Java String, change ‘&amp;1’ to ?1 and execute it as a CallableStatement. However, I am getting PLS-00103: Encountered the symbol “” when expecting one of the following begin function package pragma procedure subtype us &lt;an identifier&gt; &lt;a double quoted delimited identifier&gt; form current cursor Error occured at lines in DECLARE section Is my approach an acceptable solution, if yes, what may be wrong in my approach? Are there other better solution for my problem? Thanks
has comment: http://stackoverflow.com/comment/34187805
has comment: http://stackoverflow.com/comment/34189991
has answer: http://stackoverflow.com/a/22475379
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34189780

http://stackoverflow.com/comment/34026669
has text: Sure, an example to disable/enable all JButtons: public void flipEnabledOnAllButtons(boolean enabled, Container rootContainerToSearch) { for (Component c : rootContainerToSearch.getComponents()) { if (c instanceof Container) { disableAllButtons((Container)c); } else { if (c instanceof JButton) { c.setEnabled(enabled); } } } }
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22382477

http://stackoverflow.com/comment/34147327
score: 0
type: QuestionComment
type: Comment
has text: @EJP it hasn't zero relevance. Now I'm aware of my mistake, so it was useful for me to put that comment here. ; )
comment on: http://stackoverflow.com/q/22451394

http://stackoverflow.com/a/22455943
has comment: http://stackoverflow.com/comment/34246134
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34155657
has body: You need to place a return statement when you find a false item -- else, you're simply returning the boolean found in the last iteration of your loop. public boolean isPalindrome (Stack a, Stack b) { Object temp1; Object temp2; boolean answer; for (int i = 0; a.size() &gt; 0; i++) { temp1 = a.pop(); temp2 = b.pop(); if (temp1 != temp2) { answer = false; return answer; } else { answer = true; } } return answer; }
downvote count: 0
answers question: http://stackoverflow.com/q/22455726

http://stackoverflow.com/q/22439435
tagged with: swing
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: mysql
tagged with: selection
type: Question
upvote count: 2
tagged with: jtable
answer count: 1
has title: How to add a selection column to a JTable which shows search results
favorite count: 0
has body: I am using netbeans 7.4. I created a JFrame which search data from a mysql database and display the results in a JTable. I need to make the user able to make a selection on the resulted rows(Here Im using a database which is having a table named "Vehicle_R" which contains data about vehicles. So the user should be able to select a vehicle). Here is my coding public class CreateConnection { Connection con; Statement statmnt; public CreateConnection() { try{ this.con =DriverManager.getConnection("jdbc:mysql://localhost:3306/vehiclereserve","root","nadun"); statmnt=con.createStatement(); } catch(SQLException e) {System.out.println(e.toString());} } public Connection getCon() { return con; } public Statement getStatement() { return statmnt; } in the main i got private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try{ CreateConnection con=new CreateConnection(); ResultSet res=con.getStatement().executeQuery("select * from Vehicle_R"); jTable1.setModel(DbUtils.resultSetToTableModel(res)); //rs2xml.jar library added //TableColumn tc=new TableColumn(); //jTable1.addColumn(tc); } catch (SQLException e) { JOptionPane.showMessageDialog(null, e.toString(), "ERROR", JOptionPane.ERROR_MESSAGE); } A new column should be added with check boxes to make selections. Please consider Im new in java.
has answer: http://stackoverflow.com/a/22442097
accepted answer: http://stackoverflow.com/a/22442097

http://stackoverflow.com/q/22397609
has comment: http://stackoverflow.com/comment/34052321
has answer: http://stackoverflow.com/a/22672259
type: Question
has body: I'm new to Java EE development although I've been doing Android development for years. In Android I use Google Gson to serialize or deserialize Java classes. Is this the most popular way of doing this for Java EE development or should I be looking at some other API that is more suitable for this platform?
has comment: http://stackoverflow.com/comment/34052129
answer count: 1
has comment: http://stackoverflow.com/comment/34052324
has comment: http://stackoverflow.com/comment/34052139
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34052233
has comment: http://stackoverflow.com/comment/34052221
has title: Serializing / Deserializing Java classes to and from JSON
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/q/22475737
tagged with: java
has title: Is there some sort of Java REPL/shell that I can use to quickly test class files?
has comment: http://stackoverflow.com/comment/34189669
has comment: http://stackoverflow.com/comment/34192729
type: Question
tagged with: testing
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/23331596
has comment: http://stackoverflow.com/comment/34189831
has answer: http://stackoverflow.com/a/25024755
score: 2
has comment: http://stackoverflow.com/comment/34189288
linked to: http://stackoverflow.com/q/397488
has comment: http://stackoverflow.com/comment/38392158
has comment: http://stackoverflow.com/comment/34193051
favorite count: 0
possible better answer: http://stackoverflow.com/a/25024755
upvote count: 2
has comment: http://stackoverflow.com/comment/34190026
tagged with: read-eval-print-loop
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23331596
has body: I need a Java REPL/shell to quickly test some class files. Since they are mostly throwaway code, I don't want to have to bother writing full-blown unit tests. And writing a Main class is also too much extra work for some quick testing.

http://stackoverflow.com/q/22480387
answer count: 1
tagged with: objectinputstream
has title: Get filepointer position while reading data from an ObjectInputStream
tagged with: randomaccessfile
has body: I need to get the current filepointer-position (in bytes) when I read from my binary file. I wrote the file using ObjectOutputStream, and now I need to read it and remember the byte-position of each object. However: ObjectInputStream doesn't provide a method to read the pointer position, and RandomAccessFile cannot read Objects :( If you think there's a way, or even a workaround, this extra information might help: I have stored IDs in my file. Each ID lists at least one node (can be many nodes). All as Long-Values. For Example: ID Node Node ... 123151824812 12419512 1248129412 124912 5992039 1924823590 5238952323942 283492384 234892348 234908234 2348902348 5902303 239235523 ... Each ID is an individual object which stores the id-value itself as a long value, the nodes as an ArrayList&lt;Long&gt;. There's a second file which stores Nodes and lists the parenting IDs of each Node. Like this: Node ID ID ... 12419512 123151824812 234892348 5238952323942 27834918128911 ... The idea behind is: Whenever I know an ID and want to know information about the node, then I look which node is at the specific position in the node-file. Whenever I know the node and want to know more about its parenting ID, then I look at the specific position in the ID file. However currently I did just write the ID and Node-values itself into the files using them as "index". I don't want to look line-for-line if that's the ID I'm looking for, as these files can become very large (GB-size). It would be easier if I remember the byte-position of the other file instead of a line-index or so, because then I can simply jump to it using skip() or similar methods. Conclusion: How to get the file pointer position (in bytes) from the beginning of the next object while reading from an ObjectInputStream?
accepted answer: http://stackoverflow.com/a/22481601
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34197187
type: Question
has comment: http://stackoverflow.com/comment/34197705
tagged with: file-pointer
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22481601

http://stackoverflow.com/comment/34156531
type: QuestionComment
comment on: http://stackoverflow.com/q/22449076
score: 0
has text: when u say its not working... what's happening, are you getting an error, or the textfield does not have a value?
type: Comment

http://stackoverflow.com/a/22371948
upvote count: 4
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/22371720
has comment: http://stackoverflow.com/comment/34007536
has body: DefaultTableModel model ; /** Creates new form DynRowAdd */ public DynRowAdd() { initComponents(); model = new DefaultTableModel(); jTable1.setModel(model); model.addColumn("Id"); model.addColumn("First Name"); model.addColumn("Last Name"); model.addColumn("Company Name"); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { model.addRow(new Object[]{jTextField1.getText(), jTextField2.getText(),jTextField3.getText(),jTextField4.getText()}); }

http://stackoverflow.com/comment/34172706
type: Comment
comment on: http://stackoverflow.com/a/22465557
has text: ooh ok thanks, I'll check it, and btw could you give me an example or any code on how to create the second ArrayList? I've never worked with them that way.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34016572
has text: Your questions says to use java, but not tagged with 'java' do you mean javascript or java ? - If 'java' tag as java
score: 0
comment on: http://stackoverflow.com/q/22377564
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22354333
type: Answer
has comment: http://stackoverflow.com/comment/34018685
score: 1
has comment: http://stackoverflow.com/comment/33979989
has comment: http://stackoverflow.com/comment/33977344
has comment: http://stackoverflow.com/comment/61544683
upvote count: 1
has body: not that i'm aware of. But you could select the last node: /header/*[@timestamp = 2] and then use selectPrecedingNode()
has comment: http://stackoverflow.com/comment/33979427
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33980754
accepted answer of: http://stackoverflow.com/q/22353535
answers question: http://stackoverflow.com/q/22353535

http://stackoverflow.com/q/22451125
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/34148278
has body: In my websecurityconfig file I have the following: .formLogin() .loginPage("/api/players/authenticate") .successHandler(authenticationSuccessHandler) .permitAll() .and() For some reason Spring does a redirect GET to this url instead of a redirect POST, leading to me getting: [org.springframework.web.servlet.PageNotFound] (default task-2) Request method 'GET' not supported How do I set POST instead?
type: Question
tagged with: java
has title: Spring Security: Request method 'GET' not supported
has comment: http://stackoverflow.com/comment/34150627

http://stackoverflow.com/comment/33950865
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22339065
has text: @Ruben When you implement `compareTo`, it is called an override (whether you annotate it or not).
score: 0

http://stackoverflow.com/q/22418524
has comment: http://stackoverflow.com/comment/34089713
has body: I have a computer program in which I have to read code from two text files and then use a merge sort to merge and then sort the two text files. I cannot just put the two inventories back to back into an array and sort! My code works for ArrayLists and so I have commented them out and replaced them with an Array and other Array elements where necessary, all of the changes were made to the Inventory class. There are no syntax errors when I compile however my try catch finds an error. Here are the two text files: Store1.txt STORE 1 INVENTORY ID QTY U/P 362 5 12.98 471 2 6.70 792 13 25.00 901 7 2.98 and Store2.txt STORE 2 INVENTORY ID QTY U/P 163 4 7.20 209 5 11.98 471 5 6.70 608 4 5.90 627 2 9.99 792 1 25.00 812 4 6.00 I have multiple classes. This is the tester class where i compile my program from import java.io.*; public class MergeInventories { public static void main() { header(); try { Inventory store1 = new Inventory(new File("F:\\M359 AP Computer Science\\JAVA\\Merge Inventories\\Store1.txt")); Inventory store2 = new Inventory(new File("F:\\M359 AP Computer Science\\JAVA\\Merge Inventories\\Store2.txt")); CombinedInventory mergedInventory = mergeInventories(store1,store2); store1.print(); store2.print(); mergedInventory.print(); } catch(Exception e) { System.out.print("Error."); } } private static CombinedInventory mergeInventories(Inventory a, Inventory b) { CombinedInventory inv = new CombinedInventory(); int i=0,j=0,k=0; while(i&lt;a.size()&amp;&amp;j&lt;b.size()) { if(a.getProduct(i).getID() == b.getProduct(j).getID()) { inv.add(new Product(a.getProduct(i).getID(),a.getProduct(i).getQty()+b.getProduct(j).getQty(),a.getProduct(i).getUP())); i++; j++; } else if(a.getProduct(i).getID() &gt; b.getProduct(j).getID()) { inv.add(b.getProduct(j)); j++; } else { inv.add(a.getProduct(i)); i++; } k++; } if(j&lt;b.size()) { for(j=j;j&lt;b.size();j++) { inv.add(b.getProduct(j)); } } else if(i&lt;a.size()) { for(i=i;i&lt;a.size();i++) { inv.add(a.getProduct(i)); } } retu…
has answer: http://stackoverflow.com/a/22546827
score: 2
has comment: http://stackoverflow.com/comment/34089407
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34089298
has comment: http://stackoverflow.com/comment/34089175
answer count: 1
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/34089262
has comment: http://stackoverflow.com/comment/34089604
tagged with: sorting
has comment: http://stackoverflow.com/comment/34089302
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34089330
has comment: http://stackoverflow.com/comment/34314890
has comment: http://stackoverflow.com/comment/34089101
favorite count: 0
tagged with: text-files
has comment: http://stackoverflow.com/comment/34089465
has title: How can I replace the ArrayList in my code with an Array and still have it work?
has comment: http://stackoverflow.com/comment/34089563
type: UnansweredQuestion

http://stackoverflow.com/q/22479715
has answer: http://stackoverflow.com/a/22496063
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22484155
downvote count: 0
score: 1
has title: Access Struts2 locale in Spring AbstractRoutingDataSource
favorite count: 0
type: Question
answer count: 2
tagged with: spring
has body: Our application uses Struts2 Internalization and Spring AbstractRoutingDataSource for dynamic database changes. Changing the language, the corresponding language database should be selected. So the below code makes the dynamic database selection using Spring RoutingDataSource. public class RoutingDataSource extends AbstractRoutingDataSource { protected Object determineCurrentLookupKey() { return LanguageContextHolder.getLanguagetype(); } } Spring RoutingDataSource is working fine. My problem is how to set the locale on change. Since it is stored in Struts2, I am not able to access it in Spring. I found the Spring MVC org.springframework.context.i18n.LocaleContextHolder would do this, but since we are using Struts2, how can I do the above?
accepted answer: http://stackoverflow.com/a/22484155
tagged with: java
upvote count: 1
tagged with: struts2
possible better answer: http://stackoverflow.com/a/22496063

http://stackoverflow.com/comment/35644343
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22357910
score: 0
has text: Rhino 1.7 [implements](https://developer.mozilla.org/en-US/docs/New_in_Rhino_1.7R4) JavaScript [1.7 as defined by Mozilla](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference). JSON wasn't added until JavaScript 1.8.

http://stackoverflow.com/q/22411165
type: Question
has title: How to pass value from Button.setOnClickListener to onDateSet Android
accepted answer: http://stackoverflow.com/a/22411302
has comment: http://stackoverflow.com/comment/34075765
has body: I have a class called InboxActivity in which I use datepicker, and I need to pass some data(it is one string var, like this: String test = "aa";) from protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_inbox); btn_outbox = (Button)findViewById(R.id.btn_outbox); btn_outbox.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { **FROM HERE!!!!** } }); to here: DatePickerDialog.OnDateSetListener d = new DatePickerDialog.OnDateSetListener() { public int Syear; public int Smonth; @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { }); How can this be done?
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34075773
tagged with: android
has comment: http://stackoverflow.com/comment/34075739
has answer: http://stackoverflow.com/a/22411302
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/34188522
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22475366
has text: how did you add a dialogue box? Please share.

http://stackoverflow.com/comment/35181329
type: AnswerComment
has text: I ended up chopping my method off into pieces and established the 'happens after relationship' by moving code inside callbacks. Full code at [Github](https://github.com/akshay2000/ProjectMirror-Android).
type: Comment
comment on: http://stackoverflow.com/a/22448864
score: 0

http://stackoverflow.com/q/22446120
has answer: http://stackoverflow.com/a/22446214
tagged with: java
upvote count: 1
type: Question
tagged with: indexoutofboundsexception
has body: I have been working on this program for hours, and have worked out nearly all of the errors that have cropped up in every other class. This one, however, I can's seem to fix the receive method. The receive method should first check (by comparing SKUs) whether or not the incoming product is already in myCatalog. If not, add the product (via its SKU) to the catalog. After that, in any case -- as long as there is still some of the incoming product not yet been placed in a bin -- I want to locate which bin contains the least total quantity. (If all the bins are full, add a new, empty bin to use)I'd add that specific product to that bin until the bin is either full -- at which point I'd repeat -- or I run out of the product. This repeats until no more incoming product is left. public class Warehouse { private int myBinMax; private ArrayList&lt;MusicMedia&gt; myCatalog; private ArrayList&lt;Bin&gt; myBins; public Warehouse( int binMax ) { myBinMax = binMax; myCatalog = new ArrayList&lt;MusicMedia&gt;(); myBins = new ArrayList&lt;Bin&gt;( 5 ); } public String toString() { return Tester.detailedInventory(myCatalog,myBins); } public void addBin() { myBins.add( new Bin( "B" + myBins.size() ) ); } public void receive( MusicMedia product, int quantity ) { boolean contained = false; int lowestAmount = myBinMax, leastFullBinIndex, i, insertQuantity; for(MusicMedia entry : myCatalog) { if(entry.getSKU().equals(product.getSKU())) { contained = true; } } if(!contained) { myCatalog.add(product); } while(quantity &gt; 0) { lowestAmount = myBinMax; for(i = 0; i &lt; myBins.size(); i++) { if(myBins.get(i).totalQuantity() &lt; lowestAmount) { lowestAmount = myBins.get(i).totalQuantity(); leastFullBinIndex = i; } if((i == myBins.size() - 1 &amp;&amp; lowestAmount == myBinMax)||(myBins.size() == 0)) { myBins.add(new Bin("bin" + Integer.toString(i))); } } if(quantity &gt;= myBinMax - lowestAmount) { insertQuantity = myBinMax - lowestAmount; } else { insertQuantity = quantity; } quantity -= …
tagged with: arraylist
downvote count: 0
answer count: 1
has title: Getting an"index:0" and "size:0" error from ArrayList.size()
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34138596
type: UnansweredQuestion

http://stackoverflow.com/comment/34024314
type: QuestionComment
comment on: http://stackoverflow.com/q/22380800
has text: @j.con Yes I want to drop teh decimal and E5 from the number.
score: 0
type: Comment

http://stackoverflow.com/a/22457273
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22457208
score: 1
downvote count: 0
has body: You never initialized your dish queues array list. Initialize it in your constructor. dishQueues = new ArrayList&lt;Queue&lt;Integer&gt;&gt;();

http://stackoverflow.com/a/22449257
downvote count: 0
has body: That code is replacing the text - "{{ token }}" with the value of token in the String index. The braces are escaped because replaceAll() works on regex. BTW, it can also be done with just replace(). No need of regex here: index = index.replace("{{ token }}", token);
type: Answer
has comment: http://stackoverflow.com/comment/34143644
score: 1
answers question: http://stackoverflow.com/q/22449218
upvote count: 1
has comment: http://stackoverflow.com/comment/34143679

http://stackoverflow.com/comment/34041460
type: Comment
has text: unfortunately, no luck. Still got the same message. I am generating .war using Maven (if this is relevant). Tried to add your suggested line as first line of method and also before "return". No difference.
comment on: http://stackoverflow.com/a/22385145
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34101683
comment on: http://stackoverflow.com/q/22426047
has text: @SotiriosDelimanolis Oops! missed that part.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22358653
has body: The SecretKeySpec should receive "AES", the mode is specified on Cipher. I cut some of your code to test. Here you have: public class AES { public static void main(String[] args) throws Exception { byte[] data = "abcdefghijkl".getBytes(); byte[] tmp = null; SecretKey tempKey1 = generateKey(); // saveKey(tempKey1); // SecretKey tempKey2 = loadKey(); tmp = encrypt(data, tempKey1); byte[] printString = decrypt(tmp, tempKey1); System.out.println(Arrays.equals(data, printString)); } public static SecretKey generateKey() throws NoSuchAlgorithmException { KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); keyGenerator.init(128); SecretKey key = keyGenerator.generateKey(); return key; } public static byte[] encrypt(byte[] data, SecretKey encryptionKey) throws Exception { IvParameterSpec iv = new IvParameterSpec("0102030405060708".getBytes()); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, encryptionKey, iv); byte[] encryptData = cipher.doFinal(data); return encryptData; } public static byte[] decrypt(byte[] tmp, SecretKey encryptionKey) throws Exception { IvParameterSpec iv = new IvParameterSpec("0102030405060708".getBytes()); SecretKeySpec spec = new SecretKeySpec(encryptionKey.getEncoded(), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, spec, iv); System.out.println(tmp.length); return cipher.doFinal(tmp); } } One extra detail: use base64 for cyphered data instead of String...
downvote count: 0
answers question: http://stackoverflow.com/q/22357583
has comment: http://stackoverflow.com/comment/34008516
score: 22
type: Answer
accepted answer of: http://stackoverflow.com/q/22357583
upvote count: 22
type: AcceptedAnswer

http://stackoverflow.com/q/22438304
has comment: http://stackoverflow.com/comment/34123827
answer count: 1
has comment: http://stackoverflow.com/comment/34124927
has body: I want to build maven project having EJB module and WEB module, where EJB is needed in WEB module. parent pom.xml 4.0.0 cz.literak.oauth OAuthLogin pom 1.0-SNAPSHOT OAuthLogin-web OAuthLogin-ejb OAuthLogin JEE Skeleton http://www.literak.cz/OAuthLogin/ EJB pom.xml OAuthLogin cz.literak.oauth 1.0-SNAPSHOT 4.0.0 OAuthLoginEJB 1.0-SNAPSHOT ejb OAuthLoginEJB Beans WEB pom.xml OAuthLogin cz.literak.oauth 1.0-SNAPSHOT 4.0.0 OAuthLoginWEB war OAuthLogin Webapp cz.literak.oauth OAuthLogin-ejb 1.0-SNAPSHOT jar compile Intellij Idea tells me that version is unknown. When I run mvn clean install in parent module, it fails with: [ERROR] Failed to execute goal on project OAuthLoginWEB: Could not resolve dependencies for project cz.literak.oauth:OAuthLoginWEB:war:1.0-SNAPSHOT: Could not find artifact cz.literak.oauth:OAuthLogin-ejb:jar:1.0-SNAPSHOT -> [Help 1] Where is the issue? I browsed similar questions without luck. Thanks.
score: 0
has comment: http://stackoverflow.com/comment/34123685
has comment: http://stackoverflow.com/comment/34123603
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22438524
has comment: http://stackoverflow.com/comment/34123736
has comment: http://stackoverflow.com/comment/34123666
tagged with: maven
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34123749
accepted answer: http://stackoverflow.com/a/22438524
has title: intermodule dependencies in maven

http://stackoverflow.com/q/22466506
has comment: http://stackoverflow.com/comment/34174283
has title: AlertDialog Extern - all fine but not returning the value as I wish
accepted answer: http://stackoverflow.com/a/22509546
has comment: http://stackoverflow.com/comment/34174054
score: 0
has comment: http://stackoverflow.com/comment/34191037
has comment: http://stackoverflow.com/comment/34186937
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/34175524
has comment: http://stackoverflow.com/comment/34195874
has comment: http://stackoverflow.com/comment/34196056
has answer: http://stackoverflow.com/a/22509546
has body: I'm trying to make a extern class for AlertDialog. I want to have an universal class to use it quickly. I know the code isn't difficult at all, but there are anyhow many rows to write (or copy) and if I would find a mistake I maybe had to change many code... I've everything but one thing I don't get. So it works but returning the correct onClick doesn't work. I've also tried to make an while loop before returning, but then the app is hanging.... Has somebody any idea? public class RalaAlertDialog{ private static AlertDialog.Builder alertDialog; private static long onClick=RalaInterfaceDefault.FehlerSpezialZahl; //neutralButton public static long AlertDialogNeutral(Context class_this, String mssg, String ntrlBttnTxt, boolean dismissable, String title){ onClick=RalaInterfaceDefault.FehlerSpezialZahl; //default error number alertDialog=new AlertDialog.Builder(class_this); if(mssg.equals("")){ mssg="DEFAULT-TEXT"; } if(title.equals("")){ title="DEFAULT-TITLE"; } if(ntrlBttnTxt.equalsIgnoreCase("")){ System.out.println("No values set - default in use."); ntrlBttnTxt="OK"; } alertDialog.setMessage(mssg) .setCancelable(dismissable); alertDialog.setTitle(title); alertDialog.setPositiveButton(ntrlBttnTxt, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id){ onClick=0; dialog.dismiss(); } } ); AlertDialog a=alertDialog.create(); a.show(); //wait until button is click before continuing return onClick; }
tagged with: android-alertdialog
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34174202
has comment: http://stackoverflow.com/comment/34182505
has comment: http://stackoverflow.com/comment/34196104
tagged with: java
has comment: http://stackoverflow.com/comment/34184359
type: Question
has comment: http://stackoverflow.com/comment/34174082
has comment: http://stackoverflow.com/comment/34195811

http://stackoverflow.com/comment/34021689
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22380285
score: 0
has text: your JSON looks incomplete

websocket
tags question: http://stackoverflow.com/q/22426393
tags question: http://stackoverflow.com/q/22369238
tags question: http://stackoverflow.com/q/22422595
type: Tag
tags question: http://stackoverflow.com/q/22435622
tags question: http://stackoverflow.com/q/22399471
tag name: websocket
tags question: http://stackoverflow.com/q/22371560
tags question: http://stackoverflow.com/q/22454383
tags question: http://stackoverflow.com/q/22437615
tags question: http://stackoverflow.com/q/22395095

http://stackoverflow.com/q/22366409
has comment: http://stackoverflow.com/comment/33999757
type: UnansweredQuestion
tagged with: jpa
answer count: 0
has title: could not get the persisted sequence number from db after save and flush in jpa
tagged with: spring-data-jpa
type: Question
has body: We have a table with composite primary key as sequence number, id for a table ... let's say parent_tbl. This sequence number is an oracle seq number that is generated with a trigger before insert on each row. We have another table, let's call it child_tbl with a uni-directional many-to-one association to parent_tbl. after persisting the parent_tbl. it returns sequence number as 0. But, I need the sequence number for persisting child_tbl, otherwise, it returns integrity constraint (*_FK1) violated - parent key not found. I am currently using spring data jpa. How can I retrieve the sequence number?
has comment: http://stackoverflow.com/comment/33999906
has comment: http://stackoverflow.com/comment/33999953
score: 0
tagged with: java

http://stackoverflow.com/comment/34010255
comment on: http://stackoverflow.com/q/22373515
score: 0
has text: Let me guess: You tried with double-click? Try to execute it via terminal command: `java -jar yourJar.jar`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22409614
type: Answer
has comment: http://stackoverflow.com/comment/34076654
has comment: http://stackoverflow.com/comment/34074527
has body: Your shell will try to expand $ with an environment variable. You have to protect it $ with either a \: grep /PGProcid=1\$ or "": grep "/PGProcid=1$" Edit: To be more precise, you should use the \&gt; to match the empty string at the end of a word. And as both \ and &gt; are interpreted by the shell, you should protect them as well: grep /PGProcid=1\\\&gt; or grep "/PGProcid=1\&gt;" If you want to have a "word match" (which it seems to me), you can also try the -w option: grep -w /PGProcid=1
upvote count: 1
has comment: http://stackoverflow.com/comment/34078788
has comment: http://stackoverflow.com/comment/34075248
has comment: http://stackoverflow.com/comment/34144872
score: 1
accepted answer of: http://stackoverflow.com/q/22409389
has comment: http://stackoverflow.com/comment/34075636
answers question: http://stackoverflow.com/q/22409389
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34073677
downvote count: 0
has comment: http://stackoverflow.com/comment/34074274
has comment: http://stackoverflow.com/comment/34074360
has comment: http://stackoverflow.com/comment/34074043

http://stackoverflow.com/a/22448435
type: Answer
answers question: http://stackoverflow.com/q/22448377
has body: As I know, MySQL doesn't support embedded problems. You have to run it as a independent component of your system. If your really need the DB come along with your application, you can try SQLite https://sqlite.org/ or BekelyDB. For more information, take a look at this to have more detail http://en.wikipedia.org/wiki/Embedded_database Hope this help.
score: 0

http://stackoverflow.com/a/22359925
downvote count: 0
answers question: http://stackoverflow.com/q/22357644
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/34070599
score: 2
accepted answer of: http://stackoverflow.com/q/22357644
has comment: http://stackoverflow.com/comment/34074254
has comment: http://stackoverflow.com/comment/34068303
has body: Spring already supports JAXWS through *JaxWsServiceExporter and SpringBeanAutowiringSupport (in spring-web). The *Exporter approach doesn't quite mesh with the REST stuff because it isn't in the embedded container. You'd end up with an app listening on 2 ports (one for XML and one for JSON). If either of those works then you have a solution. If you don't really care that much about SOAP and just want XML representations, you can use normal content negotiation features (e.g. @ResponseBody or @RestController for everything).
type: AcceptedAnswer

http://stackoverflow.com/comment/33967992
has text: you could add a 'verify token' method to service1, then call this directly from service2 once it receives the token from the client?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22349069

http://stackoverflow.com/comment/34054622
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22395974
has text: Also, don't forget to accept the answer if your question has been answered ;)

http://stackoverflow.com/q/22389996
tagged with: java
accepted answer: http://stackoverflow.com/a/22408998
has comment: http://stackoverflow.com/comment/34122597
tagged with: servlets
linked to: http://stackoverflow.com/q/36489253
type: Question
has comment: http://stackoverflow.com/comment/34117625
has comment: http://stackoverflow.com/comment/34070888
has answer: http://stackoverflow.com/a/22408998
upvote count: 19
has title: How to configure spring-boot servlet like in web.xml?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34118769
has body: I have a simple servlet configuration in web.xml: appServlet org.atmosphere.cpr.MeteorServlet org.atmosphere.servlet org.springframework.web.servlet.DispatcherServlet contextClass org.springframework.web.context.support.AnnotationConfigWebApplicationContext contextConfigLocation net.org.selector.animals.config.ComponentConfiguration 1 true appServlet / How can I rewrite it for SpringBootServletInitializer?
tagged with: spring
score: 19
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: spring-boot
downvote count: 0

http://stackoverflow.com/q/22356879
tagged with: junit
favorite count: 0
tagged with: resultset
has comment: http://stackoverflow.com/comment/33982561
tagged with: oracle-database
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22356981
type: Question
has body: I am writing some tests, and I want to verify during these specific tests that my database has not been modified. Is there an easy way to do this that doesn't require me to write individual queries for each table? Basically, I would like something like this: public Map&lt;String,ResultSet&gt; getDbSnapShot(List&lt;String&gt; tableNames) { //get rows for specified tables to check from tableNames parameter //returns a map where the key is the table name and the value is the result set } public void verifySnapShotsAreEqual(Map&lt;String,ResultSet&gt; snapShot1, Map&lt;String,ResultSet&gt; snapshot2) { //compare snapshot1 and snapshot 2, verify no rows have been modified } Then I would call getDbSnapShot before and after my test and compare the results. Thanks so much.
possible better answer: http://stackoverflow.com/a/22357131
has answer: http://stackoverflow.com/a/22357045
accepted answer: http://stackoverflow.com/a/22357045
tagged with: java
has comment: http://stackoverflow.com/comment/33982389
has answer: http://stackoverflow.com/a/22357131
upvote count: 2
has title: How can I verify in Java that tables have not been modified?
answer count: 3

http://stackoverflow.com/a/22409433
answers question: http://stackoverflow.com/q/22409321
score: 2
downvote count: 0
has body: System.out.println(n); would write to the console, a JSP provides its own out writer, thus just write out.println(n);, i.e. without the System context. Or if you want to write the number into your input field then use something like this: ORDER NO &lt;input type="text" name="order" value="&lt;%=n%&gt;"/&gt;
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22409321

http://stackoverflow.com/comment/34077454
type: Comment
type: QuestionComment
has text: I am not using maven for dependencies.
score: 0
comment on: http://stackoverflow.com/q/22409911

http://stackoverflow.com/comment/34123546
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22438345
has text: Ahh! `((PassengerCar) vogn)` is _casting_? Then I know what to Google. Thank you all so much! :-) (edit: seems I don't have to Google. Thank you all for the responses - apparently I can't upvote yet, but thank you anyway! :))
type: Comment

http://stackoverflow.com/comment/34177519
comment on: http://stackoverflow.com/a/22468221
type: Comment
score: 0
has text: Thanks for the reply. I am still getting the same error after adding nullable = false. Do you have any other ideas ?
type: AnswerComment

http://stackoverflow.com/comment/34026943
comment on: http://stackoverflow.com/a/22382387
type: AnswerComment
score: 0
has text: `You should not use (or override)` - sure you can. That method is used to set the value that should be rendered. It doesn't change the data in the model.
type: Comment

http://stackoverflow.com/q/22470791
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22470835
has answer: http://stackoverflow.com/a/22470838
type: Question
linked to: http://stackoverflow.com/q/11871520
tagged with: java
has title: Assigning array variable inside of a loop
upvote count: 1
has body: new to programming but trying to assign to my double variable inside my for loop. Basically I need to use Math.abs and Math.sin, which is sort of throwing me off. Any help is appreciated. If i need to provide any more information please let me know. double[] xValues = new double[arrayAmount]; double[] yValues = new double[arrayAmount]; xValues[0] = minimumValue; for (int index = 0; index==arrayAmount; index++) { yValues = 20.0 * Math.abs((Math.sin(xValues))); // java saying this is wrong }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22470876
answer count: 4
tagged with: for-loop
has answer: http://stackoverflow.com/a/22470808
tagged with: arrays
downvote count: 0

http://stackoverflow.com/q/22477410
has comment: http://stackoverflow.com/comment/34191935
answer count: 9
type: UnansweredQuestion
tagged with: time
tagged with: multithreading
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/22477558
has answer: http://stackoverflow.com/a/22477538
tagged with: java
tagged with: date
has body: I am making an Android App that at some activity shows a timer with hours minutes and seconds. As seconds value will update every second, I was thinking to make a thread with 1000 ms sleep, after each cycle it will add 1 to seconds and update the text view. Accordingly it will calculate minutes and hours and update the respective text views. But I have one doubt in mind, are threads reliable enough to accomplish such a task or should I use inbuilt library function to get seconds after every cycle ? I am a little concerned about getting my timer getting out of sync if I rely completely on thread to calculate time.
type: Question
has answer: http://stackoverflow.com/a/22477543
has answer: http://stackoverflow.com/a/22477740
has answer: http://stackoverflow.com/a/22477623
has answer: http://stackoverflow.com/a/22477535
downvote count: 0
has answer: http://stackoverflow.com/a/22477549
has answer: http://stackoverflow.com/a/22477531
tagged with: android
has answer: http://stackoverflow.com/a/22477673
favorite count: 0
has title: Are threads reliable enough to calculate seconds?

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/22421908
tags question: http://stackoverflow.com/q/22453800
tags question: http://stackoverflow.com/q/22361343
tags question: http://stackoverflow.com/q/22460163
tags question: http://stackoverflow.com/q/22417380
tags question: http://stackoverflow.com/q/22366380
tags question: http://stackoverflow.com/q/22336582
tags question: http://stackoverflow.com/q/22348988
tags question: http://stackoverflow.com/q/22455493
tags question: http://stackoverflow.com/q/22365677
tags question: http://stackoverflow.com/q/22346018
tags question: http://stackoverflow.com/q/22417498
tags question: http://stackoverflow.com/q/22354329
tags question: http://stackoverflow.com/q/22380285
tags question: http://stackoverflow.com/q/22355328
tags question: http://stackoverflow.com/q/22397609
tags question: http://stackoverflow.com/q/22330982
tags question: http://stackoverflow.com/q/22346843
tags question: http://stackoverflow.com/q/22389400
tags question: http://stackoverflow.com/q/22415559
tags question: http://stackoverflow.com/q/22383093
tags question: http://stackoverflow.com/q/22329883
tags question: http://stackoverflow.com/q/22465618
tags question: http://stackoverflow.com/q/22386824
tags question: http://stackoverflow.com/q/22429693
tags question: http://stackoverflow.com/q/22350015
tags question: http://stackoverflow.com/q/22487288
tags question: http://stackoverflow.com/q/22358243
tags question: http://stackoverflow.com/q/22363925
tags question: http://stackoverflow.com/q/22358872
tags question: http://stackoverflow.com/q/22439665
type: Tag
tags question: http://stackoverflow.com/q/22431350
tags question: http://stackoverflow.com/q/22386344
tags question: http://stackoverflow.com/q/22366893
tags question: http://stackoverflow.com/q/22367206
tags question: http://stackoverflow.com/q/22330892
tags question: http://stackoverflow.com/q/22400682
tags question: http://stackoverflow.com/q/22385691
tags question: http://stackoverflow.com/q/22394748
tags question: http://stackoverflow.com/q/22394144
tags question: http://stackoverflow.com/q/22362607
tags question: http://stackoverflow.com/q/22406893
tags question: http://stackoverflow.com/q/22409131
tags question: http://stackoverflow.com/q/22345444
tags question: http://stackoverflow.com/q/22400470
tags question: http://stackoverflow.com/q/22378885
tags question: http://stackoverflow.com/q/22448246
tags question: http://stackoverflow.com/q/22371760
tags question: http://stackoverflow.com/q/22434297
tag name: json
tags question: http://stackoverflow.com/q/22373744
tags question: http://stackoverflow.com/q/22398281
tags question: http://stackoverflow.com/q/22333056
tags question: http://stackoverflow.com/q/22391213
tags question: http://stackoverflow.com/q/22469284
tags question: http://stackoverflow.com/q/22350150
tags question: http://stackoverflow.com/q/22421021
tags question: http://stackoverflow.com/q/22457525
tags question: http://stackoverflow.com/q/22433262
tags question: http://stackoverflow.com/q/22458904
tags question: http://stackoverflow.com/q/22461663
tags question: http://stackoverflow.com/q/22385600
tags question: http://stackoverflow.com/q/22393341
tags question: http://stackoverflow.com/q/22345833
tags question: http://stackoverflow.com/q/22454427
tags question: http://stackoverflow.com/q/22392081
tags question: http://stackoverflow.com/q/22348256
tags question: http://stackoverflow.com/q/22382932
tags question: http://stackoverflow.com/q/22483049
tags question: http://stackoverflow.com/q/22381535
tags question: http://stackoverflow.com/q/22449147
tags question: http://stackoverflow.com/q/22487138
tags question: http://stackoverflow.com/q/22425550
tags question: http://stackoverflow.com/q/22464219
tags question: http://stackoverflow.com/q/22386089
tags question: http://stackoverflow.com/q/22357910
tags question: http://stackoverflow.com/q/22449732
tags question: http://stackoverflow.com/q/22436216
tags question: http://stackoverflow.com/q/22414614

http://stackoverflow.com/comment/54543055
has text: folder name is libs only
score: 0
type: Comment
comment on: http://stackoverflow.com/a/23471869
type: AnswerComment

http://stackoverflow.com/a/22481981
score: 0
answers question: http://stackoverflow.com/q/22481811
type: Answer
has comment: http://stackoverflow.com/comment/34199660
has body: Think that every contatenation of strings creates a new string, so, if you read every character of a big file of 40 MB and concatenate you are creating in total like 40.000.000 string in read(). Try to use StringBuffer instead of String, that is recomendable for this situations.

http://stackoverflow.com/q/22345992
has title: onSelectionChanged wont work
score: 0
answer count: 1
tagged with: wicket
has body: I use wicket and I have created a List Choice like this and overriden onSelectionChanged: ListChoice&lt;String&gt; hotelList = new ListChoice&lt;String&gt;("hotel", new PropertyModel&lt;String&gt;(this, "selectedHotel"), hotelLabels) { @Override protected void onSelectionChanged(String newSelection) { super.onSelectionChanged(newSelection); System.out.print("Tesy"); } }; but it did not work - program never fires this method. I do not want use onSubmit to handle this. I need action when someone clicked smth on list. How to do this in wicket?
accepted answer: http://stackoverflow.com/a/22346883
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22346883
type: Question

http://stackoverflow.com/comment/49599298
type: Comment
comment on: http://stackoverflow.com/a/22386430
score: 1
has text: DejanRistic is right. Just bear in mind that `jsonObject.put("xyz", new JSONArray(Arrays.asList(floatArray)))` will give you an array containing your e.g. float array (`{ "xyz": [[1.0, 2.0, 3.0]] }`), while `JSONArray arr = new JSONArray(); for (float value : floatArray) { arr.put(value); }; jsonObject.put("xyz", arr)` would in turn provide you just with an array, as you'd expect (`{ "xyz": [1.0, 2.0, 3.0] }`).
type: AnswerComment

http://stackoverflow.com/a/22413812
has body: Looking at this part of your regex: [('|("|(|'|"] (I've eliminated the backslashes that you need inside a Java string literal.) When you have a set of characters enclosed by [] in a regex, the effect is to match one character that must be in the set. Thus, [abc] matches one character that can either be 'a', 'b', or 'c'. It never matches a sequence of more than one character. There are other features, for example using ^ as the first character means match a character not in the set, and there are ways to specify entire character classes such as \d for digit. However, it appears that you're trying to use it to match a multiple-character sequence, i.e. you're looking for (' or (" in the string. You can't use a [] construct for that. The way you've written it, it will match one character that is either (, ', |, or ".
answers question: http://stackoverflow.com/q/22413585
score: 0
type: Answer

http://stackoverflow.com/q/22330827
answer count: 5
has comment: http://stackoverflow.com/comment/33936559
has answer: http://stackoverflow.com/a/22346587
has title: String to char[] without String methods
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33936184
possible better answer: http://stackoverflow.com/a/22331118
has answer: http://stackoverflow.com/a/22331096
has comment: http://stackoverflow.com/comment/33936394
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22331118
has comment: http://stackoverflow.com/comment/33936340
has comment: http://stackoverflow.com/comment/33936232
has body: I am practicing for interviews and I am given a question to create the String method indexOf without the use of string methods. My first thought was to process the String into a char[] but I am not sure how to do so without the use of .toCharArray() If anyone has ever had this interview question asked to them I would love your input.
tagged with: character-arrays
has answer: http://stackoverflow.com/a/22331512
has answer: http://stackoverflow.com/a/22331028
has comment: http://stackoverflow.com/comment/33936371
has comment: http://stackoverflow.com/comment/33936438
linked to: http://stackoverflow.com/q/196830
upvote count: 1
has comment: http://stackoverflow.com/comment/33936331
has comment: http://stackoverflow.com/comment/33936282
has comment: http://stackoverflow.com/comment/33936668
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/22331096

http://stackoverflow.com/comment/33937100
comment on: http://stackoverflow.com/q/22331126
score: 0
type: Comment
type: QuestionComment
has text: JRE, and ant does run, but it fails since all the libraries are way behind.

http://stackoverflow.com/comment/34057271
has text: Maybe you need some techniques like Google image search. http://petapixel.com/2013/06/13/a-deeper-look-at-the-technology-driving-googles-new-personal-photo-search/
comment on: http://stackoverflow.com/q/22400530
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22348002
has comment: http://stackoverflow.com/comment/33966165
favorite count: 0
has comment: http://stackoverflow.com/comment/33966188
has comment: http://stackoverflow.com/comment/33967780
has body: I have a text file with a list of words which I need to sort in alphabetical order using Java. The think is I need to do it without storing in collection or Array in java but you can create temp file. FileReader r1 = new FileReader("C:/Users/394286/Desktop/file11.txt"); FileReader r2 = new FileReader("C:/Users/394286/Desktop/file21.txt"); BufferedReader f1 = new BufferedReader(r1); BufferedReader f2 = new BufferedReader(r2); String s = null; s = f1.readLine(); String s1 = f2.readLine(); Set&lt;String&gt; l1 = new TreeSet&lt;String&gt;(); Set&lt;String&gt; l2 = new TreeSet&lt;String&gt;(); Set&lt;String&gt; l3 = new TreeSet&lt;String&gt;(); Set&lt;String&gt; l4 = new TreeSet&lt;String&gt;(); Set&lt;String&gt; same = new TreeSet&lt;String&gt;(); Set&lt;String&gt; diff1 = new TreeSet&lt;String&gt;(); Set&lt;String&gt; diff2 = new TreeSet&lt;String&gt;(); if (s1 == null &amp;&amp; s == null){ System.out.println("Both the Files are Empty"); } else if (s1 == null &amp;&amp; s != null) { System.out.println(" File 2 is Empty"); } else if (s1 != null &amp;&amp; s == null) { System.out.println("File 1 is Empty"); } while (s != null){ l1.add(s); s = f1.readLine(); } while (s1 != null){ l2.add(s1); s1 = f2.readLine(); } this is my try
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33973158
has comment: http://stackoverflow.com/comment/33966281
has comment: http://stackoverflow.com/comment/33966379
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/33966667
has answer: http://stackoverflow.com/a/22348228
downvote count: 1
type: Question
upvote count: 0
has title: Files operations
score: -1
linked to: http://stackoverflow.com/q/13727030
has answer: http://stackoverflow.com/a/22348160
answer count: 2
tagged with: file-io
has comment: http://stackoverflow.com/comment/33966747
has comment: http://stackoverflow.com/comment/33966335

http://stackoverflow.com/a/22368771
score: 5
type: AcceptedAnswer
has body: I have two game states, they are: GAME_RUNNING GAME_PAUSED When pause() is called I set the state to GAME_PAUSED and when resume() is called I set the state to GAME_RUNNING. And then when I run update() on my game I check this state and if it's paused I set delta to 0. float deltaTime = game.state == GAME_PAUSED ? 0 : Gdx.graphics.getDeltaTime(); This means when all my game objects update, their changes are multipled by 0 and nothing changes. We can also add a condition and only update when deltaTime &gt; 0. If you have a timer, you'll be updating this timer somehow like: public void update(World world, float delta) { frameTimer += delta; if( frameTimer &gt;= rate / 1000) { fireAtEnemy(world); frameTimer = 0; } } Because delta is now 0 the timer will not increase and not increase until the game state it back to GAME_RUNNING after resume(). Additionally, you can add an extra state called something like GAME_RUNNING_FAST and when this state is set you can multiply the deltaTime by 2 for example. If you have all your updates relative to the deltaTime then your entire game will run at double speed. If that's something you'd desire.
upvote count: 5
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34047141
has comment: http://stackoverflow.com/comment/34046807
accepted answer of: http://stackoverflow.com/q/22368561
answers question: http://stackoverflow.com/q/22368561

http://stackoverflow.com/comment/34039878
type: QuestionComment
has text: See [Immutable object](http://en.wikipedia.org/wiki/Immutable_object) to understand what the benefits are of making things immutable.
comment on: http://stackoverflow.com/q/22390021
score: 0
type: Comment

http://stackoverflow.com/q/22393772
has title: Make java code in android apk file inaccessible (not just obfuscated)
score: 3
tagged with: copy-protection
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34046048
has body: Recently I was asked to a job interview from a potential employer because of an android app I'm currently developing that caught his attention. It is not finished yet and so it is not uploaded to google play store. In this app I do something that is new and original and doesn't allready exist in any other app play store. Now...he asked me to give him the apk in order to test it and see for him self how good and reliable it is. I'm having second thoughts about doing that as I'm not really a fan of the idea of giving my hard to produce code to a stranger..It could easily be stolen once someone has the apk file and since it is not allready on play store, the originality of the app goes bye-bye.. QUESTION: Is there any way to make the code of the app inaccessible (not just hard to read) so that I'm safe from that possibility? I know about obfuscation and while it's a good step it's not tottaly safe. With enough patience and tools someone could still get your code. Given the fact that this particular protected apk will not be uploaded to google play but will be given hand to hand are there other techniques to block access to the code?
tagged with: obfuscation
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34054451
has answer: http://stackoverflow.com/a/22395862

http://stackoverflow.com/q/22450184
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: h2
has answer: http://stackoverflow.com/a/22450273
accepted answer: http://stackoverflow.com/a/22450273
type: Question
upvote count: 2
favorite count: 0
has title: How to drop a function with Hibernate/JDBC?
tagged with: sql
answer count: 1
tagged with: jdbc
has body: I'm trying to run this query drop FUNCTION IF EXISTS time_factor; I want to run it through the Hibernate session with either createSQLQuery() or doWork(). Like this: sessionFactory.getCurrentSession().createSQLQuery(query).executeUpdate(); or sessionFactory.getCurrentSession().doWork(new Work() { @Override public void execute(Connection connection) throws SQLException { connection.prepareStatement(query).executeUpdate(); } }); This is what I get: Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "DROP FUNCTION[*] IF EXISTS TIME_FACTOR; "; expected "TABLE, INDEX, USER, SEQUENCE, CONSTANT, TRIGGER, VIEW, ROLE, ALIAS, SCHEMA, ALL, DOMAIN, TYPE, DATATYPE, AGGREGATE"; Does this mean that I can't drop functions through JDBC/Hibernate ? Also if someone knows a way I can run it I'd be really grateful.

http://stackoverflow.com/a/22380248
has comment: http://stackoverflow.com/comment/34031752
has comment: http://stackoverflow.com/comment/68353028
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22376088
answers question: http://stackoverflow.com/q/22376088
has body: The basic problem here is, that the context.xml you edit in eclipse corresponds to the main context.xml in the conf directory of tomcat. And then the preferences in the application context file takes precedence. As you already described within normal deployment lifecycle of tomcat this is perfectly fine, because you just edit the application settings. You could do the same with the context file created by eclipse (which is located somewhere at .metadata/.plugins/org.eclipse.wst.server.core/tmp0/conf/Catalina/localhost) but it will be overwritten as soon as you change something in the original context file (META-INF/context.xml). So actually you would need to make the changes there, but this is normally out of question because this file must be deployed without custom changes. But here is a workaround: You can make eclipse use another META-INF/context.xml by abusing the deployment assembly. Make a new META-INF directory somewhere else and place a context.xml file with your setting there. Then in the project properties of your eclipse project at Deployment Assembly add an additional mapping from your new path/to/META-INF to META-INF. Then eclipse will overwrite the original context.xml with your custom one and tomcat should take your settings.
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/22436631
tagged with: jcombobox
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22436726
possible better answer: http://stackoverflow.com/a/22436761
tagged with: java
upvote count: 1
has title: getting Jcomponent from other class changes frame size
tagged with: swing
downvote count: 1
type: Question
tagged with: actionlistener
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22436726
favorite count: 0
has answer: http://stackoverflow.com/a/22436761
has body: Hello I am try to get jcomponent from other class.the components are displaying but my frame size changes. Example.java public class Example extends JFrame{ static JPanel panel = new JPanel(); static A a = new A(); static B b = new B(); static JComboBox&lt;String&gt; combo = new JComboBox&lt;&gt;(); static String value; Example(){ setSize(400, 400); combo.setBounds(450, 140, 50, 20); combo.addItem(""); combo.addItem("a"); combo.addItem("b"); combo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { value = (String) combo.getSelectedItem().toString(); if(value.equals("a")){ panel.add(a.getLabel()); panel.remove(b.getLabel()); add(panel); pack(); }else if(value.equals("b")){ panel.add(b.getLabel()); panel.remove(a.getLabel()); add(panel); pack(); } } }); panel.add(combo); this.add(panel); setVisible(true); } } A.java public class A extends JFrame{ JPanel panel = new JPanel(); JLabel lab = new JLabel("Text"); A(){ lab.setBounds(280, 25, 150, 50); lab.setVisible(true); panel.add(lab); add(panel); } public JLabel getLabel(){ return lab; } } B.java public class B extends JFrame{ JPanel panel = new JPanel(); JButton lab = new JButton("Hello"); B(){ lab.setBounds(380, 25, 250, 50); lab.setVisible(true); panel.add(lab); add(panel); } public JButton getLabel(){ return lab; } } Main.java public class Main { public static void main(String [] agrs) { Example ex = new Example(); ex.setVisible(true); } } when I run frame open as defined size but when I select a from combo box the frame size decreases any suggestion so as screen size remain same.

http://stackoverflow.com/comment/34204167
type: AnswerComment
type: Comment
has text: Eclipse is returning an error unless `getTableColumnModel()` is changed to `getColumnModel()`. It is also throwing an `ArrayIndexOutOfBoundsException`.
comment on: http://stackoverflow.com/a/22482543
score: 0

http://stackoverflow.com/a/22390531
has body: This code is strange; it does not return an integer at all but a float... Anyway, the Java equivalent of the python code is something like this (note: NO bounds checking is done at all): private static double bin5(final byte[] b, final int k) { final ByteBuffer buf = ByteBuffer.allocate(8); buf.position(3); buf.put(b, k, 5); buf.rewind(); final long l = buf.getLong(); return (double) l / 65536.0; } EDIT: if the last two elements of the byte array at offset k are always 0 (which it looks like they are) then you can replace from buf.rewind() onwards with: buf.position(2); return (double) buf.getInt();
score: 0
has comment: http://stackoverflow.com/comment/34042712
has comment: http://stackoverflow.com/comment/34042699
has comment: http://stackoverflow.com/comment/34041972
has comment: http://stackoverflow.com/comment/34041314
type: Answer
answers question: http://stackoverflow.com/q/22389977
has comment: http://stackoverflow.com/comment/34042077
has comment: http://stackoverflow.com/comment/34041186
has comment: http://stackoverflow.com/comment/34042553

http://stackoverflow.com/comment/34115543
type: QuestionComment
comment on: http://stackoverflow.com/q/22433643
score: 0
has text: The value of the text is a binary value. e.g. 0010011001100111
type: Comment

http://stackoverflow.com/q/22340535
possible better answer: http://stackoverflow.com/a/22373016
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/61966732
linked to: http://stackoverflow.com/q/12209300
accepted answer: http://stackoverflow.com/a/22345903
linked to: http://stackoverflow.com/q/18787697
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22345903
has answer: http://stackoverflow.com/a/22373016
tagged with: java
type: Question
tagged with: jasper-reports
has body: I need to show JRBeanCollectionDataSource data in Table component (JasperReports). Here is my template, ShowPerson.jrxml file: <?xml version="1.0" encoding="UTF-8"?> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ShowPerson" pageWidth="612" pageHeight="792" whenNoDataType="NoDataSection" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="304c4c4e-c99a-4399-8081-748d3b7c0b8c"> <field name="name" class="java.lang.String"/> <field name="age" class="java.lang.Integer"/> <parameter name="INFO" class="java.lang.String"/> <reportElement uuid="e96450a8-8358-4cae-a094-3add06d57de2" x="0" y="20" width="56" height="20"/> <textElement/> Info <reportElement uuid="e21e9932-ebfe-4bb5-904d-ea99e141866b" x="56" y="20" width="100" height="20"/> <textElement/> $P{INFO} <reportElement uuid="dea5d821-81b6-434b-ae27-4f3a0268e805" key="table 1" x="0" y="0" width="572" height="40"/> <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> <datasetParameterExpression> </datasetParameterExpression> $P{REPORT_DATA_SOURCE} <jr:column width="169" uuid="aae649c4-6a69-485f-8a0d-87022df793ee"> <jr:tableHeader height="20" rowSpan="1"> <reportElement uuid="795dac43-0ff0-482c-89a0-7dac3b27d513" x="0" y="0" width="169" height="20"/> <textElement/> Name </jr:tableHeader> <jr:detailCell height="20" rowSpan="1"> <reportElement uuid="4f1ab13a-d776-4cd5-a2a7-a5cf23360816" x="0" y="0" width="169" height="20"/> <textElement/> $F{name} </jr:detailCell> </jr:column> <jr:column width="173" uuid="a6997eea-131e-4555-80e6-a20d4decb18f"> <jr:tableHeader height="20" rowSpan="1"> <reportElement uuid="5f6…
score: 15
has title: How to show JRBeanCollectionDataSource data with help of Table component?
upvote count: 15
answer count: 2

http://stackoverflow.com/q/22448781
tagged with: java
tagged with: class
answer count: 1
has answer: http://stackoverflow.com/a/22448862
favorite count: 0
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/22448862
has body: I'm pretty new to java and working on a program that should simulate the Mastermind game. Here's the description: Write an application in Java that allows a user to play the game Bulls and Cows against a computer. The game works as follows: The computer chooses a 4-digit number in secret. The digits must all be different. The user then guesses the number and the computer provides the number of matching digits. If the matching digit is in the right position it is a "bull", if it is on a different position it is a "cow" There are two classes that I'm allowed to have: Oracle and Game. Oracle class generates the 4-digit number that computer picks and calculates the number of bulls and cows in the player's guess. Game class gets the number of bulls and cows from Oracle and reports it. I'm getting this error when I run the program: the error appears to be here: at Game.play(Game.java:34) at BullsAndCows.main(BullsAndCows.java:5) Can you help me figure out what's wrong? Thanks a lot. these are the images of Oracle and Game classes as well as the main method
type: AnsweredQuestion
upvote count: 2
score: 1
downvote count: 1
type: Question
has title: NullPointerException runtime error

http://stackoverflow.com/q/22405212
has title: Changing Dynamic Web Module version in Eclipse Maven Project
tagged with: maven
type: AnsweredQuestion
upvote count: 19
accepted answer: http://stackoverflow.com/a/22406156
tagged with: java
score: 19
type: Question
tagged with: eclipse
has answer: http://stackoverflow.com/a/25494678
has body: I'm trying to set up Dynamic Web Module 3.0 in order to support Java 6 development. I'm getting this error in my Problems tab of eclipse whenever I do Maven > Update Project. Dynamic Web Module 3.1 requires Java 1.7 or newer. It appears as though nothing is going wrong, but I must be missing something because I consistently receive this error. Below is the contents of my .settings/org.eclipse.wst.common.project.facet.core.xml <?xml version="1.0" encoding="UTF-8"?> <fixed facet="jst.java"/> <fixed facet="jst.web"/> <installed facet="jst.java" version="1.6"/> <installed facet="jst.web" version="3.0"/> In eclipse, my Java Compiler is set to 1.6 properly. In the Project Facets tab, Dynamic Web Module is specified as version 3.0 correctly, and Java also appears as 1.6 under Project Facets. In my pom.xml file, I have also set the Java version accordingly: org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 As a side note, I should also mention that I am doing a pure-Java build with a WebApplicationInitializer and have no web.xml file. Any help is greatly appreciated as I attempt to squash this seemingly irrelevant error message. EDIT: added pom.xml contents 4.0.0 net.XXXXX XXXXX 1.0-SNAPSHOT XXXXX war http://maven.apache.org XXXXX org.apache.maven.plugins maven-compiler-plugin 3.1 1.6 1.6 org.apache.maven.plugins maven-war-plugin false junit junit 4.11 test org.springframework spring-core 4.0.2.RELEASE org.springframework spring-webmvc 4.0.2.RELEASE org.springframework spring-context 4.0.2.RELEASE commons-logging commons-logging org.springframework.security spring-security-core 3.2.1.RELEASE org.springframework.security spring-security-config 3.2.1.RELEASE org.springframework.security spring-security-web 3.2.1.RELEASE org.slf4j jcl-over-slf4j 1.7.6 org.slf4j slf4j-api 1.7.6 org.slf4j slf4j-log4j12 1.7.6 log4j log4j 1.2.17 javax.servlet javax.servlet-api 3.1.0 provided cglib cglib-nodep 3.1 org.springframework spring-orm 4.0.2.RELEASE org.hibernate hibernate-core 4.…
answer count: 3
has answer: http://stackoverflow.com/a/22406156
possible better answer: http://stackoverflow.com/a/28946005
downvote count: 0
has answer: http://stackoverflow.com/a/28946005
favorite count: 0

canvas
tags question: http://stackoverflow.com/q/22428454
tags question: http://stackoverflow.com/q/22345761
tag name: canvas
tags question: http://stackoverflow.com/q/22431620
type: Tag
tags question: http://stackoverflow.com/q/22417375
tags question: http://stackoverflow.com/q/22429982
tags question: http://stackoverflow.com/q/22397678
tags question: http://stackoverflow.com/q/22342956
tags question: http://stackoverflow.com/q/22358455

http://stackoverflow.com/q/22345286
tagged with: android
has comment: http://stackoverflow.com/comment/33961707
tagged with: httpurlconnection
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33961488
type: Question
has comment: http://stackoverflow.com/comment/33961529
tagged with: java
has title: Waiting a response in Thread via HttpUrlConnection
has body: I have a Function which sends url request to server and gets data. I'm able to get data but data is coming late as request is being sent in another Thread. I want user to wait for the request (For login authentication). How do achieve this? private String sendRequest(final String URL) { StrictMode.ThreadPolicy policy = new StrictMode. ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); new Thread(new Runnable() { public void run() { // TODO Auto-generated method stub HttpURLConnection httpUrlConnection = null; try { httpUrlConnection = (HttpURLConnection) new URL(URL) .openConnection(); InputStream in = new BufferedInputStream( httpUrlConnection.getInputStream()); data = readStream(in); Log.i(TAG,"Respose from "+URL); System.out.println(data); } catch (MalformedURLException exception) { Log.e(TAG, "MalformedURLException"); } catch (IOException exception) { Log.e(TAG, "IOException"); } finally { if (null != httpUrlConnection) httpUrlConnection.disconnect(); } } }).start(); return data; } I call above function like this public JSONObject get(String URL){ data = sendRequest(URL); try { if(null!=data){ returnJsonObj = new JSONObject(data); }else{ Log.i(TAG,"Response data is null"); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return returnJsonObj; } How do I wait for a data in get Function.
has comment: http://stackoverflow.com/comment/33962499
score: 0

http://stackoverflow.com/q/22438655
has answer: http://stackoverflow.com/a/22438919
has comment: http://stackoverflow.com/comment/34124510
upvote count: 2
has comment: http://stackoverflow.com/comment/34124358
score: 0
answer count: 3
has title: Java Enum related questions
favorite count: 0
has comment: http://stackoverflow.com/comment/34124452
has comment: http://stackoverflow.com/comment/34124194
has comment: http://stackoverflow.com/comment/34124389
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34124588
has comment: http://stackoverflow.com/comment/34124143
has answer: http://stackoverflow.com/a/22438840
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/34124169
has comment: http://stackoverflow.com/comment/34124245
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/22438868
has body: Can anyone please answer the below questions? Can I use logical operator over enum values? For example: enum Days { MONDAY(1), TUESDAY(2), WEDNESDAY(3), THURSDAY(4), FRIDAY(5), SATURDAY(6), SUNDAY(7) } now can I use if(Days.SUNDAY &gt; Days.MONDAY) ....? Is there any process to specify a range of values for enum? For example, I want to specify the valid numbers for an exam should be between 1 - 100. So if I want to declare an enum, then it would be like this -> enum Validno{ONE(1),TWO(2),....,HUNDRED(100)} Now is there any option to declare an enum containing the each values and specify them like a range instead of declaring each one seperately? Thanks in advance.

http://stackoverflow.com/a/22339385
downvote count: 0
has body: If you use scanner readLine then you can read a whole line e.g. 4 * 6 This line can then be split to get three tokens String tokens [] = line.split (" "); then you can see what operation to do based upon token[1] if (token[1].equals ("-") { //lets minus token[2] from token[0] // need to convert String to Number }
answers question: http://stackoverflow.com/q/22339324
score: 3
upvote count: 3
type: Answer

http://stackoverflow.com/comment/34125112
type: QuestionComment
has text: For an example how to split a `String` in Java you could look [here](http://stackoverflow.com/questions/3481828/how-to-split-a-string-in-java) on StackOverflow
score: 1
comment on: http://stackoverflow.com/q/22439038
type: Comment

http://stackoverflow.com/comment/33936158
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22330290
has text: I don't think your sample xml is illustrating the issue encountered in your actual code. XmlUnit docs: "Two documents are considered to be "similar" if they contain the same elements and attributes regardless of order."
type: Comment

http://stackoverflow.com/comment/34157823
score: 0
comment on: http://stackoverflow.com/a/22457411
has text: Thanks for your reply i understood what your saying friend . sure thanks i will try it.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22486453
has title: Android task lifecycle and static data, is a task ever destroyed?
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22548958
tagged with: android-activity
has body: Android activities have a well defined lifecycle and they will be paused, stopped, and destroyed. That is very well documented. My question is about the task that contains my activities as described in the docs. Under low memory or other conditions, will the task ever be shut down by the OS? (I understand the user can Force Stop the app). Can I assume my Singletons and static data will always be available? What about static members defined on an Activity? It appears that the Activity may be destroyed, but the static data lives as long as the task lives. android.app.Application has callbacks like onLowMemory() and onTrimMemory() but these seem to be voluntary, meaning it is great if the app cooperates with the OS, but it doesn't have to. So, I'm pretty certain my task is never normally killed and singletons and statics are reliable. Is this correct? This answer also had some good background.
has answer: http://stackoverflow.com/a/22488332
type: UnansweredQuestion
tagged with: android-lifecycle
tagged with: android
has answer: http://stackoverflow.com/a/22488740
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/22429197
linked to: http://stackoverflow.com/q/1944369

http://stackoverflow.com/comment/43761941
type: Comment
score: 8
has text: `Am I the only one who finds unwinding lists boring?` +1
type: AnswerComment
comment on: http://stackoverflow.com/a/26106616

http://stackoverflow.com/a/22439194
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/34125318
answers question: http://stackoverflow.com/q/22439167
accepted answer of: http://stackoverflow.com/q/22439167
has body: The answer is that you are defining an anonymous class. Thread t1 = new Thread(new Runnable() { public void run() { try { producer(); //This is called in run method! } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); The declaration of the method that calls producer() is public void run() and this method does not throw the checked exception. Therefore, you have to catch it.
upvote count: 4

http://stackoverflow.com/q/22357259
accepted answer: http://stackoverflow.com/a/22357335
downvote count: 0
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/33982269
upvote count: 1
has answer: http://stackoverflow.com/a/22357399
type: AnsweredQuestion
tagged with: linked-list
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22357335
type: Question
tagged with: iterator
possible better answer: http://stackoverflow.com/a/22357402
has answer: http://stackoverflow.com/a/22357402
has answer: http://stackoverflow.com/a/22357380
has body: this is a code i have written for implementing linked list, private class DequeIterator&lt;Item&gt; implements Iterable&lt;Item&gt; { private Node pElement; DequeIterator() { pElement = first; } public boolean hasNext() { return pElement != null; } public Item next() { if (!this.hasNext()) { throw new NoSuchElementException(); } Item ret = pElement.it; pElement = pElement.next; return ret; } public void remove() { throw new UnsupportedOperationException(); } } I dont know what is going wrong i am getting follwing errors please help me resolve those => Deque.java:25: error: Deque.DequeIterator is not abstract and does not override abstract method iterator() in Iterable =>Deque.java:35: error: incompatible types Item ret = pElement.it; ^ required: Item#2 found: Item#1 =>Deque.java:121: error: incompatible types return new DequeIterator(); ^ required: Iterator found: Deque.DequeIterator
has title: Correct Way to Override Iterables<Obj> in Java
has answer: http://stackoverflow.com/a/22357384

http://stackoverflow.com/q/22383166
possible better answer: http://stackoverflow.com/a/40304189
has title: Logback SMTPAppender only sending last email
accepted answer: http://stackoverflow.com/a/22383524
has body: I am attempting to use Logback with SMTPAppender as my logging solution. I have an evaluator attached to the appender that triggers an email to be sent every 100 errors logged. For the most part this works correctly, but I've noticed if I create errors rapidly in a loop to trigger multiple emails, only the last email gets sent, with the correct content. It seems to be a race condition where the first email is not finished being created/sent, and the second one overwrites the first on creation. Has anyone else experienced this or found a solution. My logback config is attached below. 100 ${logback.emailNotificationRecipientStr} ${logback.emailNotificationFromStr} ${logback.smtpHost} Logback logs for facebook-ads-processes ERROR ACCEPT DENY %d [Thread:%t] %p [%c] - %m%n ${logback.cyclicBufferSize} This is the evaluator: public class CountingLoggerEvaulator extends EventEvaluatorBase<ILoggingEvent> implements EventEvaluator<ILoggingEvent> { //if limit is not set in configuration, this will cause it to send one email for each message received. private int limit = 100; private int counter = 0; public void setLimit(int limit) { this.limit = limit; } public int getLimit() { return limit; } @Override public boolean evaluate(ILoggingEvent expr) throws NullPointerException, EvaluationException { counter++; if (counter == limit) { counter = 0; return true; } else { return false; } } } Any help is greatly appreciated.
tagged with: smtpappender
type: AnsweredQuestion
tagged with: java
tagged with: logback
has answer: http://stackoverflow.com/a/40304189
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22383524

http://stackoverflow.com/q/22387475
has body: How can i possibly prevent users from adding another dot in a calculator made using java. I already have my JTextfield and i want to prevent user from entering 12.56.1 instead of 12.561
answer count: 3
has answer: http://stackoverflow.com/a/22392861
has title: How to Prevent adding another Dot in Java Calculator
tagged with: user-interface
linked to: http://stackoverflow.com/q/2749521
tagged with: calculator
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/34034586
has answer: http://stackoverflow.com/a/64243994
score: 0
tagged with: java
tagged with: jtextfield
type: Question
has answer: http://stackoverflow.com/a/22389987

http://stackoverflow.com/comment/34321695
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22464810
has text: hey sorry for the late reply, i actually end up using jquery popup

http://stackoverflow.com/a/22545359
score: 0
answers question: http://stackoverflow.com/q/22342898
type: Answer
has body: A guaranteed way to generate a unique result based on the array is to convert it to one big string, and use that for your computational value. It may be slow, but it will be unique based on the array's values. Implementation examples: Best way to convert an ArrayList to a string

http://stackoverflow.com/comment/33984203
type: QuestionComment
score: 1
has text: The list of available statuses is not a property of a specific project. You shouldn't have such an association. To get the list of all the available statuses, just use a findAll query (`select s from ProjectStatus s`).
comment on: http://stackoverflow.com/q/22358016
type: Comment

http://stackoverflow.com/comment/33954497
comment on: http://stackoverflow.com/q/22340574
score: 0
type: QuestionComment
type: Comment
has text: What exactly happened the 2nd time you started your MainActivity - did `doInBackground()` get called, did `onPostExecute()` get called? Yes, you can run your AsyncTask multiple times but what exactly did you fail to achieve the second time e.g. modifying some view?

http://stackoverflow.com/a/22329050
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33947606
accepted answer of: http://stackoverflow.com/q/22328535
answers question: http://stackoverflow.com/q/22328535
type: Answer
has body: Create a class extending JsonSerializer and then on your getter use the @JsonSerialize(using=MySerializer.class) annotation One of the serializer could be something like: public class MySerializer extends JsonSerializer&lt;String&gt; { @Override public void serialize( String value , JsonGenerator jgen , SerializerProvider provider) throws IOException , JsonProcessingException { jgen.writeString(MyUtilsClass.formatWithHyphen(value) ); } }
has comment: http://stackoverflow.com/comment/33957511
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33934279

http://stackoverflow.com/comment/34106514
comment on: http://stackoverflow.com/q/22428226
score: 0
type: Comment
type: QuestionComment
has text: No idea, but maybe [this class](http://docs.oracle.com/javase/7/docs/api/java/net/Proxy.html) will interest you. And even more [this one](http://docs.oracle.com/javase/7/docs/api/java/net/ProxySelector.html)

http://stackoverflow.com/q/22340826
has body: What I am trying to do is, get input string from user. Add it into arraylist since i have to play with characters later. But first i want to print contents of ArrayList in order to check what is exactly in their. Here is my code public static void main(String[] args) { Scanner sc = new Scanner(System.in); List &lt;String&gt; Vowels = new ArrayList&lt;String&gt;(); System.out.println("What is your string? "); String abc = sc.nextLine(); int n = abc.length(); for(int i=0; i &lt;= n-1 ; i++) { Vowels.add(sc.nextLine()); } for(int j=0; j&lt; Vowels.size();j++) System.out.println(Vowels.get(j)); } It is not printing anything or not showing up any error. Your help will be highly appreciated.
has answer: http://stackoverflow.com/a/22340888
possible better answer: http://stackoverflow.com/a/22340961
has comment: http://stackoverflow.com/comment/33953901
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22340961
has comment: http://stackoverflow.com/comment/33953975
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22340888
tagged with: arraylist
score: 0
has title: Print Elements of ArrayList in order of input string
has comment: http://stackoverflow.com/comment/33953944

http://stackoverflow.com/comment/34206951
score: 0
comment on: http://stackoverflow.com/a/22485627
type: Comment
has text: @NichoDiaz, updated answer with what I think you mean and I have not used sqlite but I would be surprised if `setBoolean()` did not work with a `bool` data type.
type: AnswerComment

http://stackoverflow.com/comment/34040607
has text: Dont you need a semicolon at the end
comment on: http://stackoverflow.com/q/22390219
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22445536
tagged with: java
type: Question
tagged with: split
answer count: 2
has comment: http://stackoverflow.com/comment/34138019
has answer: http://stackoverflow.com/a/22446156
has title: Splitting lines regular expression in Java
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34138913
has answer: http://stackoverflow.com/a/22446333
tagged with: regex
has body: I want to parse an almost program. The program is consisted of two lines and it is shown below: java.io.*; java.lang.*; I am using a library, which reads the whole program and splits it using the command String[] words = sourceCode.split("[\\s+|\\W+]"); What it is produced by that is the following words[0] = "Java" words[1] = "io" words[2] = "" words[3] = "" words[4] = "" words[5] = "" words[6] = Java words[7] = "lang" words[8] = "" words[9] = "" words[10] = "" words[11] = "" However, What I want is to break that program in lines first, and after that at a line's component. That is, I am using String[] allLines = file1String.split("[\n]"); String[][] wordsOfALine =new String[allLines.length][]; for (int i=0;i&lt;allLines.length;i++){ wordsOfALine[i] = allLines[i].split("[\\s+|\\W+]").clone(); } However, what I am getting here is wordsOfALine[0][0] = "Java" wordsOfALine[0][1] = "io" wordsOfALine[1][0] = "Java" wordsOfALine[1][1] = "lang" And therefore all the empty words have now disappeared. Do you know how I can bring them back? I need to be consistent with the library... Thanks

http://stackoverflow.com/q/22355235
has answer: http://stackoverflow.com/a/22412032
accepted answer: http://stackoverflow.com/a/22412032
tagged with: jersey-client
linked to: http://stackoverflow.com/q/55778145
upvote count: 22
has title: PATCH request using Jersey Client
answer count: 4
has answer: http://stackoverflow.com/a/26341128
type: AnsweredQuestion
score: 21
tagged with: java
has answer: http://stackoverflow.com/a/59451143
possible better answer: http://stackoverflow.com/a/26341128
has comment: http://stackoverflow.com/comment/119631654
type: Question
tagged with: jersey
has body: I want to execute a PATCH request supported by our server for testing using Jersey client. My code is as below, but I get com.sun.jersey.api.client.ClientHandlerException: java.net.ProtocolException: HTTP method PATCH doesn't support output exception. Can someone let me know whats wrong with the code below? String complete_url = "http://localhost:8080/api/request"; String request = "[{\"op\":\"add\", \"path\":\"/name\", \"value\":\"Hello\"}]"; DefaultClientConfig config = new DefaultClientConfig(); config.getProperties().put(URLConnectionClientHandler.PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND, true); Client client = Client.create(config); WebResource resource = client.resource(complete_url); ClientResponse response = resource.header("Authorization", "Basic xyzabCDef") .type(new MediaType("application", "json-patch+json")) .method("PATCH", ClientResponse.class, request); Here is the full exception, com.sun.jersey.api.client.ClientHandlerException: java.net.ProtocolException: HTTP method PATCH doesn't support output at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155) at com.sun.jersey.api.client.Client.handle(Client.java:652) at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) at com.sun.jersey.api.client.WebResource$Builder.method(WebResource.java:634) at com.acceptance.common.PatchTest.patch(PatchTest.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeE…
downvote count: 1
has answer: http://stackoverflow.com/a/39641592
favorite count: 0

http://stackoverflow.com/comment/34101258
type: QuestionComment
comment on: http://stackoverflow.com/q/22425063
score: 0
has text: @Shifaza that I saw but what I meant to say is that you haven't declared size for your array. You are just assigning to some uninitialized memory. like this `noRepeatString = new String([wordList.length])`
type: Comment

http://stackoverflow.com/q/22466555
tagged with: junit
downvote count: 0
has title: Junit testing for exceptions in a constructor?
score: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/22466676
has comment: http://stackoverflow.com/comment/34174115
has answer: http://stackoverflow.com/a/22466728
answer count: 3
tagged with: exception
has answer: http://stackoverflow.com/a/22466676
has comment: http://stackoverflow.com/comment/34174052
accepted answer: http://stackoverflow.com/a/22466728
has answer: http://stackoverflow.com/a/22466669
has comment: http://stackoverflow.com/comment/34174097
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34175105
has body: In the following test I am trying to test if an exception has been thrown by the constructor when it is passed illegal arguments when trying to create the object, I have added validation in the setters of each instance variable that when they are passed invalid data they throw an exception. // test for invalid const @Test(expected = IllegalArgumentException.class) public void testInvalidBookStringStringStringInt() { // create a new book Book b = new Book(invalidISBN, invalidAuthor, invalidTitle, invalidRating1); } The test is currently failing at the minute, what am i doing wrong? Book class: package practice; /** * Class that creates a Book * * @author Ross Young * */ public class Book { // declaring instance variables /** * Book's ISBN */ private String ISBN; /** * Book's Author */ private String author; /** * Book's Title */ private String title; /** * Book's rating */ private int rating; /** * Default constructor */ public Book() { } /** * Constructor with Args * * @param ISBN * @param author * @param title * @param rating */ public Book(String ISBN, String author, String title, int rating) { this.ISBN = ISBN; this.author = author; this.title = title; this.rating = rating; } /** * Gets ISBN * * @return ISBN */ public String getISBN() { return ISBN; } /** * Sets ISBN * * @param iSBN */ public void setISBN(String iSBN) { if((iSBN.length()!=9)||(iSBN.length()!=12)){ throw new IllegalArgumentException("Invalid ISBN length"); }else{ this.ISBN=iSBN; } } /** * Gets Author * * @return author */ public String getAuthor() { return author; } /** * Sets author * * @param author */ public void setAuthor(String author) { if ((author.length() &lt; 0) || (author.length() &gt; 20)) { throw new IllegalArgumentException("Invalid author Length"); } else { this.author = author; } } /** * gets title * * @return title */ public String getTitle() { return title; } /** * Sets title * * @param title */ public void setTitle(String title) { if ((title.length() &lt; 0) || (title.length() &g…
tagged with: java
has comment: http://stackoverflow.com/comment/34174840
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/34173952

http://stackoverflow.com/a/22367945
upvote count: 1
has body: AFAIK, I think it is not possible, because Java is compiled and interpreted both. Even though you compiled the program and changed, it's name, the interpreter gets confused in class file name and the data in that class file. Correct me, If I am wrong.
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34004547
answers question: http://stackoverflow.com/q/22367825
type: Answer

http://stackoverflow.com/comment/33959213
comment on: http://stackoverflow.com/q/22343424
type: Comment
type: QuestionComment
score: 0
has text: Do you have multiple objects in single file?

http://stackoverflow.com/comment/34070849
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/49761/discussion-between-serge-and-braj)
comment on: http://stackoverflow.com/a/22391237
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22386693
has answer: http://stackoverflow.com/a/22386851
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22393022
has comment: http://stackoverflow.com/comment/34033265
has comment: http://stackoverflow.com/comment/34033229
tagged with: java
tagged with: swing
type: Question
score: 0
has answer: http://stackoverflow.com/a/22386826
answer count: 3
has body: I have made form in swing with 6 jTextFields. User should be able to input only numbers from 1 to 48 in each of Text fields. There should be also check to see if any of numbers repeat and app should check if any field is left blank. I know how to do this in VB.net but i'm new to java in general. In VB.net i would put all textfields in array and then check to see if all text fields are filled in, are the numbers in range and check if there is a duplicate number in any field. If all criteria is met i would proceed to send inputs to database. I am fairly new to java so if anyone could help me or point me in right direction that would be awesome.
has title: Input validation in Swing

http://stackoverflow.com/a/41332024
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/69882221
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22443095
has body: mapper.writeValueAsString(json) is a better approach to do it
has comment: http://stackoverflow.com/comment/69867373

http://stackoverflow.com/comment/34032145
type: Comment
has text: Correct. That index will be used by MongoDB for both your query criteria i.e., key and time.
comment on: http://stackoverflow.com/a/22367202
type: AnswerComment
score: 0

http://stackoverflow.com/a/22358727
upvote count: 3
answers question: http://stackoverflow.com/q/22358642
accepted answer of: http://stackoverflow.com/q/22358642
has comment: http://stackoverflow.com/comment/33985198
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
has body: Try this: double takttime = 1.08; int t = (int) ( 100 * takttime * 60 ); int hour = t/3600; t %= 3600; int min = t/60; t %= 60; int sec = t; or ... maybe: double takttime = 1.08; int t = (int) ( 100 * takttime); int min = t/100; int sec = 60 * (t%100) depending on what you need exactly.

http://stackoverflow.com/a/22414487
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22412765
answers question: http://stackoverflow.com/q/22412765
type: Answer
has comment: http://stackoverflow.com/comment/34142387
has comment: http://stackoverflow.com/comment/34165881
has body: Hauptklasse or: this means MainClass with the name 'or' ... The problem is with the second argument: -Xmx1500m or -XX:MaxPermSize=250m, the word or is interpreted as the name of the mainClass. Removing it should help you a bit further.
score: 2
downvote count: 0

http://stackoverflow.com/q/22448908
tagged with: java
has answer: http://stackoverflow.com/a/22448922
accepted answer: http://stackoverflow.com/a/22448939
type: Question
possible better answer: http://stackoverflow.com/a/22448922
has title: Regular expression in java
has body: I know it's a simple problem but i'm blocked on it : i want to retrieve all strings written in this form : $F{ETIQX} Where X is a number. i wrote this regular expression but i'm getting errors : if (textField.getText().matches("$F{ETIQ\d}")){ System.out.println("matches!!"); } Any help will be appreciated.
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22448939
tagged with: regex
type: AnsweredQuestion

http://stackoverflow.com/comment/34146975
comment on: http://stackoverflow.com/q/22451226
has text: I just copied it from the article, and I didn't understand why lower case? That's the whole point
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22358455
tagged with: actionbarsherlock
tagged with: java
has comment: http://stackoverflow.com/comment/33984454
type: Question
has body: I'm working on an android app that is a hearing test. it was quite outdated so I've had to update it. I've used the Sherlock library so the app is compatible for many different phones. What I'm trying to do is get the results of a hearing test to show up. The problem I'm getting it when I draw the graph to show the user how well they did, I'm getting a null pointer exception. once the test is completed, the user is taken to the Saved tests Activity shown below: public class SavedResultsActivity extends SherlockListActivity { // TODO set column names when saving test implemented private static final String TEST_NAME_COLUMN = ResultsDatabase.SAVED_NAME; private static final String TEST_DATE_COLUMN = ResultsDatabase.COLUMN_NAME_CREATE_DATE; private ResultsDatabase mDb; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDb = new ResultsDatabase(this); setContentView(R.layout.saved_tests); ActionBar ab = getSherlock().getActionBar(); SherlockHelper.setupActionBar(ab, this); TextView titleText = (TextView)findViewById(R.id.title_text); titleText.setText(R.string.Saved_Tests); // Set the empty view getListView().setEmptyView(findViewById(R.id.empty)); getListView().setItemsCanFocus(true); // Get a cursor with all phones Cursor c = getSavedTests(); if ( c != null ) { // Set up our adapter SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.saved_results_item, c, new String[] { TEST_NAME_COLUMN, TEST_DATE_COLUMN, TEST_DATE_COLUMN }, new int[] { android.R.id.text1, android.R.id.text2, R.id.delete_button }); adapter.setViewBinder(mViewBinder); // Set up our adapter setListAdapter(adapter); } } @Override protected void onListItemClick(ListView l, View v, int position, long id) { Intent intent = new Intent(this, TabbedResults.class); Cursor cursor = (Cursor) getListAdapter().getItem(position); intent.putExtra(ResultsDatabase._ID, cursor.getInt(cursor.getColumnIndex(ResultsDatabase._ID))); startActivity(intent); } pri…
tagged with: canvas
has comment: http://stackoverflow.com/comment/33986098
has title: SherlockActionBar NullPointerException
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/33985568
has comment: http://stackoverflow.com/comment/33984842
has comment: http://stackoverflow.com/comment/33985959
has comment: http://stackoverflow.com/comment/33984605
answer count: 0
has comment: http://stackoverflow.com/comment/33984170
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33984680
tagged with: android-fragments

http://stackoverflow.com/tag/csv
tags question: http://stackoverflow.com/q/22348528
type: Tag
tags question: http://stackoverflow.com/q/22346246
tags question: http://stackoverflow.com/q/22480727
tag name: csv
tags question: http://stackoverflow.com/q/22329113
tags question: http://stackoverflow.com/q/22485041
tags question: http://stackoverflow.com/q/22340439
tags question: http://stackoverflow.com/q/22400137
tags question: http://stackoverflow.com/q/22337912
tags question: http://stackoverflow.com/q/22339564
tags question: http://stackoverflow.com/q/22415487
tags question: http://stackoverflow.com/q/22344334
tags question: http://stackoverflow.com/q/22335196
tags question: http://stackoverflow.com/q/22412865
tags question: http://stackoverflow.com/q/22383093
tags question: http://stackoverflow.com/q/22458301
tags question: http://stackoverflow.com/q/22359634
tags question: http://stackoverflow.com/q/22391699

http://stackoverflow.com/comment/34186587
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22471741
score: 0
has text: check in on device because it may happen becasue of less memory

http://stackoverflow.com/q/22348920
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22349172
score: 0
has body: I am currently working on getting the source code of a specific web page in a file using Java. The web page is: http://www.studenti.ict.uniba.it/esse3/ListaAppelliOfferta.do I wrote some code to do that: try{ URL url= new URL("http://www.studenti.ict.uniba.it/esse3/ListaAppelliOfferta.do"); URLConnection urlConn = url.openConnection(); BufferedReader dis= new BufferedReader(new InputStreamReader((url.openStream()))); String s=""; while (( s=dis.readLine())!= null) { System.out.println(s); } dis.close(); }catch (MalformedURLException mue) {} catch (IOException ioe) {} } This works fine. The problem is I want to "simulate" a user selecting "[1020] Dipartimento di Informatica" in Facoltà and "[1102] Informatica e Tecnologie per la produzione del Software" in Corso di Studio and then the user clicking on "Avvia Ricerca" which starts a search and shows a table with the results. The goal is obtaining the source code of the web page containing also the information in the table I need. I noticed that if I manually do those selections and then click "Avvia Ricerca" to start the search, the web page is loaded again showing the data in the table I need, but the URL does not change. So even if the page is now showing the data I need, when using my code I can only get the source code of the page as it is BEFORE doing the selections and doing the search.
answer count: 3
has title: Simulating user click in a web page [JAVA]
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33967897
has comment: http://stackoverflow.com/comment/33968029
has answer: http://stackoverflow.com/a/22349174
has answer: http://stackoverflow.com/a/22349193

http://stackoverflow.com/comment/34047539
comment on: http://stackoverflow.com/a/22394773
has text: When I try to reconstruct the string with [] it says I needed to have {} for it to be a json object.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22347128
answer count: 1
tagged with: action
accepted answer: http://stackoverflow.com/a/22347459
has answer: http://stackoverflow.com/a/22347459
type: AnsweredQuestion
tagged with: struts-action
has body: I have a struts action flow(struts-1.x framework), which, when executes, the action class ActionFlowActionUnit1.java sets a String variable varName to request using the code request.setAttribute("varNameFromRequest", varName); and the flow finally leads to the loading of a jsp Page1.jsp. Now, Page1.jsp contains a button, which, when clicked, initiates a new struts action flow, which has the action class ActionFlowActionUnit2.java. In this class, I want to use the varName which I had set in request using request.getAttribute(). How can I do it WITHOUT USING SESSION? Technically, I'm not sure if achieving this using requestis possible, because, triggering a new struts-action will lose all other information in the request that was previously set (if I'm correct). I couldn't get anything from Google.
tagged with: java
has title: Using request across 2 different struts-action flows
tagged with: struts-1
tagged with: httprequest
type: Question
score: 0

http://stackoverflow.com/q/22421775
type: Question
has comment: http://stackoverflow.com/comment/34094972
possible better answer: http://stackoverflow.com/a/22422075
has answer: http://stackoverflow.com/a/22422075
tagged with: jsp
has title: Servlet mapping issue - what I'm doing wrong?
has comment: http://stackoverflow.com/comment/34094768
tagged with: servlets
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22422176
accepted answer: http://stackoverflow.com/a/22422176
has answer: http://stackoverflow.com/a/22422829
has comment: http://stackoverflow.com/comment/34094775
has body: It's my first Java EE "app". I am a little bit confused... After googling I think I'm doing everything correct, but if it was so, I wouldn't come across problems : ) My form under save.jsp: Name: Surname: ... etc... I've tried also: form method="post" action="/save" as well as form method="post" action="save" My Servlet: package servlets; import java.io.IOException; import java.sql.SQLException; import // etc public class SaveServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // some actions } } And web.xml mapping: SavingServlet servlets.SaveServlet SavingServlet /save After submitting my save.jsp form I see a classic message: HTTP Status 404 - /SImpleCRUD/save type Status report message /SImpleCRUD/save description The requested resource is not available. What am I doing wrong? Is my mapping incorrect?
type: AnsweredQuestion
tagged with: mapping
tagged with: java
has comment: http://stackoverflow.com/comment/34094816
tagged with: forms

http://stackoverflow.com/a/22473780
has comment: http://stackoverflow.com/comment/34194765
has body: After the class is generated you can click on the generated text and press alt-enter. This shows you an option to edit the template.
has comment: http://stackoverflow.com/comment/34207419
upvote count: 42
type: AcceptedAnswer
downvote count: 0
score: 42
type: Answer
accepted answer of: http://stackoverflow.com/q/22473707
answers question: http://stackoverflow.com/q/22473707

http://stackoverflow.com/q/22476026
answer count: 1
tagged with: smartgwt
accepted answer: http://stackoverflow.com/a/22546414
has body: I'm a newbie using smartgwt and right now I'm having some troubles passing AdvancedCriteria from client to the server. I did a datasource custom operation which builds a relative complex MySQL query in the server. That works fine and I can see the results in the client but my problem comes when I try to add filters to that query. I would like to use the FilterBuilder class and pass AdvancedCriteria from client to server. My problem is that I set the criteria in the client (DSRequest object) and in the server (DSRequest object) this is empty... Client: DSRequest request = new DSRequest(); request.setCriteria(filterBuilder.getCriteria()); DataSource.get("datasource").performCustomOperation("doSomething", record, callback, request); Server: dsRequest.getCriteria() The client is working since looking in firebug I can see the advanced criteria. Any idea. It's actually possible to use a advanced criteria in the server? Thanks!!!
has title: Use a criteria in a custom datasource operation
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22546414
tagged with: java
tagged with: mysql
type: Question
tagged with: datasource
score: 0

http://stackoverflow.com/comment/34161366
type: QuestionComment
has text: @SotiriosDelimanolis It is used for intercepting any controller method mapped to an url so far (It serves as an advice of my customized Spring AOP advisor).
comment on: http://stackoverflow.com/q/22459712
score: 0
type: Comment

http://stackoverflow.com/q/22438495
has comment: http://stackoverflow.com/comment/34124283
has comment: http://stackoverflow.com/comment/34124273
type: Question
has comment: http://stackoverflow.com/comment/34123877
has comment: http://stackoverflow.com/comment/34123943
has comment: http://stackoverflow.com/comment/34124045
has comment: http://stackoverflow.com/comment/34123903
has title: How to split number into digit strings?
has answer: http://stackoverflow.com/a/22438620
has comment: http://stackoverflow.com/comment/34123814
has body: I am new to java programming, I tried a sample code to get input a two digit number and print the wording of that number. public class ReadNumberInWord { public Integer number; public ReadNumberInWord() { Scanner userInput = new Scanner(System.in); System.out.println("Enter the number to read out : "); try { number = userInput.nextInt(); readNumber(); } catch (Exception e) { System.out.println("Please enter an integer"); new ReadNumberInWord(); } } public void readNumber() { System.out.println("Entered number is : " + number); int numSize = number.toString().length(); System.out.println("number size is : " + numSize); switch (numSize) { case 1: sizeOne(); break; case 2: sizeTwo(); break; case 3: sizeThree(); break; case 4: sizeFour(); break; default: System.out.println("Enter number of four digit or less "); new ReadNumberInWord(); break; } } private void sizeFour() { System.out.println("Number in words : " + numberCheck(number.toString())); } private void sizeThree() { String[] sizeThree = number.toString().split(""); System.out.println(sizeThree[0]); System.out.println(sizeThree[1]); System.out.println(sizeThree[2]); for (int i = 0; i &lt;= sizeThree.length - 1; i++) { System.out.println(sizeThree[i]); } System.out.println("Number in words : " + numberCheck(number.toString())); } private void sizeTwo() { String[] sizeTwo = number.toString().split(""); //System.out.println(sizeTwo[0]); //System.out.println(sizeTwo[1]); String wordsString1 = ""; ArrayList&lt;String&gt; wordsArray = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt;= sizeTwo.length - 1; i++) { System.out.println(sizeTwo[i]); String words = numberCheck(sizeTwo[i]); wordsArray.add(words); } for (String w : wordsArray) { wordsString1 += w + "\t"; } System.out.println("Number in words : " + wordsString1); } private void sizeOne() { System.out.println("Number in words : " + numberCheck(number.toString())); } public String numberCheck(String numb) { int num = Integer.parseInt(numb); switch (num) { case …
upvote count: 1
has answer: http://stackoverflow.com/a/22438721
has answer: http://stackoverflow.com/a/77590332
has comment: http://stackoverflow.com/comment/34123997
favorite count: 0
has comment: http://stackoverflow.com/comment/34123927
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34123980
answer count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/22439101
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34123853

http://stackoverflow.com/comment/33938932
comment on: http://stackoverflow.com/q/22332479
score: 0
type: QuestionComment
type: Comment
has text: if a == b then a = b; // useless, don't you think so?

http://stackoverflow.com/comment/108778441
type: AnswerComment
comment on: http://stackoverflow.com/a/38685948
type: Comment
has text: "Oracle JDK without subscription could stop working" - I see no evidence of this. The question of JDK expiration in the Java 8u space has been talked about in various places. There are different descriptions of what JDK/JRE 'expiration' means. From giving warnings when an app starts to nothing at all. This thing about a JDK/JRE just stopping to work after expiration is FUD, there is no evidence for it.
score: 1

http://stackoverflow.com/q/22419503
score: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22419517
has answer: http://stackoverflow.com/a/22419510
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/22419510
has title: arraylist cannot find symbol: method addLast
has body: I'm having a problem with using the addLast method after declaring an ArrayList. Here's the class code: import java.util.*; public class Neuron{ public int m_numInputs; public ArrayList&lt;Double&gt; m_vecWeight = new ArrayList&lt;Double&gt;(); public Neuron(int numInputs){ this.m_numInputs = numInputs + 1; //additional weight for bias for(int i = 0; i &lt; numInputs + 1; ++i){ Random rand = new Random(); m_vecWeight.addLast(rand.nextFloat() * 2.0 - 1.0); } } } So the error I'm getting is: cannot find symbol: method addLast(double), location: variable m_vecWeight of type ArrayList&lt;Double&gt; Any guidance would be greatly appreciated.
tagged with: java
has answer: http://stackoverflow.com/a/22419517
has answer: http://stackoverflow.com/a/22419526
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/22346754
tagged with: java
tagged with: database
type: UnansweredQuestion
tagged with: sql
downvote count: 0
has body: I am having a table in MySQL called hash and it has 2 fields, primary_key and hashValue. I entered data into them using the following code: insert into hash values (1,'car dog play ball morning dark night') insert into hash values (2,'car dog play ball people morning dark night sydney love') Now, I need to do the following. enter a list of words. enter a percentage value. compare words inputted with each row and get the percentage of those words available in rows. get the data rows which is above the percentage value. Ex: Imagine I enter the following word set: sydney love people track Imagine I enter the percentage as: 20 Now, the row with primary_key = 2 contains 10 words, and 3 of them (sydney love people) are in the inputted word list. That 3 words means 30% (3 words out of 10) in the second row. Since the inputted percentage is 20 and 30 is above that, I need to retrieve that row. Just like this, if there are any other rows above 20, I need to get them too. How can do this kind of thing in MySQL? Please note my database knowledge is below average (I know insert,delete,update and JDBC in Java). I did this using Java before. I read a file line by line and did the same. It is taking too much time. Now I am going to replace the file with a DB but I can't apply the same method to here, because the original DB will be really big and reading every line via Java will be a mess. FYI there will be millions of records.
score: 1
favorite count: 0
type: Question
has title: Retrieve data based on conditions in MySQL
has answer: http://stackoverflow.com/a/22348258
has comment: http://stackoverflow.com/comment/33964172
has answer: http://stackoverflow.com/a/22347039
answer count: 2
tagged with: select
tagged with: mysql
upvote count: 1
has comment: http://stackoverflow.com/comment/33964297

http://stackoverflow.com/q/22360885
has answer: http://stackoverflow.com/a/22457255
tagged with: vtd-xml
has comment: http://stackoverflow.com/comment/34041082
has comment: http://stackoverflow.com/comment/34091920
tagged with: xml-parsing
accepted answer: http://stackoverflow.com/a/22457255
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has body: I'm building a VTD based XML Parsing engine in order to process files from several input systems. I'm currently trying to get values from tags with namespace prefix: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;cli:clients xmlns declarations &gt; &lt;cli:client&gt; &lt;dat:name&gt;CLIENT NAME&lt;/dat:name&gt; &lt;dat:age&gt;1&lt;/dat:age&gt; &lt;/cli:client&gt; and querying the following Xpaths: //client/age/text() //client/name/text() How can I set VTD AutoPilot to ignore the namespace prefix? NOTE: I cannot change the xpaths as I already have this engine in production implemented with JDK's default xpath engine. UPDATE: See below the code I am using to test. File is similar to the one on the top: @Test public void doFile() throws Exception { byte[] xmlData = FileUtils.loadFile("namespace-test.xml"); VTDGen gen = new VTDGen(); gen.setDoc(xmlData); gen.parse(false); VTDNav vtd = gen.getNav(); AutoPilot pilot = new AutoPilot(vtd); pilot.selectXPath("//clients"); int re = pilot.evalXPath(); System.out.println(re); if (re &gt;= 0) { System.out.println(vtd.toString(re)); } }
has title: How to ingore namespace prefixes on VTD Xpath lookup
has comment: http://stackoverflow.com/comment/34055013
type: Question
has comment: http://stackoverflow.com/comment/34079154
upvote count: 1
answer count: 1
tagged with: xml-namespaces
tagged with: java

http://stackoverflow.com/comment/34025600
type: QuestionComment
has text: @Churro yes to what? only the default constructor? or all constructors?
score: 0
comment on: http://stackoverflow.com/q/22382107
type: Comment

http://stackoverflow.com/comment/91373669
type: AnswerComment
comment on: http://stackoverflow.com/a/44818827
score: 0
type: Comment
has text: I see a splash screen option under Application, but there is no Icons and Splash Image Edit button under Build-> Deployment. The Enable Native Packing checkbox is ticked.

http://stackoverflow.com/comment/34110086
type: Comment
has text: @user3365831 I added another example with an empty String. If this error occurs when your application starts, I assume you're passing an empty string to `valueOf`. Could you please check that?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22430550

http://stackoverflow.com/a/22379909
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22379650
accepted answer of: http://stackoverflow.com/q/22379650
score: 4
has body: Which one of the following ways is faster? and what is the difference(s)? Take a look at the implementation of String.valueOf(int) (in hyperlinked Grepcode format): 2942 public static String valueOf(int i) { 2943 return Integer.toString(i, 10); 2944 } This should give you a hint&mdash;especially if you are familiar with the concept of method call inlining performed routinely by the JIT compiler on static method calls. On the topic of proper microbenchmarking, you should use jmh to execute this: @OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(Mode.AverageTime) @OperationsPerInvocation(1) @Warmup(iterations = 5, time = 200, timeUnit=MILLISECONDS) @Measurement(iterations = 30, time = 200, timeUnit=MILLISECONDS) @State(Scope.Thread) @Threads(1) @Fork(1) public class Measure { private int arg; @Setup public void setup() { arg = (int) System.nanoTime(); } @GenerateMicroBenchmark public String integerToString() { return Integer.toString(arg); } @GenerateMicroBenchmark public String stringValueOf() { return String.valueOf(arg); } @GenerateMicroBenchmark public String plus() { return ""+arg; } } These were my results: Benchmark Mode Samples Mean Mean error Units o.s.Measure.integerToString avgt 30 53.023 8.868 ns/op o.s.Measure.plus avgt 30 54.043 6.833 ns/op o.s.Measure.stringValueOf avgt 30 52.071 8.217 ns/op
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34021303
has comment: http://stackoverflow.com/comment/34020550

http://stackoverflow.com/comment/34008869
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22372732
has text: it's the last commented out line they are asking about

http://stackoverflow.com/comment/34181572
type: AnswerComment
comment on: http://stackoverflow.com/a/22468024
has text: Sorry I somehow missed that ! or overread it. I fixed all of that so the only errors I am getting is with the this.note=note; ...etc still getting the field error
type: Comment
score: 0

http://stackoverflow.com/comment/34072899
comment on: http://stackoverflow.com/a/22407899
type: Comment
has text: Thanks Lucian. I am not sure how to use the code that you wrote. I copied and pasted and got errors. I was able to fix one error by changing myWebview.setWebViewClient to myWebView.setWebViewClient (changed the v to Captial V in myWebView). The errors are many errors and I am not sure where to start. Do you I need to import anything else?
type: AnswerComment
score: 0

http://stackoverflow.com/a/24076521
answers question: http://stackoverflow.com/q/22375808
accepted answer of: http://stackoverflow.com/q/22375808
type: Answer
has body: At runtime, java discards all class information for generic classes (and thus, for maps). Internally, it then is just working with Objects. When you map a &lt;h:inputText&gt; to a Long field of a bean, this information is still present at runtime. When using a Map&lt;..., Long> however, JSF doesn't know what to map the String (the basic type of a &lt;h:textInput&gt;) to, so it stores it as a String. One solution is, as @Gimby proposed in the comment, to build a simple converter and force JSF to store the value as a Long. @FacesConverter("longConverter") public class FacesLongConverter implements Converter { @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { return Long.parseLong(value); } @Override public String getAsString(FacesContext context, UIComponent component, Object value) { return ((Long) value).toString(); } } then use the converter in your JSF &lt;h:inputText converter="longConverter" value="#{simpleFormTest.longs[input1]}"/&gt; I did not see any further into the matter, there may be more simple solutions.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/22387516
type: UnansweredQuestion
has body: I have two long linear layouts. &lt;LineraLayout A&gt; &lt;View 1/&gt; &lt;View 2/&gt; &lt;View 3/&gt; &lt;/LineraLayout A&gt; &lt;LineraLayout B&gt; &lt;View 1/&gt; &lt;View 2/&gt; &lt;View 3/&gt; &lt;/LineraLayout B&gt; I want to include another xml of a linear layout which will animate and point on LayoutA, view 3 but I want it to look like floating on current layout, not adding it as a child of LinearLayout A how can I do so?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/29122498
tagged with: android-layout
tagged with: layout
has comment: http://stackoverflow.com/comment/34040027
has comment: http://stackoverflow.com/comment/35135598
score: 0
tagged with: android
answer count: 1
has title: how to put an android view (tooltip) on top of another inner view?

http://stackoverflow.com/comment/34241474
score: 0
comment on: http://stackoverflow.com/q/22486239
type: Comment
type: QuestionComment
has text: I'm not sure what your last question means, but for the rest of it, you should probably be using a Swing Timer: http://docs.oracle.com/javase/7/docs/api/javax/swing/Timer.html

http://stackoverflow.com/comment/34140249
has text: That helps a lot, thanks! I'm loading the initial values from a database with a row for each class stats. Since I can't create dynamic variable for the class name how can I reference the class I need to set or get? I may just be thinking about this the wrong way but I can't seem to wrap my thought process on how to get from the variable cc.class_name to get/set the Warrior/Wizard class. At least not without checking if the cc.class_name == "warrior" etc. which seems like a waste.
type: Comment
comment on: http://stackoverflow.com/a/22447032
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34041287
type: Comment
has text: @user3417347 you should [edit](http://stackoverflow.com/posts/22390901/edit) your question and post it below its current content. Stacktraces and code should not be posted in comments.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22390988

http://stackoverflow.com/a/22475854
has body: The String.split() method is what you are in search of. Try this: public static void main(String[] args) { for (String sentence : "Hello Indians,today is good day for you. We are the champions of the world cricket.Here is the time for celebration.Enjoy the moment.".split("[.]")) { System.out.println(sentence); } }
type: Answer
answers question: http://stackoverflow.com/q/22475779
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/comment/34014240
type: Comment
comment on: http://stackoverflow.com/a/22358970
type: AnswerComment
has text: Regarding the first problem, I haven't tried that, so I don't know. Did you try the New API solution in my answer? Regarding the second problem, this is not a problem, I believe, because it is not exactly like that. Reducers start the shuffling phase before all mappers are finished, but the reduce phase starts only when all mappers have finished. Otherwise, some of their input pairs could be missing.
score: 0

http://stackoverflow.com/q/22449132
has answer: http://stackoverflow.com/a/22449441
type: Question
has title: InputStream misses byte while reading in a loop
tagged with: serial-port
has answer: http://stackoverflow.com/a/22449272
has comment: http://stackoverflow.com/comment/34166567
score: 0
tagged with: java
answer count: 2
type: UnansweredQuestion
has body: I'm trying to write a java program to read from a COM port. There are 266 bytes to read, and since the 266 bytes are not generated all together, which means that the input stream can be empty at sometime, I used a while loop to read all 266 bytes. The problem is that SOMETIMES one byte may be missed (only one byte), according to my checking the received bytes one by one. Here are the codes: While(numOfBytes &lt; 266) { if(!(inputStream.available() &gt; 0)) continue; inputStream.read(buffer); data[numOfBytes] = buffer[0]; numOfBytes++; }

http://stackoverflow.com/q/22328472
has comment: http://stackoverflow.com/comment/33932698
upvote count: 1
tagged with: validation
has body: I am trying to validate json using json schema validator and am using the following versions of jars: json-schema-validator-2.1.8 json-schema-core-1.1.9 jackson coreutils 1.5 guava 16.0.1 jackson databind 2.2.3 jackson core 2.3.1 jackson anno 2.3.1 . final JsonNode fstabSchema=Utils.loadResource("Schemas/JsonSchema/"+serviceName+".json"); final JsonNode jsonResponse = Utils.loadResource("Response/Json/devices_search_2.json"); final JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); final JsonSchema schema = factory.getJsonSchema(fstabSchema); ProcessingReport report; report=schema.validate(jsonResponse); System.out.println(report); I am getting this exception and I cant find out what I am missing. Any Help will be appreciated. Exception in thread "main" java.lang.NoClassDefFoundError: com/github/fge/Frozen at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at validate.jsonValidator(validate.java:55) at validate.main(validate.java:74) Caused by: java.lang.ClassNotFoundException: com.github.fge.Frozen I am not using json-schema-core 1.0.2 ( stable version ) because the binary is not available and I am not using maven.
favorite count: 0
has comment: http://stackoverflow.com/comment/33933026
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/82270436
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33933027
has comment: http://stackoverflow.com/comment/82269645
has comment: http://stackoverflow.com/comment/33932992
tagged with: jsonschema
has title: Getting Exception java.lang.NoClassDefFoundError: com/github/fge/Frozen while validating json schema using json-schema-validator 2.1.8
type: Question
has comment: http://stackoverflow.com/comment/33932862

http://stackoverflow.com/q/22376838
has title: Cannot find symbol fail in Junit test
type: AnsweredQuestion
tagged with: windows
downvote count: 0
favorite count: 0
tagged with: linux
type: Question
has answer: http://stackoverflow.com/a/43601874
answer count: 1
has comment: http://stackoverflow.com/comment/34018006
score: 4
accepted answer: http://stackoverflow.com/a/43601874
tagged with: junit4
has comment: http://stackoverflow.com/comment/34222105
tagged with: java
has comment: http://stackoverflow.com/comment/34015478
has comment: http://stackoverflow.com/comment/34015385
upvote count: 4
has body: I have created Junit tests on my windows machine. I want to deploy these tests on a linux server. I have put the code in the correct directory and the necessary jar files in the classpath on the server. Locally the junit test runs fine, but when I want to compile on the linux server e.g. the test initiateDeliverProcess1FileTest i get: InitiateDeliveryProcess1FileTest.java:1029: cannot find symbol symbol : method fail(java.lang.String) location: class com.hp.bes.junit.systest.InitiateDeliveryProcess1FileTest fail("test fail - There should be " + numberOfFiles ^ What can I do to make it compile? update 1: I have junit-4.11.jar in classpath

http://stackoverflow.com/q/22345805
type: Question
has answer: http://stackoverflow.com/a/22345956
has answer: http://stackoverflow.com/a/22346290
has title: Maven web project is not loading spring context xml file
score: 0
answer count: 2
tagged with: applicationcontext
tagged with: tomcat
tagged with: web.xml
type: UnansweredQuestion
tagged with: spring
tagged with: java
has body: I have created a web project then converted it to maven project, I then configure the web.xml with cxf servlet and all the dependencies in the pom.xml file but when I run application in Tomcat nothing about spring context is loaded: it behaves like a normal web project with no spring. Can you please tell me what is wrong? here is my web.xml and applicationContext.xml files: 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:jaxws="http://cxf.apache.org/jaxws" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation=" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> <import resource="/spring-datasource.xml"/> <context:annotation-config /> <context:component-scan base-package="com.webservices.implementations" /> <context:component-scan base-package="com.dao.implementations"/> <jaxrs:server id="productWebService" name="productWebService" address="/productServices"> <jaxrs:serviceBeans> </jaxrs:serviceBeans> </jaxrs:server> </beans> web.xml <?xml version="1.0" encoding="UTF-8"?> TestCxfRs <listener- class>org.springframework.web.context.ContextLoaderListener</listener-class> CXF Servlet org.apache.c…

http://stackoverflow.com/a/22441468
type: Answer
score: 24
answers question: http://stackoverflow.com/q/22397924
downvote count: 0
has comment: http://stackoverflow.com/comment/58606377
has body: Had the same error, which (for me) was caused by my @ManyToOne related classes not being marked with the @Entity annotation (in your case check User and Project). Also ensure those classes' reference back to Task contain the @OneToMany reference.
upvote count: 24

http://stackoverflow.com/comment/34084495
type: QuestionComment
has text: @anttix, nope we don't use regex matching
comment on: http://stackoverflow.com/q/22415382
score: 0
type: Comment

http://stackoverflow.com/a/22482543
has comment: http://stackoverflow.com/comment/34201575
has comment: http://stackoverflow.com/comment/34201086
has body: Create an empty DefaultTableModel with code like: String[] columnNames = {"Course Code", "Subject Code", "Year Level", ...}; DefaultTableModel model = new DefaultTableModel(columnNames, 0); Then in the code where you read the data from the ResultSet you add the data to the TableMOdel using the addRow(....) method. Something like: while (rs.next()) { Vector row = new Vector(); for (int i = 1; i &lt;= columns; i++) { row.addElement( rs.getObject(i) ); } model.addRow( row ); } Finaly you create the table using: JTable table = new JTable( model ); Edit: Since you are using 3rd party code you either need to change the way you add data to the model. I gave you basic code above. You can see the Table From Database Example source code from Table From Database for a complete example. Or, you can modify the column headers after the table is created with code like: table.getColumn("course_code").setHeaderValue("Course Code"); ... table.repaint(); Edit 2: You can get the TableColumn from the TableColumnModel: TableColumnModel tcm = table.getTableColumnModel(); tcm.getColumn(0).setHeaderValue("Course Code"); ... table.repaint();
has comment: http://stackoverflow.com/comment/34204167
has comment: http://stackoverflow.com/comment/34222351
accepted answer of: http://stackoverflow.com/q/22481338
answers question: http://stackoverflow.com/q/22481338
has comment: http://stackoverflow.com/comment/34201915
has comment: http://stackoverflow.com/comment/35089624
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34222175
has comment: http://stackoverflow.com/comment/34254623
type: Answer
has comment: http://stackoverflow.com/comment/34203259
has comment: http://stackoverflow.com/comment/34256695
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/34205278

http://stackoverflow.com/a/22450619
answers question: http://stackoverflow.com/q/22449097
score: 0
has body: Your Web Service should contain the @WebService annotation. Check also the other requirements.
type: Answer

http://stackoverflow.com/q/22391964
has comment: http://stackoverflow.com/comment/34042670
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34043063
tagged with: wildcard
has comment: http://stackoverflow.com/comment/34042719
upvote count: 2
has comment: http://stackoverflow.com/comment/34042735
has answer: http://stackoverflow.com/a/69131463
has title: Java Generics With Any Type <?>
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/34042744
has body: I'm trying to write a method in Java that will be able to add a custom Key object to an array, or change an already existing key in the array if there is one. However, I can't seem to get it to work. The types that keys will use are primarily be String and Integer, but my universal approach doesn't seem to work. The setValue() method has T as the parameter type, and getValue() returns T. public void set(Key&lt;?&gt; key) { for (int i = 0; i &lt; settings.size(); i++) { Key&lt;?&gt; k = settings.get(i); if (k.getName().equals(key.getName())) { k.setValue(key.getValue()); // Error here break; } } settings.add(key); } The error (I'm using Eclipse) is: The method setValue(capture#4-of ?) in the type Key&lt;capture#4-of ?&gt; is not applicable for the arguments (capture#5-of ?)
has comment: http://stackoverflow.com/comment/34042730
has comment: http://stackoverflow.com/comment/34042938
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/34043349
downvote count: 0
has comment: http://stackoverflow.com/comment/34042773
has answer: http://stackoverflow.com/a/23199750
possible better answer: http://stackoverflow.com/a/69131463
tagged with: java
accepted answer: http://stackoverflow.com/a/23199750
has comment: http://stackoverflow.com/comment/34042883

http://stackoverflow.com/comment/34192025
has text: @LeosLiterak I tried that you suggest me and the problem is in my request. I think that maybe there is this problem because there are two forms in the page but I read the code and the "login" form hasn't got any name/id. Thank's for your help!
comment on: http://stackoverflow.com/q/22466228
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34153960
type: QuestionComment
has text: possible duplicate of https://stackoverflow.com/questions/9720195/what-is-the-best-way-to-get-the-count-length-size-of-an-iterator
comment on: http://stackoverflow.com/q/22455401
score: 0
type: Comment

http://stackoverflow.com/comment/49477188
score: 0
type: AnswerComment
has text: This was 'fixed' in Java 8u20. An exception is now thrown: http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/c5ebcc5268b4
type: Comment
comment on: http://stackoverflow.com/a/22478966

http://stackoverflow.com/a/27065408
has body: Late now but if anyone else comes across it: openssl smime -sign by default generates an "indirect" detached signature, that is, one which does not contain the data in encapContentInfo but does use signedAttrs. See https://www.ietf.org/rfc/rfc3369.txt 5.3 through 5.6; you need to compare a hash of the data to the message-digest attribute in the signedAttrs, and then verify the signature against the signedAttrs (with the IMPLICIT tagging reverted to basic). Standard Java crypto does not (currently?) do CMS/PKCS#7 but BouncyCastle does if that's an option. Consider Correct way to sign and verify signature using bouncycastle .
answers question: http://stackoverflow.com/q/22480784
type: Answer
score: 0

http://stackoverflow.com/a/22353600
answers question: http://stackoverflow.com/q/22353209
score: 0
has body: Map&lt;String, Integer&gt; map = new HashMap&lt;String,Integer&gt;(); Set&lt;Integer&gt; set = new TreeSet&lt;Integer&gt;(map.values()); Iterator iter = set.iterator(); Integer firstValue = (Integer) iter.next(); String firstKey = null; for(String key : map.keySet()) { if(map.get(key) == firstValue) { firstKey = key; break; } }
type: Answer

http://stackoverflow.com/comment/34044505
type: Comment
has text: so the onCreate() method is what creates the instance? onCreate() sounds a lot like the class's constructor but a constructor doesn't actually create an instance, it just initializes stuff.
comment on: http://stackoverflow.com/a/22392389
score: 0
type: AnswerComment

http://stackoverflow.com/a/22351282
has body: The final keyword ensures that the reference, hold by the variable, won't change. The state of the referenced instance may change. What you are likely look for is immutability of the referenced instance. This is the responsibility of the instance.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22351222
upvote count: 1

http://stackoverflow.com/comment/34186683
type: AnswerComment
has text: Oh ! Do you mean I would need to specify hard code ?
type: Comment
comment on: http://stackoverflow.com/a/22474305
score: 0

http://stackoverflow.com/q/22370132
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/34004954
tagged with: java
has body: I have a date object in format "Wed Feb 12 00:11:29 GMT 2014" and I have TIMESTAMP column in DB. I want a query records from the table which are greater than the date given in Java Program. I am using ">=" operator to compare. But it's not comparing properly. I mean it will compare day wise properly but not based on Hours properly. Date d= new Date("Wed Feb 12 00:11:29 GMT 2014"); String qry="select * from table where date_comlum &gt;=?"; st.setTimestamp(1,d.getTime()); st.execute(qry);
has title: SQL TIMESTAMP Column and Java TimeStamp/Date Comparision
type: Question
has comment: http://stackoverflow.com/comment/34006822
answer count: 1
has comment: http://stackoverflow.com/comment/34006061
has comment: http://stackoverflow.com/comment/34005099
tagged with: sql
linked to: http://stackoverflow.com/q/10073893
has answer: http://stackoverflow.com/a/22371649
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/34006660
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34013099

http://stackoverflow.com/a/22337589
score: 1
has body: Besides the mojo-executor there is no direct way to call another plugin from plugin code. However plugins can execute a parallel lifecycle which can call other plugins via its own XML configuration. http://books.sonatype.com/mvnref-book/reference/writing-plugins-sect-plugins-lifecycle.html
answers question: http://stackoverflow.com/q/22337405
has comment: http://stackoverflow.com/comment/33954976
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/22445091
has answer: http://stackoverflow.com/a/22445107
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/34136904
has body: Is it a good practice to have all the fields equal to null and just create them when they are required ? public class Products { private Map listofProducts = null; private Owner owner = null; private List&lt;listOfProductsResults&gt; listofProductsResults = null; private String fileName = null; private long id = 0L; public Products(){ } In this way whenever a method needs each of them I do the following if(listOfProducts == null){ this.listOfProducts = new HashMap(); }
has comment: http://stackoverflow.com/comment/34136722
type: Question
has title: Is it a good practice to set all the fields to null?
answer count: 2
has comment: http://stackoverflow.com/comment/34136686
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22445165
has comment: http://stackoverflow.com/comment/34136698
has comment: http://stackoverflow.com/comment/34136708
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/34064815
score: 1
comment on: http://stackoverflow.com/q/22403914
type: Comment
type: QuestionComment
has text: You can use `setContentView()` multiple times but only one layout will be loaded.

http://stackoverflow.com/comment/34057408
type: Comment
comment on: http://stackoverflow.com/a/22400367
has text: Hey mark yeah i have the whole documentation of tomcat examples. I need to write a similar code for echo server. Can you guide me how do i get about it. I need a server which will communicate with my client using a websocket.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22368125
has comment: http://stackoverflow.com/comment/34009956
accepted answer of: http://stackoverflow.com/q/22367910
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/34040578
has body: You can't get the original text back from a message digest. It's a one-way process.
has comment: http://stackoverflow.com/comment/34019381
type: AcceptedAnswer
upvote count: 3
answers question: http://stackoverflow.com/q/22367910
type: Answer

http://stackoverflow.com/a/22407957
has body: Little modification in code public static void main(String[] args) { testingStuff stuff = new testingStuff(); System.out.println(stuff.func()); // prints the result }
type: Answer
answers question: http://stackoverflow.com/q/22407779
score: 0

http://stackoverflow.com/a/22585055
downvote count: 0
has body: OK, so, first, apologies to @JBNizet for blatant code stealing (original URL to the stolen code: here). The thing is that Java 5's varargs is just syntactic sugar for an array. Witness this code: class Ideone { public static void main (String[] args) throws java.lang.Exception { foo(args); } private static void foo(String... params) { System.out.println(Arrays.toString(params)); } } It works. It would have worked the same if instead you had used a varargs in main() and an array in foo(). So, in UML, you can model varargs as an array.
type: Answer
answers question: http://stackoverflow.com/q/22456284
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22456284
type: AcceptedAnswer

http://stackoverflow.com/comment/34096868
score: 0
comment on: http://stackoverflow.com/q/22422974
type: Comment
type: QuestionComment
has text: As I said, insert `System.out.println("|" + rs.getString(2) + "|" + rs.getString(3) + "|");` before the "if" statement. Run it again and see what prints out.

http://stackoverflow.com/q/22404670
accepted answer: http://stackoverflow.com/a/22405243
has comment: http://stackoverflow.com/comment/34065887
has comment: http://stackoverflow.com/comment/34064473
has title: How to Edit a Java Object from Another Class With Ease
has comment: http://stackoverflow.com/comment/34066754
tagged with: gwt
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34063778
tagged with: java
tagged with: vaadin
has body: I'm coming from Python whereby I just passed self and I could edit the objects that way. So I have some code: public void initLayout() { DockLayoutPanel layout = new DockLayoutPanel(Unit.PC); layout.addNorth(new HTML(" v0.1"), 2); layout.addSouth(new HTML("Footer"), 2); layout.addWest(new HTML(""), 2); layout.add(new HTML("center")); RootLayoutPanel rootLayout = RootLayoutPanel.get(); rootLayout.add(layout); } This sets out the layout of the panel I'm using. I now want to easily edit/add to parts of these panels with ease. So for example in another method: private void initPanel() { rootlayout.add(some_new_component); } Or even in the future add to scroll bars etc. I know I could create a method which functioned in a way that I can pass it variables to add all the data now, but I want it to be more flexible in that I want to change things later.
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34064383
has answer: http://stackoverflow.com/a/22405243
has comment: http://stackoverflow.com/comment/34064263

http://stackoverflow.com/comment/34072541
comment on: http://stackoverflow.com/q/22409389
has text: Yes, @Matthieu, thanks I updated
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/49846540
comment on: http://stackoverflow.com/a/22367310
score: 0
type: AnswerComment
has text: Edward, you did not read exactly description given by benallansmith! He wrote that his VERSION IS 4.4.x!! Did you know about changes in 4.4.x ? Your description said that you are not.
type: Comment

http://stackoverflow.com/a/22363567
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22336991
has body: Unfortunately, at this time, the shipping information is only returned in the Execution response. There are discussions to modify this for future releases.
type: Answer
accepted answer of: http://stackoverflow.com/q/22336991

http://stackoverflow.com/q/22442118
has answer: http://stackoverflow.com/a/22442410
accepted answer: http://stackoverflow.com/a/22442410
has body: I am having a problem...I am trying to put components on a panel...and they arent showing up the way I would expect them too. here is an example... here is the code: package UserInterface; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.*; /** * * @author */ public class FlightPrice extends JPanel { private JPanel buttonPane; private JPanel dataPane; private JLabel outbound; private JLabel outDate; private JTable departFlights; private JLabel inbound; private JLabel inDate; private JTable returnFlights; private JLabel flightCost; private JTable priceTable; private JButton purchase; private JButton goBack; private JButton cancel; public FlightPrice() { initComponents(); } private void initComponents() { BorderLayout borderLayout = new BorderLayout(); //iniyliazing the componenets\\ Object[][] data1 = {{"239", "United", "8:00 AM MCO", "9:05 AM ATL", "767", "25F"}}; String[] name = {"", "",}; Object [][] data2 = {{"612", "United", "4:35 PM ATL", "5:45 PM MCO", "A320", "19A"}}; String [] name2 = {"",""}; Object [][] data3 = {{"Adult", "1", "546.00", "56.00", "602.00"}}; String [] name3 = {"",""}; buttonPane = new JPanel(); dataPane = new JPanel(new GridBagLayout()); outbound = new JLabel("Depart: Orlando TO Atlanta"); outDate = new JLabel("Date: March 1, 2014"); departFlights = new JTable(data1, name); inbound = new JLabel("Return: Atlanta TO Orlando"); inDate = new JLabel("Date: March 19, 2014"); returnFlights = new JTable(data2, name2); flightCost = new JLabel("Air Fare Cost"); priceTable = new JTable(data3, name3); purchase = new JButton("Purchase"); goBack = new JButton("goBack"); cancel = new JButton("Cancel"); //adds componetns to the panel\\ GridBagConstraints c = new GridBagConstraints(); //adding info into the tables\\ c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridx = 0; dataPane.add(outbound, c); c.gridx = 0; c.gridy = 1; dataPane.add(outDate, c); c.gri…
tagged with: swing
has title: Java Swing improperly showing up
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34131378
tagged with: layout
score: 0
answer count: 1

http://stackoverflow.com/comment/34184536
score: 0
comment on: http://stackoverflow.com/a/22472523
type: AnswerComment
type: Comment
has text: no, it's just a regular filter which implements Filter. Filter does not catch requests to servlets, which have mappings thru their web.xmls. Is there anything like defaullt filter in tomcat? may be i need to configure that?

http://stackoverflow.com/a/22404703
has body: You need to understand that there's a difference between an object and a reference (ie, pointer). An object is real (as close as anything is "real" in a program) "thing". A reference is simply the address of the thing. If, in a phone book, I change the address of your house from 123 1st Ave to 456 2nd St, that doesn't change your house. It will still (presumably) be located at 123 1st Ave. But if someone follows the address in the phone book they will end up at a different house. And if you move from one house to the other you don't (usually) take the house, you load the furniture into a truck (lorry) and haul it to the other house. Then, if you don't change the phone book, someone looking for you will end up at the wrong (old) house. (This has nothing to do with the fact that a String is immutable, BTW. The same is true of an array of long. But what you're doing in the above code with the array is moving in new furniture, not changing the address. There is only ever one array.)
answers question: http://stackoverflow.com/q/22404360
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/34101662
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22426040
type: QuestionComment
has text: Have you tried using [`ImageIO#read(URL u)`](http://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html#read(java.net.URL)) instead of `Toolkit#getImage`?

http://stackoverflow.com/q/22482196
tagged with: java
has answer: http://stackoverflow.com/a/22491318
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22488151
score: 0
linked to: http://stackoverflow.com/q/21868170
tagged with: timer
has title: Animating Separate Objects
type: UnansweredQuestion
tagged with: animation
has body: I've been working on an "elevator simulator" where I have to animate "elevators". I was able to create different elevator objects, which I did by having each Elevator Object have the parameters of width, height, and coordinates. I then stored them all into an array and used a for loop to draw them into my frame using JPanel's PaintComponent method. Can you guys suggest a way or give me advice to animate them separately from each other, like say move them up and down independently? I was able to make it move when I only had ONE elevator, but when I tried to apply it to multiple elevators, it did not work. My previous attempt involved an ActionListener (that listens to a button press to "start" the animation) that simply changes the x and y coordinates of the SINGLE elevator. So How do I go and do that with several elevators (the number of elevators is arbitrary to the user). Do I have to make as many ActionListeners as there are elevators, so it can listen to them independently? Here's the ActionListener that worked when there's only ONE elevator. It only moves up so far. private ActionListener timerActionUp = new ActionListener() { private int iterator = 0; private int top = 0; public void actionPerformed(ActionEvent e) { if(top&lt;floorQueue.length){ if(iterator&lt;floorQueue[top]){ //floorQueue is so that the elevator knows where to stop if(movefloorup&lt;VERTICALFLOORDISTANCE*6){ //this is when the elevator reaches the "top" floor that can fit into the screen, and moves to the next column representing the floors further up repaint(); movefloorup = movefloorup + VERTICALFLOORDISTANCE; System.out.println(movefloorup); iterator++; } else{ //timer.stop(); repaint(); switchmarker = 1; //makes elevator moves to the next column movefloorup = 0; iterator++; } } else { System.out.println("Picking up passengers..."); elevatorCapacity = elevatorCapacity + peopleQueue[floorQueue[top]]; System.out.println("Passengers in elevator: "+elevatorCapacity); peopleQueue[floorQueue[to…
tagged with: swing
tagged with: actionlistener

image
tags question: http://stackoverflow.com/q/22368003
tags question: http://stackoverflow.com/q/22414217
tags question: http://stackoverflow.com/q/22375708
tags question: http://stackoverflow.com/q/22458667
tags question: http://stackoverflow.com/q/22447824
tags question: http://stackoverflow.com/q/22423804
tags question: http://stackoverflow.com/q/22440867
tags question: http://stackoverflow.com/q/22344378
tags question: http://stackoverflow.com/q/22398145
tags question: http://stackoverflow.com/q/22358814
tags question: http://stackoverflow.com/q/22361452
tags question: http://stackoverflow.com/q/22397678
tags question: http://stackoverflow.com/q/22432161
tags question: http://stackoverflow.com/q/22401837
tags question: http://stackoverflow.com/q/22463308
tags question: http://stackoverflow.com/q/22417980
tags question: http://stackoverflow.com/q/22418408
tags question: http://stackoverflow.com/q/22460135
tag name: image
tags question: http://stackoverflow.com/q/22394495
tags question: http://stackoverflow.com/q/22456752
tags question: http://stackoverflow.com/q/22466793
tags question: http://stackoverflow.com/q/22363833
tags question: http://stackoverflow.com/q/22431620
tags question: http://stackoverflow.com/q/22427424
tags question: http://stackoverflow.com/q/22391353
tags question: http://stackoverflow.com/q/22343890
tags question: http://stackoverflow.com/q/22369406
type: Tag
tags question: http://stackoverflow.com/q/22468906

http://stackoverflow.com/comment/34089203
comment on: http://stackoverflow.com/q/22418585
has text: You have too many unrelated questions packed in here.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22481406
answers question: http://stackoverflow.com/q/22481300
type: Answer
score: 2
upvote count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34199338
has body: In C and C++ this kind of thing is undefined behaviour (since, in those languages, the + does not sequence the two expressions). But in Java, it is defined. The evaluation order is from left to right. It's quite simple: the first expression is x++ which has the value of 5 but increases x to 6. The second expression is ++x which increases x from 6 to 7 and has the value of 7. 5 + 7 = 12: Done. Needless to say, this kind of code is not recommended. And a port to C / C++ would be distastrous.

http://stackoverflow.com/comment/34191084
has text: I tried parser.setAllowLeadingWildcard(true) but still it doesn't work.
type: AnswerComment
comment on: http://stackoverflow.com/a/22471524
score: 0
type: Comment

qimage
tags question: http://stackoverflow.com/q/22364663
tag name: qimage
type: Tag

http://stackoverflow.com/comment/124262043
has text: @JamesBond you can navigate to it in a similar way. For example, using View Binding you could do the following: `binding.myButton.setOnClickListener { navController.navigate(R.id.settingsFragment) }`
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/65675217

http://stackoverflow.com/q/22431214
downvote count: 0
type: UnansweredQuestion
has body: Getting errors in one of my classes, "cannot find symbol". What am i doing wrong here? Do I need to declare them before hand? Getting errors in one of my classes, "cannot find symbol". What am i doing wrong here? Do I need to declare them before hand? Trying to make it look like this: package userInterface; import javax.swing.JPanel; import java.awt.*; import javax.swing.JButton; /** * * @author */ public class AddAirport { private JPanel mainPane; public AddAirport(JPanel mainPane){ GridBagLayout gridBagLayout; gridBagConstraints constraints; JPanel buttonPane; JPanel dataPane; BorderLayout borderLayout; JButton addBtn; JButton canxBtn; JLabel newAirport; JLabel enterName; JTextField airportName; JLabel enterCity; JTextField airportCity; JLabel selectState; JComboBox airportState; JLabel enterCode; } }
has answer: http://stackoverflow.com/a/22431226
has answer: http://stackoverflow.com/a/22431373
tagged with: user-interface
score: 1
favorite count: 0
type: Question
answer count: 2
upvote count: 1
tagged with: swing
has title: Trouble configuring GUI
tagged with: java
tagged with: layout

http://stackoverflow.com/a/22395519
answers question: http://stackoverflow.com/q/22395440
has body: An impure function does not return anything. That is what a computer textbook says. It’s wrong. An impure function can indeed return anything after doing whatever impure things it does. This is true in Java and every other language I know of.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34048833
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22395440
has comment: http://stackoverflow.com/comment/34049981
downvote count: 0

http://stackoverflow.com/q/22480591
answer count: 1
has body: I want get to the variables(${colour}) list and then pass the variables dynamically.Is it possible to get the variables list. Thanks
has title: How to read variables from the word document using docx4j?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22489929
tagged with: spring-mvc
tagged with: java
type: Question
tagged with: docx4j
score: 0

http://stackoverflow.com/q/22356715
upvote count: 1
has comment: http://stackoverflow.com/comment/33981438
tagged with: swing
has body: in my application I have 2 types of JComboBox: editable and non-editable. Here how the editable appears in Windows 7 with Java 7: and here's the non editable: Is it possible to set white background in the non-editable JComboBox ?
tagged with: java
has answer: http://stackoverflow.com/a/22360212
has comment: http://stackoverflow.com/comment/33982908
type: Question
has title: Java JComboBox appearence
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: jcombobox
type: UnansweredQuestion

http://stackoverflow.com/q/22436560
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22436642
score: 1
favorite count: 0
has body: I have been trying to get a simple app running that shows a map but it just wouldn't work. That's the code im using: MainActivity.java: package info.androidhive.googlemapsv2; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Get a handle to the Map Fragment GoogleMap map = ((MapFragment) getFragmentManager() .findFragmentById(R.id.map)).getMap(); LatLng sydney = new LatLng(-33.867, 151.206); map.setMyLocationEnabled(true); map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13)); map.addMarker(new MarkerOptions() .title("Sydney") .snippet("The most populous city in Australia.") .position(sydney)); } } GoogleMapsV2 Manifest: <?xml version="1.0" encoding="utf-8"?> <permission android:name="info.androidhive.googlemapsv2.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <uses-permission android:name="info.androidhive.googlemapsv2.permission.MAPS_RECEIVE" /> <uses-sdk android:minSdkVersion="12" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-library android:name="com.goog…
tagged with: android
tagged with: dictionary
has title: Google Maps API v2 throws java.lang.runtimeexception: unable to start activity java.lang.nullpointerexception
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22436642
upvote count: 1
type: Question
tagged with: java
tagged with: google-maps

http://stackoverflow.com/a/22374411
score: 5
has comment: http://stackoverflow.com/comment/34011963
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22374323
has comment: http://stackoverflow.com/comment/34017099
has body: If you were to define your constructor as: public Credentials(String userName, String password) { this.userName = userName; this.password = password; } Then the compiler will add an implicit call to the superclass constructor anyway, so this doesn't make ANY difference to the compiled code. The Credentials class does not explicitly extend another class so it extends Object I guess. What is the super(); call good for? But your class implicitly extends Object, so a call to Object() will be made.
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/22374323

http://stackoverflow.com/q/22426548
has comment: http://stackoverflow.com/comment/34102782
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/34102609
type: UnansweredQuestion
tagged with: android
has body: I am working on a project to communicate an Android application with a Java servlet. In this android application, the string entered in editText view should be sent to Java servlet as a request and Java servlet should replace this string with another string as a response. Here is my code for Android app: public class DoubleMeActivity extends Activity implements OnClickListener { static EditText inputValue=null; Integer doubledValue =0; Button doubleMe; TextView tv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.calculate); inputValue = (EditText) findViewById(R.id.inputNum); doubleMe = (Button) findViewById(R.id.doubleme); tv = (TextView) findViewById(R.id.textView2); doubleMe.setOnClickListener(this); // check if you are connected or not if(isConnected()){ tv.setBackgroundColor(0xFF00CC00); tv.setText("You are conncted"); } else{ tv.setText("You are NOT conncted"); } } @Override public void onClick(final View v) { switch (v.getId()){ case R.id.doubleme: if(!validate()) Toast.makeText(getBaseContext(), "Enter some data!", Toast.LENGTH_LONG).show(); else new HttpAsyncTask().execute("http://139.179.92.123:8080/SmartStoreServlet/FemtoStore"); break; } } private class HttpAsyncTask extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... urls) { return POST(urls[0]); } // onPostExecute displays the results of the AsyncTask. @Override protected void onPostExecute(String result) { Toast.makeText(getBaseContext(), "Data Sent!", Toast.LENGTH_LONG).show(); } } public static String POST(String url){ InputStream inputStream = null; String result = ""; try { // 1. create HttpClient HttpClient httpclient = new DefaultHttpClient(); // 2. make POST request to the given URL HttpPost httpPost = new HttpPost(url); JSONObject jsonObject = new JSONObject(); jsonObject.accumulate("string" , inputValue.getText().toString()); String json = jsonObject.toString(); System.out.p…
answer count: 0
tagged with: java
has title: Getting POST request from android app by Java servlet
type: Question
has comment: http://stackoverflow.com/comment/34119456
has comment: http://stackoverflow.com/comment/34102580
has comment: http://stackoverflow.com/comment/34102484

http://stackoverflow.com/a/22444341
type: Answer
answers question: http://stackoverflow.com/q/22444123
downvote count: 0
score: 1
has body: Could you simply deal with two columns? The first one taking 5/6 of the available width and the second one taking the 1/6th remaining? You could try the following: final JPanel sPan = new JPanel(); sPan.setBackground(Color.RED); constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 5 / 6f; // change this value... constraints.weighty = 1.00; add(sPan, constraints); final JPanel cPan = new JPanel(); cPan.setBackground(Color.BLUE); constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1 / 6f; // ... and this one. constraints.weighty = 1.00; add(cPan, constraints); Please note: I replaced your JPanels by some empty JPanels with a background color, so even like this you can see what's going on.
upvote count: 1
has comment: http://stackoverflow.com/comment/34135797

sql
tags question: http://stackoverflow.com/q/22350435
tags question: http://stackoverflow.com/q/22346643
tags question: http://stackoverflow.com/q/22486446
tags question: http://stackoverflow.com/q/22381583
tags question: http://stackoverflow.com/q/22476972
tags question: http://stackoverflow.com/q/22347030
tags question: http://stackoverflow.com/q/22450184
tags question: http://stackoverflow.com/q/22448467
tags question: http://stackoverflow.com/q/22449540
tags question: http://stackoverflow.com/q/22402349
tags question: http://stackoverflow.com/q/22346246
tags question: http://stackoverflow.com/q/22407180
tags question: http://stackoverflow.com/q/22428404
tags question: http://stackoverflow.com/q/22407768
tags question: http://stackoverflow.com/q/22411262
tags question: http://stackoverflow.com/q/22426018
tags question: http://stackoverflow.com/q/22478006
tags question: http://stackoverflow.com/q/22429871
tags question: http://stackoverflow.com/q/22483690
tags question: http://stackoverflow.com/q/22412234
tags question: http://stackoverflow.com/q/22333027
tags question: http://stackoverflow.com/q/22397367
tags question: http://stackoverflow.com/q/22384710
tags question: http://stackoverflow.com/q/22485574
tags question: http://stackoverflow.com/q/22428434
tags question: http://stackoverflow.com/q/22435292
tags question: http://stackoverflow.com/q/22410236
tags question: http://stackoverflow.com/q/22356184
tags question: http://stackoverflow.com/q/22334215
tag name: sql
tags question: http://stackoverflow.com/q/22410117
type: Tag
tags question: http://stackoverflow.com/q/22339564
tags question: http://stackoverflow.com/q/22433462
tags question: http://stackoverflow.com/q/22385398
tags question: http://stackoverflow.com/q/22449440
tags question: http://stackoverflow.com/q/22478321
tags question: http://stackoverflow.com/q/22341422
tags question: http://stackoverflow.com/q/22384612
tags question: http://stackoverflow.com/q/22385191
tags question: http://stackoverflow.com/q/22398977
tags question: http://stackoverflow.com/q/22427778
tags question: http://stackoverflow.com/q/22405299
tags question: http://stackoverflow.com/q/22360136
tags question: http://stackoverflow.com/q/22339888
tags question: http://stackoverflow.com/q/22354922
tags question: http://stackoverflow.com/q/22465404
tags question: http://stackoverflow.com/q/22422241
tags question: http://stackoverflow.com/q/22437734
tags question: http://stackoverflow.com/q/22379089
tags question: http://stackoverflow.com/q/22402497
tags question: http://stackoverflow.com/q/22474884
tags question: http://stackoverflow.com/q/22443153
tags question: http://stackoverflow.com/q/22366501
tags question: http://stackoverflow.com/q/22457292
tags question: http://stackoverflow.com/q/22458330
tags question: http://stackoverflow.com/q/22344693
tags question: http://stackoverflow.com/q/22449359
tags question: http://stackoverflow.com/q/22346197
tags question: http://stackoverflow.com/q/22370132
tags question: http://stackoverflow.com/q/22368649
tags question: http://stackoverflow.com/q/22485784
tags question: http://stackoverflow.com/q/22483948
tags question: http://stackoverflow.com/q/22403933
tags question: http://stackoverflow.com/q/22466171
tags question: http://stackoverflow.com/q/22345360
tags question: http://stackoverflow.com/q/22440694
tags question: http://stackoverflow.com/q/22393476
tags question: http://stackoverflow.com/q/22344334
tags question: http://stackoverflow.com/q/22463392
tags question: http://stackoverflow.com/q/22388736
tags question: http://stackoverflow.com/q/22431350
tags question: http://stackoverflow.com/q/22443880
tags question: http://stackoverflow.com/q/22372469
tags question: http://stackoverflow.com/q/22431831
tags question: http://stackoverflow.com/q/22479759
tags question: http://stackoverflow.com/q/22360730
tags question: http://stackoverflow.com/q/22404572
tags question: http://stackoverflow.com/q/22455206
tags question: http://stackoverflow.com/q/22377052

http://stackoverflow.com/a/22363367
has body: In your Town class add a method called compareTo(Datatype data1). public class Town { public int compareTo(Town data1) { // compare both the object and return the coresponding value return 0; } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22363119

http://stackoverflow.com/q/22473143
has comment: http://stackoverflow.com/comment/34184799
tagged with: java
score: 0
possible better answer: http://stackoverflow.com/a/22473469
has answer: http://stackoverflow.com/a/22473423
accepted answer: http://stackoverflow.com/a/22473423
has comment: http://stackoverflow.com/comment/34184772
has title: Can some one help me with this message java Exception?
has answer: http://stackoverflow.com/a/22473311
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22473469
has body: i have an assignment in java to sort numbers in ascending order and find the max, min , mean and standard deviation i have done that already but i wanted to change the program to work with double values but there is an exception showing and i cant solve the problem please help can someone fix it. import java.io.*; import java.util.Scanner; import java.io.FileReader; import java.io.FileWriter; import java.io.BufferedReader; import java.io.PrintWriter; import java.io.IOException; public class FileJava2 { static double min,max,sum,k; static double PS1,PS2; static double stdev=0; static double aa, x[]=new double[1000], no; static String source= "",source2= ""; public static void main (String args[]) throws Exception { FileJava2.fileinput(); FileJava2.fileoutput(); FileJava2.sort(); FileJava2.display(); } public static void sort() throws Exception { sum=0; for(int j=0;j&lt;k;j++){ sum+=x[j]; System.out.print(x[j]+" "); } double t; for(int dd=0; dd&lt;k; dd++){ for(int in=0;in&lt;k-1;in++){ if(x[dd]&lt;x[in]) {t=x[dd]; x[dd]=x[in]; x[in]=t; } } } min=x[0];max=0; System.out.print("\nSorted Elements: "); for(int j=0;j&lt;k;j++){ if(x[j]&lt;min) min=x[j]; if(x[j]&gt;max) max=x[j]; source2+=x[j]; System.out.print(x[j]+" "); source+=x[j]; } PS1=0;PS2=0; for( int i=0; i&lt;k;i++) { PS1 += x[i]; PS2 += Math.pow(x[i], 2); stdev = Math.sqrt(i*PS2 - Math.pow(PS1, 2))/i; } byte buf1[]=source2.getBytes(); OutputStream fo1=new FileOutputStream("SortData.txt"); for (int i=0;i&lt;buf1.length;i++) { fo1.write(buf1[i]); } } public static void fileinput() throws Exception{ Scanner s = new Scanner(System.in); do{ System.out.print("Enter Numbers: "); aa=s.nextDouble(); if(aa==0) break; else source+=(aa+" "); } while(aa!=0); System.out.println("YOUR INPUT: "+source); k=0; byte buf[]=source.getBytes(); OutputStream fo=new FileOutputStream("waitingtime"); for (int i=0;i&lt;buf.length;i++) { fo.write(buf[i]); } System.out.println("\nElements successfuly saved into waitingtime.dat "); } public st…
type: Question
has answer: http://stackoverflow.com/a/22473625

http://stackoverflow.com/q/22464596
has comment: http://stackoverflow.com/comment/34171040
has comment: http://stackoverflow.com/comment/34170752
has comment: http://stackoverflow.com/comment/34170789
has comment: http://stackoverflow.com/comment/34170836
has answer: http://stackoverflow.com/a/22464629
type: Question
score: 3
tagged with: java
linked to: http://stackoverflow.com/q/4488716
has body: I am working with Java generics. Here is a code example followed by the question. public class Test&lt;T extends Comparable&lt;T&gt;&gt; { T data; public Test(T data) { this.data = data; } public T getData() { return this.data; } } class MyClass&lt;T extends Comparable&lt;T&gt;&gt; extends Test&lt;T&gt; { //if I remove this constructor, code will not compile public MyClass(T data) { super(data); } } In MyClass, if I do not have the constructor I get the following compile time error: Implicit super constructor Test&lt;T&gt;() is undefined for default constructor. Must define an explicit constructor Why does the compiler make me do this?
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22464629
favorite count: 0
has comment: http://stackoverflow.com/comment/34170714
has comment: http://stackoverflow.com/comment/34170521
tagged with: subclass
has title: Why do I need to have a constructor in this Java generic subclass?
type: AnsweredQuestion
upvote count: 3

http://stackoverflow.com/comment/34224262
has text: @KarlMorrison Nice work, and way to figure it out yourself! You're encouraged to answer the question yourself, and accept it, since it was indeed the solution to your problem.
comment on: http://stackoverflow.com/a/22444474
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34061481
type: QuestionComment
score: 0
has text: please post the complete error in stack trace?
comment on: http://stackoverflow.com/q/22401837
type: Comment

http://stackoverflow.com/comment/34207749
type: Comment
type: QuestionComment
has text: indeed, have posted solution below :)
score: 0
comment on: http://stackoverflow.com/q/22485881

http://stackoverflow.com/a/22415844
score: 1
has body: If rule is an int, it's not going to be possible for the annotation processor to find out where that int was defined. However, you could use an enum instead of an int for the rule field and group your rules in there with references to their parsers. Maybe something like this: Parser interface: public interface RuleParser { } Example implementation: public class RuleParserImpl implements RuleParser { } Rule enum: public enum Rule { RULE_STATEMENT(RuleParserImpl.class); private final Class&lt;? extends RuleParser&gt; ruleParserClass; private Rule(Class&lt;? extends RuleParser&gt; ruleParser) { this.ruleParserClass = ruleParser; } public Class&lt;? extends RuleParser&gt; getRuleParserClass() { return ruleParserClass; } } Annotation with enum instead of int field: @Retention(RetentionPolicy.RUNTIME) public @interface RuleDependency { Rule rule(); } Usage example: @RuleDependency(rule = Rule.RULE_STATEMENT) public class RuleProcessor { public static void main(String[] args) { RuleDependency ruleDependency = RuleProcessor.class.getAnnotation(RuleDependency.class); Rule rule = ruleDependency.rule(); Class&lt;? extends RuleParser&gt; ruleParserClass = rule.getRuleParserClass(); System.out.println(ruleParserClass); //Prints "class RuleParserImpl" } } Hope that gives you some ideas.
upvote count: 1
answers question: http://stackoverflow.com/q/22360058
has comment: http://stackoverflow.com/comment/34084991
type: Answer
downvote count: 0

http://stackoverflow.com/comment/33938786
comment on: http://stackoverflow.com/a/22332375
score: 0
type: Comment
has text: Yes it is. But is there a way I can do it with an array?
type: AnswerComment

http://stackoverflow.com/a/22350144
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22343745
has comment: http://stackoverflow.com/comment/33970559
has comment: http://stackoverflow.com/comment/33971723
type: Answer
has body: Simple and trivial way is to use the java.lang.System#getProperty: String prop = System.getProperty("my.property"); Assuming that you lanched your java application with a jvm param like -Dmy.property="someValue"
answers question: http://stackoverflow.com/q/22343745
upvote count: 1
score: 1

http://stackoverflow.com/comment/34049700
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22396025
has text: can u suggest a code i tried driver.findElement(By.partialLinkText("Automation")).click();

http://stackoverflow.com/comment/34027889
score: 0
comment on: http://stackoverflow.com/q/22383630
type: Comment
type: QuestionComment
has text: did you tried cardData.trim() ?

http://stackoverflow.com/comment/34179304
has text: Thanks, you're my only beacon of hope. I'll fall back on the activator as a last resort. Where did you install play and scala? And did you export anything particular (PATH, CLASSPATH, ...)? Also, are you running Java 7?
type: QuestionComment
comment on: http://stackoverflow.com/q/22467765
score: 0
type: Comment

http://stackoverflow.com/q/22457024
has comment: http://stackoverflow.com/comment/34156724
has comment: http://stackoverflow.com/comment/34157211
tagged with: mouseevent
upvote count: 2
tagged with: windows
answer count: 1
downvote count: 1
has body: Last few days my Windows 7 laptop is not responding to my mouse and keyboard clicks etc very smoothly. I wonder if there is some Trojan at work. May be I have too much time at hand, but I wonder if there is a way to find all programs that are registered to listen to mouse/keyboard events? Symptoms: Some keyboard key-presses &amp; mouse clicks are lost altogether (no response). Many a times a single click turns into a double click. Never happens with keyboard. Situation is the same with on-laptop trackpad + keyboard + mouse-buttons or external wired keyboard and mouse connected via USB via docking station. In general it's more noticeable with mouse than keyboard. I don't mind the programming language, but I know C/C++/Java/Python the best. Thanks
tagged with: keyboard
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34156711
tagged with: c++
score: 1
tagged with: java
has title: Find programs listening to keyboard/mouse events
type: Question
has answer: http://stackoverflow.com/a/22458403
has comment: http://stackoverflow.com/comment/34171267

http://stackoverflow.com/comment/34000618
type: AnswerComment
type: Comment
has text: @PlasmaPower He said that he would receive it in the "mm/dd/yyyy" format only.
comment on: http://stackoverflow.com/a/22367488
score: 0

http://stackoverflow.com/q/22452079
possible better answer: http://stackoverflow.com/a/22465858
type: Question
has comment: http://stackoverflow.com/comment/34151441
has title: Jersey client with ignore ssl with proxy setting
score: 4
upvote count: 4
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22465858
has answer: http://stackoverflow.com/a/22455844
accepted answer: http://stackoverflow.com/a/22455844
favorite count: 0
linked to: http://stackoverflow.com/q/10385259
tagged with: jersey-client
type: AnsweredQuestion
tagged with: java
has body: how to configure the proxy to Jersey client. I am using the code from this site https://gist.github.com/outbounder/1069465. since in my coding environment, i have to use the proxy server over the https client.
tagged with: jax-ws

http://stackoverflow.com/comment/33942097
score: 0
type: Comment
type: QuestionComment
has text: Yes. Everything seems same. I'm on Windows..
comment on: http://stackoverflow.com/q/22334358

http://stackoverflow.com/comment/34159529
has text: Is ${helloController} already in session?
comment on: http://stackoverflow.com/q/22458627
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22447823
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34153486
has comment: http://stackoverflow.com/comment/34141401
tagged with: google-maps-android-api-2
has answer: http://stackoverflow.com/a/22447927
has answer: http://stackoverflow.com/a/22470737
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/34141307
has comment: http://stackoverflow.com/comment/34182212
has title: How I can show Google Maps V2 into a custom dialog android
has comment: http://stackoverflow.com/comment/34174042
tagged with: dialog
score: 1
tagged with: java
has body: Hello my name is Hernan so and I am a Android Developer. I make this question because I need insert a google map into a custom dialog I already have my dialog working ok but when I am adding the google map it throws an error in code. This is my code. Java Code: package com.sigetdriver.view.popup; import android.app.Dialog; import android.content.Context; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.view.WindowManager.LayoutParams; import android.widget.Button; import android.widget.Toast; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.sigetdriver.R; public class InsertarDestinoPopup { private GoogleMap googleMap; private Context context; public Dialog dialog; private Button btnCerrar; public void dialog(Context _context) { context = _context; dialog = new Dialog(_context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.popup_destino); dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); try { // Loading map initilizeMap(); pintarMapa(); } catch (Exception e) { e.printStackTrace(); } btnCerrar = (Button) dialog.findViewById(R.id.btnCerrar); btnCerrar.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub dialog.dismiss(); } }); dialog.show(); } /** * function to load map. If map is not created it will create it for you * */ private void initilizeMap() { if (googleMap == null) { googleMap = ((MapFragment) getFragmentManager().findFragmentById( R.id.map)).getMap(); // *******ERROR HERE******* // check if map is created successfully or not if (googleMap == null) { Toast.makeText(context, "Sorry! unable to create maps", Toast.LENGTH_SHORT) .show(); } } } private void pintarMapa() { googleMap.setMyLocationEnabled(true); // false to disable } } XML Code: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmln…
type: Question
has comment: http://stackoverflow.com/comment/34141259
has comment: http://stackoverflow.com/comment/34141311
answer count: 2
has comment: http://stackoverflow.com/comment/34141781
has comment: http://stackoverflow.com/comment/34141279
downvote count: 0
has comment: http://stackoverflow.com/comment/34141356

http://stackoverflow.com/a/22374051
answers question: http://stackoverflow.com/q/22373946
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34012310
has comment: http://stackoverflow.com/comment/34012521
has comment: http://stackoverflow.com/comment/77702621
has comment: http://stackoverflow.com/comment/34011702
has comment: http://stackoverflow.com/comment/34011780
upvote count: 1
type: AcceptedAnswer
has body: Let's have a look at the implementation of EntrySet: 965 private final class EntrySet extends AbstractSet&lt;Map.Entry&lt;K,V>> { 966 public Iterator&lt;Map.Entry&lt;K,V>> iterator() { 967 return newEntryIterator(); 968 } 969 public boolean contains(Object o) { 970 if (!(o instanceof Map.Entry)) 971 return false; 972 Map.Entry&lt;K,V> e = (Map.Entry&lt;K,V>) o; 973 Entry&lt;K,V> candidate = getEntry(e.getKey()); 974 return candidate != null &amp;&amp; candidate.equals(e); 975 } 976 public boolean remove(Object o) { 977 return removeMapping(o) != null; 978 } 979 public int size() { 980 return size; 981 } 982 public void clear() { 983 HashMap.this.clear(); 984 } 985 } Note that it's an inner class and has implicit access to all the state, and all the instance methods, of the enclosing HashMap instance. It implements its methods by calling the appropriate methods on the enclosing HashMap.
has comment: http://stackoverflow.com/comment/34013337
accepted answer of: http://stackoverflow.com/q/22373946
type: Answer

http://stackoverflow.com/comment/34053619
type: Comment
comment on: http://stackoverflow.com/a/22398400
score: 0
has text: Uttam Thanks for the giving me response.
type: AnswerComment

http://stackoverflow.com/a/22359259
accepted answer of: http://stackoverflow.com/q/22358556
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22358556
downvote count: 0
has body: You can open alert on item click like this : rowView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub //Toast.makeText(context, "You Clicked "+result[position], 2000).show(); AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Title"); builder.setMessage("Message"); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); Intent intent = new Intent(context, Activity2.class); context.startActivity(intent); } }); AlertDialog alert = builder.create(); alert.show(); } });
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/22368166
possible better answer: http://stackoverflow.com/a/22368235
has comment: http://stackoverflow.com/comment/34001753
has answer: http://stackoverflow.com/a/22368235
has comment: http://stackoverflow.com/comment/34001714
type: Question
favorite count: 0
has title: Regular expression to remove HTML tags doesn't match
has answer: http://stackoverflow.com/a/22368282
score: 0
answer count: 3
tagged with: regex
has body: I have a String like &lt;li&gt;&lt;font color='#008000'&gt; [INFO]a random user. and I want to eliminate html tags such as &lt;li&gt; and &lt;font&gt; from this String. I tried to achieve this with String.replaceAll method in Java but it doesn't work... public static String removeHTMLTags(String original){ String str = original.replaceAll("^&lt;.+&gt;$", ""); return str; }
has comment: http://stackoverflow.com/comment/34001766
has answer: http://stackoverflow.com/a/22368227
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/22368282
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/34010379
score: 0
type: Comment
type: QuestionComment
has text: @user2820379: You could try lowering the max heap/permgen size to a more suitable value (via `$JAVA_OPTS`). The defaults are probably too high for Raspberry Pi.
comment on: http://stackoverflow.com/q/22340034

http://stackoverflow.com/a/22412736
score: 2
answers question: http://stackoverflow.com/q/22412564
downvote count: 0
has comment: http://stackoverflow.com/comment/34078917
upvote count: 2
type: AcceptedAnswer
has body: Your equal Method is never used. The Java Method used by assertEquals() is called equalS (and you have to override the equals() method derived from Object). Therefore, the assertion will use equals inherited from Object, which will compare the actual instances rather than using YOUR equal method which will compare the objet values. And since they are two different INSTANCES, they are not equal. Finally, the two instances will be plotted with toString() resulting in expected = 13.75 and actual = 13.75. (Because your toString() returns only the values, ignoring the difference between instances) Your Instructors Response: A Long in Java is a 64 bit long number. Double in Java is implemented with the IEEE754 Standard, which only leaves 52 bit for the mantissa. Meaning: Any conversion of a Long Number to a double, where the Long Number has set bits on bit 53 to 63 - will cause the exponent to be shifted in a way, that you loose precision arround the LSBs - resulting in an unprecice Double Value. Therefore comparing the double values to determine equality is not sufficent for your desired Design of a "Exact Number". Example: Long bigLong = 1L&lt;&lt;51; //picked 51: 52 and 53 already causing rounding issues. Long long1 = bigLong + 1L; Long long2 = bigLong + 2L; System.out.println(long1+" -&gt; " + long1.doubleValue()); System.out.println(long2+" -&gt; " + long2.doubleValue()); //false, enough precision to preserve bit "0" and "1". System.out.println(long1.doubleValue()==long2.doubleValue()); Output: 2251799813685262 -&gt; 2.251799813685262E15 2251799813685263 -&gt; 2.251799813685263E15 false When setting bit 54: Long bigLong = 1L&lt;&lt;54; Long long1 = bigLong + 1L; Long long2 = bigLong + 2L; System.out.println(long1+" -&gt; " + long1.doubleValue()); System.out.println(long2+" -&gt; " + long2.doubleValue()); System.out.println(long1.doubleValue()==long2.doubleValue()); Output: 18014398509481985 -&gt; 1.8014398509481984E16 18014398509481986 -&gt; 1.8014398509481984E16 tru…
accepted answer of: http://stackoverflow.com/q/22412564
type: Answer

http://stackoverflow.com/comment/34127939
type: QuestionComment
type: Comment
score: 0
has text: I have edited in what line 432 is. I think I found what the problem is though (I could be wrong). The `aBuffer` was declared with the rest of the variables, but I only initialised it inside section of code, that doesn't always run. So that variable is initialised where it is declared.
comment on: http://stackoverflow.com/q/22432689

http://stackoverflow.com/comment/34013962
has text: Err, make up your mind? Don't create an ObjectInoutStream until you know you need one? Use it for all requests? Make a decision?
comment on: http://stackoverflow.com/q/22375431
score: 0
type: Comment
type: QuestionComment

amazon-vpc
type: Tag
tag name: amazon-vpc
tags question: http://stackoverflow.com/q/22365470

http://stackoverflow.com/q/22375951
has title: Change the session user for DB2 while using JDBC
possible better answer: http://stackoverflow.com/a/22376033
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22377548
accepted answer: http://stackoverflow.com/a/22377548
type: Question
tagged with: db2
score: 0
answer count: 2
has body: I have DB2 10.1 on Linux and I connect to it using Kerberos auth. Problem is that my user doesn't have permissions to do stuff so I need to impersonate another user using "SET SESSION_USER = otheruser". This works fine if I use a client like DBArtisan, but I need to do this using JDBC and it doesn't seem to work. I've tried to execute the query every time a connection is created, I can query the value of the register and it has changed, but I still get errors if I try to query the tables my user doesn't have access to but the session user does. Any ideas?
has comment: http://stackoverflow.com/comment/34017865
has answer: http://stackoverflow.com/a/22376033
tagged with: linux
tagged with: jdbc

http://stackoverflow.com/q/22432161
has comment: http://stackoverflow.com/comment/37269946
has title: Area generation not liking straight lines
tagged with: java-2d
answer count: 0
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36646569
has comment: http://stackoverflow.com/comment/36645160
has comment: http://stackoverflow.com/comment/36645237
tagged with: image
has comment: http://stackoverflow.com/comment/36647042
has comment: http://stackoverflow.com/comment/34113170
linked to: http://stackoverflow.com/q/7218309
has body: I'm using the area generation and drawing code from Smoothing a jagged path to create collision areas for tile sprites in a JRPG game I'm making in java - Its not a major full blown game, more just a proof-of-concept for me to learn from. The area generation works fine except for straight lines: http://puu.sh/7wJA2.png http://puu.sh/7wJGF.png These images are of the collision outline opened in photoshop (in the background) vs the area that the java code is generating based on the red color (in the foreground). As can be seen, the large red line in the first image won't be draw unless I have a red pixel under it every 2 pixels, as shown in the second image. I have made no changes to the code (other than adding comments in an attempt to better understand it) except to remove Graphics2D g = imageOutline.createGraphics(); //... g.dispose(); from the areaOutline draw code, replacing it with reference to my own Graphics2D variable. I tested the code both with and without those two lines and I couldn't see any difference. I'm a bit stuck on what could be causing the issue - its not a major game-breaking issue, as I can fix it a couple of ways, but it does mean I have to explain this issue to anyone when showing them how to use it with their own sprite textures. I've created a SSCCE of the issue - This shows the areas generated have vertical lines generated fine, but that horizontal ones are not. It takes two images - both a square 30x30 pixels, but one has internal pixels every 2 second pixel in which causes a more accurate area to be generated. When you press a key the program will switch between the two images (and their areas), allowing for direct comparison. The following two images must be put in the root folder of the program. You can start the program by running the "main" method. import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.image.*; import java.awt.geom.*; import java.io.*; import javax.imageio.*; public class AreaOutlineCanvas …
downvote count: 0
score: 1
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/34113137
has comment: http://stackoverflow.com/comment/34137248
type: UnansweredQuestion

http://stackoverflow.com/q/22471279
tagged with: java
accepted answer: http://stackoverflow.com/a/22471324
has title: Netbeans telling me that a value is boolean when it is an int
has comment: http://stackoverflow.com/comment/34181772
has body: my while loop : while (j =&gt;0&amp;&amp; (courseArray[j].compareByCourse(value)) &gt;=0 ){ } is giving me this error in netbeans: int cannot be converted to boolean method: public static void insertionSort(Course[] courseArray){ Course value ; // the next value from the unsorted list to be inserted into the sorted list int i; // i is a pointer to an item in the unsorted list int j; // j is a pointer to an item in the sorted list; originally the sorted list is just a[0] int compare; for (i=1; i&lt;courseArray.length; i++){ value = courseArray[i]; j = i -1; compare = courseArray[j].compareByCourse(value); while (j =&gt;0&amp;&amp; (courseArray[j].compareByCourse(value)) &gt;=0 ){ } } } compareByCourse method: //method to compare Courses by course name int compareByCourse(Course other){ return this.course.compareTo(other.getCourse()); } j is an int, the return value is an int, 0 is an int, so where is the boolean?
answer count: 1
has answer: http://stackoverflow.com/a/22471324
tagged with: netbeans
score: 0
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/34040741
score: 0
comment on: http://stackoverflow.com/q/22389763
type: Comment
type: QuestionComment
has text: @jtabone16 The text editor was saving the file in a different encoding than the process reading the file later. Make sure both use the same encoding. For the text editor, this depends on the product you use of course. For Java, the various classes that read characters from files (like `InputStreamReader`, for example), have an optional `charset` parameter. That's where you pass in the encoding. The `Charset` class also offers constants for commonly used encodings. Usually, UTF-8 is a good choice. Unless you need to use some very exotic characters.

http://stackoverflow.com/comment/34211017
type: AnswerComment
comment on: http://stackoverflow.com/a/22487557
score: 0
type: Comment
has text: @JBNizet I need to by dynamic only because I refused to believe I couldn't. I'm only coding to learn, so I'm very concerned with design: Adding a new line to my JList everytime I add a subclass to SuperClass just raised a red flag for me.

http://stackoverflow.com/comment/34167660
comment on: http://stackoverflow.com/a/22442719
has text: You could try specifying your dependencies inside of the build type: buildTypes { debug { dependencies { debugCompile "dependency" } }
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22379367
has comment: http://stackoverflow.com/comment/34028908
has comment: http://stackoverflow.com/comment/34027816
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34028961
has comment: http://stackoverflow.com/comment/34030243
has comment: http://stackoverflow.com/comment/34027152
has title: An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. Error: ''
has comment: http://stackoverflow.com/comment/34020174
has comment: http://stackoverflow.com/comment/34019866
has comment: http://stackoverflow.com/comment/34032578
upvote count: 1
tagged with: cfc
has comment: http://stackoverflow.com/comment/34023570
has body: This error has occurred in my cfc page. Previous developer has made the code, I am very new to Java also. This is happening in the nightly schedule jobs which runs on the production server. some part of CODE : &lt;cffunction name="createJavaProxy" hint="create a javaproxy, dependent on CF server settings" access="private" returntype="any" output="false"&gt; &lt;cfargument name="class" hint="the java class to create the proxy with" type="any" required="Yes"&gt; &lt;cfscript&gt; return createObject("java", "coldfusion.runtime.java.JavaProxy").init(arguments.class); &lt;/cfscript&gt;&lt;cffunction&gt; The error line is : "return createObject........"
has comment: http://stackoverflow.com/comment/34028645
favorite count: 0
has comment: http://stackoverflow.com/comment/34020013
tagged with: coldfusion
downvote count: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34181390
score: 0
type: Comment
has text: Before the loop the user already declared the increment value. The value never changes, i just need the xValue to increase by this increment every go-around. Example would be xValue[0] = 5 ... increment = .25 ... xValue[1] = 5.25 ... xValue[2] = 5.50 ... etc. Sorry if i wasn't being clear enough.
comment on: http://stackoverflow.com/a/22470835
type: AnswerComment

http://stackoverflow.com/comment/33957382
type: Comment
has text: @Boolena Then you should have asked the question correctly. Your Question Title nowhere comes close to the answer you were expecting.
comment on: http://stackoverflow.com/a/22342772
type: AnswerComment
score: 0

http://stackoverflow.com/a/22426346
score: 2
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22426277
has body: You're using non-static nested classes, also known as inner classes. Instances of those classes need an instance of their inclosing classes to be constructed, as the message indicates: Must qualify the allocation with an enclosing instance of type Hra (e.g. x.new A() where x is an instance of Hra Looking at your code, these inner classes could be static nested classes, since they don't access any member of their inclosing class. Or even better, since you don't seem to know what nested classes are yet, and since I don't see any good reason for these classes to be nested, they should be top-level classes, defined in their own .java file. Don't use nested classes before understanding what they're for, and how they work.
downvote count: 0

http://stackoverflow.com/a/22444374
answers question: http://stackoverflow.com/q/22443903
score: 0
has body: I tried to build a queue using rear and front as you did. Slighly modified your insert. I wrote a main method with some test. Also I had to add a "empty" flag to check if rear == front is because is empty or because is full. public class DummyQueue { int rear, front; String[] names; boolean empty = true; public DummyQueue(int size) { names = new String[size]; } public void insert(String name) { if(!empty &amp;&amp; rear == front ) { System.out.println("Full Queue!"); } else { names[rear] = name; rear = (rear+1) % names.length; } empty = false; } public String deque() { if (empty) { System.out.println("Empty Queue!"); return null; // demo } else { String response = names[front % names.length]; front = (front + 1) % names.length; if (front == rear) empty = true; return response; } } public static void main(String[] args) { DummyQueue d = new DummyQueue(10); System.out.println(d.deque()); d.insert("Element"); System.out.println(d.deque()); System.out.println(d.deque()); for (int i = 0; i &lt; 12; i++) { System.out.println("Adding: "+i); d.insert("Element "+ i); } for (int i = 0; i &lt; 12; i++) { System.out.println(d.deque()); } } }
type: Answer

http://stackoverflow.com/comment/33965034
score: 0
type: Comment
type: QuestionComment
has text: @Marco13 Yes, I intend to preserve similarities in that unique computated value.. Will hash-code will preserve them..? I have just take 10 images for now, the database will contain thousands of images
comment on: http://stackoverflow.com/q/22342898

http://stackoverflow.com/comment/33960495
score: 0
type: AnswerComment
has text: @EmanuelSaringan I said it's a class member. I didn't say it was declared in `main`.
type: Comment
comment on: http://stackoverflow.com/a/22344635

http://stackoverflow.com/comment/34151751
type: AnswerComment
comment on: http://stackoverflow.com/a/22453829
has text: Anyway, see edit. But I persist, this is an XY problem. If you mentioned your original problem to start with, I am sure a better solution could be found
score: 0
type: Comment

http://stackoverflow.com/q/22347733
has title: Maven get conflicted jars to exclude
has answer: http://stackoverflow.com/a/22347798
accepted answer: http://stackoverflow.com/a/22347933
tagged with: dependency-management
has body: I have following problem: I have 6-7 and more paths where from my jar is passing to classpath, and I need to get all nasted jars in my pom, and set exclusions. For now I use my Intellij Idea to build dependency tree, then use search and find all jars, and proceed exclusion one by one. Its very slow process, because Intellij works VERY slow with dependency tree. Can you suggest me some better way to do all exclusions? Thanks
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22347933
tagged with: java
tagged with: maven
possible better answer: http://stackoverflow.com/a/22347798
type: Question
score: 0
answer count: 2

http://stackoverflow.com/comment/34167731
score: 0
has text: Did you try the first change? I can correct your code to use the bit-shift techniques.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22463037

http://stackoverflow.com/a/22442799
has body: Here's how I am implementing the Google Maps in my sample app : First : Add the support library to eclipse and make sure that the application you are building has the library included. After that the implementation like this : public class MainActivity extends FragmentActivity implements LocationListener, OnMapClickListener, OnMapLongClickListener { private static final int GPS_ERRORDIALOG_REQUEST = 9001; GoogleMap map; List&lt;Address&gt; matches; TextView tvLocation; String addressText; double latitude; double longitude; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (servicesOK()) { Toast.makeText(this, "Ready to map!!", Toast.LENGTH_LONG).show(); setContentView(R.layout.activity_main); // Getting reference to the SupportMapFragment of activity_main.xml SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); // Getting GoogleMap object from the fragment map = fm.getMap(); // Enabling MyLocation Layer of Google Map map.setMyLocationEnabled(true); // Getting LocationManager object from System Service // LOCATION_SERVICE LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); // Creating a criteria object to retrieve provider Criteria criteria = new Criteria(); // Getting the name of the best provider String provider = locationManager.getBestProvider(criteria, true); // Getting Current Location Location location = locationManager.getLastKnownLocation(provider); if (location != null) { onLocationChanged(location); } locationManager.requestLocationUpdates(provider, 20000, 0, this); } else { setContentView(R.layout.activity_main); } } @Override public void onProviderDisabled(String provider) { // TODO Auto-generated method stub } @Override public void onProviderEnabled(String provider) { // TODO Auto-generated method stub } @Override public void onStatusChanged(String provider, int status, Bundle extras) { // TODO Auto-generated method st…
has comment: http://stackoverflow.com/comment/63628440
has comment: http://stackoverflow.com/comment/63691057
answers question: http://stackoverflow.com/q/22366923
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22366923
score: 2

http://stackoverflow.com/a/22411043
upvote count: 6
answers question: http://stackoverflow.com/q/22410847
type: Answer
has body: In Java 7 public int hashCode() { return Objects.hash(groupId, institutionId, postingDate, user); } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; // cast to correct class Target o = (Target)obj; return Objects.equals(groupId, o.groupId) && Objects.equals(institutionId, o.institutionId) && Objects.equals(postingDate, o.postingDate) && Objects.equals(user, o.user); }
score: 6
has comment: http://stackoverflow.com/comment/34075699
downvote count: 0

http://stackoverflow.com/comment/34175938
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22464932
has text: Sorry, I didnt explained very well. I mean for example I have a background image and some of the image get cut off, or changes, or sothing gets in front, i will need to re-draw the image right?
score: 0

http://stackoverflow.com/q/22358863
tagged with: android
tagged with: httpsurlconnection
has body: In my application, I verify a the Android user's identity by giving each user a different client-side SSL certificate. I'd like to use HttpsUrlConnection to connect to the server since that's Google's recommended way. The user can switch accounts (log out from the current one and log in with a different account). In this scenario, I need to estabilish the HTTPS connections with the new user account's client-side cert. How will HttpsUrlConnection's connection pooling mechanism work in this environment? How can I force all HTTPS connections in the connection pool using the wrong client-side cert to disconnect?
tagged with: java
has title: Android HttpsUrlConnection with multiple client certificates + connection pooling?
has answer: http://stackoverflow.com/a/22362686
tagged with: https
type: Question
tagged with: ssl
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/22420499
has comment: http://stackoverflow.com/comment/34093194
tagged with: mouseevent
has body: So, I've been working on a program that lets you click/drag over a grid of JPanels, and changes the background colors of the JPanels that you have clicked on or dragged over (you can set the colors using JRadioButtons). I've gotten the point where if I click on a JPanel, it responds and changes colors. However, if I simply do: public void mouseClicked(MouseEvent e){ ((JPanel)e.getSource()).setBackground(color_chosen); } public void mouseDragged(MouseEvent e){ System.out.println("Calling mouseClicked"); // debugging mouseClicked(e); } the program only responds to mouse clicks, and doesn't recolor the backgrounds of the JPanels affected by the mouse drag. In addition, its puzzling to me that "Calling mouseClicked" still prints out, but no background colors change. I'd appreciate some help trying to figure out where I went wrong, so that any panel that I drag over changes its background color to a pre-specified chosen color. Thanks.
score: 1
favorite count: 0
type: Question
has title: How to make JPanels respond to MouseDragged?
tagged with: swing
tagged with: java
tagged with: mouse-listeners
upvote count: 1
answer count: 0
downvote count: 0
tagged with: jpanel
type: UnansweredQuestion

http://stackoverflow.com/comment/34186161
has text: If all your values are in the range 0-255 inclusive, you should just use a `byte[]` instead. Cast each `int` to `byte` and you'll still get the right bits on the wire.
type: Comment
type: QuestionComment
score: 5
comment on: http://stackoverflow.com/q/22474001

http://stackoverflow.com/a/22350952
accepted answer of: http://stackoverflow.com/q/22348299
upvote count: 2
type: Answer
has body: Your "question" (if you could even call it that) is kind of unclear. Seems like you just don't know where to begin. So I'll give you a tip. What I would do is: Use a CardLayout. What the layout does is "layer" panels, making them navigable with methods like show(pickAPanelToShow), next(nextPanel), and previous(previousPanel). What you can do is on first page have a the two buttons, if continue is pressed, then the next() method can take you to the chooseTeamPanel. And from that panel you can navigate to the gamePanel after the team is chosen. You can see more at How to use CardLayout and you can see an example here
has comment: http://stackoverflow.com/comment/33973574
has comment: http://stackoverflow.com/comment/33973856
score: 2
answers question: http://stackoverflow.com/q/22348299
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33972790
downvote count: 0

http://stackoverflow.com/a/22349893
score: 1
answers question: http://stackoverflow.com/q/22345235
upvote count: 1
type: AcceptedAnswer
has body: I was able to solve my problem by changing the attribute type of cdate and mdate from String to Date. Furthermore I had to remove the defaultValue and canBeNull parameters from the @DatabaseField annotation. Which leaves me with the follwing class: @DatabaseTable(tableName = "users") public class User { @DatabaseField(generatedIdSequence = "users_id_seq", useGetSet = true) private long id; @DatabaseField(useGetSet = true) private Date cdate; @DatabaseField(useGetSet = true) private Date mdate; @DatabaseField(canBeNull = false, useGetSet = true) private String name; @DatabaseField(canBeNull = false, useGetSet = true) private String email; @DatabaseField(canBeNull = false, useGetSet = true) private String password; @DatabaseField(columnName = "avatar_id", foreign = true, useGetSet = true) private Avatar avatar; public User() { // ORMLite needs a no-arg constructor } // Getter and setter methods. } Finally, I had to adjust the database scheme accordingly: CREATE TABLE avatars ( id BIGSERIAL PRIMARY KEY, cdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP, mdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP -- avatar bytea NOT NULL ); CREATE TABLE users ( id BIGSERIAL PRIMARY KEY, cdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP, mdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP, name VARCHAR(160) NOT NULL, email VARCHAR (355) UNIQUE NOT NULL, password VARCHAR(30) NOT NULL, avatar_id BIGINT, CONSTRAINT user_avatar_id FOREIGN KEY (avatar_id) REFERENCES avatars (id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION ); In order to avoid NULL values, I set the default value of cdate and mdate to CURRENT_TIMESTAMP and added a trigger, which will automatically update the value of mdate if the corresponding row changes: CREATE OR REPLACE FUNCTION update_timestamp() RETURNS TRIGGER AS $update_timestamp$ BEGIN NEW.mdate := CURRENT_TIMESTAMP; RETURN NEW; END; $update_timestamp$ LANGUAGE plpgsql; CREATE TRIGGER update_timestamp BEFORE INSERT OR UPDATE ON avatars FOR EACH ROW EXECUTE PROCEDURE update_timestamp();…
type: Answer
accepted answer of: http://stackoverflow.com/q/22345235
downvote count: 0

http://stackoverflow.com/comment/33990336
type: QuestionComment
has text: Pls post the full code, imageArray is not declared
comment on: http://stackoverflow.com/q/22360716
score: 0
type: Comment

http://stackoverflow.com/comment/34021923
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22380486
score: 0
has text: Are they different? I thought you could access Scala objects from Java since they're both JVM technologies. What have you tried? If you're trying to pass strings, can you pass a char[] array?

http://stackoverflow.com/q/22395964
linked to: http://stackoverflow.com/q/19236531
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/22855570
tagged with: webdriver
type: Question
accepted answer: http://stackoverflow.com/a/22396025
possible better answer: http://stackoverflow.com/a/22396305
has answer: http://stackoverflow.com/a/22396305
has body: I have a HTML File hierarchy in tree structure in a web page as shown in picture. The HTML code is &lt;div class="rtMid rtSelected"&gt; &lt; span class="rtSp"/&gt; &lt; img class="rtImg" alt="Automation" src="http://192.168.1.6/eprint_prod_3.8/images/StoreImages/close_folder.png"/&gt; &lt; span class="rtIn" title="Automation"&gt;Automation (1)&lt;/span&gt; &lt;/div&gt; In Selenium WebDriver is there a way to click on the Automation (1) link by searching only the text I don't want to use XPath reason is the location will be changing so is there a way to find it by its text and click on it.
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34056161
upvote count: 2
has answer: http://stackoverflow.com/a/22396025
has title: How to access the link by searching its text in Selenium WebDriver?
tagged with: selenium-webdriver
score: 2
tagged with: xpath
type: AnsweredQuestion

http://stackoverflow.com/q/22343966
upvote count: 1
tagged with: apache-storm
type: Question
downvote count: 0
tagged with: cassandra
has body: Below is the source code of cassadraBolt class which receive the tuple(word,count) from Testwordcounter bolt class. I want to know what is actually happening with that tuple in the source code. And also need the explanation of writetuple() function, prepare() function, tuplemapper,incrementcounter() function. please give me the solution. This question may be silly but i need that. so thanks in advance. //Source Code private String clientConfigKey; protected AstyanaxClient&lt;K, C, V&gt; client; protected TupleMapper&lt;K, C, V&gt; tupleMapper; protected Map&lt;String, Object&gt; stormConfig; public CassandraBolt(String clientConfigKey, TupleMapper&lt;K, C, V&gt; tupleMapper) { this.tupleMapper = tupleMapper; // this.columnNameClass = columnNameClass; // this.columnValueClass = columnValueClass; this.clientConfigKey = clientConfigKey; LOG.debug("Creating Cassandra Bolt (" + this + ")"); } @SuppressWarnings("unchecked") public void prepare(Map&lt;String, Object&gt; stormConf, TopologyContext context) { Map&lt;String, Object&gt; config = (Map&lt;String, Object&gt;) stormConf.get(this.clientConfigKey); this.client = new AstTupleMapperyanaxClient&lt;K, C, V&gt;(); this.client.start(config); } public void cleanup() { this.client.stop(); } public void writeTuple(Tuple input, TupleMapper&lt;K, C, V&gt; tupleMapper) throws Exception { this.client.writeTuple(input, tupleMapper); } public void writeTuples(List&lt;Tuple&gt; inputs, TupleMapper&lt;K, C, V&gt; tupleMapper) throws Exception { this.client.writeTuples(inputs, tupleMapper); } public Map&lt;String, Object&gt; getComponentConfiguration() { return null; } public void incrementCounter(Tuple input, TupleCounterMapper tupleMapper) throws Exception { this.client.incrementCountColumn(input, tupleMapper); } public void incrementCounters(List&lt;Tuple&gt; inputs, TupleCounterMapper tupleMapper) throws Exception { this.client.incrementCountColumns(inputs, tupleMapper); }
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: bigdata
has title: Need an CassandraBolt class description
answer count: 0
tagged with: java

http://stackoverflow.com/a/22330610
has body: If you have a String s, String t = s.replaceAll("\\s+", " "); System.out.println(t); int count = s.length() - t.length(); System.out.println(count); You can remove the whitespaces using replaceAll, and count the difference in length between the strings to get the number of removed spaces.
answers question: http://stackoverflow.com/q/22330525
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/22461545
type: Answer
score: 3
upvote count: 3
downvote count: 0
has body: String[] array = {"x", "y", "z"}; if (Arrays.asList(array).contains("x")) { System.out.println("Contains!"); }
answers question: http://stackoverflow.com/q/22461470

http://stackoverflow.com/q/22432580
score: 1
tagged with: encryption
upvote count: 1
has answer: http://stackoverflow.com/a/22433021
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22432734
tagged with: java
has title: How does BigInteger interpret the bytes from a string?
possible better answer: http://stackoverflow.com/a/22432734
answer count: 2
tagged with: encoding
downvote count: 0
accepted answer: http://stackoverflow.com/a/22433021
has body: Im working on a program that is an implementation of the RSA encryption algorithm, just as a personal exercise, its not guarding anyone's information or anything. I am trying to understand how a plaintext passage is being interpreted numerically, allowing it to be encrypted. I understand that most UTF-8 characters end up only using 1 byte of space, and not the 2 bytes one might think, but thats about it. Heres my code: BigInteger ONE = new BigInteger("1"); SecureRandom rand = new SecureRandom(); BigInteger d, e, n; BigInteger p = BigInteger.probablePrime(128, rand); BigInteger q = BigInteger.probablePrime(128, rand); BigInteger phi = (p.subtract(ONE)).multiply(q.subtract(ONE)); n = p.multiply(q); e = new BigInteger("65537"); d = e.modInverse(phi); String string = "test"; BigInteger plainText = new BigInteger(string.getBytes("UTF-8")); BigInteger cipherText = plainText.modPow(e, n); BigInteger originalMessage = cipherText.modPow(d, n); String decrypted = new String(originalMessage.toByteArray(),"UTF-8"); System.out.println("original: " + string); System.out.println("decrypted: " + decrypted); System.out.println(plainText); System.out.println(cipherText); System.out.println(originalMessage); System.out.println(string.getBytes("UTF-8")); byte byteArray[] = string.getBytes("UTF-8"); for(byte littleByte:byteArray){ System.out.println(littleByte); } It outputs: original: test decrypted: test 1952805748 16521882695662254558772281277528769227027759103787217998376216650996467552436 1952805748 [B@60d70b42 116 101 115 116 Maybe more specifically i am wondering about this line: BigInteger plainText = new BigInteger(string.getBytes("UTF-8")); Does each letter of "test" have a value, and they are literraly added together here? Like say t=1,e=2,s=3,t=1 for example, if you get the bytes from that string, do you end up with 7 or are the values just put together like 1231? And why does BigInteger plainText = new BigInteger(string.getBytes("UTF-8")); output 1952805748
favorite count: 0
tagged with: utf-8
tagged with: biginteger

http://stackoverflow.com/comment/34126761
type: QuestionComment
comment on: http://stackoverflow.com/q/22439972
type: Comment
score: 2
has text: I don't get your question. If you need a type variable, you need a type parameter list in the generic method.

http://stackoverflow.com/a/22369947
type: Answer
has comment: http://stackoverflow.com/comment/34004516
answers question: http://stackoverflow.com/q/22369373
upvote count: 1
has comment: http://stackoverflow.com/comment/34005074
score: 1
downvote count: 0
has body: When new Zi() is invoked, It invokes its constructor Zi() { a. super(); //the Java compiler automatically inserts a call to the no- argument constructor of the superclass b. show(); c.super.show(); } a. when super() class constructor is called. it finds show() method.. (Since object reference is from Zi class, so Zi's show() returns "This is from zi show") public Fu() { System.out.println(this.getClass().getName()); //add this.. it will return **"Zi"** show(); // So this will return Zi's show(), due to refrence of Zi's object, when called by the sub class constructor. } b. show() - will return "This is from zi show" c. super.show() - will return super's show()
has comment: http://stackoverflow.com/comment/34005140

http://stackoverflow.com/comment/33962375
comment on: http://stackoverflow.com/q/22345631
type: Comment
type: QuestionComment
has text: @CeilingGecko even if there would be no `return` statements, `else` is not necessary because conditions are all disjoint
score: 0

http://stackoverflow.com/comment/94761681
has text: what do you mean? For using JSONTokener you must add java-json dependency (the same for JSONObject, which is the main topic of this question...)
type: AnswerComment
comment on: http://stackoverflow.com/a/50122877
score: 0
type: Comment

http://stackoverflow.com/comment/33965661
type: Comment
comment on: http://stackoverflow.com/a/22347577
has text: And I assume for this purpose that the `queue.length > 0`
score: 0
type: AnswerComment

http://stackoverflow.com/q/22385060
has comment: http://stackoverflow.com/comment/34162859
score: 0
tagged with: apache
has comment: http://stackoverflow.com/comment/34076831
tagged with: jsp
has body: Migrating from JBoss EAP 5.2.0 to JBoss EAP 6.1.0. The user is correctly directed to the login.jsp page, but after successful authentication via j_security_check, the redirect to the originally requested Main.jsp page does not happen, the user is stuck on login.jsp. The logs look like Main.jsp is initially saved as the request but since its redirected to login.jsp, login.jsp is saved over Main.jsp as the new request. Comparing with a working deployment from JBoss EAP 5.2.0, I noticed the working log contains: [org.apache.catalina.connector.CoyoteAdapter] (http-0.0.0.0-8443-1:) Requested cookie session id is ... [org.apache.catalina.authenticator.AuthenticatorBase] (http-0.0.0.0-8443-1:) Security checking request GET /myApp/ Here is the JBoss EAP 6.1.0 server output: Security checking request GET /myApp/ [org.apache.catalina.realm] (http-localhost/127.0.0.1:8443-1) Checking constraint 'SecurityConstraint[sc]' against GET /Main.jsp --> false [org.apache.catalina.realm] (http-localhost/127.0.0.1:8443-1) Checking constraint 'SecurityConstraint[all]' against GET /Main.jsp --> true [org.apache.catalina.realm] (http-localhost/127.0.0.1:8443-1) Checking constraint 'SecurityConstraint[sc]' against GET /Main.jsp --> false [org.apache.catalina.realm] (http-localhost/127.0.0.1:8443-1) Checking constraint 'SecurityConstraint[all]' against GET /Main.jsp --> true [org.apache.catalina.authenticator] (http-localhost/127.0.0.1:8443-1) Calling hasUserDataPermission() [org.apache.catalina.realm] (http-localhost/127.0.0.1:8443-1) User data constraint already satisfied [org.apache.catalina.authenticator] (http-localhost/127.0.0.1:8443-1) Calling authenticate() [org.apache.catalina.authenticator] (http-localhost/127.0.0.1:8443-1) Save request in session 'Db-s0UWZpAj9Z0g1QBRcDkhe' [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/myApp].[jsp]] (http-localhost/127.0.0.1:8443-1) Disabling the response for futher output [org.apache.catalina.core.ContainerBase.[jboss.web].[d…
has title: FORM based login not redirecting to stored request
has comment: http://stackoverflow.com/comment/34046177
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
tagged with: jboss
has comment: http://stackoverflow.com/comment/34040630
type: Question
has comment: http://stackoverflow.com/comment/34301287

http://stackoverflow.com/comment/33976958
comment on: http://stackoverflow.com/a/22353441
has text: @LutzHorn IMO this is an answer to the question - not a comment or part of the question.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34165966
comment on: http://stackoverflow.com/q/22462179
has text: Oh does this mean it doesn't accept it because it's in a public method?
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/129339897
has text: Once isPresent will return false, it will come out of the loop. As a result, other missing numbers will not be checked if there is still any. Better to add the missing numbers in a list instead using break. And at the end get all the missing numbers from that list.
comment on: http://stackoverflow.com/a/22434324
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34167147
type: Comment
score: 1
has text: @mttdbrd Don't make things `static` just so that you can share them. You can pass in the same argument if you need to.
comment on: http://stackoverflow.com/a/22462838
type: AnswerComment

http://stackoverflow.com/comment/33935918
score: 1
has text: It says - Give me a list of schedules where the schedule is still relevant on the calculated date - Then it gets a count of how many get returned based on that criteria. Then it says if the count is less than or equal to zero the condition is true
comment on: http://stackoverflow.com/q/22330626
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22374612
has comment: http://stackoverflow.com/comment/83365811
upvote count: 16
tagged with: type-annotation
has title: Is it possible to access Java 8 type information at runtime?
tagged with: reflection
tagged with: annotations
answer count: 1
has body: Assuming I have the following member in a class which makes use of Java 8 type annotations: private List&lt;@Email String&gt; emailAddresses; Is it possible to read the @Email annotation given on the String type use at runtime using reflection? If so, how would this be done? Update: That's the definition of the annotation type: @Target(value=ElementType.TYPE_USE) @Retention(RetentionPolicy.RUNTIME) public @interface Email {}
accepted answer: http://stackoverflow.com/a/22380558
tagged with: java
linked to: http://stackoverflow.com/q/923624
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/83145799
has comment: http://stackoverflow.com/comment/34011997
downvote count: 0
score: 16
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34012342
has answer: http://stackoverflow.com/a/22380558

http://stackoverflow.com/comment/69840791
score: 1
comment on: http://stackoverflow.com/a/31577152
type: AnswerComment
type: Comment
has text: Username was obtained from `HttpSession` when initiate a websocket connection

http://stackoverflow.com/a/22455521
upvote count: 1
answers question: http://stackoverflow.com/q/22455424
has body: Change List crd to List&lt;Card&gt; crd the subList method supports the generic type of the list
score: 1
accepted answer of: http://stackoverflow.com/q/22455424
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34041209
type: Comment
has text: @Tatanan, "Not elementary" means, any sequence of operations that temporarily leaves your data in an inconsistent/invalid/illegal state. The classic example is a program that takes money out of one bank account and deposits it into another. There is an instant, in-between the withdrawal and the deposit when the books are not correct. If an auditor thread happens to look at the two accounts during that instant, it would report a violation. Putting those two operations into a synchronized block makes them an atomic unit, and would prevent the auditor from seeing the accounts in that state.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22385267

http://stackoverflow.com/q/22465572
score: 0
has body: I have a glassfish web app running, and I want to add another page to my server. The page will not be static. The problem I have is mapping the page. I do know that (maybe?) I need to add servlets into my web.xml file for them to run validation and have access to a database? If that's true, how does the servlet communicate with the jsp? Much help will be appreciated!
answer count: 1
has answer: http://stackoverflow.com/a/22470530
type: UnansweredQuestion
tagged with: java
tagged with: webserver
tagged with: servlets
type: Question
has title: Add another page to my Glassfish server
tagged with: jsp
tagged with: glassfish

http://stackoverflow.com/comment/34133238
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22443191
has text: @GiovanniFar You could use a holder class for the `S2Es2SharedState` and pass that to the workers. Make all changes to the `state` through methods on that holder. Those will have to be synchronized.

http://stackoverflow.com/comment/34096228
comment on: http://stackoverflow.com/q/22422501
score: 0
type: Comment
type: QuestionComment
has text: `printf()` doesn't `fflush(stdout)`, you need the latter in the C code (since `stdout` seems to be buffered)

http://stackoverflow.com/comment/34110607
type: Comment
comment on: http://stackoverflow.com/a/22391553
score: 0
type: AnswerComment
has text: yea sure, Please let me knw when u send me the email.

http://stackoverflow.com/comment/34096789
type: QuestionComment
has text: yes thats why i am telling you to debug
comment on: http://stackoverflow.com/q/22422974
score: 0
type: Comment

http://stackoverflow.com/comment/34089821
score: 0
type: Comment
has text: Ugh. Sooooo much work just to enter in all that information ***every time***. The more I see `Scanner`, the more I dislike it.
type: QuestionComment
comment on: http://stackoverflow.com/q/22418887

http://stackoverflow.com/a/22440967
answers question: http://stackoverflow.com/q/22440898
score: 0
has body: private ArrayList&lt;Circle&gt; circles; public boolean addCircle(Circle circle) { if(circle != null &amp;&amp; circles != null &amp;&amp; !circles.contains(circle)){ circles.add(circle); } } However please remember that your have to override the equals method in your circle class. Because the contains method internally calls .equals &amp; .hashcode methods.
type: Answer
has comment: http://stackoverflow.com/comment/34128902
has comment: http://stackoverflow.com/comment/34128813

http://stackoverflow.com/comment/34146626
comment on: http://stackoverflow.com/q/22450313
has text: Coordinates: 0.0.1-SNAPSHOT changed to 0.0.1 (by mvn versions:set)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34040067
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22390113
has text: Ah ok. Also, I'm using ArrayLists so i get an error when i try to use substring()
type: Comment

http://stackoverflow.com/comment/34134497
has text: I can't completely remove HTML in my case. The whole point of the functionality is to let users send HTML ready articles to other users. I think I will be ok with something like jsoup cleaning just scripts, but I would like to keep embedded images.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22443445
score: 0

http://stackoverflow.com/comment/34174202
score: 0
has text: your `while` loop will not hang the treatment because the Dialog will be shown but only later. so, in your case, the while will be skiped. print something in your log to understand what i mean. however, when you click the button your onClick becomes 0 but there is nobody to use it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22466506

http://stackoverflow.com/comment/33934242
comment on: http://stackoverflow.com/q/22328395
score: 0
type: Comment
type: QuestionComment
has text: Ok, then pretty much either the query being called is taking an eternity to complete, or the connection is being being released to the connection pool.

http://stackoverflow.com/comment/33958188
has text: @dreamer I will update the question to use defaultCharset. Even after changing to defaultCharset, the problem remains.
comment on: http://stackoverflow.com/q/22342820
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22391294
score: 0
has body: First separate out your read and write into distinct methods i.e. private String read(Server server){ // From client InputStream inFromClient = server.getInputStream(); DataInputStream in = new DataInputStream(inFromClient); ..... return message } private void write(Server server, String message){ OutputStream outToClient = server.getOutputStream(); DataOutputStream out = new DataOutputStream(outToClient); ...... } Now use you main/run method to switch between read/write. If the client writes, the it should wait for a read response and same with the server. and you can do this while "endChat" is not true. This is simplistic but it should get you going.
answers question: http://stackoverflow.com/q/22391070
type: Answer
has comment: http://stackoverflow.com/comment/34041738

http://stackoverflow.com/comment/34166580
has text: But there must me a way around this - there must be some other way of letting the observers know something has changed as soon as a button has been pressed?
comment on: http://stackoverflow.com/a/22462231
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34547929
score: 2
has text: I think you need to pack the web.xml file in the *.war archive. Perhaps it will be helpful: https://github.com/undertow-io/jastow/blob/master/src/test/java/io/undertow/test/jsp/basic/SimpleJspTestCase.java and https://issues.jboss.org/browse/UNDERTOW-198
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22474300

http://stackoverflow.com/q/22460367
type: Question
has comment: http://stackoverflow.com/comment/34162569
has comment: http://stackoverflow.com/comment/34162975
tagged with: path
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/22460432
tagged with: swing
answer count: 1
has title: Java copy file to existing folder?
has body: I currently am trying to copy a file to a new location, but since the location already exists, I get an error. Error: java.nio.file.FileAlreadyExistsException: C:\Users\Trevor\AppData\Roaming\.minecraft\mods at sun.nio.fs.WindowsFileCopy.copy(Unknown Source) at sun.nio.fs.WindowsFileSystemProvider.copy(Unknown Source) at java.nio.file.Files.copy(Unknown Source) at me.trevor1134.modinjector.ModInjector$3.actionPerformed(ModInjector.java:162) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34162788
has answer: http://stackoverflow.com/a/22460432

http://stackoverflow.com/comment/33942679
type: Comment
score: 0
type: AnswerComment
has text: Thanks for the answer. I am very new on android so is really hard for me (almost impossible) understand your explanation.. :(
comment on: http://stackoverflow.com/a/22334372

http://stackoverflow.com/q/22348212
has answer: http://stackoverflow.com/a/22348303
favorite count: 0
score: 8
upvote count: 12
has answer: http://stackoverflow.com/a/22348262
has body: I develop an android app that can send emails to users. But it turned out that some email addresses are not valid. How check if the email address entered by the user is valid or not?
answer count: 9
has answer: http://stackoverflow.com/a/22348286
type: UnansweredQuestion
has title: Android check if an email address is valid or not?
downvote count: 4
has answer: http://stackoverflow.com/a/22348394
tagged with: java
has answer: http://stackoverflow.com/a/41615925
has answer: http://stackoverflow.com/a/22348418
type: Question
has answer: http://stackoverflow.com/a/54433821
tagged with: android
has answer: http://stackoverflow.com/a/22348452
has answer: http://stackoverflow.com/a/22348837

http://stackoverflow.com/q/22368770
has answer: http://stackoverflow.com/a/22369846
tagged with: java
has answer: http://stackoverflow.com/a/22369248
accepted answer: http://stackoverflow.com/a/22369248
tagged with: percentage
tagged with: servlets
score: 0
answer count: 3
tagged with: jsp
has body: I am working on servlet and jsp project. I am passing an object from servlet to JSP. And currently I am iterating that object and showing them in a table - Below is my code in jsp - Hash Name Database Name Version <c:forEach var="i" begin="0" end="${reportCount.getHash().size() - 1}"> ${reportCount.getHash().get(i)} ${reportCount.getDatabaseName().get(i)} ${reportCount.getVersion().get(i)} </c:forEach> And above code is working fine and I am able to show the data properly. Now what I need to do is - ${reportCount.getDatabaseName().get(i)} will return database name as oracle or mysql only. Now I need to calculate what is the percentage of oracle database. I will get the total number of records from ${reportCount.getHash().size(). So if total number of records is 10 and oracle database is present 5 times, then the percentage should be 50%. Now I am not sure how would I calculate the above percentage using that object? And after calculating that percentage, I need to show the result in a new table which is shown below - Oracle Database % I am thinking I should iterate the reportCount object again in the above new table and extract the percentage here but not sure how would I do that? Can anyone provide an example? UPDATE:- Here is my bean code - public class Response { private List<String> hash = new LinkedList<String>(); private List<String> databaseName = new LinkedList<String>(); private List<String> version = new LinkedList<String>(); // getters and setters here }
tagged with: http://stackoverflow.com/tag/html
has title: How to iterate an object in JSP to get the percentage?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22369877
possible better answer: http://stackoverflow.com/a/22369846
type: Question

http://stackoverflow.com/comment/34011942
type: Comment
has text: So now the method works by using the .equals comparison for strings, but I keep getting a 0 for an answer. When you say instantiate you mean something like String num1 = new String();
comment on: http://stackoverflow.com/a/22374075
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34133583
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22443386
has text: Sorry, just realized forgot the photo; it should appear now.

http://stackoverflow.com/comment/34034679
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22387494
has text: Are the button objects of type button or a more genric instance?
score: 0

http://stackoverflow.com/q/22341841
accepted answer: http://stackoverflow.com/a/22464270
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22464270
tagged with: entitylisteners
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: Hibernate 4 JPA EntityListeners not firing in Spring MVC/ Spring Data application
type: Question
tagged with: jpa
has body: I've got a Hibernate 4 / Spring MVC 3.2.4/ Spring Data 1.4.1 with Spring Security application in which I am trying to integrate EventListeners on my entity classes. I think I have everything configured properly, and when I run my unit tests, I can see my event listeners being fired. However, when i run my full MVC application, the event listeners are never fired. I'm a bit lost where/how to debug this problem. My EntityManagerFactory is setup pretty much the same in both cases: PRODUCTION: org.hibernate.dialect.MySQL5InnoDBDialect true '1', false '0' true false true update org.hibernate.cfg.ImprovedNamingStrategy UTF-8 UNIT TESTS: <jdbc:embedded-database id="dataSource" type="H2"></jdbc:embedded-database> org.hibernate.dialect.H2Dialect true '1', false '0' true true true true create org.hibernate.cfg.ImprovedNamingStrategy UTF-8 so I presume that it isn't the case of the Unit test entityManagerFactory being defined differently. My unit test is fairly simple: @Transactional @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration({"classpath:META-INF/spring/applicationContext*.xml"}) @ActiveProfiles("test") public class UserServiceImplTest { @Test public void updateUser(){ User newInfo = dod.getNewTransientUser(15); userService.saveUser(newInfo); } } If I put a breakpoint in my @PrePersist method, I see that the method is called. My MVC controller is also fairly straight-forward: @RequestMapping( method=RequestMethod.GET, value="getUserInfo/{userId}", produces=MediaType.APPLICATION_JSON_VALUE) @ResponseBody @PreAuthorize("hasRole('ROLE_PERMISSION_RATE_VIEW')") @Transactional public String getUserInfo( @PathVariable long userId ){ userService.saveUser(createUser()); return "done"; } where createUser() simply returns a new User object with filled fields. However, my breakpoint in my EventListener is never hit, nor do I see anything in my logs indicating that it was. If it is helpful, I can post by event listener class as well, but didn't think…

http://stackoverflow.com/comment/34088514
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22418223
score: 1
has text: This is a good simplification, and it removes the root issue I described in my answer.

http://stackoverflow.com/q/22444642
score: 0
tagged with: paypal
answer count: 1
has answer: http://stackoverflow.com/a/22444914
tagged with: java
has body: I am implementing Paypal's "Buy Now" buttons in Java web application. What I couldn't find is adding Post parameters to Success Page URL after successful payment. Is it even possible? If yes, how?
type: UnansweredQuestion
has title: Paypal "Buy Now" button: success page parameters
type: Question

http://stackoverflow.com/q/22419386
has answer: http://stackoverflow.com/a/22419402
has comment: http://stackoverflow.com/comment/34090720
answer count: 4
possible better answer: http://stackoverflow.com/a/22419400
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9360223
accepted answer: http://stackoverflow.com/a/22419402
has answer: http://stackoverflow.com/a/22419400
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34090706
has comment: http://stackoverflow.com/comment/34090743
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/22419421
has comment: http://stackoverflow.com/comment/34090677
linked to: http://stackoverflow.com/q/10541311
tagged with: jsp
has answer: http://stackoverflow.com/a/22419406
has comment: http://stackoverflow.com/comment/34091418
has title: Servlet send arraylist to JSP as request attribute
duplicate of: http://stackoverflow.com/q/10541311
has comment: http://stackoverflow.com/comment/34090670
linked to: http://stackoverflow.com/q/17988612
has body: I am attempting to send an ArrayList from a servlet to a JSP page. In the Servlet: List<ItemObj> myList = new ArrayList<ItemObj>(); req.setAttribute("list", myList); req.getRequestDispatcher("page.jsp").forward(req,resp); In the JSP: <% List<ItemObj> myList = (ArrayList<ItemObj>) request.getParameter("list"); %> However, I keep getting an error: Cannot cast from String to List. I have found sources that indicate that I can cast as such: how to send ArrayList from jsp to servlet Send array of objects from servlet to JSP What am I doing wrong?

http://stackoverflow.com/a/42115966
type: Answer
has comment: http://stackoverflow.com/comment/131502683
upvote count: 110
answers question: http://stackoverflow.com/q/22345081
has body: You can use pagination with a native query. It is documented here: Spring Data JPA - Reference Documentation "You can however use native queries for pagination by specifying the count query yourself: Example 59. Declare native count queries for pagination at the query method using @Query" public interface UserRepository extends JpaRepository<User, Long> { @Query(value = "SELECT * FROM USERS WHERE LASTNAME = ?1", countQuery = "SELECT count(*) FROM USERS WHERE LASTNAME = ?1", nativeQuery = true) Page<User> findByLastname(String lastname, Pageable pageable); }
score: 109
has comment: http://stackoverflow.com/comment/133757449
has comment: http://stackoverflow.com/comment/111505352
downvote count: 1
has comment: http://stackoverflow.com/comment/113996821

http://stackoverflow.com/a/22460757
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34187288
has body: Try to run this command in the same directory as the pom.xml: mvn dependency:tree -Ddetail=true -Dincludes=org.hibernate:hibernate-core This will give you the dependency tree of not only the hibernate-core that was chosen, but other versions dependencies that altough present, where not chosen because some other dependency took precendence. When in doubt which transitive dependency to choose, maven applies the following rules: the dependency that is the closest to the pom.xml project wins. for example if one version is two levels away in the tree and another 1 level away, the one 1 level away wins. if all dependencies are at the same level of distance from the pom.xml artifact, the one that shows up first on the pom wins. The solution for this problem is to see with the comand above everyone that is requiring hibernate-core, decide which version you want and add the proper exclusions. EDIT: The problem is that JBoss 7 is an EJB container that includes JPA, and the JPA on the server is interfering with the JPA on the WAR. This is because by default JBoss 7 works in 'server first' mode, where it will fetch libraries first from the server and only if they don't exist from the application. You can change this to 'server last', where the jars on your application always take precedence. This can be done by setting java2ParentDelegation=false in file jboss-app.xml or jboss-web.xml - see also this answer. You can also turn off server modules one by one, but this is more error prone. For that, create a file in src/main/resources/META-INF named jboss-deployment-structure.xml, and there turn off the hibernate/JPA modules on the server: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;jboss-deployment-structure&gt; &lt;deployment&gt; &lt;exclusions&gt; &lt;module name="org.hibernate" /&gt; &lt;module name="org.jboss.as.jpa" /&gt; &lt;module name="org.jboss.as.jpa.hibernate" /&gt; ... &lt;/exclusions&gt; &lt;/deployment&gt; &lt;/jboss-deployment-structure&gt;
has comment: http://stackoverflow.com/comment/34262568
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34313820
answers question: http://stackoverflow.com/q/22417836

http://stackoverflow.com/comment/33997800
type: QuestionComment
comment on: http://stackoverflow.com/q/22365721
score: 0
has text: Check your package statements and try to put all classes in the same directory with the same package statement
type: Comment

http://stackoverflow.com/comment/33980964
comment on: http://stackoverflow.com/a/22343195
score: 0
type: AnswerComment
has text: similar to the fps counter, have three variables in the method, one for the start time, one for the end time, one for the difference between the two. At the start of the `paintComponent`, set start time and at the end of the method set the end time. Find the difference between the two and `return`. You will have to set the component to return a long.
type: Comment

http://stackoverflow.com/a/22429519
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: It works fine, from multi-threaded tests to the HTML report because the ITestResult is always the same in the end, no matter what you do. You can simple create a "CustomReport" class that extends IReporter. Then, override the generateReport method and just let TestNG create and pass these 2 arguments into it: @Override public void generateReport( List&lt;XmlSuite&gt; xml, List&lt;ISuite&gt; suites, String outdir ) { for ( ISuite thisSuite: suites ) { thisSuite.getResults(). ... ... } .... Then, inside that method, do what you will, to customize the report and generate HTML tables or whatever. Also, one thing I do (to reduce confusion in the console output while multithreaded tests run) is log the thread name to messages on the TestNG report by using something like: public void logIt( String message ) { Reporter.log( "Thread-" + Thread.currentThread().getId() + ": " + message, true ); } TestNG is awesome, especially when you understand what I said above as well as the fact that you implicitly allow TestNG to pass a XMLTest or ITestContext or ITestResult to some of the @Configuration methods. For example: @BeforeClass public void setUp( ITestContext context ) { logger.info("BeforeClass setUp..."); suiteParams = context.getSuite().getXmlSuite().getAllParameters(); ...
score: 1
accepted answer of: http://stackoverflow.com/q/22423654
answers question: http://stackoverflow.com/q/22423654

http://stackoverflow.com/a/22345729
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: Try public static void ensureVisible(ListView listView, int pos) { if (listView == null) { return; } if(pos &lt; 0 || pos &gt;= listView.getCount()) { return; } int first = listView.getFirstVisiblePosition(); int last = listView.getLastVisiblePosition(); if (pos &lt; first) { listView.setSelection(pos); return; } if (pos &gt;= last) { listView.setSelection(1 + pos - (last - first)); return; } }
answers question: http://stackoverflow.com/q/22345535
accepted answer of: http://stackoverflow.com/q/22345535

http://stackoverflow.com/comment/34125947
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22439547
type: Comment
has text: Please remove unwanted comment from code, it's difficult to read.

http://stackoverflow.com/comment/34060457
score: 0
type: Comment
type: QuestionComment
has text: Just extract the part between `SELECT` and `FROM` and seperate it by `,`.
comment on: http://stackoverflow.com/q/22402497

http://stackoverflow.com/a/22462364
score: -1
has comment: http://stackoverflow.com/comment/34170204
upvote count: 0
has comment: http://stackoverflow.com/comment/34166201
answers question: http://stackoverflow.com/q/22462288
type: Answer
has comment: http://stackoverflow.com/comment/34170194
has comment: http://stackoverflow.com/comment/34168133
has body: to transfer data between activities you can use use baskets The activity which you generate the data i = new Intent(this, DeleteAppointment.class); i.putExtra("name", strFirstName); startActivity(i); The activity which you are retrieving the data @Override protected void onHandleIntent(Intent intent) { String action = intent.getAction(); String name= intent.getStringExtra("name"); }
downvote count: 1
has comment: http://stackoverflow.com/comment/34166296

http://stackoverflow.com/comment/34013150
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22375388
has text: should you call `executeUpdate()` ?
score: 0

http://stackoverflow.com/comment/34188012
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22474969
has text: Why can't you use an ActionListener if you want the text to change when a certain condition is met?

http://stackoverflow.com/comment/34092104
comment on: http://stackoverflow.com/a/22420285
has text: firstly if I am usin 32-bit JVM or 64- bit JVM what is the limit in both cases and how arrayList gives better performance than list?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34181688
type: Comment
comment on: http://stackoverflow.com/a/22466607
has text: Well the problem is that at runtime you want all versions available and pick based on the request from user so that is how we solved it. The router does not provide the list, it has the list. It gets the request and then gives back the correct versioned implementation to use.
score: 1
type: AnswerComment

http://stackoverflow.com/a/22444474
has comment: http://stackoverflow.com/comment/34224262
downvote count: 0
has comment: http://stackoverflow.com/comment/34136093
has comment: http://stackoverflow.com/comment/34135743
answers question: http://stackoverflow.com/q/22444454
has body: Whenever you're going to be dealing with some binary communications protocol, be it a TCP connection, Serial Port, USB, etc. you need to save yourself some future headaches and define your protocol. Specifically, this means field widths, and byte order. When sending binary data over a network protocol, we almost always send it in "network order", which is "big-endian", meaning the most-significant byte first. Example: I want to send a four-byte int a = 0x12345678 over the network. If you do it correctly, the bytes go out in the order 12 34 56 78. However, I believe your ATMEGA chip is little-endian, which means that bytes are stored (in memory) with the least-significant byte first. So if you were to just cast that int to a unsigned char* and send 4 bytes, they would go out in the order 78 56 34 12. So in order to send that value out, you should first decide how many bytes it's going to be. Since you've limited it to the range 0 - 1023, you've observed that it will fit into just two bytes. Good. So your protocol is: Offset 0: value Size: 2 Now, you need to send it in network order. Your example code: byte value [2]; value[1] = val &amp; 0x000000ff; value[0] = (val &amp; 0x0000ff00) &gt;&gt; 8; is putting the most significant byte at position 0, and the least significant byte at position 1. So a value of 0x1234 will go out in the order 12 34. Perfect. Your code is correct (on the Arduino side). Now, on the receiving side, you need to make sure that you're receiving data in network order also. I haven't done any Java network programming, so you'll need to check with the documentation to see how it handles network binary streams. In particular, when you go to read that "16-bit unsigned integer" from the network, the byte order needs to be respected. Perhaps this will help you on the Java side: network byte order to host byte order in java
type: Answer
has comment: http://stackoverflow.com/comment/34135596
has comment: http://stackoverflow.com/comment/34135780
upvote count: 1
has comment: http://stackoverflow.com/comment/34135829
score: 1
has comment: http://stackoverflow.com/comment/34214909

http://stackoverflow.com/comment/34029607
type: Comment
type: QuestionComment
has text: @Daan van Hulst Okay I get it now the version is 4.2.1.v20130118-173121-9MF7GHYdG0B5kx4E_SkfZV-1mNjVATf67ZAb7
comment on: http://stackoverflow.com/q/22384584
score: 0

http://stackoverflow.com/comment/34155358
type: AnswerComment
comment on: http://stackoverflow.com/a/22455826
score: 0
has text: I'm gonna try this. Seems reasonable. I didn't realize that streams were also buffers. I initially tried a straight up ByteBuffer before realize it's an abstract class. I'll update my post after testing. Thanks!
type: Comment

http://stackoverflow.com/a/22432074
accepted answer of: http://stackoverflow.com/q/22432008
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34114916
score: 2
has comment: http://stackoverflow.com/comment/34113507
has body: The problem is the precedence of the operators. The order for the 3 you use is as follows: Multiplicative Additive Shift What happens, is that left+(right-left)&gt;&gt;1 is treated as if it were (left+(right-left))&gt;&gt;1, which is not equal, but rather just right &gt;&gt; 1 or right / 2. You can see precedence here: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html
upvote count: 2
answers question: http://stackoverflow.com/q/22432008

http://stackoverflow.com/comment/33957078
comment on: http://stackoverflow.com/a/22342539
type: Comment
has text: The for-loop words. It's wrapped in a while loop and terminate on null indexes of words. The line under the for-loop will set the value at the earliest null index.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22437453
score: 0
has body: 1 . First, copy the letters to answer 2 . Then, for each letter l[i], answer[l + i - 1] = string_consisting_of_letter_l[i]_repeated_n[i]_times
type: Answer
answers question: http://stackoverflow.com/q/22437303

http://stackoverflow.com/comment/65015182
type: Comment
has text: I've tried to use this command and my maven responds with `Process exited with an error: 1 (Exit value: 1)` any ideas how to get some more debugging info from maven?
type: AnswerComment
comment on: http://stackoverflow.com/a/23855825
score: 0

http://stackoverflow.com/a/22369038
downvote count: 0
score: 1
has body: This will only read the integers on lines that contains the String "Line", "Circle" or "Rectangle". Scanner s = new Scanner(new File("sample.txt")).useDelimiter("\\n"); while (s.hasNext()) { String line = s.next(); if(line.matches("^.+(Line|Circle|Rectangle)$")) { line = line.replaceAll("(Line|Circle|Rectangle)",""); String[] tokens = line.split(" "); for(String t: tokens) { System.out.print(t+" "); } } } The above prints out: 10 10 100 100 10 20 15 30 100 50 50 10 10 50 50
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22368213

http://stackoverflow.com/q/22347196
downvote count: 0
favorite count: 0
tagged with: security
has comment: http://stackoverflow.com/comment/52834301
upvote count: 6
has comment: http://stackoverflow.com/comment/34924240
has title: shiro configuration [urls] section dynamically
answer count: 0
type: UnansweredQuestion
score: 6
has comment: http://stackoverflow.com/comment/35472211
has body: I am new to Shiro, I want to use this for securing my web application. I have tested it's various features. I have also tested [urls] /login.xhtml = authc /logout = logout /admin/** = user, roles[admin] /guest/** = user, roles[admin,guest] But In my application I want to configure this section dynamically. I Found some solutions like dynamically create the Ini instance or implementation but can they didn't solve my problem. Please provide me suggestion or way to out. Some code snippet will be better
tagged with: java
type: Question
tagged with: shiro

last-modified
type: Tag
tags question: http://stackoverflow.com/q/22406237
tag name: last-modified

http://stackoverflow.com/q/22443270
answer count: 1
tagged with: jflex
score: 0
type: UnansweredQuestion
has body: Recently i've been working with Jflex and i noticed that when i try to construct the Yylex object it only accepts java.io.Reader and java.io.InputStream. How could i do if i just want to build the object by using only a String?, like this: String myString = "Hello world"; String token; Yylex scanner = new Yylex(myString); while ((token = scanner.yylex()) != null) { //do something } In the system i'm trying to build i want the user to write something and then apply the Yylex method to it. In the models i saw that were similar to my idea the user inputs an String and then it is written into a file from where the Yylex will read. Is it possible to do that? or i'm misunderstanding something?. Is there any other tool you would reccomend instead of Jflex? Thanks!
has title: Is it possible to construct an Yylex object by using an String?
tagged with: java
tagged with: stringtokenizer
linked to: http://stackoverflow.com/q/837703
type: Question
has answer: http://stackoverflow.com/a/22491390
has comment: http://stackoverflow.com/comment/34133319

http://stackoverflow.com/a/22391219
has comment: http://stackoverflow.com/comment/34092768
has body: At 16kHz sample rate you'll have 16 samples per millisecond. Therefore, each 32ms frame would be 32*16=512 mono samples. Multiply by the number of bytes-per-sample (typically 2 or 4) and that will be the number of bytes per frame.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22389143
answers question: http://stackoverflow.com/q/22389143
has comment: http://stackoverflow.com/comment/34049122
has comment: http://stackoverflow.com/comment/34048381

http://stackoverflow.com/q/22426438
score: 1
tagged with: java
has body: I am currently creating an Android application. The application will be communicating with a server and also other Android devices running the same application. The server uses PHP with a MySQL database. Is there a convention for what ports to use in Android? Is it a good idea to hard code what ports to use or should they be different every time?
type: Question
has comment: http://stackoverflow.com/comment/34102381
accepted answer: http://stackoverflow.com/a/22426517
upvote count: 1
has comment: http://stackoverflow.com/comment/34102794
answer count: 1
has comment: http://stackoverflow.com/comment/34102897
has title: What ports should I use for Android?
has answer: http://stackoverflow.com/a/22426517
favorite count: 0
tagged with: sockets
tagged with: port
tagged with: android
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/34108566
type: AnswerComment
score: 0
type: Comment
has text: looks more complicated now, why that way? and if so hmm mathematical, another question: why 33?
comment on: http://stackoverflow.com/a/22429682

http://stackoverflow.com/q/22461192
answer count: 1
upvote count: 6
favorite count: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/34164201
linked to: http://stackoverflow.com/q/1548487
downvote count: 0
has body: Is there any method to handle/catch all exceptions thrown by a Java application, without spamming costly try{}catch(Exception e){} statements everywhere? For example, PHP has the function set_error_handler(). Back story - Despite tough testing, sometimes bugs can get through, and users are always less than cooperative with helping to fix these. Ideally, I'd like to hook the application up to a web service facility that can keep track of any stack traces thrown by a user's application.
score: 6
tagged with: error-handling
has title: Catch exceptions within an entire Java application
type: AnsweredQuestion
tagged with: java
duplicate of: http://stackoverflow.com/q/1548487
type: Question
has answer: http://stackoverflow.com/a/22461226
accepted answer: http://stackoverflow.com/a/22461226

http://stackoverflow.com/a/22386425
type: Answer
answers question: http://stackoverflow.com/q/22385205
has body: Your security configuration is blocking all unauthenticated requests. You should allow access to the controller with .antMatchers("/mycontroller").permitAll() See also: http://spring.io/blog/2013/07/03/spring-security-java-config-preview-web-security/
score: 3
has comment: http://stackoverflow.com/comment/43027263
has comment: http://stackoverflow.com/comment/34035246
downvote count: 1
has comment: http://stackoverflow.com/comment/34067490
upvote count: 4
has comment: http://stackoverflow.com/comment/34040208
has comment: http://stackoverflow.com/comment/34039458

http://stackoverflow.com/q/22443626
has comment: http://stackoverflow.com/comment/34134021
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/22443681
score: -3
answer count: 3
favorite count: 0
has title: Reading user input into array
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22443661
has answer: http://stackoverflow.com/a/22452318
has body: I need to store user input in an array, but I am having trouble accomplishing this. Can anyone offer some advice? import java.util.Scanner; public class EmployeeManagement { Scanner s = new Scanner(System.in); Employee e = new Employee(); Employee[] arrayOfEmp = new Employee[2]; //Fields public static int index; public void addRecord(Employee userE, int index){ //Add method while(index&lt;arrayOfEmp.length){ System.out.println("Please enter Employee Id : "); e.setEmployeeId(s.next()); System.out.println("Please enter Employee Name : "); e.setName(s.next()); this.arrayOfEmp[index]=userE; index++; }
tagged with: java
downvote count: 3
type: Question

http://stackoverflow.com/q/22459361
has title: HTTP request error Android
answer count: 1
has comment: http://stackoverflow.com/comment/34160714
type: UnansweredQuestion
tagged with: android
score: 0
has comment: http://stackoverflow.com/comment/34160845
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/22459710
has body: I am building an Android app in which I am making a HTTP request. But it showing error : Please make sure the Content-Type or Accept of Request Header or Request Parameters is correct!The Request should be like android But if I use same code through normal Java program it is working properly. Here is my code : public static void getJSONFromUrl(String urlStr) { try { System.setProperty("http.keepAlive", "false"); URL url = new URL(urlStr); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.setUseCaches(false); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.setDoInput(true); connection.setConnectTimeout(10000); connection.connect(); System.out.println("Connection :"+connection.getResponseCode()); String rawObjects = readZipStream(connection.getInputStream()); } catch (Exception exception) { exception.printStackTrace(); } } private static String readZipStream(InputStream is) throws IOException, ParseException { StringBuilder rawObjects = new StringBuilder(); InputStream zis = new BufferedInputStream(is); BufferedReader br = new BufferedReader(new InputStreamReader(zis)); try { String readedLine; while ((readedLine = br.readLine()) != null) { System.out.println("readedLine :"+readedLine); if (readedLine != null &amp;&amp; readedLine.trim().length() &gt; 0) { rawObjects.append(readedLine); } } } catch (IOException e) { throw new IOException(e.getMessage()); } finally { close(br); close(zis); } return rawObjects.toString(); } private static void close(InputStream inputStream) { try { if (inputStream != null) { inputStream.close(); } } catch (Exception exception) { } } private static void close(Reader reader) { try { if (reader != null) { reader.close(); } } catch (Exception exception) { } } Log o/p : 03-17 21:54:19.021: D/Response:(14409): &gt; Service response code: 404 03-17 21:54:19.021: D/Response:(14409): Service response: Please make sure the Content-Type or Accept of Request Header or Request Parameters …
tagged with: java

http://stackoverflow.com/comment/34050629
type: QuestionComment
type: Comment
has text: @JasonC: now i updated LogCat.. so now you can find that error....
score: 0
comment on: http://stackoverflow.com/q/22396336

http://stackoverflow.com/q/22385861
tagged with: tomcat
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22386147
accepted answer: http://stackoverflow.com/a/22386147
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: multithreading
has answer: http://stackoverflow.com/a/22386102
upvote count: 1
has comment: http://stackoverflow.com/comment/34031744
has body: In my web application running tomcat 6, an object (not Servlet) is scheduled to execute for reading files from a defined folder. After reading a file, the file content is saved into a database. In order to have higher performance, multitasking is needed. My original approach is to build a new thread once a file is read, tasks of each file run in parallel in background. For example, if three files are found, three threads are created. However, although tomcat configuration has set maxthreads to more than 200 as well as 32GB memory has been assigned, every time only 7-8 threads are running simultaneously. What's wrong? Or multithreading is not a best practice for multitasking? Please help. Addition (14 Mar 2014) Thanks for your advice. So my question can be more specific: 1. Can ThreadPoolExecutor improve the performance? 2. Can NIO improve the performance? Here is the original code: String[] listFiles = folder.list(); for(int i=0; i&lt;listFiles.length; i++) { synchronized(globalHashMap) { MyTask myTask = new MyTask(listFiles[i]); globalHashMap.put(listFiles[i], myTask ); myTask.start(); } } MyTask { String myFile; Thread myThread; public MyTask(String file) { myFile = file; } public void start() { myThread = new Thread(new Runnable() { do { readCnt = bufferedInputStream.read(bytesArray, 1024, 1); ... } while(not end); postProcessFunction(); synchronized(globalHashMap) { globalHashMap.remove(myFile); globalHashMap.notifyAll(); } } myThread.start(); } }
has title: High Performance in Multitasking inside Tomcat
has comment: http://stackoverflow.com/comment/34048049
tagged with: java
answer count: 3
possible better answer: http://stackoverflow.com/a/22385985
has answer: http://stackoverflow.com/a/22385985
has comment: http://stackoverflow.com/comment/34031661

http://stackoverflow.com/a/22487170
answers question: http://stackoverflow.com/q/22486619
score: 0
has body: I think this is because the readers will not read the output untill the program has finished running. I don't know about exactly how you would get the process to "wait" until user input is written to the output stream of the process, but I can help clarify some things for you. I know that the readers certainly do not wait until the program finishes running to read the output stream. LoggingProcessWrapperUtil.myPB = new ProcessBuilder(command); LoggingProcessWrapperUtil.myPB.redirectInput(Redirect.PIPE); LoggingProcessWrapperUtil.myPB.redirectOutput(Redirect.PIPE); StringBuilder commandStr = new StringBuilder(); for (String str : command) { commandStr.append(str); commandStr.append(" "); } LoggingProcessWrapperUtil.log.debug("Executing command : {}", commandStr); Process p = LoggingProcessWrapperUtil.myPB.start(); LoggingProcessWrapperUtil.log.debug("Starting ProcessStreamWorker pointed at process"); for (String str : args_to_write_on_stream) { LoggingProcessWrapperUtil.log.debug("Writing arguments on inbound outputstream:"); LoggingProcessWrapperUtil.log.debug(str); } ProcessStreamWorker w = new ProcessStreamWorker(p, args_to_write_on_stream); new Thread(w).start(); int exitCode = w.waitOn(timeoutMS); SimpleEntry&lt;Integer, String&gt; returnEntry = new SimpleEntry&lt;Integer, String&gt;(exitCode, w.getAggregateOutput()); return returnEntry; This short snippet was my solution to a related problem, albeit I was looking to automate a process, not pause it for user input. I build the process, start it, and then immediately put it into a runnable process wrapper that appends the arguments onto the OutputStream of the process. This has worked for me, so the process output stream certainly does get read in realtime. One thing that you can try is ProcessBuilder.redirectInput and ProcessBuilder.redirectOutput(Redirect.Inherit), if you have a CLI java app launching another CLI app then the process you are launching should also accept input/output activity from the console wi…
type: Answer

http://stackoverflow.com/comment/34180271
type: Comment
type: QuestionComment
has text: What kind of error are you getting?
comment on: http://stackoverflow.com/q/22470275
score: 0

http://stackoverflow.com/a/22370983
has comment: http://stackoverflow.com/comment/34097958
type: Answer
upvote count: 1
has body: I think this is not correct > &lt;mapping resource="com.hibernate.Student_Info" /&gt; This tell hibernate where are the hbm files located not the entities, then within the hbm.xml files you be able to add the entities. &lt;class name="Student_Info" table="Student_Info "&gt; ... &lt;/class&gt; Indeed com.hibernate.Student_Info not found Means there are not com.hibernate.Student_Info file, consider read this. UPDATE In order to fix the next exception you should consider renaming the file as java said. Exception in thread "main" org.hibernate.MappingNotFoundException: resource: com.hibernate.Student_Info.hbm.xml not found It means you should use &lt;mapping resource="Student_Info.hbm.xml" /&gt; And file name must to be name *Student_Info.hbm.xml* should be at the level of hibernate.cfg.xml
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22366758

jsp
tags question: http://stackoverflow.com/q/22403843
tags question: http://stackoverflow.com/q/22384128
tags question: http://stackoverflow.com/q/22438171
tags question: http://stackoverflow.com/q/22457065
tags question: http://stackoverflow.com/q/22331198
tags question: http://stackoverflow.com/q/22473833
tags question: http://stackoverflow.com/q/22376632
tags question: http://stackoverflow.com/q/22407585
tags question: http://stackoverflow.com/q/22353544
tags question: http://stackoverflow.com/q/22329289
tags question: http://stackoverflow.com/q/22329558
tags question: http://stackoverflow.com/q/22421775
tags question: http://stackoverflow.com/q/22409324
tags question: http://stackoverflow.com/q/22345218
tags question: http://stackoverflow.com/q/22436361
tags question: http://stackoverflow.com/q/22424107
tags question: http://stackoverflow.com/q/22423967
tags question: http://stackoverflow.com/q/22381575
tags question: http://stackoverflow.com/q/22404735
tags question: http://stackoverflow.com/q/22477899
tags question: http://stackoverflow.com/q/22475567
tags question: http://stackoverflow.com/q/22386764
tags question: http://stackoverflow.com/q/22355945
tags question: http://stackoverflow.com/q/22408754
tags question: http://stackoverflow.com/q/22442388
tags question: http://stackoverflow.com/q/22401970
tags question: http://stackoverflow.com/q/22343072
tags question: http://stackoverflow.com/q/22398277
tags question: http://stackoverflow.com/q/22374299
tags question: http://stackoverflow.com/q/22472404
tags question: http://stackoverflow.com/q/22453855
tags question: http://stackoverflow.com/q/22398886
tags question: http://stackoverflow.com/q/22467676
type: Tag
tags question: http://stackoverflow.com/q/22486201
tags question: http://stackoverflow.com/q/22420421
tags question: http://stackoverflow.com/q/22386571
tags question: http://stackoverflow.com/q/22483236
tags question: http://stackoverflow.com/q/22331998
tags question: http://stackoverflow.com/q/22476464
tags question: http://stackoverflow.com/q/22461879
tags question: http://stackoverflow.com/q/22387539
tags question: http://stackoverflow.com/q/22420115
tags question: http://stackoverflow.com/q/22398977
tags question: http://stackoverflow.com/q/22369857
tags question: http://stackoverflow.com/q/22419386
tags question: http://stackoverflow.com/q/22400909
tags question: http://stackoverflow.com/q/22348959
tags question: http://stackoverflow.com/q/22391281
tags question: http://stackoverflow.com/q/22410072
tags question: http://stackoverflow.com/q/22330717
tags question: http://stackoverflow.com/q/22436812
tags question: http://stackoverflow.com/q/22335466
tags question: http://stackoverflow.com/q/22348086
tags question: http://stackoverflow.com/q/22418040
tags question: http://stackoverflow.com/q/22464404
tags question: http://stackoverflow.com/q/22422160
tags question: http://stackoverflow.com/q/22459614
tag name: jsp
tags question: http://stackoverflow.com/q/22356968
tags question: http://stackoverflow.com/q/22426854
tags question: http://stackoverflow.com/q/22428216
tags question: http://stackoverflow.com/q/22369717
tags question: http://stackoverflow.com/q/22361039
tags question: http://stackoverflow.com/q/22402078
tags question: http://stackoverflow.com/q/22401877
tags question: http://stackoverflow.com/q/22397196
tags question: http://stackoverflow.com/q/22409321
tags question: http://stackoverflow.com/q/22458627
tags question: http://stackoverflow.com/q/22424586
tags question: http://stackoverflow.com/q/22368689
tags question: http://stackoverflow.com/q/22469942
tags question: http://stackoverflow.com/q/22421085
tags question: http://stackoverflow.com/q/22470136
tags question: http://stackoverflow.com/q/22405181
tags question: http://stackoverflow.com/q/22385060
tags question: http://stackoverflow.com/q/22344001
tags question: http://stackoverflow.com/q/22472937
tags question: http://stackoverflow.com/q/22477891
tags question: http://stackoverflow.com/q/22344946

http://stackoverflow.com/q/22456752
has comment: http://stackoverflow.com/comment/34156405
type: Question
has answer: http://stackoverflow.com/a/22457342
has answer: http://stackoverflow.com/a/22457042
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22475422
tagged with: image
downvote count: 0
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34156543
has title: How can I move image slowly?
tagged with: java-2d
has body: I want to move Images slowly.But drawImage() method only takes int values.Is there any method to move pictures slowly.I want to make ground move to the left a little bit slowly. import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import javax.swing.JPanel; @SuppressWarnings("serial") public class Board extends JPanel { private Image ground; private Image city; private int x = 0; public Board() { ground = Toolkit.getDefaultToolkit().getImage("Resources\\ground2.png"); city = Toolkit.getDefaultToolkit().getImage("Resources\\background2.png"); } public void paint(Graphics g){ super.paint(g); g.drawImage(ground, x--, 500, 600, 200, this); g.drawImage(ground, x + 600, 500, 600, 200, this); repaint(); g.drawImage(city, 0, 0, 600, 500, this); if(x == -600){ x = 0; } } }
type: UnansweredQuestion
tagged with: animation
upvote count: 1
tagged with: swing

http://stackoverflow.com/a/22426971
has comment: http://stackoverflow.com/comment/34103256
upvote count: 3
has body: This loop: // TODO 4: loop as long as the guess is not correct while (guess &lt;= game.getHighest() &amp;&amp; guess &gt;= 0) { guess++; is not doing what you state in the comment. It will make your guess variable reach the highest value always. No check against the secret number is done. Update 1 Replace your main method with this: public static void main(String[] args) { GuessTheNumberGame game = new GuessTheNumberGame(100); int turns = 1; int guess = -1; do { Scanner kb = new Scanner(System.in); System.out.println("Guess a nummber between 0 and 100"); guess = kb.nextInt(); if (game.isGuessHigher(guess)){ System.out.println("You guessed too high!"); turns++; } else if (!game.isGuessCorrect(guess)){ System.out.println("You guessed too low!"); turns++; } } while (!game.isGuessCorrect(guess)); System.out.printf("You guessed the number in %d turns\n", turns); } I've not executed it, so it may contain some minor problems.
has comment: http://stackoverflow.com/comment/34103392
has comment: http://stackoverflow.com/comment/34103848
type: Answer
has comment: http://stackoverflow.com/comment/34103368
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22426899

http://stackoverflow.com/comment/34095731
type: QuestionComment
comment on: http://stackoverflow.com/q/22422501
has text: I suspect you need to flush the C stream.
score: 0
type: Comment

http://stackoverflow.com/a/22456682
type: Answer
score: 3
downvote count: 0
upvote count: 3
has body: The good practice for an utility class is to make it final to disable inheritance, make constructor private to prevent instantiation and provide a set of public static utility methods: public final class AppUtils { private AppUtils() { } public static float covertDpToPx() { ... } public static String encodeUrl(String url) { ... } }
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22456331
accepted answer of: http://stackoverflow.com/q/22456331

http://stackoverflow.com/comment/34116563
comment on: http://stackoverflow.com/a/22434324
type: Comment
has text: Actually I am doing it in a simple manner. I m not using APIs in it. This type of questions with certain conditions are asked in interviews.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34128834
score: 0
type: Comment
type: QuestionComment
has text: my problem was already solved by Sabuh Hassan.
comment on: http://stackoverflow.com/q/22440510

http://stackoverflow.com/a/22461532
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/34164951
answers question: http://stackoverflow.com/q/22451406
has comment: http://stackoverflow.com/comment/34236723
has comment: http://stackoverflow.com/comment/34166529
has comment: http://stackoverflow.com/comment/34166361
has comment: http://stackoverflow.com/comment/34269599
type: Answer
has comment: http://stackoverflow.com/comment/34264397
has comment: http://stackoverflow.com/comment/34176988
has comment: http://stackoverflow.com/comment/34270104
has body: A static block is executed when the class is loaded into the JVM, and an instance block is executed when object is created. There can be multiple static and instance initialization blocks, the order of their execution in themselves will be in the order of their appearance on a top to bottom basis. for example consider the following code. public class InitBlockExample{ { System.out.println("X"); } { System.out.println("Y"); } static{ System.out.println("A"); } static{ System.out.println("B"); } } When an object of this class is created (To show both static and instance blocks object creation is necessary) the output will be as follows:- A B X Y the static statements also participate in order execution along with static block, and the one's those come first are executed first, this thing applies to your question here the class variables you created are static, so they will be executed first and because they require constructor execution first the constructor is executed but before the constructor all instance initialization blocks are executed so they are executed first and then constructor and in last the static block. If you put static Hello INS1=new Hello(); static Hello INS2=new Hello(12); after the static block then output will be reversed and static block will be executed first.
score: 5
has comment: http://stackoverflow.com/comment/34165845

http://stackoverflow.com/a/22389865
has body: You might want to and a ^[0-9]+$ for the expressions so you just get complete integers. Without the ^ and $ you could be matching other characters like tt55gh would match. if (!(s[i].matches("^[0-9]+$"))) { } Per the comment above you need to move the for loop inside the while loop. while ((line = bReader.readLine()) != null) { s = line.split("\t"); for (int i = 0; i &lt; s.length; i++) { System.out.println("Value "+i+": "+s[i]); if (!(s[i].matches("^[0-9]+$"))) { t.addWord(s[i]); System.out.println("Integer "+i+": "+s[i]); } } }
answers question: http://stackoverflow.com/q/22389801
upvote count: 1
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34039393

http://stackoverflow.com/comment/34020429
type: AnswerComment
has text: @ali Depends on your case and your data. Can't say
type: Comment
comment on: http://stackoverflow.com/a/22379564
score: 0

http://stackoverflow.com/a/22476454
downvote count: 1
upvote count: 0
score: -1
has body: you'd better use Ajax to load the data for your first ComboBox or some other fields data (page without re-loading,thus)
answers question: http://stackoverflow.com/q/22467676
type: Answer

http://stackoverflow.com/q/22443275
has comment: http://stackoverflow.com/comment/34133318
accepted answer: http://stackoverflow.com/a/22443317
has comment: http://stackoverflow.com/comment/34133340
tagged with: while-loop
has comment: http://stackoverflow.com/comment/34133321
has body: My code compiles correctly. When I run my program the output asks me to enter weight of package. If I enter a negative number the program asks me to enter weight again, but won't stop to let me enter another number. I think the problem is in the "while" statement but I'm not sure. Any help would be appreciated. import java.util.Scanner; public class dcrawford_Shipping { public static void main (String args[]) { Scanner input = new Scanner(System.in); int weight, distance, distancex; double rate, price; rate = 0.00; System.out.print("Please enter package weight: "); weight = input.nextInt(); while (weight &lt;= 0 || weight &gt;= 61) { System.out.print("Please enter package weight: "); } if (weight &lt;= 10 &amp;&amp; weight &gt;= 1 ) { rate = 5.01; } else if ( weight &lt;= 20 &amp;&amp; weight &gt;= 11 ) { rate = 7.02; } else if ( weight &lt;= 30 &amp;&amp; weight &gt;= 21 ) { rate = 9.03; } else if ( weight &lt;= 40 &amp;&amp; weight &gt;= 31 ) { rate = 11.04; } else if ( weight &lt;= 60 &amp;&amp; weight &gt;= 41) { rate = 15.00; } System.out.print("Please enter distance: "); distance = input.nextInt(); while ( distance &lt;= 0 ) { System.out.print("Please enter distance: "); } distancex = ( distance / 100 ) + 1; price = ( distancex * rate ); System.out.printf("Your total shipping cost for %d miles is $%.2f\n", distance, price); } }
downvote count: 1
type: AnsweredQuestion
has title: issue with java while statement?
has answer: http://stackoverflow.com/a/22443317
tagged with: java
score: -1
type: Question
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/22468537
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/34177791
answers question: http://stackoverflow.com/q/22468364
upvote count: 1
has body: It seems both your App Server and MySQL have a difference of 3 hours w.r.t. UTC. Set the TimeZone to UTC and then retreive. Example: TimeZone.setDefault( TimeZone.getTimezone( "UTC" ) ); scheduleDdate = rs.getDate( "scheduleDdate" ); Other Examples: System.out.println( TimeZone.getDefault() ); Calendar cal = Calendar.getInstance(); Date d = cal.getTime(); System.out.println( " d: " + d ); TimeZone.setDefault(TimeZone.getTimeZone("GMT-3")); System.out.println( " d(GMT-3): " + d ); TimeZone.setDefault(TimeZone.getTimeZone("GMT")); System.out.println( " d(GMT) : " + d ); TimeZone.setDefault(TimeZone.getTimeZone("UTC")); System.out.println( " d(UTC) : " + d ); Results: sun.util.calendar.ZoneInfo[id="IST",offset=19800000,dstSavings=0, useDaylight=false,transitions=6,lastRule=null] d: Tue Mar 18 06:41:52 IST 2014 d(GMT-3): Mon Mar 17 22:11:52 GMT-03:00 2014 d(GMT) : Tue Mar 18 01:11:52 GMT 2014 d(UTC) : Tue Mar 18 01:11:52 UTC 2014
accepted answer of: http://stackoverflow.com/q/22468364
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22369999
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34004727
score: -1
has comment: http://stackoverflow.com/comment/34004598
has title: How to parse HTML into text in Java
answer count: 3
tagged with: http://stackoverflow.com/tag/html
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22370161
has body: I have a program to connect to the internet and read the file. But its result is always in html.. how can i possible turn it into normal text.. here's the code: package urlconnectionreader; import java.net.*; import java.io.*; public class URLConnectionReader { public static void main(String[] args) throws IOException{ System.out.println("Hi!"); URL oracle = new URL("http://www.oracle.com/"); URLConnection yc = oracle.openConnection(); yc.setRequestProperty("Content-type", "text/xml"); yc.setRequestProperty("Accept", "text/xml, application/xml"); BufferedReader in = new BufferedReader(new InputStreamReader( yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } } --EDITED-- I want to get rid of html tags in its output.
has answer: http://stackoverflow.com/a/22370081
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22370131
tagged with: text
upvote count: 0

http://stackoverflow.com/comment/34019768
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22379082
has text: "the framework explicitly uses Jettison" <-- which framework?
score: 0

http://stackoverflow.com/a/22383997
has body: Here is how you do it when using Java 7: final Path src = Paths.get("C:\\test\\utf-8.txt"); final Path dst = Paths.get("C:\\test\\Cp1250.txt"); try ( BufferedReader reader = Files.newBufferedReader(src, StandardCharsets.UTF_8); BufferedWriter writer = Files.newBufferedWriter(dst, Charset.forName("windows-1252")); ) { String line; while ((line = reader.readLine()) != null) { writer.write(line); writer.newLine(); } writer.flush(); }
upvote count: 1
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22383333

http://stackoverflow.com/a/22468016
has comment: http://stackoverflow.com/comment/34178305
has comment: http://stackoverflow.com/comment/34178162
has comment: http://stackoverflow.com/comment/34177438
type: Answer
accepted answer of: http://stackoverflow.com/q/22467906
score: 3
answers question: http://stackoverflow.com/q/22467906
has comment: http://stackoverflow.com/comment/34177380
upvote count: 3
has body: Use getInputMap(WHEN_IN_FOCUSED_WINDOW) to remove any focus related issues... Make sure you are calling addKeyListener() so that the key bindings are registered. DON'T call Thread.sleep from within the Event Dispatching Thread In fact, this looks suspicious... public void run() { for(;;){ try{ frame.repaint(); Thread.sleep(40); }catch(Exception e){e.toString();} } } Seen as you're not actually updating the state of anything, all it is doing is sucking up CPU cycles which could be put to better use... Additional... Because you never add BasicRobot to anything that is displayed (like a window), it never registers it's listeners into the Event Queue, meaning, the key bindings will never work. Instead of extending BasicRobot from JComponent, you should simply not extend it from anything, there is no benifit been gained. Instead, register the key binding to the World and call BasicRobot#move from there For example...sorry, I might have your code backwards a little, but the basic idea is there.. import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.KeyStroke; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.border.LineBorder; public class World extends JPanel implements Runnable { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } new World(new BasicRobot(0, 0, BasicRobot.FACING.SOUTH…
has comment: http://stackoverflow.com/comment/34177286
has comment: http://stackoverflow.com/comment/34177082
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34177027
downvote count: 0

http://stackoverflow.com/comment/34033830
has text: Just a suggestion. The -cp argument on command line must point to the full path of the driver jar . Like -cp c:\jars\driverjar.jar;.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22384781
type: AnswerComment

http://stackoverflow.com/q/22474299
has comment: http://stackoverflow.com/comment/34189163
has answer: http://stackoverflow.com/a/22841827
answer count: 1
downvote count: 1
has title: Getting error while running jess in java program.
favorite count: 0
tagged with: jess
has comment: http://stackoverflow.com/comment/34197266
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34187087
type: Question
has comment: http://stackoverflow.com/comment/34187690
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/34189090
has body: I got error While running the jess in java program like error: package jess does not exist I don't know what and all packages to be included. I have written code like this: import jess.*; public class ExQuery { public static void main(String[] argv) throws JessException { Rete engine = new Rete(); engine.batch("query.clp"); engine.reset(); QueryResult result = engine.runQueryStar("search-by-name", new ValueVector().add("Smith")); while (result.next()) { System.out.println(result.getString("fn") + " " + result.getString("ln") + ", age" + result.getInt("age")); } } }

http://stackoverflow.com/comment/34043809
comment on: http://stackoverflow.com/q/22388889
type: Comment
type: QuestionComment
has text: I think I've found the solution, but I'm only partially sure of the cause. I changed my annotation to @Path("mailbox/{mailbox}") by adding the "mailbox/" in the event that there was a conflict with another endpoint and now it works. I mistakenly thought that because my parameter names were different and my variable datatype was different from my other @GET endpoints that I was okay but neither of those criteria would be known to HTTP.
score: 0

http://stackoverflow.com/comment/34173223
type: AnswerComment
has text: You already have an `update`method, pass new a color parameter with the `x` and `y`, or create a new method `updateColor(Color c)`
type: Comment
comment on: http://stackoverflow.com/a/22466000
score: 0

http://stackoverflow.com/q/22449097
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34147126
type: Question
has answer: http://stackoverflow.com/a/22450619
has body: I am getting an exception when i am trying to execute the following code. Can anyone please solve the problem? String url = "http://localhost:8080/Pack_Server/PredictedServices.jws"; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(url)); call.setOperationName(new QName("retriveData")); Vector recVector = (Vector) call.invoke(new Object[]{category, inpquery}); Following is the exception that i am getting when i run this code. {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 1; Content is not allowed in prolog. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:441) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1388) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:998) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210) at com.sun.…
tagged with: java-web-start
has comment: http://stackoverflow.com/comment/34145721
score: 0
has comment: http://stackoverflow.com/comment/34144414
has title: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString:
answer count: 1

http://stackoverflow.com/comment/34156009
has text: The code was supposed to be temp = (Object)temp;
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22456410

http://stackoverflow.com/a/22415642
has comment: http://stackoverflow.com/comment/34084061
has comment: http://stackoverflow.com/comment/34083948
has body: In Java 8, Interfaces can now have default methods which are actually implemented. This was done to help avoid problems for users who implement an Interface that has had a change made to it, so they don't have to update all of their classes. You add this functionality by adding the default keyword to your method signature. See The Java Tutorials
has comment: http://stackoverflow.com/comment/34084141
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22415597
accepted answer of: http://stackoverflow.com/q/22415597
type: Answer

http://stackoverflow.com/comment/33945633
comment on: http://stackoverflow.com/a/22336064
has text: Good point. But why I have - `Request fields: null null null null null` before I try to process any request any parameters?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22457152
score: 1
tagged with: java
has body: I'm having issues tying to figure why I'm getting a StackOverFlow Exception on this line of code: mPassword.setText(phone); I am trying to format a number while the user is typing it in and taking the formatted number and setting it to the EditText widget. How can I get around or fix this issue? Here is the code: @Override public void onTextChanged(CharSequence s, int start, int before, int count) { //Toast.makeText(getApplicationContext(), "In onTextChanged() Method", Toast.LENGTH_SHORT).show(); if (s.length() != 0) { switch (et.getId()) { case R.id.etUsername: { } break; case R.id.etPassword: { phone = formatPhoneNumber(phone); Log.i("PHONE", "Phone NUMB IS:"+phone); mPassword.setText(phone); //THE ERROR HAPPENS HERE } } } } public String formatPhoneNumber(String phoneNumber) { Toast.makeText(getApplicationContext(), "In formatPhoneNumber() Method", Toast.LENGTH_SHORT).show(); final StringBuffer sbPhone = new StringBuffer(phoneNumber); if (sbPhone.length() == 9) { //phoneNumber.substring(8, '-'); //phoneNumber.insert(8, '-'); if (sbPhone.indexOf("-") == -1) { sbPhone.insert(8, "-"); } } else if (sbPhone.length() == 8) { //phoneNumber.replace("-", ""); if (sbPhone.indexOf("-") != -1) { sbPhone.delete(sbPhone.indexOf("-"), sbPhone.indexOf("-")); } } } Here is the error: 03-17 09:16:42.844: E/AndroidRuntime(22047): FATAL EXCEPTION: main 03-17 09:16:42.844: E/AndroidRuntime(22047): java.lang.StackOverflowError 03-17 09:16:42.844: E/AndroidRuntime(22047): at android.text.SpannableStringBuilder.getChars(SpannableStringBuilder.java:913) 03-17 09:16:42.844: E/AndroidRuntime(22047): at android.text.TextUtils.getChars(TextUtils.java:81) 03-17 09:16:42.844: E/AndroidRuntime(22047): at android.text.method.ReplacementTransformationMethod$ReplacementCharSequence.getChars(ReplacementTransformationMethod.java:151) 03-17 09:16:42.844: E/AndroidRuntime(22047): at android.text.TextUtils.getChars(TextUtils.java:81) 03-17 09:16:42.844: E/AndroidRuntime(22047): at android.text.Measured…
has answer: http://stackoverflow.com/a/22457272
type: Question
has answer: http://stackoverflow.com/a/22457333
has title: EditText - setText() Method Not Working - StackOverFlow Exception
has answer: http://stackoverflow.com/a/22457284
answer count: 6
has answer: http://stackoverflow.com/a/22457328
has answer: http://stackoverflow.com/a/22457624
has answer: http://stackoverflow.com/a/22457262
upvote count: 1
has comment: http://stackoverflow.com/comment/34156936
favorite count: 0
has comment: http://stackoverflow.com/comment/34157082
type: UnansweredQuestion
tagged with: android
tagged with: android-edittext
downvote count: 0

http://stackoverflow.com/a/22398325
answers question: http://stackoverflow.com/q/22398119
upvote count: 1
score: 1
downvote count: 0
type: Answer
has body: One reason -- it makes it easier to swap out implementations. Suppose you want to use a TreeMap instead of HashMap, so you can print the telephone numbers in order. Or maybe you want to use a LinkedList instead of ArrayList so you can insert/delete/sort more quickly. If you use the interface version (Map and List), then you would only have to make these changes in one place, where you constructed the data structures.

http://stackoverflow.com/q/22417504
tagged with: addition
upvote count: 1
has title: reading a hand of cards and adding points
has comment: http://stackoverflow.com/comment/34087656
has comment: http://stackoverflow.com/comment/34087224
score: 1
tagged with: java
has body: I am a newbie and i am having some problems with structuring a solution to my new assignment. I cant figure out how add the points based on the number of cards in a suit which is the void,singleton and doubleton part of the question. I have posted the whole questions here. Can anyone please give me some ideas? I will be grateful. In a card game, each player's hand is made up of 13 cards. Each hand has a total point value determined by the number of cards that have a point value. The cards which are worth points are the Ace (4 points), King (3 points), Queen (2 points) and Jack (1 point). The other cards (2, 3, 4, 5, 6, 7, 8, 9, 10) have no point value. There are four of each type of card, one in each of the four suits. The suits are called clubs (C), diamonds (D), hearts (H), and spades (S). As well, points are assigned for each suit which has a void (3 points), a singleton (2 points), or a doubleton (1 point). A void in a suit means that there are no cards of that suit (e.g. a hand with no spades). A singleton in a suit means that there is only one card in that suit (e.g. a hand with only one diamond). A doubleton in a suit means that there are only two cards in that suit. Write a program to read a set of thirteen cards in the form of a string, then evaluate the number of points in the hand. The suits will appear in increasing alphabetical order. Within each suit there will be no duplicate cards. The output is to be the hand and the point value shown in a table form as below. Your output should list the cards in the same order as the input. Note that 10 is represented by the character T in both the input and the output. Input is from the keyboard, output to the screen. Sample session Enter cards: C258TJKD69QAHSTJA Cards Dealt Points Clubs 2 5 8 T J K 4 Diamonds 6 9 Q A 6 Hearts 3 Spades T J A 5 Total 18 this is what i have done so far: I cant figure out how to break my input into individual suits so that i can count the number of cards per suite and add to the poin…
type: Question
has comment: http://stackoverflow.com/comment/34087367
tagged with: split
has comment: http://stackoverflow.com/comment/34087294
has comment: http://stackoverflow.com/comment/34087786
has answer: http://stackoverflow.com/a/22417684
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34087865
type: UnansweredQuestion

http://stackoverflow.com/q/22433135
tagged with: qt
tagged with: c++
has comment: http://stackoverflow.com/comment/34114568
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22441397
has title: Does language bindings for Qt reimplement Qt modules in the specific language?
has comment: http://stackoverflow.com/comment/34114513
linked to: http://stackoverflow.com/q/4546941
has comment: http://stackoverflow.com/comment/34115018
answer count: 2
linked to: http://stackoverflow.com/q/20822214
tagged with: qt-jambi
tagged with: pyqt
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34114623
has comment: http://stackoverflow.com/comment/34114601
has body: I wanted to know if the language bindings for Qt like Qt Jambi and PyQt have implemented all of the Qt modules or not. i.e. whether they are just a means of combining target languages (JAVA, python,...) with Qt C++ modules or the target languages work with the modules implemented with the target language. e.g. a simple question is: Does Qt Jambi work with Qt modules written in Java? (If yes, could we write Qt Jambi applications which are able to run in different platforms? i.e. Are all Qt Jambi modules some jar files?)
has answer: http://stackoverflow.com/a/22433271
has comment: http://stackoverflow.com/comment/34114630

http://stackoverflow.com/a/37452181
has body: I had the same problem. I just had to modify the web.xml. Previously in my web.xml file param-value was com.two95.restful.resource I just changed to root package com.two95.restful. Then it started working like a charm with just the @Provider annotation. Jersey Web Application org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages com.two95.restful 1
type: Answer
answers question: http://stackoverflow.com/q/22413239
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/33981042
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22353784
score: 0
has text: If one of you turns their comment into an answer I will accept it. Otherwise I'll except my own answer.

http://stackoverflow.com/comment/60423882
score: 0
type: Comment
has text: This should be marked as the solution. I've spent the better half of a day trying to figure this out!! Turns out that the headers of the inbound message specified an EXCHANGE_NAME which I then believe is overriding the exchange specified in the outbound message URN.
type: AnswerComment
comment on: http://stackoverflow.com/a/22503750

http://stackoverflow.com/comment/34096458
comment on: http://stackoverflow.com/q/22422806
score: 0
type: Comment
type: QuestionComment
has text: I am using that way because I want the JPanels to be 100% wide. If I just put it SOUTH in a BorderLayout, it would not get 100% width while having the height dynamic. But then again, I am new to Java :)

http://stackoverflow.com/q/22427063
answer count: 1
tagged with: mergesort
score: 0
has comment: http://stackoverflow.com/comment/34104179
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34111205
has body: This is a multi-threaded mergesort program. The first round of threads sort their individual parts of the array and after this they need to start joining together (ie. thread 1 joins thread 0 and thread 0 merges them together). I do not know how to get the endRow from thread 1 and pass it to thread 0 so that it can merge. Here is what i have so far: makes all the threads: public static void sort(int[] X, int numThreads){ int n = X.length/numThreads; for(int i = 0; i &lt; numThreads; i++){ Thread t = new Thread(new worker(X, i*n, (i+1)*n-1)); t.start(); threadPool.add(t); } try{ for(int i = 0; i &lt; numThreads; i++){ threadPool.get(i).join(); } } catch(InterruptedException e){ e.printStackTrace(); } } This is what the thread runs: public void run(){ if(flag == false){ Arrays.sort(sorted, startRow, endRow); flag = true; } else{ merge(); sorted = Arrays.copyOfRange(finalArray, startRow, endRow); } } public void merge(){ int n = (endRow - startRow)/2 + startRow; int i=startRow,j=n+1,k=startRow; for(; i&lt;n &amp;&amp; j&lt;endRow;++k){ if( sorted[i] &lt;= sorted[j] ) finalArray[k]=sorted[i++]; else finalArray[k]=sorted[j++]; } while(i&lt;n) finalArray[k++]=sorted[i++]; while(j&lt;endRow) finalArray[k++]=sorted[j++]; }
has title: Java threads reassigning a local thread variable from another thread
tagged with: java
has answer: http://stackoverflow.com/a/22427452
type: Question
has comment: http://stackoverflow.com/comment/34104226

http://stackoverflow.com/q/22460089
tagged with: java
has title: Integrating backend code (Java, Python) with HTML
upvote count: 1
has body: I'm experienced with back-end code with languages such as Java and Python but for an upcoming project, I need to integrate this code to a website. The backend code will be a bunch of methods and classes that will be able to encrypt text messages with encryption such as AES. For this project, this system must be implemented on the web. I've been reading around and asked some people and it seems there are ways to use this Python or Java code on a webpage without having to rewrite it in something like PHP. I've seen some things like Django but I'm not sure what would be the best option for this project. The webpage will simply do the following: User selects an encryption type, gives key, and their message. This message is then encrypted using their choice of key and encryption. Suppose the encryption methods are already ready, how would I be able to connect the input on the webpage (text field, drop down menu, and button click) to my program and call the appropriate functions and display the returned values? I'm sure this is possible but I'm not sure which option would be best for this task. Thanks.
accepted answer: http://stackoverflow.com/a/22460376
type: Question
has comment: http://stackoverflow.com/comment/34162419
answer count: 1
downvote count: 0
tagged with: web
score: 1
favorite count: 0
tagged with: encryption
tagged with: http://stackoverflow.com/tag/html
tagged with: python
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22460376

http://stackoverflow.com/q/22436231
type: Question
has answer: http://stackoverflow.com/a/22436278
tagged with: arrays
accepted answer: http://stackoverflow.com/a/22436275
score: 0
possible better answer: http://stackoverflow.com/a/22436262
has answer: http://stackoverflow.com/a/22436262
has answer: http://stackoverflow.com/a/22436617
has body: I got a array of objects. From another method i want to print one object from the array, the input to this method must be an integer, that represent the index of the object in the array. I can't reach the array from printObject(). How do i do this? public static void main(String[] args) { Object []obj = new Object[2]; printObject(1); } public static void printObject(int i){ if (i == 0){ System.out.println(obj[0].toString()); } if (i == 1){ Systen.out.println(obj[1].toString()); } }
answer count: 5
has answer: http://stackoverflow.com/a/22436324
has title: Print specific array object with method
has answer: http://stackoverflow.com/a/22436275
tagged with: object
type: AnsweredQuestion
tagged with: java
tagged with: methods

http://stackoverflow.com/a/22366362
has body: The number of bytes in an HTTP response stream is not 'undefined'. See the RFC. It is defined by either: EOS in the case of a connection which is closed (HTTP 1.0 or Connection: close), The Content-Length header, or The result of decoding the chunked-encoding format. It is essential that it be defined in one of these ways, and maybe there are others, so that HTTP persistent connections can work, where there may be another response following this one. I would like to know why you are implementing this at all, when the HttpURLConnection class already exists, along with various third-party HTTP clients, which already implement all this correctly, and many other things besides.
type: Answer
answers question: http://stackoverflow.com/q/22366301
upvote count: 1
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/34009021
has comment: http://stackoverflow.com/comment/34049923

http://stackoverflow.com/q/22343975
has comment: http://stackoverflow.com/comment/33959562
accepted answer: http://stackoverflow.com/a/22344312
score: 0
has comment: http://stackoverflow.com/comment/33959489
answer count: 2
has title: Java Error: Unreported exception?
tagged with: java
has comment: http://stackoverflow.com/comment/33959449
has comment: http://stackoverflow.com/comment/33959308
has answer: http://stackoverflow.com/a/22344018
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22344312
tagged with: custom-exceptions
possible better answer: http://stackoverflow.com/a/22344018
has body: I've got the following method: public T peek() throws StackEmptyException { Node&lt;T&gt; tracker = head; while(tracker.getNext() != null) { tracker = tracker.getNext(); } return tracker.getItem(); } The problem is that when I try to do something like int firstOne = stack.peek(); I get an unreported exception StackEmptyException and I have no idea what I'm doing wrong at this point. The StackEmptyException has been made in a separate class. Am I suppose to have this class extend that new exception class I made? So confused. Thoughts guys?
type: Question
has comment: http://stackoverflow.com/comment/33959587
has comment: http://stackoverflow.com/comment/33959409
tagged with: generics

http://stackoverflow.com/a/22359474
has body: If your ball2.x and x are both integers, then when they are within 1 unit of each other, x - x can round to 0 because you are still doing integer math. You should cast them as floats before you subtract them. then do the math. This goes the same for ball2.y and y.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22359226
has comment: http://stackoverflow.com/comment/33986071
has comment: http://stackoverflow.com/comment/33986205

http://stackoverflow.com/comment/34109351
score: 0
type: Comment
has text: And what I propose is rather lightweight, and the part you skip is a really thin UI layer which I find acceptable. I also think that in my approach the test remains readable, while your approach adds a lot of code. And to conclude ... I haven't tested this out in code but I think with the `SecondaryLoop` mechanism introduced in JDK7, you might be able to dispose of the dialog on the EDT (although I doubt that having a second EDT and accessing the dialog from it is more safe then your approach)
comment on: http://stackoverflow.com/a/22417536
type: AnswerComment

http://stackoverflow.com/q/22406321
has answer: http://stackoverflow.com/a/22459844
tagged with: ojdbc
has comment: http://stackoverflow.com/comment/34150018
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/34159217
has body: I'm trying to find a explanation why Oracle driver, by default, escapes end-line character "\n" to a escaped string "\\n", that makes the "\n" to show up when I print it. I'd also like to get some suggestions on how to deal with it in a elegante way besides simply replacing "\\n" to "\n" before printing it. extra info: - Oracle driver: ojdbc6.jar - Java 1.6.0_18 and 1.7.0_45 Example: - DB "column1" data = line1\nline2\nline3 java.sql.PreparedStatement stmt = conn.prepareStatement("SELECT column1 FROM TABLE1"); java.sql.ResultSet rs = stmt.executeQuery(); while (rs.next()) { rs.getString(1); // it returns line1\\nline2\\nline3 } Appreciate any help, Cheers
type: AnsweredQuestion
has title: Oracle JDBC driver escapes \n to \\n at time to select data
tagged with: java
has comment: http://stackoverflow.com/comment/34205111
type: Question
has comment: http://stackoverflow.com/comment/34067860
has comment: http://stackoverflow.com/comment/34071242
score: 0
has comment: http://stackoverflow.com/comment/34070570
accepted answer: http://stackoverflow.com/a/22459844
tagged with: jdbc
answer count: 1
has comment: http://stackoverflow.com/comment/34149203

http://stackoverflow.com/q/22428454
tagged with: java
has title: canvas java without extends
type: Question
tagged with: graphics
score: 0
tagged with: canvas
has comment: http://stackoverflow.com/comment/34107676
tagged with: extends
has comment: http://stackoverflow.com/comment/34106152
has body: I'm trying to do a canvas object... is homework.. but I want to make a object Canvas obj=new Canvas(); but i can't draw.. package canvasobjeto; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.awt.image.BufferedImage; /** * * @author Robin */ public class CanvasObjeto { JFrame Frame=new JFrame(); public CanvasObjeto() { Frame.setTitle("CanvasObjeto"); Frame.setName("CanvasObjeto"); Frame.setSize(300, 300); Frame.setResizable(false); Frame.setUndecorated(false); Frame.setLayout(null); Frame.setLocationRelativeTo(null); Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Frame.getContentPane().setBackground(Color.WHITE); Formato(); Frame.setVisible(true); } private void Formato() { Canvas lien=new Canvas(); Graphics g= lien.getGraphics(); g.drawLine(0, 0, 20, 20); lien.setBounds(0, 0, 200, 200); lien.setBackground(Color.red); lien.repaint(); Frame.add(lien); } public static void main(String[] args) { CanvasObjeto Ventana=new CanvasObjeto(); } } this is the error... i don't know why says that if i making the obj.. Exception in thread "main" java.lang.NullPointerException at canvasobjeto.CanvasObjeto.Formato(CanvasObjeto.java:43)
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22439231
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: Go to Twitter Application Management Page - Select the App which you have created - Click API Keys Tab. Now, Click Create My Access Token to generate Access Token and Access Token Secret.
accepted answer of: http://stackoverflow.com/q/22419032
answers question: http://stackoverflow.com/q/22419032
upvote count: 1

http://stackoverflow.com/comment/51854487
score: 0
type: Comment
has text: I never would have looked under `Project Structure`. Way to go, IntelliJ
type: AnswerComment
comment on: http://stackoverflow.com/a/22392702

http://stackoverflow.com/comment/34175162
comment on: http://stackoverflow.com/q/22467153
score: 0
type: Comment
type: QuestionComment
has text: Put your `System.out.println(binarySearch(num,search))` after you read in the input.

http://stackoverflow.com/comment/34110675
has text: Then what purpose does your answer serve?
score: 0
comment on: http://stackoverflow.com/a/22430822
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34038511
has text: I think my ProductFieldSetMapper needs to extend the spring version of FieldSetMapper rather than the interface I wrote. Any idea on how to do that? Would I just delete my own interface and import the one provided by spring before calling 'implements'?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22389483

http://stackoverflow.com/q/22476972
has answer: http://stackoverflow.com/a/22477187
accepted answer: http://stackoverflow.com/a/22477084
tagged with: java
upvote count: 1
has body: I am trying to create following table, but i continiously getting error. It is seems for me that Java Db tries to parse "create table ORDER" as "ORDER BY". I lso tried to type "CREATE TABLE" but, as expected, no result. How it is possible to solve that problem? public void createTable() throws SQLException { String createString = "create table ORDER " + "(ORDER_ID int NOT NULL, " + "ORDER_NUMBER int NOT NULL, " + "PERSON_ID int NOT NULL, " + "PRIMARY KEY (ORDER_ID), " + "FOREIGN KEY (PERSON_ID) REFERENCES PERSON (PERSON_ID))"; Statement stmt = null; System.out.println(createString); try { DatabaseMetaData meta = con.getMetaData(); ResultSet tables = meta.getTables(null, null, "ORDER", new String[] { "TABLE2" }); int size = 0; while (tables.next()) { size++; } if (size == 0) { System.out.println("table created"); stmt = con.createStatement(); stmt.executeUpdate(createString); } } catch (SQLException e) { System.out.println("No connection"); e.printStackTrace(); // TODO make exeption } finally { if (stmt != null) { stmt.close(); } } } error java.sql.SQLSyntaxErrorException: Syntax error: Encountered "ORDER" at line 1, column 14. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source) at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown Source) at com.tuto.p4.OrderTable.createTable(OrderTable.java:38) at com.tuto.p4.Main.main(Main.java:18) Caused by: java.sql.SQLException: Синтаксическая ошибка: Encountered "ORDER" at line 1, column 14. at org.apache.derby.impl.j…
has answer: http://stackoverflow.com/a/22477084
type: AnsweredQuestion
tagged with: sql
downvote count: 0
score: 1
favorite count: 0
has title: Syntax error while created sql table
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22477187

http://stackoverflow.com/q/22329765
tagged with: import
has title: How to mark the output and remove zeros?
has answer: http://stackoverflow.com/a/22330181
tagged with: random
type: AnsweredQuestion
tagged with: arrays
tagged with: return
has answer: http://stackoverflow.com/a/22329881
type: Question
accepted answer: http://stackoverflow.com/a/22330181
possible better answer: http://stackoverflow.com/a/22329881
has body: This is a program to simulate rolling a dice 20 times and marking the most consecutive number, a dice doesn't have 0 which I don't know how to remove, I'm new to java package diceroll; import java.util.Random; public class Roll { //public static void main(String[] args) { private static Random generator = new Random(); public static int[] randomIntArray(int length, int n) { int [] ems = new int [length]; for (int i = 0; i &lt;ems.length; i++) ems[i] = generator.nextInt(n); return ems; } } package diceroll; import java.util.Arrays; public class Dice { public static void main(String[] args) { int[] ems = Roll.randomIntArray(20,7); System.out.println(Arrays.toString(ems)); } } When it prints it prints something like this: [4, 2, 2, 5, 2, 0, 5, 0, 5, 5, 1, 3, 3, 3, 1, 4, 3, 1, 4, 4] How can I make the code not generate zeros and mark the most consecutive numbers like this: [4, 2, 2, 5, 2, 0, 5, 0, 5, 5, 1, (3, 3, 3), 1, 4, 3, 1, 4, 4]
score: 0
tagged with: java
answer count: 2

http://stackoverflow.com/comment/34044291
comment on: http://stackoverflow.com/a/22389002
type: AnswerComment
has text: I have added an image of what my DB table looks like.
score: 0
type: Comment

http://stackoverflow.com/comment/94803606
has text: FYI, the terribly troublesome old date-time classes such as [`java.util.Date`](https://docs.oracle.com/javase/10/docs/api/java/util/Date.html), `java.sql.Date`, and `java.text.SimpleDateFormat` are now [legacy](https://en.wikipedia.org/wiki/Legacy_system), supplanted by the [*java.time*](https://docs.oracle.com/javase/10/docs/api/java/time/package-summary.html) classes built into Java 8 and later. See [*Tutorial* by Oracle](https://docs.oracle.com/javase/tutorial/datetime/TOC.html).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22397367

http://stackoverflow.com/q/22438999
tagged with: java
has title: Could not create the Java Virtual Machine when running with ShellExecuteA
type: Question
has comment: http://stackoverflow.com/comment/34125237
has body: I'm trying to make a (modded) Minecraft custom launcher and I've got a problem with launching java with special command. I'm using: ShellExecuteA(NULL, string("open").c_str(), bity.c_str(), launch.c_str(), NULL, SW_RESTORE); Where "bity" is path to Javaw: C:\Windows\System32\javaw.exe and "launch" is a loong parameter: http://pastebin.com/T0knTfzE (seriously, it's very long). And the point is that when I'm launching it with ShellExecuteA, Java shows "Could not create the Java Virtual Machine." BUT when i'm running that command (bity+launch) outside my program in cmd.exe it works! Please, help me! EDIT: --- OS: Windows 7 x64 --- RAM: 8GB --- Java 7 version 51 (newest)
tagged with: visual-c++
has comment: http://stackoverflow.com/comment/34125943
upvote count: 1
has comment: http://stackoverflow.com/comment/34125335
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34125142
tagged with: shellexecute
downvote count: 0
score: 1

http://stackoverflow.com/q/22453073
type: Question
has comment: http://stackoverflow.com/comment/34157493
score: 1
tagged with: java
tagged with: oracle10g
has comment: http://stackoverflow.com/comment/34154165
has title: exception exception while using schemaCrawler
has body: I got this exception while using schemaCrawler with Oracle Database 10g, does anyone know what did that mean? Avertissement: JDBC driver does not support retrieving functions java.lang.AbstractMethodError: oracle.jdbc.driver.OracleDatabaseMetaData.getFunctions(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/sql/ResultSet; at schemacrawler.crawl.RoutineRetriever.retrieveFunctions(RoutineRetriever.java:159) at schemacrawler.crawl.SchemaCrawler.crawlRoutines(SchemaCrawler.java:178) at schemacrawler.crawl.SchemaCrawler.crawl(SchemaCrawler.java:457) at work.SchemaCrawlerUtility.getDatabase(SchemaCrawlerUtility.java:20)
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: schemacrawler
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/34171510

http://stackoverflow.com/comment/36193487
has text: np, found it myself too :)
comment on: http://stackoverflow.com/q/22427683
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34103532
has text: FYI this is a *horribly inefficient* way to reverse a string. It has to do a string concatenation (which constructs a new string object) at each level of the recursion. Using a `StringBuilder` would be much more efficient.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22427022

http://stackoverflow.com/a/22394392
answers question: http://stackoverflow.com/q/22394022
score: 2
has body: LinkedList means, there are some nodes connected like below diagram. It can be connected one way or double way. Your first class have the member variable nextLink to have the connection with next node. But the second class doesn't has the way to link with another node. For doubly linked-list, it has 2 member variables to connect with previous node and next node.
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/34175869
has text: `Gen2<?>` is very much different than `Get2<Object>`. Also, not all generic information is lost at run time.
type: AnswerComment
comment on: http://stackoverflow.com/a/22467462
score: 0
type: Comment

http://stackoverflow.com/q/22433035
has answer: http://stackoverflow.com/a/22433064
score: 1
has answer: http://stackoverflow.com/a/22433083
favorite count: 0
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22433064
has body: Setup So I have two exceptions: ProfileException extends Exception UserException extends Exception One of my helper class method throws these two exceptions togeather: Long getSomething() throes ProfileException, UserException I invoke this method inside a try catch block like this. try { Long result = helperObj.getSomething(); } catch(ProfileException pEx) { //Handle profile exception } catch(UserException uEx) { //Handle user exception } Question Now I NEED to necessarily distinguish between those two exceptions thrown by the method and handle the exceptions separately depending on the type of exception being thrown. However I get the following error. Unreachable catch block for UserException. It is already handled by the catch block for ProfileException. How can I distinguish and handle seperately depending on the type of exception thrown by that getSomething() method?
tagged with: java
has comment: http://stackoverflow.com/comment/34114362
tagged with: unreachable-code
type: Question
has title: Unreacheable Catch Block Issue
downvote count: 0
has comment: http://stackoverflow.com/comment/34114380
has comment: http://stackoverflow.com/comment/34114387
has answer: http://stackoverflow.com/a/22433093
tagged with: exception
answer count: 3
possible better answer: http://stackoverflow.com/a/22433083

http://stackoverflow.com/q/22373843
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34010756
has comment: http://stackoverflow.com/comment/34010936
upvote count: 2
has comment: http://stackoverflow.com/comment/34010832
has comment: http://stackoverflow.com/comment/34010766
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34010706
has title: Java objects compare with null cases?
has answer: http://stackoverflow.com/a/22373876
accepted answer: http://stackoverflow.com/a/22373876
has body: Is there any ready implementation of method public static boolean equals(Object o1, Object o2) { return o1==null &amp;&amp; o2==null || o1!=null &amp;&amp; o2!=null &amp;&amp; o1.equals(o2); } somewhere in JRE/JDK?

http://stackoverflow.com/a/22396873
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22396844
has body: you might have updated the variable name from employee to employeeName the code should be this.employeeName = employeeName

http://stackoverflow.com/q/22424869
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5695387
linked to: http://stackoverflow.com/q/5600051
linked to: http://stackoverflow.com/q/5668132
has body: I am new to java and am getting to the advanced level of it, i have a problem in the GUI Controls, i made a button that when clicked opens up a new window like this: JButton b = new JButton("Open New Window"); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Window w = new Window(); w.setVisible(true); } }); this window contains other objects but i have been thinking of making the button in such a way that instead of opening a new JFrame, it opens everything in that same window without opening a new window, honestly i dont know how to do so please could i get some professional help
has answer: http://stackoverflow.com/a/22425005
score: 0
has title: Java - How to make contents of JFrame appear in the same Window instead of multiple windows
answer count: 3
tagged with: user-interface
linked to: http://stackoverflow.com/q/5414177
possible better answer: http://stackoverflow.com/a/22424901
linked to: http://stackoverflow.com/q/6893078
has answer: http://stackoverflow.com/a/22424901
tagged with: jframe
tagged with: swing
has answer: http://stackoverflow.com/a/22425094
accepted answer: http://stackoverflow.com/a/22425005
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8027849
linked to: http://stackoverflow.com/q/6811064

http://stackoverflow.com/q/22470257
has answer: http://stackoverflow.com/a/22470479
possible better answer: http://stackoverflow.com/a/22470310
type: Question
has answer: http://stackoverflow.com/a/22470310
tagged with: java
score: 0
has body: How to call a constructor with a primitive type as argument?? the class name we will get to know at runtime. Like we get to know the class name is Abc at runtime and we have to find all those constructor with int ,char,boolean as argument type in it?
answer count: 2
accepted answer: http://stackoverflow.com/a/22470479
has title: how to deal with primitive type in reflection
type: AnsweredQuestion
tagged with: reflection

http://stackoverflow.com/comment/34024700
score: 0
comment on: http://stackoverflow.com/q/22347445
type: QuestionComment
type: Comment
has text: 8000 rects isn't a lot for PC to handle, so I'm inclined to say you have too much overdraw. Yes, disabling blending will make everything opaque, but it will help tell you if your problem is overdraw.

http://stackoverflow.com/comment/33955728
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22341855
has text: So you're not changing the preferred size of the component in any way?

http://stackoverflow.com/q/22469792
score: -1
has answer: http://stackoverflow.com/a/22469855
answer count: 3
has title: How to check for divisors within an array
has answer: http://stackoverflow.com/a/22470157
has comment: http://stackoverflow.com/comment/34179561
downvote count: 1
has comment: http://stackoverflow.com/comment/34179590
has answer: http://stackoverflow.com/a/22469852
favorite count: 0
upvote count: 0
tagged with: java.util.scanner
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34179600
has comment: http://stackoverflow.com/comment/34179562
tagged with: java
has body: I have one array of n cells with cell 0 having int 0 and cell 1 with in 2 ect... [0,2,3,4,n...] My goal is to have the the user select a value(not cell #) in the array, the selected value then becomes a zero ONLY IF both of the following condition below are true: The user cannot chose a cell that is already a 0 The user cannot chose a number that does not a remaining divisor in the array. For example; the user cannot chose 3, 4 or 7 in an array containing [0,0,3,4,0,6,7,8] Any number that the user selected to be unavailable will have System.out.println ("Invalid number"); EDIT: My current problem right now is when I have [0,0,0,4,5,6] I can select 4,5 and 6 and turn it into a zero even though there is no divisor for any of these number. My try for the code, not fully working: int[] NumBox = new int[StartNum]; for (int i = 1; i &lt; NumBox.length+1; i++) {NumBox[i - 1] = i;} if (NumBox[pick-1]!= 0) { boolean hasDivisor = false; for (int k = 1; k &lt; NumBox.length+1; k++) { if (NumBox[k] == 0) continue; if (NumBox[pick-1] % NumBox[k] == 0) { hasDivisor = true; break; } } if (hasDivisor) { score1 = pick + score1; NumBox[pick-1]=0; } else System.out.println ("Invalid number"); } Thanks for any help.
type: Question
tagged with: arrays

http://stackoverflow.com/a/27454994
upvote count: 2
has body: What I did was monitor the exit status of the command executed in a loop, whenever the status is -1 (means it is still running) then I sleep the current thread, for safety it's a good idea to break when holding reach a time limit, but that's up to you. final JSch jsch = new JSch(); final Session sessionJSH = jsch.getSession(user, host, 22); sessionJSH.setPassword(pwd); final Hashtable configJSH = new Hashtable(); configJSH.put("StrictHostKeyChecking", "no"); sessionJSH.setConfig(configJSH); sessionJSH.connect(); final Channel channel = sessionJSH.openChannel("exec"); ((ChannelExec) channel).setCommand(command); channel.connect(0); // we'll hold it until 30 minutes = 30m*60s*1000ms/300ms = 6000 times int i = 0; while (channel.getExitStatus() == -1 &amp;&amp; i &lt; 6000) { log.debug("Exit status" + channel.getExitStatus()); Thread.sleep(300); i++; } log.info("Exit status" + channel.getExitStatus()); channel.disconnect(); sessionJSH.disconnect();
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22447672
accepted answer of: http://stackoverflow.com/q/22447672
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/43387010
downvote count: 0

timer
tag name: timer
tags question: http://stackoverflow.com/q/22440341
tags question: http://stackoverflow.com/q/22414217
tags question: http://stackoverflow.com/q/22451981
tags question: http://stackoverflow.com/q/22332084
tags question: http://stackoverflow.com/q/22335410
tags question: http://stackoverflow.com/q/22454019
type: Tag
tags question: http://stackoverflow.com/q/22468804
tags question: http://stackoverflow.com/q/22471121
tags question: http://stackoverflow.com/q/22384452
tags question: http://stackoverflow.com/q/22346948
tags question: http://stackoverflow.com/q/22366890
tags question: http://stackoverflow.com/q/22360471
tags question: http://stackoverflow.com/q/22428922
tags question: http://stackoverflow.com/q/22397914
tags question: http://stackoverflow.com/q/22405059
tags question: http://stackoverflow.com/q/22482196
tags question: http://stackoverflow.com/q/22347697
tags question: http://stackoverflow.com/q/22460499
tags question: http://stackoverflow.com/q/22339922

http://stackoverflow.com/comment/33991031
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22362047
has text: Then I will have a large number like "1010100111" but how can I get each byte from it like in my program?

http://stackoverflow.com/comment/34025503
comment on: http://stackoverflow.com/q/22382405
score: 0
type: Comment
type: QuestionComment
has text: Use the debugger -- put a breakpoint in your subclass `foo` method and step into the superclass method to see what is happening.

http://stackoverflow.com/comment/33977344
score: 0
type: Comment
has text: Hmm ... no that's not what I meant. I want to iterate every entry from x to y (`/header/*[@ts > x and @ts < y]`). But as the program has no idea that the timestamps are ordered it has to check every following timestamp too.
type: AnswerComment
comment on: http://stackoverflow.com/a/22354333

http://stackoverflow.com/comment/34006102
has text: If you have the source code, you can simply import the project: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-importproject.htm
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22367246

http://stackoverflow.com/comment/34172622
score: 0
type: AnswerComment
type: Comment
has text: thanks it works.. I have to keep it as multiple arrays.
comment on: http://stackoverflow.com/a/22465732

http://stackoverflow.com/a/22367629
score: 0
has comment: http://stackoverflow.com/comment/34001528
has comment: http://stackoverflow.com/comment/34001202
has comment: http://stackoverflow.com/comment/34001283
answers question: http://stackoverflow.com/q/22367564
has comment: http://stackoverflow.com/comment/34001545
has comment: http://stackoverflow.com/comment/34001025
has body: It should be in the /war directory. Check that you included the following lines in the web.xml: index.jsp
type: Answer
has comment: http://stackoverflow.com/comment/34001452

etl
tags question: http://stackoverflow.com/q/22448638
type: Tag
tag name: etl

http://stackoverflow.com/a/22430007
accepted answer of: http://stackoverflow.com/q/22429485
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22429485
has body: If you take a look at the Resources documentation you will see that the getString method strips formatting information from the String. Since Android treats HTML as styling information. If you want to return HTML from your strings file you will need to do the following; This is a test of bold Android will not strip the HTML from your text and you should get the bold HTML you are after.

http://stackoverflow.com/a/31577152
has comment: http://stackoverflow.com/comment/82940130
has comment: http://stackoverflow.com/comment/74543503
answers question: http://stackoverflow.com/q/22367223
has comment: http://stackoverflow.com/comment/69840791
has body: Oh, client side no need to known about current user, server will do that for you. On server side, using following way to send message to a user: simpMessagingTemplate.convertAndSendToUser(username, "/queue/reply", message); Note: Using queue, not topic, Spring always using queue with sendToUser On client side stompClient.subscribe("/user/queue/reply", handler); Explain When any websocket connection is open, Spring will assign it a session id (not HttpSession, assign per connection). And when your client subscribe to an channel start with /user/, eg: /user/queue/reply, your server instance will subscribe to a queue named queue/reply-user[session id] When use send message to user, eg: username is admin You will write simpMessagingTemplate.convertAndSendToUser("admin", "/queue/reply", message); Spring will determine which session id mapped to user admin. Eg: It found two session wsxedc123 and thnujm456, Spring will translate it to 2 destination queue/reply-userwsxedc123 and queue/reply-userthnujm456, and it send your message with 2 destinations to your message broker. The message broker receive the messages and provide it back to your server instance that holding session corresponding to each session (WebSocket sessions can be hold by one or more server). Spring will translate the message to destination (eg: user/queue/reply) and session id (eg: wsxedc123). Then, it send the message to corresponding Websocket session
score: 109
has comment: http://stackoverflow.com/comment/135452655
has comment: http://stackoverflow.com/comment/126353446
has comment: http://stackoverflow.com/comment/137610980
has comment: http://stackoverflow.com/comment/74542157
has comment: http://stackoverflow.com/comment/74543523
has comment: http://stackoverflow.com/comment/69798928
has comment: http://stackoverflow.com/comment/86548779
type: Answer
upvote count: 109
has comment: http://stackoverflow.com/comment/82882631
downvote count: 0

http://stackoverflow.com/q/22409597
has body: I need ebay item ID from link for my JAVA/JSP app. There are two ways extract it directly from link or Download full page and use html parser to get item ID. But downloading full page will slow my app. Is there a way to extract item ID in JAVA/JSP from link? http://www.ebay.com/itm/ASSORTED-COLORS-BACK-BATTERY-HOUSING-COVER-CASE-REPLACEMENT-FOR-IPHONE-5-/281163250779?pt=US_Cell_Phone_PDA_Cases&amp;var=580223102484&amp;hash=item4176a2bc5b
has comment: http://stackoverflow.com/comment/34078078
favorite count: 0
tagged with: parsing
downvote count: 5
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/34073547
tagged with: java
has answer: http://stackoverflow.com/a/22412049
has comment: http://stackoverflow.com/comment/34072978
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34072631
has answer: http://stackoverflow.com/a/22450691
has title: Extract item ID from ebay link
upvote count: 1

http://stackoverflow.com/a/22363496
has comment: http://stackoverflow.com/comment/33993743
has comment: http://stackoverflow.com/comment/33994942
has comment: http://stackoverflow.com/comment/33994117
has comment: http://stackoverflow.com/comment/33994182
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22363434
has comment: http://stackoverflow.com/comment/33995151
has body: You should get a value from gender Spinner in a following way: String gendert = gender.getSelectedItem().toString() EDIT How to set values in Spinner properly for String values: String[] myArray = {"Male", "Female"}; ArrayAdapter&lt;String&gt; myAdapter = new ArrayAdapter&lt;&gt;(this, android.R.layout.simple_spinner_item, myArray); gender.setAdapter(myAdapter);

http://stackoverflow.com/q/22468236
tagged with: spring
tagged with: quartz-scheduler
upvote count: 1
answer count: 1
tagged with: job-scheduling
tagged with: java
has answer: http://stackoverflow.com/a/28760328
has title: Trouble running nested jobs in quartz
type: UnansweredQuestion
downvote count: 0
has body: I'm using Quartz 1.8 to write some code that runs a job on a daily/weekly/monthly basis. When that job runs it should create a nested job. For some reason though, neither the nested JobDetail nor Trigger wind up with entries in the database, nor do they run. Here's the example I'm working with: public class QuartzSSCCE { private static Logger LOG = Logger.getLogger(QuartzSSCCE.class); private static long counter = 0L; private static Scheduler scheduler; public void scheduleOuterJob(){ try{ LOG.info("About to try to schedule OuterJob"); CronTrigger ct = new CronTrigger("OuterJobTrigger" + counter++, "OuterJobGroup", "30 * * ? * *"); ct.setStartTime((new DateTime(new Date())).plusSeconds(3).toDate()); DateTime endTime = new DateTime(new Date()); endTime = endTime.plusMinutes(5); ct.setEndTime(endTime.toDate()); JobDetail jd = new JobDetail("OuterJobDetail" + counter++, "OuterJobGroup", OuterJob.class); scheduler.scheduleJob(jd, ct); } catch (Exception e){ LOG.fatal("something went wrong while scheduling the outer job", e); } } public static class OuterJob implements Job { @Override public void execute(JobExecutionContext context) throws JobExecutionException { try{ LOG.info("running OuterJob"); //Trigger trigger = TriggerUtils.makeImmediateTrigger("InnerTriggerName" + counter++, 1, 1); SimpleTrigger simpleTrigger = new SimpleTrigger( "InnerTriggerName" + counter++, "InnerTriggerGroup", (new DateTime(new Date())).plusSeconds(10).toDate(), (new DateTime(new Date()).plusSeconds(50)).toDate(), 1, 1000 ); JobDetail jd = new JobDetail("InnerJobDetail" + counter++, "InnerJobGroup", InnerJob.class); scheduler.scheduleJob(jd, simpleTrigger); } catch (Exception e){ LOG.fatal("something went wrong while scheduling the inner job", e); } } } public static class InnerJob implements Job { @Override public void execute(JobExecutionContext context) throws JobExecutionException { LOG.info("InnerJob is running. The time at the beep is: " + new Date()); } } public void setScheduler(Sched…
score: 1
favorite count: 0
tagged with: jobs
type: Question

http://stackoverflow.com/a/22396593
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/22396536
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34050621
answers question: http://stackoverflow.com/q/22396536
type: Answer
has body: Your format has several issues: SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.US); D denotes day in year, not day in month You're missing the time zone The format for month is incorrect Since you're time is in 24-hour format, you need H instead of h Refer to SimpleDateFormat documentation for information on Date and Time Patterns.

http://stackoverflow.com/q/22445992
tagged with: public
has body: I'm working on a linked list assignment for some homework and I'm having some trouble getting my ListNode class to work. Every time I compile I get this error. C:\Users\Username\Dropbox\java\ListPkg\ListNode.java:32: error: cannot find symbol node = next; ^ symbol: variable node location: class ListNode&lt;T&gt; where T is a type-variable: T extends Comparable&lt;T&gt; declared in class ListNode 1 error [Finished in 0.6s with exit code 1] Here is the code. I have no idea what I'm doing wrong, its probably an easy fix that I'm missing. package ListPkg; public class ListNode&lt;T extends Comparable &lt;T&gt;&gt; { private T data; private ListNode&lt;T&gt; nextNode; public ListNode(T object) { setData(object); setNext(null); } public ListNode(T object, ListNode&lt;T&gt; node) { setData(object); setNext(node); } public void setData(T object) { data = object; } public T getData() { return data; } public void setNext(ListNode&lt;T&gt; next) { node = next; } public ListNode&lt;T&gt; getNext() { return nextNode; } }
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22446012
tagged with: java
has comment: http://stackoverflow.com/comment/34138305
score: -1
tagged with: methods
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/34138320
tagged with: private
has title: listNode public method not accessing private data member
downvote count: 1

http://stackoverflow.com/comment/34044337
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22370321
has text: I tried it out... I'm getting the NoSuchElementException. Not sure what I'm doing wrong

http://stackoverflow.com/comment/119789656
has text: Where is R.id.MyFragment being defined?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/65675217

http://stackoverflow.com/q/22481811
downvote count: 0
tagged with: bufferedreader
tagged with: mappedbytebuffer
has comment: http://stackoverflow.com/comment/34200927
tagged with: bytebuffer
favorite count: 0
has comment: http://stackoverflow.com/comment/34199792
has comment: http://stackoverflow.com/comment/34199704
has comment: http://stackoverflow.com/comment/34201656
possible better answer: http://stackoverflow.com/a/22482094
accepted answer: http://stackoverflow.com/a/22481994
answer count: 5
has comment: http://stackoverflow.com/comment/34199720
has answer: http://stackoverflow.com/a/77242885
has comment: http://stackoverflow.com/comment/34200760
has comment: http://stackoverflow.com/comment/34200062
has comment: http://stackoverflow.com/comment/34200802
has comment: http://stackoverflow.com/comment/34199795
has comment: http://stackoverflow.com/comment/34199898
has answer: http://stackoverflow.com/a/22481981
has answer: http://stackoverflow.com/a/22482132
upvote count: 3
has comment: http://stackoverflow.com/comment/34199562
has comment: http://stackoverflow.com/comment/34199663
has comment: http://stackoverflow.com/comment/34199891
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/22481994
has body: I'm new to java ...in my current project I need to read and write a very huge text file (1 GB - 5 GB) ... first i used this classes : BufferedReader and BufferedWriter public static String read(String dir) { BufferedReader br; String result = "", line; try { br = new BufferedReader(new InputStreamReader(new FileInputStream(dir), "UTF-8")); while ((line = br.readLine()) != null) { result += line + "\n"; } } catch (IOException ex) { //do something } return result; } public static void write(String dir, String text) { BufferedWriter bw; try { bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(dir), "UTF-8")); bw.write(""); for (int i = 0; i &lt; text.length(); i++) { if (text.charAt(i) != '\n') { bw.append(text.charAt(i)); } else { bw.newLine(); } } bw.flush(); } catch (IOException ex) { //do something } } this classes works very good but not for Huge files... then I used MappedByteBuffer for the read() method (I dont't know how to write a file using this class) : public static String read(String dir) { FileChannel fc; String s = ""; try { fc = new RandomAccessFile(dir, "r").getChannel(); MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); buffer.load(); buffer.force(); for (int i = 0; i &lt; buffer.limit(); i++) { s += (char) buffer.get(); } //I know the problem is here buffer.clear(); inChannel.close(); } catch (IOException e) { //do something } return s; } But still can't read large files(over 30-40 MB), even the NotePad is faster than my app :)) and also another problem is I don't know how to change encoding in second way(for example "UTF-8", "ANSI",...) so guys, please tell me which is the best way to read and write laaaarge files? any idea?
has comment: http://stackoverflow.com/comment/34200395
type: Question
has comment: http://stackoverflow.com/comment/34199946
has title: The best way to read a huge file (for example a very large text document)
has answer: http://stackoverflow.com/a/22482094

http://stackoverflow.com/comment/33990890
type: Comment
comment on: http://stackoverflow.com/a/22361693
has text: IE drives me crazy. Unfortunately, if I don't include the 'REQUIRE_WINDOW_FOCUS' capability, then I can't get the IEDriver to click on anything in the web app I'm testing. :-s
score: 0
type: AnswerComment

http://stackoverflow.com/a/22397602
has body: When you are using GridFS the information is stored in your MongoDB database in two collections. The first is fs.files which has the main reference to the file and fs.chunks that actually holds the "chunks" of data. See the examples Collection: fs.files { "_id" : ObjectId("53229d20f3dde871df8b89a7"), "filename" : "receptor.jpg", "chunkSize" : 262144, "uploadDate" : ISODate("2014-03-14T06:09:36.462Z"), "md5" : "f1e71af6d0ba9c517280f33b4cbab3f9", "length" : 138905 } Collection: fs.chunks { "_id" : ObjectId("53229d20824b12efe88cc1f2"), "files_id" : ObjectId("53229d20f3dde871df8b89a7"), "n" : 0, "data" : // all of the binary data } So really these are just normal MongoDB documents and normal collections. As you can see, there are various ways you can "query" these collections with the standard API: The Object Id is monotonic and therefore ever increasing. Newer entries will have a higher ObjectId value than older ones. Most importantly, the last Id that was indexed. The updloadDate also holds a general date timestamp that you can use for date range based queries. So you see, that GridFS is really just "Driver level magic" to work with ordinary MongoDB documents, and treat the binary data as a single document. As they are just normal collections with normal documents, unless you are retrieving or otherwise updating the content, then just use the normal methods to select and find.
has comment: http://stackoverflow.com/comment/34052410
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34052224
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22396822
answers question: http://stackoverflow.com/q/22396822

http://stackoverflow.com/comment/33959251
has text: You're right.. bad suggestion
comment on: http://stackoverflow.com/q/22343953
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22392732
type: Question
has title: create android geofence in background without crashing
score: 0
has body: I currently have an IntentService that receives gcm messages with lat,lng infos and I would like to register a geofence in the background without a foreground app. I already tried putting the working (in an activity) code into the IntentService but I get a nullpointerexception and I have no idea why. @Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); String messageType = gcm.getMessageType(intent); if (!extras.isEmpty()) { Double lat = Double.parseDouble(extras.getString("lat")); Double lng = Double.parseDouble(extras.getString("lng")); Float radius = Float.parseFloat("600"); createGeofences(lat,lng,radius); } } GcmBroadcastReceiver.completeWakefulIntent(intent); } public void createGeofences(Double lat, Double lng, Float radius) { mRequestType = GeofenceUtils.REQUEST_TYPE.ADD; SimpleGeofence mGeofence = new SimpleGeofence( "1", lat, lng, radius, GEOFENCE_EXPIRATION_IN_MILLISECONDS, Geofence.GEOFENCE_TRANSITION_ENTER); // Store this flat version in SharedPreferences //mPrefs.setGeofence("1", mGeofence); /* * Add Geofence objects to a List. toGeofence() * creates a Location Services Geofence object from a * flat object */ mCurrentGeofences.add(mGeofence.toGeofence()); try { mGeofenceRequester.addGeofences(mCurrentGeofences); } catch (UnsupportedOperationException e) { Toast.makeText(this, R.string.add_geofences_already_requested_error, Toast.LENGTH_LONG).show(); } this is the error message: java.lang.NullPointerException at com.app.portalalert.GcmIntentService.createGeofences(GcmIntentService.java:142) at com.app.portalalert.GcmIntentService.onHandleIntent(GcmIntentService.java:85) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.os.HandlerThread.run(HandlerThread.java:61) Any ideas or tips how I could achieve this?
answer count: 1
has answer: http://stackoverflow.com/a/22392990
accepted answer: http://stackoverflow.com/a/22392990
tagged with: service
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/34044157
has comment: http://stackoverflow.com/comment/34044360
type: AnsweredQuestion
tagged with: android-geofence
tagged with: java

http://stackoverflow.com/comment/33991476
type: Comment
type: QuestionComment
has text: Is possible you have two similar methods myMethid and myMethod and you are called the wrong one?
comment on: http://stackoverflow.com/q/22361646
score: 0

http://stackoverflow.com/comment/34030212
has text: this code works fine for me...what were you expecting it to do?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22384791

http://stackoverflow.com/a/22427237
score: 4
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/34105185
has body: JSlider with custom background is more suitable than JProgressBar. See How to Use Sliders for some examples.
type: Answer
answers question: http://stackoverflow.com/q/22427103

http://stackoverflow.com/comment/34201596
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22471651
has text: We can't make any guess about what your query should or shouldn't return if you don't show us your query. What's your query? What results do you get? What results did you expect? Please edit the question and add this information.

http://stackoverflow.com/comment/34161078
score: 0
type: QuestionComment
type: Comment
has text: You may consider the answers submitted to this question http://stackoverflow.com/questions/13276391/spring-3-mvc-expose-session-scoped-bean-in-mvc-controller-method-arguments
comment on: http://stackoverflow.com/q/22458627

http://stackoverflow.com/comment/34207615
comment on: http://stackoverflow.com/q/22485961
has text: i tried doing that earlier but i was still getting error so i removed that
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34006424
type: QuestionComment
comment on: http://stackoverflow.com/q/22371033
score: 0
has text: OK.now i am testing inside the room.Is it possible to get latlong inside the room?
type: Comment

http://stackoverflow.com/comment/34097445
has text: I've install evething and still not working :(,any other idea?
score: 0
comment on: http://stackoverflow.com/a/22422729
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33948236
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22337323
has text: @DaveSyer, this is what I get when I do `java -version`. `Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)`

c#
tags question: http://stackoverflow.com/q/22378082
tags question: http://stackoverflow.com/q/22467841
tag name: c#
tags question: http://stackoverflow.com/q/22474643
tags question: http://stackoverflow.com/q/22330626
tags question: http://stackoverflow.com/q/22434771
tags question: http://stackoverflow.com/q/22357898
tags question: http://stackoverflow.com/q/22429559
tags question: http://stackoverflow.com/q/22454241
type: Tag
tags question: http://stackoverflow.com/q/22487776
tags question: http://stackoverflow.com/q/22340335
tags question: http://stackoverflow.com/q/22357321
tags question: http://stackoverflow.com/q/22329111

http://stackoverflow.com/a/22391803
has body: To avoid the second nodelist item you can specify the index of the nodelist you want. which in this case I assume you only want to get the first nodelist. The code would have to be as follows. String username; String password; NodeList nList = doc.getElementsByTagName("param") Node nNode = nList.item(0); // This will point to just the first nodelist item if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement =(Element) nNode; username=eElement.getAttribute("username"); password=eElement.getAttribute("password"); }
type: Answer
answers question: http://stackoverflow.com/q/22390949
score: 0

http://stackoverflow.com/q/22407629
answer count: 1
score: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/22407762
has body: I have made a program that is compiling perfectly but showing run time errors. I have searched about these errors, but not getting ride off this thing. import javax.swing.JFrame; import javax.swing.SwingUtilities; class swing11 { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable(){ public void run(){ new mainframe(); } }); } } import javax.swing.JFrame; import javax.swing.JTextArea; import java.awt.BorderLayout; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class mainframe extends JFrame{ private JTextArea textarea; private JButton btn; public mainframe(){ super("new program"); setLayout(new BorderLayout()); btn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent arg0){ textarea.append("hello\n"); } }); textarea =new JTextArea(); btn = new JButton("click me!"); add(textarea, BorderLayout.CENTER); add(btn, BorderLayout.SOUTH); setSize(500,400); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } } Errors: ---------- run ---------- Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at mainframe.&lt;init&gt;(mainframe.java:16) at swing11$1.run(swing11.java:11) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:688) at java.awt.EventQueue$3.run(EventQueue.java:686) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:697) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchT…
type: UnansweredQuestion
has title: Listener is showing runtime errors
tagged with: swing
tagged with: actionlistener
tagged with: java
tagged with: event-listener
type: Question

system-calls
type: Tag
tag name: system-calls
tags question: http://stackoverflow.com/q/22438102

http://stackoverflow.com/comment/34067860
has text: Show a SSCCE demonstrating what you mean. http://www.sscce.org/
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22406321
type: QuestionComment

http://stackoverflow.com/comment/130581035
comment on: http://stackoverflow.com/q/22415054
score: 0
type: Comment
has text: A zip will only be 64-bit if it contains more than 65335 files, or requires integers for file sizes/crc32s that are larger than int32 max. Long story short, if you want a 64-bit zip, zip something large.
type: QuestionComment

http://stackoverflow.com/comment/34169413
comment on: http://stackoverflow.com/q/22456406
score: 0
type: Comment
type: QuestionComment
has text: It will be helpful if you can outline your eclipse workspace folder structure. Like @neeni rightly mentioned, this error occurs when Android Dex Loader loads more than one dex file for one class(type). The android dex file can analogized to a .class file in plain Java.

http://stackoverflow.com/a/22392060
has comment: http://stackoverflow.com/comment/34043266
accepted answer of: http://stackoverflow.com/q/22389977
downvote count: 0
answers question: http://stackoverflow.com/q/22389977
has comment: http://stackoverflow.com/comment/34043615
has comment: http://stackoverflow.com/comment/34043352
upvote count: 2
type: Answer
score: 2
has body: You could do private static double bin5(byte[] b, int k) { int b0 = b[k] &amp; 0xFF; // treat as unsigned byte int b1 = b[k + 1] &amp; 0xFF; int b2 = b[k + 2] &amp; 0xFF; int b3 = b[k + 3] &amp; 0xFF; int b4 = b[k + 4] &amp; 0xFF; return (b0 * 65536 + b1 * 256 + b2 + b3 / 256.0 + b4 / 65536.0); } As powers of 2 can be represented exactly with double you won't get any rounding error.
type: AcceptedAnswer

http://stackoverflow.com/q/22442964
has title: Opening JFrame from another package in the main window
downvote count: 0
has comment: http://stackoverflow.com/comment/34133290
accepted answer: http://stackoverflow.com/a/22443453
possible better answer: http://stackoverflow.com/a/22443058
answer count: 3
has answer: http://stackoverflow.com/a/22443058
has comment: http://stackoverflow.com/comment/34133282
has comment: http://stackoverflow.com/comment/34133480
favorite count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/34133262
tagged with: swing
has body: I have 2 packages and they each contain a seperate MyFrame class that extends JFrame. I have a third package with a MyFrame Class thet extend JFrame. I want to display the JFrames from the other packages in my "main" package JFrame when i press the corresponding button. How would I do That? this is what i have right now: public class MyFrame extends JFrame implements ActionListener { private JButton voorraadbeheer, klantenbinding, werkplaats, facturatie, parkeergarage; private JPanel mainMenu; private JDPanel mainWindow; public MyFrame() { Dimension button = new Dimension(100, 100); setLayout(new BorderLayout()); voorraadbeheer = new JButton("Voorraadbeheer"); klantenbinding = new JButton("klantenbinding"); werkplaats = new JButton("Werkplaats"); facturatie = new JButton("Facturatie"); parkeergarage = new JButton("Parkeergarage"); voorraadbeheer.setPreferredSize(button); klantenbinding.setPreferredSize(button); werkplaats.setPreferredSize(button); facturatie.setPreferredSize(button); parkeergarage.setPreferredSize(button); voorraadbeheer.addActionListener(this); klantenbinding.addActionListener(this); werkplaats.addActionListener(this); facturatie.addActionListener(this); parkeergarage.addActionListener(this); mainMenu = new JPanel(); mainMenu.setPreferredSize(new Dimension(120, 600)); mainMenu.setLayout(new FlowLayout()); mainMenu.add(voorraadbeheer); mainMenu.add(klantenbinding); mainMenu.add(werkplaats); mainMenu.add(facturatie); mainMenu.add(parkeergarage); add(mainMenu, BorderLayout.EAST); mainWindow = new JPanel(); mainWindow.setVisible(true); add(mainWindow); setSize(1024, 600); setVisible(true); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent e) { Object eventSource = e.getSource(); if (eventSource == klantenbinding) { try { klantenbinding.MyFrame klantenbindingFrame = new klantenbinding.MyFrame(); mainWindow.add(klantenbindingFrame); } catch (ParseException exc) { } } } }
has comment: http://stackoverflow.com/comment/34132697
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34133360
has answer: http://stackoverflow.com/a/22443453
has answer: http://stackoverflow.com/a/22443526
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34133571
has comment: http://stackoverflow.com/comment/34133008
type: Question

http://stackoverflow.com/a/22417234
has body: They are used often when making listeners and when making a full class is unnecessary right? Listeners in Android, or other interfaces in other situations. But in essence, that's about it. what would the alternative to using an inner anonymous class in this situation be? It would be to create a class which implements this interface and submit it as an argument. For instance: public class MyListener implements View.OnClickListener { // implement onClick(), etc etc } // In code: button.setOnClickListener(new MyListener(...));
score: 0
answers question: http://stackoverflow.com/q/22417180
type: Answer

http://stackoverflow.com/comment/34110981
score: 0
has text: @Radiodef probably the IDE drop-down quick selection menus.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22430999

http://stackoverflow.com/q/22381305
has body: I created a JTable with custom table model (MyTableModel.java) and I used some of CellRenderer class to view an effect of the cell. I have used CustomTableCellRenderer class to change the current cell as a green background. It's worked perfectly. At the same time, I have created a RenderPrice class to show the cell in decimal type, it takes the decimal value when I executed in first after if I edit the cell which is not updated and it will show the $ sign as a prefix. I want to solve this. Please give some of solution as soon as possible. thanks RenderPrice class code class RenderPrice extends DefaultTableCellRenderer { Object result; RenderPrice() { setHorizontalAlignment(SwingConstants.RIGHT); } public void setValue(Object aValue) { result = aValue; if ((aValue != null) &amp;&amp; (aValue instanceof Number)) { Number numberValue = (Number)aValue; NumberFormat formatter = NumberFormat.getCurrencyInstance(); result = formatter.format(numberValue.doubleValue()); } super.setValue(result); } } preceding code of my Tableclass (Accept.java) gradeColumn = jTable1.getColumnModel().getColumn(2); gradeColumn.setCellRenderer(new RenderPrice()); gradeColumn = jTable1.getColumnModel().getColumn(0); gradeColumn.setCellEditor(new IntegerEditor(1,100)); gradeColumn = jTable1.getColumnModel().getColumn(0); gradeColumn.setCellRenderer(new CustomTableCellRenderer()); gradeColumn = jTable1.getColumnModel().getColumn(1); gradeColumn.setCellEditor(new ComboBoxCellEditor(comboBox));
tagged with: jtable
score: 0
has answer: http://stackoverflow.com/a/22382387
has comment: http://stackoverflow.com/comment/34024802
has comment: http://stackoverflow.com/comment/34024442
type: UnansweredQuestion
tagged with: tablecelleditor
tagged with: swing
tagged with: tablecellrenderer
tagged with: java
has answer: http://stackoverflow.com/a/22383257
has title: Render the double value in the cell
type: Question
answer count: 2

http://stackoverflow.com/a/22348415
type: Answer
accepted answer of: http://stackoverflow.com/q/22345741
has body: As far as I understand from the link, it is essentially this page you are trying to reproduce: http://avail.mdx.ac.uk/ Also as far as I understand, the numbers you are trying to extract are the total and used numbers of computers, which seem to be the trailing numbers in the avail variable from the js file, after you split it where there's a ";". If you do split there you get Strings like "HESLGFOA01:84:32" which essentially seem to come down to "ID:Total:Used". Thus if you take that String again and split into its elements wherever you see a ":" you get an array of three elements (elm in the code below), ID:"HESLGFOA01", Total:"84", Used:"32". After that you only need to convert elements 1 and [2] to ints to get the numbers! As a side note: The availgroup variable contains information about each room referencing the same ID mentioned above, thus when we find a string that contains that variable we stop the loop! String url = "http://avail.mdx.ac.uk:8090/avail.js?"; // don't remove the questionmark otherwise the page won't update every time you run it String [] site = loadStrings(url); String [] list = split(site[0], ';'); for (int i = 0; i &lt; list.length; i++) { if (list[i].contains("availgroup")) break; //stops the loop String [] elm = list[i].split(":"); String ID = elm[0]; int total = int(elm[1]); int used = int(elm[2]); println("Total: " + total + " Used:" + used + " Free: " + (total - used)); } Here's a simplified version of the code with more comments to explain each step. This one only takes the first element (the first computer room) for simplicity void setup() { // do this every 4 seconds as it is refreshed. We don't want to spam // the website... This method changes how many times should draw() be // executed per second. The default value is 24 frames per second. Here // we set it to .25 which essentially means 1 draw() every 4 seconds... frameRate(0.25); } void draw() { // set the background to a boring gray colour... background(204); // set the websit…
has comment: http://stackoverflow.com/comment/34013320
has comment: http://stackoverflow.com/comment/34004769
has comment: http://stackoverflow.com/comment/34005023
score: 0
has comment: http://stackoverflow.com/comment/34016106
has comment: http://stackoverflow.com/comment/34004879
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22345741
has comment: http://stackoverflow.com/comment/34012404

http://stackoverflow.com/comment/34002217
comment on: http://stackoverflow.com/a/22368389
score: 0
type: Comment
has text: Alright it seems to be the most ideal answer, thanks.
type: AnswerComment

http://stackoverflow.com/q/22380599
has body: First, let me explain my usecase. It's pretty straight forward. There is a User entity and a Service entity. I have ManytoMany association between User and Service using UserService as the Joined entity (joined table) Initially,there will be some set of users and some set of services. Users can subscribe to any Service at any point of time. In that case, an entry will be added to UserService. But, I am getting null pointer exception when i tried to create a new UserService association. I could create User and Service individually. My Entities are : User.java package dao.models; import java.io.Serializable; import javax.persistence.*; import com.fasterxml.jackson.annotation.JsonBackReference; @Entity @org.hibernate.annotations.Proxy(lazy=false) @Table(name="`user`", schema="emm") public class User implements Serializable { public User() { } @Column(name="id", nullable=false, unique=true) @Id @GeneratedValue(generator="EMM_USER_ID_GENERATOR") @org.hibernate.annotations.GenericGenerator(name="EMM_USER_ID_GENERATOR", strategy="native") private long id; @ManyToOne(targetEntity=dao.models.Tenant.class, fetch=FetchType.LAZY) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK}) @JoinColumns({ @JoinColumn(name="tenant_id", referencedColumnName="id", nullable=false) }) @org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY) private dao.models.Tenant tenant; @OneToOne(targetEntity=dao.models.Person.class, fetch=FetchType.LAZY) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK}) @JoinColumns({ @JoinColumn(name="Person_id", nullable=false) }) @org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY) private dao.models.Person person; @Column(name="password", nullable=true, length=255) private String password; @Column(name="email", nullable=false, length=255) private String email; @Column(name="statu…
tagged with: spring-data-rest
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34035949
tagged with: spring-data-jpa
tagged with: spring
has answer: http://stackoverflow.com/a/22396059
type: UnansweredQuestion
upvote count: 7
score: 7
tagged with: java
has title: Spring Data Rest ManytoMany POST
type: Question

http://stackoverflow.com/q/22350276
has answer: http://stackoverflow.com/a/23478528
linked to: http://stackoverflow.com/q/2961777
downvote count: 0
has comment: http://stackoverflow.com/comment/35993886
tagged with: string
has comment: http://stackoverflow.com/comment/35993892
possible better answer: http://stackoverflow.com/a/23476500
favorite count: 0
has answer: http://stackoverflow.com/a/23476500
tagged with: android
has title: Avoiding syllabification on URLs
tagged with: word-wrap
tagged with: text
has body: I'm trying to display a text like this: "For more infomration please visit www.my-site.com" For some resolutions/screens the text is displayed as: |For more information please visit www.my- | |site.com | Can I avoid this effect on the URL part?
type: AnsweredQuestion
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34206198
tagged with: java
has answer: http://stackoverflow.com/a/23609017
has comment: http://stackoverflow.com/comment/35995139
type: Question
linked to: http://stackoverflow.com/q/4474237
accepted answer: http://stackoverflow.com/a/23609017
answer count: 3

http://stackoverflow.com/q/22475529
has title: Difference between results fetched through command line and JDBC query
type: Question
has answer: http://stackoverflow.com/a/22476517
has comment: http://stackoverflow.com/comment/34189649
answer count: 1
has comment: http://stackoverflow.com/comment/34189940
tagged with: sqlite
tagged with: jdbc
type: UnansweredQuestion
score: 0
tagged with: java
has body: I have a SQLITE database containing a table: Service={ID,Port,Name} I opened the command line and populated it with the following data: 1 23 abc 2 25 xyz Then I was working on an app that used JDBC bridge using to fetch the results.I used following startegy: import java.sql.*; public class SQLiteJDBC { public static void main( String args[] ) { Connection c = null; Statement stmt = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:test.db"); stmt = c.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT ID FROM SERVICE WHERE PORT=23;" ); System.out.println(rs.getInt("ID")); } catch(Exception e){ } } } This to my amazement returns 4 as result but when I type the following on command line,the result is 1 that is correct. Whythe difference in results?

http://stackoverflow.com/a/22342890
has body: Is your test.txt in your classpath? I think that your test.txt is not inside your classpath. you have many solutions for to do that. one could be give the fullpath of your file (c:/......) verify when you generate .jar file your txt is inside .jar. if not include your resource folder inside your java project. when you include made a path directly for getResourceAsStream ("test.txt") For disacoplated resource of your java project use a first option but if it not make sense use the second option .
has comment: http://stackoverflow.com/comment/33958922
has comment: http://stackoverflow.com/comment/33958648
score: 0
answers question: http://stackoverflow.com/q/22342432
type: Answer
has comment: http://stackoverflow.com/comment/33958183

http://stackoverflow.com/q/22441225
has comment: http://stackoverflow.com/comment/34130977
has comment: http://stackoverflow.com/comment/34131057
has comment: http://stackoverflow.com/comment/34129772
has comment: http://stackoverflow.com/comment/34132102
has comment: http://stackoverflow.com/comment/34129365
has comment: http://stackoverflow.com/comment/34168241
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34160075
favorite count: 0
has title: Why Java Thread distorts printing to console
has comment: http://stackoverflow.com/comment/34129640
linked to: http://stackoverflow.com/q/9459657
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/22442445
duplicate of: http://stackoverflow.com/q/9459657
has body: I have a multithreaded application in Java. In the run method of one of the threads, I have a System.out.println("Print something something something") statement. The problem I have is that sometimes, the output I get from this print is not "Print something something something" but "something Print something something" and some other variations. Please what is the cause of this? The method I am calling in my run method is shown below. public synchronized void generateRequests() { String name; int qty; int index = 0; System.out.print("Customer " + custId + " requests, "); for (Item i : items) { name = i.getName(); qty = randNoGenerator(0, 10); items.set(index, new Item(name, qty)); index++; System.out.print(qty + " " + name + ", "); } s.serviceRequests(this); }
has comment: http://stackoverflow.com/comment/34143308
has comment: http://stackoverflow.com/comment/34129630
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34129506
upvote count: 1
type: Question

http://stackoverflow.com/comment/34121787
comment on: http://stackoverflow.com/q/22436542
has text: @Dave I have found `next(Pattern pattern)` method in `Scanner` class. Is it possible to use it here?
score: 0
type: Comment
type: QuestionComment

bufferedimage
tags question: http://stackoverflow.com/q/22360716
tags question: http://stackoverflow.com/q/22330675
tag name: bufferedimage
tags question: http://stackoverflow.com/q/22364663
tags question: http://stackoverflow.com/q/22391357
type: Tag
tags question: http://stackoverflow.com/q/22403941

http://stackoverflow.com/comment/34167829
type: Comment
score: 0
has text: Also, you forgot to add ``return status;``.
type: QuestionComment
comment on: http://stackoverflow.com/q/22463171

http://stackoverflow.com/a/22347039
type: Answer
has comment: http://stackoverflow.com/comment/33965163
score: 0
has body: I would change DB structure introducing many-to-many relations hash&lt;->word Just create 3 tables hash, words, hash_words. Each your has could be stored in the 3 tables. It's much easier to work with the hash_words table. All your calculations would be just results of aggregate functions using on SQL level. (SUM/COUNT/AVG)
has comment: http://stackoverflow.com/comment/33992661
has comment: http://stackoverflow.com/comment/33964838
answers question: http://stackoverflow.com/q/22346754

http://stackoverflow.com/a/22364714
has body: You don't have validation in your code. I hope this was cut out for this post. You should check that clazz and method are valid. Anyways, if I am not missing something, you pass a char* to the Java method instead of jstring. You must convert fn.first to Java string with JNI NewStringUTF() or similar.
downvote count: 0
has comment: http://stackoverflow.com/comment/33995900
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22364382
score: 1

http://stackoverflow.com/comment/34201518
comment on: http://stackoverflow.com/a/22481601
score: 0
type: AnswerComment
type: Comment
has text: You deserve a cookie!!! Thanks so much it works fine... except the skip()-method doesn't skip anything for some reason?! ... However that was not the question and I will look for a solution for this other problem :D

http://stackoverflow.com/q/22415650
tagged with: arrays
has answer: http://stackoverflow.com/a/34581026
has answer: http://stackoverflow.com/a/22421173
has comment: http://stackoverflow.com/comment/34085014
has comment: http://stackoverflow.com/comment/34084619
score: 0
has comment: http://stackoverflow.com/comment/34083945
tagged with: dynamic
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34084702
has body: I need to modify a class to create a dynamic array stack. My code at this point looks something like this: public class DynamicArrayStack&lt;E&gt; implements Stack&lt;E&gt; { private E[] elems; //used to store the elements public static final int defaultIncrement = 25; private final int increment; private int top; @SuppressWarnings( "unchecked" ) public DynamicArrayStack( int increment ) { this.increment = increment; elems = (E[]) new Object[ increment ]; top = 0; } /** * Constructor with no parameter that will initialize * the stack to have an array whose size is the value * of increment and memorise that value as the value * of increment. */ public void ArraySize() { } public boolean isEmpty() { return top == 0; } public E peek() { return elems[ top-1 ]; } public E pop() { // save the top element E saved = elems[ --top ]; // scrub the memory, then decrements top elems[ top ] = null; return saved; } public void push( E elem ) { // stores the element at position top, then increments top elems[ top++ ] = elem; } public String toString() { StringBuffer b; b = new StringBuffer( "DynamicArrayStack: {" ); for ( int i=top-1; i&gt;=0; i-- ) { if ( i!=top-1 ) { b.append( "," ); } b.append( elems[ i ] ); } b.append( "}" ); return b.toString(); } } How do I edit the first constructor to set increment as the initial size of the stack and that same value to be used when increasing or decreasing the size of the array. My method for doing this seems way too simple. Parameter must be > 0 and a fixed number of cells are added or removed when the size of the array changes. The second constructor should set the stack to have an array whose size is the value of increment. I keep getting errors here because I can't figure out how to do that because I thought that was already set in the first constructor. Also the size of the array as the value of increment. Also how do I make this class capable of changing the capacity of the stack and into which method should I place that code?
type: Question
tagged with: stack
tagged with: java
has title: How can I implement a Dynamic Array Stack in Java?
answer count: 2

http://stackoverflow.com/q/22382036
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22400600
tagged with: java
type: Question
tagged with: ibm-connections
has body: I'm trying to toggle todo items in IBM Connections to complete/incomplete using the SBT Java API. I manage to set the todo item to complete, but how do I change it back to incomplete? todoNode = activityService.getActivityNode( "856b9450-b3d2-4b41-a198-46feeb3772a8" ); System.out.println("Title " + todoNode.getTitle()); if ( todoNode.getCategoryFlagCompleted() == null) { List&lt;String&gt; flags = new java.util.ArrayList(); flags.add("Completed"); todoNode.setFlags(flags); } activityService.updateActivityNode(todoNode); Many thanks
score: 0
answer count: 2
has title: Toggle todo items completed using sbt java api
tagged with: ibm-sbt
has answer: http://stackoverflow.com/a/25133841
has comment: http://stackoverflow.com/comment/34035950

http://stackoverflow.com/q/22423696
has title: EDT is not working properly with recursive method while updating lable
has answer: http://stackoverflow.com/a/22423735
score: 0
tagged with: settext
answer count: 1
tagged with: jlabel
tagged with: event-dispatch-thread
has comment: http://stackoverflow.com/comment/34097841
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
has body: //search files and directories public void getFile1(String directoryName) throws Exception { File directory = new File(directoryName); String str = directory.getName(); File[] fList = directory.listFiles(); if (fList != null) { for (File file : fList) { { if (file.isFile()) { st = (file.toString()); System.out.println(st); jLable1.setText(st);//jLable1 is not updating. String fileName = file.getName(); String strvirusCount=Integer.toString(virusCount); } else if (file.isDirectory()) { getFile1(file.getAbsolutePath()); } globalCount++; } } //while retrieving all files and folder unable to update label when process start to with retrieving path Swing form get unresponsive.

http://stackoverflow.com/q/22341855
tagged with: java
has answer: http://stackoverflow.com/a/22342089
tagged with: swing
linked to: http://stackoverflow.com/q/13791984
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33955869
has title: issues with putting a JPanel in a JScrollPanel
has comment: http://stackoverflow.com/comment/33955813
has comment: http://stackoverflow.com/comment/33955596
tagged with: jpanel
score: -1
has comment: http://stackoverflow.com/comment/33955668
has comment: http://stackoverflow.com/comment/33955705
has comment: http://stackoverflow.com/comment/33955851
answer count: 1
has comment: http://stackoverflow.com/comment/33955675
tagged with: paintcomponent
has comment: http://stackoverflow.com/comment/33955895
has comment: http://stackoverflow.com/comment/33955864
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33955745
has comment: http://stackoverflow.com/comment/33955454
linked to: http://stackoverflow.com/q/18393971
upvote count: 0
has comment: http://stackoverflow.com/comment/33955728
has body: im working on a project where i am drawing an image on a JPanel and then putting that panel inside a JScrollPane. The panel itself will vary in size sometimes being smaller than the screen, sometimes larger. When it is larger the scrollpane doesn't seem to have any scroll bars appearing. Im sure im messing something up that is simple but i can't seem to figure it out. Any help would be greatly appreaciated. public void createGI(theTicket[] ticketArray){ JFrame ticketReportFrame = new JFrame(); ticketReportFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel ticketReport = new drawTurnoverReport(ticketArray , notes, tapes, turnover); ticketReport.setBackground(Color.WHITE); ticketReport.setLayout(new BorderLayout()); JScrollPane ticketReportHolder = new JScrollPane(ticketReport); ticketReportFrame.setExtendedState(Frame.MAXIMIZED_BOTH); ticketReportFrame.pack(); ticketReportHolder.setWheelScrollingEnabled(true); ticketReportFrame.add(ticketReportHolder); ticketReportFrame.setVisible(true); ticketReportFrame.setResizable(false); } this is just a small portion of drawTurnoverReport to try and help show what i am doing. public class drawTurnoverReport extends JPanel{ public drawTurnoverReport(theTicket[] tickets, String[] n, String[] t, String[] to){ ticArray = tickets; notes = n; tapes = t; turnover = to; formalDate = mt.formalDate; } @Override protected void paintComponent(Graphics g){ super.paintComponent( g ); Graphics2D g2 = (Graphics2D) g; //set fonts Font tahomaB = new Font("tahoma", Font.BOLD, 15); Font tahomaP = new Font("tahoma", Font.PLAIN, 15); //draw heading g2.setColor(Color.BLACK); g2.setFont(tahomaB); Rectangle2D rec = g2.getFontMetrics().getStringBounds("Turnover / Activity Log", g2); int stringW = (int) rec.getWidth(); int prevStringH = (int) rec.getHeight(); g2.drawString("Turnover / Activity Log", x-(stringW / 2) , 50); g2.setFont(tahomaP); rec = g2.getFontMetrics().getStringBounds("Date: " + formalDate, g2); stringW = (int) rec.getWidth()…

http://stackoverflow.com/a/22532543
type: Answer
answers question: http://stackoverflow.com/q/22486016
has body: What does it throw? jjs&gt; var tt = new java.util.TimerTask {run: function() { print("hello"); }} jjs&gt; tt.run(); hello null I usually skip TimerTask altogether // Daemon flag seems to be ignored. var timer = new java.util.Timer(false); timer.schedule(function() print("Hello"), 1000); // Give timer a chance to run before exit. java.lang.Thread.sleep(5000);
score: 0
has comment: http://stackoverflow.com/comment/34295055

http://stackoverflow.com/comment/33958995
has text: I tried this method too already!.. but this wasn't working for me..
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22343577

http://stackoverflow.com/comment/34012827
comment on: http://stackoverflow.com/q/22374951
score: 0
has text: @SteveD. I think its mistake. I am removing it. Thanks
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33999570
comment on: http://stackoverflow.com/a/22365435
score: 0
type: AnswerComment
has text: Yes, for my specific scenario, I have to handle the data in thread's parent (a separate thread) - although, as you said, that explains the above behaviour..
type: Comment

http://stackoverflow.com/comment/33970640
score: 2
has text: Indeed - it's simple for you to *try* this, and then include the specific error in your question, if indeed you get one.
type: Comment
comment on: http://stackoverflow.com/q/22350565
type: QuestionComment

http://stackoverflow.com/comment/34088847
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22418277
has text: @user3161533 So far, you haven't told us what line it's getting the `NullPointerException` on. (I'm not even certain that it's been on the same line every time you've tried it.) Did you look at the stack trace and find out?
type: Comment

http://stackoverflow.com/q/22353161
answer count: 3
has answer: http://stackoverflow.com/a/22358473
has answer: http://stackoverflow.com/a/22353485
tagged with: android
has answer: http://stackoverflow.com/a/22353328
tagged with: http://stackoverflow.com/tag/html
has title: How do I make my PhoneGap Android APP fit all devices?
type: AnsweredQuestion
tagged with: cordova
possible better answer: http://stackoverflow.com/a/22353328
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22353485
tagged with: jquery-mobile
has body: I built my APP as was instructed using Cordova, and I can't get the HTML pages I make to fit the scree, they're always larger. This is the generated Android App Code, and there was no .xml file generated for layout public class APP extends CordovaActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); // Set by &lt;content src="index.html" /&gt; in config.xml super.loadUrl(Config.getStartUrl()); //super.loadUrl("file:///android_asset/www/index.html"); } } And I put this in the Meta tag, of the HTML file. &lt;meta name="viewport" content="height=device-height,width=device-width,initial-scale=1.0,maximum-scale=1.0" &gt; Running this App gives me an app that is much bigger than the size of the screen, also I use JQuery Mobile to structure the HTML, any solutions would be much appreciated.
score: 0

http://stackoverflow.com/comment/34039710
type: Comment
comment on: http://stackoverflow.com/a/22388347
has text: Without a 'new connection thread', it is not possible to have multiple clients connected. When a client connects, this `Socket` object of this connection should be passed on to the 'client thread' and the variable should be emptied in the 'connection thread'. This way each client thread will be completely independent and other threads won't be able to interfere with the client and server's client thread.
score: 1
type: AnswerComment

http://stackoverflow.com/q/22468794
has body: I have an abstract class Stack and a class that extends it: MyStack. I need to make a copy constructor for MyStack. Is it better to pass in only MyStack objects, or any Stack object? public MyStack(Stack other) public MyStack(MyStack other) Both will work, I think, because I can use the methods defined in Stack to look at and copy all the data either way; the "stack-ness" will be copied regardless of which approach I use. I can't find any 'best approach' for this. Does one exist?
has answer: http://stackoverflow.com/a/22468907
score: 0
answer count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22468907
tagged with: java
type: Question
has title: Stylistic? approach to copy constructor signature in Java

http://stackoverflow.com/comment/34175461
score: 1
has text: "Given base64 data, how do I calculate the length of the decoded data will be?" Decode it and check the length.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22467231

http://stackoverflow.com/a/22357925
has comment: http://stackoverflow.com/comment/33983347
type: Answer
has body: public int numberOfChildren(){ int count=0; for(int i=0;i&lt;passengers.length;i++){ if(passengers[i].age &lt; 16){ count++; } } return count; } public int totalWeight(){ int sum=0; for(int i=0;i&lt;passengers.length;i++){ sum+=passengers[i].weight; } return sum; }
upvote count: 1
has comment: http://stackoverflow.com/comment/33983414
downvote count: 1
answers question: http://stackoverflow.com/q/22357680
accepted answer of: http://stackoverflow.com/q/22357680
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/33970764
type: Comment
has text: There is some strange whitespace in `GVTID_ISS_DT":‌​"2010-02-01` in you last comment which breaks even http://jsonlint.com/ Please fix it.
comment on: http://stackoverflow.com/a/22350537
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34153902
comment on: http://stackoverflow.com/a/22455279
score: 0
type: AnswerComment
type: Comment
has text: i'll try it right away but meanwhile, i'd just like to know in terms of generated sql in background, how is it different than if i'd do first a SELECT on the object based on lastVisitDate/idQueue/ticketNumber and then the update on the returned Patient?

http://stackoverflow.com/a/63814321
type: Answer
has body: What does the file /usr/lib/libcuda.so.319.37 contain? If the file is a 0-byte-file, there is something really wrong, so try to repair your system by reinstalling that library. I had the same problem in smartgit, where a library in the local config folder was used, which was somehow corrupted and was a 0 byte file. So deleting the config folder and restarting the app worked for me. This could be a solution here too.
score: 0
answers question: http://stackoverflow.com/q/22345891

http://stackoverflow.com/q/22329087
score: 0
tagged with: string
has comment: http://stackoverflow.com/comment/33933511
tagged with: hex
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22329294
tagged with: java
type: Question
has title: android convert EditText input string to its hex equivalent
has answer: http://stackoverflow.com/a/22329294
linked to: http://stackoverflow.com/q/923863
answer count: 1
has body: Hello I would like my application to allow a user to input a number 1 to 16, press a button and then have the input number's hex equivalent shown on screen as a toast message and also store is hex in a single byte. Now i've most of it down and ready to go, its just i'm having problems with the input string to hex conversion. Would anyone be able to give me some help with the conversion?? I'm sure there must be an easy way of doing this?? For example if i input 1 it would display 0x31 on screen in a toast and 0x31 would be stored in a byte. thanks code: public class MainActivity extends Activity { private static String toastMsg; private static String input; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button genButton = (Button) findViewById(R.id.btnGen); final EditText inputText = (EditText) findViewById(R.id.etxtInput); final TextView outputText = (TextView) findViewById(R.id.txtOutput); genButton.setOnClickListener(new OnClickListener() { public void onClick(View view){ input = inputText.getText().toString(); toastMsg = input; toast(); } }); } //-----TOAST---------------------------------// public void toast() { Toast toast= Toast.makeText(getBaseContext(), toastMsg, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER, 0, -100); toast.show(); } }
tagged with: type-conversion

http://stackoverflow.com/comment/33969959
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22350150
has text: Because of the number of double quotes present am not able to get it as a String in java.

http://stackoverflow.com/a/25978186
answers question: http://stackoverflow.com/q/22386378
upvote count: 1
has body: Save specifically does an insert. So calling save again will result in another row in the db. Update updates an object in the session. So if the object is in the session it will update. If the object is not in the session, you should call merge. So If you retrieve an entity that already exists you have to call update/merge instead of save. JPA specification The semantics of the merge operation applied to an entity X are as follows: If X is a detached entity, the state of X is copied onto a pre-existing managed entity instance X' of the same identity or a new managed copy X' of X is created. If X is a new entity instance, a new managed entity instance X' is created and the state of X is copied into the new managed entity instance X'. If X is a removed entity instance, an IllegalArgumentException will be thrown by the merge operation (or the transaction commit will fail). If X is a managed entity, it is ignored by the merge operation, however, the merge operation is cascaded to entities referenced by relationships from X if these relationships have been annotated with the cascade element value cascade=MERGE or cascade=ALL annotation. For all entities Y referenced by relationships from X having the cascade element value cascade=MERGE or cascade=ALL, Y is merged recursively as Y'. For all such Y referenced by X, X' is set to reference Y'. (Note that if X is managed then X is the same object as X'.) If X is an entity merged to X', with a reference to another entity Y, where cascade=MERGE or cascade=ALL is not specified, then navigation of the same association from X' yields a reference to a managed object Y' with the same persistent identity as Y.
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40678171

http://stackoverflow.com/q/22337998
answer count: 1
tagged with: wicket
type: AnsweredQuestion
tagged with: java
has body: In my application I have autocompleteTextField. I need to get id of player when text in input changed. I am trying to play with models which are recommended by this question: using AutoCompleteTextField in wicket without String as the generic type but with no success. Behaviour stop working when I use PropertyModel or when I set class Player.class instead of null. I dont understand why. final AutoCompleteTextField&lt;Player&gt; playersField = new AutoCompleteTextField&lt;Player&gt;("players", new Model&lt;Player&gt;(selectedPlayer), null, new AbstractAutoCompleteRenderer&lt;Player&gt;() { @Override protected void renderChoice(Player player, Response response, String criteria) { response.write(getTextValue(player)); } @Override protected String getTextValue(Player player) { return player.getName() + " " + player.getSurname() + " " + player.getPlayerDiscriminator(); } } , settings) { @Override protected Iterator&lt;Player&gt; getChoices(String prefix) { List&lt;Player&gt; choices = getPlayers(); return choices.iterator(); } }; add(playersField); playersField.add(new AjaxFormComponentUpdatingBehavior("onchange") { @Override protected void onUpdate(AjaxRequestTarget target) { System.out.println("do something"); // All I need here is just Id of player } } });
type: Question
has title: Why behaviour stop working with propertyModel inside autocompleteField
score: 0
has answer: http://stackoverflow.com/a/22341647
linked to: http://stackoverflow.com/q/5226492
accepted answer: http://stackoverflow.com/a/22341647

http://stackoverflow.com/comment/34138341
score: 0
has text: I created `String[] input = new String[3]` and set them all to `"empty"` so I assumed that there was always going to be 3 elements in `input`. But as explained below is was marked to be garbage collected and a new `String[]` is created.
type: Comment
comment on: http://stackoverflow.com/q/22445986
type: QuestionComment

http://stackoverflow.com/comment/34008716
comment on: http://stackoverflow.com/a/22372477
score: 0
type: AnswerComment
has text: Hi Vadchen, jar file is working fine in unix while I pass input parameters to it, my requirement is .exe should be created in lieu of .jar and input parameters to be passed. It should fetch result if I give the following command as such : SSS_infinite.exe test.in 2
type: Comment

http://stackoverflow.com/comment/34020789
has text: Code updated (and tested) using input from @androiddeveloper :D
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22363598
type: Comment

http://stackoverflow.com/q/22451389
has comment: http://stackoverflow.com/comment/34147115
answer count: 1
tagged with: method-call
duplicate of: http://stackoverflow.com/q/4637215
has title: How to use Progress Bar in java swing,while the function working in heavy process
has comment: http://stackoverflow.com/comment/34147333
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22451625
has comment: http://stackoverflow.com/comment/34147053
tagged with: java
tagged with: swing
type: Question
has body: I have created a class for uploading a data from excel format to mysql database. The class contains the method to upload into the database. I am using button to call the method. That uploading process taking very long time to upload So, I want to add a progress bar for that process anyone can help me to complete this process,
tagged with: progress-bar
score: 0
linked to: http://stackoverflow.com/q/4637215

http://stackoverflow.com/q/22471808
downvote count: 1
possible better answer: http://stackoverflow.com/a/24827368
favorite count: 0
tagged with: embedded-jetty
has answer: http://stackoverflow.com/a/24827368
upvote count: 5
has title: Response Header too large - Jetty Embedded version 9
has answer: http://stackoverflow.com/a/22472794
has body: I'm getting an exception of "Response Header too large" when using Jetty, the exception is thrown at the Client and only when the size of the jsonValue is large (greater than 1500 bytes). If the jsonvalue is smaller, everything works fine. This is the code I have, it is very simple. Server Code: Server server = new Server(8080); ServletHandler handler = new ServletHandler(); server.setHandler(handler); handler.addServletWithMapping(StoreServlet.class, "/store"); server.start(); server.join(); StoreServlet class code: @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setStatus(HttpServletResponse.SC_OK); response.getWriter().println(" Store SimpleServlet "); } Client Code: HttpClient httpClient = new HttpClient(); httpClient.start(); ContentResponse response = httpClient.POST("http://0.0.0.0:" + host.getPort() + "/store").param("p", jsonValue).send(); StactTrace: java.util.concurrent.ExecutionException: java.io.IOException: Response header too large at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118) at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101) at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:589) at com.paywithbytes.communication.http.client.HttpClientHelper.doPost(HttpClientHelper.java:54) at com.paywithbytes.communication.http.client.HttpClientHelper.main(HttpClientHelper.java:35) Caused by: java.io.IOException: Response header too large at org.eclipse.jetty.http.HttpGenerator.generateRequest(HttpGenerator.java:249) at org.eclipse.jetty.client.http.HttpSenderOverHTTP.sendHeaders(HttpSenderOverHTTP.java:78) at org.eclipse.jetty.client.HttpSender.send(HttpSender.java:191) at org.eclipse.jetty.client.http.HttpChannelOverHTTP.send(HttpChannelOverHTTP.java:52) at org.eclipse.jetty.client.http.HttpConnectionOverHTTP$Delegate.send(HttpConnectionOverHTTP.java:168) at org.eclipse.…
tagged with: jetty
type: AnsweredQuestion
tagged with: java
type: Question
score: 4
answer count: 2
accepted answer: http://stackoverflow.com/a/22472794

http://stackoverflow.com/a/22480978
accepted answer of: http://stackoverflow.com/q/22382341
answers question: http://stackoverflow.com/q/22382341
type: Answer
has body: You will have to call the BlockState.update() methods to apply the BlockState back to the actual Block. http://jd.bukkit.org/beta/doxygen/d9/d1c/interfaceorg_1_1bukkit_1_1block_1_1BlockState.html#a0734c83720823a6eb2247aaf4b60ec0e
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/34184116
type: Comment
has text: You said in a comment above you will need to convert back and forth. Why not just use option #3? Regarding your comment: a piece of code written does not get duplicated with new class instances. It takes pretty much the same amount of space no matter where you write it. So unless you have issues with a specific function being available where it isn't needed, option #1 shouldn't be a problem.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22472369

http://stackoverflow.com/a/22475313
has body: Java doesn't support multiple inheritance, which means you can only extend one class in Java so once you extended Thread class you lost your chance and can not extend or inherit another class in Java so this class is specialized for Thread only. By extending Thread, each of your threads has a unique object associated with it, whereas implementing Runnable, many threads can share the same runnable instance. Extending a class generally means adding new functionality, modifying or improving behaviors. If we are not making any modification on Thread then use Runnable interface instead. Thread class has some behavior decided by JDK developers when you want to make some modification to it then you can extend your class with Thread class and modify it.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22474961

http://stackoverflow.com/comment/33956519
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22342219
has text: No problem. Let me know if I need to explain it any better.
type: Comment

http://stackoverflow.com/comment/34363657
comment on: http://stackoverflow.com/a/22441152
type: AnswerComment
type: Comment
has text: and sir also tell me how to stop this timer??
score: 0

http://stackoverflow.com/a/26999842
answers question: http://stackoverflow.com/q/22481540
has body: I had the same problem with Spring Data JPA. I confirm it comes from javassit conflict. The solution is : org.hibernate hibernate-core compile javassist org.javassist org.javassist javassist 3.18.2-GA compile
score: 0
type: Answer

http://stackoverflow.com/comment/34011152
score: 0
has text: Have you verified that `count` contains the correct number of entries? Also, that if you print the lines one by one the correct count is printed?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22374053

http://stackoverflow.com/q/22394795
type: Question
has comment: http://stackoverflow.com/comment/34047538
answer count: 1
has title: Thread safe function in java to count number of words in a sentences
has body: I was interviewed and asked to write a function to count number of words in a sentence. The function should be thread safe. Would the following method works for that? public static synchronized int find(String str){ int count=0; boolean word= false; char[] ch = str.toCharArray(); for(int i =0;i&lt;ch.length;i++){ if(!(ch[i]==' ')){ for(int j=i;j&lt;ch.length;j++,i++){ if(!(ch[j]==' ')){ word= true; if(j==ch.length-1){ count++; } continue; } else{ if(word){ count++; } word = false; } } } else{ continue; } } return count; }
has comment: http://stackoverflow.com/comment/34047652
score: 0
has answer: http://stackoverflow.com/a/22394912
has comment: http://stackoverflow.com/comment/34047756
has comment: http://stackoverflow.com/comment/34048663
favorite count: 0
has comment: http://stackoverflow.com/comment/34047558
type: UnansweredQuestion
upvote count: 1
tagged with: java
tagged with: thread-safety
downvote count: 1
has comment: http://stackoverflow.com/comment/34048575

http://stackoverflow.com/q/22344048
tagged with: mouselistener
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/34014840
score: 2
has comment: http://stackoverflow.com/comment/33963032
tagged with: java
tagged with: jfreechart
has body: I want to bind three values to the dataset as Value(y axis value), Column Name (X axis value), Column ID (to get on mouse click) in order to make drill-down chart. Here is my code to create Dataset: DefaultCategoryDataset categoryDataset = new DefaultCategoryDataset(); categoryDataset.setValue(80, "", "Chap 1"); categoryDataset.setValue(52, "", "Chap 2"); categoryDataset.setValue(95, "", "Chap 3"); categoryDataset.setValue(25, "", "Chap 4"); And the chart : JFreeChart chapterChart = createChart(chapterChartDataset, "Average Result"); ChartPanel chapterChartPanel = new ChartPanel(chapterChart); chapterChartPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseMoved(ChartMouseEvent arg0) { } @Override public void chartMouseClicked(ChartMouseEvent event){ System.out.println(event.getSource().getClass()); ChartEntity chartentity = event.getEntity(); if (chartentity != null &amp;&amp; chartentity.getToolTipText() != null &amp;&amp; chartentity.getToolTipText().trim().length() &gt; 0){ System.out.println("Mouse clicked: " + chartentity.toString()); String chapName = chartentity.getToolTipText().trim(); }else{ System.out.println("Mouse clicked: null entity."); } } }); In this code I need chapter ID also to be stored and retrieved at mouse click.
type: Question
has comment: http://stackoverflow.com/comment/33963817
linked to: http://stackoverflow.com/q/8218853
has title: JFreeChart : get ID of a bar on mouse click
downvote count: 0
has comment: http://stackoverflow.com/comment/33974894
has comment: http://stackoverflow.com/comment/33961185
has comment: http://stackoverflow.com/comment/33960648
has comment: http://stackoverflow.com/comment/34014605
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/33963234
upvote count: 2

http://stackoverflow.com/q/22459676
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34161881
answer count: 1
has title: Fatal error on using java npm package
tagged with: meteor
has comment: http://stackoverflow.com/comment/34166073
tagged with: node.js
has comment: http://stackoverflow.com/comment/34161852
has comment: http://stackoverflow.com/comment/34166208
tagged with: npm
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34161304
has comment: http://stackoverflow.com/comment/34170292
has answer: http://stackoverflow.com/a/22460722
has body: I am using 'node-excel-api' npm package inside my Meteor application. It has dependency on 'java' npm package. I am getting the following error on startup of Meteor server. A fatal error has been detected by the Java Runtime Environment: Internal Error (threadLocalStorage.cpp:56), pid=3880, tid=3074959104 guarantee(get_thread() == thread) failed: must be the same thread, quickly JRE version: (7.0_45-b18) (build ) Java VM: Java HotSpot(TM) Server VM (24.45-b08 mixed mode, sharing linux-x86 ) Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again An error report file with more information is saved as: /home/support/sTemp/excel-support/node-excel-api_Sample/.meteor/local/build/programs/server/hs_err_pid3880.log If you would like to submit a bug report, please visit: http://bugreport.sun.com/bugreport/crash.jsp =&gt; Exited from signal: SIGABRT I doubt the problem is with environment settings in my machine but I couldn't figure out the reason for the same. I am using Ubuntu 13.10 and oracle java 7(/usr/lib/jvm/java-7-oracle/). I have set the JAVA_HOME env variable and also have JAVA_HOME\bin in PATH variable. Could anyone please help me in solving the issue. Thanks in advance.
tagged with: java
tagged with: ubuntu

http://stackoverflow.com/q/22467841
tagged with: jsse
linked to: http://stackoverflow.com/q/22646533
has comment: http://stackoverflow.com/comment/34178945
has comment: http://stackoverflow.com/comment/34179052
has body: I'm working on an application using c#-4.0 and EntireX Broker 9.5.1 I'm attempting to convert to tpcip connections to use ssl. I was successful in upgrading my java code to do the same thing thanks to Java/ Software AGs use of jsse for handling the SSL/ceritificate validation. However, when connecting to the same server/port under .net I'm getting the following error: 02150403: Certificate expired or invalid The error message sounds like it's communicating. So how can I get .Net to successfully validate the certificate? PS: The certificate is signed by Verisign. UPDATE: Both IE and Firefox successfully connect on https://server.domain:port without throwing certificate errors. My application is actually connecting to ssl://server:port?verify_server=y verify_server=n throws the same certificate error. The certificate is not expired. The stack trace from the exception stops right at Broker.Logon();. at SoftwareAG.EntireX.NETWrapper.Runtime.Broker.Logon(String password) at FAServer.EntireXDotNetClasses.EntireXWrapper.CreateBroker() in C:\Users\tfburton\Documents\Visual Studio 2010\Projects\NEW FADCOM\FAServer\EntireXDotNetClasses\EntireXWrapper.cs:line 1302 UPDATE: Here's how I'm creating my Broker object. try { Broker mybroker; try { mybroker = new Broker(BrokerName, BrokerUser); } catch (Exception e) { Utilities.LogEntry("Error Creating broker instance -- BEFORE LOGON. ", e, true); throw new WrapperException("Error Creating broker instance -- BEFORE LOGON. " + Environment.NewLine + e.Message); } try //{ mybroker.Logon(BrokerPass); } { mybroker.Password = BrokerPass; mybroker.Logon(); //&lt;-- stracktrace points here } catch (AccessViolationException ave) { Utilities.LogEntry("Error During Broker Logon.", ave, EventLogEntryType.Error); throw new WrapperException(ave); //wrap and duck } } catch ( Exception e ) { Utilities.LogEntry("Error Creating broker instance. ", e, true); XException be = e as XException; if ( null != be ) //&lt;-- resolves to true { String msg = "Ce…
has comment: http://stackoverflow.com/comment/34182545
tagged with: ssl
score: 4
has comment: http://stackoverflow.com/comment/34178994
has answer: http://stackoverflow.com/a/22727562
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34218529
has comment: http://stackoverflow.com/comment/34217957
tagged with: webmethods
has title: what is the JSSE equivalent for .NET (C#)?
has comment: http://stackoverflow.com/comment/34637604
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22727562
tagged with: java
type: Question
upvote count: 4
tagged with: c#

http://stackoverflow.com/q/22408428
has body: I have seen a couple of such tricky pieces of code while i prepare for a Java certification. The return value at the end here is : 10, but finally is called and it modifies the returnval to 20. Can someone explain why this is so ? is it because the catch has a different scope of the returnval ? or am i missing something here. class MultipleReturn { int getInt() { int returnVal = 10; try { String[] students = {"Harry", "Paul"}; System.out.println(students[5]); } catch (Exception e) { System.out.println("About to return :" + returnVal); return returnVal; } finally { returnVal += 10; System.out.println("Return value is now :" + returnVal); } return returnVal; } public static void main(String args[]) { MultipleReturn var = new MultipleReturn(); System.out.println("In Main:" + var.getInt()); } } Another follow up piece of code is : class MultipleReturn { StringBuilder getStringBuilder() { StringBuilder returnVal = new StringBuilder("10"); try { String[] students = {"Harry", "Paul"}; System.out.println(students[5]); } catch (Exception e) { System.out.println("About to return :" + returnVal); return returnVal; } finally { returnVal.append("10"); System.out.println("Return value is now :" + returnVal); } return returnVal; } public static void main(String args[]) { MultipleReturn var = new MultipleReturn(); System.out.println("In Main:" + var.getStringBuilder()); } } here the output is 1010 which makes sense as the finally modifies the returnval and it gets persisted. Any explanation will be helpful. i do understand this is poorly written code and nobody in the right mind should be writing anything like this.
has title: Try Catch and Finally with Return Statements
upvote count: 1
accepted answer: http://stackoverflow.com/a/22409374
downvote count: 0
has answer: http://stackoverflow.com/a/22409698
tagged with: finally
favorite count: 0
duplicate of: http://stackoverflow.com/q/16030858
tagged with: return
has answer: http://stackoverflow.com/a/22409374
possible better answer: http://stackoverflow.com/a/22409698
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/16030858
type: Question
tagged with: try-catch
answer count: 2

http://stackoverflow.com/comment/65912777
type: Comment
type: AnswerComment
has text: Note that `newXMLGregorianCalendar(..)` is not a static method as the answer may suggest. Use `DatatypeFactory.newInstance().newXMLGregorianCalendar(..)` instead.
comment on: http://stackoverflow.com/a/22384004
score: 0

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/22426593
tags question: http://stackoverflow.com/q/22454011
tag name: android-actionbar

http://stackoverflow.com/q/22345617
has title: Hibernate one to many mapping with additional relation table
has body: I want to have two tables with one to many relation that are linked by third table. How can I approach this? I want to create exactly the same thing as in this tutorial but using one-to-many instead of many-to-many with unique="true"
has comment: http://stackoverflow.com/comment/33967031
tagged with: one-to-many
type: Question
has comment: http://stackoverflow.com/comment/33966817
has comment: http://stackoverflow.com/comment/33962990
answer count: 1
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33966496
has answer: http://stackoverflow.com/a/22349837
type: UnansweredQuestion

http://stackoverflow.com/a/22456960
has comment: http://stackoverflow.com/comment/34161068
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22456451
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/34157070
score: 2
has comment: http://stackoverflow.com/comment/34157713
has body: Putting your database calls on a separate thread puts you on the right track. However, to update the GUI after each thread completes you need to put the GUI update into a Runnable then call SwingUtilities.invokeLater(Runnable). Here is a rough pseudo-ish example: public void hitDatabase() { Thread thread = new Thread(new DatabaseHelper()); thread.start(); } private static class DatabaseHelper implements Runnable { public void run() { //Hit the DB here codeToHitDB(); //Once Complete update the GUI Runnable runnable = new Runnable() { public void run() { //Update your GUI } }; SwingUtilities.invokeLater(runnable); } } This tutorial will give you more info: http://docs.oracle.com/javase/tutorial/uiswing/concurrency/ There is also a SwingWorker class that some people claim makes this easier. There are details about SwingWorker in the tutorial.
accepted answer of: http://stackoverflow.com/q/22456451
downvote count: 0

http://stackoverflow.com/comment/34116277
has text: Thanks for your answer, I used Eclipse Gemini (previously Spring DM) until now but I've heard many rumors like it's not maintained and doesn't handle well service tracking. So, I've started looking at DS and I encountered an integration issue with Spring. I asked on the Eclipse Gemini forums and they say it is maintained and they are closed to release 2.0.M3. I used it until now and I didn't see any issue. Also, Apache Aries doesn't seem to be more active.
type: Comment
comment on: http://stackoverflow.com/a/22398200
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34071807
has text: Checking the sign bit (leftmost bit) should be enough
type: QuestionComment
comment on: http://stackoverflow.com/q/22409102
type: Comment
score: 9

http://stackoverflow.com/comment/79120764
type: Comment
comment on: http://stackoverflow.com/a/33331557
type: AnswerComment
has text: @Havnar In SBT you should use an ExclusionRule instead
score: 0

http://stackoverflow.com/q/22366463
answer count: 2
accepted answer: http://stackoverflow.com/a/22366528
downvote count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/22367150
has comment: http://stackoverflow.com/comment/33998980
has title: convert arraylist data from object / float to int to use in a method
has comment: http://stackoverflow.com/comment/34002431
favorite count: 0
has comment: http://stackoverflow.com/comment/33999066
possible better answer: http://stackoverflow.com/a/22367150
has answer: http://stackoverflow.com/a/22366528
has comment: http://stackoverflow.com/comment/33999091
has body: I have an arraylist in a class that I store number in. The method in the class that adds data to the arraylist takes one float parameter - this is because some of the data is float and some is integer. I need to extract some of the data with a method and convert it to an Int but cant work out how to. Ive tried various was of casting etc but because it is objects in the arraylist I cant get it working. (So if this isnt sounding too clear , ive been at this for 8 hours straight so brain is a bit fried now) For example , the arraylist is called subjectsResults and Ive tried: numberOfA = (Integer)subjectsResults.get(1); where numberOfA is an Int (i know where the index is of the data also - that is why I reference 1 directly) Ive tried using toString and parseInt and things like this: numberOfA = (Integer.parseInt((String)subjectsResults.get(1))); How can I achieve this - i need to extract the number from index(1) to use in a switch/case statement to show a menu choice
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33999128
type: Question
has comment: http://stackoverflow.com/comment/33999198

http://stackoverflow.com/comment/34007365
score: 0
type: Comment
has text: As the answer is very likely to depend on it: What tool did you use to "create" an executable from a jar? Clearly it's the documentation of that tool you need to look at, if it's failing to pass on command-line arguments.
type: QuestionComment
comment on: http://stackoverflow.com/q/22371767

http://stackoverflow.com/comment/34150519
type: AnswerComment
comment on: http://stackoverflow.com/a/22452764
type: Comment
has text: @Pshemo: you alright it's mean "zero-width negative lookahead"
score: 0

http://stackoverflow.com/a/22340367
answers question: http://stackoverflow.com/q/22340309
score: 4
type: Answer
upvote count: 4
has body: This isn't really what ideone was designed for; it's meant to be a tool to share small snippets of code, e.g. for posting on StackOverflow. It's not meant to be an IDE for an entire project. In this case, the error message is telling you that behind the scenes, ideone saves your code to a file Main.java and so it expects your class to be named Main, not IncomeTaxCalculator. Alternatively, the class can be made not public. The following is the ideone template for Java snippets. It explains the requirements clearly: /* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { // your code goes here } }
downvote count: 0

http://stackoverflow.com/comment/34231391
has text: @EJP Well, I disagree with your disagreement. First, SO is for questions useful to a larger audience - while a "yes" may be enough for OP it certainly won't suffice for a general audience; thus it can never fit SO's quality standards IMO. Second, there is always more to be said about it, for example why this is so. Also, "there are no alternatives" is (1) plain wrong (I could write my own algorithm that wouldn't be restricted by some policy files) and (2) a fact that would be useful to include in the answer.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22474343

http://stackoverflow.com/a/32660542
upvote count: 3
score: 3
has body: It could also happen if you have differing versions of the same library imported in your build.gradle vs one in one of your libraries. For example, Google Play Store services requires you have them all refer to the same version I had: app build.gradle compile 'com.google.android.gms:play-services-base:7.5.0' whereas: module/library build.gradle compile 'com.google.android.gms:play-services-cast:7.8.+' Upgrading my app's version to 7.8.0 solved the problem
downvote count: 0
answers question: http://stackoverflow.com/q/22468700
type: Answer

http://stackoverflow.com/a/22332917
downvote count: 0
type: Answer
score: 1
type: AcceptedAnswer
has body: Don't create another JFrame, since your class is already a JFrame. OR just use the instance JFrame and don't extend JFrame for the class. See Extends JFrame vs. creating it inside the the program You are trying to add the buttons to the instance JFrame and the JScrollPane to the class JFrame you need to choose one or the other and stick to it. Use JPanel or JComponent as a container and not Container You can nest containers (JPanels) with different layout managers to get your desired look. See Laying out Components Within a Container for help if your confused. See this example for how you can use nested JPanels with different layout managers. "oh and there is a JList that goes with one of the buttons." - doesn't really make sense. I see you trying to dispose of your main frame and opening a new one. Don't do that. Instead use a CardLayout. The layout will "layer" panels and allow you to navigate through them. See How to Use CardLayout. Also see a simple example here
accepted answer of: http://stackoverflow.com/q/22331978
upvote count: 1
answers question: http://stackoverflow.com/q/22331978

http://stackoverflow.com/q/22474702
has answer: http://stackoverflow.com/a/22475308
accepted answer: http://stackoverflow.com/a/22475055
has comment: http://stackoverflow.com/comment/34187609
has comment: http://stackoverflow.com/comment/34187944
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34187578
linked to: http://stackoverflow.com/q/9097830
has comment: http://stackoverflow.com/comment/34187871
has title: How to set different colors to ArrayList content in Java
tagged with: java
has comment: http://stackoverflow.com/comment/34187534
type: Question
tagged with: jtextarea
has answer: http://stackoverflow.com/a/22499608
has answer: http://stackoverflow.com/a/22475055
has body: I am scanning the files with different extension and putting them in String ArrayList in Java(the names with extension). I want to print with different colors into JTextArea by looking the extesions for example .xls extension as green color , .txt extension as blue color. Here is my code below ; public void setScanResult(ArrayList&lt;String&gt; x) { textArea.append("|"); for (int i = 0; i &lt; x.size(); i++) { textArea.append("\n"); textArea.append((String) x.get(i)); } x.clear(); }
linked to: http://stackoverflow.com/q/15916249
tagged with: arraylist
score: 0
possible better answer: http://stackoverflow.com/a/22499608
answer count: 3

http://stackoverflow.com/a/22460383
type: Answer
has body: fge's solution is certainly clever and reduces the lines of code. However, I feel some of the meaning is lost when glancing at that snippet of code. I would encourage you to embrace readable code, even if it's slightly more verbose. My solution would be to test these preconditions before beginning a method. If the precondition fails, throw an exception. Either write your own validation methods or use something like Apache Commons Lang Validate class. Then your code would look something like: Validate.notEmpty(text1, "error message"); Validate.notEmpty(text2, "error message"); Validate.notEmpty(text3, "error message"); Validate.notEmpty(text4, "error message"); // This line is only reached if all fields are non-empty I think this is easy to read, which is half the battle won.
downvote count: 0
answers question: http://stackoverflow.com/q/22460065
score: 3
upvote count: 3

http://stackoverflow.com/comment/34128282
type: AnswerComment
has text: The running time of this method would be O(2n) = O(n), right?
type: Comment
comment on: http://stackoverflow.com/a/22440168
score: 0

http://stackoverflow.com/comment/33980887
score: 0
type: Comment
type: QuestionComment
has text: No. That is an INFO message, not an ERROR message. It is something you need to fix but not something that should cause any problems.
comment on: http://stackoverflow.com/q/22343344

http://stackoverflow.com/comment/34141481
has text: Thanks a lot for Quick response eis@. Let me try this setup.
score: 0
comment on: http://stackoverflow.com/a/22447983
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22430141
has comment: http://stackoverflow.com/comment/34110511
has comment: http://stackoverflow.com/comment/34110189
has comment: http://stackoverflow.com/comment/34110309
has comment: http://stackoverflow.com/comment/34110161
has comment: http://stackoverflow.com/comment/34110627
has comment: http://stackoverflow.com/comment/34110359
has comment: http://stackoverflow.com/comment/34109964
tagged with: oop
tagged with: opengl
tagged with: java
has body: I have a question that's kind of hard to explain so i'll try to do my best.. I have the following code that creates two new blocks: Block block2 = new Block(new Location(30,30,30),false, 20, blockTexture2, blockTexture2, blockTexture2, blockTexture2, blockTexture2, blockTexture2, false); hittableCubes.add(block2); block2.draw(); Block block = new Block(new Location(100,100,100),false, 20, blockTexture2, blockTexture2, blockTexture2, blockTexture2, blockTexture2, blockTexture2, false); hittableCubes.add(block); block.draw(); Then I have the following code to detect collision: public static boolean hitBlock(){ int count = 0; for(Block block: hittableCubes){ System.out.println(block.getLocation().getX() + " " + block.getLocation().getY() + " " + block.getLocation().getZ()); if(-block.getLocation().getX()+block.getSize() &gt;= camera.getX() &amp;&amp; -block.getLocation().getX()-block.getSize() &lt;= camera.getX() &amp;&amp; -block.getLocation().getY()+block.getSize() &gt;= camera.getY() &amp;&amp; -block.getLocation().getY()-block.getSize() &lt;= camera.getY() &amp;&amp; -block.getLocation().getZ()+block.getSize() &gt;= camera.getZ() &amp;&amp; -block.getLocation().getZ()-block.getSize() &lt;= camera.getZ() ){ count++; } } if(count != 0){ return true; }else{ return false; } } the collision detection works for "block", but not "block2". The block2's location is actually at popping up at 130,130,130 not 100,100,100. When I create another block at 20,20,20, the new blocks location would be at 150,150,150, and block2 would be at 130,130,130. Any idea why this is happening? This is my Block class: package threeD; public class Block { Texture textureFront; Texture textureBehind; Texture textureLeft; Texture textureRight; Texture textureBottom; Texture textureTop; float cubeSize; Location location; boolean debuggingMode = false; CameraMovement camera; /* * * XY controls the spot the cube is located (XY,XY) * * Z controls the size of the cube (Z,Z) * */ public Block(Location l…
has comment: http://stackoverflow.com/comment/34109846
tagged with: collision-detection
has comment: http://stackoverflow.com/comment/34109669
type: Question
has comment: http://stackoverflow.com/comment/34110914
has comment: http://stackoverflow.com/comment/34120726
score: 0
has comment: http://stackoverflow.com/comment/34109743
tagged with: multiple-instances
has title: Creating Multiple Instances of the Same Class
has comment: http://stackoverflow.com/comment/34109930
has comment: http://stackoverflow.com/comment/34109812
answer count: 0
has comment: http://stackoverflow.com/comment/34110806
type: UnansweredQuestion

http://stackoverflow.com/comment/34176458
comment on: http://stackoverflow.com/q/22467899
score: 0
type: QuestionComment
type: Comment
has text: `SimpleDateFormat dateFormat=new SimpleDateFormat("MM/dd/yyyy"); System.out.println(dateFormat.format(new Date()));`

http://stackoverflow.com/q/22467153
has body: I'm having a problem with my code. We're working on binary search, and I can't seem to get the right output whenever I input a number. We were given a list of 60 numbers already in order(external file), and whatever number we input, the program should search and return the position. If the number is not on the list, it should return a -1. My code: import java.io.*; import java.util.*; public class Prog489 { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); System.out.print("Enter a number to search for: "); int search = scan.nextInt(); Scanner kbReader = new Scanner(new File("C:\\Users\\Guest\\Documents\\java programs\\Prog489\\Prog489.in")); int[] num = new int[60]; int i = 0; System.out.println(binarySearch(num, search)); while(kbReader.hasNextInt()) { num[i++] = kbReader.nextInt(); } } private static int binarySearch(int[] num, int search) { int lb = 0; int ub = num.length - 1; while(lb&lt;=ub) { int mid = (lb+ub)/2; if(num[mid] == search) { return mid; } else if(search&gt;num[mid]) { lb=mid+1; } else { ub = mid-1; } } return -1; } } So the part with the return should only return -1 if the number is not on the list. But whenever I do enter a number on the list (such as 60), it still returns a -1. Everything compiles, so I'm not really sure what I'm missing, or if it's something really obvious that I'm forgetting. Could someone please help me identify the error? Any guidance/feedback is greatly appreciated.
has comment: http://stackoverflow.com/comment/34175138
tagged with: binary-search
has comment: http://stackoverflow.com/comment/34175092
has answer: http://stackoverflow.com/a/22467212
upvote count: 1
has comment: http://stackoverflow.com/comment/34175230
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34176259
has title: Binary search gives incorrect output Java
has comment: http://stackoverflow.com/comment/34175162
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34176287
type: Question

http://stackoverflow.com/q/22348959
tagged with: java
type: Question
has body: I need to know how i can scale the uploaded images and save it on the server in the Upload folder. I have this to process the the form where people can upload there files. public void init() { fileSavePath = getServletContext().getRealPath("/") + File.separator + UPLOAD_DIRECTORY;/*save uploaded files to a 'Upload' directory in the web app*/ if (!(new File(fileSavePath)).exists()) { (new File(fileSavePath)).mkdir(); // creates the directory if it does not exist } } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException { String resp = ""; int i = 1; resp += "&lt;br&gt;Here is information about uploaded files.&lt;br&gt;"; try { MultipartParser parser = new MultipartParser(request, 1024 * 1024 * 1024); /* file limit size of 1GB*/ Part _part; while ((_part = parser.readNextPart()) != null) { if (_part.isFile()) { FilePart fPart = (FilePart) _part; // get some info about the file String name = fPart.getFileName(); if (name != null) { long fileSize = fPart.writeTo(new File(fileSavePath)); resp += i++ + ". " + fPart.getFilePath() + "[" + fileSize / 1024 + " KB]&lt;br&gt;"; } else { resp = "&lt;br&gt;The user did not upload a file for this part."; } } }// end while } catch (java.io.IOException ioe) { resp = ioe.getMessage(); } request.setAttribute("message", resp); getServletContext().getRequestDispatcher("/index.jsp").forward(request, response); } For example i need to rezise all the image to 100x100
tagged with: servlets
score: 0
tagged with: scale
answer count: 1
tagged with: jsp
type: UnansweredQuestion
has title: Scale image after upload JSP
has answer: http://stackoverflow.com/a/22364757

http://stackoverflow.com/q/22471407
has comment: http://stackoverflow.com/comment/34182194
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22498847
has comment: http://stackoverflow.com/comment/34183260
type: Question
has body: I'm making a POST call from within Java, and I'm not sure why it's not going through. The code is as follows: String screencastStartURL = "......"; List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1); nameValuePairs.add(new BasicNameValuePair("stateID", s_id)); nameValuePairs.add(new BasicNameValuePair("startTime", screencastStartTime)); nameValuePairs.add(new BasicNameValuePair("identifier", screencastId)); System.out.println("about to make postCall"); String postResponse = Commons.postCall(screencastStartURL, nameValuePairs); out.println(postResponse); // out is an earlier instantiated PrintWriter The postCall method is as follows: public static String postCall(String url, List&lt;NameValuePair&gt; nameValuePairs) { System.out.println("Within postCall method"); String ans = ""; HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); try { System.out.println("Within postCall method 2"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); ans = (EntityUtils.toString(response.getEntity())); } catch (IOException e) { e.printStackTrace(); } return ans; } When I deploy this code on my Tomcat Server, it prints about to make postCall in the terminal, which means it successfully executes till before the POST call is made. But then, it doesn't print Within postCall method which means something goes wrong in the call itself? The error message that I see is a NullPointerException which causes a ServletException Edit However when I make the POST call using the POSTMAN Rest Client Chrome App, it goes through successfully. Second Edit The stack trace that I see in my browser is exception javax.servlet.ServletException: Servlet execution threw an exception root cause java.lang.ExceptionInInitializerError com.bl.apps.MemoLocalRecorder.App.doGet(App.java:121) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(H…
has comment: http://stackoverflow.com/comment/34182146
tagged with: servlets
tagged with: post
score: 0
has comment: http://stackoverflow.com/comment/34182418
accepted answer: http://stackoverflow.com/a/22498847
answer count: 1
has comment: http://stackoverflow.com/comment/34182475
has comment: http://stackoverflow.com/comment/34182061
tagged with: rest
has title: Failed POST call
has comment: http://stackoverflow.com/comment/34182068
has comment: http://stackoverflow.com/comment/34182147
has comment: http://stackoverflow.com/comment/34182172
has comment: http://stackoverflow.com/comment/34181996

http://stackoverflow.com/comment/34196937
has text: No worries :) If you think it answered your question (or any of the other answers for that matter) please mark one as correct :)
comment on: http://stackoverflow.com/a/22480221
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/34053997
has text: @ManishDubey dialog.dismiss(); before return "hello";
comment on: http://stackoverflow.com/q/22398686
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34193842
type: QuestionComment
score: 0
has text: Check if they're the same size. Make sure you're writing using binary and not ascii mode.
comment on: http://stackoverflow.com/q/22478224
type: Comment

http://stackoverflow.com/comment/34201684
has text: I tried that already, and it kept on generating the compound primary key..
comment on: http://stackoverflow.com/q/22462061
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/44133406
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22380204
has body: String name = modelDispatchReportList.get(position).getName(); //get name from model class typed List String text = "&lt;font color='#000000'&gt;" + name + "&lt;/font&gt;"; //change color of name /* check version of API to call method of Html class because fromHtml method is deprecated * */ if (android.os.Build.VERSION.SDK_INT &lt;= android.os.Build.VERSION_CODES.N) { Log.d(TAG, "onBindViewHolder: if"); holder.textViewName.setText("12345" + " "); //set text to textView holder.textViewName.append(Html.fromHtml(text)); //append text to textView } else { Log.d(TAG, "onBindViewHolder: else"); holder.textViewName.setText("12345" + " "); //set text to textView holder.textViewName.append(Html.fromHtml(text, 0)); ////append text to textView }
downvote count: 0

http://stackoverflow.com/comment/34085650
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22416578
has text: Post it as an answer @regettman, I was about to but you already put it here so now I feel like I'd be poaching if I did :P
score: 0

http://stackoverflow.com/q/22400057
tagged with: java
tagged with: mysql
type: Question
answer count: 2
tagged with: tomcat
tagged with: android
has title: android application connect to local server via mysql database?
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/22400162
tagged with: php
has body: I need to send data from an android application to the database, then access the same from a webpage with the help of a local server. Can anyone suggest me how to link an android app to the database and view the same on a browser? What are all the tools required? If anyone can also help me by suggesting me a way or giving me suitable links of tutorials that can help, I'll be thankful! Cheers
has answer: http://stackoverflow.com/a/22400285

http://stackoverflow.com/comment/34086977
has text: i can't see anything related to the type of used arrays in the task
score: 0
comment on: http://stackoverflow.com/a/22401119
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34041909
has text: @Mac Yes! 1+'a' = 'b' Perhaps you should review that `char` is a numerical type, `'a'` is the exact same as `97` and `0x61`.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22389399

http://stackoverflow.com/comment/34119122
type: Comment
comment on: http://stackoverflow.com/a/22435681
type: AnswerComment
score: 0
has text: I really should take a coffee or any kind of brake :)

http://stackoverflow.com/q/22419338
tagged with: forever
has title: Notify doesnt work.. waitng forever thread Java
accepted answer: http://stackoverflow.com/a/22419411
favorite count: 0
has comment: http://stackoverflow.com/comment/34090619
tagged with: multithreading
upvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22419411
tagged with: notify
type: Question
has comment: http://stackoverflow.com/comment/34090653
answer count: 1
has body: Hello I am new to programming and I am trying to do a simple Producer-Consumer problem..but unfortunately my thread waits forever..notify doesnt work..any ideas? :/ public synchronized void order() throws Exception{ System.out.println("User "+name+" requests:\n"+"cherries=" + cherries); while(checkValues()==true){ System.out.println(name+" waiting"); wait(); } notify(); Update(); store.toString(); System.out.println(name+" gets resources "); Thread.sleep(5000); }
downvote count: 0
score: 1
tagged with: wait

http://stackoverflow.com/a/22438244
upvote count: 2
has comment: http://stackoverflow.com/comment/34124202
has comment: http://stackoverflow.com/comment/34124528
accepted answer of: http://stackoverflow.com/q/22437908
has comment: http://stackoverflow.com/comment/34124722
has comment: http://stackoverflow.com/comment/34124775
has body: Implement the Comparable&lt;T&gt; interface on the DVD class like so: public class DVD implements Comparable&lt;DVD&gt; This requires you to define a new method; compareTo This allows you to define how two objects should be ordered with respect to each other. In this instance, it would make sense for an older DVD to be "greater" than a newer DVD, so your (very basic) implementation of compareTo could look something like this: public int compareTo(DVD that) { if (age &gt; that.getAge()) { // this is older than that return 1; } else if (age &lt; that.getAge()) { // this is newer than that return -1; } // this is the same age as that return 0; } Once you have done that, you can use Arrays.sort(dvdList) to get your collection sorted into age order. From there, it is a matter of picking the first and last elements in the collection, which will be your oldest and newest DVDs respectively. In practice you might want to add some null-checking to compareTo to avoid problems if that is null.
score: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34124753
downvote count: 0
has comment: http://stackoverflow.com/comment/34123957
has comment: http://stackoverflow.com/comment/34123642
type: Answer
answers question: http://stackoverflow.com/q/22437908

http://stackoverflow.com/q/22399215
accepted answer: http://stackoverflow.com/a/22512076
has comment: http://stackoverflow.com/comment/34197511
tagged with: java
has comment: http://stackoverflow.com/comment/34199022
has comment: http://stackoverflow.com/comment/34203664
downvote count: 1
has comment: http://stackoverflow.com/comment/34095499
has comment: http://stackoverflow.com/comment/34055344
type: Question
has body: Please help. I spent entire day trying all answers to similar questions on SO, but with no luck. All i need is to save object in database. persist() didn't save anything, persist() + flush() throws exception javax.persistence.TransactionRequiredException: no transaction is in progress. web.xml <?xml version="1.0" encoding="UTF-8"?> org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/spring/kshop-security.xml, /WEB-INF/spring/root-context.xml appServlet org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/spring/appServlet/servlet-context.xml 1 appServlet / <!-- jsp *.html encoding-filter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true encoding-filter /* springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* root-context.xml <?xml version="1.0" encoding="UTF-8"?> <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" 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.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"> <context:component-scan base-package="org.shahapps.kshop.domain" /> <context:component-scan base-package="org.shahapps.kshop.dao" /> <context:property-placeholder location="/resources/database.properties" /> <property name="driverClassName" value="${database.driver}" /> <property name="url" value="${database.url}" /> <property name="username" value="${database.user}" /> <property name="password" value="${database.password}" /> <property name="database" value="MYSQL" /> <property name="showSql" value="t…
has title: Spring MVC+AngularJS+JPA+MySQL persist won't save into database. No transaction in progress
tagged with: jpa
score: -1
has comment: http://stackoverflow.com/comment/34079871
has answer: http://stackoverflow.com/a/22512076
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34055729
has comment: http://stackoverflow.com/comment/34197313
favorite count: 0
has comment: http://stackoverflow.com/comment/34252150
tagged with: spring
has comment: http://stackoverflow.com/comment/34122370
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/a/22441399
type: Answer
answers question: http://stackoverflow.com/q/22440564
has body: You could achieve this by maintaining a queue of nodes which do not yet have two children. Every time you add a new node, stick it on the end of this queue, and also make it a child of the node at the front of this queue. Once the node at the front has two children, remove it from the queue. This way you'll build it up one level at a time, left to right, and only move on to the next level once the current one is finished.
downvote count: 0
has comment: http://stackoverflow.com/comment/34150988
score: 1
has comment: http://stackoverflow.com/comment/34174458
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34129853
accepted answer of: http://stackoverflow.com/q/22440564
upvote count: 1

http://stackoverflow.com/a/22396491
answers question: http://stackoverflow.com/q/22389404
score: 0
has body: Try replacing the reader.parse line with the following (sorry, unable to test it): final javax.servlet.ServletContext servletContext = this.getServletContext(); java.io.InputStream stream = servletContext.getResourceAsStream("/WEB-INF/MapInfo.xml"); reader.parse(stream);
type: Answer

http://stackoverflow.com/a/22338294
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22337912
has body: You basically have two options: Write your own CSV parser Use an existing CSV library For (1), if all the record in the dataset are 1 line each, then you can read them using the readLine() method of the BufferedReader class and for each record (line) you can read/write character-by-character, making sure not to replace the escaped separators (e.g., commas within quotes). If the dataset has complicated special cases like multiline records or other types of escaped characters (e.g., '\,'), don't even try (1) and follow the best approach, which in all cases is (2). A CSV library (chose one that preserves spaces among fields, like OpenCSV) will allow you to read all records very fast (in the order of tens or hundreds of thousands of records per second, depending on how many fields a record has) and extract all the fields, which you will then need to rewrite to disk by joining them into records, separated by the new delimiter. The whole task should not need 1 hour. It should be doable in around 15'.
upvote count: 1

list
type: Tag
tags question: http://stackoverflow.com/q/22440898
tags question: http://stackoverflow.com/q/22355238
tags question: http://stackoverflow.com/q/22362001
tags question: http://stackoverflow.com/q/22428981
tags question: http://stackoverflow.com/q/22329883
tag name: list
tags question: http://stackoverflow.com/q/22423302
tags question: http://stackoverflow.com/q/22384165
tags question: http://stackoverflow.com/q/22442056
tags question: http://stackoverflow.com/q/22410332
tags question: http://stackoverflow.com/q/22440141
tags question: http://stackoverflow.com/q/22332489
tags question: http://stackoverflow.com/q/22428431
tags question: http://stackoverflow.com/q/22338519
tags question: http://stackoverflow.com/q/22384757
tags question: http://stackoverflow.com/q/22426827
tags question: http://stackoverflow.com/q/22471665
tags question: http://stackoverflow.com/q/22366126
tags question: http://stackoverflow.com/q/22350420
tags question: http://stackoverflow.com/q/22440979

http://stackoverflow.com/q/22437998
tagged with: java
has comment: http://stackoverflow.com/comment/34126598
type: Question
tagged with: jtable
has comment: http://stackoverflow.com/comment/34126376
has body: I have a JTable that's filled with the inventory data of a garage. It has parts, number in storage etc. At this moment i have a JOptionPane where you can enter the data if you want to add a new part to the inventory. that works fine but how do i refresh the JTable data after the part is added? This is the code I use to fille the table initially : private String[] kolommenOnderdelen = { "Nr", "Omschrijving", "Vooraad" }; private DefaultTableModel modelOnderdelen = new DefaultTableModel(kolommenOnderdelen, 0); for (Onderdeel a : voorraad.alleOnderdelen()) { modelOnderdelen.addRow(new String[] { Integer.toString(a.getOnderdeelNummer()), a.getOnderdeelOmschrijving(), Integer.toString(a.getOnderdeelVoorraad()) }); } tabelOnderdelen = new JTable(modelOnderdelen) and this is the code I have for the JOptionPane if (JOptionPane.showConfirmDialog(null, nieuwOnderdeel, "Voer de gegevens van het nieuwe onderdeel in", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { if (!onderdeelOmschrijving.getText().equals("") &amp;&amp; !onderdeelNR.getText().equals("") &amp;&amp; !onderdeelVoorraad.getText().equals("")) { if (voorraad.voegOnderdeelToe(new Onderdeel( onderdeelOmschrijving.getText(), Integer .parseInt(onderdeelNR.getText()), Integer .parseInt(onderdeelVoorraad.getText())))) { JOptionPane.showMessageDialog(null, "Het onderdeel is toegevoegd"); } } else { JOptionPane.showMessageDialog(null, "Niet volledig ingevuld", "Vul alle gegevens in!", JOptionPane.ERROR_MESSAGE); } }
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22438125
favorite count: 0
has comment: http://stackoverflow.com/comment/34122912
has comment: http://stackoverflow.com/comment/34124130
has answer: http://stackoverflow.com/a/22438125
has title: Refresh JTable after adding to ArrayList
score: 1
upvote count: 1
tagged with: swing
type: AnsweredQuestion
tagged with: defaulttablemodel

http://stackoverflow.com/comment/34150911
type: AnswerComment
type: Comment
has text: Our Jenkins was configured with '.' as the value for Default settings provider. Fixing it here makes the error go away for any new projects.
comment on: http://stackoverflow.com/a/22451632
score: 0

http://stackoverflow.com/a/22443205
answers question: http://stackoverflow.com/q/22443053
has body: It looks like that you got a missing dependency. There is a similar post on the ocpsoft forum. (http://ocpsoft.org/support/topic/cannot-deploy-project-if-i-add-integration-faces-2-0-5-jar/)
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22443053

http://stackoverflow.com/a/22329421
has comment: http://stackoverflow.com/comment/33934407
has comment: http://stackoverflow.com/comment/33934481
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22328903
has body: This code works pretty well to get a high-res photo: Uri my_contact_Uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(id)); InputStream photo_stream = ContactsContract.Contacts.openContactPhotoInputStream(cr, my_contact_Uri, true); BufferedInputStream buf = new BufferedInputStream(photo_stream); Bitmap my_btmp = BitmapFactory.decodeStream(buf); buf.close(); return my_btmp; Also, just fyi, high-res contact photos didn't exist before API 14, so if you're running it on a AVD/Device with API 13 or less, you can't get a high-res photo. Look at this question: Get high-res contact photo as bitmap below API level 14 Android for more info.
answers question: http://stackoverflow.com/q/22328903

http://stackoverflow.com/comment/34111378
comment on: http://stackoverflow.com/a/22431226
has text: Could you provide the entire stack trace and all of your classes that are involved in it?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22412953
downvote count: 0
has body: I have been doing some research, and as I have suggested, you can either register the number of "things" going into array - and then store that somewhere. So when you do undo - it removes last objects inserted. So think of it in this way: The container is holding the number of items entered into the array = 1,2,4,2 Array = {[x][x,x][x,x,x,x][x,x]} If you want to remove the last action, you take from container 2 and remove the last entry from the array so you are left with: Container holding number of items entered into array = 1,2,4 Array = {[x][x,x][x,x,x,x]} And so on and so forth. Also, you can have a look at this interesting pattern that provides the ability to restore an object to its previous state.
has comment: http://stackoverflow.com/comment/97277270
upvote count: 2
answers question: http://stackoverflow.com/q/22412569
type: Answer
score: 2

http://stackoverflow.com/a/22446670
has comment: http://stackoverflow.com/comment/34139850
type: Answer
has body: Well, one problem is at the very last line of your main method: if(me.totalHand() &gt; dealer.totalHand()) System.out.println("You win!"); me.rewardBet(); You need to wrap this body in braces - the if statement if only functioning on the print statement. Although this doesn't seem as though it will fix the problem that you've described. Perhaps you should consider doing a different design altogether, and avoid using so much duplicate code. BlackJack: public class BlackJack { private Deck deck; private Player me; private Player dealer; public static void main(String[] args) { BlackJack game = new BlackJack(); game.run(); } public BlackJack() { deck = new Deck(); deck.shuffle(); me = new Player("Joe", 1000.0); dealer = new Player("Dealer", 0); } public void run() { double bet = requestBet(me); // Deal your first two cards dealNextCard(me, "Your first card is "); dealNextCard(me, "Your second card is "); me.printHandTotal(); // Deal dealer's first card dealNextCard(dealer, "Dealer showing "); while(requestHitOrStay()) { dealNextCard(me, "Your next card is "); me.printHandTotal(); if(me.totalHand() == 21) { System.out.println(me.getName() + " wins!"); rewardBet(me, bet); System.exit(0); } else if(me.totalHand() &gt; 21) { System.out.println(me.getName() + " bust!"); System.exit(0); } } while(dealer.totalHand() &lt; 17) { dealNextCard(dealer, "Dealer draws "); dealer.printHandTotal(); if(dealer.totalHand() == 21) { System.out.println(dealer.getName() + " wins!"); System.exit(0); } else if(dealer.totalHand() &gt; 21) { System.out.println(dealer.getName() + " bust. You win!"); rewardBet(me, bet); System.exit(0); } } if(me.totalHand() &gt; dealer.totalHand()) { System.out.println("You win!"); rewardBet(me, bet); } else if(me.totalHand() &lt; dealer.totalHand()) { System.out.println("Loooooser"); } else { System.out.println("Push. Nobody wins"); } } public boolean requestHitOrStay() { System.out.print("Hit or Stay? "); Scanner in = new Scanner(System.in); return in.nextLine(…
has comment: http://stackoverflow.com/comment/34140026
score: 1
accepted answer of: http://stackoverflow.com/q/22445642
upvote count: 1
answers question: http://stackoverflow.com/q/22445642
has comment: http://stackoverflow.com/comment/34140050
has comment: http://stackoverflow.com/comment/34140270
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34037855
has text: @ElliottFrisch Since the method is creating and updating the .class in the src folder, could I not use Reflection to load the class every time the user updates their code? If so, would you be able to provide example of that?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22389030
score: 0

http://stackoverflow.com/q/22329253
type: Question
has answer: http://stackoverflow.com/a/22330522
has comment: http://stackoverflow.com/comment/33934582
has answer: http://stackoverflow.com/a/22329379
has answer: http://stackoverflow.com/a/22329811
downvote count: 0
has title: What event should I use to detect parent JFrame closing in custom JComponent?
favorite count: 0
accepted answer: http://stackoverflow.com/a/22329811
has answer: http://stackoverflow.com/a/22329799
tagged with: windowlistener
has body: I have a custom JComponent placed in a JFrame (Well placed in a JPanel on a JFrame). I have used setDefaultCloseOperation() to set my JFrame to DISPOSE_ON_CLOSE. My custom component has a Timer that continues to run after the frame has been closed. I know I could add a WindowListener to the JFrame and then make a call to the custom component to stop, but I would prefer to have my component be completely encapsulated. Is there any event I can use to detect when the parent JFrame has been closed from within my JComponent?
has comment: http://stackoverflow.com/comment/33934618
tagged with: jframe
possible better answer: http://stackoverflow.com/a/22329799
has comment: http://stackoverflow.com/comment/33933904
answer count: 4
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: swing

http://stackoverflow.com/q/22362235
type: Question
upvote count: 1
answer count: 1
has title: Start Selenium driver server programmatically before opening browser in a remote machine
favorite count: 0
has answer: http://stackoverflow.com/a/22363882
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33993161
tagged with: selenium-webdriver
score: 1
has body: Whenever we use RemoteWebDriver to execute selenium-webdriver tests in remote machine, we need to start up selenium-server-standalone-x.x.x.jar in remote machine. So far, I am doing it manually using the following command: java -jar selenium-server-standalone-x.x.x.jar Is there anyway I can do it programmatically before starting up remote browser. Below is the code I am using to drive ff in remote browser: // Declare firefox capabilities DesiredCapabilities capability = DesiredCapabilities.firefox(); // Create a remote web driver WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capabilities); // Navigate to test site driver.navigate().to("http://www.google.com");
tagged with: java

http://stackoverflow.com/q/22429577
tagged with: wait
has body: I just wanted to know if Thread1 adds elements to a list with a synchronized method and Thread2 tries to add elements to the same list does Thread2 wait until Thread1 has finished adding its elements or does it just check and if it can't access the method then it doesn't even bother trying to add elements to the list anymore? Thank you!
tagged with: synchronization
has comment: http://stackoverflow.com/comment/34108132
has answer: http://stackoverflow.com/a/22429646
type: AnsweredQuestion
score: 0
tagged with: java
has title: Does synchronized on methods make other threads that try to access that method wait until it is executed?
tagged with: multithreading
has comment: http://stackoverflow.com/comment/34108152
type: Question
linked to: http://stackoverflow.com/q/1321747
accepted answer: http://stackoverflow.com/a/22429646
has comment: http://stackoverflow.com/comment/34108212
answer count: 1

http://stackoverflow.com/a/22381702
has comment: http://stackoverflow.com/comment/34024082
has body: You have two different version dependency for hibernate entity-manager. This will not work. Remove one of them hibernate hibernate-entitymanager 3.4.0.GA ejb3-persistence org.hibernate ........................ org.hibernate hibernate-entitymanager 3.6.10.Final
type: Answer
answers question: http://stackoverflow.com/q/22381239
upvote count: 2
has comment: http://stackoverflow.com/comment/34024030
score: 2
downvote count: 0

http://stackoverflow.com/a/22358970
has comment: http://stackoverflow.com/comment/34015271
has comment: http://stackoverflow.com/comment/56220364
upvote count: 2
type: AcceptedAnswer
has body: Just a thought on using a single Job: total_count can be calculated from the map phase of the first job. Actually, it is already counted as MAP_OUTPUT_RECORDS. This is the sum of all the map output (key, value) pairs. So, if you always have 1 as value, then this sum is what you want, i.e. the total number of words in your document (with repetition). Now, I don't know if you can get this counter in the configuration of the reducers. Then, you could just output for each word the pair (word, wordCount/MAP_OUTPUT_RECORDS). I think you can do this through: New API: context.getCounter("org.apache.hadoop.mapred.Task$Counter", "MAP_OUTPUT_RECORDS").getValue(); Old API: reporter.getCounter("org.apache.hadoop.mapred.Task$Counter", "MAP_OUTPUT_RECORDS").getValue();
accepted answer of: http://stackoverflow.com/q/22357561
has comment: http://stackoverflow.com/comment/34015458
answers question: http://stackoverflow.com/q/22357561
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/56214993
has comment: http://stackoverflow.com/comment/34014240
has comment: http://stackoverflow.com/comment/34014160

http://stackoverflow.com/comment/34174406
type: QuestionComment
type: Comment
has text: I'm just executing it there EDIT: I mean at the time I'm calling this method it's only executed there. That is not the problem here I guess, without getMetaData it is working.
comment on: http://stackoverflow.com/q/22466691
score: 0

http://stackoverflow.com/q/22341422
has body: This is going to be a super newbie question and I've searched but just didn't find an adequate answer. So here's what I'm looking for: I'm looking for a cheap to free way to create a SQL database in the cloud. Basically, I should be able to go on the browser, log in to an admin panel and create new fields etc and populate them. Then I would like to be able to populate the database via a REST call to another database that responds in JSON format and sends the data over. Additionally, when I make the call to retrieve the contents from another server, I need to have some logic to modify the data. My expertise is in Java so I'm really just looking for a cloud based solution where I can write some code in Java to grab data from another server and populate my own database with it that I created in the cloud as well. I suspect there are a million ways to do this so if you could just give me an idea of the most basic one to get started, that'll be great! Thanks, -Vivek
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22342424
tagged with: java
tagged with: database
tagged with: mysql
type: Question
answer count: 2
tagged with: cloud
has answer: http://stackoverflow.com/a/22341452
score: 0
has title: Build a database in the cloud
tagged with: sql

http://stackoverflow.com/comment/33991807
comment on: http://stackoverflow.com/a/22361815
type: Comment
score: 1
type: AnswerComment
has text: Can be, then author should check the input, the one that he provided does have namespace

http://stackoverflow.com/comment/34053510
score: 0
has text: Hehehe, opps. Was calling `super.paint` instead of `super.paintComponent` :P
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22398193

http://stackoverflow.com/a/22449539
type: AcceptedAnswer
type: Answer
score: 2
has body: It's Unicode Characters. See this Link For More Info.Click Here
answers question: http://stackoverflow.com/q/22449400
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22449400
upvote count: 2

http://stackoverflow.com/q/22333509
has comment: http://stackoverflow.com/comment/33940650
has body: I'm planning to make a Twitter bot that tweets at the hour I want. I've managed to get the time every second with the following code, but when I the time is the time I want, nothing happens, it continues printing the time, like the time I've set is different to the actual time even if they're the same. Here's my code: import java.util.Calendar; public class Main { public static void main(String[] args) { while (true) { Calendar a = Calendar.getInstance(); //The time I want String wTime = "19:24:12"; String sec = Integer.toString(a.get(Calendar.SECOND)); String min = Integer.toString(a.get(Calendar.MINUTE)); String hour = Integer.toString(a.get(Calendar.HOUR_OF_DAY)); String time = hour + ":" + min + ":" + sec; System.out.println(time); if(time == wTime){ //Tweet something } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }
linked to: http://stackoverflow.com/q/513832
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: twitter
has comment: http://stackoverflow.com/comment/33941144
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33940593
possible better answer: http://stackoverflow.com/a/22333823
accepted answer: http://stackoverflow.com/a/22333593
has answer: http://stackoverflow.com/a/22333823
upvote count: 1
has title: Check time every second
has comment: http://stackoverflow.com/comment/33940618
favorite count: 0
has comment: http://stackoverflow.com/comment/33940756
has answer: http://stackoverflow.com/a/22333593
has comment: http://stackoverflow.com/comment/33940969
tagged with: multithreading

http://stackoverflow.com/q/22413429
downvote count: 0
score: 1
favorite count: 0
tagged with: android
tagged with: unity-game-engine
type: UnansweredQuestion
tagged with: joystick
upvote count: 1
type: Question
has body: I am using the Unity 3D standart assets (mobile) joystick, but I have a problem when I use it in my 2D game. I have no clue, how to achieve this: when the joystick goes left or right my character to follow or when i move it up, my character to jump So far I only have the interactive joystick working but not really moving the character. I would really appreciate some help. I am using the Free version of Unity. Thanks in advance
tagged with: 2d
tagged with: java
has title: Joystick setup in Unity 2d game
has answer: http://stackoverflow.com/a/22413504
answer count: 1

http://stackoverflow.com/comment/33939571
score: 0
has text: I got the increment to work but for some reason it is skipping some duplicates
comment on: http://stackoverflow.com/q/22332479
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22361365
has comment: http://stackoverflow.com/comment/33990349
has comment: http://stackoverflow.com/comment/36806462
has comment: http://stackoverflow.com/comment/33990073
answer count: 4
has answer: http://stackoverflow.com/a/26519193
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has title: Spring security custom token filter
has answer: http://stackoverflow.com/a/22361895
has body: I'm trying to perform a custom filter to get a token and validate it. I'm following the approach in this response. This is the relevant configuration: SecurityConfig: @Configuration @EnableWebSecurity @ComponentScan(basePackages = {"com.company.app"}) public class SecurityConfig extends WebSecurityConfigurerAdapter { @Inject AuthenticationTokenFilter authenticationTokenFilter; @Inject TokenAuthenticationProvider tokenAuthenticationProvider; @Override protected void configure(HttpSecurity http) throws Exception { http .addFilterBefore(authenticationTokenFilter, BasicAuthenticationFilter.class) .antMatcher("/*") .authenticationProvider(tokenAuthenticationProvider) .authorizeRequests() .anyRequest().authenticated(); } } AuthenticationTokenFilter: @Component public class AuthenticationTokenFilter implements Filter { private static final Logger logger = LoggerFactory.getLogger(AuthenticationTokenFilter.class); @Override public void init(FilterConfig fc) throws ServletException { logger.info("Init AuthenticationTokenFilter"); } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc) throws IOException, ServletException { SecurityContext context = SecurityContextHolder.getContext(); if (context.getAuthentication() != null &amp;&amp; context.getAuthentication().isAuthenticated()) { // do nothing } else { Map&lt;String,String[]&gt; params = req.getParameterMap(); if (!params.isEmpty() &amp;&amp; params.containsKey("auth_token")) { String token = params.get("auth_token")[0]; if (token != null) { Authentication auth = new TokenAuthentication(token); SecurityContextHolder.getContext().setAuthentication(auth); } } } fc.doFilter(req, res); } @Override public void destroy() { } } TokenAuthentication: public class TokenAuthentication implements Authentication { private String token; public TokenAuthentication(String token) { this.token = token; } @Override public Collection&lt;? extends GrantedAuthority&gt; getAuthorities() { return new ArrayList&lt;…
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/60720360
tagged with: spring-java-config
score: 9
type: Question
has comment: http://stackoverflow.com/comment/33989954
has answer: http://stackoverflow.com/a/44035312
downvote count: 0
has comment: http://stackoverflow.com/comment/33990145
has comment: http://stackoverflow.com/comment/78396856
tagged with: spring-security
has answer: http://stackoverflow.com/a/60304064
linked to: http://stackoverflow.com/q/19791406

http://stackoverflow.com/q/22341464
has answer: http://stackoverflow.com/a/22365411
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/33996816
has comment: http://stackoverflow.com/comment/33995122
has comment: http://stackoverflow.com/comment/33996271
linked to: http://stackoverflow.com/q/7201722
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33994408
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33995214
type: Question
tagged with: jvm-crash
has comment: http://stackoverflow.com/comment/33954800
tagged with: intellij-idea
accepted answer: http://stackoverflow.com/a/22365411
upvote count: 2
has body: Consider this code snippet: import java.awt.*; import java.io.*; public class V { public static void main(String[] args) { if (Desktop.isDesktopSupported()) try { Desktop.getDesktop().open(new File("C:\\")); //Or any file/folder } catch (IOException ex) { ex.printStackTrace(); } } } If I compile and run this through a command prompt it works fine and opens the folder as expected. However if I then open the same class and run it through Intellij it causes the JVM to crash. i.e Comes up with this screen Error details Problem signature: Problem Event Name: BEX Application Name: java.exe Application Version: 7.0.210.11 Application Timestamp: 515d68ea Fault Module Name: StackHash_d4e2 Fault Module Version: 0.0.0.0 Fault Module Timestamp: 00000000 Exception Offset: 6a2e6363 Exception Code: c0000005 Exception Data: 00000008 OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 5129 Additional Information 1: d4e2 Additional Information 2: d4e23849915837b7cd6589c72ebf3a65 Additional Information 3: 4c98 Additional Information 4: 4c989ca1785510040bc407d74228ddb4 The hs_err_pidxxxx.log file produces this # # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x4d81ff08, pid=7584, tid=3460 # # JRE version: 7.0_21-b11 # Java VM: Java HotSpot(TM) Client VM (23.21-b01 mixed mode windows-x86 ) # Problematic frame: # C 0x4d81ff08 # --------------- T H R E A D --------------- Current thread (0x498af400): JavaThread "Swing-Shell" daemon [_thread_in_native, id=3460, stack(0x4d550000,0x4d5a0000)] . . . Stack: [0x4d550000,0x4d5a0000], sp=0x4d59e9d0, free space=314k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C 0x4d81ff08 Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j sun.awt.shell.Win32ShellFolder2.compareIDsByColumn(JJJI)I+0 j sun.awt.shell.Win32ShellFolder2.access$3300(JJJI)I+6 j sun.awt.shell.Win32ShellFolder2$ColumnComparator$1.call()Ljava/lang/Integer;+54 j sun.awt.shell.Win32…
downvote count: 1
answer count: 1
has title: Desktop.getDesktop() crashes JVM when run with Intellij

http://stackoverflow.com/q/22382774
tagged with: android
has comment: http://stackoverflow.com/comment/34026316
has body: I have this xml: &lt;com.me.view.button.SwipeableButton android:id="@+id/mainMenuSwipeableButton" android:layout_width="250dp" android:layout_height="62dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginBottom="2dp" android:layout_marginLeft="2dp" app:button="@drawable/main_menu_button" android:visibility="visible" /&gt; and: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_pressed="true" android:drawable="@drawable/icon_menu_press" /&gt; &lt;!-- pressed --&gt; &lt;item android:drawable="@drawable/icon_menu" /&gt; &lt;!-- default --&gt; &lt;/selector&gt; why isn't my click caught when i have this code? setCloseToolTipClickListener(getMainLayout().findViewById(R.id.mainMenuSwipeableButton), tooltipView); private void setCloseToolTipClickListener(View view, final LinearLayout tooltip) { view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { tooltip.setVisibility(View.GONE); } }); }
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: android-layout
tagged with: java
has comment: http://stackoverflow.com/comment/34026020
score: 0
has comment: http://stackoverflow.com/comment/34025974
tagged with: layout
has title: cannot catch a click event on custom android view

http://stackoverflow.com/q/22378113
has body: I am trying to send first name and last name to java servelet. Request is accepted by servelet but response not showing back on application. I have searched for the internet that config.xml file line should be changed. I have tried following combinations on it but no use. My targer URL: http://myip:8081/MiddleWareUsman/androidServlet &lt;access origin="http://myip*" /&gt; &lt;access origin="http://myip:8081/MiddleWareUsman/androidServlet" /&gt; &lt;access origin="http://myip:8081" /&gt; I have tried alot. But no use. Please help if anybody knows this issue. I am attaching javascript button event and logs buttonClick: function(evt) { var input1=this.byId("Input1"); var input2=this.byId("Input2"); var label=this.byId("Label1"); $.ajax({ url : "http://myip:8081/MiddleWareUsman/androidServlet", type : "post", dataType : "jsonp", data : { "fname" : input1.getValue(), "lname" : input2.getValue() }, success : function(data) { label.setText("Respose from server is"+ data) } }); } }); Logs: 03-13 16:46:23.501: E/Trace(19435): error opening trace file: No such file or directory (2) 03-13 16:46:40.499: E/chromium(19435): external/chromium/net/disk_cache/stat_hub.cc:216: [0313/164640:ERROR:stat_hub.cc(216)] StatHub::Init - App com.mycompany.serveletcallusman isn't supported. 03-13 16:46:40.499: E/chromium(19435): external/chromium/net/disk_cache/stat_hub.cc:216: [0313/164640:ERROR:stat_hub.cc(216)] StatHub::Init - App com.mycompany.serveletcallusman isn't supported. 03-13 16:46:40.789: E/Web Console(19435): Uncaught ReferenceError: usmanshaffi is not defined at http://myip:8081/MiddleWareUsman/androidServlet?callback=jQuery17102445647087879479_1394711186603&amp;fname=usman&amp;lname=shaffi&amp;_=1394711200355:1
answer count: 1
tagged with: android
tagged with: cordova
type: UnansweredQuestion
has title: Not Getting Response from Java Servlet into Cardova/Phonegap project For Android
has answer: http://stackoverflow.com/a/22378905
tagged with: java
type: Question
score: 0

http://stackoverflow.com/q/22382717
has body: I need to merge 2 paragraphs, the first is a sequence of dots, and the second is the text that I want write on dots: Paragraph pdots1 = new Paragraph("......................................................................................................................",font10); Paragraph pnote= new Paragraph("Some text on the dots", font10); I tried to play with: pnote.setExtraParagraphSpace(-15); But this mess up the next paragraphs. I tried too with this: itext positioning text absolutely and works fine but only if my pdf size is fixed. So don't solve my problem.
tagged with: java
has title: How to underline text with a dotted line?
accepted answer: http://stackoverflow.com/a/22454562
answer count: 1
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/1625455
favorite count: 0
tagged with: paragraphs
type: AnsweredQuestion
tagged with: itext
upvote count: 1
has answer: http://stackoverflow.com/a/22454562
type: Question

http://stackoverflow.com/q/22409695
has body: I am trying to implement HTTPS communication between two apps and I am not entirely sure what exactly I need to do as I find several different tutorials articles and they are not consistent, also none of them provides the complete solution. What I know so far is that I need to: 1.Generate the keystore with following command keytool -genkey -alias tomcat -keyalg RSA -keystore NAME_OF_KEYSTORE -validity NUMBER_OF_DAYS (This will create a self-signed certificate) 2.Configure JBoss (JBoss AS 7) xml files (I am not sure which ones and what exactly I need to specify) 3.Configure Spring Security: -add a Spring Security application context file to the contextConfigLocation context-param: contextConfigLocation /WEB-INF/spring/root-context.xml /WEB-INF/spring/appServlet/application-security.xml -add the Spring Security filter and filter-mapping: springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* -modify application-security.so it contains: <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <intercept-url pattern="/**" requires-channel="https" /> <authentication-manager> </authentication-manager> </beans:beans> Now if the internet doesn't lie to me it seems like that would be all I need to have it working on the server side, however I need a bit of advice on step 2. What JBoss configuration files need to be configured and how? I have other concerns as well but I need to have this working first. I appreciate any attempt of help.
has title: Implementing SSL on JBoss app using Spring-security
answer count: 0
tagged with: java
tagged with: jboss
type: Question
tagged with: ssl
tagged with: spring-security
has comment: http://stackoverflow.com/comment/34073272
has comment: http://stackoverflow.com/comment/34073761
score: 0
has comment: http://stackoverflow.com/comment/34073296
has comment: http://stackoverflow.com/comment/34072859
has comment: http://stackoverflow.com/comment/34073066
linked to: http://stackoverflow.com/q/8081381
type: UnansweredQuestion

http://stackoverflow.com/a/22475957
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22475956
type: Answer
answers question: http://stackoverflow.com/q/22475956
has body: This Solves my problem. Well that happend to me as I tried to build my latest project. Solution was quite simple but… strange. Just remove all newer Android SDK build-tools (i.e. 19) until the Version 18.1.1 with the Android SDK Manager. Restart Eclipse. And it will work. If not, try to add the Support Libraries (Right click on your Android Project in Eclipse, choose Android Tools, Add Support Library) https://stackoverflow.com/questions/22316924/why-need-to-know-the-reason-console-shows-when-building-the-project
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/34110253
comment on: http://stackoverflow.com/q/22430678
score: 0
has text: Please post the content of `p3text.txt`
type: Comment
type: QuestionComment

layout
tags question: http://stackoverflow.com/q/22430383
tags question: http://stackoverflow.com/q/22379466
tags question: http://stackoverflow.com/q/22440632
tags question: http://stackoverflow.com/q/22386924
tags question: http://stackoverflow.com/q/22382774
tags question: http://stackoverflow.com/q/22337603
tag name: layout
tags question: http://stackoverflow.com/q/22428663
tags question: http://stackoverflow.com/q/22428031
tags question: http://stackoverflow.com/q/22367800
tags question: http://stackoverflow.com/q/22387516
tags question: http://stackoverflow.com/q/22351635
tags question: http://stackoverflow.com/q/22376792
tags question: http://stackoverflow.com/q/22340319
tags question: http://stackoverflow.com/q/22413780
tags question: http://stackoverflow.com/q/22340410
tags question: http://stackoverflow.com/q/22431214
type: Tag
tags question: http://stackoverflow.com/q/22432705
tags question: http://stackoverflow.com/q/22335134
tags question: http://stackoverflow.com/q/22379652
tags question: http://stackoverflow.com/q/22438775
tags question: http://stackoverflow.com/q/22444123
tags question: http://stackoverflow.com/q/22442118
tags question: http://stackoverflow.com/q/22402628
tags question: http://stackoverflow.com/q/22450884
tags question: http://stackoverflow.com/q/22386748
tags question: http://stackoverflow.com/q/22366378
tags question: http://stackoverflow.com/q/22366853
tags question: http://stackoverflow.com/q/22479222

http://stackoverflow.com/comment/34088587
has text: You are iterating through the list which CONTAINS your origin flight. You should skip this record. I'll update the code to reflect what you should do.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22418223

http://stackoverflow.com/comment/33953520
has text: Also to have the `whiteChessPiece` have _all_ those ancestors, doesn't really make sense to me. I can see the `whitePeice`, but why the others? Doesn't seem like the greatest design. If you need to access instance variables from other class, don't expect inheritance to work. Just a hint.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22340601

http://stackoverflow.com/comment/34112185
type: QuestionComment
comment on: http://stackoverflow.com/q/22414614
has text: But this will create a client server communication for serialization.
score: 0
type: Comment

http://stackoverflow.com/q/22430450
type: Question
tagged with: android-layout
tagged with: eclipse
has body: I'm having some issues with my school project. I can't get the text from the textbox. I searched for a solution but nothing found.. I'll be grateful if somebody help me :) So here is my Java code: package com.src.vicnote; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.content.Context; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.os.Build; public class NewNoteActivity extends ActionBarActivity { Button saveButton; EditText textData; Context context; String text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_note); saveButton = (Button) this.findViewById(R.id.buttonSave); saveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub textData = (EditText) findViewById(R.id.editText); text = textData.getText().toString(); //text = "this is sparta!"; Log.d("ADebugTag", "string: \"" + text + "\" end of note text"); new SaveClass(text/*, context.getApplicationContext()*/); } }); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.new_note, 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.…
has comment: http://stackoverflow.com/comment/34110898
score: 0
answer count: 2
has title: Can't get text from editText Android Eclipse
has comment: http://stackoverflow.com/comment/34110623
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34114582
has answer: http://stackoverflow.com/a/30115215
has answer: http://stackoverflow.com/a/22430802
tagged with: java
tagged with: import

http://stackoverflow.com/q/22371767
has comment: http://stackoverflow.com/comment/34007394
has title: How to run a exe file via unix by passing input parameter
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: unix
has comment: http://stackoverflow.com/comment/34007365
tagged with: java
type: Question
has body: I have created a exe file from jar via converter tools. Jar file was executing fine when I tried to run via unix by passing input parameters eg: java -jar SSS_Infinite.jar test.in 2 However after converting to exe I tried to run by passing input parameters via Unix but its not working and simply returns to the next line. I tried the below command in Unix cmd. Is there any other alternative to make it trigger ? SSS_Infinite.exe test1.in 2
has answer: http://stackoverflow.com/a/22372477

http://stackoverflow.com/q/22420962
linked to: http://stackoverflow.com/q/6952363
favorite count: 0
has answer: http://stackoverflow.com/a/22421048
has answer: http://stackoverflow.com/a/22421020
answer count: 5
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22421079
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22421067
possible better answer: http://stackoverflow.com/a/22421020
has title: Java replacing char at index
score: -1
has comment: http://stackoverflow.com/comment/34093186
has answer: http://stackoverflow.com/a/22421080
has answer: http://stackoverflow.com/a/22421067
has comment: http://stackoverflow.com/comment/34093234
upvote count: 0
tagged with: arrays
has body: I'm wanting to replace a character at in a string
tagged with: string

http://stackoverflow.com/comment/33943237
comment on: http://stackoverflow.com/a/22333472
has text: You need some logic in the render method, because how else are you going to switch the screen if not from the render method? Furthermore this logic will not cause any less FPS. Maybe something like 0.0000001 FPS less or something in that range.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/22380143
has body: You forgot list.setAutoCreateRowSorter(true);
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22378528
has comment: http://stackoverflow.com/comment/34022050
answers question: http://stackoverflow.com/q/22378528
upvote count: 2

http://stackoverflow.com/comment/34122760
has text: Sorry my mistake, I want to search all the objects and find the largest age and smallest age.
comment on: http://stackoverflow.com/q/22437908
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/22433644
tagged with: paintcomponent
has body: I am having a huge problem in Java creating a GUI that takes input from a user and creates a circle based on that input. I am taking input from the user and holding the values within the getUserX, getUserY, getRadius and circleColor, however I have no idea how to pass these variables into an array that's used by the paint component to make a circle. How do I properly take the value of the getUserX, getUserY and getRadius variables and put them into the circleValues array? How do I take the circleColor taken from the user's input and put it as the page.setColor value for the created circle? import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class CircleMaker { public static void main (String[] args) { BuildsFrame(); } public static void BuildsFrame() { JFrame frame = new JFrame ("Circle Drawer"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTabbedPane tp = new JTabbedPane(); tp.addTab ("Intro", new IntroPanel()); tp.addTab("Your Circle!", new CirclePanel()); frame.getContentPane().add(tp); frame.pack(); frame.setVisible(true); } } class IntroPanel extends JPanel { public IntroPanel() { final JTextField xCoorTF, yCoorTF, radiusTF; int userXcoor, userYcoor, userRadius; JButton makeButton = new JButton("Create!"); final JColorChooser colorChooser; setLayout (new FlowLayout()); setBackground (Color.gray); setPreferredSize (new Dimension(700, 500)); JLabel l1 = new JLabel ("Enter your desired coordinates and radius for your circle."); JLabel l2 = new JLabel ("Please type the X coordinate in the first box, the"); JLabel l3 = new JLabel ("Y coordinates in the second box,"); JLabel l4 = new JLabel ("and the radius of your circle"); JLabel l5 = new JLabel ("in the final box."); xCoorTF = new JTextField(5); yCoorTF = new JTextField(5); radiusTF…
favorite count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22433674
answer count: 1
downvote count: 0
has title: How to take ints from Action Event into an array to create a circle in Java?

http://stackoverflow.com/comment/33970942
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22344635
has text: Down vote as your answer has noting in common with the question.
type: AnswerComment

http://stackoverflow.com/q/22361748
accepted answer: http://stackoverflow.com/a/22361808
has answer: http://stackoverflow.com/a/22361922
has title: Remove Item from ArrayList
tagged with: arraylist
linked to: http://stackoverflow.com/q/513832
answer count: 3
possible better answer: http://stackoverflow.com/a/22361922
has answer: http://stackoverflow.com/a/22362253
has body: I am trying to make an removeItem method to remove items of String from ArrayList. The item gets removed, but I still get a NullPointerException, not really sure why. /** * remove item */ public void removeItem(String description) { Iterator&lt;Item&gt; i = items.iterator(); Item items = i.next(); if items.getDescription().equals(description) { i.remove(); } else { System.out.println("Invalid item description"); } System.out.println("Item removed!"); }
score: 0
has answer: http://stackoverflow.com/a/22361808
has comment: http://stackoverflow.com/comment/33990302
has comment: http://stackoverflow.com/comment/33990537
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33990340
type: Question

http://stackoverflow.com/q/22427253
has comment: http://stackoverflow.com/comment/34112731
score: 0
accepted answer: http://stackoverflow.com/a/22435872
has comment: http://stackoverflow.com/comment/34104599
has comment: http://stackoverflow.com/comment/34105421
answer count: 2
has body: I have a Patient who has a Set of NeurologicalFinding medical records. Patient class structure is as follows: @Entity @Table(name = "patient") public class PatientEntity { //other properties @OneToMany(fetch = FetchType.LAZY, mappedBy = "patient") private Set&lt;NeurologicalFindingEntity&gt; neurologicalFindingList; public Set&lt;NeurologicalFindingEntity&gt; getNeurologicalFindingList() { return neurologicalFindingList; //DEBUGGER never got to this line } //other get and set methods } NeurologicalFinding class structure is as follows: @Entity @Table(name = "neurological_finding") public class NeurologicalFindingEntity{ //other properties @ManyToOne @JoinColumn(name = "patient_id") private PatientEntity patient; //get and set methods } In my app, I want to get a Patient by his ID without his NeurologicalFinding records with the following method of the DAO: public PatientEntity getPatientById(int patientId) { Criteria criteria = sessionFactory.getCurrentSession() .createCriteria(PatientEntity.class); criteria.add(Restrictions.eq("id", patientId)); return (PatientEntity) criteria.uniqueResult(); } When I use this method I still get patient WITH his NeurologicalFinding records. The getter of the collection is never called (checked with debuger), so how is it possible that the lazy collection is loaded when nobody asked for it? If you need more info about my app I can provide you with it.
has comment: http://stackoverflow.com/comment/34104740
has comment: http://stackoverflow.com/comment/34113582
tagged with: one-to-many
has title: Every time fetched Lazy OneToMany collection
has comment: http://stackoverflow.com/comment/34104679
has comment: http://stackoverflow.com/comment/34121539
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22429012
tagged with: java
has answer: http://stackoverflow.com/a/22429012
type: Question
has answer: http://stackoverflow.com/a/22435872
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34104478

http://stackoverflow.com/comment/34033094
has text: Have a look [here](http://stackoverflow.com/questions/5284063/replace-default-dns-name-resolution-in-java) <-- do you have any JVM property of those `sun.xxx` in your running JVM?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22386365

http://stackoverflow.com/q/22393341
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34050288
type: Question
has body: How do I get text from json without [" "] only text, in Android project? this is my json from url {"code":200,"lang":"en-ru","text":["Better late than never"]} i need get text "text":["Better late than never"] without [" "] only text: Better late than never myclass MAINACTIVITY public class MainActivity extends Activity { JSONParser jsonparser = new JSONParser(); TextView tv; String ab; JSONObject jobj = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = (TextView) findViewById(R.id.tvResult); new retrievedata().execute(); } class retrievedata extends AsyncTask&lt;String,String,String&gt;{ @Override protected String doInBackground(String... arg0) { // TODO Auto-generated method stub jobj = jsonparser.makeHttpRequest("https://translate.yandex.net/api/v1.5/tr.json/translate?key=YOURAPIKEY&amp;text=Better%20late%20than%20never&amp;lang=ru"); // check your log for json response Log.d("Login attempt", jobj.toString()); ab = jobj.optString("text"); return ab; } protected void onPostExecute(String ab){ tv.setText(ab); } } } MY JSONPARSER CLASS public class JSONParser { static InputStream is = null; static JSONObject jobj = null; static String json = ""; public JSONParser(){ } public JSONObject makeHttpRequest(String url){ DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(url); try { HttpResponse httpresponse = httpclient.execute(httppost); HttpEntity httpentity = httpresponse.getEntity(); is = httpentity.getContent(); } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader(is,"utf-8"),8); StringBuilder sb = new StringBuilder(); String line = null; try { while((line = reader.readLine())!=null){ sb.append(line+"\n"); } is.close(); json = sb.toString(…
answer count: 2
has answer: http://stackoverflow.com/a/22393704
has comment: http://stackoverflow.com/comment/34045448
score: 0
has answer: http://stackoverflow.com/a/22396470
tagged with: parsing
has title: How to get text from JSON without [" "]
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/22393605

http://stackoverflow.com/a/22404765
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22404592
upvote count: 2
has comment: http://stackoverflow.com/comment/34071206
has comment: http://stackoverflow.com/comment/104194415
has comment: http://stackoverflow.com/comment/34423383
downvote count: 0
has body: you can use assest folder or raw folder under resource folder
has comment: http://stackoverflow.com/comment/34067998

http://stackoverflow.com/q/22399572
has answer: http://stackoverflow.com/a/52003123
has answer: http://stackoverflow.com/a/79286815
linked to: http://stackoverflow.com/q/28589509
has answer: http://stackoverflow.com/a/56467234
linked to: http://stackoverflow.com/q/43435658
has answer: http://stackoverflow.com/a/49350332
downvote count: 0
has answer: http://stackoverflow.com/a/73674079
has answer: http://stackoverflow.com/a/77157583
has answer: http://stackoverflow.com/a/52873507
has answer: http://stackoverflow.com/a/62959189
linked to: http://stackoverflow.com/q/22473348
has answer: http://stackoverflow.com/a/50856829
favorite count: 0
has answer: http://stackoverflow.com/a/51077498
has answer: http://stackoverflow.com/a/46069076
has answer: http://stackoverflow.com/a/38251279
has title: java.lang.ClassNotFoundException: Didn't find class on path: dexpathlist
has answer: http://stackoverflow.com/a/55884808
has answer: http://stackoverflow.com/a/40729225
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/23471869
has answer: http://stackoverflow.com/a/48026641
has answer: http://stackoverflow.com/a/51590259
has answer: http://stackoverflow.com/a/78408252
tagged with: android
has comment: http://stackoverflow.com/comment/34056880
linked to: http://stackoverflow.com/q/46814593
has answer: http://stackoverflow.com/a/46214681
has answer: http://stackoverflow.com/a/69296072
has comment: http://stackoverflow.com/comment/76818408
has answer: http://stackoverflow.com/a/72343524
has answer: http://stackoverflow.com/a/75915263
linked to: http://stackoverflow.com/q/10866431
has answer: http://stackoverflow.com/a/71307429
has answer: http://stackoverflow.com/a/22959847
has answer: http://stackoverflow.com/a/46698959
has answer: http://stackoverflow.com/a/74584540
has comment: http://stackoverflow.com/comment/111336299
tagged with: c++
has answer: http://stackoverflow.com/a/79297741
has answer: http://stackoverflow.com/a/24198565
answer count: 47
has comment: http://stackoverflow.com/comment/80170824
has answer: http://stackoverflow.com/a/56789533
has answer: http://stackoverflow.com/a/61249567
tagged with: java
has answer: http://stackoverflow.com/a/59523438
has answer: http://stackoverflow.com/a/47131403
has answer: http://stackoverflow.com/a/41479407
has answer: http://stackoverflow.com/a/49614815
has answer: http://stackoverflow.com/a/43352294
has comment: http://stackoverflow.com/comment/65076177
has answer: http://stackoverflow.com/a/32844963
tagged with: android-ndk
upvote count: 199
type: Question
has answer: http://stackoverflow.com/a/52056903
has answer: http://stackoverflow.com/a/44719899
has answer: http://stackoverflow.com/a/63576082
has answer: http://stackoverflow.com/a/62852289
has answer: http://stackoverflow.com/a/40023120
has body: I'm currently working on a project in which I have to use purely native ndk. It worked when I try running an helloworld example from Irrlicht engine source. Then I try using it in my project following the same format of that example. But I got: 03-14 01:40:05.308: E/AndroidRuntime(799): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.irrlicht.example1/android.app.POMActivity}: java.lang.ClassNotFoundException: Didn't find class "android.app.POMActivity" on path: DexPathList[[zip file "/data/app/com.irrlicht.example1-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.irrlicht.example1-2, /system/lib]] while running my project. Here is my main.cpp file: #include &lt;android/log.h&gt; #include &lt;jni.h&gt; #include &lt;android_native_app_glue.h&gt; #include "android_tools.h" #ifdef _IRR_ANDROID_PLATFORM_ void android_main(android_app* app) { __android_log_print(4 , "pom" , "nothing"); } #endif in Android.mk: LOCAL_PATH := $(call my-dir)/.. IRRLICHT_PROJECT_PATH := $(LOCAL_PATH) include $(CLEAR_VARS) LOCAL_MODULE := Irrlicht LOCAL_SRC_FILES := /home/karthik/Android/Essentials/ogl-es/lib/Android/libIrrlicht.a include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := HelloWorldMobile1 LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ -pipe -fno-exceptions -fno-rtti -fstrict-aliasing LOCAL_C_INCLUDES := -I ../../include -I /home/karthik/Android/Essentials/ogl-es/include -I /home/karthik/Android/json/jsoncpp-src-0.5.0/libs/linux-gcc-4.8 -I /home/karthik/Android/json/jsoncpp-src-0.5.0/include/json LOCAL_SRC_FILES := android_tools.cpp main.cpp LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid -ldl LOCAL_STATIC_LIBRARIES := Irrlicht android_native_app_glue include $(BUILD_SHARED_LIBRARY) $(call import-module,android/native_app_glue) And I have given Activity name in AndroidManifest.xml: &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.irrlicht.example1" android:versionCode="1" android:version…
has comment: http://stackoverflow.com/comment/34055456
has answer: http://stackoverflow.com/a/76619688
has answer: http://stackoverflow.com/a/22399630
has answer: http://stackoverflow.com/a/49757425
score: 199
has answer: http://stackoverflow.com/a/62959645
linked to: http://stackoverflow.com/q/36881299
has answer: http://stackoverflow.com/a/45320244
has answer: http://stackoverflow.com/a/37526993

http://stackoverflow.com/comment/34082241
type: Comment
has text: Thanks for responding . My ContentPane is gridBagLayout. Updated question to reflect full method.
type: AnswerComment
comment on: http://stackoverflow.com/a/22414569
score: 0

http://stackoverflow.com/a/62649071
score: 0
type: Answer
has body: Using this setting will avoid IE to take over the mouse control while performing actions - InternetExplorerOptions ieOp = new InternetExplorerOptions(); ieOp.disableNativeEvents();
answers question: http://stackoverflow.com/q/22338609

http://stackoverflow.com/comment/34107534
comment on: http://stackoverflow.com/q/22429134
score: 0
has text: wonderful, at least you know about that :) if you post the code with example will be much better...
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22444348
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34135553
has comment: http://stackoverflow.com/comment/34135452
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22443386
downvote count: 0
type: Answer
has body: You could use a BorderLayout... import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Dimension; import java.awt.FlowLayout; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.SwingUtilities; public class LayoutTest { private JMenuBar menuBar; private JMenu fileMenu, windowMenu, helpMenu; private JMenuItem fileNew, fileOpen, fileSave, windowTheme, windowLayout, windowProperties, helpWelcome, helpHelp, helpAbout; private JTextArea mainTextArea; public LayoutTest() { JPanel mainCard = new JPanel(new BorderLayout(8, 8)); menuBar = new JMenuBar(); fileMenu = new JMenu("File"); windowMenu = new JMenu("Window"); helpMenu = new JMenu("Help"); menuBar.add(fileMenu); menuBar.add(windowMenu); menuBar.add(helpMenu); final CardLayout layout = new CardLayout(); final JPanel cards = new JPanel(layout); cards.add(mainCard, "2"); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add("One", createPane()); tabbedPane.add("Two", createPane()); tabbedPane.add("Three", createPane()); tabbedPane.add("Four", createPane()); mainTextArea = new JTextArea(20, 40); mainCard.add(tabbedPane, BorderLayout.WEST); mainCard.add(new JScrollPane(mainTextArea)); JFrame window = new JFrame("Pseudo code text editor"); window.setJMenuBar(menuBar); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.getContentPane().add(cards); window.pack(); window.setLocationRelativeTo(null); window.setVisible(true); } protected JPanel createPane() { return new JPanel() { @Override public Dimension getPreferredSize() { return new Dimension(200, 200); } }; } public static void main(String args[]) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { new LayoutTest(); } }); } } The problem here, is the amount of space that the JTabbedPane wants is depended on it's conte…
has comment: http://stackoverflow.com/comment/34135610
answers question: http://stackoverflow.com/q/22443386

http://stackoverflow.com/comment/34108628
has text: I don't actually get a stack trace, it just throws a failure not an error.
comment on: http://stackoverflow.com/q/22429776
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34181208
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22470841
has text: Do you see the Input number prompt?

spoon
tags question: http://stackoverflow.com/q/22346559
type: Tag
tag name: spoon
tags question: http://stackoverflow.com/q/22445155

http://stackoverflow.com/q/22341092
score: 0
answer count: 2
tagged with: junit
possible better answer: http://stackoverflow.com/a/22344338
has title: Spring, JUnit, Hibernate Testing
has answer: http://stackoverflow.com/a/22344338
accepted answer: http://stackoverflow.com/a/22341129
tagged with: spring
has body: Can someone point me out to a good source of information on Spring mvc testing? I would like to test: Entities: I want to be able to create a new record in the database, fetch all records and assert on the new elements count. @Controllers: I would like to be able to simulate a get, post or put to a specific path and get it reach the @Controller by simulating RequestBody Services: I would like to be able to call autowired services from JUnit tests and perform operations on entities. In other words, I come from Rails and am trying to understand Spring way of testing, preferrably without Mocking anything...
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33965174
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33954416
type: Question
has answer: http://stackoverflow.com/a/22341129

http://stackoverflow.com/comment/34047184
comment on: http://stackoverflow.com/a/22381126
type: AnswerComment
has text: Strange. I created a test project and tried using your code. The validation works.
score: 0
type: Comment

http://stackoverflow.com/q/22356681
upvote count: 1
type: Question
tagged with: jakarta-ee
has body: Question 1: May I ask what is the difference between deploying a java webapp with it's WAR file vs just copy/pasting the build folder into tomcat webapp folder? Question 2: Somehow I am told to deploy my project just by renaming my /build/web folder to /build/, then copy and paste this folder into tomcat/webapp folder. Tomcat did serve the web app and I could access it via url. But the problem is that I suspect my System variables were not set. I start up a servlet and put this code in this init(ServletConfig config) method: System.setProperty("LogPath","D:/Test/logs"); And doing this in my log4j.properties log4j.appender.file.FILE=${LogPath}/wrapper.log wrapper.log is not found in the designated directory but a stdout.log is found in tomcat/logs folder. I am sure the init() method was fired because I have a quartz scheduler there. I am suspecting that my System.setProperty was not set. Any hint? Update: With all the same source code, I have no problem if I am deploying with a WAR file. The ${LogPath} in log4j.properties work as expected.
has title: Difference between deploying WAR and Build folder
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22359060
favorite count: 0
tagged with: web-deployment
tagged with: war
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22359060

http://stackoverflow.com/q/22350139
downvote count: 0
accepted answer: http://stackoverflow.com/a/22351037
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22351037
score: 1
has title: Xpath: find div that follows a known div (not nested)
tagged with: java
has body: I need to check that a div that follows some known div does not contains an h3 tag. How do I go about that using only xpath expression? &lt;div&gt; &lt;h2&gt;&lt;/h2&gt; ...this is the div I found... &lt;/div&gt; &lt;div&gt; ... need to check for presence of this div .. &lt;h3&gt;some text&lt;h3&gt; &lt;/div&gt;
upvote count: 1
answer count: 1
favorite count: 0
tagged with: xpath

http://stackoverflow.com/q/22448390
tagged with: spring-security
score: 3
has answer: http://stackoverflow.com/a/22448455
answer count: 1
downvote count: 0
favorite count: 0
has title: Invalid content was found starting with element 'global-method-security'
has comment: http://stackoverflow.com/comment/34142059
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22448455
upvote count: 3
tagged with: java
has body: in the below code i am getting a error like this "cvc-complex-type.2.4.a: Invalid content was found starting with element 'global-method-security'. One of '{"http://www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/ beans":alias, "http://www.springframework.org/schema/beans":bean, WC[##other:"http:// www.springframework.org/schema/beans"], "http://www.springframework.org/schema/beans":beans}' is expected." how to fixed it ? &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:context="http://www.springframework.org/schema/context" 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.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"&gt; &lt;context:component-scan base-package="client.security"/&gt; &lt;global-method-security secured-annotations="enabled" /&gt; &lt;/beans&gt;
type: Question

http://stackoverflow.com/a/22389127
has body: Louis is absolutely right, Multisets.sum(set1, set2) certainly does work, nor does copying to an ImmutableSortedMultiset cause any trouble. public static void main(String[] args) { final SortedMultiset&lt;Integer&gt; set1 = ImmutableSortedMultiset.of(1, 2, 2, 3, 3, 3); final SortedMultiset&lt;Integer&gt; set2 = ImmutableSortedMultiset.of(1, 1, 2, 4); final SortedMultiset&lt;Integer&gt; sum = ImmutableSortedMultiset.copyOf(Multisets.sum(set1, set2)); System.out.println(sum); } outputs: [1 x 3, 2 x 3, 3 x 3, 4] I suspect that it is the piece you have redacted, and replaced with ImmutableSortedMultiset.of(); that is giving you trouble. But I cannot comment too much there as you've neglected to share it.
accepted answer of: http://stackoverflow.com/q/22385553
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22385553
has comment: http://stackoverflow.com/comment/34056745
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34039020

http://stackoverflow.com/q/22346968
has comment: http://stackoverflow.com/comment/33964537
has comment: http://stackoverflow.com/comment/33964857
type: Question
has comment: http://stackoverflow.com/comment/33964477
linked to: http://stackoverflow.com/q/12164024
has comment: http://stackoverflow.com/comment/33964703
has answer: http://stackoverflow.com/a/22407584
has comment: http://stackoverflow.com/comment/33986250
has comment: http://stackoverflow.com/comment/33966580
accepted answer: http://stackoverflow.com/a/22407584
score: 0
has comment: http://stackoverflow.com/comment/33965090
has comment: http://stackoverflow.com/comment/33970604
answer count: 1
linked to: http://stackoverflow.com/q/22350825
tagged with: google-drive-api
tagged with: android
has comment: http://stackoverflow.com/comment/33966485
has comment: http://stackoverflow.com/comment/33966640
has title: Android Open and Save String to/from Google Drive SDK
type: AnsweredQuestion
has body: I have read allot about Google drive integration and I want to save STRING into Google drive and also to retrieve, I have used this demo but it is giving me errors. please anyone provide me demo for my requirement
has comment: http://stackoverflow.com/comment/33966534
has comment: http://stackoverflow.com/comment/33965001
tagged with: java
has comment: http://stackoverflow.com/comment/33966571

http://stackoverflow.com/q/22396239
type: Question
has answer: http://stackoverflow.com/a/22418994
downvote count: 0
answer count: 1
tagged with: horizontalfieldmanager
favorite count: 0
accepted answer: http://stackoverflow.com/a/22418994
upvote count: 1
has body: I want to add a TextField and a ButtonField to a HorizontalFieldManager. Now, I am using the following code HorizontalFieldManager hfmFieldManager = new HorizontalFieldManager(NO_VERTICAL_SCROLL | NO_HORIZONTAL_SCROLL | USE_ALL_WIDTH); hfmFieldManager.setPadding(5, 0, 5, 0); VerticalFieldManager buttonFieldManager = new VerticalFieldManager(USE_ALL_WIDTH | Field.FIELD_RIGHT); ButtonField btnDone = new ButtonField("DONE", FIELD_VCENTER | Field.FIELD_RIGHT); btnDone.setMargin(0, MARGIN, 0, MARGIN); buttonFieldManager.add(btnDone); TextField txtField = new TextField(FIELD_VCENTER | FIELD_LEFT)/*{ protected void layout(int width, int height) { super.layout((int) (Display.getWidth() * 0.5) , getPreferredHeight()); } }*/; txtField.setBorder(roundedBorder); txtField.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE)); hfmFieldManager.add(txtField); hfmFieldManager.add(buttonFieldManager); But it shows TextField Only. I want to show buttonfield completely at the right side and the remaining left side for textField.(Show TextField,Buttonfield from left to right). How can i adjust the width of textfield which is compatible for all screen sizes? Thanks in Advance
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34056527
score: 1
tagged with: java
tagged with: blackberry
has title: How to align a Text field and a button field in hfm in blackberry

http://stackoverflow.com/q/22445642
duplicate of: http://stackoverflow.com/q/22444822
answer count: 1
has body: I'm trying to take the output of another method and use it in another method. I know there are other questions that are similar to mine but the solutions that were in those questions never solved my problem, though they did help a little. Here's where I'm stuck (problem is at rewardBet() method): class Player { private ArrayList&lt;Card&gt;hand; private double cash, bet; //double cash, bet; public Player(double theCash) { cash = theCash; hand = new ArrayList&lt;Card&gt;(); bet = 0; } public double wagerBet() { Scanner in = new Scanner(System.in); System.out.print("Wager a bet: "); double bet = in.nextDouble(); cash = cash - bet; System.out.println("You wagered " + bet + ". " + "Now you have " + cash + " cash left."); return bet; } public void rewardBet() { bet = wagerBet(); //this is supposed to be taking whatever the user wagered as a bet in the previous method and cash = cash + (bet * 2); // apply it to this formula in order to mutate the total cash the player has System.out.println("You now have " + cash + "cash."); } Any suggestions as to how to get this bet variable input to carry over? EDIT, here's the main method like you guys requested: class BlackJack { public static void main(String[] args) { Scanner in = new Scanner(System.in); Deck myDeck = new Deck(); myDeck.shuffle(); Player me = new Player(1000); Player dealer = new Player(0); Card c = myDeck.dealCard(); me.wagerBet(); System.out.println("Your first card is " + c); me.hit(c); c = myDeck.dealCard(); System.out.println("Your next card is " + c); me.hit(c); c = myDeck.dealCard(); System.out.println("Your total hand is currently " + me.totalHand() + "."); System.out.println("Dealer showing " + c); dealer.hit(c); c = myDeck.dealCard(); String answer; System.out.print("Hit or Stay?"); answer = in.nextLine(); while(answer.equals("Hit") || answer.equals("hit")) { System.out.println("Your next card is " + c); me.hit(c); c = myDeck.dealCard(); System.out.println("Your total hand is currently " + me.totalHand() …
has comment: http://stackoverflow.com/comment/34138671
favorite count: 0
has comment: http://stackoverflow.com/comment/34138116
has answer: http://stackoverflow.com/a/22446670
accepted answer: http://stackoverflow.com/a/22446670
has comment: http://stackoverflow.com/comment/34137759
downvote count: 2
has comment: http://stackoverflow.com/comment/34138565
upvote count: 1
linked to: http://stackoverflow.com/q/22444822
type: AnsweredQuestion
tagged with: java
score: -1
has title: Variable is not properly transferring over to method
type: Question
has comment: http://stackoverflow.com/comment/34137787
has comment: http://stackoverflow.com/comment/34137714
has comment: http://stackoverflow.com/comment/34137961

http://stackoverflow.com/comment/34123065
type: Comment
comment on: http://stackoverflow.com/a/22437062
score: 0
type: AnswerComment
has text: You are welcome. And please don't call me, sir. (I am only 19 and most probably younger than you :D)

http://stackoverflow.com/comment/34043746
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22392521
score: 0
has text: `Dog dog = new Dog("rover");` Then to call it: `dog.talk();`

subclipse
type: Tag
tag name: subclipse
tags question: http://stackoverflow.com/q/22353307

http://stackoverflow.com/comment/34184652
type: QuestionComment
has text: What is the difference between a rest call and a request in your opinion? I already thought of this , too. But did not know where to set the actor system up within a java servlet.
comment on: http://stackoverflow.com/q/22452403
score: 0
type: Comment

http://stackoverflow.com/q/22359194
has title: java.lang.OutOfMemoryError: PermGen space + java
answer count: 1
has body: I am getting following exception when I am going to send the mail with FTL teampate &amp; attaching image with it. Please advice what needs to be done java.lang.OutOfMemoryError: PermGen space at sun.security.provider.certpath.UntrustedChecker.check(UntrustedChecker.java:58) at sun.security.provider.certpath.PKIXMasterCertPathValidator.validate(PKIXMasterCertPathValidator.java:117) at sun.security.provider.certpath.PKIXCertPathValidator.doValidate(PKIXCertPathValidator.java:330) at sun.security.provider.certpath.PKIXCertPathValidator.engineValidate(PKIXCertPathValidator.java:178) at java.security.cert.CertPathValidator.validate(CertPathValidator.java:250) at sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:275) at sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:263) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:173) at sun.security.validator.Validator.validate(Validator.java:218) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209) at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1185) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:136) at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593) at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:529) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:958) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1203) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:654) at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:100) at com.sun.mail.util.TraceOutputStream.write(TraceOutputStream.j…
favorite count: 0
has answer: http://stackoverflow.com/a/22359283
tagged with: heap-memory
type: UnansweredQuestion
downvote count: 1
tagged with: java
linked to: http://stackoverflow.com/q/88235
type: Question
duplicate of: http://stackoverflow.com/q/88235
upvote count: 0
score: -1

http://stackoverflow.com/comment/34110122
type: AnswerComment
score: 0
type: Comment
has text: @JasonC Sorry if that misled you. I'm new to android and it's difficult for me sometimes to formulate the problem
comment on: http://stackoverflow.com/a/22430550

http://stackoverflow.com/q/22350633
has comment: http://stackoverflow.com/comment/33970606
has title: Comparing two files using commons or Javascript
has comment: http://stackoverflow.com/comment/33970670
type: AnsweredQuestion
tagged with: apache-commons
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22350794
accepted answer: http://stackoverflow.com/a/22350794
type: Question
has body: I need to check if any of the 4 uploaded files are same, this check might be on the JSP or Java-Servlet side. I've been using var FileName1 = document.getElementById('fileChooser1').value; var FileName2 = document.getElementById('fileChooser2').value; if(FileName1 == FileName2) { alert("same files cannot be uploaded"); } But, the problem is that this only deals with the name of the file and this fails if files with same content but different names are uploaded. So, on apache commons search I found that there is a Default Comparator but I have no idea of how I can use this or is there any other better/simpler way to check for same files. How can I use the Default Comparator and on what basis does it compare? Is there any better/simpler solution to this problem in java or javascript?
upvote count: 1
answer count: 1
downvote count: 0
tagged with: javascript
favorite count: 0

http://stackoverflow.com/comment/34032481
score: 0
comment on: http://stackoverflow.com/q/22386317
type: Comment
type: QuestionComment
has text: `svn add /path/to/library.jar`, and then `svn commit`.

http://stackoverflow.com/comment/34088916
type: Comment
has text: I can't access it. I did get the code to work though. I'll edit the post and mark this answer as soon as I finish editing.
type: AnswerComment
comment on: http://stackoverflow.com/a/22418277
score: 0

http://stackoverflow.com/a/22546827
has comment: http://stackoverflow.com/comment/34646679
answers question: http://stackoverflow.com/q/22418524
type: Answer
has body: If it works with an ArrayList you don't have to do an array. If you really want arrays, you can do theArrayList.toArray(); With an ArrayList it is more simply and a bit more object-oriented.
score: 0

http://stackoverflow.com/q/22366758
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: hibernate
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/22438114
has answer: http://stackoverflow.com/a/22370196
has comment: http://stackoverflow.com/comment/34000602
favorite count: 0
has answer: http://stackoverflow.com/a/22366800
has answer: http://stackoverflow.com/a/22370983
has body: I have a Model Object which named Student_Info in the package com.hibernate. In the same package I have a Main class where I created an instance of Student_Info : public class Main { public static void main(String[] args) { Student_Info student = new Student_Info(); student.setRollNo(1); student.setName("Ichigo"); SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory(); Session session = sessionFactory.openSession(); session.beginTransaction(); session.save(student); session.getTransaction().commit(); session.close(); sessionFactory.close(); } } In the hibernate.cfg.xml file i have this : <?xml version='1.0' encoding='utf-8'?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/hibernatedb root toor 1 org.hibernate.dialect.MySQLDialect thread org.hibernate.cache.internal.NoCacheProvider true create <mapping resource="com.hibernate.Student_Info" /> </hibernate-configuration> But when I run the Main class I get this error : Exception in thread "main" org.hibernate.MappingNotFoundException: resource: com.hibernate.Student_Info not found at org.hibernate.cfg.Configuration.addResource(Configuration.java:767) at org.hibernate.cfg.AnnotationConfiguration.addResource(AnnotationConfiguration.java:123) at org.hibernate.cfg.AnnotationConfiguration.addResource(AnnotationConfiguration.java:46) at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2255) at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2227) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2207) at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:213) at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:46) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2160) at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:201) at org.hibernate.cfg.AnnotationConfiguration.doConfigure(A…
has answer: http://stackoverflow.com/a/22424019
accepted answer: http://stackoverflow.com/a/22424019
answer count: 5
possible better answer: http://stackoverflow.com/a/22370196
has title: save an object into database using hibernate
downvote count: 1

http://stackoverflow.com/comment/64193603
type: Comment
score: 0
has text: Do you know what /Webcontent is?
type: AnswerComment
comment on: http://stackoverflow.com/a/38389478

http://stackoverflow.com/comment/34157076
comment on: http://stackoverflow.com/q/22457104
score: 0
type: Comment
type: QuestionComment
has text: I've shown my complete code... But it's weird, because I only get the stack-overflow if I call median

http://stackoverflow.com/comment/34134299
has text: ok thankyou for you help, this is my first program in java so i will use your advice. The program works now anyway as i removed the if statement and set f as 0 in the for loop
comment on: http://stackoverflow.com/a/22443760
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33991389
comment on: http://stackoverflow.com/q/22359384
score: 0
type: Comment
type: QuestionComment
has text: A few questions: 1. Are your 2 images acquired from the same camera (e.g. after moving it) or from two different cameras ? 2. Is there a good reason why camera calibration is off the table ? 3. What kind of 3D reconstruction do you need: projective, euclidian or up-to-scale ? Also, be aware that `StereoBM` gives the best results when called after image rectification..

http://stackoverflow.com/comment/34034030
comment on: http://stackoverflow.com/q/22366589
score: 0
type: Comment
type: QuestionComment
has text: If you don't want to relay the output, and you are content to stick to a platform specific solution, you might be able to use jni to call a wrapper which in turn calls the platform's native system() function. However, remember that system() is blocking, so you may need to do this from its own thread. It's possible you may run into various exec() related complications though, depending on how the JVM has things set up. Another option would be to figure out what the current terminal is, and open that as stdout in the subprocess, maybe using an intermediary.

http://stackoverflow.com/comment/34087207
type: Comment
comment on: http://stackoverflow.com/a/22391261
score: 1
type: AnswerComment
has text: The only way to answer that question is to benchmark, it depends on too many variables (vertex count, shader complexity, gpu, etc). In most cases, such questions indicate premature optimization. In practice, it is best to use common sense and only optimize if you experience problems. E.g. combine static parts which are likely to be together in the frustum, split parts when one part is likely to be culled and the other isn't and split parts which are the same (duplicates) and might be culled independent of each other.

http://stackoverflow.com/q/22430965
has comment: http://stackoverflow.com/comment/34111202
has comment: http://stackoverflow.com/comment/34110946
has comment: http://stackoverflow.com/comment/34110864
score: 0
has comment: http://stackoverflow.com/comment/34110812
accepted answer: http://stackoverflow.com/a/22431273
answer count: 1
has title: How do you call a class that uses generic types in java?
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/34110837
has comment: http://stackoverflow.com/comment/34110867
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34110928
tagged with: java
has body: I'm having trouble calling my SelectionSort class, which is listed below. I get an error "cannot access SelectionSort." I'm trying to see how long the SelectionSort class takes to sort a random array. Here is the SelectionSort class: import java.lang.*; public class SelectionSort { public static &lt;T extends Comparable&lt;T&gt;&gt; void sort(T[] a) { selectionSort(a, a.length-1); } private static &lt;T extends Comparable&lt;T&gt;&gt; void selectionSort(T[] a, int n) { if (n &lt; 0) return; int indMax = findMaxIndex(a, n); swap(a, n, indMax); selectionSort(a, n-1); } private static &lt;T extends Comparable&lt;T&gt;&gt; int findMaxIndex(T[] a, int n) { int indMax = 0; for (int i = 1; i &lt;= n; i++) { if (a[indMax].compareTo(a[i]) &lt; 0) { indMax = i; } } return indMax; } private static &lt;T extends Comparable&lt;T&gt;&gt; void swap(T[] a, int i, int j) { T tmp = a[i]; a[i] = a[j]; a[j] = tmp; } // Main function to test the code public static void main(String[] args) { // Make an array of Integer objects Integer[] a = new Integer[4]; a[0] = new Integer(2); a[1] = new Integer(1); a[2] = new Integer(4); a[3] = new Integer(3); // Call the sorting method (type T will be instantiated to Integer) SelectionSort.sort(a); // Print the result for (int i = 0; i &lt; a.length; i++) System.out.println(a[i].toString()); } } Here is the part of the code where I try to call the class, I get the error in the second line long result; long startTime = System.currentTimeMillis(); SelectionSort.sort(array, 100, array.length-1); long endTime = System.currentTimeMillis(); result = endTime-startTime; System.out.println("The quick sort runtime is " + result + " miliseconds"); } }
upvote count: 1
has answer: http://stackoverflow.com/a/22431273
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34110826

http://stackoverflow.com/a/22416447
score: 0
accepted answer of: http://stackoverflow.com/q/22416433
answers question: http://stackoverflow.com/q/22416433
type: Answer
has body: Don't compare String using ==, use equals() method. Try this: boolean test = (myJTable.getValueAt(0, 0).toString().equals(rs.getString("ID"))); For more details check this
type: AcceptedAnswer

http://stackoverflow.com/comment/33971723
has text: Nice to hear that and maybe you can paste the tecik so it is made viewble for others, what was the problem already?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22350144
type: AnswerComment

http://stackoverflow.com/comment/33982381
has text: Oh thanks, your suggestion solved 1st and 3rd errors, please tell me how to resolve 2nd error?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22357335
type: AnswerComment

http://stackoverflow.com/comment/34060519
has text: Because `+` is ambiguous in these cases. Avoid this ambiguity and you're done.
comment on: http://stackoverflow.com/q/22402787
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34166093
has text: Hopefully it's now clear to you that this is a problem with Gmail and Yahoo, not with your program.
comment on: http://stackoverflow.com/a/22448263
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22404081
has comment: http://stackoverflow.com/comment/34067724
has comment: http://stackoverflow.com/comment/34068857
has body: Sorry I cannot prove my idea with running system but I would try to use wasNull() on result set: if (rs.next()) { date = rs.getDate(1); if (rs.wasNull()) { // do something } }
score: 0
has comment: http://stackoverflow.com/comment/34066959
type: Answer
answers question: http://stackoverflow.com/q/22403933

http://stackoverflow.com/q/22411432
has comment: http://stackoverflow.com/comment/34076264
has comment: http://stackoverflow.com/comment/34076558
tagged with: colors
has body: I want to change Nimbus L&amp;F color scheme in my desktop application. What is the best way for doing this? I tried the following approach, but it requires manual definition of a color for each component of the GUI. Is there any quick-way? For instance, let's say I want to change default color scheme of Nimbus to the Blue. UIManager.put("nimbusBase", new Color(61,89,171)); UIManager.put("menu", new Color(61,89,171)); //...
has title: How to change default color scheme of Nimbus L&F
type: UnansweredQuestion
tagged with: swing
tagged with: nimbus
has comment: http://stackoverflow.com/comment/34076519
answer count: 0
tagged with: java
tagged with: look-and-feel
type: Question
has comment: http://stackoverflow.com/comment/34076580
has comment: http://stackoverflow.com/comment/34077222
has comment: http://stackoverflow.com/comment/34076673
score: 0

http://stackoverflow.com/a/22409969
has comment: http://stackoverflow.com/comment/34073632
accepted answer of: http://stackoverflow.com/q/22409339
type: Answer
has comment: http://stackoverflow.com/comment/34073948
has body: I just created a new folder called Jpak02, then inside created two files: PTaccess_modes.java and PTaccess_modes_1.java, then copied the content of your classes into them (no changes done from your current given code), and compiled in order: D:\&gt;javac Jpak02\PTaccess_modes.java D:\&gt;javac Jpak02\PTaccess_modes_1.java When compiling the second class, I got this (expected) error: Jpak02\PTaccess_modes_1.java:9: error: d has private access in PTaccess_modes System.out.println("\nPrivate int d : " + d); ^ 1 error After this, I deleted the .class file generated by PTaccess_modes.java file and compiled it again (this time added a comment on the line using private d field): D:\&gt;del Jpak02\PTaccess_modes.class D:\&gt;javac Jpak02\PTaccess_modes_1.java And compiled and generated both .class files (as expected). Then, last but not least, I accessed to the package and compiled the class from there: D:\&gt;cd Jpak02 D:\Jpak02&gt;javac PTaccess_modes_1.java And now, I got the problems you stated: PTaccess_modes_1.java:3: error: cannot find symbol class PTaccess_modes_1 extends PTaccess_modes { ^ symbol: class PTaccess_modes PTaccess_modes_1.java:6: error: cannot find symbol System.out.println("\nPublic int a : " + a); ^ symbol: variable a location: class PTaccess_modes_1 PTaccess_modes_1.java:7: error: cannot find symbol System.out.println("\nProtected int b : " + b); ^ symbol: variable b location: class PTaccess_modes_1 PTaccess_modes_1.java:8: error: cannot find symbol System.out.println("\nDefault int c : " + c); ^ symbol: variable c location: class PTaccess_modes_1 4 errors TL;DR: Make sure to compile the classes from the right location and using their complete name, this is, including the package name (as shown in the first and second block of this answer).
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34073789
has comment: http://stackoverflow.com/comment/34073476
answers question: http://stackoverflow.com/q/22409339
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34052996
type: Comment
comment on: http://stackoverflow.com/a/22398085
has text: You got it. That's quite the embarrassing mistake but I doubt I would have caught it without your help. Thank you @AbhinavRanjan. I'm surprised I didn't have more mistakes littered in there.
score: 0
type: AnswerComment

split
tags question: http://stackoverflow.com/q/22425637
tags question: http://stackoverflow.com/q/22416318
tags question: http://stackoverflow.com/q/22341822
tags question: http://stackoverflow.com/q/22467450
tags question: http://stackoverflow.com/q/22441888
tags question: http://stackoverflow.com/q/22384053
tags question: http://stackoverflow.com/q/22475910
tag name: split
tags question: http://stackoverflow.com/q/22438532
tags question: http://stackoverflow.com/q/22422424
tags question: http://stackoverflow.com/q/22445536
tags question: http://stackoverflow.com/q/22350683
tags question: http://stackoverflow.com/q/22417504
tags question: http://stackoverflow.com/q/22439038
tags question: http://stackoverflow.com/q/22406019
tags question: http://stackoverflow.com/q/22395585
tags question: http://stackoverflow.com/q/22410698
tags question: http://stackoverflow.com/q/22452221
type: Tag
tags question: http://stackoverflow.com/q/22437781
tags question: http://stackoverflow.com/q/22479014

http://stackoverflow.com/comment/34133426
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22442904
has text: Can't believe I missed it! RTFM @ me. Thanks, anyway

http://stackoverflow.com/q/22363875
has title: Constructor bindings and telling parameters apart
tagged with: guice
has answer: http://stackoverflow.com/a/22364632
score: 0
answer count: 1
type: UnansweredQuestion
has body: Suppose I have a third-party class: public class ThirdParty { public ThirdParty(String arg1, String arg2); } Since this is third-party, I cannot add my own @Inject annotation, forcing me to use bind-to-constructor. The question is how I can create a ThirdParty with arg1 and arg2 different. In essence, add "Named" annotations from the outside, so to speak.
tagged with: java
type: Question

bind
tags question: http://stackoverflow.com/q/22413136
type: Tag
tag name: bind

http://stackoverflow.com/a/22474229
has comment: http://stackoverflow.com/comment/34219433
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34309578
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/22473749
upvote count: 1
has comment: http://stackoverflow.com/comment/34193027
has body: All method arguments should be resolvable by the application context. You can also use @Qualifer annotation to resolve ambiguities.
answers question: http://stackoverflow.com/q/22473749
has comment: http://stackoverflow.com/comment/34189911
has comment: http://stackoverflow.com/comment/34186648
has comment: http://stackoverflow.com/comment/34186565
has comment: http://stackoverflow.com/comment/34192492

http://stackoverflow.com/a/27529084
has body: On a IHTTPSession instance you can call the .parseBody(Map&lt;String, String&gt;) method which will then fill the map you provided with some values. Afterwards your map may contain a value under the key postBody. final HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); session.parseBody(map); final String json = map.get("postData"); This value will then hold your posts body. Code that does this, can be found here.
has comment: http://stackoverflow.com/comment/133033534
has comment: http://stackoverflow.com/comment/65013013
has comment: http://stackoverflow.com/comment/105948275
has comment: http://stackoverflow.com/comment/106282131
downvote count: 0
answers question: http://stackoverflow.com/q/22349772
has comment: http://stackoverflow.com/comment/55799319
type: Answer
upvote count: 32
has comment: http://stackoverflow.com/comment/60269359
score: 32

http://stackoverflow.com/comment/34178768
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22469208
has text: The limitation is indeed set forth by an instructor. This is my interpretation of the problem. Essentially I have to (in another class file) call the deal method which will display `n` elements from the list, and then remove them. So in the test class file, I do `deck0.deal(int n, boolean up)` and then have to print out `n` cards declaring if they're facing up or down, and remove those elements from the list. I don't know how to do that on the test class end, so I figured I had to do it in the method itself, as posted above.
score: 0

http://stackoverflow.com/q/22448884
has body: In Composite design pattern we handle the hierarchies in the manner as shown in the UML below. But when you look at the Leaf class in the above figure you see it has empty implementations of addComponent, removeComponent and getChild since these methods do not apply for the Leaf node. What i really need to know is that is there any way around that we don't have to implement empty/no-op methods? Update : Ok, i removed the Liskov's principle part since it's now clear to me. But it still does not clarify why the Leaf node need to force-implement the three methods and is there a way that it does not have to? I think there is another principle that states that subclasses should not be forced to implement methods which are unnecessary. My main concern are implementation of three methods for the Leaf node and you can think about this scenario in any parent-child structure, not necessarily Composite pattern.
answer count: 1
favorite count: 0
tagged with: design-patterns
upvote count: 4
tagged with: composite
type: AnsweredQuestion
downvote count: 0
tagged with: java
has title: Composite design pattern and empty overrides
type: Question
score: 4
has answer: http://stackoverflow.com/a/22448938
accepted answer: http://stackoverflow.com/a/22448938

http://stackoverflow.com/comment/34054323
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22397861
has text: @rocking your answer is just define how java string pool works. but the question is WHY?... why java do this....?

http://stackoverflow.com/q/22418027
has comment: http://stackoverflow.com/comment/34088264
has answer: http://stackoverflow.com/a/22418072
tagged with: mysql
type: Question
has body: I'm not able to connect to the Database but I don't know why, since the username and password are correct and I'm able to connect through phpmyadmin locally. Class.forName("com.mysql.jdbc.Driver"); // Setup the connection with the DB connect = DriverManager.getConnection( "jdbc:mysql://localhost/yerobot", "yerobot", "yerobot123"); preparedStatement = connect.prepareStatement("select * from userdata"); resultSet = preparedStatement.executeQuery(); while(resultSet.next()){ // do read rs } Whenever I call for a connection, I get this stacktrace: java.sql.SQLException: Access denied for user 'yerobot'@'localhost' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1086) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:928) at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1750) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1290) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2502) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2535) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2320) at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:834) at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:46) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:347) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at…
possible better answer: http://stackoverflow.com/a/22418072
tagged with: java
has answer: http://stackoverflow.com/a/27615579
score: 0
answer count: 2
has title: Mysql Connection in Java: Access denied for user @ localhost
has comment: http://stackoverflow.com/comment/34088088
has comment: http://stackoverflow.com/comment/34088109
has comment: http://stackoverflow.com/comment/36698090
accepted answer: http://stackoverflow.com/a/27615579
has comment: http://stackoverflow.com/comment/34088144
has comment: http://stackoverflow.com/comment/34088118
type: AnsweredQuestion

http://stackoverflow.com/comment/34178317
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22468990
type: Comment
has text: @JasonC: no, if it's inside of the parenthesis, it will allow the int division to return a non-zero decimal. I will leave it as it stands.

http://stackoverflow.com/q/22474791
tagged with: callback
favorite count: 0
tagged with: android
has title: Incorrect sequence of actions in method with callback
has answer: http://stackoverflow.com/a/22474905
accepted answer: http://stackoverflow.com/a/22474905
tagged with: google-drive-api
downvote count: 0
linked to: http://stackoverflow.com/q/22381649
possible better answer: http://stackoverflow.com/a/22479237
has answer: http://stackoverflow.com/a/22479237
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
answer count: 2
has body: I have next method, that returns ArrayList&lt;String&gt;, data from Google Drive account. public int getMetodsList() { final ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;(); System.out.println("1"); Drive.DriveApi.getFolder(MainActivity.mGoogleApiClient, getIDOfFolder("SomeFolder")) .listChildren(MainActivity.mGoogleApiClient).setResultCallback(new ResultCallback&lt;DriveApi.MetadataBufferResult&gt;() { @Override public void onResult(MetadataBufferResult mdbr) { System.out.println("2"); for (int i = 0; i &lt; mdbr.getMetadataBuffer().getCount(); i++) { result.add(mdbr.getMetadataBuffer().get(i).getTitle()); } System.out.println("3"); } } ); System.out.println("4"); return result.size(); For help i've added log with numbers - System.out.println("number"); When I invoke this method, Log returns me next sequence: 1, 4, 2, 3. So i can't get right ArrayList, return is invoked before CallBack() Help please, how can i invoke CallBack **ResultCallback&lt;DriveApi.MetadataBufferResult&gt; before return?
upvote count: 1

http://stackoverflow.com/comment/34149368
has text: You will have to call setMaxRows(0) before executing the statement to ensure there is no limit to the ResultSet.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22452654

http://stackoverflow.com/q/22449647
has answer: http://stackoverflow.com/a/22450142
tagged with: socket-timeout-exception
type: UnansweredQuestion
tagged with: infinite
tagged with: socketexception
tagged with: java
tagged with: timeout
has title: socket read timed out - should I go for 0 (inifite)
type: Question
score: 0
has body: I'm downloading a big file (say around 100mb) and I'm receiving SocketException: Read timed out every now and then. I'm thinking of raising the socket timeout. Actually, I'm thinking of setting the socket timeout to 0 (infinite) as eventually the sizes that the files that my app will be downloading may even go greater than 300mb, or even greater than 300mb. Is this a good practice? Regarding socket timeout, when does the timeout countdown actually starts? I mean, when a socket timeout occurs, does it mean that the connection is still alive and file is still continously being downloaded but just timeouts because a socket timeout is configured? Or does the countdown starts when it figures that connection is still alive but no data is being sent by the server; thus countdown begins and reached the timeout? Because if the case is the latter, then I'll not opting to go to infinite, since it will be caused by the server not sending me data and not by my app.
answer count: 1

http://stackoverflow.com/q/22387676
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34042716
has answer: http://stackoverflow.com/a/22390201
has title: remove rectangle drawn over an image
has body: I have an image displayed in jLabel. When clicking on any part of the image a 40x40 rectangle will be drawn. Now I want to remove the drawn rectangle from the image when a REMOVE(jButton) pressed. I have tried the code below public void paint (Graphics g) { g2 = (Graphics2D) g; g2.clearRect(n,n1, 40,40 ); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: repaint(n,n1,40,40); } It just fill the rectangle with background color instead of removing.Is there any way to remove the rectangle without filling any color?that is by keeping the original image itself?
type: UnansweredQuestion
tagged with: netbeans-7
tagged with: jlabel
type: Question
tagged with: swing
answer count: 1
tagged with: rectangles

http://stackoverflow.com/comment/33956496
type: QuestionComment
comment on: http://stackoverflow.com/q/22342314
type: Comment
score: 1
has text: @BrianRoach it's an array of words. it's not empty. I passed from the main to the method.

http://stackoverflow.com/q/22472195
score: 0
has comment: http://stackoverflow.com/comment/34183762
answer count: 1
tagged with: angularjs
has comment: http://stackoverflow.com/comment/34183692
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has title: Rendering dynamic user interface depending on the settings saved in database
tagged with: css
tagged with: java
has answer: http://stackoverflow.com/a/22472775
has body: I have a situation. I have one setting page through which I can modify the settings of the User Interface page. This settings page contains information about colors and images to be shown in user interface page. When I make changes in this settings page and save it then configuration gets saved in database. Now I want to use these saved settings in DB for rendering client side UI. HTML pages will remain common and depending on the settings saved in DB I need to update its interface.
type: Question
tagged with: javascript

http://stackoverflow.com/comment/34561684
type: Comment
comment on: http://stackoverflow.com/a/22486690
has text: could you specify if this solution is working with TWO tables with ONE field or with ONE table with TWO fields ?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34089262
has text: Why do you want to replace with arrays to start with if `ArrayList` works for you?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22418524

http://stackoverflow.com/q/22422582
has title: How to improve (string) Switch-statement with cleaner / better code?
tagged with: switch-statement
has body: I'm by no means a professional Java developer, I code for fun to solve various problems/improve existing solutions, mostly for myself. I'm self-taught so I probably lack some fundamental Java/programming skills. I am wondering if there is a better way to improve the following code segment. I am parsing a web site and have a need to translate the incoming data to localized language. For this I use a simple switch/case scenario for the parsed String. Could this be improved with something else? Map/HashMap? Example-code: String mCity = "Soelden"; switch (mCity) { case "Crans Montana" : mCity = "Crans-Montana"; break; case "Soelden" : mCity = "Sölden"; break; case "Val d Isere" : mCity = "Val d'Isere"; break; case "St. Moritz" : mCity = "Sankt Moritz"; break; }
answer count: 3
has comment: http://stackoverflow.com/comment/34095748
downvote count: 0
has answer: http://stackoverflow.com/a/22422654
favorite count: 0
accepted answer: http://stackoverflow.com/a/22422654
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22422735
upvote count: 2
possible better answer: http://stackoverflow.com/a/22422660
type: Question
has answer: http://stackoverflow.com/a/22422660
has comment: http://stackoverflow.com/comment/34095772
tagged with: java

http://stackoverflow.com/q/22335206
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33974843
has title: How can I get HttpServletRequest in an customized AOP advisor?
has comment: http://stackoverflow.com/comment/34023573
has body: Context: In my Spring MVC application, I have an advisor that intercepts controller methods (My AOP works fine). In the advice class, I'm trying to extract information by calling HttpServletRequest.getRemoteUser(). Then I need to load user's authorities from DB. My code Interceptor class (implements MethodInterceptor): private HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); In web.xml: org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher / Result/Problem: I still get java.lang.IllegalStateException: No thread-bound request found, the exception still suggests using RequestContextListener or RequestContextFilter. I have searched a lot on Stack Overflow and other places but no luck. Any help will be appreciated! (Please bear me for the old question:P) Update: I think I am referring to request attributes outside of an actual web request and that's why RequestContextListener doesn't help? Is there any way I can still get the current request?
upvote count: 2
tagged with: spring-aop
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22390048
accepted answer: http://stackoverflow.com/a/22390048
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/33979749

http://stackoverflow.com/comment/34048068
comment on: http://stackoverflow.com/a/22395138
type: Comment
score: 2
type: AnswerComment
has text: Why do I put a JDK when it asks for JRE

http://stackoverflow.com/comment/36700778
has text: `ss1 = string.substring(0, index); // index = " ";` - surely this is wrong; index can't be a String?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22391704

http://stackoverflow.com/a/22507474
answers question: http://stackoverflow.com/q/22470591
type: Answer
has comment: http://stackoverflow.com/comment/35281007
score: 0
has body: You have to use JSTL or Spring tags to create the URLs: &lt;c:url value="/datedflight/DatedFlightSearch.htm"&gt; or &lt;spring:url value="/datedflight/DatedFlightSearch.htm"&gt; Otherwise, HDIV can't include states identification as a parameter.

http://stackoverflow.com/comment/34007067
has text: It worked out when the element is identified again in the same driver.. But a modal dialog is shown after logout and url is loaded again
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22370613
type: Comment

http://stackoverflow.com/comment/34021355
comment on: http://stackoverflow.com/q/22368649
has text: SET statement_timeout TO 1000; http://www.postgresql.org/docs/current/static/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-STATEMENT
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22410439
has comment: http://stackoverflow.com/comment/34075642
type: Answer
has comment: http://stackoverflow.com/comment/34074830
upvote count: 1
has comment: http://stackoverflow.com/comment/34074617
has body: public void DialogDownLoad(String message,int pos) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); // set title alertDialogBuilder.setTitle("title"); // set dialog message alertDialogBuilder.setMessage(message) .setCancelable(false) .setPositiveButton("Yes",new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int id) { if(pos == 0){ // call downloadMap1(); } if(pos == 1){ // call downloadMap2(); } ...................... } }) .setNegativeButton("No",new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int id) { ............... //your code } }); // create alert dialog AlertDialog alertDialog = alertDialogBuilder.create(); // show it alertDialog.show(); } and in your onItemClick() method @Override public void onItemClick(AdapterView&lt;?&gt; av, View v, int pos, long id) { message = "Your url"; DialogDownload(message,pos); }
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22409936
accepted answer of: http://stackoverflow.com/q/22409936

http://stackoverflow.com/a/60211359
score: 2
upvote count: 2
has body: I bumped into the situation in JUnit 5 when created a private method: import org.junit.jupiter.api.Test class Test1 { @Test private fun sort() { println("1") } } Remove private.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22469480

http://stackoverflow.com/comment/34193761
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22478614
has text: if(l1 == 2) try this way
type: Comment

http://stackoverflow.com/a/22466155
downvote count: 0
answers question: http://stackoverflow.com/q/22464163
type: Answer
upvote count: 5
has body: Based on your question, I'm worried you might be misunderstanding the point of salience. Salience is a prioritization value. Drools uses it in order figure out which drool to fire first when it is the case that the constraints for more than one rule are satisfied. The problem of [firing rule P under certain circumstances and NOT rule Q when rule P is fired] is a common one. Your object model should be set up such that this is a natural consequence of reasoning over your concept space. For the literal situation you have listed, you might try inserting a new fact into working memory ("RuleFiredFact" with a value of "2nd", or whatever). You would then check for this fact in your first rule constraints. If it is true, the first rule doesn't fire. UPDATE: To be clear, "RuleFiredFact" is an abstract placeholder for some concrete fact in your fact model. Part of the point of drools is not using abstract stuff in the drools DSL. UPDATE: Whether or not stateful vs. stateless session is appropriate is going to depend a lot on your available computer resources, object model, team, the list goes on. If you don't know which to use, you should refer to a discussion on the topic. You might try this older mailing list post http://drools.46999.n3.nabble.com/Advice-sought-on-choosing-Stateful-or-Stateless-sessions-td57069.html Whichever you go with, I strongly suspect your object model is too shallow. It is very uncommon to create a drools system which contains one fact, then never creates any more. The point of drools is to reason over a number of facts. The way to tackle this is probably going to be something like moving through your object and inserting the information within it into the drools working memory as facts. You would then write rules which only fire under the constraints you want. In a circumstance like what I describe, there are many ways of making sure only a single rule fires. Your rules may all be on the lookout for a "factWasAlreadyReasonedOverFact" with a referen…
score: 5

webserver
tags question: http://stackoverflow.com/q/22465572
tags question: http://stackoverflow.com/q/22368730
tag name: webserver
type: Tag

http://stackoverflow.com/q/22399759
tagged with: pie-chart
downvote count: 0
has title: Jfreechart piechart generation
answer count: 1
has body: I am trying to generate a piechart from an existing application but am getting errors. The latest error is: createPieChart(java.lang.String,org.jfree.data.general.PieDataset,org.jfree.chart.labels.PieSectionLabelGenerator) in efa.util.chart.ChartUtil cannot be applied to (java.lang.String,org.jfree.data.general.PieDataset) [javac] sectorChart = ChartUtil.createPieChart("",xy); [javac] ^ Besides this, I also need to add a third argument in the function call, which is PieSectionLabelGenerator labelGenerator. However, I don't know how to do that. Have read the docs/api but still am unsure. What would you advise? The code I am using is imports (please see below) declaration in the code is JFreeChart sectorChart; the function: private void genChart(){ DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue("JavaWorld", new Integer(75)); pieDataset.setValue("Other", new Integer(25)); PieDataset xy = pieDataset; sectorChart = ChartUtil.createPieChart("",xy,); } I don't think there is anything wrong with my imports, nor declaration of the object. Please let me know if you'd like to see these, I'm leaving them out for brevity of this post. I'm unable to make the answer below work for my app specifically. But I have this fragment of code in my ChartUtil.java file public static JFreeChart createPieChart(final String title, final PieDataset dataset, PieSectionLabelGenerator labelGenerator) { final JFreeChart chart = ChartFactory.createPieChart(title, dataset, false, true, true); labelGenerator = labelGenerator != null ? labelGenerator : new StandardPieSectionLabelGenerator("{2} {0}", NumberFormat.getNumberInstance(), NumberFormat.getPercentInstance()); PiePlot plot = (PiePlot) chart.getPlot(); ChartUtil.formatPiePlot(plot); plot.setLabelGenerator(labelGenerator); PieRenderer renderer = new PieRenderer(); renderer.setColor((PiePlot) chart.getPlot(), dataset); return chart; } I believe we need to figure out how to pass a PieSectionLabelGenerator into the funct…
favorite count: 0
has answer: http://stackoverflow.com/a/22400050
type: UnansweredQuestion
tagged with: charts
score: 1
tagged with: java
upvote count: 1
tagged with: jfreechart
type: Question

http://stackoverflow.com/a/22355760
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22355523
has body: == in Java programming language means that it will compare memory address with the other object. In your snippet, when you call toString(), it will generate a new String object from heap as return. The logic in if-else statment it uses a String that from Constant pool differs with in heap object. You should use equals() for comparing string values, see JDK source code for details.

http://stackoverflow.com/comment/34170443
score: 0
type: QuestionComment
has text: How is `GameMap.findall` defined ?
type: Comment
comment on: http://stackoverflow.com/q/22463902

http://stackoverflow.com/comment/34160914
score: 0
has text: `Example.create()` does nothing else than `Restrictions.eq("ticketNb", ticketNb) .add(Restrictions.eq("idQueue", idQ) ...` but using example its more easy to read and understand.
type: Comment
comment on: http://stackoverflow.com/a/22455279
type: AnswerComment

http://stackoverflow.com/comment/123659387
score: 0
type: AnswerComment
has text: I'm writing this comment after trying this but it didn't work. I've a project named Helloworld which consist only 1 java file, `Helloworld/src/com/firstpackage/Test.java` (windows 10. intellij idea). I **don't** have CLASSPATH environmental variable, i want to set classpath specifically for this project. running `java com.firstpackage.Test` inside Helloworld directory doesn't work and neither does the command `java -classpath C:\Users\matuagkeetarp\IdeaProjects\Helloworld\src\com\firstpackage Test.java` set classpath variable. Can you help?
type: Comment
comment on: http://stackoverflow.com/a/27514651

http://stackoverflow.com/a/25419461
has comment: http://stackoverflow.com/comment/39839208
type: Answer
answers question: http://stackoverflow.com/q/22389431
upvote count: 5
score: 5
has body: Just saw this question. For others who are looking for it, use it like this: time: %01$02d:%02$02d %01 -> is denotes the 1st variable, %02 -> denotes the 2nd $02d -> defines decimal formatting
downvote count: 0
has comment: http://stackoverflow.com/comment/39713266

http://stackoverflow.com/q/22362326
has body: I am profiling a Grails web application with JProfiler and JConsole and am observing a phenomenon I am unable to fully understand. The setup I am profiling is as follows: A Grails web application built with maven as WAR and deployed to Tomcat. A single Solr instance Tomcat with a thread pool size of 100 HTTP worker threads, BIO connector The application calls Solr for nearly every request. There's no DB and no other backend interaction. Ehcache ist used for some caching. I have created a set of moderate load tests that are fired against the application. I have figured out a kind of load limit for my local setup. Below that limit I make the following observations with regard to the Grails application: Response times &lt; 500ms HTTP threads are mainly spending time with net I/O, a bit runnable and wait time and very little block time CPU around 70% When I raise the load a bit beyond said limit, the picture drastically changes: Response times increase to a couple of seconds HTTP threads are mainly in blocking or runnable state, very little net I/O and wait time CPU seems to "jump" a lot between 40% and 80% Now while it is totally understandable that things get slower under higher load I am very concerned about the fact that above the load limit lock contention occurs and a significant amount of time is spent blocking. I investigated the monitor history and especially found a lot of events similar to the following: Monitor class org.apache.catalina.loader.WebappClassLoader Waiting and owning thread are some HTTP worker Time spent blocking for the monitor is significant (around 2 seconds regularly) These events also occur below the load limit but they are rare and don't have such destructive impact Stacktraces of the owning and waiting threads are very different, below is an example. Filtered stacktrace of the owning thread groovy.lang.GroovyClassLoader.loadClass(java.lang.String) Script1.$createCallSiteArray() Script1.$getCallSiteArray() Script1.__$swapInit() Script1.&l…
has answer: http://stackoverflow.com/a/30433702
has title: Lock contention on WebappClassLoader in Grails application under load
tagged with: java
tagged with: grails
type: Question
upvote count: 2
tagged with: groovy
answer count: 1
tagged with: tomcat
favorite count: 0
score: 2
downvote count: 0
tagged with: classloader
type: UnansweredQuestion

http://stackoverflow.com/comment/34105335
score: 0
type: AnswerComment
has text: @user3421018 I have updated.Also which exception you receive when enter number > 48 ??
comment on: http://stackoverflow.com/a/22427918
type: Comment

http://stackoverflow.com/q/22458353
type: AnsweredQuestion
has body: Below is the code that I wrote, bucketsRow contains 80 elements and the println statement inside for loop correctly shows that. readFile is a scanner which iterates through a file having 800 rows in which the elements are the first word, of which any 80 are present in bucketsRow. I wish to copy to those rows in the new file, for which I used filewriter. for(int p=0;p&lt;bucketsRow.length;p++) { System.out.println("p:"+p+"Doc at p:"+names[p]); inner: while(readfile.hasNextLine()) { String line=readfile.nextLine(); //System.out.println(line); if(line.indexOf(names[p])!=-1) { System.out.println(line.indexOf(names[p])); writefile.write(line); writefile.write(System.getProperty( "line.separator" )); break inner; } } } writefile.flush(); writefile.close();
score: 1
tagged with: java
tagged with: filewriter
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22458560
tagged with: file-io
has comment: http://stackoverflow.com/comment/34159018
answer count: 1
downvote count: 0
has title: The output file doesn't contain all the lines i have copied from the source
favorite count: 0
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/22458560

http://stackoverflow.com/a/22345525
score: 2
upvote count: 2
has body: Apart from the group index problem mentioned in the comment, there is another question: [...] could I as well directly bind a match to a specific matching group? Like {1} is my {0} string where test would go to match.group(0)? Is that possible? Not with Java 6. With Java 7+, you can use named capturing groups: Pattern.compile("(?&lt;first&gt;.*) is my (?&lt;second&gt;.*) string") You can then use .group("first") and .group("second") on your Matcher instance. Note that .group() is equivalent to .group(0).
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22345378
answers question: http://stackoverflow.com/q/22345378
type: Answer

http://stackoverflow.com/q/22370570
has answer: http://stackoverflow.com/a/22370771
has answer: http://stackoverflow.com/a/22370894
linked to: http://stackoverflow.com/q/26305
favorite count: 0
has answer: http://stackoverflow.com/a/22370789
has title: Better way to implement empty while loop to hold control
has comment: http://stackoverflow.com/comment/34005771
possible better answer: http://stackoverflow.com/a/22370811
has comment: http://stackoverflow.com/comment/34005665
has answer: http://stackoverflow.com/a/22370764
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
has body: I am playing audio in background and I want the control of program to stay stand still till the audio playing is over for that I am using empty while loop as follows while(isPlaying==true){}; mediaPlayer.stop(); as you can see while loop holds program control till audio is playing and after that next instruction is executed. This is working fine but I came to know that this is not a proper way to do this empty-while is expensive I am searching for alternative. Please Help.
has comment: http://stackoverflow.com/comment/34005798
downvote count: 0
has answer: http://stackoverflow.com/a/22370811
has answer: http://stackoverflow.com/a/22370751
answer count: 6
accepted answer: http://stackoverflow.com/a/22370751
score: 4
tagged with: while-loop

http://stackoverflow.com/comment/34130438
type: Comment
has text: If I don't use Maven. Have I attach it as zip file to the project?
comment on: http://stackoverflow.com/a/22441732
score: 0
type: AnswerComment

http://stackoverflow.com/a/22487791
upvote count: 2
answers question: http://stackoverflow.com/q/22487726
has body: System.out.println("String length for second case is :".length()); prints the length of the string "String length for second case is :" which is 34.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/q/22379133
has body: I'm stuck with this problem. I'm switching fragments with swipe. on swipe left: public void nextFragment() { if(collection.iterator(). hasNext()){ String fragmentNameToHide = collection.iterator().current(); String fragmentNameToShow = collection.iterator().next(); Fragment fragmentToShow = null; if((fragmentToShow=fragmentManager.findFragmentByTag(fragmentNameToShow))==null){ Class&lt;?&gt; className=null; try { className = Class.forName(fragmentNameToShow); Constructor&lt;?&gt; constructor = className.getConstructor(); Object object = constructor.newInstance(); fragmentToShow = (Fragment) object; } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } FragmentTransaction ft = fragmentManager.beginTransaction(); ft.setCustomAnimations(R.animator.slide_in_right, R.animator.slide_out_left); Fragment fragmentToHide = fragmentManager.findFragmentByTag(fragmentNameToHide); ft.add(R.id.fragment_container, fragmentToShow, fragmentNameToShow); ft.show(fragmentToShow); ft.hide(fragmentToHide); ft.commitAllowingStateLoss(); } } on swipe right: public boolean prevFragment() { if(collection.iterator().isLast()){ Log.i("prv", "son"); String fragmentNameToRemove = collection.iterator().current(); String fragmentNameToShow = collection.getFragmentList().get(0); Fragment fragmentToShow = fragmentManager.findFragmentByTag(fragmentNameToShow); Fragment fragmentToRemove2 = fragmentManager.findFragmentByTag(collection.getFragmentList().get(1)); FragmentTransaction ft = fragmentManager.beginTransaction(); ft.setCustomAnimations(R.animator.slide_in_left, R.animator.slide_out_right); Fragment fragmentToRemove = fragmentManager.findFragmentByTag(fragmentNameToRemove); ft.hide(fragmentToRemove);…
type: UnansweredQuestion
has title: Can not perform this action after onSaveInstanceState on screen orientation changed
tagged with: android
tagged with: android-fragments
has answer: http://stackoverflow.com/a/22379819
tagged with: java
type: Question
score: 0
answer count: 1

http://stackoverflow.com/a/22401375
accepted answer of: http://stackoverflow.com/q/22401131
answers question: http://stackoverflow.com/q/22401131
score: 0
has comment: http://stackoverflow.com/comment/34226589
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34059815
has body: Static import First of all, you can define a scriplet with &lt;%= and %&gt; like explained here and here. Instead of copying the whole code, you can statically import the .jsp page like so: &lt;%@ include file="YourPage.jsp" %&gt; Link. To call the page at runtime instead of at the server-side you do: &lt;jsp:include page="YourPage.jsp"/&gt; But this doesn't yield a huge advantage over static importing. Link You can also declare your function and then use it throughout your webpage by using &lt;%! and %&gt; like shown here. If you do any of the methods above, your function will (can) be imported only when the page initially loads (server-side). (To be absolutely correct, &lt;jsp:include is called at runtime in theory but in practice it simulates a request without actually making a complete round-trip: server &gt; browser &gt; server &gt; browser). Dynamic import For dynamic importing or loading, you have to resort to jQuery (JavaScript) to load your JSP page client-side. Please refer to this question: How do I inject another JSP page into a &lt;div&gt; when clicking a link? You could simply do: function changeContent() { $('#content').load('YourPage.jsp'); } You can find other examples here: Display another jsp content in current jsp page upon a hyperlink click CodeRanch To quote the answer from the last link: That's something to do with Ajax, Jquery can do that. You can use javascript getElementByID or use Jquery's build_in $("sub_banner") syntax to change the div's content.
type: Answer

http://stackoverflow.com/q/22375454
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34147989
has comment: http://stackoverflow.com/comment/34149662
has comment: http://stackoverflow.com/comment/34013253
has comment: http://stackoverflow.com/comment/34016460
has body: I am having an input like this. 0 Overcast Yes 4 0 Rainy Yes 3 0 Sunny No 3 1 Cool No 1 1 Cool Yes 3 I am trying to store these data in a Hashmap {0=[Overcast Yes 4,Rainy Yes 3,Sunny No 3]} {1=[Cool No 1,Cool Yes 3]} So far what I did is Map&lt;String, List&lt;String&gt;&gt; mapPart = new HashMap&lt;String, List&lt;String&gt;&gt;(); List&lt;String&gt; tmpList = new ArrayList&lt;String&gt;(); while((partLine = bfpart.readLine())!=null){ String restOfString=""; String[] first = partLine.split(" "); String firstPart = first[0]; for (int i=1; i&lt;first.length; i++) { restOfString += first[i]; restOfString += " "; } if(mapPart.isEmpty()){ tmpList.add(restOfString); mapPart.put(firstPart, tmpList); } else{ for (Map.Entry&lt;String, List&lt;String&gt;&gt; entry : mapPart.entrySet()) { String colId = entry.getKey(); if(colId.equals(firstPart)){ List&lt;String&gt; lst = mapPart.get(colId); lst.add(restOfString); mapPart.put(colId,lst); } else{ //should we craete a new list } } } current output map: {0=[Overcast Yes 4 , Rainy No 2 , Sunny No 3 ]} I am trying to calculate this equation. Info(n)=([no.of yes for overcast,no.of No for overcast],[no.of yes for Rainy,no.of no for Rainy],[no.of yes for Sunny,no.of no for Sunny]) Info0([4,0],[3,0],[0,3])/log2 Info1([3,1])/log2 Is the above a good way to do with this equation or while reading the file itself the equation can be done or not ?
has title: Get index of a value
has answer: http://stackoverflow.com/a/22375959
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22375541
tagged with: hashmap
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22375585
has comment: http://stackoverflow.com/comment/34013326
downvote count: 0

http://stackoverflow.com/q/22417228
tagged with: sockets
score: 6
upvote count: 6
accepted answer: http://stackoverflow.com/a/22417353
type: AnsweredQuestion
tagged with: tcp
tagged with: java
has body: How can I prevent TCP from making multiple socket connection attempts? Background I'm trying to get a rough estimate of the round-trip-time to a client. The high-level protocol I have to work with gives no way to determine the RTT, nor does it have any sort of no-op reqeust/response flow. So, I'm attempting to get information directly from the lower layers. In particular, I know that the client will actively reject TCP connection attempts on a particular port. Me -&gt; Client: SYN Client -&gt; Me: ACK, RST Code long lStartTime = System.nanoTime() / 1000000; long lEndTime; // Attempt to connect to the remote party. We don't mind whether this // succeeds or fails. try { // Connect to the remote system. lSocket.connect(mTarget, MAX_PING_TIME_MS); // Record the end time. lEndTime = System.nanoTime() / 1000000; // Close the socket. lSocket.close(); } catch (SocketTimeoutException|IOException lEx) { lEndTime = System.nanoTime() / 1000000; } // Calculate the interval. lInterval = lEndTime - lStartTime; System.out.println("Interval = " + lInterval); Problem Using Wireshark, I see that the call to lSocket.connect makes three (failed) attempts to connect the socket before giving up - with an apparently arbitrary inter-attempt interval (often ~300ms). Me -&gt; Client: SYN Client -&gt; Me: ACK, RST Me -&gt; Client: SYN Client -&gt; Me: ACK, RST Me -&gt; Client: SYN Client -&gt; Me: ACK, RST Question Is there any way to make TCP give up after a single SYN/RST pair? I've looked through some of the Java code. I wondered if I was on to a winner when the comment on AbstractPlainSocketImpl said... /** * The workhorse of the connection operation. Tries several times to * establish a connection to the given &lt;host, port&gt;. If unsuccessful, * throws an IOException indicating what went wrong. */ ...but sadly there's no evidence of looping/retries in that function or any of the other (non-native) functions that I've looked at. Where does this retry behaviour actually come from? And ho…
has comment: http://stackoverflow.com/comment/34086627
type: Question
has answer: http://stackoverflow.com/a/22417353
has title: Prevent TCP socket connection retries
has comment: http://stackoverflow.com/comment/34086720
answer count: 1
downvote count: 0
tagged with: language-agnostic
favorite count: 0

http://stackoverflow.com/q/22428117
has title: Android Screencast fails (please help a new Android Dev)
has comment: http://stackoverflow.com/comment/34105577
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 3
upvote count: 3
tagged with: java
tagged with: signing
type: Question
has body: I'm setting up new AndroidDevEnvironment and I'm stuck on this error while trying to open Android Screencast which allows you to use your android device via PC via keyboard and mouse and display mirroring and more Because of rep limits (need at least 10 to post images) I posted details here (Yes, I lowered the security to the lowest setting (which is medium in Java Settings) and at least the .jnlp now goes past the Your security settings have blocked a local application from running message) This seems like a simple error to fix but Im a late on schedule noob at Java that google failed to help
has comment: http://stackoverflow.com/comment/34106095
tagged with: certificate
has answer: http://stackoverflow.com/a/29185925
has comment: http://stackoverflow.com/comment/34106154
tagged with: security
answer count: 2
has answer: http://stackoverflow.com/a/22429101
downvote count: 0

http://stackoverflow.com/comment/34096099
type: Comment
comment on: http://stackoverflow.com/a/22421894
has text: Have you tried to put the absolute path? See the Edit
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34124091
has text: I tried to import the library project, but when I go into the "add library" part it shows an empty list so I can't choose the Google Play library. What should I do?
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22437762

http://stackoverflow.com/q/22371053
tagged with: jpa
downvote count: 0
tagged with: eclipselink
favorite count: 0
score: 2
answer count: 0
type: UnansweredQuestion
has title: EclipseLink New L2 Cache
has body: How to create my own implementation of EclipseLink's L2 cache? My current issue is that I want to be able to use memcache/redis as a distributed cache, but currently I can't find any way of doing this. Most of the solutions I found is about cache coordination which seems a bit overkill for my requirement. I just need shared L2 cache across horizontally scaled servers. Thanks
tagged with: java
has comment: http://stackoverflow.com/comment/44057384
type: Question
upvote count: 2

http://stackoverflow.com/comment/34030018
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22385005
has text: So you expect folks to first __translate__ your question?

http://stackoverflow.com/q/22369347
has comment: http://stackoverflow.com/comment/34003645
has comment: http://stackoverflow.com/comment/34004262
has title: Comparing a String with a Char
has comment: http://stackoverflow.com/comment/34003774
has comment: http://stackoverflow.com/comment/34004061
tagged with: java
has body: I have been trying to create a Temperature Converter in java using 3 function for the conversion of the Fahrenheit, Celsius, and the print out of the results. The code works, but for reason I am comparing a String with a Char, making the expression never equal. I am really confused about this. Please I need your help, Thank you. TemperatureConverter: import java.util.*; public class TemperatureConverter { public static double convertToCelsius(double degrees ){ double celsius = (5*(degrees - 32)/9); return celsius; } public static double convertToFahrenheit(double degrees ){ double fahrenheit = (9*( degrees/5 ) + 32); return fahrenheit; } public static String getOutput(char units, double degrees) { if ((units == 'F') || (units == 'f')) { String output = " "; output = degrees + " F = " + convertToCelsius(degrees); return output; } else if ((units) == 'C' || (units) == 'c' ) { String output = " "; output = degrees + " C = " + convertToFahrenheit(degrees); return output; } if(!(units == 'F' || units == 'f' || units == 'C' || units == 'c')) { String output = ("Unknown units - cannot do calculation\n" + " - next time enter either \'F\' for Fahrenheit or \'C\' for Celsius."); return output; } return ""; } public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); double degrees; char units; System.out.println("Enter a temperature in degrees (for example 29.6): "); degrees = keyboard.nextDouble(); System.out.println(); System.out.println("Enter 'F' (or 'f') for Fahrenheit or 'C' (or 'c') for Celsius: "); units = keyboard.next().charAt(0); System.out.println(getOutput(units, degrees)); } } TemperatureConverterTest: import junit.framework.TestCase; /** * A JUnit test case class. * Every method starting with the word "test" will be called when running * the test with JUnit. */ public class TemperatureConverterTest extends TestCase { public static final double EPSILON = 0.0001; public void testConvertToCelsius() { assertEquals(0.0, TemperatureConverter.…
has comment: http://stackoverflow.com/comment/34004645
has comment: http://stackoverflow.com/comment/34004249
has comment: http://stackoverflow.com/comment/34004393
has comment: http://stackoverflow.com/comment/34004350
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/34003717
favorite count: 0
has comment: http://stackoverflow.com/comment/34003696
has comment: http://stackoverflow.com/comment/34004419
has comment: http://stackoverflow.com/comment/34004397
type: Question
has comment: http://stackoverflow.com/comment/34004358
has answer: http://stackoverflow.com/a/22369962
has comment: http://stackoverflow.com/comment/34003724
has answer: http://stackoverflow.com/a/22369982
has comment: http://stackoverflow.com/comment/34004055
has comment: http://stackoverflow.com/comment/34004277
score: -2
has answer: http://stackoverflow.com/a/22369978
accepted answer: http://stackoverflow.com/a/22369982
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/34004003
has comment: http://stackoverflow.com/comment/34003679
possible better answer: http://stackoverflow.com/a/22369978

http://stackoverflow.com/comment/34069396
score: 0
comment on: http://stackoverflow.com/q/22367870
has text: Your comments helped me solve my problem. Thanks Elliott.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22346412
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22329883
downvote count: 0
has comment: http://stackoverflow.com/comment/33966390
accepted answer of: http://stackoverflow.com/q/22329883
has comment: http://stackoverflow.com/comment/34007246
has comment: http://stackoverflow.com/comment/34009387
type: Answer
has body: The line List&lt;HashMap&lt;String, String&gt;&gt; localPhoneArr = _allPeoplesDictArr.get(j).get("PhoneNumbers"); is giving you the syntax error, because it is a String. If you want to make an Array out of it, you have to parse the JSON String. You can find the documentation here It should look something like this String localPhoneStr = _allPeoplesDictArr.get(j).get("PhoneNumbers"); JSONArray phoneArray = new JSONArray(localPhoneStr); for(int i=0; i&lt;phoneArray.length(); i++){ JSONObject phone = phoneArray.getJSONObject(i); userDict.put("label", phone.getString(String.format("Label_%d", i))); userDict.put("value", phone.getString(String.format("Phone_%d", i))); }
score: 1

http://stackoverflow.com/comment/34037940
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22367202
type: Comment
has text: Good. That's what I want to know

http://stackoverflow.com/q/22349241
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34055523
score: 0
has body: This is a stock management system and I have a problem with updating part in good received note. When we purchase goods, we get a good received note, so when we get the items the number of items has to be updated (has to be added to the remaining goods) according to the item code. According to the following code data from GRN will be extracted and will be saved in GRN1 and GRN2 tables. There's another table called Item_Supplier, when we receive goods Stock in hand field in Item_Supplier table has to updated according to the item_Id as well. Problem is following code does not work. Connection ss = Class_DB.myconnection(); Statement st = ss.createStatement(); - ResultSet rs = st.executeQuery("select stock_in_hand from item_supplier where item_ID =('" + TF_GRN_ITEMID.getText() + "')"); grniid = TF_GRN_NO_OF_ITEM.getText(); while (rs.next()) { nit = rs.getString("stock_in_hand"); } sumn = grniid + nit; st.executeUpdate("insert into grn1 values('" + TF_GRN_GRNNO.getText() + "','" + TF_GRN_SUPPLIERID.getText() + "','" + TF_GRN_AMOUNT.getText() + "','" + TF_GRN_DATE.getText() + "')"); st.executeUpdate("insert into grn2 values('" + TF_GRN_GRNNO.getText() + "','" + TF_GRN_ITEMID.getText() + "','" + TF_GRN_EXP_DATE.getText() + "','" + TF_GRN_TAX.getText() + "','" + TF_GRN_NO_OF_ITEM.getText() + "','" + TF_GRN_GAMOUNT.getText() + "','" + TF_GRN_NAMOUNT.getText() + "','" + TF_GRN_QTY.getText() + "','" + TF_GRN_UNIT.getText() + "','" + TF_GRN_FREE.getText() + "','" + TF_GRN_DIS.getText() + "')"); st.executeUpdate("update item_supplier set stock_in_hand='" + sumn + "' where item_ID='" + TF_GRN_ITEMID.getText() + "'"); JOptionPane.showMessageDialog(null, "Data Saved"); Please help.
tagged with: netbeans
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34055368
has title: Update Query in GRN
answer count: 0
has comment: http://stackoverflow.com/comment/33968660

http://stackoverflow.com/comment/34103353
comment on: http://stackoverflow.com/q/22426813
has text: Your example is missing a parenthesis ("}").
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22411772
type: Answer
has comment: http://stackoverflow.com/comment/34076930
score: 2
has body: public class WelcomeException extends Exception { private static int count = 0; private static final Object countLock = new Object(); public WelcomeException(String message) { super(message); synchronized(countLock) { count++; } } public static int getCount() { return count; //atomic. Doesn't need synchro. } } Your comment on another answer: Now if I want to print the count in my error message to look this: I know I put: Error printing message {count} times how might I go about that? I'm sorry if this question is basic. I'm very new. To do this, override the getMessage() method like so: public String getMessage() { return super.getMessage() + ", This exception has occurred " + getCount() + " times"; }
has comment: http://stackoverflow.com/comment/34077687
downvote count: 0
has comment: http://stackoverflow.com/comment/34077770
has comment: http://stackoverflow.com/comment/34077498
has comment: http://stackoverflow.com/comment/34077641
upvote count: 2
has comment: http://stackoverflow.com/comment/34077304
has comment: http://stackoverflow.com/comment/34077747
has comment: http://stackoverflow.com/comment/34077223
has comment: http://stackoverflow.com/comment/34077464
answers question: http://stackoverflow.com/q/22411713

http://stackoverflow.com/a/22339219
has body: Welcome to the wonderful world of a broken paint chain. Painting in Swing is complex process which is made eaiser by a number of simple methods that you can override. These methods are chained together in order to provide the functionality used to paint the components. If you override one of these methods, you are expected to call it's parent implementation. So, the simple solution would be... @Override public void paint(Graphics g) { super.paint(g); if (towns.size() &gt; 0) for (Town t : towns) g.fillRect(t.getX() - 10, t.getY() - 10, 20, 20); } However, this is not a good idea. paint is one of the top level methods within the paint chain, it is responsible for call a number of child methods. In order to maintain functionality and keep things simple, it is recommended that you override paintComponent instead @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (towns.size() &gt; 0) for (Town t : towns) g.fillRect(t.getX() - 10, t.getY() - 10, 20, 20); } Take the time to read through and understand Painting in AWT and Swing and Performing Custom Painting Ps- Swing components are double buffered by default, so there's no need for contentFrame.setDoubleBuffered(true);
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/22339157
answers question: http://stackoverflow.com/q/22339157

http://stackoverflow.com/comment/33934386
type: Comment
has text: @MarkoTopolnik: I used to have the locks before, but the performance of my threads goes then to the ground. On 32 Core machine it takes only ~30% of the all power; With lock-free code all cores are powered to 100%.
comment on: http://stackoverflow.com/q/22329304
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34034244
comment on: http://stackoverflow.com/q/22386754
has text: This is an assignment I am having problems on. My professor wants an arraylist to be used as of right now. all we are doing is printing the lines for them to be revealed in the correct way.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22389953
tagged with: java
tagged with: glassfish-4
tagged with: mysql
upvote count: 1
tagged with: persistence.xml
accepted answer: http://stackoverflow.com/a/22391839
type: Question
has comment: http://stackoverflow.com/comment/34039819
has title: Transaction realization in JPA
has body: I'm trying to understand what is transaction in JPA. Say I have an application deployed to glassfish with persistence: <?xml version="1.0" encoding="UTF-8"?> jdbc/MyDatabase <exclude-unlisted-classes>false</exclude-unlisted-classes> I'm trying to debug code sniffering requests to MySQL server: public String create() { EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("survex"); EntityManager em = entityManagerFactory.createEntityManager(); Log log = em.find(Log.class, 1); EntityTransaction transaction = em.getTransaction(); transaction.begin(); // NOTING HAPPENS ... log.setMessage("xxx"); em.flush(); // OH, HERE IT IS -> SET autocommit=0; UPDATE LOG SET message = 'xxx' WHERE (id = 1) log.setMessage("aaa"); em.flush(); // OK -> UPDATE LOG SET message = 'aaa' WHERE (id = 1) transaction.commit(); // NOTHING HAPPENS! WHERE IS COMMIT?! log = em.find(Log.class, 1); transaction = em.getTransaction(); transaction.begin(); // STILL NOTHING ... log.setMessage("555"); em.flush(); // UPDATE LOG SET message = '555' WHERE (id = 1) log.setMessage("666"); em.flush(); // UPDATE LOG SET message = '666' WHERE (id = 1) transaction.commit(); // NOTHING!!! return log.getMessage(); } // SOMEWHERE OUTSIDE: COMMIT; SET autocommit=1; Why?! Why JPA behaves so strangely? I expect commit on every transaction.commit() call or I'm misunderstanding something?
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34039289
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22391839
score: 1

http://stackoverflow.com/comment/34091286
comment on: http://stackoverflow.com/a/22419487
score: 0
type: AnswerComment
has text: +1. Like JasonC, I really don't like the "I*" names. I feel that an interface name should be an adjective, but "Walkable", "Swimmable" and so on don't fit the model in which a "Runnable" is something that you run, a "Comparable" is something that you compare, and so on. I would have called these interfaces "Walking", "Swimming" and "Talking". And "Talker implements Talking" has a nice ring to it.
type: Comment

http://stackoverflow.com/comment/33972253
type: AnswerComment
score: 0
has text: Below the TextView initialization is the progress bar being initialized. If you want to style the progress bar (location, color) you do that in XML generally. If you want to control the progress bar generally that is best done through code in my experience.
type: Comment
comment on: http://stackoverflow.com/a/22338608

http://stackoverflow.com/comment/33950396
has text: One thing I see is `try { bin = new int[23123123]; String[] hexChars = new String[bin.length * 2];`. Where's the catch block? This is allocating 200MB+ on the heap, the heap size is typically smaller than this by default. It could be throwing OutOfMemoryError.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22338802
type: Comment

http://stackoverflow.com/comment/33936683
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22331016
score: 0
has text: How would you know that you had a fatal error? The VM would exit, right? You could spawn a small helper application that starts when you're application starts and periodically checks on the main application, restarting it when necessary. You could also install an application as a service (in Windows) or equivalent in other OSs. But I think you should be thinking on the model of "fail, don't resume." You should try to understand why a program failed before simply restarting.

http://stackoverflow.com/comment/34049881
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22373958
has text: The question is what did `f.exists()` and `f.createNewFile()` return. You haven't considered the case where the file does exist and you don't have write access to it. In any case I don't see the point of creating an empty file just to test your write access to it. Most calls to `File.createNewFile()` shouldn't be made at all.
score: 0

http://stackoverflow.com/a/47150906
downvote count: 0
has comment: http://stackoverflow.com/comment/103628791
type: Answer
has body: Use This with all Permission of DB jdbc:mysql://ip:3306/dbname ******* *******
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22441076

http://stackoverflow.com/comment/34086927
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22415699
type: QuestionComment
has text: @buzzsawddog my problem is that exactly. I need to perform comparisons. For instance, (value <= 0.15) . If I get that big 0.150000005960464 as the "value" the condition returns false and should return true

http://stackoverflow.com/a/22374372
type: Answer
answers question: http://stackoverflow.com/q/22374117
downvote count: 0
score: 1
has body: Assuming you have one root Layout in the .xml file with id "my_root" LinearLayout my_root = (LinearLayout) findViewById(R.id.my_root); Create a new Layout: LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); Create a TextView: TextView textView = new TextView(this); Set some text: textView.setText("some text"); Add your TextView to the Layout: layout.addView(textView); Finally add yout Layout to the root Layout: my_root.addView(layout);
upvote count: 1

http://stackoverflow.com/q/22388876
has body: I'm having trouble printing out an array of StaffMember objects by utilizing the defined toString method with my driver. I keep getting a cannot find symbol error and I'm confused as to what I need to replace the staffList with in my driver to make things work out. This is the part of the question I'm stuck on "Your program should first print all the staff members (use toString() method of the StaffMember class) to the terminal window" Here is my code (the Staff and StaffMember classes are from the textbook and were not required to be changed for the assignment, so all problems are with my driver). public class Staff { private StaffMember[] staffList; public Staff () { staffList = new StaffMember[6]; staffList[0] = new Executive ("Sam", "123 Main Line", "555-0469", "123-45-6789", 2423.07); staffList[1] = new Employee ("Carla", "456 Off Line", "555-0101", "987-65-4321", 1246.15); staffList[2] = new Employee ("Woody", "789 Off Rocker", "555-0000", "010-20-3040", 1169.23); staffList[3] = new Hourly ("Diane", "678 Fifth Ave.", "555-0690", "958-47-3625", 10.55); staffList[4] = new Volunteer ("Norm", "987 Suds Blvd.", "555-8374"); staffList[5] = new Volunteer ("Cliff", "321 Duds Lane", "555-7282"); ((Executive)staffList[0]).awardBonus (500.00); ((Hourly)staffList[3]).addHours (40); } public void payday () { double amount; for (int count=0; count &lt; staffList.length; count++) { System.out.println (staffList[count]); amount = staffList[count].pay(); if (amount == 0.0) System.out.println ("Thanks!"); else System.out.println ("Paid: " + amount); System.out.println ("-----------------------------------"); } } } This is the abstract class: abstract public class StaffMember { protected String name; protected String address; protected String phone; //----------------------------------------------------------------- // Constructor: Sets up this staff member using the specified // information. //----------------------------------------------------------------- public StaffMember …
has comment: http://stackoverflow.com/comment/34037305
score: 0
has comment: http://stackoverflow.com/comment/34037278
has comment: http://stackoverflow.com/comment/34037577
type: UnansweredQuestion
tagged with: tostring
has answer: http://stackoverflow.com/a/22389283
tagged with: java
has comment: http://stackoverflow.com/comment/34037809
has answer: http://stackoverflow.com/a/22389180
type: Question
tagged with: object
answer count: 2
has title: Printing an Array of Staff objects with a toString
tagged with: arrays

http://stackoverflow.com/a/22438524
has comment: http://stackoverflow.com/comment/34124086
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22438304
upvote count: 2
has body: You have defined the artifactId of your ejb module like this: OAuthLoginEJB but not OAuthLogin-ejb BUT YOUR DEPENDENCY is like this: cz.literak.oauth OAuthLogin-ejb 1.0-SNAPSHOT ejb
answers question: http://stackoverflow.com/q/22438304
type: AcceptedAnswer

http://stackoverflow.com/comment/34013684
type: Comment
comment on: http://stackoverflow.com/a/22375215
has text: +1 Thanks, at least i got some idea how to actually handle it.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22476393
score: 0
answer count: 1
has title: java.lang.VerifyError thrown when I stop my application
has comment: http://stackoverflow.com/comment/34190121
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/22477719
tagged with: java
type: Question
has body: I am using Spring jar in my application. When i stop my application forcefully while its instance is still runnning, i get java.lang.VerifyError. Take a look at this: 2014-03-18 15:29:26,941 ERROR [localhost-startStop-2] ? - Destroy method on bean with name 'org.springframework.aop.config.internalAutoProxyCreator' threw an exception java.lang.VerifyError: (class: org/springframework/orm/jpa/EntityManagerFactoryUtils, method: convertJpaAccessExceptionIfPossible signature: (Ljava/lang/RuntimeException;)Lorg/springframework/dao/DataAccessException;) Wrong return type in function at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessBeforeDestruction(PersistenceAnnotationBeanPostProcessor.java:358) What i studied was: It might be because the code was compiled in other environment and now the reference is to another environment (Might be the spring jar is updated and possibly the return type has been altered) But what i need is the root cause of this issue.

http://stackoverflow.com/comment/33953929
type: Comment
has text: yes, Here most costly operation is file reading. so if a single thread do the reading operation , the same thread can easily do new file creation task. again, in this scenario you can not deploy multithread.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22340896

http://stackoverflow.com/a/22488337
score: 1
has comment: http://stackoverflow.com/comment/34212070
has comment: http://stackoverflow.com/comment/34211850
accepted answer of: http://stackoverflow.com/q/22487585
answers question: http://stackoverflow.com/q/22487585
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34212079
type: Answer
has body: Here you go! NOTE: no setters in the class, which is why I have to use @JsonCreator. Habit of mine, I don't do beans ;) If you have setters for the different fields you can do without @JsonCreator at all. public final class Jackson { private static final String JSONCONTENT = "{" + "\"type\":\"complicated\"," + "\"params\":[" + "{\"type\":\"simple\"," + "\"content\":\"i still love apples\"}," + "{\"type\":\"simple\",\"content\":\"i love spam too\"}" + "]" + "}"; public static void main(final String... args) throws IOException { final ObjectMapper mapper = new ObjectMapper(); final Complicated complicated = mapper.readValue(JSONCONTENT, Complicated.class); System.out.println("Deserialization done"); System.out.println("Serializing"); System.out.println(mapper.writeValueAsString(complicated)); } } class Complicated { private final String type; private final List&lt;Simple&gt; params; @JsonCreator Complicated(@JsonProperty("type") final String type, @JsonProperty("params") final List&lt;Simple&gt; params) { this.type = type; this.params = new ArrayList&lt;Simple&gt;(params); } public String getType() { return type; } public List&lt;Simple&gt; getParams() { return Collections.unmodifiableList(params); } } class Simple { private final String type; private final String content; @JsonCreator Simple(@JsonProperty("type") final String type, @JsonProperty("content") final String content) { this.type = type; this.content = content; } public String getType() { return type; } public String getContent() { return content; } }
upvote count: 1

http://stackoverflow.com/comment/33944746
has text: where is it returning the last input value?
comment on: http://stackoverflow.com/a/22335363
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22485579
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22486263
has comment: http://stackoverflow.com/comment/34207251
score: 0
tagged with: java
tagged with: javafx
has title: Using static method as JavaFX change listener
type: Question
has comment: http://stackoverflow.com/comment/34207183
has comment: http://stackoverflow.com/comment/34207038
has answer: http://stackoverflow.com/a/22486263
answer count: 1
has comment: http://stackoverflow.com/comment/34207636
tagged with: java-8
has body: Can someone explain to me why this isn't working? public class ListenerTest { public static void addListener(Node node) { node.visibleProperty().addListener(ListenerTest::handleVisibleChanged); } private static void handleVisibleChanged(ObservableValue&lt;? extends Boolean&gt; observable, Boolean oldValue, Boolean newValue) { // Do something } } As you can see, I am using Java 8 method reference to assign a static method as a JavaFX change listener. It compiles just fine, but handleVisibleChanged() method is not invoked when visible property changes. Please don't offer workarounds or ask why am I doing this. Think of it as an exercise. :-)

http://stackoverflow.com/q/22334747
type: Question
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/34102068
tagged with: java
has answer: http://stackoverflow.com/a/22425414
has body: to access Python objects in Java using Jython, it's necessary to create a Java interface and use coersion (PyObject.__java__()) to assign the object to a Java reference. (http://www.jython.org/faq2.html) The problem is that the Python library I'm trying to use does not have gets and sets, and I don't want to change the library code if I can. Is there a way to get those public variables without having to implement Python classes to subclass and expose those attributes through methods? Thanks.
score: 2
tagged with: jython
downvote count: 0
has title: Accessing public attributes of Python class in Java with Jython
type: AnsweredQuestion
tagged with: python
accepted answer: http://stackoverflow.com/a/22425414
favorite count: 0

http://stackoverflow.com/comment/34046780
type: Comment
has text: Yes, `new TextDemo()` is reasonable since it is a class and your server or the main application that runs the server should create and instance of `JFrame`. TextDemo is a variable type since it is a class. I think it would be great if you could look at Java Swing since it seems your `TextDemo` class has a flawed design, though I am unsure of best practices.
score: 0
comment on: http://stackoverflow.com/a/22368118
type: AnswerComment

http://stackoverflow.com/comment/34173306
score: 0
type: AnswerComment
type: Comment
has text: The if (bracket.length==1) {..} prevents that I think
comment on: http://stackoverflow.com/a/22466163

http://stackoverflow.com/comment/34149168
type: QuestionComment
has text: I'm not sure, just try this:(http://stackoverflow.com/a/2181176/3242978)
comment on: http://stackoverflow.com/q/22452654
score: 0
type: Comment

http://stackoverflow.com/comment/34122291
comment on: http://stackoverflow.com/q/22437609
type: Comment
type: QuestionComment
score: 1
has text: Please post the entire text of the error message. Include which version you're using. Don't post images when the information is contained in text. This works fine for me, even if I don't use something reasonable for the group and artifact names as shown.

http://stackoverflow.com/a/22517930
accepted answer of: http://stackoverflow.com/q/22363789
answers question: http://stackoverflow.com/q/22363789
type: AcceptedAnswer
has body: I figured it out! Turns out the reason why my graphs were freezing was because all incoming data was running on 1 thread. Using multiple threads improved the performance of the GUI &amp; prevented the GUI from freezing
type: Answer
score: 0

http://stackoverflow.com/a/22488081
score: 0
answers question: http://stackoverflow.com/q/22487053
type: Answer
has body: When you change drop-down to E(English) the change event happens and you have used onchange event handler which submits the form to the server. The server returns the page back to the client but it doesn't know the value it should set because it's not set. You should either change the event handler to not submit the form at least with the ordinal request or use Ajax to send the data, or create getters and setters for the named field to hold the value of the key in the list. Also you can't use empty keys as values of the list, because it doesn't match the selected key. You can also use a value attribute of the &lt;s:select&gt; tag to pre-select the value from the list.

http://stackoverflow.com/comment/34073632
comment on: http://stackoverflow.com/a/22409969
has text: @Amitesh answer updated to show how to reproduce your error and how to solve it.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22412225
has body: You can create a circular list using an array with modulus division. getElementAt(double[] arr, int index) { index = index % arr.length; index = index + arr.length; // If index is negative, modulus division gives us negative result, so this makes it positive. index = index % arr.length; // In case the previous step made index &gt;= n return arr[index] } If n is arr.length then 0 &lt;= index &lt; n will be like normal. n &lt;= index will wrap around the list (e.g. arr[n] == arr[0], arr[n+1] == arr[1], etc.) index &lt; 0 will wrap around the list in the other direction (e.g. arr[-1] == arr[n-1], arr[-2] == arr[n-2], etc.)
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34078157
type: Answer
answers question: http://stackoverflow.com/q/22411553
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22411553

http://stackoverflow.com/q/22417836
has comment: http://stackoverflow.com/comment/34157817
has answer: http://stackoverflow.com/a/22460757
upvote count: 1
has comment: http://stackoverflow.com/comment/34156961
has body: I am encounting bug which is supposed to be fixed: isMember on @ElementCollection throws QuerySyntaxException: unexpected end of subtree I googled about this issue and found ticket HHH-5799 and HHH-5209 where its claimed to be resolved in Hibernate 4.1.8, 4.3.0.Beta1. I am trying to query for ProductType by one of its barcodes. My entity looks like this: @Entity @XmlRootElement public class ProductType implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long id; @NotNull @ElementCollection private List<String> barcodes = new LinkedList<String>(); ... getters+setters } I am using criteria api to query for product type by barcode using this code: CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<ProductType> c = cb.createQuery(ProductType.class); Root<ProductType> f = c.from(ProductType.class); c.select(f).where(cb.isMember(barcode, f.get(ProductType_.barcodes))); TypedQuery<ProductType> query = em.createQuery(c); return query.getSingleResult(); I made a simple test: @Test public void testProductTypeWithMultipleBarcodes() { ProductType type = new ProductType(); List<String> barcodes = new LinkedList<String>(); barcodes.add("1234561"); barcodes.add("1234562"); barcodes.add("1234563"); type.setBarcodes(barcodes); em.persist(type); em.flush(); assertEquals(type, productRepository.findProductTypeByBarcode("1234561")); assertEquals(type, productRepository.findProductTypeByBarcode("1234562")); assertEquals(type, productRepository.findProductTypeByBarcode("1234563")); } But I am getting org.hibernate.hql.internal.ast.QuerySyntaxException: Caused by: org.jboss.arquillian.test.spi.ArquillianProxyException: org.hibernate.hql.internal.ast.QuerySyntaxException : unexpected end of subtree [select generatedAlias0 from cz.nuc.skladnik.storagecycle.product.ProductType as generatedAlias0 where :param0 member of generatedAlias0.barcodes] [Proxied because : Original exception not deserilizable, ClassNotFoundException] at org.h…
favorite count: 0
has answer: http://stackoverflow.com/a/22458739
has comment: http://stackoverflow.com/comment/34157089
type: UnansweredQuestion
tagged with: maven
linked to: http://stackoverflow.com/q/2852613
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/34156623
has comment: http://stackoverflow.com/comment/34156510
answer count: 2
tagged with: jpa
tagged with: jboss
has title: Maven: wrong Hibernate version?

http://stackoverflow.com/a/22415260
has comment: http://stackoverflow.com/comment/49853454
has comment: http://stackoverflow.com/comment/47815472
answers question: http://stackoverflow.com/q/22360737
type: AcceptedAnswer
upvote count: 6
type: Answer
has comment: http://stackoverflow.com/comment/37225732
has comment: http://stackoverflow.com/comment/61968928
has comment: http://stackoverflow.com/comment/47217602
has comment: http://stackoverflow.com/comment/37232764
downvote count: 0
has comment: http://stackoverflow.com/comment/47238137
score: 6
has body: This is not directly possible as local jars are not declared as transitive dependencies in Gradle. You have two options: merge the two jars in your java library so that the output contains the local jar. create a different project with no source, only the jar, and make the project depend on it. The second option gives you the ability to have more than one project depend directly on the local jar (on top of it becoming a transitive dependency). To do it, create a new gradle project and just put in its build.gradle the following: configurations.create("default") artifacts.add("default", file('somelib.jar')) This simply register your jar as the default artifact published by the project and this will get consumed by the other projects.
accepted answer of: http://stackoverflow.com/q/22360737

http://stackoverflow.com/comment/34180526
comment on: http://stackoverflow.com/q/22470459
has text: If you can't be bothered to post an actual sample of these lines, we can't be bothered to try and interpret what you want.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/34060353
score: 0
comment on: http://stackoverflow.com/q/22402552
has text: *"while I'm trying to figure out a solution I read that saving images in an Array is memory intensive"* It depends on the resolution, bit depth and number. But the typical JRE can hold hundreds of (for example) 640x480 images with full color and transparency.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22419350
score: 0
has comment: http://stackoverflow.com/comment/34097761
answer count: 1
tagged with: jlabel
tagged with: maze
has title: How to update Maze grid of labels to show path taken by Solver (highlight the path taken)
has body: Me and a partner were assigned a project where we had to create a GUI that implements a grid of JLabels that can be clicked to create the walls of a maze, and implement a solver class to solve said maze via the click of a solve button. We have the solver and GUI working together, but what we've been having trouble with has been trying to update the GUI after it has been solved. We know its solving the maze correctly because we have it printing an array of the solution but can't for the life of us figure out how to update the GUI to highlight the path of the solver the solve button is clicked. Is there any way to do that? Solver class: package lab8; import java.util.ArrayList; public class Solver implements MazeSolver { private static ArrayList&lt;Coordinate&gt; coordinates = new ArrayList&lt;Coordinate&gt;(); public Solver() { } @Override public String[][] solve(String[][] map) { String[][] str = new String[map.length][map[0].length]; boolean done = false; for (int row = 0; row &lt; map.length; row++) { for (int col = 0; col &lt; map[0].length; col++) { str[row][col] = map[row][col]; } } Coordinate c1 = findStart(str); Coordinate c2 = findFinish(str); int x = 0; while (done == false) { if ((c1.getRow() + 1 == c2.getRow()) &amp;&amp; c1.getCol() == c2.getCol()) { str[c2.getRow()][c2.getCol()] = "RIP"; break; } if (isClear(str, c1.getRow() + 1, c1.getCol())) { str[c1.getRow() + 1][c1.getCol()] = "X"; c1 = new Coordinate(c1.getRow() + 1, c1.getCol()); coordinates.add(c1); } else if (isClear(str, c1.getRow(), c1.getCol() + 1)) { str[c1.getRow()][c1.getCol() + 1] = "X"; c1 = new Coordinate(c1.getRow(), c1.getCol() + 1); coordinates.add(c1); } else if (isClear(str, c1.getRow(), c1.getCol() - 1)) { str[c1.getRow()][c1.getCol() - 1] = "X"; c1 = new Coordinate(c1.getRow(), c1.getCol() - 1); coordinates.add(c1); } else if (isClear(str, c1.getRow() - 1, c1.getCol())) { str[c1.getRow() - 1][c1.getCol()] = "X"; c1 = new Coordinate(c1.getRow() - 1, c1.getCol()); coordinates.add(c…
has answer: http://stackoverflow.com/a/22424278
tagged with: mouselistener
type: UnansweredQuestion
tagged with: swing
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34091351
has comment: http://stackoverflow.com/comment/34091498

http://stackoverflow.com/comment/33949128
type: Comment
comment on: http://stackoverflow.com/a/22338167
has text: is chosenFile a String datatype?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34142098
comment on: http://stackoverflow.com/a/22448373
type: AnswerComment
score: 0
has text: @EddieGbo Is that regarding the first comment? It's just wise to protect yourself from popping `null`.
type: Comment

http://stackoverflow.com/q/22437657
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34122294
downvote count: 1
type: Question
has body: I'm new to programming and find arrays to be quite confusing.This is what I have so far. I am hoping someone can help explain to me why I cant set maxArea to squareArray[0] and how I should go about doing so. I need to be able to return the maxArea of the squareArray as a double using a for-loop while calling the calculateArea method for each square object. public class Square{ private double sideLength; public Square (double lengthOfSides){ sideLength = lengthOfSides; } public double calculateArea (){ double Area; Area = sideLength * sideLength; return Area; } public static double findMaximumArea(Square[] squareArray){ double maxArea; squareArray[0] = maxArea; for(int i = 0; i &lt; squareArray.length; i++){ if(squareArray[i] &gt; maxArea){ maxArea = squareArray[i]; } return maxArea; } } } And the main public class SquareArrayTest { public static void main(String[] args) { Square testSquare = new Square(15); if (testSquare.calculateArea() == 225) { System.out.println(testSquare.calculateArea()); System.out.println("Your Square class is correct!"); } Square square1 = new Square(23.5); Square square2 = new Square(33.3); Square square3 = new Square(14.9); Square square4 = new Square(11.7); Square[] squareArray = new Square[4]; squareArray[0] = square1; squareArray[1] = square2; squareArray[2] = square3; squareArray[3] = square4; } }
tagged with: arrays
has title: How do you use a regular for-loop to determine the maximum calculated area of the square array in this situation?
score: -1
has answer: http://stackoverflow.com/a/22437818

http://stackoverflow.com/q/22451349
answer count: 2
has title: JAVA regular expression with space
has answer: http://stackoverflow.com/a/22453944
has body: I have a problem with the following expression: String REGEX_Miasto_Dwu_Czlonowe="\D+\s\D+"; Pattern pat_Miasto = Pattern.compile(REGEX_Miasto_Dwu_Czlonowe); Matcher mat_Miasto_Dwu_Czlonowe = pat_Miasto.matcher(adres); Because the above pattern matches "80-227 GDAŃSK DOSTUDZIENKI 666"; "83000 PRUSZCZ GDANSKI UL. TYSIACLECIA 666"; But it only should match this expression : "PRUSZCZ GDANSKI UL. TYSIACLECIA 666"; THX for help.
type: UnansweredQuestion
tagged with: regex
has comment: http://stackoverflow.com/comment/34147023
has answer: http://stackoverflow.com/a/22451637
tagged with: java
has comment: http://stackoverflow.com/comment/34147159
type: Question
score: 0

http://stackoverflow.com/a/22420316
has comment: http://stackoverflow.com/comment/34101543
type: Answer
has comment: http://stackoverflow.com/comment/34092213
score: 3
has body: Make this: String s = JOptionPane.showInputDialog("Enter your email address"); System.out.println(s.matches(".*@.*\\..*") ? "Address Appears Valid" : "Address is Invalid" ); Into this: System.out.println(JOptionPane.showInputDialog("Enter your email address").matches(".*@.*\\..*") ? "Address Appears Valid" : "Address is Invalid" ); After all, why store the value if you are just going to use it in the next line?
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22420304
has comment: http://stackoverflow.com/comment/34092456
answers question: http://stackoverflow.com/q/22420304
has comment: http://stackoverflow.com/comment/34092405
has comment: http://stackoverflow.com/comment/34092191
upvote count: 3
has comment: http://stackoverflow.com/comment/34092387
has comment: http://stackoverflow.com/comment/34092606
type: AcceptedAnswer

http://stackoverflow.com/comment/38256250
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22415022
score: 0
has text: check this http://stackoverflow.com/questions/10828562/java-sql-sqlexception-org-apache-thrift-transport-ttransportexception-in-hive/10845065#10845065

http://stackoverflow.com/comment/34179322
has text: I am able to make it visible and invisible when checkbox is selected. But I am facing new problem now. When checkbox is selected multiple selection list is getting added to gui. But the other component which was there earlier is now not visible. I guess it is because of size. When I uncheck the checkbox my multilpe list goes off and the other widget is visible.
type: AnswerComment
comment on: http://stackoverflow.com/a/22449470
score: 0
type: Comment

http://stackoverflow.com/comment/34181893
comment on: http://stackoverflow.com/q/22471323
score: 0
has text: It's strange because it compiles without an error, it just stops before accepting the users decision to buy or sell, but prints "Enter Option:"
type: Comment
type: QuestionComment

garbage-collection
tags question: http://stackoverflow.com/q/22457002
tags question: http://stackoverflow.com/q/22429556
tags question: http://stackoverflow.com/q/22477007
tags question: http://stackoverflow.com/q/22344264
tags question: http://stackoverflow.com/q/22358257
tags question: http://stackoverflow.com/q/22342793
tags question: http://stackoverflow.com/q/22397780
tag name: garbage-collection
tags question: http://stackoverflow.com/q/22350002
tags question: http://stackoverflow.com/q/22373394
type: Tag
tags question: http://stackoverflow.com/q/22416154
tags question: http://stackoverflow.com/q/22403923
tags question: http://stackoverflow.com/q/22408517
tags question: http://stackoverflow.com/q/22351864
tags question: http://stackoverflow.com/q/22379588

http://stackoverflow.com/comment/34183754
type: AnswerComment
score: 0
type: Comment
has text: I really appreciate your help dear, but honestly it's working unreliable(randomly) here. is it possible that it's a HW thing? because I know I have million of problems in my OS here.
comment on: http://stackoverflow.com/a/22467616

http://stackoverflow.com/comment/34091469
has text: The variable you are using in joker4 method in if statement is the global variable and you haven't initialized that variable
comment on: http://stackoverflow.com/a/22409454
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22398226
tagged with: java
has title: having issues with a quicksort method
has answer: http://stackoverflow.com/a/22401119
type: Question
upvote count: 1
has body: So i am doing a challenge located at https://www.hackerrank.com/challenges/quicksort2 and im having trouble wrapping my head around doing this the way they want. They are asking for the program to do a quicksort using subArrays and then put those sub arrays together at the end to come up with the result. Here is the challenge and i will have my code below. needless to say i don't have it working. All the code was provided and the challenge is to write the partition method Print Sub-Arrays In this challenge, print your array every time your partitioning method finished, i.e. print every sorted sub-array The first element in a sub-array should be used as a pivot. Partition the left side before partitioning the right side. The pivot should not be added to either side. Instead, put it back in the middle when combining the sub-arrays together. Input Format There will be two lines of input: n - the size of the array ar - the n numbers of the array Output Format Print every partitioned sub-array on a new line. Constraints 1&lt;=n&lt;=1000 -1000&lt;=x&lt;= 1000 , x ∈ ar There are no duplicate numbers. Sample Input 7 5 8 1 3 7 9 2 Sample Output 2 3 1 2 3 7 8 9 1 2 3 5 7 8 9 Code import java.util.*; public class Solution { static int[] result; static void partition(int[] ar) { int p = 0; int s = 0; int l = 0; int small[] = new int[ar.length]; int pivot[] = new int[ar.length]; int large[] = new int[ar.length]; for(int i = 0; i &lt; ar.length; i++){ if(i == 0 || ar[i]==pivot[0]){ pivot[p] = ar[i]; p++; } else if(ar[i]&gt;pivot[0]){ large[l] = ar[i]; l++; } else if(ar[i]&lt;pivot[0]){ small[s] = ar[i]; s++; } } if(s&gt;2){ int[] smallA = new int[s]; for(int i = 0; i &lt; s; i ++){ smallA[i] = small[i]; } partition(smallA); } if(l&gt;2){ int[] largeA = new int[l]; for(int i = 0; i &lt; l; i ++){ largeA[i] = large[i]; } partition(largeA); } } static void printArray(int[] ar) { for(int n: ar){ System.out.print(n+" "); } System.out.println(""); } public static void main(String[] arg…
answer count: 1
tagged with: arrays
tagged with: quicksort
favorite count: 0
downvote count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/34004149
type: Comment
comment on: http://stackoverflow.com/a/22368603
has text: So let's say I set JPanel current equal to the current panel, then how would that keep the buttons intact? Or is it that you're saying that I should make the buttons reference the currentpage?
score: 0
type: AnswerComment

http://stackoverflow.com/q/22341470
has comment: http://stackoverflow.com/comment/33967544
downvote count: 0
has comment: http://stackoverflow.com/comment/33967726
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33955453
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33954939
tagged with: android
tagged with: windows
has comment: http://stackoverflow.com/comment/33956898
has comment: http://stackoverflow.com/comment/33954951
has comment: http://stackoverflow.com/comment/33959752
has comment: http://stackoverflow.com/comment/33955291
answer count: 0
has body: I am working on Android Project. I want to write output inside my local repository.So, i am using File Class.i am using Windows.This is my code: String fileName = "C:\\LocationAPI"; File f1 = new File(fileName); if(f1.isDirectory()){ Log.d("write","Is a Directory") } else{ Log.d("write","Not a Directory"); } Result is : Not a Directory. LocationAPI directory exists inside C drive. Can somebody tell me the mistake i did?
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33956527
has comment: http://stackoverflow.com/comment/33955323
has title: Not able to find directory using File Class in Windows
has comment: http://stackoverflow.com/comment/33956443
has comment: http://stackoverflow.com/comment/33959105

http://stackoverflow.com/comment/34127002
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22440029
type: Comment
has text: I have to admit I'm not certain either... ;-)

http://stackoverflow.com/comment/34134473
type: AnswerComment
has text: you don't need 'continue'. @^^
comment on: http://stackoverflow.com/a/22443872
type: Comment
score: 0

http://stackoverflow.com/q/22474276
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34287189
tagged with: selenium
has comment: http://stackoverflow.com/comment/34287335
has comment: http://stackoverflow.com/comment/34187249
type: Question
has comment: http://stackoverflow.com/comment/34287297
has comment: http://stackoverflow.com/comment/34234178
has body: I want my test cases to execute priority wise, but all the test cases which depends on 'Method1' are executing first, so my other testcases are failing. @Test(dependsOnMethods = {"verifyLogin"}, priority = 0, description = "verify a page access") public void Method1() @Test(dependsOnMethods = {"Method1"}, priority = 1, description = "verify b page access") public void Method2() @Test(dependsOnMethods = {"Method1"}, priority = 2, description = "verify c page access") public void Method3() @Test(dependsOnMethods = {"Method3"}, priority = 3, description = "verify d page access") public void Method4() @Test(dependsOnMethods = {"Method1"}, priority = 4, description = "verify e page access") public void Method5() So the methods 1,2,3 and 5 are executing first, but I want method 4 to execute before 5 as it depends on method 3. Thanks.
has comment: http://stackoverflow.com/comment/34412034
has answer: http://stackoverflow.com/a/22653624
accepted answer: http://stackoverflow.com/a/22653624
upvote count: 1
answer count: 1
has title: Priorities in TestNG
favorite count: 0
has comment: http://stackoverflow.com/comment/34228037
has comment: http://stackoverflow.com/comment/34186646
has comment: http://stackoverflow.com/comment/34234131
has comment: http://stackoverflow.com/comment/34227937
tagged with: testng

http://stackoverflow.com/comment/34137812
comment on: http://stackoverflow.com/q/22445688
has text: You may wish to look into simple [maze theory](http://en.wikipedia.org/wiki/Maze_solving_algorithm) for ways to solve this problem. The simplest way to solve it is definitely a wall-follower, but you can try one of the more complex methods if you are feeling ambitions.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22377832
type: Answer
has body: Try this live, jsFiddle JS var htmlString = document.getElementsByTagName('html')[0].innerHTML; console.log(htmlString); HTML Hello Hi div
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22377564
score: 4

http://stackoverflow.com/comment/34299970
comment on: http://stackoverflow.com/q/22452137
score: 0
type: Comment
type: QuestionComment
has text: can't you just have different user-facing urls per task? it should be straightforward then to split traffic by task type urls. you would have a front end load balancer or server to split the processing then, before the request is actually sent to JBoss servers.

http://stackoverflow.com/q/22461158
has title: "Give a rough estimate of the overhead incurred by each system call." - what?
score: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/2860234
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34165783
downvote count: 1
tagged with: java
has body: For a Uni assignment, I've written a Java program that System.out.writes chunk by chunk of text files to the console. We're doing some resource cost tests in Linux with the time command to see the execution time with different chunk sizes (chunk size is one of the arguments of the program). We're asked to: Write documentation where you explain the results of your time measurements. Can you give a rough estimate of the overhead incurred by each system call? I am confused by the last sentence. What exactly am I being asked to do? What is overhead? What does it mean when overhead has "incurred"? How do I estimate amount of incurred overheads? (Question 3) I may be able to answer myself if 1) and 2) is answered.)
type: Question
tagged with: resources
has comment: http://stackoverflow.com/comment/34164724
tagged with: overhead
linked to: http://stackoverflow.com/q/2860234

http://stackoverflow.com/q/22382818
has title: Library for fuzzy testing for Java
has comment: http://stackoverflow.com/comment/109712938
type: Question
tagged with: testing
has comment: http://stackoverflow.com/comment/109730107
has comment: http://stackoverflow.com/comment/109674717
linked to: http://stackoverflow.com/q/32458
linked to: http://stackoverflow.com/q/1099124
answer count: 2
has answer: http://stackoverflow.com/a/22383825
has comment: http://stackoverflow.com/comment/34026343
has comment: http://stackoverflow.com/comment/34026596
downvote count: 0
has comment: http://stackoverflow.com/comment/109733806
tagged with: fuzzing
favorite count: 0
has comment: http://stackoverflow.com/comment/34312621
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/58286002
score: 11
has comment: http://stackoverflow.com/comment/34026444
upvote count: 11
has comment: http://stackoverflow.com/comment/88721620
has body: Is there a flexible framework for fuzzy testing in Java? The Wikipedia article on Fuzz testing defines fuzz testing as follows: Fuzz testing or fuzzing is a software testing technique, often automated or semi-automated, that involves providing invalid, unexpected, or random data to the inputs of a computer program. The program is then monitored for exceptions such as crashes, or failing built-in code assertions or for finding potential memory leaks. Fuzzing is commonly used to test for security problems in software or computer systems. I know there is such a framework for Erlang. Any hints are welcome.
tagged with: java

http://stackoverflow.com/comment/34020314
comment on: http://stackoverflow.com/q/22379588
type: QuestionComment
has text: I really just wanted someone to comment on general Finalizer behavior, not necessarily to reproduce the issue. Maybe someone has seen a similar issue with their classes (or in my case, third-party classes) that override finalize().
score: 0
type: Comment

http://stackoverflow.com/comment/38454177
comment on: http://stackoverflow.com/q/22448511
has text: I am just wondering why do you need "@Embeddable", you already mapped it inside the "MultilingualString", one thing I might change is the "@JoinColumn" to map incremental ids instead of strings
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22342648
has comment: http://stackoverflow.com/comment/33957084
has title: Is it possible to get the raw bits in memory of a double?
has body: I was just trying to convert the following methods that I wrote in C/C++ to Java. In short, the code provides a very efficient way of calculating the indices of the left-most and right-most bits of a number that are set to one. The two methods are based off of code in Knuth's Art of Computer programming, volume 4. // Returns index of the left-most bit of x that is one in the binary // expansion of x. Assumes x &gt; 0 since otherwise lambda(x) is undefined. // Can be used to calculate floor(log(x, 2)), the number of binary digits // of x, minus one. int lambda(unsigned long x) { double y = (double) x; // Excuse the monstrocity below. I need to have a long that has the raw // bits of x in data. Simply (long)y would yield x back since C would cast // the double to a long. So we need to cast it to a (void *) so that C // "forgets" what kind of data we are dealing with, and then cast it to // long. unsigned long xx = *((long *)((void*)&amp;y)); // The first 52 bits are the the significant. The rest are the sign and // exponent. Since the number is assumed to be positive, we don't have to // worry about the sign bit being 1 and can simply extract the exponent by // shifting right 52 bits. The exponent is in "excess-1023" format so we // must subtract 1023 after. return (int)(xx &gt;&gt; 52) - 1023; } // Returns the index of the right-most one bit in the binary expansion of x int rho(unsigned long x) { return lambda(x &amp; -x); } As you can see, I need to have a long that has the same bits of a double, but without a void* cast, I am not sure how to do this in Java. Any thoughts? Is it even possible?
has answer: http://stackoverflow.com/a/22342708
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22342708
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/a/22374395
accepted answer of: http://stackoverflow.com/q/22373766
score: 0
type: AcceptedAnswer
type: Answer
has body: You could use a selection sort to find the different percentiles. In your problem you know you need to find the 90k, 180k, and 270k positioned elements in a sorted list. Once all the 360k elements are fetched, choose a random element and split the elements to sublists based on those smaller, equal, and bigger than the element you chose. After that step, you will be able to see at what position the element you chose was in. Then, you can either choose to do the same with the smaller or bigger sublist, depending on what percentile you are looking for. In the best case, this could be solved in O(n), as you could choose the right percentiles on the first go, but this is very unlikely. In the worst case, you could choose always the smallest element, and therefore do passes o(n) times making it o(n^2), but thats very unlikely too. Luckily, the expected running time turns out to be T(n) &lt;= 8n, which is linear running time. As a tip, you could gather the min/max numbers during the streaming of the data, and then you can estimate by choosing the first element to choose as (max+min)/2. This will of course be an assumption that the numbers are somehow similar to a normal distribution, and not totally off. If you need more details on the algorithm, have a look here: http://cseweb.ucsd.edu/~dasgupta/103/4a.pdf
answers question: http://stackoverflow.com/q/22373766

http://stackoverflow.com/comment/34214647
type: AnswerComment
has text: @EvgenyKluev: But if we grow A to the right, we cannot build B from least-significant to most-significant. We need to grow A and C from right to left, at least that's how I thought it would work best. But I think you're right, in that case we just need a suffix tree of the reverse of S, then the augmentation works
type: Comment
comment on: http://stackoverflow.com/a/22464639
score: 0

http://stackoverflow.com/comment/34178773
type: QuestionComment
comment on: http://stackoverflow.com/q/22469157
has text: Remember that if you're clicking rapidly, and going through the standard APIs, the system may interpret the second click as doubleclick rather than click.
type: Comment
score: 0

http://stackoverflow.com/q/22431392
has body: What can it be the reason to get NullPointerException sometimes with below code piece. BufferedReader reader = new BufferedReader(new InputStreamReader (getClass().getClassLoader().getResourceAsStream(this.getClientHost()+".txt"))); The strange part that it sometimes works without exception but sometimes give this exception. My code i trying to read that file many times. Generally it reads in first time successful and in the second attempt it gives this exception. Here is all code: public class DictionaryImp extends RemoteServer implements Dictionary { static FileOutputStream log; public DictionaryImp(){ super(); } public String statictics() { // TODO Auto-generated method stub try { setLog("Statistic", this.getClientHost()); } catch (ServerNotActiveException e1) { // TODO Auto-generated catch block System.err.println("server is not active!!"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //some statistic return msg; } public String log() throws RemoteException { try { setLog("Log", this.getClientHost()); } catch (ServerNotActiveException e1) { // TODO Auto-generated catch block System.err.println("Client is not active!!"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } String msg = ""; try { BufferedReader reader = new BufferedReader(new InputStreamReader (getClass().getClassLoader().getResourceAsStream(this.getClientHost()+".txt"))); String line = null; while((line = reader.readLine()) != null){ msg += line + "\n"; } reader.close(); } catch (ServerNotActiveException | IOException e) { // TODO Auto-generated catch block System.err.println("Client is not active"); } return msg; } private static void createLogFile(String logFileName){ File logFile = null; logFile = new File(logFileName); if(!logFile.exists()) try { logFile.createNewFile(); } catch (IOException e1) { // TODO Auto-generated catch block System.err.println("Log file couldn't created!!"); } try { log = new FileOutputStream(logFile…
linked to: http://stackoverflow.com/q/6608795
tagged with: inputstream
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/22425501
has answer: http://stackoverflow.com/a/22431409
has answer: http://stackoverflow.com/a/22431403
has comment: http://stackoverflow.com/comment/34112162
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/34111519
has comment: http://stackoverflow.com/comment/34111517
has comment: http://stackoverflow.com/comment/34111563
favorite count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has title: InputStreamReader NullPointerException
tagged with: java
has comment: http://stackoverflow.com/comment/34112069

http://stackoverflow.com/q/22455146
upvote count: 1
answer count: 1
favorite count: 0
tagged with: nhibernate-criteria
type: AnsweredQuestion
downvote count: 0
has body: I have this query that I would like to translate in Criteria Hibernate: UPDATE Patient SET HourOut = ? WHERE IDQueue = ? AND TicketNumber = ? AND DATE_FORMAT(DATE(LastVisitDate), '%Y-%m-%d') = ?; I understand the way to update an object when it's id is known but I can't figure out how to do it with the kind of where i have here.
score: 1
tagged with: java
tagged with: hibernate
has title: how to update an object in Hibernate Criteria without knowing it's id
type: Question
accepted answer: http://stackoverflow.com/a/22455279
tagged with: criteria
has answer: http://stackoverflow.com/a/22455279

http://stackoverflow.com/comment/34110302
score: 0
type: AnswerComment
type: Comment
has text: I would say that such code should be inside the loop... it looks like each line would be a person record.
comment on: http://stackoverflow.com/a/22430714

http://stackoverflow.com/comment/34033287
score: 0
comment on: http://stackoverflow.com/q/22386571
type: Comment
type: QuestionComment
has text: It was printing null in the database. Anyway, i figured it out. I changed the button the was used to submit the data to the adduser.jsp file into a submit form. Silly me. :D

http://stackoverflow.com/a/22392270
has comment: http://stackoverflow.com/comment/34044203
has body: There are many ways to do this, but one simple way that may help you to understand this process is as follows: Implement a store method that simply writes all data to a file in a format of your choice. XML is common, as is TSV or CSV. Some of those are very easy to use, as predefined classes exist to handle them partially or completely. You will have to read the data you want to store from whereever you have it in your application, possibly in the text boxes directly. Accordingly implement a restore method that reads the file and fills it back into your data structure and/or the text boxes.
has comment: http://stackoverflow.com/comment/34047779
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22391438

http://stackoverflow.com/a/22392479
type: Answer
has comment: http://stackoverflow.com/comment/34043627
has body: You're using the raw Sample type, and the compiler thus assumes that you don't care about generic types, even for variables not declared as raw types inside this object. It's a strange rule, but it's how it is. You shouldn't use raw types if you care about generics. As soon as you use a raw type, all its members are also taken as raw types by the compiler.
upvote count: 3
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22392379

http://stackoverflow.com/q/22373348
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22373393
has comment: http://stackoverflow.com/comment/34010063
tagged with: presentation
answer count: 4
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22373615
tagged with: sorting
has answer: http://stackoverflow.com/a/22373558
favorite count: 0
has answer: http://stackoverflow.com/a/22373740
type: Question
has comment: http://stackoverflow.com/comment/34009892
has comment: http://stackoverflow.com/comment/34009870
accepted answer: http://stackoverflow.com/a/22373558
downvote count: 1
possible better answer: http://stackoverflow.com/a/22373393
has body: I am trying to create a bubble sort program for a small presentation that I am doing. The code runs fine but the largest integer in my array is never displayed. Output for the program as it stands is: 1 3 4 6 7 11 The 12 is missing! Here is my code, excuse the comments - some of them might even be wrong. public class BubbleSort { public static void main(String[] args) { int number []={6,3,1,7,4,12,11}; // 0,1,2,3,4 //For temporarily storing a value that has to be swapped int temp; //Keeps the loop running until there is nothing left to sort. boolean fixed=false; while (fixed==false) { fixed=true; //If this IF statement is accessed it means something still has to be //swapped, so at the end of the statement fixed is reverted to false //again, so it can continue the loop. for(int i=0; i&lt;number.length-1 ; i++){ //This makes i start at 0 the first time it is run, //this is due to the array starting at 0, too. if(number[i] &gt; number[i+1]) { //If 8 &gt; 5 temp = number[i+1]; //Store 5 in temporary variable number[i+1]=number[i]; //Swap array 1 with array 0/ number[i]=temp; fixed=false; } } } for(int i=0; i&lt;number.length-1 ; i++){ System.out.println(number[i]); } } }
tagged with: algorithm
has title: Bubble Sort in Java - largest integer not showing up in final sort

http://stackoverflow.com/a/25465105
type: Answer
answers question: http://stackoverflow.com/q/22413068
upvote count: 4
downvote count: 0
has body: Probably, the WebLogic Server Monitor was locking the weblogic.jar, so you couldn't upgrade the server. I had the same issue and solved it by switching to a new workspace. There, I could add the server again and upgrade it, without being disturbed by the WebLogic Server Monitor.
score: 4

http://stackoverflow.com/comment/34121349
comment on: http://stackoverflow.com/a/22437116
type: AnswerComment
has text: You have already done what? And you are confused about what? What is your question?
score: 0
type: Comment

http://stackoverflow.com/comment/33939882
type: AnswerComment
comment on: http://stackoverflow.com/a/22332813
has text: @user3367892 If my answer solves your problem, I'd be happy if you mark it as "accepted answer" and/or vote it up :-)
score: 0
type: Comment

http://stackoverflow.com/comment/34192477
score: 5
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22477842
has text: You are way off the mark... there are no quotes involved at all in this. The string is represented in bytecode just as a simple reference. The string's characters are in a separate structure, the constant pool.

http://stackoverflow.com/comment/34069220
comment on: http://stackoverflow.com/q/22407539
has text: However, you can still declare fields in your `NUMBER` `enum` and initialize it when declaring your constants.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22478223
has answer: http://stackoverflow.com/a/22478267
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/22478267
type: AnsweredQuestion
tagged with: android-webview
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34193079
has title: Why I am getting an error when I use webview in android?
has answer: http://stackoverflow.com/a/22478291
accepted answer: http://stackoverflow.com/a/22478291
type: Question
has answer: http://stackoverflow.com/a/22478344
has comment: http://stackoverflow.com/comment/34193112
has body: I am new to android and have written the code for web view to display the url given onto that. The error is as below Why I am getting this error I have used the correct logic in my problems and i haven't got any errors So kindly please let me know how to rectify it ? Th code used is : package com.coded.sandeep; import android.annotation.SuppressLint; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.webkit.WebSettings; import android.webkit.WebView; public class MainActivity extends Activity { @SuppressLint("SetJavaScriptEnabled") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView webView = (WebView) findViewById(R.id.webview); WebSettings settings = webView.getSettings(); settings.setJavaScriptEnabled(true); webView.loadUrl("http://www.google.com"); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; }} can anyone debug or it is an internet connection error ?
answer count: 3
upvote count: 1

http://stackoverflow.com/comment/33957330
type: AnswerComment
comment on: http://stackoverflow.com/a/22342816
type: Comment
score: 0
has text: I have made the changes in my question, apparently i have added wrong string, but still the issue is same.

http://stackoverflow.com/q/22451482
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: jaxb
has body: I have an xml file already containing, **&lt; ?xml version="1.0" encoding="UTF-8" standalone="yes"?> &lt; customer id="100"> &lt; age>22&lt; /age> &lt; name>naveen&lt; /name> &lt; /customer>** for which my POJO class is public class Customer { String name; int age; int id; public String getName() { return name; } public int getAge() { return age; } public int getId() { return id; } } I am trying to unmarshall this by using JAXB as, File file = new File("sample.txt"); JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Customer customer = (Customer) jaxbUnmarshaller.unmarshal(file); System.out.println(customer); But I am getting an exception as unexpected element (uri:"", local:"customer"). Expected elements are (none) Please help me out.
type: Question
possible better answer: http://stackoverflow.com/a/22451766
has answer: http://stackoverflow.com/a/22451766
answer count: 2
tagged with: unmarshalling
has answer: http://stackoverflow.com/a/22451706
accepted answer: http://stackoverflow.com/a/22451706
upvote count: 1
has title: Error while unmarshalling in java
favorite count: 0

http://stackoverflow.com/comment/34117823
comment on: http://stackoverflow.com/q/22435081
type: Comment
type: QuestionComment
score: 1
has text: Please provide the entire code, as this small snippet will cause a NPE :-)

http://stackoverflow.com/comment/34459680
has text: @jason True, however you only need one long running Socket.close() or similar to lock up the finalizer thread. I would check you are taking the stack trace at the right time. BTW Are you using a recent version of Java? If it is a bug in the JVM, it may have been fixed.
comment on: http://stackoverflow.com/a/22379964
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22447824
type: UnansweredQuestion
tagged with: swing
has body: I have a java swing project I have been working on that involves parsing text data and then displaying graphical representations through local image files. I want the user to be able to copy the images displayed so that they can be pasted into other programs (such as Microsoft Word). It doesn't even need to happen like that, just any way I can make .jpg files copied so the user can paste them elsewhere. There would be a long chain of images, so just copying and pasting one at a time is not a possibility. Please help!
has title: Allow User to Copy Images in Java Swing Application?
has answer: http://stackoverflow.com/a/22447968
tagged with: java
tagged with: image
type: Question
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/34141240
has comment: http://stackoverflow.com/comment/34141216

http://stackoverflow.com/comment/33946098
type: QuestionComment
has text: You're welcome :) ... Eclipse does appear to have this tendency sometimes...
comment on: http://stackoverflow.com/q/22336041
score: 0
type: Comment

http://stackoverflow.com/q/22430678
downvote count: 1
has comment: http://stackoverflow.com/comment/34110256
type: Question
has comment: http://stackoverflow.com/comment/34110618
has comment: http://stackoverflow.com/comment/34110243
tagged with: arrays
has comment: http://stackoverflow.com/comment/34110484
has comment: http://stackoverflow.com/comment/34110318
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22430714
has answer: http://stackoverflow.com/a/22431365
has answer: http://stackoverflow.com/a/22430714
favorite count: 0
has comment: http://stackoverflow.com/comment/34110577
accepted answer: http://stackoverflow.com/a/22431365
has title: Why am I getting an Array Index Out Of Bounds Exception error when parsing lines?
has comment: http://stackoverflow.com/comment/34110253
has comment: http://stackoverflow.com/comment/34111473
has body: In netbeans I got an Array Index Out Of Bounds Exception error in my code at line 35 in the MyProj03 class from line 55 in the Person class. I am not sure why I am getting this error. My code: import java.util.Scanner; import java.io.*; import birch.Person.*; public class MyProj03 { public static void main(String[] args) throws IOException { // check for file existence File file = new File("p3text.txt"); if (file.exists()) { // read each record into a String StringBuilder fileContents = new StringBuilder((int)file.length()); Scanner scanner = new Scanner("p3text.txt"); String lineSeparator = System.getProperty("line.separator"); try { while(scanner.hasNextLine()) { fileContents.append(scanner.nextLine() + lineSeparator); Person one = new Person(); one.parseCommaDelim(fileContents.toString()); } } finally { scanner.close(); } } else if (!file.exists()) { System.out.println("The file p3text.txt is not found."); System.exit(2); } } } more code: public class Person { //make instance fields for name, city, age, and SiblingCount public String name; public int age; public String city; public int sibCount; public Person() { name = ""; age = 0; city = ""; sibCount = 0; } // public access methods (getters) public String getPerson() { return this.name; } public int getAge() { return this.age; } public String getCity() { return this.city; } public int getSibCount() { return this.sibCount; } // make a toString method public String toString() { String str = "person: " + name + "age: " + age + "city: " + city; return str; } // make a method called parseCommaDelim public Person parseCommaDelim(String s) { String[] tokens = s.split(","); Person instance = new Person(); instance.name = tokens[0]; instance.age = Integer.parseInt(tokens[1]); //ArrayIndexOutOfBoundsException error instance.city = tokens[2]; instance.sibCount = Integer.parseInt(tokens[3]); return instance; } public int getIndex(Arrays list[], String key) { for (int index = 0; index&lt; list.length; index++) { if ( list[i…
type: AnsweredQuestion
tagged with: java
tagged with: indexoutofboundsexception
upvote count: 1

http://stackoverflow.com/q/22352344
type: UnansweredQuestion
tagged with: soap
tagged with: java
has title: Web-Service returns an object I can't work with JAVA
tagged with: web-services
downvote count: 1
type: Question
score: -1
has body: I'm creating a client of a web service - " www.webservicex.net/uszip.asmx " that returns all the cities and there post codes from that state(I'll be using that information for an weather broadcast program). ipSoap.getInfoByState() returns an object GetInfoByStateResult(gibs fron now on). Now the problem is that i can't access the content gibs has. The getContent() method returns a List of objects yet it has no methods that allow me to get the data I want (the Names and the Zips). How do I get the Name of the Cities and the Zips from the response ? Here is my code: public class Main { public static void main(String[] args){ USZip ip = new USZip(); USZipSoap ipSoap = ip.getUSZipSoap(); GetInfoByStateResult gibs = ipSoap.getInfoByState("NJ"); //New York List<Object> listOfCities = gibs.getContent(); /* problem here, getContent is always size 1, and i can't see what's inside in it. gibs.getIndex(0).toString returns: [NewDataSet: null]. */ } } GetCityByResult is at the bottom /** * Java class for anonymous complex type. * * The following schema fragment specifies the expected content contained within this class. * * * * * * * * * * * * <any/> * * * * * * * * * * * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getInfoByCityResult" }) @XmlRootElement(name = "GetInfoByCityResponse") public class GetInfoByCityResponse { @XmlElement(name = "GetInfoByCityResult") protected GetInfoByCityResponse.GetInfoByCityResult getInfoByCityResult; /** * Gets the value of the getInfoByCityResult property. * * @return * possible object is * {@link GetInfoByCityResponse.GetInfoByCityResult } * */ public GetInfoByCityResponse.GetInfoByCityResult getGetInfoByCityResult() { return getInfoByCityResult; } /** * Sets the value of the getInfoByCityResult property. * * @param value * allowed object is * {@link GetInfoByCityResponse.GetInfoByCityResult } * */ public void setGetInfoByCityResult(GetInfoByCityResponse.GetInfoByCityResult value) { this.getInfoByCityResult =…
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22353497

http://stackoverflow.com/q/22469711
score: 0
has title: HashTables Collision Handling and Rehashing
favorite count: 0
has comment: http://stackoverflow.com/comment/34179553
linked to: http://stackoverflow.com/q/4980757
answer count: 0
has body: I'm really new to HashTables and I'm having a hard time understanding, the process of collision handling, and increasing it's capacity if we run out of space and how does the loadFactor come into play when measuring the available space and capacity? If any code could be provided would really help and appreciated. Side Note: I'm not allowed to use the available class so I have to implement it on my own. Here's my put method that I override from the interface. @Override public String put(String key, String value) { int i = key.hashCode(); int hash = (i % capacity); while (table[hash] != null &amp;&amp; table[hash].key() != key) { if(hash &gt; loadFactor*capacity) { capacity = capacity*2; } if(hash == TABLE_SIZE) { return null; } hash = (hash + 1) % capacity; } System.out.println("Collision Detected"); String oldKey = table[hash].key(); String oldValue = table[hash].value(); //replace old value with the new table[hash] = new Entry(key, value); //return "index " + i + " hash " + hash; return "Old key: " + oldKey + ", Old Value: " + oldValue; }
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34179509
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34179476
has comment: http://stackoverflow.com/comment/34179460

http://stackoverflow.com/comment/34189630
has text: Thanks! do you have any idea what could be other java code coverage options for offline instrumentation?
comment on: http://stackoverflow.com/a/22475322
type: Comment
score: 0
type: AnswerComment

gquery
type: Tag
tag name: gquery
tags question: http://stackoverflow.com/q/22432277

jcreator
tags question: http://stackoverflow.com/q/22410698
tags question: http://stackoverflow.com/q/22342724
tag name: jcreator
type: Tag
tags question: http://stackoverflow.com/q/22343922

http://stackoverflow.com/comment/33940802
type: Comment
comment on: http://stackoverflow.com/a/22333500
has text: Thanks but I already have the manual Zoom controls enabled so I can click the + or - to zoom in/out. I want it to automatically zoom into my location when the activity starts.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34016858
type: AnswerComment
comment on: http://stackoverflow.com/a/22377647
type: Comment
has text: @zix The answer is basically "don't do this". You are inventing your own way of serializing data, instead of using a standard way, like for example JSON.
score: 1

http://stackoverflow.com/comment/33951377
type: Comment
type: QuestionComment
has text: Your idea works as long as I implement the interface onto any Cloneable class that I write. It doesn't work, however, for built-in java classes. - I'll see if I can work with this but feel free to keep the ideas coming. (And thank you.)
score: 0
comment on: http://stackoverflow.com/q/22330092

http://stackoverflow.com/comment/135038019
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22414394
type: AnswerComment
has text: @astra03 I think it fails when instantiating the service

http://stackoverflow.com/comment/34143644
comment on: http://stackoverflow.com/a/22449257
type: AnswerComment
has text: Thanks Rohit! So, would the following code also have worked? index=index.replaceAll("{{token}}",token);
score: 0
type: Comment

http://stackoverflow.com/comment/33967818
type: QuestionComment
comment on: http://stackoverflow.com/q/22348086
has text: Yes, it is free form.Example: typing 'India' and clicking on search, then it should Locate(zoom) and show India in Google Map
score: 0
type: Comment

http://stackoverflow.com/comment/33983734
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22357531
has text: I've not used loopj, but it appears to just be an HTTP client. Picasso handles the download of the image and the insertion into the ImageView fully, so it would potentially eliminate the need for a ton of code. It alsp automatically handles image caching.
type: QuestionComment

http://stackoverflow.com/comment/34012566
comment on: http://stackoverflow.com/q/22374868
has text: Have a look in here: http://stackoverflow.com/questions/4941372/how-to-insert-image-into-jtable-cell/4947154#4947154
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22332026
tagged with: file
has body: I've wrote some code to manipulate files with Java File and commons FileUtils API. It works fine if the files in local but not work always right if the files in anther machine. Can I use those File APIs across networks?
type: Question
has comment: http://stackoverflow.com/comment/33938264
score: 0
has title: Java File API copy files across network
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33938169
tagged with: apache-commons
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/12615475

http://stackoverflow.com/comment/34151439
score: 0
type: Comment
type: QuestionComment
has text: Please clean and rebuild the project, that will solve it
comment on: http://stackoverflow.com/q/22454004

http://stackoverflow.com/comment/34172305
score: 3
has text: Do you have an example that demonstrates the problem?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22465401

http://stackoverflow.com/a/22449029
answers question: http://stackoverflow.com/q/22448995
upvote count: 2
has body: How to resolve the issue error stating : The local variable str may not have been initialized Declare your StringBuffer as: StringBuffer str = new StringBuffer(); StringBuffer ptr = new StringBuffer(); By doing this means, you have initialized str and ptr to their default value
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/34222429
score: 0
type: Comment
has text: Actually my code works for me perfectly. What's I do is, call a webservice, in return I get a JSON response. That response is passed to the line `JSONObject jsonObject = new JSONObject(<your JSON string result>);` And the rest is same. I get the desired list after parsing through `gson`
type: AnswerComment
comment on: http://stackoverflow.com/a/22469389

http://stackoverflow.com/q/22469210
has body: I am trying to generate an index file using java with the help of Lucene. I followed this guide from iMasters and tried to adapt to version 4.7.0, the problem is that at some point the search is not working. I checked the file indexing and information from both files as its content is being indexed. Would you guys could help me? Follow my code: Indexador.java package main; import java.io.*; import java.text.*; import org.apache.log4j.*; import org.apache.lucene.analysis.*; import org.apache.lucene.analysis.standard.*; import org.apache.lucene.document.*; import org.apache.lucene.document.Field; import org.apache.lucene.index.*; import org.apache.lucene.store.*; import org.apache.lucene.util.*; import org.apache.tika.*; public class Indexador { private static Logger logger = Logger.getLogger(Indexador.class); // Diretório que irá guardar o índice; private String diretorioDosIndices = "C:\\Users\\strokes" + "\\Documents\\indice-lucene"; // Diretório que contém os documentos que serão indexados; private String diretorioParaIndexar = "C:\\Users\\strokes" + "\\Downloads"; // IndexWriter: cria e mantém o índice; private IndexWriter writer; // Biblioteca que extrai texto de diversos formatos conhecidos; private Tika tika; public static void main(String[] args) { Indexador indexador = new Indexador(); indexador.indexaArquivosDoDiretorio(); } public void indexaArquivosDoDiretorio() { try { File diretorio = new File(diretorioDosIndices); apagaIndices(diretorio); // Directory: representa o diretório do índice; Directory d = new SimpleFSDirectory(diretorio); logger.info("Diretório do índice: " + diretorioDosIndices); // Analyser/StandardAnalyser: fazem o pré-processamento do texto. // Existem analisadores inclusive em português; Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_47); // IndexWriterConfig: configurações para criação do índice. No // projeto serão utilizados os valores padrão; IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_47, analyzer); // …
answer count: 1
duplicate of: http://stackoverflow.com/q/18564029
tagged with: lucene
score: 0
has answer: http://stackoverflow.com/a/22471386
has title: Can't index and find files [Java, Lucene, Tika, Log4j]
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22471386
linked to: http://stackoverflow.com/q/18564029
type: Question

http://stackoverflow.com/comment/34054923
comment on: http://stackoverflow.com/a/22399325
score: 0
type: Comment
has text: We haven't learned how to debug yet. Going to look it up though!
type: AnswerComment

http://stackoverflow.com/comment/34211783
comment on: http://stackoverflow.com/a/22488020
has text: Jackson can do both of that too; my example above uses annotations only because my classes have no setters; if you have setters you don't even need `@JsonCreator`.
type: AnswerComment
score: 0
type: Comment

taglib
tags question: http://stackoverflow.com/q/22453855
tag name: taglib
tags question: http://stackoverflow.com/q/22461879
type: Tag

http://stackoverflow.com/comment/34132181
has text: Is that the only line you've added to your build.gradle? Because that is only compiling the java doc...
comment on: http://stackoverflow.com/q/22440230
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22389301
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22389216
downvote count: 0
has comment: http://stackoverflow.com/comment/34039480
has comment: http://stackoverflow.com/comment/34038731
has comment: http://stackoverflow.com/comment/34040014
type: Answer
has comment: http://stackoverflow.com/comment/34039599
has body: There is a much more simple way to do that: final Set&lt;String&gt; set = new HashSet&lt;&gt;(list1); set.retainAll(list2); Your set then only contains words which are in the two lists. Note: if order matters, use a LinkedHashSet instead of a HashSet
has comment: http://stackoverflow.com/comment/34038224
has comment: http://stackoverflow.com/comment/34039278
has comment: http://stackoverflow.com/comment/34039384
score: 4
answers question: http://stackoverflow.com/q/22389216
upvote count: 4
has comment: http://stackoverflow.com/comment/34039752
has comment: http://stackoverflow.com/comment/34039319

http://stackoverflow.com/a/22450303
has comment: http://stackoverflow.com/comment/34145677
upvote count: 2
type: AcceptedAnswer
has body: If a class implements Comparable, this is considered to be the natural ordering of this class. This ordering is used when you don't give an explicit Comparator to Collections.sort. That is why the single argument version of sort takes a List&lt;T&gt; where T extends Comparable&lt;? super T&gt;. The two argument versions take a List&lt;T&gt; with no restrictions on T and a Comparator&lt;? super T&gt;. So Course.compareTo is not used in your example.
type: Answer
has comment: http://stackoverflow.com/comment/34145958
has comment: http://stackoverflow.com/comment/34145570
accepted answer of: http://stackoverflow.com/q/22449967
score: 2
has comment: http://stackoverflow.com/comment/34146093
downvote count: 0
answers question: http://stackoverflow.com/q/22449967

http://stackoverflow.com/q/22404086
has comment: http://stackoverflow.com/comment/34062818
has answer: http://stackoverflow.com/a/22404540
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22404574
has comment: http://stackoverflow.com/comment/34063428
tagged with: java
has answer: http://stackoverflow.com/a/22404574
has comment: http://stackoverflow.com/comment/34063873
has title: maintain session between two pages in jsp having no relation
has comment: http://stackoverflow.com/comment/34099341
type: Question
has body: Hi guys i'm having a very weird problem that forced me to ask here well i'm having two pages say register and validate . on register page i'm setting values in session and wanted them on other page i.e validate page so can i access those values. I tried to access but not getting proper results. Is there any other way i can do that. Any help would be appreciated. session set HttpSession session=request.getSession(true); User_Registration urbean=new User_Registration(); urbean.setUser_mobile(userMobile); urbean.setUser_email(userEmail); urbean.setUser_name(userName); urbean.setUser_country(usercountry); session.setAttribute("userbean",urbean); session get HttpSession session =request.getSession(); //also tried to getSession(true) System.out.println("session---"+session); //getting error at this point getUsr_mobile is not defined System.out.println(session.getAttribute("userbean").getUser_mobile())); I have to hit these links separately in my android program and i cant maintain any reponse.sendredirect() or any redirection method.
tagged with: session
tagged with: jsp
has comment: http://stackoverflow.com/comment/34062864
has comment: http://stackoverflow.com/comment/34063613
answer count: 3
has comment: http://stackoverflow.com/comment/34064743
upvote count: 1
has comment: http://stackoverflow.com/comment/34099297
favorite count: 0
has comment: http://stackoverflow.com/comment/34062910
accepted answer: http://stackoverflow.com/a/22404540
has comment: http://stackoverflow.com/comment/34063540
has comment: http://stackoverflow.com/comment/34063391
has answer: http://stackoverflow.com/a/22407158
score: -3
has comment: http://stackoverflow.com/comment/34062731
downvote count: 4

http://stackoverflow.com/comment/34199597
type: Comment
type: QuestionComment
has text: @PeterBratton It is not in the interest of community to have accepted wrong answers, but that damage has already been done. You and I apparently differ in how exactly to go about mitigating it: you think your job is done when you have voted to close as a duplicate.
comment on: http://stackoverflow.com/q/22480749
score: 0

http://stackoverflow.com/a/22433812
has comment: http://stackoverflow.com/comment/34115937
has comment: http://stackoverflow.com/comment/34116459
has comment: http://stackoverflow.com/comment/34115836
has comment: http://stackoverflow.com/comment/34116221
score: 0
has comment: http://stackoverflow.com/comment/34116295
has comment: http://stackoverflow.com/comment/34116072
has body: Problem is with this line of code StringTokenizer token = new StringTokenizer(text); tokenizer breaks a string into tokens by a delimiter (default is " \t\n\r\f"). And as per your value of text that is binary (0010011001100111) will not be separated into tokens. Hope this helps.
type: Answer
answers question: http://stackoverflow.com/q/22433643

http://stackoverflow.com/comment/34188739
score: 0
type: QuestionComment
type: Comment
has text: Please paste your MainActivity with the line number 244 highlighted
comment on: http://stackoverflow.com/q/22460190

http://stackoverflow.com/a/22366679
downvote count: 0
has comment: http://stackoverflow.com/comment/33999391
has comment: http://stackoverflow.com/comment/33999389
has comment: http://stackoverflow.com/comment/33999489
type: Answer
has comment: http://stackoverflow.com/comment/33999465
score: 11
upvote count: 11
accepted answer of: http://stackoverflow.com/q/22366645
has body: Try this: Jsoup.connect(url).timeout(60*1000).get(); or... Jsoup.connect(url).timeout(0).get();
answers question: http://stackoverflow.com/q/22366645
has comment: http://stackoverflow.com/comment/33999538
type: AcceptedAnswer

http://stackoverflow.com/comment/33948683
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22337920
has text: yaaa jakub i already read. how string class objects are immutable. Means what in actual being performed by JVM to keep String objects immutable
score: 0

http://stackoverflow.com/comment/33958547
comment on: http://stackoverflow.com/a/22342473
score: 0
type: AnswerComment
type: Comment
has text: I am sure that I added the resources folder into my runtime classpath. However, it still doesn't work.

http://stackoverflow.com/comment/34028572
type: Comment
comment on: http://stackoverflow.com/a/22383571
has text: `Collections.sort(arraylist1, new Comparator<HashMap<String, String>>() { @Override public int compare(HashMap<String, String> o1, HashMap<String, String> o2) { String value1 = o1.get("time"); String value2 = o2.get("time"); return Long.compare(Long.valueOf(value1).longValue(), Long.valueOf(value2).longValue()); } });`
score: 0
type: AnswerComment

http://stackoverflow.com/q/22397033
has body: I am new to Java. I am stuck at a place. I need to create an editable JComboBox which fires event every time when typed value is changed. For example if there are 100 items in combo box then when user type 'a' in editable combo box then the drop down menu only shows that items which starts from 'a' only.
upvote count: 0
tagged with: java
type: Question
tagged with: autocomplete
score: -1
has comment: http://stackoverflow.com/comment/34092030
answer count: 1
downvote count: 1
duplicate of: http://stackoverflow.com/q/6777473
favorite count: 0
tagged with: jcombobox
linked to: http://stackoverflow.com/q/6777473
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22397421
tagged with: swing
has title: How to create autocomplete JComboBox in Swing?

http://stackoverflow.com/comment/116619841
has text: Note: as of PDFBox 2+, you would now use PDImageXObject.createFromFile or PDImageXObject.createFromFile or JPEGFactory.createFromStream. Note that LosslessFactory.createFromImage would be much less space-efficient. See: https://pdfbox.apache.org/2.0/migration.html#working-with-images
score: 1
comment on: http://stackoverflow.com/a/23409518
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22418914
linked to: http://stackoverflow.com/q/1614772
score: 0
has answer: http://stackoverflow.com/a/22418975
answer count: 1
has body: I want to change the color of the title bar and also the Java icon on the upper left of the frame, so I can make my program (GUI) look better. Is there a simple way to change it?
tagged with: titlebar
type: UnansweredQuestion
type: Question
has title: How to change the color of the Title bar when running a GUI program?
tagged with: java

http://stackoverflow.com/comment/34048843
has text: I will search. I do not have the book
comment on: http://stackoverflow.com/q/22395433
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34026408
has text: @Armin can you make sure ALL the bullet points are met on the links I gave you? This means you must look through the class that's causing the error, and its subclasses. Also, can you change `this.valueList = new ArrayList<>();` in `SelectParameter` to say `this.valueList = new ArrayList<String>();` (add the generic type to ArrayList)? The last time I experienced this error, it was a minor mistake in one of my subclasses.
score: 0
comment on: http://stackoverflow.com/q/22382107
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33956276
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22342209
score: 0
has text: To make the function call, you will have to use the java reflection api.

http://stackoverflow.com/comment/34166557
type: Comment
has text: Hi Luiggi, I'm sorry, I don't understand 'green check below' what's that all about?
comment on: http://stackoverflow.com/a/22458409
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34080254
type: QuestionComment
comment on: http://stackoverflow.com/q/22410265
has text: Do you need only chunks for a sentence ?
score: 0
type: Comment

http://stackoverflow.com/comment/34213682
comment on: http://stackoverflow.com/a/22369231
type: AnswerComment
has text: anyone have any other solution?
score: 0
type: Comment

http://stackoverflow.com/q/22375142
tagged with: java
has body: Is it possible to make Selenium WebDriver executable file in java? I have written code in java for data driven testing using Selenium WebDriver. I want to make it executable file so that outside eclipse one can execute it. package pkg; import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class LogingS { private WebDriver driver; private String baseUrl; @Before public void setUp() throws Exception { driver = new FirefoxDriver(); baseUrl = "http://www.example.com/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void testLogingS() throws Exception { driver.get(baseUrl); System.out.println("The current Url: " + driver.getCurrentUrl()); driver.findElement(By.id("id_email")).clear(); driver.findElement(By.id("id_email")).sendKeys("com"); Thread.sleep(1000); driver.findElement(By.id("id_password")).clear(); driver.findElement(By.id("id_password")).sendKeys("123"); Thread.sleep(1000); System.out.println("The current Url: " + driver.getCurrentUrl()); driver.findElement(By.id("btn_login")).submit(); Thread.sleep(5000); System.out.println("The current Url: " + driver.getCurrentUrl()); } @After public void tearDown() throws Exception { } }
linked to: http://stackoverflow.com/q/17148318
linked to: http://stackoverflow.com/q/13410242
type: Question
tagged with: testing
has answer: http://stackoverflow.com/a/22399317
score: 10
has answer: http://stackoverflow.com/a/50485608
tagged with: eclipse
has answer: http://stackoverflow.com/a/25774836
has answer: http://stackoverflow.com/a/22375465
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/32158634
favorite count: 0
has comment: http://stackoverflow.com/comment/105919655
has answer: http://stackoverflow.com/a/22375360
has title: Making executable file in Selenium WebDriver with Java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10127052
upvote count: 10
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/33114064

clone
tags question: http://stackoverflow.com/q/22330092
tags question: http://stackoverflow.com/q/22360011
tags question: http://stackoverflow.com/q/22481241
tags question: http://stackoverflow.com/q/22337581
tags question: http://stackoverflow.com/q/22396775
tags question: http://stackoverflow.com/q/22342509
tags question: http://stackoverflow.com/q/22394659
tag name: clone
type: Tag

http://stackoverflow.com/a/22363039
type: Answer
has comment: http://stackoverflow.com/comment/52309442
answers question: http://stackoverflow.com/q/22359384
accepted answer of: http://stackoverflow.com/q/22359384
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/52325015
has body: To answer your question, the Q matrix required by reprojectImageTo3D represents the mapping from a pixel position and associated disparity (i.e. of the form [u; v; disp; 1]) to the corresponding 3D point [X; Y; Z; 1]. Unfortunately, you cannot derive this relation without knowing the cameras' intrinsics (matrix K) and extrinsics (rotation &amp; translation between the two camera poses). Camera calibration is the usual way to estimate those. Your chef said that it is not an option, however there are several different techniques (e.g. using a chessboard, or via autocalibration) with various requirements and possibilities. Hence, investigating exactly why calibration is off the table may enable finding a method appropriate to your application. If you really have no way of estimating the intrinsics, a possible solution could be Bundle Adjustment, using more than just 2 images. However, without the intrinsics, the 3D reconstruction will likely not be very useful. Which leads us to my second point. There are several types of 3D reconstruction, the main types being: projective, metric and Euclidian. (For more details on this, see §10.2 p 264 in "Multiple View Geometry in Computer Vision" by Hartley &amp; Zisserman, 2nd Edition) The Euclidian reconstruction is what most people mean by "3D reconstruction", though not necessarily what they need: a model of the scene which relates to the true model only by a 3D rotation and a 3D translation (i.e. a change of the 3D coordinate system). Hence, orthogonal angles in the scene are orthogonal in such a model and a distance of 1 meter in the scene corresponds to 1 meter in the model. In order to obtain such a Euclidian 3D reconstruction, you need to know the intrinsics of at least some cameras AND the true distance between two given points in the scene. The metric or similarity reconstruction is most of the time good enough and refers to a 3D model of the scene which relates to the true model by a similarity transform, in other words…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/52356045

http://stackoverflow.com/q/22394748
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/22394773
upvote count: 1
has title: Json conversion error expected : after key
type: Question
has answer: http://stackoverflow.com/a/22394773
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/34048191
has body: I've been fiddling around with json conversions for the past few hours and I'm not sure why this string wouldn't convert. Can someone point me out the error? {{"x" : 100, "y" : 90},{"x" : 100, "y" : 85}} the error is org.json.JSONException: Expected a ':' after a key at 23 [character 24 line 1]
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34047534

http://stackoverflow.com/q/22402270
type: UnansweredQuestion
type: Question
score: 1
tagged with: java
tagged with: nat
has title: i am using JNAT-PMPlib for Nat Traversal and i get pmp device null, pls help me to over come this errors?
upvote count: 1
tagged with: portforwarding
has body: import com.hoodcomputing.natpmp.*; import java.net.Inet4Address; /** * This class provides an example that describes how this library is used. * @author flszen */ public class Example { /** * This method demonstrates how to use the library to work with a NAT-PMP * gateway. */ public static void TestDevice() { NatPmpDevice pmpDevice = null; try { // To find the device, simply construct the class. An exception is // thrown if the device cannot be located or if the network is not // RFC1918. // When the device is constructed, you have to tell it whether you // want it to automatically shutdown with the JVM or if you'll take // the responsibility of shutting it down yourself. Refer to the // constructor documentation for the details. In this case, we'll // let it shut down with the JVM. pmpDevice = new NatPmpDevice(true); // The next step is always to determine the external address of // the device. This is done by constructing the request message // and enqueueing it. ExternalAddressRequestMessage extAddr = new ExternalAddressRequestMessage(null); pmpDevice.enqueueMessage(extAddr); // In this example, we want to purposefully wait until the queue is // empty. It is possible to receive notification when the operation // is complete. Refer to the documentation for the // ExternalAddressRequestMessage constructor. pmpDevice.waitUntilQueueEmpty(); // We can try and get the external address to determine if the // gateway is functional. // This may throw an exception if there was an error receiving the // response. The method getResponseException() would also return an // exception object in this case, if you prefer avoiding using // try/catch for logic. Inet4Address extIP = extAddr.getExternalAddress(); Now, we can set up a port mapping. Refer to the javadoc for a gateway-selected available external port to the local port 5000. The lifetime is 120 seconds. In implementation, you would want to consider having a longer lifetime and periodicly sending a MapRequestMessage to pre…
tagged with: android
favorite count: 0
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/34043955
type: Comment
has text: @user3364788 Yes, sorry, I misread that you read only one file. However, since `foo` is an ArrayList, shouldn't you loop through it and analyse the Strings it contains? `for (String fooString : foo) { for (int k = 0; k < fooString.size() - blockSize; k++) {...} }`?
type: QuestionComment
comment on: http://stackoverflow.com/q/22392135
score: 0

http://stackoverflow.com/comment/34033229
has text: first of all, what input field are you using, JTextfield?
comment on: http://stackoverflow.com/q/22386693
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22387502
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: maven
type: Question
has body: So I have done mvn release:clean and mvn release:prepare. As a result I have a clean tag on my subversion with the latest version 1.3.3 of my artifact. Now I want to install that version 1.3.3 on my local maven repo (.m2) and NOT to the remote central maven repo. How to do that? Do I need to change something on my settings.xml ??? Do I need to run mvn release:perform with some kind of local options ??? Right now if I run mvn release:perform it will try to release my artifact to the maven central repo, which is exactly what I do not want. I want to release it locally to my other local projects, so I can do: com.mycompany myartifact 1.3.3 Interestingly enough, snapshots work fine: com.mycompany myartifact 1.3.4-SNAPSHOT So I am installing snapshots, but not full releases. Here is my settings.xml: allow-snapshots true snapshots-repo https://oss.sonatype.org/content/repositories/snapshots false true mac-profile <project.build.sourceEncoding> UTF-8 </project.build.sourceEncoding> <project.reporting.outputEncoding> UTF-8 </project.reporting.outputEncoding> mac-profile org.sonatype.plugins sonatype-nexus-snapshots myUsername myPassword sonatype-nexus-staging myUsername myPassword
has answer: http://stackoverflow.com/a/22442413
accepted answer: http://stackoverflow.com/a/22442413
tagged with: java
has answer: http://stackoverflow.com/a/71879940
answer count: 3
upvote count: 1
tagged with: maven-2
favorite count: 0
possible better answer: http://stackoverflow.com/a/22389034
has answer: http://stackoverflow.com/a/22389034
tagged with: pom.xml
has title: How to install a tagged version (i.e. not a snapshot) of your project locally and not to the maven central?

http://stackoverflow.com/q/22364479
has title: Java class as variable
has body: I am developing a game in Java, and I am trying to create enemies that can shoot projectiles. I am defining the base class for all enemy types, and I have already defined a projectile class. What I would like to do is define a class type variable in the base enemy class, and a shootProjectile() method that will create a new instance of the defined projectile class when called. Pseudo code: public class EnemyClass extends GameCharacter { protected Class projectileType; protected int a; protected int b; // Constructor and other stuff here public void shootProjectile() { projectileType newProjectile = new projectileType(a, b); } } public class MyEnemySubClass extends EnemyClass { public MyEnemySubClass() { super(); projectileType = MySuperProjectile; } // Rest of class stuff here } public class MySuperProjectile extends Projectile { public MySuperProjectile(parameter a, parameter b) { // Constructor stuff using a and b } // Other projectile-related stuff } The idea of course is that in the enemy sub classes all I need to do is define what class of projectile they shoot, and the shootProjectile() method in the base class will do the rest. I'm not sure how to achieve this. I have looked at defining generics but not sure how to make this work for my purposes and I'm not sure I fully understand how they work. Is something like this even possible in Java, or would I need to override shootProjectile for each subclass of EnemyClass to create their own projectile while attacking? Thanks in advance!
type: Question
has comment: http://stackoverflow.com/comment/34012957
upvote count: 4
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33995524
has comment: http://stackoverflow.com/comment/33995560
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22364618
has answer: http://stackoverflow.com/a/22364575
score: 4
tagged with: oop
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/22364534

http://stackoverflow.com/comment/34244843
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22346297
has text: @rpax I'm trying to minimze the code, so by translating I might have forgotten the ``array=applyAlgorithm(array);`` code. In the original code it is modifying an object so that line is not necessary.

android-dialog
type: Tag
tag name: android-dialog
tags question: http://stackoverflow.com/q/22431068

http://stackoverflow.com/a/22450686
answers question: http://stackoverflow.com/q/22450462
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22450462
downvote count: 0
type: Answer
has body: The scroll bars are handled by the OS. Consequently, the OS will decide when to show/hide the scroll bars and when to let the user use them. You can't influence that. There is a very similar question here. However, you can wrap your List in a ScrolledComposite. This way, you can still scroll even if the List is disabled: public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final ScrolledComposite composite = new ScrolledComposite(shell, SWT.V_SCROLL); composite.setLayout(new FillLayout()); List list = new List(composite, SWT.NONE); for (int i = 0; i &lt; 20; i++) { list.add("Item: " + i); } composite.setContent(list); composite.setExpandHorizontal(true); composite.setExpandVertical(true); composite.setMinSize(list.computeSize(SWT.DEFAULT, SWT.DEFAULT)); list.setEnabled(false); shell.pack(); shell.setSize(100, 150); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } Looks like this:
upvote count: 4
score: 4

http://stackoverflow.com/comment/37881024
has text: does your code returns all possible comments or it is restricted by the maximun number of comments that YouTube API can return?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22481157

http://stackoverflow.com/a/22329276
upvote count: 2
has body: Is CSVReader buffered? If not, wrap your FileReader with a BufferedReader (and make it a nice large buffer size).
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22329113

http://stackoverflow.com/comment/34050177
comment on: http://stackoverflow.com/a/22383681
has text: @David.. i used different fonts like sans-sarif,Arial Halvetica...etc..but the problem is that i m creting the chart by calling the method of ChartFactory.createBarChart3D(...) .. and even though it is showing me square boxes..even my dataset is UTF-8 compliant that is whatever i m adding to dataset is in already UTF-8 format.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22467038
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34175012
has comment: http://stackoverflow.com/comment/34175029
has comment: http://stackoverflow.com/comment/34174859
upvote count: 1
has body: Firstly, you should implement compareTo() in class Employee, not in Department. In class Employee, here is how the method should read: if (this.getDept().compareTo(other.getDept()) != 0) return this.getDept().compareTo(other.getDept()); return this.getAge() - e.getAge();
answers question: http://stackoverflow.com/q/22466987
has comment: http://stackoverflow.com/comment/34174905
has comment: http://stackoverflow.com/comment/34174969
type: Answer

http://stackoverflow.com/comment/34003949
comment on: http://stackoverflow.com/q/22369212
type: Comment
type: QuestionComment
has text: Also, event driven is usually implemented with function callbacks and Java doesn't really do that. I think the _async_ path is the closest alternative.
score: 0

http://stackoverflow.com/a/22486708
has comment: http://stackoverflow.com/comment/34210166
has body: I've tried using your code (in NetBeans) and it works perfectly fine. Where is the location of the line new TextAreaOutputStream(...)?
has comment: http://stackoverflow.com/comment/34210468
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34208909
answers question: http://stackoverflow.com/q/22486017

http://stackoverflow.com/comment/34175459
type: QuestionComment
comment on: http://stackoverflow.com/q/22467267
score: 0
has text: Write "in english" the algorithm for computing Fibonacci numbers .. then compare that to your Java implementation. WHy are you adding 1 to fold1 and fold2??
type: Comment

http://stackoverflow.com/comment/34096419
type: Comment
has text: it give java.sql.SQLException: Column count doesn't match value count at row 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)
score: 1
comment on: http://stackoverflow.com/a/22398527
type: AnswerComment

http://stackoverflow.com/q/22427392
has comment: http://stackoverflow.com/comment/34104022
tagged with: java
tagged with: jmockit
tagged with: mocking
has answer: http://stackoverflow.com/a/22459075
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34104158
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22459075
score: 1
has body: How to mock getForObject method in RestTemplate class using jmockit - I am trying to do like this - @Test public void test2DataClient() { new MockUp&lt;RestTemplate&gt;() { @Mock public String getForObject(String url, Class&lt;String&gt; responseType, Object... urlVariables) { return "{(\"error\": \"missing data id\", \"data_id\":2001)}"; } }; } But every time I am getting this error- java.lang.IllegalArgumentException: Matching real methods not found for the following mocks: Any thoughts what wrong I am doing here? UPDATE:- Full StackTrace - java.lang.IllegalArgumentException: Matching real methods not found for the following mocks: com.host.dataclient.test.DataTest$3#getForObject(String url, Class responseType, Object[] urlVariables) at com.host.dataclient.test.DataTest$3.&lt;init&gt;(DataTest.java:649) at com.host.dataclient.test.DataTest.test25dataclient(DataTest.java:649) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.lang.reflect.Method.invoke(Method.java:602) at java.lang.reflect.Method.invoke(Method.java:602) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
tagged with: resttemplate
upvote count: 1
has comment: http://stackoverflow.com/comment/34103964
tagged with: unit-testing
type: Question
has title: How to mock RestTemplate getForObject method using jmockit?

http://stackoverflow.com/a/22356981
type: Answer
has comment: http://stackoverflow.com/comment/33981660
has body: Implement a trigger on your database that updates a log table when your tables are modified. Then check the log table after the tests are run.
score: 0
answers question: http://stackoverflow.com/q/22356879
has comment: http://stackoverflow.com/comment/33981759

http://stackoverflow.com/q/22362269
tagged with: android-support-library
favorite count: 0
has body: I'm porting ActionBar functionality in my app for android 2.2. When starting any ActionBarActivity gets following error: java.lang.ExceptionInInitializerError at android.support.v7.app.ActionBarActivityDelegate.createDelegate(ActionBarActivityDelegate.java:54) at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:96) ... Caused by: java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$attr at android.support.v7.app.ActionBarActivityDelegateBase.&lt;clinit&gt;(ActionBarActivityDelegateBase.java:47) My set up is: IntelliJ Idea CE - 135.406 Android support library - 19.0.1 Based on similar questions, I have: Added v7 support as jar Added appcompat as library project Changed Activity to extend ActionBarActivity Added to Manifest android:theme="@style/Theme.AppCompat" But still getting resource error, any suggestions how I can fix this?
tagged with: android
has comment: http://stackoverflow.com/comment/33991288
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22933804
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Android ActionBar can't find resource
has comment: http://stackoverflow.com/comment/33991385
has answer: http://stackoverflow.com/a/22933804
has comment: http://stackoverflow.com/comment/33991354
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33993278

http://stackoverflow.com/a/22331647
score: 3
answers question: http://stackoverflow.com/q/22331463
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33974523
upvote count: 3
has body: Don't set preffered size for the JTextPane. Instead override method of root View (section view returned by your ViewFactory) public float getPreferredSpan(int axis) to return desired span for X and Y axises E.g. see how pagination could be implemented here http://java-sl.com/Pagination_In_JEditorPane.html and here http://java-sl.com/JEditorPanePrinter.html

http://stackoverflow.com/comment/34013326
has text: You should definitely check what a `Map` represents and what it is good for - I think you mistake a map for a list.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22375454
score: 1

http://stackoverflow.com/comment/34161667
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22459202
type: Comment
has text: It should not have a body, but it should have a content length set in the response header.

datetime
tags question: http://stackoverflow.com/q/22468364
tags question: http://stackoverflow.com/q/22375165
tags question: http://stackoverflow.com/q/22346058
tags question: http://stackoverflow.com/q/22470150
tags question: http://stackoverflow.com/q/22463062
tags question: http://stackoverflow.com/q/22343238
tags question: http://stackoverflow.com/q/22388959
tags question: http://stackoverflow.com/q/22377147
tags question: http://stackoverflow.com/q/22348159
tags question: http://stackoverflow.com/q/22329798
tag name: datetime
tags question: http://stackoverflow.com/q/22393330
tags question: http://stackoverflow.com/q/22328635
tags question: http://stackoverflow.com/q/22378556
tags question: http://stackoverflow.com/q/22415141
tags question: http://stackoverflow.com/q/22363418
tags question: http://stackoverflow.com/q/22470227
type: Tag
tags question: http://stackoverflow.com/q/22391645

http://stackoverflow.com/comment/34068796
type: Comment
comment on: http://stackoverflow.com/a/22406296
has text: @LeosLiterak Nope, I made this modification for both 'N' and 'T', but I still get the exception.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34194959
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22468704
has text: he reason for subProjectB & subProjectC to be linked to subProjectA is they use subProjectA as one of their dependencies. This way subProjectB & subProjectC would be linked to changes whenever they happen and I would not have apply the changes to subProjectB & subProjectC individually.
score: 0

http://stackoverflow.com/comment/34003075
type: QuestionComment
comment on: http://stackoverflow.com/q/22368689
score: 0
has text: I can't reproduce this. Show us a `Servlet` that would reproduce this. Make the example as minimal as possible.
type: Comment

http://stackoverflow.com/comment/34109700
has text: I am able to broadcast the message to multiple Clients, but cant listen to them back
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22430278
score: 0

http://stackoverflow.com/a/22344167
has body: String x=null; Scanner sc = new Scanner(System. in ); String hisName=null; do{ System.out.print("Please enter the first name of the person you would love to know about : "); hisName = sc.next(); printSomeInfoAbout(hisName); System.out.print("y/n"); x=sc.next(); }while(x.equals("y"));
upvote count: 3
answers question: http://stackoverflow.com/q/22344139
score: 3
downvote count: 0
type: Answer

http://stackoverflow.com/q/22422316
score: 0
answer count: 2
tagged with: development-environment
has answer: http://stackoverflow.com/a/22422348
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has body: I've used a custom Dialog theme which i name poptheme and when i installed it to Gingerbread, the action bar doesn't shows up but when i installed it to Kitkat it works fine. Since it's a dialog theme, a customized a new theme because i can't put an action bar using the theme theme.dialog. It worked fine on my phone which has Kitkat version, but when i try to run it on Gingerbread version, the layout is not what i wanted it to look like. This is the code in my onCreate() for the customized dialog theme: this.requestWindowFeature(Window.FEATURE_ACTION_BAR); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND, WindowManager.LayoutParams.FLAG_DIM_BEHIND); LayoutParams params = this.getWindow().getAttributes(); params.alpha = 1.0f; params.dimAmount = 0.7f; params.height=250; params.width=420; this.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); // This sets the window size, while working around the IllegalStateException thrown by ActionBarView // this.getWindow().setLayout(420,250); // this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); setContentView(R.layout.activity_main); //getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON,R.drawable.ic_launcher);
tagged with: android
has answer: http://stackoverflow.com/a/22422527
tagged with: java
has title: ActionBar doesn't shows up when installed to Android Gingerbread
type: Question

http://stackoverflow.com/q/22467691
has comment: http://stackoverflow.com/comment/34177779
downvote count: 1
type: Question
has title: Recursive Maze Algorithm
tagged with: recursion
tagged with: algorithm
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/34176756
score: 4
has comment: http://stackoverflow.com/comment/34177104
accepted answer: http://stackoverflow.com/a/22467947
tagged with: matrix
answer count: 1
favorite count: 0
has body: I'm solving a maze using recursion. my matrix look like this char maze[][] = { {'#','#','#','#','#','#','#','#','#','#','#'}, {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'}, {'#','#','#','#',' ','#','#','#','#','#','#'}, {'#',' ',' ',' ',' ','#',' ',' ',' ',' ','X'}, {'#',' ',' ',' ',' ','#',' ',' ',' ',' ','#'}, {'#',' ','#','#','#','#','#','#',' ','#','#'}, {'#',' ',' ',' ',' ',' ',' ',' ',' ',' ','#'}, {'#','#','#','#','#','#','#','#','#','#','#'}, }; this is prototype of the bigger matrix. my solve recursion method looks like this private void solve(int x, int y) { // set everything to false wasHere = new boolean[maze.length][maze[1].length]; correctPath = new boolean[maze.length][maze[1].length]; for (int i = 0; i &lt; maze.length; i++){ // Sets boolean Arrays to default values for (int j = 0; j &lt; maze[i].length; j++){ wasHere[i][j] = false; // set everything to false correctPath[i][j] = false; } } boolean b = solveRecursion(1,1); System.out.println(b); } as you can notice here I'm returning a boolean and it should give me a true if I find a path. But it is keep giving me false. I'm not sure about the logical errors that I'm making in my solveRecursion method. Here's the method private boolean solveRecursion(int x, int y) { if (x == endX &amp;&amp; y == endY){ return true; } if (maze[x][y] == '#' || wasHere[x][y]){ return false; } wasHere[x][y]=true; if (x != 0) // Checks if not on left edge if (solveRecursion(x-1, y)) { // Recalls method one to the left correctPath[x][y] = true; // Sets that path value to true; maze[x][y]='S'; return true; } if (x != maze[0].length ) // Checks if not on right edge if (solveRecursion(x+1, y)) { // Recalls method one to the right correctPath[x][y] = true; maze[x][y]='S'; return true; } if (y != 0) // Checks if not on top edge if (solveRecursion(x, y-1)) { // Recalls method one up correctPath[x][y] = true; maze[x][y]='S'; return true; } if (y != maze.length) // Checks if not on bottom edge if (solveRecursion(x, y+1)) { // Recal…
has comment: http://stackoverflow.com/comment/34176262
tagged with: maze
has comment: http://stackoverflow.com/comment/34176319
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22467947

http://stackoverflow.com/comment/34003023
score: 0
type: AnswerComment
has text: Changing date to ` + " '2014-03-12 14:55:32' , "` has reduced my stacktrace to two lines as shown in my updated post.
type: Comment
comment on: http://stackoverflow.com/a/22368958

http://stackoverflow.com/a/22336642
score: 1
answers question: http://stackoverflow.com/q/22336509
has body: I don't know why you want to use both breadth-first and depth-first search, but yes, either of those can be used to find the correct order of steps to a solution. Using strings to represent the nodes in your graph is a bad idea. It will be much more trouble than necessary to generate the outgoing vertices from each node, and to avoid adding redundant nodes. The next thing you need to do is define a class to represent each node on the graph, and write a function to find adjacent nodes, filtering out any nodes with the goat and cabbage or goat and wolf on the same side of the river and alone.
upvote count: 1
has comment: http://stackoverflow.com/comment/139655000
type: Answer
downvote count: 0

http://stackoverflow.com/q/22410939
tagged with: spring-mvc
tagged with: model-view-controller
tagged with: java
has title: Spring MVC: Form Bind: Erroneous inputs do not retain value
has body: I am using standard spring mvc tags, ala: &lt;form:input id="startDate" path="startDate" cssClass="datepicker" cssErrorClass="error datepicker" placeholder="Start Date" /&gt; backed by a form object. My inputs are validated on the serverside, either using annotation based binding on the form object, ala: @NotNull getStartDate() { return this.startDate(); } or being explicitly rejected, ala: FieldError fieldErr = new FieldError("theForm", "startDate", "Please check your dates"); BindingResult result.addError(fieldErr); If an input fails validation, the spring tag correctly adds the cssErrorClass to the input. However, my problem. I'd like the erroneous content to stay populated in the input tag. If 1/1/14 is determined to be invalid, I want the form to be repopulated with 1/1/14 as the value of that input. So... help? Anyone have a workaround for this? Thanks!
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/22414943
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34077989
tagged with: spring

http://stackoverflow.com/comment/34151966
score: 0
comment on: http://stackoverflow.com/q/22427945
type: Comment
has text: Check [this question](http://stackoverflow.com/questions/21739578/how-to-disable-spring-logging-debug-messages/21748252?noredirect=1#comment32996059_21748252) to see if that helps
type: QuestionComment

http://stackoverflow.com/comment/90016393
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/48840927
has text: It is not about how one can get access to the references it is what if somebody has access to those? as mentioned "if String would not have been immutable in nature then it would cause a serious security threat to the application because these values are allowed to get changed and if it is allowed then these might get changed due to wrongly written code or any other person who have access to our variable references."
score: 0

http://stackoverflow.com/q/22473302
has comment: http://stackoverflow.com/comment/34185030
has body: There is some error on my SQLite. 03-18 16:12:09.720: E/SQLiteLog(27137): (1) near "type": syntax error 03-18 16:12:09.720: W/dalvikvm(27137): threadid=1: thread exiting with uncaught exception (group=0x40c20450) 03-18 16:12:09.740: E/AndroidRuntime(27137): FATAL EXCEPTION: main public void onCreate(SQLiteDatabase db) { String CREATE_OWNER_TABLE = "CREATE TABLE " + TABLE_BUS + "(" + KEY_ROUTE + " TEXT NOT NULL," + KEY_DESTINATION + " TEXT NOT NULL," + KEY_FEE + " TEXT NOT NULL " + KEY_TYPE + " TEXT NOT NULL " + KEY_VIA1 + " TEXT NOT NULL " + KEY_VIA2 + " TEXT NOT NULL " + KEY_VIA3 + " TEXT NOT NULL );"; db.execSQL(CREATE_OWNER_TABLE); }
has answer: http://stackoverflow.com/a/22474156
tagged with: java
type: Question
has title: Variable error of SQLite in Android
has answer: http://stackoverflow.com/a/22473414
score: 0
answer count: 3
tagged with: sqlite
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22473336
tagged with: android

http://stackoverflow.com/comment/34112029
comment on: http://stackoverflow.com/a/22427468
type: Comment
has text: Can you show me your spring-servlet.xml? And you should just do @Autowired SessionFactory sessionFactory in your UsuarioHome class.
score: 0
type: AnswerComment

copy-protection
tags question: http://stackoverflow.com/q/22393772
type: Tag
tag name: copy-protection

http://stackoverflow.com/comment/34039024
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22358127
has text: My guess is that the filter should be `(&(objectclass=Person)(sAMAccountName=$1))` because LDAP will not understand HTML entities.

http://stackoverflow.com/q/22330848
upvote count: 17
has answer: http://stackoverflow.com/a/44503166
has answer: http://stackoverflow.com/a/67932055
answer count: 9
has answer: http://stackoverflow.com/a/22331092
possible better answer: http://stackoverflow.com/a/33331557
has answer: http://stackoverflow.com/a/33331557
type: AnsweredQuestion
downvote count: 0
has title: HTTPClient Example - Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE
score: 17
favorite count: 0
has body: I am using HttpClient components from Apache for the following simple program and I see the below exception: Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.(DefaultHttpRequestWriterFactory.java:52) at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.(DefaultHttpRequestWriterFactory.java:56) at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.(DefaultHttpRequestWriterFactory.java:46) at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.(ManagedHttpClientConnectionFactory.java:72) at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.(ManagedHttpClientConnectionFactory.java:84) at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.(ManagedHttpClientConnectionFactory.java:59) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory.(PoolingHttpClientConnectionManager.java:487) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.(PoolingHttpClientConnectionManager.java:147) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.(PoolingHttpClientConnectionManager.java:136) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.(PoolingHttpClientConnectionManager.java:112) at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:726) at com.starwood.rms.controller.property.HttpExample.main(HttpExample.java:14) public class HttpExample { public static void main(String[] args) { HttpClient client = HttpClientBuilder.create().build(); HttpGet request = new HttpGet("https://www.google.com/?q=java"); try { HttpResponse response = client.execute(request); System.out.println(response.getStatusLine()); } catch (Exception e) { e.printStackTrace(); } } } I am using Httpclient-4.3.3.jar Httpcore-4.3.2.jar Any ideas?
tagged with: apache-httpclient-4.x
type: Question
accepted answer: http://stackoverflow.com/a/22331092
has answer: http://stackoverflow.com/a/22331608
has answer: http://stackoverflow.com/a/29890336
has answer: http://stackoverflow.com/a/54261446
has answer: http://stackoverflow.com/a/37203983
tagged with: java
has answer: http://stackoverflow.com/a/37552131

http://stackoverflow.com/q/22469157
has comment: http://stackoverflow.com/comment/34179272
tagged with: java
has comment: http://stackoverflow.com/comment/34180236
has comment: http://stackoverflow.com/comment/34219209
type: Question
tagged with: actionlistener
score: 0
has body: I made a ticker which will show the average number of clicks per second which will refresh every .1 second. It will count the clicks for the past 4 seconds. Is there any chance that I am losing precision? Because my rates max to 6 and I would presume to have a higher rate from tapping in gaming experience. // Frame not shown import javax.swing.JOptionPane; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Ticker extends JPanel { private int d, count, rate, x; private int[] array; private JLabel l; public Ticker() { setLayout(new BorderLayout()); rate = x = 0; // JPanel p = new JPanel(); setLayout(new GridLayout(2, 1)); JButton b = new JButton("Click"); b.addActionListener(new Listener()); b.setHorizontalAlignment(SwingConstants.LEFT); add(b); l = new JLabel("a"); l.setHorizontalAlignment(SwingConstants.CENTER); add(l); Timer t = new Timer(100, new Listener2()); t.start(); array = new int[40]; for (int k = 0; k &lt; 40; k++) array[k] = 0; } private class Listener implements ActionListener { public void actionPerformed(ActionEvent e) { count++; } } private class Listener2 implements ActionListener { public void actionPerformed(ActionEvent e) { if (x &gt; 39) x = 0; array[x] = count; count = 0; x++; for (int i : array) { rate += i; } l.setText("" + (int)(rate/4.0)); rate = 0; // System.out.println((int)(x) +" " + array[(x-1)]); } } } Thank you.
has comment: http://stackoverflow.com/comment/34223500
tagged with: time
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34178773
has title: Is my program losing precision in counting clicks per second?
tagged with: jbutton
has comment: http://stackoverflow.com/comment/34179340
answer count: 0

http://stackoverflow.com/a/22473469
has body: Replace this on your for loop of fileoutput() method for (int i = 0; i &lt; l.length(); i++) { if (l.charAt(i) != '.' &amp;&amp; l.charAt(i) != ' ') { String cc = (" " + l.charAt(i)).trim(); int result = Integer.parseInt(cc); if (result != 0) { x[(int) k++] = result; } } }
answers question: http://stackoverflow.com/q/22473143
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/q/22482350
type: Question
has body: I need (well, really would love...) to add a namespace declaration to the root element of a DOM tree. I repeatedly use that namespace later in the document, and it's not very handy to have the declaration in each node where I use it: <?xml version="1.0" encoding="UTF-8" standalone="no"?> 42.42 Hello Namespace! What I'd like to get is <?xml version="1.0" encoding="UTF-8" standalone="no"?> 42.42 Hello Namespace! which is much more convenient when later editing by hand. I know it's possible, because this is what I get when I load a document that contains and add the remaining nodes. So I think the questions boils down to: How do I add xmlns:test="urn:mynamespace" to the root node? When I just try to add the attribute, I get a NAMESPACE_ERR exception (I use namespace-aware factory, etc). because I try to mess with namespaces bypassing the API that I just can't find... Note: there is no attribute using the namespace in the root element (when I allow that, I can get it to work), but just the namespace declaration.
downvote count: 0
has title: How to add namespace declaration to root element of DOM?
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: xml-namespaces
has comment: http://stackoverflow.com/comment/96442089
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/28496282
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22980413
tagged with: dom

http://stackoverflow.com/comment/34475511
type: AnswerComment
type: Comment
has text: You may want to edit your question further to clarify what you actually want to achieve. `MapBinder` for Guice is handled a bit different than in Dagger, since Dagger should be used to verify the `ObjectGraph` in CompileTime, but in Guice is all RunTime. Even if you dont actually use a module, you can should use the `@Module` Annotation to list **all** your bindings. If you want your implementations be actual Singletons, then annotate your implementation classes with `@Singleton` else I dont see the point having a `HashMap` storing the instances.
comment on: http://stackoverflow.com/a/22580776
score: 0

http://stackoverflow.com/a/35775052
answers question: http://stackoverflow.com/q/22484156
type: Answer
has body: There are some good step-by-step tutorials on how to integrate spring security. For example: For Java config: http://jtuts.com/2016/03/03/spring-security-login-form-integration-example-with-java-configuration/ For XML config: http://jtuts.com/2016/03/02/spring-security-login-form-integration-example-with-xml-configuration/
score: 0

http://stackoverflow.com/q/22348848
score: 2
tagged with: java
type: Question
tagged with: google-maps
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/22349029
upvote count: 2
type: UnansweredQuestion
has title: How to Draw Path between start location and end location with multiple waypoints on google map in android?
has comment: http://stackoverflow.com/comment/50644766
has body: I want to Draw Path between start location and end location with multiple waypoints on google map in android along with i want to give numbering to the point for example start point is 1 and onward Please help.

http://stackoverflow.com/comment/34160845
type: Comment
type: QuestionComment
has text: Can you show the complete error log?
score: 0
comment on: http://stackoverflow.com/q/22459361

http://stackoverflow.com/comment/34178714
has text: Not to distract too much from the OP's question, but I'm curious about Lombok, which I never heard of before. Just watched the demo video. How about customizing setters to, for instance, null is not allowed, or a number has to be in a certain range, or whatever? I also wonder about how good its JavaDoc turns out to be, when the functions don't exist in your source. Interesting concept.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22469099
type: QuestionComment

http://stackoverflow.com/comment/33995487
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22364382
has text: Then find and disable whatever exception handler is preventing you from getting a stack trace. Or run under the ndk-gdb. Or put some logging in your native code. But leaving people to **guesss** the error location is just not reasonable.

http://stackoverflow.com/q/22376031
accepted answer: http://stackoverflow.com/a/22376315
type: AnsweredQuestion
downvote count: 0
has body: I'm running a servlet in a tomcat container. All is working correct, tomcat calls the init method of my Servlet and it starts correctly. When I look at the Tomcat Web Application Manager - List Applications I see the running status is "true". In the init function I want to check some important settings. If a check fails, I throw a new ServletException. Now I thought that the running status would change to "false" but it didn't. So my question is how to stop the servlet from a check in the init function. Or maybe I just do it the wrong way. Would like to get some help, thanks in advance
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22376315
type: Question
tagged with: tomcat
tagged with: servlets
has title: Showing the right "Running" status in tomcat manager
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/34084361
comment on: http://stackoverflow.com/q/22331126
score: 0
has text: Start ant via batchfile like that => http://stackoverflow.com/a/5558327/130683
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34032203
comment on: http://stackoverflow.com/q/22384710
type: QuestionComment
has text: yes i have mysql running on my system
score: 0
type: Comment

http://stackoverflow.com/a/22345533
has body: check the date format in your excel file. It might be DD-Mmm-YYYY. by changing it to DD-MM-YYYY you could parse i guess.
type: Answer
answers question: http://stackoverflow.com/q/22343865
score: 0

http://stackoverflow.com/comment/34136603
comment on: http://stackoverflow.com/a/22445045
type: AnswerComment
score: 0
has text: Your answer is better than mine was. :)
type: Comment

http://stackoverflow.com/comment/34048677
type: AnswerComment
score: 2
type: Comment
comment on: http://stackoverflow.com/a/22395430
has text: I personally consider printing diagnostic or trace output to be not semantically observable, which is why I hesitate to make a statement one way or the other about printing anything.

http://stackoverflow.com/comment/34185672
type: AnswerComment
has text: Thanks for the report, I will take a look at that.
type: Comment
comment on: http://stackoverflow.com/a/22466499
score: 0

http://stackoverflow.com/comment/34076792
type: AnswerComment
comment on: http://stackoverflow.com/a/22395138
type: Comment
has text: @JigarJoshi This is path to linked `jdk` _(shown in the snapshot)_ http://s11.postimg.org/5fm3sac37/Screenshot_at_2014_03_14_22_54_03.png
score: 0

http://stackoverflow.com/q/22374299
favorite count: 0
duplicate of: http://stackoverflow.com/q/2132242
has answer: http://stackoverflow.com/a/22374398
linked to: http://stackoverflow.com/q/20827284
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34011475
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/2132242
accepted answer: http://stackoverflow.com/a/22374424
type: Question
possible better answer: http://stackoverflow.com/a/22374398
tagged with: javascript
linked to: http://stackoverflow.com/q/2422468
has answer: http://stackoverflow.com/a/22374424
tagged with: servlets
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/34011447
has title: Passing variable from JavaScript to servlet
tagged with: jsp
has body: I've used JavaScript in my JSP page to process get data of the div tag: var script = ace.edit("editor"); var myDivText = script.getValue(); Now I want to pass myDivText to my servlet.java. Till today I've passed it as below window.open('http://XXX.XX.XXX.XX:8800/FirstServlet/mygeco?mytxt=' + myDivText,'resizable=yes'); But now, I had to include a few input forms and now I am calling my servlet through a submit mechanism, so how do I pass myDivText to servlet.java without using the above method? ==============================EDIT========================== My form looks as follows: Left File : Right File : Config File : Submitting form through JavaScript: var scc1 = document.getElementById("box"); scc1.innerHTML = scc1.innerHTML + " " + "Uploading files, the page might refresh"; var thetxt = scc1.innerHTML; document.getElementById('myField').value = thetxt; document.myform.submit(); Getting data in Servlet.java String mydiv = request.getParameter("myField"); request.setAttribute("mydiv", mydiv);

http://stackoverflow.com/q/22377377
has title: Test whether a method returns doubles
answer count: 4
possible better answer: http://stackoverflow.com/a/22377770
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22377770
tagged with: java
has comment: http://stackoverflow.com/comment/34016243
has body: Here is a paraphrasing of a question I posed to a group of students, and it turns out that finding an answer is a bit trickier (for me, anyway) than I expected: Suppose you have asked me to write a method, f, that has a String parameter, and returns a double. You now wish to test whether I have done my job correctly by writing your own test code that will compile if I have written f as specified, but won't compile if I have not. Some students proposed this incorrect solution: System.out.println(f("cat")); This is not a good tester because it does not test the return type of the method. That is, it will compile even if I had written f to return a String or an int or a boolean, and so on. I proposed this solution to the students: double d = f("cat"); I reasoned that this tests whether f accepts Strings and returns doubles. But really, this is no good either. f could return an int (or any "narrower" primitive data type), and the result could be stored in d. So, I'm seeking ideas for a simple solution (one or two lines of code, perhaps?) to the problem: write code that will compile if f has been defined correctly (String parameter, double return), but won't compile if f has not been written as specified.
type: Question
has answer: http://stackoverflow.com/a/22378234
has comment: http://stackoverflow.com/comment/34016108
has answer: http://stackoverflow.com/a/22377534
score: 0
accepted answer: http://stackoverflow.com/a/22377534
has answer: http://stackoverflow.com/a/22377572

http://stackoverflow.com/q/22402612
answer count: 1
tagged with: jpa
favorite count: 0
has title: CriteriaQuery list of abstract class
has answer: http://stackoverflow.com/a/22412510
score: -1
type: UnansweredQuestion
has body: I have the classes Order, Article, Car public class Order{ private List&lt;Article&gt; articles; } public abstract class Article{ private int id; } public class Car extends Article{ private String color; } public class Book extends Article{ private String title; } How can I check the articles that are a car using criteriaquery?
tagged with: java
tagged with: criteriaquery
downvote count: 1
type: Question
upvote count: 0

http://stackoverflow.com/a/22340697
has body: The root element web-app is missing in the descriptor file Your web.xml is missing the root element . The nesting is also incorrect. The element is a top-level element like the element, not nested inside it. Your web.xml should have a structure similar to this: Jersey REST Service com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.edu.cs157b.restful AssignmentTwo 1 Jersey REST Service /api/* If you use an IDE (like Netbeans, Eclipse) when you create a Web-app it will generate a valid web.xml for you. If you create a REST web service it will probably even configure a JAX-RS web.xml for you.
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22339723
score: 1

http://stackoverflow.com/a/22349857
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33978943
has comment: http://stackoverflow.com/comment/33978269
type: Answer
has comment: http://stackoverflow.com/comment/33969691
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22348988
answers question: http://stackoverflow.com/q/22348988
has body: I think this is because the toString pare the full content of your base64 data to handle unicode characters and escape some specific characters. You can see this in JSONStringer#string, which is called for every string value in your JsonObject when you call toString. Of course, as your data is base64, you don't actually need this. So I think you will need to implement your own toString implementation, probably based on the JSONStringer without escaping
has comment: http://stackoverflow.com/comment/33977900
type: AcceptedAnswer

http://stackoverflow.com/comment/34110130
has text: If we take aside the requirement to be resumable, this is one of the most standard recursive algorithms. So you can just search for `recursion` and `permutation` and a lot of solutions will comes up. Also, I know this problem as `Vector 0/1` so you can try search for this too.
comment on: http://stackoverflow.com/q/22430559
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/70396548
type: Comment
score: 0
type: AnswerComment
has text: @Frederic Leitenberger http://www.java67.com/2015/07/how-to-stop-thread-in-java-example.html
comment on: http://stackoverflow.com/a/22437372

http://stackoverflow.com/a/22336315
has body: Stop right there. readUTF()/writeUTF() are for reading/writing UTF character strings of up to 64k in length. Not for binary. And readUTF() can only read data that was written by writeUTF(). You're using the wrong API for the wrong purpose. String is not a container for binary data. You should be using the plain read() and write() methods, or possibly readFully(). Note that write() has an overload where you can specify an offset and length. You need to read as above and write to a ByteArrayOutputStream, and get the byte array from that, or write direct to a BLOB.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22335536

http://stackoverflow.com/comment/33964617
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22346240
has text: Sorry, I was forgetting `CheckboxTableViewer.newCheckList` is the approved way to construct the viewer. Answer updated.
score: 0

m2e
type: Tag
tags question: http://stackoverflow.com/q/22424168
tag name: m2e
tags question: http://stackoverflow.com/q/22431461
tags question: http://stackoverflow.com/q/22435309

http://stackoverflow.com/comment/34000153
comment on: http://stackoverflow.com/a/22366760
type: AnswerComment
score: 0
type: Comment
has text: Something like merging both streams for instance?

http://stackoverflow.com/q/22437026
has comment: http://stackoverflow.com/comment/34121537
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34121721
has comment: http://stackoverflow.com/comment/34121320
score: -1
has body: hi i have made a simple parser in java which parses arithmatic expressions like 1+4,-5/3-7... and my question is how can i modify my cosw so that it can also parse braces like(-3+6)/7... my idea is unclear...... any one please give me just ideas so that i can make it working.... thank you this is my code package parser; public class Parser { boolean isNum(StringBuffer s) { try { Double.parseDouble(new String(s)); } catch(NumberFormatException e) { return false; } return true; } double toNum(StringBuffer s) { return Double.parseDouble(new String(s)); } double eval(StringBuffer exp) { if(isNum(exp)) { return toNum(exp); } else if(!isNum(exp)) { for(int i=exp.length()-1;i&gt;=0;i--) { if(exp.charAt(i)=='/') { return (double)eval(new StringBuffer(exp.substring(0, i))) / eval(new StringBuffer(exp.substring(i+1,exp.length()))); } else if(exp.charAt(i)=='*') { return (double)eval(new StringBuffer(exp.substring(0, i))) * eval(new StringBuffer(exp.substring(i+1,exp.length()))); } else if(exp.charAt(i)=='-') { return (double)eval(new StringBuffer(exp.substring(0, i))) - eval(new StringBuffer(exp.substring(i+1,exp.length()))); } else if(exp.charAt(i)=='+') { return (double)eval(new StringBuffer(exp.substring(0, i))) + eval(new StringBuffer(exp.substring(i+1,exp.length()))); } } } return 0; } public static void main(String[] args) { System.out.println("Simple Expression Parser \n"); System.out.println(new Parser().eval(new StringBuffer("-1+2*3/4"))); } }
accepted answer: http://stackoverflow.com/a/22437116
upvote count: 0
answer count: 1
favorite count: 0
tagged with: parsing
has comment: http://stackoverflow.com/comment/34121275
has comment: http://stackoverflow.com/comment/34121220
has comment: http://stackoverflow.com/comment/34122057
type: AnsweredQuestion
tagged with: java
has title: Parser that can parse Expression with braces
has answer: http://stackoverflow.com/a/22437116

http://stackoverflow.com/comment/34199800
type: Comment
comment on: http://stackoverflow.com/a/22481723
has text: Thanks-I'll give that a try as well for my own learning but for the purposes of what I'm doing your suggestion works perfectly.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34094088
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22421469
has text: I added `web.xml` to the question.

http://stackoverflow.com/comment/34278657
comment on: http://stackoverflow.com/a/22479522
has text: I increase receiving and sending socket buffers to 1mb in TcpTransportClient.intialize: socketChannel.socket().setReceiveBufferSize(size); socketChannel.socket().setSendBufferSize(size); And add this code to sendMessage: rc = socketChannel.write(bytes); if (rc == 0) while (bytes.hasRemaining()) { Thread.sleep(10l); rc = socketChannel.write(bytes); } It's work fine with diameter server on c++ on debian, but on jdiameter server problem not solved.
score: 0
type: AnswerComment
type: Comment

pca
tag name: pca
type: Tag
tags question: http://stackoverflow.com/q/22404743

http://stackoverflow.com/q/22425226
favorite count: 0
has answer: http://stackoverflow.com/a/22425802
accepted answer: http://stackoverflow.com/a/22425802
tagged with: android
possible better answer: http://stackoverflow.com/a/22425255
score: 2
downvote count: 0
has body: As you can see in ss, some apps have created their own folders in my phone root folder. So that means it's possible, but I couldn't find a way to do this. Tried this but didn't work, File folder = new File("/myfolder"); boolean success = true; if (!folder.exists()) { success = folder.mkdir(); }
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22425255
type: Question
upvote count: 2
answer count: 2
has title: How to create a folder in rootfolder in Android
tagged with: directory

http://stackoverflow.com/a/22366402
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22366204
answers question: http://stackoverflow.com/q/22366204
type: AcceptedAnswer
has body: Java keeps runtime type information (RTTI). This means that even if you hold a reference to a base class object the sub-class's method will be called(if the method is overriden by the subclass). So you don't have to do anything so as the subclass method to be called. public class SubRenderPanel extends RenderPanel{ @Override public abstract void render() { //Do your stuff here } } public class Window implements Runnable{ RenderPanel r = new SubRenderPanel(); public void run(){ while(running){ r.render(); Thread.sleep(5000); } } }
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/22340712
has body: You cannot do that. You will certainly end up with nothing more than a ClassCastException. If your method is a non-final method of base (possibly overridden in subclasses) then you can cast both to a base and call it that way. You can also make proper use of interfaces to represent common functionality instead. The only means of dynamic binding that Java offers is via reflection (tutorial, also java.lang.Class documentation), e.g.: myObject.getClass().getDeclaredMethod("display").invoke(myObject); Bear in mind that you lose all benefits of compile-time type checking when using reflection (and also the interface is much more cumbersome) -- there is almost always a better way to accomplish the task without it (in your case, I have a hunch that there is most definitely a better way).
upvote count: 2
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22340577
type: Answer
accepted answer of: http://stackoverflow.com/q/22340577
score: 2

http://stackoverflow.com/a/22475744
type: AcceptedAnswer
downvote count: 0
has body: Hypothesis: you use Excel to open your CSVs under Windows. Unfortunately for you, Excel is crap at reading UTF-8. Even though it should not be required, Excel expects to have a byte order mark at the beginning of the CSV if it uses any UTF-* encoding, otherwise it will try and read it using Windows 1252! Solution? Errr... Don't use Excel? Anyway, with your old way: CSVWriter writer = new CSVWriter(new FileWriter(file)); this would use the JVM's default encoding; this is windows-1252 under Windows and UTF-8 under Linux. Note that Apache's commons-io has BOM{Input,Output}Stream classes which may help you here. Another solution would be (ewwww) to always read/write using Windows-1252. Other note: if you use Java 7, use the Files.newBuffered{Reader,Writer}() methods -- and the try-with-resources statement.
accepted answer of: http://stackoverflow.com/q/22475431
type: Answer
answers question: http://stackoverflow.com/q/22475431
score: 1
upvote count: 1

http://stackoverflow.com/a/22407986
has body: I did something similar for an MVP architecture that we use. The rule was to have no application logic in the UI, and no reference to Swing components in the Presenters. We accomplished that by: Creating an Interface that the Swing GUI implemented. The presenters had a handle to this Interface and is how it interacted with the UI. Using enums (or String constants, or whatever) that acted as a key for each field. The UI would register each component with the specified key, and the Presenter would then act upon the UI using these field keys. Code in the Presenter would look something like this: ui.setEditable(AddressBook.NAME, false); ui.setValue(AddressBook.NAME, "John Doe"); The UI would receive these events and make the JTextField for the NAME field read-only, populated with the given text. So based on your question, you want to add JButtons dynamically to the UI? We wouldn't normally do that. In our scenerio, the Swing implementor of the UI interface would already have all of it's components created and registered. However, if that's what's really needed, I imagine I'd need a method that looked like this on the UI (based on an Address Book example): ui.addCommandButton(AddressBook.SOME_COMMAND, "Button Text"); Or, if you didn't have the key and wanted the UI to generate a new field dynamically, maybe something like: Object key = ui.addCommandButton("Button Text");
answers question: http://stackoverflow.com/q/22404265
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/22330843
type: Question
has body: I am getting the above mentioned error.I have the xml file hibernate.cfg.xml already within the web application. As well as this I have the full jar files required for hibernate under WebINF lib folder. Here's the full error Mar 11, 2014 4:11:18 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\MinGW\bin;C:\JavaSE7\Tomcat7\apache-tomcat-7.0.29\bin;C:\Program Files (x86)\Java\jdk1.7.0_05\bin;C:\Program Files (x86)\Java\jdk1.7.0_05\bin;C:\JavaSE7\eclipse;;. Mar 11, 2014 4:11:18 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:CricketWebApplication' did not find a matching property. Mar 11, 2014 4:11:18 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:WebApp' did not find a matching property. Mar 11, 2014 4:11:18 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.ser…
answer count: 2
has answer: http://stackoverflow.com/a/22331565
score: 0
has comment: http://stackoverflow.com/comment/33936937
accepted answer: http://stackoverflow.com/a/22331576
tagged with: classloader
possible better answer: http://stackoverflow.com/a/22331565
has title: hibernate.cfg.xml already exists in my project but I'm getting this error hibernate.cfg.xml not found
has comment: http://stackoverflow.com/comment/33937263
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22331576
tagged with: java
tagged with: hibernate
tagged with: servlets

http://stackoverflow.com/a/22451625
score: 1
upvote count: 1
has body: You need to use a SwingWorker thread to do the processing and update the progress bar from that. http://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html
has comment: http://stackoverflow.com/comment/34147483
has comment: http://stackoverflow.com/comment/34148029
downvote count: 0
answers question: http://stackoverflow.com/q/22451389
type: Answer

http://stackoverflow.com/comment/34185613
comment on: http://stackoverflow.com/a/22472737
score: 0
type: Comment
has text: Is the jar file in your home directory? If not, look at the path of the directory it's in, and before the java command run `cd path-goes-here`
type: AnswerComment

http://stackoverflow.com/comment/34037196
score: 0
type: AnswerComment
type: Comment
has text: @Cruncher Yes, greedy.
comment on: http://stackoverflow.com/a/22388786

http://stackoverflow.com/q/22439286
score: 0
has comment: http://stackoverflow.com/comment/34125551
has comment: http://stackoverflow.com/comment/34125466
answer count: 1
linked to: http://stackoverflow.com/q/22433466
has body: I am trying to understand synchronization in JAVA. I have written a small program. class A implements Runnable { public void run() { Random r = new Random(); int i = r.nextInt(10); if(i&lt;5){ print(); }else{ display(); } } public synchronized void display() { System.out.println("display"); print(); // Line no: 19 } public synchronized void print() { System.out.println("print"); } } public class Test { public static void main(String argv[]) throws Exception { A a = new A(); Thread t = new Thread(a, "A"); Thread t1 = new Thread(a, "B"); t.start(); t1.start(); } } Consider 1st case: I have put a debug point on the 1st line inside print method. Now when thread A starts running and number randomly generated number 1. It will call print method and as I have debug point on its first line. It will wait for me to resume. Now during that time, thread B starts running and number randomly generated number 8. It should call display method but I see the execution doesn't go inside the display method. It will go inside only after I have make sure that thread A has finished execution. Shouldn't thread B should go inside display method and wait on the line no 19. Can two thread generated by same object cannot execute 2 different synchronized method? Please explain.
linked to: http://stackoverflow.com/q/14243790
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22439348
type: Question
has title: Why second thread not going inside `display()` method?
accepted answer: http://stackoverflow.com/a/22439348
tagged with: synchronized

http://stackoverflow.com/comment/34153534
type: QuestionComment
has text: The method getViewObject() goes to the Factory-Classes and get the JSON-Data. Here is a example code of the button: public View getViewObject(DynamicForm form){ Button dfbutton = new Button(form); dfbutton.setText(this.getValue()); dfbutton.setWidth(this.getWidth()); dfbutton.setHeight(this.getHeight()); dfbutton.setX(this.getPosX()); dfbutton.setY(this.getPosY()); return dfbutton; }
score: 0
comment on: http://stackoverflow.com/q/22453800
type: Comment

http://stackoverflow.com/comment/92140377
has text: Hello, @Sebastian Have you found what is Constant Name for flag 402653184?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22389136

http://stackoverflow.com/comment/34134761
has text: @PeterLawrey The tree is a recursive data structure, so it is natural.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22443867
type: Comment

http://stackoverflow.com/comment/34175548
comment on: http://stackoverflow.com/q/22467267
score: 0
type: Comment
type: QuestionComment
has text: @MattiasBuelens true story :D

http://stackoverflow.com/q/22329431
has title: Pass Map value to Spring MVC controller using <form:hidden>
has comment: http://stackoverflow.com/comment/33934934
downvote count: 0
has answer: http://stackoverflow.com/a/22329751
favorite count: 0
upvote count: 2
tagged with: spring
has body: On submitting the page, i need to do some process and send some data to the controller. I felt the 'Map' suits for my requirement to pass in the data. Here is what i am doing: JSP: &lt;form:hidden id="passMapData" path="passMapData"/&gt; Controller: @RequestMapping(value = "/newPage/testData", method = RequestMethod.POST) public String newPageTestData(@Valid @ModelAttribute("npf") NewPageForm npf, BindingResult result, Model model) { } NewPageForm.java: public class NewPageForm { private Map&lt;String, String&gt; passMapData = null; public Map&lt;String, String&gt; getPassMapData() { return passMapData; } public void setPassMapData(Map&lt;String, String&gt; passMapData) { this.passMapData = passMapData; } } Issue: On submitting the form, the BindingResult in the controller is showing error "IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.Map]" Cant we pass a Map type to controller in form submit?
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18280395
accepted answer: http://stackoverflow.com/a/22329751
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33934286
answer count: 1

http://stackoverflow.com/a/22443661
upvote count: 1
score: 1
downvote count: 0
has body: That should be because you don't append the right value in your array. You append "userE" which is a parameter, but you set values inside "e", which is another Employee instance.
answers question: http://stackoverflow.com/q/22443626
type: Answer

http://stackoverflow.com/comment/34200244
type: Comment
has text: the second part would justify a downvote ;-) Didn't because the first seems to pinpoint the OP's problem (though hard to tell what exactly that is)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22481586

http://stackoverflow.com/a/22441174
answers question: http://stackoverflow.com/q/22441131
accepted answer of: http://stackoverflow.com/q/22441131
has body: You need to use a Service to keep your music play when the user is not using your app/or you app is killed. There are no other ways, you cannot say to android to keep your activity alive. Read this to understand more about services. To let a service run foreaver (let it be a foreground service) you should create a notification and use startForeground A foreground service is a normal service with the difference it will be alive as long as the system can keep it alive. (with a notification which help to user to kill the service if not needed, in this case to stop the music player)
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34045601
has text: What on earth does `2014-14-03` mean? Did the year just get longer?
comment on: http://stackoverflow.com/q/22393330
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22458667
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
has body: I'm getting a problem using PDFBox API. I have a PDF file with a JBIG2 image in it and I want to read it out and create a JPEG or PNG file with the PDF content. Unfortunately I'm only getting a black image. My code is: public static void copyDocumentAsImage(String path) throws IOException { PDDocument document = PDDocument.load(new File(path)); String destinationDir = "myDestinationPath"; BufferedImage img = new BufferedImage(2000, 2000, BufferedImage.TYPE_BYTE_GRAY); PDXObjectImage ximage = new PDJpeg(document, img); ximage.write2file(destinationDir); } I already checked this: https://issues.apache.org/jira/i#browse/PDFBOX-1067 But it did not work for me or I not getting the right solution. Can someone help me out with it? Thanks in advance.
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34226479
tagged with: jbig2
has comment: http://stackoverflow.com/comment/35262900
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/40627909
has title: Java - PDFBox - PDF with JBIG2 image
tagged with: pdfbox
tagged with: image
type: Question
upvote count: 2

http://stackoverflow.com/a/22421894
upvote count: 1
has body: I think that your Java code is Ok, then try to change your Python script. Please, would you be so kind to change the line print int(predictions[0]) with: sys.stdout.write(str(predictions[0])) sys.stdout.flush() sys.stdout will print data to console outputstream and just for testing, put the absolute path of your script in the ProcessBuilder constructor: String appDir = "C:\\my\\full\\path\\to\\script.py"; ProcessBuilder pb = new ProcessBuilder("python", appDir); Process p = pb.start(); ....
has comment: http://stackoverflow.com/comment/34096099
accepted answer of: http://stackoverflow.com/q/22421669
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34096759
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34095730
answers question: http://stackoverflow.com/q/22421669
score: 1

http://stackoverflow.com/comment/33950092
type: AnswerComment
comment on: http://stackoverflow.com/a/22330910
type: Comment
has text: @DouglasGrealis: `"...I'm still getting inaccurate results"` -- hm curious. Then please don't accept my answer then since it is incorrect. But do consider creating and posting a [minimal example program](http://stackoverflow.com/help/mcve) (please check the link) if one can be created, so that we can test the issue for ourselves and thereby hopefully come up with a better and correct solution.
score: 2

http://stackoverflow.com/comment/34145010
has text: Can you show the Event class also?
comment on: http://stackoverflow.com/q/22449732
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33972129
type: AnswerComment
comment on: http://stackoverflow.com/a/22335306
has text: But shouldn't my balls preffered size be the size of the ball itself? **BALL_DIAMETER**? Because in this case it doesn't appear.
score: 0
type: Comment

http://stackoverflow.com/a/22381394
type: Answer
has body: try either deleting your slfj dependency entry in your pom, your force the hibernate dependency to exclude it. Hibernate wants to use its own. org.hibernate hibernate-annotations 3.6.10.FINAL org.slf4j slf4j-api compile etc. Add the same exclusions for hibernate-core etc.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22381239
upvote count: 1

http://stackoverflow.com/comment/33947561
type: AnswerComment
has text: Umm, you don't have to escape hyphens in strings.
type: Comment
score: 3
comment on: http://stackoverflow.com/a/22337380

http://stackoverflow.com/comment/34092047
type: Comment
type: QuestionComment
has text: What Java version are you using? If this is valid syntax, it's only valid in later versions of Java (7 or so, I think)
score: 0
comment on: http://stackoverflow.com/q/22420201

http://stackoverflow.com/q/22483507
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8046803
has body: I am trying to create a new Glassfish server instance in my Eclipse Indigo IDE. I have downloaded the additional server adapters. I select New -&gt; Server -&gt; GlassFish -&gt; GlassFish 3.x and click on Next. But nothing happends. Is this a bug and if so, what's the workaround?
has answer: http://stackoverflow.com/a/22517436
score: 1
has title: Installing a new Glassfish server on Eclipse Indigo
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/28137848
tagged with: eclipse
tagged with: glassfish

http://stackoverflow.com/comment/34119645
type: Comment
has text: The stack trace is telling you that org.hibernate.cache.CacheProvider is not found, did you include the libraries properly?
comment on: http://stackoverflow.com/q/22436084
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33954860
has text: Kids. My first computer was a Commodore 64, and I still have it. Get off my lawn!
type: QuestionComment
comment on: http://stackoverflow.com/q/22339917
type: Comment
score: 0

http://stackoverflow.com/a/22363882
has body: The short answer is that this is not directly possible. To execute commands on a remote machine, you need to have an application running on the remote machine that serves as a listener - waiting for commands that come through. This is what selenium-server-standalone basically achieves (and beyond that it then kickstarts the tests). Hence, the easiest way to do this would be to start selenium-server manually or as a workaround, you can execute a script at a preset time (I execute an ant build as an alarm on a Mac). Either way you look at it, you need a server which provides SSH running on the remote machine for you to establish a connection for your application on the hub to kickstart something in the node. My workaround for this was to set up an alarm (on a Mac - you can find similar scripts for Windows) to run an ant task at a certain time which will start the server. The server is started about two minutes before the actual tests are run to give the server time to register with the node.
answers question: http://stackoverflow.com/q/22362235
score: 0
type: Answer

http://stackoverflow.com/comment/33939493
comment on: http://stackoverflow.com/q/22329727
has text: is my calculation wrong in the method to get the biggest number in the if statment
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22430455
tagged with: java
type: Question
has title: What Is Wrong With My Coding
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34109849
has body: When I run the analize it on comes back with one error in the manafest android name = is not public but when i build it says built with no error but when i run it on my emu and my tablet it crashes i can not figure this out please help. This is my code with names omitted. activity_main.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="com.xxxx.xxxx.app.MainActivity" android:background="@drawable/appbackground"&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/facebook" android:id="@+id/button1" android:background="@drawable/facebook" android:clickable="true" android:enabled="true" android:gravity="end" android:width="50dp" android:layout_alignParentTop="true" android:layout_alignRight="@+id/button3" android:layout_alignEnd="@+id/button3" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/dealer" android:id="@+id/button2" android:enabled="true" android:background="@drawable/dealer" android:clickable="true" android:layout_alignParentTop="true" android:layout_alignLeft="@+id/button4" android:layout_alignStart="@+id/button4" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/map" android:id="@+id/button3" android:enabled="true" android:clickable="true" android:background="@drawable/google_navigation" android:layout_below="@+id/button1" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginTop="29dp" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_…
tagged with: android
has answer: http://stackoverflow.com/a/22430522
accepted answer: http://stackoverflow.com/a/22430522
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34110117

http://stackoverflow.com/comment/39376330
comment on: http://stackoverflow.com/a/23447044
score: 0
type: AnswerComment
has text: but this is to ssh 2 different machines separately but i want to ssh from machine 1 to 2 then from 2 to 3 and also execute some basic commands in any of the machines
type: Comment

http://stackoverflow.com/a/22368811
has comment: http://stackoverflow.com/comment/34029452
has comment: http://stackoverflow.com/comment/34005366
has comment: http://stackoverflow.com/comment/34030379
type: Answer
has body: Typically you get a Web container such as Tomcat and then you create an HTML page with a form that submits to a Java Servlet that you create. You can get a lot fancier with JSPs or JSF but a plain Servlet based application should get you started.
has comment: http://stackoverflow.com/comment/34015706
upvote count: 1
has comment: http://stackoverflow.com/comment/34031865
has comment: http://stackoverflow.com/comment/34019101
score: 1
accepted answer of: http://stackoverflow.com/q/22368730
has comment: http://stackoverflow.com/comment/34033473
has comment: http://stackoverflow.com/comment/34004436
has comment: http://stackoverflow.com/comment/34028980
answers question: http://stackoverflow.com/q/22368730
has comment: http://stackoverflow.com/comment/34037893
has comment: http://stackoverflow.com/comment/34023368
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22339041
has body: I just added the constructor Building and I thought everything would work fine, but I'm getting an error on line 43. When I create the object, Building b = new Building();, it says I need to have a double and int in the argument, so I did as it said, but I just keep getting more errors. What am I doing wrong? // This program lets the user design the area and stories of a building multiple times // Author: Noah Davidson // Date: February 20, 2014 import java.util.*; public class Building // Class begins { static Scanner console = new Scanner(System.in); double area; // Attributes of a building int floors; public Building(double squarefootage, int stories) { area = squarefootage; floors = stories; } void get_squarefootage() // User enters the area of floor { System.out.println("Please enter the square footage of the floor."); area = console.nextDouble(); } void get_stories() // The user enters the amount of floors in the building { System.out.println("Please enter the number of floors in the building."); floors = console.nextInt(); } void get_info() // This function prints outs the variables of the building { System.out.println("The area is: " + area + " feet squared"); System.out.println("The number of stories in the building: " + floors + " levels"); } public static void main(String[] args) // Main starts { char ans; // Allows for char do{ // 'do/while' loop starts so user can reiterate // the program as many times as they desire Building b = new Building(); // Creates the object b b.get_squarefootage(); // Calls the user to enter the area b.get_stories(); // Calls the user to enter the floors System.out.println("---------------"); b.get_info(); // Displays the variables System.out.println("Would you like to repeat this program? (Y/N)"); ans = console.next().charAt(0); // The user enters either Y or y until // they wish to exit the program } while(ans == 'Y' || ans == 'y'); // Test of do/while loop } }
score: 8
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/44294526
has comment: http://stackoverflow.com/comment/33950740
tagged with: java
has answer: http://stackoverflow.com/a/22339068
has answer: http://stackoverflow.com/a/22339156
answer count: 2
has comment: http://stackoverflow.com/comment/33950577
downvote count: 0
possible better answer: http://stackoverflow.com/a/22339156
favorite count: 0
upvote count: 8
accepted answer: http://stackoverflow.com/a/22339068
has title: Java error: constructor in class cannot be applied to given types

http://stackoverflow.com/q/22469499
has answer: http://stackoverflow.com/a/35579228
favorite count: 0
linked to: http://stackoverflow.com/q/13672487
upvote count: 2
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34180229
has answer: http://stackoverflow.com/a/65675217
tagged with: java
type: Question
has title: How to start a fragment when preference clicked
answer count: 2
has body: I want start a fragment on clicking a preference item. Refer below: &lt;PreferenceSreen android:key="zd_pref" android:summary="@string/zd_summary_no" android:title="@string/zd_platform" &gt; &lt;intent android:action="com.example.prefs.PREFS_ONE" android:targetClass="com.android.settings.bussiness.AuthCertifyConfirm" android:targetPackage="com.example.settings" /&gt; &lt;/PreferenceSreen&gt; &lt;PreferenceSreen android:key="hw_pref" android:summary="@string/hw_summary" android:title="@string/hw_platform" &gt; &lt;intent android:action="com.example.prefs.PREFS_ONE" android:targetClass="com.android.settings.bussiness.AuthCertifyConfirm" android:targetPackage="com.example.settings" /&gt; &lt;/PreferenceSreen&gt; The AuthCertifyConfirm is a fragment, public class AuthCertifyConfirm extends Fragment {} BUT, this method caused error, when click the preference. The errors: E/AndroidRuntime(28027): FATAL EXCEPTION: main E/AndroidRuntime(28027): android.view.InflateException: Binary XML file line #21: Error inflating class PreferenceSreen E/AndroidRuntime(28027): at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:441) E/AndroidRuntime(28027): at android.preference.GenericInflater.rInflate(GenericInflater.java:481) E/AndroidRuntime(28027): at android.preference.GenericInflater.inflate(GenericInflater.java:326) E/AndroidRuntime(28027): at android.preference.GenericInflater.inflate(GenericInflater.java:263) E/AndroidRuntime(28027): at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:269) E/AndroidRuntime(28027): at android.preference.PreferenceFragment.addPreferencesFromResource(PreferenceFragment.java:285) E/AndroidRuntime(28027): at com.android.settings.bussiness.BussinessSettings.onCreate(BussinessSettings.java:78) E/AndroidRuntime(28027): at android.app.Fragment.performCreate(Fragment.java:1673) E/AndroidRuntime(28027): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:854) E/AndroidRuntime(28027): a…
score: 2
downvote count: 0

http://stackoverflow.com/a/22373070
has comment: http://stackoverflow.com/comment/34010479
upvote count: 2
has comment: http://stackoverflow.com/comment/34013352
has comment: http://stackoverflow.com/comment/34010488
has comment: http://stackoverflow.com/comment/34012747
has body: You have not quoted the city value: start n=node(*) MATCH n-[:LIVES_IN]-&gt;city where city.city=dhaka return n.name should be start n=node(*) MATCH n-[:LIVES_IN]-&gt;city where city.city='dhaka' return n.name Also, please use parameters: start n=node(*) MATCH n-[:LIVES_IN]-&gt;city where city.city={city} return n.name http://docs.neo4j.org/chunked/stable/tutorials-cypher-parameters-java.html EDIT Since you've modified your query, from Michael's comment, try Map&lt;String,Object&gt; params=new HashMap&lt;String,Object&gt;(); params.put("city_name","dhaka"); result=engine.execute("MATCH (city:City {city:{city_name})&lt;-[:LIVES_IN]-(person) RETURN person",params); Iterator&lt;Node&gt; n_column = result.columnAs( "person" ); Create an index on City before that: CREATE INDEX ON :City(city) (http://docs.neo4j.org/chunked/stable/query-schema-index.html) Please also go through the following learning material: The online training course: http://www.neo4j.org/learn/online_course The manual: http://docs.neo4j.org/chunked/stable/ Learn Cypher: http://www.neo4j.org/tracks/cypher_track_start
has comment: http://stackoverflow.com/comment/34009674
type: Answer
has comment: http://stackoverflow.com/comment/34010153
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22372991

http://stackoverflow.com/comment/34061331
comment on: http://stackoverflow.com/a/22402463
score: 0
type: Comment
has text: GC, DB queries, Hibernate statistics, Application Log, System Log, Heap memory looks OK, only I come to doubt state is thread dump with Waiting On Condition and Parked are large.
type: AnswerComment

http://stackoverflow.com/comment/34188037
type: QuestionComment
has text: Don't see the link with the template,I don't think the error come from there but I also added it
comment on: http://stackoverflow.com/q/22474200
score: 0
type: Comment

http://stackoverflow.com/comment/33937796
has text: You can't do that. Change your code to not modify the set concurrently. In particular, note that collections are not thread-safe.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22331840

http://stackoverflow.com/comment/34133560
comment on: http://stackoverflow.com/a/22443340
score: 0
type: Comment
has text: Here lies the answer I suppose : http://stackoverflow.com/questions/2457538/several-requests-from-one-httpurlconnection
type: AnswerComment

http://stackoverflow.com/q/22376140
has body: i solve problem when i make simple code one by hand and 2nd with GUI builder NetBeans and that created with Netbeans doesnt work that way i want. on attached screenshot is how my app looks.http://postimg.org/image/6c00csqjn/ it work when i switch tabs,equation in MathML will render with JEuclid library in case when i write the code handly. but when i do the same in NetBeans, do gui with builder and write render code to action events generated with netbeans, then the code doesnt work and nothing render. please can somebody tell me where is bug? in NetBeans i found only that Netbeans is using .addTab to JTabbedPane and not .add as do I. app code is bellow. thank you for any answer import java.awt.BorderLayout; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSpinner; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.event.ChangeEvent; import net.sourceforge.jeuclid.swing.JMathComponent; public class MathMLTabbed extends JFrame{ private JTextArea formulaSource; private JPanel drawingArea, editorArea; private JSpinner spinner; private JTabbedPane zalozky; public MathMLTabbed() { this.setTitle("MathML Example"); this.setSize(500, 500); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); Container content = getContentPane(); this.formulaSource = new JTextArea(); editorArea = new JPanel(); editorArea.setLayout(new BorderLayout()); editorArea.add(new JScrollPane(this.formulaSource),BorderLayout.CENTER); editorArea.add(spinner = new JSpinner(),BorderLayout.NORTH); spinner.setValue(18); drawingArea = new JPanel(); zalozky = new JTabbedPane(); zalozky.addTab("MathML vstup", editorArea); zalozky.addTab("Vzorec", new JScrollPane(drawingArea)); content.add(zalozky); zalozky.addChangeListener(new javax.swing.event.ChangeListener() { @Override public void stateChanged(ChangeEvent e) { if(zalozky.getSelectedIndex() == 0) drawingArea.removeAll(); if(zalo…
tagged with: netbeans
tagged with: java
has title: JTabbedPane what difference between addTab and add
type: Question
score: 0
answer count: 1
tagged with: user-interface
tagged with: jtabbedpane
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/34019382
has answer: http://stackoverflow.com/a/22376363

http://stackoverflow.com/comment/33976867
has text: possible duplicate of [Java Repeated output from nested for loop](http://stackoverflow.com/questions/22277928/java-repeated-output-from-nested-for-loop)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22354059
score: 0

http://stackoverflow.com/comment/67061712
score: 0
type: Comment
type: AnswerComment
has text: What is the reason for the error shown above ? Any idea, I am facing the same problem.
comment on: http://stackoverflow.com/a/25147848

http://stackoverflow.com/q/22420234
tagged with: a-star
upvote count: 2
tagged with: java
type: Question
downvote count: 0
has body: I have a svg file which contains a map. Ive written an a* algorithm, which I want to use to path find within this svg map. I was wondering if anyone knows a good way to convert the svg map to a grid map ie 0 0 0 0 1 0 1 0 0 1 1 0 1 0 1 1 ... (0 = open, 1 = wall) for use with a* algorithm. This will be done in Java on Android platform.
favorite count: 0
has title: Converting svg to grid map
type: UnansweredQuestion
tagged with: android
score: 2
answer count: 0

http://stackoverflow.com/comment/34104012
score: 0
type: Comment
has text: It is included in at least the latest version of the support pack. But you any type of Activity would do. E.g. the android.app.Activity. But I think you get android.support.v7.app.ActionBarActivity by default if you create a new app in eclipse with the latest android tools
type: AnswerComment
comment on: http://stackoverflow.com/a/22427139

http://stackoverflow.com/comment/33980664
type: QuestionComment
has text: Why should have they used `T(T object)`? That's a constructor. And name of the class is `Gen`.
comment on: http://stackoverflow.com/q/22356417
score: 4
type: Comment

http://stackoverflow.com/a/22438087
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34123726
type: Answer
has body: Optimize your loop as : for (int i = 0; i &lt; num1; ++i) { if( i == 0 ) //i.e. first time str = ""; str += "*"; } txtdept1record.setText(str); //outside :-) But this is not recommended, so use StringBuilder StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; num1; ++i) { sb.append("*"); } txtdept1record.setText(str); //outside :-) Your (foolproof) code: ... else if(e.getSource()==btnView){ int num1 = Integer.parseInt(txtdept1.getText()); int num2 = Integer.parseInt(txtdept2.getText()); int num3 = Integer.parseInt(txtdept3.getText()); int num4 = Integer.parseInt(txtdept4.getText()); StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; num1; ++i) { sb.append("*"); } txtdept1record.setText(sb.toString()); sb = new StringBuilder(); //empty it. //Same thing (i'll show once) for (int i = 0; i &lt; num1; ++i) { sb.append("*"); } txtdept2record.setText(sb.toString()); ...
has comment: http://stackoverflow.com/comment/34123117
has comment: http://stackoverflow.com/comment/34123136
answers question: http://stackoverflow.com/q/22437959
has comment: http://stackoverflow.com/comment/34123425
has comment: http://stackoverflow.com/comment/34123307
accepted answer of: http://stackoverflow.com/q/22437959
score: 0
has comment: http://stackoverflow.com/comment/34123317

http://stackoverflow.com/comment/34031303
type: QuestionComment
has text: If it is ok for you to leave spring out of the game, I can suggest a couple of configurable DS components that have the same functionality: DataSource, TransactionHelper, Transaction aware connection pool
comment on: http://stackoverflow.com/q/22381205
score: 0
type: Comment

http://stackoverflow.com/comment/34155042
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22379685
has text: yet there is a problem: the last leg is done with a jump and not smoothly. how can I change this?

http://stackoverflow.com/a/24178458
answers question: http://stackoverflow.com/q/22430731
type: AcceptedAnswer
downvote count: 0
score: 9
type: Answer
has body: This solved my problem from https://stackoverflow.com/a/19320065/619673 I added this code for my activity because I was using theme "NO TITLE" for Activity. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if ( keyCode == KeyEvent.KEYCODE_MENU ) { // do nothing return true; } return super.onKeyDown(keyCode, event); }
accepted answer of: http://stackoverflow.com/q/22430731
upvote count: 9

http://stackoverflow.com/q/22487282
tagged with: google-maps-android-api-2
type: UnansweredQuestion
tagged with: android
has body: Trying to implement google map API in my android project and getting the warning error that is under my java code GoogleMap gMap; gMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); LatLng Jamaica = new LatLng(18.1155173, -77.2760026); gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(Jamaica, 13)); gMap.addMarker(new MarkerOptions() .title("Jamaica") .snippet("The greatest country in the world") .position(Jamaica)); gMap.setMyLocationEnabled(true); Logcat: 03-18 12:45:00.140: W/ActivityThread(10477): ClassLoader.loadClass: The class loader returned by Thread.getContextClassLoader() may fail for processes that host multiple applications. You should explicitly specify a context class loader. For example: Thread.setContextClassLoader(getClass().getClassLoader());
downvote count: 0
score: 1
tagged with: java
has title: Unable to create Google map fragment
has answer: http://stackoverflow.com/a/23904694
type: Question
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22488048
favorite count: 0

http://stackoverflow.com/a/22366652
has body: The View crono is null. Initialise your view and then call setText: crono.setText("Test" + millisUntilFinished / 1000);
type: Answer
answers question: http://stackoverflow.com/q/22366283
accepted answer of: http://stackoverflow.com/q/22366283
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/22469534
has comment: http://stackoverflow.com/comment/34179211
has comment: http://stackoverflow.com/comment/34179433
has answer: http://stackoverflow.com/a/22470148
score: 0
has comment: http://stackoverflow.com/comment/34179296
has comment: http://stackoverflow.com/comment/34179415
has comment: http://stackoverflow.com/comment/34179974
answer count: 1
has comment: http://stackoverflow.com/comment/34179425
has comment: http://stackoverflow.com/comment/34179388
has body: The goal of this program is to check how many times an integer appears consecutively in a given file. The program prompts the user for the file and then reads the file. This file is called "integers.txt" and the program is supposed to keep track of which number appears for the longest consecutive run. I'm having issues with the program not considering two numbers consecutive due to the way java tokenizes things. The program doesn't consider two numbers consecutive if there is a tab between them in the given file, although it is supposed to. To add to that, if there are multiple runs of consecutive numbers with the same length of consecutive numbers that appear, it will print out all of the multiple runs. It is supposed to print only the first occurrence, but must also run through the rest of the program to make sure that there aren't any other runs that have a longer length. If it didn't have to check for any longer runs, then I'd be able to stop the code after getting what I needed. Not allowed to use arrays in my code. Issues Consecutive numbers are only being considered consecutive if they are not separated by a tab/line (fixed) Can't keep track of the longest consecutive run that appears first. Gets replaced by whatever run comes next. (fixed) Question Why isn't the program seeing consecutive numbers that are separated by a line and/or tab(s) as consecutive? How do I fix this? Also, if there are two runs of the same length (i.e. how there are four 5's and four 3's), how do I only print out the first run and still make sure it is the longest? The issue I would have right now is that it would print out saying there are four 5's and also four 3's. INPUT FILE (Integers.txt) 12 2 3 3 98 23 4 4 4 5 5 5 5 21 21 21 -3 -3 -1 2 3 3 3 3 1 3 3 3 Program that checks runs import java.util.*; import java.io.*; public class LongRun { public static void main(String[] args) throws FileNotFoundException { Scanner console = new Scanner(System.in); Scanner input = getInput(console);…
has title: Check to see how many times a number appears consecutively from user-specified input file
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22470148

http://stackoverflow.com/a/22431679
has body: If I understand what you are looking for, something like this should work, public static void inputStats(Scanner input) throws FileNotFoundException { int numLines = 0; int numwords = 0; String longest = ""; String maxLine = ""; while (input.hasNextLine()) { String nextLine = input.nextLine(); nextLine = (nextLine != null) ? nextLine .trim() : ""; if (nextLine.length() &gt; maxLine.length()) { maxLine = nextLine; } StringTokenizer st = new StringTokenizer( nextLine); while (st.hasMoreTokens()) { String token = st.nextToken(); token = (token != null) ? token.trim() : ""; if (token.length() == 0) { continue; } numwords++; if (token.length() &gt; longest.length()) { longest = token; } } numLines++; }// end of while System.out.print("Line " + numLines + " has "); System.out.print(numwords + "tokens "); System.out.println("(longest = " // + longest + ")"); }// end of method
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22431621

http://stackoverflow.com/q/22342800
upvote count: 0
has comment: http://stackoverflow.com/comment/33957236
favorite count: 0
has body: This is my code snippet: static String filepath = "test.txt"; public static void main(String[] args) throws IOException { try{ BufferedReader reader = new BufferedReader(new FileReader(filepath)); String l = reader.readLine(); System.out.println(l); }catch (FileNotFoundException e){ System.out.println(e); } catch(IOException e){ System.out.println(e); } java.io.FileNotFoundException: test.txt (No such file or directory) This is the exception I am getting. What file path should I use? I put the text file in the bin folder. I am running Eclipse on Ubuntu, it that matters.
type: UnansweredQuestion
tagged with: java
tagged with: file
downvote count: 1
has title: BufferedReader file not found
type: Question
score: -1
tagged with: ubuntu
tagged with: eclipse
has answer: http://stackoverflow.com/a/22342817
answer count: 2
has comment: http://stackoverflow.com/comment/33957231
has answer: http://stackoverflow.com/a/22342837

http://stackoverflow.com/q/22386012
possible better answer: http://stackoverflow.com/a/22386061
answer count: 2
has answer: http://stackoverflow.com/a/22386061
has title: Synchronized block inside synchronized block
downvote count: 0
has comment: http://stackoverflow.com/comment/34032071
tagged with: synchronization
accepted answer: http://stackoverflow.com/a/22386041
favorite count: 0
has comment: http://stackoverflow.com/comment/42012607
tagged with: multithreading
has body: May I include a synchronized block inside another one for synchronizing another object? Example: synchronized(myObjetc1){ // code synchronized(myObjetc2){ // code } } If so, still, is it a correct technique or is it too risky?
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22386041

http://stackoverflow.com/q/22462309
score: 0
accepted answer: http://stackoverflow.com/a/22463037
has comment: http://stackoverflow.com/comment/34167126
answer count: 1
type: AnsweredQuestion
tagged with: opengl
has answer: http://stackoverflow.com/a/22463037
tagged with: java
tagged with: lwjgl
has body: First, I'll start with my code because I've identified which block is causing the issue. // init GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 0, 600, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_TEXTURE_2D); // BEGINNING OF OFFENDING CODE BufferedImage image = ImageIO.read(new File("res/button.png")); int[] pixels = new int[image.getWidth() * image.getHeight()]; image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth()); IntBuffer buffer = BufferUtils.createIntBuffer(pixels.length); for (int pixel : pixels) buffer.put(pixel); buffer.flip(); int button = GL11.glGenTextures(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, button); //Setup wrap mode GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer); // END OF OFFENDING CODE This is what things are supposed to look like without the textured quad. This is what happens when I render with the offending code (with the textured quad). This is what happens when I render with the offending code (without the textured quad). For reference, this is the texture I can't seem to figure out which GL11 call is affecting the rest of the Display and why it would be affecting the rest of the display. From what I understand, all of the calls that follow GL11.glBindTexture are limited to the bound texture, aren't they? Edit: Additional Rendering Code private static void renderQuad(int x, int y, int width, int height) { GL11.glPushMatrix(); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(x, y); GL11.glVertex2f(x + width, y); GL11.glVertex2f(x + w…
has comment: http://stackoverflow.com/comment/34166364
has title: Textured Quad issue in Java OpenGL
has comment: http://stackoverflow.com/comment/34166468
type: Question
has comment: http://stackoverflow.com/comment/34166745

http://stackoverflow.com/a/22337516
has comment: http://stackoverflow.com/comment/33947948
upvote count: 4
has body: The code posted is a valid and accepted approach (although, do re-use the same PRNG..). The most plausible explanation of the behavior that I can think of, is that the values are not what are expected. For instance, the following will always yield 20. int min = 20; int max = 20; return randomGenerator.nextInt(max - min + 1) + min; Replacing the values yields nextInt(1) + 20, where nextInt(1) always returns 0 as Random.nextInt(n) returns an integer in the range [0,n). Some other causes .. (debugging is about developing and testing hypothesis) Perhaps, randomGenerator is not Random and is just broken. class FairRandom { public int nextInt(int n) { return 0; /* chosen by fair dice roll */ } } } Or, perhaps, a random number is being generated correctly, and the "always 20" value comes from elsewhere. Or, perhaps, the random number generator is being re-seeded before each call to nextInt and you are very unlucky that the seed results in 20 being chosen "randomly". Or, perhaps, you're listening to @JasonC and playing havoc with all my assumptions ;-)
downvote count: 0
has comment: http://stackoverflow.com/comment/33947973
has comment: http://stackoverflow.com/comment/33947830
score: 4
accepted answer of: http://stackoverflow.com/q/22337318
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22337318
type: Answer

http://stackoverflow.com/a/22337454
upvote count: 2
has comment: http://stackoverflow.com/comment/33948195
downvote count: 1
answers question: http://stackoverflow.com/q/22337318
score: 1
has comment: http://stackoverflow.com/comment/33947915
type: Answer
has body: Your random number generation code is fine. The most reasonable explanation for what you are seeing is that getMaxDamage() is actually returning 20 instead of 30. I suggest adding some temporary print-outs to inspect those values, or running it in a debugger, as well as examining the getMaxDamage() code for errors. Other explanations include an extremely unlucky presence of neutrinos / cosmic rays causing bit flips in CPU registers that happen to result in 20 being calculated every time, or perhaps the Intergalactic Council of Zero Entropy deemed your actions to have too high a risk of exposing the usefulness of random numbers and overwrote your memory of debugging your software with a memory of seeing 20 to help their larger goal of spreading anti-random propaganda throughout the universe.

http://stackoverflow.com/comment/33978912
comment on: http://stackoverflow.com/a/22355052
type: AnswerComment
type: Comment
score: 1
has text: Spelling error on `paingComponent` in second paragraph. Wish I could +2 for good answer and then the extra advice given.

http://stackoverflow.com/a/52269483
has body: Here is explanation of equivalent JPA Criteria Query of SELECT * from calls where TIMESTAMPDIFF(SECOND, setup, released) &lt; 3600; First you have to create unit expression and extend it from BasicFunctionExpression for which take "SECOND" parameter as a unit and override its rendor(RenderingContext renderingContext) method only. import java.io.Serializable; import org.hibernate.query.criteria.internal.CriteriaBuilderImpl; import org.hibernate.query.criteria.internal.compile.RenderingContext; import org.hibernate.query.criteria.internal.expression.function.BasicFunctionExpression; public class UnitExpression extends BasicFunctionExpression&lt;String&gt; implements Serializable { public UnitExpression(CriteriaBuilderImpl criteriaBuilder, Class&lt;String&gt; javaType, String functionName) { super(criteriaBuilder, javaType, functionName); } @Override public String render(RenderingContext renderingContext) { return getFunctionName(); } } then you use this unit expression in your JPA criteria Query. EntityManager entityManager = emProvider.get(); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); Root&lt;Calls&gt; thingyRoot = query.from(Calls.class); Expression&lt;String&gt; second = new UnitExpression(null, String.class, "SECOND"); Expression&lt;Integer&gt; timeInSec = cb.function( "TIMESTAMPDIFF", Integer.class, second , root.&lt;Timestamp&gt;get("setup"), root.&lt;Timestamp&gt;get("release")); List&lt;Predicate&gt; conditions = new ArrayList&lt;&gt;(); conditions.add(cb.lessThan(timeInSec, 3600)); cq.where(conditions.toArray(new Predicate[]{})); return session.createQuery(cq); It is working.
upvote count: 5
has comment: http://stackoverflow.com/comment/91486325
score: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22412234

http://stackoverflow.com/q/22442247
has comment: http://stackoverflow.com/comment/34156455
tagged with: google-cloud-datastore
downvote count: 0
answer count: 1
favorite count: 0
tagged with: shell
has body: I've followed this tutorial. I notice that I need to set DATASTORE_SERVICE_ACCOUNT, DATASTORE_PRIVATE_KEY_FILE environment variables in order to configure the credential. I wonder, is there other way to configure the credential without the need to set the environment variables? If there is no other way, Could any one help me to know how I can read these variables from the user and then set them programmatically from java? (I don't want to use the shell, I need to set them using codes) (Note:I'm using mac). Any help will be appreciated..
has comment: http://stackoverflow.com/comment/34194514
has comment: http://stackoverflow.com/comment/34158473
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/22479031
type: Question
linked to: http://stackoverflow.com/q/318239
score: 1
tagged with: java
has title: setting environment variables to configure Datastore credentials from java

http://stackoverflow.com/q/22425310
tagged with: android-layout
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/32660046
has title: Can't get text from editText Android
has answer: http://stackoverflow.com/a/32660046
score: 0
has answer: http://stackoverflow.com/a/22425681
has body: I'm having some issues with my school project. I can't get the text from the textbox. I searched for a solution but nothing found.. I'll be grateful if somebody help me :) So here is my Java code: package com.src.vicnote; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.content.Context; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.os.Build; public class NewNoteActivity extends ActionBarActivity { Button saveButton; EditText textData; Context context; String text; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new_note); saveButton = (Button) this.findViewById(R.id.buttonSave); saveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub textData = (EditText) findViewById(R.id.editText); text = textData.getText().toString(); //text = "this is sparta!"; Log.d("ADebugTag", "string: \"" + text + "\" end of note text"); new SaveClass(text/*, context.getApplicationContext()*/); } }); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.new_note, 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.…
tagged with: android
has answer: http://stackoverflow.com/a/22433450
accepted answer: http://stackoverflow.com/a/22433450
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/76916553
tagged with: import
type: Question

http://stackoverflow.com/comment/34130235
comment on: http://stackoverflow.com/a/22434490
has text: Agreed answer for my question was Flyweight, I was not thinking eight yesterday night as I pointed out to Radiodef.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22413555
has body: You make an instance variable. You need to make it 'visible'. Also where is your startsWith method? Make sure you are passing the correct parameters. pseudo code class SomeClass { var1 &lt; THIS IS an instance method accessible to any method in that class method1 { var2 } method2 { something.doSomeMethodOn(var2) &lt;&lt;&lt;&lt;&lt; THIS is NOT accessible something.doSomeMethodON(var1)&lt;&lt;&lt; THIS IS! }
answers question: http://stackoverflow.com/q/22413375
score: 0
has comment: http://stackoverflow.com/comment/34080171
type: Answer

http://stackoverflow.com/comment/33987602
has text: Wouldn't it be easier to use the `split()` method instead?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22360245
type: QuestionComment

http://stackoverflow.com/a/28282965
upvote count: 4
downvote count: 0
score: 4
has body: Assuming you or anyone else still requires this, you can do the following. Using Java, after you have computed your keypoints you can do the following using the Features2d class in OpenCV. // draw keypoints on image Mat outputImage = new Mat(); // Your image, keypoints, and output image Features2d.drawKeypoints(image, keypoints, outputImage); String filename = "keypoints.jpg"; System.out.println(String.format("Writing %s...", filename)); Highgui.imwrite(filename, outputImage);
type: Answer
answers question: http://stackoverflow.com/q/22416739

http://stackoverflow.com/q/22380119
has answer: http://stackoverflow.com/a/66305895
has body: This is my first Spring Boot code. Unfortunately, it always shuts down. I was expecting it to run continuously so that my web client can get some data from the browser. package hello; import org.springframework.boot.*; import org.springframework.boot.autoconfigure.*; import org.springframework.stereotype.*; import org.springframework.web.bind.annotation.*; @Controller @EnableAutoConfiguration public class SampleController { @RequestMapping("/") @ResponseBody String home() { return "Hello World!"; } public static void main(String[] args) throws Exception { SpringApplication.run(SampleController.class, args); } } [@localhost initial]$ java -jar build/libs/gs-spring-boot-0.1.0.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.0.0.RC4) 2014-03-13 09:20:24.805 INFO 14650 --- [ main] hello.SampleController : Starting SampleController on localhost.localdomain with PID 14650 (/home/xxx/dev/gs-spring-boot/initial/build/libs/gs-spring-boot-0.1.0.jar started by xxx) 2014-03-13 09:20:25.002 INFO 14650 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@b9eec: startup date [Thu Mar 13 09:20:24 EDT 2014]; root of context hierarchy 2014-03-13 09:20:28.833 INFO 14650 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Registering beans for JMX exposure on startup 2014-03-13 09:20:30.148 INFO 14650 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0 2014-03-13 09:20:30.154 INFO 14650 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed bean 'requestMappingEndpoint': registering with JMX server as MBean [org.springframework.boot:type=Endpoint,name=requestMappingEndpoint] 2014-03-13 09:20:30.316 INFO 14650 --- [ main] o.s.b.a.e.jmx.EndpointMBeanExporter : Located managed …
has answer: http://stackoverflow.com/a/73351234
has answer: http://stackoverflow.com/a/22409655
has answer: http://stackoverflow.com/a/49372950
tagged with: java
score: 291
has answer: http://stackoverflow.com/a/47293212
has answer: http://stackoverflow.com/a/59628203
upvote count: 291
has comment: http://stackoverflow.com/comment/34027473
has comment: http://stackoverflow.com/comment/34026479
has answer: http://stackoverflow.com/a/44009328
has answer: http://stackoverflow.com/a/52421266
has comment: http://stackoverflow.com/comment/34028808
type: Question
has answer: http://stackoverflow.com/a/49427779
has answer: http://stackoverflow.com/a/46274214
accepted answer: http://stackoverflow.com/a/22409655
tagged with: spring-boot
has answer: http://stackoverflow.com/a/75091647
has comment: http://stackoverflow.com/comment/34023655
has answer: http://stackoverflow.com/a/73688907
has comment: http://stackoverflow.com/comment/34038678
linked to: http://stackoverflow.com/q/24214224
possible better answer: http://stackoverflow.com/a/43118630
has answer: http://stackoverflow.com/a/43118630
has answer: http://stackoverflow.com/a/67599468
has answer: http://stackoverflow.com/a/64194593
has title: Why does my Spring Boot App always shutdown immediately after starting?
has answer: http://stackoverflow.com/a/41322976
has answer: http://stackoverflow.com/a/57077292
has comment: http://stackoverflow.com/comment/34029304
downvote count: 0
answer count: 24
favorite count: 0
has answer: http://stackoverflow.com/a/65050293
has answer: http://stackoverflow.com/a/63221558
has answer: http://stackoverflow.com/a/77111988
has comment: http://stackoverflow.com/comment/34037388
has answer: http://stackoverflow.com/a/65702342
has comment: http://stackoverflow.com/comment/83997223
tagged with: spring
has answer: http://stackoverflow.com/a/53897990
has comment: http://stackoverflow.com/comment/34028366
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/64085393
has answer: http://stackoverflow.com/a/76190162

http://stackoverflow.com/comment/34191458
has text: for a Start `C /= A is equivalent to C = C / A` similar for `C +=A`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22476905

http://stackoverflow.com/a/22422152
answers question: http://stackoverflow.com/q/22422092
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34095061
type: Answer
has body: In Java 8: public static void main(final String[] args) throws Exception { final Path path = Paths.get("path", "to", "my", "document"); Files.lines(path).map((l) -&gt; l.split("\t")).forEach((s) -&gt; { System.out.println("doc id " + s[0]); System.out.println("word id " + s[1]); }); } More seriously, you can just split on tab: public static void read_doc_word(final String line){ final String[] split = line.split("\t"); final String doc_id = split[0] ; final String word_id = split[1] ; System.out.println("doc id " + doc_id ) ; System.out.println("word id " + word_id ) ; } It is also worth noting that you should never do String concatenation in a loop. This is amazingly slow. So even if there wasn't a String.split method your method could still be improved upon.
score: 1

http://stackoverflow.com/comment/34154150
type: QuestionComment
has text: Your problem: com.mobIce.digicoin.digitalcoin.MainActivity.populateListView(MainActivity.java:50)
type: Comment
comment on: http://stackoverflow.com/q/22455662
score: 0

http://stackoverflow.com/a/22351037
answers question: http://stackoverflow.com/q/22350139
score: 0
type: AcceptedAnswer
has body: Actually, the question is not very clear. If you want to find all &lt;div&gt; element following current element that doesn't have child element &lt;h3&gt;, you can use XPath expression below : /following-sibling::div[not(h3)] But if you want to find only the first &lt;div&gt; element after current element has that criteria, you can try as follow : /following-sibling::div[1][not(h3)]
accepted answer of: http://stackoverflow.com/q/22350139
type: Answer
has comment: http://stackoverflow.com/comment/33972088
has comment: http://stackoverflow.com/comment/33973472
has comment: http://stackoverflow.com/comment/33971654

http://stackoverflow.com/comment/139743754
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/79242631
type: Comment
has text: This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/36588393)

http://stackoverflow.com/a/72739312
has body: Instancio is a data generation library for unit tests that does what you are looking. E.g. if you need a random string of certain length: Foo foo = Instancio.of(Foo.class) .generate(field("fooString"), gen -> gen.string().length(10)) .create(); To generate a random predictable values, you can supply a seed: Foo foo = Instancio.of(Foo.class) .generate(field("fooString"), gen -> gen.string().length(10)) .withSeed(123) .create(); Or if you use JUnit 5: @ExtendWith(InstancioExtension.class) class ExampleTest{ @Seed(1234) @Test void example { Foo foo = Instancio.of(Foo.class) .generate(field("fooString"), gen -> gen.string().length(10)) .create(); // ... } } If you need predictable data always, you can configure a global seed value through a properties file. This way you won't need to specify it in the code. https://github.com/instancio/instancio/
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22459613

http://stackoverflow.com/q/22351542
possible better answer: http://stackoverflow.com/a/61677866
has answer: http://stackoverflow.com/a/74698553
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22358911
score: 16
type: Question
has title: Maven: exclude dependency from shade plugin
upvote count: 16
has answer: http://stackoverflow.com/a/61677866
has body: I've seen next string after mvn clean install Including com.sun.jersey.contribs:jersey-multipart:jar:1.5 in the shaded jar Problem: I can't make it not shaded even I've added exlusion for maven-shade-plugin (see code below) My maven-shade-plugin: org.apache.maven.plugins maven-shade-plugin 2.1 package shade *:* META-INF/*.SF META-INF/*.DSA META-INF/*.RSA //Here ==> com.sun.jersey.contribs:jersey-multipart:jar Main 123 META-INF/spring.handlers META-INF/spring.schemas
answer count: 3
tagged with: packaging
favorite count: 0
accepted answer: http://stackoverflow.com/a/22358911
tagged with: maven

http://stackoverflow.com/q/22417875
tagged with: java
has body: Hi I am trying to use a external project i got from github(AccordionWidgetDemoActivity) as library in my application. I made the project as library in eclipse adt and addeed the same library in my application. I have also added the application in the project buildpath. however I am getting the following errror when i try to launch the application *[2014-03-15 05:19:35 - Sample] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY [2014-03-15 05:19:35 - Sample] Please check logcat output for more details. [2014-03-15 05:19:35 - Sample] Launch canceled!* In Log cat I am getting the following errro ** *> Package com.example.sample requires unavailable shared library com.sentaca.android.accordion; failing!* ** I have added the library in android manifest as follows as package name in src folder in the library project i have googled around and everythhing refers to google maps. I am a beginner in android and Request help Thanks in advance
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/22418892
score: 0
answer count: 1
has title: package unavilable shared library failing android
type: UnansweredQuestion
tagged with: android-library
tagged with: android

http://stackoverflow.com/q/22452785
has comment: http://stackoverflow.com/comment/34152545
answer count: 1
has comment: http://stackoverflow.com/comment/34150709
has body: Assume a java class without source code available, we just have the .class file. The class implements JDK's Comparable interface. I want to know programmatically which fields/getters the compareTo method accesses. Using asm bytecode library I want to get a list of all getters or field accesses called within a certain method. Are there any code examples available?
tagged with: java-bytecode-asm
type: AnsweredQuestion
has title: code example for bytecode inspection using asm
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22473499
accepted answer: http://stackoverflow.com/a/22473499
score: 0

http://stackoverflow.com/comment/33992004
comment on: http://stackoverflow.com/q/22362261
type: Comment
type: QuestionComment
has text: @Raedwald: Not entirely. The question is probably not to review this code but how to work with arrays (a large number of variables). In that sense it's a technical question.
score: 1

http://stackoverflow.com/a/22478481
type: Answer
accepted answer of: http://stackoverflow.com/q/22478260
has comment: http://stackoverflow.com/comment/34194632
has body: I suspect that it is thrown by aggregate functions in your SQL. AFAIR by default SQL will define a variable to hold an aggregate function result to be the same type as the parameter of this function. You may want to redefine it as greater precision/size variables in your SQL.
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22478260
has comment: http://stackoverflow.com/comment/34193691

http://stackoverflow.com/q/22406493
has answer: http://stackoverflow.com/a/22406572
score: 0
has comment: http://stackoverflow.com/comment/34066966
has body: I am new to Android. I am trying to make a simple app that creates a Pie Chart. I have 2 activities, one is MainActivity and the other is PieChart, both extending Activity, and I have a MyView class which extends View. In the MainActivity I have a button which is bound to a onClick event (set as a android:onClick="createPieChart" Button XML attribute) and when I click on it a function called 'creaTorta()' should change the activity and create the pie chart. here is the MainActivity.java: public class MainActivity extends Activity { private View vista; public void creaPieChart(View myView){ Intent viewPieChart = new Intent(this.getApplicationContext(), PieChart.class); startActivity(viewPieChart); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); vista= (View)findViewById(R.id.viewtorta1); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } } Here is the PieChart activity: public class PieChart extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); Log.d("Point", "Here I am!"); setContentView(R.layout.activity_la_torta); Log.d("Point", "Here I am again!"); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.la_torta, menu); return true; } } And here is the MyView.java: public class MyView extends View { private float cx=0,cy=0; private RectF r = new RectF(100,100,430,430); private float valori[] = {10,20,10,30,25,5}; private Paint p,ct; public MyView(Context context) { super(context); p=new Paint(); p.setAntiAlias(true); ct=new Paint(); ct.setAntiAlias(true); } protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawColor(Color.BLACK); float degStart=0,x,y; int i=0; ct.setColor(Color.argb(255, 255, 255, 255)); for (float count : valori){ float de…
answer count: 1
tagged with: android-activity
accepted answer: http://stackoverflow.com/a/22406572
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34066953
tagged with: java
type: Question
has title: Android Java | InflateException error inflating class when I call setContentView()

http://stackoverflow.com/comment/33988332
comment on: http://stackoverflow.com/a/22360415
type: AnswerComment
has text: Awesome! Glad to be of some help.
score: 0
type: Comment

http://stackoverflow.com/comment/34026722
has text: From the `setVolumeControlStream` documentation: _"It is not guaranteed that the hardware volume controls will always change this stream's volume (for example, if a call is in progress, its stream's volume may be changed instead)"_. By changing the mode to `MODE_IN_COMMUNICATION` you're probably causing the audio framework (specifically, the `AudioService`) to select `STREAM_VOICE_CALL` as the stream to change the volume for, rather than the stream you specified (`STREAM_MUSIC`).
type: Comment
comment on: http://stackoverflow.com/q/22373395
score: 0
type: QuestionComment

http://stackoverflow.com/q/22468640
has title: How StringRedisTemplate use redis zcard method?
type: Question
score: 0
answer count: 1
has body: How would I properly use the StringRedisTemplate method in this following program? public void put(StringRedisTemplate template, final Object key, final Object value ) { template.execute(new RedisCallback&lt;Object&gt;() { public Object doInRedis(RedisConnection connection) throws DataAccessException { connection.zCard((byte[]) key); connection.exec(); return null; } } ); }
tagged with: redis
has answer: http://stackoverflow.com/a/22471561
accepted answer: http://stackoverflow.com/a/22471561
type: AnsweredQuestion
tagged with: java
tagged with: spring-data

http://stackoverflow.com/comment/34289118
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22485710
type: Comment
has text: my error in my code is gone but now, after I debuged my app on my Phone there are lots of errors and after i clicked the button i become a force close. My Debug window tells me that there is an error with doinbackground. I post my log: 03-20 13:19:42.453: E/AndroidRuntime(26652): FATAL EXCEPTION: AsyncTask #1 `03-20 13:19:42.453: E/AndroidRuntime(26652): Process: com.example.test2, PID: 26652 03-20 13:19:42.453: E/AndroidRuntime(26652): java.lang.RuntimeException: An error occured while executing doInBackground()` @chris

http://stackoverflow.com/comment/34176947
comment on: http://stackoverflow.com/a/22468159
type: AnswerComment
score: 0
type: Comment
has text: Oh, sorry. That was a typo on my side. I guess I was two or third words ahead in my thoughts :-). I've corrected it.

http://stackoverflow.com/q/22398281
favorite count: 0
has answer: http://stackoverflow.com/a/22398400
accepted answer: http://stackoverflow.com/a/22398400
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
has body: i need to convert my ArrayList&lt;Map&lt;String, String&gt;&gt; object to the JSONArray ArrayList&lt;Map&lt;String, String&gt;&gt; dataList = new ArrayList&lt;Map&lt;String, String&gt;&gt;(); //I tried this JSONArray jsonArray = new JSONArray(dataList); // I am importing (java-json.jar) for converting ArrayList to JSONArray // But i can't put this array in to JqGrid in my jsp page it's does not give me any output
tagged with: arraylist
has title: Convert ArrayList<Map<String, String>> to jsonArray
has comment: http://stackoverflow.com/comment/34053368
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/34009847
score: 0
comment on: http://stackoverflow.com/q/22348256
type: Comment
type: QuestionComment
has text: I was using 3.0.3Release version of spring. What version are you all using? Hopefully I don't have to upgrade to version 4. That would not be good solution to just get jquery grid working.

http://stackoverflow.com/a/22336685
has body: You should be able to better performance by recognizing that as the window slides from one index to the next, the only difference between one sum and the next sum is that exactly one item is added and exactly one item is subtracted. You don't need to re-compute the sum in a j for loop in each iteration of the i for loop. Compute the initial sum of the first window numbers first, which will take care of i being 0. Then in each iteration of the i loop, starting at 1, add in to the sum the value at index window + i and subtract out the value at index i. This will improve the performance, especially for high values of window.
accepted answer of: http://stackoverflow.com/q/22336560
upvote count: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22336560
score: 5

http://stackoverflow.com/q/22348128
tagged with: xpath
type: UnansweredQuestion
tagged with: namespaces
tagged with: java
has answer: http://stackoverflow.com/a/22349809
has title: setNamespaceContext for default namespace
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22349327
linked to: http://stackoverflow.com/q/6390339
has body: I have xml as follows. And a default namespace http://september.examples.com/ for addnumber,firstnumber,secondnumber XML: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> 10 22 </soapenv:Body> </soapenv:Envelope> When I try to get value from Xpath using the following code factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(new InputSource(new StringReader(xml))); XPathFactory xpathFactory = XPathFactory.newInstance(); XPath xpath = xpathFactory.newXPath(); xpath.setNamespaceContext(createContext(xml)); String value = xpath.compile("/soapenv:Envelope[1]/soapenv:Body[1]/addnumber[1]/firstnumber[1]").evaluate(document).toString(); I'm geting empty value. Since the Xpath I have given here is empty namespace of addnumber[1]/firstnumber[1] How can I give xpath of default namespace? Note:createContext() will crate a map which would contain prefix, URI
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/34005353
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22370482
has text: checkout [`SimpleDateFormat`](http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html)
type: Comment

http://stackoverflow.com/comment/33949691
has text: I am trying to post the code I have on here but it says it is "too long"
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22338116
type: Comment

http://stackoverflow.com/comment/34081149
type: Comment
has text: Well, I'm not actually adding the whole `content` to my `levels` variable. True, I am trying to send the `content` to the class, but didn't think it would be saved. Just process the key details and save 2 ints and 2 strings (level name and file name). However, your answer did help me to reorganize my variables. Moving the `byte[] buffer` as well as the `String[] content` and some other variables outside the loops made the program complete all 37 files. Must try and remember this. Thanks.
comment on: http://stackoverflow.com/a/22411257
type: AnswerComment
score: 0

http://stackoverflow.com/q/22485749
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: internet-explorer
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22486081
has title: InternetExplorerDriver gives strange error when instantiating
has answer: http://stackoverflow.com/a/22486081
has body: I'm getting a strange error when trying to instant InternetExplorerDriver. I've written the following code: public static void main(String[] args) { System.setProperty("webdriver.ie.driver", "C:\\Program Files\\Internet Explorer\\iexplore.exe"); WebDriver driver = new InternetExplorerDriver(); driver.get("http://www.google.com"); } Internet Explorer comes up, set to http://--port=26290 like this: It never ends up going to google as I've coded it to. About ten seconds later, I get this stack trace in the console: (TestBase.main(TestBase.java:358) is the line where I instantiate the driver.) Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '2.40.0', revision: '4c5c0568b004f67810ee41c459549aa4b09c651e', time: '2014-02-19 11:13:01' System info: host: 'LT10387', ip: '192.168.0.82', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_45' Driver info: driver.version: InternetExplorerDriver at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:567) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:218) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:203) at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:193) at org.openqa.selenium.ie.InternetExplorerDriver.&lt;init&gt;(InternetExplorerDriver.java:183) at org.openqa.selenium.ie.InternetExplorerDriver.&lt;init&gt;(InternetExplorerDriver.java:154) at com.gdit.fwa.informant.webui.base.selenium.TestBase.main(TestBase.java:358) Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: '2.40.0', revision: '4c5c0568b004f67810ee41c459549aa4b09c651e', time: '2014-02-19 11:13:01' System info: host: 'LT10387', ip: '192.168.0.82', os.name: 'Windows 7', os.arch: 'amd64',…

http://stackoverflow.com/a/22526590
accepted answer of: http://stackoverflow.com/q/22479461
has comment: http://stackoverflow.com/comment/34436477
type: AcceptedAnswer
has body: Thanks Guys, May be your solutions too will do the trick. Finally what I did is i created a socket program and executed server myself. Then scheduled jenkins to execute the client.(Server in my environment &amp; client in jenkin's environment) When client connects to the server it executes the bat file. Now everything works fine.
score: 0
answers question: http://stackoverflow.com/q/22479461
type: Answer

http://stackoverflow.com/a/22328778
has comment: http://stackoverflow.com/comment/33934638
has comment: http://stackoverflow.com/comment/33933857
answers question: http://stackoverflow.com/q/22328635
has comment: http://stackoverflow.com/comment/33933221
has comment: http://stackoverflow.com/comment/33934357
type: Answer
has comment: http://stackoverflow.com/comment/33933977
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22328635
has comment: http://stackoverflow.com/comment/33933319
has comment: http://stackoverflow.com/comment/33933141
type: AcceptedAnswer
downvote count: 0
has body: You can use this. DateFormat df = DateFormat.getTimeInstance(); df.setTimeZone(TimeZone.getTimeZone("UTC")); String dateutc = df.format(new Date());

http://stackoverflow.com/a/49490656
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/22344356
upvote count: 0
score: -1
has body: Download the jar file using this link: //http://www.onbarcode.com/tutorial/java-barcode-generation.html#1 /* // Select a barcode type to create a Java barcode object Code128 barcode = new Code128(); // Set barcode data text to encode barcode.setData("Barcode-in-Java"); // Set barcode data text to encode barcode.setX(2); // Generate barcode &amp; encode into GIF format barcode.drawBarcode("C://barcode-code128.gif"); // Generate barcode &amp; encode into JPEG format barcode.drawBarcode("C://barcode-code128.jpg"); // Generate barcode &amp; encode into EPS format barcode.drawBarcode2EPS("C://barcode-code128.eps"); // Generate barcode &amp; print into Graphics2D object barcode.drawBarcode("Java Graphics2D object"); */ String path=System.getProperty("user.home") "/Desktop"; String val = "val here" Code39 barcode = new Code39(); barcode.setData(val); barcode.setX(2); barcode.drawBarcode(path "/" NIC ".png");

http://stackoverflow.com/q/22377250
has comment: http://stackoverflow.com/comment/34016723
has comment: http://stackoverflow.com/comment/34016326
type: Question
tagged with: java
linked to: http://stackoverflow.com/q/2889571
has body: I'm learning Java and I have no idea about iterators, I only worked with them in C++. The thing is, I have some classes which are 2 lists of Nodes with a value on them and I need to list them from the smallest to the biggest (1, 3, 4, 5, 5, 6.. They can be strings too but that doesn't matter). The thing is I don't know how to implement an Iterator to go through and print every Node. Here are the classes I have: interface Conjunt&lt;T&gt; { // Descripcio general: contenidor generic sense elements repetits // Pre : --- // Post: x pertany al conjunt void afegir(T x); // Pre : --- // Post: x no pertany al conjunt void esborrar(T x); // Pre : --- // Post: diu si x pertany al conjunt boolean pertany(T x); } ConjuntLlista public class ConjuntLlista&lt;T&gt; implements Conjunt&lt;T&gt; { // Descripcio general: conjunt implementat en forma de llista de nodes encadenats protected Node primer; // Primer node de la llista class Node { // Descripcio general: un node de la llista T valor; // Valor dins la llista Node seg; // Seguent node de la llista // Pre : --- // Post: Crea un node amb els valors dels parametres Node(T valor, Node seg) { this.valor = valor; this.seg = seg; } } class Pair { // Descripcio general: tupla de dos nodes Node first; Node second; // Pre : --- // Post: Crea una tupla amb els valors dels parametres Pair(Node first, Node second) { this.first = first; this.second = second; } } // Pre : --- // Post: Crea un conjunt buit public ConjuntLlista() { primer = null; } // Les seguents operacions no cal especificar-les perque ja estan // especificades a la interface. public void afegir(T x) { if (!pertany(x)) primer = new Node(x, primer); } public void esborrar(T x) { Pair p = buscar(x); if (p.second != null) // Hem trobat x if (p.first != null) // x no ocupa la primera posicio p.first.seg = p.second.seg; else primer = p.second.seg; } public boolean pertany(T x) { return buscar(x).second != null; } // Pre : --- // Post: Si el conjunt conte x aleshores retorna un pa…
has answer: http://stackoverflow.com/a/22377450
score: 0
tagged with: iterator
answer count: 2
has answer: http://stackoverflow.com/a/22377504
has comment: http://stackoverflow.com/comment/34016007
linked to: http://stackoverflow.com/q/16000282
type: UnansweredQuestion
has title: Working with iterators, how to use them?
has comment: http://stackoverflow.com/comment/34015972

http://stackoverflow.com/comment/34171092
comment on: http://stackoverflow.com/a/22460007
has text: thanks, but I think OSGi exceeds the needs of this project. Nevertheless, your tips about naming conventions will be quite useful.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22384584
has title: No autogenerated xml file on layout folder and src
has comment: http://stackoverflow.com/comment/34029518
has answer: http://stackoverflow.com/a/22414518
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34030094
accepted answer: http://stackoverflow.com/a/22414518
has answer: http://stackoverflow.com/a/22394092
type: Question
has comment: http://stackoverflow.com/comment/34029444
has comment: http://stackoverflow.com/comment/34029226
tagged with: java
possible better answer: http://stackoverflow.com/a/22394092
has body: Hello I know this is a really simple question to ask but out of my curiosity, by the way I am just starting learning android programming today, I am wondering why is that in my newly created android application project there are no auto generated activity_main.xml on my res->layout folder and in the src folder it is empty unlike in this tutorial that I followed there are auto generated files afterwards creating the android application. Provided is the screenshot of my project:
has comment: http://stackoverflow.com/comment/34029607
has comment: http://stackoverflow.com/comment/34029945
score: 0
has comment: http://stackoverflow.com/comment/34029416
answer count: 2
has comment: http://stackoverflow.com/comment/34030386
has comment: http://stackoverflow.com/comment/34029555
tagged with: android

http://stackoverflow.com/comment/34133625
type: Comment
type: AnswerComment
has text: Hi, without knowing what you were expecting to see at that URL, it's a little hard to say.If it expects a valid session for you to get at the page you want, you will need to authenticate to the URL first - I'm saying this on having no knowledge of the service. There are many methods of using cURL (for example) to authenticate, but it depends on the type of auth being used. Are you trying to get to this using a browser or other client?
score: 0
comment on: http://stackoverflow.com/a/22417869

http://stackoverflow.com/comment/33950581
has text: Do you consider Perl a programming language? :) :)
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22339053

http://stackoverflow.com/comment/90697337
comment on: http://stackoverflow.com/a/22470236
type: Comment
score: 2
type: AnswerComment
has text: FYI, the terribly troublesome old date-time classes such as [`java.util.Date`](https://docs.oracle.com/javase/10/docs/api/java/util/Date.html), [`java.util.Calendar`](https://docs.oracle.com/javase/10/docs/api/java/util/Calendar.html), and `java.text.SimpleDateFormat` are now [legacy](https://en.wikipedia.org/wiki/Legacy_system), supplanted by the [*java.time*](https://docs.oracle.com/javase/10/docs/api/java/time/package-summary.html) classes built into Java 8 and later. See [*Tutorial* by Oracle](https://docs.oracle.com/javase/tutorial/datetime/TOC.html).

http://stackoverflow.com/comment/34136698
score: 6
type: Comment
type: QuestionComment
has text: No, don't do that. It is utterly annoying to look at
comment on: http://stackoverflow.com/q/22445091

instantiation
type: Tag
tags question: http://stackoverflow.com/q/22443940
tag name: instantiation
tags question: http://stackoverflow.com/q/22477007

http://stackoverflow.com/comment/34102180
comment on: http://stackoverflow.com/a/22426303
type: Comment
has text: So it doesn't implicitly iterate?
score: 0
type: AnswerComment

http://stackoverflow.com/q/22461333
has comment: http://stackoverflow.com/comment/34165182
has comment: http://stackoverflow.com/comment/34165837
tagged with: api-design
upvote count: 1
has answer: http://stackoverflow.com/a/22462416
has comment: http://stackoverflow.com/comment/34165328
tagged with: fluent
has comment: http://stackoverflow.com/comment/34165637
has title: Fluent Builder/DSL in Java by Example
favorite count: 0
has answer: http://stackoverflow.com/a/22462713
answer count: 3
has body: I have a Java app where I need to represent a simple arithmetic expression as a tree. The operations I will be supporting include unary (!, unary negation, etc.), binary (+, -, *, /) and even tertiary (custom functions) operations. As such I've selected the DefaultMutableTreeNode as the structure to represents my math tree, because these trees can have 0+ child nodes. For instance, the expression: 3 + 4 * someFunc(2, 6, 9) would be represented as the following tree: * / \ / \ / \ + someFunc / \ /|\ / \ / | \ 3 4 2 6 9 This is because of operator precedence (multiplication trumps addition and the someFunc method must resolve to a value before it can be an argument to the root multiplication). Anyways, I need a way to programmatically-build up these trees easily, and would like to use a Java DSL (Fluent Builder pattern) to accomplish this. For the nodes: public abstract class MathNode { } public abstract class OperatorNode extends MathNode { } public class Addition extends OperatorNode { // Same for Multiplication, SomeFunc, and every other supported operator. } public class Number extends MathNode { // 3, 4, 2, 6, 9, etc. } Then, I might be able to have a fluent builder/DSL like so: // Uses DefaultMutableTreeNode for internal structure. MathTreeBuilder treeBuilder = new MathTreeBuilder(); treeBuilder.multiply() .add(3,4) .someFunc(2,6,9); MathTree tree = treeBuilder.build(); However I'm having a tough time seeing the "forest" through the "trees" here. Do I need a builder at all, or can I just accomplish the same by having the DSL be apart of MathTree itself? What would the DSL look like - am I on track or have I misunderstood the use of the fluent builder pattern? And, most importantly, in each of the different DSL methods (add(), multiply(), someFunc(), etc.), how do I actually go about modifying the DefaultMutableTreeNode to accurately represent the tree?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22462655
downvote count: 0
has comment: http://stackoverflow.com/comment/34165497
tagged with: dsl
has comment: http://stackoverflow.com/comment/34166020
type: Question
has comment: http://stackoverflow.com/comment/34165442
tagged with: tree
has comment: http://stackoverflow.com/comment/34165528
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34165409

http://stackoverflow.com/comment/34041139
comment on: http://stackoverflow.com/a/22390988
has text: @user3417347 please add your stacktrace when you compile with the line you use to compile it.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34093482
type: QuestionComment
has text: Well, sorry it's my bad. I wasn't aware of a built in PriorityQueue class so I will adjust my question right now.
score: 0
comment on: http://stackoverflow.com/q/22421023
type: Comment

http://stackoverflow.com/q/22470985
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/65231206
tagged with: reflection
tagged with: java
has answer: http://stackoverflow.com/a/22471048
score: 46
upvote count: 47
has body: What is the difference between Integer.class, Integer.TYPE and int.class? acc to me Integer.class is a reference of Integer (Wrapper) Class object but what is then int.class as int is not a class, it's a primitive type. And what does Integer.TYPE refer to?
favorite count: 0
has answer: http://stackoverflow.com/a/22471301
possible better answer: http://stackoverflow.com/a/22471247
accepted answer: http://stackoverflow.com/a/22471301
has answer: http://stackoverflow.com/a/22471247
answer count: 5
tagged with: primitive
has title: Integer.class vs int.class
downvote count: 1
has answer: http://stackoverflow.com/a/22471019

http://stackoverflow.com/q/22440097
possible better answer: http://stackoverflow.com/a/22440281
tagged with: github
has comment: http://stackoverflow.com/comment/34127178
favorite count: 0
accepted answer: http://stackoverflow.com/a/22440182
has title: Java directory structure on github
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34127431
downvote count: 1
has comment: http://stackoverflow.com/comment/34127085
has body: My bin directory is currently being untracked; however, I would like that to be part of the repo as it contains the binary file to execute the program. On the other hand, the build directory is being tracked, which I do not want. How can I add the bin directory and remove the build directory?
tagged with: git
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/22440281
answer count: 2
has answer: http://stackoverflow.com/a/22440182
upvote count: 0
has comment: http://stackoverflow.com/comment/34127000

http://stackoverflow.com/q/22336989
has answer: http://stackoverflow.com/a/22337043
has answer: http://stackoverflow.com/a/22337032
score: 5
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33946902
has body: I have never come across such expression in Java. It is not even a switch case //no code above to make it look like a switch case or loop abc: { // do some stuff break abc; } Do you have any idea what this does?
possible better answer: http://stackoverflow.com/a/22337032
has comment: http://stackoverflow.com/comment/33947132
favorite count: 0
accepted answer: http://stackoverflow.com/a/22337043
has comment: http://stackoverflow.com/comment/33947005
has comment: http://stackoverflow.com/comment/33946904
type: AnsweredQuestion
tagged with: syntax
has title: What does statement "abc: {..}" mean?
has answer: http://stackoverflow.com/a/22337037
has comment: http://stackoverflow.com/comment/33947013
linked to: http://stackoverflow.com/q/14147821
type: Question
upvote count: 5
tagged with: java
duplicate of: http://stackoverflow.com/q/14147821

http://stackoverflow.com/q/22384663
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/34030164
type: Question
has comment: http://stackoverflow.com/comment/34029980
has title: How to detect if class is injectable
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22385225
has body: I am using Java Reflection to initialize different types of objects. All of these objects are constructed the same way (namely, I pass in the same values to construct them). Thus, my injector looks through each of the fields, and does a long if/else statement like the following: if (Foo.class.isAssignableFrom(field.getType()) return new Foo(values); else if (Bar.class.isAssignableFrom(field.getType()) return new Bar(values); else if...//Continue over and over I can't define an interface that requires the class to have a factory, because factories are static by nature. The same holds true for extending an abstract class. Is there some way I can remove the above if/else statement so my injecting class has no idea about the classes that need injecting (besides the fact that it can be constructed with values?
possible better answer: http://stackoverflow.com/a/22385051
accepted answer: http://stackoverflow.com/a/22385225
has answer: http://stackoverflow.com/a/22385051
type: AnsweredQuestion

http://stackoverflow.com/comment/33936309
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22330866
has text: I do not understand what you're asking, you might use a Map; but that isn't really different from what you have shown here.

http://stackoverflow.com/comment/34046477
type: QuestionComment
score: 6
has text: Are you familiar with the [`jar` command?](http://docs.oracle.com/javase/tutorial/deployment/jar/build.html)
type: Comment
comment on: http://stackoverflow.com/q/22394109

http://stackoverflow.com/comment/34124610
type: Comment
comment on: http://stackoverflow.com/a/22438588
has text: Hmm, I was hoping to more general way of doing this, for example, if I want to override build action, I cannot use this. Also, will this work if I want to have the code before actual deletion? eg. I want to save resources before removing them from workspace (not file system).
score: 0
type: AnswerComment

http://stackoverflow.com/q/22376536
linked to: http://stackoverflow.com/q/415403
has answer: http://stackoverflow.com/a/22376642
downvote count: 0
has title: what are the differences between the various ways to instantiate JAVA_HOME in ubuntu
tagged with: ubuntu
favorite count: 0
tagged with: linux
has answer: http://stackoverflow.com/a/22376640
answer count: 4
type: UnansweredQuestion
tagged with: java-home
upvote count: 1
has answer: http://stackoverflow.com/a/22376684
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22376615
has body: There are various ways to set the JAVA_HOME variable in ubuntu , simply write the following lines: JAVA_HOME = / usr/lib/jvm/java-...... export JAVA_HOME etc ... but what's the DIFFERENCE if these commands are added: 1] in /etc/profile.d/java.sh 2] in .Profile Or another way.

http://stackoverflow.com/q/22411041
type: Question
has body: I am trying to determine differences between two images during an integration test. After doing some research on the web, I stumbled over the MarvinProject and tried to create a UnitTest with it, see below. As far as I understood the plugin DifferentRegions, it will fill the passed ImageMask differenceMask with the regions that contain the differences. The two images I pass for the test do differ, so it should print out something. Unfortunately it does not. I have written other tests that compare those two images byte-wise and those succeed. For those who want to try the problem, I have created a repository on GitHub and here is the ImageCompareTest. @Test public void tryMarvinProject() { // init images String root = "src/test/resources/"; MarvinImage assertedImg = MarvinImageIO.loadImage(root + "image1.bmp"); MarvinImage actualImg = MarvinImageIO.loadImage(root + "image2.bmp"); // init diff-regions plugin DifferentRegions regions = new DifferentRegions(); regions.load(); regions.setAttribute("comparisonImage", assertedImg); int width = assertedImg.getWidth(); int height = assertedImg.getHeight(); int type = assertedImg.getType(); // process the images and retrieve differences from the ImageMask MarvinImageMask differenceMask = new MarvinImageMask(); regions.process( actualImg, new MarvinImage(new BufferedImage(width, height, type)), new MarvinAttributes(), differenceMask, false); // should contain the differences, but does not System.out.println(differenceMask.getMaskArray()); assertNotNull(differenceMask.getMaskArray()); }
score: 4
upvote count: 4
downvote count: 0
answer count: 1
has title: Compare images with MarvinFramework
favorite count: 0
has answer: http://stackoverflow.com/a/22426261
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22426261
tagged with: java
tagged with: image-processing
tagged with: marvinproject

http://stackoverflow.com/comment/34052917
score: 0
comment on: http://stackoverflow.com/q/22355660
type: Comment
type: QuestionComment
has text: All submenus will automatically open up when mouse pointer hovers on a menu item(If this menu item was the parent of the submenu). Right click on **Navigator or Package view** then hover the mouse pointer on **New** menu item, you will see the submenu with different menu item like **Project..**, **Example..**, **Other..** etc. This submenu will disappear on moving the mouse pointer to other menu items. To understand your question clearly, add the screen shots(you can upload the screen-shot here http://postimg.org and share link)

http://stackoverflow.com/q/22385322
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22385688
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34030983
favorite count: 0
has body: I have always use java Generics with existing collections API and know that it provide compile time type safety. But I am confused with using wildcard or Bounded type parameters in my classes . Could someone clarify what is the pros of using these when compiler type Erasure actually replaces it with base types. Why should not we direct code to base classes As an example from java tutorial (http://docs.oracle.com/javase/tutorial/java/generics/genMethods.html) You can write a generic method to draw different shapes: public static &lt;T extends Shape&gt; void draw(T shape) { /* ... */ } The Java compiler replaces T with Shape: public static void draw(Shape shape) { /* ... */ } So Why we should not write directly to take Shape parameter, what is benefit of using wildcard or Bounded type?
has comment: http://stackoverflow.com/comment/34031166
tagged with: generics
has comment: http://stackoverflow.com/comment/34030657
accepted answer: http://stackoverflow.com/a/22385688
has title: What are the usage wildcard or Bounded type parameters in Java Generics?
upvote count: 2
linked to: http://stackoverflow.com/q/2723397
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34030612
possible better answer: http://stackoverflow.com/a/22385583
tagged with: java
linked to: http://stackoverflow.com/q/3486689
has answer: http://stackoverflow.com/a/22385583

http://stackoverflow.com/comment/34200590
type: Comment
comment on: http://stackoverflow.com/a/22479900
type: AnswerComment
score: 0
has text: Is there a record that matches both conditions?

http://stackoverflow.com/comment/34093257
comment on: http://stackoverflow.com/q/22420741
score: 0
type: QuestionComment
type: Comment
has text: yes it is 100% capable of blocking connection { resource: http://stackoverflow.com/questions/11302705/will-a-firewall-block-local-tcp-communication-between-processes }

http://stackoverflow.com/comment/34043457
comment on: http://stackoverflow.com/q/22360910
has text: yeah.. i fixed it.. will update the code
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22451820
downvote count: 0
score: 1
has body: For future use: After elcodedocle's answer I modified a little bit the layout size details. Now it works: The fixed main's code: public static void main(String[] args) { final JFrame frameMain = new JFrame(){ @Override public Dimension getPreferredSize() { Dimension prefDim = super.getPreferredSize(); prefDim.width = 600; return prefDim; } }; JPanel pnlMain = new JPanel(); JTextArea txtAreaLeft = new JTextArea(getLoremIpsumString(), 10, 15); JTextArea txtAreaRight = new JTextArea(getLoremIpsumString(), 10, 15); JTextArea txtAreaBottom = new JTextArea(getLoremIpsumString(), 5, 15); txtAreaLeft.setWrapStyleWord(true); txtAreaRight.setWrapStyleWord(true); txtAreaBottom.setWrapStyleWord(true); txtAreaLeft.setLineWrap(true); txtAreaRight.setLineWrap(true); txtAreaBottom.setLineWrap(true); txtAreaLeft.setEditable(false); txtAreaRight.setEditable(false); txtAreaBottom.setEditable(false); GroupLayout layout = new GroupLayout(pnlMain); pnlMain.setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setAutoCreateGaps(true); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(txtAreaLeft, 1, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(txtAreaRight, 1, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) ) .addComponent(txtAreaBottom, 1, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(txtAreaLeft) .addComponent(txtAreaRight) ) .addComponent(txtAreaBottom) ); txtAreaLeft.setBackground(txtAreaLeft.getParent().getBackground()); txtAreaRight.setBackground(txtAreaRight.getParent().getBackground()); txtAreaBottom.setBackground(txtAreaBottom.getParent().getBackground()); frameMain.setContentPane(pnlMain); frameMain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frameMain.pack(); frameMain.setVisible(true); }
upvote count: 1
answers question: http://stackoverflow.com/q/22450884
type: Answer

http://stackoverflow.com/q/22389322
has body: I have a Java application which I cannot launch All error message of the type: illegal start of type HashMap&lt;String, Double&gt; simScoreTable = new HashMap&lt;&gt;(); ^ illegal start of type HashMap&lt;String, Double&gt; simScoreTable = new HashMap&lt;&gt;(); ^ The project requirements are Jdk 1.7 or higher. My installed version is java version "1.7.0_25" OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2) OpenJDK Server VM (build 23.7-b01, mixed mode) It looks like I have some version problem. I would appreciate if you could show me the problem. javac 1.6.0_27
tagged with: compilation
has comment: http://stackoverflow.com/comment/34038193
has comment: http://stackoverflow.com/comment/34038175
has comment: http://stackoverflow.com/comment/34038294
score: 0
has comment: http://stackoverflow.com/comment/34038342
has comment: http://stackoverflow.com/comment/34038331
answer count: 1
has comment: http://stackoverflow.com/comment/34038237
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34038096
has comment: http://stackoverflow.com/comment/34038085
has title: Java illegal start of type in correct project
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22389494
accepted answer: http://stackoverflow.com/a/22389494

http://stackoverflow.com/q/22399583
type: UnansweredQuestion
score: 3
downvote count: 0
tagged with: voice
tagged with: speech-recognition
favorite count: 0
has comment: http://stackoverflow.com/comment/127934756
type: Question
tagged with: android
has body: we are working on SpeechRecognization class of android framework.Is there any way that we can Set Audio Source for VoiceRecognization of android we have checked documentation of android but so far we dont have any way we can input VOIP call's audio as source to Speech Recognition.Is that possible. ?
has title: Change Audio Source of Android Speech Recognizer
upvote count: 3
tagged with: java
answer count: 0
tagged with: voip

http://stackoverflow.com/comment/34014709
type: AnswerComment
comment on: http://stackoverflow.com/a/22374424
has text: if u r using chrome.press ctrl+shift+i and go to the console and check if u getting any error in ur javascript...probably some error is taking place before the form.submit
type: Comment
score: 1

http://stackoverflow.com/comment/34182483
type: Comment
type: QuestionComment
has text: go through this...http://www.dzone.com/tutorials/java/struts/struts-example/struts-display-tag-table-decorator-example-1.html
score: 0
comment on: http://stackoverflow.com/q/22471384

http://stackoverflow.com/q/22402628
has title: Paint does not get added to JPanel
tagged with: swing
has answer: http://stackoverflow.com/a/22402708
tagged with: java
has answer: http://stackoverflow.com/a/22402793
has body: So I have two classes, one is in charge of creating the JPanel and also overrides paint. The other contains the main and uses this other class. For the sake of ease, I've cut out what isn't involved in graphics. This first one does the JPanel and paint. The second is the main. I apologize for any poor structure or mess, I'm relatively new and I've just been throwing things in to see what works. The stuff in the paint is only a test, it isn't the primary goal. public class PokerTable extends JPanel { private static final int WIDTH = 800; private static final int HEIGHT = WIDTH * 3 / 4; private static final String NAME = "Test"; private JFrame frame = new JFrame(NAME); public PokerTable() { //frame.setMinimumSize(new Dimension(WIDTH,HEIGHT)); //frame.setMaximumSize(new Dimension(WIDTH,HEIGHT)); frame.setPreferredSize(new Dimension(WIDTH,HEIGHT)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setVisible(true); } public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.setBackground(Color.GREEN); g2d.setColor(Color.RED); g2d.fillOval(0, 0, 30, 30); } } This next one does more than call the PokerTable, but I've left the other parts out as they rely on other classes and just print to console. public class Poker{ public static void main(String[]args) { System.out.println("hello"); PokerTable pt = new PokerTable(); pt.repaint(); } Not that I necessarily expected it to work, I've changed the extension on PokerTable to Canvas and JFrame without any luck.
type: Question
tagged with: layout
tagged with: jpanel
score: 0
answer count: 2
tagged with: repaint
type: UnansweredQuestion

http://stackoverflow.com/comment/34066257
comment on: http://stackoverflow.com/a/22353240
type: Comment
has text: Timer is just not the recommended way to do this. There are a number of posts if you look around on SO - [like this one](http://stackoverflow.com/questions/20330355/timertask-or-handler) that explain the disadvantages of using a timer. That's why I provided the handler code. It's the correct way to solve this problem.
score: 0
type: AnswerComment

infinite-scroll
tag name: infinite-scroll
type: Tag
tags question: http://stackoverflow.com/q/22434919

opencv
tags question: http://stackoverflow.com/q/22464503
type: Tag
tags question: http://stackoverflow.com/q/22344626
tags question: http://stackoverflow.com/q/22359384
tags question: http://stackoverflow.com/q/22428448
tags question: http://stackoverflow.com/q/22453435
tags question: http://stackoverflow.com/q/22400530
tags question: http://stackoverflow.com/q/22377093
tags question: http://stackoverflow.com/q/22445350
tags question: http://stackoverflow.com/q/22342088
tags question: http://stackoverflow.com/q/22390131
tag name: opencv
tags question: http://stackoverflow.com/q/22422977
tags question: http://stackoverflow.com/q/22345087
tags question: http://stackoverflow.com/q/22432473
tags question: http://stackoverflow.com/q/22381421
tags question: http://stackoverflow.com/q/22436834
tags question: http://stackoverflow.com/q/22421223
tags question: http://stackoverflow.com/q/22416739
tags question: http://stackoverflow.com/q/22370006
tags question: http://stackoverflow.com/q/22483441
tags question: http://stackoverflow.com/q/22363659

http://stackoverflow.com/comment/34025550
type: Comment
type: QuestionComment
score: 2
has text: There are about a million examples of using flatMap (for Scala at least, and they are basically the same :)) on the internet, have you tried searching? Heres one to start with: http://www.brunton-spall.co.uk/post/2011/12/02/map-map-and-flatmap-in-scala/
comment on: http://stackoverflow.com/q/22382453

http://stackoverflow.com/q/22411781
has answer: http://stackoverflow.com/a/22411860
downvote count: 2
has answer: http://stackoverflow.com/a/22411913
has comment: http://stackoverflow.com/comment/34076841
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/34076788
has body: I have a string which contains the byte array's String value for example like this [B@42031498 I want to retrieve the String content as byte[] ? How can I do that ? PS : converting the string with String.getBytes() method doesn't work . It converts the string but doesn't give me the value as byte array. It works like this. If It's is not possible is there a way to get byte[] from Object in java (and always without converting)
has title: Transform String value to bytearray java
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34093788
has comment: http://stackoverflow.com/comment/34076817
upvote count: 0
has answer: http://stackoverflow.com/a/22411899
tagged with: java
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/34076911
has answer: http://stackoverflow.com/a/22411947
tagged with: casting
accepted answer: http://stackoverflow.com/a/22411913
score: -2
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22411947

http://stackoverflow.com/q/22413347
tagged with: java
has answer: http://stackoverflow.com/a/22413452
has comment: http://stackoverflow.com/comment/34079826
type: Question
has comment: http://stackoverflow.com/comment/34079799
has answer: http://stackoverflow.com/a/22413406
upvote count: 2
answer count: 3
has title: Matching Pipe Character in Java
favorite count: 0
has answer: http://stackoverflow.com/a/22413420
type: UnansweredQuestion
has body: How should I match and replace Pipe character in Java? The following code tried to find and remove "|" from str and it doesn't work. String str = "ABC | DEF | GHI"; Pattern p = Pattern.compile("\\|"); Matcher m = p.matcher(); while (m.find()) { str = str.replaceAll(m.group(), ""); str = str.trim(); }
tagged with: regex
score: 2
downvote count: 0

http://stackoverflow.com/a/22402921
has body: This could make sense if you have Guava as dependency: String yourString = "Word1 \n" + "Word2 \n" + "Word3 Word4 Word5"; String result = Joiner.on(" ").join( Splitter.onPattern("\\s+").split(yourString)); System.out.println(result); See explanation of Splitter/Joiner here
score: 0
answers question: http://stackoverflow.com/q/22402305
type: Answer

http://stackoverflow.com/q/22464022
tagged with: exception
answer count: 4
has answer: http://stackoverflow.com/a/22464156
has answer: http://stackoverflow.com/a/22464298
upvote count: 2
has comment: http://stackoverflow.com/comment/34169404
has title: Handling exceptions in Java application
has answer: http://stackoverflow.com/a/22464138
possible better answer: http://stackoverflow.com/a/22464156
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/409563
tagged with: java
type: Question
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22464138
favorite count: 0
has body: When I throw an exception from the package in which I handle the database, in the package in which I handle the UI, should I throw the same exception or create another? The UI package should know the exceptions of the package which I handle the database?
has answer: http://stackoverflow.com/a/22464308

http://stackoverflow.com/a/22433459
score: 0
answers question: http://stackoverflow.com/q/22423837
type: Answer
has body: I sort out the problem jmethodID cid = (*env)-&gt;GetMethodID(env,class, "&lt;init&gt;", "(CDDIIC)V"); I changed this to jmethodID cid = (*env)-&gt;GetMethodID(env,class, "&lt;init&gt;", "(Ljava/lang/String;DDIILjava/lang/String;)V"); now it is working fine.
has comment: http://stackoverflow.com/comment/34135504

http://stackoverflow.com/comment/33976269
comment on: http://stackoverflow.com/q/22353814
has text: Yes, that is possible
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33981355
score: 1
has text: Try posting an [MCVE](http://stackoverflow.com/help/mcve) instead of your whole program, and edit your post so it asks a more specific question. Recommended reading: http://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html
type: QuestionComment
comment on: http://stackoverflow.com/q/22356743
type: Comment

http://stackoverflow.com/q/22336509
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22336640
has answer: http://stackoverflow.com/a/22336642
tagged with: depth-first-search
upvote count: 4
downvote count: 0
tagged with: breadth-first-search
tagged with: java
type: Question
tagged with: algorithm
score: 4
has title: Farmer, Wolf, Goat and Cabbage Breadth-first and Depth-first Search in Java
tagged with: river-crossing-puzzle
answer count: 2
has body: So, I started this problem where I have to bring a cabbage, wolf, and goat across the river without leaving the cabbage with the goat or the wolf and goat by themselves on the same side. I started and got sorely confused about how to approach this. Basically I was thinking of adding a bunch of vertexes that would lead to the correct outcome, and just have the program demonstrate breadth-first and depth-first searching without having a complex vertices generation process. Am I thinking about this correctly, or is there a better approach? Here is my code for the main method so far. package project3; import java.util.*; import java.io.*; public class Project3 extends Network{ /** * @param args the command line arguments */ public static void main(String[] args) { new Project3().run(); } //main method public void run() { String start ="fwgcR", finish = "Rfwgc"; addVertex(start); addVertex("fwgRc"); addVertex("fwcRg"); addVertex(finish); //Breadth First iterator Iterator&lt;String&gt; itr = network.breadthFirstIterator (start); while (itr.hasNext()) System.out.print (itr.next() + " "); //Depth First Iterator itr = network.depthFirstIterator (start); while (itr.hasNext()) System.out.print (itr.next() + " "); } // method run }
favorite count: 0

http://stackoverflow.com/comment/34067812
has text: I changed my answer ;)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22406619
type: Comment

http://stackoverflow.com/q/22374769
type: Question
answer count: 2
has body: I have to need your advice, code-review or improvement about my multiton pattern implementation. I want to multi-connection support for mongodb server. public class MongoDatabaseFactory { private static volatile Map&lt;String, MongoDatabase&gt; connections = new ConcurrentHashMap&lt;String, MongoDatabase&gt;(); public static MongoDatabase getDatabase(Databases database) throws MongoException { if (null == database) throw new MongoException("Database not found"); if (null == database.name() || database.name().isEmpty()) throw new MongoException("Database not found"); if (!connections.containsKey(database.name()) || null == connections.get(database.name())) { synchronized (database) { if (!connections.containsKey(database.name()) || null == connections.get(database.name())) { connectDB(database); } } } if (!connections.get(database.name()).isAuthenticated()) { synchronized (database) { if (!connections.get(database.name()).isAuthenticated()) { connectDB(database); } } } return connections.get(database.name()); } } What is best practice for multiton pattern?
tagged with: multiton
accepted answer: http://stackoverflow.com/a/22376658
possible better answer: http://stackoverflow.com/a/22375415
has answer: http://stackoverflow.com/a/22375415
score: 0
has comment: http://stackoverflow.com/comment/34012928
tagged with: design-patterns
has answer: http://stackoverflow.com/a/22376658
has title: Side Effects of Multiton Pattern Usage
type: AnsweredQuestion
tagged with: java
tagged with: concurrency
linked to: http://stackoverflow.com/q/11126866

http://stackoverflow.com/comment/34063402
comment on: http://stackoverflow.com/q/22404398
type: QuestionComment
type: Comment
has text: btn_buy is probably declared in fragment_sales ...
score: 0

wifi
tag name: wifi
type: Tag
tags question: http://stackoverflow.com/q/22447282
tags question: http://stackoverflow.com/q/22437752

http://stackoverflow.com/comment/115694794
has text: Can u please answer my question here https://stackoverflow.com/q/65439715/11567530
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22345649

http://stackoverflow.com/comment/34108227
comment on: http://stackoverflow.com/a/22421572
has text: The problem I see with this, is you've potentially changed the state of the application you are testing...possibly invalidating the test...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34088859
type: AnswerComment
comment on: http://stackoverflow.com/a/22418277
has text: I removed everything in the constructor but super(new Rectangle2D.Double(x, y, w, h)); The line: super(new Rectangle2D.Double(x, y, w, h)); will not execute and is throwing the exception.
type: Comment
score: 0

http://stackoverflow.com/comment/34057642
comment on: http://stackoverflow.com/q/22400472
score: 0
type: Comment
has text: Ok, then as I understand the solution I provided should work and give me the correct difference (in case server B is indeed synchronized as mentioned by ThorbjørnRavnAndersen). I'll keep the TZ and DST on a shelf for now;). Thank you all for your help!
type: QuestionComment

http://stackoverflow.com/q/22377485
tagged with: design-patterns
has title: What's the name of this pattern? (reused flyweight)
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34019510
answer count: 1
downvote count: 0
favorite count: 0
has body: For years, I referred to this as flyweight, but looking for a good description of flyweight, I noted that they all said the basic use case was to create a lot of lightweight objects, whereas my motivation is to avoid creating a lot of objects. The pattern is about using one object, or a small number of objects, for sequentially referring to different parts of a larger data structure under the guise of a specific interface. For instance, here is a class for an object that gives me a Number object that refers to parts (one part at a time) of a byte array for its actual data: public final class LittleEndRef extends Number { private byte[] a; private int off; // This is the point: the fields are not finals, set in a constructor, which would require // creating a new object every time I want to address some postion of an array. I reuse the // same object to refer to different positions. (My motivation is to ensure that there is no // overhead from garbage collection, ever.) void setRef(byte[] a, int off) { this.a = a; this.off = off; } public byte byteValue() { return a[off]; } public short shortValue() { return (short)(a[off] | a[off+1]&lt;&lt;8); } public int intValue() { return a[off] | a[off+1]&lt;&lt;8 | a[off+2]&lt;&lt;16 | a[off+3]&lt;&lt;24; } public long longValue() { return a[off] | a[off+1]&lt;&lt;8 | a[off+2]&lt;&lt;16 | a[off+3]&lt;&lt;24 | (long)(a[off+4] | a[off+5]&lt;&lt;8 | a[off+6]&lt;&lt;16 | a[off+7]&lt;&lt;24)&lt;&lt;32; } public float floatValue() { return Float.intBitsToFloat(intValue()); } public double doubleValue() { return Double.longBitsToDouble(longValue()); } } You could say this is an adapter, but it's a special kind of adapter in that it refers to part of a larger storage without duplicating the data, and also that it can be changed to refer to a different part, without creating a new object. Any takes on how I should refer to that pattern?
has comment: http://stackoverflow.com/comment/34019096
has answer: http://stackoverflow.com/a/22378903
type: UnansweredQuestion

http://stackoverflow.com/a/69174358
has body: Continue with @Andrew's answer If we use only Files.move(src, dst, StandardCopyOption.REPLACE_EXISTING); then it will delete source directory because we only provide a directory path not an absolute path of a particular file. So it will also delete a source directory when operation will be done. Let's say source path is /opt/src which contains a csv files and destination path is /opt/dst and I want to move all files from src to dst and I'm using Files.move(src, dst, StandardCopyOption.REPLACE_EXISTING); this then it will move all the files to dst but it will delete a src directory after moving all files because we didn't provide an absolute path of a each file for src as well as dst. We should have to provide src path like /opt/src/foo.csv and dst path like /opt/dst/foo.csv then and then it will not delete a source directory. DirectoryStream used to iterate over the entries in a directory. A directory stream allows for the convenient use of the for-each construct to iterate over a directory. So we get an absolute path for src and we use resolve method for resolving an absolute path for dst. Please refer DirectoryStream for more information.
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/22356585
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34052924
has text: The usual deal, you ask the user for input **then** search the DB (levering indexes) Don't pull the whole DB and search records on java side
score: 0
comment on: http://stackoverflow.com/q/22398008
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22480083
accepted answer of: http://stackoverflow.com/q/22479566
score: 0
type: AcceptedAnswer
type: Answer
has body: A good solution to this would be to store all of your GUI components in an ArrayList or some other sort of List that you may prefer. You would initially read the text file and add it's respective components into the list, and then you would load that list into your GUI. When the file is edited, you can loop through it again and if a component does not exists in the list you can add it in. If any components in the list don't correspond to the file you can remove them from the list. After that happens, you can reload the GUI with the components in the list.
answers question: http://stackoverflow.com/q/22479566
has comment: http://stackoverflow.com/comment/34197541

http://stackoverflow.com/a/22444963
has comment: http://stackoverflow.com/comment/34136443
upvote count: 3
has comment: http://stackoverflow.com/comment/34136857
has comment: http://stackoverflow.com/comment/34136607
downvote count: 0
has body: It is simple, just use input.equals("exit") instead of input != "exit" If you use non-primitive variable (like String), you are storing reference in that variable. Comparing with == means that you are comparing if you are refering to the exactly same object.
has comment: http://stackoverflow.com/comment/34136848
has comment: http://stackoverflow.com/comment/34136630
accepted answer of: http://stackoverflow.com/q/22444956
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22444956
has comment: http://stackoverflow.com/comment/34136502
type: Answer
score: 3

http://stackoverflow.com/comment/34186068
type: Comment
type: QuestionComment
has text: Can you please elaborate on what your specific question is?
comment on: http://stackoverflow.com/q/22473749
score: 0

http://stackoverflow.com/q/22424246
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34099622
downvote count: 0
possible better answer: http://stackoverflow.com/a/22424344
tagged with: mysql
has answer: http://stackoverflow.com/a/22424344
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34099566
answer count: 2
upvote count: 1
favorite count: 0
has body: I'm trying to make a App which can add data into my database.I have a Table which have two columns "Name" and "Points".So I made a PHP file and uploaded into my server : &lt;?php $connection = mysql_connect("mywebhost.example", "user", "password")ordie(mysql_error()); $selection = mysql_select_db("name_of_database", $connection)or die(mysql_error()); $name = $_POST['name']; $points = $_POST['points']; $insert = "INSERT INTO my_table('name','points') VALUES('$name','$points')"; $run = mysql_query($insert)or die(mysql_error()); ?&gt; I uploaded this in ftp://mywebhost.example/android_connect/connect.php Now I tried to connect it with my App like this : public void test_button (View view) { List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("country", country)); try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://mywebhost.example/android_connect/connect.php"); httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } Sooo... When I try to test it my App crashs and gives me this Error : 03-15 12:08:34.409: E/AndroidRuntime(626): FATAL EXCEPTION: main 03-15 12:08:34.409: E/AndroidRuntime(626): java.lang.IllegalStateException: Could not execute method of the activity 03-15 12:08:34.409: E/AndroidRuntime(626): at android.view.View$1.onClick(View.java:3591) 03-15 12:08:34.409: E/AndroidRuntime(626): at android.view.View.performClick(View.java:4084) 03-15 12:08:34.409: E/AndroidRuntime(626): at android.view.View$PerformClick.run(View.java:16966) 03-15 12:08:34.409: E/AndroidRuntime(626): at android.os.Handler.handleCallback(Handler.java:615) 03-15 12:08:34.409: E/AndroidRu…
tagged with: android
has answer: http://stackoverflow.com/a/22424336
accepted answer: http://stackoverflow.com/a/22424336
has title: Working with MySQL & PHP in Android

http://stackoverflow.com/q/22346628
has body: I am working on a project which takes 15 min to build and deploy in local server , My problem is i use to work in grails before this , and i am very use to making changes in controllers/servlets and just refresh the page , changes gets reflected without restarting the server , now i would like something similar for this project which is a Java E Application , we use Ant to build the EAR , any input will be highly appreciated , thanks.
has comment: http://stackoverflow.com/comment/33964370
type: Question
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/22346839
tagged with: ant
tagged with: grails
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33967410
has title: Dynamic changes to server without restarting server
favorite count: 0
has comment: http://stackoverflow.com/comment/33963838
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22346839

http://stackoverflow.com/comment/34022041
type: AnswerComment
comment on: http://stackoverflow.com/a/22380648
score: 0
type: Comment
has text: That's what I thought.

hashset
tags question: http://stackoverflow.com/q/22444255
tags question: http://stackoverflow.com/q/22391350
tags question: http://stackoverflow.com/q/22405235
tags question: http://stackoverflow.com/q/22432741
type: Tag
tags question: http://stackoverflow.com/q/22331840
tag name: hashset

http://stackoverflow.com/q/22337941
answer count: 3
has answer: http://stackoverflow.com/a/22337959
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22338224
has answer: http://stackoverflow.com/a/22338383
tagged with: java
type: Question
has title: User input for an if/else statement
has comment: http://stackoverflow.com/comment/33948748
score: 0
has body: its only my second program with java and im running into some issues. I'm trying to get input from a user, either yes or no, then based on that go to an if else statemene. Heres what I have so far String answer= UI.askString("Do you want to continue?"); if(answer=="yes"){ UI.println("Lets go"); } else if(answer == "no"){ UI.println("Thank you. Goodbye"); } else{ UI.println("Please enter yes or no"); } Im thinking perhaps its better to use booleans for this? Any help is gladly appreciated! (also if you're wondering, its a custom import hence the weird syntax in some lines) Cheers.

http://stackoverflow.com/comment/34010951
has text: thanks. any idea if there's a more efficient way to handle this? +rep btw
comment on: http://stackoverflow.com/q/22373766
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22398315
tagged with: cloud
tagged with: amazon-web-services
tagged with: sdk
has body: I want to create default VPC with all default components(i.e default security group,internet gateway) and components that are needed for an instance launched inside this VPC to communicate to external world say through ssh. I can create such VPCthrough AWS VPC console keeping default option selected but I want to do it through java code using aws-java-sdk. I tried this code private static void createVpc() { System.out.println("Creating VPC.....\n"); CreateVpcRequest newVPC = new CreateVpcRequest(); String cidrBlock = "10.0.0.0/28"; newVPC.setCidrBlock(cidrBlock); CreateVpcResult res = ec2.createVpc(newVPC); Vpc vp = res.getVpc(); vp.setIsDefault(true); String vpcId = vp.getVpcId(); System.out.println("Created VPC"+vpcId); //deleteVpc("vpc-c80418aa"); } but it creates VPC and no other associated components. Please tell what else I need to do or provide sample code steps to build VPC with other components.
has answer: http://stackoverflow.com/a/22416511
answer count: 1
has title: How to create AWS default VPC through aws-java-sdk
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34094358
score: 1
tagged with: java
favorite count: 0
type: Question
upvote count: 1

http://stackoverflow.com/comment/34092064
comment on: http://stackoverflow.com/a/22420218
has text: Then use List if you dont have keys
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34011083
type: Comment
type: QuestionComment
has text: You don't have the need for mocks to test this method; also, I see a bug in it ;)
comment on: http://stackoverflow.com/q/22374049
score: 0

http://stackoverflow.com/comment/33985556
type: QuestionComment
comment on: http://stackoverflow.com/q/22359226
score: 1
has text: What are the values of each of the variables just before that line?
type: Comment

http://stackoverflow.com/comment/65678994
has text: Why don't you just use `Double.compare(this.balance, b.balance)` to compare the balances?
comment on: http://stackoverflow.com/a/39167699
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22340577
has comment: http://stackoverflow.com/comment/33953426
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33953504
has comment: http://stackoverflow.com/comment/33953318
possible better answer: http://stackoverflow.com/a/22340723
has comment: http://stackoverflow.com/comment/33953297
tagged with: java
has comment: http://stackoverflow.com/comment/33953386
type: Question
answer count: 2
has body: So I have 3 classes. base derived1 derived from base derived2 derived from base This code says that derived1 cannot be casted to derived2, even though I already casted derived1 to a base object? base temp = (derived2)((base)derived1); I'm trying to cast derived1 into a derived2 object. And this was the only solution I could come up, is this valid? And is there any other way to achieve this? Thanks!
tagged with: casting
accepted answer: http://stackoverflow.com/a/22340712
has comment: http://stackoverflow.com/comment/33953345
has comment: http://stackoverflow.com/comment/33953332
has comment: http://stackoverflow.com/comment/33953395
has comment: http://stackoverflow.com/comment/33953371
score: 0
has answer: http://stackoverflow.com/a/22340723
has answer: http://stackoverflow.com/a/22340712
has title: Casting derived to base, and then casting that into another derived. Java
has comment: http://stackoverflow.com/comment/33953405
tagged with: downcast

izpack
tag name: izpack
tags question: http://stackoverflow.com/q/22371167
tags question: http://stackoverflow.com/q/22485790
type: Tag

android-contentprovider
tags question: http://stackoverflow.com/q/22475845
tags question: http://stackoverflow.com/q/22423759
tag name: android-contentprovider
type: Tag

http://stackoverflow.com/a/22371578
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/34007508
answers question: http://stackoverflow.com/q/22369868
has comment: http://stackoverflow.com/comment/34007056
has body: It seems that Java cannot connect to the SMTP server mail.supremecluster.com:143 I am guessing that the mail settings you have provided are not the ones for SMTP (SMTP is only for outgoing email messages, IMAP is for receiving messages). Why don't you open Thunderbird and under Account Settings check and see what the settings are in the Outgoing Server (SMTP) item.
has comment: http://stackoverflow.com/comment/34007376
accepted answer of: http://stackoverflow.com/q/22369868
has comment: http://stackoverflow.com/comment/34007447
has comment: http://stackoverflow.com/comment/34007191
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34007018

http://stackoverflow.com/a/22400105
upvote count: 5
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22391347
has comment: http://stackoverflow.com/comment/34188474
score: 5
has body: You should be able to do that by adding the element to the release-plugin configuration. This will only be used for release:perform Mojo. Something like this should do the trick: maven-release-plugin skipTestsForReleasePerform (...) skipTestsForReleasePerform <maven.test.skip>true</maven.test.skip>
has comment: http://stackoverflow.com/comment/78063900
has comment: http://stackoverflow.com/comment/34077257

http://stackoverflow.com/comment/33976518
has text: This did not work, I think the problem is that the android device picks it up as a CordovaActivity, or an App with a webView or something as such, that I don't have much control over. i.e, It would have worked if I was trying to open an HTML page using an Android Browser, this is an app using HTML.
comment on: http://stackoverflow.com/a/22353328
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22422729
downvote count: 0
has comment: http://stackoverflow.com/comment/34096946
has comment: http://stackoverflow.com/comment/34096464
type: Answer
has comment: http://stackoverflow.com/comment/34096712
score: 2
has comment: http://stackoverflow.com/comment/34096512
upvote count: 2
has comment: http://stackoverflow.com/comment/34096382
answers question: http://stackoverflow.com/q/22422695
has body: You have to install the intel atom implementation for the API version of your emulator In the SDK Manager make sure that you have installed Intel x86 Atom system image subitem of the API version of your emulator.
has comment: http://stackoverflow.com/comment/34097445
accepted answer of: http://stackoverflow.com/q/22422695
type: AcceptedAnswer

http://stackoverflow.com/comment/34206672
has text: @codeMagic Sorry about that but most of times warnings are not important.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22485467

http://stackoverflow.com/a/22457328
type: Answer
score: 0
has body: The problem is with your TextWatcher, when you use setText it also invokes a callback on your TextWatcher so as soon as the user types something the TextWatcher goes in an endless loop where he constantly sets the text. To prevent this the simplest although not best solution for all cases would be to use a flag to determine where that text changed callback is coming from. Try something like this: private boolean isUserCallback = true; @Override public void onTextChanged(CharSequence s, int start, int before, int count) { //Toast.makeText(getApplicationContext(), "In onTextChanged() Method", Toast.LENGTH_SHORT).show(); if (s.length() != 0 &amp;&amp; isUserCallback) { switch (et.getId()) { case R.id.etUsername: { } break; case R.id.etPassword: { phone = formatPhoneNumber(phone); Log.i("PHONE", "Phone NUMB IS:"+phone); mPassword.setText(phone); //THE ERROR HAPPENS HERE } } } else { isUserCallback = true; } } Only when isUserCallback is true you react to the callback. If you set the text programatically you just have to set the boolean to false: this.isUserCallback = false; mPassword.setText("asdf"); The isUserCallback flag will reset itself automatically in the callback.
answers question: http://stackoverflow.com/q/22457152

http://stackoverflow.com/q/22464159
tagged with: sdk
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22464336
has body: Just trying to get started. I followed the Google instructions and “Download the SDK ADT Bundle for Windows”. I then followed the next step Install the SDK and Eclipse IDE Unpack the ZIP file (named adt-bundle-.zip) and save it to an appropriate location, such as a "Development" directory in your home directory. Open the adt-bundle-/eclipse/ directory and launch eclipse. When I open the files and try to launch eclipse I get an error: A JRE or JDK must be available for eclipse to run. I have reloaded the Java runtime with no success. Could someone give me a hand?
has title: Android SDK getting started
tagged with: java
has answer: http://stackoverflow.com/a/22464303
type: Question
score: 0
answer count: 2

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/22483189

http://stackoverflow.com/a/22338863
has body: After this.cam.update(); do you do - batch.setProjectionMatrix(this.cam.combined); debugRenderer.setProjectionMatrix(this.cam.combined);
accepted answer of: http://stackoverflow.com/q/22336382
answers question: http://stackoverflow.com/q/22336382
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/22398247
has body: Theoretically Yes. However in practice, There are many projects that work fine on Oracle JDK but not on OpenJDK and vice versa. Since even a simple patch update of your JDK may lead to problems in your system, you have to thoroughly test the compatibility in a test environment first before moving in production.
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22397762
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22397762
type: Answer
score: 4

http://stackoverflow.com/q/22381379
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/22381987
has title: Java: why "\uFFFF" converts to [-17, -65, -65] in UTF-8?
has answer: http://stackoverflow.com/a/22384805
tagged with: java
tagged with: character-encoding
has body: Why does "\uFFFF" (which is apparently 2 bytes long) convert to [-17,-65,-65] in UTF-8 and not [-1,-1]? System.out.println(Arrays.toString("\uFFFF".getBytes(StandardCharsets.UTF_8))); Is this because UTF-8 uses only 6 bits in every byte for codepoints larger than 127?
type: Question
answer count: 2
downvote count: 0
tagged with: unicode
tagged with: utf-8
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34023591

http://stackoverflow.com/comment/34053161
type: Comment
score: 0
type: AnswerComment
has text: string.valueOf(obj) or ""+obj are equivalent, both get the obj.toString() - the latter creates a new instance. Anyway if this was useful you should at least upvote :)
comment on: http://stackoverflow.com/a/22378026

http://stackoverflow.com/comment/33983312
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22356442
has text: Please show the code for your `trait` - I'm assuming that `make` is implemented on the `trait Index`, but it's an assumption and given `Index$class.make` doesn't work could be wrong
score: 0

http://stackoverflow.com/comment/34131420
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22438677
type: Comment
has text: I got 2 on the first block too

http://stackoverflow.com/q/22435735
upvote count: 2
has answer: http://stackoverflow.com/a/22459308
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: javafx
type: Question
accepted answer: http://stackoverflow.com/a/22459308
downvote count: 0
tagged with: javafx-8
answer count: 1
has body: I have the following class ProtokollEvent public class ProtokollEvent extends Event { //variable holds all devices in given protokoll private ObservableList&lt;Device&gt; devicesList; //variable holds SaveResult private SaveResult result; //final ProtokollEvents public static final EventType&lt;ProtokollEvent&gt; PROTOKOLL_SAVE = new EventType(ANY, "PROTOKOLL_SAVE"); public static final EventType&lt;ProtokollEvent&gt; PROTOKOLL_SAVE_DONE = new EventType(ANY, "PROTOKOLL_SAVE_DONE"); public static final EventType&lt;ProtokollEvent&gt; PROTOKOLL_UPDATED = new EventType(ANY, "PROTOKOLL_UPDATED"); public static final EventType&lt;ProtokollEvent&gt; PROTOKOLL_DELETED = new EventType(ANY, "PROTOKOLL_DELETED"); public ProtokollEvent() { this(PROTOKOLL_SAVE); } public ProtokollEvent(EventType&lt;? extends Event&gt; arg0) { super(arg0); } public ProtokollEvent(Object arg0, EventTarget arg1, EventType&lt;? extends Event&gt; arg2) { super(arg0, arg1, arg2); } /** * getDevices will return current {@link Device} as ObservableList * * @return {@link ObservableList} of type {@link Device} */ public ObservableList getDev() { return devicesList; } /** * setDevices will set devicesList * @param devices ObservableList {@link Device} */ public void setDev(ObservableList devices) { this.devicesList = devices; } /** * get the result which is returned from calling saveProtokoll * @return result {@link SaveResult} */ public SaveResult getResult() { return result; } /** * set the result which is returned after calling saveMessprotokoll in RestCall * @param result {@link SaveResult} */ public void setResult(SaveResult result) { this.result = result; } } in the second class public class SaveUtils { private MainWindowController controller; private ObservableList&lt;RowContainerPruefvorschriftController&gt; rows; private Protokoll lastSavedProtokoll; private Protokoll currentSavingProtokoll; public SaveUtils(MainWindowController control){ this.controller = control; } private void startSaving(){ …
has title: fireEvent from Custom class
favorite count: 0
tagged with: javafx-2

http://stackoverflow.com/comment/34140085
comment on: http://stackoverflow.com/q/22447127
type: Comment
type: QuestionComment
has text: What do you want it to do. You're just taking bytes here and writing them out as strings, but I'm not sure what you are really trying to accomplish.
score: 2

http://stackoverflow.com/a/22337443
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33949317
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22336839
has body: Spring application can be configured using java. In that case you dont need application.xml. @Configuration public class AppConfig { @Autowired Environment env; @Bean public MyBean myBean(){ return new MyBean() } } Here @Configuration bean enables the @autowired. Following is another good example on using autowiring http://www.mkyong.com/spring/spring-auto-wiring-beans-with-autowired-annotation/ Hope it helps

http://stackoverflow.com/a/38411085
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22434070
has body: Save the image in every folder of drawable like in xhdpi,xxhdpi,xxxhdpi with respect to thier resolution.

http://stackoverflow.com/comment/34100073
type: AnswerComment
comment on: http://stackoverflow.com/a/22425019
score: 0
has text: can you tell me what is a Class object ?
type: Comment

http://stackoverflow.com/comment/34139555
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22446629
has text: switch statement is actually the same as your boolean idea, compiler turns a switch into an internal function array of jmpTo points. It really takes no memory (he's only ruling out 7 cases of nearby numbers). HashIdea i fear would be pretty slow, though, with a binary search on each number.
type: Comment

http://stackoverflow.com/q/22463465
has answer: http://stackoverflow.com/a/22463524
has body: Can someone help with this? I can get it to run, but after the output message "What is the outside Temperature:" "Number here" Type (C) for Celsius or (F) for Fahrenheit: Once I type in C or F it gives me this error message Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:909) at java.util.Scanner.next(Scanner.java:1530) at java.util.Scanner.nextInt(Scanner.java:2160) at java.util.Scanner.nextInt(Scanner.java:2119) at Tem.main(Tem.java:13) Please Help import java.util.Scanner; public class Tem { public static void main(String [] args) { Scanner scan = new Scanner(System.in); String unit = ""; System.out.print("What is the outside Temperature: "); double temp = scan.nextDouble(); System.out.println("Type (C) for Celsius or (F) for Fahrenheit: "); int input = scan.nextInt(); if (input == 'F') { temp = (temp - 32) * 5/9.0; unit = "Celsius."; } else if (input == 'C') { temp = (temp * 9/5.0) +32; unit = "Fahrenheit."; } System.out.println("It is "+temp+" degrees "+unit); } }
has title: Exception in thread “main” java.util.InputMismatchException "Temperature program"
tagged with: exception
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
tagged with: inputmismatchexception
tagged with: program-entry-point
answer count: 1
has comment: http://stackoverflow.com/comment/34168303

http://stackoverflow.com/a/77582700
score: 0
answers question: http://stackoverflow.com/q/22439177
has body: The problem is that you implemented a more efficient version with StringBuilder than the compiler would. Try while (System.currentTimeMillis() - startTime <= 1000) { character = new StringBuilder(character).append("Y").toString(); } That will give you a similar result to +=. The problem is that the compiler isn't necessarily smart enough to realize that instead of repeatedly casting to StringBuilder and back to String, it could do everything with the same StringBuilder. As others have already noted, using a single StringBuilder is going to be much faster, as it only has to allocate memory occasionally. The += version may still do more optimizations than that one. But it will act more like that than your version. Consider sb = new StringBuilder(); while (System.currentTimeMillis() - startTime <= 1000) { sb.append("Y"); character = sb.toString(); } Almost the same as your version but as slow as creating a new StringBuilder on every iteration. Apparently it's the toString that slows things down.
type: Answer

http://stackoverflow.com/q/22361646
score: 0
has title: global array filled with method result
has comment: http://stackoverflow.com/comment/33991423
has comment: http://stackoverflow.com/comment/33991476
answer count: 1
tagged with: global
has body: I have a global array, not initialized, a method with a loop that returns a tmpArray and should fill myArray, but I'm getting an empty myArray. Not sure what I'm doing wrong or where is the problem. Post edited with myMethod code: global: int myArray[] =null; code sample: myArray [] = myMethod(); private int [] myMethid (int option){ int [] tmpArray = new int[99]; int a=0,b=0; System.out.println( "bla bla bla bla "+option+": \n" + "------------------------------------------------------------------"); for(int i=0;i&lt;99;i++){ System.out.println("bla bla bla bla bla bla "); a = Integer.parseInt(lector.nextLine()); if (a==-1){ menu(); }else{ if (a &gt; 9){ System.out.println("bla bla bla bla bla bla bla bla bla bla "); i--; }else{ i++; tmpArray[i]=a; } System.out.println("bla bla bla bla bla bla "+ a); b = Integer.parseInt(lector.nextLine()); tmpArray[i+1]=b; System.out.println(tmpArray[i] +"x" + otherArray[tmpArray[i+1]]+"\n"); } } System.out.println(Arrays.toString(tmpArray)); return tmpArray; }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33990099
has comment: http://stackoverflow.com/comment/33991302
has comment: http://stackoverflow.com/comment/33991670
tagged with: java
has comment: http://stackoverflow.com/comment/33991544
has answer: http://stackoverflow.com/a/22361674
type: Question
has comment: http://stackoverflow.com/comment/33991685
tagged with: arrays

http://stackoverflow.com/comment/34111609
has text: As i said in the first attempt to read the file it finds and in the second attempts it returns null
comment on: http://stackoverflow.com/a/22431409
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/50970696
upvote count: 4
downvote count: 0
has body: These commands all result in equal YearMonth values: YearMonth.from(localDate) localDate.query(YearMonth.FROM) // ThreeTen localDate.query(YearMonth::from) // JDK 8 YearMonth.of(localDate.getYear(), localDate.getMonth()) YearMonth.of(localDate.getYear(), localDate.getMonthValue())
type: Answer
score: 4
answers question: http://stackoverflow.com/q/22475987

http://stackoverflow.com/comment/34005023
comment on: http://stackoverflow.com/a/22348415
score: 0
has text: The code above is what I have tried to use and I get 'Cannot find anything' error. As I have replaced the mousex with the integer variable I would assume it would reference the ellipse to the integer inside the live data string. What is missing? Possible 'IF' statements?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34079696
type: Comment
comment on: http://stackoverflow.com/q/22413083
has text: No. I requested http://myhost.com/JavaBridge/hello.php. In that page there is a dropdown with predefined languages to choose from. I should not need to request the language in my query string. It should work. It would be defined if PHP would find the Java class path that defines it, and it is not.
score: 0
type: QuestionComment

http://stackoverflow.com/q/22463758
tagged with: imageicon
accepted answer: http://stackoverflow.com/a/22463819
answer count: 1
tagged with: user-interface
favorite count: 0
tagged with: jlabel
tagged with: jframe
type: AnsweredQuestion
has body: I want to display different images in a same frame within a loop. String pathName[] contains the different paths of the images. When running this code, only last image i.e image at path pathname[last] is getting displayed on frame instead I want all images to be displayed in a continuous way (have given delay of 1sec ). Help is appreciated. public void actionPerformed(ActionEvent event) { int i=0; while(i&lt;5){ if(i&gt;0){ Container labelParent = receiverImageLabel.getParent(); labelParent.remove(receiverImageLabel); labelParent.validate(); labelParent.repaint(); } try { imageR = ImageIO.read(new File(pathName[i++])).getScaledInstance(512,512 , BufferedImage.SCALE_SMOOTH); receivedImage = new ImageIcon(imageR); }catch (IOException e) { e.printStackTrace(); } receiverImageLabel = new JLabel(receivedImage); receiverFrame.getContentPane().add(BorderLayout.EAST,receiverImageLabel); receiverFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); receiverFrame.setSize(800,700); receiverFrame.setVisible(true); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }
score: 1
tagged with: java
has title: GUI in JAVA to display different images in a same frame
upvote count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/22463819

http://stackoverflow.com/comment/33989483
comment on: http://stackoverflow.com/a/22360924
has text: No, only the `setTop` method will add to `top`, and only the `setBottom` method will add to `bottom`. The initialization simply creates the empty lists.
score: 0
type: AnswerComment
type: Comment

algorithm
tags question: http://stackoverflow.com/q/22436387
tags question: http://stackoverflow.com/q/22373348
tag name: algorithm
tags question: http://stackoverflow.com/q/22429680
tags question: http://stackoverflow.com/q/22401648
tags question: http://stackoverflow.com/q/22336560
tags question: http://stackoverflow.com/q/22453435
tags question: http://stackoverflow.com/q/22421676
tags question: http://stackoverflow.com/q/22467100
tags question: http://stackoverflow.com/q/22467063
tags question: http://stackoverflow.com/q/22412569
tags question: http://stackoverflow.com/q/22467691
tags question: http://stackoverflow.com/q/22445917
tags question: http://stackoverflow.com/q/22403920
tags question: http://stackoverflow.com/q/22409264
tags question: http://stackoverflow.com/q/22463777
tags question: http://stackoverflow.com/q/22406245
tags question: http://stackoverflow.com/q/22413387
tags question: http://stackoverflow.com/q/22475910
tags question: http://stackoverflow.com/q/22328877
tags question: http://stackoverflow.com/q/22415470
tags question: http://stackoverflow.com/q/22441276
tags question: http://stackoverflow.com/q/22414965
type: Tag
tags question: http://stackoverflow.com/q/22387257
tags question: http://stackoverflow.com/q/22401615
tags question: http://stackoverflow.com/q/22346361
tags question: http://stackoverflow.com/q/22365558
tags question: http://stackoverflow.com/q/22430559
tags question: http://stackoverflow.com/q/22377606
tags question: http://stackoverflow.com/q/22452607
tags question: http://stackoverflow.com/q/22386859
tags question: http://stackoverflow.com/q/22427257
tags question: http://stackoverflow.com/q/22441252
tags question: http://stackoverflow.com/q/22399472
tags question: http://stackoverflow.com/q/22412707
tags question: http://stackoverflow.com/q/22432008
tags question: http://stackoverflow.com/q/22336509
tags question: http://stackoverflow.com/q/22446477
tags question: http://stackoverflow.com/q/22421459
tags question: http://stackoverflow.com/q/22445407

http://stackoverflow.com/q/22467688
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34177162
has comment: http://stackoverflow.com/comment/34177320
has comment: http://stackoverflow.com/comment/34177361
has comment: http://stackoverflow.com/comment/34177518
has body: I am making a gui with netbeans. I right clicked a JTable to add event listener for mouse clicked. I added my code to the new method. For the life of me when I click the JTable I get no errors. Any ideas on what I am doing wrong or how to fix it? if you need to see more of my code let me know. everything besides the connection to the DB is ran out of the driver class. I moved my program to eclipse to make this easier for me to trouble shoot. private void tableDisplayMouseClicked(java.awt.event.MouseEvent evt) { try { int row = tableDisplay.getSelectedRow(); String tableClick = (tableDisplay.getModel().getValueAt(row, 1).toString()); String sql = " select * from contact where id = ' " + tableClick + " ' "; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); if(rs.next()) { System.out.println("hey dude this method is being called."); String add2 = rs.getString("Business_Name"); fieldBN.setText(add2); String add3 = rs.getString("First_Name"); fieldFN.setText(add3); String add4 = rs.getString("Last_Name"); fieldLN.setText(add4); String add5 = rs.getString("Phone"); fieldP.setText(add5); String add6 = rs.getString("Email"); fieldE.setText(add6); String add7 = rs.getString("Address_Line_1"); fieldA.setText(add7); String add8 = rs.getString("Address_Line_2"); aLine2.setText(add8); String add9 = rs.getString("Website"); fieldW.setText(add9); } } catch(Exception e) { JOptionPane.showMessageDialog(null, e); } } Here is the onclick method Here is my even listener public Driver() { gui(); conn = DbConnect.ConnectDb(); UpdateTable(); tableDisplay.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { tableDisplayMouseClicked(evt); } }); } Here is the whole Driver Class: import java.awt.BorderLayout; public class Driver { private JFrame f; private JPanel p; private JTextField fieldBN; private JTextField fieldFN; private JTextField fieldLN; private JTextField fieldP; private JTextField fieldE; private JTextField fieldA…
tagged with: java
has title: event mouseclicked in java not working to populate text field
type: Question
has comment: http://stackoverflow.com/comment/34176199
has comment: http://stackoverflow.com/comment/34177537
answer count: 1
has comment: http://stackoverflow.com/comment/34177500
has comment: http://stackoverflow.com/comment/34177034
has comment: http://stackoverflow.com/comment/34176172
accepted answer: http://stackoverflow.com/a/22468602
score: 0
has comment: http://stackoverflow.com/comment/34176366
has comment: http://stackoverflow.com/comment/34177532
has answer: http://stackoverflow.com/a/22468602
has comment: http://stackoverflow.com/comment/34176162
has comment: http://stackoverflow.com/comment/34177329
has comment: http://stackoverflow.com/comment/34176340
tagged with: swing
has comment: http://stackoverflow.com/comment/34176092

http://stackoverflow.com/a/22377405
score: 0
has body: When you access the List using index + 1 or i+1, you overstep the bounds of the List on the last iteration. You can fix this by setting the conditional for your for loop to i &lt; list.size() -1. for (int i = 0; i &lt; list.size() -1; i++) { if (list.get(i).compareTo(list.get(i+1))==0) { positionToRemove.add(i); } }
type: Answer
answers question: http://stackoverflow.com/q/22377335

http://stackoverflow.com/comment/34162336
type: AnswerComment
type: Comment
score: 1
has text: @EdwinDalorzo I don't like how Java 8 examples make me feel like I need to learn the language again :-D
comment on: http://stackoverflow.com/a/22460165

http://stackoverflow.com/comment/34168867
type: AnswerComment
type: Comment
has text: Wow - "Jon Skeet can make IE obey his CSS rules.", He MUST be a genius then.
comment on: http://stackoverflow.com/a/22462607
score: 0

http://stackoverflow.com/comment/34031707
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22385171
has text: http://stackoverflow.com/questions/22385728/convert-byte-array-to-a-string-with-performace-android
score: 0

http://stackoverflow.com/q/22356708
type: AnsweredQuestion
has body: I'm trying to take an input from the user for the array size and then ask the user for the array contents. This part seems to work fine but the outprint isn't working. It out prints 0's for the marks. Thanks for any help provided. public static void getExamMarks() { int x,mark; System.out.println("Please enter the number of exam marks: "); x=Keyboard.readInt(); int javastudents[]=new int[x]; for (int i=0;i&lt;javastudents.length;i++) { System.out.println("Please enter an intiger for the mark: "); mark=Keyboard.readInt(); } printArray(javastudents); } public static void printArray(int [] javastudents) { for (int i=0;i&lt;javastudents.length;i++) { System.out.println(javastudents[i]); } }
score: 1
tagged with: java
type: Question
answer count: 1
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/22356817
favorite count: 0
has comment: http://stackoverflow.com/comment/33981266
has answer: http://stackoverflow.com/a/22356817
has title: How to correctly outprint this array in java?
upvote count: 1
has comment: http://stackoverflow.com/comment/33981396

http://stackoverflow.com/a/22388224
answers question: http://stackoverflow.com/q/22388050
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34036313
downvote count: 0
has body: void run() { int[] arr = {1, 2, 3, 4, 5}; twiddle(arr); for (int i : arr) { System.out.println(i); } } static void twiddle(int[] toBeTwiddled) { toBeTwiddled[2] = 10; } Calling run() prints: 1 2 10 4 5 Did you try your code? It looks like it should do exactly what you want.

http://stackoverflow.com/comment/34125016
comment on: http://stackoverflow.com/a/22439062
type: AnswerComment
score: 0
type: Comment
has text: sorry, i meant to say, i declared that at the beginning of my code. i have `String splitString;` at the top :)

http://stackoverflow.com/q/22328908
has body: What would be the "lo" interface equivalent when programming on a windows platform. for instance when i want to use the following line: NetworkInterface interf = NetworkInterface.getByName("lo"); or NetworkInterface interf = NetworkInterface.getByName("eth1"); what would be its equivalent on windows
tagged with: windows
tagged with: unix
score: 1
tagged with: java
tagged with: network-interface
upvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22363150
tagged with: network-programming
has title: What would be the "lo" interface equivalent on windows
accepted answer: http://stackoverflow.com/a/22363150
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/q/22394193
has title: Java: method().method()
has comment: http://stackoverflow.com/comment/34046798
has comment: http://stackoverflow.com/comment/34046801
has comment: http://stackoverflow.com/comment/34046657
has comment: http://stackoverflow.com/comment/34046689
has comment: http://stackoverflow.com/comment/34046727
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34046650
score: -5
has answer: http://stackoverflow.com/a/22394265
accepted answer: http://stackoverflow.com/a/22394265
tagged with: java
has comment: http://stackoverflow.com/comment/34046644
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34046654
possible better answer: http://stackoverflow.com/a/22394335
has comment: http://stackoverflow.com/comment/34046633
has comment: http://stackoverflow.com/comment/34046621
has body: I've made a "Loader" class (self-explanatory, but it loads files from a folder), and since I have to convert the loaded strings to an integer array very commonly, I'd like to add a method to the class that does that. I've seen the following done before, and use it a lot as well: String s = ""; int length = s.toLowerCase().length(); Instead of: String s = ""; String lowercase = s.toLowerCase(); int length = lowercase.length; But when I try to use this method in the Loader class: public int[][] initMatrix() { return new int[20][20]; } I get an error (probably obvious why, but I can't wrap my head around it). What is the correct way of using this? Edit: Here's the class I intend to use: import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; public class Loader { public String[] loadStrings(String fileName) { String[] ret = null; try { ret = Files.readAllLines(Paths.get(fileName), StandardCharsets.UTF_8).toArray(new String[0]); } catch (IOException e) { e.printStackTrace(); } return ret; } public int[][] initMatrix() { } } And I try to use: int[][] foo = new Loader().loadStrings().initMatrix(); Edit #2: I apologize for the confusing question. I just can't figure out why this one-liner works: char c = "World".toLowerCase().charAt(0); When you System.out.println() this to the console, you end up with a lowercase "w", adn only the "w". Therefore, in one line, 2 steps were performed. There are clearly 2 methods doing work. Why exactly does this happen?
favorite count: 0
has comment: http://stackoverflow.com/comment/34046717
has comment: http://stackoverflow.com/comment/34046635
has comment: http://stackoverflow.com/comment/34046666
upvote count: 0
has comment: http://stackoverflow.com/comment/34046708
has answer: http://stackoverflow.com/a/22394335
downvote count: 5
has comment: http://stackoverflow.com/comment/34046692

http://stackoverflow.com/comment/34120982
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22436018
has text: What are you seeing as response body in Firebug when making this call? (Generally your code looks OK, there is probably some detail missing.) Also - did you try producing another media type?
score: 0

http://stackoverflow.com/a/22471204
has body: Try like this: Server serverJetty = new Server(); SelectChannelConnector connector = new SelectChannelConnector(); connector.setPort(jettyPort); connector.setHost(jettyHost); serverJetty.setConnectors(new Connector[] { connector });
answers question: http://stackoverflow.com/q/22469479
has comment: http://stackoverflow.com/comment/34189460
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34195066
has comment: http://stackoverflow.com/comment/34190175

http://stackoverflow.com/comment/34014477
type: Comment
has text: @Vyger: Thanks for advise, yes of course I should use them.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22361866

http://stackoverflow.com/q/22427022
has comment: http://stackoverflow.com/comment/34103335
has title: Using recursion without truncating?
has comment: http://stackoverflow.com/comment/34103873
upvote count: 0
type: UnansweredQuestion
has body: I can't understand this recursive method as the return method doesn't seem to add the charAt(0) method per run. Suppose you were given a method that reverses a String (it is correct): public String reverseString(String s) { if (s.length() &lt;= 1) return s; return reverseString(s.substring(1)) + s.charAt(0); } EDIT: I now understand: rs(Hello) rs(ello) + H (rs(llo) + e) + H ((rs(lo) + l) + e) + H (((rs(o) + l) + l) + e) + H o + l + l + e + H
score: -3
tagged with: recursion
has answer: http://stackoverflow.com/a/22427116
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9723912
has comment: http://stackoverflow.com/comment/34103532
downvote count: 3
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/34092768
comment on: http://stackoverflow.com/a/22391219
type: AnswerComment
has text: how to know bytes per sample value in my programme i am new to java,plz help, my data is containe in data1 array,can you provide me some pseudo code on how to proceed next
score: 0
type: Comment

http://stackoverflow.com/q/22356079
has answer: http://stackoverflow.com/a/22357742
favorite count: 0
type: UnansweredQuestion
tagged with: jdbc
downvote count: 0
score: 1
tagged with: java
tagged with: hive
type: Question
tagged with: hadoop
has title: How do you specify additional jars for the mr job launched from hive jdbc queries?
tagged with: avro
has answer: http://stackoverflow.com/a/22360688
answer count: 2
has body: I am trying to query a hive table via jdbc that uses avro storage format but I am getting a class not found error in the mr job spawned by the query. The strange thing is that I can run the query from hive shell without the exception occurring. I can run a query that does not spawn a map reduce job (select * from table limit 10) and it works fine. 2014-03-12 10:23:34,040 WARN [main] org.apache.hadoop.mapred.YarnChild: Exception running child : java.io.IOException: java.lang.reflect.InvocationTargetException at org.apache.hadoop.hive.io.HiveIOExceptionHandlerChain.handleRecordReaderCreationException(HiveIOExceptionHandlerChain.java:97) at org.apache.hadoop.hive.io.HiveIOExceptionHandlerUtil.handleRecordReaderCreationException(HiveIOExceptionHandlerUtil.java:57) at org.apache.hadoop.hive.shims.HadoopShimsSecure$CombineFileRecordReader.initNextRecordReader(HadoopShimsSecure.java:344) at org.apache.hadoop.hive.shims.HadoopShimsSecure$CombineFileRecordReader.&lt;init&gt;(HadoopShimsSecure.java:291) at org.apache.hadoop.hive.shims.HadoopShimsSecure$CombineFileInputFormatShim.getRecordReader(HadoopShimsSecure.java:405) at org.apache.hadoop.hive.ql.io.CombineHiveInputFormat.getRecordReader(CombineHiveInputFormat.java:560) at org.apache.hadoop.mapred.MapTask$TrackedRecordReader.&lt;init&gt;(MapTask.java:168) at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:409) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:342) at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:165) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1548) at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:160) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)…
upvote count: 1

http://stackoverflow.com/a/22367002
answers question: http://stackoverflow.com/q/22366961
score: 1
upvote count: 1
downvote count: 0
has body: yes, you can use Collections.sort( list, comparator ) or a TreeSet which sorts the collection upon adding of new elements SortedSet ss = new TreeSet( comparator ); ss.add( someObj0 ); .... ss.add( someObjn ); List sortedList = new ArrayList( ss );
type: Answer

http://stackoverflow.com/a/22374843
type: Answer
accepted answer of: http://stackoverflow.com/q/22374656
downvote count: 0
answers question: http://stackoverflow.com/q/22374656
score: 1
has comment: http://stackoverflow.com/comment/34015636
upvote count: 1
type: AcceptedAnswer
has body: Yes you can do that without removing the project and importing it back. Right Click your Project-> Java Build Path->Add Library->Android Classpath Container->Choose your Project->Ok You will your Android X.X back. Hope it helps.

http://stackoverflow.com/q/22425306
upvote count: 11
favorite count: 0
has comment: http://stackoverflow.com/comment/88217360
tagged with: maven
tagged with: web-services
score: 11
has answer: http://stackoverflow.com/a/22531977
accepted answer: http://stackoverflow.com/a/22531977
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/15079913
tagged with: java
tagged with: jaxb
has title: Resolving conflicts when generating code with CXF and wsdl2java
type: Question
linked to: http://stackoverflow.com/q/13422253
downvote count: 0
answer count: 1
has body: I'm struggling with some conflicts during code generation from a bunch of WSDL files using wsdl2java via the cxf-codegen-plugin with Maven. The WSDLs declare different APIs of the same system, and the generated code has some amount of overlap (especially with the model classes). The external system and the WSDLs come from a third party and are therefore not controlled by us. The first problem I have is a naming conflict in one of the resulting ObjectFactory classes caused by one of the WSDLs. It defines a complexType with the name Foo that contains an element with the name Status, and it also defines a element with the name FooStatus. When generating the code, JAXB throws a fit because the ObjectFactory would have two factory methods with the name createFooStatus(...) and I end up with an exception during runtime. I've tried providing the option -autoNameResolution to wsdl2java with no avail. I've looked at "Two declarations cause a collision in the ObjectFactory class" and "Applying external JAXB binding file to schema elements imported from WSDL", and based on those I've written an external binding file that renames one of the factory methods. I use SCD instead of XPath in the binding file as shown in the latter link, because I had the same problem with XPath as the author. This works, but only if I process the WSDL files individually and apply the binding file only to the WSDL that causes the conflict. The Maven configuration looks like this: org.apache.cxf cxf-codegen-plugin 3.0.0-milestone1 generate-proxies generate-sources ${basedir}/First.wsdl ${basedir}/bindings.xml ${basedir}/Second.wsdl ${basedir}/Third.wsdl ... More wsdlOption declarations ... wsdl2java Now, if I do this I end up with another problem, because the generated code from the different WSDL files uses the same package structure. What this means in practice is that the ObjectFactory classes get overridden when processing subsequent WSDL files, meaning that only the one generated from the last WS…
tagged with: wsdl

http://stackoverflow.com/a/22436232
type: Answer
has comment: http://stackoverflow.com/comment/34120117
score: 3
has comment: http://stackoverflow.com/comment/34119980
accepted answer of: http://stackoverflow.com/q/22436206
has comment: http://stackoverflow.com/comment/34120054
answers question: http://stackoverflow.com/q/22436206
has body: In your code, the value of col will always be m.length - 1 after the outer loop completes. You need to store the minimum column somewhere, e.g., public static int minColIndex (int[][] m) { int row = m.length, col = m[0].length; int min = m[0][0]; int minCol = 0; // extra variable to store minimumm column for (col = 0; col &lt; m.length; col++) { for (row = 0; row &lt; m[col].length; row++) { if (min &gt; m[col][row]) { min = m[col][row]; minCol = col; // remember the minimum column as well as minimum } } } return minCol; // return minimum column, not col } There's also no need for row and col to have initial values set before the loop, so you can change the first few lines of the method to be the following, for slightly greater clarity: public static int minColIndex (int[][] m) { int min = m[0][0]; int minCol = 0; // extra variable to store minimumm column for (int col = 0; col &lt; m.length; col++) { for (int row = 0; row &lt; m[col].length; row++) { ... etc.
type: AcceptedAnswer
downvote count: 0
upvote count: 3

http://stackoverflow.com/a/22407051
score: 1
has body: Your data is stored as strings but this select query here... String selectQuery = "SELECT * FROM "+CONTACT_TABLE_NAME+" WHERE "+CONTACT_PHONE_NUMBER+"="+pn+";"; ... does not quote pn as a string literal. Since it can be interpreted as a number, there's no syntax error but it doesn't match any of the strings with + or 0 in front. To quote string literals in SQL, use '' single quotes. However, it's better to use ? placeholders and bind values there, like String selectQuery = "SELECT * FROM "+CONTACT_TABLE_NAME+" WHERE "+CONTACT_PHONE_NUMBER+"=?;"; Cursor cursor = db.rawQuery(selectQuery, new String[] { pn });
accepted answer of: http://stackoverflow.com/q/22406969
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22406969
type: Answer

http://stackoverflow.com/comment/34206097
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22485277
has text: Did you write this? If so, why don't you know how it works? Which part is it that you don't understand. Also: Wow, GOTO statements!
score: 0

http://stackoverflow.com/comment/34064325
type: Comment
comment on: http://stackoverflow.com/a/22394378
has text: @Sandy: Best to avoid absolute positioning via setSize, setLocation or setBounds. Best to use layout managers to achieve best relative position so that your GUI works well on all platforms. For more specific help, please do create and post a [minimal example program](http://stackoverflow.com/help/mcve) (please check out the link), and then send me a comment to let me know it's done.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22344334
score: 0
tagged with: java
tagged with: import
type: Question
has answer: http://stackoverflow.com/a/22344512
tagged with: database
has answer: http://stackoverflow.com/a/22344407
has body: I'm importing database values from a .csv file. However, the first row in the .csv is actually the names of the tables' columns, and my importer updates the database with that being the first row. And that messes up the queries that I'll do later with it. Please help how can I prevent this? My code of my .csv importor try { BufferedReader br=new BufferedReader(new FileReader("v.csv")); String line; while((line=br.readLine())!=null) { String[]value = line.split(","); String sql = "INSERT into main ([Ticket #], Status, Priority, Department, [Account Name]) " + "values ('"+value[0]+"','"+value[1]+"','"+value[2]+"','"+value[3]+"','"+value[4]+"')"; System.out.println(sql); PreparedStatement pst = null; try { pst = db.prepareStatement(sql); pst.executeUpdate(); }finally{ if(pst != null){ pst.close(); } } } br.close(); } catch(Exception e) { JOptionPane.showMessageDialog(null, e); }
answer count: 3
tagged with: sql
has title: Java - Import .csv to database - Exclude first row
possible better answer: http://stackoverflow.com/a/22344407
has answer: http://stackoverflow.com/a/22344480
accepted answer: http://stackoverflow.com/a/22344512
tagged with: http://stackoverflow.com/tag/csv
type: AnsweredQuestion

http://stackoverflow.com/a/22333717
upvote count: 1
answers question: http://stackoverflow.com/q/22329304
downvote count: 0
has comment: http://stackoverflow.com/comment/76975413
type: Answer
score: 1
has body: It seems that AtomicInteger ques by calling AtomicInteger.incrementAndGet() an increment event. My threads are calling that function ~3.5 Mio times and the Queue is huge. After my Threads are done, the main Thread instantly copies the ConcurrentHashMap of AtomicInteger, but the queue of some AtomicIntegers is not completley done. That makes the inconsistency. I solved that by giving the AtomicInteger some time to finish it "increment Queue" after all threads are done. try { myCountDownLatch.await(); Thread.sleep(5000); //let AtomicInteger finish they incrementations } catch (Exception e) { System.err.println("Error in a Latch Countdown: " + e.toString()); } And voila! There no inconsistency anymore! If there is another method to wait for AtomicInteger finish their increment Queues, I would be thankful to read about that.

http://stackoverflow.com/comment/110393591
type: AnswerComment
has text: This isnt exactly true. final and const ARE the same, the main difference here is that the pointer in Java is hidden from you. I.e. `final StringBuffer s` is the same as `StringBuffer * const s` (not to be confused with `const StringBuffer *s` which is different.)
type: Comment
comment on: http://stackoverflow.com/a/22351313
score: 0

http://stackoverflow.com/comment/34195967
score: 0
type: QuestionComment
type: Comment
has text: @WhoAmI Thank you,I have corrected.
comment on: http://stackoverflow.com/q/22479014

http://stackoverflow.com/comment/34122586
score: 2
has text: Here are the rules of the game http://stackoverflow.com/help/how-to-ask
comment on: http://stackoverflow.com/q/22437676
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34061300
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22402379
type: AnswerComment
has text: Try 2nd way which I was posted or you can http://pastebin.com/W6U75jHe use this.

http://stackoverflow.com/comment/33942667
has text: You can map entity properties directly to the form fields, what is the necessity to write intermediate objects and transform them to the entities?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22331198

http://stackoverflow.com/comment/33969015
type: Comment
comment on: http://stackoverflow.com/a/22349270
has text: i don't get it, they have value, and fillOval() use that value,I have just try to add System.out.println(ClickCounter); System.out.println(xClick); System.out.println(yClick);, at first click there is all value to build circle
score: 0
type: AnswerComment

http://stackoverflow.com/a/22393758
accepted answer of: http://stackoverflow.com/q/22393477
type: Answer
answers question: http://stackoverflow.com/q/22393477
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: You can either use NumDouble to do so or create an anonymous instance of Num. The latter would look like something like this: Num num = new Num() { Double d; @Override public void neg() { d = -d; } @Override public void sqrt() { d = Math.sqrt(d); } @Override public String asString() { return d.toString(); } }; As you can see this does not make sense since you can't add constructors to an anonymous instance and your interface does not contain a setter. Just a note: NumList is not really a Num since it does not fit in the Num abstraction you create. So my suggestion is to either use NumDouble like this: nums.add(new NumDouble(value)); or create a new class extending Num.

http://stackoverflow.com/q/22399901
tagged with: java
downvote count: 1
has title: Swing Dynamic JTable creation
type: Question
has answer: http://stackoverflow.com/a/22400160
linked to: http://stackoverflow.com/q/10621470
answer count: 2
upvote count: 0
score: -1
tagged with: jtable
has answer: http://stackoverflow.com/a/22400129
has comment: http://stackoverflow.com/comment/34061371
has body: I want to create tables dynamically depending on Input. If input is 5 there will be 5 JTables and then I should be able to identify these 5 tables uniquely so that i can work on these 5 tables individually afterwards. I am doing table=new Jtable() ,but I want table1=new Jtable(),table2=new Jtable(),table3=new Jtable() and so on thus generate automatically.I upper limit of input is 18. How do i do this?
favorite count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: dynamic

http://stackoverflow.com/q/22439098
score: 0
has title: GWT Deployment on Tomcat 5.5
has comment: http://stackoverflow.com/comment/34127052
has comment: http://stackoverflow.com/comment/34127350
has body: I'm trying to deploy my GWT project to a remote server. I'm being unable to make it run properly. For some reason the browser looks for the resources relative to the domain root and not relative to the html page location. The project has the following files structure after deployment: /public_html/ProjectName /public_html/ProjectName/ProjectName.html /public_html/ProjectName/WEB-INF /public_html/ProjectName/META-INF /public_html/ProjectName/Css /public_html/ProjectName/Images /public_html/ProjectName/ProjectName/ProjectName.nocache.js /public_html/ProjectName/ProjectName/hosted.html /public_html/ProjectName/ProjectName/etc... As for the images an example how I did it is this found on my uibinder.xml: <g:Image ui:field="imgLogo" styleName="{style.img-logo}" url="/images/logo.png"/> You can see it for yourself on: http://www.tattoon.pt/webtattoon/ The app is working fine while in development. I tried to deploy the default GWT to the same server. Unfortunately I get the same error stating that the URL wasn't found when I make the send request. You can check it on: http://www.tattoon.pt/deployment/ And here is the web.xml: greetServlet com.ohapp.deployment.server.GreetingServiceImpl greetServlet /deployment/greet I know that the project works because I deployed it in another server and achieved the pretended result: http://metalemore.com:8080/deployment/ Also I already tested the Tomcat server and is working: http://tattoon.pt/jsptest.jsp The only difference is the fact that one server uses Tomcat version 7.0.42 on port 8080 and the one that doesn't work uses Tomcat 5.5.36 on port 80. I'm using GWT 2.6.0. I would appreciate any help. Thank you.
has comment: http://stackoverflow.com/comment/34126677
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22442019
tagged with: gwt
has comment: http://stackoverflow.com/comment/34125827
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22440666
tagged with: tomcat

http://stackoverflow.com/q/22448834
type: AnsweredQuestion
has title: String-related issue in Java: why isn't my level promotion/downgrade updated correctly?
has comment: http://stackoverflow.com/comment/34148003
tagged with: java
has comment: http://stackoverflow.com/comment/34143018
possible better answer: http://stackoverflow.com/a/22449320
has answer: http://stackoverflow.com/a/22452985
has answer: http://stackoverflow.com/a/22452688
type: Question
tagged with: string
linked to: http://stackoverflow.com/q/513832
answer count: 3
accepted answer: http://stackoverflow.com/a/22452688
score: 0
has body: I am trying to write this program in java. I can read the string from the constructor and separate the string by using delimiters. However, every time, I try to call methods such as promote() for those values, the value just remains the same. The boolean method promote() displays true, but the level just doesn't increases. For example: if the string from the constructor is : "Harry#wizard#broom", then: name &lt;- "Harry" level &lt;- "wizard" supplies &lt;- "broom" name, level and broom are all the private data instances (I don't know if I should be using data instances or local variables). However, whenever I call harry.promote() it returns true but the level just stays the same, it doesn't get promoted. The initial value in level seems to overwrite it. I have written the following code: import java.util.Scanner; import java.io.*; public class Magician { private String name; private String level; private String supplies; private double health; private int galleons; public Magician(String phrase) //phrase will be sth like this: Harry#wizard#broom#staff { health = 4000; galleons = 200; Scanner firstScan = new Scanner(details); firstScan.useDelimiter("#"); name = firstScan.next(); level = firstScan.next(); if (firstScan.hasNext()) { supplies = firstScan.next(); while (firstScan.hasNext()) { supplies = supplies + " " + firstScan.next(); } } else { supplies =""; } } public String getName() { return name; } public String getLevel() { return level; } public int getGalleons() { return galleons; } public double getHealth() { return health; } public String getSupplies() { return supplies; } //Mutators public void setName(String nameUpdate) { name = nameUpdate; } public void setLevel(String levelUpdate) { level =levelUpdate; } public void setGalleons(int galleonsUpdate) { galleons = galleonsUpdate; } public void setHealth(double healthUpdate) { health = healthUpdate; } public void setSupplies(String suppliesUpdate) { supplies = suppliesUpdate; } // boolean promote, promotes a …
has answer: http://stackoverflow.com/a/22449320
tagged with: jgrasp

http://stackoverflow.com/a/22357569
has body: The DefaultMessageListenerContainer will automatically reconnect according to the recoveryInterval. Turn on DEBUG (or even TRACE) logging to figure out what's happening.
answers question: http://stackoverflow.com/q/22355929
score: 0
type: Answer

http://stackoverflow.com/a/22350307
type: Answer
answers question: http://stackoverflow.com/q/22350015
has body: This was a simple mistake on my part. class ThisDoesWorkAfterAll { public List&lt;List&lt;Integer&gt;&gt; vars; } This is the correct way to deserialize the json. In my data, I simply had an additional level of lists. If you run into the same problem, check if GSON tells you it expected "Your Type" (E.g. Integer), but saw an START_ARRAY ([). ...embarrasing...
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22350015

http://stackoverflow.com/comment/34201363
type: Comment
comment on: http://stackoverflow.com/a/22482328
has text: The method I'm calling using `test`, requires for it to be a `EnumSet`, not a `Set`.
type: AnswerComment
score: 0

akka
type: Tag
tags question: http://stackoverflow.com/q/22400064
tags question: http://stackoverflow.com/q/22412960
tag name: akka
tags question: http://stackoverflow.com/q/22431280
tags question: http://stackoverflow.com/q/22452403
tags question: http://stackoverflow.com/q/22387142

http://stackoverflow.com/comment/101663790
type: AnswerComment
comment on: http://stackoverflow.com/a/22357585
score: 2
type: Comment
has text: What does the below one means? \n `code [INFO] | +- com.sun.jersey:jersey-servlet:jar:1.18.1:compile [INFO] | | \- com.sun.jersey:jersey-server:jar:1.18.1:compile [INFO] | | \- com.sun.jersey:jersey-core:jar:1.18.1:compile code` Does the negative signs that the dependency is omitted?

http://stackoverflow.com/comment/34141767
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22447968
type: AnswerComment
has text: I see. If you don't mind, could you edit your example to incorporate putting two pictures side by side into one and pasting it? I would really appreciate it!

http://stackoverflow.com/comment/33962650
score: 0
type: AnswerComment
has text: Dear Salah, i have tracked my application & the problem is in runJob() method only. Any idea on this method.
type: Comment
comment on: http://stackoverflow.com/a/22345635

http://stackoverflow.com/q/22407180
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/34068839
has comment: http://stackoverflow.com/comment/34069767
has comment: http://stackoverflow.com/comment/34068641
type: UnansweredQuestion
tagged with: oracle-database
tagged with: jdbc
has comment: http://stackoverflow.com/comment/34068575
has body: I have a java project where I need to fetch a count of the number of rows not having a date set (the date is null for these rows in the Oracle table). The project is in Java 6 using Oracle jdbc 6. (ojdbc6.jar). Statement statement = null; String query = " select count(*) thesum from jobview where starteddate is null"; statement = con.createStatement(); ResultSet resultSet = statement.executeQuery(query); if(resultSet.next()) { workCount = new Integer(resultSet.getInt("thesum")); } Now, the problem is that workCount is always 0. If I run the same query in SQLDeveloper it returns a result with the number of rows with starteddate as expected (meaning not 0). What am I missing here or are there some know bugs with the oracle driver or my version of java (build 1.6.0_29) which is a project restriction...
tagged with: java
has title: Oracle JDBC sql statement where is null does not return any data
has comment: http://stackoverflow.com/comment/34068298
has comment: http://stackoverflow.com/comment/34068254
has comment: http://stackoverflow.com/comment/34416564
type: Question
has answer: http://stackoverflow.com/a/22628836
has comment: http://stackoverflow.com/comment/34068405
has comment: http://stackoverflow.com/comment/34161368
has comment: http://stackoverflow.com/comment/34068404
score: 0
has comment: http://stackoverflow.com/comment/34068942

http://stackoverflow.com/a/22485082
has comment: http://stackoverflow.com/comment/34205713
answers question: http://stackoverflow.com/q/22484658
downvote count: 0
has comment: http://stackoverflow.com/comment/34205795
has comment: http://stackoverflow.com/comment/34206025
has comment: http://stackoverflow.com/comment/34205754
upvote count: 2
has comment: http://stackoverflow.com/comment/34205889
has body: Let me share with you how I like to organize my tests in eclipse :-) maybe you may find useful. First, I create two projects, one for the app and another for the test. The test project, of course, has a dependency on the app project Now, let's suppose you want to add some test case, you just point to the right src dir. So you want to create your test code without mixing app code and test code (for example, utils), just leave what's specific to the right project. The only name convention I use is the eclipse junit default, appending the word "Test" in the end of the test class. No need for ant scripts to deploy only the app code. Even JUNIT dependency is restricted to the test project. I hope it helps.
has comment: http://stackoverflow.com/comment/34205611
type: Answer
score: 2

http://stackoverflow.com/comment/34076372
has text: But that doesn't work until my app first make a client connection to the hardware then serversocket accepts connections. But once I do this. I can skip the client connection (Android to hardware) and my server will always accept the connection from the hardware. As if Android registers somewhere it already once talk to this hardware and I can accept connection from it ...
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22391972

http://stackoverflow.com/a/22483720
type: Answer
has comment: http://stackoverflow.com/comment/34207073
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22482835
has comment: http://stackoverflow.com/comment/34208927
score: 1
answers question: http://stackoverflow.com/q/22482835
type: AcceptedAnswer
downvote count: 0
has body: ArrayBlockingQueue is a standard library, whereas BlockingBuffer / BoundedFifoBuffer is not. This would be a sufficient reason to prefer ArrayBlockingQueue if you don't have a particular reason. Another strong difference is that Buffer is a collection but not a Queue, whereas ArrayBlockingQueue is. If your use case is a queue, then ArrayBlockingQueue would be preferable as there are libraries that expects a Queue. Finally, ArrayBlockingQueue uses a bit more sophisticated concurrency control, so I wouldn't be surprised if it performs better.

http://stackoverflow.com/a/22373126
answers question: http://stackoverflow.com/q/22372533
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34011161
has body: The mentioned code works fine. You can try other way also to get the text node - String expression = "/ADOXML/MODELS/MODEL/MODELATTRIBUTES/ATTRIBUTE/text()"; NodeList nodeList = (NodeList) xPath.compile(expression).evaluate(document, XPathConstants.NODESET); System.out.println(nodeList.item(0).getNodeValue());

http://stackoverflow.com/q/22444461
tagged with: ruby-on-rails
has answer: http://stackoverflow.com/a/22444619
downvote count: 1
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22448728
score: -1
linked to: http://stackoverflow.com/q/792024
has comment: http://stackoverflow.com/comment/34135691
answer count: 2
has title: How to call ruby code from java (Android)
upvote count: 0
has answer: http://stackoverflow.com/a/22448728
possible better answer: http://stackoverflow.com/a/22444619
favorite count: 0
has body: I'm developing an Android app which involves a user login. I am doing all the database interactions in Ruby/Rails. This will be how my app typically will run: Main activity (User log in screen) Rails code (ActiveRecord stuff..) to log user in and generate an XML filled with users information (name, email etc) Start next activity which parses xml file for certain information The trouble is, I don't know how to make specific ruby function calls from the Java/Android code (Think bridging between steps 1 and 2). So suppose we enter the username and email in the main activity (step 1). We now need to call the Rails code to verify this username and email - How do we call that code from java? Any advice or links or examples would help, thanks!
tagged with: android
tagged with: jruby
tagged with: ruby
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34135595

http://stackoverflow.com/comment/34112618
score: 0
has text: I edited the post, with main program and the errors
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22431950

http://stackoverflow.com/comment/34181177
has text: There has to be something else you're not telling us; the code appears to work as illustrated. You're sure that you're compiling it correctly and running it correctly?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22470841

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/22417364
tags question: http://stackoverflow.com/q/22382341
tags question: http://stackoverflow.com/q/22355116
tags question: http://stackoverflow.com/q/22339900
tags question: http://stackoverflow.com/q/22418852
tags question: http://stackoverflow.com/q/22359193
type: Tag
tags question: http://stackoverflow.com/q/22462668
tags question: http://stackoverflow.com/q/22347483

http://stackoverflow.com/comment/34080313
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22413668
has text: remove the last back slash in `results += " for all draws.\n\n\";` It escapes the " with the result being the string is not closed

http://stackoverflow.com/comment/34080414
comment on: http://stackoverflow.com/a/22389228
score: 0
type: Comment
has text: Thought there was other way than concatenating.
type: AnswerComment

http://stackoverflow.com/a/22419939
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34092553
answers question: http://stackoverflow.com/q/22407360
has body: Prasanth, Why don't you make your life a bit easier and start with one of the simple examples in the JiBX project or on our github site. I would suggest you start with this example: https://github.com/jibx/maven-plugin/tree/master/test-suite/base-binding-test The example in this project has a simple program to marshal and unmarshal xml. Good Luck! Don JiBX contributor

http://stackoverflow.com/a/22455506
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/22455401
has body: An Iterator just give you a method of walking over a Collection, so the "size of the Iterator" is the size of the collection it iterates over. In this case just use Set's (or any other Collection) built in size() method : int size = Map.keySet().size(); If you are in a situation where you just have access to the Iterator but need the underlying Collection's size I think you'll need to talk to the one giving you just that iterator, and either get access to the Collection, or get the size of the Collection.
score: 3

http://stackoverflow.com/a/22389260
has body: This code is not good. You are attempting, on each recursion to regenerate the entire array from scratch! In fact the probability of your successfully generating the ladders is about 1 / 64. If I were you, I'd drop the recursion and adjust the loop: public static void ladders() { for (int i = 0 ; i &lt; 6 ; ){ ladderBottoms [i] = (int) ((Math.random () * 80)+1); ladderTops [i] = (int) ((Math.random () * 80)+1); if(ladderBottom[i] &lt;= /*do you really want =*/ ladderTop[i]){ i++; /* this is OK so increment; else have another go*/ } }//for }//ladders An empty expression in a for loop is perfectly legal in Java. Do take note of my comment in the code. Do you really want a unit-length ladder? If not then replace the &lt;= in the conditional with &lt;. As a rule of thumb, always try to avoid recursive functions: they can be difficult to follow in a 3am debugging session and also, particularly with ramdomisation, can, once in a while, cause a stack to overflow.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22389102
score: 0
answers question: http://stackoverflow.com/q/22389102
type: Answer

http://stackoverflow.com/comment/42322429
comment on: http://stackoverflow.com/q/22468263
score: 0
type: QuestionComment
type: Comment
has text: I am facing a same problem my code is:

http://stackoverflow.com/comment/34165807
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22461655
has text: Ah wow, I was overcomplicating the matter a lot by relying on the gradle command to run my tests. So @fge yes that worked as I wanted it to. Thanks for the help.
score: 0

http://stackoverflow.com/q/22382628
has answer: http://stackoverflow.com/a/22403826
answer count: 3
has answer: http://stackoverflow.com/a/22383652
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/52016472
tagged with: selenium-webdriver
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22383652
tagged with: java
has body: This is my first question on Stack Overflow. Thanks to all StackOverflow users who keeps technology passion ticking. I am testing a web application with selenium Webdriver . It is payment webpage where, after selecting Payment method as 'PayPal' it opens up a new Popup , a PayPal popup and i Switch window to Paypal , do all my necessary Transaction. And once the Transaction is successful , automatically the paypal popup is closed, and i am not able to return to my original window from where i have initiated transaction. I am getting following error in eclipse console: Starting ChromeDriver (v2.9.248315) on port 25947 [70.164][SEVERE]: Unable to receive message from renderer The following details might help : selenium Webdriver (2.28.0) java - JRE7 Google Chrome Version - Version 33.0.1750.146 Test Framework - Test NG Here is my code : // To Switch to Popup/Paypal window String currentWindowHandle=driver.getWindowHandle(); Set&lt;String&gt; openWindowsList=driver.getWindowHandles(); String popUpWindowHandle=null; for(String windowHandle:openWindowsList) { if (!windowHandle.equals(currentWindowHandle)) popUpWindowHandle=windowHandle; } driver.switchTo().window(popUpWindowHandle); // Carraying out my paypal transaction driver.manage().window().maximize(); driver.findElement(By.xpath("//*[@id='loadLogin']")).click(); Thread.sleep(8000); WebElement login_email = driver.findElement(By.xpath("//*[@id='login_email']")); login_email.clear(); login_email.sendKeys(Keys.BACK_SPACE); login_email.sendKeys("abc@abc.com"); WebElement login_password = driver.findElement(By.xpath("//*[@id='login_password']")); login_password.clear(); login_password.sendKeys("abcxyz"); // Next Click is Final Click on PayPal driver.findElement(By.xpath("//*[@id='submitLogin']")).click(); // Transaction is finished on PayPal side and it automatically popup is closed //Now i am trying to switch to my last working(original) window driver.switchTo().window("My Web Page Title");
tagged with: selenium
possible better answer: http://stackoverflow.com/a/52016472
type: Question
upvote count: 4
has title: Selenium Webdriver - Chrome - Switch Window and back - Unable to receive message from renderer
score: 4

binary-tree
tag name: binary-tree
type: Tag
tags question: http://stackoverflow.com/q/22458157
tags question: http://stackoverflow.com/q/22366138
tags question: http://stackoverflow.com/q/22439585
tags question: http://stackoverflow.com/q/22444332

http://stackoverflow.com/comment/34083113
score: 0
type: Comment
has text: I didn't test it, but what's the point of just `a` or `a = a` in the initializer? Or in any context for that matter.
comment on: http://stackoverflow.com/a/22415085
type: AnswerComment

http://stackoverflow.com/a/22430822
answers question: http://stackoverflow.com/q/22430801
has comment: http://stackoverflow.com/comment/34110563
has body: Change s = input.next() to s = input.nextLine()
has comment: http://stackoverflow.com/comment/34110702
has comment: http://stackoverflow.com/comment/34110645
has comment: http://stackoverflow.com/comment/34110615
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/34110675

http://stackoverflow.com/comment/34062630
score: 0
has text: And the question is? Show some code, the way the database is defined, etc. Also, `\u4f60\u597d` is the UTF-16 representation of a Unicode code point
type: Comment
comment on: http://stackoverflow.com/q/22404000
type: QuestionComment

http://stackoverflow.com/q/22443880
possible better answer: http://stackoverflow.com/a/22443937
type: Question
answer count: 2
tagged with: sql
downvote count: 0
score: 1
favorite count: 0
has body: Using Hibernate I want to get clients ID from Contract table where the admission date is in a range( between two dates). List clients = session.createQuery("from Contract contract where contrat.datesouscription BETWEEN "+ begindate+" and "+endate).list(); my query doesn't work. Thanks
has answer: http://stackoverflow.com/a/22443901
has title: get records having admission date in a range
upvote count: 1
has answer: http://stackoverflow.com/a/22443937
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22443901
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/34096818
type: QuestionComment
comment on: http://stackoverflow.com/q/22422974
score: 0
type: Comment
has text: Use a debugger to find out what the values in your result set are before the "if" statement. If you don't know how to use a debugger, then try inserting `System.out.println("|" + rs.getString(2) + "|" + rs.getString(3) + "|");` before the "if" statement so you can see whether the values from the database are what you expect.

http://stackoverflow.com/a/22402512
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/34061047
answers question: http://stackoverflow.com/q/22402237
has comment: http://stackoverflow.com/comment/34060659
has body: Now he ask me there is a immutable class with only getter methods. Then in this class what is the use of final? Only getter methods do not ensure that a class is immutable. If you expose the internal state than a client can change the class's state. Immutable means that you can not change an objects state once it is created. Making all fields final and providing only getters will not make it immutable out of the box. Imagine the following code: public class MyString { private final char[] content; public MyString(String str){ this.content = str.toCharArray(); } public char[] getContent(){ return this.content; // internal state exposed. You should return a copy. } } This class has only final fields and only getter methods but is still mutable. Imagine this client code: MyString myString = new MyString("test"); myString.getContent()[0] = 'f'; Now he ask me there is a immutable class with only getter methods. Then in this class what is the use of final? The use of final is to express your intention with java's language features and therefore enforce them by the compiler. So making a variable final is good for primitive types, but you must take care if the variable is a reference. In this case you must either ensure that the object you are referencing is also immutable or only your instance has access to that object. The later can only be ensured by the programmer. So take extra care when you return references.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34060754

http://stackoverflow.com/a/22399455
score: 4
has body: If you want to enforce that only types K can be used that implement Comparable, you can check it at compile time: public class HashMapVectorSimilarity&lt;K extends Comparable&lt;K&gt;&gt; { ... } This is easiest and probably best. If you want a runtime check, you cannot do it the way you wrote, because of type erasure. The way generics work in Java is that the compiler checks all the types, but erases them, so they're not available at runtime. So if you want to have the runtime type available, you need to pass in a Class object explicitly: static public &lt;K&gt; double calculateSimilarity( HashMap&lt;K, Double&gt; hashMap1, HashMap&lt;K, Double&gt; hashMap2, Class&lt;K&gt; clazz) { if (Comparable.class.isAssignableFrom(clazz)) { ... } } Or you could pass clazz in to the constructor and store it inside the object.
upvote count: 4
has comment: http://stackoverflow.com/comment/34084542
answers question: http://stackoverflow.com/q/22399355
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22399355

http://stackoverflow.com/comment/34167089
has text: Yeah, see [here](http://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#context-functionality-events).
type: Comment
comment on: http://stackoverflow.com/q/22462290
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34191935
comment on: http://stackoverflow.com/q/22477410
score: 0
type: Comment
has text: So I have to call `new DateTime().getSecondOfMinute()` after every cycle to get accurate value of seconds.
type: QuestionComment

http://stackoverflow.com/comment/34048462
has text: GZIPInputStream gave me an IOException... unexpected magic number 6316 or something along those lines. I haven't tried JTAR though, I'll take a look.
comment on: http://stackoverflow.com/q/22392730
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33946200
comment on: http://stackoverflow.com/q/22336194
score: 0
type: Comment
type: QuestionComment
has text: How is your cleanup method being called? Is it something that the MapReduce framework invokes automatically? If not, then I guess you're not getting output from reducer due to the cleanup method not being invoked. the `map output records=10` could be intermediate data from the Map tasks

http://stackoverflow.com/a/22345520
upvote count: 1
answers question: http://stackoverflow.com/q/22345378
type: Answer
downvote count: 0
score: 1
has body: group 0 is ALWAYS the whole matched string. matching groups that you define within a regexp always start from 1. have a loot at the javadoc for Matcher.group(int): Group zero denotes the entire pattern, so the expression m.group(0) is equivalent to m.group()

http://stackoverflow.com/comment/33978857
has text: @erictesting: You construct with the comparator, then repeatedly add from `entrySet` in an enhanced `for` loop. E.g. (after construction) `for (Map.Entry entry : originalMap.entrySet()) { treeSet.add(entry); }`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22353306

http://stackoverflow.com/comment/34166151
score: 0
has text: Did you try other generation strategies like ```@GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid")``` ?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22462061

http://stackoverflow.com/a/23816587
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Found a way to fix it myself String name = "contact_name_to_search_for" ContentResolver cr = getContentResolver(); Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null,"DISPLAY_NAME" + " LIKE '%"+name+"%'", null, ContactsContract.CommonDataKinds.Phone.LAST_TIME_CONTACTED + " DESC"); if (cursor.moveToFirst()) { String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)).toLowerCase(); Cursor phones = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId.toLowerCase(), null, null); while (phones.moveToNext()) { String number = phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); int type = phones.getInt(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE)); switch (type) { case ContactsContract.CommonDataKinds.Phone.TYPE_HOME: Toast.makeText(getApplicationContext(), number+" Home number",Toast.LENGTH_SHORT ).show(); break; case ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE: Toast.makeText(getApplicationContext(), number+" Mobile number",Toast.LENGTH_SHORT ).show(); break; case ContactsContract.CommonDataKinds.Phone.TYPE_WORK: Toast.makeText(getApplicationContext(), number+" Work number",Toast.LENGTH_SHORT ).show(); break; } } phones.close(); } cursor.close();
answers question: http://stackoverflow.com/q/22431372

http://stackoverflow.com/q/22328710
upvote count: 2
score: 1
tagged with: java
tagged with: multithreading
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22328947
has comment: http://stackoverflow.com/comment/33962049
tagged with: listview
answer count: 2
has answer: http://stackoverflow.com/a/22328943
favorite count: 0
has body: I need refresh my listview without clearing and blinking, just show new items. But I can't do that at once, because I getting items async during a few seconds. This code doesn't work correctly by the reason of clearing adapter at the very beginning of procedure. private void scanLeDevice(final boolean enable) { if (enable) { mLeDeviceListAdapterNew.clear(); //mLeDeviceListAdapterNew.notifyDataSetChanged(); // Stops scanning after a pre-defined scan period. mHandler.postDelayed(new Runnable() { @Override public void run() { mScanning = false; mBluetoothAdapter.stopLeScan(mLeScanCallback); runOnUiThread(new Runnable(){ @Override public void run() { mLeDeviceListAdapterNew.notifyDataSetChanged(); scanLeDevice(true); //invalidateOptionsMenu(); } }); } }, SCAN_PERIOD); //Here my adapter updates with new items, //but it's shouldn't be displayed until I call adapter //refresh data in SCAN_PERIOD
type: UnansweredQuestion
has title: Update ListView without clearing and blinking
tagged with: android
has comment: http://stackoverflow.com/comment/34152649
has comment: http://stackoverflow.com/comment/33933126
has comment: http://stackoverflow.com/comment/33932868

http://stackoverflow.com/comment/33993087
type: QuestionComment
has text: might suggest pulling down another version and starting eclipse from there, and connect to your existing workspace
comment on: http://stackoverflow.com/q/22362825
score: 0
type: Comment

http://stackoverflow.com/comment/34070220
type: QuestionComment
has text: Is this in the code? Or a marker? Or in the package explorer?
score: 2
comment on: http://stackoverflow.com/q/22408284
type: Comment

http://stackoverflow.com/comment/34035565
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22382041
type: Comment
has text: The `...Java3D\1.5.1\lib\ext` directory should also contain a `j3dutils.jar` - it's contained in this one.

http://stackoverflow.com/a/22408422
answers question: http://stackoverflow.com/q/22408284
has body: Exclamation mark in Eclipse means that Eclipse has detected some fault in your code but it has not been deemed critical enough to be marked as an error (Red color X marker) so it displays it instead as a yellow exclamation mark Signifying it as a warning not an error.
type: Answer
score: 0

http://stackoverflow.com/q/22333538
has comment: http://stackoverflow.com/comment/33940726
has comment: http://stackoverflow.com/comment/33940952
has comment: http://stackoverflow.com/comment/33940741
favorite count: 0
has body: I have a secondary thread which receives (array of strings) data from the network and then stores those values in a public String array (which has been declared outside the secondary thread) like this: //Code to fetch result in XML format URL GetCardXmlUrl = new URL("http://10.0.2.2:8080/searchresultxml/search_xml_output.xml"); URLConnection GetresultXmlConnection = GetCardXmlUrl.openConnection(); InputStream ResultInstream = new BufferedInputStream(GetresultXmlConnection.getInputStream()); Serializer PhoneBookSerializer = new Persister(); Search_info_xml parse_result_xml = PhoneBookSerializer.read(Search_info_xml.class, ResultInstream); SearchResult.this.mobile_nos = parse_result_xml.getPhones(); Log.d("note:", "getting stuff"); Log.d("number: ", mobile_nos[0]); Here mobile_no is the public variable. Log.d("number: ", mobile_nos[0]); successfully displays the value. But when I try to access the same array (after the secondary thread is done with it) from the main thread and try to populate a list from it, I get java.lang.NullPointerException error. Here is how I access my array: try { setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.phonebook_listview, mobile_nos)); } catch(Exception e) { e.printStackTrace(); } Here is how I have declared mobile_nos array: public String[] mobile_nos = new String[20]; Any idea what could be the problem? Or am I doing it wrong? EDIT: Full code, as requested. public class SearchResult extends ListActivity { public volatile String[] mobile_nos = new String[20]; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Get the search string sent by search.class via bundle Bundle valBundle = getIntent().getExtras(); String searchString = valBundle.getString("search_string"); Log.d("company: ", searchString); getSearchResult(searchString); try { setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.phonebook_listview, mobile_nos)); } catch(Exception e) { e.printStackTrace(); } …
has answer: http://stackoverflow.com/a/22335552
accepted answer: http://stackoverflow.com/a/22335552
tagged with: multithreading
tagged with: android
has answer: http://stackoverflow.com/a/22333733
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33941043
score: 2
downvote count: 0
has title: Array of strings populating inside secondary thread but primary thread shows array as null
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22333733
has comment: http://stackoverflow.com/comment/33941256
has comment: http://stackoverflow.com/comment/33941205
upvote count: 2
answer count: 2

http://stackoverflow.com/a/22392047
score: 10
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22391915
upvote count: 10
has body: Wrong on all counts. The method to be called is decided at runtime, in every case here, based on the runtime type of the object. The only decisions made at compile time are for calls to final, private, or static methods, or choices among a set of overloaded methods (which could still lead to runtime choices if the overloaded methods are not final, private, or static.)

http://stackoverflow.com/comment/33953358
score: 0
type: QuestionComment
type: Comment
has text: @Pshemo - You should post this as an answer.
comment on: http://stackoverflow.com/q/22340090

http://stackoverflow.com/q/22401909
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22402214
has title: Tomcat deployment creates 2 folders from single war file?
has answer: http://stackoverflow.com/a/37069823
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/37069823
answer count: 2
has body: I'm trying to deploy my developed TestMyApplication.war file to tomcat. Problem: on startup tomcat will create 2 folders in webapps: /TestMyApplication and /test. This results in errors as then 2 applications are trying to start. The content of these folders is identically. Why could this happen? And how can I prevent it?
tagged with: deployment
has answer: http://stackoverflow.com/a/22402214
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/comment/34144401
type: QuestionComment
comment on: http://stackoverflow.com/q/22449337
has text: possible duplicate of ["code too large" compilation error in java](http://stackoverflow.com/questions/2407912/code-too-large-compilation-error-in-java)
score: 0
type: Comment

http://stackoverflow.com/q/22389189
has comment: http://stackoverflow.com/comment/34037953
answer count: 1
has body: int a=0xFFFF; System.out.println("test1 "+Integer.toBinaryString(a)); a&lt;&lt;=1; System.out.println("test2 "+Integer.toBinaryString(a)); Output: test1 1111111111111111 test2 11111111111111110 My question is, where did the 0 came from?
accepted answer: http://stackoverflow.com/a/22389228
has title: Shifting bits, where did it came from?
tagged with: bit
has comment: http://stackoverflow.com/comment/34037943
has comment: http://stackoverflow.com/comment/34037819
has answer: http://stackoverflow.com/a/22389228
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/34037899
tagged with: java
has comment: http://stackoverflow.com/comment/34037944
score: 0

http://stackoverflow.com/a/22443872
score: 3
has comment: http://stackoverflow.com/comment/34134475
upvote count: 3
has comment: http://stackoverflow.com/comment/34134454
downvote count: 0
answers question: http://stackoverflow.com/q/22443850
has comment: http://stackoverflow.com/comment/34134473
type: Answer
has body: Because in the previous if, either the branch that ends with continue or the branch that ends with break will be executed. Both these instructions will cause the current iteration to end, so there is no way in which more code may be executed.
has comment: http://stackoverflow.com/comment/34134489

http://stackoverflow.com/comment/34096686
score: 0
comment on: http://stackoverflow.com/q/22422806
has text: But still did not help with the scollpane issue though :( I have tried putting it before "container" and even "bottom", but still no luck. It just makes a super-wide scroll and prevents the JTextPane's to word-wrap.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22418076
has comment: http://stackoverflow.com/comment/34088198
type: AnsweredQuestion
tagged with: user-interface
has title: How to not discard 0's at the beginning of a number that is parsed via Integer.parseInt
has comment: http://stackoverflow.com/comment/34088338
has answer: http://stackoverflow.com/a/22418108
type: Question
accepted answer: http://stackoverflow.com/a/22418108
tagged with: integer
has comment: http://stackoverflow.com/comment/34088220
has comment: http://stackoverflow.com/comment/34088325
score: 0
tagged with: java
tagged with: mysql
answer count: 1
has body: So I basically have a database that is stored externally on the server which I am connected to using the JDBC driver. I have a GUI where you can basically traverse through each record in the database, add/delete/modify data. I have a list of customer records and they have a passport number. The problem is if these numbers start with 0's, when I search for the passport number to see the record on the table it won't show. However when I search a customer who has the passport number such as 891029380 then this will show. When I am creating a customer and specify their passport number through the GUI then the full passport number will be stored on the database and it will record passport numbers that begin with 0's. Is there possibly any way of overriding the Integer.parseInt method where when specifying in a JTextField the passport number to search for a particular customer. It will show the customer's details relating to that number (a number beginning with 0's) rather than not.

http://stackoverflow.com/a/22336640
type: Answer
answers question: http://stackoverflow.com/q/22336509
score: 4
upvote count: 4
downvote count: 0
has body: The usual approach for problem-solving search is to develop a state space representation. You seem to want to explicitly represent all the states and transitions in a graph, but the more common approach is to design a state representation and then a process that will generate the successor states from a given state. The search process then relies on the successor state generator to expand a current state and carry out the search. I strongly recommend using a state generating function rather than building a complete state graph from the start. In your case, the state representation might be as simple as the current side of the river for each object (farmer, wolf, goat, and cabbage). The successor states for a given state are the farmer and possibly one of the objects currently on the same side as the farmer switching sides. You would probably want to filter out inadmissible states as part of the successor generation function. I don't recommend a string to represent the states, although it could work. An array of four booleans (each representing, say, "right side of the river") would be easier to work with.

http://stackoverflow.com/q/22365699
tagged with: osgi
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/22384228
accepted answer: http://stackoverflow.com/a/22384228
has title: Hot plug for web applications modules
has body: I have a web application running in a servlet container (Tomcat). My plan is to use hot plug in order to add and remove additional modules to the running web application. These additional modules just contain some business logic but not any web related stuff like servlets, JSP pages or HTML files. What is the best way to do this? I thought about switching from Tomcat to Glassfish in order to use OSGi. I also thought about using Apache Felix with Tomcat. What are the alternatives?
downvote count: 0
tagged with: glassfish
answer count: 1
favorite count: 0
tagged with: hotdeploy

http://stackoverflow.com/comment/34184335
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22472292
score: 0
has text: @Youngistan that's the complete trace, the error is caused on the `session.saveOrUpdate()` line

tomcat7
tags question: http://stackoverflow.com/q/22485581
tags question: http://stackoverflow.com/q/22439189
tags question: http://stackoverflow.com/q/22456236
tags question: http://stackoverflow.com/q/22354519
tags question: http://stackoverflow.com/q/22461745
tags question: http://stackoverflow.com/q/22463941
tags question: http://stackoverflow.com/q/22412012
tags question: http://stackoverflow.com/q/22443328
tags question: http://stackoverflow.com/q/22356790
type: Tag
tags question: http://stackoverflow.com/q/22409324
tags question: http://stackoverflow.com/q/22436361
tag name: tomcat7
tags question: http://stackoverflow.com/q/22343344

http://stackoverflow.com/a/22445008
score: 2
has comment: http://stackoverflow.com/comment/34137103
has comment: http://stackoverflow.com/comment/34136629
upvote count: 2
has comment: http://stackoverflow.com/comment/34136702
has comment: http://stackoverflow.com/comment/34136912
has comment: http://stackoverflow.com/comment/34136930
has comment: http://stackoverflow.com/comment/34136862
has body: You Could... Create a key/value property object which holds the two distinct values. You would then pass this to the JList as a single Object. You would need to supply a custom cell renderer in order to render the value appropriately. See How to use lists and Writing a Custom Cell Renderer for more details You Could... Use a JTable. While this would allow you to supply each value (key/value) as a separate column, I would still wrap the two in a key/value object, as it would make the management of these values simpler. This would allow you to interact with each side individually should you wish. See How to Use Tables for more details You Should... Make use of appropriate layout managers. Pixel perfect layouts (this.setLayout(null);) are an illusion in modern GUIs. There are so many aspects of the rendering pipeline you simply don't have control over, which would quickly turn your "pretty" layout on your system into alphabet soup on different systems Take a look at Laying Out Components Within a Container for more details.
has comment: http://stackoverflow.com/comment/34136596
has comment: http://stackoverflow.com/comment/34136725
downvote count: 0
has comment: http://stackoverflow.com/comment/34136803
has comment: http://stackoverflow.com/comment/34136971
has comment: http://stackoverflow.com/comment/34137058
has comment: http://stackoverflow.com/comment/34136757
has comment: http://stackoverflow.com/comment/34137018
type: Answer
has comment: http://stackoverflow.com/comment/34136842
has comment: http://stackoverflow.com/comment/34136794
answers question: http://stackoverflow.com/q/22444916
has comment: http://stackoverflow.com/comment/34136667
has comment: http://stackoverflow.com/comment/34136830

http://stackoverflow.com/a/22452043
has comment: http://stackoverflow.com/comment/34148125
has comment: http://stackoverflow.com/comment/34148794
has body: Try and do that: private static final Pattern PATTERN = Pattern.compile("\\p{IsL}+"); // ... final Matcher m = PATTERN.matcher(description); while (m.find()) System.out.println(m.group());
answers question: http://stackoverflow.com/q/22451915
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34148504
has comment: http://stackoverflow.com/comment/34148624

http://stackoverflow.com/a/22389584
type: Answer
answers question: http://stackoverflow.com/q/22389509
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22389509
has body: long i = Long.parseLong("f8004896", 16); System.out.println(i); System.out.println(Integer.MAX_VALUE); Output: 4160768150 2147483647
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34109615
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22429785
has text: I'd assume that `MenuItemCompat.getActionProvider(menuItem);` returns null, could you verify that please?
score: 0

mouselistener
tags question: http://stackoverflow.com/q/22358416
tags question: http://stackoverflow.com/q/22348685
tags question: http://stackoverflow.com/q/22419350
type: Tag
tags question: http://stackoverflow.com/q/22368610
tags question: http://stackoverflow.com/q/22339481
tag name: mouselistener
tags question: http://stackoverflow.com/q/22420121
tags question: http://stackoverflow.com/q/22344048

http://stackoverflow.com/a/22333577
has body: The second version attempts to synchronize on null, which will fail. The synchronized keyword attempts to acquire the lock on the Object referred to by obj, and since it is initially null, you will get a NulPointerException.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22333514
upvote count: 1
score: 1

http://stackoverflow.com/comment/33990685
comment on: http://stackoverflow.com/q/22361522
has text: Java 8 is being released next week and your use case is a perfect match for the new `Streams` API.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22396122
possible better answer: http://stackoverflow.com/a/33750417
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: gemfire custom serialization not helping
type: Question
has answer: http://stackoverflow.com/a/22411567
has comment: http://stackoverflow.com/comment/34051331
answer count: 2
tagged with: gemfire
downvote count: 0
tagged with: deserialization
accepted answer: http://stackoverflow.com/a/22411567
favorite count: 0
has answer: http://stackoverflow.com/a/33750417
tagged with: serialization
has body: I am using gemfire as my cache. The cache heap size is well above 100GB. I discovered that when we put data in gemfire cache from client, it would serialize the data and send to server, and on server the data is stored in serialized form. Problems: When i try to execute any on-server function call, it then starts deserializing the data and it is really time consuming, some times it takes more than an hour just to iterate through the objects in cache. (Number of objects are close to 6 million). I tried using gemfire custom serialization (DataSerializer class). And the amount of memory it takes after all the data is in cache is about 60GB which is the same if I were to use Java default serialization. I tried using a library called Kryo https://github.com/EsotericSoftware/kryo and that does helps a lot, but i still don't understand why gemfire serialization doesn't help me as i am serializing each attribute of the class individually so there shouldn't be any burden to write class headers and any other meta data. Any help would be really appreciated.

http://stackoverflow.com/a/22338553
score: 3
answers question: http://stackoverflow.com/q/22338519
downvote count: 0
has body: Simply loop through your ArrayList and multiply away: int foo=1; for(int i : list) { foo *= i; }
upvote count: 3
type: Answer

http://stackoverflow.com/a/22366348
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33998834
has comment: http://stackoverflow.com/comment/34001866
has comment: http://stackoverflow.com/comment/33998849
answers question: http://stackoverflow.com/q/22366301
has body: You can't just clear() the byte buffer. You need to allocate a new one; otherwise the same buffer is being added to listBuffers repeatedly. ByteBuffer buff = ByteBuffer.allocate(BUFFER_SIZE); while( sc.read(buff) &gt; -1){ if(buff.remaining() == 0){ listBuffers.add(buff); buff = ByteBuffer.allocate(BUFFER_SIZE); } } if (buff.position() &gt; 0) { listBuffers.add(buff); } Since the last buffer might not (probably will not) be full, you should calculate the finalBuffer size taking this into account.
upvote count: 2
has comment: http://stackoverflow.com/comment/33999025
has comment: http://stackoverflow.com/comment/34040559
has comment: http://stackoverflow.com/comment/33999011
type: Answer

http://stackoverflow.com/a/22825792
downvote count: 1
upvote count: 0
accepted answer of: http://stackoverflow.com/q/22440864
answers question: http://stackoverflow.com/q/22440864
has body: A friend and I were able to (painfully) figure out a solution to this problem using Python. I would still love to learn a way to do a similar task with R. Below is the code: import mechanize from bs4 import BeautifulSoup URL = "http://www.censusindia.gov.in/Census_Data_2001/Village_Directory/View_data/Village_Profile.aspx" def select_element(br, form, value): br.select_form(nr=0) br[form] = [value] return br.submit() def get_page(state, district, sub_district, village): """ Get village data """ # I have no idea why exactly this works, the form uses javascript callbacks and # it seems that you need to submit the form for each selection or you get an error. br = mechanize.Browser() br.open(URL) # Could probably parse the responses at each stage to get valid entries for the next sub-unit. select_element(br, 'ctl00$Body_Content$drpState', state) # read html and pull out disticts select_element(br, 'ctl00$Body_Content$drpDistrict', district) select_element(br, 'ctl00$Body_Content$drpSubDistrict', sub_district) r2 = select_element(br, 'ctl00$Body_Content$drpVillage', village) return r2.read() state = '35' district = '01' sub_district = '0004' village = '00026500' print(get_page(state, district, sub_district, village)) parameters = {'35': {'01': {'0004': ['00026500']}}} foo = [] for state, districts in parameters.items(): for district, subdistricts in districts.items(): for subdistrict, villages in subdistricts.items(): for village in villages: foo.append(get_page(state, district, subdistrict, village)) with open('foo', 'w') as f: f.write(get_page(state, district, subdistrict, village)) I am very new to Python and prefer to use R for this task. Is this possible?
type: AcceptedAnswer
score: -1
type: Answer

http://stackoverflow.com/q/22468303
has comment: http://stackoverflow.com/comment/34177410
downvote count: 0
possible better answer: http://stackoverflow.com/a/22468589
favorite count: 0
has answer: http://stackoverflow.com/a/22468589
has comment: http://stackoverflow.com/comment/34177214
upvote count: 2
has answer: http://stackoverflow.com/a/22468542
has comment: http://stackoverflow.com/comment/34177467
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: try-catch
tagged with: actionlistener
accepted answer: http://stackoverflow.com/a/22468542
answer count: 2
has body: I have a small issue with my updateButtonResults button. I have JOptionPane Message Dialogs that are programmed to pop up when the user updates the four fields First Name, Last Name, E-mail and Sign-up date. My problem is all 4 messages pop up, even if I only update one field. Example: I update a customers last name, the message dialogs will pop up in this order (First name, Last name, E-mail, Sign-up date). Here is my code //method for buttons on 'resultFrame' public void BtnAction3() { updateButtonResults.addActionListener( new ActionListener() { //method for events that will be performed when updateButton is pressed public void actionPerformed(ActionEvent e) { //instanciates variables to text in textfields String fname = fNameTextBoxResults.getText(); String lname = lNameTextBoxResults.getText(); String email = eMailTextBoxResults.getText(); String signUpDate = signUpTextBoxResults.getText(); try { //statement that checks to make sure user enters only letters if(fname.matches("[a-zA-Z]+")) { //updates 'Fname' field in db to text that user inputted in 'fname' textfield rs2.updateString("Fname", fname); JOptionPane.showMessageDialog(null, "Customer first name been updated!"); } //statement that prompts user if they enter something other letters else { JOptionPane.showMessageDialog(null, "Please enter first name in correct format!"); fNameTextBoxResults.setText(""); } //statement that checks to make sure user enters only letters if(lname.matches("[a-zA-Z]+")) { //updates 'Lname' field in db to text that user inputted in 'lname' textfield rs2.updateString("Lname", lname); JOptionPane.showMessageDialog(null, "Customer last name been updated!"); } //statement that prompts user if they enter something other letters else { JOptionPane.showMessageDialog(null, "Please enter last name in correct format!"); lNameTextBoxResults.setText(""); } //statement and actions if user enters a '.' if(email.contains(".")) { //gets last period in "email" int emailDotCheck = email.lastInde…
linked to: http://stackoverflow.com/q/3953208
has title: ActionListener Logical Error (Java)
has comment: http://stackoverflow.com/comment/34177481
tagged with: logic

http://stackoverflow.com/q/22338131
has title: Android Separating two numbers with comma
has comment: http://stackoverflow.com/comment/33949034
accepted answer: http://stackoverflow.com/a/22338312
has comment: http://stackoverflow.com/comment/33949097
has answer: http://stackoverflow.com/a/22338312
type: AnsweredQuestion
has body: At this moment my code separating like this 1,2,1,2,1,2,2,2,1 and i want to make this 11,22,12,21,11,11,11 my code: public void onClick(View arg0) { ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); switch(arg0.getId()){ case R.id.one: //disp.append("1"); list.add("1"); break; case R.id.two: list.add("2"); } StringBuilder sb = new StringBuilder(); for (String s : list) { sb.append(s); if (sb.length() &gt; 0) sb.append(","); } String returnedItems = sb.toString(); System.out.println(returnedItems); disp.append(returnedItems); } any idea and help, im new in java and programming
tagged with: java
has comment: http://stackoverflow.com/comment/33949092
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33949120
answer count: 1

http://stackoverflow.com/q/22341480
type: Question
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/22341566
upvote count: 0
has comment: http://stackoverflow.com/comment/33954857
tagged with: arrays
score: -1
has comment: http://stackoverflow.com/comment/33954870
duplicate of: http://stackoverflow.com/q/218384
tagged with: binary-search
tagged with: selection-sort
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/33954902
has comment: http://stackoverflow.com/comment/33955035
favorite count: 0
has answer: http://stackoverflow.com/a/22341871
type: UnansweredQuestion
has title: I can't figure out how to fix the nullpointererror in Java
answer count: 4
has body: I am writing a program that takes a file and writes it's contents to an array. Then the array is sorted with a selection sort algorithm and then can be searched using the binary search algorithm. The array can not have more than 100 elements and I can't use user-defined classes. /*Griffen Fox CS 110 Assignment 5 Question 1 */ import java.util.Scanner; import java.io.*; public class WordsSearchProgram { public static void main(String[] args)throws IOException { //Loads Words.txt to an array final int SIZE = 100; //Size of the array String[] words = new String[SIZE]; // creates the array int index = 0; // Loop Control Variable //Opens the File File file = new File("words.txt"); Scanner inputFile = new Scanner(file); //Reads Contents Into Array while (inputFile.hasNext() &amp;&amp; index &lt; words.length) { words[index] = inputFile.nextLine(); index++; } //Close File inputFile.close(); int search; for (index = 0; index &lt; words.length; index++) { search = searchString(words, words[index]); if (search &gt;= 0) { System.out.println(words[index] + " is at index " + search); } else { System.out.println(words[index] + " is not in the array."); } } } //Selection Sort Algorithm public static String[] sort(String[] words) { for (int i = words.length - 1; i &gt;= 1; i--) { // Find the maximum in the list[0..i] String currentMax = words[0]; int currentMaxIndex = 0; for (int j = 1; j &lt;= i; j++) { if (currentMax.compareTo(words[j]) &lt; 0) { currentMax = words[j]; currentMaxIndex = j; } } // Swap list[i] with list[currentMaxIndex] if necessary; if (currentMaxIndex != i) { words[currentMaxIndex] = words[i]; words[i] = currentMax; } } return words; } //Binary Search String public static int searchString(String[] words, String key) { int first = 0; int last = words.length; int position = -1; boolean found = false; while (!found &amp;&amp; first &lt;= last) { int mid = ((first + last) / 2); if (key.compareTo(words[mid]) == 0) { found = true; position = mid; } else if (key.compar…
has comment: http://stackoverflow.com/comment/33954919
has answer: http://stackoverflow.com/a/22341589
tagged with: java
has answer: http://stackoverflow.com/a/22341650
has comment: http://stackoverflow.com/comment/33954836
downvote count: 1

http://stackoverflow.com/comment/33937481
score: 0
has text: What have you tried? What don't you understand? Are you asking how to make a GUI? How to handle a button click? How to call your function?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22331641

http://stackoverflow.com/q/22411104
type: AnsweredQuestion
tagged with: file
has comment: http://stackoverflow.com/comment/34081015
type: Question
has comment: http://stackoverflow.com/comment/34083501
tagged with: java
tagged with: memory
score: 0
has body: Sort of new to Java but I've been able to learn quite a bit quite quickly. There are still many methods that elude me though. I'm writing a Java program that is to run through a bunch of files and test them thoroughly to see if they are a valid level pack file. Thanks to Matt Olenik and his GobFile class (which was only meant to extract files) I was able to figure out a good strategy to get to the important parts of the level pack and their individual map files to determine various details quickly. However, testing it on 37 files (5 of which aren't level packs), it crashes after testing 35 files. The 35th file is a valid level pack. The error it gives is: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space Iterator iter = itemList.keySet().iterator(); numJKLs = 0; while (iter.hasNext()) { String nextFile = (String) iter.next(); if (nextFile.startsWith("jkl\\")) { System.out.println(((ItemInfo) itemList.get(nextFile)).length); --&gt; byte[] buffer = new byte[((ItemInfo) itemList.get(nextFile)).length]; gobRaf.seek(((ItemInfo) itemList.get(nextFile)).offset); gobRaf.read(buffer, 0, ((ItemInfo) itemList.get(nextFile)).length); String[] content = new String(buffer).toLowerCase().split( "\n"); levels.add(numJKLs, new JKLFile(theFile, nextFile, content)); gametype = levels.get(numJKLs).getFileType(); progress.setProgText(nextFile); buffer = null; content = null; numJKLs++; } } Arrow shows where the error is marked. The ´JKLFile´ class reads the content array for these important parts, but should (in theory) dispose of it when done. Like here, I set content = null; in JKLFile just to make sure it is gone. If you are wondering how big the map file it stopped on is, well, it managed to pass a 17 Mb map file, but this one was only 5 Mb. As you can see these JKLFile objects are kept in this object (GobFile.java) for easy access later on, and the GobFile objects are kept in another class for later access, until I change directory (not implemented yet). But th…
answer count: 1
has comment: http://stackoverflow.com/comment/34081598
has answer: http://stackoverflow.com/a/22411257
tagged with: out-of-memory
has comment: http://stackoverflow.com/comment/34075890
has title: Java - byte buffer Out Of Memory
has comment: http://stackoverflow.com/comment/34080888
accepted answer: http://stackoverflow.com/a/22411257

http://stackoverflow.com/comment/34076073
comment on: http://stackoverflow.com/a/22410365
score: 0
type: Comment
has text: When I do that I get a JavaFX Launcher Error: Exception while running Application.
type: AnswerComment

http://stackoverflow.com/comment/34163585
comment on: http://stackoverflow.com/a/22460432
type: Comment
has text: This means you are trying to overwrite a non empty directory; `newP` is probably a directory there. Do you want to copy a file or an entire directory tree?
score: 0
type: AnswerComment

http://stackoverflow.com/q/22436387
tagged with: java
linked to: http://stackoverflow.com/q/9515635
linked to: http://stackoverflow.com/q/879807
has comment: http://stackoverflow.com/comment/34120188
type: Question
has body: I have around 500-1000 entities where each has a name and string content. To find how these entities are connected every name in every content field has to be searched. Entities can be edited, so I might have to rebuild connections for an edited entity by searching its name in all content fields again. Exact string matching (.indexOf or .contains) is not an option as there are further rules: names can consist of multiple words and predefined special chars (_, /, -, ,, ...) names may be surrounded by special chars and will still be recognized names may be ended by predefined plural endings (s, es, ...) and will still be recognized Example names: fine apple juice, apple, app, _n, n Example content: apps are like fine apple juice_n matches all example names edit: Clarification on rule 2: a match must not be something like "appxxy" or other gibberish but separated words by blanks (or the special chars). I have looked through various possible solutions such as Aho-Corasick, using regex, string-search, regex pattern, Apache Lucene or using a custom Scanner with WordDetector. However I'm lost when choosing which one is best suited for my purpose and best in performance as I'm not too experienced in programming.
has comment: http://stackoverflow.com/comment/34127436
tagged with: algorithm
score: 4
has title: Efficient Java complex pattern string search
tagged with: search
upvote count: 4
has comment: http://stackoverflow.com/comment/34120731
downvote count: 0
tagged with: string
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34120515
has comment: http://stackoverflow.com/comment/34125071
has comment: http://stackoverflow.com/comment/34130535
answer count: 0
has comment: http://stackoverflow.com/comment/34125989

http://stackoverflow.com/q/22423589
upvote count: 2
tagged with: java
has title: Import com.google.android.gms.maps.model.LatLng to Netbeans
type: Question
downvote count: 0
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
has body: Is there a way to import a certain library of Android to Netbeans?
tagged with: android
score: 2
answer count: 0

http://stackoverflow.com/comment/34205056
type: Comment
comment on: http://stackoverflow.com/q/22484510
score: 0
type: QuestionComment
has text: By looking at the source code, the usage seems exactly the same: http://nsoup.codeplex.com/SourceControl/latest#NSoup/NSoup.cs Did you even try it?

http://stackoverflow.com/comment/34157846
score: 0
type: QuestionComment
has text: I am trying what you gave me in the link but "this.getSystem.Service" does not exist... what should I do?
comment on: http://stackoverflow.com/q/22444382
type: Comment

http://stackoverflow.com/q/22357794
tagged with: jtable
has title: JTable rendering breaks on replacing row
has body: The program is 2 Synchronized ArrayLists that is modified by 2 threads. First thread is a socket listener which creates objects. And second is swing EDT in which button can move an object from an array 1 to array 2. Both arrays are represented as a JTable. Objects have View object inside of them which holds Component for every table cell to render. Some fields are updated real time , most are not. When I add the first line everything works fine and then remove it from the table it , it disappears properly adding a new line in its place , the field in column 0 does not render until I click on it ,all other fields render properly. Real time field render properly. Object visual representation class public class View implements MouseListener { public final List&lt;JTextField&gt; symbols = new ArrayList&lt;&gt;(); public final List&lt;JTextField&gt; ratios = new ArrayList&lt;&gt;(); public final kosilkshik.Position source; public final JTextField name = new JTextField(); public final JTextField mkt = new TextFieldNumber(String.valueOf(mktTime), 2); public final JTextField p = new TextFieldNumber(String.valueOf(pTime), 2); public final JTextField flip = new TextFieldNumber(String.valueOf(flipTime), 2); public final JTextField current = new TextFieldNumber(String.valueOf(currentQty), 2); public final JTextField qt = new TextFieldNumber(String.valueOf(getQty()), 2); public final JTextField buy = new TextFieldNumber(String.valueOf(buyAt), 2); public final JTextField sell = new TextFieldNumber(String.valueOf(sellAt), 2); public final JTextField avg = new JTextField(String.valueOf(average), 2); public final JTextField bid = new JTextField(String.valueOf(average), 2); public final JTextField ask = new JTextField(String.valueOf(average), 2); public final JCheckBox invert = new JCheckBox(); public JButton control; public JButton control1; public JButton control2; public JButton control3; { bid.setEditable(false); ask.setEditable(false); avg.setEditable(false); name.setText(makeNa…
has answer: http://stackoverflow.com/a/22541018
score: 0
tagged with: swing
possible better answer: http://stackoverflow.com/a/22358737
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22358737
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22541018
answer count: 2

http://stackoverflow.com/q/22465194
type: Question
score: 0
has answer: http://stackoverflow.com/a/22465246
has title: Class not found in project error in Netbeans
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34171570
tagged with: netbeans
has body: The following is my code: package student; public class Student { private String idNumber; private int creditHoursEarned; private int pointsEarned; public Student(){ this.idNumber = "9999"; this.creditHoursEarned = 3; this.pointsEarned = 12; } public String getIdNumber() { return idNumber; } public void setIdNumber(String idNumber) { this.idNumber = idNumber; } public int getCreditHoursEarned() { return creditHoursEarned; } public void setCreditHoursEarned(int creditHoursEarned) { this.creditHoursEarned = creditHoursEarned; } public int getPointsEarned() { return pointsEarned; } public void setPointsEarned(int pointsEarned) { this.pointsEarned = pointsEarned; } public double calculateGpa() { double gradePointAverage = (double)pointsEarned / creditHoursEarned; return gradePointAverage; } public String toString() { return "Student --"+ "Id Number: " + idNumber+ ", Credit Hours Earned: " + creditHoursEarned+ ", Points Earned: " + pointsEarned; } } When I try to run it in Netbeans IDE 7.4 I get and error: student.Student class wasn't found in Student project
tagged with: java

http://stackoverflow.com/comment/34066623
comment on: http://stackoverflow.com/q/22406237
score: 0
type: Comment
has text: Read http://docs.oracle.com/javase/tutorial/essential/io/notification.html for watching a Directory for Changes using Java.
type: QuestionComment

http://stackoverflow.com/comment/34188062
comment on: http://stackoverflow.com/q/22464508
type: Comment
has text: Can you post the few lines where you create the SXSSFWorkbook?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34211562
type: QuestionComment
comment on: http://stackoverflow.com/q/22487585
has text: Could you please point me to a tutorial or reference of this?
score: 0
type: Comment

http://stackoverflow.com/comment/34290748
type: Comment
has text: That bit of information helps, yes. That would implicate the JSP compiler, not necessarily the EL implementation. Unless there's a nested exception, in which case that would be what I would need. Even a stack trace of generated code tells a story.
type: AnswerComment
comment on: http://stackoverflow.com/a/22522537
score: 0

http://stackoverflow.com/comment/34151201
has text: Can you share a SSCCE? See http://sscce.org if you don't know what I mean by this.
comment on: http://stackoverflow.com/q/22375929
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/44447840
comment on: http://stackoverflow.com/q/22481624
score: 0
type: Comment
type: QuestionComment
has text: Just a hint for debuging. You still have about 4? method calls which actually return something and you totaly skipped them. So store them in some variable and you might find something usefull.

http://stackoverflow.com/comment/33962806
type: QuestionComment
comment on: http://stackoverflow.com/q/22345843
score: 1
has text: If it is working 160 times before fail then I would guess it is a resource error or multi-thread error, not because you are not validating your cert.
type: Comment

http://stackoverflow.com/comment/34091716
score: 0
type: AnswerComment
type: Comment
has text: still doesn't work (I presume I'm supposed to add bob.getPosition().add(speed,0); to the end of your routine?)
comment on: http://stackoverflow.com/a/22386803

http://stackoverflow.com/comment/33949395
comment on: http://stackoverflow.com/a/22338116
type: AnswerComment
has text: @Mike, my teacher gave us this code and expects usto just follow it to finish the rest of the program. If I started this program myself it ightve been a lot easier. Can you please show me what my ReadFile() method should look like because I am pretty sure I am screwing up my code right now following both of your advice...you guys are giving me 2 seperate instructions lol...I just want this thing to work...Would you mind putting in CODE tags please
score: 0
type: Comment

http://stackoverflow.com/comment/34074830
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22410439
has text: @user2030307 you need to customize your `public void onClick(DialogInterface dialog,int id)` present inside the `setPositiveButton'
score: 0

http://stackoverflow.com/comment/33939310
type: AnswerComment
score: 0
type: Comment
has text: @mike Well, this is the best you can get.
comment on: http://stackoverflow.com/a/22332645

http://stackoverflow.com/comment/34114259
score: 1
has text: Well, the first link I'd point to is [the javadoc for `ProcessBuilder`](http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html). It is immensely configurable (for instance, set the working directory, modify the environment etc), so any further link than that would only restrict your imagination :)
comment on: http://stackoverflow.com/q/22432767
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22367816
favorite count: 0
tagged with: code-organization
has comment: http://stackoverflow.com/comment/34001379
type: AnsweredQuestion
tagged with: recursion
score: 2
has answer: http://stackoverflow.com/a/22367873
upvote count: 2
tagged with: stack
tagged with: java
has body: I'm trying to figure out how I can write this method to avoid the stack buildup from recursively calling the method in the exception? Here is the wording of my instructions: Read a number, use an exception handler to make sure it is an int number and then add to the ArrayList object, aryList. Here is my attempt: public void createOriginalAryList() { Scanner keyboard = new Scanner(System.in); System.out.println("Enter a number: "); try { int number = keyboard.nextInt(); aryList.add(number); while(keyboard.hasNextInt()) { System.out.println("Enter a number: "); number = keyboard.nextInt(); aryList.add(number); } } catch(InputMismatchException ime) { System.out.println("Invalid number submitted! Try again."); createOriginalAryList(); } System.out.println(aryList); } Any suggestions are greatly appreciated!
type: Question
has title: How to avoid stack build up?
tagged with: callstack
accepted answer: http://stackoverflow.com/a/22367873
answer count: 1
downvote count: 0

http://stackoverflow.com/q/22348159
answer count: 1
has body: I need to populate JComboBox with days as follows: April 1, 2014 April 2, 2014 ... April 10,2014 I am using JodaTime to define dates. However, I don't know how to create an iterater over days in JodaTime. JComboBox&lt;String&gt; days = new JComboBox&lt;String&gt;(); DateTime startD = new DateTime(2014, 4, 1, 0, 0, 0); for (int i=0; i&lt;10; i++) { // DateTime nextD = ... days.addItem(startD.toString(DateTimeFormat.forPattern("yyyyMMdd"))); }
tagged with: datetime
has answer: http://stackoverflow.com/a/22348250
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33966808
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22348250
tagged with: jodatime
has title: How to create an iterater over days in JodaTime
score: 0
tagged with: iterator

http://stackoverflow.com/comment/33950945
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22338598
score: 0
has text: @sasankad I assumed `LoginTimeout` is different than "idle timeout"?

http://stackoverflow.com/a/22447927
answers question: http://stackoverflow.com/q/22447823
type: Answer
has body: base on your png, it seems like you're using support v4 package,in this case you'll need to replace getFragmentManager with getSupportFragmentManager
has comment: http://stackoverflow.com/comment/34154819
score: 0

http://stackoverflow.com/comment/33960129
comment on: http://stackoverflow.com/a/22344186
type: AnswerComment
has text: @PankajKumar +1 up for your _Awesome_ answer.
score: 0
type: Comment

http://stackoverflow.com/a/22428413
has comment: http://stackoverflow.com/comment/34106353
has comment: http://stackoverflow.com/comment/34106113
has comment: http://stackoverflow.com/comment/34106326
answers question: http://stackoverflow.com/q/22428270
type: Answer
score: 0
has body: I think I finally understand what you want to do... final double threshold = 0.00005; boolean failed = false; do { for (int i = 0; i &lt; V.length; i++) { double Vold = V[i]; V[i] = updateValue(V[i]); if (V[i] - Vold &gt; threshold) { failed = true; // Not sure if you want this break in here - it's still unclear what you really want break; } } } while (failed); Where updateValue() is some function or expression that implements the desired update.
has comment: http://stackoverflow.com/comment/34106188

http://stackoverflow.com/comment/33949312
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22335712
has text: There is only one process running: the JVM. It is repeatable that I can delete the file individually from Scala, unless the file is returned to me from the code the searches for duplicate files, so I cannot imagine there would be any other process holding a lock. Good idea, though, so thanks for the tip.

http://stackoverflow.com/q/22350435
has comment: http://stackoverflow.com/comment/33970853
score: 1
has comment: http://stackoverflow.com/comment/33970380
tagged with: java
tagged with: mysql
upvote count: 1
has answer: http://stackoverflow.com/a/22350762
type: Question
has comment: http://stackoverflow.com/comment/33970689
has body: I have linked up a database to my Java application using the JDBC in Netbeans. On my database I have a table with 3 fields : ID FirstName Surname I am looking to type a number into the id text field in the application, click save and allow the id inputted by the user from the text field save in the ID section in the database table. I am a student new to all of this so please forgive me if I am asking the right way or in the wrong section, I have already searched thoroughly for a working example, any help would be much appreciated.
has title: How to read text from a text field and input it into a database table
tagged with: database
tagged with: sql
has comment: http://stackoverflow.com/comment/33970202
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22334678
has comment: http://stackoverflow.com/comment/33962683
answers question: http://stackoverflow.com/q/22332601
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22332601
score: 1
has body: Where are you calling setScreen? Since everything should be happening in the rendering thread (even InputListeners) you should be able to call setScreen in your first Screen and then return from the render method. The Game instance will automatically call hide on your first Screen which is where you can call dispose.

http://stackoverflow.com/comment/33947338
type: QuestionComment
has text: Op just start implementing your library and change it as you go. Not even the best programmer can predict what (not) to put in a common library, but as you go along you keep refactoring. Just make sure you appreciate and stick to well known design patterns.
score: 0
comment on: http://stackoverflow.com/q/22337045
type: Comment

http://stackoverflow.com/q/22454357
has comment: http://stackoverflow.com/comment/34152724
tagged with: java
tagged with: slick2d
has body: i need some help in Java Slick2D library, from my experience in coding with this library i understood that the class which extends BasicGameState will call the update() and the render() methodes in an infinite loop, my problem is to find a way to call some methodes in render() methode which has some movement of a sprite, for exemple i have this methode : public void move(Graphics g, Image sprite, int X, int Y){ for(int i = 0; i &lt; 32; i++) g.drawImage(sprite, X+i, Y); } when i call move(g, sprite, posX, PosY) in render() methode my sprite will teleport to the next 32 pixels without showing animations. what should i do to solve this problem and make my sprite moving correctly ?
has answer: http://stackoverflow.com/a/22492557
answer count: 1
score: 0
has title: how to make slick2D showing movement of my sprite
type: UnansweredQuestion
type: Question

http://stackoverflow.com/q/22477891
tagged with: http://stackoverflow.com/tag/html
type: AnsweredQuestion
has title: get current url of context
accepted answer: http://stackoverflow.com/a/22479132
type: Question
tagged with: java
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/3655316
has body: I want to get the current URL of my website. Not the context, not the ports, not the scheme or the protocol. Only the relative url. For example: https://www.myurl.com/context/relative/url/site.mvc I want to have: /relative/url/site.mvc ${pageContext.request.contextPath} gives me: /context/ ${pageContext.request.requestURL} gives me https://www.myurl.com/context/WEB-INF/tiles/relative/url/site/center.jsp Thats where the site is located in my directory. But I want the relative path of the website... without Javascript!
tagged with: jsp
possible better answer: http://stackoverflow.com/a/22478190
has answer: http://stackoverflow.com/a/22478190
has answer: http://stackoverflow.com/a/22479132

http://stackoverflow.com/comment/34143827
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22449337
has text: Why do you need your own `MyLabels` class if you're using properties files? Doesn't the `Properties` class work for your requirements?

http://stackoverflow.com/comment/34196085
has text: Yes. Thanks for your prompt response. But I added content type as "image/png" for a file named ex: Image.PNG. Still I got a response like a unicode value. Please refer the attached screenshot
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22475881
type: QuestionComment

http://stackoverflow.com/a/22455140
answers question: http://stackoverflow.com/q/22454985
has body: try this, String str="http://www.youtube.com/embed/SomER1aNdomTexT?list=UUDvJQzC6YfBdOMkbQGUekOg"; String re1="(embed)"; // Word 1 String re2="(\\/)"; // Any Single Character 1 String re3="((?:[a-z][a-z]+))"; // Word 2 String re4=".*?"; // Non-greedy match on filler String re5="(\\?)"; // Any Single Character 2 String []st1=str.split("embed\\/"); String []st2=st1[1].split("\\?list"); System.out.println(st2[0]);
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22454985
type: AcceptedAnswer
downvote count: 0

hql
tag name: hql
tags question: http://stackoverflow.com/q/22449359
type: Tag
tags question: http://stackoverflow.com/q/22356184
tags question: http://stackoverflow.com/q/22478321

http://stackoverflow.com/a/22417869
has comment: http://stackoverflow.com/comment/34133625
has body: A 302 redirect is notice to the browsing client that the document has been moved, it won't necessarily give you the content unless your browsing client follows the redirect. Try using cURL with the -L argument to have it follow the redirect. Try this curl -vv -L http://......
type: Answer
has comment: http://stackoverflow.com/comment/34095662
answers question: http://stackoverflow.com/q/22417825
score: 0

http://stackoverflow.com/comment/34137360
has text: My observation, having actually worked on the implementation of charAt and array indexing, is that the main difference between the two is that you have (if not inlined by the JITC) a method call per character with charAt and only one method call per String with array indexing. Unless you were processing a lot of characters in each String, or performance was *very* critical, I'd go with charAt for simplicity.
comment on: http://stackoverflow.com/q/22445104
type: QuestionComment
type: Comment
score: 3

http://stackoverflow.com/a/22345635
has comment: http://stackoverflow.com/comment/33962306
has body: We can't figure out what is causing the memory leak by just looking at code like this. So what you really need to do are the followings: First: Track your application while that memory leak using vesualVM, generate a heap dump and thread dump, then analyze the heap, you will find the exact objects that takes that much of memory, and the thread dump will show you where is you code currently executing, after that you'll be able to fix your code. Second: you need to look at the JVM memory parameter, it will help you to optimize your application 1) This parameters will not avoid the memory leak but its good to know: -Xmx2048m -&gt; this param to set the max memory that the JVM can allocate -Xms1024m -&gt; the init memory that JVM will allocate on the start up -XX:MaxPermSize=512M -&gt; this for the max Permanent Generation memory 2) this parameter will speed up the GC so GC will have more proportionality to clean up you memory -XX:MaxNewSize= -&gt; this need to be 40% from your Xmx value -XX:NewSize=614m -&gt; this need to be 40% from your Xmx value 3) never ever use System.gc, use CMS garbage collector. -XX:+UseConcMarkSweepGC
has comment: http://stackoverflow.com/comment/33962543
score: 0
answers question: http://stackoverflow.com/q/22345437
type: Answer
has comment: http://stackoverflow.com/comment/33962650

http://stackoverflow.com/q/22440765
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22440907
has answer: http://stackoverflow.com/a/22440922
has body: //Getting Prime numbers from 2 to given range. //When Inner for loop is running for number 2, it is printing 9 as a prime number. import java.util.*; import java.io.*; class A { public static void main(String args[]) { System.out.println("Enter the number till which the prime number is to be printed:"); Scanner sc = new Scanner(System.in); int limit = sc.nextInt(); System.out.println("Printing the prime numbers from 1 to "+limit); for(int num =2; num&lt;=limit; num++) { for(int d=2; d&lt;=num; d++) { if(num%d == 0) { break; } if() { System.out.println(num); break; } } } } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34128510
has comment: http://stackoverflow.com/comment/34128460
has answer: http://stackoverflow.com/a/22440894
tagged with: java
type: Question
has title: Showing NINE as a prime number while executing this code.Help me

notnull
type: Tag
tag name: notnull
tags question: http://stackoverflow.com/q/22451394

http://stackoverflow.com/comment/33991319
type: QuestionComment
comment on: http://stackoverflow.com/q/22362293
score: 0
has text: Put the code the show the menu and read the input in a function and call it where you want to display it again
type: Comment

http://stackoverflow.com/a/22473670
type: Answer
accepted answer of: http://stackoverflow.com/q/22473301
answers question: http://stackoverflow.com/q/22473301
has body: In curl -F means post the form data, usually the content type is multipart/form-data. You can use the Apache HttpClient library for this purpose in Java. Here is an example of posting form using MultipartRequestEntity. Before looking into this example, I'll suggest you to try this example to be habituated with normal http POST.
has comment: http://stackoverflow.com/comment/34197694
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/22384805
answers question: http://stackoverflow.com/q/22381379
type: Answer
score: 4
has body: 0xFFFF has a bit pattern of 11111111 11111111. Divide up the bits according to UTF-8 rules and the pattern becomes 1111 111111 111111. Now add UTF-8's prefix bits and the pattern becomes *1110*1111 *10*111111 *10*111111, which is 0xEF 0xBF 0xBF, aka 239 191 191, aka -17 -65 -65 in twos complement format (which is what Java uses for signed values - Java does not have unsigned data types).
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/22402214
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22401909
answers question: http://stackoverflow.com/q/22401909
type: Answer
has body: Just for reference: The path attribute in server.xml was pointing to /test, whereas the war name was different. That caused the duplicate deployment.
score: 0

http://stackoverflow.com/comment/34020194
comment on: http://stackoverflow.com/a/22363206
has text: i dont have it open right now, but it should be, right click on the project, and select properties. ill update when i open it.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22441276
answer count: 2
has answer: http://stackoverflow.com/a/22441462
tagged with: loops
tagged with: recursion
has comment: http://stackoverflow.com/comment/34129514
tagged with: algorithm
tagged with: java
has title: How to find N grams of a word in Java?
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34129519
type: UnansweredQuestion
tagged with: string
has comment: http://stackoverflow.com/comment/34130141
favorite count: 0
has comment: http://stackoverflow.com/comment/34129656
type: Question
has body: For example if the input is "name" and the minGram is 1 and maxGramSize is 2 output will consist of n,a,m,e,na,am,me. If the minGram=2, maxGram=4 inputWord=name, output = na,am,me,nam,ame,name. Function signature can be something like this: public List&lt;String&gt; generateNGrams(String input, int minGramSize, int maxGramSize) Initially I tried doing it with for loops, but I was finding it hard to follow the indices. Then I tried solving it using recursion with pen and paper but I'm still struggling with it. Can someone help me with this?
has answer: http://stackoverflow.com/a/22441728
has comment: http://stackoverflow.com/comment/34129623
upvote count: 2
has comment: http://stackoverflow.com/comment/34307723

http://stackoverflow.com/q/22432901
score: 1
has comment: http://stackoverflow.com/comment/34138249
favorite count: 0
type: Question
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/34114337
has comment: http://stackoverflow.com/comment/34114275
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/25621405
has answer: http://stackoverflow.com/a/25621772
tagged with: java
has comment: http://stackoverflow.com/comment/34114197
type: UnansweredQuestion
has body: I'm new to android development and really struggling with using a custom view. I've read a lot of stuff on SO and its been really helpful with everything else, I just cant seem to work this one out. You guys are very smart and know your stuff so well. I hope to one day give back on SO as opposed to always taking! Any help would be very much appreciated. Thanks. activity_display_message.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/share" /&gt; &lt;view class="me.myfirstapp.DisplayMessageActivity$MyView" android:layout_width="150dp" android:layout_height="100dp" /&gt; DisplayMessageActivity.java package me.myfirstapp; import android.os.Bundle; import android.app.Activity; import android.util.AttributeSet; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ShareActionProvider; import android.support.v4.app.NavUtils; import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Typeface; import android.os.Build; @SuppressLint({ "NewApi", "DrawAllocation" }) public class DisplayMessageActivity extends Activity { @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); // 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); …
tagged with: android-custom-view
has answer: http://stackoverflow.com/a/25621664
has title: android.view.InflateException - Issues creating custom view
downvote count: 0
has comment: http://stackoverflow.com/comment/34141304

http://stackoverflow.com/q/22479508
has answer: http://stackoverflow.com/a/35933869
accepted answer: http://stackoverflow.com/a/35933869
favorite count: 0
tagged with: bouncycastle
tagged with: diffie-hellman
has body: I'm trying to execute code to perform the Diffie-Hellman key exchange. I sourced the code from an example online (forget where now). I had to import the bouncycastle.jar, which I assumed worked up until execution. my code: package testproject; import java.math.BigInteger; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.MessageDigest; import java.security.SecureRandom; import java.security.Security; import javax.crypto.KeyAgreement; import javax.crypto.spec.DHParameterSpec; public class KeyGen { private static BigInteger g512 = new BigInteger("1234567890", 16); //generates a random, non-negative integer for Base private static BigInteger p512 = new BigInteger("1234567890", 16); //generates a random, non-negative integer for Prime public static void main(String[] args) throws Exception { Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); DHParameterSpec dhParams = new DHParameterSpec(p512, g512); //Specify parameters to use for the algorithm KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH", "BC"); //Define specific algorithm to use "diffie-hellman", with provider "bc" keyGen.initialize(dhParams, new SecureRandom()); //initialize with parameters &amp; secure random seed KeyAgreement aKeyAgree = KeyAgreement.getInstance("DH", "BC"); //define algorithm for A's key agreement KeyPair aPair = keyGen.generateKeyPair(); //generate keyPair for A KeyAgreement bKeyAgree = KeyAgreement.getInstance("DH", "BC"); //define algorithm for B's key agreement KeyPair bPair = keyGen.generateKeyPair(); //generate keyPair for B aKeyAgree.init(aPair.getPrivate()); //initialize A's keyAgreement with A's private key bKeyAgree.init(bPair.getPrivate()); //initialize B's keyAgreement with B's private key aKeyAgree.doPhase(bPair.getPublic(), true); //do last phase of A's keyAgreement with B's public key bKeyAgree.doPhase(aPair.getPublic(), true); //do last phase of B's keyAgreement with A's public key MessageDigest ha…
has answer: http://stackoverflow.com/a/22483706
upvote count: 6
answer count: 4
linked to: http://stackoverflow.com/q/22492417
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22483706
linked to: http://stackoverflow.com/q/10891119
tagged with: java
has title: Java Diffie-Hellman key exchange
has answer: http://stackoverflow.com/a/28051374
has answer: http://stackoverflow.com/a/73286935
downvote count: 1
type: Question
score: 5

http://stackoverflow.com/comment/34133094
comment on: http://stackoverflow.com/a/22443179
score: 0
type: Comment
has text: can you give me an example, please?
type: AnswerComment

http://stackoverflow.com/comment/34153945
score: 0
type: Comment
has text: I agree.i just tried to produce the scenario where notifyAll has upper hand over notify
comment on: http://stackoverflow.com/a/22436541
type: AnswerComment

http://stackoverflow.com/comment/34195128
score: 0
comment on: http://stackoverflow.com/a/22478291
type: Comment
has text: wait let me check @Kedarnath
type: AnswerComment

http://stackoverflow.com/comment/34117394
type: Comment
has text: Here is the issue https://code.google.com/p/googleappengine/issues/detail?id=10704
type: AnswerComment
comment on: http://stackoverflow.com/a/22423355
score: 0

http://stackoverflow.com/comment/34135337
has text: So it's boolean? Like a true-false value?
comment on: http://stackoverflow.com/a/22432857
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22473209
has body: The problem was exactly as the error stated. I went to my respository and opened the POM file at the path above. I realize that somehow the POM file was downloaded while I was not authenticated against one of our internal systems. So even though a file existed, the pom file only contained an error message. After deleting the file at the path and restarting the build, the build was successful.
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/22450277
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22450277
type: Answer

http://stackoverflow.com/comment/34057147
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22398510
has text: Can you tell the type of joker4?
type: Comment

http://stackoverflow.com/q/22363633
tagged with: click
favorite count: 0
type: Question
has title: How to automate a 'triple-click' using Java & Selenium?
has comment: http://stackoverflow.com/comment/33995269
score: 4
has comment: http://stackoverflow.com/comment/75146462
has comment: http://stackoverflow.com/comment/33996556
tagged with: selenium
has comment: http://stackoverflow.com/comment/33997270
has comment: http://stackoverflow.com/comment/37855133
answer count: 1
has comment: http://stackoverflow.com/comment/34041180
tagged with: java
has comment: http://stackoverflow.com/comment/34003983
has answer: http://stackoverflow.com/a/46452894
upvote count: 4
has body: I'm automating tests that deal with text, and I need to be able to select an entire paragraph. In order to do this (at this point) I need to automate a triple click. Any idea how to do that? This is what I've attempted so far, neither works: action.click().click().click().perform(); //and... for(int i=0; i&lt;3; i++) { action.click().perform(); }
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/46452894

http://stackoverflow.com/q/22424168
has comment: http://stackoverflow.com/comment/34101482
has title: eclipse: No "Maven" entry for Windows / Preferences
has comment: http://stackoverflow.com/comment/34111543
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22431239
upvote count: 1
tagged with: m2e
has answer: http://stackoverflow.com/a/22425970
has comment: http://stackoverflow.com/comment/34098708
tagged with: m2eclipse
type: Question
has comment: http://stackoverflow.com/comment/34098867
has comment: http://stackoverflow.com/comment/34098919
tagged with: eclipse
answer count: 2
has body: I had eclipse Juno running; I decided to upgrade to eclipse Kepler. I only had Java 1.6, so I downloaded and installed java 1.7, and changed my JAVA_HOME. I downloaded and unpacked Kepler and pointed it at my existing workspace. I have two questions; First, when I click on "Window / Preferences", there is no entry for "Maven" on the left of the dialog. I shut down and rebooted the machine after I changed JAVA_HOME to ensure that didn't cause this. I checked the list of installed plugins, and it lists m2e (v1.4). Second, I am getting an error message "Plugin execution not covered by lifecycle configuration". There are a double-handful of sites indicating what to do about this, including the m2e's wiki pages, but over half the suggestions don't look reasonable, the wiki doesn't spell out what to do for its recommended solution, assuming you know, and the one that looked most promising to me involves using "Windows / Preferences / Maven". So I'm most interested in the answer to the first question; if you have hints to offer on the second, I'm all ears...
has comment: http://stackoverflow.com/comment/34111430
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34100433
type: UnansweredQuestion

http://stackoverflow.com/comment/34121671
score: 0
type: Comment
type: QuestionComment
has text: do you want to concat letters with numbers array's element? also both array have same size?
comment on: http://stackoverflow.com/q/22437303

http://stackoverflow.com/a/22331512
has body: public static int customIndexOf(String string,char character) { String c = String.valueOf(character); Scanner sc = new Scanner(string).useDelimiter(Pattern.compile("")); int i=0; while(sc.hasNext()) { if (sc.next().equals(c)) { return i; } i++; } return -1; }
score: 1
answers question: http://stackoverflow.com/q/22330827
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/22428242
accepted answer: http://stackoverflow.com/a/22428329
favorite count: 0
has comment: http://stackoverflow.com/comment/34105697
downvote count: 2
tagged with: tree-structure
upvote count: 1
type: AnsweredQuestion
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/22428281
tagged with: java
tagged with: database
has answer: http://stackoverflow.com/a/22428281
score: -1
has comment: http://stackoverflow.com/comment/34105740
has answer: http://stackoverflow.com/a/22428329
type: Question
answer count: 2
has body: What external database can I use to work with my java application except Microsoft Access? I need a tree like structure or a hashmap and not relational tables.
has title: External database t implement tree like / hash map structure
has comment: http://stackoverflow.com/comment/34105713

http://stackoverflow.com/a/22452151
type: Answer
has body: Iterate over the outer list and convert every entry to a string. e.g. ArrayList&lt;String&gt; result = new ArrayList&lt;&gt;(shares.size()); for(ArrayList&lt;Byte&gt; bytes: shares) { result.add(bytes.toString()); } If you want the result as a string array you can do it this way: String[] result = new String[shares.size()]; for(int i = 0; i &lt; result.length; ++i) { ArrayList&lt;Byte&gt; bytes = shares.get(i); result[i] = bytes.toString(); } If the bytes actually represent a string (you want the characters and not the bytes as numbers printed) then you would have to convert the inner list to an array (see other answers) and instantiate a string with it. If you want the encoding stuff see Java - String getBytes()
has comment: http://stackoverflow.com/comment/34148758
has comment: http://stackoverflow.com/comment/34149067
has comment: http://stackoverflow.com/comment/34148587
has comment: http://stackoverflow.com/comment/34148393
has comment: http://stackoverflow.com/comment/34148520
has comment: http://stackoverflow.com/comment/34148646
score: 0
answers question: http://stackoverflow.com/q/22452046

http://stackoverflow.com/comment/34039241
has text: you don't need and perhaps shouldn't have a fragment in your navigation drawer - you can use a FragmentViewPager inside the layout for the drawer, and this could contain fragments, but please think about your UX design and ensure this is what you (/your users) want.
comment on: http://stackoverflow.com/q/22389933
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33939949
type: AnswerComment
score: 0
type: Comment
has text: It might be *slower* as it has to interpret the characters from the bytes. And it might use a *tiny* bit more memory (but swamped by any buffer you might - probably should - wrap it in, anyway). I suppose it being slower might be relevant if doing something where you are not interested in the the content of the file (e.g. copying it). Doesn't help much if you actually need to 'read' the content though.
comment on: http://stackoverflow.com/a/22332434

http://stackoverflow.com/a/22401940
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22378885
type: Answer
accepted answer of: http://stackoverflow.com/q/22378885
has body: I think you need to first to deserialize the "messageText" to JsonObject like this: JsonElement jsonElem = gson.fromJson(messageText, JsonElement.class); JsonObject jsonObject = jsonElem.getAsJsonObject(); and then extract elements by their names, and deserialize to requested type: JsonElement jsonA = jsonObject.get("A"); A a = gson.fromJson(jsonA, A.class); And for the list element: JsonElement jsonBs = jsonObject.get("B"); Type bListType = new TypeToken&lt;List&lt;B&gt;&gt;(){}.getType(); List&lt;B&gt; dataSetIds = gson.fromJson(jsonBs, bListType);
upvote count: 1

http://stackoverflow.com/comment/34159237
comment on: http://stackoverflow.com/a/22458519
has text: What if the most desired quality attribute is not maintenance but performance? Have you ever debugged through an ORM framework to see how much time it takes to execute simple queries against plain raw JDBC?
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/22438682
score: 0
has body: You may use code like: Scanner sc = new Scanner(args[0]); sc.useDelimiter("/"); int day = sc.nextInt(); int month = sc.nextInt(); int year = sc.nextInt();
type: Answer
answers question: http://stackoverflow.com/q/22438532

http://stackoverflow.com/comment/34029415
type: AnswerComment
comment on: http://stackoverflow.com/a/22384458
type: Comment
has text: still gives the same error "reafile(String)" is undefined for the type BufferedReader."
score: 0

http://stackoverflow.com/q/22353307
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: svn
tagged with: subclipse
tagged with: eclipse
score: 0
answer count: 1
has body: Previously ran SVN in Indigo without issues. I decided to update to Kepler and have been trying to get SVN setup. Based on all of the documentation I can find I have it setup (no errors) the problem is that it is not recognizing the SVN properties of my projects and I don't see any way to get it to link.(Clicking "Team" only shows the menu item "Apply Patch"). The Preferences for SVN is totally different from Indigo so I can't match that either.. Clearly I'm missing something.. I installed the below Subclipse version http://subclipse.tigris.org/update_1.6.x
tagged with: eclipse-kepler
has answer: http://stackoverflow.com/a/22380048
has title: SVN file changes undetectable in Eclipse Kepler Project Explorer

http://stackoverflow.com/a/24553335
type: Answer
has body: You should be aware that hadoop spawns multiple attempts of a task, usually two for each mapper. If you see log file output twice, that's probably the reason.
score: 0
answers question: http://stackoverflow.com/q/22464537

http://stackoverflow.com/comment/34044800
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22390066
has text: Hmm I always tried to get away with as little as possible but if the Swing commands always use both I might rethink that policy.

http://stackoverflow.com/a/22368167
has body: The expression inside the "if" condition should evaluate to a boolean or Boolean otherwise the code will not compile. Check that Java specs page here
type: Answer
answers question: http://stackoverflow.com/q/22368120
score: 0

http://stackoverflow.com/comment/34013546
type: AnswerComment
comment on: http://stackoverflow.com/a/22375132
type: Comment
has text: Sir i try many time but did not solve the issue, sir if you send me the code that Reset and update an issue and i will be very thankfull to you.
score: 0

http://stackoverflow.com/comment/34123496
has text: TrainCar has a method for returning the weight of an empty cart. PassengerCar and CargoCar extend TrainCar, while the last class, Locomotive, is the class where I'm currently a little stumped. :-)
score: 0
comment on: http://stackoverflow.com/q/22438277
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22349910
tagged with: menu
has comment: http://stackoverflow.com/comment/33969690
type: AnsweredQuestion
has title: Android: Convert a normal menu to slider menu? (With minimal coding)
tagged with: java
has body: I have an app with a normal menu i.e. the common old menu that shows up at the bottom of the screen when the menu button is pressed. But it is a problem in some phones where there is no hard menu button. I want to switch to slider menu with a menu icon on top. Is there an easy way to do this (I mean a way where code change would be minimum) retaining the existing functionality? Or will i have to go about coding the slider menu from scratch? Any example code of a similar situation would really help.
accepted answer: http://stackoverflow.com/a/22350295
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33969350
has answer: http://stackoverflow.com/a/22350295
tagged with: slider
tagged with: android
has comment: http://stackoverflow.com/comment/33969807

http://stackoverflow.com/comment/34001118
comment on: http://stackoverflow.com/q/22366559
score: 0
type: Comment
type: QuestionComment
has text: if you are using Eclpise or another IDE enable logcat and there should be some output to why it crashed.

http://stackoverflow.com/comment/34092405
has text: package shortcode; import javax.swing.JOptionPane; public class Shortcode { System.out.println(JOptionPane.showInputDialog("Enter your email address").matches(".*@.*\\..*") ? "Address Appears Valid" : "Address is Invalid" ); } also the error says <identifier> expected Im sure my error is something silly can you please help me out i cant seem to get it no matter how much i look at it
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22420316

http://stackoverflow.com/comment/34185415
type: Comment
comment on: http://stackoverflow.com/q/22473455
has text: There is an error in your xml file, MapsActivity class.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34152431
comment on: http://stackoverflow.com/q/22415559
type: QuestionComment
has text: @Mark for more information about the total not adding up, I forgot to answer that. `ob1` and `ob2` Each have two sub properties `x` and `y` but `x` and `y` has two percentages / each. One is the percentage of the whole outer circle, and one is the sub-percentage of `ob1` and `ob2`. I am editing my first post to add an example picture.
score: 0
type: Comment

http://stackoverflow.com/a/22416848
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22416743
has body: You should move the code that handles the InputStream, like: return (String) formatResponse(new BufferedReader(new InputStreamReader(httpResponse.getEntity().getContent()))); to your AsyncTask as well. Handling InputStreams is nothing that you want to do in your UI Thread.
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22416743

http://stackoverflow.com/q/22366204
answer count: 2
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22366402
accepted answer: http://stackoverflow.com/a/22366402
favorite count: 0
tagged with: abstract
tagged with: subclass
possible better answer: http://stackoverflow.com/a/22366305
type: AnsweredQuestion
type: Question
has body: So say you want to have an abstract class called play, which has a render method. public abstract class RenderPanel{ public abstract void render(); } And then you have another class which calls the render method using some sort of game loop. public class Window implements Runnable{ public void run(){ while(running){ RenderPanel.render(); Thread.sleep(5000); } } } This code would not work because you cannot call an abstract class statically, and you can't instantiate the class. So how would you go about this so that if you make a subclass of RenderPanel, the render method in the subclass will be called automatically?
has comment: http://stackoverflow.com/comment/33998688
has title: How would an abstract render method work? (Java)
score: 1
has answer: http://stackoverflow.com/a/22366305
tagged with: java
tagged with: render
tagged with: game-loop

http://stackoverflow.com/a/22368118
score: 0
has body: I assume you forgot to initialize a variable since that is the usual case for null pointer exception. A quick look at your code and I think it is under TextDemo. Probably would have been static JTextArea textArea = new JTextArea();.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22368041
has comment: http://stackoverflow.com/comment/34048965
type: Answer
has comment: http://stackoverflow.com/comment/34020235
has comment: http://stackoverflow.com/comment/34053075
has comment: http://stackoverflow.com/comment/34047415
has comment: http://stackoverflow.com/comment/34001748
has comment: http://stackoverflow.com/comment/34021298
answers question: http://stackoverflow.com/q/22368041
has comment: http://stackoverflow.com/comment/34046780
has comment: http://stackoverflow.com/comment/34002197
has comment: http://stackoverflow.com/comment/34001819
has comment: http://stackoverflow.com/comment/34001892

http://stackoverflow.com/q/22393302
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22393413
possible better answer: http://stackoverflow.com/a/22393419
type: Question
has answer: http://stackoverflow.com/a/22393368
has comment: http://stackoverflow.com/comment/34045060
has comment: http://stackoverflow.com/comment/34045073
has comment: http://stackoverflow.com/comment/34045131
score: 0
answer count: 3
has body: I have the following code that reads through a line of students and the program should split at each white space then go to the next part of the text but I get arrayindexoutofBound exception. The text file has several lines like this: 130002 Bob B2123 35 34 B2132 34 54 B2143 23 34 public static void main(String[] args) throws FileNotFoundException { File f = new File("C:\\Users\\Softey\\Documents\\scores.txt"); Scanner sc = new Scanner(f); List&lt;MarkProcessing&gt; people = new ArrayList&lt;MarkProcessing&gt;(); while(sc.hasNextLine()){ String line = sc.nextLine(); String[] details = line.split("\\s+"); String regNumber = details[0]; String name = details[1]; String modOne= details[2]; int courseM = Integer.parseInt(details[3]); int examM = Integer.parseInt(details[4]); String modTwo = details[5]; int courseM2 = Integer.parseInt(details[6]); int examM2 = Integer.parseInt(details[7]); String modThree = details[8]; int courseM3 = Integer.parseInt(details[9]); int examM3= Integer.parseInt(details[10]); MarkProcessing p = new MarkProcessing(regNumber, name, modOne,courseM, examM, modTwo,courseM2,examM2, modThree, courseM3, examM3); people.add(p); } } } When it goes to details[1] I get the index error.
has title: Java Array Index Out of Bound
has comment: http://stackoverflow.com/comment/34045132
has answer: http://stackoverflow.com/a/22393419
favorite count: 0
has comment: http://stackoverflow.com/comment/34045065
accepted answer: http://stackoverflow.com/a/22393413
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/34082463
has text: @jWeaver I have definitely used Quartz for web apps
score: 0
comment on: http://stackoverflow.com/a/22413304
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34000746
has text: your teacher must be Chuck Norris :D
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22367540
score: 2

http://stackoverflow.com/comment/34145261
type: AnswerComment
comment on: http://stackoverflow.com/a/22448439
type: Comment
has text: You were given a better solution 18 hours previously. If you're not going to take notice of what you're told here it is difficult to see the point of posting at all.
score: 0

http://stackoverflow.com/a/22402642
has comment: http://stackoverflow.com/comment/34060656
accepted answer of: http://stackoverflow.com/q/22402516
upvote count: 1
has comment: http://stackoverflow.com/comment/34060616
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22402516
has body: You have final ImageView myimage = new ImageView(ctx); ctz is not initialized. Its only declared as Context ctx; You have this gridView.setAdapter(adapter); But you need to intialize adapter before using the same So change to setContentView(R.layout.main); final ImageView myimage = new ImageView(this); //this refers to Activity context gridView = (GridView) findViewById(R.id.gv_memory); adapter = new ImageAdapter(this) gridView.setAdapter(adapter);

http://stackoverflow.com/comment/34194913
has text: this is so (facepalm)
comment on: http://stackoverflow.com/a/22463671
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34133676
comment on: http://stackoverflow.com/a/22443179
has text: Thanks a lot, but I still don't quite understand what to do. Can I give you my code so you can give me some better explanation?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22331198
type: Question
has comment: http://stackoverflow.com/comment/33942667
tagged with: jsp
tagged with: struts2
score: 0
has body: Hy guys, I've turning around a problem using Struts2. Basically I've a form that the user can submit filling different fields. I would like to populate conditionally the right object with the properties insert by the user. So for example, if the user fill the form in a intermediary way I would like to use the properties for to create an Intermediary object, instead if the user fill the request in entity way, i'll use the properties for to create the Entity object, ecc... These object share the same interface Request. Is there any way to use polimorphically properties for to create Intermediary or Entity object? Suppose this is my two POJO: public class Intermediary implements Request{ private String name; private String surname; private String code; private String FiscalCode; private String address; ... /*Getters and setters */ .... } public class Entity implements Request{ private String name; private String surname; private String code; .... /*Getters and setters */ .... } This could be my form into the jsp page: <s:form action="fillRequest" id="formRichiesta" name="formRichiesta" method="post"> <s:radio id="tipoRichiedente" name="tipoRichiedente" list="richiedenti"> Name <s:textfield name="name"/> Surname <s:textfield name="surname"/> code <s:textfield name="code"/> Adress <s:textfield name="adress"/> Fiscal Code <s:textfield name="fiscalCode"/> </s:form> <s:submit> Basically my problem is that I can discover the kind of request the the user trying to fill only ofter submission and watching at the radiobutton state. Is there any way to mapping the properties into the right object directly instead of creating one big object with all the form properties and then create the right implementation? for to map properties could I use the interface reference? For example image my action: public class RequestAction { private Request request; .... } So in my jsp could I use: Name <s:textfield name="request.name"/> Thanks in advance.
has comment: http://stackoverflow.com/comment/33966308
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33966111
tagged with: java
has title: Conditional object population

finalize
type: Tag
tags question: http://stackoverflow.com/q/22373394
tag name: finalize

http://stackoverflow.com/comment/133438898
has text: This is dangerous advice. `Timestamp` is fundamentally `Instant` like (no timezone, UTC-epoch-millis based), and therefore, if the database is actually storing e.g. TIMESTAMP WITH TIME ZONE, which is more like ZonedDateTime, you're converting from ZDT to instant on one side and then letting j.s.Timestamp convert back to ZDT which __easily risks introducing errors due to mismatching zones__. It's also slow. Much, much, MUCH better: `rs.getObject(index/colName, LocalDateTime.class)`. Which avoids all that dangerous conversion. Replace LDT with whatever type you're looking for.
type: AnswerComment
comment on: http://stackoverflow.com/a/22470650
type: Comment
score: 0

jax-rs
tags question: http://stackoverflow.com/q/22410381
tags question: http://stackoverflow.com/q/22427747
tags question: http://stackoverflow.com/q/22472649
tags question: http://stackoverflow.com/q/22339723
tags question: http://stackoverflow.com/q/22475881
tags question: http://stackoverflow.com/q/22466392
tags question: http://stackoverflow.com/q/22483744
type: Tag
tags question: http://stackoverflow.com/q/22368258
tags question: http://stackoverflow.com/q/22339248
tags question: http://stackoverflow.com/q/22386462
tags question: http://stackoverflow.com/q/22457986
tags question: http://stackoverflow.com/q/22403537
tag name: jax-rs

http://stackoverflow.com/comment/34093745
has text: I don't know, why this is not working for me. Can you please suggest me any tutorial, where I can find steps to do (add jobs and listing them) this on netbeans
score: 0
comment on: http://stackoverflow.com/a/22413304
type: Comment
type: AnswerComment

http://stackoverflow.com/q/22348289
has body: Let's assume that I have my.company.Component class in project. Unfortunately, in JDK libraries there is java.awt.Component class available (that I never need to use). Each time I want to import Component class, IntelJ asks my to decide which one I want to use. It's quite irritating given that I always want to use the same one. In Eclipse I could use "Type Filters" to exclude packages/classes that I never use. Is there any equivalent for InteliJ?
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33967677
has answer: http://stackoverflow.com/a/22351480
type: Question
accepted answer: http://stackoverflow.com/a/22351480
score: 3
possible better answer: http://stackoverflow.com/a/22349047
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/33966784
tagged with: eclipse
has title: Is there InteliJ Idea equivalent for Eclipse "type filters" feature
answer count: 2
downvote count: 0
tagged with: ide
favorite count: 0
has answer: http://stackoverflow.com/a/22349047

http://stackoverflow.com/comment/34115386
type: QuestionComment
type: Comment
has text: Thanks, the problem was There was no row inserted, i thought updating will automatically add the row. Thanks for the help. Its working when i inserted a row and perform the update statement.
score: 0
comment on: http://stackoverflow.com/q/22433462

http://stackoverflow.com/comment/63252417
type: Comment
has text: There is no need for full implementation of the code. The important part here is that if you tell to Retrofit that to parse the server response like List this means that your json at the top level is not json object {} but json array [] .
comment on: http://stackoverflow.com/a/22479711
score: 1
type: AnswerComment

http://stackoverflow.com/q/22387649
has comment: http://stackoverflow.com/comment/34036102
favorite count: 0
type: UnansweredQuestion
tagged with: excel
answer count: 0
tagged with: java
tagged with: noclassdeffounderror
upvote count: 1
type: Question
has title: eclipse plugin throwing org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Row
has body: I am trying to populate excel sheet with the values from the eclipse plugin containing a Text Field. I am getting the below provided exception log using java The jars added are dom4j-1.6, poi-3.7-20101029, poi-ooxml-3.7,poi-ooxml-schemas-3.7-20101029,xmlbeans-2.3.0 Also i have added the entry Class-Path: /poi-3.7-20101029.jar in the MANIFEST.MF org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Row at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.j`enter code here`ava:243) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132) at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:850) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionItem.java:743) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:727) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:662) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngin…
tagged with: eclipse
downvote count: 0
score: 1

http://stackoverflow.com/a/22341283
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22340971
type: Answer
accepted answer of: http://stackoverflow.com/q/22340971
has body: With that input, your program is reading the final "printAll", then "del" as the order number, then "4.9" as a double, then it tries to use nextDouble to read the final "printAll" and fails. The order "del" should be followed by two doubles.

http://stackoverflow.com/comment/34053797
has text: @NaveenKumar it's not causing error, though it's confusing and a bad programming style.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22398510
type: QuestionComment

http://stackoverflow.com/comment/33943526
type: AnswerComment
score: 0
type: Comment
has text: When I put in "W (10-5)" I'm only getting the W returned as a match. Wonder why?
comment on: http://stackoverflow.com/a/22335067

http://stackoverflow.com/comment/34554212
score: 0
type: Comment
has text: Mm more or less, but I only have two bundles: Provider and Client. Provider registers the service directly (with ServiceTracker) and at the same time has a manifest that registers the service via DS. The client uses both ServiceTracker and DS as well. Hope it helps to make things more clear, sorry for the misunderstanding.
comment on: http://stackoverflow.com/a/22675344
type: AnswerComment

http://stackoverflow.com/comment/34113167
type: QuestionComment
has text: 1) Use a consistent and logical indent for code blocks. The indentation of the code is intended to help people understand the program flow. 2) Instead of using a `JTextField`, use a `JSpinner` as seen [here](http://stackoverflow.com/a/10021773/418556).
comment on: http://stackoverflow.com/q/22432215
score: 0
type: Comment

http://stackoverflow.com/q/22384662
tagged with: arrays
answer count: 1
accepted answer: http://stackoverflow.com/a/22385438
has comment: http://stackoverflow.com/comment/34029481
tagged with: arraylist
score: 0
has body: I have an ArrayList&lt;Integer&gt; called nodes. I want to assign elements from array[] to elements in ArrayList. Such that 1st element in arraylist will have first element in array as its property.. and so on. However, there are only 6 elements in array and thus for 7th element its again first element from array[]. Array is of type Integer. public static String[] Interest = new String[] {"I1","I2","I3","I4","I5","I6"}; public static void main(String[] args){ System.out.println("Enter number of nodes"); Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int i=0;i&lt;=n;i++) { nodes.add(i); } System.out.println(nodes); } I want to set up an interest profile for each element in node. For that I have an array called Interest which has 6 elements in it. Now say for the first element in node, I want to set up preferences for Interests. For example, the first element could have interest profile as I1 = 10, I2 = 8, ..., I6 = 2 and so on. I am thinking of using a method like SetIntensity(ArrayList element, array of integers) which will set interest profile for an element passed as a parameter. I am not sure if it's correct but I am expecting something like this: public static void setInterest(List&lt;String&gt; array){ String[] Interest = new String[]{"I1","I2","I3","I4","I5","I6"}; for(int k=0;k&lt;array.size();k++){ array.get(k); for(int j=0;j&lt;Interest.length;j++){ } } }
has comment: http://stackoverflow.com/comment/34030436
has comment: http://stackoverflow.com/comment/34030681
has comment: http://stackoverflow.com/comment/34030333
has answer: http://stackoverflow.com/a/22385438
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34029437
tagged with: java
has title: appending an array of string to arraylist of type Integer in Java
has comment: http://stackoverflow.com/comment/34030670
type: Question
has comment: http://stackoverflow.com/comment/34073813

http://stackoverflow.com/a/22427864
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22427778
has comment: http://stackoverflow.com/comment/34105213
has comment: http://stackoverflow.com/comment/34105057
has comment: http://stackoverflow.com/comment/34105351
type: Answer
has body: Assuming that you have M assets and N locations, unless you want a table with M*N rows, which is probably not what you want (and if it is then I'd suggest reviewing "what you want"), you'll need to do a join. However, you can use a view, which is essentially a canned select statement, to make subsequent queries easier to write: create view reports as select foo.x, bar.y from foo, bar where foo.id = bar.id and then (for select purposes) you can treat reports as if it were a table.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22427778
upvote count: 1

http://stackoverflow.com/comment/34308336
type: Comment
comment on: http://stackoverflow.com/a/22455693
type: AnswerComment
has text: I make this project in eclipse and work! :D Thanks for interesting :D
score: 0

http://stackoverflow.com/q/22393755
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22393900
answer count: 3
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/22393780
has comment: http://stackoverflow.com/comment/34045853
has answer: http://stackoverflow.com/a/22393940
has title: java best way to declare variables with main method
score: 2
upvote count: 2
type: UnansweredQuestion
has body: Hi I was just wondering what the best way to declare a variable in java was: with static variables declared outside the method: public class Copy { public static Scanner scanInput = new Scanner(System.in); public static String captureString; public static void main(String[] args){ //Scanner scanInput = new Scanner(System.in); //String captureString; System.out.println("Please enter some words.."); captureString = scanInput.nextLine(); System.out.println("You entered: " + captureString); } } or with variables inside the main method: public class Copy { //public static Scanner scanInput = new Scanner(System.in); //public static String captureString; public static void main(String[] args){ Scanner scanInput = new Scanner(System.in); String captureString; System.out.println("Please enter some words.."); captureString = scanInput.nextLine(); System.out.println("You entered: " + captureString); } } Which is the preferred way of declaring variables in this case?

http://stackoverflow.com/comment/33961608
score: 0
type: Comment
has text: Then you have to split the text at `.` and append a line break after each split array element.
comment on: http://stackoverflow.com/a/22345228
type: AnswerComment

http://stackoverflow.com/q/22428060
score: 0
answer count: 2
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22428142
has comment: http://stackoverflow.com/comment/34105375
favorite count: 0
has comment: http://stackoverflow.com/comment/34105404
type: UnansweredQuestion
has title: Printing Stars in java
tagged with: java
has answer: http://stackoverflow.com/a/22428136
type: Question
has comment: http://stackoverflow.com/comment/34105361
has body: public static void processQuestionData() { double[] cake = {3.6, 7.8, 15.8} double carrot = 15.8 for (int i = 0; i &lt; cake.length; i++) { drawBar(cake[i], carrot); } public static void drawBar(double value, double max ) { final int MAX_STARS = 20 String BAR_REP = "*"; double correctRatio = (value / max) * MAX_STARS; if (correctRatio == MAX_STARS) { for (int index = 0; index &lt; MAX_STARS; index++) { System.out.print(BAR_REP); } } else if (correctRatio &lt; MAX_STARS) { for (int index = 0; index &lt; MAX_STARS; index++) { System.out.print(BAR_REP); } } } I want given a value and a max as double type arguments, draws a bar using * representing the value, scaled so that max value would equal the constant MAX_STARS. I am not able to do that what is wrong with my code? Output should be **** ********* ******************** 1st star gotten by (3.6 / 15.8) * 20 = 4 3rd star gotten by (15.8 / 15.8) * 20 = 20 How can I do that?

http://stackoverflow.com/comment/34110735
type: Comment
comment on: http://stackoverflow.com/a/22430802
has text: When I initialize it outside the OnClickListener the app just crashes when I click save
score: 0
type: AnswerComment

http://stackoverflow.com/a/22427918
upvote count: 1
has comment: http://stackoverflow.com/comment/34105493
score: 1
answers question: http://stackoverflow.com/q/22427894
has comment: http://stackoverflow.com/comment/34105335
has comment: http://stackoverflow.com/comment/34105473
has comment: http://stackoverflow.com/comment/34105030
downvote count: 0
type: Answer
has body: You are iterating the for loop for 5 times as below : for(int i=0; i&lt;5; i++) //Size of array is 6 but iterating only 5 times When you enter value more than 48 in any of 5 text field then if (nums[i] &lt; 1 || nums[i] &gt; 48) this statement becomes true and you will receive message as Range error in message dialog.As you are using return then there will not be any further execution of loop.

http://stackoverflow.com/comment/33955433
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22341875
has text: I did not include my swap method. It takes up unnecessary space towards the objective of the question.
score: 0

http://stackoverflow.com/comment/34078113
type: AnswerComment
score: 0
type: Comment
has text: Glad to help you. I'll update the answer for future readers's sake
comment on: http://stackoverflow.com/a/22410331

http://stackoverflow.com/comment/34178033
type: AnswerComment
has text: ok, so what user action will have to be carried out for the update to go to my db? Just correct format in textfields? no button press?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22468542

http://stackoverflow.com/comment/34086149
type: Comment
type: QuestionComment
has text: What's with all the ArrayLists? I built a 15 puzzle a few years ago and I built it around a matrix of int. Maybe I'm misunderstanding your code, but there's only a couple of states you really care about: 'solved' and 'unsolved,' and the various permutations of 'unsolved' don't matter. How do you know when the puzzle is solved? [0][0] == 1 && [1][0] == 2 && [2][0] = 3 && [3][0] = 4 && [0][1] == 5 and so on. Not sexy, but dead simple.
score: 0
comment on: http://stackoverflow.com/q/22416797

http://stackoverflow.com/q/22344013
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33966786
has body: Here is my code: import org.apache.poi.hslf.HSLFSlideShow; import org.apache.poi.hslf.model.Slide; import org.apache.poi.hslf.usermodel.SlideShow; import java.io.*; public class CreateNewPresentation { public static void main(args[]) { try { SlideShow slideShow = new SlideShow(); Slide slide = slideShow.createSlide(); FileOutputStream out = new FileOutputStream("slideshow.ppt"); slideShow.write(out); System.out.println("File Created..."); out.close(); } catch(Exception e) { e.printStackTrace(); } } } The issue is that it does not recognise org.apache.poi package. How can I make it work?
has comment: http://stackoverflow.com/comment/33959487
has comment: http://stackoverflow.com/comment/33965591
has title: Error creating an Excel file with Apache POI library.
tagged with: apache-poi
score: 0
linked to: http://stackoverflow.com/q/7598623
tagged with: excel
type: Question
linked to: http://stackoverflow.com/q/219585
tagged with: java
has comment: http://stackoverflow.com/comment/33964521
has answer: http://stackoverflow.com/a/22347746
answer count: 1
has comment: http://stackoverflow.com/comment/33964621

http://stackoverflow.com/comment/34003163
comment on: http://stackoverflow.com/q/22368934
has text: Seriously, focus on the model, make it thread safe if you have to. It's unlikely that the combobox itself will (or should) be modified in anyway other then on the EDT...
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/comment/33968793
comment on: http://stackoverflow.com/q/22349339
score: 0
type: Comment
type: QuestionComment
has text: where is activity_list_demostration.xml ...

http://stackoverflow.com/comment/34074043
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22409614
type: AnswerComment
has text: @ChristopherLewis is the other server using the same shell (i.e both using bash, ksh, ...)? You might want to try single quotes `'` instead of double `"` as single quotes won't expand anything.

http://stackoverflow.com/q/22451949
has comment: http://stackoverflow.com/comment/68208460
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3941479
downvote count: 1
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/68255445
type: Question
score: 5
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/40505998
has title: Generic Map for JAXB
has body: Ok, so we all know that Maps are somewhat of a pain in JAXB. I here present an alternative to the current solutions. My main objective is to get feedback on any and all potential problems with this solution. Maybe it is not even a good solution for some reasons. When I played around with the standard Generic Map Adapter it seemed like the adapters for the classes were not used. The classes are instead scanned, forcing me to mark my data model with JAXB annotations and adding default constructors where I don't want them (I'm talking about complex classes that I want to store in Maps, not simple data types). Above all, this makes my internal data model public thereby breaking encapsulation since the generated XML is a direct representation of the internal structures. The "workaround" I did was to combine the adapter with the Marshall.Listener and Unmarshall.Listner thereby being able to extract additional annotation information. A field would then be @XmlElement(name = "testMap") @XmlJavaTypeAdapter(MapAdapter.class) @MapKeyValueAdapters(key=SomeComplexClassAdapter.class) private final HashMap<SomeComplexClass, String> testMap2 = new HashMap<SomeComplexClass, String>(); This additional annotation accepts both key and value as arguments. If omitted the functionality falls back on standard qualification for the omitted. The example above will use the given adapter for the key and standard handling for the value. Here the annotation. import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.xml.bind.annotation.adapters.XmlAdapter; /** * This annotation holds the adapters for the key and value used in the MapAdapter. */ @Retention(RUNTIME) @Target({ FIELD }) public @interface MapKeyValueAdapters { /** * Points to the class that converts the value type to a bound type or vice versa. See {@link XmlAdapter} for more * details. */ Cla…
upvote count: 6
has comment: http://stackoverflow.com/comment/68252851

http://stackoverflow.com/comment/33964744
score: 0
type: AnswerComment
type: Comment
has text: Thanks @Smutje for your answer, I just edited my answer could you look and tell me what wrong there?
comment on: http://stackoverflow.com/a/22347118

http://stackoverflow.com/comment/34157902
has text: So, I assume you are using Eclipse then? The fact your project doesn't show errors doesn't mean the same libraries are included in your run/debug configurations. I would start by making sure your project is exporting the libraries in question, then check the launch configurations to make sure they show up.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22456767
type: QuestionComment

http://stackoverflow.com/q/22456331
answer count: 3
has answer: http://stackoverflow.com/a/22456461
has answer: http://stackoverflow.com/a/22456682
accepted answer: http://stackoverflow.com/a/22456682
has answer: http://stackoverflow.com/a/22456457
has comment: http://stackoverflow.com/comment/34155551
has title: Normal Class, singleton class or static methods for performance
has comment: http://stackoverflow.com/comment/34155474
tagged with: android
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34155499
type: Question
possible better answer: http://stackoverflow.com/a/22456457
has body: In my application I've a class called AppUtils.java, which basically contains utility functions like covertDpToPx() ,UrlEncoder()` etc. Issue is this class, apart from normal Activities, can also be called by Services running constanly in background. So, how should I design this class from performance point-of-view? Thank You
score: 0

http://stackoverflow.com/a/22402767
downvote count: 0
has body: ResultSetMetaData may help You still have to execute the query to get the meta data, but you may be able to alter add a restriction to the where clause which means it returns zero rows very quickly. For example you could append and 1 = 0 to the where clause. The DBMS still has to do all the query parsing that it would normally do - it just means that the execution should hopefully fail very quickly
answers question: http://stackoverflow.com/q/22402497
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/34207724
type: Comment
type: QuestionComment
has text: javac 1.6.0_30 and therefore this must be my problem.
comment on: http://stackoverflow.com/q/22485881
score: 0

http://stackoverflow.com/q/22414249
has comment: http://stackoverflow.com/comment/34082324
score: 0
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
has body: I want to pass this Integer value like a=100 to all reducers. Then in the reduce function, I can use this value. Is there a way to do this? I don't want to put this value to pair like &lt;"a", 100> since it will go to a specific reducer that I don't know and in this case, not all reducers will receive this value. The value is needed by every reducer.
has comment: http://stackoverflow.com/comment/34082050
has answer: http://stackoverflow.com/a/22414869
answer count: 1
has comment: http://stackoverflow.com/comment/34083553
has title: Is there a way of passing an Integer value from mapper class to all reducers
type: UnansweredQuestion

http://stackoverflow.com/comment/34187872
score: 0
type: AnswerComment
has text: Sorry, I didn't notice your comment for a while. Yes, I pasted exactly what you have above into a new class. I had to add some imports to get it to compile, of course. But I ran it. It certainly played the tune. I can't imagine what you might've done wrong, other than the obvious things like muting your speakers.
type: Comment
comment on: http://stackoverflow.com/a/22468024

http://stackoverflow.com/a/22442860
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22441725
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22441725
has comment: http://stackoverflow.com/comment/34133173
type: AcceptedAnswer
has body: You can use SetCharacterEncodingFilter. This wiki page is also helpful for you.

http://stackoverflow.com/comment/34040125
has text: getSelectedItem() returned null. you didn't select anything.
score: 0
comment on: http://stackoverflow.com/q/22382829
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22330471
has answer: http://stackoverflow.com/a/22330512
has comment: http://stackoverflow.com/comment/33936666
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22332813
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22330512
has answer: http://stackoverflow.com/a/22332813
has comment: http://stackoverflow.com/comment/33935685
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33936631
has comment: http://stackoverflow.com/comment/33935946
has title: Integer.parseint exceptions
has comment: http://stackoverflow.com/comment/33935659
has body: The question was : Write a program that processes an input.txt file that contains data regarding ticket type followed by mileage covered and reports how many frequent-flier miles the person earns. 1 frequent flyer mile is earned for each mile traveled in coach. 2 frequent flyer miles are earned for each mile traveled in first class. 0 frequent flyer miles are earned on a discounted flight. For example, given the data in input.txt below, your method must return 15600 (2*5000 + 1500 + 100 + 2*2000). Input.txt: firstclass 5000 coach 1500 coach 100 firstclass 2000 discount 300 My code gives me a problem with the parseint method. Any help would be appreciated :) //InInteger class import java.lang.NumberFormatException; public class IsInteger { public static boolean IsaInteger (String s)throws NumberFormatException { try { Integer.parseInt(s);//converts the string into an integer return true; } catch (NumberFormatException e) { return false; } } } //main class import java.io.*; import java.util.StringTokenizer; public class LA5ex2 { public static void main(String[] args) throws FileNotFoundException { BufferedReader input= new BufferedReader (new InputStreamReader (new FileInputStream("C:/Users/user/workspace/LA5ex2/input.txt"))); String str; int TotalMiles=0; try { int mileage,lines=0; String check,copy=null; String word=null; boolean isString=false; while ((str = input.readLine()) != null) { lines++; StringTokenizer token = new StringTokenizer(str); while (token.hasMoreTokens()) { if ((lines&gt;1) &amp;&amp; (isString)) { //do nothing } else {word= token.nextToken(); copy=word;} if (token.hasMoreTokens()) mileage= Integer.parseInt(token.nextToken()); else { if (!(IsInteger.IsaInteger(word))) { copy=word; isString=true; } break; } if (copy.equals("firstclass")) TotalMiles+= (2*mileage); else if (copy.equals("coach")) TotalMiles+= (1*mileage); else if (copy.equals("discount")) TotalMiles+= (0*mileage); } } System.out.println("Frequent-flier miles the person earns: "+ Tota…

t9
type: Tag
tag name: t9
tags question: http://stackoverflow.com/q/22375251

http://stackoverflow.com/comment/34086968
comment on: http://stackoverflow.com/q/22417184
type: Comment
score: 0
has text: this is the error: 'Error: Syntax error on token "char", delete this token', however when i delete it is says "firstletter cannot be resolved to a variable' and "aStringVariable cannot be resolved"
type: QuestionComment

http://stackoverflow.com/comment/34168137
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22463342
has text: Yes, i should admit i didn't catch it in the example because i remember later the exception. :(
score: 0

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/22365312
tags question: http://stackoverflow.com/q/22364309
tags question: http://stackoverflow.com/q/22469395
tags question: http://stackoverflow.com/q/22435226
tags question: http://stackoverflow.com/q/22347381
tags question: http://stackoverflow.com/q/22466383
tags question: http://stackoverflow.com/q/22350288
tags question: http://stackoverflow.com/q/22412189
tags question: http://stackoverflow.com/q/22446452
tags question: http://stackoverflow.com/q/22386666
tags question: http://stackoverflow.com/q/22366020
tags question: http://stackoverflow.com/q/22339922
tags question: http://stackoverflow.com/q/22482835
tags question: http://stackoverflow.com/q/22483575
type: Tag
tags question: http://stackoverflow.com/q/22467063
tags question: http://stackoverflow.com/q/22374769
tags question: http://stackoverflow.com/q/22457573

http://stackoverflow.com/q/22376673
tagged with: jboss-weld
has answer: http://stackoverflow.com/a/22428490
has comment: http://stackoverflow.com/comment/34022042
answer count: 1
downvote count: 0
favorite count: 0
tagged with: cdi
type: UnansweredQuestion
score: 6
has body: I have a Service in a Java SE application (without any application server) which creates Algorithm instances and run them. Every Algorithm instance needs a new (separate) ActionExecutor and a new (separate) AlgorithmState. ActionExecutor also needs an AlgorithmState instance and this instance have to be the same as Algorithm gets. How can I achieve this with CDI? I've tried constructor injection and @New on both parameters of Algorithm but I guess this is not what I want. Service class: import java.util.ArrayList; import java.util.List; import javax.enterprise.inject.Instance; import javax.inject.Inject; public class Service { @Inject private Instance&lt;Algorithm&gt; algorithmInstance; public void run() { final List&lt;Algorithm&gt; algorithms = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; 3; i++) { final Algorithm algorithm = algorithmInstance.get(); algorithms.add(algorithm); } for (final Algorithm algorithm: algorithms) { algorithm.doSomething(); } } } Algorithm class: import java.util.concurrent.atomic.AtomicInteger; import javax.enterprise.inject.New; import javax.inject.Inject; public class Algorithm { private static final AtomicInteger counter = new AtomicInteger(100); private final ActionExecutor actionExecutor; private final AlgorithmState algorithmState; private final int id; @Inject public Algorithm(@New final ActionExecutor actionExecutor, @New final AlgorithmState algorithmState) { this.actionExecutor = actionExecutor; this.algorithmState = algorithmState; id = counter.incrementAndGet(); System.out.println("algorithm ctor#" + id); } public void doSomething() { System.out.printf("do something, algorithm id: #%d: executor id%sd, stateId: %d, executor-&gt;stateId: %d%n", id, actionExecutor.getId(), algorithmState.getId(), actionExecutor.getAlgorithmStateId()); } } ActionExecutor class: import java.util.concurrent.atomic.AtomicInteger; import javax.inject.Inject; public class ActionExecutor { private static AtomicInteger counter = new AtomicInteger(200)…
upvote count: 6
tagged with: java
type: Question
tagged with: dependency-injection
has title: Creating and wiring related instances at runtime with CDI

http://stackoverflow.com/q/22455872
tagged with: location
answer count: 1
downvote count: 0
tagged with: android-location
favorite count: 0
has comment: http://stackoverflow.com/comment/34154800
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java
upvote count: 1
has body: I'm looking for a simple android weather app that would show degrees and condition for example in a textview by location programmatically. I found this one: http://www.survivingwithandroid.com/2013/05/build-weather-app-json-http-android.html?m=1 But it's too much complicated.Really, I need only two datas from my location. public class MainActivity extends Activity implements LocationListener{ protected LocationManager locationManager; protected LocationListener locationListener; protected Context context; TextView txtLat; String lat; String provider; protected String latitude,longitude; protected boolean gps_enabled,network_enabled; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); txtLat = (TextView) findViewById(R.id.textview1); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this); } @Override public void onLocationChanged(Location location) { txtLat = (TextView) findViewById(R.id.textview1); txtLat.setText("Latitude:" + location.getLatitude() + ", Longitude:" + location.getLongitude()); } @Override public void onProviderDisabled(String provider) { Log.d("Latitude","disable"); } @Override public void onProviderEnabled(String provider) { Log.d("Latitude","enable"); } @Override public void onStatusChanged(String provider, int status, Bundle extras) { Log.d("Latitude","status"); } } Is there a simple method to have the weather?
type: Question
has title: Simple android weather app
tagged with: weather
has answer: http://stackoverflow.com/a/24687220
has comment: http://stackoverflow.com/comment/34154469

http://stackoverflow.com/q/22403592
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26042669
has comment: http://stackoverflow.com/comment/34062166
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34062075
type: Question
tagged with: emf
linked to: http://stackoverflow.com/q/2543987
tagged with: object
has title: How to convert a java object to EMF EObject?
has body: I need to convert an XML to java object and in turn convert the java object to EMF EObject. Please help me out.
answer count: 1
has comment: http://stackoverflow.com/comment/34062115
linked to: http://stackoverflow.com/q/3276149
linked to: http://stackoverflow.com/q/11221136

http://stackoverflow.com/a/22344645
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22344369
has body: Spring batch will be a good fit for that: http://projects.spring.io/spring-batch/ It has support for automatic restart of jobs and partitioning ( distribution over many machines ). There is an entire chaptr in the docs dedicated to scaling/distribution: http://docs.spring.io/spring-batch/2.2.x/reference/html/scalability.html

http://stackoverflow.com/comment/34015176
type: QuestionComment
comment on: http://stackoverflow.com/q/22371041
has text: The same way you give the path to *any* file.
score: 0
type: Comment

http://stackoverflow.com/comment/34048737
score: 0
has text: I'm not familiar with try/catch statements. Does it automatically loop back to the top of the try-block upon completion of the catch-block?
type: Comment
comment on: http://stackoverflow.com/a/22395146
type: AnswerComment

http://stackoverflow.com/comment/34109489
type: QuestionComment
comment on: http://stackoverflow.com/q/22430159
has text: @fge sorry, this is only a section of coding. It refers to the level of an object that was already declared.
score: 0
type: Comment

http://stackoverflow.com/comment/33989412
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22360709
has text: yes. The next line has the data also for the same user.
score: 0

http://stackoverflow.com/comment/34209243
comment on: http://stackoverflow.com/q/22486903
score: 1
has text: Do you want to analyze the state of specific objects or any arbitrary object? Because for example the Eclipse debugger can help you. If not the JVM Monitor is a rather capable tool which is an Eclipse plugin.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22462326
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34166149
has body: When you add a UI component in swing, you need to call the component's revalidate method for the changes to take effect.
has comment: http://stackoverflow.com/comment/34166203
upvote count: 1
answers question: http://stackoverflow.com/q/22462275
accepted answer of: http://stackoverflow.com/q/22462275
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/34166173
has comment: http://stackoverflow.com/comment/34166682

http://stackoverflow.com/q/22427683
downvote count: 0
tagged with: rest
score: 1
favorite count: 0
has title: use FormDataParam in netbeans
type: UnansweredQuestion
has body: I'm trying to use the FormDataParam to upload a file to the glassfish server but I can't figure out how to import it. When I add the Jersey library with netbeans (Right Click on Librairies and Add Library) there is no such package org.glassfish.jersey.media.multipart. And when I try to download Jersey from the website the jar does not contain this package. Thanks for your help
answer count: 0
has comment: http://stackoverflow.com/comment/36193487
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/36186445
tagged with: jersey

http://stackoverflow.com/comment/34119669
comment on: http://stackoverflow.com/q/22436093
score: 1
has text: Still trying to work out your question to see where your confusion lies - but the answer is the constructor is run at run-time.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22341205
upvote count: 2
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/33954485
score: 2
tagged with: java
linked to: http://stackoverflow.com/q/22123266
type: Question
tagged with: graphics
linked to: http://stackoverflow.com/q/12683533
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22341224
has answer: http://stackoverflow.com/a/22342170
has title: drawing an oval after clicking the mouse
has body: I want to draw an oval when I click the mouse in my panel. And drawing is allowed after I click the button. But a problem is occurs: a copy of the button is drawn in the top left of the panel. This is my code: public class PaintPanel extends JPanel implements MouseListener, MouseMotionListener{ private boolean draw = false; private JButton button; private Point myPoint; public PaintPanel(){ this.setSize(800,600); button = new JButton("Allow draw"); button.setSize(30,30); this.add(button); this.addMouseListener(this); this.addMouseMotionListener(this); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { draw = true; } }); } @Override public void paintComponent(Graphics g){ g.setFont(new Font("Arial",Font.BOLD,24)); g.setColor(Color.BLUE); if(draw){ g.drawOval(myPoint.x-10, myPoint.y-10, 20, 20); } } @Override public void mousePressed(MouseEvent e) { if(draw){ myPoint = e.getPoint(); repaint(); } } public static void main(String[] agrs){ JFrame frame = new JFrame("Painting on panel"); frame.add(new PaintPanel()); frame.setVisible(true); frame.setSize(800,600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); } }
tagged with: paintcomponent
favorite count: 0

http://stackoverflow.com/q/22458627
accepted answer: http://stackoverflow.com/a/22460061
has comment: http://stackoverflow.com/comment/34159561
favorite count: 0
has comment: http://stackoverflow.com/comment/34159463
tagged with: spring
has comment: http://stackoverflow.com/comment/34159649
tagged with: spring-mvc
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22460061
has comment: http://stackoverflow.com/comment/34161078
has comment: http://stackoverflow.com/comment/34159529
has body: I have a simple controller with scope annotation. @Controller @Scope("session") @RequestMapping("/") public class HelloController { private User user = new User("Bob"); @RequestMapping(method = RequestMethod.GET) public String printWelcome() { return "hello"; } } and simple jsp page Y=${sessionScope.user} Z=${user} But when I'm trying to run this code, I'm getting nothing. The result is empty. I don't want to use single beans of User, also I don't like to pass object of HttpSession to method in controller or HttpServletRequest object for retrieving session from it. Is there any solution for using some annotation (except @SessionAttributes) to pass object to jsp from my controller?
has title: How can I bind JSP page and session scoped field of the controller?
downvote count: 0
answer count: 1
tagged with: jsp
linked to: http://stackoverflow.com/q/13276391

http://stackoverflow.com/a/22355996
has comment: http://stackoverflow.com/comment/33979897
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33980002
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22355927
type: Answer
has comment: http://stackoverflow.com/comment/33979894
has body: Well, you can't directly store binary values in Java without any prefix. binNumber isn't stored as the binary number 1111010; instead, it's stored as the decimal number 1111010. This you have to store as int binNumber = Integer.parseInt("1111010", 2); or better yet int binNumber = 0b1111010;. For octal: int octalNo = 0177; //'0' is prefix or int octalNo = Integer.parseInt("0177", 8); //leading '0's are ignored For hexadecimal: int hexNo = 0x177; //'0x' is prefix or int hexNo = Integer.parseInt("0177", 16); //leading '0's are ignored For more info, have a look at this.
answers question: http://stackoverflow.com/q/22355927
has comment: http://stackoverflow.com/comment/33980052
upvote count: 5

http://stackoverflow.com/a/22476050
answers question: http://stackoverflow.com/q/22475913
score: 1
has body: public void onPostExecute(String result){ Intent intent = new Intent(ThisActivity.this, TargetActivity.class); intent.putExtra("YourData", result); StartActivity(intent) } and get it in another activity via getIntent()
has comment: http://stackoverflow.com/comment/34418954
downvote count: 1
upvote count: 2
type: Answer

http://stackoverflow.com/comment/34047082
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22394276
has text: Why the downvote? This is a legitimate question...
type: Comment

http://stackoverflow.com/comment/34149203
comment on: http://stackoverflow.com/q/22406321
has text: Yes Thorbjørn Ravn Andersen, and also debuging the code thru Eclipse IDE. If I just replace "\\n" to "\n" in the returned value I get the expected result.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/22429580
score: 0
answers question: http://stackoverflow.com/q/22422712
has body: Your configuration looks correct . Did you restart hbase ? Restarting is essential if you do any changes to the conf files. I checked on my system and it's working fine.. By default hbase uses /tmp/hbase-${user.name} for storing data which I think is also being used in your case.
has comment: http://stackoverflow.com/comment/34119889
type: Answer

http://stackoverflow.com/comment/34136702
score: 0
type: AnswerComment
has text: ok because my background is like the minecraft main menu where it is animated and i dont want it covered
type: Comment
comment on: http://stackoverflow.com/a/22445008

http://stackoverflow.com/q/22407693
favorite count: 0
has answer: http://stackoverflow.com/a/38429698
type: UnansweredQuestion
score: 2
downvote count: 0
has title: javax.naming.directory.BasicAttributes.put() method: is there a way to create an LDAP entry with 2 identical LDAP attributes at creation time?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22431917
has body: I tried using the javax.naming.directory.BasicAttributes.put() method. However, when I run the code (see sample below) I only get 1 attribute value in the "testKey1" LDAP attribute ("junk1"), instead of 2 (i.e. "junk1" and "junk2")? How can I do this on an ldap create call? Thank you in advance for any assistance you may be able to provide /** * Creates an LDAP ENTRY based on a commonName passed in. * * @param commonName * * @throws NamingException */ public void createLDAPEntry (String commonName) throws NamingException { Ldap ldap = null; // a custom Ldap object that can be used to connect and perform methods on an Ldap connection (i.e. create, add, delete, etc.). try { ldap = getLDAPAuthenticated(true); // bind to LDAP with the appropriate credentials String commonNameString = "cn=" + commonName + "ou=Servers,ou=myOrg,c=US"; javax.naming.directory.BasicAttributes basicAttributes = new BasicAttributes(true); // new object with case-insensitive // basicAttributes.put(new javax.naming.directory.BasicAttribute("cn", commonName)); // not needed, the ldap.create() does this for you. basicAttributes.put(new BasicAttribute("testKey1", "junk1")); basicAttributes.put(new BasicAttribute("testKey1", "junk2")); basicAttributes.put(new BasicAttribute("sn", commonName)); basicAttributes.put(new BasicAttribute("objectclass", "top")); basicAttributes.put(new BasicAttribute("objectclass", "person")); basicAttributes.put(new BasicAttribute("objectclass", "organizationalPerson")); basicAttributes.put(new BasicAttribute("objectclass", "inetorgperson")); ldap.create(commonNameString, basicAttributes); // will create a cn that has commonNameString for the value and the attributes } finally { // be sure to close the connection if (ldap != null) { ldap.close(); } } } Here is the corresponding create method call protected void create(String dn, javax.naming.directory.Attributes attrs) throws NamingException { LdapContext ctx = null; try { int i = 0; while ((i &lt;= this.config.getOperatio…
upvote count: 2
tagged with: ldap
answer count: 2

http://stackoverflow.com/a/35244892
has body: Try something like this jobClient.displayTasks(jobID, "map", "completed"); where job ID is JobID jobID = new JobID(jobIdentifier, jobNumber); or TaskReport[] taskReportList = jobClient.getMapTaskReports(jobID);
score: 0
answers question: http://stackoverflow.com/q/22412423
type: Answer

http://stackoverflow.com/a/22389494
type: AcceptedAnswer
downvote count: 0
has body: You seem to be using a 1.6 JDK but a 1.7 JRE. Since you are using ubuntu, try and see what this command gives: dpkg --list|grep openjdk If my reasoning is correct, you will have openjdk-6-jdk and openjdk-7-jre. If this is the case, try and: sudo apt-get install openjdk-7-jdk Normally, JDK 7 has a higher priority than JDK 6 (see update-alternatives); so after install, you should have the correct compiler version. Check again with javac -version.
answers question: http://stackoverflow.com/q/22389322
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22389322

http://stackoverflow.com/q/22434031
possible better answer: http://stackoverflow.com/a/22434718
downvote count: 0
has comment: http://stackoverflow.com/comment/34116049
has answer: http://stackoverflow.com/a/22434718
score: 1
has comment: http://stackoverflow.com/comment/34116024
has comment: http://stackoverflow.com/comment/34116051
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34116086
has body: I am going through an exercise in Java trying to improve my lacklustre programming skills. I have built an array of Items (with each Item holding the name and price of an item). This is done in my GroceryBill class and the array seems to have worked. I then add items to the array but when I try to get the total of the array I get NullPointerException. To shorten it to the relevant parts (and if I am missing anything important I can edit it in). This is the code in the main class. public class InheritanceDiscountBill { public static void main(String[] args){ // TODO code application logic here GroceryBill checkout1 = new GroceryBill(); Item orange = new Item("Orange", 0.50); Item pie = new Item("Pie" , 2.49); checkout1.addItem(orange); checkout1.addItem(pie); checkout1.getTotal(); } } Item class public class Item{ private String name; private double price; public Item (String n, double p){ name = n; price = p; } public String getName(){ return name; } public double getPrice(){ return price; } } GroceryBill class public class GroceryBill { Item[] groceryBill; int counter; public GroceryBill(){ groceryBill = new Item[10]; counter = 0; } public void addItem(Item i){ groceryBill[counter] = i; counter++; } public double getTotal(){ double totalCost = 0; for (Item i : groceryBill){ totalCost = totalCost + i.getPrice(); System.out.println(i.getPrice()); } return totalCost; } } It keeps coming up with Null pointer exception and points to when I call the checkout1.getTotal() method and then the totalCost = totalCost + i.getPrice();. Is it because the list isn't full and so it is getting null values as it iterates through the list? If so how do I stop this from happening? I'm very new to this so please take it easy and explain things simply. I have read around on the topic but am still lost as to what I am doing wrong.
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/22434127
upvote count: 1
has comment: http://stackoverflow.com/comment/34116063
has title: NullPointerException in Java in an Array List
accepted answer: http://stackoverflow.com/a/22434127
has comment: http://stackoverflow.com/comment/34116076
has comment: http://stackoverflow.com/comment/34116023
tagged with: nullpointerexception
type: AnsweredQuestion

http://stackoverflow.com/a/22481157
has comment: http://stackoverflow.com/comment/37933661
has comment: http://stackoverflow.com/comment/37990876
type: Answer
accepted answer of: http://stackoverflow.com/q/22479598
has body: It would be little tricky because all the comments are written in a separate iframe tag inside watch discussion. You will have to switch on that iframe first using driver.switchTo().frame("put ID or Name here"); but the iframe id is random value. After switch to that iframe you can find the comments all comments in a div that have class name 'Ct' so you can get those using XPATH. see the below working code FirefoxDriver driver = new FirefoxDriver(); driver.get("https://www.youtube.com/watch?v=JcbBNpYkuW4"); WebElement element = driver.findElementByCssSelector("#watch-discussion"); System.out.println(element.getText()); // this prints: loading.. // scrolll down so that comments start to load driver.executeScript("window.scrollBy(0,500)", ""); Thread.sleep(20000); List&lt;WebElement&gt; iframes = driver.findElements(By.xpath("//iframe")); for(WebElement e : iframes) { if(e.getAttribute("id") != null &amp;&amp; e.getAttribute("id").startsWith("I0_")) { // switch to iframe which contains comments driver.switchTo().frame(e); break; } } // fetch all comments List&lt;WebElement&gt; comments = driver.findElements(By.xpath("//div[@class='Ct']")); for(WebElement e : comments) { System.out.println(e.getText()); }
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/37898963
answers question: http://stackoverflow.com/q/22479598
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/37881024
has comment: http://stackoverflow.com/comment/37926292

http://stackoverflow.com/a/22394335
type: Answer
has body: What you want is probably something like this: public class Loader { private String[] strings; public Loader loadStrings(final String filename) { // initiate, fill "strings", then: return this; // Here is the "magic" stuff } public int[][] initMatrix() { // whatever } } But this is a shaky design; for instance, what if you don't .loadStrings() before you call .initMatrix()? You had better make an initMatrix(String fileName) method which calls loadStrings() which would then become private. That is a solution, there are others.
has comment: http://stackoverflow.com/comment/34047161
score: 0
answers question: http://stackoverflow.com/q/22394193

http://stackoverflow.com/comment/34056670
comment on: http://stackoverflow.com/a/22399700
has text: It won't show in the run as menu. But if you select run as -> Maven build (without ...), it will run your custom configuration if there is exactly one or show you a menu, if you have created multiple configs.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34103880
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22427242
has text: What is "cake" in your processQuestionData method. Are you sure you don't have some simple syntax errors?
type: Comment

http://stackoverflow.com/a/22338019
type: Answer
score: 1
upvote count: 1
has body: How can I make new File()work? It does work, but it doesn't create files on secondary storage. It just creates a File object in memory. So, n the second case you aren't creating a file at all. If you want to create an empty file, call f.createNewFile(). You probably don't want to do that: you probably want to put some content into it, via a new FileOutputStream(f).
accepted answer of: http://stackoverflow.com/q/22337398
answers question: http://stackoverflow.com/q/22337398
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22405753
score: 0
has comment: http://stackoverflow.com/comment/34068261
accepted answer of: http://stackoverflow.com/q/22405399
has comment: http://stackoverflow.com/comment/34067492
type: Answer
answers question: http://stackoverflow.com/q/22405399
has comment: http://stackoverflow.com/comment/34067616
has comment: http://stackoverflow.com/comment/34066839
has comment: http://stackoverflow.com/comment/34066318
has comment: http://stackoverflow.com/comment/34068075
has comment: http://stackoverflow.com/comment/34066646
has comment: http://stackoverflow.com/comment/34067955
has comment: http://stackoverflow.com/comment/34068145
has comment: http://stackoverflow.com/comment/34065585
has comment: http://stackoverflow.com/comment/34066435
type: AcceptedAnswer
has body: you can do something like this: BufferedReader reader = null; try { reader = new BufferedReader(new FileReader("path")); String line = null; int count = 0; while ((reader.readLine()) != null &amp;&amp; count &lt; 11) { count++; } if (count &gt; 10) { reader = new BufferedReader(new FileReader("path")); while ((line = reader.readLine()) != null) { System.out.println(line); } } else { System.out.println(" the file must have at least 10 lines"); } System.out.println("done"); } catch (Exception e) { e.printStackTrace(); }

null-layout-manager
tags question: http://stackoverflow.com/q/22371039
type: Tag
tags question: http://stackoverflow.com/q/22417290
tag name: null-layout-manager

http://stackoverflow.com/q/22443431
tagged with: io
answer count: 1
accepted answer: http://stackoverflow.com/a/22443536
score: 1
favorite count: 0
tagged with: serialization
type: Question
upvote count: 1
tagged with: java
has title: Java - Class Not Found exception
downvote count: 0
has answer: http://stackoverflow.com/a/22443536
has body: I am working on a project (this IS homework) where our professor gave us a .ser file and a Course.java file (Which is the class that he used to create the .ser file) My issue is that when I try to load the data from the .ser file into an array I get a ClassNotFoundException. what I ended up doing was creating a new class in my project named exactly the same as the class my professor created and copying/pasting his code into that class. I did do some research and my the .class files are in the same project folder and I am able to use the methods from the Course class in my project. After some guess and check work I know that the ClassNotFoundException gets kicked back at line 16, test = readData(); My Code: import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; public class ObjectSort { public static void main(String[] args) throws Exception { Course[] test = new Course[24]; test = readData(); } // end main() // read data from class binary file and put into an array of courses public static Course[] readData() throws Exception { // create class object to hold data from file Course[] holder = null; // create file and object input streams FileInputStream holderFile = null; ObjectInputStream holderObject = null; // catch exceptions try { // set up file and stream objects holderFile = new FileInputStream("fall2014.ser"); holderObject = new ObjectInputStream(holderFile); // read the object from a file holder = (Course[]) holderObject.readObject(); } catch (IOException exc) { exc.printStackTrace(); } finally { holderObject.close(); } return holder; } // end readData() }// end class ObjectSort Proffesor's class code: import java.io.*; class Course implements Serializable { private String campus; // the campus on which the course is offered private String course; // the course number, such as CSCI 111 private String section; // the section number private String crn; // the CRN for this section private int cr…
type: AnsweredQuestion

http://stackoverflow.com/comment/33954339
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22341128
has text: Right, let me rephrase. Unless Dennis Ritchie is here ...

http://stackoverflow.com/q/22475114
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22475322
tagged with: java
has body: Is Emma code coverage tool compatible with Java 7? The documentation states: According the the paper "EclEmma 2.0", Jacoco (that you looked) is supposed to work with Java 1.7. (see all Jacoco releases here) Java Runtime: As JaCoCo requires Java 1.5 the same minimum JRE is required for the Eclipse instance running EclEmma and the application under test. Note that this does not apply to the Java class files under test: Any class file version ranging from Java 1.0 to 1.7 is possible. The latest changes history mentions: Release 0.6.0 (2012/10/06) New Features Full support for Java 7 including INVOKEDYNAMIC as JaCoCo is now based on ASM 4.0 (GitHub #5). (since then, 0.6.1, 2012/12/19 has been released) But I couldn't get it running with Java 7? Has anyone tried it?
tagged with: emma
has title: Emma compatibility with Java version
type: Question
score: 0
answer count: 1
tagged with: jvm

http://stackoverflow.com/comment/34011963
comment on: http://stackoverflow.com/a/22374411
type: Comment
score: 1
has text: Damn. Your adherence to semantic absolutes has got me all hot and bothered. I'll do it @Keppil.
type: AnswerComment

http://stackoverflow.com/comment/41427797
type: QuestionComment
score: 0
has text: I had this problem in Tomcat7, turns out I had wrong userNameCol in DataSourceRealm context.xml config. Double check table and column names in a xml file.
comment on: http://stackoverflow.com/q/22370821
type: Comment

http://stackoverflow.com/comment/34003696
score: 2
comment on: http://stackoverflow.com/q/22369347
type: Comment
type: QuestionComment
has text: @rekire Primitives don't have an `equals` method - they're not objects

http://stackoverflow.com/comment/34142727
type: QuestionComment
comment on: http://stackoverflow.com/q/22448616
score: 0
has text: you can not declare a static variable inside a method...it will show illegal start of expression
type: Comment

http://stackoverflow.com/q/22441709
type: AnsweredQuestion
tagged with: netbeans
has answer: http://stackoverflow.com/a/22442724
has title: new gui components not displaying in netbeans
tagged with: java
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/22442724
score: 0
tagged with: user-interface
has comment: http://stackoverflow.com/comment/34131975
answer count: 1
has body: I started a Netbeans project a couple of weeks ago where I made a GUI. I came back to it today and added a JComboBox to my source code. However, when I run the program, my new combo box and all of my other editions to the code do not appear and nothing changes. It just keeps running my older version of the gui. Why is this happening and how do I fix it?

validation
tags question: http://stackoverflow.com/q/22477065
tags question: http://stackoverflow.com/q/22431821
tags question: http://stackoverflow.com/q/22395082
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/22450819
tags question: http://stackoverflow.com/q/22387835
tags question: http://stackoverflow.com/q/22442985
tags question: http://stackoverflow.com/q/22346969
tags question: http://stackoverflow.com/q/22480843
tags question: http://stackoverflow.com/q/22412455
tags question: http://stackoverflow.com/q/22328472
tags question: http://stackoverflow.com/q/22363093
tags question: http://stackoverflow.com/q/22417833
tags question: http://stackoverflow.com/q/22470589
tags question: http://stackoverflow.com/q/22425264
tags question: http://stackoverflow.com/q/22460584
tags question: http://stackoverflow.com/q/22374271
tags question: http://stackoverflow.com/q/22332309

http://stackoverflow.com/comment/34115240
type: AnswerComment
type: Comment
has text: You really should be overriding paintComponent and calling super.paintComponent before doing anything else. Perhaps you should provide a runnable example and update you question...
comment on: http://stackoverflow.com/a/22432348
score: 0

http://stackoverflow.com/q/22354821
type: Question
has comment: http://stackoverflow.com/comment/33978250
downvote count: 0
upvote count: 7
has comment: http://stackoverflow.com/comment/33978232
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/22354881
has body: I couldn't find any information about this when searching StackOverflow or Google, and I've got some coworkers who disagree with my preference for how to initialize a simple Long variable. Is there any reason to use one of these formats over the other? Long foo = (long) 0; // First way of doing it Long bar = 0L; // Second way of doing it I'm most interested if anyone knows if there is an efficiency difference here. The reason I prefer the second way is because you can specify values less than Integer.MIN_VALUE and greater than Integer.MAX_VALUE, whereas Eclipse would complain with something along the lines of "The literal 10000000000 of type int is out of range" if you used the first way here.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22354881
has answer: http://stackoverflow.com/a/24536002
linked to: http://stackoverflow.com/q/6834037
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/22354996
has title: Java - Is There Any Reason to Use This Format: (long) 0; Instead of This One: 0L;?
accepted answer: http://stackoverflow.com/a/22354996
has answer: http://stackoverflow.com/a/22354924

http://stackoverflow.com/q/22452572
tagged with: 3d
tagged with: libgdx
downvote count: 0
has answer: http://stackoverflow.com/a/22457532
upvote count: 1
has body: I am trying to get a better understanding of the Models and their Nodehierarchy in Libgdx. As much as i understood, a Model is made of many ChildNodes, which can contain other Nodes as well. Each node has a Vector3 translation describing its position, Vector3 scale, describing its scale and Quaternion rotation describing its rotation, all relative to the parent Node or Model. The Matrix4 gloabalTransform describes the same, but relative to the world they are in. Now if i think about games like Garrys Mod, where the Models of the Players can move parts of the model dynamically (for example if they lie on an edge after they died their upper body can hang down the wall), i can only think about, that they modify the single Nodes at runtime, in their source code. Now my questions: Is my assumption correct? Do i have the possibility to create the Nodes in Blender (lets say 1 Node is the left lower leg, 1 Node is the left upper leg...) and get and change them at runtime by using (for example) modelInstance.getNode("leftLowerLeg").translation.set(Vector3 position), or are they created and named automatically, depending on the shape, facecount...? Thanks a lot!
has comment: http://stackoverflow.com/comment/34152678
has comment: http://stackoverflow.com/comment/34154288
favorite count: 0
has answer: http://stackoverflow.com/a/22853004
has comment: http://stackoverflow.com/comment/34156399
has comment: http://stackoverflow.com/comment/34149434
has comment: http://stackoverflow.com/comment/34154459
tagged with: animation
has comment: http://stackoverflow.com/comment/34154575
has comment: http://stackoverflow.com/comment/34162220
has title: Understanding 3D Models and Nodes in Libgdx
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34153987
has comment: http://stackoverflow.com/comment/34156328
has comment: http://stackoverflow.com/comment/34191578
has comment: http://stackoverflow.com/comment/34161971
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34153690
type: Question
possible better answer: http://stackoverflow.com/a/22853004
has comment: http://stackoverflow.com/comment/34152856
answer count: 2
accepted answer: http://stackoverflow.com/a/22457532

http://stackoverflow.com/a/22361693
type: Answer
has comment: http://stackoverflow.com/comment/33991540
has comment: http://stackoverflow.com/comment/33990890
downvote count: 0
has comment: http://stackoverflow.com/comment/33992617
score: 3
has body: Is there a reason you set this property InternetExplorerDriver.REQUIRE_WINDOW_FOCUS to true? This is why IEDriver asks IE to take control your pointer. To fix it, simply remove it or set it to false. This was introduced in 2.28.0.3, here's the quote from CHANGELOG: Introduced the "requireWindowFocus" capability into the IE driver. When used in conjunction with the "nativeEvents" capability, the driver will attempt to bring the current IE window to the foreground before executing a mouse or keyboard event. Also, when the requireWindowFocus capability is set to true, advanced user interactions will now use the Windows SendInput() API to execute the interactions. To enable this behavior, set the value of the requiresWindowFocus capability to "true" when creating an instance of the IE driver. The default for this new capability is "false". This functionality is currently considered extremely experimental; use at your own risk.
has comment: http://stackoverflow.com/comment/49912193
answers question: http://stackoverflow.com/q/22338609
has comment: http://stackoverflow.com/comment/33991281
has comment: http://stackoverflow.com/comment/33991384
accepted answer of: http://stackoverflow.com/q/22338609
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/a/22385690
has comment: http://stackoverflow.com/comment/34032307
has comment: http://stackoverflow.com/comment/34031603
has comment: http://stackoverflow.com/comment/34031845
downvote count: 0
has comment: http://stackoverflow.com/comment/34031978
has comment: http://stackoverflow.com/comment/34032217
has comment: http://stackoverflow.com/comment/34031526
type: Answer
answers question: http://stackoverflow.com/q/22385640
has comment: http://stackoverflow.com/comment/34032310
has comment: http://stackoverflow.com/comment/34041882
has comment: http://stackoverflow.com/comment/34032090
has comment: http://stackoverflow.com/comment/34031783
score: 2
has comment: http://stackoverflow.com/comment/34033914
upvote count: 2
has comment: http://stackoverflow.com/comment/34031728
has comment: http://stackoverflow.com/comment/34039112
has comment: http://stackoverflow.com/comment/34032182
has body: Try the following: /web/search/(?!(employee/123456789$)).* The slash was doubled in the negating look-ahead group.
has comment: http://stackoverflow.com/comment/34032389
has comment: http://stackoverflow.com/comment/34032253
has comment: http://stackoverflow.com/comment/34032167

http://stackoverflow.com/comment/34037577
type: QuestionComment
has text: staffList is the name of the array in the Staff class that holds all the staffmember info that I need to print.
score: 0
comment on: http://stackoverflow.com/q/22388876
type: Comment

http://stackoverflow.com/q/22349169
score: 1
favorite count: 0
tagged with: oracle-database
tagged with: webcenter-sites
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22354891
upvote count: 1
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22354891
has title: How to put the application icon of the "Articles" sample in the application bar of the Oracle WebCenter Sites
has body: Good Morning, I'm following the documentation at the following link: http://docs.oracle.com/cd/E29542_01/doc.1111/e29634/wemregisteringapp.htm I have succeed in start the application. I can go at path: http://localhost:9180/Articles-1.0/home.app and use the application. However I want also to add the Articles Icon on the application bar like in this figure: http://imageshack.com/a/img839/3513/rzz.gif I follow all of the step-by-step guide at the first link but nothing appens in the application bar.
downvote count: 0
answer count: 1

http://stackoverflow.com/q/22477256
score: 2
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/22566101
tagged with: java
has title: android - speech recognition for Arabic language
type: Question
possible better answer: http://stackoverflow.com/a/27815292
has answer: http://stackoverflow.com/a/27815292
answer count: 2
downvote count: 0
tagged with: speech-recognition
favorite count: 0
has comment: http://stackoverflow.com/comment/82236712
tagged with: android
has answer: http://stackoverflow.com/a/22566101
has body: I am developing a speech recognition system, I have made one with English language and it worked very well. But what i am having problem with is that I need to develop the app to recognize Arabic language. Here is my code : private static final int RESULT_SPEECH = 1; Button b1 ; ListView lv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); lv = (ListView) findViewById(R.id.listView1); b1 = (Button) findViewById(R.id.button1); b1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent voicerecogize = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); voicerecogize.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "ar-eg"); startActivityForResult(voicerecogize, RESULT_SPEECH); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == RESULT_SPEECH &amp;&amp; requestCode == RESULT_OK); { ArrayList&lt;String &gt; results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); lv.setAdapter(new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1 , results)); } super.onActivityResult(requestCode, resultCode, data); }

http://stackoverflow.com/q/22328877
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34016569
score: 1
has comment: http://stackoverflow.com/comment/33933579
tagged with: java
accepted answer: http://stackoverflow.com/a/22330606
has comment: http://stackoverflow.com/comment/34021824
has comment: http://stackoverflow.com/comment/33934048
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22329157
tagged with: hashmap
tagged with: algorithm
has comment: http://stackoverflow.com/comment/33933627
has answer: http://stackoverflow.com/a/22330606
has comment: http://stackoverflow.com/comment/33934435
has answer: http://stackoverflow.com/a/22330318
answer count: 3
linked to: http://stackoverflow.com/q/2738886
downvote count: 0
has comment: http://stackoverflow.com/comment/33934024
favorite count: 0
possible better answer: http://stackoverflow.com/a/22329157
has body: I need an algorithm to find matching pairs of objects in a list. This is an example case: class Human { int ID; string monthOfBirth; string country; string [] hobbies = {}; } There is a large list of humans and the problem is to find matching human pairs, and this needs to be done efficiently because the lists are huge. Matching criteria: Birth month and country must match exactly Both should have more than x% of hobbies matching. Because of (2) criteria we can't do an exact equals comparison. The ways I can think of are: Brute force - Compare each object with every other object. Complexity O(n^2) Hash table For the hash table approach, I'm considering the following way: Create a hash set of &lt;String, List&lt;Human&gt;&gt; (Or a MultiMap) Concatenate birth month and country of each Human to one string Use this concatenated string to hash to the HashSet (two humans having same birth month and country must give the same hash code) If there is already an element, compare the hobbies for x% of match If matching, then this is a duplicate If hobbies do not match more than x%, then add this human (linked list approach) Is there a better way to do this? Does it make sense to concatenate the month and country? The list would be large, so I'm assuming, 'better' would mean by the amount of storage, not the execution speed.
has title: Efficiently finding matching pairs of objects
has comment: http://stackoverflow.com/comment/33936610

http://stackoverflow.com/comment/34102869
comment on: http://stackoverflow.com/q/22426593
has text: your stacktrace tells there is a NPE @ line 24. so actionbar is null
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22475910
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34189487
upvote count: 2
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/22476228
accepted answer: http://stackoverflow.com/a/22476228
has title: Java library or algorithm to extract person information from String
type: Question
tagged with: split
linked to: http://stackoverflow.com/q/1330103
tagged with: algorithm
score: -1
has comment: http://stackoverflow.com/comment/34189453
answer count: 1
favorite count: 0
tagged with: parsing
has body: I am looking for a Java library or algorithm to extract person information from a String. How I can extract person attributes from a String? Example: String s = "Mr. Dr. Tom Jones"; Person person = new Person(s); p.getSurename(); // Jones p.getFirstname(); // Tom p.getSalutation(); // Mr. p.getTitle(); // Dr. I am looking for a library based on algorithms via Fuzzy, Levenshtein or Phonetik. I have lists with titles, names and salutations to compare. I believe there isn't a perfect way. Sure there are many exceptions about name-conventions (some middle names, Jr. abbreviation, ...). Maybe someone has taken the step?
has comment: http://stackoverflow.com/comment/34189985
has comment: http://stackoverflow.com/comment/34189750

http://stackoverflow.com/a/22389399
has comment: http://stackoverflow.com/comment/34039769
has comment: http://stackoverflow.com/comment/34041909
has body: The -'0' is just a shorthand method of conversion between ascii and ints. Your stack is storing single digit numbers as chars, see the 2nd conversion below. Conversion from 1-digit int to numeric char int x = 1; char c = x + '0'; Conversion from numeric char to int char c = '5'; int x = c - '0'; Conversion from int to lowercase alphabetic char (0='a', 25='z') int x = 1; char c = x + 'a'; Conversion from lowercase alphabetic char to int char c = 'm'; int x = c - 'a'; Conversion from int to uppercase alphabetic char (0='A', 25='Z') int x = 1; char c = x + 'A'; Conversion from uppercase alphabetic char to int char c = 'M'; // 'M'=77 int x = c - 'A'; // 77-65=12 therefore 'M is element 12 of the alphabet (A=0) These work because: 0+48 = 0+'0' = '0' 0+65 = 0+'A' = 'A' 0+97 = 0+'a' = 'a'
type: Answer
answers question: http://stackoverflow.com/q/22389186
score: 0

http://stackoverflow.com/comment/33980788
has text: Do you use maven? If so, please add your pom.xml to the question. It looks like a dependency problem.
comment on: http://stackoverflow.com/q/22345432
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22369212
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/34003926
linked to: http://stackoverflow.com/q/4235609
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34003949
type: Question
tagged with: event-handling
has comment: http://stackoverflow.com/comment/34003729
has answer: http://stackoverflow.com/a/22369341
has title: Event driven web applications in Java?
answer count: 1
downvote count: 0
favorite count: 0
has body: Is it correct to assume that event driven web applications are currently not practical in Java, or is there a framework or techniques that make this practical in java. It seems to me that it is not possible, but maybe I am missing something. JDBC drivers (and JDBC itself) assume thread based/blocking interactions. Jetty/Tomcat and other app servers assume Servlets block until the results are ready. I know Cassandra has "execAsync()" modes, which is promising, but over all it seems like an uphill (impractical) proposition.

http://stackoverflow.com/q/22487367
answer count: 2
has title: SoapUI and Groovy: How to call a compiled jar file as if from the command line?
downvote count: 0
tagged with: groovy
has body: I am writing a test that requires me to execute a java file at one point. The Java file is already compiled and I do not have access to the source code or documentation. I know if I open up a command prompt and execute the file via typing: "java -jar someFile.jar - someOptions" then the step I need done is executed properly. I have tried the groovy script def output = "java -jar someFile.jar - someOptions".execute().text log.info output However this simply gives me an empty log entry. I am not sure if the issue is that the java takes some time to execute (it involves server calls) and thus the output has not been written to the string before I try to log the output. I am also not sure if the script can see the .jar file. I have placed it in my \bin\ext folder. However I also need this test to be OS agnostic so I'm really hesitant to hard code paths in the code.
favorite count: 0
tagged with: soapui
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22495133
score: 2
has answer: http://stackoverflow.com/a/22506467
tagged with: java
type: Question

multidimensional-array
tags question: http://stackoverflow.com/q/22485735
tags question: http://stackoverflow.com/q/22418151
tags question: http://stackoverflow.com/q/22436813
tags question: http://stackoverflow.com/q/22446985
type: Tag
tags question: http://stackoverflow.com/q/22393185
tags question: http://stackoverflow.com/q/22434012
tags question: http://stackoverflow.com/q/22444686
tags question: http://stackoverflow.com/q/22436206
tags question: http://stackoverflow.com/q/22432235
tags question: http://stackoverflow.com/q/22458725
tags question: http://stackoverflow.com/q/22381433
tags question: http://stackoverflow.com/q/22445071
tags question: http://stackoverflow.com/q/22471809
tags question: http://stackoverflow.com/q/22445396
tag name: multidimensional-array

http://stackoverflow.com/a/22466116
downvote count: 0
has comment: http://stackoverflow.com/comment/34173258
type: Answer
accepted answer of: http://stackoverflow.com/q/22465845
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22465845
has body: The javac compiler reads *.java source files and generates *.class files. As I see it, since DVDs/CDs are write-once, you'll need to adopt one of the following approaches: You compile the Java and burn both the source and class files onto the disk. You put the Java source onto the disk, and then your lecturer uses something like javac -d path/to/output/directory to generate the compiled class files somewhere on their own computer, and running the program from there.
has comment: http://stackoverflow.com/comment/34173167
type: AcceptedAnswer

http://stackoverflow.com/a/22431273
has body: SelectionSort.sort(array, 100, array.length-1); This 3-argument method doesn't exist in the code you've shown us so presumably you can't call it. int[] array = new int[size]; int is not an object so it can't extend Comparable. Arrays do not get auto-boxed so you must declare it as an Integer[] to pass it to a method that accepts a T[] where T extends Comparable&lt;T&gt;. Integer[] a = new Integer[4]; SelectionSort.sort(a); That part was OK and that is how you can call sort.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22430965
accepted answer of: http://stackoverflow.com/q/22430965
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34115065
comment on: http://stackoverflow.com/q/22433262
type: Comment
type: QuestionComment
has text: @SunilD. Hi, Sunil, I got the error message says:Failed to load resource: the server responded with a status of 500 (Internal Server Error)
score: 0

http://stackoverflow.com/comment/34041491
comment on: http://stackoverflow.com/a/22388664
type: Comment
has text: Add a `Log.d( "URL", sb.toString() )` before you append the API key. Please also log the contents of `data` in your `PlacesTask`.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34033330
type: QuestionComment
comment on: http://stackoverflow.com/q/22386593
has text: yes, sorry if i was not clear. i want to move it out to a java pojo config class, where using annotation i can create the bean.
score: 0
type: Comment

http://stackoverflow.com/comment/34051217
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22396552
type: Comment
has text: It seams you have not imported required packages. Kindly post Test.java as well

http://stackoverflow.com/comment/34135090
has text: @Accollativo (a) I added example code to illustrate. (b) You would have found such examples if you had searched StackOverflow. (c) Invest some time in study. Date-time work is surprisingly complicated and tricky.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22443231

http://stackoverflow.com/a/22347085
has body: use Object as a method parameter type Or you can user Generics (? or T) based on your requirements
type: Answer
answers question: http://stackoverflow.com/q/22347026
score: 0

grouplayout
type: Tag
tags question: http://stackoverflow.com/q/22330435
tag name: grouplayout

http://stackoverflow.com/comment/34287189
type: Comment
type: QuestionComment
has text: Oh sorry, typo..Always method5 executes before method4 which I don't want. How can I do it?
comment on: http://stackoverflow.com/q/22474276
score: 0

http://stackoverflow.com/q/22457065
tagged with: jsp
tagged with: javascript
has answer: http://stackoverflow.com/a/22463660
has comment: http://stackoverflow.com/comment/34158627
tagged with: ajax
accepted answer: http://stackoverflow.com/a/22469169
has comment: http://stackoverflow.com/comment/34157737
favorite count: 0
has comment: http://stackoverflow.com/comment/34157185
has comment: http://stackoverflow.com/comment/34156737
has comment: http://stackoverflow.com/comment/34158250
upvote count: 1
has title: JSP + JavaScript + Servlet Unexpected Results
has comment: http://stackoverflow.com/comment/34157747
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34156841
has body: I have a form on a jsp which calls a javascript function which latter calls a servlet. However the code mention below works once in while and when the code does reach the servlet the parameters return null. Also its really bizarre but it jumps between The doGet and doPost method even though i specify "POST". Can someone assist me with the correction. JAVASCRIPT: JSP FORM: Email: Password: login SERVLET "loginServlet": @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); String email = request.getParameter("email"); String password = request.getParameter("password"); String loginResult = login(email,password); System.out.println("EMAIL:" +email); System.out.println("PASSWORD:" +password); System.out.println("IM INSIDE GET!!!!"); response.getWriter().write(loginResult); } /** * Handles the HTTP POST method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); String email = request.getParameter("email"); String password = request.getParameter("password"); String loginResult = login(email,password); System.out.println("IM INSIDE POST!!!!"); response.getWriter().write(loginResult); } If any other information is required please let me know. Thank you for the help in advance.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34158138
linked to: http://stackoverflow.com/q/9824808
has answer: http://stackoverflow.com/a/22469169
has comment: http://stackoverflow.com/comment/34157830
has comment: http://stackoverflow.com/comment/34158007
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/34157899
answer count: 2
possible better answer: http://stackoverflow.com/a/22463660
downvote count: 0

http://stackoverflow.com/comment/33993228
type: QuestionComment
comment on: http://stackoverflow.com/q/22363234
type: Comment
has text: Ignoring the joys of SQL injection, print out your SQL statement. You're probably missing the single quotes.
score: 0

http://stackoverflow.com/a/67769288
answers question: http://stackoverflow.com/q/22475739
score: 0
type: Answer
has body: I was facing a similar issue on Ubuntu 20.04. What resolved it was to install and use Oracle JDK 11 as the default instead of OpenJDK. Here is a good tutorial: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-20-04 Notes: I did not need to completely uninstall OpenJDK or perform any other actions such as setting JAVA_OPTS or adding an ApplicationListener. What pointed me in the right direction: https://github.com/eXist-db/exist/issues/2242.

http://stackoverflow.com/q/22368577
has answer: http://stackoverflow.com/a/22369245
tagged with: file
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34003593
type: Question
has comment: http://stackoverflow.com/comment/34003617
has body: try{ File myDir = new File("c:/AndExam2/TestList/res/Xml"); File file = new File(myDir,"database.xml"); DocumentBuilderFactory docBuildFact = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuild = docBuildFact.newDocumentBuilder(); Document doc = docBuild.parse(file); doc.getDocumentElement().normalize(); } i don't know what's wrong. this code always makes java.io.FileNotFoundException: /c:/AndExam2/TestList/res/Xml/database.xml : open failed:ENOENT(no such file or directory)
score: -1
answer count: 2
tagged with: android
downvote count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: parsing xml in android. i don't know what's wrong
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34003631
has comment: http://stackoverflow.com/comment/34002502
upvote count: 0
has answer: http://stackoverflow.com/a/22369151
tagged with: java

http://stackoverflow.com/q/22337538
tagged with: if-statement
has comment: http://stackoverflow.com/comment/33948282
has answer: http://stackoverflow.com/a/22338543
has answer: http://stackoverflow.com/a/22337640
has answer: http://stackoverflow.com/a/22339039
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22337781
answer count: 4
has title: Trying to reduce/optimize if/else block to make more readable
tagged with: java
has body: I have the following block of code. Basically it determines in baseball if a player gets a number of bases, what happens based on if someone is on 1st/2nd/3rd. I did this out brute force but is there a way to rewrite this to drastically reduce the line count? I haven't been able to come up with a good way to do it. int runsScored = 0; switch (action) { case 0: break; case 1: if (third) { if (second) { if (first) { runsScored = 2; second = false; } else { runsScored = 2; first = true; second = false; third = false; } } else { if (first) { runsScored = 1; second = true; third = false; } else { runsScored = 1; first = true; third = false; } } } else { if (second) { if (first) { third = true; } else { first = true; } } else { if (first) { second = true; } else { first = true; } } } break; case 2: if (third) { if (second) { if (first) { runsScored = 2; first = false; } else { runsScored = 2; third = false; } } else { if (first) { runsScored = 1; second = true; } else { runsScored = 1; second = true; third = false; } } } else { if (second) { if (first) { runsScored = 1; third = true; second = true; first = false; } else { runsScored = 1; } } else { if (first) { first = false; second = true; third = true; } else { second = true; } } } break; case 3: if (third) { if (second) { if (first) { runsScored = 3; first = false; second = false; third = true; } else { runsScored = 2; second = false; } } else { if (first) { runsScored = 2; first = false; } else { runsScored = 1; } } } else { if (second) { if (first) { runsScored = 2; third = true; second = false; first = false; } else { runsScored = 1; second = false; third = true; } } else { if (first) { runsScored = 1; first = false; second = false; third = true; } else { third = true; } } } break; case 4: if (third) { if (second) { if (first) { runsScored = 4; first = false; second = false; third = false; } else { runsScored = 3; second = false; third = false; } } else { if (first) { runsScored = 3; first = false; third = false; } …
has comment: http://stackoverflow.com/comment/33947938
type: Question

http://stackoverflow.com/q/22427926
has answer: http://stackoverflow.com/a/22428828
type: Question
has body: I installed maven3 on Mavericks by Macports. It's working well but using java 1.6. How could I change to use java 7 instead? Maven3 is installed but using java 1.6: $ mvn -version Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 13:51:28+0000) Maven home: /opt/local/share/java/maven3 Java version: 1.6.0_65, vendor: Apple Inc. Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home Default locale: en_US, platform encoding: MacRoman OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac" Java 7 is also installed: $ java -version java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) Java 7 path: $ which java /usr/bin/java $ ls -lah /usr/bin/java lrwxr-xr-x 1 root wheel 74B 26 Oct 13:33 /usr/bin/java -&gt; /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java What's the difference in the two java paths? /System/Library/Java/JavaVirtualMachines /System/Library/Frameworks/JavaVM.framework/Versions
tagged with: java
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/22428828
tagged with: osx-mavericks
has title: How to use maven3 with java7 on OSX Mavericks?
type: AnsweredQuestion
tagged with: macports
downvote count: 0
score: 1
tagged with: maven-3
favorite count: 0

wcf-interoperability
tags question: http://stackoverflow.com/q/22332829
tag name: wcf-interoperability
type: Tag

http://stackoverflow.com/comment/34006414
type: AnswerComment
score: 2
type: Comment
has text: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
comment on: http://stackoverflow.com/a/22366650

http://stackoverflow.com/comment/34033325
comment on: http://stackoverflow.com/q/22386764
score: 0
type: Comment
type: QuestionComment
has text: Is there any data in the login table. I mean if you run that SQL SELECT query manually from MySQL command line does it produce any results?

http://stackoverflow.com/comment/34169263
comment on: http://stackoverflow.com/a/22462607
type: AnswerComment
has text: The 360 knowledge of web dev/programming alot of users on here seem to have is amazing, and a little intimidating.
score: 0
type: Comment

http://stackoverflow.com/a/22480293
type: Answer
has comment: http://stackoverflow.com/comment/76369012
score: 15
accepted answer of: http://stackoverflow.com/q/22480192
has comment: http://stackoverflow.com/comment/76322630
has comment: http://stackoverflow.com/comment/76319909
has body: So Why class property didn't change? Because the object hasn't changed, just the type of the reference you have to it. Casting has no effect at all on the object itself. In Java, unlike some other languages (thankfully), the type of the reference largely doesn't affect which version of a method you get. For instance, consider these two classes (courtesy of 2rs2ts&nbsp;&mdash; thank you!): class Base { public Base() {} public void foo() { System.out.println("I'm the base!"); } } class Child extends Base { public Child() {} public void foo() { System.out.println("I'm the child!"); } } This code: Child x = new Child(); Base y = (Base) x; y.foo(); ...outputs I'm the child! because even though the type of y is Base, the object that we're calling foo on is a Child, and so Child#foo gets called. Here (again courtesy of 2rs2ts) is an example on ideone to play with. The fact that we get Child#foo despite going through a Base reference is crucial to polymorphism. Now, it just so happens that the method you were calling (getClass) can only be Object#getClass, because it's a final method (subclasses cannot override it). But the concept is crucial and I figured it was probably the core of what you were asking about. The chief thing that the type of the reference does is determine what aspects of an object you're allowed to access. For instance, suppose we add bar to Child: class Child extends Base { public Child() {} public void foo() { System.out.println("I'm the child!"); } public void bar() { System.out.println("I'm Child#bar"); } } This code won't compile: Child x = new Child(); Base y = (Base) x; y.bar(); // &lt;=== Compilation error ...because Base has no bar method, and so we can't access the object's bar method through a reference with type Base.
upvote count: 15
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/76351256
answers question: http://stackoverflow.com/q/22480192

http://stackoverflow.com/q/22415370
linked to: http://stackoverflow.com/q/409784
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/22415397
has title: Returning an array of double values from string
downvote count: 0
has comment: http://stackoverflow.com/comment/34083474
favorite count: 0
has answer: http://stackoverflow.com/a/22415482
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/22415411
has body: String numbers = ("5,25,77,44,64,8,55,28,86,35"); I would like to return an array of double values from the string. I am unable to do that successfully with the following code : public static double[] fillArray(String numbers) { String[] answers = numbers.split(","); double[] boom = new double[answers.length]; for (int index = 0; index &lt; answers.length; index++) { boom[index] = Double.parseDouble(answers[index]); } return boom; } The error I get is quite weird... [De56f047c Why is that and how do I fix it?
score: 1
tagged with: java

http://stackoverflow.com/comment/37819237
comment on: http://stackoverflow.com/a/22366650
has text: @SubinJacob Your comment makes no sense. The answer is to use JWS.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34043150
type: Comment
has text: Thanks, I'll give it a shot. FYI, I'm using Eclipse. The problem with the setting a breakpoint technique is I cannot make this problem happen at will. It's very intermittent. So I was really hoping to simply add some diagnostics, rebuild, and run the code from a command line. Just the same, I'll see if I can use the technique you've suggested. Thanks!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22392146

http://stackoverflow.com/comment/34010168
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22373515
has text: But `jar` is compatible for Mac too.
score: 0

http://stackoverflow.com/comment/34206908
type: QuestionComment
has text: Ok, I see. Well, its the while loop with turn==0. Is it a better way to make the player fight the creature without stating that it should be turns? Btw, I edited the question to be more precise :)
comment on: http://stackoverflow.com/q/22485277
score: 0
type: Comment

http://stackoverflow.com/a/22428907
has comment: http://stackoverflow.com/comment/34107605
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34107463
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/34109400
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22428879
has body: The Java Language Specification says the following about class literals A class literal is an expression consisting of the name of a class, interface, array, or primitive type, or the pseudo-type void, followed by a '.' and the token class. The type of C.class, where C is the name of a class, interface, or array type (§4.3), is Class. [...] It is a compile-time error if the named type is a type variable (§4.4) or a parameterized type (§4.5) or an array whose element type is a type variable or parameterized type. You cannot do that. What you can do, but you'll have to refactor heavily, is to use type tokens.
has comment: http://stackoverflow.com/comment/34109387
has comment: http://stackoverflow.com/comment/34107508
answers question: http://stackoverflow.com/q/22428879

http://stackoverflow.com/q/22400333
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/15542145
upvote count: 2
has comment: http://stackoverflow.com/comment/34057586
favorite count: 0
type: UnansweredQuestion
has title: Eclipse Kepler Open Call Hierarchy Doesn't Searches in Application Libraries
score: 2
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34057639
has body: I recently have installed latest Eclipse Kepler for Java EE Developer Release 2. In the previous release the Call Hierarchy search was working for searching the invocation of the methods within the third party jars as well as the standard java library jars. But in this release it works only for the jars of the JRE Libraries. Has anyone faced this issue? Is there any solution? There is a similar question has already bean asked here and answered. This solution didn't worked for me. I have all the checkboxs (Sources, Required Projects, JRE Libraries, Application Libraries) selected in the option of "Search In" of Call Hierarchy.
tagged with: eclipse

http://stackoverflow.com/comment/34118545
score: 0
type: Comment
has text: I tried Upto fetching query from user passing it to a dictionary and finding the context of it,Later passing it to the search engine that fetches the related url ...now i need to group them based on similarity existng among those corpus...I dono how to do that?? Please help me
type: QuestionComment
comment on: http://stackoverflow.com/q/22434889

http://stackoverflow.com/q/22398886
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/22399097
tagged with: jsp
tagged with: struts2
answer count: 2
has answer: http://stackoverflow.com/a/22401155
favorite count: 0
accepted answer: http://stackoverflow.com/a/22401155
has title: How to match the result with the return statement of an action returning an object in Struts 2?
has body: i have an action searchUser, for that i made a method getUserById which returns the searched object. public Employee getUserById(int userId) { try { PreparedStatement preparedStatement = connection. prepareStatement("select * from employee where first=? OR last=?"); preparedStatement.setString(1, employee.getFirstName()); preparedStatement.setString(2, employee.getLastName()); ResultSet rs = preparedStatement.executeQuery(); if (rs.next()) { employee.setId(rs.getInt("id")); employee.setAge(rs.getInt("age")); employee.setFirstName(rs.getString("first")); employee.setLastName(rs.getString("last")); } } catch (SQLException e) { e.printStackTrace(); } return employee; } now, what should be the matching term for result in struts.xml because normally we match success string. but dnt know how i can match an object. Thnx
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22399097

http://stackoverflow.com/q/22397435
has answer: http://stackoverflow.com/a/22397590
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/34052194
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22397674
accepted answer: http://stackoverflow.com/a/22397674
has answer: http://stackoverflow.com/a/22397649
has title: Cant run Shell Script to launch Jar
upvote count: 3
tagged with: batch-file
answer count: 3
possible better answer: http://stackoverflow.com/a/22397590
tagged with: shell
has comment: http://stackoverflow.com/comment/34052151
favorite count: 0
has body: i have a windows batch script which launches a jar which launches a game written all in Java (its a runescape client). It should work. The original Batch (WIN): @echo off @echo Client Is loading...... @echo ----------------------- java -Xmx1000m -cp .;Theme.jar Gui 0 0 highmem members 32 pause the Shell file ive made for OS: #!/bin/sh echo Your client is loading... echo -------------------- java -Xmx1000m -cp Theme.jar Gui 0 0 highmem members 32 the error in terminal: Your Client is loading... -------------------- Exception in thread "main" java.lang.NoClassDefFoundError: Gui Caused by: java.lang.ClassNotFoundException: Gui at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) How can i fix it or make a shell script that will do the exact as the Batch and actually run?

http://stackoverflow.com/comment/34027657
type: Comment
type: QuestionComment
has text: Could be... I am stil new in libgdx and this is my first try with 3D, so i am pretty satisfied with the results until now, but ofc i want to optimate performance, if possible. So thats why i was asking
comment on: http://stackoverflow.com/q/22347445
score: 0

http://stackoverflow.com/comment/34061731
comment on: http://stackoverflow.com/a/22403133
type: Comment
score: 0
type: AnswerComment
has text: You're welcome... But I noticed that you've changed the description, and left the question without any point in it ("why does it give different results?" - the results are **NOT** different anymore)!

http://stackoverflow.com/a/22433627
downvote count: 0
type: AcceptedAnswer
score: 1
has body: You are initializing a local array here Player[] players = new Player[3]; Do this instead players = new Player[3];
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34115409
accepted answer of: http://stackoverflow.com/q/22433558
has comment: http://stackoverflow.com/comment/34115459
answers question: http://stackoverflow.com/q/22433558

http://stackoverflow.com/q/22328635
answer count: 2
tagged with: android
tagged with: utc
tagged with: datetime
has title: Having problems on getting actual time in UTC Android
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33933303
has answer: http://stackoverflow.com/a/22328778
has comment: http://stackoverflow.com/comment/33932947
possible better answer: http://stackoverflow.com/a/22329475
accepted answer: http://stackoverflow.com/a/22328778
has answer: http://stackoverflow.com/a/22329475
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33932781
has body: I am trying to get the the day and time in UTC as milliseconds but repeatedly get the same problem. The result should be something like '63530139420000' but each time the value '1394547490884' is returned. To get the date and time in UTC I use the following method: long dateutc = System.currentTimeMillis(); Can anyone tell me what is the problem?
type: Question

http://stackoverflow.com/q/22400292
has comment: http://stackoverflow.com/comment/34056643
has answer: http://stackoverflow.com/a/22400520
has answer: http://stackoverflow.com/a/22400486
has answer: http://stackoverflow.com/a/22401189
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22400486
has title: Extend all methods with extra parameters without declaring them
downvote count: 0
accepted answer: http://stackoverflow.com/a/22400591
favorite count: 0
has body: I have following interface: public interface HszService { Response&lt;User&gt; getUsers(); Response&lt;Item&gt; getItems(); Response&lt;Item&gt; getItems(ItemType type); } Every of those methods can be called in API also with int page and int pagesize parameters. Is it possible to extend above methods indirectly with those parameters ? I really want to avoid defining it like: public interface HszService { Response&lt;User&gt; getUsers(); Response&lt;User&gt; getUsers(int page, int pagesize); Response&lt;Item&gt; getItems(); Response&lt;Item&gt; getItems(int page, int pagesize); Response&lt;Item&gt; getItems(ItemType type); Response&lt;Item&gt; getItems(ItemType type, int page, int pagesize); } What is the best pattern to handle it ?
has answer: http://stackoverflow.com/a/22400591
answer count: 4

http://stackoverflow.com/a/22330606
has body: First of all, you need to sort the Humans into buckets by monthOfBirth + country. That should be pretty cheap to do - just iterate through them all, popping each one into the appropriate bucket. Note that appending Strings is the "hacky" way to approach this. The "proper" way would be to create a key object with a proper hashCode method: public class MonthCountryKey { String monthOfBirth; String country; // &lt;snip&gt; constructor, setters @Override public int hashCode() { return Arrays.hashCode(new Object[] { monthOfBirth, country, }); } @Override public boolean equals(Object o) { ... } } See: What is a best practice of writing hash function in java? Map&lt;MonthCountryKey,List&lt;Human&gt;&gt; buckets = new HashMap&lt;List&lt;Human&gt;&gt;; while(Human human = humanSource.get()) { MonthCountryKey key = new MonthCountryKey(human.getMonthOfBirth(), human.getCountry()); List list = buckets.get(key); if(list == null) { list = new ArrayList&lt;Human&gt;(); buckets.put(key,list); } list.add(human); } Note that there are other kinds of Set. For example, new TreeSet(monthCountryHumanComparator) -- with Apache BeanUtils new TreeSet(new BeanComparator("monthOfBirth.country"))! If there are really lots of humans, it could be worth storing the buckets in a database - SQL or otherwise, as you see fit. You just need to be able to get them reasonably quickly by bucket and list index number. Then you can apply a hobby matching algorithm to each bucket in turn, reducing the scale of the brute force search dramatically. I can't see a way to avoid comparing every Human in a bucket to every other Human in the same bucket, but you could do some work to make the comparisons cheap. Consider encoding the hobbies as an integer; one bit per hobby. A long gives you up to 64 hobbies. If you need more, you will need more integers or a BigInteger (benchmark both approaches). You could build up the dictionary of bit positions to hobbies as you work through the Humans and encounter new hobbies.…
score: 3
has comment: http://stackoverflow.com/comment/34032657
answers question: http://stackoverflow.com/q/22328877
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22328877
has comment: http://stackoverflow.com/comment/33946035
upvote count: 3
has comment: http://stackoverflow.com/comment/34019737

file
type: Tag
tags question: http://stackoverflow.com/q/22482428
tags question: http://stackoverflow.com/q/22420427
tags question: http://stackoverflow.com/q/22387759
tags question: http://stackoverflow.com/q/22443098
tags question: http://stackoverflow.com/q/22440339
tags question: http://stackoverflow.com/q/22405399
tags question: http://stackoverflow.com/q/22441785
tags question: http://stackoverflow.com/q/22341897
tags question: http://stackoverflow.com/q/22446095
tags question: http://stackoverflow.com/q/22401135
tags question: http://stackoverflow.com/q/22384347
tags question: http://stackoverflow.com/q/22442469
tags question: http://stackoverflow.com/q/22337398
tag name: file
tags question: http://stackoverflow.com/q/22358198
tags question: http://stackoverflow.com/q/22340971
tags question: http://stackoverflow.com/q/22360408
tags question: http://stackoverflow.com/q/22367836
tags question: http://stackoverflow.com/q/22456202
tags question: http://stackoverflow.com/q/22357100
tags question: http://stackoverflow.com/q/22403058
tags question: http://stackoverflow.com/q/22417980
tags question: http://stackoverflow.com/q/22384413
tags question: http://stackoverflow.com/q/22472779
tags question: http://stackoverflow.com/q/22481783
tags question: http://stackoverflow.com/q/22342800
tags question: http://stackoverflow.com/q/22469395
tags question: http://stackoverflow.com/q/22412040
tags question: http://stackoverflow.com/q/22418995
tags question: http://stackoverflow.com/q/22334358
tags question: http://stackoverflow.com/q/22338389
tags question: http://stackoverflow.com/q/22374758
tags question: http://stackoverflow.com/q/22428738
tags question: http://stackoverflow.com/q/22470200
tags question: http://stackoverflow.com/q/22341194
tags question: http://stackoverflow.com/q/22390488
tags question: http://stackoverflow.com/q/22332026
tags question: http://stackoverflow.com/q/22376783
tags question: http://stackoverflow.com/q/22348002
tags question: http://stackoverflow.com/q/22356066
tags question: http://stackoverflow.com/q/22338035
tags question: http://stackoverflow.com/q/22487110
tags question: http://stackoverflow.com/q/22368577
tags question: http://stackoverflow.com/q/22431620
tags question: http://stackoverflow.com/q/22466839
tags question: http://stackoverflow.com/q/22411104
tags question: http://stackoverflow.com/q/22411958
tags question: http://stackoverflow.com/q/22392964
tags question: http://stackoverflow.com/q/22406204
tags question: http://stackoverflow.com/q/22392685
tags question: http://stackoverflow.com/q/22473192
tags question: http://stackoverflow.com/q/22360383
tags question: http://stackoverflow.com/q/22368003
tags question: http://stackoverflow.com/q/22426192
tags question: http://stackoverflow.com/q/22374258
tags question: http://stackoverflow.com/q/22388951
tags question: http://stackoverflow.com/q/22408430

http://stackoverflow.com/a/22417116
has body: Use a TimerTask to set the title of the JFrame every second. public class TimerFrame { private static JFrame frame = new JFrame(); public static void main(String[] args) { TimerFrame timerFrame = new TimerFrame(); timerFrame.frame.setVisible(true); timerFrame.frame.setSize(400,100); new Timer().schedule(new TimerTask(){ int second = 60; @Override public void run() { frame.setTitle("Application will close in " + second-- + " seconds."); } },0, 1000); } }
answers question: http://stackoverflow.com/q/22416939
has comment: http://stackoverflow.com/comment/34086892
upvote count: 3
type: AcceptedAnswer
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/34086719
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22416939

http://stackoverflow.com/comment/34133247
has text: Why do you think that it doesn't make sense? It's exactly the same as the other answer was. You could always call the `SuperClass` constructor with default values, you shouldn't be afraid of typing since it's not that much. Also `integer`'s default value is 0. **Edit:* Now that the other answer is back again, it's excactly the same.
type: Comment
comment on: http://stackoverflow.com/a/22443056
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33973185
comment on: http://stackoverflow.com/q/22352022
has text: But you _can_ build a `String` from a `char[]` (or a `CharBuffer`)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22455826
has comment: http://stackoverflow.com/comment/34171704
type: AcceptedAnswer
downvote count: 0
has body: It seems to me, that you reqire a dynamically growing buffer. You can use the built in BytaArrayOutputStream to achieve that. It will automatically grow to store all data written to it. You can use write(int b) and toByteArray() to realize add b to block_storage and process block_storage as a byte[]. But take care - this stream will grow unbounded. You should implement some sanity checks around it to avoid using up all memory (e.g. count bytes written to it and break by throwing an exception, when it exceeds an reasonable amount). Also make sure to close and throw away the reference to a stream after consuming the block, to allow the GC to free up memory. edit: As @marcman pointed out, the buffer can be reset().
type: Answer
has comment: http://stackoverflow.com/comment/34157038
upvote count: 1
has comment: http://stackoverflow.com/comment/34167614
has comment: http://stackoverflow.com/comment/34155245
accepted answer of: http://stackoverflow.com/q/22447410
has comment: http://stackoverflow.com/comment/34155358
answers question: http://stackoverflow.com/q/22447410
score: 1

http://stackoverflow.com/comment/34196200
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22479770
has text: First i need to cast the document to something that i can send via JMS, so i tried with ObjectMessage and BytesMessage and BlobMessage. it says it cannot be cast to .. I add that the document was generated by itextpdf.
type: Comment

http://stackoverflow.com/comment/34195826
has text: This is does`nt cause a popup at all, even when developing, Unfortunately this was created and built a long time ago, so there is no documentation on it.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22476103

http://stackoverflow.com/comment/37062538
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22538604
has text: This has been broken from u25 (as mentioned previously by @haraldK) and from what I could glean from the numerous bug reports was expected to be fixed as of u60... however it is not fixed. Your code is a simple but effective work around. Thanks!

http://stackoverflow.com/comment/34089368
score: 1
type: AnswerComment
has text: @user815423426 Yeah; that wouldn't work. I'm reading Py4J docs looking for clues about why a class in the classpath can't be found, but haven't found anything yet. I'll let you know if I do. Are you *positive* the Java code compiles, and that all relevant `.class` files are present? Are you packaging this in a JAR? If so, does the JAR actually contain `ABCartDAO` and is the JAR on the JVM's class path? What happens if you try and test your code with pure Java, without going through Python?
type: Comment
comment on: http://stackoverflow.com/a/22418598

http://stackoverflow.com/comment/34107208
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22428981
has text: list say it called List<Car> cars1; and List<Car> cars2;
score: 0

http://stackoverflow.com/comment/34016365
comment on: http://stackoverflow.com/a/22368820
score: 0
type: AnswerComment
type: Comment
has text: Another example is Western Samoa which didn't have the date 2011-12-30 due to a change acrossing the international date line.

http://stackoverflow.com/q/22471372
tagged with: jsp
favorite count: 0
has title: Execution flow of web application?
tagged with: spring
has body: Below is the web.xml file of my web application .i need a favor that how my web application gets started what will be step by step flows. <?xml version="1.0" encoding="ISO-8859-1"?> Tudu Lists log4jConfigLocation WEB-INF/log4j.xml contextConfigLocation classpath:META-INF/spring/application-context.xml javax.servlet.jsp.jstl.fmt.localizationContext messages org.springframework.web.util.Log4jConfigListener org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener net.sf.navigator.menu.MenuContextListener dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher /tudu/* dwr org.directwebremoting.spring.DwrSpringServlet debug true 2 dwr /ajax/* rss tudu.web.servlet.RssFeedServlet 3 rss /servlet/rss backup tudu.web.servlet.BackupServlet backup /servlet/tudu_lists_backup.xml springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /tudu/* springSecurityFilterChain /ajax/* springSecurityFilterChain /servlet/* Open Session In View Filter org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter Open Session In View Filter /ajax/* encodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true encodingFilter /tudu/* GZipFilter net.sf.ehcache.constructs.web.filter.GzipFilter GZipFilter /* SimpleCachingHeadersPageCachingFilter net.sf.ehcache.constructs.web.filter.SimpleCachingHeadersPageCachingFilter suppressStackTraces false cacheName web-cache SimpleCachingHeadersPageCachingFilter /rss index.jsp java.lang.Exception /tudu/500 404 /tudu/404
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34780379
has answer: http://stackoverflow.com/a/22471408
accepted answer: http://stackoverflow.com/a/22471408
type: Question
tagged with: servlets
upvote count: 2
linked to: http://stackoverflow.com/q/5837122
downvote count: 1
answer count: 1

http://stackoverflow.com/q/22351348
upvote count: 1
tagged with: apache-storm
type: Question
tagged with: apache-kafka
tagged with: amazon-web-services
has body: after running topology in local cluster I created a remote storm cluster (storm-deploy Nathan). i Have removed Storm jars from build path in eclipse before creating a runnable jar with "package dependencies". my topology uses storm-kafka-0.9.0-wip16a-scala292.jar, which i either left in build path and removed from build path before creating runnable jar(just to try solve this issue..). when i use the following command: ./storm jar /home/ubuntu/Virtual/stormTopologia4.jar org.vicomtech.main.StormTopologia it always replies: Exception in thread "main" java.lang.NoClassDefFoundError: OpaqueTridentKafkaSpout at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2451) at java.lang.Class.getMethod0(Class.java:2694) at java.lang.Class.getMethod(Class.java:1622) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486) Caused by: java.lang.ClassNotFoundException: OpaqueTridentKafkaSpout at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) Since this topology worked fine on AWS on a single instance as a runnable jar, i can´t figure what i´m missing... here is code inside my main method: Config conf = new Config(); OpaqueTridentKafkaSpout tridentSpout = crearSpout( kafkadir, "test"); OpaqueTridentKafkaSpout logUpvSpout = crearSpout(kafkadir, "logsUpv"); OpaqueTridentKafkaSpout logSnortSpout = crearSpout( kafkadir, "logsSnort"); try { StormSubmitter.submitTopology( "hackaton", conf, buildTopology( tridentSpout, logUpvSpout, logSnortSpout)); } catch (AlreadyAliveException | Invali…
accepted answer: http://stackoverflow.com/a/22351683
downvote count: 0
answer count: 1
favorite count: 0
has title: storm-deploy submit topology java.lang.NoClassDefFoundError
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22351683

http://stackoverflow.com/comment/34014340
comment on: http://stackoverflow.com/a/22372477
has text: @user3380554 .exe files run on **Windows**. They **cannot** run on any Unix or Linux system.
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/34052861
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22395792
type: Comment
has text: I am getting an error inside the loop when valueexists is false.The part where the empty bean is generated and added..

http://stackoverflow.com/comment/33940456
has text: thank you for you time sorry for all the confutation
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22331950
type: Comment

http://stackoverflow.com/comment/34039226
score: 0
has text: My string is complicated, but this is the idea.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22389957

http://stackoverflow.com/q/22480262
favorite count: 0
accepted answer: http://stackoverflow.com/a/22500816
tagged with: digital-signature
tagged with: bouncycastle
has title: Bouncy Castle : Detached Enveloped Signature Changes at Every Run
upvote count: 1
has body: I am following the post generating and verifying digital signature. The Signed Data remains constant at all runs but Detached Enveloped Signature varies at every run. How the same text generates different Detached Enveloped Signature?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22500816
linked to: http://stackoverflow.com/q/16662408
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34200399
type: Question
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34203255

http://stackoverflow.com/q/22344023
tagged with: java
has answer: http://stackoverflow.com/a/27607845
score: 0
answer count: 1
has body: As we know that there is a limit of 25K contacts an user can have in his directory. Now I wants to add a new contact to the users directory. Is there any way available to fetch total contact count before adding a new contact to user directory. I am using Java Google Contact API 3.0. Any help would be appreciated.
has comment: http://stackoverflow.com/comment/85057184
type: UnansweredQuestion
tagged with: google-contacts-api
has title: To get total number of contacts an user have using Google Contact API
type: Question

http://stackoverflow.com/q/22384031
score: 0
has comment: http://stackoverflow.com/comment/34028463
has title: Applying style to selected text of a String in android?
linked to: http://stackoverflow.com/q/16060991
answer count: 1
tagged with: string
has answer: http://stackoverflow.com/a/22384161
tagged with: android
has comment: http://stackoverflow.com/comment/34028494
has body: I have a small doubt and I would like if you could make. Currently, I have a String and I check if a word using ".contains("String");" as for example: TextView tv = (TextView) dialog.findViewById(R.id.txtr); for (int x = 1; x &lt; 2; x++) { tv.append("Text one\n"); tv.append("Text Two\n"); } if(tv.getText().toString().contains("Text one")){ //Found }else{ //Not found } My question is this. Can I do conditional and if you find the word I'm looking, apply a style? if(tv.getText().toString().contains("Text one")){ tv.setTypeface(null, Typeface.BOLD); //I found text. Apply text bold }else{ //Not found } Regards!
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/19908547
tagged with: styles
type: Question
tagged with: conditional-statements
has comment: http://stackoverflow.com/comment/34028439
tagged with: java
accepted answer: http://stackoverflow.com/a/22384161

http://stackoverflow.com/q/22438243
answer count: 0
tagged with: java
has title: Add directories in to EXE file - EXE4J
has comment: http://stackoverflow.com/comment/34123601
type: Question
has body: I’m trying to make an EXE file from my java application using the exe4j tool. I have successfully built the JAR file of the project and also the lib directory. Another directory named “img” includes all the image files used in the application; without this directory, the JAR file does not execute. How do I connect this directory to the EXE in exej4? Or do I need to add this directory to the EXE file? How do I go about this?
has comment: http://stackoverflow.com/comment/34145167
score: 0
tagged with: exe4j
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22203162
tagged with: exe

http://stackoverflow.com/comment/34131048
comment on: http://stackoverflow.com/a/22442042
score: 0
type: AnswerComment
has text: @aruisdante I updated the answer in accordance with your comment. Downvoter: please see the revised answer.
type: Comment

http://stackoverflow.com/q/22343982
answer count: 4
score: 2
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/22344033
tagged with: java
duplicate of: http://stackoverflow.com/q/3456177
has title: Calling super class method
has answer: http://stackoverflow.com/a/22344270
has comment: http://stackoverflow.com/comment/33959632
has comment: http://stackoverflow.com/comment/33959302
type: Question
has comment: http://stackoverflow.com/comment/33959546
has answer: http://stackoverflow.com/a/22344064
has comment: http://stackoverflow.com/comment/33959862
upvote count: 2
linked to: http://stackoverflow.com/q/3456177
has comment: http://stackoverflow.com/comment/33959911
has comment: http://stackoverflow.com/comment/33960238
has answer: http://stackoverflow.com/a/22344289
accepted answer: http://stackoverflow.com/a/22344289
favorite count: 0
has comment: http://stackoverflow.com/comment/33959751
tagged with: android
has answer: http://stackoverflow.com/a/22344033
has body: I have class A which has a method sum(). Now class B extends class A and overrides sum() method, and class C extends class B and also overrides sum() method. Now I create an instance of class C. My question is: How can I call class A's sum() method in class C through C instance? One of the way is call super.sum() in B and C. Is there any other way?

http://stackoverflow.com/comment/34097177
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22423425
score: 1
has text: @ZouZou Two arguments would suffice. (One is the filename.)

http://stackoverflow.com/q/22445186
has comment: http://stackoverflow.com/comment/34136947
tagged with: arrays
downvote count: 0
score: 1
tagged with: string
accepted answer: http://stackoverflow.com/a/22445218
favorite count: 0
answer count: 3
has body: Using this code: public String toString() { StringBuilder s = new StringBuilder(); for (int i = 0; i &lt; length; i++) { s.append(i).append(":").append(arr[i]).append(", "); } s.delete(s.length()-2, s.length()-1); return s.toString(); } is not passing this test: @Test public void testToString() { BetterArray&lt;String&gt; b = new BetterArray&lt;String&gt;(); assertEquals("", b.toString()); b.add("hello"); assertEquals("0:hello", b.toString()); b.add("bye"); assertEquals("0:hello, 1:bye", b.toString()); b.add("adios"); assertEquals("0:hello, 1:bye, 2:adios", b.toString()); } It needs to start out as an empty string (""), am i doing that correctly? I'm new to StringBuilder. I'm using the s.delete to remove the trailing comma and space
possible better answer: http://stackoverflow.com/a/22445229
has answer: http://stackoverflow.com/a/22445229
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22445551
upvote count: 1
has title: Testing toString but it's failing?
type: Question
tagged with: tostring
has answer: http://stackoverflow.com/a/22445218
tagged with: java
has comment: http://stackoverflow.com/comment/34136881
has comment: http://stackoverflow.com/comment/34136895

http://stackoverflow.com/comment/37486505
type: Comment
has text: It appears during applet load, as i said in main topic
comment on: http://stackoverflow.com/a/24251078
type: AnswerComment
score: 0

http://stackoverflow.com/q/22467254
tagged with: struts2
type: AnsweredQuestion
score: 2
has title: struts2 convention plugin doesn't work in an EAR but works fine in WAR
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22490925
type: Question
upvote count: 2
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/22490925
has body: When I deployed the WAR file the convention plugin was able to find the action class using annotations, but it fails to find the action with in an EAR. glassfish- v2.1.1 struts2-convention-plugin-2.3.15.3 Content of struts.xml file: &lt;struts&gt; &lt;constant name="struts.devMode" value="true" /&gt; &lt;constant name="struts.convention.action.mapAllMatches" value="true"/&gt; &lt;constant name="struts.convention.package.locators" value="webservice"/&gt; &lt;constant name="struts.convention.action.suffix" value="Controller"/&gt; &lt;constant name="struts.convention.default.parent.package" value="rest-default"/&gt; &lt;constant name="struts.convention.exclude.parentClassLoader" value="true" /&gt; &lt;constant name="struts.convention.action.fileProtocols" value="jar,zip" /&gt; &lt;constant name="struts.convention.action.includeJars" value=".*?/*.*?jar(!/)?"/&gt; The stack trace: There is no Action mapped for namespace / and action name orders. - [unknown location] com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185) com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:70) org.apache.struts2.rest.RestActionProxyFactory.createActionProxy(RestActionProxyFactory.java:53) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:553) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:313) org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218) org.apache…
tagged with: struts2-convention-plugin

http://stackoverflow.com/comment/34064743
has text: can anyone tell why i'm getting downvotes for this .
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22404086

http://stackoverflow.com/comment/33974852
comment on: http://stackoverflow.com/q/22352375
score: 0
type: QuestionComment
has text: What about `.do`? Have you configured S2 to use it as action extension or not? If no then you need to remove it from the url.
type: Comment

http://stackoverflow.com/comment/34206721
type: AnswerComment
comment on: http://stackoverflow.com/a/22485627
has text: 11 is the bool object. So your saying just swap line 11 with your line of code? and How would I go about changing this value based on the relationship added on line 10? its a combo box with 4 values. If the value Relationship is picked I need the bool to be set to true instead of false. otherwise I need it set to false.
score: 0
type: Comment

http://stackoverflow.com/a/22425005
score: 1
has body: I think you want a card layout for this situation. Here is some code which should point you in the right direction. class MyFrame extends JFrame { public MyFrame() { JComponent allMyStuff = new JComponent(); JComponent allMyOtherStuff = new JComponent(); this.getContentPane().setLayout(new CardLayout()); this.getContentPane().add(allMyStuff, "1"); this.getContentPane().add(allMyOtherStuff, "2"); CardLayout cl = (CardLayout) (this.getContentPane().getLayout()); cl.show(this.getContentPane(), "1"); JButton b = new JButton("Open New Window"); //add somewhere to first compoonent b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CardLayout cl = (CardLayout) (this.getContentPane().getLayout()); cl.show(this.getContentPane(), "2"); } }); } } I doubt the code runs but generally it holds the idea. You have stuff in one panel, and stuff in another panel, and you just want to switch between the two. The button of course needs to be added in the first panel (allMyStuff) somewhere.
answers question: http://stackoverflow.com/q/22424869
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22424869
type: Answer
downvote count: 0

http://stackoverflow.com/comment/33999337
score: 0
comment on: http://stackoverflow.com/q/22365982
type: Comment
type: QuestionComment
has text: How can I move the printout to the main method>?

http://stackoverflow.com/a/22450463
type: AcceptedAnswer
upvote count: 16
has comment: http://stackoverflow.com/comment/34166581
type: Answer
has comment: http://stackoverflow.com/comment/34169113
has body: Yes you can. 1) Inject a DLL in the process hosting the JVM (eg, java.exe, or javaw.exe, or iexplore.exe). A common injection technique is to use SetWindowsHookEx 2) In the DLL, get the module handle of the jvm.dll using GetModuleHandle 3) Get the address of the JNI_GetCreatedJavaVMs function, using GetProcAddress 4) Call the function and, if successfull, attach your thread to the first JVM found, using the AttachCurrentThread function pointer from the JavaVM struture. 5) Done. Usefull link: The Invocation API
accepted answer of: http://stackoverflow.com/q/22441878
downvote count: 0
score: 16
answers question: http://stackoverflow.com/q/22441878
has comment: http://stackoverflow.com/comment/34169225

http://stackoverflow.com/a/22405022
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22329548
answers question: http://stackoverflow.com/q/22329548
type: Answer
has body: If someone is in trouble with the same issue, here is how i fixed it: try{ String encodedUrl = URLEncoder.encode("name with spaces", "UTF-8"); URL url = new URL("https://site.com/android/dir/file.php?paramName="+encodedUrl); URLConnection urlConnection = url.openConnection(); @SuppressWarnings("unused") InputStream in = urlConnection.getInputStream(); }catch(Exception e){ e.printStackTrace(); } } in php you need to escape and decode the parameter from the url like: $categoryParam= mysql_real_escape_string(urldecode($_GET["Param"])); It might not be the best way to do it, but it is working.

http://stackoverflow.com/a/22439774
type: AcceptedAnswer
upvote count: 3
has comment: http://stackoverflow.com/comment/34131402
has comment: http://stackoverflow.com/comment/34126451
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/34128319
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22430170
answers question: http://stackoverflow.com/q/22430170
has body: OpenGL ES does not destroy contexts or surfaces during orientation changes. The View hierarchy does do this; GLSurfaceView is particularly fond of releasing everything it can find. The onSurfaceCreated() callbacks are associated with Surfaces and Views. When the orientation changes you go through the activity lifecycle events, which tear down the View, and they in turn tear down the Surface. If this didn't happen, and you continued to render into the same Surface, then everything you did would appear to be rotated 90 degrees. (Remember, SurfaceView surfaces are sent directly to the system compositor, not composited with the UI by the application.) The usual practice is just to let everything get torn down and then build it back up again. If this doesn't work for some reason, I would recommend that you do your rendering off-screen and then blit the texture to the current surface. You can see an example of this in Grafika's "Double decode" activity, which renders into a pair of SurfaceTextures that it connects (and re-connects) to a pair of TextureViews. Another way to do the same thing would be to create an FBO, render into that, and blit that to your SurfaceView (you can see an example of FBO setup / blit in Grafika's "Record GL app" activity).
has comment: http://stackoverflow.com/comment/34128083

http://stackoverflow.com/a/54261446
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22330848
has body: I also was frustrated by this and Eclipse until I realized that similar to Pat B's Webpshere tip, it does cause issues for Eclipse if you have the dependencies in the wrong order. Properties -&gt; Java Build Path -&gt; Order and Export Play a bit around here with the order of core and client.

http://stackoverflow.com/comment/34103403
has text: Could you send me the path to it on stack overflow if you know where it is i couldnt find it ?
score: 0
comment on: http://stackoverflow.com/q/22427091
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22459231
upvote count: 1
has comment: http://stackoverflow.com/comment/34162847
answer count: 1
favorite count: 0
has body: This question is been manipulated from exam labs public class B{ public static void main(String args[]){ byte g =10; Byte x = new Byte(g); B p= new B(); p.doStuff(x); p.doStuff(g); } void dostuff(Number y){ System.out.println("C"); } void doStuff(short t){ System.out.println("X");} } Output : XC In above program , i dont understant why its giving "C" as output? its giving X because Byte--> byte-->short; but in case of , byte g=10; it should again pass through same method and give "X" as output. public class B{ public static void main(String args[]){ byte b1=12; Byte B1=new Byte(b1); capture(b1); capture(B1); } static void capture(short x){ System.out.print("A"); } static void capture(Number x){ System.out.print("G"); } } output : AG Here , also i understand why its A , because short is bigger than byte so it gives A But , for other output its should be again A , because B1 is Byte ---> byte(Autoboxing) --->pass through short (Widdening). Why its G?
has title: Autoboxing Concept SCJP
downvote count: 0
tagged with: scjp
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22459721
accepted answer: http://stackoverflow.com/a/22459721

http://stackoverflow.com/comment/59529346
type: AnswerComment
has text: I am using private void initMachineName(){ try { machineName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { e.printStackTrace(); } } is it fine?
type: Comment
comment on: http://stackoverflow.com/a/24640729
score: 0

http://stackoverflow.com/comment/33967030
comment on: http://stackoverflow.com/a/22348115
has text: @Junaid glad to help. Look at `at android.app.AlertDialog.<init>` in the stacktrace indicates that initialization failed.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34794454
comment on: http://stackoverflow.com/q/22446916
score: 0
type: QuestionComment
type: Comment
has text: Take a look at the first two answers [here](http://stackoverflow.com/questions/2422603/how-to-manage-transaction-for-database-and-file-system-in-java-ee-environment)

http://stackoverflow.com/a/22336760
answers question: http://stackoverflow.com/q/22336550
has comment: http://stackoverflow.com/comment/33949152
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22336550
has body: Use: NodeList nodeList = doc.getElementsByTagName("xLabel"); for (int temp = 0; temp &lt; nodeList.getLength(); temp++) { Node node = nodeList.item(temp); NodeList namexLabelNodes = node.getChildNodes(); for (int i = 0; i &lt; namexLabelNodes.getLength(); i++) { System.out.println(" Name : " + namexLabelNodes.item(i).getTextContent()); } } For yLabel will be same code.
type: Answer

http://stackoverflow.com/q/22385118
has answer: http://stackoverflow.com/a/22385137
tagged with: java
tagged with: datasource
has body: i am stuck on this problem for the past 2 days, i have a webservice that extract Data from a local database converts it to XML sends to another webservice with HttpGet and gets the response of success or faile and updates my local database. After some time i start to get this Error: java.sql.SQLException: Couldn't get connection because we are at maximum connection count (20/20) and there are none available I have tried increasing the maxconnection in my server.xml and applicationContext but nothing changes, always after some time this happens, This is my datasource java:comp/env/jdbc/StoreDS I have 2 methods that queries de Database, after them i use this one to close public void close() { try { if (!this.getJdbcTemplate().getDataSource().getConnection().isClosed()) { this.getJdbcTemplate().getDataSource().getConnection().close(); } } catch (Exception e) { e.printStackTrace(); // Logger.getLogger(myDAOImpl.class.getName()).log(Level.SEVERE, null, e); } } Heres one example public void updateStatus(Integer id, String name) { super.getJdbcTemplate().update( QueryUtil.QueryAtualizaPedido, name, id); close(); } My server.xml also has maxActive="250", i tried to change this several times but the error always comes as 20/20 The server encountered an internal error () that prevented it from fulfilling this request. exception org.hibernate.exception.GenericJDBCException: Cannot open connection org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126) org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114) org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52) org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:449) org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) org.hibernate.jdbc.BorrowedConnectionProxy.invoke(BorrowedConnectionProxy.java:74) com.sun.pro…
type: Question
has title: JDBC Maximum connection
answer count: 1
score: 0
type: UnansweredQuestion
tagged with: spring

jmenu
tags question: http://stackoverflow.com/q/22418640
tag name: jmenu
type: Tag

jar
tags question: http://stackoverflow.com/q/22373515
tags question: http://stackoverflow.com/q/22434068
tags question: http://stackoverflow.com/q/22464484
tags question: http://stackoverflow.com/q/22443650
tags question: http://stackoverflow.com/q/22468906
tags question: http://stackoverflow.com/q/22469319
tags question: http://stackoverflow.com/q/22333647
tags question: http://stackoverflow.com/q/22423208
tags question: http://stackoverflow.com/q/22360737
tags question: http://stackoverflow.com/q/22394109
tags question: http://stackoverflow.com/q/22430866
type: Tag
tags question: http://stackoverflow.com/q/22350106
tags question: http://stackoverflow.com/q/22342782
tags question: http://stackoverflow.com/q/22390203
tags question: http://stackoverflow.com/q/22456406
tags question: http://stackoverflow.com/q/22451117
tags question: http://stackoverflow.com/q/22336391
tags question: http://stackoverflow.com/q/22373090
tags question: http://stackoverflow.com/q/22356117
tag name: jar
tags question: http://stackoverflow.com/q/22471053
tags question: http://stackoverflow.com/q/22348613
tags question: http://stackoverflow.com/q/22470673
tags question: http://stackoverflow.com/q/22351377
tags question: http://stackoverflow.com/q/22387041
tags question: http://stackoverflow.com/q/22365753
tags question: http://stackoverflow.com/q/22442123
tags question: http://stackoverflow.com/q/22470275
tags question: http://stackoverflow.com/q/22400996
tags question: http://stackoverflow.com/q/22434575
tags question: http://stackoverflow.com/q/22457247
tags question: http://stackoverflow.com/q/22417980
tags question: http://stackoverflow.com/q/22403843
tags question: http://stackoverflow.com/q/22344001
tags question: http://stackoverflow.com/q/22356692
tags question: http://stackoverflow.com/q/22345619
tags question: http://stackoverflow.com/q/22481205

http://stackoverflow.com/q/22421541
tagged with: spring
has answer: http://stackoverflow.com/a/23028046
downvote count: 1
type: Question
tagged with: spring-mvc
tagged with: java
tagged with: welcome-file
score: -1
has body: I've tried, and both not working ( HTTP 404 ) /home and home in the URL http://myserver.com:8080/App-0.1/home is working fine LOGS: INFO : org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping - Mapped URL path [/home] onto handler 'homeController' INFO : org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping - Mapped URL path [/home.*] onto handler 'homeController' INFO : org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping - Mapped URL path [/home/] onto handler 'homeController'
tagged with: servlets
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/34095104
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22422436
has title: Spring welcome-file

http://stackoverflow.com/a/22347075
answers question: http://stackoverflow.com/q/22346858
has comment: http://stackoverflow.com/comment/33966156
type: Answer
accepted answer of: http://stackoverflow.com/q/22346858
score: 1
upvote count: 1
has body: if you are using Swing you can try to use form-layout from jgoodies for this. Have a look here: http://www.jgoodies.com/freeware/libraries/forms/ First define your spacer ("fill:default:grow") and then dynamically add your panels to the bottom You can define your layout like this: FormLayout layout = new FormLayout("file:default:grow","fill:default:grow"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); layout.appendRow(new RowSpec("pref")); buiulder.add(new Panel(), cc.xy(1,layout.getRowCount())); I used this method already in demo application which had a chat included.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33974901
downvote count: 0
has comment: http://stackoverflow.com/comment/33974984
has comment: http://stackoverflow.com/comment/33975015

http://stackoverflow.com/a/22338419
answers question: http://stackoverflow.com/q/22338321
has body: You can reset them in the activity's onDestroy() method which is called at the end of the activity lifecycle. Or just initialize them in onCreate() as Mr. Trigg said.
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22338321

http://stackoverflow.com/comment/34015302
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22376632
type: QuestionComment
has text: Web page not available when I try to visit it.

http://stackoverflow.com/comment/34165133
comment on: http://stackoverflow.com/q/22461703
type: Comment
type: QuestionComment
has text: The source code has the answer to that.
score: 2

http://stackoverflow.com/comment/34124452
score: 0
comment on: http://stackoverflow.com/q/22438655
type: Comment
type: QuestionComment
has text: @NPException: That's still not clear. If you just want a range check, then implement a range check. If that's not what you want, then please add some psuedocode to your question to illustrate how you'd like to *use* this "enum".

http://stackoverflow.com/comment/34170714
type: QuestionComment
has text: As soon as you declare a constructor, the implied no-argument constructor no longer exists. Also, constructors are not inherited. This is fairly basic Java language rules, it's unrelated to generics.
comment on: http://stackoverflow.com/q/22464596
score: 0
type: Comment

http://stackoverflow.com/a/35575362
answers question: http://stackoverflow.com/q/22369717
type: Answer
upvote count: 7
score: 7
downvote count: 0
has body: Use below code for passing string from one jsp to another jsp A.jsp &lt;% String userid="Banda";%&gt; &lt;form action="B.jsp" method="post"&gt; &lt;% session.setAttribute("userId", userid); %&gt; &lt;input type="submit" value="Login"&gt; &lt;/form&gt; B.jsp &lt;%String userid = session.getAttribute("userId").toString(); %&gt; Hello&lt;%=userid%&gt;

http://stackoverflow.com/q/22391350
has comment: http://stackoverflow.com/comment/63214899
has title: How to sort a HashSet?
has comment: http://stackoverflow.com/comment/34042173
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/53060206
has answer: http://stackoverflow.com/a/42114141
tagged with: set
has answer: http://stackoverflow.com/a/32340316
has comment: http://stackoverflow.com/comment/106077036
tagged with: collections
has answer: http://stackoverflow.com/a/47189251
has answer: http://stackoverflow.com/a/29625277
has answer: http://stackoverflow.com/a/58729759
linked to: http://stackoverflow.com/q/59903608
has answer: http://stackoverflow.com/a/22391384
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/57466263
type: Question
has answer: http://stackoverflow.com/a/45696217
has answer: http://stackoverflow.com/a/41618678
upvote count: 154
has body: For lists, we use the Collections.sort(List) method. What if we want to sort a HashSet?
has answer: http://stackoverflow.com/a/69341515
has answer: http://stackoverflow.com/a/33796651
has answer: http://stackoverflow.com/a/58354673
has answer: http://stackoverflow.com/a/57824107
tagged with: hashset
tagged with: sorting
has answer: http://stackoverflow.com/a/44668594
has comment: http://stackoverflow.com/comment/34042005
has answer: http://stackoverflow.com/a/58989789
has answer: http://stackoverflow.com/a/22391958
has comment: http://stackoverflow.com/comment/96250214
has comment: http://stackoverflow.com/comment/34041524
score: 151
has answer: http://stackoverflow.com/a/22391360
answer count: 21
has answer: http://stackoverflow.com/a/52987487
has answer: http://stackoverflow.com/a/35352987
has answer: http://stackoverflow.com/a/69334684

http://stackoverflow.com/comment/43510849
score: 0
type: Comment
has text: So, how to initialize mGeofenceRequester correctly? Instantiate a Geofence requeste? mGeofenceRequester = new GeofenceRequester(this); doesn't work.
comment on: http://stackoverflow.com/a/22392990
type: AnswerComment

http://stackoverflow.com/q/22432545
favorite count: 0
score: -4
downvote count: 4
has answer: http://stackoverflow.com/a/22432555
accepted answer: http://stackoverflow.com/a/22432555
type: AnsweredQuestion
upvote count: 0
tagged with: java
has title: what are different types of initialisations of arrays in java?
type: Question
possible better answer: http://stackoverflow.com/a/22432551
answer count: 2
has body: i got problem with this code. public class Data { int[] d =new int[3]; d[2]=4; } showing error public class Data { int[] d ={1,2,3}; } working fine. what is the difference between them. can anyone help me out.
has answer: http://stackoverflow.com/a/22432551

http://stackoverflow.com/q/22397861
has comment: http://stackoverflow.com/comment/34053379
has answer: http://stackoverflow.com/a/22397903
upvote count: 232
has answer: http://stackoverflow.com/a/47121747
has comment: http://stackoverflow.com/comment/34054323
has answer: http://stackoverflow.com/a/44712265
has comment: http://stackoverflow.com/comment/34052636
tagged with: java
has comment: http://stackoverflow.com/comment/80352844
has comment: http://stackoverflow.com/comment/34207737
linked to: http://stackoverflow.com/q/14757978
has answer: http://stackoverflow.com/a/46702730
type: Question
has comment: http://stackoverflow.com/comment/65150806
score: 229
has comment: http://stackoverflow.com/comment/34053043
has title: Why is String immutable in Java?
has comment: http://stackoverflow.com/comment/34052790
linked to: http://stackoverflow.com/q/20945049
has answer: http://stackoverflow.com/a/48840927
has answer: http://stackoverflow.com/a/34781087
has comment: http://stackoverflow.com/comment/34052744
has comment: http://stackoverflow.com/comment/34053682
has comment: http://stackoverflow.com/comment/34053089
answer count: 13
has comment: http://stackoverflow.com/comment/34052876
has body: I was asked in an interview why String is immutable I answered like this: When we create a string in Java like String s1="hello"; then an object will be created in string pool(hello) and s1 will be pointing to hello. Now if again we do String s2="hello"; then another object will not be created, but s2 will point to hello because JVM will first check if the same object is present in string pool or not. If not present, then only a new one is created, else not. Now if suppose Java allows string mutable then if we change s1 to hello world then s2 value will also be hello world so the Java String is immutable. Is my answer right or wrong?
linked to: http://stackoverflow.com/q/8881291
has answer: http://stackoverflow.com/a/22397880
downvote count: 3
has answer: http://stackoverflow.com/a/22398067
has answer: http://stackoverflow.com/a/51450265
has comment: http://stackoverflow.com/comment/34064406
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/34053270
has comment: http://stackoverflow.com/comment/34052761
has answer: http://stackoverflow.com/a/50690864
has answer: http://stackoverflow.com/a/72232140
has comment: http://stackoverflow.com/comment/34053321
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/41911338
has answer: http://stackoverflow.com/a/22398222
has comment: http://stackoverflow.com/comment/34053496
has comment: http://stackoverflow.com/comment/34053322
has comment: http://stackoverflow.com/comment/41718954

http://stackoverflow.com/comment/34069594
type: AnswerComment
comment on: http://stackoverflow.com/a/22400015
score: 0
type: Comment
has text: Your example does work, but the example I post still doesn't work. Thx

http://stackoverflow.com/comment/33963441
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22345741
score: 0
has text: Based on the syntax, it is not Java (`println`, `int(split(...))` does not seems to be a syntactically correct Java code)

http://stackoverflow.com/q/22483332
possible better answer: http://stackoverflow.com/a/31441103
has answer: http://stackoverflow.com/a/72589327
has answer: http://stackoverflow.com/a/58692483
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22483467
tagged with: java
has answer: http://stackoverflow.com/a/36993319
accepted answer: http://stackoverflow.com/a/36993319
has title: Codingbat array2 no14
type: Question
answer count: 8
has body: I am doing problems in coding bat. About this problem, I think I have done correctly but the result is not right. Please help me to find out the mistakes. Problem : Given an array of int, return true if it contains no 1's or it contains no 4's. no14({1, 2, 3}) → true no14({1, 2, 3, 4}) → false no14({2, 3, 4}) → true the following are my codes: public boolean no14(int[] nums) { int i=0; int count1=0; int count4=0; while(i&lt;nums.length) { if(nums[i]==1) {count1++;} i++; } while(i&lt;nums.length) { if(nums[i]==4) {count4++;} i++; } if(count1==0&amp;&amp;count4!=0) {return true;} else if(count1!=0&amp;&amp;count4==0) {return true;} else if(count1==0&amp;&amp;count4==0) {return true;} else return false; }
score: 0
has answer: http://stackoverflow.com/a/23775560
has answer: http://stackoverflow.com/a/30422453
has answer: http://stackoverflow.com/a/31441103
has answer: http://stackoverflow.com/a/22483448

http://stackoverflow.com/a/22348250
type: Answer
answers question: http://stackoverflow.com/q/22348159
accepted answer of: http://stackoverflow.com/q/22348159
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: DateTime currentDate = startD.plusDays(i); You should have found that easily by reading the javadoc. Note that unless you really want the items to represent a precise instant (i.e. the first april at midnight in your timezone), you should probably use a LocalDate instead of a DateTime.

http://stackoverflow.com/a/22412255
answers question: http://stackoverflow.com/q/22412078
score: 1
has body: You could store the values in a Bidirectional Map and always have this property.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34205402
comment on: http://stackoverflow.com/a/22484048
type: Comment
has text: Great! If you have no more issues you should definitely mark this as the answer. :D
score: 1
type: AnswerComment

http://stackoverflow.com/q/22451033
has title: Specifying URL address. Apache Tomcat
has comment: http://stackoverflow.com/comment/34146554
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22451084
accepted answer: http://stackoverflow.com/a/22451084
tagged with: servlets
type: Question
tagged with: apache
answer count: 1
tagged with: tomcat
score: 0
has body: I have Web app, which is deployed by instructions: open localhost:port/manager open .war file and click deploy. That's ok. Site is working through localhost:port/appname. So I want this address to connect from outside not only local PC. I need to specify URL for my site. How?

http://stackoverflow.com/comment/33945632
type: Comment
comment on: http://stackoverflow.com/a/22335912
has text: ahh clever should have thought of that.thanks a lot for your help :D
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33965531
type: Comment
type: QuestionComment
has text: Your first problem is that you aren't testing the result of readLine() for null before doing anything else with it. Until you fix that your code can't really be taken seriously.
score: 0
comment on: http://stackoverflow.com/q/22347131

http://stackoverflow.com/comment/33954431
type: Comment
type: QuestionComment
has text: Also try using an absolute path than a relative one.
comment on: http://stackoverflow.com/q/22341194
score: 0

http://stackoverflow.com/q/22487110
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22492346
tagged with: mule
has body: I have a file inbound endpoint where a pipe delimited file will come in. The first line of the file is header and rest are records. On an average there would be 40K records making file size close to 7MB. I need to convert this file into XML structure (headers from file are not same as XML elements). What is a good way to convert this file to XML? I wrote a component which takes input stream, read file line by line, tokenize it, create and write to an XML file. But in that case I am keeping file connection open for long time and I would have to take care about closing file stream and moving the file for backup. Wondering what can be other way of doing it? Has anyone used Data Mapper for similar purpose?
downvote count: 0
answer count: 1
favorite count: 0
has title: How to convert pipe delimited file with multi thousand records into XML in mule
has answer: http://stackoverflow.com/a/22492346
tagged with: http://stackoverflow.com/tag/xml
tagged with: file
upvote count: 1

http://stackoverflow.com/comment/33969786
type: QuestionComment
has text: I don´t know (is create a new conversation @create) but only do on the 1º time this method it's call, then never happen again, only if i restart the server.
comment on: http://stackoverflow.com/q/22334645
score: 0
type: Comment

http://stackoverflow.com/comment/34118244
comment on: http://stackoverflow.com/q/22435081
score: 0
type: Comment
has text: *The code is simplified for readability.*: and by simplifying it, you hide the part which causes the NPE not to happen. Post compilable code which reproduces the problem.
type: QuestionComment

http://stackoverflow.com/a/24594788
has comment: http://stackoverflow.com/comment/38104647
has comment: http://stackoverflow.com/comment/38450288
score: 0
type: AcceptedAnswer
has body: my Spring context was not closing properly and the JMS Connection factory was being managed by my spring container therefore it caused the leak.
answers question: http://stackoverflow.com/q/22387349
type: Answer
accepted answer of: http://stackoverflow.com/q/22387349

http://stackoverflow.com/comment/33969172
type: QuestionComment
comment on: http://stackoverflow.com/q/22346843
has text: @chaitu: Why do you want to pass data as json?
score: 0
type: Comment

http://stackoverflow.com/comment/34018325
has text: Are you managing the database as well ? because is a problem related to the database access! Can you post your connection string for us to see ?
comment on: http://stackoverflow.com/q/22378210
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22416239
upvote count: 17
type: Question
has answer: http://stackoverflow.com/a/62656663
linked to: http://stackoverflow.com/q/12930852
has answer: http://stackoverflow.com/a/22416342
has comment: http://stackoverflow.com/comment/34085508
has comment: http://stackoverflow.com/comment/92930933
downvote count: 0
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/64241911
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22427552
has body: I have a situation where I use a builder pattern for constructing an object. Best example to give is the pizza code public class Pizza { private int size; private boolean cheese; private boolean pepperoni; private boolean bacon; public static class Builder { //required private final int size; //optional private boolean cheese = false; private boolean pepperoni = false; private boolean bacon = false; public Builder(int size) { this.size = size; } public Builder cheese(boolean value) { cheese = value; return this; } public Builder pepperoni(boolean value) { pepperoni = value; return this; } public Builder bacon(boolean value) { bacon = value; return this; } public Pizza build() { return new Pizza(this); } } private Pizza(Builder builder) { size = builder.size; cheese = builder.cheese; pepperoni = builder.pepperoni; bacon = builder.bacon; } } So far so good. Now lets assume a usecase where I need to update the cheese. That needs a setter. I have never seen a single example where builder patterns coexist with setters, making me suspicious that what I was upto was an anti-pattern. Can setters AND builders coexist together ?
has title: Setters AND ( not OR or VS ) builder patterns
tagged with: design-patterns
has answer: http://stackoverflow.com/a/28488860
has answer: http://stackoverflow.com/a/40532470
tagged with: builder
tagged with: java
score: 17
has answer: http://stackoverflow.com/a/79224110

http://stackoverflow.com/a/22443231
has comment: http://stackoverflow.com/comment/34133454
upvote count: 1
type: AcceptedAnswer
has body: Span of Time Your question is not clear. Apparently you want to work with a span of time. For that you definitely need the Joda-Time library (or the new java.time package built into Java 8). Joda-Time Joda-Time offers 3 classes for spans of time: Interval Represents a start-stop pair of points along the timeline. Example: 2013-01-01T00:00:00.000-05:00/2013-01-04T18:00:00.000-05:00 Duration A length of time in milliseconds. Not tied to the timeline. Period Represents a span as a number of fields, such as years, months, weeks, days, hours, minutes, seconds and millis. ISO 8601 The ISO 8601 standard defines sensible textual formats to represents various aspects of date-time values. Joda-Time (and java.time in Java 8) use ISO 8601 as its defaults. In particular, ISO 8601 defines a format for Durations (what Joda-Time calls a Period†). A value is represented as a string in the format of PnYnMnDTnHnMnS. The 'P' indicates the beginning of a duration (Period) string. A 'T' indicates the time portion. Each number precedes its element designator. For example, "P3Y6M4DT12H30M5S" represents a duration of "three years, six months, four days, twelve hours, thirty minutes, and five seconds". Example Code // Specify the time zone rather than rely on default. https://en.wikipedia.org/wiki/List_of_tz_database_time_zones DateTimeZone timeZone = DateTimeZone.forID( "Europe/Rome" ); DateTime a = new DateTime( 2014, 1, 2, 8, 6, 0, timeZone ); DateTime b = new DateTime( 2014, 1, 2, 8, 0, 0, timeZone ); Period period = new Period( a, b); long millis = period.toStandardDuration().getMillis(); Dump to console… System.out.println( "a: " + a ); System.out.println( "b: " + b ); System.out.println( "period: " + period ); System.out.println( "millis: " + millis ); When run… a: 2014-01-02T08:06:00.000+01:00 b: 2014-01-02T08:00:00.000+01:00 period: PT-6M millis: -360000 More Info Search StackOverflow for "joda" and one of those three class names to find many examples. †Time-related terms vary widel…
has comment: http://stackoverflow.com/comment/34135090
type: Answer
accepted answer of: http://stackoverflow.com/q/22439322
answers question: http://stackoverflow.com/q/22439322
downvote count: 0
score: 1

http://stackoverflow.com/comment/34000064
type: AnswerComment
score: 0
type: Comment
has text: edit: god damn I'm dumb. so I just tried it with a docx file and it sent stuff back. so it just doesn't like .txt
comment on: http://stackoverflow.com/a/22339277

http://stackoverflow.com/comment/34303625
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22342898
has text: @Marco13 , Why the Arrays.hashcode(doubles) is not unique for array ?. Java 7 uses the order of elements also while computing hashcode. i confused..
score: 0

http://stackoverflow.com/comment/34125162
comment on: http://stackoverflow.com/a/22437832
type: Comment
has text: Is this correct one? I have created the table in SQL Server and created all the columns in varchar(50); Database connection successfull. Yes i am getting the below error, **com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254) at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)**
type: AnswerComment
score: 0

http://stackoverflow.com/a/22414859
type: Answer
has comment: http://stackoverflow.com/comment/34083269
score: 0
answers question: http://stackoverflow.com/q/22414809
has comment: http://stackoverflow.com/comment/34082921
has comment: http://stackoverflow.com/comment/34082775
has body: Do you set content type? You content type should be same (for example text/html) and not like application/octet-stream. Hardcoded example: Headers headers = httpExchange.getResponseHeaders(); headers.add("Content-Type", "text/html"); In your example you set: httpExchange.setAttribute(key, this.flatRequestValues(values)); instead of headers.add. Try: Headers headers = httpExchange.getResponseHeaders(); for (String value: values) { headers.add(key, value); } EDIT: or better: Headers headers = httpExchange.getResponseHeaders(); headers.put(key, values);

http://stackoverflow.com/a/26245208
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/22476343
downvote count: 0
has body: This has been logged as an issue on the project github page: https://github.com/JDatePicker/JDatePicker/issues/29 It has been fixed and will be part of next release (1.4.0): https://github.com/JDatePicker/JDatePicker/commit/4fa441a8e06691e4a00573379ea4d218710d7d1a
has comment: http://stackoverflow.com/comment/68663587
has comment: http://stackoverflow.com/comment/130927780

http://stackoverflow.com/q/22360471
tagged with: timer
type: UnansweredQuestion
score: -4
tagged with: swing
has comment: http://stackoverflow.com/comment/33988825
tagged with: java
has comment: http://stackoverflow.com/comment/33988582
has comment: http://stackoverflow.com/comment/33988760
has title: How am I misusing javax.swing.Timer?
type: Question
downvote count: 4
upvote count: 0
has answer: http://stackoverflow.com/a/22361103
has comment: http://stackoverflow.com/comment/33988677
answer count: 1
favorite count: 0
has body: Here I created a game where you roll a dice and draw a bug one part at a time . Here's the list of what rolls get you what parts and how many you need. 1 - body (need one) 2 - head (need one; must have a body first) 3 - eyes (need two, must have a head first) 4 - antenna (need two; must have head first ) 5 - legs (need six; must have body first) 6 - tail (need one; must have body first) You have to click on the screen near where the body part goes to make it show up. Then we could time the whole thing. I used the Panel to work with my timer, but I am not getting what is wrong? Main Program package dice; import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.Timer; public class Yahtzee extends JFrame implements ActionListener { Die[] d; // array to hold the 5 dice FourOfAKind[] f; JPanel buttonPanel; // panel for the timer JPanel dicePanel; // panel to hold the dice JPanel bugPanel; ScoreRow[] theScores; protected Object bug; public static void main(String[] args) { Yahtzee y = new Yahtzee(); } public Yahtzee() { setDefaultCloseOperation(EXIT_ON_CLOSE); setLayout(new FlowLayout()); setLayout(new BorderLayout()); dicePanel = new JPanel(); dicePanel.setLayout(new GridLayout(5, 1)); dicePanel.setLayout(new FlowLayout()); dicePanel.setSize(new Dimension(50, 50)); add(dicePanel, BorderLayout.CENTER); d = new Die[1]; for (int i = 0; i &lt; 1; i++) { d[i] = new Die(this); dicePanel.add(d[i]); } bugPanel = new JPanel(); bugPanel.setLayout(new GridLayout(5, 5)); bugPanel.setLayout(new FlowLayout()); bugPanel.setSize(new Dimension(50, 50)); add(bugPanel, BorderLayout.SOUTH); f = new FourOfAKind[1]; for (int w = 0; w &lt; 1; w++) { f[w] = new FourOfAKind(this); bugPanel.add(f[w]); } setSize(new Dimension(715, 705)); setVisible(true); } public void actionPerformed(ActionEvent e) { repaint(); } public void setChoice(int choice) { f[0].setChoice(choice); } public void drawBug() { f[0].setChoice(d[0].getChoice()); f[0].drawBug(); } } I commented out th…

http://stackoverflow.com/comment/34165689
comment on: http://stackoverflow.com/a/22459070
score: 0
type: Comment
has text: just accepted yours. Will post the new one now and bring the link for reference
type: AnswerComment

http://stackoverflow.com/comment/34176977
score: 1
comment on: http://stackoverflow.com/a/22468024
type: AnswerComment
type: Comment
has text: Please don't accept my answer until you know that it works - it might discourage someone who knows better than I do from coming along and giving you a better answer.

http://stackoverflow.com/a/22412532
has comment: http://stackoverflow.com/comment/34080892
accepted answer of: http://stackoverflow.com/q/22410602
type: Answer
has body: UPDATE 2: Turns out your usage of many components of the Java Cipher capabilities are not spot on. Look here at this other SO answer. Java AES and using my own Key UPDATE 1: To get the 256 bit value down to 128 bits using the example below, here is what you may want to try: // After you already have generated the digest byte[] mdbytes = md.digest(); byte[] key = new byte[mdbytes.length / 2]; for(int I = 0; I &lt; key.length; I++){ // Choice 1 for using only 128 bits of the 256 generated key[I] = mdbytes[I]; // Choice 2 for using ALL of the 256 bits generated key[I] = mdbytes[I] ^ mdbytes[I + key.length]; } // Now use key as the input key for AES ORIGINAL: Here is a great example of using the built-in java APIs for performing a SHA hash on some data bytes. http://www.mkyong.com/java/java-sha-hashing-example/ Java has built-in capability to perform multiple differing hash types, and you really should try to take advantage of one, instead of trying to write one yourself. Perhaps the most widely used hash functions are the SHA versions. There are versions that can output a 128, 256, and 512 bit hash output. What you are asking for, is in all technicality exactly how logging into a system using your password generally works. the system never truly stores your actual textual password, but rather the HASH to it. When you, the user, enters your password, the system performs a live hash of what you entered and compares the live generated hash with the stored hash. This does not go the added step of lets say using that hash as an actual key component for a symmetric encryption. In general a GOOD hash can indeed generate DECENT key material for use in actual symmetric encryption / decryption.
has comment: http://stackoverflow.com/comment/34079139
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22410602
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34078768
downvote count: 0

http://stackoverflow.com/a/22431240
upvote count: 2
has body: mappedBy = "user"means: I'm the inverse side of a bidirectional association, whose owner side is the field user in the target entity (i.e. Product). There is no user field in Product. So it doesn't make sense. If you want the createdBy ad modifiedBy associations to be bidirectional, you need two fields in User: @OneToMany(mappedBy = "createdBy") private Set&lt;Product&gt; createdProducts; @OneToMany(mappedBy = "modifiedBy") private Set&lt;Product&gt; modifiedProducts;
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22431073
accepted answer of: http://stackoverflow.com/q/22431073
type: Answer
downvote count: 0
score: 2

http://stackoverflow.com/a/22330974
score: 1
answers question: http://stackoverflow.com/q/22328787
upvote count: 1
has body: As many of you know, this only prints the image 1 time, and should I resize the frame, the image disappears. What is your requirement when the frame resizes? Do you paint the image at its original size? If so then just use a JLabel with an ImageIcon and add the label to the frame Do you want the image to scale with the size of the frame? Then you need to do custom painting. You can create a custom component as demonstrated in other answers. Or you can use a JLabel with a Stretch Icon which will stretch to fill the space available to the label.
type: Answer
downvote count: 0

http://stackoverflow.com/q/22483615
tagged with: uri
tagged with: url
has body: I have the following Activity: package com.example.myapp; import android.net.Uri; import android.os.Bundle; import android.app.Activity; import android.content.ComponentName; import android.content.Intent; import android.content.SharedPreferences; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.view.animation.Animation; import android.view.animation.Animation.AnimationListener; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.ImageButton; import android.widget.ScrollView; import android.widget.Toast; public class HomeActivity extends Activity implements AnimationListener { // Animation Animation animFadein; Animation animFadeout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.home_start); // load the animation animFadein = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fade_in); animFadeout = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fade_out); // set animation listener animFadein.setAnimationListener(this); ImageButton homepage =(ImageButton)findViewById(R.id.homepage); ImageButton new_b =(ImageButton)findViewById(R.id.new_b); ImageButton view_b =(ImageButton)findViewById(R.id.view_b); ImageButton home_b =(ImageButton)findViewById(R.id.home_b); ImageButton info_b =(ImageButton)findViewById(R.id.info_b); Button back_b =(Button)findViewById(R.id.back_b); Button site =(Button)findViewById(R.id.site); homepage.startAnimation(animFadein); //Click on screen to start homepage.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { View homepage = (View)findViewById(R.id.homepage); View startpage = (View)findViewById(R.id.startpage); homepage.setVisibility(View.GONE); homepage.startAnimation(animFadeout); startpage.setVisibility(View.VISIBLE); startpage.setAnimation(animFadein);};}); new_b.setOnClickListener(new OnClickListener() { @…
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34202754
tagged with: android-intent
has comment: http://stackoverflow.com/comment/34203026
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34202964
type: Question
has title: On button click uri intent works in android 4.1.2, but does not work on android 2.3.7
score: 0

http://stackoverflow.com/comment/107954558
comment on: http://stackoverflow.com/a/38251279
type: Comment
score: 2
has text: This worked for me too with react native. I opened the android folder with Android Studio and then build -> clean project. Rebuilt it with `react-native run-android`
type: AnswerComment

http://stackoverflow.com/q/22397776
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34052513
tagged with: gwt
tagged with: java
has comment: http://stackoverflow.com/comment/34053064
has title: Max size of byte array with which String object can be formed?
type: Question
tagged with: arrays
score: 0
has answer: http://stackoverflow.com/a/22397932
has comment: http://stackoverflow.com/comment/34076304
answer count: 1
has comment: http://stackoverflow.com/comment/34052883
has body: I am trying to create a String object from a byte array like below: String content = new String(byteContents); The size of the byteContents array is 200,000 approx. I get the following error when the above line is encountered. stack: RangeError: Maximum call stack size exceeded If I try it with a byte array of size say 10,000, I don't get such an error. Is there a limit on the maximum size of the byte array that can be passed as an argument to the String constructor?

http://stackoverflow.com/comment/34113729
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22432621
type: Comment
has text: Not an activity- a Service. The reason is that an Activity can only exist if you're in the foreground. A service can run when you're in the background as well. That Service should then spawn off a thread or async task it owns (because Services also run on the UI thread, as do Activities). The Service will keep your app active and give you a context (otherwise you may be killed when the reciever returns, as no context is running), the thread/asyctask in the service will move you off the main thread.

http://stackoverflow.com/a/22442042
type: Answer
has comment: http://stackoverflow.com/comment/34130949
score: 2
has comment: http://stackoverflow.com/comment/34131048
downvote count: 0
has comment: http://stackoverflow.com/comment/34130974
has comment: http://stackoverflow.com/comment/34141638
upvote count: 2
has body: It's a common misconception that Java does not have multiple inheritance. It doesn't have multiple inheritance of state, but it does have multiple inheritance of (declarations of) behavior, which is shown through interfaces. So you can have a single class implement multiple interfaces: public class A implements Comparator&lt;A&gt;, Serializable { }
answers question: http://stackoverflow.com/q/22441997
has comment: http://stackoverflow.com/comment/34130952

http://stackoverflow.com/comment/34165119
type: Comment
comment on: http://stackoverflow.com/q/22461703
type: QuestionComment
has text: Of course. But I'm actually asking if those are the only characters considered to be a white-space.
score: 0

http://stackoverflow.com/q/22444382
type: Question
has comment: http://stackoverflow.com/comment/34164298
has comment: http://stackoverflow.com/comment/34156862
has comment: http://stackoverflow.com/comment/34165230
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34159069
has comment: http://stackoverflow.com/comment/34161621
has comment: http://stackoverflow.com/comment/34157846
has comment: http://stackoverflow.com/comment/34157254
tagged with: android-popupwindow
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34164577
has title: PopupWindow does not pop up
has comment: http://stackoverflow.com/comment/34168228
has comment: http://stackoverflow.com/comment/34248250
has comment: http://stackoverflow.com/comment/34161695
has body: I am trying to set PopupWindow in my app and it does not pop up. Here is my code: popUp.showAtLocation(layout, Gravity.BOTTOM, 10, 10); popUp.update(50, 50, 300, 200); layout.setOrientation(LinearLayout.VERTICAL); tv.setText("Hi this is a sample text for popup window"); tv.setTextColor(Color.BLACK); params= new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); layout.setOrientation(LinearLayout.VERTICAL); layout.addView(tv,params); layout.addView(cl); layout.addView(stats); layout.setBackgroundColor(Color.BLUE); main.findViewById(R.layout.ajax); mainLayout.addView(check,params); popUp.setContentView(layout); // popUp.showAtLocation(layout, Gravity.BOTTOM, 10, 10); setContentView(mainLayout); What do I need to do to get this work and get a PopupWindow? Thank You.
answer count: 0
has comment: http://stackoverflow.com/comment/34156514
has comment: http://stackoverflow.com/comment/34256137
has comment: http://stackoverflow.com/comment/34209029
tagged with: java
linked to: http://stackoverflow.com/q/1967863

http://stackoverflow.com/comment/33993886
score: 0
has text: 1. No. 2. No. 3. Only in Eclipse. Window-> Preferences...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22363612

http://stackoverflow.com/comment/34103195
has text: boolean is_valid(int xnext,int ynext){ if(xnext>=0&&xnext<N&&ynext>=0&&ynext<N&&sol[xnext][ynext]==-1){ return true; } else return false; } }
score: 0
comment on: http://stackoverflow.com/q/22426753
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34208139
comment on: http://stackoverflow.com/a/22480084
has text: I think you should do something like that `query = "SELECT First_Name FROM user_information WHERE USER_ID = 1"`, 1 is an example, you have to get the id or any one single info to create your condition with.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22487857
type: Answer
answers question: http://stackoverflow.com/q/22487793
upvote count: 1
score: 1
has body: You can call static methods without needing to intantiate an object: TestObject.staticMethodCall(); For non-static methods you need to create an instance to call a method on: new TestObject().nonStaticMethodCall();
downvote count: 0

http://stackoverflow.com/comment/34051494
type: Comment
has text: not exactly it will return the int ,but my requirement was get return type in string .I solved it and really thanks for yours response. excelPojo.setRiskIdEnd(String.valueOf((int)cell.getNumericCellValue()))
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22378026

http://stackoverflow.com/q/22425614
has answer: http://stackoverflow.com/a/22426363
has body: J2EE 1.4 SDK update 1 is required for my project. Goggled a lot but couldn't find it. So it would be great if any one have a link to download J2EE SDK update 1 specifically. If you know or find a link don't forget to forward me. Thanks in advance.
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34102058
accepted answer: http://stackoverflow.com/a/22426363
score: -1
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has title: Where can i find j2ee 1.4 sdk update 1?

http://stackoverflow.com/q/22395403
has body: This class encrypt data values, to do this first I get the cipher as follows, KeyStore primaryKeyStore = getKeyStore(keyStoreFile, password, keyType, provider); java.security.cert.Certificate certs = primaryKeyStore.getCertificate(aliasName); cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, certs); But the last line of the above code gives the following error. What does the wrong key usage means? Can't I use this certificate for encryption purposes? Is there separate certificate for encryption? Caused by: java.security.InvalidKeyException: Wrong key usage at javax.crypto.Cipher.init(Cipher.java:1640) at javax.crypto.Cipher.init(Cipher.java:1549) at my.test.ciphertool.CipherTool.initCipher(CipherTool.java:167) ... 1 more
tagged with: java
tagged with: certificate
type: Question
answer count: 1
tagged with: security
upvote count: 3
has title: Wrong key usage in encryption
favorite count: 0
downvote count: 0
tagged with: encryption
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22395842
accepted answer: http://stackoverflow.com/a/22395842

http://stackoverflow.com/q/22389060
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34040563
type: Question
has title: JPA Cacheable specific example on how to use it
score: 0
has comment: http://stackoverflow.com/comment/34039329
tagged with: jpa
type: UnansweredQuestion
has body: I am kind of new to JPA and have read a bit about second level caching in JPA. And I think it should apply correctly to my scenario. I have a table (say A) whose content will never change unless a new release is applied. I need to query some data from the database : for that I have a JPQL working correctly and that uses a join between table A and an additional table (say B). Since the contents of table A never change through the life of application, I could essentially mark this table A as Cacheable and reuse the content from Cache - rather than going to the database for that. I have read about @NamedQuery that enables a one time JPQL to SQL translation for the life of the application. And it is not what I am looking for. I want to know how should I go about using the Cacheable property for my purpose. This is what I have done so far : Marked tableA as cacheable - @Entity @Cacheable @Table(name = "TableA") public class Table{ @Id @NotNull @Column(updatable = false) private String uuid; @NotNull @Size(min = 1) private String description; . . . } 2. There is a DAO that does a find using the JPQL - public Collection findAll(String description) { final Cache cache = entityManager.getEntityManagerFactory().getCache(); if (cache.contains(TableA.class, "abc")) { System.out.println("cached"); } else { System.out.println("not cached"); } final Query query = entityManager .createQuery("Select distinct A from TableA A, IN(A.TableB) B where A.description = :description"); //$NON-NLS-1$ query.setParameter("description", description); //$NON-NLS-1$ return query.getResultList(); } &lt;/code&gt; Can I take advantage of using Cacheable property in my scenario. If so, then could you suggest how? Also, "not cached" gets printed always no matter what the value of string I use (from table) instead of "abc". Appreciate your help. Thanks
answer count: 0

http://stackoverflow.com/comment/33965202
type: QuestionComment
comment on: http://stackoverflow.com/q/22347124
score: 0
has text: you might want to read the Java I/O lesson: http://docs.oracle.com/javase/tutorial/essential/io/ It explains how to do exactly what you want at the Find section: http://docs.oracle.com/javase/tutorial/essential/io/find.html
type: Comment

http://stackoverflow.com/a/22543071
answers question: http://stackoverflow.com/q/22468234
score: 0
type: Answer
has body: There were a couple of issues with the Spring configuration file that was the culprit. Specifically, in the heading, I had: &lt;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-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt; despite being on Spring 3.1. That caused Spring to revert to the old PropertyPlaceholderConfigurer rather than the new PropertySourcesPlaceholderConfigurer. Once I changed the 3.0.xsd reference to 3.1.xsd, it started to resolve the issue. The new header looks like so: &lt;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-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"&gt; The second issue was this line: &lt;context:property-placeholder ignore-resource-not-found="true" system-properties-mode="OVERRIDE"/&gt; Because of the system-properties-mode attribute, Spring again reverted back to the old PropertyPlaceholderConfigurer and not the new PropertySourcesPlaceholderConfigurer. When using the old PropertyPlaceholderConfigurer, it doesn't pick up the values from the new Environment which was why the property values weren't being picked up in the Spring Context configuration.

http://stackoverflow.com/comment/34047851
has text: Short answer: use `equals` instead of `==`.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22395018
score: 6

http://stackoverflow.com/comment/34190330
comment on: http://stackoverflow.com/a/22476237
type: Comment
has text: can you try putting @SuppressWarnings("unchecked") with List
score: 0
type: AnswerComment

http://stackoverflow.com/a/22354005
type: AcceptedAnswer
downvote count: 0
has body: You could store java.util.concurrent.locks.Lock implementation in a HashMap keyed by the MAC. Make sure that you also synchronise access to the HashMap, otherwise you'll have a possible race condition when you first encounter the MAC address. But the Object-Oriented solution is to put the method writeRemoteRegister in the MAC class and make it synchronized.
type: Answer
has comment: http://stackoverflow.com/comment/33976833
upvote count: 1
has comment: http://stackoverflow.com/comment/33979337
score: 1
accepted answer of: http://stackoverflow.com/q/22353868
has comment: http://stackoverflow.com/comment/33977993
answers question: http://stackoverflow.com/q/22353868

http://stackoverflow.com/comment/34034502
score: 0
type: QuestionComment
has text: Is not `mTcpClient.run("");` blocking the thread? Maybe you should release it after receiving a message. Just a guess, I never worked with TCPClient.
type: Comment
comment on: http://stackoverflow.com/q/22386822

http://stackoverflow.com/q/22427747
score: 6
has answer: http://stackoverflow.com/a/22427794
tagged with: web-services
upvote count: 7
downvote count: 1
type: Question
tagged with: java
has body: Say ,i have producer in java and consumer in dot net. Producer has a method that takes Employee as method parameter and creates employee in db. For SOAP based ws, dot net client will hit WSDL and creates the stubs (including employee data representation in dot net). Now it can fill the object and send to producer. I am not sure how it will work in restful webservices as there is no WSDL. How rest consumer will get to know what are the operations exposed by producer without any WSDL contract and how dot net consumer will get stubs (like employee data object) so that it can simply fill it and send across? I know there is WADL(parallel to WSDL) in rest but looks like its not very prominent and not a standard as of now. I am not getting how client side code will generate EmployeeData class so that it can fill it and send to producer? Will client manually create extra class (instead of proxy EmployeeData that used to be generated on the basis of WSDL using utilities available at client side)? Even if client has to do it manually, how client will know what is the class definition of EmployeeData class without wsdl or wadl?
has comment: http://stackoverflow.com/comment/34104786
answer count: 2
has answer: http://stackoverflow.com/a/22428385
accepted answer: http://stackoverflow.com/a/22427794
has comment: http://stackoverflow.com/comment/98882456
tagged with: jax-rs
favorite count: 0
has comment: http://stackoverflow.com/comment/34104900
linked to: http://stackoverflow.com/q/4111646
possible better answer: http://stackoverflow.com/a/22428385
tagged with: rest
has title: What is WSDL equivalent in restful WS . If nothing,how consumer generates required client side classes?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/107687199
linked to: http://stackoverflow.com/q/5890438

http://stackoverflow.com/a/22340404
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33953455
type: Answer
has comment: http://stackoverflow.com/comment/33953402
answers question: http://stackoverflow.com/q/22340157
has body: First, I would work on reformatting your code properly so that it is easier to read and debug. After you do that, you should be able to easily see that you have extra open scope brackets ({) where they should not be. I counted two from a quick glance but I will leave it as an exercise for you to find them after you reformat your code so it is easier to read. Hint: there is one in the first function and one in the second function.
has comment: http://stackoverflow.com/comment/33953336
has comment: http://stackoverflow.com/comment/33953285
score: 0
accepted answer of: http://stackoverflow.com/q/22340157

http://stackoverflow.com/a/22457284
answers question: http://stackoverflow.com/q/22457152
upvote count: 1
has body: Your onTextChanged method is being called recursively by calling setText in it. The setText method call causes another trigger of onTextChanged which causes setText to be called and so on. Try to set a flag when you edited the TextField from code, so it does not trigger another change. For example: private boolean autochange = false; @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if(autochange) { // skip execution if triggered by code autochange=false; // next change is not triggered by code return; } if (s.length() != 0) { switch (et.getId()) { case R.id.etUsername: { } break; case R.id.etPassword: { phone = formatPhoneNumber(phone); Log.i("PHONE", "Phone NUMB IS:"+phone); autochange=true; mPassword.setText(phone); } } } }
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/34368110
has text: Wanted to add, to avoid confusion, that the Weighted Sum _can_ guarantee uniqueness, but _only_ if you multiply by a big enough number. Multiplying by the index doesn't necessarily work. Take the array [0 1] -> 0*1 + 1*2 = 2 and compare to [2 0] -> 2*1 + 0*2 = 2. The same applies to small numbers; [0 0.01] -> 0.02, [0.02 0] -> 0.02. The number you have to use is dependent on your precision.
type: Comment
comment on: http://stackoverflow.com/a/22550285
score: 0
type: AnswerComment

http://stackoverflow.com/q/22380243
favorite count: 0
tagged with: spring
has title: Is there a single rule to cope with single quotes in writing Spring Resource Boundle?
tagged with: internationalization
tagged with: double-quotes
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/10461945
linked to: http://stackoverflow.com/q/6332378
upvote count: 17
type: Question
has answer: http://stackoverflow.com/a/22380244
tagged with: resourcebundle
score: 17
has body: Spring's ResourceBundleMessageSource uses MessageFormat for replacing placeholders ({0}) inside messages. MessageFormat requires that single quotes (') are escaped using two single quotes ('') (see: MessageFormat Javadoc). However, by default messages that does not contain any arguments will not be parsed by MessageFormat, so single quotes in messages without arguments don't need to be escaped. So your translator have to be aware of two rules in writing and maintaining resource bundle: write ('') if the message with the single quotes contains at least one placeholders ({0}) too; write (') if the message with the single quotes contains none placeholders. Is there a single rule to cope with single quotes in writing Spring Resource Boundle?
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22380244

http://stackoverflow.com/comment/34125551
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22439286
has text: Looks like a duplicate of a question you asked earlier today, which was answered, and specifically to the point that you are asking here. Please read answers on earlier questions (and mark accepted answer) before asking the same question again. http://stackoverflow.com/questions/22433466/two-threads-executing-two-synchronized-methods/22433513

http://stackoverflow.com/comment/34109295
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22421572
score: 0
has text: @MadProgrammer I think that simply searching for an OK button and hitting it is quite useless as well. Note that in my approach, you could still visualise the contents of the `JOptionPane` if needed with some more refactoring. You just wouldn't show it in a blocking modal dialog

http://stackoverflow.com/q/22332435
accepted answer: http://stackoverflow.com/a/22332645
score: 3
downvote count: 0
answer count: 1
tagged with: generics
favorite count: 0
has body: I'm looking for a way to find out if an object x is an instance of a generic type. For example List&lt;String&gt;. Inspired by the Super-Type-Token idiom I can retrieve the java.lang.reflect.Type at runtime with follwing code import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.List; public class Test { public static void main(String[] args) { TypeReference&lt;List&lt;String&gt;&gt; ref = new TypeReference&lt;List&lt;String&gt;&gt;() {}; System.out.println(ref.getType()); System.out.println(ref.getType().getClass()); } abstract static class TypeReference&lt;T&gt; { private final Type type; protected TypeReference() { ParameterizedType superclass = (ParameterizedType) getClass().getGenericSuperclass(); type = superclass.getActualTypeArguments()[0]; } public Type getType() { return type; } } } The output is java.util.List&lt;java.lang.String&gt; class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl How can I use this information for dynamic casting or type checking? Background is I'm currently writing a heterogeneous type-safe container lib and want to add support for generic types https://bitbucket.org/mbeyene/jam
type: AnsweredQuestion
tagged with: reflection
has answer: http://stackoverflow.com/a/22332645
upvote count: 3
tagged with: java
type: Question
has title: Check instance with java.lang.reflect.Type
has comment: http://stackoverflow.com/comment/33939218

http://stackoverflow.com/comment/34944340
comment on: http://stackoverflow.com/a/22843789
score: 0
type: AnswerComment
has text: MaximilianWalter Thank you for your answer. My problem is that we have a lot of passwords generated by crypto so we need to implement the same algorithm with Java for compatibility reasons. However, I don't know how crypto generates the IV and salt. How are they generated by crypto? If I knew how to generate the salt I could use BouncyCastle's OpenSSLPBEParametersGenerator to derive the key and IV.
type: Comment

http://stackoverflow.com/q/22354604
has title: how to force the page reload in primefaces?
has answer: http://stackoverflow.com/a/22354769
tagged with: primefaces
tagged with: java
type: Question
answer count: 1
tagged with: javascript
score: 0
has body: I want to force the reload of the page in my page after the download of my file. I tried this but it did not work &lt;p:commandButton ajax="false" actionListener="#{fileDownloadController.forceDownload}"&gt; &lt;p:fileDownload value="#{fileDownloadController.downloadXMLFile(myBean.mostRecentFile)}" /&gt; &lt;/p:commandButton&gt; &lt;/p:commandButton&gt; EDITED This solution correctly reloads but it happens before the file can be downloaded public StreamedContent downloadXMLFile(DMFile dmFile) { ... return new DefaultStreamedContent(stream, "text/xml", fileName); } And public void forceReload(){ ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); try { ec.redirect(((HttpServletRequest) ec.getRequest()).getRequestURI()); } catch (IOException ex) { Logger.getLogger(FileDownloadController.class.getName()).log(Level.SEVERE, null, ex); } }
type: UnansweredQuestion

single-sign-on
tags question: http://stackoverflow.com/q/22485916
tags question: http://stackoverflow.com/q/22432667
type: Tag
tag name: single-sign-on

http://stackoverflow.com/comment/34142287
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22435020
has text: I'm not sure what you are asking. "append" keeps the existing text in the text area and adds the new text to it. This is all in strings, textarea does not know anything about integers. To reset the text area, you have to use "settext" once before the loop.

http://stackoverflow.com/q/22450277
type: AnsweredQuestion
has title: What does this mean: Not a v4.0.0 POM. for project org.codehaus.mojo:rpm-maven-plugin
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/27846933
type: Question
has answer: http://stackoverflow.com/a/22473209
answer count: 3
downvote count: 0
favorite count: 0
score: 7
has comment: http://stackoverflow.com/comment/34148595
accepted answer: http://stackoverflow.com/a/22473209
has body: I'm afraid I just don't know what this error means, besides that there is an error. I was able to build jars before, but this is my first time using the rpm-maven-plugin. I would like to create an rpm, but so far using the rpm-maven-plugin has resulted in errors. [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Project ID: org.codehaus.mojo:rpm-maven-plugin POM Location: C:\Users\&lt;my name&gt;\.m2\repository\org\codehaus\mojo\rpm-maven-plug in\2.0.1\rpm-maven-plugin-2.0.1.pom Reason: Not a v4.0.0 POM. for project org.codehaus.mojo:rpm-maven-plugin at C:\U sers\&lt;my name&gt;\.m2\repository\org\codehaus\mojo\rpm-maven-plugin\2.0.1\rpm-maven -plugin-2.0.1.pom
possible better answer: http://stackoverflow.com/a/26538851
tagged with: maven
upvote count: 7
has answer: http://stackoverflow.com/a/26538851

http://stackoverflow.com/comment/34058274
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22399453
has text: Thanks for the response, i am digging more in to it.

http://stackoverflow.com/comment/34023507
type: AnswerComment
has text: In general terms, the object can still be accessed without obtaining the monitor
comment on: http://stackoverflow.com/a/22381219
type: Comment
score: 1

http://stackoverflow.com/a/22494657
score: 1
has comment: http://stackoverflow.com/comment/34436408
has comment: http://stackoverflow.com/comment/34231637
answers question: http://stackoverflow.com/q/22479461
has comment: http://stackoverflow.com/comment/34226305
has body: The trick is figuring out in what session you want to start the cmd.exe. On a remote server (which is most often the case with Jenkins), it's not necessary straight forward. Your Remote Desktop Session is not in the same session as someone who is logged in physically at the console. Bring up Windows Task Manager Click the Users tab Note down the ID of the session of the logged in user that you want Download psexec from Windows Sysinternals Edited from here downwards Open elevated command prompt: type cmd into Start's quicksearch, right click cmd.exe, select Run as Administrator. Type C:\path\to\psexec.exe -accepteula and press enter. Type C:\path\to\psexec.exe -i 1 cmd and press enter. (If you see a command prompt appear, all is good, close it now) In Job configuration, configure Execute Windows Batch command step Write the following: C:\path\to\psexec.exe -accepteula &amp;&amp; C:\path\to\psexec.exe -i 1 cmd /c start C:\full\path\to\java.exe -jar myjarfile.jar A more detailed explanation is provided in this answer Open Excel on Jenkins CI
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34242531
has comment: http://stackoverflow.com/comment/34242662

http://stackoverflow.com/a/22345579
score: 0
type: Answer
has body: try @JsonProperty(value="authenticationToken") private String authenticationToken; then un-marshall that string into another class with @JsonProperty(value="token") private String tokenStr;
answers question: http://stackoverflow.com/q/22345444

http://stackoverflow.com/q/22361125
tagged with: java
has title: when an abstract class extends a concrete class, do the inherited members become abstract?
possible better answer: http://stackoverflow.com/a/22361148
type: Question
has answer: http://stackoverflow.com/a/22361148
answer count: 2
has answer: http://stackoverflow.com/a/22361185
tagged with: inheritance
score: 0
accepted answer: http://stackoverflow.com/a/22361185
has comment: http://stackoverflow.com/comment/33989182
has body: I'm getting ready to take my Java 7 Programmer exam and have a question: when an abstract class extends a concrete class, do the inherited members from the concrete class then become abstract in the abstract class? I can't find a clear answer so far in the book I am studying; furthermore, Google is spinning me in circles without telling me what I need to know. Thanks in advance
type: AnsweredQuestion

http://stackoverflow.com/a/22336344
type: Answer
has comment: http://stackoverflow.com/comment/33945925
has comment: http://stackoverflow.com/comment/33945703
has body: Integer.toString(hexNumber, 16); See IDE one demo javadoc
upvote count: 5
has comment: http://stackoverflow.com/comment/33946032
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22336327
answers question: http://stackoverflow.com/q/22336327

http://stackoverflow.com/comment/34133647
type: AnswerComment
comment on: http://stackoverflow.com/a/22443453
type: Comment
has text: that works, but i want to add it to my current GUI. youre right about the beginner. this is for a School Project. thanks for the tip
score: 0

http://stackoverflow.com/comment/34141412
comment on: http://stackoverflow.com/q/22447926
has text: Yeah, you might like to think about the lines immediately before and after the top of the `for` loop
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/22336327
accepted answer: http://stackoverflow.com/a/22336344
has comment: http://stackoverflow.com/comment/33945959
tagged with: java
has comment: http://stackoverflow.com/comment/33945995
has comment: http://stackoverflow.com/comment/33946877
has title: Print hexadecimal as hexadecimal
has body: int hexNumber = 0x7A; System.out.println(hexNumber); This will print 122, but what if I want it to print 01111010 and 0x7A?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33945732
linked to: http://stackoverflow.com/q/1269573
has answer: http://stackoverflow.com/a/22336776
type: Question
has answer: http://stackoverflow.com/a/22336515
score: 0
has comment: http://stackoverflow.com/comment/33945927
possible better answer: http://stackoverflow.com/a/22336515
answer count: 3
has comment: http://stackoverflow.com/comment/33946208
has answer: http://stackoverflow.com/a/22336344
has comment: http://stackoverflow.com/comment/33946145
has comment: http://stackoverflow.com/comment/33945926

http://stackoverflow.com/q/22427302
has body: I am currently using just one class from javafx.util package : Pair, because I did not want to implement my own Pair class, so I thought this would be a reasonnable solution. However, I am working with Intellij, which seems to know where to find the jfxrt.jar, so I did not notice that this could cause problems. In fact, when I run my main from Intellij, all is right, but when I try to package the application with Maven, and then java -jar myapp.jar, the application needs the Pair class, and apparently doesn't find it : Exception in thread "main" java.lang.NoClassDefFoundError: javafx/util/Pair So I searched around, and here is what I can tell you : My JDK is 1.7.0_40, so I know jfxrt.jar is bundled, and I found it. Maven version : 3.1.0 I am on windows seven I tried to add %JAVA_HOME%\lib\ to my PATH variable, did not change anything I tried to add this system dependency in my pom.xml : javafx jfxrt 2.0 system ${java.home}/lib/jfxrt.jar But it does not seem to change anything, and even if it sound silly, I tried to copy/paste jfxrt.jar, in a lib folder within my jar, and surprisingly, it did not work either... I use the maven-assembly-plugin like this : minmax minmax 1.0-SNAPSHOT javafx jfxrt 2.0 system ${java.home}/lib/jfxrt.jar maven-assembly-plugin fr.tlasnier.jeux.puissance4.ihm.Puissance4Main jar-with-dependencies make-assembly package single Should you have any suggestion, please go ahead (might be another solution for my Pair problem that does not rely on javafx ...)
upvote count: 3
linked to: http://stackoverflow.com/q/15278215
has answer: http://stackoverflow.com/a/22427371
has comment: http://stackoverflow.com/comment/34104412
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34104168
tagged with: maven
has title: Cannot find jfxrt.jar (javafx) at runtime
has answer: http://stackoverflow.com/a/56098558
score: 3
tagged with: java
tagged with: javafx
favorite count: 0
has comment: http://stackoverflow.com/comment/34104024
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34104276

http://stackoverflow.com/q/22431620
accepted answer: http://stackoverflow.com/a/22432348
score: 0
has comment: http://stackoverflow.com/comment/34113097
has comment: http://stackoverflow.com/comment/34113204
answer count: 1
has comment: http://stackoverflow.com/comment/34112295
favorite count: 0
has title: Java Canvas Draw Image from BufferedImage
has comment: http://stackoverflow.com/comment/34112574
upvote count: 1
has body: I am currently working on my personal project. The idea is to import a picture and crop it into n-pieces of bufferedimage then draw them with random sequence to a java canvas. After that save the canvas to image file. Right now iam stuck at saving the canvas and i have searching for the solutions but none of them work. Here my save procedure. Please help, thanks in advance private void save() { int r = jFileChooser1.showSaveDialog(this); File file2 = null; if(r == jFileChooser1.APPROVE_OPTION){ file2 = jFileChooser1.getSelectedFile(); Graphics g2d = canvas.getGraphics(); BufferedImage bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = bi.createGraphics(); canvas.paint(g2); g2.dispose(); g2d.dispose(); try { ImageIO.write(bi, "jpg", file2); } catch (Exception ex) { System.out.println("Error saving"); } } } Update : Now i get it, after using paintComponents now i can save the picture. Thanks @madProgrammer public class CaptureImage extends javax.swing.JFrame { MyPanel canvas; BufferedImage[] processedImage; public CaptureImage(BufferedImage[] proc) { processedImage = proc; SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } private void createAndShowGUI() { System.out.println("Created GUI on EDT? " + SwingUtilities.isEventDispatchThread()); JFrame f = new JFrame("Output Picture"); f.addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ save(); System.exit(0);//cierra aplicacion } }); canvas = new MyPanel(processedImage); f.add(canvas); f.setSize(400, 400); f.setVisible(true); } public void save() { JFileChooser jFileChooser1 = new JFileChooser(); int r = jFileChooser1.showSaveDialog(this); File file2 = null; if (r == jFileChooser1.APPROVE_OPTION) { file2 = jFileChooser1.getSelectedFile(); BufferedImage bi = new BufferedImage(300, 300, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = bi.createGraphics(); canvas.print(g2); try { ImageIO.write(bi, "jpg", file2); g2.dispose(); } catc…
has answer: http://stackoverflow.com/a/22432348
type: AnsweredQuestion
tagged with: java
tagged with: file
tagged with: image
downvote count: 1
type: Question
tagged with: canvas
has comment: http://stackoverflow.com/comment/34111922

http://stackoverflow.com/a/65678192
downvote count: 0
has comment: http://stackoverflow.com/comment/118539935
type: Answer
answers question: http://stackoverflow.com/q/22454839
score: 1
has comment: http://stackoverflow.com/comment/118458278
upvote count: 1
has body: Find the below code to make visible the view in Circuler reveal, if you send true, it'll get Invisible/Gone. If you send false, it'll get visible. anyView is the view you're going to visible/hide, it could be any view (Layouts, Buttons etc) private fun toggle(flag: Boolean, anyView: View) { if (flag) { val cx = anyView.width / 2 val cy = anyView.height / 2 val initialRadius = Math.hypot(cx.toDouble(), cy.toDouble()).toFloat() val anim = ViewAnimationUtils.createCircularReveal(anyView, cx, cy, initialRadius, 0f) anim.addListener(object : AnimatorListenerAdapter() { override fun onAnimationEnd(animation: Animator) { super.onAnimationEnd(animation) anyView.visibility = View.INVISIBLE } }) anim.start() } else { val cx = anyView.width / 2 val cy = anyView.height / 2 val finalRadius = Math.hypot(cx.toDouble(), cy.toDouble()).toFloat() val anim = ViewAnimationUtils.createCircularReveal(anyView, cx, cy, 0f, finalRadius) anyView.visibility = View.VISIBLE anim.start() } }

http://stackoverflow.com/q/22414809
has title: Passing request from server to client
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22414859
tagged with: http
tagged with: java
type: Question
has body: I need to pass response from server to clinet (a'la proxy): private void pushProxyToClient(HttpExchange httpExchange, HttpURLConnection connection) throws IOException { // pass headers Headers respHeaders = httpExchange.getResponseHeaders(); Map&lt;String, List&lt;String&gt;&gt; headers = connection.getHeaderFields(); for (String key: headers.keySet()) { if (key == null){ continue; } List&lt;String&gt; values = headers.get(key); respHeaders.put(key, values); } httpExchange.sendResponseHeaders(connection.getResponseCode(), connection.getContentLength()); // pass body InputStreamReader isr = new InputStreamReader(connection.getInputStream()); OutputStreamWriter isw = new OutputStreamWriter(httpExchange.getResponseBody()); long count = 0; while (count &lt; connection.getContentLengthLong()) { isw.write(isr.read()); count += 1; } isr.close(); isw.close(); } Unfortunatley, the client (firefox) tries to download response as file instead of render it as html. What I'm doing wrong? UPDATE It's now working (sendResponseHeaders was invoked too early) but now I'm getting error (from browser) that it was unable to uncompress body. The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression. Content body is empty. Why? UPDATE 2 It almost works. The problem was InputStreamWriter. Changing it to InputStream's read helped. Any way... some of pages render its content twice.. do not know why.
answer count: 1
score: 0

http://stackoverflow.com/a/25494314
score: 3
downvote count: 0
type: Answer
has body: Given sentences, once could average the predicted classes after annotation. The predicted classes can be accessed passing the annotated tree class to RNNCoreAnnotations.getPredictedClass: public class SentimentAnalysis { private final String document; public SentimentAnalysis(String document) { this.document = document; } public SentimentAnalysis(Collection&lt;String&gt; sentences) { this.document = Joiner.on(". ").join(sentences); } public List&lt;Integer&gt; annotateAndScore(){ List&lt;Integer&gt; scores = Lists.newArrayList(); Properties props = new Properties(); props.put("annotators", "tokenize, ssplit, pos, parse, sentiment"); StanfordCoreNLP pipeline = new StanfordCoreNLP(props); Annotation document = new Annotation(this.document); pipeline.annotate(document); for (CoreMap sentence : document.get(CoreAnnotations.SentencesAnnotation.class)) { Tree annotatedTree = sentence.get(SentimentCoreAnnotations.AnnotatedTree.class); int score = RNNCoreAnnotations.getPredictedClass(annotatedTree); scores.add(score); } return scores; } }
answers question: http://stackoverflow.com/q/22434081
upvote count: 3

http://stackoverflow.com/comment/33999706
type: Comment
has text: Thanks - Fixed this by removing poison from the list and by adding poison directly to the queue after producer executor is terminated.
type: AnswerComment
comment on: http://stackoverflow.com/a/22365442
score: 0

http://stackoverflow.com/comment/35011471
has text: When logging in with username and password the BearerAuthenticationInfo does not get called. When authenticating with a token it does it get called and returns as expected. Am putting debug into AtLeastOneSuccessfulStrategy now, will reply when done
comment on: http://stackoverflow.com/a/22919387
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34039631
comment on: http://stackoverflow.com/a/22390209
score: 0
type: AnswerComment
type: Comment
has text: Why? It's immutable. Why copy it?

text-to-speech
tags question: http://stackoverflow.com/q/22400462
type: Tag
tags question: http://stackoverflow.com/q/22468819
tag name: text-to-speech

http://stackoverflow.com/q/22443903
answer count: 2
upvote count: 1
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/34134788
accepted answer: http://stackoverflow.com/a/22444434
has comment: http://stackoverflow.com/comment/34135602
possible better answer: http://stackoverflow.com/a/22444374
has comment: http://stackoverflow.com/comment/34134613
downvote count: 0
has answer: http://stackoverflow.com/a/22444374
has comment: http://stackoverflow.com/comment/34135582
has answer: http://stackoverflow.com/a/22444434
tagged with: loops
has comment: http://stackoverflow.com/comment/34135555
type: Question
type: AnsweredQuestion
has body: Let's say that I have an Array of size [10] and when that array get's filled up I want to implement a FIFO structure instead of it just being full and therefore not able to add new stuff to the array and throw out the old. For example if I have a String array with car manufacturers and when I have 10 manufacturers in my array I want the oldest entry to be deleted and the newest entry to be added but kepping FIFO in mind. How would I implement that in a method like this: public void insert(String name) { int a; a = (rear + 1) % names.length; if(a == front) { System.out.println("Full Queue!"); } else { rear = a; names[rear] = name; if(front == -1) { front = 0; } } }
has title: Queue Circular Array loop
score: 1
linked to: http://stackoverflow.com/q/5498865
tagged with: java
has comment: http://stackoverflow.com/comment/34134574
has comment: http://stackoverflow.com/comment/34135701
has comment: http://stackoverflow.com/comment/34152771
has comment: http://stackoverflow.com/comment/34145366
tagged with: queue

selenium-webdriver
tags question: http://stackoverflow.com/q/22333840
tags question: http://stackoverflow.com/q/22485749
tags question: http://stackoverflow.com/q/22350903
tags question: http://stackoverflow.com/q/22395964
tags question: http://stackoverflow.com/q/22382628
tags question: http://stackoverflow.com/q/22375765
tags question: http://stackoverflow.com/q/22367014
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/22447104
tags question: http://stackoverflow.com/q/22348216
tags question: http://stackoverflow.com/q/22410764
tags question: http://stackoverflow.com/q/22379967
tags question: http://stackoverflow.com/q/22379182
tags question: http://stackoverflow.com/q/22362235
tags question: http://stackoverflow.com/q/22331821
tags question: http://stackoverflow.com/q/22346638
type: Tag
tags question: http://stackoverflow.com/q/22425565
tags question: http://stackoverflow.com/q/22375142

http://stackoverflow.com/q/22463941
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34170038
upvote count: 2
tagged with: tomcat7
type: Question
accepted answer: http://stackoverflow.com/a/22464288
possible better answer: http://stackoverflow.com/a/22465125
tagged with: java
has answer: http://stackoverflow.com/a/22465125
has comment: http://stackoverflow.com/comment/34169460
answer count: 2
score: 2
downvote count: 0
has body: I know we can set/add a property to tomcat catalina opts by using set or export command. But how do I get or print all the properties set in CATALINA_OPTS as well as their values? I checked online but couldn't really find a way to print the values. Thanks!
favorite count: 0
has answer: http://stackoverflow.com/a/22464288
tagged with: config
has title: how to get/print CATALINA_OPTS

http://stackoverflow.com/comment/34177867
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22467063
has text: It's quite likely that among other problems you are experiencing [false sharing](http://en.wikipedia.org/wiki/False_sharing). Also, `2*processors` threads is probably too many. Start with just two threads and see if that gives you correct results and a performance boost. *Then* increase the number of threads.
type: Comment

http://stackoverflow.com/a/22463857
type: Answer
has body: It seems to work if you wrap the code to show the stage in a Platform.runLater(): animation.setOnFinished(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent t) { Platform.runLater(new Runnable() { @Override public void run() { Stage stage = new Stage(); StackPane pane = new StackPane(); pane.getChildren().add(new Label("Hello world")); stage.setScene(new Scene(pane, 100, 100)); stage.showAndWait(); } }); } }); No idea why. It fails on Java FX 8 too.
answers question: http://stackoverflow.com/q/22463004
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/comment/34081537
score: 1
comment on: http://stackoverflow.com/q/22414087
type: QuestionComment
type: Comment
has text: you dont need any Threads, just use a Handler and send delayed Messages to make your desired effect

http://stackoverflow.com/comment/34088168
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22417890
has text: You want to color buttons when particular key is pressed. Right?

http://stackoverflow.com/comment/34066991
score: 0
comment on: http://stackoverflow.com/q/22348632
type: Comment
has text: And btw, I have the same issue with U+0065 & U+0301 combined char that gives "é". I don't know if it helps, but this PDF file was originally written in LaTeX and encoded with MiKTeX-xdvipdfmx (0.7.8)
type: QuestionComment

http://stackoverflow.com/a/40532470
type: Answer
upvote count: 1
score: 1
has body: Let me suggest another couple of options, going further in the direction of the first answers. As has been mentioned, the virtues of the builder pattern include the ability to accumulate knowledge over multiple steps, support for immutable instances, and to ensure that a "fresh" object is created in a coherent state. I'll stay within the concepts of your question's design. You could extend the Pizza class by an instance method (e.g. withCheese(boolean value) that returns a new Pizza instance whose other attributes match those of the receiving instance but with the specified cheese attribute value. This preserves immutability of the original, but gives you a new instance with the intended difference. You could extend the Pizza class by an instance method (e.g. builder() that returns a Pizza.Builder initialized with the attributes of the receiving instance. Then all the methods already on Pizza.Builder are available, without needing to add instance methods per option 1. The cost of that benefit is the need to make a final build() call on the Pizza.Builder. So after executing Pizza pizza0 = new Pizza.Builder(10) .cheese(true) .build(); to get a ten-inch cheese pizza, you could execute // option 1 Pizza pizza1 = pizza0.withPepperoni(true); to get a ten-inch cheese-and-pepperoni pizza via option 1, or // option 2 Pizza pizza2 = pizza0.builder().pepperoni(true).build(); to get the same thing via option 2. Option 1 is shorter to get a new pizza with a single difference, but takes more effort to implement all the needed instance methods and builds more intermediate pizzas to make multiple differences. Option 2 always gets a Pizza.Builder but then reuses all of its capabilities to get a single resulting pizza in the desired configuration. This option also allows more pizza attributes to be added more easily (by adding the instance attribute to Pizza and the single corresponding method to Pizza.Builder.
downvote count: 0
answers question: http://stackoverflow.com/q/22416239

http://stackoverflow.com/a/22398200
has comment: http://stackoverflow.com/comment/77621377
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/34116277
score: 3
answers question: http://stackoverflow.com/q/22381205
downvote count: 0
has comment: http://stackoverflow.com/comment/34117206
has body: Spring and Declarative services are not meant to be used together. So the approach you use will not work.Declarative services is a very simple framework that can only wire services into components and publish components as services. It has no capabilities regarding jpa. So I think DS will not be a good match if you want to use something like jpa with container managed persistence. Like Holly mentioned blueprint supports that with the help of some other aries modules. I have created a tutorial that shows how to use this in a complete example. See: http://liquid-reality.de/pages/viewinfo.action?pageId=6586413 The blueprint approach is very different from how spring does jpa and container managed transactions. In spring you normally create the datasource in your context and inject it. In blueprint you work more like in standard jpa. There the datasource is referenced in persistence.xml and looked up using jndi. Aries jndi then bridges from jndi to OSGi services so another bundle can offer the datasource as an OSGi service. The other option you have is to use spring dm to create jpa services the "spring way". But spring dm is not maintained and has a lot of problems in OSGi. So blueprint is currently the best way to go.

http://stackoverflow.com/comment/34186095
has text: You can also create Hashmap after reading the values from file and split("->"). Let the key be 0,1,...,25000 and value be the corresponding one.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22473192

http://stackoverflow.com/q/22368973
answer count: 0
tagged with: java
type: Question
has body: Hi i am uploading a file using &lt;input type="file"&gt; in spring mvc. I submit form on change event of file and show uploaded process. But file content not uploaded and get null on server. If i upload on click of submit button every thing works fine. This is my code: Html File: &lt;form:form method="POST" modelAttribute="book" id="saveBook" name="saveBook" enctype="multipart/form-data"&gt; &lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr&gt; &lt;td&gt;Book :&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt; &lt;input type="file" name="file" id="file" class="edit_form" onchange="return upload('&lt;c:url value='/bookstore/librery/uploadBook' /&gt;', 'saveBook', this);" /&gt; &amp;nbsp; &lt;form:errors path="file" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form:form&gt; Jquery Code: function upload(requestUrl, formId, clickedObj) { if (clickedObj &amp;&amp; eval(clickedObj) &amp;&amp; clickedObj != null &amp;&amp; clickedObj != undefined) { clickedObj.disabled = true; } var formData = new FormData(document.getElementById(formId)); $.ajax({ 'url': requestUrl, 'type': 'POST', 'data': formData, 'cache': false, 'contentType': false, 'processData': false, success: function (data) { $("#tempLoc").val(data.tempLoc); $("#bookPreview").attr("src", "data:image/png;base64," + data.image); $("#image").val(data.image); clickedObj.disabled = false; }, error: function (xhr, status, err) { clickedObj.disabled = false; var tempErrorHTML = getAjaxRequestErrorMsg(xhr); alert(tempErrorHTML); }, xhr: function () { var xhr = new window.XMLHttpRequest(); xhr.upload.addEventListener("progress", function (evt) { if (evt.lengthComputable) { var percentComplete = (evt.loaded / evt.total) * 100; //Do something with upload progress alert('percentComplete = ' + percentComplete + '%'); } }, false); return xhr; }, }, 'json'); } If i call upload function on click of submit button every thing works fine. I think form is submitted before file uploaded but don't k…
has title: input type file goes blank when submit form onchange
has comment: http://stackoverflow.com/comment/34003165
linked to: http://stackoverflow.com/q/2320069
has comment: http://stackoverflow.com/comment/34003232
score: 0
has comment: http://stackoverflow.com/comment/34003288
tagged with: jquery
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
tagged with: spring-mvc

http://stackoverflow.com/q/22467063
downvote count: 0
tagged with: java
tagged with: concurrency
type: Question
has comment: http://stackoverflow.com/comment/34175776
has comment: http://stackoverflow.com/comment/34177867
tagged with: algorithm
has body: I am currently writing a program which first generates prime numbers by the Sieve of Eratosthenes sequentially, then concurrently. The concurrent version of the algorithm is supposed to be quicker than the sequential one, but in my case the concurrent version is approx. 10 times slower. I am wondering where I am putting the extra work on my threads, compared to the main thread in the sequential solution. Here's my program (prepare to read a bit!): Primes.java: public abstract class Primes { byte[] bitArr; int maxNum; final int[] BITMASK = { 1, 2, 4, 8, 16, 32, 64 }; final int[] BITMASK2 = { 255 - 1, 255 - 2, 255 - 4, 255 - 8, 255 - 16, 255 - 32, 255 - 64 }; void setAllPrime() { for (int i = 0; i &lt; bitArr.length; i++) { bitArr[i] = (byte) 127; } } void crossOut(int i) { bitArr[i/14] = (byte) (bitArr[i/14] - BITMASK[((i/2)%7)]); } boolean isPrime(int i) { if(i == 2){ return true; } if((i%2) == 0){ return false; } return (bitArr[i/14] &amp; BITMASK[(i%14)&gt;&gt;1]) != 0; } int nextPrime(int i) { int k; if ((i%2) == 0){ k =i+1; } else { k = i+2; } while (!isPrime(k) &amp;&amp; k &lt; maxNum){ k+=2; } return k; } void printAllPrimes() { for (int i = 2; i &lt;= maxNum; i++){ if (isPrime(i)){ System.out.println("Prime: " + i); } } } } PrimesSeq.java: import java.util.ArrayList; public class PrimesSeq extends Primes{ PrimesSeq(int maxNum) { this.maxNum = maxNum; bitArr = new byte[(maxNum / 14) + 1]; setAllPrime(); generatePrimesByEratosthenes(); } void generatePrimesByEratosthenes() { crossOut(1); // 1 is not a prime int curr = 3; while(curr &lt; Math.sqrt(maxNum)){ for(int i = curr*curr; i &lt; maxNum; i+=2*curr){ if(isPrime(i)){ // 2*curr because odd*2 = even! crossOut(i); } } curr = nextPrime(curr); } } } PrimesPara.java: import java.util.ArrayList; public class PrimesPara extends Primes { PrimeThread[] threads; int processors; int currentState = 0; //0 = Init //1 = Generate primes after thread #0 finish //2 = Factorize public PrimesPara(int maxNum){ this.maxNum = ma…
has comment: http://stackoverflow.com/comment/34175249
has comment: http://stackoverflow.com/comment/34182467
has title: Prime numbers by Eratosthenes quicker sequential than concurrently?
accepted answer: http://stackoverflow.com/a/22477240
tagged with: sieve-of-eratosthenes
upvote count: 3
has comment: http://stackoverflow.com/comment/34175191
answer count: 1
has answer: http://stackoverflow.com/a/22477240
favorite count: 0
tagged with: multithreading
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/22415918
has comment: http://stackoverflow.com/comment/34152737
type: Question
answer count: 2
upvote count: 0
score: -2
has title: Hibernate query fails with "this_.id must appear in GROUP BY" when using projection.count or projection.rowcount
possible better answer: http://stackoverflow.com/a/68050705
has body: Edited to provide more detailed information. I'm building a web service using Spring 2.5.6 and Hibernate 4. I'm dynamically building a criteria query based on input from a client. We are using Spring 2.5.6 because it is legacy code, previous attempts to upgrade to later versions of Spring by updating the versions in the Maven POM file fail, and our deadline is too tight to provide time to fully transition the project to a later version of Spring. The web service is searching for observations made by sensors using filters sent to the service by a client over SOAP. The users of this web service have need to create filters that result in several thousand observations returned. The service is taking so long to return a response, the users' clients are timing out. What I am attempting to do to resolve this performance issue is first query the database for how many observations would be returned by the users' filters, then splitting the work off into several threads of execution using a cached thread pool. Each thread will query the database for a portion of the results. Then using a thread-safe queue provided by Java's java.util.concurrent package, I have each thread encode the responses into the proper JAXB objects and add these objects to the queue. Finally, the web service returns the entire response to the client. I'm hoping this design will reduce response time (it obviously assumes the database will handle the multiple parallel queries just fine and that returning the results from the database in pieces along several connections is faster than one bulk return on a single connection). However, when attempting to get that initial count required before creating my threads, I get an error from the database. I'm using Hibernate criteria queries and a Hibernate projection to get the count. The criteria is generated by the code below: Criteria criteria = session.createCriteria(Observation.class); if (!filter.isSetService()) { throw new JpaCriteriaFactoryException("Service…
has answer: http://stackoverflow.com/a/68050705
has comment: http://stackoverflow.com/comment/34084551
favorite count: 0
has comment: http://stackoverflow.com/comment/34152625
has comment: http://stackoverflow.com/comment/67246175
has answer: http://stackoverflow.com/a/22511876
downvote count: 2
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/34084456
accepted answer: http://stackoverflow.com/a/22511876

http://stackoverflow.com/q/22340779
has title: Should multiple threads read from the same DataInputStream?
type: Question
has body: I'd like my program to get a file, and then create 4 files based on its byte content. Working with only the main thread, I just create one DataInputStream and do my thing sequentially. Now, I'm interested in making my program concurrent. Maybe I can have four threads - one for each file to be created. I don't want to read the file's bytes into memory all at once, so my threads will need to query the DataInputStream constantly to stream the bytes using read(). What is not clear to me is, should my 4 threads call read() on the same DataInputStream, or should each one have their own separate stream to read from?
has comment: http://stackoverflow.com/comment/33953807
has comment: http://stackoverflow.com/comment/33953708
has comment: http://stackoverflow.com/comment/33953982
has answer: http://stackoverflow.com/a/22340857
downvote count: 0
has answer: http://stackoverflow.com/a/22341097
favorite count: 0
has answer: http://stackoverflow.com/a/22341590
answer count: 5
score: 2
has comment: http://stackoverflow.com/comment/33954264
upvote count: 2
type: UnansweredQuestion
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/22340896
has answer: http://stackoverflow.com/a/22340820

http://stackoverflow.com/comment/34025238
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/22365154
type: Comment
has text: @Alex, for both of your questions the answer is: inject a provider. But it doesn't mean that you have to *bind* any provider. You can create simple linked binding and still *inject* a provider. See for yourself: https://gist.github.com/dpx-infinity/9529941. I didn't create any `toProvider()` bindings, yet I'm still able to inject a provider which creates new instances every time it is asked to.

http://stackoverflow.com/comment/34132689
type: Comment
type: QuestionComment
has text: First of all, they are private. Sub classes won't be able to see them. Rephrase what you want.
comment on: http://stackoverflow.com/q/22442994
score: 0

http://stackoverflow.com/a/22409431
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22409234
upvote count: 1
has body: An android project is a Java project. If you are saying that you want to create a copy that you can run locally (essential run the back end) Create a branch/fork of your current project, delete all the android related code, add a main method that will run the project. If you are trying to port an android project to a desktop application that is a different issue.
type: Answer

http://stackoverflow.com/comment/34057639
score: 0
type: Comment
type: QuestionComment
has text: @ChandrayyaGK They are in Build path.
comment on: http://stackoverflow.com/q/22400333

http://stackoverflow.com/comment/34049419
type: Comment
has text: *"how can I code it such that only when i click on a position"* What feature does this bring to the user? Is it spyware?
comment on: http://stackoverflow.com/q/22375422
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34176035
score: 0
comment on: http://stackoverflow.com/a/22467536
type: Comment
has text: After int n = console.readInt(); go for System.out.println(n); just to confirm u had no wrong input ... This is strange
type: AnswerComment

hudson
type: Tag
tags question: http://stackoverflow.com/q/22380712
tag name: hudson

http://stackoverflow.com/comment/34058787
type: QuestionComment
has text: How are you getting the array? Do you declare/instantiate it? Are you reading it from file?
score: 0
comment on: http://stackoverflow.com/q/22401648
type: Comment

http://stackoverflow.com/comment/34294599
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22485647
has text: Thanks! I fall in #2 of the possibilities and your explanation helped greatly.
score: 0

variables
tag name: variables
tags question: http://stackoverflow.com/q/22441141
tags question: http://stackoverflow.com/q/22362796
tags question: http://stackoverflow.com/q/22375517
tags question: http://stackoverflow.com/q/22338321
tags question: http://stackoverflow.com/q/22444901
type: Tag
tags question: http://stackoverflow.com/q/22421112
tags question: http://stackoverflow.com/q/22458839
tags question: http://stackoverflow.com/q/22360457
tags question: http://stackoverflow.com/q/22486215
tags question: http://stackoverflow.com/q/22340972
tags question: http://stackoverflow.com/q/22330866

http://stackoverflow.com/comment/34067380
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22406204
type: Comment
has text: @Lawrence, thanks for clearing that up for me. I was not thinking I had to have a server side provide the file for the client side to read.

http://stackoverflow.com/comment/34165177
comment on: http://stackoverflow.com/a/22459772
type: Comment
score: 0
type: AnswerComment
has text: Actually it is the way I create `pointcut` and `advice` in the `advisor` class that caused the problem. Neither objects are managed by Spring. Thank you for answering my questions!

http://stackoverflow.com/a/22474905
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22474791
answers question: http://stackoverflow.com/q/22474791
type: AcceptedAnswer
score: 1
has body: You are using the asynchronous method, so the output is hardly surprising. When you want to access the folder contents synchronously, use await: With this release of Google Play services, you now have the option to specify if an API call should execute asynchronously (you will receive a callback once it is finished), or synchronously (the thread will block until the operation has completed). This is achieved by using the classes PendingResult, Result, and Status in the com.google.android.gms.common.api package. In practice, this means that API operations will return an instance of PendingResult, and you can choose if you want the method to execute asynchronously using setResultCallback or synchronously using await. (http://android-developers.blogspot.de/2014/02/new-client-api-model-in-google-play.html).
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34493883
type: AnswerComment
comment on: http://stackoverflow.com/a/22468044
has text: First of all, thanks for your answer. But I must use **REST** protocol with JSON body.
type: Comment
score: 0

http://stackoverflow.com/comment/75206921
comment on: http://stackoverflow.com/a/22372823
type: AnswerComment
has text: If there was a compilation error you should have mentioned it in your question.
type: Comment
score: 0

http://stackoverflow.com/q/22423837
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/34114849
has comment: http://stackoverflow.com/comment/34100395
answer count: 1
has comment: http://stackoverflow.com/comment/34114918
has answer: http://stackoverflow.com/a/22433459
score: 0
tagged with: java
has body: This is the java constructor method public Intersection(String id, double lat, double lon, int interType, int index, String legsFrame){ setIntersectionId(id); setLatitude(lat); setLongitude(lon); setIntersectionType(interType); setIndex(index); setLegsFrame(legsFrame); } and I'm accessing this constructor form native side JNIEXPORT jobject JNICALL Java_org_smartcar_serverdatainterface_shared_services_CppConnector_getIntersection (JNIEnv *env, jobject obj, jdouble lat, jdouble lon, jint direction) { jclass class = (*env)-&gt;FindClass(env,"org/smartcar/serverdatainterface/shared/businessentities/Intersection"); if (NULL == class) PrintError ("class"); jmethodID cid = (*env)-&gt;GetMethodID(env,class, "&lt;init&gt;", "(CDDIIC)V"); if (NULL == cid) PrintError ("method"); return (*env)-&gt;NewObject(env, class, cid, "jjlk", 34.5, 45.7, 6, 7, "dgdfh"); } but cid is getting null. how to access this constructor when is has String parameters.
tagged with: java-native-interface
has title: Access a method with string parameters Java Native Interface

http://stackoverflow.com/q/22442032
tagged with: java
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/22442698
has title: Combo Boxes in netbeans
score: 0
has body: i have a gui in netbeans. 3 textfields animal id(i.e MAM001) , type of animal(LION) and nickname(SIMBA). when the three textfields are entered the user can click on the submit button which will store the values from the three textfields in a database. what i want to do but don't know how to do it, is to use a combo box with three different fields in it (MAMMAL,BIRD REPTILE). when i select mammal from the combo box it will the change mysql statements in the background so that the data entered into the textfields will go into the mammal table in the database. if i click on the "bird" field in the combo box the same thing will happen except the data will go into the bird table in the database. Any help would be greatly appreciated Thank you.
answer count: 1
tagged with: combobox
accepted answer: http://stackoverflow.com/a/22442698
tagged with: netbeans
type: AnsweredQuestion

http://stackoverflow.com/q/22468646
score: 0
answer count: 1
has body: I've got a few questions concerning the Google Play Game Services and the BaseGameActivity class. In the Developer's Guide it is suggested that the main activity extends BaseGameActivity. On the next page I read that the system initiates the user sign-in flow automatically when the game launches when the main activity extends BaseGameActivity. But I don't want to force my users to use the Google Play Game Services. Only those who are keen on sharing there results with their friends should use this possibility. It this still possible with the BaseGameActivity class? So I just want to have a sign-in button (which is also described there) and no auto login at the start of the game. Furthermore I want to know how to deal the following issue: In my game the results which should be submitted to Google are available in a different activity than the main activity. There I can't call getApiClient(). How am I supposed to treat such a situation?
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22729947
has title: Google Play Game Services and BaseGameActivity questions
tagged with: java
type: Question
tagged with: google-play-services

http://stackoverflow.com/comment/34187862
type: AnswerComment
has text: "Yes" is hardly an answer. I'm aware that this is a poorly asked question and maybe you feel it doesn't deserve a better answer, but then you should have posted this as a comment. If you're going to post an answer, at least include a short explanation and maybe describe some alternatives...
comment on: http://stackoverflow.com/a/22474343
type: Comment
score: 1

http://stackoverflow.com/comment/34112573
comment on: http://stackoverflow.com/a/22431981
has text: This is not an answer. It's a bit extensive to be a comment, but it should be a comment.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34253633
type: QuestionComment
comment on: http://stackoverflow.com/q/22384940
type: Comment
has text: Probably those methods are defined in the interface that you haven't provided when creating the class using the right GUI option...
score: 0

http://stackoverflow.com/a/22388947
has comment: http://stackoverflow.com/comment/34039224
has comment: http://stackoverflow.com/comment/34053241
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34039302
type: Answer
has body: I don't really understand your question but if you're trying to get the white color to become shaded when you click it (pixel at a time) then you could use this to darken the pixel: public BufferedImage shadePixel(BufferedImage img, int x, int y, int darkness){ //x is the mouse x position &amp; y is the mouse y position Color color = new Color(img.getRGB(x, y)); int imgR = color.getRed()-darkness;//if it makes it brighter try + instead of - int imgG = color.getGreen()-darkness; int imgB = color.getBlue()-darkness; Color color2 = new Color(imgR, imgG, imgB); img.setRGB(x, y, color2.getRGB()); return img; } Hope it helps :) But if you meant for it to detect the different shades then you could try this: public boolean isShadeOfWhite(BufferedImage img, int x, int y){ Color color = new Color(img.getRGB(x, y)); int imgR = color.getRed(); int imgG = color.getGreen(); int imgB = color.getBlue(); if(imgR == imgG &amp;&amp; imgR == imgB){ return true; } return false; }
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22387585
answers question: http://stackoverflow.com/q/22387585

http://stackoverflow.com/q/22394659
has answer: http://stackoverflow.com/a/22394752
has comment: http://stackoverflow.com/comment/34047361
tagged with: clone
tagged with: java
type: Question
has body: I am having a problem understanding the clone method in Java. In this example the output is 1. int[][]x = {{1,2},{3,4}}; int[][]y = new int[2][]; y[0] = x[0].clone(); y[1] = x[1].clone(); x[0][0] = 0; System.out.println(y[0][0]); In this example the output is 100 8 int[][][] x = {{{1,2},{3,4}},{{5,6},{7,8}}}; int[][][] y = new int[2][2][]; y[0] = x[0].clone(); y[1][1] = x[1][1].clone(); x[0][0][0] = 100; x[1][1][1] = 200; System.out.println(y[0][0][0]+" "+y[1][1][1]); Why does the value for the y array change in the second example but not the first?
has title: How to know when to clone in java?
answer count: 1
tagged with: arrays
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22394752
upvote count: 2
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/22420956
answer count: 0
has comment: http://stackoverflow.com/comment/34093710
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34093731
has title: Standard Widgets Toolkit - Tooltip
has body: I'm pondering over this, I have a swt tooltip being set on a label. The tooltip method will be called setTooltip(message) will be called from a different class and the setMessage(message) will be set in the class where tooltip object will be created. Right now Im checking for null or empty condition before setting the tooltip message otherwise it would throw IllegalArgumentException. So my code is as such public void setTooltip(String message) { if (message != null &amp;&amp; !message.isEmpty()) { tooltip.setMessage(message); label.addMouseTrackListener(mouseTrackListener); iconLabel.addMouseTrackListener(mouseTrackListener); } else { label.removeMouseTrackListener(mouseTrackListener); iconLabel.removeMouseTrackListener(mouseTrackListener); } } I need an option in the else condition because the control goes to removeListener line eben if null is passed and tooltip has not been associated with the listener. I do not know how the control flow happens here. Can someone elaborate on this. I would explicitly set tooltip to an empty string in the else condition, so there's no chance of some previous value being set on the tooltip, Such as else { tooltip.setMessage(""); label.removeMouseTrackListener(mouseTrackListener); iconLabel.removeMouseTrackListener(mouseTrackListener); } This way callers can pass null/empty into this method to remove the tooltip, if desired. Is this possible? If so how does the above else condition work and how the control flows? I should have an else condition which I do not want to remove but I need to know how to achieve this.
score: 0
type: UnansweredQuestion
tagged with: swt
has comment: http://stackoverflow.com/comment/34093647

http://stackoverflow.com/comment/34137493
comment on: http://stackoverflow.com/q/22368909
has text: @DavidYoung Actually, I think `flatMap` is a good name for `>>=`, quite apart from lists. It suggests well what `>>=` does for all the monads I can think of at the moment, and I speak as someone who has been around Haskell's monads for a looooong time. Admittedly this conceptual viewpoint could be influenced by my introduction to monads via Wadler's papers.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22479070
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34194789
tagged with: video
tagged with: java
linked to: http://stackoverflow.com/q/15735716
type: Question
has title: Java Frame Grabber
has body: can anyone give me a hint on how to get a frame from an mp4 video, by providing a timestamp (in ms or so)? I'm trying to seek a video frame by frame. Thanks, Pateta
score: 0
has comment: http://stackoverflow.com/comment/34415584
tagged with: frame

http://stackoverflow.com/q/22429700
has answer: http://stackoverflow.com/a/22429780
score: 1
tagged with: java
tagged with: arrays
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22429780
tagged with: android
type: AnsweredQuestion
has title: Get info of item clicked in ListActivity?
upvote count: 1
type: Question
has body: I'm building a ListActivity with a list of activities (each item on the list is an activity of my app). When one of the items in the list is clicked I want to get it's info. It's mostly done, however I'm getting an error when trying to retrieve the item data onclick. This is what I'm doing: private class ActivityItem { private CharSequence title; private Class activityClass; // I didn't limit it to Activities because I might use it for Fragments public ActivityItem(int titleResId, Class activityClass) { this.title = getResources().getString(titleResId); this.activityClass = activityClass; } @Override public String toString() { return title.toString(); } } private static ActivityItem[] mItems; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_items_not_added); // Instantiate the list of samples. ActivityItem[] mItems = new ActivityItem[]{ new ActivityItem(R.string.dialer, Example1.class), new ActivityItem(R.string.clock, Example2.class), }; setListAdapter(new ArrayAdapter&lt;ActivityItem&gt;(this, android.R.layout.simple_list_item_1, android.R.id.text1, mItems)); } @Override protected void onListItemClick(ListView listView, View view, int position, long id) { Log.d("Title:", mItems[position].toString()); // This returns error } Log: 03-15 17:45:30.302 18134-18134/com.example.android.launcher E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.android.launcher, PID: 18134 java.lang.NullPointerException at com.example.android.launcher.ItemsNotAdded.onListItemClick(ItemsNotAdded.java:92) What am I doing wrong?

http://stackoverflow.com/q/22417355
has answer: http://stackoverflow.com/a/22417489
upvote count: 0
has answer: http://stackoverflow.com/a/22417435
score: -1
tagged with: android-button
answer count: 2
tagged with: user-interface
favorite count: 0
tagged with: android-asynctask
accepted answer: http://stackoverflow.com/a/22417489
tagged with: android
type: AnsweredQuestion
tagged with: java
has title: UI not updating in Android using AsyncTask
downvote count: 1
has body: I've searched the internet far and wide about getting the UI to update in real-time in Android to no avail. I implemented an AysncTask class as most of the other posts suggested, but it's still not updating my UI in real-time like I want. It only updates after the program is done running. I've even been getting the "Skipped n frames. The application may be doing too much work in its main thread." error, which I don't understand because I'm trying to do these updates in the UI thread. About 5 seconds into running my program the screen turns black and stays like that until its done finishing. Any help would be much appreciated as I've been pulling my hair out on this one for awhile Here's my code. EDIT: Solved. Removed the Thread.sleep(n) from my UI thread and added it to my AsyncTask. Thanks everyone! Main class: public class Home extends Activity { // Declare objects Button turingB, socratesB, voltaireB, descartesB, platoB; int[] eating, thinking, hungry; Philosopher socrates, turing, voltaire, descartes, plato; Philosopher[] philosophers; Chopstick[] chopsticks; TextView info; String value; Context context; int toastLength; boolean turingHungry, socratesHungry, voltaireHungry, descartesHungry, platoHungry; String running; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); // Instantiate objects (keep track of each button individually context = getApplicationContext(); toastLength = Toast.LENGTH_SHORT; info = (TextView) findViewById(R.id.textView1); info.setText("Click Start to begin!"); socratesB = (Button) findViewById(R.id.button1); descartesB = (Button) findViewById(R.id.button5); platoB = (Button) findViewById(R.id.button4); voltaireB = (Button) findViewById(R.id.button3); turingB = (Button) findViewById(R.id.button2); running = "false"; // Set all philosophers to thinking (blue) // socratesB.setBackgroundColor(Color.BLUE); // descartesB.setBackgroundColor(Color.BLUE); // pl…
type: Question
possible better answer: http://stackoverflow.com/a/22417435

http://stackoverflow.com/q/22472844
tagged with: linux
answer count: 3
linked to: http://stackoverflow.com/q/6161437
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/21867723
has answer: http://stackoverflow.com/a/40507543
has title: How to set socket option (TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL) in java or netty?
type: UnansweredQuestion
tagged with: sockets
tagged with: netty
score: 11
upvote count: 11
has comment: http://stackoverflow.com/comment/34184521
has comment: http://stackoverflow.com/comment/34191781
tagged with: tcp
tagged with: java
has body: In C/Linux, it's easily to set different value about those socket options for every KEEPALIVE tcp connection independently. TCP_KEEPCNT (since Linux 2.4) The maximum number of keepalive probes TCP should send before dropping the connection. This option should not be used in code intended to be portable. TCP_KEEPIDLE (since Linux 2.4) The time (in seconds) the connection needs to remain idle before TCP starts sending keepalive probes, if the socket option SO_KEEPALIVE has been set on this socket. This option should not be used in code intended to be portable. TCP_KEEPINTVL (since Linux 2.4) The time (in seconds) between individual keepalive probes. This option should not be used in code intended to be portable. In netty or java, how to set the three socket options for socket? I know there is no portable way to solve it, but only in Linux, can I set those socket options?
has answer: http://stackoverflow.com/a/29062476
type: Question
has answer: http://stackoverflow.com/a/54067335
has comment: http://stackoverflow.com/comment/34221217
has comment: http://stackoverflow.com/comment/62416736

http://stackoverflow.com/q/22440567
favorite count: 0
has body: I have a method that a wrote. This method just scans for a user entered integer input. If the user enters a character value it will throw an input mismatch exception, which is handled in my Try-Catch statement. The problem is that, if the user inputs anything that is not a number, and then an exception is thrown, I need the method to loop back around to ask the user for input again. To my understanding, a Try catch statement automatically loops back to the Try block if an error is caught. Is this not correct? Please advise. Here is my method (it's pretty simple): public static int getMask() { //Prompt user to enter integer mask Scanner keyboard = new Scanner(System.in); int output = 0; try{ System.out.print("Enter the encryption mask: "); output = keyboard.nextInt(); } catch(Exception e){ System.out.println("Please enter a number, mask must be numeric"); } return output; }//end of getMask method Here is how the method is implemented into my program: //get integer mask from user input int mask = getMask(); System.out.println("TEMP mask Value is: " + mask); /***********************************/ Here is my updated code. It creates an infinate loop that I can't escape. I don't understand why I am struggling with this so much. Please help. public static int getMask() { //Prompt user to enter integer mask Scanner keyboard = new Scanner(System.in); int output = 0; boolean validInput = true; do{ try { System.out.print("Enter the encryption mask: "); output = keyboard.nextInt(); validInput = true; } catch(InputMismatchException e){ System.out.println("Please enter a number, mask must be numeric"); validInput = false; } }while(!(validInput)); return output; /********************/FINAL_ANSWER I was able to get it finally. I think I just need to study boolean logic more. Sometimes it makes my head spin. Implementing the loop with an integer test worked fine. My own user error I suppose. Here is my final code working correctly with better exception handling. Let me know in the c…
possible better answer: http://stackoverflow.com/a/22440609
answer count: 3
has comment: http://stackoverflow.com/comment/34128050
has comment: http://stackoverflow.com/comment/34128124
has comment: http://stackoverflow.com/comment/34128096
has answer: http://stackoverflow.com/a/22440609
has title: try-catch statement not returning to try block when catching exception
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/22440621
tagged with: java
accepted answer: http://stackoverflow.com/a/22440621
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/22440598
upvote count: 1

http://stackoverflow.com/comment/34115459
type: AnswerComment
comment on: http://stackoverflow.com/a/22433627
score: 0
type: Comment
has text: When you are done with the constructor, you end up with the array in heap memory but you do not have any reference to it. So it is available for garbage collection. Memory will be freed of this object when garbage collection happens.

http://stackoverflow.com/comment/34007955
type: Comment
comment on: http://stackoverflow.com/a/22371872
has text: I have just made a short video of what happenes when I run the code, if that helps anything in my question. Yes I will try to find out to do that. I will write in 5 minutes again here
score: 0
type: AnswerComment

http://stackoverflow.com/a/22345627
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22345508
type: Answer
has comment: http://stackoverflow.com/comment/33997363
has body: Lambda expressions are based on single-method interfaces. Anywhere where an implementation of a single-method interface is used (for example, an anonymous inner class that implements an interface that has one method), a Java 8 user can use a lambda expression instead. Have a look at how the collection classes have been modified in Java 8; for example the forEach method that was added to Iterable. Each of those methods take a single-method interface as an argument. Have a look at: State of the Lambda State of the Lambda: Libraries Edition To make your library useable to pre-Java 8 users, you might also want to provide methods that support the old style of iterating over collections; don't force those users to use lots of anonymous inner classes.
score: 1

http://stackoverflow.com/comment/33956066
type: QuestionComment
comment on: http://stackoverflow.com/q/22341124
score: 0
has text: it's just an exanple of using stack and linkedlist
type: Comment

http://stackoverflow.com/q/22357190
possible better answer: http://stackoverflow.com/a/22357425
upvote count: 2
has answer: http://stackoverflow.com/a/22357425
has comment: http://stackoverflow.com/comment/75675695
has comment: http://stackoverflow.com/comment/34069939
has comment: http://stackoverflow.com/comment/33982172
tagged with: generics
has comment: http://stackoverflow.com/comment/34068556
favorite count: 0
has title: How to correctly use Java generics for an array implementation of an ADT
has comment: http://stackoverflow.com/comment/33982306
has body: I am trying to teach my students the proper way to use Java generics. I am teaching a data structures course, so I want them working with arrays and their own linked lists, not with the Java Collections (for example no ArrayList). A typical issue is providing an array implementation for an ADT. Here is an example where I am trying to use a heap implemented as an array to provide a Priority Queue. I would like to support a priority queue of any kind of data objects so I use a generic I start with an interface: public interface PriQue&lt;E&gt; { void insert(int pri, E data); E remove(); // return null when empty boolean isEmpty(); } Then I implemented it: public class ArrayHeap&lt;E&gt; implements PriQue&lt;E&gt; { //private class Entry&lt;E&gt; { hides E of ArrayHeap which means remove fails private class Entry { // uses E of ArrayHeap int pri; E data; . . . } // end of Entry Entry heap[]; int cnt; public ArrayHeap(int size) { // heap = new Entry[size]; can not create generic array error // heap = (Entry[])new Object[size]; blows up on a cast error heap = (Entry[])new Object[size]; cnt = 0; } . . . public E remove() { E tmp = (E)heap[--cnt].getData(); //bad don't want to cast // trickle down code here return tmp; } Since the interface is parameterized I use the same generic in the implementing class – I think this is ok. I need to create an array of entries that will hold a priority and the corresponding data item. So I create a private class. Here my problem begins. If I leave the parameter out then since it is part of ArrayHeap it should pick up the E generic form there. This compiles but blows up when I try to create an array of Entry. Alternately I can have an explicit generic parameter to Entry. If I pick E it will “hide” E from ArrayHeap and when I try to remove an E from the array it does not realize it is the same E as the ArrayHeap E. If I name it something else, say V, then it cannot assign an E to a V and I cannot store any data. I think this is a fairly c…
has comment: http://stackoverflow.com/comment/34067993
has comment: http://stackoverflow.com/comment/34069967
has comment: http://stackoverflow.com/comment/33982226
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34068148
has comment: http://stackoverflow.com/comment/33982277
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22357478
accepted answer: http://stackoverflow.com/a/22357478
tagged with: arrays
tagged with: adt

http://stackoverflow.com/q/22455767
answer count: 1
tagged with: email
tagged with: smtp
has comment: http://stackoverflow.com/comment/34154351
has comment: http://stackoverflow.com/comment/34196856
tagged with: portability
has answer: http://stackoverflow.com/a/25052646
has comment: http://stackoverflow.com/comment/34188855
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34196081
type: Question
accepted answer: http://stackoverflow.com/a/25052646
has comment: http://stackoverflow.com/comment/34197307
has comment: http://stackoverflow.com/comment/34155266
has comment: http://stackoverflow.com/comment/34182504
has body: We are using 2 SMTP servers one that runs on Solaris 11 and other that runs on Win 2K8. And I'm compiling the codes using a PC that runs on Windows XP. The business code runs in server that runs on Solaris 11. I'm forbidden to bring out the business code, its an enterprises application that sends approximately 1000 mails a day. And the code gets a Socket object for the SMTP server and Prints some protocol related messages like "MAIL FROM: mail_id@domain.tld" and flushes it. then gets a input steam object of the socket and checks for error. This way mails are sent. The problem is that, code that runs in windows PC using Windows SMTP is not running for Solaris SMTP. Why JAVA, which is advocate to be platform portable is behaving like this? Java version is 1.3.2 Socket socketSMTP= new Socket(server_name,smtp_port); BufferedReader reader = new BufferedReader(new java.io.InputStreamReader(socketSMTP.getInputStream())); PrintWriter writer= new PrintWriter(socketSMTP.getOutputStream()); String respones=""; //--Some codes to check if server is ready -- writer.println("MAIL FROM:&lt;"+sender_address.trim()+"&gt;"); writer.flush(); respones=reader.readLine(); if(!tmp_msg.startsWith("250"))throw new Exception("Error in protocol "+respones); this part is where I'm getting error, Solaris SMTP expect 'username' in the place of sender_address whereas Windows SMTP expects 'mail id' in place of sender_address; sender_address is a String variable available from a POJO class
has comment: http://stackoverflow.com/comment/34155268
has title: Does Java mail work differently on different operating system
has comment: http://stackoverflow.com/comment/34154647

http://stackoverflow.com/comment/34236378
comment on: http://stackoverflow.com/a/22423511
type: Comment
score: 0
type: AnswerComment
has text: in place of List<JLabel> i used

http://stackoverflow.com/comment/34129386
has text: that's not really an answer!
comment on: http://stackoverflow.com/a/22441235
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/34053558
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22398116
has text: @Shriram no I don't get any error message

http://stackoverflow.com/q/22480059
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/34196791
linked to: http://stackoverflow.com/q/4656802
has comment: http://stackoverflow.com/comment/34196634
tagged with: java
score: -1
has body: I found this Java code to calculate the midpoint between two latitude and longitude: midpoint between two latitude and longitude public static void midPoint(double lat1,double lon1,double lat2,double lon2){ double dLon = Math.toRadians(lon2 - lon1); //convert to radians lat1 = Math.toRadians(lat1); lat2 = Math.toRadians(lat2); lon1 = Math.toRadians(lon1); double Bx = Math.cos(lat2) * Math.cos(dLon); double By = Math.cos(lat2) * Math.sin(dLon); double lat3 = Math.atan2(Math.sin(lat1) + Math.sin(lat2), Math.sqrt((Math.cos(lat1) + Bx) * (Math.cos(lat1) + Bx) + By * By)); double lon3 = lon1 + Math.atan2(By, Math.cos(lat1) + Bx); //print out in degrees System.out.println(Math.toDegrees(lat3) + " " + Math.toDegrees(lon3)); } Anyone can help me to convert this piece of code to Borland Delphi? With the input like this format: lat1 = 48.865223, lon1 = 2.318974 lat2 = 48.865983, lon2 = 2.321475 I am not sure if that is already in "radian".
type: Question
has title: Convert Java code to Delphi about midpoint calculation
has answer: http://stackoverflow.com/a/22480428
tagged with: delphi
has comment: http://stackoverflow.com/comment/34196680
answer count: 1
favorite count: 0

dsl
tags question: http://stackoverflow.com/q/22461333
tag name: dsl
type: Tag

http://stackoverflow.com/q/22332293
score: 0
has title: Make a method parameter a generic or wildcard.
has body: I have the following method private void test(String A, String B, &lt;?&gt; C) throws Exception { //..... } I would like C to be a generic parameter or anything (int, long, double, etc.). What is the right way to do that?
answer count: 5
tagged with: generics
has answer: http://stackoverflow.com/a/22332381
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22332378
has answer: http://stackoverflow.com/a/22332356
has comment: http://stackoverflow.com/comment/33938621
type: Question
has comment: http://stackoverflow.com/comment/33938625
has answer: http://stackoverflow.com/a/22332358
accepted answer: http://stackoverflow.com/a/22332358
tagged with: java
has answer: http://stackoverflow.com/a/22332364
possible better answer: http://stackoverflow.com/a/22332381

download
tags question: http://stackoverflow.com/q/22391065
tags question: http://stackoverflow.com/q/22366857
type: Tag
tag name: download
tags question: http://stackoverflow.com/q/22430408
tags question: http://stackoverflow.com/q/22449216

http://stackoverflow.com/q/22447839
has answer: http://stackoverflow.com/a/22447959
has answer: http://stackoverflow.com/a/22450220
downvote count: 0
has answer: http://stackoverflow.com/a/22450506
favorite count: 0
has comment: http://stackoverflow.com/comment/34141252
has body: This question is similar to singleton, but i need to create a class that can allow 'n' number of objects only, Below is my code public class MSInt { private static MSInt instance = null; private static int count = 0; private MSInt() { } public static MSInt getInstance() { if(count &lt; 5){ instance = new MSInt(); count++; return instance; } else { return null; } } } This is working but i am thinking a better solution than this if any.
answer count: 5
type: UnansweredQuestion
has title: Class which can allow to create Only 'n' number of Objects
has comment: http://stackoverflow.com/comment/34141255
has comment: http://stackoverflow.com/comment/35838593
has comment: http://stackoverflow.com/comment/34141237
upvote count: 3
tagged with: java
type: Question
score: 3
has answer: http://stackoverflow.com/a/22451028
has answer: http://stackoverflow.com/a/22447907
has comment: http://stackoverflow.com/comment/34145946

http://stackoverflow.com/q/22424036
downvote count: 0
has body: I am working on scraping some data on a specific Web page: http://www.studenti.ict.uniba.it/esse3/ListaAppelliOfferta.do The data I have to scrape are showed in the table which can be obtained as the output of the search which can be achieved by selecting one "Facoltà", one "Dipartimento" and then clicking on "Avvia Ricerca". I am very glad to say I was able to scrape 100% of the data in the table using JSoup, but in order to do so I need the HTML source code of the page containing the table. The only way I was able to get that HTML is by manually selecting one "Facoltà", one "Dipartimento" and then clicking on "Avvia Ricerca". Then the table is showed and I can obtain the HTML of the whole page containing it by right clicking and downloading the source code. I want to write some Java code which allows to automate these steps, after I give to my program the above mentioned url: selecting "Dipartimento di Informatica" among Facoltà selecting "Informatica" (or one of the others available) clicking "Avvia Ricerca" downloading the HTML source code of the Web page in .html file So then I can apply the code I wrote by myself for scraping the data in the table I need. Is there any library or something of this kind that can help me? I am sure there is no need to re-invent the wheel on this matter. Please note I tried some code to do that: try{ URL url= new URL("http://www.studenti.ict.uniba.it/esse3/ListaAppelliOfferta.do"); URLConnection urlConn = url.openConnection(); BufferedReader dis= new BufferedReader(new InputStreamReader((url.openStream()))); String s=""; while (( s=dis.readLine())!= null) { System.out.println(s); } dis.close(); }catch (MalformedURLException mue) {} catch (IOException ioe) {} But in this way I obtain only the HTML code of the page still not containing the table I need to scrape data from.
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/34128769
has comment: http://stackoverflow.com/comment/34098312
answer count: 0
type: UnansweredQuestion
score: 1
upvote count: 1
has title: Getting HTML code of Web Page in Java
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34099326
linked to: http://stackoverflow.com/q/2586975

http://stackoverflow.com/comment/33993726
has text: ofcourse I will upvote for the answers, my code is working fine for else loop i.e. if the user is not a valid user but not going into the if(resultCode==RESULT_OK). And I highly appreciated yours as well as Merlevede's efforts. Thank you.
comment on: http://stackoverflow.com/a/22338983
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22375473
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22375388
has body: use statement.executeUpdate(); for insert use String sql = "INSERT INTO mytable (user, password, level)" + "VALUES (?, ?, ?)"; PreparedStatement preparedStatement = conn.prepareStatement(sql); preparedStatement.setString(1, "user"); preparedStatement.setString(2, "password"); preparedStatement.setString(3, "0,1"); preparedStatement.executeUpdate();

http://stackoverflow.com/comment/34125040
comment on: http://stackoverflow.com/q/22438978
type: Comment
has text: Use a `RelativeLayout` so you can add views on top of each other.
score: 0
type: QuestionComment

http://stackoverflow.com/q/22400064
upvote count: 2
tagged with: scala
type: UnansweredQuestion
has body: I'm currently following the akka-camel integration example in http://doc.akka.io/docs/akka/snapshot/scala/camel.html. As transport I'm using jetty:http, like class Orders extends Actor with Producer { def endpointUri = "jetty:http://localhost:8877/" } same for the endpoint class MyEndpoint extends Consumer { def endpointUri = "jetty:http://0.0.0.0:8877/" def receive = { case msg: CamelMessage =&gt; { println("here", msg ); sender ! "ok"} case _ =&gt; { println("somewhere else") } } } All works fine when sending simple text-messages like val sys = ActorSystem("some-system") val orders = sys.actorOf(Props[Orders]) val endp = sys.actorOf(Props[MyEndpoint]) orders ? "hello" But things do not work when sending Case-Classes case class B(id:String) orders ? B("hello") The output states an error with the TypeConversion akka.camel.AkkaCamelException: No type converter available to convert from type: de.spring.cases.infrastructure.SerializationSpec.B to the required type: java.io.InputStream with value B(hello) ... Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: de.spring.cases.infrastructure.SerializationSpec.B to the required type: java.io.InputStream with value B(hello) at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:169) at org.apache.camel.component.jetty.JettyHttpProducer.createHttpExchange(JettyHttpProducer.java:135) at org.apache.camel.component.jetty.JettyHttpProducer.process(JettyHttpProducer.java:75) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122) at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117) at akka.camel.ProducerSupport$ProducerChild.produce(Producer.scala:137) at akka.camel.ProducerSupport$ProducerChild$$…
has answer: http://stackoverflow.com/a/22488410
has title: akka camel sending case classes as messages
tagged with: java
tagged with: apache-camel
type: Question
linked to: http://stackoverflow.com/q/9264162
score: 2
downvote count: 0
tagged with: akka
answer count: 1
favorite count: 0
tagged with: serialization

http://stackoverflow.com/q/22427122
answer count: 1
has title: Sorting values in a tree map with string and list bean as parameters
score: 0
type: UnansweredQuestion
has body: Continuation from my previous question posted Sorting a map in java I am trying out a solution to sort a tree map based on its values Let me declare the Map Map&lt;String, List&lt;Bean&gt;&gt; sortedBeanMap =new TreeMap&lt;String,List&lt;Bean&gt;&gt;(); i have created a separate comparator method to compare the values . public class MapSort { public static Map sortByValue(Map unsortedMap){ Map sortedMap = new TreeMap(new ValueComparator(unsortedMap)); sortedMap.putAll(unsortedMap); return sortedMap; } public static Map sortByKey(Map unsortedMap){ Map sortedMap = new TreeMap(); sortedMap.putAll(unsortedMap); return sortedMap; } } ValueComparator class public class ValueComparator implements Comparator { Map map; public ValueComparator(Map map){ this.map = map; } public int compare(Object keyA, Object keyB){ Comparable valueA = (Comparable) map.get(keyA); Comparable valueB = (Comparable) map.get(keyB); System.out.println(valueA +" - "+valueB); return valueA.compareTo(valueB); } } I knew the values should be of type string for the comparable to Work.But in my case , it will be a bean list.So how to get the comparator to work for my case ? i am stuck in this for a while ..Any suggestions and ideas would be great . Thanks guys in advance...
tagged with: hashmap
has answer: http://stackoverflow.com/a/22427217
linked to: http://stackoverflow.com/q/22422185
tagged with: java
tagged with: treemap
tagged with: comparable
type: Question
tagged with: comparator

http://stackoverflow.com/comment/33940490
has text: So, you want to set the `onClickListener` for your whole layout?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22332017
score: 0

http://stackoverflow.com/a/22461977
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22460204
type: Answer
answers question: http://stackoverflow.com/q/22460204
has body: The first thing I would do is stop using static methods for all your Database functions. Also why is Database an abstract class? Is there another class that extends Database with specific implementations (like MyDatabase or OracleDatabase. You might consider using static methods to return an instance of a Database and then convert the static methods to public instance methods.

http://stackoverflow.com/a/22479371
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22479100
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22479100
has comment: http://stackoverflow.com/comment/34197475
has comment: http://stackoverflow.com/comment/34197528
type: Answer
has body: Try the following Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); return (DataSource) envCtx.lookup("jdbc/sipreDs"); It seems that you are using jdbc in the lookup of the context and the datasource
has comment: http://stackoverflow.com/comment/34197876

http://stackoverflow.com/a/22342639
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33958436
has comment: http://stackoverflow.com/comment/33957067
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/22342314
has comment: http://stackoverflow.com/comment/33958176
answers question: http://stackoverflow.com/q/22342314
has body: There are two problems with this code 1.You didn't do null check,although the array contains null values 2.Your array index from 0-8,if you wan't to get element at 9th index it will throw ArrayIndexOutOfBound Exception. Your code should be like that public static void lengthFrequency (String [] words) { int [] lengthTimes = new int [9]; for(int i = 0; i &lt; words.length; i++) { String w = words[i]; if(null!=w) //This one added for null check { /* if(w.length() &gt;= 10) { lengthTimes[9]++; } else { lengthTimes[w.length()-1]++; } }*/ //Don't need to check like that ...u can do like below for(int i = 0; i &lt; words.length; i++) { String w = words[i]; if(null!=w) { lengthTimes[i] =w.length(); } } } //here we should traverse upto length of the array. for(int i = 0; i &lt; lengthTimes.length; i++) { System.out.println("Word-length " + (i+1) + ": " + lengthTimes[i]); } }
has comment: http://stackoverflow.com/comment/33957587
has comment: http://stackoverflow.com/comment/33958119
has comment: http://stackoverflow.com/comment/33957240

http://stackoverflow.com/comment/34156971
comment on: http://stackoverflow.com/a/22429034
score: 0
type: AnswerComment
type: Comment
has text: @issac no I am not using any other classes. Just this method. It is called recursion. It can be tricky to understand at first. It is a method that calls itself. I suggest reading into it online, even on stackoverflow. If I find a good resource I will get back to you.

http://stackoverflow.com/comment/64741184
score: 0
has text: Do we need to have separate table for the FooSequence to insert the sequence value.I am getting the insertion error for the FooSequence table.which i don't have in database
type: Comment
comment on: http://stackoverflow.com/a/22486690
type: AnswerComment

http://stackoverflow.com/q/22333056
tagged with: web-services
has body: I have a rest service, and a client using CXF webservice proxy coming with Jackson mapper. For some reason, I have to design the result class as an interface. Something like following: public interface SomeInterface {...} and the proxy @GET @Path("/something/{id}") public SomeInterface getById(@PathParam("id") String id); SomeInterface will have several implementations. Now Jackson will complain that it cannot construct a new "SomeInterface" instance, yes, that's right. But is there any way to tell Jackson to construct a concrete implementation of SomeInterface or not? Thanks a lot, KK
has comment: http://stackoverflow.com/comment/33940168
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 0
type: UnansweredQuestion
tagged with: rest
has comment: http://stackoverflow.com/comment/33940396
type: Question
has title: CXF Rest Client with Jackson provider // The expected result class in an interface

http://stackoverflow.com/q/22342145
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33956117
favorite count: 0
has answer: http://stackoverflow.com/a/22342241
type: UnansweredQuestion
has body: I am trying to install Java 7. I tested my Java version first, please see the below code ubuadmin@ubuserver3:~/JavaJars/HelloWordGPU$ java -version java version "1.6.0_30" OpenJDK Runtime Environment (IcedTea6 1.13.1) (6b30-1.13.1-1ubuntu2~0.12.04.1) OpenJDK Client VM (build 23.25-b01, mixed mode, sharing) I tried uninstalling this first, using below command: sudo apt-get remove openjdk-6-jdk It gave me the following result. ubuadmin@ubuserver3:~/JavaJars/HelloWordGPU$ sudo apt-get remove openjdk-6-jdk Reading package lists... Done Building dependency tree Reading state information... Done Package openjdk-6-jdk is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ubuadmin@ubuserver3:~/JavaJars/HelloWordGPU$ I also tried using sudo apt-get remove default-jdk but same. So how can I install Java 7?
has comment: http://stackoverflow.com/comment/33956099
tagged with: java
has answer: http://stackoverflow.com/a/22342633
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/20690143
tagged with: apt-get
tagged with: ubuntu
has title: Unable to install Java 6 and install 7
score: 0
tagged with: linux

http://stackoverflow.com/a/22384614
score: -1
has comment: http://stackoverflow.com/comment/34029511
upvote count: 0
has comment: http://stackoverflow.com/comment/34030343
has comment: http://stackoverflow.com/comment/34030282
has comment: http://stackoverflow.com/comment/34030031
type: Answer
has comment: http://stackoverflow.com/comment/34029283
answers question: http://stackoverflow.com/q/22384503
has comment: http://stackoverflow.com/comment/34029424
downvote count: 1
has comment: http://stackoverflow.com/comment/34029659
has comment: http://stackoverflow.com/comment/34078368
has comment: http://stackoverflow.com/comment/34030284
has body: The reason is just what the error message says: The Google App Engine apparently will not run your code with a JDK, but only a JRE. Your eclipse JRE/JDK settings do not matter here. They can't cause your deployment target to suddenly have a JDK installed. But since you use JDK features (like the compiler), your app will not run where only a JRE is installed. For a remedy, you can bundle the eclipse compiler ecj.jar (you'll find it somewhere in the internet or even via maven) with your application, and rewrite the part that compiles stuff accordingly.
has comment: http://stackoverflow.com/comment/34029266
has comment: http://stackoverflow.com/comment/34029350

http://stackoverflow.com/a/30399558
has body: I yesterday found I could solve this with Mockito (I didn't try powermock or easymock). Assuming your class is class C, my solution is: C c=spy(new C); doNothing().when(c).nativeInit(); c.androidMethod() verify(c).nativeInit(); This does, of course, require that nativeInit is visible to the test.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22447181

http://stackoverflow.com/comment/34192698
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22477844
has text: It does not work for me: I've tried with valid and invalid IPs, like 192.168.1.1 and 192.168.1. with first regex, also with correct and incorrect domain addresses like: -google.com and google.com with second regex. In which cases it should matches?

http://stackoverflow.com/q/22369868
score: 0
answer count: 1
has title: Sending mail of imap mail server through Spring?
tagged with: mail-sender
tagged with: spring
has body: Hi im using Spring framework to send the mail . I dont know about mail server settings. We are using mozilla thunderbird. I wrote a sample mail sending application in spring. I googled and came to a conclusion that we need a server host and port. i have set all those, But my problem is its getting the following exception. Exception in thread "main" org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: mail.supremecluster.com, port: 143, response: -1 at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:418) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:307) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:297) at com.javacodegeeks.spring.mail.MailService.sendMail(MailService.java:24) at com.javacodegeeks.spring.mail.MailServiceTest.main(MailServiceTest.java:14) Caused by: javax.mail.MessagingException: Could not connect to SMTP host: mail.supremecluster.com, port: 143, response: -1 at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1694) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:525) at javax.mail.Service.connect(Service.java:291) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:388) ... 4 more Spring.xml smtp true true true MailService public void sendMail(String from, String to, String subject, String body) { SimpleMailMessage message = new SimpleMailMessage(); message.setFrom(from); message.setTo(to); message.setSubject(subject); message.setText(body); mailSender.send(message); } public void sendAlertMail(String alert) { SimpleMailMessage mailMessage = new SimpleMailMessage(alertMailMessage); mailMessage.setText(alert); mailSender.send(mailMessage); } Mailltest public static void main(String[] args) { ApplicationContext context = new FileSystemXmlApplicationContext("conf/sprin…
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22371578
type: Question
has answer: http://stackoverflow.com/a/22371578

http://stackoverflow.com/a/22423774
has comment: http://stackoverflow.com/comment/34098092
accepted answer of: http://stackoverflow.com/q/22423536
answers question: http://stackoverflow.com/q/22423536
has comment: http://stackoverflow.com/comment/34099717
has body: i will going changing SelectTypeActivity into a dialog, if the only purpose of this activity is showing the different type of notes you can do a dialog over a dialog programatically like this (instead of going to SelectTypeActivity activity): Dialog dialog = new Dialog(this); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Select Color Mode"); ListView modeList = new ListView(this); String[] stringArray = new String[] { "Bright Mode", "Normal Mode" }; ArrayAdapter<String> modeAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, stringArray); modeList.setAdapter(modeAdapter); builder.setView(modeList); dialog = builder.create(); Then handling the onclick button with .setPositiveButton Check here for more details: How to click 'OK' on an AlertDialog via code? Obviusly you have to populate the modeList with your type of notes Hope i helped you :)
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/40627909
downvote count: 0
has body: JBIG2 images are handled by an optional extension, that probably it isn't supplied by you: Reading JBIG2 images: JBIG2 ImageIO or JBIG2-Image-Decoder Just load this dependency from Maven: com.levigo.jbig2 levigo-jbig2-imageio 1.6.5 More information here.
upvote count: 3
answers question: http://stackoverflow.com/q/22458667
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/128419937

http://stackoverflow.com/comment/33947578
has text: Post your Person class. My bet is that you've declares all its fields `static`.
score: 2
comment on: http://stackoverflow.com/q/22337347
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33961095
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22344952
has text: Perhaps there should be a line break which will break each line after there is a period.

http://stackoverflow.com/a/22419055
has comment: http://stackoverflow.com/comment/34090150
has comment: http://stackoverflow.com/comment/34090093
type: Answer
accepted answer of: http://stackoverflow.com/q/22419019
has comment: http://stackoverflow.com/comment/34090133
has comment: http://stackoverflow.com/comment/34090117
has comment: http://stackoverflow.com/comment/34090213
downvote count: 0
has comment: http://stackoverflow.com/comment/34090196
score: 7
has comment: http://stackoverflow.com/comment/34090186
has comment: http://stackoverflow.com/comment/34090130
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34090157
has comment: http://stackoverflow.com/comment/34090191
has body: One I declare a thread, and run something inside it - everything from that point on is going to run inside that thread, unless I explicitly create a new thread. No matter how many classes and methods the code passes through - it will stay in the same thread. Correct. In fact even if you create a new thread, current thread execution flow will never be changed. This new thread will start executing some time in the future after you started it, but its flow is independent from the thread that created it. which - and please correct me if I'm wrong - is exactly what I need most of the time with Swing You're wrong. You don't want to do everything in the EDT. Any data fetching and manipulation in the EDT will degrade your GUI reponsiveness. Say for example you want to fetch a lot of data from a DB. If you do so in the EDT, your GUI will freeze and the user will not be able to interact with it until you finish getting it (and probably manipulating it).
has comment: http://stackoverflow.com/comment/34090107
upvote count: 7
has comment: http://stackoverflow.com/comment/34090253
has comment: http://stackoverflow.com/comment/34090354
has comment: http://stackoverflow.com/comment/34090547
answers question: http://stackoverflow.com/q/22419019

http://stackoverflow.com/comment/34078609
has text: OK, so as @Pshemo mentions, you are missing imports
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22412400
type: Comment

http://stackoverflow.com/comment/34077256
score: 0
comment on: http://stackoverflow.com/q/22404463
type: Comment
type: QuestionComment
has text: I see. One of the only alternatives that I could think of would be an own implementation of Map (maybe extending AbstractMap) that internally stores *two* maps, a "forward" and a "backward" map, but have not thoroughly thought about this yet, and can imagine that this would bring no real benefit (despite the higher implementation effort)

http://stackoverflow.com/q/22420958
tagged with: java
tagged with: jax-ws
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22619717
has title: Do I need to instantiate new JAX-WS client if any exception occurs?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22619717
has body: I connect to web service like this: CalculatorService service = new CalculatorService(); Calculator client = service.getCalculatorPort(); ((BindingProvider) client).getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, 5000); ((BindingProvider) client).getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, 5000); Do I need to instantiate new JAX-WS client and set REQUEST_TIMEOUT, CONNECT_TIMEOUT if any exception occurs or I can reuse the same objects?
tagged with: web-services
type: Question

http://stackoverflow.com/comment/34124202
comment on: http://stackoverflow.com/a/22438244
type: Comment
has text: then he should use `Collections.min(Arrays.asList(dvdList))`, or use a List from the beginning.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22463777
has comment: http://stackoverflow.com/comment/34175950
has comment: http://stackoverflow.com/comment/34172029
has comment: http://stackoverflow.com/comment/34168903
upvote count: 7
has title: Given a number check if digits form an equation with addition?
has comment: http://stackoverflow.com/comment/34171990
downvote count: 1
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/34172166
has answer: http://stackoverflow.com/a/22464639
has comment: http://stackoverflow.com/comment/34170223
score: 6
has answer: http://stackoverflow.com/a/22464581
answer count: 3
has comment: http://stackoverflow.com/comment/34212926
possible better answer: http://stackoverflow.com/a/22464581
has comment: http://stackoverflow.com/comment/34168945
favorite count: 0
has comment: http://stackoverflow.com/comment/34168983
has comment: http://stackoverflow.com/comment/34169142
has comment: http://stackoverflow.com/comment/34169062
has comment: http://stackoverflow.com/comment/34171980
accepted answer: http://stackoverflow.com/a/22464639
tagged with: c++
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34169233
has answer: http://stackoverflow.com/a/22465085
has comment: http://stackoverflow.com/comment/34171266
tagged with: math
tagged with: java
has body: Given a string S, I want to find out whether there are non-overlapping substrings A, B and C in S, so that the equation A + B = C holds when the substrings are interpreted as decimal numbers. Example: For S = 17512, the answer is yes, because 12 + 5 = 17 holds. This is not a homework question, I have tried approaching this problem building a suffix array 17512 7512 512 12 2 but then I realize that given 132, 1 + 2 = 3 Would require other forms of permutations in selection? How do you solve this in an efficient way?
has comment: http://stackoverflow.com/comment/34180987

http://stackoverflow.com/a/22472564
has body: You should call the FileName() method in the constructor of the JFrame.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22424491

http://stackoverflow.com/comment/34579073
type: AnswerComment
comment on: http://stackoverflow.com/a/22486690
score: 0
type: Comment
has text: It has two tables and two fields. E(id, S_value) S(value). The extra table is part of a compromise this approach makes. In principle you can delete rows from the sequence table after insert if you do not have an FK constraint on the table. However it's probably not worth the effort.

http://stackoverflow.com/comment/34199457
score: 2
has text: @Marko If you have a better answer, please post it and I'll be happy to vote it up for you. But I don't think it's in the interest of the community to have an identical question answered differently in two places on this site. If the dupe is wrong, you should explain why there. Either way, this is a duplicate, according to the principles of stack exchange as I understand them.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22480749

http://stackoverflow.com/a/22400015
score: 0
has comment: http://stackoverflow.com/comment/34069117
has body: Are you sure that twitter.txt is on your classpath and you're not getting a FileNotFoundException? You might want to check that first. If the FileReader can't find your file, no nodes and relationships will be created. Although I'm not really sure why your example does not work, I do have a couple of suggestions. First of all, I'd get rid of the "id" property as it's very confusing. Every node already has an id so you'd want to change the property name to something else. Second of all, since you are clearly using java 7, you can make use of the AutoClosable interface of FileReader and BufferedReader as well. When I run the JavaQuery class, I do get the expected results. It's again really strange that your experiencing different behavior. Why don't you try the simplest example of them all? See what output you get from the following script: public class TestNeo4j { public static void main(String[] args) throws Exception { final GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase("db"); final Transaction tx = graphDb.beginTx(); final Node node = graphDb.createNode(); node.setProperty("test", "test"); tx.success(); tx.close(); final ExecutionEngine engine = new ExecutionEngine(graphDb); System.out.println(engine.execute("START n=node(*) RETURN id(n), n.test").dumpToString()); graphDb.shutdown(); } } Your output should be similar to: +----------------+ | id(n) | n.test | +----------------+ | 0 | "test" | +----------------+ 1 row Let me know your results. EDIT: If you want to create unique nodes (or paths), use Cyphers MERGE command. It can create unique nodes and/or full paths. An example: MERGE (tweep1:Tweep{user: "twitter_account"}) MERGE (tweep1)-[:FOLLOWS]-&gt;(tweep2:Tweep{user: "another_account"}) This will create or use node "tweep1" if there is already a matching node. That node will be used to create a relationship to node "tweep2". Does this more or less answer your question?
has comment: http://stackoverflow.com/comment/34069331
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34069594
accepted answer of: http://stackoverflow.com/q/22396999
type: Answer
answers question: http://stackoverflow.com/q/22396999

http://stackoverflow.com/comment/34141217
comment on: http://stackoverflow.com/a/22447453
type: AnswerComment
has text: OP asked for *better* and *more efficient* solutions, and the provided answers are less efficient. Whether they are *better* is a matter of opinion, I think. Personally, I prefer readable code to overcomplicated code.
type: Comment
score: 1

http://stackoverflow.com/comment/33965173
type: Comment
comment on: http://stackoverflow.com/q/22345235
has text: "*if you try to insert a row with a missing column which is set to NOT NULL*" so what do you expect? If you are trying to insert NULL (which is what "a missing column" means) then Postgres will (and should) reject that insert. You need to create a correct INSERT statements providing values for all NOT NULL columns (btw: it's Postgres, not Postgre)
score: 0
type: QuestionComment

http://stackoverflow.com/q/22338012
has title: Monitor All Android Devices events remotely
answer count: 1
has body: In Android, I can monitor if certain events are triggered through the use of Broadcast Receivers. Are there any tools which let me view ALL events on an android device I am debugging instead of having to add a broadcast receiver to listen to them? For example, in a Broadcast receiver, I can monitor for a call forwarding event. Is there a way to debug such events outside of having to write additional Android code? My goal is to test that certain events are triggered after UI state changes, and I am not seeing anything obvious in Logcat that communicates which events are being fired. For example, with call forwarding I only see cases like below in Logcat. START u0 {act=android.intent.action.MAIN cmp=com.android.phone/.GsmUmtsCallForwardOptions}
accepted answer: http://stackoverflow.com/a/22338323
linked to: http://stackoverflow.com/q/6257927
favorite count: 0
tagged with: android
tagged with: remote-debugging
type: AnsweredQuestion
tagged with: java
type: Question
score: 9
tagged with: debugging
has answer: http://stackoverflow.com/a/22338323
upvote count: 9
downvote count: 0

http://stackoverflow.com/q/22382237
answer count: 1
has body: As per the API of iText, it is mentioned that we can set the height of the barcode using the method public void setBarHeight(float barHeight), but it is not mentioned what is the measurement (unit) of the height. I need to have the barcode of height 25mm; so what should be the value passed to the mentioned method?
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has title: How to set the height of the barcode as 25mm
score: 1
tagged with: java
tagged with: itext
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/22384087

maven-eclipse-plugin
tag name: maven-eclipse-plugin
type: Tag
tags question: http://stackoverflow.com/q/22399145

http://stackoverflow.com/q/22369406
has answer: http://stackoverflow.com/a/22369472
has comment: http://stackoverflow.com/comment/34003769
has body: Looking to create the star of david: How would I go about this in java? Very confused on this.
type: UnansweredQuestion
score: -8
upvote count: 1
has title: Drawing a "star of david" shape
tagged with: java
tagged with: image
has comment: http://stackoverflow.com/comment/34003761
type: Question
answer count: 2
downvote count: 9
favorite count: 0
has answer: http://stackoverflow.com/a/22369543

http://stackoverflow.com/q/22336895
has title: How can I make ExpandableListView not selectable?
has answer: http://stackoverflow.com/a/22355807
score: 0
has answer: http://stackoverflow.com/a/22337233
tagged with: android-listview
accepted answer: http://stackoverflow.com/a/30507819
has answer: http://stackoverflow.com/a/22337185
possible better answer: http://stackoverflow.com/a/22355807
answer count: 4
tagged with: android
has body: I have a expandable list view with all the list already expanded. I don't want the user to be able to selected any parent items (group items). I have made it so that clicking it will not collapse the list, but cannot figure out how to make the item un-selectable.
tagged with: expandablelistview
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/5126581
has answer: http://stackoverflow.com/a/30507819
type: Question
has comment: http://stackoverflow.com/comment/33967142
has comment: http://stackoverflow.com/comment/33979138

http://stackoverflow.com/comment/34025748
has text: Definitely. String is also an object.
score: 0
comment on: http://stackoverflow.com/a/22382669
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34150522
type: AnswerComment
type: Comment
score: 1
has text: Because you never initialize it - no code branch where it is initialized got executed.
comment on: http://stackoverflow.com/a/22448735

http://stackoverflow.com/comment/34160529
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22458838
has text: Please give an example of how you expect to refer to `getIdentity` in a static context
score: 0

http://stackoverflow.com/comment/33980188
comment on: http://stackoverflow.com/q/22347445
has text: I use blending, actually i have a 100*100 block map with 4 block tall walls. I have only the edge walls + 1 wall through the whole map in z-direction and 1 hole inside (to go through). So there are about 1000 rects (as a maximum, depending on my position and direction cause of frustum culling). All the rects have a 128*128 px texture on them. I wanted to group them, but i was not able to repeat the `Texture`s then (see my other question (http://stackoverflow.com/questions/21908241/repeating-textures-on-a-model/22297242#22297242))
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/71643538
type: Comment
has text: Even though that line is not required its very helpful to know if the driver is correctly loaded.
comment on: http://stackoverflow.com/a/22384781
type: AnswerComment
score: 0

http://stackoverflow.com/q/22464082
type: UnansweredQuestion
tagged with: jsoup
has body: I am building a desktop client for a university that allows them to create a dashboard of all of their power supplies on campus. The technology is already in place and the company has provided a website to view all of this but you can only view one at a time which becomes very annoying. My job is to design a desktop application which makes them log in with the correct credentials and then shows everything at once. My problem is, I want to take whatever username and password they enter and enter it into a website. Here is the code I am working with on their website: &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;Log On&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;meta http-equiv="Expires" content="-1"&gt; &lt;meta http-equiv="Pragma" content="no-cache"&gt; &lt;meta http-equiv="Cache-Control" content="no-cache"&gt; &lt;link href="core.css" rel="stylesheet" type="text/css" /&gt; &lt;script type="text/javascript"&gt; function placeFocus() { if (document.forms.length &gt; 0) { var field = document.forms[0]; for (i = 0; i &lt; field.length; i++) { if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea")) { document.forms[0].elements[i].focus(); break; } } } } &lt;/script&gt; &lt;/head&gt; &lt;body OnLoad="placeFocus()"&gt; &lt;table cellpadding="0" cellspacing="0" id="message"&gt; &lt;tr&gt; &lt;td class="edging"&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr&gt; &lt;td class="msg"&gt; &lt;form method="post" action="/Forms/login1" name="HashForm1"&gt; &lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr&gt; &lt;td width="27%" class="dataName" noWrap&gt;&lt;span id="langUsername"&gt;User Name&lt;/span&gt;:&amp;nbsp; &lt;/td&gt; &lt;td width="73%"&gt;&lt;input type="text" name="login_username…
type: Question
has answer: http://stackoverflow.com/a/22464423
tagged with: http://stackoverflow.com/tag/html
tagged with: jframe
score: 0
has title: putting username and password into specific tags online
answer count: 1
tagged with: java

http://stackoverflow.com/comment/34012310
score: 0
type: Comment
has text: I get that `EntrySet` can access any structure in `HashMap` class. I see the code, but can you please detail the linkage between this view and the internal objects mapped in `table`? Or are you saying that the assignment of a new `HashMapEntry` to `table[index]` is automatically reflected into the `entrySet` field. How?
comment on: http://stackoverflow.com/a/22374051
type: AnswerComment

http://stackoverflow.com/a/22365708
upvote count: 1
has body: Step 1) Just change this : c.add(a); c.add(b); to this : c.addAll(a); c.addAll(b); PS : Next time you post question, please copy the error message, statement "keep getting into errors" is facepalm statement in programming community :). Step 2) Add line to the top : import java.util.ArrayList; Step 3) Download netbeans, it is very user-friendly and it helps you solve errors by "tip" or even solving dependencies (like imports) for you.
has comment: http://stackoverflow.com/comment/33997691
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22365669
type: Answer
accepted answer of: http://stackoverflow.com/q/22365669

http://stackoverflow.com/comment/33985672
type: Comment
type: QuestionComment
score: 1
has text: @Fallenreaper: Your bet is not correct: `Math.sqrt()` returns a `double`.
comment on: http://stackoverflow.com/q/22359226

http://stackoverflow.com/comment/34056412
has text: Set itself is a collection which cannot holds duplicate elements. http://www.tutorialspoint.com/java/java_set_interface.htm
type: AnswerComment
comment on: http://stackoverflow.com/a/22400095
type: Comment
score: 2

http://stackoverflow.com/comment/34093393
has text: Of course that problem can be completely avoided if the creating thread creates the reference *then* assigns myCard to equal that reference.
comment on: http://stackoverflow.com/q/22420988
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22413881
accepted answer of: http://stackoverflow.com/q/22413625
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34081319
has body: Cause Thrift by design doesn't allow for null results. This is the code of the generated recv_Xxx() function: public List&lt;Integer&gt; recv_getEntityByIP() throws org.apache.thrift.TException { getEntityByIP_result result = new getEntityByIP_result(); receiveBase(result, "getEntityByIP"); if (result.isSetSuccess()) { return result.success; } throw new org.apache.thrift.TApplicationException( org.apache.thrift.TApplicationException.MISSING_RESULT, "getEntityByIP failed: unknown result"); } You have to return a valid result, which is ... a valid list, which may be empty, but must not be null an exception thrown on the server Solution Remove the return null from your finally clause. Best practice Put the result into an object, similar to what you already did with the args: struct EntityByIP_result { 1: list&lt;i32&gt; data; } This way you also leave room for further improvements down the road, you can add new fields to the struct at any time.
upvote count: 3
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34080773
has comment: http://stackoverflow.com/comment/34081126
answers question: http://stackoverflow.com/q/22413625
score: 3

http://stackoverflow.com/q/22408284
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34070198
has title: What means an '!' at eclipse?
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/34070220
has answer: http://stackoverflow.com/a/22408412
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22408422
has answer: http://stackoverflow.com/a/22408614
downvote count: 10
score: -10
has comment: http://stackoverflow.com/comment/34070178
has comment: http://stackoverflow.com/comment/34070417
upvote count: 0
linked to: http://stackoverflow.com/q/1561336
has comment: http://stackoverflow.com/comment/34070176
type: Question
has body: I'm programming in Java with Eclipse, and after a time appears a '!' in some class. What's that means?

http://stackoverflow.com/comment/80117284
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22445304
has text: @amaurycrickx: are we not suppose to implement 'Recongnito' on server and then send voice files collected from mobile to server for authentication???

http://stackoverflow.com/q/22467899
has body: Currently using Parse to obtain a date on an object by using: Date date = object.getCreatedAt(); The returned String when displaying it in a TextView is this: Mon Mar 17 22:39:27 CET 2014 However I really only want the MM/DD/YYYY to display like so: 3/17/2014 I've tried this: Date date = object.getCreatedAt(); SimpleDateFormat originalFormat = new SimpleDateFormat("MMM DDD yyyy"); try { Date originaldate = originalFormat.parse(date.toString()); finalDate = originaldate.toString(); } catch (java.text.ParseException e1) { e1.printStackTrace(); } but keep getting a ParseException for "Unparseable date", any idea what's going on? If I were to simply change this line back to this: SimpleDateFormat originalFormat = new SimpleDateFormat("EEE MMM DDD HH:mm:ss z yyyy"); Then it prints out the full date again just fine with no parse exception, including all the date stuff I don't want.
tagged with: date
has comment: http://stackoverflow.com/comment/34176496
has comment: http://stackoverflow.com/comment/34176425
answer count: 2
has title: Formatting Date from Date Object with only MM/DD/YYYY
accepted answer: http://stackoverflow.com/a/22468085
tagged with: parsing
possible better answer: http://stackoverflow.com/a/22467953
tagged with: parse-platform
has answer: http://stackoverflow.com/a/22467953
tagged with: android
has comment: http://stackoverflow.com/comment/34176458
has comment: http://stackoverflow.com/comment/34176518
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34176462
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22468085
type: Question
has comment: http://stackoverflow.com/comment/34176406

http://stackoverflow.com/comment/34126155
score: 1
type: QuestionComment
has text: even though it would not be the answer to your particular question, I would rather use Predicates for this purpose http://stackoverflow.com/questions/2312849/filter-and-sort-list-using-google-collections
type: Comment
comment on: http://stackoverflow.com/q/22439591

http://stackoverflow.com/comment/34020241
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22378943
has text: @Shriram i try to post server just a minute...

atomicinteger
tag name: atomicinteger
tags question: http://stackoverflow.com/q/22329304
type: Tag

http://stackoverflow.com/a/22408137
answers question: http://stackoverflow.com/q/22402431
type: Answer
downvote count: 0
score: 1
has body: As I said before: are you sure that the server have sent the data to the client - there is no buffer flush so it can still be cached. out.flush() will make sure that buffer is flushed. It will make sense to handle clients separately and send them periodic messages to update them about the status. It is useful for your server code to handle the client disconnect/connection drop too. On the side note: message = new NetworkOffer(); out.writeObject(buyer_offer); Your code seems to be sending something else that is not present in your example. Is that correct?
upvote count: 1

http://stackoverflow.com/q/22475670
favorite count: 0
has comment: http://stackoverflow.com/comment/39928288
type: UnansweredQuestion
tagged with: android
has body: I am developing a chat application in which I want to add smiley support to it. But I am not being able to use it. I have gone through many codes but the symbols are not changing to smileys. Here is my code... private static final Factory spannableFactory = Spannable.Factory .getInstance(); private static final Map&lt;Pattern, Integer&gt; emoticons = new HashMap&lt;Pattern, Integer&gt;(); static { addPattern(emoticons, ":)", R.drawable.emo_im_happy); addPattern(emoticons, ":-)", R.drawable.emo_im_happy); // ... } private static void addPattern(Map&lt;Pattern, Integer&gt; map, String smile, int resource) { map.put(Pattern.compile(Pattern.quote(smile)), resource); } protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.messaging_screen); // messaging_screen); messageHistoryText = (EditText) findViewById(R.id.messageHistory); messageText = (EditText) findViewById(R.id.message); messageText.requestFocus(); sendMessageButton = (Button) findViewById(R.id.sendMessageButton); } public void appendToMessageHistory(String paramString1, String paramString2) { if ((paramString1 != null) &amp;&amp; (paramString2 != null)) { if (paramString1.toString().equals(this.friend.userName.toString())) { appendColoredText(this.messageHistoryText,paramString1 + ":\n", Layout.Alignment.ALIGN_NORMAL,-16711936); appendColoredText(this.messageHistoryText, getSmiledText(this, paramString2) + "\n", Layout.Alignment.ALIGN_NORMAL, -16711936); } else { appendColoredText(this.messageHistoryText, "you:\n",Layout.Alignment.ALIGN_OPPOSITE, -65536); appendColoredText(this.messageHistoryText, getSmiledText(this, paramString2) + "\n",Layout.Alignment.ALIGN_OPPOSITE, -65536); } } } public static boolean addSmiles(Context context, Spannable spannable) { boolean hasChanges = false; for (Entry&lt;Pattern, Integer&gt; entry : emoticons.entrySet()) { Matcher matcher = entry.getKey().matcher(spannable); while (matcher.fin…
linked to: http://stackoverflow.com/q/3341702
score: 3
has comment: http://stackoverflow.com/comment/34190009
answer count: 0
upvote count: 3
tagged with: java
type: Question
has title: How to add smileys to chat in android
downvote count: 0
has comment: http://stackoverflow.com/comment/34190075

http://stackoverflow.com/q/22364849
tagged with: opengl
score: 1
tagged with: java
tagged with: lwjgl
has title: Transparency issue with opengl/lwjgl
has comment: http://stackoverflow.com/comment/33996991
has comment: http://stackoverflow.com/comment/33996255
has body: I am attempting to draw two textures to 3D space that containing transparency. When they do not overlap they work fine: However when one texture overlaps the other the the transparency means that you can see through the one behind: I use GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA when initialising blending.
type: Question
has comment: http://stackoverflow.com/comment/34076883
has answer: http://stackoverflow.com/a/23661851
answer count: 2
has comment: http://stackoverflow.com/comment/33996196
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22463533
upvote count: 1

http://stackoverflow.com/a/22376079
accepted answer of: http://stackoverflow.com/q/22376022
score: 12
answers question: http://stackoverflow.com/q/22376022
upvote count: 12
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/55372273
type: Answer
has body: If you just want to compare the date part, you can do it like so: LocalDate startDate = new LocalDate(2014, 1, 2); LocalDateTime startDateTime = new LocalDateTime(2014, 1, 2, 14, 0); LocalDate forCompare = startDateTime.toLocalDate(); System.out.println("equal dates: " + forCompare.equals(startDate)); // equal dates: true docs
has comment: http://stackoverflow.com/comment/34015082

http://stackoverflow.com/comment/33997717
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22363388
has text: public void dragRel(Point relative) throws UiObjectNotFoundException { Point realCoord = new Point(); realCoord.x = relative.x * getBounds().width(); realCoord.y = relative.y * getBounds().height(); dragPix(realCoord); }
score: 0

http://stackoverflow.com/comment/34000272
type: QuestionComment
type: Comment
has text: Oh, yes. You probably need to get people to update manually.
comment on: http://stackoverflow.com/q/22366893
score: 0

service
tags question: http://stackoverflow.com/q/22388066
tag name: service
tags question: http://stackoverflow.com/q/22402063
tags question: http://stackoverflow.com/q/22406194
tags question: http://stackoverflow.com/q/22452956
tags question: http://stackoverflow.com/q/22392732
tags question: http://stackoverflow.com/q/22477777
type: Tag
tags question: http://stackoverflow.com/q/22346539

http://stackoverflow.com/q/22341252
has body: I have been trying to get logging to work with a basic configuration via log4j2.xml, in a Spring project. Tried for two days with no luck. The project seems to ignore my log4j2.xml file and pick up the default configuration. This is what I have been doing: Created log4j2.xml and added it to the class path. Configuration given below. Ensured that this xml file is part of the Deployment Assembly, hoping that it gets picked up Unzipped the war file generated to see if the file is being added as part of the deployment... and yes it was. None helped. I looked up several postings to such problems on StackOverflow but most of it mentioned that all we have to do is add the file to classpath. But in my case, only the default configuration is what I see as being active, when I run the app. To be precise, though the below config says "info", the statement log.info("Inside foo()"); doesn't print the message. When I step in, I see that Info level logs are not enabled. Any help will be greatly appreciated. ================== log4j2.xml <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="[%d{ISO8601}] [%t] %-5p %c{6} - %msg%n"/> <PatternLayout pattern="[%d{ISO8601}] [%t] %-5p %c{6} - %msg%n"/> <appender-ref ref="Console"/> <appender-ref ref="File"/> <appender-ref ref="Console"/> Dependencies in my gradle build script: def tomcatVersion = '7.0.42' tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}", "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}" tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") { exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj' } compile group: 'commons-collections', name: 'commons-collections', version: '3.2' compile group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version:'1.0.3' //compile group: 'com.yammer.metrics', name: 'metrics-core', version:'2.2.0' compile 'org.springframework:spring-core:3.2.3.RELEASE' compile 'org.springframework:spring-webmvc:3.2.3.RELEASE'…
tagged with: configuration
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/33956432
has comment: http://stackoverflow.com/comment/33999444
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22371380
has title: log4j2.xml not being picked up by STS
favorite count: 0
has comment: http://stackoverflow.com/comment/33999299
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22371380
upvote count: 7
tagged with: log4j2
tagged with: logging
type: Question

http://stackoverflow.com/q/22423520
has title: Boolean to custom string converter in JSF
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34097388
linked to: http://stackoverflow.com/q/5706513
tagged with: jsf
has body: I have a requirement that all boolean fields should be saved in database as "Y" and "F" values. In my form I'm using primefaces &lt;p:selectBooleanCheckbox&gt; for retrieving boolean input: &lt;h:outputLabel for="termsOfUseAck" value="#{msg['user_sign_up.terms_of_use_ack']}" /&gt; &lt;p:selectBooleanCheckbox id="termsOfUseAck" value="#{accountRegistrationController.account.termsOfUseAck}" converter="booleanToYNConverter" /&gt; and my converter is defined as follows: @FacesConverter(value="booleanToYNConverter") public class BooleanToYNConverter implements Converter { public BooleanToYNConverter() { } public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String param) { try { Boolean result = Boolean.parseBoolean(param); System.out.println("#BooleanToYNConverter.getAsObject param is: " + param); return result; } catch (Exception exception) { throw new ConverterException(exception); } } public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object obj) { try { if ((obj != null) &amp;&amp; ((Boolean) obj)) { System.out.println("#BooleanToYNConverter.getAsString returns Y"); return "Y"; } else { System.out.println("#BooleanToYNConverter.getAsString returns N"); return "N"; } } catch (Exception exception) { throw new ConverterException(exception); } } } In console I can see that converter is called and it returns single character: #BooleanToYNConverter.getAsString returns Y But unfortunately in the end accountRegistrationController.account.termsOfUseAck is set to true or false values instead of desired Y or N. What am I doing wroing?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22424784
has comment: http://stackoverflow.com/comment/34099436
tagged with: primefaces
tagged with: jsf-2
score: 0
has comment: http://stackoverflow.com/comment/34097650
tagged with: converters
answer count: 1

http://stackoverflow.com/comment/34205956
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22485199
score: 0
has text: In your shoes, I'd focus first on getting something that works. Only after that, I'd try to extract interfaces or reorganize the code to use interfaces. One step at a time.

http://stackoverflow.com/comment/33994410
type: Comment
comment on: http://stackoverflow.com/a/22363598
has text: That's great - thanks Cedric! Are 'newReport' 'reportActivity' variables you've defined elsewhere in your code? If so how have you initialised them? I'm getting a red line under both of them :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34049094
type: QuestionComment
comment on: http://stackoverflow.com/q/22395533
has text: The value of B2 arrays will always fall within 0 to 1 . Why ?
score: 0
type: Comment

http://stackoverflow.com/comment/34133178
has text: using static references to Context is strongly discouraged, it prevents the GC to recycle this memory, and any context keeps references to all the application resources, so in case you exit the application it will keep a reference to this object. (more info here http://android-developers.blogspot.com.es/2009/01/avoiding-memory-leaks.html)
type: Comment
comment on: http://stackoverflow.com/a/22440258
type: AnswerComment
score: 0

computer-science
tags question: http://stackoverflow.com/q/22369227
tags question: http://stackoverflow.com/q/22355961
type: Tag
tag name: computer-science

http://stackoverflow.com/comment/34040184
has text: Your question is quite long & HMM is a pretty specialized topic. You could probably improve your chance for answers if you trim the question down to the essentials and / or split it into several smaller questions since you combine quite a bit in here. E.g. "figure out how to set the initial Opdfs" (whatever that is) is probably a question you could separate.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22389552
score: 0

http://stackoverflow.com/comment/34079799
type: Comment
type: QuestionComment
has text: What's wrong with good 'ol `String.replace`? No need for Regex here. http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replace(char, char)
score: 7
comment on: http://stackoverflow.com/q/22413347

http://stackoverflow.com/comment/33949556
type: Comment
score: 0
type: AnswerComment
has text: @mttdbrd Are you saying that if I change all of the monthName's to m and change monthName = editMonth(monthName) to monthName = editMonth(m) it will not fix my program?
comment on: http://stackoverflow.com/a/22338380

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/22366204
type: Tag

http://stackoverflow.com/a/22451244
downvote count: 0
type: Answer
has body: It all depends on the context. Let's say you have a Library class that contains a List&lt;Book&gt;. You would want the List to be an instance variable since each library should have its own books. If you made the List&lt;Book&gt; static each instance of library would share the same List, which would be incorrect since libraries can have different books. But let's say you had a class FootballTeam which contains a List&lt;Position&gt;. Since each Football team has the same positions this class could be shared amongst all instances of FootballTeam since one team's positions will not differ from anothers. So it really depends on what is being placed within the List. Are the values stored in the List specific to a particular instance of a class? If so, they should not be static. Are the values common across of instances of a particular type? If so they could be static.
upvote count: 1
has comment: http://stackoverflow.com/comment/34148072
score: 1
answers question: http://stackoverflow.com/q/22451092

http://stackoverflow.com/comment/39771658
type: AnswerComment
comment on: http://stackoverflow.com/a/25473563
has text: Ah, I see. I added a link to this question to the comment section of `HHH-9042` so that we can update this here once the issue is closed. Also, it's good to know that it is an 'official' bug that is considered open by the Hibernate Envers team.
type: Comment
score: 0

http://stackoverflow.com/comment/34093268
has text: Null reference will not make any impact to hibernate engine.You simply delete the parent alone without using cascading...
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22420495

http://stackoverflow.com/comment/34061308
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22403083
has text: Err... localhost is the name of the machine your database is on.
type: Comment

http://stackoverflow.com/comment/33999206
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22366525
type: Comment
has text: truncate what?The element doesn't get added

http://stackoverflow.com/q/22421669
tagged with: python-2.7
has answer: http://stackoverflow.com/a/22421894
answer count: 1
tagged with: bufferedreader
tagged with: postgresql
tagged with: processbuilder
has body: Hi i just create a java application to run my python code externally. But it want giving me the out put. this is my java code:- package com.epatient; import java.io.*; public class InterpreterExample { //static String workingDir = System.getProperty("user.dir"); //static String appDir = workingDir + "\\epatient\\epatient_prediction.py"; public static void main(String a[]){ try{ String appDir = "C:\\Users\\Thushara Kasun\\Documents\\juno\\serial.port\\epatient\\epatient_prediction.py"; System.out.println(appDir); ProcessBuilder pb = new ProcessBuilder("python",appDir); Process p = pb.start(); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String ret = in.readLine(); System.out.println("value is : "+ret); }catch(NumberFormatException e){e.printStackTrace();} catch (IOException e) {e.printStackTrace();} } } this is my python code :- import sys from sklearn.externals import joblib import pandas as pd import numpy as np import csv from sklearn.decomposition import PCA import re import psycopg2 import datetime import time con = None bio_data = None heart_rate = None so2_data = None temp_data = None bp_data = None try: con = psycopg2.connect(database='Epatient_user_1', user='postgres', password='root') cur = con.cursor() ...#database access codes omited model_name = 'trained_model' est = joblib.load(model_name) predictions = est.predict(data) #predictions # &lt;codecell&gt; #sys.stdout.write(str(int(predictions[0]))) #sys.stdout.flush() #print int(predictions[0]) ts = time.time() st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') #print st cur.execute('INSERT INTO patient_status (STATUS,TIME,PROCESSED) VALUES (' + str(int(predictions[0])) + ',\''+ st + '\',0);') con.commit() except psycopg2.DatabaseError, e: print 'Error %s' % e sys.exit(1) finally: if con: con.close() sys.stdout.write(str(int(predictions[0]))) sys.stdout.flush() #print int(predictions[0]) Java out put is just value is : null there is no problem with …
downvote count: 1
favorite count: 0
upvote count: 0
has title: External python application is not running
has comment: http://stackoverflow.com/comment/34114716
has comment: http://stackoverflow.com/comment/34096781
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22421894
tagged with: java
score: -1
type: Question

http://stackoverflow.com/comment/34168436
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22463538
has text: Do you have to use a 2d array? I would make an object, with an int called key and an arraylist called value. That way you have an arraylist of objects and if you match a key then add the value
type: Comment

http://stackoverflow.com/a/63285937
has body: Make use of Jackson JSON Parser ObjectMapper mapper = new ObjectMapper(); Map&lt;String,Object&gt; map = mapper.readValue(inputStreamObject,Map.class); If you want specifically a JSONObject then you can convert the map JSONObject json = new JSONObject(map); Refer this for the usage of JSONObject constructor http://stleary.github.io/JSON-java/index.html
answers question: http://stackoverflow.com/q/22461663
type: Answer
upvote count: 2
downvote count: 1
score: 1

http://stackoverflow.com/q/22390563
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22390643
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/22390916
has comment: http://stackoverflow.com/comment/34040187
has title: Drawing a diagonal line?
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/34040293
has body: I'm new to Java and need help drawing a diagonal line. I want it to go from the bottom left of a box to the top centre. The dimensions of the box are user entered so I would prefer it to be something like width/2 etc. so it always works. How would I go about creating this line?
type: Question
answer count: 2

http://stackoverflow.com/comment/34022237
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22369033
has text: The java plugin wants sources in `src\main\java`, the groovy plugin in `src\main\groovy` isn't that just the problem, that both of the plugins are specified?
score: 0

http://stackoverflow.com/a/22485668
has comment: http://stackoverflow.com/comment/34207092
has comment: http://stackoverflow.com/comment/34206877
type: Answer
has body: On the second line of display(boolean, int), you are attempting to compare a boolean with the = operator. This sets digits to false I think you meant to say: if (digits == false) An if statement needs a boolean for input, i.e. if(bool). You don't need to check if this is true or false like if(bool == true) because bool == true always evaluates to equal bool. Saying bool == true is completely redundant. However, you bool == false always evaluates to the opposite of bool. The ! operator flips the value of the following boolean, e.g. !true evaluates to false. !bool therefore always evaluates to the opposite of bool, and is the same as bool == false. Therefore, you only need: if (!digits) It is also considered good practice to do it this way. Another way to make your code even shorter is by using the ternary operator. This isn't necessarily the best thing to do, but I personally like doing it this way: Replace if (digits = false) JOptionPane.showMessageDialog(null, num + " is a palindrome"); else JOptionPane.showMessageDialog(null, num + " is not a palindrome"); with JOptionPane.showMessageDialog(null, num + " is " + (digits ? "not " : "") + "a palindrome"); For more about the ternary operator, see these pages: How does the ternary operator work? How do I use the conditional operator? http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html Another thing to note is that you don't need to process the input as an integer, because you never use the number in arithmetic statements; you only compare the digits of the number to each other. In this working code, I processed it as a string, so it is much shorter: import javax.swing.*; class Palindrome { public static void main(String args[]) { display(); } /** * Returns a five-digit string */ public static String retrieveInput() { String number = JOptionPane.showInputDialog("Enter A Five Digit Number:"); //get input while(number.length() != 5) //continue to get input while it is not five digits { JOptionPane.showMessag…
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22485508
has comment: http://stackoverflow.com/comment/34206859
upvote count: 2
answers question: http://stackoverflow.com/q/22485508
type: AcceptedAnswer

http://stackoverflow.com/comment/34185726
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22473713
has text: The problem is the way you read data from the server; you probably fail to specify the correct encoding. Code?

http://stackoverflow.com/comment/63194848
type: AnswerComment
comment on: http://stackoverflow.com/a/22490185
type: Comment
has text: @tarunkumar : Yes, it does support .property files, but it's not the same syntax as Log4j v1, as explained in Log4j v2 documentation (that's what I indicated at the beginning of my answer). I will add a comment on the other Answer just in case
score: 0

http://stackoverflow.com/comment/34085865
score: 0
has text: +1 for official JavaDoc reference and explaining *why*.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22416813

http://stackoverflow.com/comment/34205278
has text: @ohtph, I can't debug your code. If you are getting Exceptions then that means you haven't created the JTable and added the TableModel to the table yet. The basic answer it the TableColumn contains the value that is displayed on the frame. Read the JTable API and follow the link to the Swing tutorial on `How to Use Tables`. Download the example code from there and try the changes I have suggested to prove to yourself that the concept works. Then figure out what you are doing wrong with your own code.
comment on: http://stackoverflow.com/a/22482543
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33998108
score: 0
comment on: http://stackoverflow.com/q/22365938
type: Comment
type: QuestionComment
has text: Either make the class static - `public static class linkedList{` or move it outside.

probe
tags question: http://stackoverflow.com/q/22350161
type: Tag
tag name: probe

http://stackoverflow.com/comment/34010479
type: AnswerComment
type: Comment
has text: Actually as you are using Neo4j 2.0 stay away from using start n=node(*) just create an index for `:City(city)` and do `MATCH (city:City {city:{city_name})<-[:LIVES_IN]-(person) return person.name`
comment on: http://stackoverflow.com/a/22373070
score: 0

http://stackoverflow.com/comment/34048127
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22395047
has text: ok, thanks. I have just added filter for the extension as well.

http://stackoverflow.com/comment/34160225
has text: @DavidConrad "What's the difference between next() and nextLine() methods from Scanner class?"
type: AnswerComment
comment on: http://stackoverflow.com/a/22458766
type: Comment
score: 7

http://stackoverflow.com/q/22335568
upvote count: 0
tagged with: permutation
accepted answer: http://stackoverflow.com/a/22335688
favorite count: 0
has title: Generate one to five character length string consisting of a-z and 0-9
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22335638
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22335638
has answer: http://stackoverflow.com/a/22335688
score: -1
has body: I'd like to generate all possible strings, from length 1 to length 5, consisting of the characters a-z and 0-9. I've found snippets of code that can probably help me, but I am stuck on modifying them to achieve what I need. This bit of code I found on SO will produce all possible string combinations of length 4 using a-z and 0-9, 1679616 strings. public static void generate(){ int MAX = 36; long count = 1L * MAX * MAX * MAX * MAX; int counter = 0; char[] alphabet = "0123456789abcdefghijklmnopqrstuvwxyz".toCharArray(); int[] digits = new int[4]; char[] output = "0000".toCharArray(); for (int i= 0; i &lt; count; i++){ String name = String.valueOf(output); for(int d = 3; d &gt;=0; --d){ digits[d] = (digits[d] + 1) % MAX; output[d] = alphabet[digits[d]]; if (digits[d] &gt; 0){ break; } } counter++; System.out.println(name); } System.out.println(counter); } Now that's not what I need exactly, but it's close and maybe I can make it work! I've tried modifying in it the following way but there are index issues that are throwing ArrayOutBounds exceptions everywhere. The thought process is, I can just wrap this entire block in another for loop that deals with the size of digits and output, which would go from 1 to 5. The more time I spend modifying, the uglier it gets and the more I am thinking, "there must be a cleaner way". public static void generate(){ int MAX = 36; long count = 1L * MAX * MAX * MAX * MAX * MAX; String build = null; int counter = 0; char[] alphabet = "0123456789abcdefghijklmnopqrstuvwxyz".toCharArray(); int[] digits = null; char[] output = null; for (int j = 1; j &lt; 5; j++){ build = null; //clear build digits = null; //clear digits outputs = null; //clear outputs digits = new int[j]; //initialize digits to size j //small loop to append "0" to build for (int m = 0; m &lt; j; m++){ build = build + "0"; } output = build.toCharArray(); //convert our string to charArray for (int i= 0; i &lt; count; i++){ String name = String.valueOf(output); for(int d = 3; d…
answer count: 2
has comment: http://stackoverflow.com/comment/33944342

http://stackoverflow.com/a/22420031
score: 4
type: Answer
has body: Classes in both Referenced Libraries and Maven Dependencies are visible in Eclipse but Maven build can see only dependencies from pom. If you try to build the project with maven it may fail because of this
upvote count: 4
answers question: http://stackoverflow.com/q/22419817
downvote count: 0

http://stackoverflow.com/comment/34176022
score: 0
type: Comment
type: QuestionComment
has text: lol true! haha answer so I can accept
comment on: http://stackoverflow.com/q/22466623

http://stackoverflow.com/comment/34157336
has text: @mttdbrd : I prefer to have a single war that loads his context dependending on spring.profiles.active.
score: 0
comment on: http://stackoverflow.com/q/22456653
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33952924
score: 0
has text: Its just the method that you are calling, read up on some more java. In terms of IDE, I and many others at Google prefer Eclipse. It has really good code-completions functions and little features that are very convenient.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22339811

http://stackoverflow.com/q/22401648
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34059373
has comment: http://stackoverflow.com/comment/34058784
has comment: http://stackoverflow.com/comment/34059377
has answer: http://stackoverflow.com/a/22401748
accepted answer: http://stackoverflow.com/a/22401748
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/34058842
has comment: http://stackoverflow.com/comment/34058785
type: Question
has comment: http://stackoverflow.com/comment/34058862
has title: Fastest way to check if value is in array many times
has body: I have an array of some values between -15 and 31 and I have to check, if some x is in this array for ~300 000 000 times. Because there is negative values, I can't create boolean array. Now I am creating HashSet from original array and use .contains() method, but this is too slow. Is there any faster way or trick? Update I create this array from another one (so I can use any structure I want)
score: 4
has comment: http://stackoverflow.com/comment/34058787
has comment: http://stackoverflow.com/comment/34058924

twitter
tags question: http://stackoverflow.com/q/22438441
tags question: http://stackoverflow.com/q/22446492
tags question: http://stackoverflow.com/q/22350013
type: Tag
tags question: http://stackoverflow.com/q/22435360
tags question: http://stackoverflow.com/q/22419032
tags question: http://stackoverflow.com/q/22367959
tags question: http://stackoverflow.com/q/22333509
tags question: http://stackoverflow.com/q/22464690
tags question: http://stackoverflow.com/q/22414964
tag name: twitter
tags question: http://stackoverflow.com/q/22355453

http://stackoverflow.com/a/22331942
accepted answer of: http://stackoverflow.com/q/22331469
answers question: http://stackoverflow.com/q/22331469
has comment: http://stackoverflow.com/comment/33964515
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33940104
has comment: http://stackoverflow.com/comment/34033312
has body: Check that you have that dependency in ur pom file: org.springframework spring-context x.x.x.RELEASE (x.x.x : to be modified) if you aren't using maven : check the jar "spring-context-x.x.x.RELEASE.jar" into your build path
score: 3
upvote count: 3

http://stackoverflow.com/a/22479318
downvote count: 0
answers question: http://stackoverflow.com/q/22479014
has body: I think this is one of those things that a regular language (aka regex) cannot express. It is a while since I studied compiler theory, but for instance nested comments, e.g. /* outer /* inner */ */, is one of the things that just cannot be expressed, and your problems seems to be similarly close without me giving an authoritative answer on that, but I think you should give up regex as a tool for this problem, because even if it were possible I am convinced that a simple parse-count-parenthesis solution will be simpler and easier to understand/maintain.
type: Answer
has comment: http://stackoverflow.com/comment/34196437
has comment: http://stackoverflow.com/comment/34196080
score: 1
has comment: http://stackoverflow.com/comment/34196611
upvote count: 1

http://stackoverflow.com/a/22426288
has body: For the first case, Stream#map() method will give you a Stream&lt;Integer&gt;, and then Stream#toArray() returns an Object[], which you need to cast to Integer[]. But at runtime, this cast may fail, if internally an Object[] is created instead of an Integer[], which is the case here. The source code of toArray() method for this stream looks like this: @Override public final Object[] toArray() { return toArray(Object[]::new); } And you can't cast an Object[] to an Integer[] reference. You can solve this issue by using Stream#toArray(IntFunction) instead, and then you wouldn't need a cast: private Integer[] parseTime (String time){ Integer[] hhmmss = Arrays.stream(time.split(":")) .map(s-&gt;Integer.valueOf(s)) .toArray(Integer[]::new); return hhmmss; } In second case however, Stream#mapToInt() method gives you an IntStream, and IntStream#toArray() returns an int[], and hence no casting required there.
score: 15
has comment: http://stackoverflow.com/comment/34113779
upvote count: 15
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22426212
type: Answer
answers question: http://stackoverflow.com/q/22426212

content-length
type: Tag
tag name: content-length
tags question: http://stackoverflow.com/q/22433264

http://stackoverflow.com/a/22444537
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
has body: The best datastructure for a file system is a Tree. If you think of it, it naturally models the hierarchy of a directory structure dir1 dir2 dir2a file2b dir3 dir3a file3b file3c dir4 file4a
accepted answer of: http://stackoverflow.com/q/22444332
answers question: http://stackoverflow.com/q/22444332

http://stackoverflow.com/q/22361211
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/22361818
type: Question
tagged with: jakarta-ee
tagged with: ejb
has comment: http://stackoverflow.com/comment/33989716
has comment: http://stackoverflow.com/comment/33989689
score: 2
accepted answer: http://stackoverflow.com/a/22361818
answer count: 1
downvote count: 0
has body: When I package my pom.xml as an EJB I get an error that I do not understand. This error shows up if I touch the package in any way, to include Ctrl+S and Maven update. The error goes away if I change the packaging back to jar. Code: 4.0.0 com.myorg.buildparent BuildParent 0.0.1-SNAPSHOT com.myorg.myEjbPackage MyEjbPackage 0.0.1-SNAPSHOT ejb By changing ejb to jar The error will go away. Error string for reference: 'Building workspace' has encountered a problem. Errors occurred during the build. Errors running builder 'Maven Project Builder' on project 'MyEjbPackage'. org.codehaus.plexus.archiver.ArchiverException Even though I can remove the error, I still feel like it should be packaged as an ejb. Does this make sense to anyone? Does my EJB package need to be packaged as a EJB in the pom? I should admit that my skills with Maven are around that of a novice/low intermediate.
favorite count: 0
tagged with: maven
tagged with: pom.xml
has title: Maven error when pom.xml is packaged an ejb, but goes away when packaged as jar
type: AnsweredQuestion

http://stackoverflow.com/q/22462665
accepted answer: http://stackoverflow.com/a/22547592
tagged with: multithreading
type: AnsweredQuestion
tagged with: apache-commons
tagged with: java
tagged with: mapreduce
type: Question
upvote count: 4
tagged with: hadoop
has title: Is Hadoop's TooRunner thread-safe?
has answer: http://stackoverflow.com/a/22547592
downvote count: 0
answer count: 1
has body: I would like to trigger a few Hadoop jobs simultaneously. I’ve created a pool of threads using Executors.newFixedThreadPool. Idea is that if the pool size is 2, my code will trigger 2 Hadoop jobs at the same exact time using ‘ToolRunner.run’. In my testing, I noticed that these 2 threads keep stepping on each other. When I looked under the hood, I noticed that ToolRunner creates GenericOptionsParser which in turn calls a static method ‘buildGeneralOptions’. This method uses ‘OptionBuilder.withArgName’ which uses an instance variable called, ‘argName’. This doesn’t look thread safe to me and I believe is the root cause of issues I am running into. Any thoughts?
favorite count: 0
score: 4

http://stackoverflow.com/q/22412564
has title: Test Case failing when expected is equal to output
possible better answer: http://stackoverflow.com/a/22412758
tagged with: junit3
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22412736
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34078954
accepted answer: http://stackoverflow.com/a/22412736
score: 0
has answer: http://stackoverflow.com/a/22412758
has body: Before I get into detail, YES this is a HOMEWORK ASSIGNMENT. NO I DON'T WANT ANSWERS, JUST TIPS and/or Suggestions to try this or that. The problem introduces with this: Create a class, ExactNumber, that uses two long properties named left and right (representing the portion of the number that is to the left and right of the decimal point respectively). For example, 3.75 would be represented by new ExactNumber(3, 7500000000000000L). Note the L on the end which tells Java the large number is a long. This translates to: 3 + 7500000000000000/10000000000000000 = 3.75 Here is my code: public class ExactNumber { private long left; private long right; public ExactNumber(long left, long right) { this.left = left; this.right = right; } public String toString() { return String.valueOf(doubleValue()); } public double doubleValue() { return ((double) left + (double) (right/ 100000000000000L) / 100); } public int compareTo (ExactNumber exactNumber) { if(exactNumber.left &lt; left) { return 1; } else if (exactNumber.left == left) { if (exactNumber.right &lt; right) { return 1; } else if (exactNumber.right == right) { return 0; } else { return -1; } } else { return -1; } } public boolean equal(ExactNumber thisobject) { if (thisobject instanceof ExactNumber) { if (thisobject.doubleValue() == this.doubleValue()) { return true; } else { return false; } } else { return false; } } public double add(ExactNumber exactNumber) {; return ((left+exactNumber.left) + (double)((right+exactNumber.right)*1E-16)); } } My problem are the tests coming up as an error when the expected value is equal to the actual value. Here are the test cases (NOTE: there are more test cases, but they pass the JUnit test): public class TestExactNumber extends TestCase { ExactNumber threesevenfive = new ExactNumber(3, 7500000000000000L); ExactNumber threesevenfive_andalittlebit = new ExactNumber(3, 7500000000000001L); ExactNumber threesevenfive_dupe = new ExactNumber(3, 7500000000000000L); ExactNumber ten = new Exact…

http://stackoverflow.com/q/22429776
score: 0
answer count: 1
tagged with: junit
has body: I'm trying to get a String/class/file/name from the user that specifies which class to run Junit tests on. It compiles and runs however, the Junit testing says Class Not Found and gives me an error. I'm not sure how to go about fixing this or working around it. import java.util.Scanner; import junit.framework.*; import org.junit.runner.JUnitCore; public class Utf extends TestCase { public static void main(String[] args) { /* * creates and reads from scanner */ Scanner in = new Scanner(System.in); String filename = in.nextLine(); /* * gets Tester class' name and stores it as a String */ String className = Tester.class.getName(); /* * if user input String matches Tester class' name then run tests * else File Not Found */ if (filename == className) {JUnitCore.main(className);} else {System.out.println("File not Found");} /* * closes scanner */ in.close(); } } public class Tester { /* * tests StudentConstructor() method */ public void testStudentConstructor() throws Exception { try { String uid = "000"; String name = "Test Student"; String email = "test@test.com"; Student s = new Student(uid, name, email); assert (s.getUid() == uid); assert (s.getName() == name); assert (s.getEmail() == email); } catch(NullPointerException e){System.out.println("testStudentConstructor() failed: NullPointerException:" + e.getMessage());} catch(IllegalArgumentException e){System.out.println("testStudentConstructor() failed: IllegalArgumentException:" + e.getMessage());} catch(UnsupportedOperationException e){System.out.println("testStudentConstructor() failed: UnsupportedOperationException:" + e.getMessage());} }; /* * tests StudentToString() method */ public void testStudentToString() throws Exception { try { String uid = "000"; String name = "Test Student"; String email = "test@test.com"; Student s = new Student(uid, name, email); s.studentToString(s); } catch(NullPointerException e) {System.out.println("testStudentToString() failed: NullPointerException:" + e.getMessage());} catch(Ille…
has answer: http://stackoverflow.com/a/22429902
type: AnsweredQuestion
tagged with: filenames
tagged with: java
has comment: http://stackoverflow.com/comment/34108671
tagged with: unit-testing
has comment: http://stackoverflow.com/comment/34108628
has title: JUnitCore Class Not Found
type: Question
has comment: http://stackoverflow.com/comment/34108581
accepted answer: http://stackoverflow.com/a/22429902
linked to: http://stackoverflow.com/q/4228047

http://stackoverflow.com/comment/34154828
type: Comment
score: 0
type: AnswerComment
has text: You have a million people to ask here on SO. The problem is how you ask the question an what you ask. Questions that are too broad are unlikely to get answered. questions with not enough detail describing your problem will not likely get answered. GUI programming related questions are preferred to asked with [a Minimal, Complete, Tested and Readable example](http://stackoverflow.com/help/mcve). Other than that, this site is not really a help desk, it's just a Q & A. Most people here are professional and don't really have the time to tutor or mentor. There are tutorials for that...
comment on: http://stackoverflow.com/a/22447948

http://stackoverflow.com/q/22402424
has title: Can I change JVM parameters during execution
tagged with: java
has answer: http://stackoverflow.com/a/22402668
type: Question
upvote count: 4
answer count: 2
linked to: http://stackoverflow.com/q/763295
downvote count: 0
score: 4
duplicate of: http://stackoverflow.com/q/763295
favorite count: 0
accepted answer: http://stackoverflow.com/a/22402627
tagged with: jvm-arguments
tagged with: jvm
has body: I am writing a Java program and at some point during execution I want to change the JVM settings (decrease the heap) and after a while increase it again. Is it possible with Java?
has comment: http://stackoverflow.com/comment/34060143
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22402627
possible better answer: http://stackoverflow.com/a/22402668

http://stackoverflow.com/q/22435401
type: Question
tagged with: byte-shifting
score: 3
duplicate of: http://stackoverflow.com/q/563544
possible better answer: http://stackoverflow.com/a/22435456
has comment: http://stackoverflow.com/comment/34118351
tagged with: java
has answer: http://stackoverflow.com/a/22435436
has answer: http://stackoverflow.com/a/22435456
has comment: http://stackoverflow.com/comment/34118401
upvote count: 4
has comment: http://stackoverflow.com/comment/34118380
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/22435436
has body: I have this code: int i = 255; byte b = (byte) i; int c; System.out.println(Integer.toBinaryString( i)); System.out.println("b = " + b); // b = -1 c=b&gt;&gt;&gt;1; System.out.println(Integer.toBinaryString( c)); System.out.println(c); But I can't understand how it works. I think that unsigned shifting to 255(11111111) should give me 127(0111111) but it doesn't. Is my assumption wrong?
has comment: http://stackoverflow.com/comment/34118551
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22435536
has title: Java bit unsigned shifting (>>>) give strange result
linked to: http://stackoverflow.com/q/563544
downvote count: 1

http://stackoverflow.com/q/22382306
has answer: http://stackoverflow.com/a/22382456
accepted answer: http://stackoverflow.com/a/22382456
tagged with: spring
tagged with: dependencies
type: AnsweredQuestion
downvote count: 0
type: Question
has body: I'm having some errors attempting to run some dbunit tests on a simple spring project. java.lang.IncompatibleClassChangeError: Found class org.springframework.test.context.TestContext, but interface was expected at com.github.springtestdbunit.DbUnitTestExecutionListener.prepareTestInstance(DbUnitTestExecutionListener.java:86) This is my error. I know it has something to do with the dependencies and i have been fiddling with them for awhile(upgrading and such). Here is my pom.xml for clarity. 4.0.0 org.springframework.samples TheHitProject 0.0.1-SNAPSHOT <java.version>1.6</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <spring-framework.version>3.2.3.RELEASE</spring-framework.version> <hibernate.version>4.2.1.Final</hibernate.version> <logback.version>1.0.13</logback.version> <slf4j.version>1.7.5</slf4j.version> <junit.version>4.11</junit.version> mysql mysql-connector-java 5.1.6 org.springframework spring-jdbc ${org.springframework.version} org.springframework spring-tx ${org.springframework.version} org.springframework spring-context ${spring-framework.version} org.springframework spring-tx ${spring-framework.version} org.slf4j slf4j-api ${slf4j.version} compile ch.qos.logback logback-classic ${logback.version} runtime org.hibernate hibernate-entitymanager ${hibernate.version} org.springframework spring-test ${spring-framework.version} test junit junit 4.11 test org.dbunit dbunit 2.4.9 com.github.springtestdbunit spring-test-dbunit 1.1.0 test org.slf4j slf4j-log4j12 1.7.5 test org.hsqldb hsqldb 2.3.2 test
score: 1
tagged with: java
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34025196
has title: Spring dependance error in my pom file

http://stackoverflow.com/comment/34025602
has text: How can I create array with unknown numer of elements ?In C++ is with dynamic allocation.In java?
type: Comment
comment on: http://stackoverflow.com/a/22381867
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34179433
comment on: http://stackoverflow.com/q/22469534
score: 0
type: Comment
type: QuestionComment
has text: find the single number that has the longest run and print that out. all of the print statements are there just so I can see what my program is doing and try and fix it to the best of my knowledge

http://stackoverflow.com/a/22441235
type: Answer
score: 3
has body: Because InsertionSort has time complexity O(n^2) while MergeSort has time complexity O(nlogn). Have a look here for a simple comparison of all the sorting algorithms. You can read more here, here and here. As a simple example, if you have 100 elements to sort, InsertionSort will do 100^2 = 10 000 operations to sort it, while MergeSort will do it with 100*log(100) = 100*2 = 200 operations, making it 50 times faster. This becomes very important for large sets of data. When sorting an array of 1 000 000 objects, InsertionSort will perform 1 000 000 000 000 operations while MergeSort will only perform 6 000 000, making it 166 666 times faster. In the above case, assuming you are using a computer that can do 1 billion operations per second, it would take InsertionSort 17 minutes to sort them, while MergeSort will do it in 6 milliseconds. Do note that the above figures and time complexities apply on an average case.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22441215
answers question: http://stackoverflow.com/q/22441215
has comment: http://stackoverflow.com/comment/34129602
has comment: http://stackoverflow.com/comment/34129386
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/34202847
comment on: http://stackoverflow.com/q/22483575
type: QuestionComment
has text: Can you use a compare-and-set loop instead of a lock? http://blog.slaks.net/2013-07-22/thread-safe-data-structures/
score: 2
type: Comment

http://stackoverflow.com/q/22433096
score: 2
has answer: http://stackoverflow.com/a/22433127
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22433117
has answer: http://stackoverflow.com/a/40844395
has title: Java Class.forName method java.lang.ClassNotFoundException;
type: Question
upvote count: 2
tagged with: classnotfound
has answer: http://stackoverflow.com/a/22433145
has body: I've found other thread where people had and solved this error; however, all of were NOT using fully qualified class paths. I cannot seem to get Class.forName to work and I am using fully qualified paths. I've tested compiling from CLI and using ItelliJ Idea. Both fail with the same error. Code (in test directory): package test; public class Test { public static void main(String[] args) { Class cls = Class.forName("java.util.ArrayList"); } } Error: java.lang.ClassNotFoundException; must be caught or declared to be thrown The example above does NOT work. Thanks in advance!
tagged with: class
has answer: http://stackoverflow.com/a/22433154
tagged with: classnotfoundexception
possible better answer: http://stackoverflow.com/a/40844395
favorite count: 0
answer count: 5
accepted answer: http://stackoverflow.com/a/22433117

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/22413625
type: Tag

http://stackoverflow.com/comment/34175926
has text: Yes, it takes a computer to makes feel truly dumb...mine are masters of it...
comment on: http://stackoverflow.com/q/22466623
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22478563
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/34193665
has comment: http://stackoverflow.com/comment/34195089
type: Question
has answer: http://stackoverflow.com/a/22503229
has title: Redirect a JSF Page From a button
has comment: http://stackoverflow.com/comment/34194180
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34200626
favorite count: 0
has comment: http://stackoverflow.com/comment/34215626
has comment: http://stackoverflow.com/comment/34193850
accepted answer: http://stackoverflow.com/a/22503229
tagged with: jdeveloper
has body: I'm trying to redirect a jsf page when i click the login button but it doesn't work. in my case when i click the login button is check if user was found in the database,once it's found it,the system redirect to the page utitled2.jsf i'm using J2ee under jdeveloper.can someone help me please??? this is my function in the sessionEJB public UserEntity authentification(String login, String pwd) { try{ Query query; query = em.createQuery("select o from UserEntity o where " + " o.login = :LOGIN AND o.pwd = :PWD"); query.setParameter("LOGIN",login); query.setParameter("PWD",pwd); return (UserEntity) query.getSingleResult(); } catch(Exception e){ e.printStackTrace(); return null; } } this is my backingbean public String loginaction() { BindingContainer bindings = getBindings(); OperationBinding operationBinding = bindings.getOperationBinding("authentification"); Object result = operationBinding.execute(); if (!operationBinding.getErrors().isEmpty()) { return "success"; } return null; } this is my faces-config <?xml version="1.0" encoding="windows-1256"?> oracle.adf.rich /login.jsf #{backing_login.loginaction} success /untitled2.jsf <redirect/> and this is my login.JSF <?xml version='1.0' encoding='UTF-8'?> <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"> <af:document title="login.jsf" id="d1" binding="#{backingBeanScope.backing_login.d1}"> <af:messages binding="#{backingBeanScope.backing_login.m1}" id="m1"/> <af:form id="f1" binding="#{backingBeanScope.backing_login.f1}"> <af:panelFormLayout id="pfl1" binding="#{backingBeanScope.backing_login.pfl1}"> <af:inputText value="#{bindings.login.inputValue}" label="#{bindings.login.hints.label}" required="#{bindings.login.hints.mandatory}" columns="#{bindings.login.hints.displayWidth}" maximumLength="#{bindings.login.hints.precision}" shortDesc="#{bindings.login.hints.tooltip}" id="loginfield" binding="#{backingBeanScope.backing_login.it1}"> <f:validator binding="#{bindings.login.val…
score: 2
type: AnsweredQuestion
tagged with: jsf

http://stackoverflow.com/a/34110720
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22415916
has body: I was told to always use the TO_DATE() function when building a SQL statement string for Oracle. I am actually surprised that option 4 worked in 10g! Perhaps it is a bug which has since been fixed? Perhaps in the table in the 10g database, the expirationdate column was a VARCHAR2 instead of a DATE?

http://stackoverflow.com/comment/34190395
type: Comment
comment on: http://stackoverflow.com/q/22476381
score: 0
type: QuestionComment
has text: I suggest you step through the code in your debugger to see why it is behaving differently to what you think it should.

http://stackoverflow.com/a/76256421
score: 0
answers question: http://stackoverflow.com/q/22471055
type: Answer
has body: After weeks of searching, trying tons of plugins, viewers, embedders, etc., I finally came up with a solution. It's a combination of a paid plugin and a free plugin. The free plugin I'm using is "Prevent Files / Folders Access" https://wordpress.org/plugins/prevent-file-access/ which protects the url of the PDF if somebody manages to get it by viewing page source. And I purchased PDF Poster: https://wordpress.org/plugins/pdf-poster/ However, I'm waiting for this plugin developer to answer my request for a bit of CSS to add to it to enable vertical scrolling and the hand tool both by default. I would have preferred a free solution, but this is the best I could come up with, and I needed to move ahead and get my hundreds of embeds done. I hope this is helpful to someone else out there.

http://stackoverflow.com/q/22362230
has comment: http://stackoverflow.com/comment/33992203
has comment: http://stackoverflow.com/comment/33991999
has comment: http://stackoverflow.com/comment/33991217
answer count: 1
downvote count: 0
tagged with: inheritance
favorite count: 0
tagged with: subclass
has title: Saving a subclass as a superclass type and using its methods in Java
has answer: http://stackoverflow.com/a/22362712
has body: In the code below, a subclass extends its superclass, and overrides its method, using it to call another method unique to the subclass, which uses a variable of the subclass. The program then stores an instance of the subclass to a variable of type Superclass, and then calls its method. It then runs as if it is of type Subclass, calling the method and variable unique to the subclass. However, it is impossible to access these directly. class Superclass { void go() { System.out.println(0); } } class Subclass extends Superclass { int i = 1; @Override void go() { run(); } void run() { System.out.println(i); } } public class JavaApplication { public static void main(String[] args) { Superclass instance = new Subclass(); instance.go(); // outputs 1; it must have called run() and accessed i instance.run(); // causes compile-time error System.out.println(instance.i);// causes compile-time error } } Once the Subclass instance is saved as type Superclass, it still have access to all Subclass fields and methods. So why can't I access them directly?
has comment: http://stackoverflow.com/comment/33992083
type: UnansweredQuestion
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33992153
tagged with: superclass
type: Question
linked to: http://stackoverflow.com/q/898909
tagged with: java

http://stackoverflow.com/comment/34140462
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22447306
has text: You do realise that `run()` only runs once per call to `start()`, right? It doesn't run over and over until something makes it stop.
score: 0

http://stackoverflow.com/q/22429390
tagged with: jlabel
type: Question
linked to: http://stackoverflow.com/q/11664522
has title: How to add JLabel to this?
has answer: http://stackoverflow.com/a/22429616
answer count: 3
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/22429573
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22429819
downvote count: 0
score: 1
has body: I was wondering how to add a JLabel to the bottom right corner of this JFrame? I am also fairly new to coding so I will be taking this as a learning experience.:) public class MainQuestions { public static void main (String args[]){ JFrame frame=new JFrame(); Object ARRAY[]={"French","English","Portugese","Spanish"}; String answer=(String)JOptionPane.showInputDialog(frame, "What language predominately spoken in Latin American countries?","World Geography Review", JOptionPane.PLAIN_MESSAGE, null, ARRAY, null); if(answer == null) { //System.exit(0); } else if(answer.equals("Spanish")) { JOptionPane.showMessageDialog(null, "Correct!", "World Geography Review", JOptionPane.PLAIN_MESSAGE,null); //System.exit(0); } else { JOptionPane.showMessageDialog(null, "Sorry, wrong answer.", "World Geography Review", JOptionPane.PLAIN_MESSAGE,null); //System.exit(0); } } }
favorite count: 0

http://stackoverflow.com/a/22368489
answers question: http://stackoverflow.com/q/22368435
type: Answer
has comment: http://stackoverflow.com/comment/34002551
has comment: http://stackoverflow.com/comment/34002498
upvote count: 1
has body: The basic solution would be to create a new class, maybe called Main, from there, create the public static void main(String args[]) method and simply create a new instance of each object... public class Main { public static void main(String[] args) { new Blue(); System.out.println("..."); new Red(); System.out.println("..."); new White(); System.out.println("..."); new Orange(); } } If you're using an IDE, you would then simply be able to run this class and see the output...
score: 1
downvote count: 0

http://stackoverflow.com/comment/34129842
type: Comment
comment on: http://stackoverflow.com/a/22441430
score: 0
type: AnswerComment
has text: I don't think I'm allowed to use that. That's what I meant by standard API classes. I will add the links of what I believe I'm allowed to use to the question

http://stackoverflow.com/a/22448980
score: 0
has body: In Java, array index go from 0 to "length - 1". So if you start in array.length, you are trying to access out of the array's positions. Same occurs if you try to access to -1 index, because your least index is 0.
answers question: http://stackoverflow.com/q/22448921
type: Answer

http://stackoverflow.com/q/22360257
has comment: http://stackoverflow.com/comment/33987678
type: Question
answer count: 1
has title: How do I create a Glass effect in opengl?
score: 0
has body: I want to create an Effect in opengl that works a bit like windows aero but in a 3D environment to make frosted glass more realistic. But even after hours of searching I couldn't find a solution.
favorite count: 0
has answer: http://stackoverflow.com/a/22377475
upvote count: 1
downvote count: 1
tagged with: graphics
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22377475
has comment: http://stackoverflow.com/comment/33987741
tagged with: opengl
tagged with: java

http://stackoverflow.com/comment/34137559
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22445551
has text: oh yup, smart, thats a tactic ill remember for removing traling characters
score: 0

http://stackoverflow.com/comment/34190174
type: Comment
has text: still its giving an error .unchecked cast from object to List<Bean>
type: AnswerComment
comment on: http://stackoverflow.com/a/22476237
score: 0

http://stackoverflow.com/q/22379085
type: Question
has comment: http://stackoverflow.com/comment/34019689
answer count: 1
downvote count: 1
favorite count: 0
has title: Getting MalformdURLException while trying connect to RMIRegisty when replaying LoadRunner script
tagged with: loadrunner
has comment: http://stackoverflow.com/comment/34019610
has answer: http://stackoverflow.com/a/22380227
tagged with: performance-testing
has comment: http://stackoverflow.com/comment/34021529
has comment: http://stackoverflow.com/comment/34019450
upvote count: 0
type: UnansweredQuestion
has body: I am trying to replay a load runner script which makes the call through RMI to the server client-server application. The RMI service and registry are running fine on the server as other applications are able to connect and work fine. When I try to replay the LoadRunner script, I am getting below stacktrace: Virtual User Script started at : 2014-03-13 11:03:29 Starting action vuser_init. Ending action vuser_init. Running Vuser... Starting iteration 1. Starting action Actions. java.rmi.registry.LocateRegistry.getRegistry("mycompamny.abc.xyz.com", 25002, [RMIClientSocketFactory]) sun.rmi.registry.RegistryImpl_Stub.lookup("XMLS") Error: System.err: java.net.MalformedURLException--Error System.err: at java.net.URL.&lt;init&gt;(URL.java:601)--Error System.err: at java.net.URL.&lt;init&gt;(URL.java:464)--Error System.err: at java.net.URL.&lt;init&gt;(URL.java:413)--Error System.err: at murex.shared.fs.Connection.&lt;init&gt;(Connection.java:43)--Error System.err: at murex.shared.property.Properties.fillRMIProperties(Properties.java:231)--Error System.err: at murex.shared.property.Properties.getObjProperty(Properties.java:91)--Error System.err: at murex.shared.property.Properties.getProperty(Properties.java:80)--Error System.err: at murex.apps.middleware.client.core.server.transport.rpc.tcp.socket.SocketUtilities.setSocket(SocketUtilities.java:81)--Error System.err: at murex.apps.middleware.client.core.server.transport.rpc.tcp.socket.CompressedRMISocketFactory.createSocket(CompressedRMISocketFactory.java:29)--Error System.err: at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)--Error System.err: at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)--Error System.err: at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)--Error System.err: at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)--Error System.err: at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)--Error System.err: at Actions.action(Actions.j…
tagged with: rmi
tagged with: java
score: -1
tagged with: malformedurlexception

http://stackoverflow.com/comment/34025352
score: 0
type: Comment
has text: @ikegami indeed - well spotted
comment on: http://stackoverflow.com/a/22381217
type: AnswerComment

http://stackoverflow.com/q/22451413
answer count: 1
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/22451564
has comment: http://stackoverflow.com/comment/34147941
favorite count: 0
has comment: http://stackoverflow.com/comment/34147283
has body: I'm programming with Java and can't figure out how. I don't know how this is called, so I hope to get an answer by posting an example. void MethodX(){ if (A.isTrue){ x = A.Method1); }else if (B.isTrue){ x = B.Method1); }else if (C.isTrue){ x = C.Method1); }else if (D.isTrue){ x = D.Method1); } } I think there's an easier way to do this, but can't figure out how to. I don't need the exact answer, but it would be nice to have some keywords to know what to search... Thanks in advance!
upvote count: 1
has comment: http://stackoverflow.com/comment/34147125
has comment: http://stackoverflow.com/comment/34147390
type: AnsweredQuestion
has title: How to 'autocall' a method in java
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22451564

http://stackoverflow.com/comment/34198825
type: AnswerComment
has text: @Dukeling Thanks, I should have mentioned that.
comment on: http://stackoverflow.com/a/22450167
type: Comment
score: 0

http://stackoverflow.com/q/22368321
tagged with: sublist
favorite count: 0
score: 4
has answer: http://stackoverflow.com/a/22368389
accepted answer: http://stackoverflow.com/a/22368389
downvote count: 1
type: AnsweredQuestion
tagged with: java
has body: I have an arraylist of a deck of cards ints 1-52 and they're shuffled and i'd like to basically split the deck in half indexes(0,25) and (26,51) to deal to two players. But I'm only seeing responses that say use List&lt;> although I'd like to keep each players deck an arraylist as to not interfere with other already created methods. Is there a way to keep both players decks as arraylists? import java.util.ArrayList; import java.util.Collections; public class Methods { public static ArrayList&lt;Integer&gt; deck = new ArrayList&lt;Integer&gt;(); public static ArrayList&lt;Integer&gt; deckPlayerOne = new ArrayList&lt;Integer&gt;(); public static ArrayList&lt;Integer&gt; deckPLayerTwo = new ArrayList&lt;Integer&gt;(); public static ArrayList&lt;Integer&gt; generateDeck(){ for(int i=1; i&lt;53; i++){ deck.add(i); } return deck; } public static ArrayList&lt;Integer&gt; shuffle(){ Collections.shuffle(deck); return deck; } public static void splitDeck(){ // deckPlayerOne = deck.subList(0, 25); &lt;---- location of error } public static ArrayList&lt;Integer&gt; playerOneDeck(){ } } public static ArrayList&lt;Integer&gt; platerTwoDeck(){ } }
has comment: http://stackoverflow.com/comment/34002085
type: Question
has comment: http://stackoverflow.com/comment/34002057
upvote count: 5
has title: How to obtain an ArrayList from ArrayList.subList?
tagged with: arraylist
answer count: 1
has comment: http://stackoverflow.com/comment/34002246

http://stackoverflow.com/comment/33990218
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22361230
has text: You should edit or OP with your code. Its next to impossible to read in a comment.
score: 0

http://stackoverflow.com/a/22483973
has comment: http://stackoverflow.com/comment/34285309
score: 7
has comment: http://stackoverflow.com/comment/65823324
upvote count: 8
has comment: http://stackoverflow.com/comment/34283586
has body: Here is an example: PrimitiveIterator.OfInt it = new PrimitiveIterator.OfInt() { private int value = 0; @Override public int nextInt() { return value++; } @Override public boolean hasNext() { return true; } }; Spliterator.OfInt spliterator = Spliterators.spliteratorUnknownSize(it, Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.ORDERED | Spliterator.SORTED); IntStream stream = StreamSupport.intStream(spliterator, false); It's a bit verbose, as you see. To print the first 10 elements of this stream: stream.limit(10).forEach(System.out::println); You can ofcourse also transform the elements, like you do in your Scala example: IntStream plusTwoStream = stream.map(n -&gt; n + 2); Note that there are built-in infinite streams such as java.util.Random.ints() which gives you an infinite stream of random integers.
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22483554

http://stackoverflow.com/a/22330952
type: AcceptedAnswer
has body: Sounds like a Map will do what you need. You can put the histograms in a Map keyed by whatever the property value is. Map&lt;String,Histogram&gt; histograms = new HashMap&lt;String,Histogram&gt;(); histograms.put("PropertyValue1", histogram1); histograms.put("PropertyValue2", histogram2); String desiredHistogram = silderBox.getProperty("VALUE"); Histogram histogramToUse = histograms.get(desiredHistogram); histogramToUse.getSum(); // do whatever you need to with this You'll want to check for nulls and all that stuff too.
answers question: http://stackoverflow.com/q/22330866
type: Answer
accepted answer of: http://stackoverflow.com/q/22330866
upvote count: 4
has comment: http://stackoverflow.com/comment/34069638
has comment: http://stackoverflow.com/comment/33936663
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/33938079

http://stackoverflow.com/a/22372705
downvote count: 0
answers question: http://stackoverflow.com/q/22372621
has body: For example int i = 0; now i++ ==> 1 now 1++ is the error. ++ is used only for variables not for constants.
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/a/22370980
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22370899
has body: Change switch to ToggleButton &lt;ToggleButton android:id="@+id/swButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Switch" android:textOff="Off" android:textOn="On" /&gt;

http://stackoverflow.com/a/22397255
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22396772
has body: Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data. If the parameter data was sent in the request body, then i occurs with an HTTP POST request. In an HTTP GET request, parameters are sent as a query string: http://example.com/page?parameter=value&amp;also=another check this for more information Data from the query string and the post body are aggregated into the request parameter set. Query string data is presented BEFORE post body data. For example, if a request is made with a query string of a=hello and a post body of a=goodbye&amp;a=world, the resulting parameter set would be ordered a=(hello, goodbye, world). The following are the conditions that must be met before post FORM data will be populated to the parameter set: The request is an HTTP or HTTPS request. The HTTP method is POST. The content type is application/x-www-form-urlencoded. The servlet has made an initial call of any of the 'getParameter' family of methods on the request object. If the conditions are not met and the post form data is not included in the parameter set, the post data must still be available to the servlet via the request object's input stream. If the conditions are met, post form data will no longer be available for reading directly from the request object's input stream. http://www.javacertifications.net/javacert/HttpservletRequest.jsp http://www.w3.org/TR/html401/interact/forms.html#h-17.13 http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/ServletRequest.html#getParameter(java.lang.String) http://www.xyzws.com/Servletfaq/what-is-the-difference-between-the-request-attribute-and-request-parameter/1
type: Answer

http://stackoverflow.com/q/22444957
has answer: http://stackoverflow.com/a/22445017
downvote count: 1
has answer: http://stackoverflow.com/a/22445080
favorite count: 0
tagged with: sum-of-digits
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34136529
has answer: http://stackoverflow.com/a/22445081
score: 1
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/22445084
has comment: http://stackoverflow.com/comment/34136522
type: Question
has title: Understanding methods. Java code
has body: Write a method that computes the sum of the digits in an integer. Use the following method header: public static int sumDigits(long n) Programming problem 5.2. Page 212. Please forgive my newness to programming. I'm having a hard time understanding and answering this question. Here's what I have so far. Please assist and if you dont mind, explain what I'm doing wrong. import java.util.Scanner; public class PP52v2 { public static void main(String [] args) { int sum = sumDigits(n); System.out.println("The sum is: " + sum); }//main public static int sumDigits(long n) { Scanner input = new Scanner(System.in); System.out.println("Enter your digits"); n = input.nextLong(); int num = (int)(n); int sum; while(num &gt; 0) { sum += num % 10; //must mod - gives individual numbers num = num / 10; //must divide - gives new num }//loop return sum; }//sumDigits }//class
has comment: http://stackoverflow.com/comment/34136423
has answer: http://stackoverflow.com/a/22445051
answer count: 6
upvote count: 2
has answer: http://stackoverflow.com/a/22445062

http://stackoverflow.com/a/22449272
has body: You give input stream an array to store data in (is.read(buffer)), but regardless of how much it reads, storing only 1 byte, and incrementing number of bytes by 1. Try instead something like: While(numOfBytes &lt; 266) { if(!(inputStream.available() &gt; 0)) continue; int b = inputStream.read(); if(b &gt;= 0){ data[numOfBytes] = (byte) b ; numOfBytes++; } }
answers question: http://stackoverflow.com/q/22449132
type: Answer
has comment: http://stackoverflow.com/comment/34144070
score: 0

http://stackoverflow.com/comment/41061497
type: Comment
comment on: http://stackoverflow.com/a/22515026
has text: @Puce Please see the update. This feature is implemented now.
type: AnswerComment
score: 0

file-upload
tags question: http://stackoverflow.com/q/22459248
tags question: http://stackoverflow.com/q/22468763
type: Tag
tags question: http://stackoverflow.com/q/22375038
tags question: http://stackoverflow.com/q/22375614
tags question: http://stackoverflow.com/q/22356066
tags question: http://stackoverflow.com/q/22470875
tag name: file-upload
tags question: http://stackoverflow.com/q/22449790

http://stackoverflow.com/comment/34006250
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22371033
has text: yes.I tested using real device and also gave permissions in manifest.In network provider its working fine

http://stackoverflow.com/comment/34068198
comment on: http://stackoverflow.com/a/22405794
score: 0
type: AnswerComment
has text: ah ok thank you. I see what you've done now and it makes sense. Although, i specify my blocksize as 2 (2 chars per block) and get minus values as hash codes. I dont get why :S
type: Comment

http://stackoverflow.com/a/22339951
accepted answer of: http://stackoverflow.com/q/22339917
has body: private void parseLabel(FileOutputStream asciiout) { asciiout.write("Label: ".getBytes()); }
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22339917
score: 2
upvote count: 2

http://stackoverflow.com/a/22441642
has comment: http://stackoverflow.com/comment/34130236
has comment: http://stackoverflow.com/comment/34130775
upvote count: 2
has comment: http://stackoverflow.com/comment/34132205
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22440733
has comment: http://stackoverflow.com/comment/34130989
has body: I don't know why you don't want to use a JTextPane or JEditorPane. You insert text by its document. Examples here --> How to use Editor Panes and Text Panes. But for your purpose you can for example do something like this. I override changeSelection to selectAll text when is clicking, the cells are editable but its cellEditors are not editable. public class JTableTest { private final DefaultCellEditor cellEditor; private final JTextField textfield; private JPanel panel; private MyTableModel tableModel = new MyTableModel(); private JTable table = new JTable() { @Override public TableCellEditor getCellEditor(int row, int column) { return JTableTest.this.cellEditor; } @Override public void changeSelection( final int row, final int column, final boolean toggle, final boolean extend) { super.changeSelection(row, column, toggle, extend); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if ((getCellEditor(row, column) != null &amp;&amp; !editCellAt(row, column))) { JTextField textfield=(JTextField)JTableTest.this.cellEditor.getComponent(); textfield.selectAll(); } } }); } }; public JTableTest() { JScrollPane scroll = new JScrollPane(table); table.setModel(tableModel); panel = new JPanel(new BorderLayout()); panel.add(scroll, BorderLayout.CENTER); textfield = new JTextField(); textfield.setEditable(Boolean.FALSE); textfield.setBorder(null); cellEditor = new DefaultCellEditor(textfield); tableModel.insertValue(new ItemRow("nonEditable", "Editable")); } private class ItemRow { private String column1; private String column2; public ItemRow(String column1, String column2) { this.column1 = column1; this.column2 = column2; } public String getColumn1() { return column1; } public void setColumn1(String column1) { this.column1 = column1; } public String getColumn2() { return column2; } public void setColumn2(String column2) { this.column2 = column2; } } private class MyTableModel extends AbstractTableModel { public static final int COLUMN1_INDEX = 0; public …
answers question: http://stackoverflow.com/q/22440733
type: Answer
score: 2
downvote count: 0

function
tags question: http://stackoverflow.com/q/22363056
tag name: function
type: Tag
tags question: http://stackoverflow.com/q/22465404

http://stackoverflow.com/a/22333472
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33943237
has comment: http://stackoverflow.com/comment/33941127
upvote count: 3
type: Answer
has body: This is how I usually handle this problem: public SplashScreen implements Screen { @Override public void render(float delta) { // I assume that you have a reference to the game somewhere to switch the screen game.setScreen(new MapScreen()); dispose(); return; } } I first set the new Screen, then dispose() the current one and then immediately stop any further execution of the current screen via return. This way the current render cycle should be stopped and in the next cycle the render() of your next screen will be called. Another approach might be to call dispose() in your hide() method of the Screens, because that is going to be the last method being called before the Game will use the next screen. This is especially useful when there could be several different next screens. In that case there will still be only a single place of dispose() and that will be in the hide() method.
answers question: http://stackoverflow.com/q/22332601
has comment: http://stackoverflow.com/comment/33978877

http://stackoverflow.com/comment/33997580
type: QuestionComment
comment on: http://stackoverflow.com/q/22365558
has text: You *can* insert into a tree in constant time, but then you lose efficiency somewhere else (e.g., insertion into a skew binomial heap is constant-time, but remove-min is O(log n)). You can also get O(1) insertion and O(log n) random access into a sorted structure (IIRC), but it's complicated (and fairly recently discovered).
score: 0
type: Comment

http://stackoverflow.com/q/22386539
duplicate of: http://stackoverflow.com/q/161633
favorite count: 0
has comment: http://stackoverflow.com/comment/34033249
type: Question
tagged with: interface
has answer: http://stackoverflow.com/a/22386779
score: -1
accepted answer: http://stackoverflow.com/a/22386742
linked to: http://stackoverflow.com/q/5418464
answer count: 3
downvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34032874
has body: I have maybe a simple question. Here two code-snippets to show what I mean: Example 1: public interface SomeInterface{ public void someMethod(...); } Example 2: public interface AnotherInterface{ void anotherMethod(...); } So, Example 1 is completely clear to me but Example 2 isnt. In fact, is there any difference between those two examples expect the public-modifier? On one hand I found that methods from Interfaces are implicitly public but on the other hand I have found that methods declared in an Interface are "package-public" (I dont now if thats the correct description) - saying these are visible to all classes in the same package as the Interface. For now I am completely confused.. So could someone please explain me whats right? Thanks anyways.
has answer: http://stackoverflow.com/a/22386687
has title: Differences on Interface implementation
linked to: http://stackoverflow.com/q/161633
has comment: http://stackoverflow.com/comment/34033117
type: AnsweredQuestion
upvote count: 0
possible better answer: http://stackoverflow.com/a/22386687
has comment: http://stackoverflow.com/comment/34032970
has comment: http://stackoverflow.com/comment/34033156
has answer: http://stackoverflow.com/a/22386742

http://stackoverflow.com/comment/33953117
score: 0
type: Comment
type: QuestionComment
has text: @RafaEl And I thought I just needed more coffee
comment on: http://stackoverflow.com/q/22340439

http://stackoverflow.com/a/22431230
answers question: http://stackoverflow.com/q/22431217
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34111323
has comment: http://stackoverflow.com/comment/34111379
has comment: http://stackoverflow.com/comment/34111981
has comment: http://stackoverflow.com/comment/34111391
type: Answer
has comment: http://stackoverflow.com/comment/34111384
has comment: http://stackoverflow.com/comment/34111192
has comment: http://stackoverflow.com/comment/34111539
upvote count: 7
has comment: http://stackoverflow.com/comment/34111944
score: 7
has comment: http://stackoverflow.com/comment/34111337
has body: Open source refers to license. You can have the source code of a non-open source program, for example. Generally speaking, no, your original source code is not available to anyone - you can easily use methods such as obfuscation and encryption if you are concerned about this. Check out this question. However Java bytecode can be reverse engineered to Java source code. You can take a look here to get more information: http://resources.infosecinstitute.com/java-bytecode-reverse-engineering. If so, then isn't this a problem for major companies that don't want their trade secrets or their work available to anyone? Why would it be? Java is usually running on the server side, where you can't even access the bytecode. If you're creating a desktop application you're just as likely to have it reverse engineered as pirated, I'd wager. In essence it's possible to get the source code from bytecode, but you can prevent that, and it's usually not a big deal.
accepted answer of: http://stackoverflow.com/q/22431217
has comment: http://stackoverflow.com/comment/34111215

http://stackoverflow.com/q/22448404
tagged with: java
tagged with: file-attributes
has body: plz any buddy share demo program about file version control of any document and how can uniquely identify that document at the time of when we uploading. http://java2s.com/Tutorials/Java/java.nio.file.attribute/BasicFileAttributes/Java_BasicFileAttributes_fileKey_.htm#Example import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; public class Main { public static void main(String[] args) throws Exception { BasicFileAttributes attr = null; Path path = Paths.get("C:/tutorial/Java/JavaFX", "Topic.txt"); attr = Files.readAttributes(path, BasicFileAttributes.class); System.out.println(attr.fileKey()); } }
upvote count: 1
tagged with: version-control
answer count: 1
downvote count: 1
favorite count: 0
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22448554
tagged with: dms
type: Question
tagged with: jakarta-ee
has title: what is filekey attribute and how can set filekey attribute of any document in java

http://stackoverflow.com/comment/34128740
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22440710
has text: Just figured out the charInput, I'm an idiot and for some reason declared a 2nd GridLayout in my addInnerLeft() method.

http://stackoverflow.com/q/22440498
has comment: http://stackoverflow.com/comment/34127896
has answer: http://stackoverflow.com/a/22440533
has title: when is it required to add throws in Java?
answer count: 3
has comment: http://stackoverflow.com/comment/34127902
linked to: http://stackoverflow.com/q/6115896
favorite count: 0
tagged with: exception
accepted answer: http://stackoverflow.com/a/22440533
type: AnsweredQuestion
upvote count: 3
tagged with: java
score: 0
downvote count: 3
tagged with: throws
has comment: http://stackoverflow.com/comment/34128030
has answer: http://stackoverflow.com/a/22440520
possible better answer: http://stackoverflow.com/a/22440716
has body: in following example, Eclipse does not ask me to add ' throws EmptyStackException' public E pop() { if (stack.isEmpty()) { throw new EmptyStackException(); } ... } However, in following example, 'throws Exception' is required public E pop() throws Exception { if(stack.isEmpty()) { throw new Exception(); ... } Is there any specific rules on when should I add throws or not?
type: Question
has answer: http://stackoverflow.com/a/22440716

http://stackoverflow.com/q/22467267
has comment: http://stackoverflow.com/comment/34175381
answer count: 1
has comment: http://stackoverflow.com/comment/34175360
score: 1
has comment: http://stackoverflow.com/comment/34175478
favorite count: 0
has comment: http://stackoverflow.com/comment/34175346
upvote count: 2
has comment: http://stackoverflow.com/comment/34175394
has title: My Java implementation of the Fibonacci algorithm is not working.
downvote count: 1
type: AnsweredQuestion
tagged with: fibonacci
has body: I am trying to write a Java program that produces the "nth" Fibonacci number. What am I doing wrong?! public class project7 { public static void main(String[] args) { ConsoleReader console = new ConsoleReader(System.in); int fold1 = 1; int fold2 = 1; System.out.println("Enter the number of times you would like to compute:"); int n = console.readInt(); for(int i = 0; i &lt;= n; i++ ){ fold1++; fold2++; } int fnew = fold1 + fold2; System.out.println(fnew); } }
has comment: http://stackoverflow.com/comment/34175548
tagged with: java
has comment: http://stackoverflow.com/comment/34175412
has answer: http://stackoverflow.com/a/22467536
type: Question
has comment: http://stackoverflow.com/comment/34175459
accepted answer: http://stackoverflow.com/a/22467536

http://stackoverflow.com/comment/34112731
type: QuestionComment
comment on: http://stackoverflow.com/q/22427253
score: 0
has text: Any code unit in your service layer that calls getPatientById? I just did a project and was in the same scenario as yours, my lazy fetch works fine. My suspect is the same as JB Bizet: accidentally lazy fetched your list while debugBing. The moment you check for the list size, it could have triggered.
type: Comment

http://stackoverflow.com/q/22330683
has answer: http://stackoverflow.com/a/22331460
accepted answer: http://stackoverflow.com/a/22331460
score: 0
has title: Setting a JLabel's size with a JComboBox
tagged with: jcombobox
tagged with: font-size
tagged with: swing
type: AnsweredQuestion
tagged with: fonts
tagged with: java
type: Question
answer count: 1
has body: this is my first time using a JComboBox for a Java GUI assignment, I have multiple JComboBoxes to modify a user's string input (such as font, color and size) and display the output on a JLabel in the GUI. I have successfully modified my output Label using the font and color combo boxes, but I currently have no idea on how to set the size of my label, without interfering with my font and color combo box. Here's my code: package javaassignment; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class JavaAssignment implements ActionListener { JPanel panel; JLabel textLabel, fontTypeLabel, fontSizeLabel, fontColorLabel, resultLabel, newLineLabel; JTextField textField; JComboBox fontTypeComboBox, fontSizeComboBox, fontColorComboBox; JButton okButton, cancelButton; GridLayout glay; //Declaration of all objects needed on the interface public JPanel createPaneContent() { panel = new JPanel(); glay = new GridLayout (6,2,50,50); //setting layout grid arrangement and 50,50 for spaces in between panel.setLayout(glay); textLabel = new JLabel("Enter Text:"); textField = new JTextField(10); fontTypeLabel = new JLabel("Select font type: "); String fontTypes[] = {"Consolas", "Calibri", "Arial", "Times New Roman"}; fontTypeComboBox = new JComboBox(fontTypes); fontTypeComboBox.setSelectedIndex(0); fontTypeComboBox.addActionListener(this); //Declaring arrays for the JComboBox that modifes font styles, and adding action listener. fontSizeLabel = new JLabel("Select font size: "); String fontSizes[] = {"Small", "Medium", "Big"}; fontSizeComboBox = new JComboBox(fontSizes); fontSizeComboBox.setSelectedIndex(0); fontSizeComboBox.addActionListener(this); //Declaring arrays for the JComboBox that modifies font sizes, and adding action listener. fontColorLabel = new JLabel("Select font color"); String fontColors[] = {"Default", "Red", "Green", "Blue"}; fontColorComboBox = new JComboBox(fontColors); fontColorComboBox.setSelectedIndex(0); fontColorComboBox.addActionListene…
has comment: http://stackoverflow.com/comment/33936824

http://stackoverflow.com/a/22340567
answers question: http://stackoverflow.com/q/22332829
has comment: http://stackoverflow.com/comment/33985790
score: 0
has body: I have had success with WCF svc and BasicHttpBinding. BasicHttpBinding should give you the most interop success and uses SOAP 1.1. We have used .NET 3 and up with Java, PHP and uniface clients.
type: Answer

http://stackoverflow.com/comment/34065191
score: 0
has text: it once counted each 5 lines as one !!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22405399

http://stackoverflow.com/a/22381920
score: 4
accepted answer of: http://stackoverflow.com/q/22381839
upvote count: 4
answers question: http://stackoverflow.com/q/22381839
type: AcceptedAnswer
downvote count: 0
has body: The issue in your Pattern is that you are using a 0 or more (greedy) quantifier on the underscore. Try this: String input = "Unexpected ID 'foo_1': ERR-125:\"IDs\": invalid id"; // | any digit // | | once or more (greedy) System.out.println(input.matches("Unexpected ID 'foo_\\d+': ERR-125:\"IDs\": invalid id")); Output true
type: Answer

http://stackoverflow.com/q/22368649
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/34015445
score: 0
has comment: http://stackoverflow.com/comment/34021355
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/34007624
has comment: http://stackoverflow.com/comment/34003176
tagged with: postgresql
type: UnansweredQuestion
has title: Execute a query but get an error if it is in waiting state for too long
has body: Is there a way for an application to send a query to a database but have the database terminate the query and throw an error if the query waits too long? Something like: WAIT FOR CAST('1 min' AS INTERVAL) &lt;your query here&gt; If value of waiting in pg_stat_activity has been true for any longer than the given interval, the database should cancel the query and return an error, which would be interpreted by the application as an Exception. Does something like this exist? Or is there any workaround (preferably written in Java) that can achieve the same effect? A particular use case I'm targeting is this (in a simplified form of Java code): try { statement.executeUpdate("WAIT FOR CAST('30 sec' AS INTERVAL) TRUNCATE my_table"); //TRUNCATE may wait if other processes are accessing the table, //example a backup process that has locked the table. } catch (WaitTimeoutException wte) { statement.executeUpdate("DELETE FROM my_table"); } The idea is to preferably do TRUNCATE as this is much faster, but if the query ends up waiting for too long, then I should fall back to DELETE instead to get the job done. This could also be used to time queries out in other use cases, where you don't want the application waiting forever. Instead, the application can detected the condition of "waiting too long" and act appropriately (such as alerting the user or trying again after logging).
type: Question
tagged with: postgresql-9.1
has comment: http://stackoverflow.com/comment/34002993
has answer: http://stackoverflow.com/a/22380370
has comment: http://stackoverflow.com/comment/34003104

http://stackoverflow.com/comment/34234024
comment on: http://stackoverflow.com/a/22489717
has text: Your data is not `json` type, but javascript.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22481939
has title: Java Certification: How to override methods that define a throws exception?
answer count: 2
has answer: http://stackoverflow.com/a/22482391
has answer: http://stackoverflow.com/a/22482213
has comment: http://stackoverflow.com/comment/34199685
score: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/34200231
has body: Can anyone confirm the following in regards to methods that define exceptions thrown when method overriding? I want to be sure I understand it clearly. Given the following code: class A { public void doStuff() throws IllegalArgumentException{} } class B extends A { public void doStuff() throws NumberFormatException{} } class C extends A { public void doStuff() throws Exception{} } Only class A and B should compile and not class C. When overriding a method you can narrow the thrown class, but cannot widen it like in class C. The reason behind this I believe is the example in the following code: class D { doIt(A a) { try { a.doStuff(); } catch(IlligalArgumentException e){} } } Class A could be extended any number of times and so the doStuff() method can also potentially be overriden any number of times, but regardless, the try catch above will always catch the exception. But if widening were allowed, the above code could potentially miss the exception being thrown and there would be unexpected result in the application. Is this the correct thinking? Is there anything else I'm missing? Thanks
tagged with: scjp
possible better answer: http://stackoverflow.com/a/22482391
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22482213

http://stackoverflow.com/q/22346843
has comment: http://stackoverflow.com/comment/33968343
favorite count: 0
has comment: http://stackoverflow.com/comment/33968189
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33968718
has answer: http://stackoverflow.com/a/22350796
has comment: http://stackoverflow.com/comment/33968638
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am passing a JSON object through Ajax call in JavaScript function. I have linked the generated action to a struts action class. I have the control in action class, but my setters are not being called, because of which I am facing a NullPointerException. Here is my Ajax call in JavaScript var arr = {entity:entity,subEntity:subEntity,choice:choice,drinkingWaterChosen:drinkingWaterChosen,roadChosen:roadChosen,groupChoice:groupChoice}; console.log(JSON.stringify(arr)); url = "&lt;s:url action='FetchQuery'/&gt;"; $.ajax({ type : 'POST', url : url, dataType : 'json', contentType: 'application/json; charset=utf-8', data:JSON.stringify(arr), async : false, success : function(data) { console.log(data); alert("I am back "+data); } }); My Struts config file is as shown below &lt;struts&gt; &lt;package name="default" extends="json-default"&gt; &lt;result-types&gt; &lt;result-type name="json" class="org.apache.struts2.json.JSONResult" /&gt; &lt;/result-types&gt; &lt;interceptors&gt; &lt;interceptor name="json" class="org.apache.struts2.json.JSONInterceptor" /&gt; &lt;/interceptors&gt; &lt;action name="FetchQuery" class="serp.FetchQuery"&gt; &lt;result type="json"/&gt; &lt;/action&gt; &lt;/package&gt; My Action class is as shown below private String entity;//getter and setters for all variables private String subEntity; private String choice; private String drinkingWaterChosen; private String roadChosen; private String groupChoice; public String execute(){ System.out.println("Hello world&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"); String msg = constructQuery(); return msg; } private String constructQuery() { if (entity.equals("Hello")) {} //Null pointer exception is raised at this line } I think this error is because the entity is not being set before hand. So my question is how to handle the JSON object that is passed to the action class. I have read many questions on this site and tried all the ways, but still I couldn't figure out the problem. Any …
linked to: http://stackoverflow.com/q/16749885
has title: Unable to access the JSON request object in struts action class
type: Question
accepted answer: http://stackoverflow.com/a/22350796
answer count: 2
has comment: http://stackoverflow.com/comment/33969172
has comment: http://stackoverflow.com/comment/33965726
downvote count: 0
tagged with: javascript
possible better answer: http://stackoverflow.com/a/22349368
tagged with: struts2
has answer: http://stackoverflow.com/a/22349368
tagged with: nullpointerexception

http://stackoverflow.com/a/22459374
downvote count: 0
type: Answer
score: 3
has body: You've only initialized as far as polje[1][...]. So when i is 2 (and j is anything), polje[i][j] will be null... and when you dereference it by calling charAt(0), you'll get the exception. Note that this sort of error can be avoided using List instead of arrays, where the size grows dynamically. You could even mix the two: List&lt;String[]&gt; polje = new ArrayList&lt;&gt;(); polje.add(new String[] { "Janez", "Tine", ... }; polje.add(new String[] { "Tone", "Andrej", ... }; for (String[] array : polje) { for (String item : array) { // This way you'll handle empty strings, too if (item.startsWith("A")) { fw.write(item + '\n'); } } }
answers question: http://stackoverflow.com/q/22459322
upvote count: 3

http://stackoverflow.com/a/22360872
upvote count: 1
has comment: http://stackoverflow.com/comment/33988711
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22360136
type: AcceptedAnswer
type: Answer
has body: Your error shows Unknown column 'bankbranch0_.T_BANKNUM' in 'field list' try to find if the table has the T_BANKNUM column in the table. It will not be there, remove it from the mapping pojo.
answers question: http://stackoverflow.com/q/22360136
score: 1

http://stackoverflow.com/comment/33956944
score: 0
type: Comment
type: QuestionComment
has text: I have appended System.lineSeparator() to the final record. But after I convert it to bytes and recheck the bytes, I dont see the new line.
comment on: http://stackoverflow.com/q/22342624

http://stackoverflow.com/comment/34017369
comment on: http://stackoverflow.com/q/22377551
score: 0
type: Comment
type: QuestionComment
has text: what database are you working with here?

http://stackoverflow.com/a/22442169
answers question: http://stackoverflow.com/q/22441922
score: 0
type: Answer
has body: For general checking if an email address could be valid (static validation of the format) you can use for example apache commons (see What is the best Java email address validation method?) For validation if an email address exist, a common way is to send an email to this address, with an double opt in token, that the user need to click, to confirm that he is the owner of the mail account.

http://stackoverflow.com/comment/38104647
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/24594788
score: 0
has text: did you try to use transactional context source?

http://stackoverflow.com/q/22451636
has body: So for school a task I have is to write a program that converts decimal to binary to hexadecimal. So I'm running into a problem that when I call a method that takes a para of the 4 digit binary and returns the hexadecimal character using a switch statement. It throws a StackOverflowError at line 15 and 19. package assignmentOne; public class QuestionSix { public static void main(String[] args) { new QuestionSix(); } public QuestionSix() { System.out.println(getHex("01001110")); } public String getHex(String binary) { StringBuilder hexBuilder = new StringBuilder(); int startIndex = 0; int endIndex = 4; while(true) { hexBuilder.append(getHex(binary.substring(startIndex, endIndex))); startIndex += 4; endIndex += 4; if(startIndex &gt;= binary.length()) break; } return hexBuilder.toString(); } public String getHexValue(String binarySet) { switch(binarySet) { default: break; case "0000": return "0"; case "0001": return "1"; case "0010": return "2"; case "0011": return "3"; case "0100": return "4"; case "0101": return "5"; case "0110": return "6"; case "0111": return "7"; case "1000": return "8"; case "1001": return "9"; case "1010": return "A"; case "1011": return "B"; case "1100": return "C"; case "1101": return "D"; case "1110": return "E"; case "1111": return "F"; } return null; } } And the error I'm getting is at http://pastebin.com/fx3mCtif Thanks
has comment: http://stackoverflow.com/comment/34147604
possible better answer: http://stackoverflow.com/a/22451670
has answer: http://stackoverflow.com/a/22451670
tagged with: java
tagged with: methods
tagged with: switch-statement
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22451671
has title: StackOverflowError when running a method with switch statement
tagged with: stringbuilder
accepted answer: http://stackoverflow.com/a/22451671
score: 0
answer count: 2
tagged with: stack-overflow

http://stackoverflow.com/q/22455209
tagged with: java
tagged with: sonarqube
has title: SonarQube Java plugin custom rule
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22460984
has comment: http://stackoverflow.com/comment/34153541
has body: We have implemented a custom rule based on the BaseTreeVisitor in https://github.com/SonarSource/sonar-java/tree/master/java-checks/src/main/java/org/sonar/java/checks as described in http://docs.sonarqube.org/display/SONAR/Extending+Coding+Rules. We are able to deploy it and it appears as a new plugin in Sonar, but we couldn't find a way to add it to any of the quality profiles. Is this the correct way to implement a custom rule? If yes, how to deploy &amp; use it in a profile properly?
has comment: http://stackoverflow.com/comment/56363499
has comment: http://stackoverflow.com/comment/34156479
favorite count: 0
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34156342
upvote count: 2
has comment: http://stackoverflow.com/comment/62670926
accepted answer: http://stackoverflow.com/a/22460984
type: Question

http://stackoverflow.com/a/22454081
has comment: http://stackoverflow.com/comment/34152053
score: 1
upvote count: 3
downvote count: 2
has body: mature and well tested library To verify MAC addresses? It's 6 bytes in hex optionally separated by a delimiter. It's a homework assignment or light interview question, no need to write a library. My solution is 10 lines, and it's more paranoid than necessary...
has comment: http://stackoverflow.com/comment/34156033
type: Answer
answers question: http://stackoverflow.com/q/22450819

http://stackoverflow.com/a/22421636
has comment: http://stackoverflow.com/comment/37862767
downvote count: 0
has comment: http://stackoverflow.com/comment/37879746
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/37863408
has body: The line str = "welcome"; doesn't change the value of any String - Strings can never change their values. What it does is it makes one reference point to a different String. But the reference that it reassigns is the one that's local to changeStr, not the one that is declared in main.
answers question: http://stackoverflow.com/q/22421583
score: 2

google-maps-android-api-2
tags question: http://stackoverflow.com/q/22484741
tags question: http://stackoverflow.com/q/22333284
tags question: http://stackoverflow.com/q/22487282
type: Tag
tags question: http://stackoverflow.com/q/22451133
tag name: google-maps-android-api-2
tags question: http://stackoverflow.com/q/22447823

http://stackoverflow.com/q/22415047
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/34082972
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/34083058
has answer: http://stackoverflow.com/a/22415146
has body: I am making an online game. I'm using a MySQL database. I'm trying to go through each row and pick out the port the client needs to connect to, so I can connect the client to the servers I gathered through the rows. Here is my code : public class Main { private static Connection con; static ResultSet rs; static String getServers = "SELECT * FROM servers"; public static void main(String[] args) { connect(); Window window = new Window("BLAZE", 800, 600, false); while(!window.isCloseRequested()) { update(); render(); Display.update(); Display.sync(60); } } private static void connect() { try{ Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://sql2.freesqldatabase.com/sql233105", "sql233105", "eD7*wA7!"); PreparedStatement st = con.prepareStatement(getServers); rs = st.executeQuery(); //Loop through each row and get info // Psuodo code for(int i = 0; i &lt; NUMBER OF ROWS; i++) { int port = ROW.getColumn().getValue(); } } catch(Exception e) { e.printStackTrace(); } } private static void update() { } private static void render() { } }
tagged with: java
tagged with: mysql
has title: Java MySQL - How do I get info from each row and column

http://stackoverflow.com/comment/34159117
type: AnswerComment
has text: If `Person` class is declared inside initialization block (like in OP example) then there is no `Test.Person` type. That is why OP is asking "Does that mean **Initializer Block** can't be used for defining classes?". What you are saying in your answer it is perfectly fine, just use instance of outer class, while it is not. That is why Jon Skeet removed his first answer which was similar to yours.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22414045

http://stackoverflow.com/comment/34042791
score: 0
comment on: http://stackoverflow.com/q/22382829
has text: Do you know how can i solve this?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34096717
type: QuestionComment
has text: i don't know.. our teacher just gave that code to us..
comment on: http://stackoverflow.com/q/22422974
score: 0
type: Comment

http://stackoverflow.com/comment/33986734
type: QuestionComment
type: Comment
has text: List<?> means the list may contain anything, but all of those anythings are of the same type. Since you don't know what they are, you can't add one.
score: 0
comment on: http://stackoverflow.com/q/22359772

http://stackoverflow.com/a/22421851
score: 1
has comment: http://stackoverflow.com/comment/34095740
has comment: http://stackoverflow.com/comment/34095301
answers question: http://stackoverflow.com/q/22421805
downvote count: 0
has comment: http://stackoverflow.com/comment/34095238
type: Answer
has comment: http://stackoverflow.com/comment/34094859
has comment: http://stackoverflow.com/comment/34095839
has comment: http://stackoverflow.com/comment/34096186
has comment: http://stackoverflow.com/comment/34095115
has comment: http://stackoverflow.com/comment/34095905
has body: The least you should do is wrap FileOutputStream int a BufferedOutputStream, there are very few instances where you should not use BufferedInputStream/BufferedOutputStream. Try it and see how long it would take now.
upvote count: 1

http://stackoverflow.com/q/22456284
has body: I'm creating a UML static class diagram for AsyncTask. How should I denote doInBackground(Params... params), which has a variable number of argumetns?
has comment: http://stackoverflow.com/comment/34155713
accepted answer: http://stackoverflow.com/a/22585055
has comment: http://stackoverflow.com/comment/34382368
has comment: http://stackoverflow.com/comment/34155293
score: 0
has comment: http://stackoverflow.com/comment/34382612
tagged with: java
has comment: http://stackoverflow.com/comment/34158027
tagged with: uml
has comment: http://stackoverflow.com/comment/34166649
has comment: http://stackoverflow.com/comment/34382467
has comment: http://stackoverflow.com/comment/34155554
has comment: http://stackoverflow.com/comment/34382413
possible better answer: http://stackoverflow.com/a/22481743
has answer: http://stackoverflow.com/a/22585055
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22481743
tagged with: variadic-functions
has title: How to represent Java varargs in a UML static class diagram?
type: Question
has comment: http://stackoverflow.com/comment/34382543
answer count: 2

http://stackoverflow.com/q/22389400
has comment: http://stackoverflow.com/comment/34038510
tagged with: jackson
has title: JsonParseException while trying to map Json
type: Question
has comment: http://stackoverflow.com/comment/34038549
tagged with: android
has answer: http://stackoverflow.com/a/22389452
has comment: http://stackoverflow.com/comment/34038797
has comment: http://stackoverflow.com/comment/34038632
score: 0
has comment: http://stackoverflow.com/comment/34038168
has body: I am trying to map Json to POJO but I am getting this exception: This is my code: ObjectMapper mapper = new ObjectMapper(); try { InputStream is = getActivity().getAssets().open("user.json"); List&lt;MessageCenterResponse&gt; mcr = (List&lt;MessageCenterResponse&gt;) mapper.readValue(content, MessageCenterResponse.class); System.out.println(mcr); } catch (IOException ex) { ex.printStackTrace(); } I am getting the following exception: org.codehaus.jackson.JsonParseException: Unexpected character ('a' (code 97)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: java.io.StringReader@41e86930; line: 1, column: 2] Is it something related to type issue?
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34038898
has comment: http://stackoverflow.com/comment/34038670

http://stackoverflow.com/comment/34117704
has text: You may also want to take a look at the [builder pattern](http://www.oodesign.com/builder-pattern.html)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22434894

http://stackoverflow.com/q/22332309
score: 1
tagged with: java
has body: I have the following method: @RequestMapping(value = "/resource/{resourceId}", method = RequestMethod.GET) @ResponseStatus(value = HttpStatus.OK) public @ResponseBody ResourceDto getChannelById(@PathVariable Long resourceId, QueryParameters queryParameters) { ... } Which I can call this way: GET localhost:8080/someName/resources/1?attr1=1 And attr1 is correctly binded in the QueryParameters object. I would like to recognize when the call is made with an unknown attribute(attribute not present in the QueryParameters class): GET localhost:8080/someName/resources/1?attr1=1&amp;attrUnknown=2 And throw an error. Is possible to recognize an attribute that is not present in the object? Edit: Relevant part of the QueryParameters private List expand = new ArrayList&lt;>(); getters and setters...
type: Question
has comment: http://stackoverflow.com/comment/33941707
has comment: http://stackoverflow.com/comment/33938956
has comment: http://stackoverflow.com/comment/33939154
tagged with: validation
downvote count: 0
favorite count: 0
has title: Spring MVC request param invalid parameter name
type: UnansweredQuestion
upvote count: 1
tagged with: request
tagged with: spring
tagged with: spring-mvc
answer count: 0

http://stackoverflow.com/comment/33998861
comment on: http://stackoverflow.com/q/22360716
type: Comment
type: QuestionComment
has text: Ah sorry, I tried to pull together what my code looks like. But I re-edited again to alter those errors. But the question still arises, are values suppose to be the exact same from when you write the image back out?
score: 0

http://stackoverflow.com/q/22374215
has answer: http://stackoverflow.com/a/24945014
type: Question
tagged with: mocking
tagged with: mockito
has title: Mockito spy method not working
possible better answer: http://stackoverflow.com/a/22387686
upvote count: 7
tagged with: spy
favorite count: 0
has answer: http://stackoverflow.com/a/22387582
accepted answer: http://stackoverflow.com/a/22387582
answer count: 4
has answer: http://stackoverflow.com/a/22387686
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78346935
downvote count: 0
score: 7
tagged with: java
has body: I'm in trouble with mockito.spy method. I'm recently arrived on a "old" project and my first task is to add mockito in it, and to do real unit test :) the project has many conception problems but its not the point here ;) I explain my problem: I have a class public class Tutu{ public Tutu(){ } } public class Toto{ public Toto(){ } public int executeToto(Tutu tutu){ //do some stuff return 5; } } public class Titi{ private Toto toto; public Titi(){ this.toto = new Toto(); } public void executeTiti(){ //do some stuff Tutu tutu = new Tutu(); int ret = this.toto.executeToto(tutu); //do some stuff } } in my test class TitiTest.java I want to test only executeTiti, I don't want to test executeToto stuff because this class has is own test class TotoTest.java. but as you can see, toto is instantiate in titi constructor so I try something like this: (I'm using PowerMock in my test too, so I'm using PowerMockRunner but it doesn't seem to be the problem) @RunWith(PowerMockRunner.class) public class TitiTest { @Test public void testExecuteTiti(){ Toto toto = Mockito.spy(new Toto()); Mockito.doReturn(2).when(toto).executeToto(Mockito.any(Tutu.class)); Titi testedObject = new Titi(); testedObject.executeTiti(); } } but the real method is always calling and ret = 5 everytime :( Do I miss something? I read many post about this on stackoverflow and try all solution but it's never work because I think I'm doing right thing. I use junit4.11/powermock1.5.4/mockito1.9.5

http://stackoverflow.com/q/22456236
has title: why doesn't Tomcat 7x require WSServletContextListener and WSServlet configured in web.xml for Jax-ws service deployment?
tagged with: java
tagged with: jax-ws
tagged with: tomcat6
type: Question
has body: I'm deploying and testing a simple Jax-ws service in both Tomcat6x and Tomcat7x with the jaxws-ri-2.2.8 added to both the server lib directories . Tomcat6x requires the WSServletContextListener and WSServlet and configured in web.xml whereas in Tomcat 7x the webservices gets deployed without the WSServletContextListener and WSServlet configuration. Whats different in Tomcat7 that makes the web.xml configuration optional?
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22469089
possible better answer: http://stackoverflow.com/a/22457026
score: 7
favorite count: 0
has answer: http://stackoverflow.com/a/22457026
accepted answer: http://stackoverflow.com/a/22469089
tagged with: tomcat7
tagged with: web-services
upvote count: 7
type: AnsweredQuestion

http://stackoverflow.com/comment/34131376
has text: @Deepsthecoder: the code print 2 in both conditions
comment on: http://stackoverflow.com/q/22438677
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22454427
has title: Sending and Receiving JSON data from a restful webservice ?
score: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/34158379
type: UnansweredQuestion
tagged with: web-services
type: Question
has comment: http://stackoverflow.com/comment/34152491
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Here is my POJO Code : /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.akapoor.ws.testws.model; import java.io.File; import java.io.IOException; import javax.annotation.ManagedBean; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jettison.json.JSONObject; /** * * @author */ @XmlRootElement(name = "person") @XmlType(propOrder = {"id", "fullName", "age"}) public class Person{ private int id; private String fullName; private int age; //Must have no-argument constructor public Person() { } public Person(String jsonRepresentation) { //Converts Java Object in &amp; From Json ObjectMapper mapper = new ObjectMapper();//Jackson Person object; try { /*Deserialisierung * JSON Unmarshalling (FROM JSONrepresentation to Object) * Converting JSON String */ object = mapper.readValue(jsonRepresentation, Person.class); //Jackson JSON } catch (IOException e) { throw new WebApplicationException(Response.status(Status.BAD_REQUEST). entity("Couldn´t parse JSON string: " + e.getMessage()).build()); } this.age = object.getAge(); this.fullName = object.getFullName(); this.id = object.getId(); } /* toPack from String to Object * Deserializes an Object of class Person from its JSON representation+ * Constructor with String Json */ // JSON to Person public static Person fromString (String jsonRepresentation) { //Converts Java Object in &amp; From Json ObjectMapper mapper = new ObjectMapper();//Jackson Person object; try { /*Deserialisierung * JSON Unmarshalling (FROM JSONrepresentation to Object) * Converting JSON String */ object = mapper.readValue(jsonRepresentation, Person.class); //Jackson JSON } catch (IOException e) { throw ne…
answer count: 1
has answer: http://stackoverflow.com/a/22457979

http://stackoverflow.com/a/56866792
upvote count: 2
has body: I experienced the same issue, however in my case it was due to the Configuration settings in IntelliJ IDEA. Even though the project SDK (File -> Project Structure) was set to Java 11, the JRE in the Run/Debug Configurations (Run -> Edit Configurations) was set to Java 8. After changing that to Java 11, it worked like a charm.
downvote count: 0
has comment: http://stackoverflow.com/comment/127823057
type: Answer
answers question: http://stackoverflow.com/q/22381202
score: 2

http://stackoverflow.com/comment/33942390
comment on: http://stackoverflow.com/q/22329113
type: Comment
type: QuestionComment
score: 0
has text: @PeterMmm I disagree . There must be some mechanism to do that faster . I have experience using setAsciiStream with csv for prepared statement purposes . It is lightning fast . . . There must be a work around

http://stackoverflow.com/comment/34034860
score: 0
type: Comment
type: QuestionComment
has text: Also; replacing the data with random combinations of letters and numbers seems to meet your stated requirements.
comment on: http://stackoverflow.com/q/22387577

http://stackoverflow.com/comment/34057360
has text: Also it is not clear what you are trying to achieve. Are you wanting to access the android device externally via the gateway?
type: QuestionComment
comment on: http://stackoverflow.com/q/22399994
type: Comment
score: 0

http://stackoverflow.com/comment/34077933
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22408117
has text: Thanks Eenvincible. I am getting, but partially. Can you please explain in detail with a clear example.

http://stackoverflow.com/comment/137489364
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22409655
has text: I switched `compile` with `implementation` and it worked.

http://stackoverflow.com/comment/34217545
comment on: http://stackoverflow.com/q/22487138
type: QuestionComment
type: Comment
has text: possible duplicate of [Create JSON schema from Java class](http://stackoverflow.com/questions/17783909/create-json-schema-from-java-class)
score: 0

rxtx
tags question: http://stackoverflow.com/q/22373090
tag name: rxtx
type: Tag

http://stackoverflow.com/q/22431217
linked to: http://stackoverflow.com/q/1704202
tagged with: bytecode
answer count: 1
score: 4
tagged with: class
accepted answer: http://stackoverflow.com/a/22431230
has title: Is the code of any Java application available to anyone?
favorite count: 0
has comment: http://stackoverflow.com/comment/34111231
has comment: http://stackoverflow.com/comment/34111253
has comment: http://stackoverflow.com/comment/34111225
tagged with: reverse-engineering
downvote count: 2
has body: Any class file can be decompiled to original Java source code relatively easily. Does this mean that the source code of any Java program, unless encrypted in some way, is relatively easily available to anyone who has the final program? If so, then isn't this a problem for major companies that don't want their trade secrets or their work available to anyone?
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34111198
tagged with: java
has comment: http://stackoverflow.com/comment/34111959
has answer: http://stackoverflow.com/a/22431230
type: Question

http://stackoverflow.com/comment/34000699
score: 0
comment on: http://stackoverflow.com/q/22367526
has text: you could take the Max - int1 and Max - int2 and whichever is closest to 0 would be your closest int
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22388515
has comment: http://stackoverflow.com/comment/34043856
has comment: http://stackoverflow.com/comment/34037436
answers question: http://stackoverflow.com/q/22387336
score: 0
has body: The subclass' onCreate method should be called when it is created by Android (see Understanding the Lifecycle Callbacks), which for example happens when an Intent to that Activity is issued. Edit: I just saw @Mgamerz answer and realised that line in your superclass Activity was where you were trying to make Android create the subclass Activity. This next paragraph is somewhat irrelevant now, but note that you do still need to add the subclass activity to the manifest file. Are you sure you're application is actually starting the subclass Activity, or is it still starting the superclass Activity? You might have to have a look at your project's "AndroidManifest.xml" file and check that there's an &lt;activity /&gt; element corresponding to the subclass Activity. I think splitting the class into a superclass and a subclass is sensible if the superclass has functionality which can/will be re-used by multiple subclass Activities. For example you might have subclass activities like DirectionsActivity and SearchActivity which have some common map-related activity provided by their superclass MapActivity. Even if you have only one subclass Acitivty now, it may still make sense to have a superclass and a subclass if you think you're likely to write additional map-related activities later on. I my opinion it's not sensible to split the class into a superclass and a subclass just because the single class was getting too long. If you do just want a helper class and you don't expect to have more MapActivity subclasses in the future, you could make a MapUtils class in the same package as the Activity class, which would define some static helper methods. For example, you could put your GetProvider method into such a helper class. Sketch example (note the package-private access of MapHelper): class MapHelper { static Location getProvider() { // ... return location; } // Other helper methods here } public class MyActivity extends Activity { @Override public void onCreate(Bundle save…
type: Answer
has comment: http://stackoverflow.com/comment/34036901

http://stackoverflow.com/a/22370405
type: Answer
score: 2
has body: This is not how transactions work when using Spring.The transactional method must be called from outside and not within other method. The reason is that in your case Spring would not be able to apply transactions via AOP proxy since call to methodB is directly from methodA and Spring would have no means to apply the transactional aspect before methodB gets called. For more information have a look here in section "Understanding AOP proxies" and also here in section 10.5.1
answers question: http://stackoverflow.com/q/22370271
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/34163282
has text: @Conan Are you within the same session when checking?
comment on: http://stackoverflow.com/a/22459772
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22425955
type: Question
has body: //Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException //at Sudoku.azar(Sudoku.java:94) //at Sudoku$EscuchadorStart.actionPerformed(Sudoku.java:106) this is the error that shows after pressing the button start, the program compiles but it does not work when press the Button Start I used a throws IOException in the methot but when I call that methot it says that I need to catch the IOEXception the text file juegos is a text file with 2 sudokus games, so it has 9 columns and 18rows this is the code import java.awt.event.*; import java.awt.*; import java.io.*; public class Sudoku extends Frame{ private TextField[][] cuadrados=new TextField[9][9]; private Button start=new Button ("Start"); private Button check=new Button("Check"); private Button clear=new Button("Clear"); private Button exit=new Button("Exit"); private int[][] numeros=new int[9][9]; public int[][] auxiliar; public Sudoku(){ setSize(500,500); setTitle("Sudoku"); setLayout(new BorderLayout()); Panel pan=new Panel(); pan.setLayout(new GridLayout(9,9)); add(pan, BorderLayout.CENTER); Font myFont = new Font("ARIALBD",Font.BOLD,30); for(int a=0;a&lt;9;a++){ for(int b=0;b&lt;9;b++){ cuadrados[a][b]=new TextField(); cuadrados[a][b].setFont(myFont); cuadrados[a][b].setBackground(Color.pink); cuadrados[a][b].setForeground(Color.RED); pan.add(cuadrados[a][b]); if(a&gt;=0&amp;&amp;a&lt;3){ if((b&gt;=0&amp;&amp;b&lt;3)||(b&gt;=6&amp;&amp;b&lt;9)){ cuadrados[a][b].setBackground(Color.CYAN); } } if(a&gt;=3&amp;&amp;a&lt;6){ if(b&gt;=3&amp;&amp;b&lt;6){ cuadrados[a][b].setBackground(Color.CYAN); } } if(a&gt;=6&amp;&amp;a&lt;9){ if((b&gt;=0&amp;&amp;b&lt;3)||(b&gt;=6&amp;&amp;b&lt;9)){ cuadrados[a][b].setBackground(Color.CYAN); } } } } Panel aux=new Panel(); aux.setLayout(new FlowLayout()); aux.add(start); aux.add(check); aux.add(clear); aux.add(exit); add(aux, BorderLayout.SOUTH); start.addActionListener(new EscuchadorStart()); check.addActionListener(new EscuchadorCheck()); clear.addActionListener(new…
upvote count: 0
tagged with: arrays
score: -1
has answer: http://stackoverflow.com/a/22426093
answer count: 1
has comment: http://stackoverflow.com/comment/34101547
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34101570
has title: problems with ioException in sudoku code
tagged with: java
tagged with: methods
downvote count: 1

http://stackoverflow.com/a/22364147
downvote count: 0
answers question: http://stackoverflow.com/q/22334013
upvote count: 2
type: Answer
score: 2
has body: As Andrei says, this isn't an OpenERP question, this is just a general python question. You will need to look at the python SOAP libraries to make SOAP calls to your java web-service. As a caution though, think carefully about hooking the SOAP call into the workflow as you will get all your transactions failing in OpenERP if the java server is down. Unless you need them to be synchronous would be better to use a queue (Celery, Rabbit etc) and just dump the message into the queue. You can use the OpenERP scheduled tasks to kick of a synchronise process when you need.

http://stackoverflow.com/q/22432837
type: Question
has title: Inserting space underneath line, but not a new line (Java)
has comment: http://stackoverflow.com/comment/34114093
score: 1
has body: Having a bit of confusion on a simple issue. I have a new line in my output, however, the necessary output just shows a line being skipped. Here is what I mean. What can I do to my code to match the output on the right? if (listData.isEmpty()) { System.out.println("no customer"); System.out.println(); }
tagged with: java
has comment: http://stackoverflow.com/comment/34113979
downvote count: 0
has comment: http://stackoverflow.com/comment/34113987
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34114032
has comment: http://stackoverflow.com/comment/34113974
has comment: http://stackoverflow.com/comment/34114047
has comment: http://stackoverflow.com/comment/34113998
answer count: 0
upvote count: 1

http://stackoverflow.com/comment/34047819
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22395003
has text: Any coding effort so far?

http://stackoverflow.com/comment/34612802
type: Comment
score: 1
has text: This will _not_ do what the question asked about, you'd need to swap the order of the statements in the third `if`.
type: AnswerComment
comment on: http://stackoverflow.com/a/22461601

http://stackoverflow.com/q/22386822
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34069549
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/34033613
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34034502
tagged with: java
has answer: http://stackoverflow.com/a/22387256
accepted answer: http://stackoverflow.com/a/22387256
answer count: 1
has title: Aysnctask doesnt call the onPostExecute method when it should
has body: Within the Asynctask the onPostExecute method is not being called, however, neither are the Logcat prints after the method within the doinbackground. Any ideas? public class connectTask extends AsyncTask&lt;String,String,String[]&gt; { String FilmId, Name, Certificate, Duration, Director, Description, ReleaseDate, Cast; @Override protected String[] doInBackground(String... params) { //we create a TCPClient object and mTcpClient = new TCPClient(new TCPClient.OnMessageReceived() { @Override //here the messageReceived method is implemented public void messageReceived(String message) { //this method calls the onProgressUpdate //Log.e("TCP Client", message); try { JSONObject json = new JSONObject(message); FilmId = (String) json.get("FilmId"); Name = (String) json.get("Name"); Certificate = (String) json.get("Certificate"); Duration =(String) json.get("Duration"); Director = (String) json.get("Director"); Description = (String) json.get("Description"); ReleaseDate = (String) json.get("ReleaseDate"); Cast = (String) json.get("Cast"); Log.e("FilmId: ", FilmId); Log.e("Name: ", Name); Log.e("Cert: ", Certificate); Log.e("Duration: ", Duration); Log.e("Director: ", Director); Log.e("Description: ", Description); Log.e("ReleaseDate: ", ReleaseDate); Log.e("Cast: ", Cast); JSON[0] = FilmId; JSON[1] = Name; System.out.println(JSON[1]); Log.e("work","work"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); mTcpClient.run(""); Log.e("work","please"); return null; } @Override protected void onPostExecute(String[] result) { // TODO Auto-generated method stub Log.e("work","goddammit"); Intent FilmInfo = new Intent(FullscreenActivity.this, FilmInfo.class); FilmInfo.putExtra("NamePass", JSON[1]); FullscreenActivity.this.startActivity(FilmInfo); super.onPostExecute(result); } @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); } } I've already checked various other questions and they haven't helpe…

http://stackoverflow.com/q/22370863
score: 0
has title: Exception in thread AWT-EventQueue-0 java.lang.StackOverflowError
has comment: http://stackoverflow.com/comment/34007619
has comment: http://stackoverflow.com/comment/34006063
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34006007
tagged with: swing
has comment: http://stackoverflow.com/comment/34007290
type: Question
has comment: http://stackoverflow.com/comment/34006058
has comment: http://stackoverflow.com/comment/34006171
has body: I just want to ask for help since I do not know if what this error caused my program not to run. Before I went here to ask for help, I did a little testing and debbuging in order for me to locate if what was the root caused of the error when I try to run my program. see the code below public class AcademicPersonnelForm{ public AcademicPersonnelForm(){ create(); } public static void main(String [] args){ SwingUtilities.invokeLater(new Runnable(){ public void run(){ new AcademicPersonnelForm(); } }); }//close main below is my method called "create()" where I created my JFrame. inside this method i declare all the necesarry components I needed to be inserted in the Frame.(component included only where the error occured) public void create(){ gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.LINE_START; gbc.ipady = 20; gbc.ipadx = 20; gbc.gridx = 1; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; textEmpNo.addKeyListener(new MyRetrieve()); textEmpNo.setPreferredSize(new Dimension(80,5)); textEmpNo.setDocument(new LengthRestrictedDocument(3)); //add textEmpNo in the main panel gbl.setConstraints(textEmpNo, gbc); mainPanel.add(textEmpNo); } I found out that the error mentioned above occured in "textEmpNo.addKeyListener(new MyRetrieve());", because when I tried to put comment in this code the program works fine. "new MyRetrieve()" is a subclass where I can generate and retrieve employee number. see code below. public class MyRetrieve implements KeyListener{ search_employee_record_db serdb = new search_employee_record_db(); generate_emp_num_db gendb = new generate_emp_num_db(); public void keyReleased(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_ENTER){ serdb.EMPNUM = textEmpNo.getText(); //if(serdb.EmpNo.equals(textEmpNo.getText())){ if(textEmpNo.getText().equals(serdb.EMPNUM)){ serdb.retrieved(); //textEmpNo.setText(serdb.EmpNo); textFName.setText(serdb.FName); textLName.setText(serdb.LName); comboGender.setSelectedItem(serdb.GENDER); textAddress.…
has comment: http://stackoverflow.com/comment/34006297

http://stackoverflow.com/comment/33961146
has text: That's why I don't want to use SQL statements, But with that second approach EntityManager is used in implementation so it is aware of everything... Am I right on this? Does anyone done something similar?
score: 0
comment on: http://stackoverflow.com/q/22344870
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22340888
has comment: http://stackoverflow.com/comment/33953864
has body: here is your problem: for(int i=0; i &lt;= n-1 ; i++) { Vowels.add(sc.nextLine()); ^ } "It is not printing anything" because it waiting for your input What you need is: public static void main(String[] args) { Scanner sc = new Scanner(System.in); List &lt;String&gt; Vowels = new ArrayList&lt;String&gt;(); System.out.println("What is your string? "); String abc = sc.nextLine(); int n = abc.length(); for(int i=0; i &lt; n ; i++) { Vowels.add(new StringBuilder().append("").append(abc.charAt(i)).toString()); } for(int j=0; j&lt; Vowels.size();j++) System.out.print(Vowels.get(j)); } Input : Burger Output: Burger If you want your output as [B, u, r, g, e, r], then just do: System.out.println(Vowels); //without for loop
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33954033
has comment: http://stackoverflow.com/comment/33954014
accepted answer of: http://stackoverflow.com/q/22340826
answers question: http://stackoverflow.com/q/22340826

http://stackoverflow.com/comment/65943431
type: Comment
comment on: http://stackoverflow.com/a/39206916
has text: This one is the best answer
score: 1
type: AnswerComment

http://stackoverflow.com/q/22430226
type: Question
has comment: http://stackoverflow.com/comment/34113294
downvote count: 0
has comment: http://stackoverflow.com/comment/34111719
answer count: 1
has body: I'm working with Swing's ProgressMonitor. This produces this nice dialog box for me: Honestly, I think there's a flaw in the design of ProgressMonitor: What do you think happens if the user closes the dialog box by pressing the red/white cross ? Yep, you guessed it: It simply closes/hides the dialog and whatever job you have going in the background of course continues. There's no way to get the dialog box back, afaik. Closing the window should either mean "cancel" or simply not be allowed, because I need the user to either wait for the task to complete or cancel it. How do I achieve either of this? If I could just get a reference to that JDialog then I could do: dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); but I can't get that reference. UPDATE AND FINAL ANSWER So, I wasn't telling you the full story. In fact I use ProgressMonitorInputStream which of course under the covers use ProgressMonitor, so I thought it didn't matter for the case at hand. But it does! Andrew is right when he says that ProgressMonitor sets the isCancelled flag when the dialog is closed. This can be verified by looking at the JDK sources. But in order to catch that event you'll need a PropertyChangeListener. When working with a ProgressMonitorInputStream you are likely not to have one (like me) because updating the ProgressMonitor is all taken care of by ProgressMonitorInputStream so you won't have to do that part yourself. I was under the assumption that ProgressMonitorInputStream's raison d'etre was in not having to do boilerplate coding. I have to say that I find the benefits of using a ProgressMonitorInputStream to be extremely small or even negative compared to a DIY approach.
score: 1
has answer: http://stackoverflow.com/a/22432366
favorite count: 0
has comment: http://stackoverflow.com/comment/34109628
has title: Disable dialog close for ProgressMonitor
accepted answer: http://stackoverflow.com/a/22432366
upvote count: 1
has comment: http://stackoverflow.com/comment/34112728
tagged with: swing
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/7691629

http://stackoverflow.com/q/22438936
tagged with: ehcache
has title: ehCache WebPage Cache Key based on Cookie
has answer: http://stackoverflow.com/a/22486324
tagged with: cookies
type: UnansweredQuestion
tagged with: java
type: Question
has body: Background I am looking to cache HTML response of some of my pages. Since ehCache is already being used in my application, it is obvious to look for a solution there. It just so happen that ehCache has some out of the box filter like SimplePageCachingFilter available. Problem These filter generally use URL including the query string as keys. In my case different users will have the same url and the contents for that page will be different. I can not add the user id in the query string. So perhaps the solution for me is to cache pages based on cookie [ or use some other unique user id] as part of the key. Question My question is how to use a different key, other than the one being used by SimplePageCachingFilter. The documentation suggests to override javax.servlet.http.HttpServletRequest to take into account of significant QS parameter , but does not talk about how can I completely over ride the way key is formulated. Lack of sample code is also a problem so I would appreciate if someone can point me to some sample code with better control of keys. Also it would be nice to have control to invalidate the cache, rather than just waiting for the contents to expire by themselves, Though not essential for my application.
tagged with: performance
tagged with: caching
score: 0
answer count: 1

cdi
tags question: http://stackoverflow.com/q/22463102
tags question: http://stackoverflow.com/q/22376673
tags question: http://stackoverflow.com/q/22418299
type: Tag
tag name: cdi
tags question: http://stackoverflow.com/q/22338520

http://stackoverflow.com/comment/34146914
comment on: http://stackoverflow.com/q/22450745
has text: is it a header parameter>
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34115519
type: QuestionComment
has text: have you tried: `System.out.println(s.toString());`
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22433643

http://stackoverflow.com/comment/34076624
type: Comment
comment on: http://stackoverflow.com/a/22392617
has text: @user2835815 Well, if you applied the fix correctly, it should work. You'll have to provide a specific set of parameters for testing if you think it's still broken. I posted my code for comparison.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/73320243
type: Comment
has text: Do you have a source of documentation that defines the NFC subsystem calls? My searches have been fruitless.
comment on: http://stackoverflow.com/a/22352936
score: 0
type: AnswerComment

http://stackoverflow.com/a/22471799
has body: It's not clear what you are trying to do. First of all, classes with bounds like class GeneCarrier&lt;T extends GeneCarrier&lt;T&gt;&gt; are not useful. You should almost always use class GeneCarrier&lt;T&gt;. Your actual error results from the fact that Human extends Organism, which extends GeneCarrier&lt;Organism&gt;, and so Human cannot possibly extend GeneCarrier&lt;Human&gt;, and Gene requires its bound T to extend GeneCarrier&lt;T&gt;. It's unclear why class Gene has this requirement at all. You do not show any code for that class, so there doesn't seem to be any reason. What bound you need very much depends on what operations you perform on the type T. For example, if all you do is pass the type T into a method of GeneCarrier&lt;T&gt; that takes type T, then a bound of T extends GeneCarrier&lt;? super T&gt; would suffice. And with this bound Gene&lt;Human&gt; would work fine. Or, perhaps even a bound of &lt;T&gt; will suffice; it's hard to tell without any code. If it is actually required that T extends GeneCarrier&lt;T&gt; (which is not very likely), then Human must extend GeneCarrier&lt;Human&gt;. In this case, Organism cannot be defined the way it is. If you take Paul Bellora's suggestion of making Organism also parameterized, then it would look like this: public abstract class GeneCarrier&lt;T&gt; { protected Gene&lt;T&gt; gene; //... } public abstract class Organism&lt;T&gt; extends GeneCarrier&lt;T&gt;{ //... } public class Human extends Organism&lt;Human&gt; { public void foo(){ Gene&lt;Human&gt; g; } }
score: 0
answers question: http://stackoverflow.com/q/22431364
type: Answer

http://stackoverflow.com/comment/34123312
comment on: http://stackoverflow.com/a/22438082
score: 0
type: Comment
type: AnswerComment
has text: @nachokk I strongly agree with you. **I always respect Design Patterns**

http://stackoverflow.com/q/22389431
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has title: formatted="false" for Quantity Strings (Plurals)
type: UnansweredQuestion
score: 1
has body: I'm using a quantity string and eclipse tells me: error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute? But adding formatted="false" to the plurals or item tag doesn't solve the problem. Eclipse still comes up with the same error. Here an example xml code which produces the error: time: %02d:%02d What do I have to do?
type: Question
tagged with: java
tagged with: eclipse
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25419461

http://stackoverflow.com/a/22357935
has comment: http://stackoverflow.com/comment/33983374
score: 1
accepted answer of: http://stackoverflow.com/q/22357803
has comment: http://stackoverflow.com/comment/33983607
upvote count: 1
answers question: http://stackoverflow.com/q/22357803
has body: This is what you want... List&lt;Object[]&gt; rowList = new ArrayList&lt;Object[]&gt;(); rowList.add(new Object[] { 'a', 5, 6 }); rowList.add(new Object[] { 'b', 5, 6 }); rowList.add(new Object[] { 7, 8 }); for (Object[] row : rowList) { System.out.println("Row = " + Arrays.toString(row)); } And the output is Row = [a, 5, 6] Row = [b, 5, 6] Row = [7, 8]
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33983202
type: Answer

http://stackoverflow.com/comment/34103225
score: 0
type: AnswerComment
has text: @user3423663: I still don't follow your argument for why you think the loop is infinite, but I am going to leave it at that.
type: Comment
comment on: http://stackoverflow.com/a/22426791

http://stackoverflow.com/comment/33951759
has text: NetBeans freezes on a core i7 system ? wow
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22339586
score: 0

file-descriptor
tags question: http://stackoverflow.com/q/22366589
type: Tag
tag name: file-descriptor

http://stackoverflow.com/a/22372748
has body: You can use Array of Linked List where in the Array you will have Column Header and each element of Array A(1) (Column) will point to corresponding Row.It is an interesting structure as it combines a static structure (an Array use to store Column) and a dynamic structure (Linked Lists use to store Rows) to form a useful data structure. Hope this might help you Thanks
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22370807

http://stackoverflow.com/comment/33997736
type: Comment
has text: Some hours away from the computer gave me a solution similar to yours, it is a much better option than turn Location serializable. Thanks for all the help provided.
comment on: http://stackoverflow.com/a/22365541
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34143621
score: 1
comment on: http://stackoverflow.com/a/22449238
has text: @user3118495 - in case you didn't realize, your server is NOT reachable from where we are out on the internet so the jsFiddle doesn't help us much.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34131790
type: Comment
comment on: http://stackoverflow.com/a/22442235
has text: sorry if i ask a question and your like god just look at the link
score: 0
type: AnswerComment

drupal-7
tags question: http://stackoverflow.com/q/22362419
type: Tag
tag name: drupal-7

http://stackoverflow.com/comment/34244012
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22475471
has text: I think that you have conflicts with .jars . can you put you pom.xml?
score: 0

http://stackoverflow.com/comment/34190501
has text: i'm unable to put that warning ,as its type:safety check.also its giving java.lang.OutOfMemoryError: Java heap space exception.i tried to increase the heap size also but it didn't not works.
comment on: http://stackoverflow.com/a/22476237
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/22334215
has body: I'm trying to port an app from MySQL to Apache Derby. The system uses the Spring framework. What I am finding is that the system sends SQL like "Select blah from table where myint = '123'. I want to change that to just 123 without the quotes - can anyone tell me how to do this? I can open it up in NetBeans, but I am new to this area. It's based here https://github.com/TGAC/TGACBrowser. Any ideas, URLs, references and/or suggestions appreciated. Paul...
has title: MySQL spring framework port to Apache Derby: Remove quotes in SQL?
tagged with: sql
answer count: 0
has comment: http://stackoverflow.com/comment/33942177
type: Question
has comment: http://stackoverflow.com/comment/33944278
tagged with: spring
tagged with: quotes
score: 0
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/33943120
has comment: http://stackoverflow.com/comment/33943642
has comment: http://stackoverflow.com/comment/33944701
type: UnansweredQuestion

http://stackoverflow.com/comment/34093789
type: QuestionComment
has text: @GabeSechan *"Now if the thread that's using it wants to do more than a null check"* I've assumed that `callAnotherMethod()` will be using the data; that may not be a correct assumption.
comment on: http://stackoverflow.com/q/22420988
score: 0
type: Comment

http://stackoverflow.com/comment/34042901
has text: If you didn't create an object, then the method isn't being called. Analogy: just because the architect drew up blueprints doesn't mean the house is built.
comment on: http://stackoverflow.com/q/22392083
type: QuestionComment
type: Comment
score: 6

http://stackoverflow.com/comment/34128977
has text: Are you able to write it as an `xps` file?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22435894
type: Comment

http://stackoverflow.com/q/22447574
has title: Sending messages(notification) to a group - Android
tagged with: mysql
type: Question
has body: I am writing an android application in which i need to send a notification to a group of users. I have two group of users in the database. If a user press a button "Notify Group 1" in the android app , i need to send the notification to all the group 1 users. How i implement this logic? I think the same logic is using in the group chat . Can you provide me the sample code for android and server side? Thanks.. Zacharia
downvote count: 0
accepted answer: http://stackoverflow.com/a/22447743
tagged with: push-notification
answer count: 1
favorite count: 0
score: 8
upvote count: 8
linked to: http://stackoverflow.com/q/12408718
tagged with: android
tagged with: php
has answer: http://stackoverflow.com/a/22447743
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22356341
type: Answer
answers question: http://stackoverflow.com/q/22355927
has comment: http://stackoverflow.com/comment/33980510
score: 0
has body: The answer is clear. You have assigned to integers some diferent values.hexNumber is initialized to decimal value 122, even if the representation you use for that is hexadecimal. decNumber is initialized to decimal value 122, so when you compare hexNumber and decNumber you will get true because it's really the same value. Finally binNumber is initialized to the decimal value 1111010, so if you compare it with one of the other numbers you will get false.

http://stackoverflow.com/q/22369575
accepted answer: http://stackoverflow.com/a/22375694
type: AnsweredQuestion
has body: Could you give me a simple example on how to delete a record from my database using SQLContainer. I have tried using SQLContainer.Removeid(itemID) but it still won't work. Hope someone can help me. This is what I have tried: try { SQLContainer DeleteContainer = new SQLContainer(new TableQuery("tbl_grade", connectionPool)); Object ItemID = "10"; DeleteContainer.removeItem(ItemID); DeleteContainer.commit(); } catch (SQLException ex) { ex.printStackTrace(); }
has comment: http://stackoverflow.com/comment/34008677
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34005918
tagged with: vaadin
has answer: http://stackoverflow.com/a/22375694
score: 0
answer count: 1
has title: Vaadin Remove a record from database
has comment: http://stackoverflow.com/comment/34045382
has comment: http://stackoverflow.com/comment/34005434

http://stackoverflow.com/comment/34076884
comment on: http://stackoverflow.com/a/22395138
type: AnswerComment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/49771/discussion-between-saplingpro-and-jigar-joshi)
score: 0
type: Comment

http://stackoverflow.com/comment/34097593
comment on: http://stackoverflow.com/q/22423496
type: Comment
score: 0
has text: I have added the stacktrace
type: QuestionComment

http://stackoverflow.com/a/22653624
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22474276
type: Answer
accepted answer of: http://stackoverflow.com/q/22474276
score: 0
has body: I faced similar problem in my framework test classes. usually if we use both dependsOnMethods or priority in our test class testng executes test with priority first but doesn't apply priority to tests having dependsOnMethods. Tests with 'dependsOnMethod' attribute will run in the last as per their dependencies/priorities. Test case execution order will be like below: Test cases without dependencies according to priorities. Test case with dependencies in order of test methods they are dependent on and priority. Hence,In your case it will execute test cases having dependency on 'method1' first and than test case having dependency on 'method3'. To solve this problem you need understand in which sequence you tests are going to executed based on priorities and dependsOnMethods. You have to adjust both attributes accordingly. You can also make one test case dependent on multiple test methods for example in your case you can make test case 4 dependent on 'method1' as well as 'method3'.

http://stackoverflow.com/a/22351891
type: Answer
accepted answer of: http://stackoverflow.com/q/22351434
downvote count: 0
answers question: http://stackoverflow.com/q/22351434
has body: java.util.Date and java.sql.Date are different. Database accepts only java.sql.Date. For that, you need to convert java.util.Date into java.sql.Date. Try this: java.util.Date util_StartDate = format.parse( req.getParameter("startDate") ); java.sql.Date sql_StartDate = new java.sql.Date( util_StartDate.getTime() ); Now you can use this sql_StartDate to set parameter values using prepared statement. pst.setDate( 1, sql_StartDate ); Use the same procedure on other sql specific dates to use with jdbc.
score: 5
type: AcceptedAnswer
upvote count: 5

http://stackoverflow.com/q/22354420
accepted answer: http://stackoverflow.com/a/43382565
upvote count: 4
tagged with: logging
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33978052
downvote count: 0
has comment: http://stackoverflow.com/comment/33977988
tagged with: java
has answer: http://stackoverflow.com/a/43382565
type: Question
has body: I'm using SLF4J SimpleLogger for unit tests. Due to external factors, it would be challenging to change log providers. The class under test grabs a logger from the owning framework to record errors. The problem is that when I test an error condition, I wind up with a big scary error message in the test logs, even though the test passes. I think this is a Bad Thing. When I used to use Log4J, I could grab the logger for the class under test and change its level to OFF before running the test, then change it back. It looks like SimpleLogger doesn't have an OFF level, so the quietest setting would be ERROR, which of course still logs when error() is called. Is there a better way to do this? Is it even possible?
score: 4
tagged with: slf4j
answer count: 1
has title: Can I turn off logging in SLF4J SimpleLogger?
favorite count: 0

http://stackoverflow.com/q/22431247
tagged with: streaming
has body: I tried to make a streaming radio application. I used service for the media player. How when radio1 is playing, i click radio2, radio1 is stop and play radio2 ? (sorry for my bad english :D) This is my code MyRadio.java import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MyRadio extends Activity implements OnClickListener { Button radio1, radio2, stop; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_service); radio1 = (Button) findViewById(R.id.button1); radio2 = (Button) findViewById(R.id.button3); stop = (Button) findViewById(R.id.button2); radio1.setOnClickListener(this); radio2.setOnClickListener(this); stop.setOnClickListener(this); } public void onClick(View v) { switch (v.getId()) { case R.id.button1: Intent i = new Intent(getApplicationContext(), MyService.class); i.putExtra(MyService.URL, "http://5.231.68.21:8004"); startService(i); break; case R.id.button3: Intent j = new Intent(getApplicationContext(), MyService.class); j.putExtra(MyService.URL, "http://50.117.121.163:80"); startService(j); break; case R.id.button2: stopService(new Intent(this, MyService.class)); break; } } } MyService.java import java.io.IOException; import android.app.Service; import android.content.Intent; import android.media.MediaPlayer; import android.os.IBinder; public class MyService extends Service implements MediaPlayer.OnPreparedListener, MediaPlayer.OnErrorListener { public static String URL; private MediaPlayer mp; public IBinder onBind(Intent arg0) { return null; } @Override public void onCreate() { super.onCreate(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { String i = intent.getStringExtra(URL); String url = "" + i; mp = new MediaPlayer(); mp.setOnPreparedListener(this); try { mp.setDataSource(url); } catch (Ille…
answer count: 1
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22664001
tagged with: media-player
type: Question
tagged with: android
has title: Create dynamic media player Android
has comment: http://stackoverflow.com/comment/34111768
score: 0
has comment: http://stackoverflow.com/comment/34111591
tagged with: stream

unit-testing
tags question: http://stackoverflow.com/q/22353669
tags question: http://stackoverflow.com/q/22408680
tags question: http://stackoverflow.com/q/22480863
tags question: http://stackoverflow.com/q/22374650
tags question: http://stackoverflow.com/q/22378687
tags question: http://stackoverflow.com/q/22362745
tags question: http://stackoverflow.com/q/22357170
tags question: http://stackoverflow.com/q/22374049
tags question: http://stackoverflow.com/q/22346823
tags question: http://stackoverflow.com/q/22429776
tags question: http://stackoverflow.com/q/22467349
tags question: http://stackoverflow.com/q/22346275
tags question: http://stackoverflow.com/q/22345322
tags question: http://stackoverflow.com/q/22391202
tags question: http://stackoverflow.com/q/22456450
tags question: http://stackoverflow.com/q/22447181
tags question: http://stackoverflow.com/q/22451846
type: Tag
tags question: http://stackoverflow.com/q/22386619
tag name: unit-testing
tags question: http://stackoverflow.com/q/22354915
tags question: http://stackoverflow.com/q/22427392
tags question: http://stackoverflow.com/q/22373109
tags question: http://stackoverflow.com/q/22431543

http://stackoverflow.com/comment/34210759
has text: @NickAlexander I am sorry for my mistake. The dispose() method must not be called as the Graphics object is passed by the Swing.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22471222
type: Comment

http://stackoverflow.com/a/22485662
score: 10
has comment: http://stackoverflow.com/comment/34218885
downvote count: 0
has body: Your google play services library is being exported from other dependencies of your project and at the compile time the dex compiler gets confused. If you're using Gradle then including this in your project's build.gradle should exclude the support library from being exported into your main project. apply plugin: 'android' apply plugin: 'crashlytics' /** Must exclude exported support jars from dependencies, or get dex duplicate class error. * we're **/ configurations { all*.exclude group: 'com.android.support', module: 'support-v4' all*.exclude group: 'com.google.android.gms', module: 'play-services' } If you're using the andoid studio build system. Then you should go to File -> project structure and disable -> modules. Go through each module the and click on the dependency tab, uncheck the export column for for the support library and google play services library. Post comments if you need more help.
type: Answer
answers question: http://stackoverflow.com/q/22468700
upvote count: 10
has comment: http://stackoverflow.com/comment/34269764

http://stackoverflow.com/comment/34109093
comment on: http://stackoverflow.com/a/22429902
type: AnswerComment
has text: Thanks for the link, I forgot the simplest thing in the world. Thanks for the quick responses as well.
score: 0
type: Comment

http://stackoverflow.com/q/22393309
tagged with: java
type: Question
has body: i want my program to look for a colour near white and click on it. I know how to identify a colour when i point my mouse to it and my goal is to do the opposite EX. search for a colour near white then click on it public static void klick ( int x , int y) { robot.mouseMove(x, y); robot.delay(5); robot.mousePress(MouseEvent.BUTTON1_MASK); robot.mouseRelease(MouseEvent.BUTTON1_MASK); } public static void colour (int x, int y) { robot.delay(5); Color color = robot.getPixelColor(x,y); robot.delay(5); System.out.println("Red = " + color.getRed()); System.out.println("Green = " + color.getGreen()); System.out.println("Blue = " + color.getBlue()); if (inColorRange(color.getRed(), color.getBlue()) &amp;&amp; inColorRange(color.getBlue(), color.getGreen())) { robot.mousePress(MouseEvent.BUTTON1_MASK); robot.mouseRelease(MouseEvent.BUTTON1_MASK); } } public static boolean inColorRange(int color1, int color2) { return Math.abs(color2-color1) &lt;= 20; } this is what i have so far it identifies a colour near white and clicks on it but i have to tell the program what coordinates.
tagged with: awtrobot
has comment: http://stackoverflow.com/comment/34045071
has title: Scan Screen to look for specific colour JAVA
score: 0
tagged with: colors
has comment: http://stackoverflow.com/comment/34045255
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34045137

http://stackoverflow.com/comment/34168606
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22462729
has text: @Erika Edit your question. Add your new configuration below. Clean and redeploy your application.
type: AnswerComment

http://stackoverflow.com/a/22390201
downvote count: 0
type: Answer
has body: Custom painting is done in the paintCompnent(..) method of the label, NOT the paint() method. Also you should invoke super.paintComponent(g) as the first statement. In your case it sounds like you need a Boolean variable to control when the rectangle is drawn. Maybe something like: @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (paintRectangle) // paint the rectangle } Now in the ActionListener you just set the paintRectangle variable to false and invoke repaint() on the component.
score: 1
answers question: http://stackoverflow.com/q/22387676
upvote count: 1

http://stackoverflow.com/a/22368097
upvote count: 1
answers question: http://stackoverflow.com/q/22368018
score: 1
downvote count: 0
has body: try System.out.println("Please enter the number of courses you have left: "); int size = input.nextInt(); int totalSum = 0; for (int i=0; i&lt; size; i++) { System.out.println("Enter the number of CUs for each course: "); int cuNum = input.nextInt(); totalSum += cuNum ; } System.out.print("The sum of the numbers is: " + totalSum);
type: Answer

http://stackoverflow.com/comment/34190026
comment on: http://stackoverflow.com/q/22475737
score: 0
type: QuestionComment
has text: @GyroGearless I tried Jython and intuitively figured out how to work it without reading any documentation. Thanks for the suggestion, you should post it as an answer!
type: Comment

http://stackoverflow.com/q/22450612
downvote count: 0
score: 1
tagged with: android
has answer: http://stackoverflow.com/a/22450647
favorite count: 0
has title: how to have value of a variable in onCreat() to be used in a different method
upvote count: 1
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22450647
possible better answer: http://stackoverflow.com/a/22450777
tagged with: java
has answer: http://stackoverflow.com/a/22450777
answer count: 2
has comment: http://stackoverflow.com/comment/34145867
has body: i have value of a variable 'position' in my oncreate which i got it from a different activity using getIntent(). now i want to use the value of this position in a different method. protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.tatslideshow); Intent j = getIntent(); int position = j.getExtras().getInt("pos"); } and i want to use position in this method public void updateUI() { int imgid[] = alltats[position]; . . . } now i know i can pass the value by putting parameters in updateUI() like updateUI(position) and use it. but the problem is i also have a subclass in my class where i am calling this method so i cant put parameters in updateUI(). this is the subclass: class RefreshHandler extends Handler { @Override public void handleMessage(Message msg) { // TODO Auto-generated method stub TatSlideShow.this.updateUI(); } } TatSlideShow is the main class. please tell me the way to achieve it.

http://stackoverflow.com/comment/38494965
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/24801119
has text: It looks to me like the questioner already has `withMisfireHandlingInstructionDoNothing()`. Could you suggest a code solution?

http://stackoverflow.com/comment/34147050
comment on: http://stackoverflow.com/q/22450745
type: Comment
type: QuestionComment
score: 0
has text: You can set the header parameters as u set the content type header

http://stackoverflow.com/comment/34159793
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22458747
has text: So are you using XML mappings, or are you using annotations? Pick one then come back if you're still having issues. From docs: *You can mix annotated persistent classes and classic hbm.cfg.xml declarations with the same SessionFactory. ... [but] You cannot mix configuration strategies (hbm vs annotations) in an entity hierarchy ...*
type: Comment

http://stackoverflow.com/comment/34224643
comment on: http://stackoverflow.com/a/22460311
type: AnswerComment
score: 0
type: Comment
has text: Thank you so much @Alex! For the first time in months I have no red exclamation marks!

http://stackoverflow.com/comment/38506350
type: Comment
has text: @Noob Thousands across hundreds of class files.
type: QuestionComment
comment on: http://stackoverflow.com/q/22360085
score: 0

http://stackoverflow.com/a/22410918
answers question: http://stackoverflow.com/q/22410847
upvote count: 5
score: 5
downvote count: 0
type: Answer
has body: You could compact the code down, but the odds are far higher that you would introduce bugs than that you would do anything useful. All the parts of the equals and hash code method are there for a reason. If it's bothering you most IDEs have a folding editor, just click the little yellow box (usually) and all the contents of the method get hidden away.

http://stackoverflow.com/q/22433604
tagged with: servlets
type: Question
tagged with: jersey
has title: Tomcat Jersey Eclipse ClassNotFound org.glassfish.jersey.servlet.ServletContainer
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/26042991
favorite count: 0
linked to: http://stackoverflow.com/q/12712224
downvote count: 0
tagged with: maven
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22433617
accepted answer: http://stackoverflow.com/a/22433617
has body: I am running the hello world example. However, I am using version 2.7. on maven pom.xml I have 4.0.0 com.mydomain.restful AdvertServer 0.0.1-SNAPSHOT Advert Server org.glassfish.jersey jersey-bom 2.7 pom import com.google.code.gson gson 2.2.4 javax javaee-web-api 6.0 javax.ws.rs javax.ws.rs-api 2.0 provided org.glassfish.jersey.core jersey-client 2.7 org.glassfish.jersey.containers jersey-container-servlet-core 2.7 <!-- artifactId>jersey-container-servlet src src **/*.java maven-compiler-plugin 3.0 1.7 1.7 I tried running the servlet from command line and from withing the Server plugin on Eclipse. I get the same error: java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:525) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:507) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:126) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957) at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284) at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279) 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:722) The weird thing is that I can see the class among the .jar files. The class is ther…
tagged with: java
possible better answer: http://stackoverflow.com/a/22436345
has answer: http://stackoverflow.com/a/22436345
tagged with: eclipse

http://stackoverflow.com/comment/34207038
score: 0
type: QuestionComment
has text: That should work as expected - are you sure that the property is changed? Can you create a complete example that reproduces the issue?
type: Comment
comment on: http://stackoverflow.com/q/22485579

http://stackoverflow.com/q/22357392
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/22357502
has comment: http://stackoverflow.com/comment/33982387
possible better answer: http://stackoverflow.com/a/22357470
has answer: http://stackoverflow.com/a/22357502
has answer: http://stackoverflow.com/a/22357470
linked to: http://stackoverflow.com/q/1694751
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22357781
tagged with: java
type: Question
has title: How to put numbers in ascending order in an arraylist in Java?
has body: I have made some code which gets numbers from the standard input and I want to take these values and sort them in ascending order. How do I do it? import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { boolean Done = false; ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(20); while(Done == false){ System.out.print("Enter number: "); int x = sc.nextInt(); numbers.add(x); System.out.print("Keep going? (Y/N)"); String keepGoing = sc.next(); if(keepGoing.equalsIgnoreCase("Y")) ; else if(keepGoing.equalsIgnoreCase("N")){ Done = true; //this is just temporary to print out the numbers. for(int n : numbers){ System.out.print(n + " "); } } else System.out.println("Command not recognised..."); } } } Sorry if I am posting a question that has already been answered but I could not find any answers which seemed to work with my code :(

http://stackoverflow.com/q/22436597
score: 2
type: AnsweredQuestion
has title: How to make entrySet() show key-value pairs on new line?(java)
upvote count: 2
tagged with: java
tagged with: set
type: Question
has body: I have a long Map (int, int[] ) ; I use map.entrySet() and it returns me the Set view of my map Map &lt;Integer, ArrayList&lt;Integer&gt;&gt;res = function() ; System.out.println( res.entrySet() ) ; i want to show every entry on new line: [1=[1, 47, 432, 433, 527, 678, 679, 680, 820, 904], 2=[1, 31, 47, 66, 118, 139, 194, 195, 196, 217] 3 = [.............], 10 = [..............], but instead i have it all printed on one line(it's very long): [1=[1, 47, 432, 433, 527, 678, 679, 680, 820, 904], 2=[1, 31, 47, 66, 118, 139, 194, 195, 196, 217], 3=[123,23,.....],............ How to make my set print each key-value pair on new line? or is it by default comma after comma and in one line?
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34120472
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22436662
possible better answer: http://stackoverflow.com/a/75228924
tagged with: dictionary
tagged with: entryset
accepted answer: http://stackoverflow.com/a/22436662
has answer: http://stackoverflow.com/a/75228924

http://stackoverflow.com/comment/34057169
type: AnswerComment
score: 0
type: Comment
has text: this only avoids NPE not fix it.
comment on: http://stackoverflow.com/a/22400322

http://stackoverflow.com/q/22426194
tagged with: filelock
score: 0
tagged with: java
type: Question
has body: assuming I have a (stock) android 4.x tablet connected to a microcontroller board via USB. The board is able to access the SD-card as USB mass storage and reads/writes to a file on the card. Now there should be an app on the tablet, which reads/writes the same file like the board does. So there is simultaneous read/write file-access from the board and the app. To avoid inconsistent data etc. I would use exclusive FileLock when the app reads/writes to the file. Now my question is, if FileLock "is low-level enough" to also work in this case and prevent inconsistent data? THX
tagged with: file-access
tagged with: usb
has answer: http://stackoverflow.com/a/22427662
has title: Simultaneous files access via App and USB
answer count: 2
has answer: http://stackoverflow.com/a/22426247
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/22361376
type: Question
has comment: http://stackoverflow.com/comment/33989612
score: -1
tagged with: eclipse
has answer: http://stackoverflow.com/a/22361542
accepted answer: http://stackoverflow.com/a/22361542
has body: I would like to know how to see result of variables without dump to console. Thanks to all.
upvote count: 2
answer count: 2
downvote count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22361406
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22361406
tagged with: java
has title: How Can I see debug perspective in Eclipse?

http://stackoverflow.com/comment/34140313
type: AnswerComment
score: 3
type: Comment
comment on: http://stackoverflow.com/a/22447183
has text: @ambigram_maker It probably is faster. Looking at the source it's almost the same code as in the question minus some unnecessary `array.length` lookups.

http://stackoverflow.com/comment/33946078
score: 0
type: Comment
type: QuestionComment
has text: You could work out an optimal maximum length to set the cell width to ahead of time. Could be a bit of work/trial and error, but would prevent said resizing during usage?
comment on: http://stackoverflow.com/q/22334274

http://stackoverflow.com/q/22339564
has comment: http://stackoverflow.com/comment/33952459
has body: I am looking to populate my database with values from a csv file. But it returns SQLITE_BUSY: Database file is locked. Here is my code try { BufferedReader br=new BufferedReader(new FileReader("v.csv")); String line; while((line=br.readLine())!=null) { System.out.println(line); String[]value = line.split(","); System.out.println(value.length); String sql = "INSERT into main ([Ticket #], Status, Priority, Department, [Account Name]) " + "values ('"+value[0]+"','"+value[1]+"','"+value[2]+"','"+value[3]+"','"+value[4]+"')"; System.out.println("test"); PreparedStatement pst = null; try { pst = DatabaseConnection.ConnectDB().prepareStatement(sql); pst.executeUpdate(); } finally { if(pst != null) { pst.close(); } } } br.close(); } catch(Exception e) { JOptionPane.showMessageDialog(null, e); } I'm using different print statements to check where the error is, it seems it can't executeUpdate(); when the loop executes the second time. This is what I get in the console Ticket,Status,Priority,Department,Account Name 5 test Here is my DatabaseConnection just for your reference public class DatabaseConnection { Connection conn = null; Statement stmt = null; public static Connection ConnectDB() { try { Class.forName("org.sqlite.JDBC"); Connection conn = DriverManager.getConnection("jdbc:sqlite:database.db"); conn.setAutoCommit(true); return conn; } catch (Exception e) { JOptionPane.showMessageDialog(null, e); return null; } } }
has answer: http://stackoverflow.com/a/22339654
linked to: http://stackoverflow.com/q/8559623
has comment: http://stackoverflow.com/comment/33952137
has comment: http://stackoverflow.com/comment/33951970
type: AnsweredQuestion
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/33951982
type: Question
has comment: http://stackoverflow.com/comment/33952177
accepted answer: http://stackoverflow.com/a/22339654
answer count: 2
has answer: http://stackoverflow.com/a/22340110
has comment: http://stackoverflow.com/comment/33952230
has comment: http://stackoverflow.com/comment/33952427
possible better answer: http://stackoverflow.com/a/22340110
score: 0
has comment: http://stackoverflow.com/comment/33952277
tagged with: http://stackoverflow.com/tag/csv
tagged with: sql
has title: Java - Database locked
tagged with: sqlite

http://stackoverflow.com/comment/34155559
comment on: http://stackoverflow.com/q/22412274
type: Comment
type: QuestionComment
score: 0
has text: I can get this dialog with a USB mic plugged in. Right click on volume and go to Recording Properties - then right click on your device and go to properties again and click on the listen tab

http://stackoverflow.com/q/22429007
score: 0
answer count: 1
tagged with: vaadin7
has answer: http://stackoverflow.com/a/22609420
type: UnansweredQuestion
has body: I made a Vaadin program with a gridlayout in eclipse (a server - minesweeper program). When I preview in eclipse I see the following. When I call the same in for example firefox I get I believe it's a problem with resizing or something similar. public void drawBoard() { this.removeAllComponents(); boardDTO = gameManager.getCurrentGame().getBoardDTO(); Integer w = 30 * boardDTO.getNumOfRow() + 80; Integer h = boardDTO.getNumOfCol() * 30 + 150; String wPx = w.toString() + "px"; String hPx = h.toString() + "px"; this.setWidth(wPx); this.setHeight(hPx); gridLayout = new GridLayout(boardDTO.getNumOfRow(), boardDTO.getNumOfCol()); gridLayout.setSpacing(true); gridLayout.setMargin(true); for (int i = 0; i &lt; boardDTO.getNumOfRow(); i++) { ArrayList&lt;Cell&gt; row = new ArrayList&lt;Cell&gt;(); for (int j = 0; j &lt; boardDTO.getNumOfCol(); j++) { Cell cell = new Cell(boardController, boardDTO.getCellDTO(i, j)); cell.setVisible(true); row.add(cell); gridLayout.addComponent(cell); cell.addClickListener(cell); boardDTO.getCellDTO(i, j).addObserver(cell); } grid.add(row); } this.addComponent(gridLayout); } public Cell(BoardController controller, CellDTO cellDTO) { posX = cellDTO.getPosX(); posY = cellDTO.getPosY(); boardController = controller; setSizeUndefined(); currentImg = BoardView.getCurrentImage(cellDTO); //setStyleName(); loadImage(); setContent(layout); } @SuppressWarnings("unused") private void loadImage() { layout.removeAllComponents(); image = new Image("", new ThemeResource(currentImg)); image.setSizeUndefined(); Integer w=(int)getWidth(); Integer h=(int)getHeight(); //layout.setWidth(w+"px"); //layout.setHeight(h+"px"); // image.setWidth(w.toString()+"px"); // image.setHeight(h.toString()+"px"); layout.addComponent(image); layout.setExpandRatio(image, 1.0f); layout.setComponentAlignment(image, Alignment.MIDDLE_CENTER); } Any suggestions how to solve this.
type: Question
tagged with: java
has title: Vaadin image in gridlayout (resizing)
tagged with: eclipse

http://stackoverflow.com/comment/33945175
comment on: http://stackoverflow.com/a/22335394
type: AnswerComment
score: 0
type: Comment
has text: You were absolutely correct. This has cleared up a lot of confusion regarding using static within the class

http://stackoverflow.com/q/22461596
type: Question
has answer: http://stackoverflow.com/a/22462721
has body: I've been dealing with this for over a week, and now it's beginning to impede my productivity. I have a JTextBox that I am applying a custom document filter to. To add this, I right-clicked on the control, went into Customize Code, and added this line beneath everything: ((javax.swing.text.AbstractDocument)jtfTextField.getDocument()).setDocumentFilter(new mylibrary.NumericDocumentFilter()); Now, this was a copy-paste job (as I've used this in other places). The field I wanted to set the filter to is called TextField. By mistake, I clicked OK, compiled, and it exploded. Duh, I see my mistake. I fix it, recompile, and I still get the error. Now my code has this: ((javax.swing.text.AbstractDocument)TextField.getDocument()).setDocumentFilter(new mylibrary.NumericDocumentFilter()); ((javax.swing.text.AbstractDocument)jtfTextField.getDocument()).setDocumentFilter(new mylibrary.NumericDocumentFilter()); And when I go into Customize Code, it just shows the correct (top) one. I close Netbeans, edit the file with Notepad++ and remove the offending line, and start Netbeans back up. Now it compiles, I run it, test, then when I go back, the code regenerated itself with the erroneous line. I blew out the cache for Netbeans and that did nothing, so I am really at a loss on how to fix this. Any takers? Netbeans Version 7.3.1. Update: I snoop'd around a bit and found this in my Topcomponent's *.form file: &lt;AuxValues&gt; &lt;AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="((javax.swing.text.AbstractDocument)jtfTextField.getDocument()).setDocumentFilter(new mylibrary.NumericDocumentFilter());"/&gt; &lt;/AuxValues&gt; Perhaps deleting this could fix the issue, but I'm not sure, and really don't want to risk destroying this project.
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22462721
has title: Netbeans regenerates broken code in TopComponent. How do I fix this?
tagged with: compiler-generated
type: AnsweredQuestion
tagged with: netbeans
tagged with: java

http://stackoverflow.com/comment/34001764
score: 1
type: AnswerComment
has text: @ylun it is to run the app on the Event Dispatch Thread, as should be done with all swing app. See [Initial Threads](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html) for more detail
comment on: http://stackoverflow.com/a/22343755
type: Comment

http://stackoverflow.com/comment/34055989
type: QuestionComment
comment on: http://stackoverflow.com/q/22399472
score: 0
has text: Well yes, SHA1 is weak compared to SHA256 and SHA512, but this is really relative... SHA1 is plenty strong for a lot of needs. MD5 is weak compared to SHA1 too.
type: Comment

http://stackoverflow.com/comment/34035238
score: 0
type: Comment
type: QuestionComment
has text: This is the error I get: Exception in thread "main" java.lang.Error: Unresolved compilation problem: Unhandled exception type FileNotFoundException at MagellanSchoolQ2Coursework2.main(MagellanSchoolQ2Coursework2.java:9)
comment on: http://stackoverflow.com/q/22387759

http://stackoverflow.com/comment/34171909
type: Comment
comment on: http://stackoverflow.com/a/22465150
has text: Use some unique key/value pair to store `JTextField` such as `HashMap<String,JTextField>`
type: AnswerComment
score: 0

http://stackoverflow.com/a/22419557
score: 0
has body: Hi i resolved your problem...You will use like this You can get your need...Definitely it will give only the 0.15 format only use this...I hope you will get your desired Answer.. String decim= "0.15456564564564"; String convert = String.format("%.2f", Double.valueOf(decim)); float v = Float.parseFloat(convert); System.out.println(v);
type: Answer
answers question: http://stackoverflow.com/q/22415699

http://stackoverflow.com/a/22365359
type: AcceptedAnswer
has body: I'm fairly certain it is the SecureRandom seeding. Cyrpto requires strong random number generation. One of the techniques for this is to run an algorithm for a long time, producing an unpredictable number at the end. Solutions might be: find a way to do this "ahead of time", and that it only happens once. find a crypto implementation / JVM which has a different faster implementation.
has comment: http://stackoverflow.com/comment/34021707
type: Answer
has comment: http://stackoverflow.com/comment/34044645
has comment: http://stackoverflow.com/comment/34255059
accepted answer of: http://stackoverflow.com/q/22363711
answers question: http://stackoverflow.com/q/22363711
score: 0

http://stackoverflow.com/comment/34192123
type: QuestionComment
comment on: http://stackoverflow.com/q/22474812
score: 0
has text: Well, at least you know that part works. Maybe try another barcode app; make sure it's a valid code. Or try a different barcode, of a different type.
type: Comment

http://stackoverflow.com/comment/34106546
comment on: http://stackoverflow.com/a/22428375
has text: regarding this solution , i have posted same solution in my previous post .
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22422796
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22418883
answers question: http://stackoverflow.com/q/22418883
score: 0
has body: Seems like the problem was the multiple parameters I was sending.. I had to put them in a string[] command and the execute.. Thanks a lot for your help and time

http://stackoverflow.com/q/22450568
tagged with: wcf-security
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22470580
accepted answer: http://stackoverflow.com/a/22470580
tagged with: java
type: Question
score: 0
has title: PolicyException: None of the policy alternatives can be satisfied in WCF Service Call
tagged with: axis
answer count: 1
tagged with: wsdl
has body: I have created web service client using Apache axis 1.4. The wcf service i am accessing is STS service which required AppliesTo Parameter and its return SAML token. I have go through various blog and website while searching and some how i came to this kanbancoding Part 3 So i go through it and do the changes in my code but now i am getting org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied. My

http://stackoverflow.com/comment/33964661
type: QuestionComment
comment on: http://stackoverflow.com/q/22345218
score: 0
has text: helloooooooooooooo is there any1
type: Comment

http://stackoverflow.com/comment/34108718
has text: More info on the tekst1 object would be nice. Is that you're text pane? If so I think you're calling `print` incorrectly, look at the [**documentation**](http://docs.oracle.com/javase/7/docs/api/javax/swing/JComponent.html#print(java.awt.Graphics))
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22428725
score: 0

http://stackoverflow.com/comment/34042173
score: 5
comment on: http://stackoverflow.com/q/22391350
has text: You could convert it to a list first then sort if you need to sort
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22466681
has answer: http://stackoverflow.com/a/22473483
has title: How to capture this pattern?
has answer: http://stackoverflow.com/a/22473554
tagged with: regex
type: UnansweredQuestion
score: 0
has body: I have a file in which i need to parse each paragraph. Each paragraph starts with the word "Scenario". I was able to do this using the below pattern Pattern p = Pattern.compile("Scenario(.*?)(?=Scenario)", Pattern.DOTALL); Matcher m = p.matcher(input); Obviously this failed for the last paragraph since there is no look ahead Scenario below. How do i write a pattern to just capture the last paragraph? I tried writing one where it does negative lookahead on Scenario but that captured all 3 paragraphs. Any help on this? Scenario: Blah blah Scenario: Blah blah Scenario: Blah blah Scenario: Blah blah
has comment: http://stackoverflow.com/comment/34175503
has comment: http://stackoverflow.com/comment/34185048
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/q/22411958
has comment: http://stackoverflow.com/comment/34077198
score: 3
has comment: http://stackoverflow.com/comment/34077471
has answer: http://stackoverflow.com/a/22412400
has body: I am trying to create a file from a log report. To save the file I've created a button. When the button is pushed, the following code is executed: public void SAVE_REPORT(KmaxWidget widget){//save try { String content = report.getProperty("TEXT"); File file = new File("logKMAX.txt"); // if file doesnt exists, then create it if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close(); } catch (IOException e) { e.printStackTrace(); } } //SAVE_REPORT I have no compilation errors, but there isn't any file saved. Any idea on what might be wrong?
has comment: http://stackoverflow.com/comment/34077732
possible better answer: http://stackoverflow.com/a/59138871
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/34078620
has comment: http://stackoverflow.com/comment/34079800
has comment: http://stackoverflow.com/comment/34078302
has comment: http://stackoverflow.com/comment/34077773
has comment: http://stackoverflow.com/comment/34078482
has comment: http://stackoverflow.com/comment/34077913
has comment: http://stackoverflow.com/comment/34077192
downvote count: 0
has comment: http://stackoverflow.com/comment/34079130
linked to: http://stackoverflow.com/q/3988788
has answer: http://stackoverflow.com/a/59138871
has comment: http://stackoverflow.com/comment/34077187
favorite count: 0
has comment: http://stackoverflow.com/comment/34078842
has comment: http://stackoverflow.com/comment/34078089
has comment: http://stackoverflow.com/comment/34077537
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34077300
tagged with: java
tagged with: save
has comment: http://stackoverflow.com/comment/34080674
accepted answer: http://stackoverflow.com/a/22412400
tagged with: file
has comment: http://stackoverflow.com/comment/34077976
has title: How to save a file in java
has comment: http://stackoverflow.com/comment/34081059
type: Question
has comment: http://stackoverflow.com/comment/34080099

http://stackoverflow.com/a/22367442
has comment: http://stackoverflow.com/comment/34000564
type: Answer
has body: You cannot fix it because of the reasons others already mentioned. I would also like to point out that your current approach is flawed. With your current code, version 10.1 will equal 1.01 for example. Instead, do not compare app version names and start comparing app version codes instead. That is, when you release version 1.0, release that version to code 1; when you release version 1.1, release it with code 2 and so on. In your app, compare version codes, and ignore version names if you want to make your life easier. The android manifest uses this mechanism to check app versions on the Play Store. Look at &lt;manifest android:versionCode="integer" android:versionName="string" /&gt; for reference.
score: 0
answers question: http://stackoverflow.com/q/22366893

http://stackoverflow.com/comment/34047717
has text: I strongly disagree. If there is code that is guaranteed to give an `Error` (not an `Exception`) at runtime, the compiler should be able to catch it.
comment on: http://stackoverflow.com/a/22368427
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34129605
comment on: http://stackoverflow.com/q/22439289
type: Comment
has text: similair question(s) is/are asked this/last month
score: 1
type: QuestionComment

http://stackoverflow.com/comment/34000486
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22367331
has text: Could you please correct the typo with the parantheses inside the first for loop. Funny enough, it might compile and run.
score: 0

http://stackoverflow.com/q/22458814
type: AnsweredQuestion
tagged with: return
possible better answer: http://stackoverflow.com/a/22458856
has answer: http://stackoverflow.com/a/22458856
tagged with: loops
has title: Java - Returning multiple values from loop, as single string
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22458971
tagged with: int
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/34161181
has body: I have a method where I pass two int arguments, and returns a string. A loop will make sure that if the first argument(the greater value) is greater than the second, that the first will decrement until it is equal the value of the second argument(the lesser value). The problem I'm having is that I am trying to return the value of the decremented value after each time that the loop runs. I would like to return the values as a string like "8,6,4,2".How would i set that up? public String countDown(int arg1, int arg2){ if (arg1&gt;arg2){ for (int i = arg1; arg1&gt;arg2;i--){ //??? return i; } }
tagged with: string
has comment: http://stackoverflow.com/comment/34160006
has answer: http://stackoverflow.com/a/22458971

http://stackoverflow.com/a/22435123
has comment: http://stackoverflow.com/comment/34118269
score: 0
type: Answer
has body: Okay so I feel a bit incompetent asking for help so quickly when I have approached the problem from a bad angle. I fixed my problem by storing the points of the original polygon in two int arrays named xpoints and ypoints. These points will never change once loaded, they do not relate to the position of the Polygon rather they relate to the position of the points around the Polygon's center which can change at any given moment. What I did was looped through all of these points each frame, and used the AffineTransform class to get a rotated instance of each point using (0, 0) as the center. I then constructed a Polygon object out of these rotated points and translated it based on the player's x and y position (Which are stored variables in my class). This is the segment of code that I use. public void DoFrame(Graphics2D g) { // Increment x by the dx factor x += dx * game.GetDeltaTime(); // Increment y by the dy factor y += dy * game.GetDeltaTime(); // Reset the body polygon body.reset(); // Loop through all of the reference polygon points for(int i = 0; i &lt; xpoints.length; i++) { // Create a placeholder array for the two points double[] pt = {xpoints[i], ypoints[i]}; // Rotate the points around a center (0, 0) AffineTransform.getRotateInstance(theta, 0, 0).transform(pt, 0, pt, 0, 1); // Add the rotated point to the body body.addPoint((int) pt[0], (int) pt[1]); } // Translate the body based on x and y coordinates body.translate((int) x, (int) y); } This will roughly display a rotated polygon based on the center of the original passed points, note however that the center used is not a perfect center rather it depends upon the positioning of the points upon the call of the constructor.
answers question: http://stackoverflow.com/q/22434314

http://stackoverflow.com/comment/33957511
has text: Alright, I am going to try out the one you mentioned, thanks.
comment on: http://stackoverflow.com/a/22329050
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33993003
type: Comment
comment on: http://stackoverflow.com/q/22363056
score: 0
has text: @trumpetlicks i am still working on it.... i was planning to add getbounds.width(); and getbounds.Height(); and then working on the mathematical formula.
type: QuestionComment

http://stackoverflow.com/comment/34001508
score: 0
type: Comment
has text: You missed the class name after `com.example.bmtiTest2` on your layout XML.
type: QuestionComment
comment on: http://stackoverflow.com/q/22368002

http://stackoverflow.com/comment/34028756
type: QuestionComment
comment on: http://stackoverflow.com/q/22384160
score: 0
has text: Try putting this in your onCreate: massEditText.requestFocus(); (You'll need to change the edittext name to whatever yours is called)
type: Comment

http://stackoverflow.com/comment/34167591
comment on: http://stackoverflow.com/a/22462655
score: 0
type: AnswerComment
has text: OK, that's what I thought. BTW I was going to say that right away, but I bit my tongue when I saw it was really a neutral, general-purpose class. It may be a bit awkward, but it is not wrong, not for any real-life reason.
type: Comment

http://stackoverflow.com/q/22386859
type: AnsweredQuestion
score: 3
tagged with: algorithm
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22386926
has title: Is it possible to efficiently create a balanced binary search tree from an unsorted array without sorting the array?
tagged with: arrays
answer count: 1
downvote count: 0
favorite count: 0
has body: The title says it all. I see that I can create a binary search tree out of an unsorted array rather easily. If root is null, set 1st array value to the root current = root for each value in the array: while current not null If arrays value &gt;= current value if root.left is null, set array value to current.right else current = current.right and continue Else if arrays value &lt; current value if current.left is null, set array value to current.left else current = current.left return root; And can also create a balanced binary search tree out of an ordered array easily. Get the Middle of the array and make it root. Recursively do same for left half and right half. Get the middle of left half and make it left child of the root created in step 1. Get the middle of right half and make it right child of the root created in step 1. But is there an efficient way to create a balanced binary search tree from an unsorted array just as easily without changing the array / copying the array, ect.
tagged with: c++
accepted answer: http://stackoverflow.com/a/22386926
upvote count: 3
tagged with: tree

http://stackoverflow.com/comment/34117215
comment on: http://stackoverflow.com/a/22434490
score: 0
has text: Agreed with need for factory pattern when we are instantiating lot of objects. But my question here is that these action classes generally have no local storage, all that consumer want to do is execute some action, why do consumers need to instantiate objects when they can utilize static invocation? I believe all these frameworks already use reflection to instantiate appropriate action classes, so there is no question of reflection being slow.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33990130
score: 0
has text: Watch out that you don't replace already processed elements. This could certainly happen with the `replace` call.
comment on: http://stackoverflow.com/q/22361285
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22336205
possible better answer: http://stackoverflow.com/a/22337453
type: Question
has comment: http://stackoverflow.com/comment/33946311
answer count: 2
tagged with: casting
has comment: http://stackoverflow.com/comment/33945737
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/33945862
upvote count: 4
tagged with: generics
has body: This is the first time I am trying to make a factory.. please excuse me if I didn't use the pattern properly! So this is my Factory: public class BuilderFactory { public BuilderFactory(){ } public &lt;T extends Builder&gt; T getBuilderOf(Object clazz){ if(clazz instanceof House){ return (T) new HouseBuilder(); } return null; } } it will return a builder (in this case HouseBuilder) which has a Builder interface. Builder: public interface Builder&lt;T&gt; { T build(); } HouseBuilder: public class HouseBuilder implements Builder&lt;House&gt; { private String street; public HouseBuilder() { } @Override public House build() { return new House(street); } @Override public HouseBuilder&lt;House&gt; withStreet(String street) { this.street = street; return this; } } This is the place where I call it: BuilderFactory builderFactory = new BuilderFactory(); Now it is possible to do: builderFactory.getBuilderOf(House.class).build(); Since build() is in the Builder interface. But if I want to do: builderFactory.getBuilderOf(House.class).withStreet("street"); I implicitily need to cast the builder like so: (HouseBuilder)builderFactory.getBuilderOf(House.class).withStreet("street") Or else the compiler will complain. I don't want to cast it, or instantiate my return value from the factory. Is there any option where I don't have to cast the result and could still use the .withStreet() method ? :) Thanks in advance. Davey
tagged with: builder
has answer: http://stackoverflow.com/a/22336405
accepted answer: http://stackoverflow.com/a/22336405
tagged with: factory
has answer: http://stackoverflow.com/a/22337453
type: AnsweredQuestion
has title: Calling a Factory without typecasting the return type
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33946117

http://stackoverflow.com/comment/33961692
has text: so what have you tried? Also is the reading of `readLine()` twice a bug?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22345360
type: Comment

header
type: Tag
tags question: http://stackoverflow.com/q/22450645
tag name: header

http://stackoverflow.com/comment/34013755
type: Comment
comment on: http://stackoverflow.com/q/22360346
has text: Yes, there is a discrepancy in the document and example. See my answer.
score: 0
type: QuestionComment

http://stackoverflow.com/a/22373709
type: Answer
accepted answer of: http://stackoverflow.com/q/22359731
answers question: http://stackoverflow.com/q/22359731
score: 0
type: AcceptedAnswer
has body: ok i got the solution. myexec.exe was an executable python file produced by py2exe. due to How to flush output of Python print? i put sys.stdout.flush() after every print function and problem disappeared

http://stackoverflow.com/q/22348024
has body: I am writing an application in Java that is supposed to communicate to an external device. The device responds using the following format 01 02 05 0A 2D 3E 01 02 12 2B 09 07 As a response I may get at least one line, but often there are several. I tried to validate the response using a simple regular expression ([0-9a-fA-F]{2} ?){6}\r But it returns true if at least one line is correct, and I need to validate all lines. I know that I may split the response into separate lines and validate each in a loop, but the question is - is it possible to validate all lines using a single regex? Update (the Java code I am using): Pattern pattern = Pattern.compile("([0-9a-fA-F]{2} ?){6}\r"); String string = "01 02 05 qA 2D 3E\r01 02 12 2B 09 07\r"; // qA - 4th number is invalid Matcher matcher = pattern.matcher(string); if (matcher.find()) { System.out.println(matcher.group()); }
has title: Validate each line using a single regex
answer count: 1
has comment: http://stackoverflow.com/comment/33966846
tagged with: regex
favorite count: 0
has answer: http://stackoverflow.com/a/22349634
accepted answer: http://stackoverflow.com/a/22349634
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33968863
type: Question
upvote count: 2

http://stackoverflow.com/comment/34048864
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22371801
has text: For ease of reference, I have edited and simplified the post

http://stackoverflow.com/a/22471534
answers question: http://stackoverflow.com/q/22471327
accepted answer of: http://stackoverflow.com/q/22471327
has body: As EJP suggested, you want a "table" of salary to tax rate. In a full scale application, this information will likely be stored in a database rather than in memory, but going for something in-between statically defined and a full scale database would be to use a Map. Specifically, using a NavigableMap will allow very simple access to such calculations: NavigableMap&lt;Double, Double&gt; payToTaxRate = new TreeMap&lt;Double, Double&gt;(); // e.g., loaded from a file: payToTaxRate.put(100000, 0.4); payToTaxRate.put(60000, 0.3); payToTaxRate.put(30000, 0.2); payToTaxRate.put(15000, 0.1); payToTaxRate.put(5000, 0.05); payToTaxRate.put(Double.MIN_VALUE, 0); System.out.prinln(pay * payToTaxRate.floorEntry(pay).getValue()); Naturally, this is overkill for an assignment and the if statements would likely be faster than the overhead of the map. However, in a world where tax brackets are literally added from year-to-year (not so often, thankfully), a more dynamic approach like the above is helpful.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34182364
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/34182536
has comment: http://stackoverflow.com/comment/34182440
upvote count: 3
has comment: http://stackoverflow.com/comment/34182235

http://stackoverflow.com/a/22449025
has body: That's because StringBuffer str; is declared not initialized. You initialize it only inside the for loop which is conditional and in case the condition doesn't satisfy, the loop may not be executed, leaving str un-initialized. And that is why you get the error The local variable str may not have been initialised on this line, String prt=str.toString();. Initialize it to either null or a new StringBuffer, just in case, the for loop condition doesn't satisfy. StringBuffer str = null; // Either this StringBuffer str = new StringBuffer(); // or this The same would apply to ptr as well.
answers question: http://stackoverflow.com/q/22448995
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/22457266
type: Answer
has comment: http://stackoverflow.com/comment/34158098
has comment: http://stackoverflow.com/comment/34158037
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34157877
has comment: http://stackoverflow.com/comment/34158275
has comment: http://stackoverflow.com/comment/34157944
upvote count: 2
has comment: http://stackoverflow.com/comment/34157692
answers question: http://stackoverflow.com/q/22457208
has comment: http://stackoverflow.com/comment/34158192
has body: private ArrayList&lt;Queue&lt;Integer&gt;&gt; dishQueues; not instantiated do private ArrayList&lt;Queue&lt;Integer&gt;&gt; dishQueues = new ArrayList&lt;Queue&lt;Integer&gt;&gt;(); before you use it. or even private List&lt;Queue&lt;Integer&gt;&gt; dishQueues = new ArrayList&lt;Queue&lt;Integer&gt;&gt;();

http://stackoverflow.com/comment/99604600
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22463062
has text: See my answer for an explanation of `LocalDateTime` vs. `ZonedDateTime` vs. `OffsetDateTime` vs. `Instant` vs. `LocalDate` vs. `LocalTime`, how to keep calm about why it's so complicated and how to do it right at the first shot.

http://stackoverflow.com/a/22461480
downvote count: 0
answers question: http://stackoverflow.com/q/22461375
accepted answer of: http://stackoverflow.com/q/22461375
type: Answer
has comment: http://stackoverflow.com/comment/34164837
score: 1
has comment: http://stackoverflow.com/comment/34165555
upvote count: 1
has comment: http://stackoverflow.com/comment/34164748
has body: you never initiate sharedpreferences: SharedPreferences sharedpreferences; thats the reason why you get a NullPointerException here: Editor editor = sharedpreferences.edit(); put something like this in your onCreate method before using SharedPreferences: sharedpreferences = this.getSharedPreferences( "com.example.app", Context.MODE_PRIVATE); that are your keys: public static final String MVerified = ""; public static final String NVerified = ""; public static final String EAVerified = ""; each key is an empty String. You have to define a key for each entry in your SharedPreferences: public static final String MVerified = "key1"; public static final String NVerified = "key2"; public static final String EAVerified = "key3"; otherwise you overwrite each entry with the next one...
type: AcceptedAnswer

http://stackoverflow.com/comment/34078168
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22405293
has text: Actually, you can use java.util.LinkedHashMap if you want to save ordering of the properties in a JSON object.

http://stackoverflow.com/comment/34116312
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22422974
has text: So, did you try printing out `user.getUserName()` at the top of your method? Was it what you expected?

http://stackoverflow.com/a/22466614
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22466560
answers question: http://stackoverflow.com/q/22466560
has body: Directories can't be executed but you could do File dir = new File("..."); if (Desktop.isDesktopSupported()) { Desktop.getDesktop().open(dir); }

http://stackoverflow.com/a/22419704
has body: Try indexOf(input), without the quotes. What you've written only makes sense if the array is expected to contain the string "input".
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/22419678
score: 4
downvote count: 0

http://stackoverflow.com/a/22399453
score: 1
accepted answer of: http://stackoverflow.com/q/22399299
has body: Consider researching Websockets and Server-sent events. I have not used any of them with Java but I'm sure that you can find a nice library.
answers question: http://stackoverflow.com/q/22399299
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/34058274
downvote count: 0

http://stackoverflow.com/comment/33938306
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22332040
has text: Post a short runnable program replicating this issue. You code lacks some important details.
type: Comment

http://stackoverflow.com/comment/34161804
type: Comment
score: 0
has text: i cont see wat you edited in that so could you please highlight the corrected code ...
comment on: http://stackoverflow.com/a/22457411
type: AnswerComment

http://stackoverflow.com/comment/34100654
comment on: http://stackoverflow.com/q/22425280
type: Comment
type: QuestionComment
score: 0
has text: https://www.ietf.org/rfc/rfc2388.txt

http://stackoverflow.com/comment/33954584
comment on: http://stackoverflow.com/q/22340971
type: Comment
type: QuestionComment
has text: I added this input to your question. Please fix if it's not right. If this is the input, then you code is having problems processing the "del" order because it is not followed by two doubles.
score: 0

http://stackoverflow.com/a/55803211
type: Answer
has body: Make sure it doesn't say (24) or (v 24) next to the image file you have in your drawable file, re-copy the image and make it save it as the type with no (24) in it as it will prepare it to be used for API 24 and above, my phone uses that's why it failed on my part API 23.
answers question: http://stackoverflow.com/q/22434070
score: 0

http://stackoverflow.com/a/22443068
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34133408
answers question: http://stackoverflow.com/q/22442700
has comment: http://stackoverflow.com/comment/34133362
accepted answer of: http://stackoverflow.com/q/22442700
has body: I'm still not exactly sure what you want to do. at runtime I want to create a Map with the key type of typeof(field annotated with @Identifier) and the value type of Student You can create a raw Map or a Map&lt;Object, Object&gt;. You can get the type of the field annotated with @Identifier. I'm not sure what you mean by value type of Student so I'll assume you mean the type Student, ie. its Class object. public static void main(String[] args) throws Exception { Class&lt;?&gt; clazz = Student.class; Map&lt;Object, Object&gt; map = new HashMap&lt;&gt;(); Field[] fields = clazz.getDeclaredFields(); for (Field field : fields) { Identifier annotation = field.getAnnotation(Identifier.class); if (annotation != null) { map.put(field.getType(), clazz); } } System.out.println(map); } With your example class in your question, this prints {class java.lang.String=class com.spring.Student} So the annotated field type is mapped to the class type. You won't be able to have a Map&lt;String,Student&gt; though because you don't know the type String (and possibly not even Student) at compile time. You can try casting, but you're setting yourself up for a number of ClassCastExceptions.
upvote count: 1
type: AcceptedAnswer

ads
tags question: http://stackoverflow.com/q/22448541
tags question: http://stackoverflow.com/q/22395129
tags question: http://stackoverflow.com/q/22438483
tag name: ads
tags question: http://stackoverflow.com/q/22439112
type: Tag
tags question: http://stackoverflow.com/q/22437672

http://stackoverflow.com/comment/34053281
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22398192
has text: You mean something like [this](http://stackoverflow.com/questions/16728397/print-the-whole-program-layout/16728708#16728708) or [this](http://stackoverflow.com/questions/22241711/setting-print-size-of-a-jlabel-and-put-a-jradiobutton-on-the-print/22242658#22242658) (check both answers) or [this](http://stackoverflow.com/questions/17904518/fit-scale-jcomponent-to-page-being-printed/17961911#17961911) or [this](http://stackoverflow.com/questions/12764634/printing-a-jframe-and-its-components/12765916#12765916)?

http://stackoverflow.com/comment/34072859
comment on: http://stackoverflow.com/q/22409695
score: 0
type: QuestionComment
has text: [Crosspost](http://crypto.stackexchange.com/questions/15002/implementing-ssl-on-jboss-app-using-spring-security) from crypto.SE.
type: Comment

http://stackoverflow.com/comment/34148730
score: 0
has text: You are reading blocks as MappedByteBuffer. Each block gets processed before the next block is read. You want to store the blocks so that they can be processed. OK. But aren't they already "stored" when you have them as a MappedByteBuffer? The intention is unclear for me, maybe some (pseudo-) code that shows how you would like to use this data structure may be helpful...
comment on: http://stackoverflow.com/q/22447410
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34188292
has text: @devnull: `\t` should also work (it matches the literal tab character instead of the tab metacharacter, but that works identically).
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22475181

http://stackoverflow.com/a/22383825
score: 1
answers question: http://stackoverflow.com/q/22382818
downvote count: 1
has comment: http://stackoverflow.com/comment/122222112
has body: Looks like there is a Java port of Quickcheck. The goal of QuickCheck is to replace manually picked values with generated values. A QuickCheck-based test tries to cover the laws of a domain whereas classical testing can only test the validity for distinct values. Basically, QuickCheck is about generators of data. The QuickCheck runner method is just a fancy for loop implementation. QuickCheck can help in scenarios where whole classes of test cases have to be tested and it is not feasible to write tests for all distinct test scenarios.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/68372732
has comment: http://stackoverflow.com/comment/122221901

http://stackoverflow.com/comment/34070562
type: Comment
score: 0
type: AnswerComment
has text: @jegadees again: edit your question, add four dashes, then below it add **your current code** and the **stacktrace of the exception**, otherwise you're a blind asking to another blind to explain the colors...
comment on: http://stackoverflow.com/a/22395792

http://stackoverflow.com/comment/34159649
type: QuestionComment
comment on: http://stackoverflow.com/q/22458627
score: 0
has text: ever = never? I don't follow you either to be honest.
type: Comment

http://stackoverflow.com/comment/105762588
type: AnswerComment
has text: This solution also worked for me - I had the same problem when implementing CSRFGuard on Azure Linux WebApps, with CloudFlare.
score: 0
comment on: http://stackoverflow.com/a/25879160
type: Comment

http://stackoverflow.com/a/22409586
has body: There is no "browser language" - you cannot reliably detect it. The solution is to use GWT's internationalization. You can define different locales for your project. Then a user can choose a language for your app, and you can display all UI elements, including dates, in a way that users expect. Many elements - dates, currencies, numbers - will be displayed "correctly" without any changes in your code.
upvote count: 2
answers question: http://stackoverflow.com/q/22408685
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/22416498
tagged with: android
has body: I am writing an android app, and I have a home screen that starts different playing modes (different activites). I want to start each activity for a result using startActivityForResult() with the requestCode being equal to some constant for each type of the game (easy, medium, hard). I was trying to do this with an enum, but eclipse is telling me startActivityForResult(Intent i, int request code) is not applicable for arguments (Intent, [name of my enum class]). I tried to implement this with an inner class, but it does not work. I was hoping to utilize enums so that the code is more readable in onActivityResult() (i.e. checking if resultCode == EASY rather than resultCode == 1). From my understanding, Enums act the same as integers. Correct me if I am wrong. Can anyone help?
tagged with: java
type: Question
tagged with: enums
has title: startActivityForResult with an enum
tagged with: eclipse
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22417291
has answer: http://stackoverflow.com/a/22416545
type: UnansweredQuestion

http://stackoverflow.com/q/22419032
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22439231
tagged with: twitter
tagged with: twitter-oauth
type: Question
has title: How do I get the Access-Token and Access-Token-Secret?
tagged with: security
upvote count: 1
answer count: 1
favorite count: 0
has body: Can anyone explain me these terms with respect to OAuth ? Consumer Key Consumer Secret Access Token Access Token Secret Also, when I registered my application with twitter I got the consumer key and consumer secret but how do I get the access token and access token secret ?
tagged with: oauth
accepted answer: http://stackoverflow.com/a/22439231
type: AnsweredQuestion

http://stackoverflow.com/q/22475209
tagged with: telnet
tagged with: performance
has comment: http://stackoverflow.com/comment/34282641
tagged with: java
has comment: http://stackoverflow.com/comment/34188237
has title: Java System.out.println() performance througth Telnet
type: Question
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/22487312
has body: Can it change the performance of an application on an embedded system (J9 JVM) if the output is shown through telnet? It seems that in this way the system runs better during development that when the system is in production and don't run through telnet. System.out.println() sentences are not deleted in source code (this code smells i know). Any suggestion? I suppose that all System.out.println() sentences are are undermining the performance of the virtual machine...
has comment: http://stackoverflow.com/comment/34284665
has comment: http://stackoverflow.com/comment/34284525
has answer: http://stackoverflow.com/a/22475376
has comment: http://stackoverflow.com/comment/34282745
type: UnansweredQuestion

http://stackoverflow.com/comment/34186990
type: AnswerComment
score: 0
type: Comment
has text: return new MapActivity(); is wrong because you are trying to cast an activity to a fragment which is totally impossible, so what you could do is create a fragment that extends SupportMapFragment (i.e. MySupportMapFragment), put your logic methods in there (like gotoLocation() and etc...) and then from your adapter return a new MySupportMapFragment() instead of new MapActivity()
comment on: http://stackoverflow.com/a/22473651

http://stackoverflow.com/comment/34111253
comment on: http://stackoverflow.com/q/22431217
type: Comment
has text: @user2357112 So isn't this a problem for major companies? Is there a way to solve this?
score: 0
type: QuestionComment

http://stackoverflow.com/q/22416301
tagged with: character-encoding
type: Question
has comment: http://stackoverflow.com/comment/34085349
has title: Find out programmatically which code page is being used for stderr
has comment: http://stackoverflow.com/comment/34085250
score: 0
tagged with: windows
linked to: http://stackoverflow.com/q/1336930
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22465704
has body: I've made some progress on my previous question, and discovered that the message being displayed is redirected from stderr and is encoded with Cp850. So, how can I discover this from the program in Java? Reading the Wikipedia page on code page 850, and looking at the characters that can be encoded, it's obvious that this won't be used on all Windows systems because it doesn't include the characters needed for, say, Japanese. (And I assume that it won't be used on non-windows systems.) If I print out the results of Charset.defaultCharset(), I get windows-1252. But using Cp1252 to decode the output from stderr doesn't give the correct encoding -- what should be è prints as Š. This has been asked before in a slightly different way, but the answers given are just wrong or don't apply to what I'm trying to do. Is this possible to do in Java? If not, what are people doing to get a stderr message to the user in a format they can read?
tagged with: java

http://stackoverflow.com/q/22434522
has answer: http://stackoverflow.com/a/22434550
has title: Locating a file with Java
favorite count: 0
possible better answer: http://stackoverflow.com/a/22434550
accepted answer: http://stackoverflow.com/a/22434553
upvote count: 3
downvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22434553
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/1080634
score: 2
has body: I'm working with the File class for the first time and am a little confused. I wrote this basic code to see if a file on my desktop could be detected: public static void main(String[]args){ File test= new File("abc.pdf"); if(test.exists()==true){ System.out.println("got it!"); } else{System.out.println("try again");} } I know I'm missing a big step since the program can't seem to detect it. Can anyone tell me what else I need to look up? Thanks.

http://stackoverflow.com/a/22483982
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22449790
type: Answer
answers question: http://stackoverflow.com/q/22449790
has body: Apparently had a dependency problem in the pom.xml, and had misconfigured the method, I leave it to someone else if you could help: @POST @Path("/upload") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces({ MediaType.APPLICATION_JSON }) public ServiceResponse uploadFIle(FormDataMultiPart form) { byte[] fileContents = form.getField("iconBmp").getValueAs(byte[].class); String uploadedfilename = form.getField("iconBmp").getContentDisposition().getFileName(); String description = form.getField("description").getValue(); String fileName = form.getField("fileName").getValue(); //String id = form.getField("id").getValue(); // TODO: //catIconBean.uploadIcon(fileContents); ServiceResponse sr = new ServiceResponse(); sr.httpResponse = true; return sr; } Greetings.

http://stackoverflow.com/comment/34076831
has text: I actually meant the code showing how you are redirecting.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22385060

http://stackoverflow.com/q/22388788
type: Question
tagged with: random
has answer: http://stackoverflow.com/a/22392291
downvote count: 1
tagged with: arrays
favorite count: 0
answer count: 3
has body: I have to create an array size of 10 and generate random numbers from 0 to 100 including 0 and excluding 100. When I write the code it keeps giving me an error of: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 59 at BillyLancasterHw6.printArray(BillyLancasterHw6.java:23) at BillyLancasterHw6.main(BillyLancasterHw6.java:13) Here is the code I am using. public class BillyLancasterHw6 { public static void main(String[] args){ //int N = 10; double[] list = new double[10]; for(int i = 0; i &lt; list.length; i++) { double randomNumber = (Math.random() * 100); list[i] = randomNumber; } printArray(list); //sort(list); //System.out.println(); //printArray(list); } public static void printArray(double[] list) { for(double u: list) { System.out.printf("%2.2f%s", list[(int) u], " "); } } } I am not understanding why I cannot generate random numbers up to 100 in an array of size 10. Meaning that 10 numbers are randomly generated between 0 and 100. Any suggestions would be great. If you can reference where in the documentation I can find the answers as well. I am new to programming and am having trouble with this.
upvote count: 4
has answer: http://stackoverflow.com/a/22388860
has answer: http://stackoverflow.com/a/22388829
type: UnansweredQuestion
has title: How to generate random numbers up to 100 in an array size of 10
has comment: http://stackoverflow.com/comment/40337856
score: 3
tagged with: numbers
tagged with: java

http://stackoverflow.com/comment/34197450
comment on: http://stackoverflow.com/q/22480739
score: 6
type: Comment
has text: Stacktrace, please!
type: QuestionComment

http://stackoverflow.com/comment/34089403
type: AnswerComment
has text: The JAR *must* contain `ABCartDAO` (and all other referenced classes) if that class is to be referenced.
type: Comment
comment on: http://stackoverflow.com/a/22418598
score: 1

http://stackoverflow.com/comment/33960112
comment on: http://stackoverflow.com/a/22343195
type: Comment
score: 0
type: AnswerComment
has text: Thanks a lot! There's still a problem though. I need to get the execution time of my paintComponent() method, because currently I'm only able to get the time it takes to run just the update loop. How would I achieve this?

http://stackoverflow.com/q/22367962
has comment: http://stackoverflow.com/comment/34002110
has comment: http://stackoverflow.com/comment/34001650
type: Question
has comment: http://stackoverflow.com/comment/34001516
answer count: 1
has comment: http://stackoverflow.com/comment/34001754
has body: I'm trying to add bank holidays from an ics calendar to an ArrayList of Date objects: public void loadHolidays() { try { URL holidays = new URL("https://www.gov.uk/bank-holidays/england-and-wales.ics"); InputStream fin = holidays.openStream(); CalendarBuilder builder = new CalendarBuilder(); Calendar calendar = builder.build(fin); for (Iterator&lt;?&gt; i = calendar.getComponents().iterator(); i.hasNext();) { Component component = (Component) i.next(); SimpleDateFormat fm = new SimpleDateFormat("yyyyMMdd"); publicHolidays.add(fm.parse(component.getProperty("DTSTART").getValue())); } System.out.println("\t\tSuccess."); } catch (IOException e) { System.out.println("\t\tFailed. www.gov.uk/bank-holidays/england-and-wales.ics does not exist."); } catch (ParserException | ParseException e) { System.out.println("\t\tFailed. Format changed in iCalendar"); } } However, I always get: Exception in thread "main" java.lang.NoClassDefFoundError: net/fortuna/ical4j/data/ParserException at framework.GPSIS.main(GPSIS.java:29) Caused by: java.lang.ClassNotFoundException: net.fortuna.ical4j.data.ParserException I have the imports in the beginning of the file: import net.fortuna.ical4j.data.CalendarBuilder; import net.fortuna.ical4j.data.ParserException; import net.fortuna.ical4j.model.Calendar; import net.fortuna.ical4j.model.Component; And my .classpath contains: &lt;classpathentry exported="true" kind="lib" path="library/ical4j-1.0.5.jar"/&gt; I'm fairly new to Eclipse, and I'm trying to figure out what I'm missing here.
tagged with: ical4j
favorite count: 0
has comment: http://stackoverflow.com/comment/34001876
has title: ParserException with ical4j in Eclipse
has comment: http://stackoverflow.com/comment/34001600
tagged with: exception
tagged with: parsing
score: 2
has comment: http://stackoverflow.com/comment/34001711
upvote count: 3
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/34001769
tagged with: java
has answer: http://stackoverflow.com/a/22368427
tagged with: eclipse

web-applications
tags question: http://stackoverflow.com/q/22445710
tags question: http://stackoverflow.com/q/22376680
tags question: http://stackoverflow.com/q/22473713
tags question: http://stackoverflow.com/q/22448445
tags question: http://stackoverflow.com/q/22371612
tags question: http://stackoverflow.com/q/22405181
tag name: web-applications
tags question: http://stackoverflow.com/q/22469777
tags question: http://stackoverflow.com/q/22377903
tags question: http://stackoverflow.com/q/22483397
tags question: http://stackoverflow.com/q/22449299
type: Tag

http://stackoverflow.com/comment/34003782
comment on: http://stackoverflow.com/q/22369373
has text: This question has been asked a dozen times or more. You should try searching SO for this before posting a new question.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34012767
type: Comment
has text: add this line table.load(new FileInputStream(file)); below the line where you are creating the Properties called 'table'.
type: AnswerComment
comment on: http://stackoverflow.com/a/22374877
score: 0

http://stackoverflow.com/comment/34127287
type: Comment
comment on: http://stackoverflow.com/a/22440060
type: AnswerComment
score: 0
has text: I have no idea why my src folder is empty. Can I regenerate those files as I remember those files are auto generate?

http://stackoverflow.com/q/22436838
favorite count: 0
tagged with: arraylist
score: 0
downvote count: 1
answer count: 0
type: UnansweredQuestion
tagged with: collections
type: Question
has title: Repeating overridden elements in ArrayList at the end
has body: I know this question has been often repeated - but mine does not have any resemblance with existing reported issues !! :( Mine there is no static fields and is in Spring framework platform app. Request assistance in the matter .. As you see the console output given, the Array List repeatedly prints last item when I loop back the Array List contents Here are my code snippet the culprit one :) for (Map.Entry&lt;Integer, List&lt;String&gt;&gt; entry : fileDataCollection .entrySet()) { rowDataHolder=getRowDataBucket(); // Spring Based int currrentRowIndex = entry.getKey(); if ((currrentRowIndex &gt; startRange) &amp;&amp; currrentRowIndex &lt; endRange) { List&lt;String&gt; rowDataValue=entry.getValue(); if(null!=(rowDataValue)){ SectionDataVO rowDataHolder=extractSectionSpecificData(entry.getValue()); if(null!=rowDataHolder){ System.out.println("Now Adding rowDataHolder Value"); System.out.println("----"+rowDataHolder); DTOCollectionList.add(rowDataHolder); } } Now my System out println for rowDataHolder shows clearly it collects unique SectionDataVO every time. However when I try to add them in another ArrayList - it just add last one but thrice !! There is no static field here - all are spring based beans. I searched the here a lot of options given .. wondering what next to be done... Console Output : Now Adding rowData to List - TransSummaryDataVO [transactionName= 01_C01_OMS_AddNote, min= 0.061, avg= 0.138, max= 25.607, stdDeviation= 0.725, ninetyPerc= 0.16] TransSummaryDataVO [transactionName= 02_C01_OMS_GetNote, min= 0.09, avg= 0.374, max= 26.003, stdDeviation= 0.801, ninetyPerc= 0.404] TransSummaryDataVO [transactionName= OMSWillingToWait, min= 0.062, avg= 0.249, max= 64.869, stdDeviation= 2.441, ninetyPerc= 0.156] DTOCollectionList Size [TransSummaryDataVO [transactionName= OMSWillingToWait, min= 0.062, avg= 0.249, max= 64.869, stdDeviation= 2.441, ninetyPerc= 0.156], TransSummaryDataVO [transactionName= OMSWillingToWait, min= 0.062, avg= 0.249, max= 64.869, st…
tagged with: java
has comment: http://stackoverflow.com/comment/34125084
has comment: http://stackoverflow.com/comment/34126860
has comment: http://stackoverflow.com/comment/34121503
upvote count: 1
has comment: http://stackoverflow.com/comment/37638000

http://stackoverflow.com/comment/34133888
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22443453
has text: Could it work if i remove this part from my klantenbinding.MyFrame class? `setSize(900, 600); setVisible(true); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE);`
score: 0

http://stackoverflow.com/comment/34088276
has text: (Thanks for the command I didn't know it) So the error is a nullPointerException on this line: for(int i = 0; i < resources.length; i++) { As I suspected the error comes from this part of my code but I still can't figure why I get this error... It works perfectly in Eclipse.
type: Comment
comment on: http://stackoverflow.com/q/22417980
type: QuestionComment
score: 0

http://stackoverflow.com/q/22445023
possible better answer: http://stackoverflow.com/a/22445076
favorite count: 0
has answer: http://stackoverflow.com/a/22445076
has answer: http://stackoverflow.com/a/22445045
has answer: http://stackoverflow.com/a/22445056
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22445222
has title: Printing out two variables on one line?
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22445045
has body: I can't seem to figure out how to print both variables i and balance. When i use + it actually adds them. I also tried several other ways to do it that I looked up on Google but they didn't come out correct either. However When I print out either variable i or balance by themselves, I do get the correct result. Can someone help me? import java.util.*; public class Forloops { public static void main (String [ ] args) { System.out.print("Enter Balance:"); double balance = input.nextDouble(); System.out.print("Enter Number of Months:"); int i = input.nextInt(); for ( i = 0; i &lt;= 12; i = i + 1 ) { balance = balance * (1.00417); System.out.println( balance); } } }
tagged with: java
downvote count: 0
score: 1

http://stackoverflow.com/comment/34182660
type: QuestionComment
comment on: http://stackoverflow.com/q/22471384
has text: We have already used decorator to added the editable row in finishrow method, but it is not getting called when list is empty.can you give sample code how to achieve this
score: 0
type: Comment

http://stackoverflow.com/q/22464594
has comment: http://stackoverflow.com/comment/34170748
has comment: http://stackoverflow.com/comment/34170639
has comment: http://stackoverflow.com/comment/34170917
has answer: http://stackoverflow.com/a/22534782
has answer: http://stackoverflow.com/a/22464882
answer count: 4
tagged with: parsing
favorite count: 0
possible better answer: http://stackoverflow.com/a/22464811
upvote count: 2
has answer: http://stackoverflow.com/a/22464811
has body: I have a string with the format: String dateString = "2014-03-17T20:05:49.2300963Z" Trying this: SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'kk:mm:ss.SSSX"); Date date = df.parse(dateString); Results in an Unparsable date exceptioon. The docs: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html indicate that X is used with ISO 8601 when a single letter is used for the TimeZone. EDIT Re-reading the docs, I've switched up the SimpleDateFormat a little: SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); dateString = dateString.replace("Z", ""); I take out the Z because I know the timezone, use H instead of k and add a couple more S for giggles. Now the time is parsing, but incorrectly. Date is accurate, Time seems to be random. EDIT 2 The problem is that java only allows millisecond accuracy, so 2300963 is being interpreted as 2300 seconds and 963 milliseconds. I'll need to format my string a little differently to get this to work. EDIT 3 Turns out you can't have a fractional part of a second in Java. It has to be truncated to milliseconds. I ended up using a type made available to me by my database, but the general solution is to truncate the fractional part of the second to millisecond. I'll post example code of how to do that as an answer.
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22534782
tagged with: simpledateformat
tagged with: java
tagged with: date
has title: Java Unparsable date
has answer: http://stackoverflow.com/a/40470268
type: Question
linked to: http://stackoverflow.com/q/5636491
has comment: http://stackoverflow.com/comment/34170586
downvote count: 0

http://stackoverflow.com/comment/33945268
type: Comment
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/49503/discussion-between-meir-shapiro-and-user2342687)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22335479

http://stackoverflow.com/q/22406092
tagged with: owl
tagged with: http://stackoverflow.com/tag/rdf
upvote count: 1
tagged with: object-property
accepted answer: http://stackoverflow.com/a/22410005
type: AnsweredQuestion
tagged with: jena
tagged with: java
has body: I'm trying create an Ontology usuing Jena API and the output will be in OWL as pasted down. import com.hp.hpl.jena.ontology.Individual; import com.hp.hpl.jena.ontology.ObjectProperty; import com.hp.hpl.jena.ontology.OntClass; import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.rdf.model.ModelFactory; public class BandsOntology { public static void main(String[] args) { // Create an empty ontology model OntModel m = ModelFactory.createOntologyModel(); String baseURI = "http://www.bands.fr"; String NSBand = baseURI + "#"; m.setNsPrefix("Band", NSBand); OntClass Band = m.createClass(NSBand + "Band"); OntClass Guitarist = m.createClass(NSBand + "Guitarist"); OntClass Bassist = m.createClass(NSBand + "Bassist"); OntClass Keyboardist = m.createClass(NSBand + "Keyboardist"); OntClass Vocalist = m.createClass(NSBand + "Vocalist "); ObjectProperty bandComposedBy = m.createObjectProperty(NSBand +"composedBy"); bandComposedBy.hasDomain(Band); bandComposedBy.hasRange(Guitarist); bandComposedBy.hasRange(Bassist); bandComposedBy.hasRange(Keyboardist); bandComposedBy.hasRange(Vocalist); Individual queen = Band.createIndividual(NSBand + "Queen"); Individual guitarist01 = Guitarist.createIndividual(NSBand + "guita01"); m.add(queen, bandComposedBy, guitarist01); m.write(System.out, Constants.TYPE_RDF_XML_ABBREV); } } And the output on console : &lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:Band="http://www.bands.fr#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"&gt; &lt;owl:Class rdf:about="http://www.bands.fr#Bassist"/&gt; &lt;owl:Class rdf:about="http://www.bands.fr#Band"/&gt; &lt;owl:Class rdf:about="http://www.bands.fr#Vocalist "/&gt; &lt;owl:Class rdf:about="http://www.bands.fr#Keyboardist"/&gt; &lt;owl:Class rdf:about="http://www.bands.fr#Guitarist"/&gt; &lt;owl:ObjectProperty rdf:about="http://www.bands.fr#composedBy"/&gt; &lt;Band:Band rdf:abo…
type: Question
has title: OWL ObjectProperty definition in Jena with domain and range not outputted
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22410005

ldap
tags question: http://stackoverflow.com/q/22358127
tags question: http://stackoverflow.com/q/22381728
tags question: http://stackoverflow.com/q/22383624
tags question: http://stackoverflow.com/q/22407693
tag name: ldap
type: Tag
tags question: http://stackoverflow.com/q/22452861
tags question: http://stackoverflow.com/q/22397249

http://stackoverflow.com/a/22966120
score: 0
type: Answer
has body: You need give the OperatingSystemMXBean enough time to gather CPU usage information. I think, in your example it doesn't have time to gather information
answers question: http://stackoverflow.com/q/22374669

http://stackoverflow.com/comment/34097050
has text: Thing is that when I do export I don't get the "move items" he gets in the video
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22422992

http://stackoverflow.com/a/22429053
type: Answer
answers question: http://stackoverflow.com/q/22428922
score: 1
downvote count: 0
upvote count: 1
has body: You can use the Timer class with it's schedule() method. On callback simple call the methods to "end your level".

http://stackoverflow.com/comment/34127051
score: 0
type: AnswerComment
type: Comment
has text: Thank you, I want to ask you something if it's not a problem. I can't really understand how onItemClick method works. I'm confused with the arguments and also every item in my list has a name. How I can find out which item is clicked and get it's name?
comment on: http://stackoverflow.com/a/22439789

http://stackoverflow.com/a/22340511
score: -1
downvote count: 1
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/22340460
has body: event is null. You need to check for that and not call getAction on it

http://stackoverflow.com/q/22360981
answer count: 1
has body: I have seen the transition thing with the enterState() function, but there you can also specify a out and in transition. How does this work?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34076800
has title: How does the enterState() Transitions work? (Slick2D)
tagged with: java
tagged with: slick2d
type: Question
has comment: http://stackoverflow.com/comment/34506131
has answer: http://stackoverflow.com/a/22416456
score: 0
has comment: http://stackoverflow.com/comment/34057036

http://stackoverflow.com/a/22479302
answers question: http://stackoverflow.com/q/22479259
has body: Because a string uses double quotes and it needs to differentiate between a char and a string. Just the same as it requires you adding an L for long and an f for float when specifying numbers - it needs to be able to determine which type you are referring to. This is a very good article on declaring string literals in Java.
has comment: http://stackoverflow.com/comment/34195098
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34195352
has comment: http://stackoverflow.com/comment/34195389
upvote count: 8
type: Answer
score: 8
accepted answer of: http://stackoverflow.com/q/22479259

http://stackoverflow.com/comment/34167542
score: 0
type: AnswerComment
has text: also i musn't use expections
type: Comment
comment on: http://stackoverflow.com/a/22451662

http://stackoverflow.com/q/22469954
score: -1
has body: Can I use batch programming to read java codes and identify the variables (inside .java or .class) and create a loop at batch programming and modify the variables? For example **Inside java** String s = "abc"; Can batch programming read into java and retrieve the "String s" and modify using batch programming? Thank you for your views, comments and answers. Let me explain why am I asking this question. I have a java code that able to pull files from FTP. There are many folders inside the FTP. And the java code able to pull files from each folder.One year got 52 weeks means that the FTP got 52 folders. I just want to pull files up to 3 weeks back but not 52 weeks. So I suggested them to create a simple function into java codes to pull files up to 3 weeks. But they said they prefer not to touch the java codes. Because they said in future there might be other vendor use this java codes to pull files.So they think that if create a batch file to solve this problem, in future they just need to change the setting in the batch files. They said "if I make changes in java,in future if there are 10 vendors, are you going to maintain 10 java codes?" So they request me to use batch programming to do it. =/. So I am asking is it possible to use batch programming to read variables and modify the variables and return to the java codes. If still unclear, please do ask me. I am willing to answer it.
has answer: http://stackoverflow.com/a/22470132
tagged with: batch-file
has comment: http://stackoverflow.com/comment/34179821
has comment: http://stackoverflow.com/comment/34179782
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34179818
favorite count: 0
has comment: http://stackoverflow.com/comment/34179760
has comment: http://stackoverflow.com/comment/34179831
has comment: http://stackoverflow.com/comment/34179862
accepted answer: http://stackoverflow.com/a/22470132
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34179776
has comment: http://stackoverflow.com/comment/34179915
tagged with: java
downvote count: 1
has title: Can batch programming use to read variables that inside .java and make change of it?
type: Question

http://stackoverflow.com/q/22442344
answer count: 0
has comment: http://stackoverflow.com/comment/34131644
type: UnansweredQuestion
has body: I want to make a generic requests class for android public class Requests { protected JSONObject postRequest(URL url, Map data) { return null; } protected JSONObject getRequest(URL url) { return null; } } I know that if I want to do a request I must do a background task (Thread or AsyncTask), but It´s posible to make a asynctask in both methods?, should I use Threads?, a better idea? Thanks!
has comment: http://stackoverflow.com/comment/34134970
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/34131473
has title: Create generic requests class
tagged with: android-asynctask
tagged with: multithreading
tagged with: request
has comment: http://stackoverflow.com/comment/34132407
score: 0
tagged with: java

http://stackoverflow.com/comment/34187391
type: Comment
comment on: http://stackoverflow.com/q/22474200
score: 0
has text: I don't see references to your scripts in that page. I'm not a java expert, but I think I need the code of the HTML template. You can remove the `.java` file.
type: QuestionComment

http://stackoverflow.com/q/22438035
accepted answer: http://stackoverflow.com/a/22438396
type: AnsweredQuestion
tagged with: java
type: Question
has body: i need to generate barcodes when a certain quantity is inputted in a textbox.but can seem to work with this codes that i made. any help would be appreciated. import com.aspose.barcode.BarCodeBuilder; import com.aspose.barcode.Symbology; import com.aspose.words.Document; import com.aspose.words.DocumentBuilder; JButton btnCreate = new JButton("Create Barcode"); btnCreate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { String strBaseFolder = "C:\\users\\ronjonathan\\desktop\\barcode\\"; try { // Generate barcode image BarCodeBuilder builder = new BarCodeBuilder(); builder.setSymbologyType(Symbology.Code128); for(int i = 1;i &lt;= Integer.parseInt(txtBarcode.getText()); i++){ builder.setCodeText(Integer.toString(i)); String strBarCodeImageSave = "img.jpg"+ i; builder.save(strBaseFolder + strBarCodeImageSave);
answer count: 1
downvote count: 0
score: 1
tagged with: ms-word
has title: generate barcodes when a certain quantity is inputted in a textbox,
favorite count: 0
has answer: http://stackoverflow.com/a/22438396
upvote count: 1

http://stackoverflow.com/a/22353994
answers question: http://stackoverflow.com/q/22353944
upvote count: 2
type: Answer
score: 2
has body: Yes, put a method in A which you override in B and C containing the table name.
has comment: http://stackoverflow.com/comment/33977137
downvote count: 0

http://stackoverflow.com/q/22425188
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: asn.1
has answer: http://stackoverflow.com/a/22425288
type: Question
downvote count: 0
has title: Public key same as PublicKey.getEncoded()
tagged with: openssl
answer count: 1
has body: I want to get same ASN.1 output from OpenSSL as from Java PublicKey.getEncoded(). I use EC and curve type is prime256v1. Here is my code for OpenSSL: EC_KEY *ec_key = EVP_PKEY_get1_EC_KEY(key); unsigned char *result = NULL; int r = i2d_EC_PUBKEY(ec_key, &amp;result); Java code is very simple: byte[] result = keyPair.getPublicKey().getEncoded(); And OpenSSL result contains ASN.1 but not same format as Java code output. In Java output there are only two Object ID's and bit string. In OpenSSL output there are much more parameters and bit string. It seems like in OpenSSL version all this parameters described by curve type are provided but why? If we know curve type we know this parameters so the only thing output must provide is curve type (second Object ID). I understand that I'm doing something wrong so could someone please provide right code for OpenSSL version?
accepted answer: http://stackoverflow.com/a/22425288

http://stackoverflow.com/comment/34112109
has text: could you please take a look at question 2 and 3 queries? Those queries doesn't seems to be working.
type: Comment
comment on: http://stackoverflow.com/a/22431684
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34149833
comment on: http://stackoverflow.com/q/22450313
score: 0
type: Comment
has text: I use `mvn -N versions:update-child-modules` to align all child modules to use the correct parent. Will this help your case?
type: QuestionComment

http://stackoverflow.com/comment/33936047
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22329113
has text: By the way - what CSVReader API is this?

filenotfoundexception
tags question: http://stackoverflow.com/q/22428738
tag name: filenotfoundexception
tags question: http://stackoverflow.com/q/22340683
tags question: http://stackoverflow.com/q/22420835
tags question: http://stackoverflow.com/q/22394326
type: Tag
tags question: http://stackoverflow.com/q/22387759
tags question: http://stackoverflow.com/q/22364778

http://stackoverflow.com/comment/33958912
score: 0
type: AnswerComment
type: Comment
has text: @user2342687 For the margin you need to call requestLayout() after setMargins().
comment on: http://stackoverflow.com/a/22335479

http://stackoverflow.com/a/22427794
has comment: http://stackoverflow.com/comment/39242524
upvote count: 8
has body: One important concept of REST is HATEOAS or Hypermedia as the Engine of Application State. What this means is that your client interacts with the REST service through hypermedia links that the service hands it. Your REST web service has an entry point, say http://yourhost.com/rest. Your client will start by sending the request to that URL. Your service will respond with a resource that describes some or all the accessible resources and how to access them. You keep discovering and following links. This is how the API is published (and discovered). Here's an awesome video describing this concept: Hypermedia APIs. Through HATEOAS you can make your service API completely discoverable by just following hypermedia links. There is no concept of top down/bottom up design in REST. REST is about resources, not about method calls, which is basically what a WSDL describes. Even if client has to do it manually, how client will know what is the class definition of EmployeeData class without wsdl or wadl? It won't need to create an EmployeeData class. Say you needed to create a new Employee, you would send a GET request to /employees which would possibly return a response containing how to do that. That might be an XHTML response like so (among other things) &lt;form class="new-employee" action="/context/employees" method="PUT" &gt; &lt;input type="text" name="employee_name" /&gt; &lt;input type="text" name="employee_age" /&gt; &lt;input type="submit" name="submit" /&gt; &lt;/form&gt; The response contains the exact format you need to follow to create a new employee. You need to submit the form to /context/employees with an HTTP PUT request containing those form parameters. This is HATEOAS. The hypermedia link is the /context/employees. The engine is following this link with a PUT request. The application state is that after this request, a new employee will exist.
has comment: http://stackoverflow.com/comment/34105131
type: Answer
has comment: http://stackoverflow.com/comment/34123767
has comment: http://stackoverflow.com/comment/39256841
has comment: http://stackoverflow.com/comment/34252310
has comment: http://stackoverflow.com/comment/34105061
has comment: http://stackoverflow.com/comment/34252435
answers question: http://stackoverflow.com/q/22427747
accepted answer of: http://stackoverflow.com/q/22427747
has comment: http://stackoverflow.com/comment/34113817
type: AcceptedAnswer
downvote count: 0
score: 8

http://stackoverflow.com/comment/34043443
has text: >>8 : right shift by 8 position, suppose that red = 00000000 00001111 , red>>16 means 11111111 00000000 , (00001111 disappeared )
type: AnswerComment
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22391906

http://stackoverflow.com/a/22451114
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22450884
upvote count: 1
has comment: http://stackoverflow.com/comment/34146807
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22450884
has body: From How to Use GroupLayout: The size of each component in a GroupLayout is constrained by three values; minimum size, preferred size and maximum size. These sizes control how the component resizes within the layout. The GroupLayout.addComponent(...) method allows the size constraints to be specified. It seems you just need to specify these constrains on: .addComponent(txtAreaLeft) .addComponent(txtAreaRight) ) .addComponent(txtAreaBottom) and you'll be done.

http://stackoverflow.com/q/22468726
tagged with: maven
has title: JHipster Eclipse project running out of memory in "main"
tagged with: node.js
has body: I am building up a baseline JHipster project with no bells and whistles involved (no clustering, etc.). I am following the exact tutorial steps using my standard Node-enabled (of course) command line, and am then importing the project into Eclipse as a Maven Project. Everything looks like it should be working fine based on reviewing the project, except when I try to run it on the server or build it using the mvn command line... Error Message INFO: Starting Servlet Engine: Apache Tomcat/7.0.12 Exception in thread "main" Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main" POM/Maven From what I can tell, this may be a POM dependency error, but if so then I am having a heck of a time figuring out which. My project is directly configured to use JRE 1.7. My POM is below. Another thought is that it is directly related to the original NPM install from Hipster (after POM): org.springframework.boot spring-boot-starter-parent 1.0.0.RC4 dev true <spring.profiles.active>dev</spring.profiles.active> <logback.loglevel>DEBUG</logback.loglevel> prod <spring.profiles.active>prod</spring.profiles.active> <logback.loglevel>INFO</logback.loglevel> <logback.appender>CONSOLE</logback.appender> com.github.trecloux yeoman-maven-plugin 0.1 <yeomanProjectDirectory>${project.basedir}</yeomanProjectDirectory> run-grunt generate-resources build maven-clean-plugin 2.5 dist .tmp node_modules org.springframework.boot spring-boot-maven-plugin --spring.profiles.active=prod <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.7</java.version> <metrics-spring.version>3.0.0-RC4</metrics-spring.version> <HikariCP.version>1.3.3</HikariCP.version> <commons-lang.version>2.6</commons-lang.version> <commons-io.version>2.4</commons-io.version> <javax.inject.version>1</javax.inject.version> <joda-time-hibernate.version>1.3</joda-time-hibernate.version> <geronimo-ja…
score: 2
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/5756299
tagged with: java
type: Question
tagged with: eclipse
has answer: http://stackoverflow.com/a/22469966
accepted answer: http://stackoverflow.com/a/22469966
upvote count: 2
tagged with: jhipster
answer count: 1
favorite count: 0

lazy-loading
tags question: http://stackoverflow.com/q/22399713
tag name: lazy-loading
type: Tag

http://stackoverflow.com/a/22416905
upvote count: 1
has comment: http://stackoverflow.com/comment/34086836
has body: Remove the semicolon at the end of the if statements. Also, this is a perfect example when a switch statement should be used.
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22416829
has comment: http://stackoverflow.com/comment/34086393

http://stackoverflow.com/q/22487726
accepted answer: http://stackoverflow.com/a/22487773
answer count: 5
has body: Can somebody please explain me this behavior of java. class StringLength { public static void main(String args[]) { String str = "Hi! This is me."; int length = str.length(); System.out.println("String length is :" + length); System.out.println("String length for second case is :".length()); } } The output of code is : String length is :15 34 First println statement gives output as 15. That's ok, but what about second one?? How second one is even syntactically correct, because concatenation operator for java is "+" not ".". can anyone please explain me this output.
has answer: http://stackoverflow.com/a/22487778
has answer: http://stackoverflow.com/a/22487803
has answer: http://stackoverflow.com/a/22487791
type: AnsweredQuestion
tagged with: java
has title: String.length() function
type: Question
has comment: http://stackoverflow.com/comment/34210758
possible better answer: http://stackoverflow.com/a/22487772
has answer: http://stackoverflow.com/a/22487773
has answer: http://stackoverflow.com/a/22487772
has comment: http://stackoverflow.com/comment/34210842
score: 0
has comment: http://stackoverflow.com/comment/34210775

spring-aop
tags question: http://stackoverflow.com/q/22440836
tags question: http://stackoverflow.com/q/22459712
tags question: http://stackoverflow.com/q/22335206
tag name: spring-aop
type: Tag

http://stackoverflow.com/comment/34197555
type: Comment
comment on: http://stackoverflow.com/a/22477666
has text: I have check it again and again! Finaly I found that the problem is with the code. I tried a few tools to submit the request and the problem is with cookies. Every tool which work with cookies run ok, but with other tools the response content write that this connection is not possible because I have disabled cookies in my browser. Any Idea?
type: AnswerComment
score: 0

http://stackoverflow.com/a/22420449
answers question: http://stackoverflow.com/q/22420335
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22420335
type: Answer
downvote count: 1
has body: LocalTime time = new LocalTime(0, 0); // midnight time = time.plusSeconds(110); String output = DateTimeFormat.forPattern("HH:mm:ss").print(time); System.out.println(output); // 00:01:50 Note this answer is valid for amounts of seconds less than one full day (86400). If you have bigger numbers then better use a formatter for durations (in Joda-Time called PeriodFormatter) - see also the right answer of @Isaksson.
upvote count: 10
score: 9

http://stackoverflow.com/q/22372454
upvote count: 3
tagged with: java
type: UnansweredQuestion
has body: I have implemented One-To-Many relationship in my app engine application. Entities are like below: User.java @Entity public class UserMaster { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key key; private String userName; @OneToMany(mappedBy = "user") List&lt;FeedMaster&gt; feeds; } Feed.java @Entity public class FeedMaster { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key feedId; @ManyToOne(fetch = FetchType.LAZY) UserMaster user; } When i try to update FeedMaster entity. it throws com.google.api.server.spi.SystemService invokeServiceMethod: null java.lang.NullPointerException at com.google.appengine.api.datastore.KeyTranslator.convertToPb(KeyTranslator.java:49) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$V3KeyBatcher.toPb(AsyncDatastoreServiceImpl.java:111) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl$V3KeyBatcher.toPb(AsyncDatastoreServiceImpl.java:102) at com.google.appengine.api.datastore.Batcher$BatchIterator.&lt;init&gt;(Batcher.java:176) at com.google.appengine.api.datastore.Batcher$1.&lt;init&gt;(Batcher.java:270) at com.google.appengine.api.datastore.Batcher.getBatches(Batcher.java:270) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl.doBatchGet(AsyncDatastoreServiceImpl.java:301) at com.google.appengine.api.datastore.AsyncDatastoreServiceImpl.get(AsyncDatastoreServiceImpl.java:280) at com.google.appengine.api.datastore.DatastoreServiceImpl$1.runInternal(DatastoreServiceImpl.java:69) at com.google.appengine.api.datastore.DatastoreServiceImpl$1.runInternal(DatastoreServiceImpl.java:66) at com.google.appengine.api.datastore.TransactionRunner.runInTransaction(TransactionRunner.java:29) at com.google.appengine.api.datastore.DatastoreServiceImpl.get(DatastoreServiceImpl.java:66) at com.google.appengine.api.datastore.DatastoreServiceImpl.get(DatastoreServiceImpl.java:56) at com.google.appengine.datanucleus.WrappedDatastoreService.get(WrappedDatastoreService.java:60) at c…
score: 3
tagged with: google-cloud-datastore
tagged with: jpa
downvote count: 0
favorite count: 0
type: Question
tagged with: google-app-engine
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/27566120
has title: Error while updating entity in Google App engine - com.google.api.server.spi.SystemService invokeServiceMethod: null java.lang.NullPointerException

http://stackoverflow.com/a/22405559
answers question: http://stackoverflow.com/q/22405228
downvote count: 0
has body: That is a too general question and it depends on the number of objects created, their life span and their sizes. For example: If you're dealing with big data structure, let's say you load images to memory - you'll need a larger heap. But then you need to consider - do these images long-lived, or they're loaded, manipulated and die. If they die quickly you'll probably have to change the ratio between old and young generation (assuming the old generation contains only "regular" objects) You need to make sure the size of the young generation is large enough to not let any object get to the older the generation on the one hand, but not too large which will cause longer computation to count live objects You can adjust the ratio of the survivor space. If almost nothing makes it to the survivor space then it should be relatively small. There are all sorts of things to think about and there's no one-size-fit all solution. Here's a lecture I like that can get you into this whole idea of GC tuning: Tuning the JVM After you see the video and get the general idea, I would recommend a good article that I recently read to get deeper into the GC and JVM tuning: Java SE 6 HotSpot[tm] Virtual Machine Garbage Collection Tuning
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/56121388
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28763335
has text: `Runnable` is an interface, you can implement it with a lambda. So you can call the `schedule` method with a lambda. Here is a working gist https://gist.github.com/fsamin/ec5aa79bc23965eca277
type: AnswerComment

http://stackoverflow.com/comment/34135363
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22444218
has text: You have made the reverse error: Comparable --> compareTo. Comparator --> compare. I used compareTo for a comparator. Your answer uses compare, for a Comparable.
score: 0

http://stackoverflow.com/a/22445017
has body: Your code works fine for me. i just changed int sum = sumDigits(n) to int sum = sumDigits(0) since n wasn't declared. To have it done correctly, you just would have to put your scanner into the main method and pass the result of it (the long value) to your method sumDigits(long n).
answers question: http://stackoverflow.com/q/22444957
has comment: http://stackoverflow.com/comment/34136771
score: 0
type: Answer

http://stackoverflow.com/q/22404360
has answer: http://stackoverflow.com/a/22405327
has answer: http://stackoverflow.com/a/22404703
type: Question
has answer: http://stackoverflow.com/a/22404626
tagged with: arrays
answer count: 6
has body: class Effect { public static void main(String [] args) { Effect e=new Effect(); e.method(); } void method() { long [] a1 = {3,4,5}; long [] a2 = doArray(a1); //expected output System.out.println("After Calling doArray "+a1[1] +" "+ a2[1]); String s1 = "Hello"; String s2 = doString(s1); //expected output s1=HelloJava s2=World like earlier arrays System.out.println("After Calling doString "+s1 + " " + s2); } long [] doArray(long [] a3) { a3[1] = 7; System.out.println("In doArray "+ a3[0]+" "+a3[1]+" "+a3[2]); return a3; } String doString(String s1) { s1 = s1 + "Java"; System.out.println("In doString "+ s1); return "World"; } } OUTPUT In doArray 3 7 5 After Calling doArray 7 7 In doString HelloJava After Calling doString Hello World My Expected OUTPUT : After Calling doString HelloJava World all array references a1,a2,a3 pointing to same. So, modified data applicable to all but in case of String it gives old value even if we modify data please give some explanation?
linked to: http://stackoverflow.com/q/1552301
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/22404435
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22404449
has title: Arrays and Strings acts as Objects
score: 3
has answer: http://stackoverflow.com/a/22405298
upvote count: 3
tagged with: java

classification
tags question: http://stackoverflow.com/q/22453435
tag name: classification
type: Tag

http://stackoverflow.com/q/22400304
has answer: http://stackoverflow.com/a/22400439
type: AnsweredQuestion
tagged with: javacard
tagged with: java
has comment: http://stackoverflow.com/comment/34074848
linked to: http://stackoverflow.com/q/16095083
type: Question
has comment: http://stackoverflow.com/comment/34056602
accepted answer: http://stackoverflow.com/a/22400439
answer count: 1
has comment: http://stackoverflow.com/comment/34056742
has body: I'm new to Java Card and I'm working on a project where I need PIN secured smart cards for a healthcare project. What I wanted to know is if I can load my Java Card Applet on a non Java smart card (I'm trying to avoid the expensive cost which can pick 40 USD or even more / 1 card) ? If it is possible, I wanted to know some tips on how to make the difference between the cards and get their technical details (Type, Memory, Contact / contacless, etc).
score: 0
tagged with: smartcard
has title: Can i upload my java card applet on a non java smart card?

http://stackoverflow.com/a/22454648
answers question: http://stackoverflow.com/q/22447104
type: Answer
score: 1
upvote count: 1
has body: I'm only providing this as an alternative: Use CSS not xpath. CSS is cleaner, simpler, and faster. span[id^='ctl00_header1_upperRepeater'] I just can't condone the other answers. Xpath is complicated and unnecessary for something of this caliber.
downvote count: 0

http://stackoverflow.com/comment/34017646
has text: @Meno Hochschild: yep, it's instance of LocalTime. Thanks.
type: Comment
comment on: http://stackoverflow.com/q/22378051
score: 0
type: QuestionComment

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/22366559
tags question: http://stackoverflow.com/q/22479222
tags question: http://stackoverflow.com/q/22431413
tags question: http://stackoverflow.com/q/22441753
tags question: http://stackoverflow.com/q/22417584
tags question: http://stackoverflow.com/q/22447823
type: Tag
tags question: http://stackoverflow.com/q/22467525
tags question: http://stackoverflow.com/q/22474543
tags question: http://stackoverflow.com/q/22342843

http://stackoverflow.com/q/22448713
answer count: 1
has answer: http://stackoverflow.com/a/22448762
duplicate of: http://stackoverflow.com/q/3677606
tagged with: jdbc
duplicate of: http://stackoverflow.com/q/2400955
linked to: http://stackoverflow.com/q/3677606
type: AnsweredQuestion
has title: How to insert java.util.Date object holding date and time into mysql database
tagged with: java
linked to: http://stackoverflow.com/q/2400955
tagged with: mysql
accepted answer: http://stackoverflow.com/a/22448762
type: Question
has body: I am using following code to insert a java.util.Date object in MySQL. d1 is date object I'm getting from a function. I tried casting java.util.Date into java.sql.Date but this doesn't save the time part. String sql = "INSERT INTO abc " + "VALUES" + "('Zara',?)"; pstmt = conn.prepareStatement(sql); pstmt.setDate(1, d1); stmt.executeUpdate(sql); Any Idea to store Date and time of Date Object in MySQL?
tagged with: java.util.date
has comment: http://stackoverflow.com/comment/34142717
score: 0

http://stackoverflow.com/q/22456862
tagged with: java
has title: Bracket Tournament planning (optaplanner)
tagged with: drools
has comment: http://stackoverflow.com/comment/34605720
tagged with: optaplanner
tagged with: drools-planner
tagged with: tournament
score: 0
has body: I am trying to create a implementation to plan a tournament schedule per round. Als called bracket Tournament. I am trying to use OptaPlanner for this, but the documentation is not that clear to me. I have the following classes: Player Table Matchup (containing: 2 players and a table) This is my planningEntity Round (containing: a list of matches, a list of players, a list of tables, a list of previous matchups) This is my planningSolution) Schedule (containing: a list of rounds) What I want out of this, is at least for 1 round a list of matchups from this info. What I do not get is how to configure my rules in drools. For example: how do I configure a rule that simply states: a machup contains two players that are not the same player. Another one is: a matchup contains two players that have not played against each other Finally: a table is available for exactly one matchup. It feels not that complicated, but the documentation (including samples) are just not enough to get there.
has comment: http://stackoverflow.com/comment/34185151
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42019595
type: Question

http://stackoverflow.com/q/22475016
tagged with: java
type: Question
has body: I would like to serialize some objects in console application just before program terminates itself(without adding this code simply in the end of main method)? Is that possible to solve out?
has title: How to invoke method before console program terminates itself
has comment: http://stackoverflow.com/comment/34188295
tagged with: termination
score: 0
has answer: http://stackoverflow.com/a/22478152
answer count: 1
tagged with: application-close
tagged with: serialization
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34187976

http://stackoverflow.com/a/22329157
upvote count: 1
has comment: http://stackoverflow.com/comment/33934133
answers question: http://stackoverflow.com/q/22328877
has body: Hash would generally be the way to go. Rather than concatenating month and country, you could cheat and just add the hashcodes of these two values together to form a combined hashcode; that'd save you some processing effort and memory use. You could also define .equals() for the record to implement the match logic you've described, which would let a hashset directly check whether a matching entry exists.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33937558
type: Answer
has comment: http://stackoverflow.com/comment/33937475

http://stackoverflow.com/comment/33950633
comment on: http://stackoverflow.com/a/22338953
type: Comment
has text: @Jean-Paul - variables don't get discarded. Values do.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22375266
accepted answer: http://stackoverflow.com/a/22375494
answer count: 1
score: 0
has body: I have a method which updates the records in database and following is my method: String hqlUpdate="UPDATE VFSMSServerOut vFSMSServerOut SET vFSMSServerOut.status=:rowStatus where cast(vFSMSServerOut.createDate as date) between :fromDate and :toDate and vFSMSServerOut.status in ('U','NU'))"; int rowsCount=4 public void updateProcessingRows(String hqlUpdate, Date frmDate, Date toDate,Integer rowsCount) throws SecMsgException { Session session = null; try { session = hibernateTemplate.getSessionFactory().openSession(); Query updateProcessingRows = session.createQuery(hqlUpdate); updateProcessingRows.setString("rowStatus", "QU"); updateProcessingRows.setDate("fromDate", frmDate); updateProcessingRows.setDate("toDate", toDate); updateProcessingRows.setMaxResults(rowsCount); updateProcessingRows.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } } but instead of updating only four rows, the query updates all the rows which falls under the date range given. how do i set number of rows to update
linked to: http://stackoverflow.com/q/12284814
has answer: http://stackoverflow.com/a/22375494
type: Question
has comment: http://stackoverflow.com/comment/34013056
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/88204643
tagged with: java
tagged with: hibernate
has title: update only the number of rows given in hibernate
tagged with: sql

http://stackoverflow.com/comment/33991329
has text: Unhappy what? Please post the code of your template as well.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22361924
type: Comment

http://stackoverflow.com/comment/34056263
has text: No, this is not possible since I'm using the latest 1.7 JRE.
type: QuestionComment
comment on: http://stackoverflow.com/q/22392812
score: 0
type: Comment

http://stackoverflow.com/q/22421815
answer count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34094564
has answer: http://stackoverflow.com/a/22421923
tagged with: java
has title: Possible loss of precision double
has answer: http://stackoverflow.com/a/22421893
type: Question
score: 0
tagged with: double-precision
has body: int leccs1 = q1+q2+r1+swhw1; System.out.println("LecCS = "+ leccs1+ "/60"); int lecprelim = lcp+lcpo; System.out.println("LecPrelim = "+ lecprelim+ "/100"); double x = 0.50; int lecgrade = ((x * leccs1) + (x * lecprelim)); System.out.println("LecGrade = "+ lecgrade); C:\FINALS OBE\OBE1\ICS112_1ISB_LecFinals_OBE.java:61: error: possible loss of precision int lecgrade = ((x * leccs1) + (x * lecprelim)); ^ required: int found: double 1 error Process completed. I am trying to compute grade. The user enters the grades as input. I want x to be double not int.
has answer: http://stackoverflow.com/a/22421866
has comment: http://stackoverflow.com/comment/34094551

http://stackoverflow.com/q/22366600
has title: How to use JPA in a existing project?
accepted answer: http://stackoverflow.com/a/22366925
score: 0
answer count: 1
has body: My team is working on a medium size application (OLTP style). We were interested by switching to JPA instead of only using JDBC queries. Mostly for performance and practical reason. I'm not looking for a tutorial that shows me how to create a persistence.xml or Entity class in Eclipse. What i would like to know is what would be the steps to convert all the database queries into the JPA format. I know that the whole application must use JPA. Many programmers has worked on this project over the years, so not everyone has the same SQL knowledge or the same programming skills. So there must be in this application 1000+ customs queries, using multiple tables (something that native JPA does not support very well), or query that is selecting only a few fields in a table... This is getting a bit out of control and i think that JPA would create a nice toolbox to make sure that everyone is going the same direction. What should i look for to make sure that i'm not going into a process (convertion) that will never end ? Some sort of guideline. (Again, i'm not looking for programming exemples, nor Eclipse tutorial.) Thanks!
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
type: Question
tagged with: jpa
has answer: http://stackoverflow.com/a/22366925

http://stackoverflow.com/q/22433904
has answer: http://stackoverflow.com/a/22434018
tagged with: linkedhashset
has comment: http://stackoverflow.com/comment/34115868
has answer: http://stackoverflow.com/a/22434023
score: 0
type: UnansweredQuestion
tagged with: collections
has answer: http://stackoverflow.com/a/22434046
tagged with: java
tagged with: set
has body: I was reading about Set interface from here which the code sipped below which is a generic method that removes duplicates from a collection. My question is what is that **&lt; E&gt;** placed after static before Set&lt;E&gt; ? I mean wouldn't that Set&lt;E&gt; be enough ? why &lt;E&gt; was there twice? public static &lt;E&gt; Set&lt;E&gt; removeDups(Collection&lt;E&gt; c) { return new LinkedHashSet&lt;E&gt;(c); }
has title: What is that <E> in the method signature?
has comment: http://stackoverflow.com/comment/34115830
type: Question
has comment: http://stackoverflow.com/comment/34227977
answer count: 3
has comment: http://stackoverflow.com/comment/34115987
tagged with: generics

http://stackoverflow.com/comment/34035958
score: 0
comment on: http://stackoverflow.com/q/22388135
type: Comment
type: QuestionComment
has text: Create a `interface ModernPlane extends Plane` and add other methods to it? Although you _still_ won't be able to access the new methods if you access your F-22 as a `Plane`...

http://stackoverflow.com/comment/33962231
score: 0
comment on: http://stackoverflow.com/q/22345631
type: Comment
type: QuestionComment
has text: You can remove all `else` statements since they are obsolete because your `if` statements have `return` statements.

http://stackoverflow.com/comment/34365665
has text: Multiplying by index positions will give you a result like the Weighted Sum. In fact, it is a kind of Weighted Sum (using the index position as a weight). This doesn't guarantee uniqueness, nor does it preserve similarity, though it doesn't destroy all similarity either.
type: Comment
comment on: http://stackoverflow.com/a/22550285
score: 0
type: AnswerComment

http://stackoverflow.com/a/22371904
upvote count: 1
score: 1
has body: It means that Java does not support AEDT abbreviation, but since you know timezone offset you can doit this way SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("GMT+12")); java.util.Date convertedDate = (java.util.Date) sdf.parse(date1);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22371612
type: Answer
accepted answer of: http://stackoverflow.com/q/22371612

http://stackoverflow.com/a/22350464
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/22350420
upvote count: 3
has body: While iterating a Collection, element removal should be done only by means of Iterator.remove. Or else, undefined behavior may happen. for (Iterator&lt;List&lt;String&gt;&gt; it = lists.iterator(); it.hasNext();) { List&lt;String&gt; aList = it.next(); if (mustRemove(aList)) { it.remove(); } } From The Collection Interface in the Java Tutorials: Note that Iterator.remove is the only safe way to modify a collection during iteration; the behavior is unspecified if the underlying collection is modified in any other way while the iteration is in progress. Also, if you're in a position to use third-party libraries, you could use Apache Commons' Collections CollectionUtils.filter() along with a Predicate that would remove unwanted elements from the List.
type: Answer

http://stackoverflow.com/q/22353535
type: Question
tagged with: vtd-xml
upvote count: 1
answer count: 1
has body: I am currently looking to integrate VTD-XML in to our project (as a replacement of a Stax based system). Our xml files are mostly structured like this: &lt;header&gt; &lt;entry1 timestamp="0"/&gt; &lt;entry2 timestamp="1"/&gt; &lt;entry1 timestamp="2"/&gt; &lt;entry2 timestamp="3"/&gt; &lt;/header&gt; Is there a way to get VTD-XML to recognize that the timestamps are strictly ordered and to abort a xpath query like /header/*[@timestamp &lt; 2] early?
favorite count: 0
has title: Prior knowledge on attributes?
has answer: http://stackoverflow.com/a/22354333
accepted answer: http://stackoverflow.com/a/22354333
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/22426598
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34102589
has answer: http://stackoverflow.com/a/22426648
downvote count: 1
has comment: http://stackoverflow.com/comment/34102651
type: Question
tagged with: object
has body: I'm nearing the end of my program and I've hit a snag that I don't know how to fix. I'm trying to compare the rank value of two cards, so I use a method to get the rank of the card that was just removed from the queue. However, I can't convert the card to int values. I'm a little confused by this because the Card is simply two int values, rank and suit which are then converted to strings via the cRank/cSuit arrays. This is the specific code that is causing the error x = Card.getRank(PlayerOne.remove()); //Incompatible types: Card cannot be converted to int Here is the code, and if you see anything that makes you want to cry just point it out. Card class package randomdeck; import java.util.ArrayList; import java.util.Stack; public class Card { int suit; int rank; public String[] cRank = new String[] { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King" }; public String[] cSuit = new String[] { "Hearts", "Spades", "Diamonds", "Clubs" }; public Card(int rank, int suit) { this.suit=suit; this.rank=rank; } int getRank(int rank) { return rank; } int getSuit(int suit) { return suit; } void setSuit() { suit=Card.this.suit; } void setRank() { rank=Card.this.rank; } public String toString() { return cRank[rank] + " of " + cSuit[suit]; } } Deck Class public class Deck { Stack&lt;Card&gt; Deck = new Stack&lt;Card&gt;(); public Deck() { for(int rank=0; rank&lt;13; rank++) { for(int suit=0; suit&lt;4; suit++) { Deck.push(new Card(rank,suit)); } } } public void peekDeck() { System.out.println(Deck); } public void printDeckSize() { System.out.println("DECK " + Deck.size()); } public int getDeckSize() { Deck.size(); return Deck.size(); } public Stack popDeck() { Deck.pop(); return Deck; } public Stack getDeck() { return Deck; } public void shuffleDeck() { long seed = System.nanoTime(); //Collections.shuffle(Deck, new Random(seed)); //MichealScot.no/gif ArrayList&lt;Card&gt; temp = new ArrayList&lt;Card&gt;(); while(Deck.size()!=0) { temp.add(Deck.pop()); } …
score: -1
linked to: http://stackoverflow.com/q/11993077
has answer: http://stackoverflow.com/a/22426641
answer count: 2
has title: incompatible types: Card cannot be converted to int
upvote count: 0
has comment: http://stackoverflow.com/comment/34102658
tagged with: incompatibility
favorite count: 0

http://stackoverflow.com/comment/34030168
type: Comment
type: QuestionComment
has text: You may want to read a basic tutorial. double is a reserved keyword. The scopes of numerator and denominator are local to the main, you can't access them in your "double" method. You need to return something from your method, it's not the case here.
comment on: http://stackoverflow.com/q/22384967
score: 3

http://stackoverflow.com/q/22426222
type: Question
has comment: http://stackoverflow.com/comment/34102031
upvote count: 1
tagged with: e-commerce
favorite count: 0
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has title: How to access different database for different subbranch stores in java web?
tagged with: multiple-databases
has body: I am trying to implement a small ecommerce website. And some requirements are There are many branch stores. Each store can have different products when using my website, people first choose store, then browse products in store chose Different branch store want to have their customize web page template So My thought is Specify separately database for each branch store(fix the 1st and 2nd requirements), we use url to decide which database to query As product's structure is same, all the databases have same schema(Table definition). When maintaining by CMS, each store insert differnt product content into different database. And after people choose store(i.e. www.my.com/1102, which means 1102 branch store is chosen), my server can query data all from corresponding database. Can this be done in java web development? If yes, how and any disadvantage? If no, how to solve such requirement? Thanks. Any comments is appreciated.

http://stackoverflow.com/comment/34209498
score: 0
has text: I believe that my question should have been "Does the Java Language provide a facility to do this?" and the answer is "No.". Thoughts?
type: Comment
comment on: http://stackoverflow.com/q/22383128
type: QuestionComment

http://stackoverflow.com/comment/34206557
type: QuestionComment
type: Comment
has text: How did you map the action in the `struts.xml` or by convention?
comment on: http://stackoverflow.com/q/22477899
score: 0

http://stackoverflow.com/q/22466239
upvote count: 1
tagged with: autowired
duplicate of: http://stackoverflow.com/q/39173982
has comment: http://stackoverflow.com/comment/34173435
has body: I've tried everything i can think of to fix this error but spring cannot seem to differentiate between the base holdService and it's child activationHoldService. @Component("ActivationHoldService") public class ActivationHoldServiceImpl extends HoldServiceImpl { @Component("BaseHoldService") public class HoldServiceImpl implements HoldService { @Component("com.erac.vos.webservice.hold.HoldWebServiceValidator") public class HoldWebServiceValidator extends BaseValidator { private static final Log LOG = LogFactory.getLog( com.erac.vos.webservice.hold.HoldWebServiceValidator.class); @Autowired @Qualifier("BaseHoldService") private HoldService holdService; I'm trying to Autowire the HoldService but i keep getting the error message could not autowire field: private com.erac.vos.service.vehicle.hold.HoldService com.erac.vos.webservice.vehicle.hold.HoldWebServiceValidator.holdService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.erac.vos.service.vehicle.hold.HoldService] is defined: expected single matching bean but found 2: [ActivationHoldService, BaseHoldService] I've tried changing it to @Resource(name="BaseHoldService",type=com.erac.vos.service.vehicle.hold.HoldServiceImpl.class) Including excluding the quailifier and even switching the baseHoldService to a different name, and any combination of those things i can think of, to get it to work but it still cant find it. the strangest part is have a near identical line of code in a different class that works perfectly fine @Resource(name="BaseHoldService",type=com.erac.vos.service.vehicle.hold.HoldServiceImpl.class) private HoldService defaultHoldService; Any Ideas whats going on?
type: Question
linked to: http://stackoverflow.com/q/39173982
answer count: 2
has comment: http://stackoverflow.com/comment/34173720
has answer: http://stackoverflow.com/a/22488509
downvote count: 0
has title: No unique bean of type is defined [blah]: expected single matching bean but found 2 [moreBlah]
has comment: http://stackoverflow.com/comment/34184371
favorite count: 0
has comment: http://stackoverflow.com/comment/34174211
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22538936
tagged with: spring
has comment: http://stackoverflow.com/comment/34175180
score: 1
tagged with: java

http://stackoverflow.com/a/22442167
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22442071
score: 3
answers question: http://stackoverflow.com/q/22442071
has body: MainActivity mc = new MainActivity(); Instantiating a new activity doesn't make any sense. Instead, you need to find the existing instance of MainActivity and call it's desired method. Also, using an activity to play music isn't really a good idea. Consider using a service.
upvote count: 3

http://stackoverflow.com/comment/34000204
has text: I'm sorry. I needed to do something shortly after this so I had to rush this, which is why there's only small information in my post.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22365974
score: 0

mapreduce
tags question: http://stackoverflow.com/q/22408931
type: Tag
tags question: http://stackoverflow.com/q/22467370
tags question: http://stackoverflow.com/q/22336194
tags question: http://stackoverflow.com/q/22357561
tags question: http://stackoverflow.com/q/22414249
tag name: mapreduce
tags question: http://stackoverflow.com/q/22406490
tags question: http://stackoverflow.com/q/22379379
tags question: http://stackoverflow.com/q/22464537
tags question: http://stackoverflow.com/q/22463163
tags question: http://stackoverflow.com/q/22353605
tags question: http://stackoverflow.com/q/22384689
tags question: http://stackoverflow.com/q/22462665
tags question: http://stackoverflow.com/q/22441669
tags question: http://stackoverflow.com/q/22351547

http://stackoverflow.com/q/22416569
tagged with: design-patterns
type: Question
tagged with: setter
has answer: http://stackoverflow.com/a/22416942
score: 0
answer count: 2
has body: I am trying to build an ORM around GlideRecords. GlideRecords have a format similar to var inc = new GlideRecord('incident'); inc.addQuery("foo", "1"); inc.addQuery("bar", "1"); inc.query(); The orm is intended to look like this: var inc = new ORM().foo("1").bar("1").query(); My immediate decision was to implement the ORM using builder pattern but then realized that I also had to support update operations. ie inc.foo("2").update() Now update needs me to use setters So Help me chose from following options: Use only setters Use builders and setters.
type: UnansweredQuestion
has title: Building an ORM and debating setters vs builders
tagged with: builder
has answer: http://stackoverflow.com/a/22417026
tagged with: java
tagged with: orm

http://stackoverflow.com/comment/34181772
has text: What's `j =>0` supposed to be?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22471279
type: QuestionComment

http://stackoverflow.com/a/22402091
has comment: http://stackoverflow.com/comment/34059998
score: 0
has body: Define entry as final like this: for (final Map.Entry&lt;String, String&gt; entry : myMap.entrySet())
type: Answer
has comment: http://stackoverflow.com/comment/34059442
answers question: http://stackoverflow.com/q/22401960
accepted answer of: http://stackoverflow.com/q/22401960
type: AcceptedAnswer

http://stackoverflow.com/q/22461913
type: UnansweredQuestion
tagged with: java
has title: what does this line mean in reflection
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/8836635
has comment: http://stackoverflow.com/comment/34165642
has comment: http://stackoverflow.com/comment/34165680
has answer: http://stackoverflow.com/a/22461944
has comment: http://stackoverflow.com/comment/34165695
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34165560
favorite count: 0
linked to: http://stackoverflow.com/q/22461278
duplicate of: http://stackoverflow.com/q/22461278
has body: new Class[]{String.class} What does this line mean actually,why do we write String.class when we pass as an argument in getDeclaredConstructor() method? and why we pass it as Class array?
score: -1
tagged with: reflection

http://stackoverflow.com/q/22477346
tagged with: websphere
has title: Server crashes on generation of large excel files (with more than 100000 rows and 24 columns) using poi
answer count: 1
has answer: http://stackoverflow.com/a/22477475
type: AnsweredQuestion
tagged with: apache-poi
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22477475
has body: We have a dynamic web project and on a certain request large reports are generated (in .xls format). The data for the reports are fetched from the Data Base and are written to .xls files using poi.But if the number of records exceeds 100000 rows with around 24 columns, the server crashes. Want to know how to generate large xls files using poi. Server : WebSphere Application Server v 7.0.0.29, JVM - 512MB - 2048 MB, POI - Implementation-Version: 3.9 Please let me know if any other details are required from my side.
score: 0

http://stackoverflow.com/q/22366832
has title: Why a nullpointerexception with dynamically modifying a TextView in the ActionBar?
has answer: http://stackoverflow.com/a/22367041
answer count: 2
tagged with: textview
tagged with: nullpointerexception
tagged with: android
accepted answer: http://stackoverflow.com/a/22367041
has comment: http://stackoverflow.com/comment/33999582
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33999640
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/22366881
tagged with: tic-tac-toe
has answer: http://stackoverflow.com/a/22366881
has body: I keep getting a nullpointerexception when I launch my activity. I'm trying to get the score for a tic tac toe game to show up on the Action Bar in a TextView, but whenever I try to set the text in the onPrepareOptionsMenu() method, the application crashes. I am, in fact, using an ActionView to put the widget in the Action Bar. Here is the code in my res/menu/score_show.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourapp="http://schemas.android.com/apk/res-auto" &gt; &lt;item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_settings"/&gt; &lt;item android:id="@+id/scoreTextItem" yourapp:showAsAction="always|withText" android:actionViewClass="android.widget.TextView" yourapp:actionViewClass="@layout/score_text"/&gt; &lt;/menu&gt; And my res/layout/score_text.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scoreText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" &gt; &lt;/TextView&gt; And finally, a snippet of the TicTacToeActivity.java: @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.score_show, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onPrepareOptionsMenu(Menu menu) { scoreItem = menu.findItem(R.id.scoreTextItem); TextView scoreText = (TextView)MenuItemCompat.getActionView(scoreItem); scoreText.setText("P1: " + humanScore + " P2: " + computerScore); supportInvalidateOptionsMenu(); return super.onPrepareOptionsMenu(menu); } Here is my logcat 03-13 00:40:09.244: D/AndroidRuntime(1127): Shutting down VM 03-13 00:40:09.248: E/AndroidRuntime(1127): FATAL EXCEPTION: main 03-13 00:40:09.248: E/AndroidRuntime(1127): Process: com.packagename.tictactoe, PID: 1127 03-13 00:40:09.248: E/AndroidRunt…
type: Question

http://stackoverflow.com/q/22383637
has comment: http://stackoverflow.com/comment/34027841
tagged with: java
has comment: http://stackoverflow.com/comment/34027739
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22383729
answer count: 1
has comment: http://stackoverflow.com/comment/34027831
favorite count: 0
has body: How is the output of the following Java program calculated? class hello { public static void main(String args[]){ short a=(byte)32767; System.out.println(a); } }
has comment: http://stackoverflow.com/comment/34027647
has title: Why does `short a = (byte)32767` become -1?
score: 2
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/34072822
score: 0
type: AnswerComment
has text: Thanks, a for loop would be great except I don't add all the components in the same method, there are about 20 methods for displaying a group of different types of component, I would have to have a loop in each method right?
type: Comment
comment on: http://stackoverflow.com/a/22406485

http://stackoverflow.com/comment/34126702
comment on: http://stackoverflow.com/q/22438030
type: Comment
has text: have a look http://java2practice.com/2014/03/01/java-rpc-style-webservice-with-jax-ws/
score: 0
type: QuestionComment

http://stackoverflow.com/a/22364581
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34010966
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22347048
score: 1
has body: AES is a block cipher that encrypts in blocks of 16 bytes. The padding is used to pad messages so they have a size that is a multiple of 16 bytes. PKCS-5 padding determines the number of bytes missing to be a multiple of 16, and then writes this number repeatable until sufficiently padded. So a message like this (in hex): D1 F2 05 7E 97 54 27 89 F2 would be padded like D1 F2 05 7E 97 54 27 89 F2 07 07 07 07 07 07 07 -------------------- pad When decrypting the message it is checked that the padding is correct. If not, something have gone wrong. Typical causes: Usually when padding is wrong, the whole decrypt have gone wrong. Using NoPadding in the decrypt would only remove the symptoms - not cure the problem. All the following things can trigger a padding exception: Using wrong IV when decrypting Using wrong key when decrypting Using wrong chaining mode when decrypting (the CBC) Or using wrong padding mode (!)
accepted answer of: http://stackoverflow.com/q/22347048

http://stackoverflow.com/comment/33963465
type: Comment
comment on: http://stackoverflow.com/q/22345786
score: 0
type: QuestionComment
has text: @Simon you are absolutely correct. String lp_text = editText.getText().toString(); gives null pointer but i don't want to handle it just I don't want nullpointer

http://stackoverflow.com/q/22423227
accepted answer: http://stackoverflow.com/a/22437330
has body: I'm fairly new in Android development so please forgive me if it's a stupid question. Basically I have an iPhone app,which will compress UIImage into NSData, using UIImageJPEGRepresentation method, this is not a problem. The question begins when I am trying to read this data on an Android device. I'm transferring the image data (NSData)from iPhone to Android, and I want to display the image on Android. How should I do so? Is there any customised class that can do function similar to UIImage imageWithData in Java, that can decode the data and turn it into Bitmap? Or should I try to encode and decode using a different but stand method? If so, what are the options? Thank you so much for your help!
tagged with: bitmap
has answer: http://stackoverflow.com/a/22437330
type: AnsweredQuestion
tagged with: uiimage
tagged with: java
has title: UIImage, imageWithData in Android?
type: Question
tagged with: ios
score: 0
tagged with: android
answer count: 1

http://stackoverflow.com/a/22466728
accepted answer of: http://stackoverflow.com/q/22466555
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22466555
has body: You need to call the setX methods from your constructor. Also change setISBN to : if((iSBN.length()!=9) &amp;&amp; (iSBN.length()!=12)) { throw new IllegalArgumentException("Invalid ISBN length");
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/34041605
type: Comment
comment on: http://stackoverflow.com/a/22391384
has text: I'm not though perhaps my use of lexographic is imprecise ;-)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33939279
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22331796
type: Comment
has text: @JonSkeet gotcha! Ignore the question!

http://stackoverflow.com/a/22395477
answers question: http://stackoverflow.com/q/22377773
accepted answer of: http://stackoverflow.com/q/22377773
has body: I solved the problem. I was using import org.springframework.web.portlet.ModelAndView. i changed it to import org.springframework.web.servlet.ModelAndView.
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/67044094
comment on: http://stackoverflow.com/a/22374231
type: Comment
has text: What is `LayoutParams`? There are literally dozens of classes called `LayoutParams`.
score: 1
type: AnswerComment

http://stackoverflow.com/q/22330092
has answer: http://stackoverflow.com/a/22339612
has title: Nested Casting using Class.cast() Method
has comment: http://stackoverflow.com/comment/33938139
has comment: http://stackoverflow.com/comment/33950188
tagged with: clone
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33952363
has comment: http://stackoverflow.com/comment/33950708
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33950750
has comment: http://stackoverflow.com/comment/33935210
tagged with: casting
has comment: http://stackoverflow.com/comment/33953401
has comment: http://stackoverflow.com/comment/33951377
has comment: http://stackoverflow.com/comment/33950908
has answer: http://stackoverflow.com/a/22340303
has body: I have a Person class, which implements Cloneable. I then have Objects p and o which reference a Person object. I am trying to clone one into another, and discovered that the following works: Object p = new Person("Heather"); Object o = ((Person)p).clone(); (I have to use that cast because clone() is protected in Object. I use this to call clone() in Person instead.) What I need to know is how to perform the above cast using Class.cast(). I know how to cast once, it would be something like this: Object o = p.getClass().cast(p); But how do I do the nested casting example in this way. (I need to know because in this project, I won't always know what class to cast to but I WILL know the class is Cloneable.) I tried… ((Cloneable)p).clone() ...but that doesn't work. The clone() method is a protected method in the Object class, and interface Cloneable does not have a clone() method, so the compiler can't recognize it. I've looked all over for an answer and can't find one anywhere. Thank you for your help.
tagged with: class
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33949841
favorite count: 0
has comment: http://stackoverflow.com/comment/33952461
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33941207

http://stackoverflow.com/q/22366853
type: Question
tagged with: gridbaglayout
tagged with: layout
has answer: http://stackoverflow.com/a/22366884
has comment: http://stackoverflow.com/comment/34016740
tagged with: preferredsize
downvote count: 0
answer count: 1
has body: I am making a calculator. I used a GridBagLayout to arrange the buttons, and so far it looks like this: I am trying to find the exact size of the grid so I can set the size of the JFrame to match it. In the GridBagLayout API, I found three methods: maximumLayoutSize, minimumLayoutSize, and preferredLayoutSize. I tried all three and set the JFrame to each size to see how they worked: When I looked at the dimensions returned by maximumLayoutSize, they were huge (millions and billions). When I used the dimensions returned by minimumLayoutSize, I got width=151, height=150, which looks like this: When I used the dimensions returned by preferredLayoutSize, I got width=220, height=180, which looks like this: Instead, I want the dimensions of the GridBagLayout when it looks normal like it is in the first picture. How can I get these dimensions?
favorite count: 0
accepted answer: http://stackoverflow.com/a/22366884
has comment: http://stackoverflow.com/comment/34003097
has title: How do I get the dimensions of a GridBagLayout?
has comment: http://stackoverflow.com/comment/34001030
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/34052173
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22397594
has text: Hi @YohanesKhosiawan许先汉 i have doubt in it
score: 0

http://stackoverflow.com/comment/34087225
comment on: http://stackoverflow.com/a/22394609
score: 1
has text: Very nicely done! Congrats on the moderator election.
type: AnswerComment
type: Comment

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/22456653

http://stackoverflow.com/a/22333886
upvote count: 1
has body: The array what I expected should be: {{be},{li},{ev},{e}} If you want to have an array that looks like this, you can use a 2D char array. public static void main(String[] args) throws Exception{ String word="believe"; char[][] arr = getSplittedString(word); System.out.println("The array is: "+Arrays.deepToString(arr)); for(char[] c : arr){ System.out.print(c); System.out.print(' '); } } public static char[][] getSplittedString(String word){ char[] new_word = word.toCharArray(); char[][] word_splitted = new char[word.length()/2 + word.length()%2][]; int j = 0; for(int i = 0; i &lt; word.length()/2; i++){ word_splitted[i] = new char[] {new_word[j++],new_word[j++]}; } if(word.length()%2 != 0){ word_splitted[word_splitted.length-1] = new char[]{new_word[j]}; } return word_splitted; } Output: The array is: [[b, e], [l, i], [e, v], [e]] be li ev e
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22333553
answers question: http://stackoverflow.com/q/22333553
type: AcceptedAnswer
type: Answer
score: 1

http://stackoverflow.com/q/22460571
has title: How do you convert WSDLs to Java classes using Eclipse?
has answer: http://stackoverflow.com/a/22461100
score: 51
has answer: http://stackoverflow.com/a/30584865
has answer: http://stackoverflow.com/a/55395588
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/30584865
downvote count: 0
tagged with: java
favorite count: 0
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34162963
type: Question
upvote count: 51
has answer: http://stackoverflow.com/a/44124718
has answer: http://stackoverflow.com/a/28874025
answer count: 6
has body: I have a WSDL file (or, more precisely, its URL). I need to convert it to Java classes. I also need to provide tests for the web service it describes. I'm new to web services, so could someone tell me how to convert WSDLs to Java? I use Eclipse JEE Kepler. Maybe there are some plugins to do this automatically?
accepted answer: http://stackoverflow.com/a/22461100
has answer: http://stackoverflow.com/a/22460832
tagged with: wsdl

http://stackoverflow.com/a/22816756
type: Answer
has body: This is an absolute hack, but I think it would work on your case: In the file logback.xml, set the scan to a short interval: http://logback.qos.ch/manual/configuration.html#autoScan Then have your code modify the logback file, setting the appropriate level. Logback will re-scan the xml file and apply the changes.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22335441
downvote count: 0

http://stackoverflow.com/q/22411299
has comment: http://stackoverflow.com/comment/34075970
downvote count: 0
tagged with: sorting
has body: I made a program to combine all files in a folder together. Here's part of my code: File folder = new File("c:/some directory"); File[] listOfFiles = folder.listFiles(); for (File file : listOfFiles){ if (file.isFile()){ System.out.println(file.getName()); File f = new File("c:/some directory"+file.getName()); However, I hope my files can be in order of like: job1.script, job2.script, ..... but I get: job1.script, job10.script, job11.script, that 10,11,12... are in front of 2. I hope I can get efficient code that can avoid this problem.
has answer: http://stackoverflow.com/a/22411385
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/34075934
has answer: http://stackoverflow.com/a/22411383
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22411521
has answer: http://stackoverflow.com/a/22413279
tagged with: java
has title: Sort files in numeric order
type: Question

http://stackoverflow.com/comment/34010848
score: 0
type: QuestionComment
type: Comment
has text: that really dependes on your latency requirements. if you dont mind the extra couple of seconds it will take to sort the whole thing at the end than thats the best approach.
comment on: http://stackoverflow.com/q/22373766

localization
tags question: http://stackoverflow.com/q/22470227
type: Tag
tags question: http://stackoverflow.com/q/22473713
tags question: http://stackoverflow.com/q/22449299
tag name: localization
tags question: http://stackoverflow.com/q/22402491

http://stackoverflow.com/comment/33954540
comment on: http://stackoverflow.com/a/22341224
type: Comment
type: AnswerComment
has text: _"I want to draw append. previos oval doesn't disappear "_. @hjepsjga_94 see [this example](http://stackoverflow.com/a/22123304/2587435) in regards to MadProgrammer's point about the `List`
score: 0

http://stackoverflow.com/q/22453364
has comment: http://stackoverflow.com/comment/34150397
has answer: http://stackoverflow.com/a/22453486
type: UnansweredQuestion
upvote count: 1
tagged with: collections
has answer: http://stackoverflow.com/a/22453555
score: 1
tagged with: java
has title: Regarding unmodifiable collection
has body: Consider the following code below import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Test { public static void main(String[] args) { List&lt;Integer&gt; intList1=new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; intList2; intList1.add(1); intList1.add(2); intList1.add(3); intList2=Collections.unmodifiableList(intList1); intList1.add(4); for(int i=0;i&lt;4;i++) { System.out.println(intList2.get(i)); } } } The result of the above code is 1 2 3 4 In the above code we create an unmodifiable List intList2 from the contents of the List intList1. But after the Collections.unmodifiable statement when I make a change to intList1 that change reflects to intList2. How is this possible ?
type: Question
has answer: http://stackoverflow.com/a/22453430
downvote count: 0
has answer: http://stackoverflow.com/a/22453426
favorite count: 0
has answer: http://stackoverflow.com/a/22453454
answer count: 5

http://stackoverflow.com/a/64880543
has comment: http://stackoverflow.com/comment/125442659
type: Answer
upvote count: 4
has body: You can do this with Mockito 3.6.0: when(mockObject.myMethod(anyString())) .thenAnswer(invocation -&gt; myStringMethod(invocation.getArgument(0))); This answer is based on Sven's answer and Martijn Hiemstra's comment, with getArgumentAt() changed to getArgument().
downvote count: 0
answers question: http://stackoverflow.com/q/22338536
score: 4

http://stackoverflow.com/a/22424336
has comment: http://stackoverflow.com/comment/34099322
answers question: http://stackoverflow.com/q/22424246
accepted answer of: http://stackoverflow.com/q/22424246
score: 0
type: AcceptedAnswer
has body: The Problem with your App is, that you use network functions in your main-Thread. Try to use something like an AsyncTask. If you access your PHP-file with your browser you have to make sure that your post-values aren't empty.
type: Answer
has comment: http://stackoverflow.com/comment/34099039

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/22363093
type: Tag

http://stackoverflow.com/q/22332227
type: AnsweredQuestion
tagged with: performance
possible better answer: http://stackoverflow.com/a/22332434
tagged with: java
tagged with: inputstream
has comment: http://stackoverflow.com/comment/33938565
has answer: http://stackoverflow.com/a/22332678
type: Question
accepted answer: http://stackoverflow.com/a/22332796
has body: I am a bit confused at the difference between the file and FileReader classes in Java, they both work for me in the same way in that they can take a text file and input it into an array but which one is actually more efficient to use and which is the best to use in a situation like this. I am aware questions like this have been asked but they tend to focus on specific code or the methods which the two classes have. Thank you.
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22332796
has answer: http://stackoverflow.com/a/22332434
tagged with: input
has comment: http://stackoverflow.com/comment/33938472
has title: What is more efficient to read from a text file, File or FileReader?

http://stackoverflow.com/q/22369612
upvote count: 2
tagged with: java
has body: I want to retrive PName of the row/field whose id =2 and pAddress=INDIA <?xml version="1.0"?> 1 XYZ INDIA 1234567897 2 PQR UK 755377 3 ABC USA 67856697 String expression="/mysqldump/database[@name='MyDb']/table[@name='DescriptionTable']/row/field[@name='id' and ./text()]"; Edit: I would like to get Pname whoese id is 2 and pAddress=INDIA String expression="/mysqldump/database[@name='MyDb']/table[@name='DescriptionTable']/row/field[@name='id' and .='2']and[@name='pAddress' and .='INDIA']/../field[@name='pName']/text()";
has answer: http://stackoverflow.com/a/22369848
has answer: http://stackoverflow.com/a/23080852
type: Question
accepted answer: http://stackoverflow.com/a/22374792
answer count: 6
downvote count: 0
has answer: http://stackoverflow.com/a/22961399
has answer: http://stackoverflow.com/a/23009144
favorite count: 0
has answer: http://stackoverflow.com/a/22369836
has answer: http://stackoverflow.com/a/22374792
possible better answer: http://stackoverflow.com/a/22369836
tagged with: http://stackoverflow.com/tag/xml
has title: How to Check for Multiple Conditions in Xpath
score: 2
tagged with: xpath
type: AnsweredQuestion

http://stackoverflow.com/comment/34021196
type: Comment
has text: @JonSkeet I am quite uncomfortable as you say because I can't reproduce the problem very specifically. I am asking for experience here with this kind of thing.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22380001

http://stackoverflow.com/a/22425213
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has body: By declaring other as final, it means that you can not change the value once it has been set. The reason you're casting to a Person object is because, the parameter of is type Object. That means you can get all of the methods in the Object class. By casting it to Person, you can access all of the methods in the Person class. The same functionality could be achieved by: ((Person)obj).personMethod();
has comment: http://stackoverflow.com/comment/34100311
accepted answer of: http://stackoverflow.com/q/22425183
type: Answer
has comment: http://stackoverflow.com/comment/34100604
answers question: http://stackoverflow.com/q/22425183
has comment: http://stackoverflow.com/comment/34100444
has comment: http://stackoverflow.com/comment/34100416
score: 3

http://stackoverflow.com/q/22478614
answer count: 4
has comment: http://stackoverflow.com/comment/34194147
has body: I couldnt use equals with long values: long a = 20; //or 20L long b = 20; //or 20L if(a.equals(b)) { //do } error: Cannot invoke equals(long) on the primitive type long Also == does not work with long values. How can I check if long values equals?
possible better answer: http://stackoverflow.com/a/22478658
tagged with: equals
upvote count: 2
has answer: http://stackoverflow.com/a/22478658
has answer: http://stackoverflow.com/a/22478678
has title: Cannot invoke equals(long) on the primitive type long
has answer: http://stackoverflow.com/a/22478647
has comment: http://stackoverflow.com/comment/34193841
has comment: http://stackoverflow.com/comment/34194265
downvote count: 7
type: AnsweredQuestion
score: -5
tagged with: java
tagged with: equals-operator
type: Question
accepted answer: http://stackoverflow.com/a/22478647
favorite count: 0
linked to: http://stackoverflow.com/q/8671397
tagged with: android
has answer: http://stackoverflow.com/a/22478713
has comment: http://stackoverflow.com/comment/34193761

http://stackoverflow.com/a/22345890
has body: Without doing null check your are trying to do operation on edittext.
answers question: http://stackoverflow.com/q/22345786
score: 0
type: Answer

http://stackoverflow.com/a/22478658
upvote count: 4
downvote count: 0
has body: == operator used to compare primitive value and equals() method used to compare Object Since, long is a primitive type then you have to use == operator for primitive type data as below... if(a == b ) { //do } The equals() is used to compare 2 Object and Long is an Object type of long. If you declare your instances as Long type then you can use equals() method as below... Long a = 20; Long b = 20; if(a.equals(b)) { //do }
answers question: http://stackoverflow.com/q/22478614
score: 4
type: Answer

http://stackoverflow.com/comment/33999159
type: Comment
score: 1
has text: Why use channels at all? You're doing blocking IO, and storing data into heap-allocated buffers. Do you really think you're gaining *anything* over a simple `SocketInputStream`?
type: QuestionComment
comment on: http://stackoverflow.com/q/22366301

http://stackoverflow.com/a/59628203
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22380119
has body: in my case i already had the maven dependency to 'spring-boot-starter-web' and the project would start fine without auto-stopping when i run it as springboot app from within the IDE. however, when i deploy it to K8s, the app would start and auto-stop immediately. So i modified my main app class to extend SpringBootServletInitializer and this seems to have fixed the auto-stopping. @SpringBootApplication public class MyApp extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(MyApp.class, args); }}

http://stackoverflow.com/a/22399847
downvote count: 0
score: 4
has body: Short update: I talked to one of the Drools developers and that seems to be an actual feature gone slightly wrong. The bug can be found here, the respective question in the mailing list is here and the commit to fix this is here. Thanks to Mario Fusco for this quick fix!
type: Answer
answers question: http://stackoverflow.com/q/22383471
upvote count: 4

http://stackoverflow.com/comment/34064558
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22404750
has text: I am not an Android dev. but i guess @mbs just showed up with the "generic" way of handling the internal storage of the Android System ;)
score: 0

http://stackoverflow.com/comment/105096236
type: QuestionComment
comment on: http://stackoverflow.com/q/22427424
score: 0
has text: It will be great to have it as a plugin to https://github.com/oliver-moran/jimp library.
type: Comment

war
tags question: http://stackoverflow.com/q/22343344
tags question: http://stackoverflow.com/q/22475471
type: Tag
tags question: http://stackoverflow.com/q/22400176
tags question: http://stackoverflow.com/q/22356681
tag name: war
tags question: http://stackoverflow.com/q/22417002
tags question: http://stackoverflow.com/q/22442123

encryption
tags question: http://stackoverflow.com/q/22434005
tags question: http://stackoverflow.com/q/22333550
tags question: http://stackoverflow.com/q/22460089
tags question: http://stackoverflow.com/q/22406368
tags question: http://stackoverflow.com/q/22449053
tags question: http://stackoverflow.com/q/22410602
tags question: http://stackoverflow.com/q/22339123
tag name: encryption
tags question: http://stackoverflow.com/q/22344554
tags question: http://stackoverflow.com/q/22464728
tags question: http://stackoverflow.com/q/22470823
tags question: http://stackoverflow.com/q/22368441
tags question: http://stackoverflow.com/q/22393528
tags question: http://stackoverflow.com/q/22403616
tags question: http://stackoverflow.com/q/22347048
tags question: http://stackoverflow.com/q/22357583
tags question: http://stackoverflow.com/q/22473576
tags question: http://stackoverflow.com/q/22387577
tags question: http://stackoverflow.com/q/22372553
tags question: http://stackoverflow.com/q/22425951
tags question: http://stackoverflow.com/q/22388332
tags question: http://stackoverflow.com/q/22432580
tags question: http://stackoverflow.com/q/22398384
tags question: http://stackoverflow.com/q/22395403
tags question: http://stackoverflow.com/q/22388553
type: Tag
tags question: http://stackoverflow.com/q/22435581
tags question: http://stackoverflow.com/q/22372337

http://stackoverflow.com/a/22469421
accepted answer of: http://stackoverflow.com/q/22469387
answers question: http://stackoverflow.com/q/22469387
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34179012
has body: choicesList.clear will actually delete all data from the list. Since the list is the same one as in the question object, the one in the question object gets cleared too. Instead of clearing it, you want to create a new ArrayList.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34130126
has text: The way my teacher worded the question is what's wrong. "Write a method copyStack that takes as argument a stack S and returns a new stack containing the same elements and in the same order as S. Before the method ﬁnishes, it must restore the contents of S to its original state (same contents in the same order). Besides the new stack that the method returns, the only additional data structure that it can use is a single queue."
type: Comment
comment on: http://stackoverflow.com/a/22441430
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34085998
comment on: http://stackoverflow.com/a/22415573
score: 0
type: Comment
has text: @GarethJones `Color( 0,0,0,0 )` is transparent. `JPanel` is opaque by default. Try `setOpaque(false);`
type: AnswerComment

http://stackoverflow.com/q/22332720
tagged with: api
has answer: http://stackoverflow.com/a/22333196
answer count: 1
linked to: http://stackoverflow.com/q/1381617
type: UnansweredQuestion
tagged with: java
has body: I am trying to create an java/swing based application which shows weather. So far I have created background and textfield + button to get the location but I do not know how to connect it so it shows and changes the background to another image. I am sorry if that's a noob question, but I never did java before (just processing and arduino plus web design) and my uni forced me to use advanced java with knowledge I never did anything like that before. Here is my code so far: package AppPackage; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class ApplicationWidget extends JFrame implements ActionListener { ImageIcon basic; JLabel label1; JFrame frame; JLabel label; JTextField textfield; JButton button; public static void main (String[]args){ ApplicationWidget gui = new ApplicationWidget(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setVisible(true); gui.setSize(320, 480); } public ApplicationWidget() { setLayout(new FlowLayout()); WeatherAPI weather = new WeatherAPI("44418"); System.out.println(WeatherAPI.theWeatherRSS); for(int i = 0; i &lt; WeatherAPI.weatherForecastList.size(); i++) { System.out.println(WeatherAPI.weatherForecastList.get(i).lowTemp + " " + WeatherAPI.weatherForecastList.get(i).highTemp); } label = new JLabel("Welcome! Please Enter your location"); add(label); textfield = new JTextField(15); add(textfield); for(int i = 0; i &lt; WeatherAPI.weatherForecastList.size(); i++) { System.out.println(WeatherAPI.weatherForecastList.get(i).lowTemp + " " + WeatherAPI.weatherForecastList.get(i).highTemp); } button = new JButton("Check weather"); add(button); basic = new ImageIcon(getClass().getResource("basicback.jpg")); label1 = new JLabel(basic); add(label1); /*add design here*/ /*add mouse interaction*/ /*add image capture*/ } @Override public void actionPerformed(ActionEvent e){ JButton button = (JButton) e.getSource(); if (e.getSource() == button){ String data = textfield.…
tagged with: swing
has comment: http://stackoverflow.com/comment/33939990
has comment: http://stackoverflow.com/comment/33941755
has comment: http://stackoverflow.com/comment/33939630
type: Question
tagged with: weather
has title: Weather API display in JFrame
score: 0

http://stackoverflow.com/comment/34137511
type: QuestionComment
has text: yes, it must be sorted else if you want the same result without sorting it will go with the complexity of `n^(n-1)` as you have to check each element with other n-1 elements.
score: 0
comment on: http://stackoverflow.com/q/22445407
type: Comment

http://stackoverflow.com/comment/34177286
comment on: http://stackoverflow.com/a/22468016
score: 0
type: AnswerComment
has text: Ok it does work. I implemented your suggestion in the world constructor and it's all good. The thing is I still can't understand why the previous version didn't work. btw I did add the BasicRobot to the JPanel just deleted it by mistake.
type: Comment

http://stackoverflow.com/q/22423938
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/22424105
type: Question
has comment: http://stackoverflow.com/comment/34098444
tagged with: types
accepted answer: http://stackoverflow.com/a/22424105
has body: I have a problem with the LSP in my program. I have a Base Class that is abstract and two different types of products , one is Food , the other is an Electronic device. I need to make a method that returns the expirationDate/Warranty for those products. The problem is that one is of type Date, and the other (warranty) is of type Int... Do you have any idea how to make a method that satisfies both of those data types? without using switch/if statements since that will violate the OCP. private static void printExpirationDateStatistics(List&lt;Product&gt; foodProducts) { for (Product product : foodProducts) { System.out.println(product.getExpirationDate()); } } Is there any way that is can modify this function to handle both food and electronics so I don't have to make another method for each new product is add ? Those are the methods from the base class public Date getExpirationDate() { return expirationDate; } public void setExpirationDate(Date expirationDate) { this.expirationDate = expirationDate; } public int getWarranty() { return warranty; } public void setWarranty(int warranty) { this.warranty = warranty; } I tried making one getValidity method but the problem is that for food it should return Date, and for electronics should return Int. Any ideas ?
score: 0
has title: Liskov Substitution Principle different data types
answer count: 1
favorite count: 0
tagged with: liskov-substitution-principle

http://stackoverflow.com/comment/33938447
has text: Can you upload a sketch of what you're trying to achieve ?
comment on: http://stackoverflow.com/a/22331836
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22333127
has body: I installed JDK 1.7 u 51 32 bit on Windows 7 32 bit and JDK 1.7 u 51 64 bit on Windows 7 64 bit machine from following link http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html Windows x86 (http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-windows-i586.exe) Windows x64 (http://download.oracle.com/otn-pub/java/jdk/7u51-b13/jdk-7u51-windows-x64.exe) After installation I found different folder hierarchy creation in jre. I was surprised because it creates different structure without giving any option. Difference JDK 1.7 u 51 32 bit is having three directories: - C:\Program Files\Java\jre7\bin\client C:\Program Files\Java\jre7\bin\dtplugin C:\Program Files\Java\jre7\bin\plugin2 Note: - There is no server directory While in JDK 1.7 u 51 64 bit is having different directory structure C:\Program Files\Java\jre7\bin\server C:\Program Files\Java\jre7\bin\dtplugin C:\Program Files\Java\jre7\bin\plugin2 Note: - There is no client directory Now question comes here, because of what option JDk kit has created "client" and "server" directories.
type: UnansweredQuestion
score: 2
has title: Issue in understanding jre directory structure
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/22346113
type: Question
upvote count: 2
answer count: 2
tagged with: java-7
favorite count: 0
has answer: http://stackoverflow.com/a/22344205

http://stackoverflow.com/a/22389238
answers question: http://stackoverflow.com/q/22389102
type: Answer
has body: Don't recursive the total method just retry randoms another time. public static void ladders() { for (int i = 0 ; i &lt; 6 ; i++) { do{ ladderBottoms [i] = (int) ((Math.random () * 80)+1); ladderTops [i] = (int) ((Math.random () * 80)+1); }while(ladderBottom[i] &gt;= ladderTop[i]); }//for }//ladders Not tested.
score: 0

http://stackoverflow.com/q/22341897
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33955756
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33955744
tagged with: file
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33955949
has comment: http://stackoverflow.com/comment/33955855
has title: Java Regex to look for files in multiple directories
has answer: http://stackoverflow.com/a/22342219
accepted answer: http://stackoverflow.com/a/22342219
has comment: http://stackoverflow.com/comment/33955727
answer count: 1
downvote count: 0
has body: I am trying to look for files with ".js", ".less", ".jsp", and ".png" files while also checking for them in many different directories for example "/MyProject/public/someSecurePage.jsp", "/MyProject/public/js/page/SecuredPage1/", "/MyProject/public/js/page/SecuredPage2/", "/MyProject/public/less/page/SecuredPage1/", etc I am using the someString.macthes(regexString) Right now I have 2 separate regexes, but I am not sure they are correct: File exts .*?\\.(jsp|less|css|png|js)$ Directories/Files EDIT1: .*?\\.(/MyProject/public/someSecurePage.jsp|/MyProject/public/js/page/SecuredPag‌​e1/|/MyProject/public/js/page/SecuredPage2/|/MyProject/public/less/page/SecuredPa‌​ge1/) EDIT1: Another issue I am looking at is that this does not seem to look at /MyProject/public/js/page/SecuredPage2/securedPage2.js is not getting read correctly, my if statement is coming to false with this check. My issue is that I am not actually sure that my files/ directories one is correct, because going through an if statement trying to match a directory, comes to false. I am new to using regular expressions
favorite count: 0
has comment: http://stackoverflow.com/comment/33955698
has comment: http://stackoverflow.com/comment/33956142
has comment: http://stackoverflow.com/comment/33956045
tagged with: regex

http://stackoverflow.com/comment/34163171
has text: By registering `MyAdvice` class to the config, UserDetails object is no longer null in MyAdvice class. thank you! However, I also noticed it is not the same object as it is in `UserDetailsInterceptor`.
comment on: http://stackoverflow.com/a/22459772
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22484901
type: Question
score: 0
tagged with: http://stackoverflow.com/tag/html
tagged with: events
has title: java detection of html document nodes
has body: Suppose I have a text in Java from a html document. It is possible to detect mouse events related to document nodes? It is possible to get the id of the node of that document from the event? I did it before using JavaScript.
has comment: http://stackoverflow.com/comment/34205227
type: UnansweredQuestion
tagged with: text
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34205225

http://stackoverflow.com/comment/33947744
comment on: http://stackoverflow.com/q/22337347
score: 0
type: Comment
type: QuestionComment
has text: JB Nizet - your absolutely correct. I had declared them all static and have just changed that and tried and now it works again. thanks. I was working on this last night and forgot I did that (and cant remember why either). Makes perfect sense. thankyou

http://stackoverflow.com/q/22416433
has body: I'm trying to compare a value from a cell in a JTable and a value returned from an SQL ResultSet, but it always return FALSE even if I know they are equal. Their content equals "1" I also checked for the length of each string which is 1. boolean test = (myJTable.getValueAt(0, 0).toString() == rs.getString("ID")) //test equals to false. What makes them different?? Thank you in advance for your help.
score: 0
linked to: http://stackoverflow.com/q/513832
answer count: 1
tagged with: string
duplicate of: http://stackoverflow.com/q/513832
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22416447
has comment: http://stackoverflow.com/comment/34085261
type: Question
has title: String-Comparison in java
has comment: http://stackoverflow.com/comment/34098268
accepted answer: http://stackoverflow.com/a/22416447
has comment: http://stackoverflow.com/comment/34085265

http://stackoverflow.com/comment/34430499
type: AnswerComment
comment on: http://stackoverflow.com/a/22379964
type: Comment
has text: As mentioned, the finalizer thread isn't running a finalize() during any thread dump, the objects build up over a couple of weeks, and a call to System.runFinalization() will clean up the objects in less than a second. That doesn't seem like the finalizer thread is unable to keep up with the objects being discarded.
score: 1

http://stackoverflow.com/a/22375694
score: 1
answers question: http://stackoverflow.com/q/22369575
accepted answer of: http://stackoverflow.com/q/22369575
has body: You need to provide Id of the item as an instance of RowId class. Try this: (Assumming Id of the item is of type Integer) try { SQLContainer deleteContainer = new SQLContainer(new TableQuery("tbl_grade", connectionPool)); RowId itemID = new RowId(new Integer[] { 10 }); deleteContainer.removeItem(itemID); deleteContainer.commit(); } catch (SQLException ex) { ex.printStackTrace(); }
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/34137506
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22445458
has text: @nachokk I'd "guess" it's a process of a watered down example leaving in/out elements...

http://stackoverflow.com/q/22363955
has comment: http://stackoverflow.com/comment/33994764
has comment: http://stackoverflow.com/comment/33994863
has comment: http://stackoverflow.com/comment/33994737
score: 0
accepted answer: http://stackoverflow.com/a/22364033
possible better answer: http://stackoverflow.com/a/22364210
has comment: http://stackoverflow.com/comment/33994818
has title: String equivalence
has answer: http://stackoverflow.com/a/22364210
tagged with: string
tagged with: hex
has comment: http://stackoverflow.com/comment/33995221
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22364033
tagged with: java
has comment: http://stackoverflow.com/comment/33994901
type: Question
has body: String s="00110001" is a string containing the hexadecimal number 31. What I want to know is how can I convert it to a string String a="1". (since the ASCII code for 1 is 49and 49 in hexa is 31.)
has comment: http://stackoverflow.com/comment/33994690
answer count: 2

http://stackoverflow.com/comment/34088678
type: Comment
has text: @KevinBowersox Definitely. The use of e.g. a `Set` to store known airports would be a good first step in that direction.
type: AnswerComment
comment on: http://stackoverflow.com/a/22418217
score: 0

testing
tags question: http://stackoverflow.com/q/22476381
tags question: http://stackoverflow.com/q/22436167
tags question: http://stackoverflow.com/q/22354839
tag name: testing
tags question: http://stackoverflow.com/q/22460584
tags question: http://stackoverflow.com/q/22375142
tags question: http://stackoverflow.com/q/22368754
tags question: http://stackoverflow.com/q/22475737
tags question: http://stackoverflow.com/q/22336465
tags question: http://stackoverflow.com/q/22459613
tags question: http://stackoverflow.com/q/22409603
type: Tag
tags question: http://stackoverflow.com/q/22382818
tags question: http://stackoverflow.com/q/22487077
tags question: http://stackoverflow.com/q/22417113

http://stackoverflow.com/a/22347912
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33967037
has comment: http://stackoverflow.com/comment/33967344
has comment: http://stackoverflow.com/comment/33967256
type: Answer
accepted answer of: http://stackoverflow.com/q/22347651
has body: This line causing the crash...here, context_main is null. LoginThread login = new LoginThread(context_main); Now, initialize the LoginThread object inside the onCreate() method as below...The crash is happening because, the Context of MainActivity isn't properly assigned. LoginThread login; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); login = new LoginThread(this); }
answers question: http://stackoverflow.com/q/22347651

http://stackoverflow.com/a/22364976
accepted answer of: http://stackoverflow.com/q/22364920
upvote count: 6
answers question: http://stackoverflow.com/q/22364920
type: AcceptedAnswer
downvote count: 0
score: 6
type: Answer
has body: Are you sure that the string as is doesn't contain the entire webpage? Printing strings to the console can lead to ellipsis (or truncating, shown as ...) if the string is very long. That doesn't mean however, that it's cut off at the point of ellipsis. Have you tried treating the string, and did you get any errors? Or do you just assume that it is incomplete?

http://stackoverflow.com/comment/34037203
type: QuestionComment
comment on: http://stackoverflow.com/q/22388769
score: 0
has text: Also, you should `return Double.compare(p1_distance, p2_distance);`
type: Comment

http://stackoverflow.com/comment/34053796
has text: @NaveenKumar: No, it's not. You can have a method and a field with the same name in Java.
comment on: http://stackoverflow.com/q/22398510
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22374758
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4166135
has answer: http://stackoverflow.com/a/22376877
tagged with: java
has comment: http://stackoverflow.com/comment/34012227
has body: I have a text file(example.txt) that contains this java code "System.out.println("Hello World!"); How can I execute this java code retrieved from the text file? Thanks :x
has comment: http://stackoverflow.com/comment/34012210
answer count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/4166135
accepted answer: http://stackoverflow.com/a/22376877
score: 0
has title: How can I execute java code retrived from txt file?
has comment: http://stackoverflow.com/comment/34012290
tagged with: file
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/34077257
type: Comment
has text: I was experimenting with profiles. My problem is further complicated by Jenkins not allowing you to parameterize your release goals separately. There's only a single box for your goals and parameters for a release.I ended up solving this by having the job just run release:prepare as normal and then a post build action running the release:perform without tests only on a real release (which is known by Jenkins setting an environment variable). Hacky and not exactly the Maven way but it ended up doing the job well enough.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22400105

junit
type: Tag
tags question: http://stackoverflow.com/q/22425075
tags question: http://stackoverflow.com/q/22357046
tags question: http://stackoverflow.com/q/22346275
tags question: http://stackoverflow.com/q/22466555
tags question: http://stackoverflow.com/q/22452806
tags question: http://stackoverflow.com/q/22345322
tags question: http://stackoverflow.com/q/22346396
tags question: http://stackoverflow.com/q/22391202
tags question: http://stackoverflow.com/q/22447181
tags question: http://stackoverflow.com/q/22417419
tags question: http://stackoverflow.com/q/22424912
tags question: http://stackoverflow.com/q/22379298
tags question: http://stackoverflow.com/q/22411891
tags question: http://stackoverflow.com/q/22469480
tag name: junit
tags question: http://stackoverflow.com/q/22431543
tags question: http://stackoverflow.com/q/22474315
tags question: http://stackoverflow.com/q/22356879
tags question: http://stackoverflow.com/q/22487155
tags question: http://stackoverflow.com/q/22367039
tags question: http://stackoverflow.com/q/22404592
tags question: http://stackoverflow.com/q/22463606
tags question: http://stackoverflow.com/q/22341092
tags question: http://stackoverflow.com/q/22364586
tags question: http://stackoverflow.com/q/22371973
tags question: http://stackoverflow.com/q/22354839
tags question: http://stackoverflow.com/q/22378114
tags question: http://stackoverflow.com/q/22374951
tags question: http://stackoverflow.com/q/22374049
tags question: http://stackoverflow.com/q/22443333
tags question: http://stackoverflow.com/q/22462061
tags question: http://stackoverflow.com/q/22388549
tags question: http://stackoverflow.com/q/22431821
tags question: http://stackoverflow.com/q/22406776
tags question: http://stackoverflow.com/q/22378763
tags question: http://stackoverflow.com/q/22328852
tags question: http://stackoverflow.com/q/22359959
tags question: http://stackoverflow.com/q/22429776
tags question: http://stackoverflow.com/q/22382405

http://stackoverflow.com/comment/34013663
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22363682
has text: you should pass data from activity to fragment , so when you should call the display of fragment you need to pass the data in argument: like this : for exemple Bundle bundle = new Bundle(); String url = getWebViewUrl(); bundle.putString("url", url); WebViewFragment webViewFragment = new WebViewFragment(); // set Fragmentclass Arguments webViewFragment.setArguments(bundle); and in your fragment youshould getfragment to return the value.

http://stackoverflow.com/comment/34177400
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22468024
has text: Sorry I am new to forum! I just thought the little check meant I liked your answer :) So I updated my code with the following changes that you suggested but still not getting any output. it doesn't show any errors and builds successfully though
type: AnswerComment

http://stackoverflow.com/q/22387771
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22387800
tagged with: java
linked to: http://stackoverflow.com/q/10810768
has body: I was getting this error using Eclipse. Duplicate local variable cape I really don't understand why I was getting such an error. This was my code: switch (frame) { // frame is an integer case 0: Sprite cape = modules.get(Module.CAPE); //cape.setRegion(region); cape.translateY(+1); break; case 1: Sprite cape = modules.get(Module.CAPE); //cape.setRegion(region); cape.translateY(-1); break; default: throw new IllegalArgumentException( "Undefined frame number: " + frame); } Why is it not true that the cape variable is local to each case, but instead to the switch statement?
tagged with: switch-statement
type: Question
duplicate of: http://stackoverflow.com/q/10810768
score: 8
has answer: http://stackoverflow.com/a/22387797
has title: Duplicate local variable in switch statement
has answer: http://stackoverflow.com/a/22387795
has answer: http://stackoverflow.com/a/22387806
has comment: http://stackoverflow.com/comment/34035204
tagged with: eclipse
linked to: http://stackoverflow.com/q/3894119
possible better answer: http://stackoverflow.com/a/22387806
downvote count: 0
favorite count: 0
upvote count: 8
accepted answer: http://stackoverflow.com/a/22387795

http://stackoverflow.com/comment/34140026
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22446670
has text: For that you would do something like this: `double bet = me.wagerBet();` and then later on when you decide to reward the winner, do `me.rewardBet(bet);`. And get rid of the bet field from the Player, since it will be kept track of in the main method.

http://stackoverflow.com/a/22414869
type: Answer
upvote count: 1
score: 1
has body: You should be able to pass this through the JobConf object. Assign the JobConf which you get in configure to a local instance and set the value. Should be available in configure() of reducer.
downvote count: 0
answers question: http://stackoverflow.com/q/22414249

http://stackoverflow.com/q/22373395
tagged with: android
tagged with: android-audiomanager
has comment: http://stackoverflow.com/comment/34025182
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34052346
tagged with: java
has comment: http://stackoverflow.com/comment/34026722
type: Question
has body: Which API calls do I have to make to get the hardware volume control buttons to control the speaker volume when in speakerphone mode ?? I have tried to call setVolumeControlStream(AudioManager.STREAM_MUSIC) but that doesn't help. The HW vol buttons only adjusts the speaker volume in handset mode. As soon as I switch to speakerphone mode, the HW buttons don't control the speaker volume anymore. This is how I switch to speakerphone mode: thisAudioMgr.setMode(AudioManager.MODE_IN_COMMUNICATION); thisAudioMgr.setSpeakerphoneOn(true);
has title: Android : How do I get the HW volume buttons to change speaker volume in speakerphone mode?
has comment: http://stackoverflow.com/comment/34011330
score: 0

http://stackoverflow.com/comment/34101103
type: Comment
type: QuestionComment
has text: Sorry, I don't understand your question exactly. If file does not exist it catches it, but my problem if I do not stop running server, the client can not read updated log file. After if I run server and client again in this case client can read previous log information
comment on: http://stackoverflow.com/q/22425501
score: 0

rx-java
tags question: http://stackoverflow.com/q/22468409
type: Tag
tag name: rx-java

http://stackoverflow.com/comment/34184521
has text: As mentioned in your documentation above, these options "[...]should not be used in code intended to be portable". You'd need to use JNI (or better, JNA) and implement your own `Socket`/`SocketFactory` if you want to use these
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22472844

http://stackoverflow.com/q/22357898
tagged with: java-8
type: Question
tagged with: c#
tagged with: java
score: -1
has body: The Java language designer decided to use virtual extension methods instead of static extension methods like C#. Static extension methods can lead to naming conflicts with future methods, but interfaces can leaved untouched. So what were the reasons to use virtual extension methods in Java?
has comment: http://stackoverflow.com/comment/33983679
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33983587
has comment: http://stackoverflow.com/comment/33983269
tagged with: extension-methods
has title: Why does Java have virtual and not static extension methods like C#?
has comment: http://stackoverflow.com/comment/33983436
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/22358501
upvote count: 1

http://stackoverflow.com/comment/34065920
score: 12
type: Comment
type: QuestionComment
has text: What **specific** thing(s) are missing?
comment on: http://stackoverflow.com/q/22405971

http://stackoverflow.com/q/22441753
score: 1
has body: I guess I am going slightly mad... But I can't figure it out. I would like to show a custom alert dialog bound to an Onclick event with a list of data which come from a database. All works perfectly if I use a simple Dialog, but I would like to make it custom in order to set a title, some text views and buttons on the top of the alert dialog (instead of just show a title with the .setTitle() method). Here is my code: protected void onPostExecute(String file_url) { pDialog.dismiss(); runOnUiThread(new Runnable() { @Override public void run() { infoListButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // custom Dialog AlertDialog.Builder builder; AlertDialog alertDialog; Context mContext = getApplicationContext(); LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE); View layout = inflater.inflate(R.layout.custom_dialog_institutionalinfos, null); TextView text = (TextView) layout.findViewById(R.id.custom_dialog_text); text.setText("Hello, this is a custom dialog!"); builder = new AlertDialog.Builder(mContext); builder.setView(layout); alertDialog = builder.create(); // inflating the custom institutional expandable list layout LayoutInflater li = (LayoutInflater) thisContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = li.inflate(R.layout.institutional_info_custom_list, null, false); alertDialog.setContentView(v); InstitutionalInfoListView = (ListView) v.findViewById(android.R.id.list); final MasterDetailArrayAdapter adapter = new MasterDetailArrayAdapter(HomeComune.this, MasterDetailInstitutionalInfoList); InstitutionalInfoListView.setAdapter(adapter); alertDialog.show(); } }); } }); } the app crashes when I click on the infoListButton and I get A message in the LogCat: 03-16 19:25:22.905: E/AndroidRuntime(5301): FATAL EXCEPTION: main 03-16 19:25:22.905: E/AndroidRuntime(5301): android.util.AndroidRuntimeException: requestFeature() must be called before adding content an…
upvote count: 1
has answer: http://stackoverflow.com/a/22442005
type: Question
tagged with: dialog
tagged with: java
has title: How to create a custom alertDialog with a list inside bound to an onClick event android?
tagged with: customdialog
answer count: 1
accepted answer: http://stackoverflow.com/a/22442005
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34130373
type: AnsweredQuestion

http://stackoverflow.com/comment/34139574
comment on: http://stackoverflow.com/q/22446492
type: Comment
type: QuestionComment
has text: @SuhailGupta How many times have you run this program to test it, and what other sources of tweets do you have besides your test program? Have you truly only made 15 tweets today?
score: 0

http://stackoverflow.com/comment/34493969
comment on: http://stackoverflow.com/a/22635805
has text: No other constructors exist apart from the default one.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22393887
tagged with: jenkins-plugins
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has title: jenkins build pipeline plugin add text to build box?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/51652609
has body: Is it possible to add text to the build boxes in the build pipeline plugin (v1.4.2) for Jenkins. For example, in the diagram below I would like to add release info under the timestamp in the "#1 dev" build that will propagate to the next step. Parameters don't appear to do this here.
has answer: http://stackoverflow.com/a/22626635
tagged with: jenkins
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/22371075
has answer: http://stackoverflow.com/a/22371655
linked to: http://stackoverflow.com/q/3624280
tagged with: java
downvote count: 2
tagged with: sharedpreferences
upvote count: 1
has answer: http://stackoverflow.com/a/22371210
possible better answer: http://stackoverflow.com/a/22371655
type: Question
has comment: http://stackoverflow.com/comment/34006242
score: -1
answer count: 2
tagged with: nullpointerexception
accepted answer: http://stackoverflow.com/a/22371210
has body: I am passing and showing values from one activity to another activity, and making file name using those string like this: AU_20140312_160107_65.jpg AU - simple prefix 20140312_160107 - yyyyMMdd_HHmmss 6 - event_id (getting from LoginActivity.java) 5 - operative_id (getting from LoginActivity.java) see my code below: LoginActivity.java: static SharedPreferences sharedprefs; static String event_id, operative_id ; sharedprefs = getApplicationContext().getSharedPreferences( "com.example.app", Context.MODE_PRIVATE); Intent intent = getIntent(); event_id = intent.getStringExtra("event_id"); sharedprefs.edit().putString("EVENT_ID", event_id).commit(); operative_id = intent.getStringExtra("operative_id"); sharedprefs.edit().putString("OPERATIVE_ID", operative_id).commit(); CameraLauncherActivity.java: static File getOutputMediaFile() { String event_ID = LoginActivity.sharedprefs.getString("EVENT_ID", null); Log.d("shared &gt;&gt;&gt; eventID : ", event_ID); String operative_ID = LoginActivity.sharedprefs.getString("OPERATIVE_ID", null); Log.d("shared &gt;&gt;&gt; operativeID : ", operative_ID); timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss") .format(new Date()); // file name mediaFile = new File(LoginActivity.mediaStorageDir.getPath() + File.separator + "AU_" + timeStamp + "_" + event_ID + operative_ID + ".jpg"); return mediaFile; } when launching first time, Log says: shared &gt;&gt;&gt; eventID :(29917): 12 shared &gt;&gt;&gt; operativeID :(29917): 4 like you can see above, everything works fine, and getting eventID and operativeID using log as well but once i will launch my app again, after closing it, and caputre image, then getting NPE and Log : FATAL EXCEPTION: main java.lang.NullPointerException: println needs a message at android.util.Log.println_native(Native Method) at android.util.Log.d(Log.java:155) app.mac.Camera.CameraLauncherActivity.getOutputMediaFile(CameraLauncherActivity.java:386) at app.mac.Camera.CameraLauncherActivity$2.onPictureTaken(CameraLaunche…
favorite count: 0
tagged with: android
has title: Null Pointer using SharedPreferences
type: AnsweredQuestion

http://stackoverflow.com/q/22425277
has title: Error: can only iterate over an array or an instance of java.lang.Iterable
upvote count: 8
has answer: http://stackoverflow.com/a/22425397
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22425397
linked to: http://stackoverflow.com/q/601658
tagged with: java
has body: please help me with my error can't seem to make it work because of that can only iterate over an array or an instance of java.lang.Iterable. i want to create a barcode and read it and add it to the word document Update Post the nodeCollection is from the com.aspose.words. import com.aspose.barcode.*; import com.aspose.barcoderecognition.BarCodeReadType; import com.aspose.barcoderecognition.BarCodeReader; import com.aspose.words.Document; import com.aspose.words.DocumentBuilder; import com.aspose.words.ImageType; import com.aspose.words.NodeCollection; import com.aspose.words.NodeType; import com.aspose.words.Shape; try { // Generate barcode image BarCodeBuilder builder = new BarCodeBuilder(); builder.setSymbologyType(Symbology.Code39Standard); builder.setCodeText("test-123"); String strBarCodeImageSave = "img.jpg"; builder.save(strBarCodeImageSave); // Add the image to a Word doc Document doc = new Document(); DocumentBuilder docBuilder = new DocumentBuilder(doc); docBuilder.insertImage(strBarCodeImageSave); String strWordFile = "docout.doc"; doc.save(strWordFile); // Recognition part // Extract image from the Word document NodeCollection&lt;Shape&gt; shapes = doc.getChildNodes(NodeType.SHAPE, true, false); int imageIndex = 0; for(Shape shape: shapes) { if (shape.hasImage()) { // If this shape is an image, extract image to file String extension = ImageTypeToExtension(shape.getImageData().getImageType()); String imageFileName = MessageFormat.format("Image.ExportImages.{0} Out.{1}", imageIndex, extension); String strBarCodeImageExtracted = "" + imageFileName; shape.getImageData().save(strBarCodeImageExtracted); // Recognize barcode from this image BarCodeReader reader = new BarCodeReader((BufferedImage) Toolkit.getDefaultToolkit().getImage(strBarCodeImageExtracted),BarCodeReadType.Code39Standard); while (reader.read()) { System.out.println("codetext: " + reader.getCodeText()); } imageIndex++; } } } catch(Exception ex) { System.out.println(ex.getMessage()); } } private…
downvote count: 2
has comment: http://stackoverflow.com/comment/34100464
has comment: http://stackoverflow.com/comment/34100733
tagged with: for-loop
possible better answer: http://stackoverflow.com/a/22425341
tagged with: arrays
has answer: http://stackoverflow.com/a/22425341
score: 6
has comment: http://stackoverflow.com/comment/34100579
has comment: http://stackoverflow.com/comment/34100508
has comment: http://stackoverflow.com/comment/34100527
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34100918
favorite count: 0

http://stackoverflow.com/q/22362238
has title: Play framework (Java) can't find cache after deployment. "There is no cache plugin registered"
tagged with: playframework-2.2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22373530
has body: I'm having problems getting Play to use the cache after deploying to my server. The cache works fine in my development environment (Eclipse) but throws an exception on the target server. It states that there is no cache plugin registered. The documentation says to add the cache as a dependency to the Build.scala file but that didn't work. play dependencies reports play-cache_2.10.jar and play-cache_2.10.jar as dependencies. Message: "There is no cache plugin registered. Make sure at least one CachePlugin implementation is enabled." Build.scala: ... val appDependencies = Seq( javaCore, javaJdbc, javaEbean, cache ) (Play version 2.2.2) What am I missing?
tagged with: java
tagged with: caching
type: Question
score: 0
tagged with: playframework
answer count: 1

http://stackoverflow.com/q/22332730
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33939322
tagged with: indexing
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/22332798
tagged with: for-loop
accepted answer: http://stackoverflow.com/a/22332798
has body: I'm attempting to write a method that takes in a string and an array and print out the following... --- Name is "Abe"--- Adorable Beautiful Elegant --- Name is "bob"--- Beautiful Outstanding Beautiful My code... public static void printReport(String name, String[] sortedArray) { System.out.println(name); char c = '\0'; for (int i = 0; i &lt;name.length()-1;i++) { c = name.charAt(i); int index = c-'A'; System.out.println(sortedArray[index]); } } } Where name is the... well name, and sortedArray is an array of 26 adjectives in alphabetical order. I'm attempting to use the numerical values of chars to print out the correct adjective. I'm getting an error on System.out.println(sortedArray[index]); and can't seem to figure out why. Any and all help is much appreciated.
tagged with: char
has title: Java Method Confusion with Chars
has comment: http://stackoverflow.com/comment/33939317

custom-exceptions
type: Tag
tag name: custom-exceptions
tags question: http://stackoverflow.com/q/22414229
tags question: http://stackoverflow.com/q/22343975

http://stackoverflow.com/comment/34064613
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22401949
has text: @user3123545 ...using Eclipse for this, maybe I need to understand these errors and learn how to resolve them. Can i also post the errors from the IDE here ?

http://stackoverflow.com/comment/34091325
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22419506
has text: ok. thanks guys. I just added some more tests for comparison that exposed the flaw in comparison. will update the posting

http://stackoverflow.com/comment/34493732
has text: I think that, when DefaultHttpClient calls execute method HttpGet object inside it(as parameter), it connects the server. Thus it can get response from that server. Am I wrong?
type: Comment
comment on: http://stackoverflow.com/q/22466268
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34102553
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22426558
score: 1
has text: Look into aspect oriented programming for sh*ts and giggles.

http://stackoverflow.com/comment/34176170
has text: thanks, but I am not testing for invalid args in the constructor?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22466676

http://stackoverflow.com/comment/34146854
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22451226
score: 0
has text: typo in the article then, I thought it smelled fishy...

http://stackoverflow.com/q/22470765
type: UnansweredQuestion
has body: I know that concrete classes that extends the abstract classes can benefit from the constructor to save some code, but I still feel it weird that you can have a constructor which can not be used to instantiate the corresponding class.
type: Question
has answer: http://stackoverflow.com/a/22470789
duplicate of: http://stackoverflow.com/q/2170500
tagged with: default-constructor
tagged with: java
has title: Why abstract class in Java has constructor?
has comment: http://stackoverflow.com/comment/34180954
linked to: http://stackoverflow.com/q/2170500
score: 0
answer count: 1
tagged with: abstract-class

http://stackoverflow.com/q/22336582
type: Question
has title: Parsing JSON data in a table
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33946214
has comment: http://stackoverflow.com/comment/33946485
answer count: 1
has answer: http://stackoverflow.com/a/22336710
score: 0
has body: `JSONObject c;JSONArray events;JSONObject event_data; JSONArray cont;JSONObject contacts_data; JSONObject jsonObj=new JSONObject(data); categories = jsonObj.getJSONArray("categories"); for (i = 0; i &lt; categories.length(); i++) { ContentValues valuesCat=new ContentValues(); c = categories.getJSONObject(i); String name = c.getString("name"); Toast.makeText(this, name, Toast.LENGTH_SHORT).show(); String blck=c.getString("black_icon_url"); String wht=c.getString("white_icon_url"); valuesCat.put(GetData.CATEGORY_ID, "c_"+(i+1) ); valuesCat.put(GetData.C_NAME, name); valuesCat.put(GetData.BLACK, blck); valuesCat.put(GetData.WHITE, wht); try{ db.insertOrThrow(GetData.TABLE_CATEGORTIES, null, valuesCat);} catch(Exception e){} events=c.getJSONArray("events") ; for(j = 0 ; j &lt; events.length() ; j++) { event_data = events.getJSONObject(j); cont=event_data.getJSONArray("contacts"); for(k = 0 ; k &lt; cont.length() ; k++) { ContentValues valuesCon=new ContentValues(); contacts_data=cont.getJSONObject(k); String nm1=contacts_data.getString("name"); String phone=contacts_data.getString("phone"); String fb=contacts_data.getString("facebook"); String id="c_"+(i+1)+"e_"+(j+1)+"_"+k; valuesCon.put(GetData.CONTACT_ID, id); valuesCon.put(GetData.NAME, nm1); valuesCon.put(GetData.PHONE, phone); valuesCon.put(GetData.FAB, fb); db.insertOrThrow(GetData.TABLE_CONTACTS, null, valuesCon); } } } } catch (Exception e) { e.printStackTrace(); }` JSON [link]:"http://jsonviewer.stack.hu/#http://www.edg.co.in/events.json" I am parsing the following JSON object into a table but when i run my code only the first iteration runs successfully and the loop is terminated . The JSON i am dealing with is a bit complex it has array inside another array and another array . HELP!! to iterate over the entire JSON object
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33946287

http://stackoverflow.com/a/22419526
upvote count: 1
has body: You need to use add() method to add the element in the arraylist change m_vecWeight.addLast(rand.nextFloat() * 2.0 - 1.0); to m_vecWeight.add(rand.nextFloat() * 2.0 - 1.0);
answers question: http://stackoverflow.com/q/22419503
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/34001556
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22367997
has text: possible duplicate of [Unsupported major.minor version 51.0](http://stackoverflow.com/questions/10382929/unsupported-major-minor-version-51-0)
score: 0

http://stackoverflow.com/q/22417419
has answer: http://stackoverflow.com/a/22417461
type: Question
answer count: 2
tagged with: junit
score: 0
has answer: http://stackoverflow.com/a/22417482
linked to: http://stackoverflow.com/q/11776847
has comment: http://stackoverflow.com/comment/34172840
has comment: http://stackoverflow.com/comment/34087110
type: UnansweredQuestion
has title: Spring & JUnit: Spring instantiates two instances of test class, only injects dependencies for one, runs the other one
tagged with: spring
tagged with: dependency-injection
tagged with: java
has body: What I'm trying to do: Run a single JUnit test (one JUnit test class with a single test method). Test class has one dependency that I expect Spring to handle (inject) prior to running the test. What I see: Test class is instantiated twice, dependency is satisfied (injected) for one of the instances but not the other. Test is run using the instance for which dependencies are not injected. My guess: I'm speculating that the test class is instantiated twice because Spring is using the first instance to analyze dependencies (probably using reflection to look for annotations, which I'm not using). But: I cannot for my life figure out why the test class instance for which the dependency is not created/injected is used to run the test. test.xml &lt;beans ...&gt; &lt;bean id="test" class="com.example.MyTestClass"&gt; &lt;property name="primaryDependency" ref="pridep"/&gt; &lt;/bean&gt; &lt;bean id="pridep" class="com.example.MyPrimaryDependency"&gt; &lt;property name="dataSource" ref="ds"/&gt; &lt;/bean&gt; &lt;bean id="ds" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"/&gt; &lt;/beans&gt; MyTestClass.java @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:test.xml"}) public class MyTestClass { private IPrimaryDependency mDep = null; public MyTestClass() { } public void setPrimaryDependency(IPrimaryDependency dep) { mDep = dep; } @Before public void createImageData() { } @Test public void testImageSearch() { assertNotNull("mDep is null", mDep); } } MyPrimaryDependency.java public class MyPrimaryDependency extends RequiresADataSource implements IPrimaryDependency { public MyPrimaryDependency() { } } Existing related question: Spring dependency injection null when running a test case, but I'm not able to discern what's going on from that answer. Sorry for the rookie question-- I've been scouring documentation (and bothering colleagues) for several days and am baffled by this. Thanks!

http://stackoverflow.com/q/22373394
linked to: http://stackoverflow.com/q/2506488
has answer: http://stackoverflow.com/a/22373491
type: UnansweredQuestion
has body: I have following questions related to finalize() method and Garbage Collection of Java. Is there a way by which we can force finalize() method? And what was the reason for the deprecation from JDK of the following method? Runtime.runFinalizersOnExit(true); Adding to the question above, I was reading the article http://javarevisited.blogspot.com/2011/04/garbage-collection-in-java.html. In this, see point 5 where the author says that finalize() is called before Garbage Collector is called. So does this thing happens for sure? I mean will the finalize() method be always called before execution of Garbage Collector method? Suppose I have a lots of garbage in my heap but the garbage collector isn't executed. So isn't it a bad behavior or a flaw of JVM? And how does it degrade the performance of my application since the garbage collection didn't happened?
tagged with: finalize
has comment: http://stackoverflow.com/comment/34010016
downvote count: 0
has title: Is there a way to enforce finalize() method
score: 1
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/24904178
tagged with: java
tagged with: garbage-collection
upvote count: 1

http://stackoverflow.com/comment/34076841
score: 0
type: Comment
has text: If it does not give you the output as a byte array what does it give you the output as?
type: QuestionComment
comment on: http://stackoverflow.com/q/22411781

http://stackoverflow.com/q/22472404
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22475076
downvote count: 2
answer count: 4
tagged with: java
has body: I want to send the value attribute in &lt;s:property/&gt; from JSP to action class. my &lt;s:property/&gt; is like this. &lt;input type="check box"&gt;&lt;s:property value="option 1" /&gt; &lt;input type="check box"&gt;&lt;s:property value="option 2" /&gt; &lt;input type="check box"&gt;&lt;s:property value="option 3" /&gt; &lt;input type="check box"&gt;&lt;s:property value="option 4" /&gt; here all options are check boxes. value for options are coming from database. Now I want to send user clicked check box/boxes value/s to the java action class. how can I do it ?
type: Question
has title: How to send the value in <s:property/> from jsp to action class
has answer: http://stackoverflow.com/a/22472580
upvote count: 0
score: -2
tagged with: jsp
tagged with: struts2
has answer: http://stackoverflow.com/a/22472917
has answer: http://stackoverflow.com/a/22472699

http://stackoverflow.com/comment/34179821
score: 0
type: Comment
type: QuestionComment
has text: @user2709555. It is not possible to change .class file
comment on: http://stackoverflow.com/q/22469954

fractions
type: Tag
tags question: http://stackoverflow.com/q/22341846
tag name: fractions

http://stackoverflow.com/q/22388959
has answer: http://stackoverflow.com/a/22389097
tagged with: java
has title: Date in UTC zone in Java using Joda-Time
tagged with: date
has comment: http://stackoverflow.com/comment/37666289
tagged with: jodatime
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/42394607
favorite count: 0
accepted answer: http://stackoverflow.com/a/22389021
type: Question
tagged with: datetime
score: 1
has comment: http://stackoverflow.com/comment/42395704
tagged with: utc
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/26924692
has answer: http://stackoverflow.com/a/26924692
has body: I need to convert Joda-Time date/time to java.util.Date. I'm doing as follows. DateTimeFormatter dateTimeFormatter=DateTimeFormat.forPattern("dd-MMM-yyyy hh:mm:ss aa"); DateTime dateTime = dateTimeFormatter.parseDateTime("2-Oct-2013 11:34:26 AM").withZone(DateTimeZone.UTC); System.out.println(dateTime); This displays date/time represented by UTC zone as expected. In this case, it is 2013-10-02T06:04:26.000Z When this dateTime is converted to java.util.Date as follows, System.out.println(dateTime.toDate()); it shows, Wed Oct 02 11:34:26 IST 2013. It should be in the UTC format. Is there a way to represent a Date in UTC after converting it from Joda-Time? I want a date to be stored into a database as represented by the UTC zone. org.joda.time.DateTime needs to be converted to java.util.Date (or java.sql.Timestamp) before inserting it to a database. How to overcome this situation?
has answer: http://stackoverflow.com/a/22389021

http://stackoverflow.com/comment/34111391
comment on: http://stackoverflow.com/a/22431230
type: Comment
has text: Relevant question about detecting the language from binary: http://stackoverflow.com/questions/1704202/determine-source-language-from-a-binary.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34130707
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22441895
has text: `TimeUnit.MILLISECONDS.sleep(insertHere)`
type: Comment

http://stackoverflow.com/a/22413659
score: 0
has comment: http://stackoverflow.com/comment/34082196
answers question: http://stackoverflow.com/q/22413585
type: Answer
has body: Try with String.split() String urlStr = "background: url('../../footer/right.png') repeat;"; String url = urlStr.split("'")[1]; System.out.println(url); output ../../footer/right.png

http://stackoverflow.com/comment/34204379
has text: Your `SearchResult` class isn't `serializable`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22484215

http://stackoverflow.com/q/22456451
accepted answer: http://stackoverflow.com/a/22456960
score: 2
type: AnsweredQuestion
has title: Can you progressively update a JPanel through the EventQueue?
downvote count: 0
tagged with: java
tagged with: multithreading
has body: I have a log on screen that requires three connections to be set up. Each time a connection is successfully set up I immediately want a buffered image to appear next to it (tick or cross). At the moment, the images will not appear until the main thread has finished and all three connections are set up. I have tried spawning new threads to deal with the separate connections being set up to see if this may help but it hasn't. Loading an image (same for cross): // Create new JLabel to hold images; stored as a field picLabelDataMapper = new JLabel(); try { logger.debug("Reading tick.png image"); tick = ImageIO.read(new File("tick.png")); // Global Field } catch (IOException e) { // TODO Auto-generated catch block logger.debug("Read tick.png failed"); e.printStackTrace(); } // Ensure label is not visible; nothing is loaded at this moment anyway picLabelDataMapper.setVisible(false); // Add label to panel panelDataMapper.add(picLabelDataMapper, "cell 3 1"); Check to see if database was set up successfully: /** * Ensure the data Mapper database was set up successfully */ public void checkForDataMapperCompletion(){ if(dataMapperPassed){ picLabelDataMapper.setIcon(new ImageIcon(tick)); picLabelDataMapper.setVisible(true); }else{ picLabelDataMapper.setIcon(new ImageIcon(cross)); picLabelDataMapper.setVisible(true); } } So whats the best way to perform a sequential update like this: Database 1 Set Up > Update GUI Database 2 Set Up > Update GUI Database 3 Set Up > Update GUI Any directions/avenues anyone could recommend to explore ? Thanks in advance.
has answer: http://stackoverflow.com/a/22456960
tagged with: swing
type: Question
upvote count: 2
answer count: 1
favorite count: 0

http://stackoverflow.com/q/22468421
has comment: http://stackoverflow.com/comment/34177582
has comment: http://stackoverflow.com/comment/34177472
has answer: http://stackoverflow.com/a/39167699
tagged with: compareto
linked to: http://stackoverflow.com/q/27581
type: UnansweredQuestion
tagged with: arraylist
has comment: http://stackoverflow.com/comment/65679112
has comment: http://stackoverflow.com/comment/34177990
has title: Im trying to sort an array list with the compareTo method
answer count: 1
linked to: http://stackoverflow.com/q/3730019
linked to: http://stackoverflow.com/q/4108604
linked to: http://stackoverflow.com/q/3413448
type: Question
has body: I am trying to sort Bank accounts where it first sorts by Name alphabetically, and second by the amount in the account from most to least. Unfortunately the CompareTo method doesn't seem to be working correctly, the only part that works is the second part where it sorts by the amount. BankAccount class /** * A bank account has a balance, the name of the account holder, * and an account number. The balance can be changed by deposits * and withdrawals. */ public class BankAccount implements Comparable&lt;BankAccount&gt; { /** * Constructs a bank account with a zero balance. * @param name the name of the account holder */ public BankAccount(String name) { this.name = name; balance = 0; accountNo = ++lastAccountNo; } /** * Constructs a bank account with a given balance. * @param initialBalance the initial balance * @param name the name of the account holder */ public BankAccount(String name, double initialBalance) { this.name = name; balance = initialBalance; accountNo = ++lastAccountNo; } /** * Deposits money into the bank account. * @param amount the amount to deposit */ public void deposit(double amount) { double newBalance = balance + amount; balance = newBalance; } /** * Withdraws money from the bank account. * @param amount the amount to withdraw */ public void withdraw(double amount) { double newBalance = balance - amount; balance = newBalance; } /** * Gets the current balance of the bank account. * @return the current balance */ public double getBalance() { return balance; } /** * Gets the name of the account holder. * @returns the name of the account holder */ public String getName() { return name; } /** * Gets the account number of the account. * @returns the account number of the account */ public int getAccountNo() { return accountNo; } /** * Returns a String representation of the BankAccount. The format * is "name: accountNo balance" * @returns a String representation of the BankAccount. */ public String toString() { return name + ": AccountNo:" + accountNo…
linked to: http://stackoverflow.com/q/14154127
score: 0
tagged with: java

http://stackoverflow.com/comment/34073367
comment on: http://stackoverflow.com/q/22409911
has text: are you using maven ? if yes plz post your dependencies section related to hibernate (including hibernate search)
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/34086910
has text: I would just use a `GridLayout` filled with `JPanel`s and then `paintComponent()` the pieces on. Or put `JLabel`s with icons that relate to the pieces into the `JPanel`s.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22417290

http://stackoverflow.com/q/22418929
has comment: http://stackoverflow.com/comment/34090098
answer count: 3
accepted answer: http://stackoverflow.com/a/22419187
tagged with: arrays
has comment: http://stackoverflow.com/comment/34089892
has title: How to convert Strings to 2d char Array
has body: I have a text file like this A B C D E F AABG EF 123 AD AD POLFE APF PLF ADS I'm trying to put each characters including blank spaces into a 2D array; I tried this data = new ASCIIDataFile(); int rowLen =0; String s = ""; while(data.isEOF()!=true){ iArray[rowLen] = data.readLine().toCharArray(); rowLen++; } but this will give me a null pointer. How can I put them in a 2d char array?
score: 0
tagged with: chars
has answer: http://stackoverflow.com/a/22418981
has answer: http://stackoverflow.com/a/22419187
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22418997
tagged with: java
has answer: http://stackoverflow.com/a/22418997
has comment: http://stackoverflow.com/comment/34089872
has comment: http://stackoverflow.com/comment/34089884

http://stackoverflow.com/q/22485666
possible better answer: http://stackoverflow.com/a/22485736
has comment: http://stackoverflow.com/comment/34206849
downvote count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22485827
accepted answer: http://stackoverflow.com/a/22485827
tagged with: regex
favorite count: 0
has answer: http://stackoverflow.com/a/22485736
has title: Getting values separated by comma inside square brackets using Regex in Java
type: AnsweredQuestion
tagged with: java
score: -1
has body: I have a String like this: String text = "[Values, one, two, three]"; I tried do it with Guava's class Splitter: List&lt;String&gt; split = Splitter.on(",").splitToList(text); But my result is: [Values one two three] How can I get a List with the values one, two and three using Regex?
type: Question
answer count: 2

http://stackoverflow.com/comment/34083387
score: 0
type: Comment
has text: @Bartzilla - calling `new LinkedList()` is NOT tight coupling, that is called making an instance of List. Tight coupling would be passing LinkedList into f().
type: AnswerComment
comment on: http://stackoverflow.com/a/22409145

http://stackoverflow.com/a/22402411
has comment: http://stackoverflow.com/comment/34059847
type: Answer
answers question: http://stackoverflow.com/q/22402131
has comment: http://stackoverflow.com/comment/34060398
score: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/34059944
has body: The should overwrite the paint method of the JFrame. A paint method in Infout is useless. import javax.swing.*; import java.awt.*; public class Infout { Infout(){ JFrame frame = new JFrame() { @Override public void paint(Graphics g) { g.drawRect(5, 5, 105, 105); } }; frame.setSize(300, 400); frame.setTitle("An Empty Frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public static void main(String[] args) { // TODO Auto-generated method stub Infout m = new Infout(); // You shouldn't need to call repaint } }
downvote count: 1

http://stackoverflow.com/a/22437216
type: Answer
has body: You read an object in loop, but when client disconect you must somehow handle exception and do not read other object from ObjectInputStream
accepted answer of: http://stackoverflow.com/q/22431067
score: 0
upvote count: 1
type: AcceptedAnswer
downvote count: 1
answers question: http://stackoverflow.com/q/22431067
has comment: http://stackoverflow.com/comment/34121683

sprite
tags question: http://stackoverflow.com/q/22380848
type: Tag
tag name: sprite

http://stackoverflow.com/comment/34054956
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22398005
has text: I have updated the code in the answer...this works fine for me...let me know any further queries

http://stackoverflow.com/a/22353951
has comment: http://stackoverflow.com/comment/33978103
type: Answer
score: 0
has body: If you are using a JFrame then it is easy. Try this: if(shape1==shape2 &amp;&amp; shape2==shape3){ public void paint(Graphics g) { super.paint(g); Graphics2D g2 = (Graphics2D) g; Line2D lin = new Line2D.Float(100, 100, 250, 260); g2.draw(lin); } } Of course the coordinates depend on where your shape is.
has comment: http://stackoverflow.com/comment/33976908
answers question: http://stackoverflow.com/q/22353814
has comment: http://stackoverflow.com/comment/33979606
has comment: http://stackoverflow.com/comment/33979881
has comment: http://stackoverflow.com/comment/33976493
has comment: http://stackoverflow.com/comment/33976696
has comment: http://stackoverflow.com/comment/33977830
has comment: http://stackoverflow.com/comment/33979647

http://stackoverflow.com/a/22413519
has comment: http://stackoverflow.com/comment/34080551
type: Answer
has comment: http://stackoverflow.com/comment/34103131
answers question: http://stackoverflow.com/q/22413437
has body: You can use native DataSource provided by JDBC driver, but what you usually do is you use a connection pool like DBCP, C3P0 or BoneCP.
score: 0

http://stackoverflow.com/q/22351409
has answer: http://stackoverflow.com/a/22353921
has comment: http://stackoverflow.com/comment/33972157
accepted answer: http://stackoverflow.com/a/22351624
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33972194
has answer: http://stackoverflow.com/a/22351835
score: 0
has title: Does the null object pattern make sense without checks only?
tagged with: design-patterns
type: Question
has body: If one still uses checks for a null object according to the null object pattern, is this still legal use of the null object pattern or is one violating it already? public class Example { private static final Example NULL = new Example(new Object()); public static Example getNull() { return NULL; } private Object member; public Example(Object member) { this.member = member; } } public class Manager { public operation(Example example) { if(Example.getNull().equals(example) == false) { doSomething(example); } } } Ideally one would have a null object that could be called directly with doSomething(example) without checks. But if one needs such a check, does it still make sense to avoid null at all?
tagged with: null
tagged with: java
has comment: http://stackoverflow.com/comment/33972064
has answer: http://stackoverflow.com/a/22351624
answer count: 3
possible better answer: http://stackoverflow.com/a/22353921

http://stackoverflow.com/comment/34134144
score: 0
type: Comment
has text: Thanks for this. Stupid error on my part.
comment on: http://stackoverflow.com/a/22443709
type: AnswerComment

http://stackoverflow.com/q/22420595
upvote count: 0
type: UnansweredQuestion
tagged with: applet
has comment: http://stackoverflow.com/comment/34094754
favorite count: 0
score: -1
type: Question
has comment: http://stackoverflow.com/comment/34112465
answer count: 2
has answer: http://stackoverflow.com/a/22421634
tagged with: swing
has body: we have done this code in java swing. We have a database table nodes and a copy of that table nodecopy. Our motive is to draw a line from a particular node to another destination. Here +tablename+ refer to the table which is getting created every time when got clicked on the screen(a node is also created when clicked). This code showing error as invalid cursor state and result state not closed Please guide public void paint(Graphics g) { int stX,stY,endX,endY; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:router"); Statement sta = con.createStatement(); ResultSet rs=sta.executeQuery("Select * from nodecopy;"); String tablename; ResultSet rs1; while(rs.next()) { tablename=rs.getString("1"); tablename=tablename.trim(); System.out.println("select * from "+tablename+";"); try { rs1=sta.executeQuery("select * from "+tablename+";"); String name,val; if(rs1.next()) { name=rs1.getString(1); val=rs1.getString(2); System.out.println(name+":"+val); } a=search(node_name,tablename); stX=node_x_coordinate[a]; stY=node_y_coordinate[a]; String dest=rs1.getString(1); b=search(node_name,dest); endX=node_x_coordinate[b]; endY=node_y_coordinate[b]; System.out.println(tablename+"\t"+dest+"\t"+stX+"\t"+stY+"\t"+endX+"\t"+endY); Color clr=new Color((int)(Math.random()*999999999)); g.setColor(clr); g.drawLine(stX,stY,endX,endY); JLabel vall; add(vall=new JLabel(rs1.getString(2).trim())); vall.setForeground(clr); vall.setBounds((stX+endX)/2,(stY+endY)/2,40,40); System.out.println(tablename+"\t"+dest+"\t"+stX+"\t"+stY+"\t"+endX+"\t"+endY); } catch(Exception e) { System.out.println(e); sta.execute("delete from nodecopy where node='"+tablename+"';"); sta = con.createStatement(); rs=sta.executeQuery("Select * from nodecopy;"); } }//end of while sta.close(); } catch(Exception e) { System.out.println(e); } }
downvote count: 1
has answer: http://stackoverflow.com/a/22421376
tagged with: java
tagged with: database
has title: Getting the error of Result set not closed and Invalid cursor state in the same code

http://stackoverflow.com/a/22395842
has body: It means exactly what it says it means in the Javadoc: If the certificate is of type X.509 and has a key usage extension field marked as critical, and the value of the key usage extension field implies that the public key in the certificate and its corresponding private key are not supposed to be used for the operation represented by the value of opmode, an InvalidKeyException is thrown.
accepted answer of: http://stackoverflow.com/q/22395403
answers question: http://stackoverflow.com/q/22395403
score: 5
type: AcceptedAnswer
downvote count: 0
upvote count: 5
type: Answer

http://stackoverflow.com/comment/33955855
has text: Also, you may not want to have the `$` at the end of your second regex, unless it is only searching the directories, without the file names attached. `$` means end of the string.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22341897

reflection
tags question: http://stackoverflow.com/q/22332435
tags question: http://stackoverflow.com/q/22405801
tags question: http://stackoverflow.com/q/22470257
tags question: http://stackoverflow.com/q/22439436
tags question: http://stackoverflow.com/q/22440993
tags question: http://stackoverflow.com/q/22419511
tags question: http://stackoverflow.com/q/22442541
tags question: http://stackoverflow.com/q/22442700
tags question: http://stackoverflow.com/q/22340090
tags question: http://stackoverflow.com/q/22472395
tags question: http://stackoverflow.com/q/22468373
tags question: http://stackoverflow.com/q/22358465
tags question: http://stackoverflow.com/q/22364479
tags question: http://stackoverflow.com/q/22461278
tags question: http://stackoverflow.com/q/22453540
tags question: http://stackoverflow.com/q/22374612
tags question: http://stackoverflow.com/q/22439169
type: Tag
tags question: http://stackoverflow.com/q/22470985
tags question: http://stackoverflow.com/q/22450125
tags question: http://stackoverflow.com/q/22474969
tags question: http://stackoverflow.com/q/22461913
tags question: http://stackoverflow.com/q/22384663
tags question: http://stackoverflow.com/q/22442846
tags question: http://stackoverflow.com/q/22462944
tags question: http://stackoverflow.com/q/22377248
tags question: http://stackoverflow.com/q/22459357
tag name: reflection

http://stackoverflow.com/comment/34038645
comment on: http://stackoverflow.com/q/22389638
score: 0
has text: I'd suggest looking at something like Lucene/Solr (optionally wrapped with Hibernate Search), especially if your search is going to be text-heavy or do things like snowballing and synonyms.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34186446
type: Comment
type: QuestionComment
has text: Ok so when I put byte[0] = 0xFF and then I do outputStream.write(byte[0]) it sends 255 on my Port_Com ? Even if when I do sysout of byte[0] its show me -1 ?
score: 0
comment on: http://stackoverflow.com/q/22474001

http://stackoverflow.com/q/22414965
tagged with: algorithm
tagged with: arrays
has comment: http://stackoverflow.com/comment/34082920
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34088937
has comment: http://stackoverflow.com/comment/34082968
has comment: http://stackoverflow.com/comment/34083040
has comment: http://stackoverflow.com/comment/34083002
has comment: http://stackoverflow.com/comment/34083316
tagged with: hash
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34083412
has comment: http://stackoverflow.com/comment/34082899
has comment: http://stackoverflow.com/comment/34082856
has title: Array Hash algorithm better than Arrays.deepHashCode in Java
has body: I feel the algorithm of default Java Arrays.deepHashCode is problematic: I tried the following code: Integer[] a1 = { 2, 1 }; Integer[] a2 = { 1, 32 }; System.out.println("deepHash a1:" + Arrays.deepHashCode(a1) + " a2:" + Arrays.deepHashCode(a2)); The output was: deepHash a1:1024 a2:1024 I found in my application that Arrays.deepHashCode will produce lots of clash when the first element of a two element array is small (e.g. 1 or 2). Does anyone know a better Array hash algorithm? I mean in generally better than Arrays.deepHashCode. The array could have elements of any type. integer, String, Double, boolean, etc.... Not only Integer. The array could have any number of elements. I need a function to replace Arrays.deepHashCode(Object[]), taking the same type of parameters (Object[]) and giving the same type of output (int).
tagged with: java
has comment: http://stackoverflow.com/comment/34083334
type: Question
has answer: http://stackoverflow.com/a/23448707

http://stackoverflow.com/a/22383920
upvote count: 1
has comment: http://stackoverflow.com/comment/34050500
has body: Create a custom spinner Adapter and then use the getDropDownView() method. eg: adapter = new ArrayAdapter&lt;String&gt;(ActivityName.this, R.layout.custom_spinner, gender_arraylist) { @Override public View getView(int position, View convertView, ViewGroup parent) { View v = super.getView(position, convertView, parent); return v; } public View getDropDownView(int position, View convertView, ViewGroup parent) { View v = super.getDropDownView(position, convertView, parent); //change height and width or text size and colour here return v; } };
accepted answer of: http://stackoverflow.com/q/22378722
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22378722
type: Answer
score: 1

http://stackoverflow.com/q/22456636
upvote count: 0
score: -2
possible better answer: http://stackoverflow.com/a/22456772
has body: i want to sleep one thread on my propram,but it put two thread to sleep,so what's my problem,please help? public class TestWait extends Thread{ static TestWait t1; static TestWait t2; public void run() { while(true) { try { t1.sleep(10000); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } public static void main(String [] args) throws InterruptedException { t1 = new TestWait(); t2 = new TestWait(); t1.start(); t2.start(); t1.setName("t1"); t2.setName("t2"); } }
has answer: http://stackoverflow.com/a/22456820
accepted answer: http://stackoverflow.com/a/22456820
answer count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/1508278
downvote count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/22456833
has title: Java's Thread sleep method not behaving as expected
has answer: http://stackoverflow.com/a/22456772
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/34156034
type: Question
has comment: http://stackoverflow.com/comment/34156183
has answer: http://stackoverflow.com/a/22456988

http://stackoverflow.com/q/22487250
accepted answer: http://stackoverflow.com/a/22632990
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/17087164
type: Question
has title: Hibernate delete entry from association table when one part of association is deleted
tagged with: jpa
has answer: http://stackoverflow.com/a/22487370
score: 0
possible better answer: http://stackoverflow.com/a/22498923
answer count: 3
has answer: http://stackoverflow.com/a/22498923
has body: i have the following hibernate mapping: Class Magazine: @Entity @Table(name = "PROJECTNAME_MAGAZINE") @SequenceGenerator(name = "MAGAZINE_SEQUENCE_GENERATOR", sequenceName = "MAGAZINE_SEQUENCE") @Analyzer(definition = "customanalyzer") public class Magazine extends AbstractBaseEntity implements Serializable{ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "MAGAZINE_SEQUENCE_GENERATOR") @Column(name = "ID") private Long id; @NotNull @Field(index=Index.YES, analyze=Analyze.YES, store=Store.NO) @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy="magazine", orphanRemoval = true) private List&lt;MagazineKeywordMapper&gt; magazineKeywordMappings; Class MagazineKeyword @Entity @Table(name = "PROJECTNAME_MAGAZINE_KEYWORD") public class MagazineKeyword extends AbstractBaseEntity { public MagazineKeyword(String keyword) { this.keyword = keyword; this.id = (long) keyword.hashCode(); } @Id @Column(name = "ID") private Long id; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy="keyword",orphanRemoval=true) private List&lt;MagazineKeywordMapper&gt; magazineMappings; Class MagazineKeywordMapper @Entity @Table(name="MAGAZINE_KEYWORD_MAPPER") public class MagazineKeywordMapper extends AbstractBaseEntity implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name = "ID") private Long id; @ManyToOne @PrimaryKeyJoinColumn(name="MAGAZINE_ID", referencedColumnName="ID") private Magazine magazine; @ManyToOne @PrimaryKeyJoinColumn(name="KEYWORD_ID", referencedColumnName="ID") private MagazineKeyword keyword; public MagazineKeywordMapper() { } public MagazineKeywordMapper(Magazine magazine, MagazineKeyword keyword) { this.magazine = magazine; this.keyword = keyword; this.id = Long.parseLong(magazine.getId()+""+keyword.getId()); } I tried alot of stuff, but somehow i could not manage to find a good way to do deletes on the mappings. If i delete a keyword i want all the mappings c…
type: AnsweredQuestion
tagged with: many-to-many
has answer: http://stackoverflow.com/a/22632990

http://stackoverflow.com/comment/34197009
has text: @Thorbjørn Ravn Andersen : Need to see the char or int value of this ASCII 2 or 3 response. Just that.
comment on: http://stackoverflow.com/q/22479933
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22470842
has comment: http://stackoverflow.com/comment/34181209
has comment: http://stackoverflow.com/comment/34181314
answers question: http://stackoverflow.com/q/22470814
has body: If I understand your problem (correct me if not) you cant get the screen to update when you step through each individual space. In which such case you would use the repaint(); method.
has comment: http://stackoverflow.com/comment/34181107
type: Answer
has comment: http://stackoverflow.com/comment/34181350
score: 0

http://stackoverflow.com/q/22378885
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/22379927
tagged with: gson
has answer: http://stackoverflow.com/a/22379927
has comment: http://stackoverflow.com/comment/34019561
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34019105
has answer: http://stackoverflow.com/a/22401940
has comment: http://stackoverflow.com/comment/34020046
score: 1
favorite count: 0
has title: How to send objects of different class in one Json message so that they can be deserialised using Gson?
has body: I want to send message (using RabbitMQ, but I think it's not important). The message text is in Json. I want to send information about two classes in one message. On the listener site I want to deserialize message using Gson, so that I obtain my objects again. One object is a simple object and the second is a list of simple objects. I couldn't find how to serialise two different objects into one Json, so I packed them in a map and made a message out of this map: A a = new A(); ArrayList&lt;B&gt; bList = new ArrayList&lt;B&gt;(); bList.add(new B()); bList.add(new B()); HashMap&lt;String, Object&gt; map = new LinkedHashMap&lt;&gt;(); map.put("A", a); map.put("B", bList); String messageText = gson.toJson(map); If I now want to deserialise the message: HashMap&lt;String, Object&gt; sentItems = gson.fromJson(messageText, HashMap.class); A a = (A) sentItems.get("A"); Collection&lt;B&gt; bList = (Collection&lt;B&gt;) sentItems.get("B"); I get an exception from the line with get("A"): com.google.gson.internal.StringMap cannot be cast to A. Can I fix this or should I follow some other approach to obtain what I want? Edit: The error is the same if I inform Gson of type I want to use: Type type = new TypeToken&lt;HashMap&lt;String, Object&gt;&gt;() {}.getType(); HashMap&lt;String, Object&gt; sentItems = gson.fromJson(argument.getValue(), type);
has comment: http://stackoverflow.com/comment/34019728
upvote count: 1
accepted answer: http://stackoverflow.com/a/22401940

http://stackoverflow.com/comment/34142828
comment on: http://stackoverflow.com/a/22448592
type: Comment
score: 0
type: AnswerComment
has text: Note what the doc of `WeakHashMap` says: "An **entry** in a WeakHashMap will automatically be removed when its key is no longer in ordinary use." (emphasis mine)

http://stackoverflow.com/a/22487272
score: 5
accepted answer of: http://stackoverflow.com/q/22487182
has body: Depends on what you want to accomplish. The version and download link should be in the configuration file of your dependency management tool (such as maven). That way, the documentation is never out of date, and not repeated in every class that happens to use that particular API. To discover which classes use which API, import statements work quite nicely (yes, one can bypass import statements by using qualified class names, but very few people do, as that makes the source code very hard to read). Alternatively, simply remove the library from the classpath, and see where compilation errors occur. I recommend against documenting this in the javadoc, as the caller of your class should be agnostic of its implementation. That is, I consider APIs used to be an implementation detail a caller should not know - and what the caller should not know should not be mixed with the things he must know.
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22487182

http://stackoverflow.com/comment/33989834
has text: What @BoristheSpider means is that posting that your question *is urgent* and any *please* or related comments are not a matter for us. Note that this site is to free help and you already got it from the first comment, but you insist to get your work done. There are other sites where you can pay to get the work done within a limited amount of time that is better suited for your case.
type: Comment
comment on: http://stackoverflow.com/q/22359634
type: QuestionComment
score: 1

http://stackoverflow.com/comment/34184338
has text: A duplicate, although it won't allow me to set it since it has no good answers: http://stackoverflow.com/questions/19398676/aix-cannot-execute-binary-file-0403-006-execute-permission-denied
type: Comment
comment on: http://stackoverflow.com/q/22472743
score: 0
type: QuestionComment

http://stackoverflow.com/q/22391202
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22398390
tagged with: java
tagged with: integration-testing
has title: JUnit @Parameterized function is run before @BeforeClass in a test suite?
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/64554556
has answer: http://stackoverflow.com/a/47023002
has body: I am using a JUnit test suite to run a few tests, one of which is run multiple times using @Parameterized. I am finding that when I run my tests, the @Parameterized function is run before @BeforeClass. Is this expected behavior or is something else happening? I would have expected that @BeforeClass would run before any of the tests are started. Here is my test suite: @RunWith(Suite.class) @SuiteClasses({ Test1.class, Test2.class }) public class TestSuite { @BeforeClass public static void setup() throws Exception { // setup, I want this to be run before anything else } } Test1 uses @Parameterized: public class Test1 { private String value; // @Parameterized function which appears to run before @BeforeClass setup() @Parameterized.Parameters public static Collection&lt;Object[]&gt; configurations() throws InterruptedException { // Code which relies on setup() to be run first } public Test1(String value) { this.value = value; } @Test public void testA() { // Test } } How can I fix this to run the @BeforeClass setup() function before running anything else?
accepted answer: http://stackoverflow.com/a/22398390
linked to: http://stackoverflow.com/q/15493189
has answer: http://stackoverflow.com/a/74829048
tagged with: automated-tests
tagged with: junit
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/37455700
answer count: 5
has answer: http://stackoverflow.com/a/37455700
score: 13
upvote count: 13

http://stackoverflow.com/q/22441089
type: Question
has body: I'm not sure if I'm doing the for loop correctly to give a true value in the if statement. How do i increment by 1 if i need to use this kind of the for loop. This is the part I'm working on. To make a booking, the user should be prompted to input the destination and day of week that they wish to travel. If such a flight exists and there are seats available on the flight, then the passenger details should be input and a new passenger created . The number of seats booked for the flight should be incremented by 1. public void flightBooking(){ Passenger passenger; String flightDay, flightDestination; boolean found = false; Flight myFlight = null; Scanner scan = new Scanner(System.in); System.out.println(" On which day do you wish to travel ? "); flightDay = scan.nextLine(); System.out.println(" What is your destination ? "); flightDestination = scan.nextLine(); for ( Flight d : flightList ) { if (d.getDay().equals(flightDay)) { myFlight= d; found = true; } } for ( Flight s : flightList ) { if (s.getDestination().equals(flightDestination)) { myFlight= s; found = true; } } if (found == true) { System.out.println("The Flight Day and Destination were found, the Flight will be booked."); Passenger passengers = new Passenger ("Laura", "14 Rathmines Rd ","laura99@gmail.com" , myFlight); passengerList.add(passengers); } else { System.out.println("There is no flight booking."); } }
has answer: http://stackoverflow.com/a/22441168
score: 0
answer count: 1
type: UnansweredQuestion
has title: make a booking - For loop
tagged with: java

http://stackoverflow.com/comment/33958755
type: QuestionComment
has text: above link is not working
score: 0
comment on: http://stackoverflow.com/q/22343424
type: Comment

http://stackoverflow.com/q/22330608
accepted answer: http://stackoverflow.com/a/22330850
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22330775
has answer: http://stackoverflow.com/a/22330850
tagged with: string
has body: So I have a site where a user enters a link (which may or may not be from amazon). There's a problem with amazon links though since they add quite a lot of unneccessary information to the URL. For example: http://www.amazon.co.uk/Xbox-360-Console-Wireless-Controller/dp/B00BM2LKHW/ref=sr_1_1?ie=UTF8&amp;qid=1394554640&amp;sr=8-1&amp;keywords=xbox+360 When I just need the following: http://www.amazon.co.uk/Xbox-360-Console-Wireless-Controller/dp/B00BM2LKHW What's the best way to go about this? Would it be like this: if (link.contains("amazon") { link = ....... //should i use the / as a marker? } Just a bit worried a user will enter it without the http:// and then it'll mess it up.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22330775
tagged with: java
has title: Remove unneccessary information from a link?
type: Question

http://stackoverflow.com/comment/34033212
comment on: http://stackoverflow.com/a/22384897
has text: Is there any other alternatives.... i have 10-20 no. of files and total size will be 25-30 MB(without compression)(as mail size restriction). I have not tested with this but got some information as it will be ~50% slow compare to normal write. i need speed as well good compression. I have still to test read and write performance with java.util.zip.ZipOutputStream. Thanks for your valuable suggestion.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/33997956
type: Comment
comment on: http://stackoverflow.com/a/22363598
has text: @CedricSimon just use the normal way - use a loop that will read bytes into a buffer, and write from the buffer to the file : while ((bytesRead = inputStream.read(buffer)) != -1) outputStream.write(buffer, 0, bytesRead ); . here's how to do it with a progress bar: http://stackoverflow.com/a/3028660/878126
type: AnswerComment
score: 0

http://stackoverflow.com/a/22437648
has comment: http://stackoverflow.com/comment/34122450
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34146594
has comment: http://stackoverflow.com/comment/34143298
has body: This happens when the JAR is by itself actually not an executabele JAR. A real executable JAR should have at least a class with a main() method and have it referenced in MANIFEST.MF. Important in Eclipse is that you export your JAR as runnable JAR file. see Corrupt jar file or Make a .JAR file using classes, ERROR : invalid or corrupted file
has comment: http://stackoverflow.com/comment/34122554
has comment: http://stackoverflow.com/comment/34129616
upvote count: 1
answers question: http://stackoverflow.com/q/22437480
has comment: http://stackoverflow.com/comment/34122721
type: Answer
has comment: http://stackoverflow.com/comment/34145072

http://stackoverflow.com/comment/34326531
type: AnswerComment
type: Comment
has text: Sorry, but that didn't change anything :/
comment on: http://stackoverflow.com/a/22486511
score: 0

http://stackoverflow.com/a/22354996
has comment: http://stackoverflow.com/comment/33980899
has comment: http://stackoverflow.com/comment/33978635
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22354821
has comment: http://stackoverflow.com/comment/34003552
type: Answer
score: 13
has comment: http://stackoverflow.com/comment/33978524
has comment: http://stackoverflow.com/comment/33984610
upvote count: 13
has comment: http://stackoverflow.com/comment/33979014
has comment: http://stackoverflow.com/comment/33980555
has comment: http://stackoverflow.com/comment/33998882
has body: There is no difference (except you mentioned). Compiler is smart enough. If I compile following class: public class Test { public static void main(String[] args) { Long foo = (long) 0; Long bar = 0L; } } And then decompile them: $ javap -c Test.class Compiled from "Test.java" public class Test { public Test(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."&lt;init&gt;":()V 4: return public static void main(java.lang.String[]); Code: 0: lconst_0 1: invokestatic #2 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long; 4: astore_1 5: lconst_0 6: invokestatic #2 // Method java/lang/Long.valueOf:(J)Ljava/lang/Long; 9: astore_2 10: return } I don't see any difference. Use one which is look better for you or corresponds to the conventions. To verify decompiler I compile this two lines independent and then calculate checksums: $ sha1sum Test.class_L Test.class_long 292a93b6433b5a451afdb41bd957667c91eebf23 Test.class_L 292a93b6433b5a451afdb41bd957667c91eebf23 Test.class_long
has comment: http://stackoverflow.com/comment/33978838
accepted answer of: http://stackoverflow.com/q/22354821

http://stackoverflow.com/q/22365135
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33996822
has body: I'm not really new to programming but a complete fresh noob regarding android and java. I recently made the decision to programm an Android App using this tutorial. I got till the actionbar and can even display some actions like search and settings in the overflow. What I cant manage to do is to let an action appear on the actionbar(with or without icon). I managed to it once with this tutorial but I somehow cant repeat it on my actual "Tutorialapp". Here is my code: main.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &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.example.newapp.MainActivity" &gt; &lt;item android:id="@+id/action_settings" android:orderInCategory="100" android:title="@string/action_settings" app:showAsAction="never"/&gt; &lt;item android:id="@+id/action_search" android:orderInCategory="1" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="always"/&gt; &lt;/menu&gt; MainActivity.java: package com.example.newapp; import android.support.v7.app.ActionBarActivity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends ActionBarActivity { public final static String EXTRA_MESSAGE = "com.example.newapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } switch (item.get…
has answer: http://stackoverflow.com/a/27386865
has answer: http://stackoverflow.com/a/22365232
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33996692
has title: No actions or icons showing on the actionbar; only in overflow
tagged with: java
type: Question

http://stackoverflow.com/comment/34241041
has text: Thank you i will try it on your first suggestion..
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22472398
score: 0

http://stackoverflow.com/q/22336766
accepted answer: http://stackoverflow.com/a/22337103
answer count: 1
tagged with: database
has title: Methods of Data Storage - Opinion
tagged with: persistence
score: 0
tagged with: file-io
has body: I have been working on an app and have encountered some limitations relating to my lack of experience in Java IO and data persistence. Basically I need to store information on a few Spinner objects. So far I have saved information on each Spinner into a text file using the format of: //Blank Line Name //the first drop-down entry of the spinner Type //an enum value Entries //a semicolon-separated list of the drop-down entry String values //Blank line And then, assuming this rigid syntax is followed always, I've extracted this information from the saved .txt whenever the app is started. But things such as editing these entries and working with certain aspects of the Scanner have been an absolute nightmare. If anything is off by even one line or space of blankness BAM! everything is ruined. There must be a better way to store information for easy access, something with some search-eability, something that won't be erased the moment the app closes and that isn't completely laxed in its layout to the extent that the most minor of changes destroys everything. Any recommendations for how to save a simple String, a simple int, and an array of String outside the app? I am looking for a recommendation from an experienced developer here. I have seen the storage options, but am unsure which would be best for just a few simple things. Everything I need could be represented in a 3 X n table wherein n is the number of spinners.
favorite count: 0
has comment: http://stackoverflow.com/comment/33946625
has answer: http://stackoverflow.com/a/22337103
tagged with: android
has comment: http://stackoverflow.com/comment/33946580
upvote count: 1
type: AnsweredQuestion
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/33946620
type: Question

http://stackoverflow.com/comment/34104925
score: 0
type: AnswerComment
has text: Yes .. and I would suggest you change your implementation of mergesort .. concentrate on the output .. not the input. Your current implementation stops whenever you exhaust one of the inputs ... even though all the output has not been generated
comment on: http://stackoverflow.com/a/22427588
type: Comment

http://stackoverflow.com/q/22471642
tagged with: ruby
has body: Will the UUID generated using two programming languages say 'Ruby' and 'Java' be unique?
tagged with: uuid
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34182476
upvote count: 1
tagged with: guid
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22473075
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34182531
has answer: http://stackoverflow.com/a/22474937
has title: UUID generated using two programming languages?

http://stackoverflow.com/comment/34199089
type: Comment
type: QuestionComment
has text: May i completely remove ALL xml config from my application? It wont decrease speed of my application? I can remove all XML and create one WebConfig for the whole application? This complete tutorial it is greeting app (example by Spring) which i mention in question, that i tried it.
score: 0
comment on: http://stackoverflow.com/q/22481357

http://stackoverflow.com/comment/34035432
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22387257
has text: @NiklasB. Yes, we sometimes recommend [starting from scratch](http://meta.codereview.stackexchange.com/q/1353/9357)!

http://stackoverflow.com/q/22409603
tagged with: android
answer count: 1
favorite count: 0
tagged with: android-studio
has title: Cannot run ./gradlew connectedInstrumentTest
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
tagged with: gradle
type: Question
tagged with: testing
has body: I set up a basic instrument test in Android Studio in my src/androidTest/java folder. Now I want to run this test and everywhere I get the information to call ./gradlew connectedInstrumentTest on my OS X terminal. But that results in an error "Task 'connectedInstrumentTest' not found in project". If I look at ./gradlew tasks the instrument task is not listed. Do I have to set anything else up in my project/build.gradle? No tutorial or docu tells me to do so, so I'm a bit confused. Has anyone an explanation for that? Cheers K.
upvote count: 2
has answer: http://stackoverflow.com/a/22413703
accepted answer: http://stackoverflow.com/a/22413703

http://stackoverflow.com/comment/34152163
comment on: http://stackoverflow.com/a/22454537
score: 0
type: AnswerComment
type: Comment
has text: Please let me know, if problem is still not resolved?

http://stackoverflow.com/comment/114256167
comment on: http://stackoverflow.com/a/62852289
type: AnswerComment
type: Comment
score: 2
has text: This took forever for me to find. Thank you very much!

http://stackoverflow.com/a/22337165
score: 5
has comment: http://stackoverflow.com/comment/33950715
has comment: http://stackoverflow.com/comment/33947377
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33960966
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/22337053
has comment: http://stackoverflow.com/comment/33952737
downvote count: 0
answers question: http://stackoverflow.com/q/22337053
has comment: http://stackoverflow.com/comment/33947539
has body: You should create an class that encapsulates this data including the item name and price, and then populate your JComboBox with objects of this class. e.g., public class MyItem { private String itemName; private double itemCost; // any more fields? public MyItem(String itemName, double itemCost) { this. ///..... etc } // getters and setters } To have it appear nice, there's a quick and dirty way: give the class a toString() method that prints out just the item name, e.g., @Override public String toString() { return itemName; } ... or a more involved and probably cleaner way: give the JComboBox a renderer that shows only the item name. Edit You ask: Ok, just unsure how I go about passing through the values from the file. You would parse the file and create objects with the data. Pseudo code: Create a Scanner that reads the file while there is a new line to read read the line from the file with the Scanner split the line, perhaps using String#split(" ") Get the name token and put it into the local String variable, name Get the price String token, parse it to double, and place in the local double variable, price Create a new MyItem object with the data above Place the MyItem object into your JComboBox's model. End of while loop close the Scanner

http://stackoverflow.com/comment/34004738
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22346413
type: AnswerComment
has text: Thanks for the lack of a more direct answer I am accepting this.And yes you are probably right loading the whole log file into a string is a waste of good memory.

http://stackoverflow.com/q/22346246
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/csv
has body: I'm importing database values from a .csv file. However, the last row in the .csv is actually the totals of some columns, and my importer updates the database with that being the last row and that is undesirable. And that messes up the queries that I'll do later with it. Please help how can I prevent this? My code of my .csv importer: try { BufferedReader br=new BufferedReader(new FileReader("v.csv")); String line; while((line=br.readLine())!=null) { String[]value = line.split(","); String sql = "INSERT into main ([Ticket #], Status, Priority, Department, [Account Name]) " + "values ('"+value[0]+"','"+value[1]+"','"+value[2]+"','"+value[3]+"','"+value[4]+"')"; System.out.println(sql); PreparedStatement pst = null; try { pst = db.prepareStatement(sql); pst.executeUpdate(); }finally{ if(pst != null){ pst.close(); } } } br.close(); } catch(Exception e) { JOptionPane.showMessageDialog(null, e); }
tagged with: java
tagged with: import
type: Question
has title: Java - Import .csv to database - Exclude last row
tagged with: database
has answer: http://stackoverflow.com/a/22348144
score: 0
answer count: 3
tagged with: sql
has answer: http://stackoverflow.com/a/22346421
has answer: http://stackoverflow.com/a/22346394

http://stackoverflow.com/q/22395080
has comment: http://stackoverflow.com/comment/34048069
has body: My goal is to convert this Arrays.sort(nums, j+1, nums.length) into a reverse sort. The only reverse sort information I can find doesn't seem to have the ability to sort a subarray. And this gives me an error Arrays.sort(nums, j+1, nums.length, Collections.reverseOrder());
answer count: 1
tagged with: arrays
downvote count: 0
tagged with: sorting
favorite count: 0
tagged with: reverse
has title: Reverse Sorting a Subarray in java
upvote count: 1
tagged with: collections
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22395344
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22395344

http://stackoverflow.com/comment/34144955
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22449935
has text: I'm on Java 6. What can I do there?

http://stackoverflow.com/a/22335552
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22333538
score: 2
accepted answer of: http://stackoverflow.com/q/22333538
has body: You do: getSearchResult(searchString); try { setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.phonebook_listview, mobile_nos)); } catch(Exception e) { e.printStackTrace(); } In getSearchResult you start new Thread, and before it ends you run setListAdapter with mobile nos which is new String[20]. You forgot that Thread runs simultanously with rest of your code. Try something like this: public void getSearchResult(final String searchString){ /*--The connection to the server is established in another (not main) thread. This prevents the app to stop responding if the connection to the server is not established or it takes time to establish the connection--*/ new Thread(new Runnable() { @Override public void run() { try { //Send search string to the server URL mobileurl = new URL("http://10.0.2.2:8080/project_server/Search"); URLConnection connection = mobileurl.openConnection(); connection.setDoOutput(true); OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream()); out.write(searchString); out.close(); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); in.readLine(); in.close(); //Fetch result in XML format URL GetCardXmlUrl = new URL("http://10.0.2.2:8080/searchresultxml/search_xml_output.xml"); URLConnection GetresultXmlConnection = GetCardXmlUrl.openConnection(); InputStream ResultInstream = new BufferedInputStream(GetresultXmlConnection.getInputStream()); Serializer PhoneBookSerializer = new Persister(); Search_info_xml parse_result_xml = PhoneBookSerializer.read(Search_info_xml.class, ResultInstream); final String[] data = parse_result_xml.getPhones(); runOnUiThread(new Runnable(){ @Override public void run() { setListAdapter(new ArrayAdapter&lt;String&gt;(SearchResult.this, R.layout.phonebook_listview, data)); } }); Log.d("note:", "getting stuff"); Log.d("number: ", mobile_nos[0]); } catch (Exception e) { e.printStackTrace(); } } }).start(); } } and remove try { setListAdapter(new ArrayAdap…

http://stackoverflow.com/a/22457417
answers question: http://stackoverflow.com/q/22457081
score: 0
type: Answer
has body: I would recommend ViewPager with fragments. You can disable scrolling and select next page on specific action. here is a tutorial from google

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/22455113
tags question: http://stackoverflow.com/q/22413329
type: Tag
tags question: http://stackoverflow.com/q/22330102
tags question: http://stackoverflow.com/q/22387769

http://stackoverflow.com/comment/34284665
has text: Well, not knowing your setup, it is impossible to tell... Note that you can still redirect stdout if you want. However the best solution here would probably be to use a logging framework and use its logging methods instead of `println()`; if you want the output to appear on stdout as well you can always configure an appender for doing so
comment on: http://stackoverflow.com/q/22475209
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34070443
type: AnswerComment
has text: Thanks. Did that. Run it. Still a blank screen. Any other ideas?
comment on: http://stackoverflow.com/a/22407899
type: Comment
score: 0

http://stackoverflow.com/comment/34123302
score: 1
comment on: http://stackoverflow.com/q/22438102
has text: Maybe one question at a time?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/51865483
has comment: http://stackoverflow.com/comment/92363171
type: Answer
has body: The Oracle and OpenJDK JVMs are the same and have the same GC features (as of the latest versions 10+). Prior to Oracle managing the OpenJDK JVM there were concrete differences that made that old Openjdk JVM almost unusable in many environments. The JVMs are now the same. The JDKs which include the JVM as part of the Kit, differ by licensing, release and maintenance schedule, and the software libraries included in the JDK. Crucial differences to me also mean things that would make code not run if not present. Not only licensing. diff --brief -r openjdk oraclejdk Crucially the following files are missing in addition to a bunch of others on the linux JDK (So if you 'claimed' that code didn't work on OpenJDK and did so on OracleJDK while you were using javafx then you were correct): Only in jdk-10.0.1/bin: javapackager Only in jdk-10.0.1/bin: javaws Only in jdk-10.0.1/bin: jcontrol Only in jdk-10.0.1/bin: jmc Only in jdk-10.0.1/bin: jweblauncher Only in jdk-10.0.1/lib: ant-javafx.jar Only in jdk-10.0.1/lib: deploy Only in jdk-10.0.1/lib: deploy.jar Only in jdk-10.0.1/lib: desktop Only in jdk-10.0.1/lib: fontconfig.bfc Only in jdk-10.0.1/lib: fontconfig.properties.src Only in jdk-10.0.1/lib: fontconfig.RedHat.6.bfc Only in jdk-10.0.1/lib: fontconfig.RedHat.6.properties.src Only in jdk-10.0.1/lib: fontconfig.SuSE.11.bfc Only in jdk-10.0.1/lib: fontconfig.SuSE.11.properties.src Only in jdk-10.0.1/lib: fonts Only in jdk-10.0.1/lib: javafx.properties Only in jdk-10.0.1/lib: javafx-swt.jar Only in jdk-10.0.1/lib: java.jnlp.jar Only in jdk-10.0.1/lib: javaws.jar Only in jdk-10.0.1/lib: jdk.deploy.jar Only in jdk-10.0.1/lib: jdk.javaws.jar Only in jdk-10.0.1/lib: jdk.plugin.jar Only in jdk-10.0.1/lib: jfr Only in jdk-10.0.1/lib: libavplugin-53.so Only in jdk-10.0.1/lib: libavplugin-54.so Only in jdk-10.0.1/lib: libavplugin-55.so Only in jdk-10.0.1/lib: libavplugin-56.so Only in jdk-10.0.1/lib: libavplugin-57.so Only in jdk-10.0.1/lib: libavplugin-ffmpeg-56.so Only in jdk-10.0.…
upvote count: 37
answers question: http://stackoverflow.com/q/22358071
score: 37
downvote count: 0

http://stackoverflow.com/q/22390310
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22405856
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/10007327
upvote count: 2
tagged with: complexity-theory
accepted answer: http://stackoverflow.com/a/22405856
has body: There is a question asking how to measure computational complexity of Java code similar to what trend-prof does for C/C++. The accepted answer to that question says it is commonly done using Sonar. I know that Sonar has good cyclomatic complexity capabilities built in, but that is not what the question was asking for. Does Sonar in fact have computational complexity measuring capabilities? If so any pointers to details on setting it up would be great.
type: AnsweredQuestion
tagged with: java
has title: Does Sonar have computational complexity measuring capabilities?
tagged with: sonarqube
type: Question

http://stackoverflow.com/comment/103238383
type: AnswerComment
score: 0
type: Comment
has text: java.nio has better file handling than java.io package. I have experienced bad behavior when you dealing with files with special characters in their name. Better way to do things would be the @Andrew's response.
comment on: http://stackoverflow.com/a/37383506

http://stackoverflow.com/comment/34167712
comment on: http://stackoverflow.com/q/22462920
score: 0
type: Comment
type: QuestionComment
has text: What i meant was the <value> child element under distance is at the third level from its root element <row>. Like i wanted to know can i directly access the distance element one after the other and fetch the value element. well that is what i have understood about DOM?

http://stackoverflow.com/q/22477065
type: Question
tagged with: network-programming
tagged with: validation
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: How to determine wrong domain/IP
has comment: http://stackoverflow.com/comment/34192413
has answer: http://stackoverflow.com/a/22477844
score: 2
has body: I have field on my web application that allow entering domain/IP addresses. User can specified by misteken the following values: 10.10.10. or -domain.com Both values are incorrect regarding RFCs about IP and Domain names. I use the following validators from guava's library for validation : InetAddresses InternetDomainName My goal is to determine wheter user specified wrong IP or Domain and show messages regarding to it. Ex: if user specifes "-domain.com". Alert shoud be appear with message "Wrong domain name is specified". I've already used ^[0-9\\.]*$ for determining wrong ip's, but I am not sure whether it was correct one. Could you suggest some
tagged with: java

http://stackoverflow.com/a/22489470
has comment: http://stackoverflow.com/comment/34260103
has comment: http://stackoverflow.com/comment/34289807
has comment: http://stackoverflow.com/comment/34286504
has body: So, first off: your code is very messy. Your BobController class (which I don't think really needed to be separated from Bob, although that is not really an issue, just seems pointless) is doing way too much. The two things I'd definitely put in a different class is input and collision detection. And try to avoid things like updating Bob's position during collision detection, it makes it unorganized and hard to find. Sorry for so much talk about that, now for the problem itself. Notice how your bullets have a speed of 10, and Bob's max velocity is 15. That means he should be able to accelerate past them. But then why doesn't he do so at 60 FPS? The part of the movement that doesn't depend on delta when it should is DAMP. At 60 FPS, it decreases the speed 60 times; at 20 FPS, only 20 times. This meant that at high FPS, MAX_VEL can never be reached at all. Eventually Bob reaches a speed where his acceleration every frame equals the speed damping takes away from him. If we assume fixed FPS of 60, this means that he accelerates by ACCELERATION * delta = 20 * (1/60) = 0.33 every frame. When this acceleration takes him to horizontal speed of 3.33, the damping takes away 0.33 as well - an equilibrium is reached. So the actual maximum velocity is 3, not 15. At lower FPS rates, this value is higher. So the first part of fixing it is simple - change MAX_VEL to 3. That is a significant improvement, but Bob is still a bit faster at lower framerates. This is because his position is updated in checkCollisions() after applying acceleration, but before applying DAMP and MAX_VEL. So if Bob is at his maximum velocity of 3, his actual velocity is a bit larger depending on how much he accelerates every frame. The second fix - put checkCollisions() to the end of BobController.update() (or at least after applying MAX_VEL). After that, the maximum speed is the same for all framerates, but damping is still framerate-dependent - he stops much quicker on high framerates. This is easier to fi…
has comment: http://stackoverflow.com/comment/34317969
answers question: http://stackoverflow.com/q/22380848
has comment: http://stackoverflow.com/comment/34292641
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22380848
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34291127
has comment: http://stackoverflow.com/comment/34291287
has comment: http://stackoverflow.com/comment/34295673
type: Answer
has comment: http://stackoverflow.com/comment/34289755
has comment: http://stackoverflow.com/comment/34295837
has comment: http://stackoverflow.com/comment/34223040
upvote count: 1

abstract-class
tags question: http://stackoverflow.com/q/22378422
tags question: http://stackoverflow.com/q/22426277
tags question: http://stackoverflow.com/q/22365891
type: Tag
tags question: http://stackoverflow.com/q/22470765
tag name: abstract-class
tags question: http://stackoverflow.com/q/22431364

http://stackoverflow.com/comment/34208009
type: QuestionComment
comment on: http://stackoverflow.com/q/22486201
score: 0
has text: The problem seems that you're not sending the request at all. This can be probably by a firewall or any other agent blocking the request. To make sure you're sending the request to the right URL, you can use Chrome or Firefox with Firebug installed, press F12 and manage network traffic, then fire the expected request and see the results about it (and the related problems).
type: Comment

http://stackoverflow.com/q/22460767
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34163441
has comment: http://stackoverflow.com/comment/34163297
has title: How can my subclass properly inherit a static variable
tagged with: inheritance
favorite count: 0
tagged with: static
accepted answer: http://stackoverflow.com/a/22460888
has comment: http://stackoverflow.com/comment/34163383
possible better answer: http://stackoverflow.com/a/22460941
has answer: http://stackoverflow.com/a/22460941
has body: public abstract class SuperClass { public int x, y; public static int z; } I want every subclass of SuperClass to have the static variable z. Naturally z will contain a different value for each subclass. I'm hoping to avoid defining z in every subclass, since it's going to be a functional dependancy of values x and y; Is this possible?
upvote count: 3
has answer: http://stackoverflow.com/a/22460914
tagged with: superclass
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/22460888

http://stackoverflow.com/comment/34097169
type: Comment
comment on: http://stackoverflow.com/a/22422538
score: 0
type: AnswerComment
has text: @user3422747 i think to a solution using Generics but i not found any. I updated the answer for +10 listener types...

http://stackoverflow.com/q/22448341
downvote count: 1
has comment: http://stackoverflow.com/comment/34142035
type: Question
has comment: http://stackoverflow.com/comment/34142037
has title: What is the differences between volatile and static keyword?
has comment: http://stackoverflow.com/comment/34142023
accepted answer: http://stackoverflow.com/a/22448389
answer count: 1
favorite count: 0
upvote count: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8005250
score: 1
linked to: http://stackoverflow.com/q/2423622
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/22448389
has body: Static variable keeps single value for a thread but volatile keeps single value for all threads(example here) Most of the scenario constants are declared as static and also constant data will be the same for all threads so why constants are not declared as volatile when we can use volatile keyword in java
has comment: http://stackoverflow.com/comment/34142108

http://stackoverflow.com/comment/36852692
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22412234
has text: Hi @WiseTree, I am too facing same issue while working with grails+hibernate+MySQL. If you have a solution could you please post it? -Thanks
score: 0

http://stackoverflow.com/a/24113415
accepted answer of: http://stackoverflow.com/q/22344039
answers question: http://stackoverflow.com/q/22344039
score: 3
has body: UserCollectionType is for when you want to rely on Hibernate's collection handling when handling persistence, but want to expose a different class to clients of your persistent objects. For example, if you have an Auction and a one-to-many of Bids, you might want Hibernate to treat this a set when persisting, but you might want getBids() to return a FastSet (as in your link). CustomCollectionType is for when you want to persist a collection in a completely different way with different semantics using a new implementation of PersistentCollection. I'm not sure when you'd really want to do this except to change some Hibernate framework behavior.
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/a/22330856
downvote count: 0
answers question: http://stackoverflow.com/q/22329122
type: Answer
has body: FIXED! I found I was missing override two methods: @Override public int getViewTypeCount() { return RowType.values().length; } @Override public int getItemViewType(int position) { return rows.get(position).getViewType(); }
upvote count: 1
score: 1

http://stackoverflow.com/q/22392685
tagged with: file
linked to: http://stackoverflow.com/q/19990038
type: Question
has comment: http://stackoverflow.com/comment/34044073
has answer: http://stackoverflow.com/a/22392851
has title: how to detect what user my program is in in java
linked to: http://stackoverflow.com/q/585534
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34044020
has comment: http://stackoverflow.com/comment/34044001
upvote count: 2
type: UnansweredQuestion
has body: I am working on a word processor and i need to know what user my program is in so that my program can auto detect it on start and save the files in their my Documents. Im using java. and i have no precode for the directory detect. but in case this helps here is my code: import javax.swing.*; import java.io.*; import java.awt.event.*; import java.util.*; @SuppressWarnings("serial") class Word1 extends JFrame implements ActionListener, KeyListener{ ClassLoader Idr = this.getClass().getClassLoader(); static JPanel pnl = new JPanel(); public static JTextField Title = new JTextField("Document",25); static JTextArea Body = new JTextArea("Body", 48, 68); public static JScrollPane pane = new JScrollPane(Body); JTextField textField = new JTextField(); JButton saveButton = new JButton("Save File"); JButton editButton = new JButton("Edit File"); JButton deleteButton = new JButton("Delete"); public static String Input = ""; public static String Input2 = ""; public static String Text = ""; public static void main(String[] args){ @SuppressWarnings("unused") Word1 gui = new Word1(); } public void ListB(){ // Directory path here String username = JOptionPane.showInputDialog(getContentPane(), "File to Delete", "New ", JOptionPane.PLAIN_MESSAGE); String path = "C:\\Users\\"+username+"\\Documents\\"; File folder = new File(path); File[] listOfFiles = folder.listFiles(); for (int i = 0; i &lt; listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { String files = listOfFiles[i].getName(); if (files.endsWith(".txt") || files.endsWith(".TXT")){ ArrayList&lt;String&gt; doclist = new ArrayList&lt;String&gt;(); doclist.add(files); System.out.print(doclist); String l = doclist.get(i); } } } } public Word1() { ListB(); setTitle("Ledbetter Word"); setSize(800, 850); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); add(pnl); Body.setLineWrap(true); Body.setWrapStyleWord(true); Body.setEditable(true); Title.setEditable(true); Title.addKeyListener(keyListen2); saveButton.addActionListen…
score: 2
has comment: http://stackoverflow.com/comment/34044013
tagged with: java

http://stackoverflow.com/q/22355961
has body: hi i am doing a coin toss simulator for java that must be done a certain way. it must have a string for sideup to hold the string of "heads" or "tails" made by a no arg constructor, the toss method must be void and it must have a getsideup method, then we must run the coin toss 20 times and diplay the number of heads and tails... i can do it easy with none void methods and just returning the result, but getting around this void and getsideup is driving me nuts. this is what i have so far. import java.util.Random; public class coin { public static String sideUp; public static void toss() { Random rand = new Random(); int sideup = rand.nextInt(2); if (sideup == 0) { sideUp = "heads"; } else { sideUp = "tails"; } } public static String getsideup() { System.out.println(sideUp); return sideUp; } public static void main(String[] args) { // coin coin = new coin(); int hcount = 0; int tcount = 0; for (int i = 1; i &lt;= 20; i++) { if (getsideup().equals("heads")) { hcount++; } else { tcount++; } } System.out.println("total heads = " + hcount + " total tails = " + tcount); } } im hoping someone can tell me what im doing wrong and put me in the right direction.
accepted answer: http://stackoverflow.com/a/22356131
possible better answer: http://stackoverflow.com/a/22357601
has answer: http://stackoverflow.com/a/22357601
score: 0
has title: java coin toss simulator problems
has answer: http://stackoverflow.com/a/22356118
has answer: http://stackoverflow.com/a/22356185
has answer: http://stackoverflow.com/a/22356131
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33979884
tagged with: java
tagged with: computer-science
type: Question

http://stackoverflow.com/q/22403781
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22403862
tagged with: actionlistener
has answer: http://stackoverflow.com/a/22403842
answer count: 2
has body: I made a frame with a button "Start downloading" for it to download a JAR from a website. The problem is whenever I click the start downloading button, the whole frame freezes until it is done downloading, and then it's normal after that. How would I fix it? Here's the code when the button is clicked it executes private void addToDesktop() throws IOException { URL url = new URL("urlremoved"); URLConnection connection = url.openConnection(); InputStream inputstream = connection.getInputStream(); FileSystemView filesys = FileSystemView.getFileSystemView(); filesys.getHomeDirectory(); sizeOfClient = connection.getContentLength(); BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(new FileOutputStream(new File(clientDL.textField1.getText() + "/jarname.jar"))); byte[] buffer = new byte[2048]; int length; while(( length = inputstream.read(buffer)) &gt; -1) { down += length; bufferedoutputstream.write(buffer, 0 , length); String text = clientDL.label1.getText(); int perc = getPerc(); if(perc &lt;= 50) { text += getPerc() + "% done"; }else { text ="Please wait until the jar is downloading..."; text = text + (100 - perc) + " % remaining"; } } if (down == sizeOfClient) { JOptionPane.showMessageDialog(clientDL.frame, "Download successful. It has been placed at : " + clientDL.textField1.getText() + "/jarname.jar", "Success!", JOptionPane.INFORMATION_MESSAGE); clientDL.frame.dispose(); clientDL.frame.setVisible(false); } bufferedoutputstream.flush(); bufferedoutputstream.close(); inputstream.close(); hideSplashScreen(); }
downvote count: 0
has title: Why does my frame freeze when I start this action[DOWNLOADING]

http://stackoverflow.com/q/22388549
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34052195
tagged with: spring
has comment: http://stackoverflow.com/comment/34071825
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34038534
has comment: http://stackoverflow.com/comment/34038992
has title: Spring MVC Testing without Mocking
has comment: http://stackoverflow.com/comment/34070971
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34036856
linked to: http://stackoverflow.com/q/12607140
has answer: http://stackoverflow.com/a/22388703
has comment: http://stackoverflow.com/comment/34036709
has comment: http://stackoverflow.com/comment/34037467
has body: Ok, I come from Rails am having a bit of a hard time trying to get this working. Right know this is what I understand from the Spring framework (and please correct me if I'm wrong): I am using Tomcat. So what it does, basically, is go after web.xml, and check any configuration files from there in order to initialize and get beans auto wired, etc. In my example, I have on web.xml the context config location as application-config.xml It turns out that application-config.xml has other config files that will take care of the following: Hibernate: &lt;util:properties id="hibernatePropertiesConfigurer" location="classpath:hibernate.properties"/&gt; JSon Converter: &lt;import resource="classpath:json-converter.xml"/&gt; Managers (@Component) Scanner: &lt;import resource="classpath:scanner-config.xml"/&gt; Among others. In other words, these work just fine, web server gets up, managers (@Components) are @Autowired, @Controllers can call them, persist objects in the database, etc. Now, I want to test, i.e. run JUnit tests. I did find a lot of examples on how to mock these layers (managers, controllers) but I want to try the real thing: Test will instantiate @Controller Test will post to @Controller object @Controller will have a real @Autowired (not mocked version) of @Component or @Bean @Component will persist an @Entity And, most important of all, database should see the changes. (I am using MySQL) Test will, then, use an @Autowired instance of @Component, and query the database to confirm the persistence occurred. Is this possible, at all, with Spring, JUnit testing?
has comment: http://stackoverflow.com/comment/34037295
tagged with: junit
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34062791

http://stackoverflow.com/comment/34042976
has text: Could you please amend the comments then
comment on: http://stackoverflow.com/q/22391915
score: 2
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33955973
type: QuestionComment
has text: But the second code sample is the only code sample which uses binary search. So I'm not entirely sure what you're getting at there.
comment on: http://stackoverflow.com/q/22342064
score: 0
type: Comment

http://stackoverflow.com/comment/34123309
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22438171
has text: Why are you using maven-dependency-plugin? What are you using maven-surefire-plugin for integration testing? There is a better one: maven-failsafe-plugin which is intended for integration testing. Furthermore what does it mean 'src/main/webapp/WEB-INF' is removed? How do you call mvn? `mvn clean package`?

http://stackoverflow.com/comment/34191199
has text: You're sorting the array, and you want to print it unsorted? Conflict of interest..
score: 5
comment on: http://stackoverflow.com/q/22477039
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22342328
has comment: http://stackoverflow.com/comment/33956364
score: -1
has comment: http://stackoverflow.com/comment/33956822
has body: There is no 99.0 version for aspectj:aspectjlib, your project is configured to use wrong version, check for 99.0 in your pom.xml
has comment: http://stackoverflow.com/comment/33957076
has comment: http://stackoverflow.com/comment/33957315
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33956591
answers question: http://stackoverflow.com/q/22342279
upvote count: 0
has comment: http://stackoverflow.com/comment/33956318

manifest
tags question: http://stackoverflow.com/q/22333173
tags question: http://stackoverflow.com/q/22350567
tag name: manifest
type: Tag

http://stackoverflow.com/a/22440138
answers question: http://stackoverflow.com/q/22440064
has body: Any UI related code should be ran on the UI thread using RunOnUiThread method.
has comment: http://stackoverflow.com/comment/34128234
has comment: http://stackoverflow.com/comment/34127950
score: 0
has comment: http://stackoverflow.com/comment/34127907
type: Answer

http://stackoverflow.com/comment/33968192
comment on: http://stackoverflow.com/a/22349215
has text: OK so what I want is probably not possible with spring annotations. However, do you have any idea how such a requirement could be implemented?
type: AnswerComment
score: 0
type: Comment

thread-safety
tags question: http://stackoverflow.com/q/22333514
tags question: http://stackoverflow.com/q/22463266
tag name: thread-safety
tags question: http://stackoverflow.com/q/22394795
type: Tag
tags question: http://stackoverflow.com/q/22346214

http://stackoverflow.com/a/22365194
type: Answer
answers question: http://stackoverflow.com/q/22365086
has body: The advantage is that Bicycle reference is more general and can refer to any object which has Bicycle in its inheritance hierarchy for example MountainBike. It offers more flexibility and does not binds you to concrete implementation. This is one of the basic principles in OOP. That said, there are some cases, like when used in short method when using Bicycle or RoadBikemakes no difference. Also there is the aspect of invoking overloaded methods which is determined by reference type at compile time (depending on the reference type, different method might be called even thought they point to the same object) but having those kinds of overlaoded methods is not advised. You might get better explanation here.
score: 0

http://stackoverflow.com/comment/34132279
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22441678
has text: @nachokk Key types into the Editing component are consumed. The clipboard is another system that lives outside of this component. To clarify, the key type is an event, and event can have multiple "listeners" this just consumes the event so the listener of the text component does not see it, but does not consume it globally.

http://stackoverflow.com/comment/34124609
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22438844
has text: That's simply telling you that `com.runtime.Main` is not on your classpath. Please double-check your assumptions about the contents of `../lib` ;)

http://stackoverflow.com/q/22351026
has comment: http://stackoverflow.com/comment/33971632
tagged with: java
type: Question
score: 0
has body: I'm using spring to create a MVC desktop application. At the main method, I create a AnnotationConfigApplicationContext. When the controller of the MainForm is created, it shows the main form view (JFrame). I set the MainFormView to setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE). // when the MainFormController is created, it shows the MainForm JFrame. AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext("..."); try { // WAIT FOR MAINFORM CLOSE! How? } finally { ctx.close(); } My question is: I need to close the AnnotationConfigApplicationContext ? If yes, how can I do this, wait for the MainForm close and than close the application context?
answer count: 1
has answer: http://stackoverflow.com/a/22353033
tagged with: spring
accepted answer: http://stackoverflow.com/a/22353033
tagged with: swing
has title: Swing and Spring
tagged with: model-view-controller
type: AnsweredQuestion

http://stackoverflow.com/comment/33942449
type: QuestionComment
has text: JB Nizet: above the classes.
score: 0
comment on: http://stackoverflow.com/q/22332154
type: Comment

http://stackoverflow.com/a/22412947
type: Answer
has comment: http://stackoverflow.com/comment/34079666
has body: You have two problems. First, this: PrintWriter output = new PrintWriter(csvFile); truncates the file. Which means you truncate the file at each loop iteration. Second, PrintWriter does not automatically flush its content to the destination and you don't .flush() it. Since your file is empty, this also means you probably forget to .close() it. Assuming you use Java 7, use this instead (note: assumes csvFile is a String; if it is a File, use csvFile.toPath() in the code extract below instead of Paths.get(csvFile)): try ( final BufferedWriter w = Files.newBufferedWriter(Paths.get(csvFile), StandardCharsets.UTF_8, StandardOpenOption.CREATE); final PrintWriter writer = new PrintWriter(w); ) { for(int i = 0; i &lt; A.size(); i++) { System.out.println(A.get(i)+", "+ B.get(i)); writer.println(A.get(i)+", "+ B.get(i)); } writer.flush(); }
has comment: http://stackoverflow.com/comment/34079297
accepted answer of: http://stackoverflow.com/q/22412865
score: 2
has comment: http://stackoverflow.com/comment/34079534
upvote count: 2
answers question: http://stackoverflow.com/q/22412865
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34079292

http://stackoverflow.com/a/22361076
score: 6
has body: The error message is saying that you are getting an XML document that looks like this: &lt;ItemSearchResponse&gt; Instead of one like the following that matches the namespace qualification that you have mapped: &lt;ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01"&gt;
has comment: http://stackoverflow.com/comment/33989064
has comment: http://stackoverflow.com/comment/33989227
answers question: http://stackoverflow.com/q/22360943
downvote count: 0
type: Answer
upvote count: 6

http://stackoverflow.com/a/22366206
score: 0
has body: import java.util.Arrays; import java.util.Comparator; public class Asdf { public static void main(final String[] args) { final int[][] data = new int[][]{ new int[] {3,0}, new int[] {0,1}, new int[] {3,1}, new int[] {0,2}, new int[] {3,2}, new int[] {0,3}, new int[] {1,3}, new int[] {2,3}, new int[] {3,3} }; Arrays.sort(data, new Comparator&lt;int[]&gt;() { @Override public int compare(final int[] entry1, final int[] entry2) { if(entery1[0] == entry2[0]){ if(entery1[1] &gt; entery2[1]) return 1; else return -1; } else{ if(entery1[0] &gt; entery2[0]) return 1; else return -1; } final String time2 = entry2[0]; return time1.compareTo(time2); } }); } }
has comment: http://stackoverflow.com/comment/34000291
type: Answer
answers question: http://stackoverflow.com/q/22365974

http://stackoverflow.com/q/22376156
type: AnsweredQuestion
tagged with: android-webview
has comment: http://stackoverflow.com/comment/34014430
has comment: http://stackoverflow.com/comment/34014974
tagged with: java
has answer: http://stackoverflow.com/a/22376720
accepted answer: http://stackoverflow.com/a/22376720
score: 0
has comment: http://stackoverflow.com/comment/34014787
answer count: 2
has comment: http://stackoverflow.com/comment/34014373
has comment: http://stackoverflow.com/comment/34014901
possible better answer: http://stackoverflow.com/a/22376907
has comment: http://stackoverflow.com/comment/34014563
tagged with: android
has body: The below method onReceivedTitlegets called 2-3 times with in a second when webview url changes. I want to call a method in it, when onReceivedTitle is being called last time. I am doing this because I just want to monitor url changes with in webview. shouldOverrideUrlLoading is not getting called when url changes through ajax. class MyWebChromeClient extends WebChromeClient { @Override public void onReceivedTitle(WebView view, String title) { Log.v("onReceivedTitle", "=&gt;" + title); // callAMehod(); super.onReceivedTitle(view, title); } }
has title: Call a method only once after 1 second from a method which get called 2-3 times
has answer: http://stackoverflow.com/a/22376907
type: Question

builder
tags question: http://stackoverflow.com/q/22336205
tags question: http://stackoverflow.com/q/22416239
tags question: http://stackoverflow.com/q/22416569
tag name: builder
type: Tag

http://stackoverflow.com/comment/34133478
type: Comment
comment on: http://stackoverflow.com/q/22443289
score: 0
has text: Do you call using the same values or different values? What values?
type: QuestionComment

http://stackoverflow.com/q/22441136
has answer: http://stackoverflow.com/a/22441179
tagged with: spring
type: AnsweredQuestion
upvote count: 1
accepted answer: http://stackoverflow.com/a/22441179
type: Question
score: 1
tagged with: java
tagged with: hibernate
has body: I use Spring and Hiberate to create simply web service. In Controller i have long list of args from form. My Controller @RequestMapping( value="/addAccount", method=RequestMethod.POST ) public String addAccoundPOST( @RequestParam( value = "username" ) String username, @RequestParam( value = "password" ) String password, @RequestParam( value = "email" ) String email, @RequestParam( value = "name" ) String name, @RequestParam( value = "surname" ) String surname, @RequestParam( value = "birth_date" ) String birth_date, @RequestParam( value = "place" ) String place, @RequestParam( value = "province" ) String province, @RequestParam( value = "motorcycle" ) String motorcycle, @RequestParam( value = "tel" ) String tel ) { User user = new User(); if( username != null &amp;&amp; username.length() &gt;= 4 ) user.setUsername( username ); if( password != null &amp;&amp; password.length() &gt;= 4 ) user.setPassword( password ); // and more, and more, and mode.... return "addAccount"; } Part of User class: @Entity @Table( name = "users", catalog = "dbjadenazlot" ) public class User implements Serializable { private int uid; private String ...; /* --------------------------------- GET ------------------------------ */ @Id @GeneratedValue(strategy = IDENTITY) @Column( name = "uid", unique = true, nullable = false ) public int getUID() { return uid;} @Column( name = "name", length = 45 ) public String getName() { return name; } // setters and rest code.. } Is it possible to convert my arguments from POST request to class? If it's possible, what is required? @RequestMapping( value="/addAccount", method=RequestMethod.POST ) public String addAccoundPOST( @RequestParam( value = "user") User user ) { return "addAccount"; } How can i write shorten code?
has title: Spring @RequestParam with class
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/22410331
has comment: http://stackoverflow.com/comment/34077390
has comment: http://stackoverflow.com/comment/34077596
has body: This line is missing the final comma ',': DepartCity char(20) NOT NULL EDIT: it also turned out that the insert statement string was containing tab chars instead of spaces.
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/34075472
answers question: http://stackoverflow.com/q/22410236
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/34074692
has comment: http://stackoverflow.com/comment/34075212
accepted answer of: http://stackoverflow.com/q/22410236
has comment: http://stackoverflow.com/comment/34078113

http://stackoverflow.com/a/22452120
answers question: http://stackoverflow.com/q/22452046
type: Answer
has body: Check toArray method of ArrayList Also you can find simmilar question here
score: 0

http://stackoverflow.com/comment/34171570
type: QuestionComment
comment on: http://stackoverflow.com/q/22465194
score: 3
has text: Show the main() method where you try to use this class. Also, beware that if your classes are in different packages you will have to use an import statement.
type: Comment

http://stackoverflow.com/a/22477187
has comment: http://stackoverflow.com/comment/34194452
answers question: http://stackoverflow.com/q/22476972
type: Answer
has comment: http://stackoverflow.com/comment/34191832
has body: Or you can use brackets like this to create your table: create table `ORDER` ...
score: 0

http://stackoverflow.com/comment/34072972
comment on: http://stackoverflow.com/a/22390027
has text: This is bad advice, since from floor(sqrt(N)), which is much smaller than N/2 for large N, up to N there is at most one prime factor of N.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22411021
tagged with: java
has title: Android: button does not work
has answer: http://stackoverflow.com/a/22411061
has answer: http://stackoverflow.com/a/22411124
score: 0
answer count: 2
tagged with: tablelayout
tagged with: sqlite
tagged with: button
possible better answer: http://stackoverflow.com/a/22411124
has comment: http://stackoverflow.com/comment/34075360
tagged with: android
accepted answer: http://stackoverflow.com/a/22411061
type: AnsweredQuestion
has body: So there is 4 buttons on this page... 3 of them work fine, the 4th button, which links to ToolsTableLayout.class does not respond at all. There are no erros, the app does not crash or anything... you just click the button and nothing happens. Code for the button class: public class MainMenu extends Activity implements OnClickListener{ private String result; boolean isScanout; public static final String SCAN_RESULT = "MyPreferencesFile"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_menu); Button ScanOut=(Button)findViewById(R.id.scanout); ScanOut.setOnClickListener(this); Button ScanIn=(Button)findViewById(R.id.scanin); ScanIn.setOnClickListener(this); Button EndSession = (Button) findViewById(R.id.endsession); EndSession.setOnClickListener(this); } @Override public void onClick(View v) { if(v.getId()==R.id.scanout){ isScanout = true; IntentIntegrator.initiateScan(this); } else if(v.getId()==R.id.scanin){ isScanout = false; IntentIntegrator.initiateScan(this); } else if(v.getId()==R.id.endsession){ Intent endsessionintent = new Intent(MainMenu.this, MainActivity.class); startActivity(endsessionintent); } else if(v.getId()==R.id.toolDB){ Intent i = new Intent(MainMenu.this, ToolsTableLayout.class); startActivity(i); } } protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch(requestCode) { case IntentIntegrator.REQUEST_CODE: { if (resultCode != RESULT_CANCELED) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, data); if (scanResult != null) { String qrCode = scanResult.getContents(); SharedPreferences codeHack = getSharedPreferences(SCAN_RESULT,0); SharedPreferences.Editor editor = codeHack.edit(); editor.putString("entry", qrCode); editor.commit(); } } } } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().in…
type: Question

http://stackoverflow.com/a/22374313
score: 0
type: Answer
has body: try this import android.app.Activity; import android.view.Menu; import android.view.ViewGroup; import android.widget.*; import android.view.View; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); LinearLayout layout = (LinearLayout)findViewById(yourlayoutid from xml file); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0.0F); TextView tx= new TextView(this); // tx.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); tx.setText("ANDROID APP"); layout.add(tx); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } }
answers question: http://stackoverflow.com/q/22374117

http://stackoverflow.com/q/22363434
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33993670
has comment: http://stackoverflow.com/comment/33993513
type: Question
has title: Cannot invoke getText() on the array type String[]
has comment: http://stackoverflow.com/comment/33993567
has comment: http://stackoverflow.com/comment/33993639
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/33993897
has comment: http://stackoverflow.com/comment/33993774
answer count: 1
has comment: http://stackoverflow.com/comment/33993629
has answer: http://stackoverflow.com/a/22363496
has body: I am new to Android. I have an error in my java code: Cannot invoke getText on the array type string. I put gender in a spinner and I declared it in an array. Error is on this line String gendert=gender.getText().toString();
tagged with: android
downvote count: 1
has comment: http://stackoverflow.com/comment/33993602
favorite count: 0

http://stackoverflow.com/comment/34082081
type: Comment
has text: GWT version 2.5.1. Should I update it too?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22405892

http://stackoverflow.com/comment/34151085
score: 0
type: Comment
has text: Thanks Marco, your help has been greatly useful. I managed to obtain the HTML code of the page containing the table I needed simply modifying a little the params of the POST request. For example String params = "fac_id=1012&cds_id=1102&ad_id=&docente_id=&data=&btnSubmit=Avvia Ricerca"; Allows to obtain the table containing all the infos about the exams of Corso di Studio = 1102. I did not add any ad_id, data or docente_id because I am interested in obtaining all the exams. The btn=Submit=Avvia Ricerca did the rest for having those data displayed in the table on the Web page.
comment on: http://stackoverflow.com/a/22441655
type: AnswerComment

http://stackoverflow.com/a/34509877
answers question: http://stackoverflow.com/q/22461663
has body: This code works BufferedReader bR = new BufferedReader( new InputStreamReader(inputStream)); String line = ""; StringBuilder responseStrBuilder = new StringBuilder(); while((line = bR.readLine()) != null){ responseStrBuilder.append(line); } inputStream.close(); JSONObject result= new JSONObject(responseStrBuilder.toString());
upvote count: 10
type: Answer
downvote count: 0
score: 10

http://stackoverflow.com/comment/34011997
has text: Have you tried and defined such an annotation and used it? I haven't, but I doubt this applies to generics since they are erased at runtime... Logically, so would be your annotation
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22374612
score: 0

http://stackoverflow.com/comment/33956359
type: Comment
type: QuestionComment
has text: this is the line " while(!(Integer.valueOf(sc.nextInt()).equals(stack.peek())) && !(stack.isEmpty()))" that is a problem but i don't know how to solve it
comment on: http://stackoverflow.com/q/22341124
score: 0

http://stackoverflow.com/comment/34063729
type: AnswerComment
comment on: http://stackoverflow.com/a/22404435
type: Comment
has text: In case of `doArray()` a3 acts as formal parameter even a3 modifies data it reflects all other. Similarly in case of `doString()' s1 acts as formal parameter. So, here i got **confused**. Please give some more **explanation**.
score: 0

http://stackoverflow.com/comment/34162032
type: QuestionComment
has text: If you can store your fields in a `List` or `Map` then just loop. Then with Java 8 you can `stream()` that collection and use a lambda. Without knowing the general structure of your code we cannot recommend what changes you could make to simplify your code.
comment on: http://stackoverflow.com/q/22460065
score: 0
type: Comment

http://stackoverflow.com/a/22453039
downvote count: 0
score: 7
upvote count: 7
answers question: http://stackoverflow.com/q/22452930
type: Answer
has body: System.exit() terminates the JVM. Nothing after System.exit() is executed. Return is generally used for exiting a method. If the return type is void, then you could use return; But I don't think is a good practice to do it in the main method. You don't have to do anything for terminate a program, unless infinite loop or some strange other execution flows.

http://stackoverflow.com/a/22368882
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22368754
score: 1
upvote count: 1
has body: The NPE(NullPointerException) is coming from accessing the parameter 'str' when it is null. It makes sense if you replace the parameter with 'null', so it would look like this: int len = null.length(); Which doesn't make a lot of sense. The '||' or operator differs from the '|' or operator in that if the first element is true, the other operand is not evaluated, since the whole result can be determined. Leveraging this in this situation allows you to safely call str.isEmpty() because it is guaranteed to not be null. public static String reverseStr(String str) { if(null == str || str.isEmpty()){ return "Empty String"; } int len = str.length(); char[] strArr = new char[len]; int count = 0; for (int i = len - 1; i &gt;= 0; i--) { strArr[count] = str.charAt(i); count++; } return new String(strArr); }

http://stackoverflow.com/q/22433264
tagged with: content-length
score: -2
has answer: http://stackoverflow.com/a/22433373
has answer: http://stackoverflow.com/a/37886153
has answer: http://stackoverflow.com/a/22433409
downvote count: 2
has comment: http://stackoverflow.com/comment/34114747
answer count: 3
tagged with: java
has title: How to get a file size in Bytes or in MB's through a URL
accepted answer: http://stackoverflow.com/a/22433409
type: AnsweredQuestion
upvote count: 0
favorite count: 0
has body: I am new to Java.. I was trying to get the file size from a URL but I failed can any one help me how to get the URL size in bytes?
tagged with: file-io
type: Question
tagged with: http-content-length
possible better answer: http://stackoverflow.com/a/22433373

http://stackoverflow.com/q/22351434
tagged with: simpledateformat
tagged with: java
tagged with: mysql
answer count: 3
accepted answer: http://stackoverflow.com/a/22351891
downvote count: 0
favorite count: 0
has body: I am trying to get my code to work with the SimpleDateFormat class here in the code. Does anybody knows why? Have a nice day from Julie When I run the code where I have imported: import java.util.Date. I get the error: "The type Date is ambiguous" in the lines: Date startDate = format.parse(req.getParameter("startDate")); Date endDate = format.parse(req.getParameter("endDate")); When I run the code where I have imported: import java.sql.Date; I get the error: Date startDate = format.parse(req.getParameter("startDate")); Date endDate = format.parse(req.getParameter("endDate")); "Type mismatch: cannot convert from java.util.Date to java.sql.Date" import java.sql.Date; package WorkPackage; import java.io.*; import java.sql.*; import java.text.SimpleDateFormat; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.*; import java.util.*; import java.util.Date.*; public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ String connectionURL = "jdbc:mysql://localhost/NekiWork"; Connection connection=null; //String startDate = req.getParameter("startDate"); //String endDate= req.getParameter("endDate"); try { //Load database driver Class.forName("com.mysql.jdbc.Driver"); //Connection to the database connection = DriverManager.getConnection(connectionURL, "root", ""); //Getting the data from database String sql = "SELECT *, (Day_hours + (Day_minutes / 60)) AS Allday_hours FROM Workdata " + "WHERE Date = startdate = ? AND endDate = ? "; PreparedStatement pst = connection.prepareStatement(sql); //Date startDate; SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date startDate = format.parse(req.getParameter("startDate")); Date endDate = format.parse(req.getParameter("endDate")); pst.setDate(1,startDate); pst.setDate(2, endDate);
has answer: http://stackoverflow.com/a/59700259
type: AnsweredQuestion
score: 2
upvote count: 2
has title: Type mismatch: cannot convert from java.util.Date to java.sql.Date
possible better answer: http://stackoverflow.com/a/22351522
has answer: http://stackoverflow.com/a/22351891
has answer: http://stackoverflow.com/a/22351522
type: Question

http://stackoverflow.com/a/22417127
has comment: http://stackoverflow.com/comment/34095551
has body: This is possible using an Ajax request, that is meant to be used for partial page refreshes. With ajax a request is sent to the server but the page remains the same. Then an event is triggered when the response arrives. In response to that event we can modify parts of the page with fresh data without reloading it. See this answer for an example of how to do it with jQuery.
score: -1
answers question: http://stackoverflow.com/q/22408754
has comment: http://stackoverflow.com/comment/34098330
downvote count: 1
upvote count: 0
type: Answer

spring-security
tags question: http://stackoverflow.com/q/22370819
tags question: http://stackoverflow.com/q/22453550
tags question: http://stackoverflow.com/q/22460782
tags question: http://stackoverflow.com/q/22333631
tags question: http://stackoverflow.com/q/22448390
tags question: http://stackoverflow.com/q/22448969
tags question: http://stackoverflow.com/q/22447603
type: Tag
tags question: http://stackoverflow.com/q/22484156
tags question: http://stackoverflow.com/q/22357250
tags question: http://stackoverflow.com/q/22390547
tags question: http://stackoverflow.com/q/22448613
tags question: http://stackoverflow.com/q/22407195
tags question: http://stackoverflow.com/q/22352015
tags question: http://stackoverflow.com/q/22409223
tags question: http://stackoverflow.com/q/22385448
tags question: http://stackoverflow.com/q/22409695
tags question: http://stackoverflow.com/q/22448394
tags question: http://stackoverflow.com/q/22415382
tags question: http://stackoverflow.com/q/22385205
tags question: http://stackoverflow.com/q/22403089
tags question: http://stackoverflow.com/q/22409115
tags question: http://stackoverflow.com/q/22361365
tags question: http://stackoverflow.com/q/22447798
tag name: spring-security
tags question: http://stackoverflow.com/q/22386675
tags question: http://stackoverflow.com/q/22359550
tags question: http://stackoverflow.com/q/22417115
tags question: http://stackoverflow.com/q/22434738
tags question: http://stackoverflow.com/q/22470591

apache
tag name: apache
tags question: http://stackoverflow.com/q/22385060
tags question: http://stackoverflow.com/q/22382399
tags question: http://stackoverflow.com/q/22386824
tags question: http://stackoverflow.com/q/22343577
tags question: http://stackoverflow.com/q/22454383
tags question: http://stackoverflow.com/q/22369586
tags question: http://stackoverflow.com/q/22444253
tags question: http://stackoverflow.com/q/22419581
tags question: http://stackoverflow.com/q/22485170
tags question: http://stackoverflow.com/q/22377745
tags question: http://stackoverflow.com/q/22416891
tags question: http://stackoverflow.com/q/22353657
tags question: http://stackoverflow.com/q/22408850
type: Tag
tags question: http://stackoverflow.com/q/22329000
tags question: http://stackoverflow.com/q/22478503
tags question: http://stackoverflow.com/q/22390740
tags question: http://stackoverflow.com/q/22400176
tags question: http://stackoverflow.com/q/22451033
tags question: http://stackoverflow.com/q/22343149
tags question: http://stackoverflow.com/q/22370821

http://stackoverflow.com/comment/34122742
has text: Do you want to sort a collection of DVD objects by age?
type: Comment
comment on: http://stackoverflow.com/q/22437908
score: 1
type: QuestionComment

http://stackoverflow.com/comment/33943387
type: QuestionComment
comment on: http://stackoverflow.com/q/22334505
score: 0
has text: @webbeginner A problem would be if the code did not do that and instead did something else. Right now it just sounds like you are wanting us to write this functionality for you. In general, we don't do that, we help fix problems.
type: Comment

http://stackoverflow.com/comment/34147390
comment on: http://stackoverflow.com/q/22451413
has text: Is that supposed to be `...Method1()` (with both brackets)? Also method names are not capitalised by convention.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34206198
type: Comment
type: QuestionComment
score: 1
has text: Can you post your code/layout?
comment on: http://stackoverflow.com/q/22350276

http://stackoverflow.com/a/22330278
type: Answer
accepted answer of: http://stackoverflow.com/q/22330203
has comment: http://stackoverflow.com/comment/33935688
has comment: http://stackoverflow.com/comment/33939507
type: AcceptedAnswer
has body: You are getting the NullPointerException (NPE) in one of your loops in the PersoanaList class. For example: public boolean cautare(String a,int b){ boolean check=true; for(int j=1;j&lt;=perslist.length;j++) { if(perslist[j].getNume().equals(a) &amp;&amp; perslist[j].getPin()==b) Since unless you've completely filled your perslist variable, you'll hit an array item that is null, giving you a NPE when .getName() is called. After you fix that though, you'll probably hit an ArrayIndexOutOfBoundsException since you are using 1 to n for your array indices. Arrays start at 0 and go to n-1. So for 20 array items, you would reference them as 0 to 19.
score: 0
answers question: http://stackoverflow.com/q/22330203

http://stackoverflow.com/a/22367294
accepted answer of: http://stackoverflow.com/q/22366915
upvote count: 1
has body: Second - I tried to start the activity from my project using: That's not correct, unless your app's package name in the &lt;manifest&gt; is com.grazerss.feedly.newton. I also tried That should be better, insofar as it will use your app's own package name. Does anyone have idea whats going on here? There is no such class in your project. Most likely, that is because of: I have added GrazeRSS to my project "Java Build Path" in the "Projects" tab.. ...which is wrong. Undo that. Assuming that you are trying to incorporate what's in the app/ directory of that repository, that's an application. There is no standard means of incorporating one application in toto into another, other than by copying all of its files in res/, src/, and libs/ into your project's res/, src/, and libs/ directories. Or, you could attempt to convert that project into an Android library project and use it that way.
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22366915

http://stackoverflow.com/comment/33955698
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22341897
has text: I don't think the double forward slashes `//` are necessary, you should be able to just use a single slash. `.*?\\.(/MyProject/public/someSecurePage.jsp|/MyProject/public/js/page/SecuredPage1/|/MyProject/public/js/page/SecuredPage2/|/MyProject/public/less/page/SecuredPage1/)$` I could be wrong though.
score: 0

http://stackoverflow.com/comment/34042912
type: QuestionComment
has text: There wasn't much help in the way of status codes or messages at all. Just a stack trace. I was hoping I could create my own HttpSendSocket class that extends the original and add some diagnostics but HttpSendSocket is package protected, so I wasn't sure how to proceed that way.
comment on: http://stackoverflow.com/q/22391903
score: 0
type: Comment

jframe
tags question: http://stackoverflow.com/q/22406046
tags question: http://stackoverflow.com/q/22364743
tags question: http://stackoverflow.com/q/22424869
tags question: http://stackoverflow.com/q/22348685
tags question: http://stackoverflow.com/q/22463758
tag name: jframe
tags question: http://stackoverflow.com/q/22416647
tags question: http://stackoverflow.com/q/22334749
tags question: http://stackoverflow.com/q/22329253
tags question: http://stackoverflow.com/q/22438775
tags question: http://stackoverflow.com/q/22331978
tags question: http://stackoverflow.com/q/22462275
tags question: http://stackoverflow.com/q/22418640
tags question: http://stackoverflow.com/q/22480348
tags question: http://stackoverflow.com/q/22402131
tags question: http://stackoverflow.com/q/22396572
tags question: http://stackoverflow.com/q/22398145
tags question: http://stackoverflow.com/q/22353814
tags question: http://stackoverflow.com/q/22328995
tags question: http://stackoverflow.com/q/22466018
tags question: http://stackoverflow.com/q/22469574
tags question: http://stackoverflow.com/q/22368069
tags question: http://stackoverflow.com/q/22340601
tags question: http://stackoverflow.com/q/22354451
tags question: http://stackoverflow.com/q/22428663
tags question: http://stackoverflow.com/q/22424491
tags question: http://stackoverflow.com/q/22394478
tags question: http://stackoverflow.com/q/22379635
tags question: http://stackoverflow.com/q/22354651
tags question: http://stackoverflow.com/q/22403781
tags question: http://stackoverflow.com/q/22420672
tags question: http://stackoverflow.com/q/22427194
tags question: http://stackoverflow.com/q/22394495
tags question: http://stackoverflow.com/q/22465685
tags question: http://stackoverflow.com/q/22407855
tags question: http://stackoverflow.com/q/22343268
tags question: http://stackoverflow.com/q/22416939
type: Tag
tags question: http://stackoverflow.com/q/22398192
tags question: http://stackoverflow.com/q/22442964
tags question: http://stackoverflow.com/q/22464082
tags question: http://stackoverflow.com/q/22359372

http://stackoverflow.com/q/22465739
type: Question
tagged with: jpa
score: 0
has title: How to save short unicode HTML file as a table field?
has answer: http://stackoverflow.com/a/22467253
answer count: 1
tagged with: unicode
tagged with: javafx-2
has body: I'm using hibernate 4 with JPA 2 and I'll use it with Derby, MySQL or SQL Server!(Anyway shouldn't be important) I want to save a small (&lt;10kb) html file in a table field. The html should be in Unicode. But I wonder how to define the data type in the entity class and how to force it to be written and read as Unicode(utf8). Either in Java or in the annotations and when I will display it in the browser component of JavaFX2.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22467253
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/22442030
tagged with: java
score: -1
tagged with: methods
has comment: http://stackoverflow.com/comment/34131258
type: Question
upvote count: 0
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/22442398
favorite count: 0
has title: I am having trouble initializing arrays with multiple methods.
tagged with: method-call
has body: I'm having some difficulties figuring out exactly how tot initialize my arrays for a project. I have an array being created in one method and it being called and copied in another then called to another method to be printed and i can't seem to get it to work correctly. import java.util.*; import java.io.*; public class Tention_ArrayProcessing{ public static void main(String[] args) throws IOException{ int[] inputData = inputData(); int[] array = new int[SIZE]; for (int i =0; i &lt; inputData.length; i++) array[i] = inputData[i]; printArray(); } public static int[] inputData() throws IOException{ // gets file name String data; Scanner filename = new Scanner(System.in); System.out.println("Enter a file name please. Include extension"); data = filename.next(); filename.close(); //Reads from file and places data in array int i = 0; File file = new File (data); Scanner inputFile = new Scanner(file); final int SIZE = inputFile.nextInt; int[] inputData = new int[SIZE]; while (inputFile.hasNext() &amp;&amp; i &lt; inputData.length){ inputData[i] = inputFile.nextInt(); i++; } System.out.println(); inputFile.close(); return inputData; } public static void printArray(int[] array){ //calls inputData method for array then prints it. int c = 0; System.out.println("Printing Array:"); for( int i = 0; i &lt; 100; i++) System.out.print(array[i] +" "); c++; if (c == 10){ System.out.println(); } } }
has comment: http://stackoverflow.com/comment/34131469
accepted answer: http://stackoverflow.com/a/22442398
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34130923

http://stackoverflow.com/a/22480305
has comment: http://stackoverflow.com/comment/34204937
has body: The to("jms:queue") in the middle of the first queue will act as other request/reply endpoints: the message "Hello" is sent as a JMS message, processed by the second route (down to "file://target/inbox"), and the result produced by the file endpoint is sent as JMS message to "replyTo" queue, which in turn is received in the first route by "mock:toThirdEndpoint"
has comment: http://stackoverflow.com/comment/34205188
type: Answer
has comment: http://stackoverflow.com/comment/34205631
upvote count: 2
answers question: http://stackoverflow.com/q/22475916
score: 2
has comment: http://stackoverflow.com/comment/34206517
downvote count: 0

http://stackoverflow.com/comment/34135386
score: 1
comment on: http://stackoverflow.com/q/22444332
has text: A B-tree is closer to what is really used, NTFS uses that. Some hashing could perhaps be used to increase performance, especially with caching, although caching is normally a layer above the file system implemented in the OS.
type: Comment
type: QuestionComment

dvd
tags question: http://stackoverflow.com/q/22465845
type: Tag
tag name: dvd

http://stackoverflow.com/a/22455844
upvote count: 3
has comment: http://stackoverflow.com/comment/34154566
has comment: http://stackoverflow.com/comment/86858226
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22452079
type: Answer
has body: our can try urlconnection instead of jersey client which is much more easier than the jersey client please find the below some code With the help of few stack overflow answer and Configure proxy to Jersey client, package org.app.last; import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.client.urlconnection.HttpURLConnectionFactory; import com.sun.jersey.client.urlconnection.URLConnectionClientHandler; import com.sun.jersey.core.util.Base64; import java.io.IOException; import java.net.HttpURLConnection; import java.net.InetSocketAddress; import java.net.Proxy; import java.net.URL; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.util.logging.Level; import java.util.logging.Logger; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.X509TrustManager; import javax.ws.rs.core.MediaType; public class ConnectionFactory implements HttpURLConnectionFactory { Proxy proxy; String proxyHost = //ener your proxy host Integer proxyPort = //ener your proxy port SSLContext sslContext; public ConnectionFactory() { } public ConnectionFactory(String proxyHost, Integer proxyPort) { this.proxyHost = proxyHost; this.proxyPort = proxyPort; } private void initializeProxy() { proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort)); } @Override public HttpURLConnection getHttpURLConnection(URL url) throws IOException { initializeProxy(); HttpURLConnection con = (HttpURLConnection) url.openConnection(proxy); if (con instanceof HttpsURLConnection) { System.out.println("The valus is...."); HttpsURLConnection httpsCon = (HttpsURLConnection) url.openConnection(proxy); httpsCon…
score: 3
answers question: http://stackoverflow.com/q/22452079

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/22362607
tag name: restful-architecture

http://stackoverflow.com/q/22467617
has title: "Cannot return a value from method whose result type is void"
tagged with: compiler-errors
tagged with: return
has answer: http://stackoverflow.com/a/22467644
has answer: http://stackoverflow.com/a/22467656
accepted answer: http://stackoverflow.com/a/22467644
has body: How can I use the boolean hasDivisor outside the for loop? I get the message "Cannot return a value from method whose result type is void" when I try to compile this section of the code for (int i = 0; i &lt; NumBox.length; i++) { if (NumBox[i] == 0) continue; boolean hasDivisor = false; for (int j = 0; j &lt; i; j++) { if (NumBox[j] == 0) continue; if (NumBox[i] % NumBox[j] == 0) { hasDivisor = true; break; } } return hasDivisor; }
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22467656
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/34175925

http://stackoverflow.com/q/22343530
has comment: http://stackoverflow.com/comment/34006100
upvote count: 1
type: Question
has body: Folks, We have one requirement where we want to merge two excel sheets in to one workbook using JAVA. We know this can be done with Apache POI. But we donot want to do following. We just want to merge these two excel files in to single workbook. Donot do : Load both Excel file in to memory. Their contents are huge more than 100k rows. Thanks.
downvote count: 0
answer count: 1
favorite count: 0
tagged with: apache-poi
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22357884
tagged with: excel
has title: Merging two excel sheets in to One Excel work book without loading them in to memory
score: 1
tagged with: java

http://stackoverflow.com/a/22460376
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22460089
has comment: http://stackoverflow.com/comment/34171120
has body: First of all remember that before reaching your server, the data has to pass from the user's browser to your server (i.e. over the Internet). If you want the data the user is sending to be encrypted on the way to your server then you need to set up a certificate and use HTTPS. This is irrespective of whether you are going to use Java, Python, PHP or anything else on the server side. For what you need then, if you are using Java, what you would do is have a servlet container (such as Apache Tomcat) and develop a Servlet (which is a normal class that extends HttpServlet) and in its doPost() method, which receives the data from the user, calls your respective methods, and outputs the message (ideally in HTML format, enclosed in &lt;html&gt;, &lt;body&gt;, &lt;p&gt; tags) You would also need to create a small HTML form (could be a simple HTML file if there is nothing dynamic in it and just has a form with a dropdown of the encryption choices and a text area where he puts the data). The action of the form would direct to the servlet above, that calls the encryption methods. Both the servlet and the HTML file need to be bundled in a webapp war file, which is then deployed in Tomcat. There are obviously much more details to this, but hopefully you have enough keywords to get you started with building a 'hello world' web application with a simple servlet. I suppose there are similar things for Python too, make friends with Google!
has comment: http://stackoverflow.com/comment/34163084
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34167305
has comment: http://stackoverflow.com/comment/34165724
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22460089

http://stackoverflow.com/q/22336550
has body: I have file XML file,I want read this file but I want use loop "FOR" for read element. Not :I use "org.w3c.dom" file XML : <?xml version="1.0" encoding="UTF-8" standalone="no"?> wer we sdf 1sa 2as 3as I need read this file but I can't access by loop to all element in "yLabel" and "xLabel". code java : File xmlfile = new File("D:\\Project//createFile.xml"); DocumentBuilderFactory documentFactory =DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder(); Document doc = documentBuilder.parse(xmlfile); doc.getDocumentElement().normalize(); NodeList nodeList = doc.getElementsByTagName("xLabel"); for (int temp = 0; temp < nodeList.getLength(); temp++) { Node node = nodeList.item(temp); if (node.getNodeType() == Node.ELEMENT_NODE) { Element student = (Element) node; System.out.println(" Name : " + student.getElementsByTagName("NamexLabel").item(0).getTextContent()); } } nodeList = doc.getElementsByTagName("yLabel"); for (int temp = 0; temp < nodeList.getLength(); temp++) { Node node = nodeList.item(temp); Element student = (Element) node; *******//I change get Elemets to loop For**** System.out.println(" Name : " + student.getElementsByTagName("NameyLabel").item(0).getTextContent()); System.out.println(" Name : " + student.getElementsByTagName("NameyLabel").item(1).getTextContent()); System.out.println(" Name : " + student.getElementsByTagName("NameyLabel").item(2).getTextContent()); } } catch (Exception e) { e.printStackTrace(); } }
tagged with: http://stackoverflow.com/tag/xml
score: 0
tagged with: java
has title: How Read XML file?
answer count: 1
has comment: http://stackoverflow.com/comment/33946358
accepted answer: http://stackoverflow.com/a/22336760
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22336760

http://stackoverflow.com/a/29968359
upvote count: 1
type: Answer
has body: Another option would be create your own implementation of Future, which also implements Serializable. In the page below, the author shows that. In this case, he used JMS behind the Future implementation. http://www.javacodegeeks.com/2013/02/implementing-custom-future.html
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22375764

http://stackoverflow.com/q/22424825
type: Question
has body: I have a few entities which I need to use eager fetch. After browsing here it seems that this is a known problem when setting the fetch type to eager. Is there a way of eliminating the duplicates? I can't use Sets because I am getting a lot of problem with some of the equals() and hashCode() (Some of the elements the only reason to recognize between them is the id, not a business key). Right now I am using PrePersist and PostLoad to eliminate the duplicates, e.g. @PostLoad @PrePersist //FIXME best way to handle this? public void removeDuplicates() { Set&lt;Role&gt; noDupesRoles = new HashSet&lt;Role&gt;(); noDupesRoles.addAll(roles); roles.clear(); roles.addAll(noDupesRoles); } This obviously impedes performance, and I was wondering if there's a better way of returning the list with no duplicates.
linked to: http://stackoverflow.com/q/1093153
linked to: http://stackoverflow.com/q/26763213
tagged with: jpa
downvote count: 0
tagged with: persistence
has comment: http://stackoverflow.com/comment/109394686
has title: Hibernate duplicate values with eager fetching
favorite count: 0
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1

http://stackoverflow.com/comment/34127085
comment on: http://stackoverflow.com/q/22440097
type: QuestionComment
type: Comment
has text: Take a look at [this document](https://help.github.com/articles/ignoring-files)
score: 0

http://stackoverflow.com/q/22357531
accepted answer: http://stackoverflow.com/a/22459528
tagged with: java
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22357758
has comment: http://stackoverflow.com/comment/33983191
has answer: http://stackoverflow.com/a/22357758
has comment: http://stackoverflow.com/comment/33983521
type: Question
has body: I'm sure I am doing something wrong, new to Android, I already have the URL stored in a string in a for loop, need to grab the image from that URL using AsyncTask. Quite new to Android so I am running into some issues. Any help is appreciated. SecondClass.java package edu.colum.iam.JSON; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONObject; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import android.widget.Toast; public class SecondClass extends Activity { private TextView first, second, third; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.second); first = (TextView)findViewById(R.id.firsttv); second = (TextView)findViewById(R.id.secondtv); third = (TextView)findViewById(R.id.thirdtv); String id = getIntent().getStringExtra("id"); System.out.println(id); String response = readBuilding(id.trim()); System.out.println(response); try { JSONObject jsonObj = new JSONObject(response); if(jsonObj.length()&gt;0) { String CourseName = jsonObj.getString("CourseName"); String CourseNumber = jsonObj.getString("CourseNumber"); String CourseDescription = jsonObj.getString("CourseDescription"); JSONArray arrayOfImages = jsonObj.getJSONArray("Images"); String theImage = arrayOfImages.get(0).toString(); //getting first image in the array and returning the link as a string int arrSize = arrayOfImages.length(); List&lt;String&gt; urlOfImage = new ArrayList&lt;String&gt;(arrSize); first.setText("Cours…
tagged with: android
has answer: http://stackoverflow.com/a/22459528
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/33983734
score: 0
answer count: 2
has title: Calling async task class not working

http://stackoverflow.com/a/32718484
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22453981
has body: I'm working on such a library. It will take some more time to be usable for real works but I hope you would be interested. I don't introduce the project location here because it can be the cause of deletion of this answer. Please search for Bitbucket API Client for Java on a search engine for the current status. It will provide a language binding to the Bitbucket REST API by Java classes wrapping details about REST and HTTP. You will be able to access Bitbucket without writing most of REST and HTTP handling code. In addition, it supports OAuth authorization and you don't have to ask user name and password yourself. By using OAuth, users can know how your application uses your account when they first authorize your application's access.
score: 1

http://stackoverflow.com/a/22412777
has body: Domain.list(max) will return a PagedResultList, which has getTotalCount() which can be used to find the total count. in above case: ${ menuItemInstanceList.size() } //actual count using pagination ${ menuItemInstanceList.totalCount } //total count
accepted answer of: http://stackoverflow.com/q/22412082
answers question: http://stackoverflow.com/q/22412082
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/34089491
type: AnswerComment
has text: Just remove it. Not used any where. It will work fine for numbers and alphabets. Read my previous comments to solve it for rest keys.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22418211

http://stackoverflow.com/q/22368258
type: Question
answer count: 1
tagged with: jax-rs
score: 0
tagged with: resteasy
has answer: http://stackoverflow.com/a/22375412
has title: Why isn't my sub resource matched?
has body: I'm unable to get a sub resource working, here's my error WARN [org.jboss.resteasy.core.ExceptionHandler] (default task-1) failed to execute: javax.ws.rs.NotFoundException: Could not find resource for full path: http://127.0.0.1:8080/NornLM/individuals/f86e3400-5f56-4b28-af44-69a2ccfd908e/activities/a9da4e17-2ca4-4c02-a9ff-71638a92c318 and some additional interesting log data DEBUG [org.jboss.weld.Conversation] WELD-000327: Resuming conversation with id null DEBUG [org.jboss.resteasy.core.SynchronousDispatcher] PathInfo: /individuals/cce937d3-7982-407b-ae64-909bf3710f4e/activities/d3bb56d5-610c-4c88-8688-a913ba1bdf01 DEBUG [org.jboss.resteasy.cdi.CdiConstructorInjector] Beans found for class com.lm.activity.rest.IndividualsCtrlr : [Managed Bean [class com.lm.activity.rest.IndividualsCtrlr] with qualifiers [@Any @Default]] DEBUG [com.lm.activity.rest.IndividualsCtrlr] Individual Activities DEBUG [org.jboss.resteasy.cdi.CdiInjectorFactory] Using CdiConstructorInjector for class class com.lm.activity.rest.ActivitiesCtrlr. DEBUG [org.jboss.resteasy.cdi.CdiConstructorInjector] Beans found for class com.lm.activity.rest.ActivitiesCtrlr : [Managed Bean [class com.lm.activity.rest.ActivitiesCtrlr] with qualifiers [@Any @Default]] here's my base resource package com.lm.activity.rest; import com.lm.activity.IndividualBuilder; import com.lm.infrastructure.Regex; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.container.ResourceContext; import javax.ws.rs.core.Context; import org.slf4j.Logger; @RequestScoped @Path( "/individuals" ) public class IndividualsCtrlr { @Path( "{individual:" + Regex.UUID + "}" ) public ActivitiesCtrlr activities( @PathParam( "individual" ) IndividualBuilder ib ) { log.debug( "Individual Activities" ); ActivitiesCtrlr ctrl = resourceContext.getResource( ActivitiesCtrlr.class ); ctrl.setIndividual( ib.build() ); return ctrl; } @Context ResourceContext re…
type: UnansweredQuestion
tagged with: wildfly
tagged with: jakarta-ee
tagged with: java

http://stackoverflow.com/comment/34007713
type: Comment
comment on: http://stackoverflow.com/a/22367257
score: 0
type: AnswerComment
has text: Yeah, it should be. If you want to make sure, you can print out the line inside the loop, that'll show you exactly how many times the program loops along with the values of the variables at each iteration.

http://stackoverflow.com/q/22434361
type: Question
linked to: http://stackoverflow.com/q/22423696
has title: Java: setText before performing a time-consuming task
answer count: 2
has answer: http://stackoverflow.com/a/22434897
has body: I am trying to set the text of a JTextArea before doing a really slow task, I tried doing it following this code, but for some reason it first finish the method convert and then it changes the text of my textArea. public void actionPerformed(ActionEvent e) { ... textArea.setText("Converting your file...\n"); //Time-consuming task File newFile = convert(oldFile); ... }
has comment: http://stackoverflow.com/comment/34116971
accepted answer: http://stackoverflow.com/a/22434897
possible better answer: http://stackoverflow.com/a/22434890
has answer: http://stackoverflow.com/a/22434890
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34116666

http://stackoverflow.com/comment/34169225
comment on: http://stackoverflow.com/a/22450463
type: Comment
has text: @CantChooseUsernames Side note: with `SetWindowsHookEx`, you can choose to attach to the "GUI" thread. It may matter.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22405803
tagged with: java
has title: Mule ESB: component and message source in one thing
has comment: http://stackoverflow.com/comment/34068952
type: Question
tagged with: mule
score: 0
answer count: 1
has body: I'd like to implement a flow in Mule that gets a message and returns multiple messages, not just one. However, I don't want to return a collection. I want the output messages to be sent out one-by-one. What I have in mind is something like a message source that is activated by receiving a message. An example flow would be something like this: message [a bunch of values for some SQL placeholders] --&gt; --&gt; VM inbound-endpoint --&gt; --&gt; Custom DB component/connector (which executes an SQL query with the information from the inbound message) "a new message is generated for each row returned by the SELECT query" --&gt; --&gt; VM outbound-enpoint The first thought I had was to write a component that implements both MessageSource and Callable interfaces. But that doesn't seem to work. Any idea / suggestions ?
has comment: http://stackoverflow.com/comment/34067062
type: UnansweredQuestion
tagged with: spring
tagged with: components
has answer: http://stackoverflow.com/a/22407005

http://stackoverflow.com/comment/37873221
comment on: http://stackoverflow.com/a/22385263
type: AnswerComment
type: Comment
score: 3
has text: However small it is. Never the less it is a valuable question with valuable answer. I have it correct at some place and I just forgot about it. This helped me to find my mistake quickly. So do not ignore this question. Thanks!!

http://stackoverflow.com/a/22358624
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22358416
has body: This if(entered = true){ is an assigment operator not a conditional. Instead you want if(entered == true){ paintComponent is meant to be overriden and not called explicitly. Don't explicitly call paintComponent when what you mean to do is call repaint() JFrame has no paintComponent method, so you aren't actually overriding any paint functionality. For JFrame you should override paint, though I'd advise against it, and paint with JPanel or JComponent In a paintComponent or paint method you should also be calling super.paintComponent or super.paint, respectively, as to not break the paint chain.
has comment: http://stackoverflow.com/comment/33987992
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/22366589
tagged with: exec
tagged with: file-descriptor
favorite count: 0
has comment: http://stackoverflow.com/comment/33999392
upvote count: 8
accepted answer: http://stackoverflow.com/a/40867001
type: Question
has comment: http://stackoverflow.com/comment/34034173
has answer: http://stackoverflow.com/a/22636468
has comment: http://stackoverflow.com/comment/34035521
possible better answer: http://stackoverflow.com/a/22636468
has comment: http://stackoverflow.com/comment/33999454
tagged with: java
has title: Execute a command in Java without redirecting the output
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/34034030
has answer: http://stackoverflow.com/a/22366760
has comment: http://stackoverflow.com/comment/34034820
has answer: http://stackoverflow.com/a/40867001
score: 6
type: AnsweredQuestion
has body: How do I run an external command (via a shell) from a Java program, such that no redirection takes place, and wait for the command to end? I want the file descriptors of the external program to be the same as those of the Java program. In particular I do not want the output to be redirected to a pipe that the Java program is reading. Having the Java program relay the output is not a solution. This means that a plain invocation of java.lang.Runtime.exec is not the solution. I presume that java.lang.ProcessBuilder is involved, but how do I specify that output and error streams must be the same as the calling Java process? class A { public static void main(String[] args) { try { ProcessBuilder pb = new ProcessBuilder("echo", "foo"); /*TODO: pb.out = System.out; pb.err = System.err;*/ Process p = pb.start(); p.waitFor(); } catch (Exception e) { System.err.println(e); System.exit(1); } } } (This may or may not be the right approach.) In other words, I'm looking for Java's system, but all I can find is (roughly) popen. Here's an example of a situation where relaying cannot work: if the subprocess writes to both stdout and stderr and the Java program is relaying, then the Java program has no way to know the order of the write calls in the subprocess. So the order of the output on stdout and stderr from the Java program will be observably different if the two streams end up in the same file. Mixing stdout and stderr is of course not a solution because the caller may want to keep them separate. While I think this question is of general interest, a Linux-specific solution would solve my immediate problem.

http://stackoverflow.com/q/22384054
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34028557
upvote count: 5
tagged with: java
tagged with: overriding
possible better answer: http://stackoverflow.com/a/22384464
type: Question
answer count: 2
score: 5
downvote count: 0
accepted answer: http://stackoverflow.com/a/22384205
has body: I was playing around with generics, and I found a problem I really can't figure out. Please take a look at this code: class Operation&lt;R&gt; { } class P&lt;O extends Operation&lt;R&gt;, R&gt; { } class MyResource { } class MyO extends Operation&lt;MyResource&gt; { } class MyP extends P&lt;MyO, MyResource&gt; { } abstract class A&lt;R&gt; { abstract P&lt;Operation&lt;R&gt;, R&gt; doIt(); } class B extends A&lt;MyResource&gt; { @Override MyP doIt() { /* the compiler is complaining about the above line: The return type is incompatible with A&lt;MyResource&gt;.doIt() */ return null; } } So basically, MyP is a subclass of P&lt;MyO, MyResource&gt; which in turn is a subclass of P&lt;Operation&lt;MyResource&gt;, MyResource&gt;. In other words, we are returning a subclass of A.doIt return type in B.doIt. But nevertheless, the compiler is complaining. Can you help me to understand this ? Thanks.
favorite count: 0
has answer: http://stackoverflow.com/a/22384464
has answer: http://stackoverflow.com/a/22384205
tagged with: generics
linked to: http://stackoverflow.com/q/5056595
has title: Incompatible return type when overriding methods of Generic classes in Java

http://stackoverflow.com/q/22331933
type: UnansweredQuestion
tagged with: spring
score: 2
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/1336989
tagged with: apache-axis
type: Question
downvote count: 0
has title: Inject client options in Axis 2 stubs using Spring
favorite count: 0
has body: I have used wsdl2java ant task to create several proxies for different web services using Axis2. Since some of these take considerable time to complete, I need to set timeout accordingly. As of problem with axis client stub timeout I can programmatically set timeout using ServiceClient class. I want to efficiently set timeout for any service client in my project. Currently I had to create a factory bean for a specific service and manually set timeout there: Context: <property name="xmlValidatorUrl" value="${validator.url}" /> Factory: public XmlValidatorStub create() throws Exception { XmlValidatorStub ret = new XmlValidatorStub(); ret._getServiceClient() .getOptions() .setTimeOutInMilliSeconds(1000000); return ret; } I want to ask if such option can be set efficiently using Spring for any web service stub defined as bean
upvote count: 2

http://stackoverflow.com/comment/34067192
has text: You think that a code is correcte in java? and can I write char** as String in java ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22402344

http://stackoverflow.com/comment/34156342
comment on: http://stackoverflow.com/q/22455209
score: 0
type: Comment
type: QuestionComment
has text: Thanks for your comment David, the problem is that I have 20 pages of inactive rules and I don't know what name should the rule have. Should it be the name of the class? or where is this configured?

http://stackoverflow.com/q/22452133
favorite count: 0
has title: Multiple pom files for a maven project
has comment: http://stackoverflow.com/comment/34434821
tagged with: maven
accepted answer: http://stackoverflow.com/a/22455467
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34148555
tagged with: java
upvote count: 10
has comment: http://stackoverflow.com/comment/34148652
type: Question
tagged with: svn
score: 10
has body: i have a project which has multiple maven project and 1 parent pom which has all other projects as maven modules. pom.xml abc-codegen stellar-codegen abc-engine stellar-engine out of those maven projects few projects(abc-codegen, stellar-codegen) are used for code generation. the codegen artifacts are used by other maven modules such as abc-engine. the codegen modules may not be built everytime other application modules(abc-engine etc) are built and released. pom-codegen.xml abc-codegen stellar-codegen However, the codegen projects should remain inside the parent folder (svn/my-service/trunk) for the sake of consistency with other such applications. One of the idea i have is to create another pom file called as pom-codegen.xml under the parent folder and generate code when required by explicitely calling mvn -f pom-codegen.xml clean deploy The only i have to do is tell my CI to execute the above command and trigger deploy the artifact when required. whilst Other build (mvn clean install) will check the sanity of the code. can we do this any other approach?
tagged with: eclipse
has answer: http://stackoverflow.com/a/22455467
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34178706
comment on: http://stackoverflow.com/q/22469208
score: 1
type: Comment
has text: Where does the limitation come from? If you (in any circumstances) always need to return exactly one element, the return type really shouldn't be ``ArrayList``. This situation might be a hint, that you misunderstood your task (homework?).
type: QuestionComment

http://stackoverflow.com/comment/34159037
type: Comment
has text: In other words, `person` object is accessible from `main`, and since OP is creating the object in `main`, I'm assuming he wants to use it there.
type: AnswerComment
comment on: http://stackoverflow.com/a/22414045
score: 0

http://stackoverflow.com/comment/34158066
has text: Use "Content-type: application/json; charset=utf-8" in your angular request
comment on: http://stackoverflow.com/q/22457525
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22380718
accepted answer of: http://stackoverflow.com/q/22357338
score: 0
type: AcceptedAnswer
type: Answer
has body: It turned out that some internal outputstream of workbook was closed and not the one from class ExcelSerializer. Once workbook.dispose() is called the workbook is no longer available to do any work. And the solution is to create a new workbook on each call.
answers question: http://stackoverflow.com/q/22357338

http://stackoverflow.com/a/22470361
answers question: http://stackoverflow.com/q/22470316
type: Answer
has body: If default constructor is available in super class then compiler will include default constructor invocation in sub class's default constructor. For Example - class Base(){ Base(){ // default constructor ... } } class Sub extends Base{ // no constructor } In this case not required. class Base(){ Base( int i){ // no default constructor ... } } class Sub extends Base{ // no constructor } In this case it required. class Sub extends Base{ Sub(){ Base(1); } }
score: 0

http://stackoverflow.com/q/22416461
favorite count: 0
tagged with: android
type: AnsweredQuestion
has body: I'm trying to instantiate an Fragment to my FragmenteActivity class but Eclipse doesnt let me! Let me show you: That is my Fragment Class: public class VendorListFragment extends Fragment { private VendorListAdapter adapter; private ArrayList&lt;Vendor&gt; vendorList; private VendorSQLiteHelper dbHelper; private ListView listView; public VendorListFragment() { // empty constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_vendor_list, container, false); listView = (ListView) rootView.findViewById(R.id.listView); listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); this.setRetainInstance(true); return rootView; } So you can see that it extends Fragment, right? But in my FragmentActivity class, shown above, when I code fragmentTransaction.add(R.id.view_trade_show_vendor_fragment, new VendorListFragment()); Eclipse says: The method add(int, Fragment) in the type FragmentTransaction is not applicable for the arguments (int, VendorListFragment) So, Eclipse doesn't think my ViewTradeShowActivity is a Fragment, even with the Extends Fragment, what is wrong?!? See some more code below: public class ViewTradeShowActivity extends FragmentActivity { TextView viewTradeShowName; TradeShow tradeShow; Fragment vendorFragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_trade_show); tradeShow = getIntent().getParcelableExtra("tradeShow"); viewTradeShowName = (TextView) findViewById(R.id.view_trade_show_name); viewTradeShowName.setText(tradeShow.getName()); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager .beginTransaction(); fragmentTransaction.add(R.id.view_trade_show_vendor_fragment, new VendorListFragment()); } } Thank you!
has title: Eclipse doesn't recognize my class as a Fragment
type: Question
tagged with: android-fragments
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22416475
accepted answer: http://stackoverflow.com/a/22416475
upvote count: 1
answer count: 1
downvote count: 0

http://stackoverflow.com/a/22468124
answers question: http://stackoverflow.com/q/22418567
score: 1
accepted answer of: http://stackoverflow.com/q/22418567
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Just for the record, I am put here some considerations about this subject I learn there few days: First all, besides the two sets of classes generated by Hibernate (DAO and POJO), I create one anotherm based in this example: http://www.baeldung.com/hibernate-4-spring where I configure some options and methods of the Hibernate and point to the file where I place the options for conect to the database (database.properties). After, I made some changes in the generated classes: 1) In the POJO class, I added the annotation @Entity and @Table for the class (and the second annotation with de parameter value="?", where ? is the name of the table associated to this class). For the attributes, I add the annotation @Column for all of them and the annotation @Id for the attribute related to the primary key. 2) In the DAO classes, I added the annotation @Repository for the class, and the annotation @Transactional for all the methods. Because of this annotation, I may insert in my *-servlet.xml file the follow line: &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt; and in the header, this options: xmlns:tx="http://www.springframework.org/schema/tx" and inside xsi:schemaLocation: http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd. Also, the atribute sessionFactory was annotated with @Autowired, the association was removed, and this methos was added: protected Session getCurrentSession() { return sessionFactory.getCurrentSession(); } For use of this class to handle the queries to database, I add them as atributes of the controller, always informing the annotation @Autowired. Inside each method of the controller, I use the classes as this examples: read data Usuario novo = usuario.findById(this.getId_usuario()); save data Sessao nova = new Sessao(novo, 0); sessao.persist(nova);
type: Answer

http://stackoverflow.com/comment/34118404
type: Comment
comment on: http://stackoverflow.com/q/22435292
type: QuestionComment
score: 2
has text: Then the string that is passed as argument already contains those chars, and the bug is in code you're not showing us.

http://stackoverflow.com/a/22436345
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22433604
has body: Just a hint... At the end, what you are creating are good old war files... which should have your libraries under WEB-INF/lib. Have you checked if it is happening? I mean, you can create your war (Export/WAR file right clicking on the project in the project explorer), and then, through your zip application, go to that WEB-INF/lib folder in the war file, and checking that your jar files are there. If they are not there, Eclipse is not exporting your libraries into the war file correctly. Have you added them to your build path(java build path / Libraries and java build path / Order and export)?
upvote count: 1
has comment: http://stackoverflow.com/comment/34120079
has comment: http://stackoverflow.com/comment/34182739
has comment: http://stackoverflow.com/comment/34135716
type: Answer

http://stackoverflow.com/a/22446793
answers question: http://stackoverflow.com/q/22446583
score: 0
type: Answer
has body: I dont know how you managed to make so many mistakes.. this is a working code import java.util.Scanner; public class Lame { /** * @param args */ public static void main(String[] args) { double a, b, c; Scanner scan = new Scanner(System.in); System.out.println("Length of side a?"); a = scan.nextDouble(); System.out.println("Length of side b?"); b = scan.nextDouble(); c = Math.sqrt((a*a + b*b)); System.out.print("The length of side C is"); System.out.println(c+ "units."); } } Some hints. Pay attention to your Capitalization. Java is case sensitive. scanner and Scanner are not the same thing in java! (Classes are capitalized while functions are not) Java does not automatically convert types you cannot set a= scan.nextDouble(): because it will return a double not an int. (if you want to cast a double to int you must do it yourself) there is no such thing as a power sign ^ in Java. You need to either use a pow() function or just do a variable times itself like a*a. Change your class name from Math. Try google things and do a lot of exercises from the book just coping the code. After a while you will start understanding things.

http://stackoverflow.com/comment/34065015
score: 0
type: QuestionComment
type: Comment
has text: how many characters are considered as a line?
comment on: http://stackoverflow.com/q/22405399

http://stackoverflow.com/q/22459268
tagged with: java
possible better answer: http://stackoverflow.com/a/22459316
has title: Java Creating instance of subclass error
has comment: http://stackoverflow.com/comment/34160540
has answer: http://stackoverflow.com/a/22459316
has answer: http://stackoverflow.com/a/22459515
has answer: http://stackoverflow.com/a/22459396
has body: Hi guys Im having trouble creating an instance of a subclass: package room; public class Room { String roomNumber; int capacity; boolean projection; public Room(String rm, int n, boolean p) { roomNumber = rm; capacity = n; projection = p; } public String getRoomNumber() { return roomNumber; } public int getCapacity() { return capacity; } public boolean hasProjector() { return projection; } public class ComputerLab extends Room { private String os; public ComputerLab(String rm, int n, boolean p, String os) { super(rm, n, p); this.os = os; } public String getOS() { return os; } public void setOS(String update) { os = update; } } public static void main(String[] args) { Room r; r = new ComputerLab("G102", 20, true, "WindowsXP"); System.out.println(r.getCapacity()); } } In the line where I create the ComputerLab object in my main function, i am getting the following error: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - non-static variable this cannot be referenced from a static context at room.Room.main(Room.java:48) Can anyone help explain why this error is occuring and how to fix it? Many thanks
has answer: http://stackoverflow.com/a/22459388
score: 0
has answer: http://stackoverflow.com/a/22459307
answer count: 5
accepted answer: http://stackoverflow.com/a/22459388
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/22420323
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22420304
has body: Don't create s, pur joption in the println instead

http://stackoverflow.com/comment/34041788
type: Comment
comment on: http://stackoverflow.com/a/22391237
has text: First, thanks for the much neater code. The purpose though is to read from a file, output.txt (that's my flat file, sry for the misleading name, should've been something else). I'm conceptually having a hard time understanding how the code reads the lines and turns them into fieldSet's, which I can then work with.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34089194
type: Comment
has text: It means user wants same behavior on mouse click also? We can add key listener on Panel or JFrame itself if focus is lost to come back on text box.
comment on: http://stackoverflow.com/a/22418211
type: AnswerComment
score: 0

http://stackoverflow.com/q/22481226
has answer: http://stackoverflow.com/a/22481273
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22482459
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22482459
type: Question
tagged with: alfresco
has body: I'm trying to authenticate to alfresco using from a Java Class AuthenticationService. Here is the code: public void Authenticate() throws AuthenticationException { authenticationService.authenticateAsGuest(); } The problem is that I can't run the function because it says that No exception of type AuthenticationException can be thrown; an exception type must be a subclass of Throwable I'm using Alfresco 4.2. The concerned classes are imported from: import org.alfresco.repo.security.authentication.AuthenticationException; import org.alfresco.service.cmr.security.AuthenticationService;
possible better answer: http://stackoverflow.com/a/22481337
has title: No exception of type AuthenticationException can be thrown JAVA
has answer: http://stackoverflow.com/a/22481337
answer count: 3
upvote count: 1

http://stackoverflow.com/comment/33956720
has text: But why oh why are you using `Vector`?
score: 1
comment on: http://stackoverflow.com/q/22342509
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22441463
answers question: http://stackoverflow.com/q/22441252
downvote count: 0
upvote count: 2
has body: Performance analysis: Your hashing function doesn't take the order into account. According to your algorithm, if there's no overflow, ab = ba. Your code depends on overflow to make difference between different order. So there is space for a lot of extra collisions which can be removed if you think about the sentences to be a N based number. Suggested Improvement: 2 * 3 == 3 * 2 but 2 * 223 + 3 != 3 * 223 + 2 So if we represent the strings as N based number, number of collisions will be decreased at a dramatic scale.
type: Answer
score: 2

http://stackoverflow.com/comment/34118099
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22435189
type: AnswerComment
has text: Thanks a lot... It really saved a lot of time for me

http://stackoverflow.com/comment/34157963
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22457532
has text: Thanks for this answer. It deffinitly helped me to understand it. As you said you don't know libgdx and so you cannot answer the libgdx specific questions, like the naming of the `Node`s, if it is the same as in Blender... For that i ll leave this question open for some days and then accept it. I will try out those things myself and if i find out something i add it to this answer and accept it. Thanks again

http://stackoverflow.com/a/22343863
upvote count: 1
has comment: http://stackoverflow.com/comment/33960282
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33959316
has comment: http://stackoverflow.com/comment/33959837
answers question: http://stackoverflow.com/q/22343798
type: Answer
accepted answer of: http://stackoverflow.com/q/22343798
downvote count: 0
has comment: http://stackoverflow.com/comment/33960371
score: 1
has body: In this code public void addBouncer(Bouncer newBouncer) { bouncerList.add(Bouncer); // this is trying to add a class } you need to change to public void addBouncer(Bouncer newBouncer) { bouncerList.add(newBouncer); // this will add the object } and after movingSprite.setMovementVector(3, 1); call addBouncer (movingSprite);

http://stackoverflow.com/q/22385364
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I have a basic progress dialog call in an async class for a google glass app. I implemented it and it did not throw any errors, but also did not show up in any way on Glass. I then tried the program in a Galaxy Nexus emulator and it worked perfectly. Is there a resolution or compatibility issue that keeps progress dialog from appearing on Glass? Here is my code just in case I'm a dummy. public class GetUPC extends AsyncTask&lt;Void, Void, Void&gt; { private ProgressDialog dialog; @Override protected void onPreExecute() { super.onPreExecute(); dialog = new ProgressDialog(ctx_context); this.dialog.setMessage("Progress start"); this.dialog.show(); } @Override protected Void doInBackground(Void... arg0) { //secret stuff } @Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub super.onPostExecute(result); try { if (dialog.isShowing()) { dialog.dismiss(); } } catch(Exception e) { Log.e("Post_ERROR", e.toString()); } } }
tagged with: google-gdk
type: Question
has comment: http://stackoverflow.com/comment/39545621
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34072935
score: 0
tagged with: android
has title: Progress Dialog not showing on Google Glass

http://stackoverflow.com/comment/34053228
type: AnswerComment
has text: If that worked for you then don't forget to check it as the answer to complete the thread of question ( and would help someone in future )
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22398005

http://stackoverflow.com/a/22445837
answers question: http://stackoverflow.com/q/22445701
downvote count: 0
type: Answer
upvote count: 1
has body: You can just turn the string into a char[] (array of characters) with the toCharArray() method. After than you can use the Character class's utility methods to check for whitespace and convert things to lowercase. Deque&lt;Character&gt; stack = new ArrayDeque&lt;Character&gt;(); for (char c : inputString.toCharArray()) { if (!Character.isWhitespace(c)) { stack.push(Character.toLowerCase(c)); } }
score: 1

http://stackoverflow.com/q/22483589
favorite count: 0
possible better answer: http://stackoverflow.com/a/22484568
has body: I understand using immutable object as map keys are preferable. But how about mutable objects with default hashCode() method (and of course, I don't override the equals() method). That should also be fine, since default hashCode() uses the object memory address? Is there anything I miss here?
has answer: http://stackoverflow.com/a/22484568
downvote count: 0
score: 1
tagged with: java
has title: Java Mutable Object as Map Key but using default hashCode()
type: Question
type: AnsweredQuestion
tagged with: hashmap
has comment: http://stackoverflow.com/comment/34204414
has answer: http://stackoverflow.com/a/22483626
accepted answer: http://stackoverflow.com/a/22483626
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/58664565

http://stackoverflow.com/comment/34137391
type: Comment
type: QuestionComment
has text: @ Sotirios Delimanolis and PakkuDon, good boys have a cookie...
comment on: http://stackoverflow.com/q/22445404
score: 0

http://stackoverflow.com/q/22420345
has comment: http://stackoverflow.com/comment/34094993
has body: I have input web cam video processing each frame 1-by-8 co-ordinates values in list. Values are like the following: points=[33,12,3,2,54,222,44,54] points=[54,32,1,1,33,44,54,21] points=[64,443,2,2,2,44,3,5] This is my code: public class Sample { private List&lt;List&lt;Integer&gt;&gt; matrix; //Getter and Setter Method public List&lt;List&lt;Integer&gt;&gt; getMatrix() { return matrix; } public Sample setMatrix(List&lt;&lt;Integer&gt;&gt; matrix) { this.matrix = matrix; return this; } public void list_method(List&lt;Integer&gt; points) { Sample sample = new Sample(); //Class object sample.getMatrix().add(); System.out.println(sample); } } I got result like matrix = [33,12,3,2,54,222,44,54] matrix = [33,12,3,2,54,222,44,54 ,54,32,1,1,33,44,54,21] matrix =[33,12,3,2,54,222,44,54 ,54,32,1,1,33,44,54,21,64,443,2,2,2,44,3,5 ] But I would like it to be in a form like : matrix = [33,12,3,2,54,222,44,54] matrix = [33,12,3,2,54,222,44,54], [54,32,1,1,33,44,54,21] matrix = [33,12,3,2,54,222,44,54], [54,32,1,1,33,44,54,21], [64,443,2,2,2,44,3,5]
has comment: http://stackoverflow.com/comment/34092228
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34092428
tagged with: java
has answer: http://stackoverflow.com/a/22423161
has comment: http://stackoverflow.com/comment/34092364
type: Question
tagged with: arraylist
score: 0
has title: How to Add Array ListSequential form using Java
answer count: 1
has comment: http://stackoverflow.com/comment/34092281

http://stackoverflow.com/q/22459429
has comment: http://stackoverflow.com/comment/34161830
downvote count: 0
score: 1
has title: How to include CSS and images when using Spring
favorite count: 0
has comment: http://stackoverflow.com/comment/34162354
has comment: http://stackoverflow.com/comment/34161635
type: Question
upvote count: 1
tagged with: spring
tagged with: java
has body: I want to include CSS and image files in my views. This is my web.xml: &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"&gt; &lt;display-name&gt;RSuite GUI&lt;/display-name&gt; &lt;servlet&gt; &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt; &lt;servlet-class&gt; org.springframework.web.servlet.DispatcherServlet &lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;mvc-dispatcher&lt;/servlet-name&gt; &lt;url-pattern&gt;/a/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/mvc-dispatcher-servlet.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;listener&gt; &lt;listener-class&gt; org.springframework.web.context.ContextLoaderListener &lt;/listener-class&gt; &lt;/listener&gt; &lt;/web-app&gt; And my dispatcher xml: &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt; &lt;context:component-scan base-package="com.tangomc.rsuitegui.controllers" /&gt; &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="prefix"&gt; &lt;value&gt;/WEB-INF/pages/&lt;/value&gt; &lt;/property&gt; &lt;property name="suffix"&gt; &lt;value&gt;.jsp&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; &lt;mvc:annotation-driven /&gt; &lt;mvc:resources mapping=”/resources/*…
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/38049072
score: 0
type: AnswerComment
type: Comment
has text: If the peer goes down and up you will get NoSuchObjectException rather than a connect exception, indicating a stale stub which definitely must be reacquired. If a stub consistently doesn't work of course it must he discarded and re-acquired. But you should allow yourself a couple of retries in case the condition is transient. And I didn't say anything about 'ignoring' anything.
comment on: http://stackoverflow.com/a/24543954

http://stackoverflow.com/a/22434127
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22434031
score: 3
answers question: http://stackoverflow.com/q/22434031
type: AcceptedAnswer
downvote count: 0
has body: You can't use the for-each loop in getTotal normally because your array has null elements: // vv groceryBill = new Item[10]; You only add two items to the list so elements 2-9 are all null. So use a regular loop that goes until counter. for(int i = 0; i &lt; counter; i++) { // do stuff with groceryBill[i] } Using the for-each loop you'd have to do something like this: for(Item item : groceryBill) { if(item != null) { // do stuff with non-null element } } But that is a little excessive because you are iterating farther than you need to.
has comment: http://stackoverflow.com/comment/34130075

http://stackoverflow.com/comment/34208119
has text: I thought to make the file mapped to memory, but I have data of varying lengths and set the read buffer I can not ( Thanks for the help I will try.
comment on: http://stackoverflow.com/a/22481016
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34093730
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22421316
score: 0
has text: I already comment the error line that log cat point in above question .

http://stackoverflow.com/q/22379022
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34020682
has comment: http://stackoverflow.com/comment/34021081
has comment: http://stackoverflow.com/comment/34021375
has comment: http://stackoverflow.com/comment/34021275
has comment: http://stackoverflow.com/comment/34021130
has body: btn2.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent e) { ((Stage)btn2.getScene().getWindow()).setScene(new Scene(new Login())); } }); This is the code to display new contents in the same window when clicked on a button. Now I want to display new contents in the same window when clicked on a menu item. I tried this code just by changing the button name with menu item name. But it didn't worked. How can I do it ?
has comment: http://stackoverflow.com/comment/34020851
tagged with: menu
tagged with: javafx-2
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34021362
tagged with: menuitem
has title: Perform an action when clicked on a menu item
tagged with: java

http://stackoverflow.com/a/22431911
has comment: http://stackoverflow.com/comment/34112616
has comment: http://stackoverflow.com/comment/34112441
has comment: http://stackoverflow.com/comment/34112522
has body: In folder src/: $ javac org/example/Hello.java $ java org.example.Hello
has comment: http://stackoverflow.com/comment/34112859
has comment: http://stackoverflow.com/comment/34112536
score: 4
accepted answer of: http://stackoverflow.com/q/22431904
upvote count: 4
answers question: http://stackoverflow.com/q/22431904
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34112906
type: Answer
has comment: http://stackoverflow.com/comment/34112716
has comment: http://stackoverflow.com/comment/34112742

http://stackoverflow.com/q/22431413
tagged with: dialog
has body: I came across a really frustrating problem. I have a button with an onClick event that should display a dialog pop up with a ExpandableListView inside of it. This is the code: public class Home extends Activity { List<String> groupList; List<String> childList; Map<String, List<String>> laptopCollection; ExpandableListView expListView; private Context thisContext = this; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); createGroupList(); createCollection(); Intent myDataIntent = this.getIntent(); // getting the municipality name, the year and the versed money from the prev. intent this.municipalityName = myDataIntent.getStringExtra(TAG_COMUNE); this.year = myDataIntent.getStringExtra(TAG_ANNO); this.versedMoney = myDataIntent.getStringExtra(TAG_VERSED_MONEY); Button infoListButton = (Button) findViewById(R.id.infoButton); infoListButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // custom dialog final Dialog dialog = new Dialog(thisContext); dialog.setContentView(R.layout.institutional_info_custom_list); dialog.setTitle("Info"); LayoutInflater li = (LayoutInflater) thisContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = li.inflate(R.layout.institutional_info_custom_list, null, false); dialog.setContentView(v); expListView = (ExpandableListView) findViewById(android.R.id.list); final ExpandableListAdapter expListAdapter = new ExpandableListAdapter( Home.this, groupList, laptopCollection); /// THE APP CRASHES HERE expListView.setAdapter(expListAdapter); // getting the window manager and changing the dialog position WindowManager.LayoutParams params = dialog.getWindow().getAttributes(); params.gravity = Gravity.TOP | Gravity.LEFT; params.y = 80; dialog.getWindow().setAttributes(params); // dialog width and height. dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); // set …
score: 0
answer count: 1
has title: Can't setAdapter() inside a Dialog pop up Android?
accepted answer: http://stackoverflow.com/a/22431444
linked to: http://stackoverflow.com/q/13590627
has comment: http://stackoverflow.com/comment/34117229
tagged with: android
has answer: http://stackoverflow.com/a/22431444
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/22335688
accepted answer of: http://stackoverflow.com/q/22335568
answers question: http://stackoverflow.com/q/22335568
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/33944842
has body: You need to modify the lines long count = 1L * MAX * MAX * MAX * MAX * MAX; // one more * MAX ... int[] digits = new int[5]; // from [4] char[] output = "00000".toCharArray(); // from 0000 ... for(int d = 4; d &gt;=0; --d){ // from d = 3 More generally, if n is the number of digits, long count = 1L; for( int i=0; i&lt;n; i++ ) count *= MAX; ... int[] digits = new int[n]; char[] output = new char[n]; Arrays.fill( output, '0' ); ... for(int d = n-1; d &gt;=0; --d){
has comment: http://stackoverflow.com/comment/33946736
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/33945565

http://stackoverflow.com/comment/34039274
has text: Thanks for your reply. Using your code I get java.sql.SQLException: No suitable driver found for <database_name>
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22389579
type: AnswerComment

http://stackoverflow.com/comment/33972761
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22351642
has text: it means that it will return the number of char that have been read, anther wise it will return -1 if there is no data in the file or its finished reading.
score: 1

http://stackoverflow.com/q/22368018
has comment: http://stackoverflow.com/comment/34001529
type: Question
has comment: http://stackoverflow.com/comment/34001618
has title: Java - summing up Array list values
favorite count: 0
has answer: http://stackoverflow.com/a/22368098
answer count: 3
has answer: http://stackoverflow.com/a/22368087
has comment: http://stackoverflow.com/comment/34001523
possible better answer: http://stackoverflow.com/a/22368097
has answer: http://stackoverflow.com/a/22368097
upvote count: 2
has comment: http://stackoverflow.com/comment/34001537
accepted answer: http://stackoverflow.com/a/22368087
type: AnsweredQuestion
tagged with: java
downvote count: 3
score: -1
has body: I am building an array that ask how many different inputs you have, then allowing you to enter each input. At the end I want to sum them up, but I keep getting an error. Also when I go above 5 inputs, I lose one..... For example when I respond to the first question: Enter "10". When I start adding different numbers in it stops at nine. Please help. public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Please enter the number of courses you have left: "); int size = input.nextInt(); int[] numArr = new int[size]; System.out.println("Enter the number of CUs for each course: "); for (int i=0; i&lt;numArr.length; i++) { numArr[i] = input.nextInt(); } int totalSum = numArr + totalSum; System.out.print("The sum of the numbers is: " + totalSum);

http://stackoverflow.com/comment/34065597
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22400975
has text: Thank you very much for your response, johnstir. Win7 replies to ping requests if the command is executed by a shell, but not by java. For that reason, I said it might be a little buggy. I'm not sure if this could be "too much" for my software. It's like a chat, so it forwards a lot of messages and the software should contain many many timers. Ok, let's suppose for a moment that my software tries to do its best with no ACK, but what if it only wants to check the client still connected before sending a message? Which alternatives do we have to isReachable()?

http://stackoverflow.com/a/22346289
upvote count: 2
has comment: http://stackoverflow.com/comment/33964083
answers question: http://stackoverflow.com/q/22346197
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22346197
type: Answer
score: 2
downvote count: 0
has body: Missing rs.next() I guess. See here. Also it is possible that sum is not String. Try to get BigDecimal

http://stackoverflow.com/comment/34122984
comment on: http://stackoverflow.com/a/22437915
type: AnswerComment
type: Comment
score: 2
has text: But ojdbc6dms.jar it doesn't have class oracle/dms/console/DMSConsole

http://stackoverflow.com/comment/34182727
score: 0
has text: To which `Component` do you add the ActionListener? Can you show us more Code? In your If-Statement you have to check if the Button is clicked with `.equals()` not `==`.
comment on: http://stackoverflow.com/q/22471796
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22379976
has body: You don't need the abstract modifier in an interface, and I have a hunch that is what is causing your problems. The only place to use abstract methods is in abstract classes. EDIT I think it's likely that the interface has recently changed and in a separate jar. It probably used to return a Vector, but now the source you see returns a List. I suspect you are compiling with an old version of the jar (one in which getRecordsVector() still returns a Vector) in your classpath.
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34052942
upvote count: 0
answers question: http://stackoverflow.com/q/22379630
has comment: http://stackoverflow.com/comment/34063921
score: -1

http://stackoverflow.com/comment/33996020
comment on: http://stackoverflow.com/q/22363787
score: 0
type: QuestionComment
type: Comment
has text: @SearchForKnowledge Yeah I did. I guess it's because i didn't import the google play library

http://stackoverflow.com/comment/34066155
score: 0
type: QuestionComment
has text: If you mean the files are created at different location then you might give absolute path.
type: Comment
comment on: http://stackoverflow.com/q/22405999

http://stackoverflow.com/q/22446184
upvote count: 0
tagged with: java
type: Question
score: -1
has comment: http://stackoverflow.com/comment/34138597
has answer: http://stackoverflow.com/a/22456796
has body: I'm stuck and unsure of how to progress, I would like to create a .bat file that can search through a directory (and eventually sub directories) and pick up files with similar names and either move them or copy them into a new folder based on that name. For instance, I have these files in a documents directory: apples101.txt 101apples.txt 201applesohmy.doc 203apples101course.txt 101oranges.txt orangesohmy101.txt peeltheoranges.txt orangejuice.txt and I would like to move all the files with "apple" in their name to a folder called Apple and all the files with "Orange" in their name into a folder called orange. The key point to it though is that the search should automatically pick up like files based on pattern and not something I dictate. What I mean to ask is if there is a way so that rather then me having to put apple into the delim string and then running another set of commands with orange in it, is there a loop I can do that would basically search though all the files and sort like files into their own directory? I know I can use tokens without a delim option string but then it wouldn't search the files to match the name. Perhaps it would be better to take the first file name (excluding file extension) maybe say matching 6 characters in the name, and run the file name against the rest of the file names to find a pattern match and then move those files into a new folder with a like name? Then loop it for the remaining files? Would this be possible? Would this be possible in maybe java without the need to compile the script?
has comment: http://stackoverflow.com/comment/34155563
tagged with: batch-file
has comment: http://stackoverflow.com/comment/34148310
answer count: 1
downvote count: 1
tagged with: cmd
favorite count: 0
type: UnansweredQuestion
has title: Creating .bat file to sort files with similar pattern anywhere in string

http://stackoverflow.com/a/22444933
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22444731
type: Answer
score: 11
has body: Remember a method reference is just a shortcut for a lambda. So an instance method reference is a lambda that calls that method on the argument. The type of the argument is the class given in the method reference. It helps to "unwrap" it. MyPerson::getAge Unwrap to a lambda: (MyPerson p) -&gt; p.getAge() Unwrap to an anonymous class: new ToIntFunction&lt;MyPerson&gt;() { @Override public int applyAsInt(MyPerson p) { return p.getAge(); } } With a static method reference, the signature must match exactly, that is, the static method takes a T and returns an int. With an instance method reference, the parameter T of the lambda is the object the method gets called on.
upvote count: 11
answers question: http://stackoverflow.com/q/22444731
type: AcceptedAnswer

http://stackoverflow.com/comment/34055396
has text: did you tried some od (custom???) LookAndFeels, part (authors) of them to overide this awfull decorations
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22399476
type: Comment

http://stackoverflow.com/q/22338519
downvote count: 3
has comment: http://stackoverflow.com/comment/33949702
upvote count: 1
possible better answer: http://stackoverflow.com/a/22338553
has answer: http://stackoverflow.com/a/22338561
type: Question
type: AnsweredQuestion
score: -2
tagged with: math
has answer: http://stackoverflow.com/a/60698031
has title: How to times all the values together in an array list
tagged with: arrays
accepted answer: http://stackoverflow.com/a/22338561
has comment: http://stackoverflow.com/comment/33949650
favorite count: 0
answer count: 5
has body: I would like to multiply each value inside an arraylist of integers. For example, I have an array list which contains the following numbers: 5, 5, 5, 5 How would I create an integer that contains all these numbers multiplied by eachother: int x = 5 * 5 * 5 * 5 In my case I'm returning it with a method, like so: List&lt;Integer&gt; stack = new ArrayList&lt;Integer&gt;(); public int multiply() { int x = 0; for (int i = 0; i &lt; stack.size(); i++) { x *= stack.get(i); } return x; }
has answer: http://stackoverflow.com/a/22338564
has answer: http://stackoverflow.com/a/22338553
tagged with: list
has comment: http://stackoverflow.com/comment/33949779
has answer: http://stackoverflow.com/a/22338570
tagged with: java

http://stackoverflow.com/a/22347139
has comment: http://stackoverflow.com/comment/34003975
has comment: http://stackoverflow.com/comment/34003449
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/34004109
answers question: http://stackoverflow.com/q/22344344
has comment: http://stackoverflow.com/comment/34004757
downvote count: 0
score: 1
has body: Follow this link : Android Video Streaming Below code works for me : public static void getVideoFromHttp(String urlPath) { try { // Start the MediaController MediaController mediacontroller = new MediaController(mContext); mediacontroller.setAnchorView(mVideoview); // Get the URL from String VideoURL Uri mVideo = Uri.parse(urlPath); mVideoview.setMediaController(mediacontroller); mVideoview.setVideoURI(mVideo); } catch (Exception e) { Log.e("Error", e.getMessage()); e.printStackTrace(); } mVideoview.requestFocus(); mVideoview.setOnPreparedListener(new OnPreparedListener() { // Close the progress bar and play the video public void onPrepared(MediaPlayer mp) { mVideoview.start(); } }); mVideoview.setOnCompletionListener(new OnCompletionListener() { public void onCompletion(MediaPlayer mp) { } }); }
has comment: http://stackoverflow.com/comment/34004989

http://stackoverflow.com/a/22440957
score: 4
has body: You could make use of the contains() method on ArrayList. However, this will get slower and slower as the list gets larger. Unless you really need List semantics you should consider using a Set as these prevent duplicates. If you wish to maintain insertion order when iterating (like a List) then you can use a LinkedHashSet.
has comment: http://stackoverflow.com/comment/34128989
type: Answer
has comment: http://stackoverflow.com/comment/34128920
has comment: http://stackoverflow.com/comment/34128835
answers question: http://stackoverflow.com/q/22440898
has comment: http://stackoverflow.com/comment/116958237
has comment: http://stackoverflow.com/comment/34129212
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/34143861
has text: The simplest way to expose this is via static flag on your listener that your web application can then check.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22390941
type: AnswerComment

http://stackoverflow.com/comment/34111066
comment on: http://stackoverflow.com/a/22431048
type: AnswerComment
has text: @user3220962 [Ask another question](http://stackoverflow.com/questions/ask). Make sure to include the full stack trace and _all_ the relevant code.
score: 0
type: Comment

http://stackoverflow.com/comment/33976490
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22349181
has text: And i have to object you can do really great stuff with class implementatoin diagrams and descriptions, even import code comments in the project and vice versa

http://stackoverflow.com/q/22328787
tagged with: repaint
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/33934118
has comment: http://stackoverflow.com/comment/33934191
has title: How to access repaint from the main?
has answer: http://stackoverflow.com/a/22329051
tagged with: java
type: Question
tagged with: graphics
has answer: http://stackoverflow.com/a/22330974
has answer: http://stackoverflow.com/a/22329013
score: 0
has body: I am working on a Java program that basically renders an image from a file source and then paints that image onto a panel (which is on a frame). Now what I am able to do is invoke a line of code of the form printpanel.getGraphics().drawImage(myimage.globalimage, 0,0, null); where myimage is a class that contains the image. As many of you know, this only prints the image 1 time, and should I resize the frame, the image disappears. Now the way to fix this would be to put the line into the repaint method, but i'm in the main method right now so how do I access the definition of the repaint method and change it from within the main method? Thanks! ===================================================================================================== My code: MAIN CLASS: package imagetester; import java.awt.image.*; import javax.swing.*; import javax.imageio.*; import java.awt.Graphics2D.*; import java.io.*; public class Imagetester { public static void main(String[] args) { JFrame printframe = new JFrame("The drawing frame"); JPanel printpanel = new JPanel(); printframe.setSize(700,700); printpanel.setSize(700,700); printframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); printframe.add(printpanel); printpanel.setVisible(true); printframe.setVisible(true); Imageobject myimage = new Imageobject(); try { myimage.setImage("word.jpg"); } catch(IOException e) { System.out.println("the image failed!"); } printpanel.getGraphics().drawImage(myimage.globalimage, 0,0, null); printpanel.repaint(); System.out.println("hi"); } } myimage class: package imagetester; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class Imageobject { BufferedImage globalimage; public void setImage(String filename) throws IOException { globalimage = ImageIO.read(new File(filename)); } public void Imagebject() { } }
has comment: http://stackoverflow.com/comment/33934269
answer count: 3
tagged with: graphics2d

http://stackoverflow.com/comment/34097076
has text: You're trying to subtract a negative number from MAX_VALUE. This wil thus try to add a positive number to MAX_VALUE. And by definition, no integer can be bigger than MAX_VALUE. So you have an integer overflow.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22423345

http://stackoverflow.com/comment/34103096
comment on: http://stackoverflow.com/q/22426868
score: 0
type: QuestionComment
has text: So catch can handle 2 exceptions and this is introduced in java 7
type: Comment

http://stackoverflow.com/comment/94801104
has text: It's a `DialogPreference` :/
comment on: http://stackoverflow.com/a/53981349
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34119253
type: QuestionComment
has text: I'm sorry, but I still have difficulties understating your question. Please edit/update your question to be more clear.
score: 0
comment on: http://stackoverflow.com/q/22435670
type: Comment

http://stackoverflow.com/q/22345301
type: Question
has comment: http://stackoverflow.com/comment/33961952
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33961794
answer count: 1
has comment: http://stackoverflow.com/comment/33962002
downvote count: 0
tagged with: shell
has comment: http://stackoverflow.com/comment/33962224
favorite count: 0
has comment: http://stackoverflow.com/comment/33961569
tagged with: time
has title: Shell script time output over java environment
has comment: http://stackoverflow.com/comment/33962214
type: UnansweredQuestion
has body: I am running a script from java program using sshxcute API. Script contains: #!/bin/sh data=`stat -c%y filename` echo $data Script running on bash gives output: 2014-03-08 13:26:29.335545828 -0800 Script running through java program gives output: 2014-03-08 21:26:29.335545828 +0000 I think the -0800 is getting added. I need output in first format. How to resolve the issue?
upvote count: 1
has answer: http://stackoverflow.com/a/22345865

http://stackoverflow.com/a/22458046
upvote count: 1
score: 1
has body: Wrap your dependency type in a project object model pom as a type: ${project.that.has.postgres.as.dependency.groupId} ${project.that.has.postgres.as.dependency.artifactId} ${project.that.has.postgres.as.dependency.version} pom
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22457247
type: Answer
accepted answer of: http://stackoverflow.com/q/22457247

http://stackoverflow.com/a/22799608
has body: Here is the whole working flow, with GPO and READ RECORD instructions. Request1: 00A404000E325041592E5359532E444446303100 Response1: 6F2C840E325041592E5359532E4444463031A51ABF0C1761154F07A00000027710105007496E74657261638701019000 Request2: 00A4040007A000000277101000 (SELECT) Response2: 6F348407A0000002771010A5295007496E74657261638701015F2D02656E9F38159F59039F5A019F02069F1A025F2A029F37049F58019000 Request3: 80A80000158313C080000000000000100001240124823DDE7A0100 (GPO) Response3: 7711820218009404100102009F6304001000009000 Request4: 00B2011400 (READ RECORD) Response4: 70615A08XXXXXXXXXXXXXXXXX5F3401015F24031711308E0C0000000000000000010302038C159F02069F03069F1A0295055F2A029A039C019F37048D09910A8A0295059F37049F0D05FCF8FCF8F09F0E0500100000009F0F05FCF8FCF8F09F070229009000 Thanks to Nicolas Riousset. My problems included incorrect PDOL response, a dead EMV card and finally in the READ RECORD, I need to read record 2 to pick up the track data. (not record 1)
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22446007
upvote count: 3

http://stackoverflow.com/comment/33953395
has text: No. It would still call the derived1 display. Why would it do otherwise?
comment on: http://stackoverflow.com/q/22340577
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22355905
accepted answer of: http://stackoverflow.com/q/22352991
has body: Was all my fault. Thanks to Dirks question reg. the startup process I double-checked the bash launcher script which my colleague wrote and saw that he starts java with /Library/Java/Home/bin/java -jar ... instead of using only java -jar .... While java points to the Java 6 JDK, /Library/Java/Home/bin/java still points to old Java 5. Bummer! :-( With using java -jar ... instead in the bash script, everything works fine now...
answers question: http://stackoverflow.com/q/22352991
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/34093631
comment on: http://stackoverflow.com/a/22417353
type: Comment
has text: This answers the primary question, thanks. (Interestingly, when the far end sends a RST rather than timing out, neither TcpInitialRTT nor the doubling approach seem to apply.) Does anybody have any alternative suggestions for estimating the RTT?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34118476
comment on: http://stackoverflow.com/a/22435436
score: 0
type: AnswerComment
type: Comment
has text: That's right, because of Java's promotion rules `b>>>1` means `((int)b) >>> 1`. It's the promotion of `b` to `int` that adds all these ones - that's required to keep the value equal to the original `-1`.

http://stackoverflow.com/q/22389186
possible better answer: http://stackoverflow.com/a/22389304
score: 1
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/22389399
has comment: http://stackoverflow.com/comment/34038798
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/22389293
has body: I'm trying to verify my understanding of stacks. While I'm starting to understand the basics and I still have a ways to go, I found an example that piqued my curiosity. My research included this thread: Understanding Postfix-expression Evaluation in Java code using a stack I am confused by one line in particular from the thread I referenced above. Here is the entire section of code - my question refers to the line inside the while loop - details after the code: public static void main(String[] args) { char[] a = args[0].toCharArray(); int N =a.length; intStack s = new intStack(); for (int i = 0; i&lt;N; i++) { if (a[i]=='+') { s.push(s.pop() + s.pop()); } if (a[i]=='*') { s.push(s.pop() * s.pop()); } if ((a[i] &gt;= '0') &amp;&amp; (a[i] &lt;= '9')) { s.push(0); } while ((a[i] &gt;= '0') &amp;&amp; (a[i] &lt;= '9')) { s.push(10*s.pop() + (a[i++]-'0')); } Out.println(s.pop() + ""); } } My question is this: what purpose does the -'0' serve? If I understand the rest of the line properly, we are referencing the char 0 (due to the single quotes) and the - appears to be the operator for subtraction. Subtracting zero - a hard-coded zero, as opposed to a variable that just might happen to be zero occasionally - seems pointless. My current assumption is that there is a finely nuanced answer to this - i.e. it only /appears/ to be a pointless exercise, but there is something truly magical happening that I am simply too dim to understand. Thanks in advance to everyone here - I've been learning a great deal from the advice - this has quickly become one of my favorite and most-visited sites. Best regards
answer count: 3
favorite count: 0
linked to: http://stackoverflow.com/q/14542610
has title: java stacks and an apparent pointless exercise
has answer: http://stackoverflow.com/a/22389304
upvote count: 1
has answer: http://stackoverflow.com/a/22389293
type: AnsweredQuestion

http://stackoverflow.com/comment/34174840
comment on: http://stackoverflow.com/q/22466555
has text: If you want to avoid building illegal `Book`s, you should consider using the builder pattern; argument checking can be done there and you won't clutter your `Book` class
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34035263
type: QuestionComment
type: Comment
has text: Supply us with the stack trace. That way we know right away what's wrong, instead of us having to read all your code. Just edit your question and paste your stacktrace.
score: 1
comment on: http://stackoverflow.com/q/22387769

http://stackoverflow.com/comment/34093568
comment on: http://stackoverflow.com/a/22421111
type: AnswerComment
has text: What kind of methods will you put in that interface?
type: Comment
score: 0

http://stackoverflow.com/comment/34193619
has text: @user3425148 Updated my answer to add a part on case-insensitivity.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22434641

http://stackoverflow.com/a/22383884
upvote count: 9
has body: Consider using @Transactional over your DAO methods. It seems that your configuration is correct.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22382950
has comment: http://stackoverflow.com/comment/34028348
has comment: http://stackoverflow.com/comment/59952669
score: 9
has comment: http://stackoverflow.com/comment/61112825

http://stackoverflow.com/a/22385858
score: 1
answers question: http://stackoverflow.com/q/22384053
has body: I'll try to tackle your questions : Which of these two methods would be best or easier to work with for invalid input handling? (Ex.: static item missing, invalid format, etc.). I believe the Matcher method, because you can simply iterate over your declared array of Patterns and use the Matcher#usePattern(Pattern P) on each. I find it clean and clear, packing all the desired regexes in one place and running them in a quick for each. Why is the regex method faster? I would have assumed the opposite since Matchers and Patterns must have a somewhat more complex logic behind them. Is my performance analysis even representative? You're using Apache Commons implementation of split. Per their documentation they are using a specialized implementation of String Tokenizer, which as shown by experiment is slower than String#split(Str regex) (which uses String#indexOf()) and also slower than Matcher&amp;Pattern approach. Which of these methods is less likely to produce unexpected behaviour? Generic question, but I'd go with Apache Commons approach. One safety advantage of it is it does nullchecks for you. Quoting the description of StringUtils class : "Operations on String that are null safe." (quoted from StringUtils documentation, link posted in answer to 2nd question). Other than that, it all depends on you : )
downvote count: 0
has comment: http://stackoverflow.com/comment/34033981
type: Answer
upvote count: 1

http://stackoverflow.com/q/22366013
upvote count: 6
has comment: http://stackoverflow.com/comment/33998295
has answer: http://stackoverflow.com/a/22366036
tagged with: string
possible better answer: http://stackoverflow.com/a/22366173
accepted answer: http://stackoverflow.com/a/22366047
favorite count: 0
has title: Why does using one "print" instead of three work?
linked to: http://stackoverflow.com/q/1532461
has comment: http://stackoverflow.com/comment/33998208
has answer: http://stackoverflow.com/a/22366047
has comment: http://stackoverflow.com/comment/33998442
has answer: http://stackoverflow.com/a/22366212
score: 6
has answer: http://stackoverflow.com/a/22366173
answer count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has body: So I don't know much about java but I noticed this worked then according to my class notes I should be doing it a different way Here's what my notes have System.out.print("hello"); System.out.print(name); System.out.print("\n"); However I tried this and it also does the same thing. It's shorter so is this an acceptable way to do it or will it break down the road? System.out.print("hello"+name+"\n); Also as long as the code runs right my teacher shouldn't care right? It's my first class and I'm not a computer science major.
has comment: http://stackoverflow.com/comment/33998303

http://stackoverflow.com/q/22413052
answer count: 1
tagged with: android-activity
has comment: http://stackoverflow.com/comment/34081097
has answer: http://stackoverflow.com/a/22414095
has comment: http://stackoverflow.com/comment/34079229
has comment: http://stackoverflow.com/comment/34079621
score: 0
type: UnansweredQuestion
tagged with: android-manifest
has title: RuntimeError for activity specified on Android Manifest
tagged with: java
has comment: http://stackoverflow.com/comment/34079809
has comment: http://stackoverflow.com/comment/34079804
has comment: http://stackoverflow.com/comment/34079855
has body: I have this problem that just seems strange. I have this Android View with six buttons and when i click on one of them(the only one with the action defined apart from the exit button), it gives me a RuntimeError. The Activity is declared on the manifest, and this is why i don't understand my error. Can someone please help me with this. I would really appreciate it :) So here's my code: package com.example.calendar; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; public class MainActivity extends Activity implements OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); View createButton = findViewById(R.id.btn_create); View deleteButton = findViewById(R.id.btn_delete); View moveButton = findViewById(R.id.btn_move); View searchButton = findViewById(R.id.btn_search); View translateButton = findViewById(R.id.btn_translate); View exitButton = findViewById(R.id.exit); createButton.setOnClickListener(this); deleteButton.setOnClickListener(this); moveButton.setOnClickListener(this); searchButton.setOnClickListener(this); translateButton.setOnClickListener(this); exitButton.setOnClickListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.btn_create: Intent i = new Intent(this, CreateAppointment.class); startActivity(i); break; case R.id.exit: finish(); break; } } } My layout is like this: <CalendarView android:id="@+id/calendar" android:layout_width="match_parent" android:layout_height="match_parent" /> And the manifest: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersi…
type: Question
tagged with: button
has comment: http://stackoverflow.com/comment/34079697
has comment: http://stackoverflow.com/comment/34079987
tagged with: android

http://stackoverflow.com/q/22387257
has comment: http://stackoverflow.com/comment/34035053
score: 0
has comment: http://stackoverflow.com/comment/34035530
upvote count: 1
has comment: http://stackoverflow.com/comment/34034417
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34034787
has comment: http://stackoverflow.com/comment/34034808
has comment: http://stackoverflow.com/comment/34035289
has comment: http://stackoverflow.com/comment/34034674
has comment: http://stackoverflow.com/comment/34034866
favorite count: 0
has comment: http://stackoverflow.com/comment/34035080
accepted answer: http://stackoverflow.com/a/22389860
has comment: http://stackoverflow.com/comment/34034558
has comment: http://stackoverflow.com/comment/34034619
has comment: http://stackoverflow.com/comment/34035013
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34035147
has comment: http://stackoverflow.com/comment/34034412
tagged with: java
has answer: http://stackoverflow.com/a/22389860
has comment: http://stackoverflow.com/comment/34034641
has comment: http://stackoverflow.com/comment/34035432
type: Question
has title: Optimal algorithm for happy numbers
tagged with: algorithm
has body: Given number is n digits find 2n digits numbers that, for example given number is 3 then 6n numbers are from 100000 -999999 then find count of those numbers that for example 123213 1 + 2 + 3 = 2 + 1 + 3 6 = 6 I found and wrote a program for calculating little numbers, but I need the fastest algorithm to find those numbers. Ideas? my program : Scanner scan = new Scanner(System.in); System.out.println("enter n "); int say = scan.nextInt(); say *= 2; int low = (int) Math.pow(10, say - 1); int max = (int) Math.pow(10, say) - 1; int counter = 0; int first = 0; int last = 0; for (int i = low; i &lt;= max; i++) { int number = i; first = 0; last = 0; for (int j = 0; j &lt; say / 2; j++) { int k = number % 10; first += k; number /= 10; } for (int j = 0; j &lt; say / 2; j++) { int k = number % 10; last += k; number /= 10; } if (first == last) { // System.out.println(i); counter++; } } System.out.println(counter);
has comment: http://stackoverflow.com/comment/34035517
has comment: http://stackoverflow.com/comment/34036771
has comment: http://stackoverflow.com/comment/34034951
has comment: http://stackoverflow.com/comment/34035118
has comment: http://stackoverflow.com/comment/34035420

http://stackoverflow.com/q/22362426
upvote count: 1
tagged with: eclipse-rcp
has answer: http://stackoverflow.com/a/22362609
accepted answer: http://stackoverflow.com/a/22362609
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
tagged with: xstream
possible better answer: http://stackoverflow.com/a/33033341
has title: RCP Application + Xstream
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/33033341
tagged with: rcp
has body: i got a problem with using XStream in my RCP Application. I've added plugin with Xstream libs and created object class containing info about books. package Library.objects; import com.thoughtworks.xstream.annotations.XStreamAlias; @XStreamAlias("book") public class Book { @XStreamAlias("id") private int id; @XStreamAlias("name") private String name; @XStreamAlias("author") private String author; @XStreamAlias("desc") private String desc; @XStreamAlias("status") private boolean status; //some methods here } And in my other class i wanted to test if this lib works. So I created smth like this package Library.parts; public class test { private Table table; ArrayList&lt;Book&gt; books; MockBooks MockElement; private Text text; public test() { } /** * Create contents of the view part. * */ @PostConstruct public void createControls(Composite parent) { parent.setLayout(null); Display display = parent.getDisplay(); final Shell shell = new Shell(display); MockElement = new MockBooks(); //XMLBooks xml = new XMLBooks(); XStream xstream = new XStream(new DomDriver()); xstream.alias("book",Library.objects.Book.class); Book test = new Book(1,"test1","auth1","desc1","true"); String result = xstream.toXML(test); Book test2 = (Book) xstream.fromXML(result); //other stuff in window } Parsing from object to xml works perfectly, but parsing from XML string (or file) gives me alle the time same error: com.thoughtworks.xstream.mapper.CannotResolveClassException: Library.objects.Book I got this problem only when I use RCP. In clean java applications xstream works fine. Any ideas why?
answer count: 2

http://stackoverflow.com/a/49372950
has body: this work with spring boot 2.0.0 replace org.springframework.boot spring-boot-starter-tomcat provided with org.apache.tomcat.embed tomcat-embed-core 9.0.6
answers question: http://stackoverflow.com/q/22380119
type: Answer
score: 2
upvote count: 3
downvote count: 1

http://stackoverflow.com/a/22337221
upvote count: 2
type: Answer
score: 2
has body: you never put anything in array a. Int array's initialize everything as 0. Split on " " (space) instead. AND! you need to change it from string to int do this via: Integer.parseInt(yourString);
answers question: http://stackoverflow.com/q/22337094
downvote count: 0

http://stackoverflow.com/q/22383217
favorite count: 0
has body: in .Net you can simply do this with the following code Public class MyClass:ISomeInterface, SomeBaseClass Can something similar be done in Java? The code I have is as follows public class InputHander extends OnTouchListener implements IControlHandler However I get the error "no interface expected here" with regards to OnTouchListener
possible better answer: http://stackoverflow.com/a/22383237
accepted answer: http://stackoverflow.com/a/22383244
has comment: http://stackoverflow.com/comment/34026787
tagged with: interface
has comment: http://stackoverflow.com/comment/34027100
has answer: http://stackoverflow.com/a/22383237
has answer: http://stackoverflow.com/a/22383436
upvote count: 3
tagged with: java
answer count: 3
type: AnsweredQuestion
has title: Can a class inherit from both an Interface and a base class in Java?
downvote count: 5
has comment: http://stackoverflow.com/comment/34027319
tagged with: inheritance
type: Question
has comment: http://stackoverflow.com/comment/34027252
linked to: http://stackoverflow.com/q/19998454
has comment: http://stackoverflow.com/comment/34026768
has answer: http://stackoverflow.com/a/22383244
score: -2

size
type: Tag
tag name: size
tags question: http://stackoverflow.com/q/22441955

http://stackoverflow.com/q/22361285
has title: Replacing character pairs with characters in Java
tagged with: hex
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22361592
tagged with: java
accepted answer: http://stackoverflow.com/a/22361592
tagged with: loops
has body: So I have want to turn string with character pairs to a string that turns all of the same character pairs to a single letter. Like if I had String: "32 5A 5A 65 75 5A 67" To "ABBCDBE" (32=A,5A=B,65=C,75=D,67=E). I have this script: public static void main(String[] args) { String viesti; viesti = "23 44 B0 9A 61 A4 91 12 47 A4 91 96 44 B0 BF E0 32 68 EC 96 BF 32 44 B0 CA 32 35 A4 BF 32 EC A4 61 E4 CA 61 5A 32 70 12 91 32 BC 44 12 32 9A 44 91 32 96 91 E0 32 BA CA 61 BC 32 35 CA 47 47 32 E4 44 B0 CA 32 A1 CA 47 47 44 35 32 EC A4 E8 0A CA 61 E0 32 68 EC CA 32 82 61 44 70 47 CA 52 32 35 96 91 EC 32 91 EC 96 BF 32 E8 96 82 EC CA 61 32 96 BF 32 91 EC A4 91 32 91 EC CA 32 0A CA BC 32 96 BF 32 82 61 CA 91 91 BC 32 47 44 B0 9A E0 32 20 32 35 96 47 47 32 E8 44 52 CA 32 12 82 32 35 96 91 EC 32 A4 32 70 CA 91 91 CA 61 32 CA B0 E8 61 BC 82 91 96 44 B0 32 BF EC CA 52 CA 32 A4 B0 BC 32 BF 44 44 B0 E0 32 03 44 12 61 32 BF 44 47 12 91 96 44 B0 32 96 BF 5E 32 96 9A CA 47 47 E4 E8 A1 9A 61 A1 61 E0"; int pituus; pituus = viesti.length(); int i; i=1; char luku; char luku2; char merkki; String hexa; String merkki2; String viesti2; StringBuilder sb = new StringBuilder(); merkki = 'A'; while(i &lt; pituus){ luku = viesti.charAt(i-1); luku2 = viesti.charAt(i); if(luku2!=' ' &amp;&amp; merkki!=(char)91){ sb.append(luku); sb.append(luku2); hexa = sb.toString(); sb.setLength(0); merkki2 = Character.toString(merkki); viesti2 = viesti.replace(hexa,merkki2); i+=3; merkki++; } else { i+=2; } } System.out.print(viesti2); } } But it seems that viesti2 is only has the first pair replaced and nothing else. How to workaround this?
type: Question
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33990130

http://stackoverflow.com/comment/34048208
has text: eclipse uses `javac` from jdk you set in installed JRE
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22395138

http://stackoverflow.com/a/22474050
has comment: http://stackoverflow.com/comment/34186652
has comment: http://stackoverflow.com/comment/34187061
has comment: http://stackoverflow.com/comment/34188786
accepted answer of: http://stackoverflow.com/q/22473965
type: Answer
has comment: http://stackoverflow.com/comment/34187456
has comment: http://stackoverflow.com/comment/34188235
has comment: http://stackoverflow.com/comment/34187641
score: 0
has comment: http://stackoverflow.com/comment/34188047
has body: Try and use Java 7's Files.copy(). On the client side: final Path source = Paths.get(file); Files.copy(source, outToServer); On the server side: final Path destination = Paths.get(file); Files.copy(inFromClient, destination); See the javadoc for Files.
has comment: http://stackoverflow.com/comment/34186725
has comment: http://stackoverflow.com/comment/34187109
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34187287
answers question: http://stackoverflow.com/q/22473965
has comment: http://stackoverflow.com/comment/34188302

http://stackoverflow.com/comment/34096279
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22421832
has text: @user3263864, I'm glad you got it working. But I'm curious. If `openFileOutput()` was recognized, the others should be as well. What class are you working in?

http://stackoverflow.com/a/63423679
answers question: http://stackoverflow.com/q/22366217
type: Answer
upvote count: 1
has body: For Android 10+ add following into manifest: <application android:requestLegacyExternalStorage="true" ... as asking for Manifest.permission.WRITE_EXTERNAL_STORAGE is no more enough.
downvote count: 0
score: 1

http://stackoverflow.com/comment/34124266
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22438591
has text: The compiler error message says: *incompatible types: java.util.Map<java.lang.Object,java.lang.Object> cannot be converted to java.util.Map<java.lang.String,java.lang.Integer>*. So the not inferred type of the argument is `Map<java.lang.Object,java.lang.Object>`, not Object.
type: AnswerComment

android-intent
tags question: http://stackoverflow.com/q/22485072
tags question: http://stackoverflow.com/q/22340348
tags question: http://stackoverflow.com/q/22329950
tags question: http://stackoverflow.com/q/22483615
tags question: http://stackoverflow.com/q/22423992
type: Tag
tags question: http://stackoverflow.com/q/22367996
tag name: android-intent
tags question: http://stackoverflow.com/q/22454011
tags question: http://stackoverflow.com/q/22451133
tags question: http://stackoverflow.com/q/22338173
tags question: http://stackoverflow.com/q/22388434
tags question: http://stackoverflow.com/q/22408554
tags question: http://stackoverflow.com/q/22408780
tags question: http://stackoverflow.com/q/22370879

http://stackoverflow.com/comment/34148310
comment on: http://stackoverflow.com/q/22446184
score: 0
type: QuestionComment
type: Comment
has text: This sounds like a soundex. I wouldn't even consider doing it in pure batch. I'd use SQLite for that part.

http://stackoverflow.com/comment/34058753
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22398510
has text: It is an iteger value

http://stackoverflow.com/comment/34074632
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22395138
has text: Could you post what path is set exactly for your installed jre now /

http://stackoverflow.com/q/22448394
tagged with: spring
answer count: 1
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34168109
has body: Hi i create a implementation of Spring Security 3.1, hibernate 4.1.8,Spring MVC, JSP &lt;authentication-manager alias="authenticationManager"&gt; &lt;authentication-provider user-service-ref="customUserDetailsService"&gt; &lt;password-encoder ref="passwordEncoder" /&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; but i dont know how to show the other values of login of spring security, ejm lastname_user. @Service @Transactional(readOnly=true) public class CustomUserDetailsService implements UserDetailsService{ @Autowired UsersDao usersDao; @Override public UserDetails loadUserByUsername(String login) throws UsernameNotFoundException { Users domainUser = usersDao.getUser(login); boolean accountNonExpired = true; boolean credentialsNonExpired = true; boolean accountNonLocked = true; return new SecurityUser( domainUser.getLogin(), domainUser.getPassword(), domainUser.getEnabled(), accountNonExpired, credentialsNonExpired, accountNonLocked, getAuthorities(domainUser.getauthorities().getId()), domainUser.getLastName_user()); } My SecurityUser public class SecurityUser extends org.springframework.security.core.userdetails.User{ private static final long serialVersionUID = 1L; private Users user; public Users getUser() { return user; } public void setUser(Users user) { this.user = user; } public SecurityUser(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection&lt;? extends GrantedAuthority&gt; authorities,String lastname_user) { super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities); } I can login, and show the user with #{request.userPrincipal.name}, but I want to use the @Controller and (UserDetails)SecurityContextHolder.getContext().getAuthentication(). getPrincipal(); to show other values of my user login via controller/jsp, the examples in internet use System.out.println but there is a way to show in a t…
tagged with: java
tagged with: hibernate
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34165967
has title: Spring Login showuser info
tagged with: spring-security
type: Question
score: 0
has answer: http://stackoverflow.com/a/22465736

http://stackoverflow.com/comment/34094646
score: 0
type: QuestionComment
type: Comment
has text: so you mean its already compressed? and even though xz shortens it to 20% of original size?
comment on: http://stackoverflow.com/q/22421805

http://stackoverflow.com/a/22460165
score: 7
has comment: http://stackoverflow.com/comment/34162331
accepted answer of: http://stackoverflow.com/q/22460065
has comment: http://stackoverflow.com/comment/34162336
has comment: http://stackoverflow.com/comment/34162266
has comment: http://stackoverflow.com/comment/34162546
has comment: http://stackoverflow.com/comment/34162317
has body: You can do something like this: if (Arrays.asList(text1, text2, etc).contains("")) But a better solution would depend on the context. Note however that this is a little slower than your current code. If you don't execute that test a bazillion times a second, though, it should not matter. EDIT since it has been learned in the comments that strings with only spaces should also satisfy the condition... Here goes: private static final Pattern PATTERN = Pattern.compile("\\s*"); private static boolean emptyOrSpacesOnly(final String... strings) { for (final String s: strings) if (PATTERN.matcher(s).matches()) return true; return false; } Then, in code: if (emptyOrSpacesOnly(text1, text2, etc))
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34162767
has comment: http://stackoverflow.com/comment/34162295
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22460065

http://stackoverflow.com/comment/34040293
has text: What framework are you using?
score: 0
comment on: http://stackoverflow.com/q/22390563
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34135574
comment on: http://stackoverflow.com/q/22443913
type: Comment
type: QuestionComment
has text: Now post the `onCreate()` and `onClickListeners()` methods of your Activity.
score: 0

http://stackoverflow.com/a/22371656
score: 0
accepted answer of: http://stackoverflow.com/q/22359872
type: Answer
answers question: http://stackoverflow.com/q/22359872
has body: As indicated in the reference documentation, you currently have two options: annotation based auditing and interface based auditing: For interface based auditing your object implements Auditable and our infrastructure will call the setters exposed through the interface (see the relevant snippet of AuditableBeanWrapperFactory). For annotation based auditing we currently only support setting the auditing information directly into the field (see ReflectionAuditingBeanWrapper for details). There's a ticket in our tracker to make the annotation based solution accessor aware as well and we will have this fixed in the first milestone of upcoming release train Dijkstra.
type: AcceptedAnswer

http://stackoverflow.com/comment/34155519
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22454398
has text: Ok so modified the code accordingly.For the 1st command that i am executing i am getting the result i.e for "pwd" but the subsequent commands are not getting executed.I was trying this as an alternative to ssh to the other machine from the current machine.Please check if what i have done is correct.Thanx for the help.

http://stackoverflow.com/comment/34067814
has text: errr is non static method setRootName(String) can not be refrrenced from a static context
type: AnswerComment
comment on: http://stackoverflow.com/a/22406727
score: 0
type: Comment

http://stackoverflow.com/comment/34090992
has text: http://stackoverflow.com/questions/2740975/https-with-self-signed-ssl-certificate-issues-solution-or-better-way may be this will help to you. is that your ssl is self signed certificate?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22407784
type: AnswerComment

http://stackoverflow.com/q/22386399
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22386470
has title: Simplest example with py4J
type: Question
score: 15
upvote count: 15
accepted answer: http://stackoverflow.com/a/22386470
downvote count: 0
answer count: 1
has body: I installed py4J using pip on my conda virtual environment in Python. I wrote a super simple example AdditionApplication.java to test py4J, but it fails to compile, i.e. javac AdditionApplication.java fails complaining that GatewayServer is not defined. I am knowledgeable in Python but unfortunately not in Java. What else do I need to provide? public class AdditionApplication { public int addition(int first, int second) { return first + second; } public static void main(String[] args) { AdditionApplication app = new AdditionApplication(); // app is now the gateway.entry_point GatewayServer server = new GatewayServer(app); server.start(); } } In case it matters I have the following version of Java installed: java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode) Update 1 After I added: import py4j.GatewayServer; to the top of the file, I got a different error: package py4j does not exist Update 2 pip install py4j left a jar file under &lt;PATH_TO_CONDA_ENVIRONMENT&gt;/share/py4j/py4j0.8.1.jar. I have added it to my class path with: javac -cp &lt;PATH_TO_CONDA_ENVIRONMENT&gt;/share/py4j/py4j0.8.1.jar AdditionApplication.java and it output AdditionApplication.class How do I run it? Final update and solution: After applying the previous fixes, I finally run the code with: java -cp &lt;PATH_TO_CONDA_ENVIRONMENT&gt;/share/py4j/py4j0.8.1.jar AdditionApplication the code runs in the background. To test it: &gt;&gt;&gt; from py4j.java_gateway import JavaGateway &gt;&gt;&gt; gateway = JavaGateway() # connect to the JVM &gt;&gt;&gt; random = gateway.jvm.java.util.Random() # create a java.util.Random instance &gt;&gt;&gt; number1 = random.nextInt(10) # call the Random.nextInt method &gt;&gt;&gt; number2 = random.nextInt(10) &gt;&gt;&gt; print(number1,number2) (2, 7) &gt;&gt;&gt; addition_app = gateway.entry_point # get the AdditionApplication instance &gt;&gt;&gt; addition_app.ad…
has comment: http://stackoverflow.com/comment/119234034
favorite count: 0
has comment: http://stackoverflow.com/comment/94629329
tagged with: python
has comment: http://stackoverflow.com/comment/133499386
tagged with: py4j

http://stackoverflow.com/q/22415621
has title: Spring Hibernate getCurrentSession() delete not working
upvote count: 2
type: UnansweredQuestion
tagged with: spring
type: Question
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22415982
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has body: I am fully testing an entity on my unit test, and almost everything worked so far: create, update, list. However, when I try to delete a record, it is not getting deleted. Here is the code I am using: public void delete (Integer id) { // This doesnt work even though I know user is set and id is not null User user = find(id); getSession().delete(user); // This will work // Query query = getSession().createSQLQuery("DELETE FROM users WHERE id = " + id); // query.executeUpdate(); } private Session getSession() { if (session == null) { try { session = SessionFactoryUtils.getSession(sessionFactory, Boolean.TRUE); TransactionSynchronizationManager.bindResource(session.getSessionFactory(), new SessionHolder(session)); } catch (Exception e) { session = SessionFactoryUtils.getSession(sessionFactory, Boolean.FALSE); } } return session; } If I execute the query directly it works but using the delete() method doesnt. I think it may be related to committing the transaction but I already tried something like that and no luck. Any ideas?

http://stackoverflow.com/a/22485007
type: Answer
accepted answer of: http://stackoverflow.com/q/22484783
upvote count: 1
answers question: http://stackoverflow.com/q/22484783
has body: public MyObjectInfoService(ObjectInfo[] objectInfoArray, DIfferentService diffService) {...} or better yet public MyObjectInfoService(Map&lt;String, ObjectInfo&gt; objectInfoMap, DIfferentService diffService) {...} that way you can use keys to grab the required parts and error on any missing.
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34168111
has text: @Abraam Avoidance of exceptions shows the unwillingness to use Java standard practices. If you don't want an exception to propagate, catch and handle it.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22451662

http://stackoverflow.com/q/22388878
has body: I was wondering what is difference between those two? RuntimeBeanReference worked for me rather RuntimeBeanNameReference for the following scenario: GenericBeanDefinition bd = new GenericBeanDefinition(); bd.setBeanClassName(beanClassName); MutablePropertyValues pvs = new MutablePropertyValues(); pvs.add("dataSource", new RuntimeBeanReference(dataSourceBeanName)); bd.setPropertyValues(pvs);
downvote count: 0
answer count: 1
tagged with: javabeans
favorite count: 0
has title: RuntimeBeanNameReference vs RuntimeBeanReference
tagged with: spring
accepted answer: http://stackoverflow.com/a/22390074
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/22390074
type: Question
tagged with: java

http://stackoverflow.com/a/22339277
has comment: http://stackoverflow.com/comment/34000064
answers question: http://stackoverflow.com/q/22338802
downvote count: 0
has comment: http://stackoverflow.com/comment/33951760
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33951722
score: 2
has comment: http://stackoverflow.com/comment/34000027
has body: It's probably just me, but, these... FileOutputStream out = new FileOutputStream(file); bin = new int[23123123]; String[] hexChars = new String[bin.length * 2]; Seem weird to me. I don't know why you would be opening an OutputStream to a File which you've just opened an InputStream to...The int buffer seems overly large and the hexChars never need need to exceed 16 characters, not to mention the fact that you are completely ignore the int buffer anyway... Your try-catch is a little awkward to. Generally you should be providing a finally block which is used to close any resources, like streams, that you openeded, or your could use the try-with-resource feature introduced in Java 7... try (FileInputStream in = new FileInputStream(file)) {... Your file reading process also seems a little awkward, for example, the following seems overtly complicated... while (!done) { int next = in.read(); if (next == -1) { And could be reduced to... int next = -1; while ((next = in.read()) != -1) {... But that's a nit pick ;) You're not adding any new line characters to the text area nor are you taking into consideration the potential that the hexchars may contain a partial result when you finish reading the file. Since you are reading each int from the file one by one, a better solution might be to just convert each int to a hex value and append it to the JTextArea (or maybe a StringBuilder depending on your requirements) For example import java.awt.BorderLayout; import java.awt.EventQueue; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class HexViewer { public static void main(String[] args) { new HexViewer(); } public HexViewer() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.get…

http://stackoverflow.com/comment/34073082
comment on: http://stackoverflow.com/q/22409339
type: Comment
type: QuestionComment
has text: well i actually compiled the base/super class .java file before compiling the sub class .java file,, and i am compiling from the package root directory itself.
score: 0

task
type: Tag
tag name: task
tags question: http://stackoverflow.com/q/22469777

http://stackoverflow.com/comment/34365814
type: AnswerComment
has text: I've settled for a stage+camera for the UI elements (buttons, label, etc) with camera fixed to the device screen, and then the underlying balls drawn using sprite batch. Still getting 60fps with 10,000 sprites (small balls). Slight drop to about 55fps with 100,000 sprites, and complete drop to 9fps with 1,000,000 sprites. I won't be using numbers of sprites that big, so this method seems to work for me for now
type: Comment
comment on: http://stackoverflow.com/a/22384774
score: 0

http://stackoverflow.com/q/22468318
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/28050417
score: 5
tagged with: jpeg2000
tagged with: java
has body: I have downloaded this library and I am running the code below: import java.awt.image.BufferedImage; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream; import org.dcm4che3.imageio.plugins.dcm.DicomImageReadParam; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGImageEncoder; public class TestConverter { public static void main(String... x) throws IOException, Exception{ TestConverter.dicomToJpeg("C:\\Users\\xxxxx\\Desktop\\SCOUT\\IM-0001-0001.dcm"); } public static void dicomToJpeg(String args) throws IOException, Exception { // TODO Auto-generated method stub try { File myDicomFile = new File(args); BufferedImage myJpegImage = null; Iterator&lt;ImageReader&gt; iter = ImageIO.getImageReadersByFormatName("DICOM"); ImageReader reader = (ImageReader) iter.next(); DicomImageReadParam param = null; try{ param = (DicomImageReadParam) reader.getDefaultReadParam(); } catch (Exception e) { e.printStackTrace(); } ImageInputStream iis=ImageIO.createImageInputStream(myDicomFile); reader.setInput(iis, false); myJpegImage = reader.read(0, param); iis.close(); if (myJpegImage == null) { System.out.println("\nError: couldn't read dicom image!"); return; } File myJpegFile = new File("d:/demo.jpg"); OutputStream output = new BufferedOutputStream(new FileOutputStream(myJpegFile)); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(output); encoder.encode(myJpegImage); System.out.println("Image Create successufully"); output.close(); } catch(IOException e){ System.out.println("\nError: couldn't read dicom image!"+ e.getMessage()); return; } } } and getting following exception Exception in thread "main" java.lang.UnsatisfiedLinkError: com.sun.medialib.codec.jp2k.Decoder.decode_init(Ljavax/imageio/stream/ImageInputStream;J)J…
upvote count: 5
has title: Issue with DCIM to JPG converter
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26592181
answer count: 2

http://stackoverflow.com/a/54321351
has body: Similar Problem I had the same problem event though I was already using mockito in JUnit tests under src/test. Once I added tests under src/androidTest I started having issues, including this crash: Mockito cannot mock/spy because : - final class And after making the class open, manually, I still got crashes in the JNI layer as it tried to load the *.so library (which wouldn't happen if mocks were working properly). Working Solution Instead, what I had to do was open the class for testing purposes using Kotlin's all-open plugin. The process is also explained well in this recent medium post but it boils down to the following four simple changes that are also modeled in one of the architecture components sample apps: 1. Make these additions to build.gradle: buildscript { dependencies { classpath "org.jetbrains.kotlin:kotlin-allopen:${versions.kotlin}" } } apply plugin: "kotlin-allopen" allOpen { // marker for classes that we want to be able to extend in debug builds annotation 'com.your.package.name.OpenClass' } 2. Add the corresponding annotations in the debug flavor. For example: app/src/debug/java/com/your/package/name/OpenForTesting.kt package com.your.package.name @Target(AnnotationTarget.ANNOTATION_CLASS) annotation class OpenClass @OpenClass @Target(AnnotationTarget.CLASS) annotation class OpenForTesting 3. Add the corresponding annotation in the release flavor. For example: app/src/release/java/com/your/package/name/OpenForTesting.kt package com.your.package.name @Target(AnnotationTarget.CLASS) annotation class OpenForTesting 4. Add the @OpenForTesting annotation to the class that needs to be mocked package com.your.package.name @OpenForTesting class JniClassOfVictory { ... external fun nativeInit() ... companion object { init { System.loadLibrary("victoryeveryday") } } } The result is a flexible way to mark classes as open without actually making them open in release builds. Of course, this is because the @OpenForTesting annotation that we created in release …
type: Answer
answers question: http://stackoverflow.com/q/22447181
score: 0

http://stackoverflow.com/q/22384589
has answer: http://stackoverflow.com/a/22384897
type: UnansweredQuestion
has title: How to use java.util.GZIPOutputStream or any other to store multiple records as single file where each records are zipped individually?
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22384935
type: Question
answer count: 2
downvote count: 0
has body: How to use java.util.GZIPOutputStream or any other to store multiple records as single file where each records are zipped individually? That is required for seek file for individual record and unzip that only. I have read HBase doing same thing for hfile. But am getting problem with record wise zip in single file.
favorite count: 0

http://stackoverflow.com/comment/34084091
score: 0
comment on: http://stackoverflow.com/q/22415728
type: Comment
type: QuestionComment
has text: It will never print, unless you move that to a `System.out.println()`.

http://stackoverflow.com/comment/34192450
type: QuestionComment
has text: I agree but why is it getting appended by underscore (_) in Firefox and chrome. whereas in IE, its working fine with the name downloadPdfFrominvDmsViewLibraryLink.pdf
comment on: http://stackoverflow.com/q/22477273
score: 0
type: Comment

http://stackoverflow.com/comment/34601421
has text: You can give this a shot setting the properties in your code right before you call the library which executes the Axis call as these settings are set globally for the VM. Setting `-Djava.net.useSystemProxies=true` may also be helpful.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22661621
type: AnswerComment

http://stackoverflow.com/comment/34038884
comment on: http://stackoverflow.com/q/22389667
has text: Maybe [CodeReview](http://codereview.stackexchange.com/) is a better place for this kind of question.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/22365870
possible better answer: http://stackoverflow.com/a/22365961
tagged with: java
has answer: http://stackoverflow.com/a/22365961
has answer: http://stackoverflow.com/a/22365939
has title: Java objacts makenew object that override current object
has comment: http://stackoverflow.com/comment/33997982
type: Question
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22365939
has body: I have a class and I want something like this: public class MainClass{ . . . public makenew(){ this=new ClassName() } } so when I call makenew the object changes. Can I do this?
has comment: http://stackoverflow.com/comment/33998001
tagged with: object
has comment: http://stackoverflow.com/comment/33998004
type: AnsweredQuestion

http://stackoverflow.com/comment/34058387
type: Comment
comment on: http://stackoverflow.com/a/22401153
type: AnswerComment
score: 0
has text: Sorry it din't solve the issue, still I can at least give you a vote up for your suggestions...

http://stackoverflow.com/q/22451382
has answer: http://stackoverflow.com/a/22451504
upvote count: 1
favorite count: 0
has body: I have two entities, User and Event. Each event can have multiple users associated with it, so its a one to many between Event and User. The way its being stored in the database, is that I have 3 tables, user, event, and event_user. event_user contains 3 fields, id, eventId, userId. So I can do a query like select userId from event_user where eventId = ? to get all the users which are associated with the event. My question is, how can I map this relationship between the events and users in Hibernate, to get it to auto save/load the users associated with the event? I want to have the following field in the Event class: Set&lt;User&gt; users = new HashSet&lt;&gt;(); and have hibernate auto load / save the users to this set. How can I map this (using annotations)?
possible better answer: http://stackoverflow.com/a/22451504
type: AnsweredQuestion
has title: How to map one-to-many connection between two entities using a 3rd table, in Hibernate?
accepted answer: http://stackoverflow.com/a/22451546
has comment: http://stackoverflow.com/comment/34147133
score: 1
tagged with: java
tagged with: hibernate
tagged with: orm
tagged with: mysql
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22451546
downvote count: 0
has comment: http://stackoverflow.com/comment/34147102

http://stackoverflow.com/a/22417525
score: 0
answers question: http://stackoverflow.com/q/22417364
type: Answer
has body: As shoover pointed out the } for the if (args.length == 1) statement was in the wrong place. The new code is: @SuppressWarnings("deprecation") public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) { Player p = (Player) sender; if (cmd.getName().equalsIgnoreCase("jukebox")) { if (args.length == 0) { sender.sendMessage(ChatColor.GOLD + "** " + ChatColor.AQUA + "Jukebox version " + pdFile.getVersion() + ChatColor.GOLD + " **\n" + ChatColor.RED + "Usage: " + ChatColor.LIGHT_PURPLE + "/jukebox play (track)"); return true; } if (args.length == 1) { if (args[0].equalsIgnoreCase("play")) { String recordNames = "Stop, 13, Cat, Blocks, Chirp, Far, Mall, Mellohi, Stal, Strad, Ward, 11, Wait"; String regex = "\\[|\\]"; recordNames = recordNames.replaceAll(regex, ""); sender.sendMessage(ChatColor.AQUA + "Track selection: " + ChatColor.GREEN + recordNames + "\n" + ChatColor.AQUA + "Type " + ChatColor.LIGHT_PURPLE + "/jukebox play (track)" + ChatColor.AQUA + " to play a track."); return true; } } if (args.length &gt; 1 &amp;&amp; (args[0].equalsIgnoreCase("play"))) { if (args[1].equalsIgnoreCase("13")) { p.playEffect(p.getLocation(), Effect.RECORD_PLAY, 2256); sender.sendMessage(ChatColor.AQUA + "Now playing " + ChatColor.GREEN + "13" + ChatColor.AQUA + "."); return true; } else { sender.sendMessage(ChatColor.AQUA + "Please enter a valid track name."); return true; } } } return false;

http://stackoverflow.com/a/22340095
answers question: http://stackoverflow.com/q/22339713
score: 1
has body: You are getting "Missing return statement" because you don't have a return statement in switch-case. For ex: @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.settings: setSettings(); return true; case R.id.second: setColor(); return true; default: return super.onOptionsItemSelected(item); } }
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/79224110
answers question: http://stackoverflow.com/q/22416239
has body: For me, the only difference between both are that: With Setter you are not stuck with modifying the object in its instantiation. But you cant update immutable variables. With Builder you can modify Immutable objects after its Build. But you can modify the object just in its instantiation, as it returns Self.
has comment: http://stackoverflow.com/comment/139708971
has comment: http://stackoverflow.com/comment/139708491
type: Answer
has comment: http://stackoverflow.com/comment/139708553
has comment: http://stackoverflow.com/comment/139708786
has comment: http://stackoverflow.com/comment/139708824
has comment: http://stackoverflow.com/comment/139708537
has comment: http://stackoverflow.com/comment/139701994
score: 0

http://stackoverflow.com/comment/34192244
type: Comment
has text: @Bruno, @EJP, I'm trying whit this code: `if (in.readUTF().equalsIgnoreCase("private")) { SSLSession sslSession = sslsocket.getSession(); sslSession.invalidate(); sslsocket.setNeedClientAuth(true); [continue reading...] ` but I dont know how validate the session again after that.
comment on: http://stackoverflow.com/a/22462454
score: 0
type: AnswerComment

http://stackoverflow.com/a/22422124
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22422092
upvote count: 1
has body: split the String on all whitespace, which includes tabs: public static void read_doc_word(String line){ String[] tokens = line.split("\\s+"); System.out.println("Doc ID:" + tokens[0]); System.out.println("Word ID:" + tokens[1]); }
downvote count: 0

http://stackoverflow.com/q/22419395
has comment: http://stackoverflow.com/comment/34091741
type: Question
score: 0
has comment: http://stackoverflow.com/comment/34091085
tagged with: classnotfoundexception
answer count: 1
has body: I’m new using IntelliJ 13 and I have a problem on connection to MySQL. I’m using the code as below and this code I learn from tutorials Manage Your Database Scheme with IntelliJ IDEA 12. public class App { public static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; public static final String JDBC_URL = "jdbc:mysql://localhost/sample"; public static final String JDBC_USER = "root"; public static final String JDBC_PASSWORD = ""; public static void main (String[] args) throws SQLException, ClassNotFoundException { Statement statement = null; try{ Class.forName(JDBC_DRIVER); Connection connection = DriverManager.getConnection(JDBC_URL, JDBC_USER, JDBC_PASSWORD); statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery("select id, firstname, lastname, email " + "from customer"); System.out.println("First name\tLast name\tEmail"); int count = 0; while (resultSet.next()){ String firstname = resultSet.getString("firstname"); String lastname = resultSet.getString("lastname"); String email = resultSet.getString("email"); System.out.printf("%s\t%s\t%s%n", firstname, lastname, email); count++; } System.out.println("--"); System.out.println(MessageFormat.format("Rows: {0}", count)); } finally { if(statement != null){ statement.close(); } } } } I have tried many solution based on this issue on https://stackoverflow.com/ but nothing can solved my problem. It give error message like this Connection to MySQL – sample@localhost failed: Exception in thread “main” java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.f…
has answer: http://stackoverflow.com/a/22420191
has title: "ClassNotFoundException: com.mysql.jdbc.Driver"
type: UnansweredQuestion
tagged with: jdbc
tagged with: database-connection
has comment: http://stackoverflow.com/comment/34091818
tagged with: java

http://stackoverflow.com/comment/33962917
score: 0
has text: One can not spot this kind of problem without code. - So yes please post the code snippets.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22344916

http://stackoverflow.com/q/22442106
has comment: http://stackoverflow.com/comment/34131157
has answer: http://stackoverflow.com/a/22442328
answer count: 1
has comment: http://stackoverflow.com/comment/34131371
has title: unfortunately "name application" has stopped android eclipse
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/34131147
upvote count: 0
has body: Activity_main.xml &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" &gt; &lt;Button android:id="@+id/engadget" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Engadget" /&gt; &lt;/RelativeLayout&gt; bestblog.java package com.example.bestblog; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; public class bestblog extends Activity { Button button; @Override public void onCreate(Bundle saveInstanceState) { super.onCreate(saveInstanceState); setContentView(R.layout.activity_main); addListemerOnButton(); } private void addListemerOnButton() { button = (Button) findViewById(R.id.engadget); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.engadget.com")); startActivity(browserIntent); } }); } } If I use a Android Simulator to run my application, I get a error message. I don't know how to fix it, I get this error message "unfortunately "name application" has stopped".
tagged with: java
tagged with: eclipse
type: Question
score: -2
downvote count: 2

http://stackoverflow.com/comment/34194270
has text: @eis I'm not 100% sure, I think I got the wining lottery ticket on OpenJDK 7 and Oracle Java 7, where hundreds of builds extensively testing order and Cassandra queries relying on that order passed with 100% success rate. The project in question features automagical CQL 3 schema generation directly from Scala code. Advanced CQL features rely on fields to be collected in the order they are written. Anyway, looks like I have to re-think the automagical.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22406222

http://stackoverflow.com/a/22341906
score: 0
answers question: http://stackoverflow.com/q/22341822
type: Answer
has body: User anubhava has answered your question, but in the future http://regexpal.com/ is very helpful when regexing. I use it all the time as a tool, though there are many options. Helps with trial and error :) Good luck, happy coding

remote-server
tags question: http://stackoverflow.com/q/22351552
tag name: remote-server
type: Tag

http://stackoverflow.com/comment/34139218
type: QuestionComment
has text: @Raghunandan I have mentioned that too! It would disturb flow of method logic. Also, due to lack of proper closures in Java, I can't freely access variables outside the scope of callback. I've edited the question to show what exactly I am trying to port from C# to Java. Code samples are welcome.
score: 0
comment on: http://stackoverflow.com/q/22446452
type: Comment

http://stackoverflow.com/a/22493981
accepted answer of: http://stackoverflow.com/q/22483744
type: Answer
answers question: http://stackoverflow.com/q/22483744
score: 0
type: AcceptedAnswer
has body: In the toResponse method, I changed this return exception.getResponse(); to this return Response.status(exception.getResponse().getStatus()) .entity(exception.getMessage()) .build(); The problem is the when I do this: throw new BadRequestException("Something is wrong!"); it doesn't populate the exception's Response's body with "Something is wrong!". GlassFish sees that the response body is empty and its status code is an error code, so it inserts its own response body. By populating the response body (a.k.a. entity) in the provider, this problem goes away.

gson
tags question: http://stackoverflow.com/q/22428630
tags question: http://stackoverflow.com/q/22400470
tags question: http://stackoverflow.com/q/22487288
tags question: http://stackoverflow.com/q/22469284
tags question: http://stackoverflow.com/q/22378885
tags question: http://stackoverflow.com/q/22449732
tags question: http://stackoverflow.com/q/22441134
tag name: gson
tags question: http://stackoverflow.com/q/22446091
tags question: http://stackoverflow.com/q/22417380
tags question: http://stackoverflow.com/q/22350015
tags question: http://stackoverflow.com/q/22451672
tags question: http://stackoverflow.com/q/22360346
tags question: http://stackoverflow.com/q/22358243
tags question: http://stackoverflow.com/q/22343238
tags question: http://stackoverflow.com/q/22439665
type: Tag

http://stackoverflow.com/a/22331623
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22331474
answers question: http://stackoverflow.com/q/22331474
has body: A servlet is a Servlet. A @Controller annotation references the concept of a controller, and is independent of javax.servlet.Servlet. The Spring documentation is quite clear (emphasis mine): The @Controller annotation indicates that a particular class serves the role of a controller. Spring does not require you to extend any controller base class or reference the Servlet API. However, you can still reference Servlet-specific features if you need to. From that, the answer to your title question is: No. (Also you asked about "all controllers in Java", but note that Spring != all of Java.) Your question about "other methods to implement request/response" is too vague to answer. There are infinite ways to implement anything. You could write a raw HTTP server in Java if you'd like. You could use a different protocol than HTTP entirely. You could do something not network based at all if that was part of your requirements. You could use a different language / framework that isn't Java. Be more specific.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34022805
upvote count: 2

http://stackoverflow.com/q/22442028
has title: Inheriting Servlet instead of using filters
tagged with: filter
linked to: http://stackoverflow.com/q/2957165
answer count: 0
has body: By reading this answer, I noted that the given exemple : public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException { if (((HttpServletRequest) request).getSession().getAttribute("user") == null) { // User is not logged in. Redirect to login page. ((HttpServletResponse) response).sendRedirect("login"); } else { // User is logged in. Just continue with request. chain.doFilter(request, response); } } make us having to write in web.xml something like : RestrictionFilter com.myproject.filters.RestrictionFilter RestrictionFilter /restrained/* But I want to be totally free to choose which url have to be restrained to loged members (it's a bit annoying to specify, for each url-pattern, the filter which have to be activated). I used to create a Servlet who inherits HttpServlet and surcharges service() in order to check if the session contains a member instance, and then, calls the "true" service() method : public abstract class MembreHttpServletProjet1 extends HttpServlet{ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{ if(req.getSession().getAttribute("membre") == null){ resp.sendRedirect(req.getContextPath() + "/accueil"); return; } super.service(req, resp); } } By this way, if a servlet needs to be used only if the user is loged as a member, I make inherit this servlet by MembreHttpServletProjet1. Is this way wrong ? I understood the utility of filters in some case but I still confused for this exemple. Thank you.
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/34169947
tagged with: servlet-filters
tagged with: jakarta-ee
tagged with: java
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/34134649

http://stackoverflow.com/a/22330181
score: 0
has body: To avoid 0 you must add 1 to nextInt output (it starts from 0). You can mark the most consecutive numbers during array population. Something like int length=1; int defLength=0; int startIdx=0; int defStartIdx=0; int endIdx=0; int defEndIdx=0; // Needed in order not to override start index boolean found = false; if(efs[i] == efs[i-1]) { ++length; if(!found) { startIdx=i-1; found = true; } } else { if(found) { endIdx=i-1; found=false; } if(defLength &lt; length) { defEndIdx = endIdx; defStartIdx = startIdx; found = false; } } Then you need a print method to put your parenthesis before printing efs[defStartIdx] and before efs[defEndIdx]
type: Answer
accepted answer of: http://stackoverflow.com/q/22329765
answers question: http://stackoverflow.com/q/22329765
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33980651

http://stackoverflow.com/q/22419127
has answer: http://stackoverflow.com/a/22419175
favorite count: 0
has comment: http://stackoverflow.com/comment/34091808
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34090209
upvote count: 3
tagged with: java
downvote count: 3
has body: Can anyone please help me with this output- a-=(a--)-(--a) when the initial value of a is 6. The answer upon execution is coming to 4 but according to me it should be -4. I would appreciate it if you could show me step-by-step.
accepted answer: http://stackoverflow.com/a/22419175
tagged with: output
has answer: http://stackoverflow.com/a/22419171
has comment: http://stackoverflow.com/comment/34090244
type: Question
has title: Please explain "a-=(a--)-(--a)"
has comment: http://stackoverflow.com/comment/34091786
has comment: http://stackoverflow.com/comment/34091750
possible better answer: http://stackoverflow.com/a/22419181
score: 0
has answer: http://stackoverflow.com/a/22419181
answer count: 3

http://stackoverflow.com/comment/34137117
type: Comment
type: QuestionComment
has text: Please post the exact error. I suspect it's complaining about `Post`, not `post`.
score: 0
comment on: http://stackoverflow.com/q/22445262

http://stackoverflow.com/q/22443151
has answer: http://stackoverflow.com/a/22443169
has comment: http://stackoverflow.com/comment/34133057
has body: Say that I have an shoeCollection class that has both the shoe size and the shoe brand. how do I modify the comparator such that it will sort the priorityQueue based on shoe size? I know that priority queues already have a build-in comparator, but since my object is not an Integer or Double, I figured I need to write my own. This is my comparator right now static class ShoeComparator implements Comparator&lt;shoes&gt; { @Override public int compare(shoes x, shoes y) { if(x.getID() &gt; y.getID()){ return 1; } if(x.getID() &lt; y.getID()){ return -1; } return 0; } } I then declare a new Shoe priority queue with the following private static Comparator&lt;shoes&gt; comparator = new shoeComparator(); private static PriorityQueue&lt;shoes&gt; list = new PriorityQueue&lt;shoes&gt;(10001, comparator); I tried adding some shoes and see how it will turn out list.add(new shoes(56.0, "Nike")); list.add(new shoes(47.0, "Addidas")); list.add(new shoes(93.0, "Puma")); list.add(new shoes(3.0, "Vans")); Test it in Main for(int i = 0; i &lt; list.size(); i++){ System.out.println(list.poll().getID()); } //3.0 47.0 Only ID with 3.0 and 47.0 has been registered. Is there something wrong with my Comparator? It seems like it will only return the first 2 ID and ignore the rest, but when I call upon list.size() it returns 4, which is correct. I can't locate the problem.
tagged with: java
has comment: http://stackoverflow.com/comment/134847487
has title: Java PriorityQueue comparator
type: Question
answer count: 2
score: -3
downvote count: 4
has answer: http://stackoverflow.com/a/61035896
favorite count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/27533102
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22430731
has body: public class MainActivity extends ActionBarActivity Change this to: public class MainActivity extends Activity

http://stackoverflow.com/a/22919387
has comment: http://stackoverflow.com/comment/35021494
has comment: http://stackoverflow.com/comment/35021515
has comment: http://stackoverflow.com/comment/35013640
has comment: http://stackoverflow.com/comment/35007756
has comment: http://stackoverflow.com/comment/35010039
has comment: http://stackoverflow.com/comment/35017911
has comment: http://stackoverflow.com/comment/35011471
has comment: http://stackoverflow.com/comment/35010494
has comment: http://stackoverflow.com/comment/35010211
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/35015453
has comment: http://stackoverflow.com/comment/35012486
has comment: http://stackoverflow.com/comment/35007420
type: Answer
has comment: http://stackoverflow.com/comment/35015424
has comment: http://stackoverflow.com/comment/129037228
has comment: http://stackoverflow.com/comment/35049193
accepted answer of: http://stackoverflow.com/q/22353445
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/35009563
has comment: http://stackoverflow.com/comment/35015037
has comment: http://stackoverflow.com/comment/35044680
has body: Looks like it is expected behavior. If you look at the javadoc for ModularRealmAuthenticator: * @throws AuthenticationException if the user could not be authenticated or the user is denied authentication * for the given principal and credentials. */ protected AuthenticationInfo doAuthenticate(AuthenticationToken authenticationToken) throws AuthenticationException { If you are having problems with the exception, you might need to change the code that calls the authentication to expect this exception. Left for other searches: You might have a missing supports method in your TokenAuthorizingRealm class. Something like @Override public boolean supports(AuthenticationToken token) { return token instanceof BearerAuthenticationToken; } should be present.
has comment: http://stackoverflow.com/comment/35008975
answers question: http://stackoverflow.com/q/22353445
has comment: http://stackoverflow.com/comment/35007145

http://stackoverflow.com/comment/33999003
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22366477
has text: You can use `strtol()` to parse strings into integers.

http://stackoverflow.com/comment/34046657
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22394193
has text: I know that the example stated above is meaningless, but thats just an example.
score: 0

http://stackoverflow.com/comment/34923662
comment on: http://stackoverflow.com/q/22353445
score: 0
type: Comment
has text: Can you share your realms doGetAuthenticationInfo implementation and how you call login with us?
type: QuestionComment

http://stackoverflow.com/comment/34069563
type: QuestionComment
comment on: http://stackoverflow.com/q/22407945
score: 7
has text: The answer is don't. Never have dependencies from parent classes to their child classes.
type: Comment

http://stackoverflow.com/a/22431140
answers question: http://stackoverflow.com/q/22431127
downvote count: 0
type: Answer
has body: The only difference that I know of is if you declare the variable in a local scope and not in class scope, the compiler will complain if you try to use the variable before some initialization for the latter. Otherwise there is no difference that I know.
score: 2
upvote count: 2

http://stackoverflow.com/q/22356581
tagged with: java
tagged with: hibernate
type: Question
has body: I have a service, which uses multiple DAOs to do a unit of work like following. The DAOs fetch the data/save by creating a session and commit. In that case, why do i need to have transactional on the service when the dao is managing the session by itself? If something goes wrong in the second DAO, the data in the first DAO is already commited, how do I get around this situation? @Transactional public boolean testService(SomeObject obj){ userDao.save(obj.getUser()); // this dao gets the session from sessino factory and commits there itself. addressDao.save(obj.getAddress()); // something fails here, and the above line has already commited the data, so the data is not Atomic. return true; }
tagged with: spring-transactions
score: 0
has answer: http://stackoverflow.com/a/22356633
answer count: 1
has title: Proper way to use @Transactional on a service
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22356633

http://stackoverflow.com/comment/34003939
has text: I have tried that but still does not work. in fact what is in this code almost like what is in my code. I guess the problem is in how the client receive the message from the server the code in the client how we can we make the client accept the message from server.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22368134

http://stackoverflow.com/a/22354799
answers question: http://stackoverflow.com/q/22353273
score: 0
has comment: http://stackoverflow.com/comment/34004654
has body: There are a number of Docs on the EclipseLink site that go into more detail on its caching and how it works. I'd suggest you check out https://www.eclipse.org/eclipselink/documentation/2.4/concepts/cache001.htm and https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Caching/Configuring first and then ask your specific questions, and there are many reasons why something might be in the cache on one day and not on the next depending on the settings. By default, the shared L2 cache uses as soft cache and weak identity map references, so objects no longer referenced by the application can be garbage collected.
type: Answer

http://stackoverflow.com/a/22447097
answers question: http://stackoverflow.com/q/22386497
has body: Your URL is broken, you added a space after comma after the latitude coordinate. If you would like to abstract the places API processing, I recently developed a library in Java that is a 1 to 1 mapping of the Place API. Getting nearby restaurants is as easy as. GooglePlaces client = new GooglePlaces("apiKey"); List&lt;Place&gt; places = client.getNearbyPlaces(lat, lng, GooglePlaces.MAXIMUM_RESULTS, Param.name("types").value("restaurant")); for (Place place : places) { System.out.println(place.getName()); } https://github.com/windy1/google-places-api-java
score: 0
type: Answer

http://stackoverflow.com/a/32405311
score: 0
type: Answer
has body: The problem is the package name of the button. Check the comments here: Error inflating class com.facebook.widget.LoginButton with Facebook SDK 4.0.1
answers question: http://stackoverflow.com/q/22337895

http://stackoverflow.com/a/22362160
has body: The ObjectInputStream waits for an incoming header. Until the header is completly received you will be stuck at this line: ObjectInputStream in = new ObjectInputStream(socket.getInputStream()); to solve this problem you need to invoke flush() on the ObjectOutputStream on the other side (i.e. the server) as soon as the connection is established. For more information read the javadoc.
accepted answer of: http://stackoverflow.com/q/22361951
upvote count: 7
answers question: http://stackoverflow.com/q/22361951
score: 7
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/133982246

http://stackoverflow.com/a/22338566
answers question: http://stackoverflow.com/q/22338173
has body: If a camera app crashes, it can lock up the camera hardware, preventing it from being used again until the device is rebooted. Hence, if you run into "cannot open camera" and similar sorts of messages, try rebooting the device to see if the problem clears up.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/22338173
upvote count: 1

hadoop
tags question: http://stackoverflow.com/q/22400137
tags question: http://stackoverflow.com/q/22359552
tags question: http://stackoverflow.com/q/22462665
tags question: http://stackoverflow.com/q/22431984
tag name: hadoop
tags question: http://stackoverflow.com/q/22487688
tags question: http://stackoverflow.com/q/22384689
tags question: http://stackoverflow.com/q/22430866
tags question: http://stackoverflow.com/q/22408931
type: Tag
tags question: http://stackoverflow.com/q/22336194
tags question: http://stackoverflow.com/q/22421988
tags question: http://stackoverflow.com/q/22441669
tags question: http://stackoverflow.com/q/22351547
tags question: http://stackoverflow.com/q/22419915
tags question: http://stackoverflow.com/q/22476852
tags question: http://stackoverflow.com/q/22409103
tags question: http://stackoverflow.com/q/22415022
tags question: http://stackoverflow.com/q/22467370
tags question: http://stackoverflow.com/q/22357561
tags question: http://stackoverflow.com/q/22471053
tags question: http://stackoverflow.com/q/22412423
tags question: http://stackoverflow.com/q/22379379
tags question: http://stackoverflow.com/q/22462404
tags question: http://stackoverflow.com/q/22463163
tags question: http://stackoverflow.com/q/22434072
tags question: http://stackoverflow.com/q/22414249
tags question: http://stackoverflow.com/q/22406490
tags question: http://stackoverflow.com/q/22467704
tags question: http://stackoverflow.com/q/22356079
tags question: http://stackoverflow.com/q/22464537
tags question: http://stackoverflow.com/q/22452642

http://stackoverflow.com/comment/34055729
comment on: http://stackoverflow.com/q/22399215
score: 0
type: Comment
type: QuestionComment
has text: In your case where the repository does not implement an interface, you will need to have CGLIB on the classpath in order for Spring to be able to handle transactions for it

http://stackoverflow.com/q/22453259
linked to: http://stackoverflow.com/q/2849102
tagged with: java
linked to: http://stackoverflow.com/q/16910503
type: Question
has title: POI - Importing new fonts to the POI
answer count: 2
score: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34151718
has body: How can i import a new font to POI API with extensions ttf &amp; otf , without install these fonts into the environment ? Is there a jar that i should update it with the path of the new font ?
has answer: http://stackoverflow.com/a/54297905
has answer: http://stackoverflow.com/a/22453696
has comment: http://stackoverflow.com/comment/34158938
tagged with: apache-poi
upvote count: 2
has comment: http://stackoverflow.com/comment/34158572
type: UnansweredQuestion

http://stackoverflow.com/a/22387689
type: Answer
score: 3
downvote count: 0
has body: As the Java tutorial on Thread interruption here states It's up to the programmer to decide exactly how a thread responds to an interrupt, but it is very common for the thread to terminate. You have not specifically done anything to handle interruption so nothing happens when you invoke y.interrupt();
has comment: http://stackoverflow.com/comment/34035075
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22387608
answers question: http://stackoverflow.com/q/22387608
has comment: http://stackoverflow.com/comment/34035109

http://stackoverflow.com/comment/34106233
score: 1
has text: @swiftsly yes, you could use a `HashMap` storing the player's name & location `Map<String,Location>`, then, when they type the command, use `map.get(player.getName())`, which will return the location from the map, then, get the `X` and `Z` coords of the location, if `player.getLocation().getX() <= mapLocation.getX() - 65 || player.getLocation.getX() >= mapLocation.getX() + 65`, then do the same for the X coord
comment on: http://stackoverflow.com/a/22419245
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34388087
has text: @chris when you are using the debugger, it changes the order of evaluation slightly because you are doing things like displaying the contents of variables. Also if the field is being initialised by another thread, you can get very different order of execution with a debugger.
comment on: http://stackoverflow.com/a/22475885
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22407994
possible better answer: http://stackoverflow.com/a/22408807
tagged with: java
tagged with: jax-ws
tagged with: authentication
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34183551
tagged with: webservice-client
downvote count: 0
has title: JAX WS client cannot authenticate
favorite count: 0
has comment: http://stackoverflow.com/comment/34070438
has answer: http://stackoverflow.com/a/22414394
has answer: http://stackoverflow.com/a/22408807
has comment: http://stackoverflow.com/comment/34070736
tagged with: web-services
score: 11
has comment: http://stackoverflow.com/comment/34235721
upvote count: 11
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22414394
has comment: http://stackoverflow.com/comment/34070363
has body: I'm trying to consume a secure (HTTPS schema) web-service with help of standard JAVA 7 JAX WS tools. This web-service requires authentication. I have already successfully added certificate to my local java keystore. All needed classes I've generated from WSDL file with help of wsimport tool. Now I am trying to use the following call to run a simple test: public class ReportingWebServiceTest { static ReportingServiceService service; static ReportingService port; @BeforeClass public static void setUpBeforeClass(){ service = new ReportingServiceService(); port = service.getReportingServicePort(); Map&lt;String, Object&gt; rContext = ((BindingProvider) port).getRequestContext(); Map&lt;String, List&lt;String&gt;&gt; headers = new HashMap&lt;String, List&lt;String&gt;&gt;(); headers.put("Authorization", Collections.singletonList("Basic YWRtaW5AYWRhcHRsb2dpYy5jb206MTIxMjE****=")); // headers.put("Username", Collections.singletonList("*****@******.com")); // headers.put("Password", Collections.singletonList("********")); rContext.put(MessageContext.HTTP_REQUEST_HEADERS, headers); // rContext.put(BindingProvider.USERNAME_PROPERTY, "*****@******.com"); // rContext.put(BindingProvider.PASSWORD_PROPERTY, "********"); } @Test public void test() { WEBCAMPAIGNROW row = port.getCampaignRowById(14081); toConsole(row.toString()); } protected static void toConsole(String msg) { System.out.println(msg); } } When I run the test it gives me following exception: javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://reporting-stage.admp.mtv3.adtlgc.com/admp/ReportingService?wsdl. It failed with: Got Server returned HTTP response code: 401 for URL: https://reporting-stage.admp.mtv3.adtlgc.com/admp/ReportingService?wsdl while opening stream from https://reporting-stage.admp.mtv3.adtlgc.com/admp/ReportingService?wsdl. at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:173) at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse…

http://stackoverflow.com/comment/33944006
score: 0
type: Comment
type: QuestionComment
has text: If it's crashing then post `logcat` output.
comment on: http://stackoverflow.com/q/22335410

http://stackoverflow.com/comment/34161057
has text: If the reading code gets stuck the fault is probably in the sending code. Post it. NB you don't need to read entire files into memory just to send them.
comment on: http://stackoverflow.com/q/22457495
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22416769
tagged with: exception
possible better answer: http://stackoverflow.com/a/22416820
has comment: http://stackoverflow.com/comment/34085845
has body: Why does this cause me to get stuck in an endless loop when the initial choice is invalid? while (true) { System.out.print("Choice:\t"); try { int choice = scanner.nextInt(); break; } catch (InputMismatchException e) { System.out.println("Invalid Input!"); } } Output: Choice: df Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input! Choice: Invalid Input!
has answer: http://stackoverflow.com/a/22416820
type: AnsweredQuestion
score: 2
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/34085814
upvote count: 2
tagged with: java
has title: Why am I getting an input Invalid Infinite Loop?
type: Question
tagged with: infinite-loop
has answer: http://stackoverflow.com/a/22416823
tagged with: inputmismatchexception
answer count: 3
has answer: http://stackoverflow.com/a/22416813
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34085854
accepted answer: http://stackoverflow.com/a/22416813

http://stackoverflow.com/a/22371027
score: 0
type: Answer
has body: One way to do it is by using Stringbuilder String builder(StringBuilder has overloaded methods for char and Sting). StringBuilder str= new StringBuilder(); str.append('\n'); or str.append("\n");
answers question: http://stackoverflow.com/q/22370716

http://stackoverflow.com/q/22379630
tagged with: java
has answer: http://stackoverflow.com/a/22379976
type: Question
has answer: http://stackoverflow.com/a/22383898
answer count: 2
tagged with: ant
score: 0
has body: I'd really tough time understanding what went wrong. Beginning with this, I've an interface like this... public interface UserRecordsInterface { public abstract List getRecordsVector() throws UserExitException; } I wanted to implement this interface in my class MyRecordsClass.java like this... public class MyRecordsClass implements UserRecordsInterface{ private List addendaRecs = null; /** * Return the list of addenda records * * @return List */ public List getRecordsVector() { return addendaRecs; } } While compiling using ant, I got 2 errors.. 1 Class MyRecordsClass is not abstract and does not override the abstract method getRecordsVector() in UserRecordInterface. 2 getRecordsVector() in MyRecordsClass cannot implement getRecordsVector() in UserRecordsInterface; attempting to use incompatible return type. - [javac] found : java.util.List - [javac] required: java.util.Vector - [javac] public List getRecordsVector() { Initially, the method getRecordsVector() had return type Vector in the interface. Now, it was changed to List. So, I've changed accordingly in my class. Now, its giving this error. If I change my class to Vector &amp; compile, then its working fine. But I want to use List, because thats what currently the interface has. So, I believe that ant is still pointed to the old lib that has vector interface. Not sure, if this is some problem with ant or with my code. Please suggest..
has comment: http://stackoverflow.com/comment/34020511
type: UnansweredQuestion
has title: Compile Errors with ant
linked to: http://stackoverflow.com/q/641536

http://stackoverflow.com/a/22411004
score: 0
has body: You are comparing checkArray[i] == letter and if true replacing checkArray[i] by letter, but they are already equal. You need to pass the word that you are checking. public static char[] checkMethod(char[] checkArray, char[] wordArray, char letter) { boolean flag = false; for(int i=0; i&lt;checkArray.length; i++) { if(wordArray[i] == letter) { checkArray[i] = letter; flag = true; } } if(flag == true) System.out.println("Good job!"); else System.out.println("Aww.. Try again"); return checkArray; }
answers question: http://stackoverflow.com/q/22410901
type: Answer

http://stackoverflow.com/a/22351652
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22351536
accepted answer of: http://stackoverflow.com/q/22351536
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33972820
has comment: http://stackoverflow.com/comment/33972719
has body: I wanna know that size of char array is 1000 so why does read method returns -1 second time. Because the input stream contains no more characters to read. Note that if there were a second read, you would overwrite the contents already read into the array. And your javadoc points to the wrong method. You use the read() method taking a char[] as an argument. A CharBuffer is not a char[]! Finally (and you have asked a question about such a subject recently and I have already told you that), you should specify the encoding you are using for both reading the file and writing to the file.
type: Answer
has comment: http://stackoverflow.com/comment/33972548
has comment: http://stackoverflow.com/comment/33972651

http://stackoverflow.com/q/22351820
tagged with: java
has comment: http://stackoverflow.com/comment/33974813
linked to: http://stackoverflow.com/q/44373453
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/44377369
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/61813897
has title: html email with reference to an image as base64 String
favorite count: 0
has body: I would like to send an email with the Java Mail API (javax.mail). The message must contain html and inside there is a reference to an image. There is a challenge, because no reference to a physical file on disk is allowed but instead I have created a base64 string (http://www.base64-image.de/step-1.php) for that image and copied that data to a static String variable. With javax.mail I build a message of type MulitPart with two parts. The first part is the html itself and the second part is the image. The html part reference to the image via . Message msg = new MimeMessage(session); Multipart multipart = new MimeMultipart("related"); BodyPart htmlPart = new MimeBodyPart(); htmlPart.setContent(" A title Some text in here " + " some more text ", "text/html"); multipart.addBodyPart(htmlPart); public static final String base64logo = "/9j/4AAQSkZJRgABAQEASABIAAD/4QBe…"; // ein ganz langer String erzeugt über http://www.base64-image.de/step-1.php sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder(); byte[] imageByte = decoder.decodeBuffer(base64logo); InternetHeaders header = new InternetHeaders(); BodyPart imgPart=new MimeBodyPart(header, imageByte); imgPart.setHeader("Content-ID","the-img-1"); imgPart.setDisposition(MimeBodyPart.INLINE); multipart.addBodyPart(imgPart); msg.setContent(multipart); Unfortunately the image is missing in the incoming email. When I point to the file on my disk it is working: DataSource ds=new FileDataSource("c:/temp/image001.jpg"); imgPart.setDataHandler(new DataHandler(ds)); We are developing with Talend and we cannot reference to external files because that would make the deployment process more complicate. Can you find some wrong doings in my approach? Kind regards Hilderich
has answer: http://stackoverflow.com/a/29030208
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33978433
score: 2
downvote count: 0

http://stackoverflow.com/a/22386548
type: Answer
has body: Choose Window/Preferences/Java/Compiler to see default configuration of your IDE. Check the project properties as well to be sure you do not have per-project configuration differ from default.
answers question: http://stackoverflow.com/q/22386495
score: 0

joptionpane
tags question: http://stackoverflow.com/q/22464317
tags question: http://stackoverflow.com/q/22426813
tags question: http://stackoverflow.com/q/22398915
type: Tag
tags question: http://stackoverflow.com/q/22351137
tags question: http://stackoverflow.com/q/22417113
tag name: joptionpane
tags question: http://stackoverflow.com/q/22396891
tags question: http://stackoverflow.com/q/22342966
tags question: http://stackoverflow.com/q/22395751

http://stackoverflow.com/q/22398116
has comment: http://stackoverflow.com/comment/34053199
tagged with: eclipse
has answer: http://stackoverflow.com/a/23895562
has answer: http://stackoverflow.com/a/22398264
type: Question
has comment: http://stackoverflow.com/comment/34102568
downvote count: 0
has comment: http://stackoverflow.com/comment/34054019
has body: I came to my home after a while and I found out my eclipse won't launch the Android SDK (it will launch the loading bar but then nothing pops) , I tried everything I think, upgrade java &amp; also copy its program files to another location and change system Variables (for certainty) change find_java.bat in the sdk folder download and install the adt-bundle-windows again copy the SDK Manager.exe in the SDK folder I tried of course to open SDK Manager.exe alone and it won't open unless I run it as an admin. So I changed to run always as admin still nothing at eclipse running, still the same. I see at the properties security tab of the Android SDK everything checked . Could you please find me a solution to open SDK Manager.exe from eclipse , thanks in advance. EDIT Also to note that the eclipse Console has this :
tagged with: sdk
answer count: 3
tagged with: android
linked to: http://stackoverflow.com/q/22215958
tagged with: windows
has title: Android SDK wont't be launched from eclipse
favorite count: 0
has comment: http://stackoverflow.com/comment/34053045
has comment: http://stackoverflow.com/comment/34053558
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/8593940
has answer: http://stackoverflow.com/a/22398294
score: 1
tagged with: java

http://stackoverflow.com/comment/34039819
type: QuestionComment
comment on: http://stackoverflow.com/q/22389953
has text: No, .flush after .commit leads to exception.
score: 1
type: Comment

http://stackoverflow.com/a/22465732
score: 1
answers question: http://stackoverflow.com/q/22465618
type: AcceptedAnswer
downvote count: 0
has body: Instead of: new JsonArray().add("test").add(1234) .add("test2").add(9594) .add("test6").add("down") which creates one array of 6 elements, you should: // new array, new JsonArray() // add a new 2-element array in it, .add(new JsonArray().add("test").add(1234)) // add a new 2-element array in it, .add(new JsonArray().add("test2").add(9594)) // add a new 2-element array in it .add(new JsonArray().add("test6").add("down"))
has comment: http://stackoverflow.com/comment/34172622
type: Answer
accepted answer of: http://stackoverflow.com/q/22465618
upvote count: 1
has comment: http://stackoverflow.com/comment/34172700
has comment: http://stackoverflow.com/comment/34172805

http://stackoverflow.com/comment/33933904
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22329253
score: 1
has text: DISPOSE_ON_CLOSE should be HIDE or NOTHING by using WindowListener, inside desired event should be called setVisible(false)

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/22338012
tags question: http://stackoverflow.com/q/22471593
type: Tag

http://stackoverflow.com/q/22394326
has comment: http://stackoverflow.com/comment/34047048
has title: receiving FileNotFoundException even though throws statement is present
score: 0
has body: I have written the following code that prints a list of randomly generated characters to a file, then reads them from a file, encrypts them using an exclusive or, and then prints them again. The issue is that I am receiving a FileNotFoundException even though I have placed it in a throws statement. /** * @param args the command line arguments */ public static void main(String[] args) throws FileNotFoundException { //get integer mask from user input int mask = getMask(); System.out.println("TEMP mask Value is: " + mask); //create 50 character random String and save to file String randomString = getRandomString(50); System.out.println("Original Random Character String: " + '\n' + randomString); //save 50 Char String from file Scanner keyboard = new Scanner(System.in); System.out.println("Saving encrypted string..."); System.out.print("Enter a file name: "); String fileName = keyboard.next(); File outputFile = new File(fileName); saveFile(fileName, randomString); /*System.out.println("Saving Original Random Character string..."); Scanner keyboard = new Scanner(System.in); System.out.print("Enter a file name: "); String fileName = keyboard.next(); File outputFile = new File(fileName); PrintWriter fileWriter = new PrintWriter(outputFile); fileWriter.println(randomString); fileWriter.close();//CLOSE OF FILEWRITER */ //scan in from file Scanner file = new Scanner(outputFile); String inputString = file.nextLine(); //print what was just scanned in from file System.out.print("Original random character string from the file" + '\n' + inputString + '\n'); //apply mask by convertig String to char using loop String maskedString = maskString(inputString, mask); System.out.print("Encrypted character string: " + '\n' + maskedString + '\n'); /*String maskedString = ""; for(int i = 0; i &lt; inputString.length(); i++){ char charMasked = (char)(((int) inputString.charAt(i))^mask); maskedString += charMasked; }//end of for loop System.out.print("Encrypted character string: " + '\n' + mas…
possible better answer: http://stackoverflow.com/a/22394375
answer count: 3
accepted answer: http://stackoverflow.com/a/22394369
tagged with: exception
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22394497
type: Question
tagged with: filenotfoundexception
has comment: http://stackoverflow.com/comment/34047083
has answer: http://stackoverflow.com/a/22394375
has answer: http://stackoverflow.com/a/22394369
tagged with: java

http://stackoverflow.com/q/22473833
type: UnansweredQuestion
tagged with: swt
upvote count: 1
downvote count: 1
tagged with: java
tagged with: eclipse
type: Question
tagged with: outlook
answer count: 1
tagged with: jsp
score: 0
has body: I need to create a jsp page with a button - when clicked, it opens the New E-mail window in outlook with 'To', 'Subject', and 'Body' fields populated. I am implementing this via servlet, so when user clicks the button, the servlet is called and the following code is called from doGet() of the servlet class. This works fine when I try to tested it as an independent java application, and the new message window opens perfectly. But when I try to open it via the jsp form, I am getting the exception. Exception : java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Display I have included the following jars : org.eclipse.swt.win32.win32.x86_3.7.0.v3735b.jar org.eclipse.core.commands_3.6.0.I20110111-0800.jar Code referred from : http://www.vogella.com/tutorials/EclipseMicrosoftIntegration/article.html Code : Display display = Display.getCurrent(); Shell shell = new Shell(display); OleFrame frame = new OleFrame(shell, SWT.NONE); // This should start outlook if it is not running yet OleClientSite site = new OleClientSite(frame, SWT.NONE, "OVCtl.OVCtl"); site.doVerb(OLE.OLEIVERB_INPLACEACTIVATE); // now get the outlook application OleClientSite site2 = new OleClientSite(frame, SWT.NONE,"Outlook.Application"); OleAutomation outlook = new OleAutomation(site2); OleAutomation mail = invoke(outlook, "CreateItem", 0 /* Mail item */) .getAutomation(); setProperty(mail, "To", "someone@something.com"); /* * Empty but could also be * predefined */ // setProperty(mail, "Bcc", "test@gmail.com"); /* * Empty but could also be * predefined */ setProperty(mail, "BodyFormat", 2 /* HTML */); setProperty(mail, "Subject", "Top News for you"); setProperty(mail, "HtmlBody", "some message"); // File file = new File("c:/temp/test.txt"); // if (file.exists()) { // OleAutomation attachments = getProperty(mail, "Attachments"); // invoke(attachments, "Add", "c:/temp/test.txt"); // } else { // MessageDialog // .openInformation(shell, "Info", // "Attachment File c:/temp/test.txt not found; will send …
has title: ClassNotFoundException: org.eclipse.swt.widgets.Display
favorite count: 0
has answer: http://stackoverflow.com/a/22473876

http://stackoverflow.com/a/22344267
upvote count: 1
has body: Here the Http protocol works on Connection-Oriented TCP connection. So internally, it creates a TCP connection. then send http request on that and receive the response back. then drop the TCP Connection. that is why two different streams are there.
downvote count: 0
answers question: http://stackoverflow.com/q/22344191
type: Answer
score: 1

http://stackoverflow.com/q/22393628
type: Question
tagged with: gwt
tagged with: java
has answer: http://stackoverflow.com/a/63598911
answer count: 2
tagged with: casting
has comment: http://stackoverflow.com/comment/34046863
has comment: http://stackoverflow.com/comment/34046387
score: 0
has comment: http://stackoverflow.com/comment/34047598
has comment: http://stackoverflow.com/comment/34046940
has title: ClassCastException: string can't be cast to double
has answer: http://stackoverflow.com/a/22393680
has comment: http://stackoverflow.com/comment/34046947
has comment: http://stackoverflow.com/comment/34048073
has comment: http://stackoverflow.com/comment/34054315
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34048720
has comment: http://stackoverflow.com/comment/34055212
has body: I have got a Java method (getTrucks()), which throws ClassCastException: string can't be cast to double. The method belongs to FoodTruckServiceImpl, which implements FoodTruckService. I retrieve the objects via parser, so they are stored with the correct types. Here is the method: public List&lt;Truck&gt; getTrucks() { PersistenceManager pm = getPersistenceManager(); List&lt;Truck&gt; trucklist = new ArrayList&lt;Truck&gt;(); try { Extent e = pm.getExtent(Truck.class, true); Iterator iter = e.iterator(); int count = 0; while(iter.hasNext()) { count++; System.out.println(count); Truck t = (Truck) iter.next(); trucklist.add(t); } if(count&gt;0){ System.out.println("get to here(count&gt;0)?!!"); return trucklist; } } finally { pm.close(); } System.out.println("get to here?!!"); return this.trucklist.getTruckList(); } Truck Class: @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Truck { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; @Persistent private String key; @Persistent private String vendorType; @Persistent private String status; @Persistent private String businessName; @Persistent private String location; @Persistent private String description; @Persistent private double lat; @Persistent private double lon; @Persistent private Date createDate; //constructor for food truck public Truck() { this.createDate = new Date(); } public Truck(String symbol, String type, String status, String businessName, String location, String description, double lat, double lon) { this(); this.key = symbol; this.vendorType = type; this.status = status; this.businessName = businessName; this.location = location; this.description = description; this.lat = lat; this.lon = lon; } public Long getId() { return this.id; } public String getTruck() { return this.key; } public void setKey(String key) { this.key = key; } public String getVendorType() { return this.vendorType; } public void setVendorType(String vendorType) { this.ven…

http://stackoverflow.com/comment/34112405
has text: @keshk Sorry, I fixed the problem.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22431819
type: Comment

http://stackoverflow.com/q/22471593
tagged with: remote-debugging
has title: Java applets doesnt not working with Remote debugging of applet
has body: I have trying to use remote debugging for Java applets. I m using Java 7 update 51 and when i try to load the applets this is displyed in the java console and then it is struck. network: Connecting http://domain.com/useradmin3.gif with proxy=DIRECT network: Connecting http://domain.com/ with proxy=DIRECT preloader: Stop progressCheck thread I have passed the following as runtime parameters in the Javacpl: "-Djava.compiler=NONE -Xnoagent -Xdebug -Xrunjdwp:transport=dt_socket,address=8007,server=y,suspend=n"
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34184894
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29286197
has comment: http://stackoverflow.com/comment/34182355
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/29286197
possible better answer: http://stackoverflow.com/a/22493717
tagged with: applet
favorite count: 0
has answer: http://stackoverflow.com/a/22493717

http://stackoverflow.com/a/22464887
has comment: http://stackoverflow.com/comment/34171091
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22464763
type: Answer
accepted answer of: http://stackoverflow.com/q/22464763
score: 1
has comment: http://stackoverflow.com/comment/34171272
upvote count: 1
has body: Assuming that your JAXB definition knows nothing about &lt;root&gt;, i.e. you can't just unmarshal the whole thing and look inside the resulting Root object: Parse into a Document. Use XPath / DOM traversal / whatever to get [a] reference[s] to the device Node[s]. Use unmarshaller.unmarshal (node).
downvote count: 0

http://stackoverflow.com/comment/34198879
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22468704
score: 0
has text: It's a fundamentally wrong approach, and the implementation is fundamentally wrong too. I recommend to study the first several chapters of the [Gradle User Guide](http://gradle.org/docs/current/userguide/userguide_single.html), and the samples in the full Gradle distribution.

http://stackoverflow.com/comment/34133340
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22443275
has text: Your while loop has a single statement in it, a println.

http://stackoverflow.com/comment/34173426
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22466137
has text: You fail to check for the return value of `imageFile.delete()`: it may fail!
score: 0

http://stackoverflow.com/q/22445502
has body: I'm testing JavaCV to update a JPanel with the image from my webcam. It works well except when i use setSize of JFrame to set width to my resolution (my resolution is 1366 x 768). When i make this (set width to 1366), the repaint of the JPanel does not work properly and the image freeze. When i set width to 1365 or 1367 it works very well. To test, i created a button that adds 8 to width in every click. I start the form with 1350 in width and when width is changed to 1366 (after 2 clicks) the repaint stops. Anybody knows what happens? Below my code. package com.pictap; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.image.BufferedImage; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextPane; import org.apache.log4j.Logger; import com.googlecode.javacv.FrameGrabber; import com.googlecode.javacv.OpenCVFrameGrabber; import com.googlecode.javacv.cpp.opencv_core.IplImage; public class PicTap { private static final Logger logger = Logger.getLogger(PicTap.class); private static JFrame form; private static ImagePanel panel; private static FrameGrabber grabber; private static JTextPane status; private static Integer counter = 0; public static void main(String[] args) { //Declare FrameGrabber to import output from webcam grabber = new OpenCVFrameGrabber(""); try{ IplImage img; BufferedImage bi; // Show GUI form = new JFrame("PicTap"); form.setSize(1350, 768); form.setLayout(new BorderLayout()); form.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new ImagePanel(); panel.setDoubleBuffered(true); panel.setBackground(Color.BLACK); form.add(panel, BorderLayout.CENTER); panel.setVisible(true); JButton increase = new JButton("Aumentar"); form.add(increase,BorderLayout.NORTH); increase.setVisible(true); increase.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { …
has comment: http://stackoverflow.com/comment/34137668
tagged with: javacv
has comment: http://stackoverflow.com/comment/34138695
downvote count: 0
has comment: http://stackoverflow.com/comment/34137455
favorite count: 0
has title: JPanel repaint issue when set width to max
tagged with: repaint
has comment: http://stackoverflow.com/comment/34137631
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34223483
tagged with: swing
type: Question
tagged with: jpanel
has comment: http://stackoverflow.com/comment/34138648

breakout
type: Tag
tags question: http://stackoverflow.com/q/22339763
tag name: breakout

http://stackoverflow.com/comment/80382446
type: Comment
type: QuestionComment
has text: @NDeveloper, Is your Java version 7, how could u fic this issue please? I too face the same issue. Thanks in advance
comment on: http://stackoverflow.com/q/22475431
score: 0

http://stackoverflow.com/a/22380799
score: 4
has comment: http://stackoverflow.com/comment/66822999
type: Answer
has body: Solved it, I had to refresh the indices for search to work client.admin() .indices() .prepareRefresh() .execute() .actionGet();
accepted answer of: http://stackoverflow.com/q/22353227
answers question: http://stackoverflow.com/q/22353227
upvote count: 4
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/34149596
has text: @RazorAlliance192 that was not in the initial question and you're still missing `stmt.setFetchSize(Integer.MIN_VALUE);`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22452875
type: Comment

http://stackoverflow.com/a/22339454
has body: You could try parsing the line using a Pattern object, something like this: Pattern opPattern = Pattern.compile("(\\d+) *([+-*/]) *(\\d+)"); Matcher matcher = opPattern.matcher(userLine); if(matcher.find()) { int op1 = Integer.toValue(matcher.group(1)); int op2 = Integer.toValue(matcher.group(3)); String op = matcher.group(2); if(op.equals("+")) { // do + op ... } else ... { // etc... } } else { // error in line, not the form of an operation } Have a look at the javadoc, as I'm not sure if I used the correct method names and the like, just tried to illustrate the idea...
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22339324

http://stackoverflow.com/comment/33990148
comment on: http://stackoverflow.com/q/22361522
has text: How about using the `ForkJoin` framework? That framework allows you to cut up a big computational job into "fixed size" snippets, and distribute the resulting batch of snippets over a thread pool. Linky: http://docs.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22450852
type: Answer
accepted answer of: http://stackoverflow.com/q/22450649
has body: You can implement two different comparators. public class CourseComparatorById implements Comparator&lt;Course&gt; { @Override public int compare(Course o1, Course o2) { // for example - sort ascending by ID return o1.getId() - o2.getId(); } } public class CourseComparatorByStartTime implements Comparator&lt;Course&gt; { @Override public int compare(Course o1, Course o2) { // for example - sort ascending by start time return o1.getStartTime() - o2.getStartTime(); } } And then use them to sort the array. List&lt;Course&gt; courses = ... Collections.sort(courses, new CourseComparatorById()); // now it's sorted by ID Collections.sort(courses, new CourseComparatorByStartTime()); // now it's sorted by start time
answers question: http://stackoverflow.com/q/22450649
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34146559
score: 8
has comment: http://stackoverflow.com/comment/34146420
upvote count: 8

http://stackoverflow.com/comment/34163626
has text: Thanks for this, it is on par with what I am trying to do. A machine takes a Date down to a millisecond so this makes a lot of sense. I appreciate it!
comment on: http://stackoverflow.com/a/22458314
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22426708
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/34103050
type: Question
has comment: http://stackoverflow.com/comment/34103209
score: 1
has title: Libgdx BitmapFont bad framerate
favorite count: 0
has body: I have a BitmapFont to display the player score. The player is moving in a constant rate. For the BitmapFont I use a second OrtographicCamera and SpriteBatch so I don't need to recalculate the fonts position. My problem is: as soon as I include the BitmapFont the framerate goes down and the whole game becomes laggy. What am I doing wrong? public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); rbg.render(delta); spriteBatch.setProjectionMatrix(cam.combined); spriteBatch.begin(); drawBlocks(); drawBob(); spriteBatch.end(); scoreBatch.setProjectionMatrix(scoreCam.combined); scoreBatch.begin(); drawScore(this.score); scoreBatch.end(); if (debug) drawDebug(); } private void drawBob() { bobFrame = bob.isFacingLeft() ? bobIdleLeft : bobIdleRight; if(bob.getState().equals(State.WALKING)) { bobFrame = bob.isFacingLeft() ? walkLeftAnimation.getKeyFrame(bob.getStateTime(), true) : walkRightAnimation.getKeyFrame(bob.getStateTime(), true); } else if (bob.getState().equals(State.JUMPING)) { if (bob.getVelocity().y &gt; 0) { bobFrame = bob.isFacingLeft() ? bobJumpLeft : bobJumpRight; } else { bobFrame = bob.isFacingLeft() ? bobFallLeft : bobFallRight; } } spriteBatch.draw(bobFrame, bob.getPosition().x * ppuX, bob.getPosition().y * ppuY, Bob.WIDTH * ppuX, Bob.HEIGHT * ppuY); cam.position.set(cam.position.x + 24f, Gdx.graphics.getHeight() / 2f, 0); cam.update(); } private void drawBlocks() { for (Block block : world.getDrawableBlocks((int)CAMERA_WIDTH, (int)CAMERA_HEIGHT)) { spriteBatch.draw(blockTexture, block.getPosition().x * ppuX, block.getPosition().y * ppuY, Block.SIZE * ppuX, Block.SIZE * ppuY); } for (Block block : world.getBottomBlocks((int)CAMERA_WIDTH, (int)CAMERA_HEIGHT)) { spriteBatch.draw(blockBottomTexture, block.getPosition().x * ppuX, block.getPosition().y * ppuY, Block.SIZE * ppuX, Block.SIZE * ppuY); } for (Block block : world.getTopBlocks((int)CAMERA_WIDTH, (int)CAMERA_HEIGHT)) { spriteBatch.draw(blockTopTextu…
has answer: http://stackoverflow.com/a/22427030
upvote count: 1
answer count: 1
tagged with: frame-rate
tagged with: libgdx
tagged with: java
tagged with: bitmap-fonts
accepted answer: http://stackoverflow.com/a/22427030

http://stackoverflow.com/a/22367529
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22367429
score: 1
has body: It's nearly never a good idea to parse a date on your own. Dates are mysterious things: leap seconds, leap years, time zones, etc. are a ultra complex thing. To check a date I would really recommend to use the java functions for that task (or a library). Here is an example: import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Snippet { public static void main(String[] args) throws ParseException { // define your own date format SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); // for strict parsing of dates, turn of lenient mode dateFormat.setLenient(false); // try to parse the date Date date = dateFormat.parse("13/31/1604"); // if no exception occurs, your date is a valid date System.out.println("date valid"); } }
downvote count: 0

http://stackoverflow.com/a/22449320
downvote count: 0
answers question: http://stackoverflow.com/q/22448834
type: Answer
upvote count: 2
score: 2
has body: I would replace: else if (level == "shaman") { return false; } return true; by: else if (level.equals("shaman")) { return false; } System.err.println("Invalid/corrupted level name! ['" + level + "']"); return false; Indeed, if I can rephrase your algorithm: if level is upgradable then promote it return true if level is top level don't do anything return false // we shouldn't be in this place! // A level is either upgradable or it is the top level... // if we are, there is some mistake in here warn user return false and I would do the same for downgrade(). Whether or not you add the error message, you shouldn't return true for level promotion/downgrade if you don't actually perform any promotion/downgrade operation. It usually is a good practice to check for unexpected behavior and raise an exception (or at least write to the error output) when appropriate. In this case, it might have alerted you at run time that you never entered any of your tests and you would probably have seen that the problem was somehow related to the equality check for the strings. As @Rafa El and @JB Nizet have stated in the comments, you shouldn't use == to compare strings in Java. For reference, I'm adding the link @JB Nizet provided in the comments: How do I compare strings in Java? Note: Why don't you use an enum to store the possible levels? that way you know there cannot be any mistake in the string that is passed to your level object. public enum Level { APPRENTICE, WIZARD, MAGE, SORCERER, SHAMAN, } and then: Level level = Level.APPRENTICE; switch (level) { case APPRENTICE: level = Level.WIZARD; galleons += 100; return true; case ...: ... } Also, because upgrade/downgrade is very much only a value shift in the enum, you could write a more generic method for that shift, and it would thus be easier to add/delete a level or change their orders as your project evolves, without needing to edit all your test cases. As this point is slightly off topic, I'll keep it brief. Feel free to ask for…

http://stackoverflow.com/comment/34198383
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22480870
score: 0
has text: ok you mean event dispatch thread http://docs.oracle.com/javase/tutorial/uiswing/concurrency/dispatch.html

http://stackoverflow.com/q/22426040
tagged with: java
type: Question
has title: Error: sun.awt.image.ToolkitImage cannot be cast to java.awt.image.BufferedImage
has body: please help me cant do this thing to work to me sun.awt.image.ToolkitImage cannot be cast to java.awt.image.BufferedImage if (shape.hasImage()) { // If this shape is an image, extract image to file String extension = ImageTypeToExtension(shape.getImageData().getImageType()); String imageFileName = MessageFormat.format("Image.ExportImages.{0} Out.{1}", imageIndex, extension); String strBarCodeImageExtracted = "" + imageFileName; shape.getImageData().save(strBarCodeImageExtracted); // Recognize barcode from this image BarCodeReader reader = new BarCodeReader ((BufferedImage) Toolkit.getDefaultToolkit().getImage(strBarCodeImageExtracted),BarCodeReadType.Code39Standard); while (reader.read()) { System.out.println("codetext: " + reader.getCodeText()); } imageIndex++; }
downvote count: 0
accepted answer: http://stackoverflow.com/a/22429392
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34101662
upvote count: 2
has comment: http://stackoverflow.com/comment/34101991
tagged with: swing
has answer: http://stackoverflow.com/a/22429392
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/22381535
accepted answer: http://stackoverflow.com/a/22382133
tagged with: jpa
has title: JPA and JSON serialization problems
tagged with: jackson
score: 0
has body: Help solve the problem. I have 2 entity classes: 1. @Entity @Table(name = "topic") public class Topic { @Id @Column(name = "topic_id") @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(name = "system_id") private int systemId; @Column(name = "topic_name") private String name; @OneToMany(mappedBy = "topic", fetch = FetchType.EAGER, orphanRemoval = true) private List&lt;Faq&gt; faqList; // getters and setters @Override public String toString() { return "Topic{" + "id=" + id + ", systemId=" + systemId + ", name='" + name + '\'' + ", faqList=" + faqList + '}'; } } 2. @Entity @Table(name = "faq") public class Faq { @Id @Column(name = "faq_id") @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(name = "question") private String question; @Column(name = "answer") private String answer; @ManyToOne @JoinColumn(name = "topic_id") @JsonIgnore private Topic topic; //getters and setters @Override public String toString() { return "Faq{" + "id=" + id + ", question='" + question + '\'' + ", answer='" + answer + '\'' + ", topicId=" + topic.getId() + '}'; } } I was forced to in toString method write to console only topic.id, because getting an error "StackOverflow". A similar situation with serialisation to JSON (jackson converter), therefore I used @JsonIgnore annotation. And all was okay. But there is a problem: when i send JSON object from controller.js {topic: {id: "1"}, question: "test", answer: "test"} to the server @RequestMapping(method = RequestMethod.POST, value = "/faqs") @ResponseBody public Message editFaq(@RequestBody Faq faq) { System.out.println(faq); Message message = new Message("ok"); return message; } in System.out I got NullPointerException. I think that is because @JsonIgnore, when i try get faq.toString (topic.getId()) I got exception. How can I solve this problem? I solved this, adding path variable to the post: @RequestMapping(method = RequestMethod.POST, value = "/faqs/{topicId}") ... Topic topic = new Topi…
answer count: 1
has answer: http://stackoverflow.com/a/22382133
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/a/22358141
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33985349
answers question: http://stackoverflow.com/q/22353814
accepted answer of: http://stackoverflow.com/q/22353814
has comment: http://stackoverflow.com/comment/33985379
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33985314
has body: One way it can be done is with some boolean logic and a custom JButton class and some custom painting. For instance in the example below, there a leftRight flag. If there is a horizontal tic tac toe, the leftRight flag will be raised, causing the line to be draw in each of the buttons in the tic tac toe Forgive my tic tac toe programming logic, it's not a final game product. It only gives an example of the top row tic tac toe of O's. But I'm sure you can figure out the logic for the other type of tic tac toe's. For instance, for a diagonal, you can have a leftDiag flag and if raised, it would paint drawLine(0, 0, getWidth(), getHeight()) Play with it. ENJOY! import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.border.LineBorder; public class TTTButtons { ImageIcon oooIcon; MyButton[][] buttons = new MyButton[3][3]; JPanel gamePanel; public TTTButtons() { oooIcon = new ImageIcon(getClass().getResource("/resources/ooooo.png")); gamePanel = createGamePanel(); JFrame frame = new JFrame("TicTacToe"); frame.add(gamePanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } private JPanel createGamePanel() { JPanel panel = new JPanel(new GridLayout(3, 3)); for (int i = 0; i &lt; buttons.length; i++) { for (int j = 0; j &lt; buttons[i].length; j++) { buttons[i][j] = new MyButton(oooIcon); panel.add(buttons[i][j]); } } return panel; } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new TTTButtons(); } }); } public class MyButton extends JButton { Image oooImage; boolean leftRight = false; boolean clicked = false; boolean ooo = false; b…
has comment: http://stackoverflow.com/comment/33985412

http://stackoverflow.com/a/22452248
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22452094
upvote count: 1
has body: Before asking any question please do use Google .By The Way Click Here I hope it helps you .

http://stackoverflow.com/comment/34184184
type: QuestionComment
has text: You only create Set but size is 0, just create the User object set in the task object and then save it
score: 0
comment on: http://stackoverflow.com/q/22472292
type: Comment

http://stackoverflow.com/comment/34138648
type: QuestionComment
score: 0
has text: Im begginer in swing, i dont see where this thread violations are. Any hint how i can find where my code was blocking EDT? thanks
comment on: http://stackoverflow.com/q/22445502
type: Comment

http://stackoverflow.com/comment/34080822
type: AnswerComment
type: Comment
has text: @m0skit0: Indeed, as it's a local class. (Hence the deletion of my answer, of course - I made the same mistake everyone else did, but I didn't want my second attempt to start off with a +3 vote advantage :)
comment on: http://stackoverflow.com/a/22413864
score: 0

http://stackoverflow.com/a/22332358
has body: First, don't name your variables as upper case letters. Second, like so - private &lt;TYPE&gt; void test(String a, String b, TYPE c) throws Exception { //..... // c is of the generic type TYPE. } Any primitive types used will be auto-boxed to their Object wrapper types (e.g. double will be Double, etc).
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22332293
has comment: http://stackoverflow.com/comment/33939307
answers question: http://stackoverflow.com/q/22332293
type: Answer

http://stackoverflow.com/a/22342816
answers question: http://stackoverflow.com/q/22342624
has body: Because this line is never executed. finalRecord.append(rec).append(System.lineSeparator()); I'm not sure why you split string like this: String Recordstore[] = p.split("\\^\\^"); Obviously, the array Recordstore.length() will always be 1, since there isn't any ^^ in your original string. So counter != len - 1 will always be false. update: I made some changes in this line: baos.write(finalRecord.append(System.lineSeparator()).toString().getBytes());
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33957330
has comment: http://stackoverflow.com/comment/33957949

http://stackoverflow.com/q/22484683
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/22489220
tagged with: jsp
score: 0
has title: after GWT/js redirect, request.setAttribute does't work
answer count: 1
type: UnansweredQuestion
tagged with: gwt
tagged with: java
has body: In my site I have few languages to choice. I use a servlet, jsp to view, and GWT as a place where is localized button to action (treat it as js). In servlet I'm catching the subdomain which is the language like en, de, fr and so on (for instance en.mydomain.com will give string "en"). Because I use GWT I have to send parameter, to jsp with a current locale which I get from subdomain. the jsp parameter code looks like bellow &lt;meta name="gwt:property" content="locale=&lt;%=request.getAttribute( "locale1" )%&gt;"&gt; and servlet send attribiute: request.setAttribute("locale1", locale); But in my site (GWT layer) you can change the language just by pushing the button with flag. What happens there? I replacing the subdomain from one language to another. After push I redirect the url to new one with new subdomain Window.Location.assign(Window.Location.createUrlBuilder() .setHost(newURL).buildString()); The url is correct after above action and then the action is walking into servlet where I get language from subdomain which is correct (the new one is fetched) and trying to setAttribute like above code. But in jsp locale are not replaced. Just previous language still are there. No matter how many times I would perform the action the jsp will not replace the locale (mean en de fr ...) The question: why it happens and how to fix it?

http://stackoverflow.com/comment/34016771
has text: What type does setRiskIdEnd take and what type does getNumericCellValue return?
comment on: http://stackoverflow.com/q/22377745
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34131656
has text: i just wanna say that ive been learning java for 1 1/2 years and this is the stuff i like to learn
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22442235

http://stackoverflow.com/comment/33985306
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22340034
has text: Thanks for the hint. I attached the dmesg log above.

http://stackoverflow.com/comment/33951358
has text: i was getting help from Luiggi Mendoza and this was what i came up with so far, i'm still tweaking with it
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22339233
type: Comment

http://stackoverflow.com/q/22429871
has comment: http://stackoverflow.com/comment/34111403
has comment: http://stackoverflow.com/comment/34111750
has body: I need your help with my movie quiz app which ask user a question and come up with 4 answers (1 right and 3 wrong). I have to find queries for app but it's doesn't seem to work for me. Here is the schema for tables - table one (movies) has 4 values - id (primary key), title (title of the movie), year (year of release), director (director of the movie) table two (stars) has 3 values - id (primary key), first_name, last_name table three (stars_in_movies) has 2 values - movie_id, star_id (movie_id and star_id both are foreign keys here Now, for the questions: I have to come up with queries for the following questions and these are queries I came up with. Which star was in movie x? select first_name,last_name from stars_in_movies inner join stars where movie_id=%s and star_id=id; (This works fine) Who directed the star x? select director from movies inner join stars_in_movies where star_id=%s and movie_id = id; (This doesn't seem to be working) Which star appears in both movies x and y? select first_name,last_name from stars_in_movies inner join stars where (movie_id=%s and movie_id=%y) and star_id=id; (This doesn't seem to be working either) Which star did not appear in the same movie as star x? (I don't know how to approach this query but I am thinking about making a helper function to pick a random movie with at least 3 stars in it, then use 1 star in the question, and the other two as wrong answers. Then just find another random star that hasn't been in a movie with the first star. but I don't know how to write code for it)
has comment: http://stackoverflow.com/comment/34109573
has comment: http://stackoverflow.com/comment/34111802
has answer: http://stackoverflow.com/a/22431684
type: AnsweredQuestion
tagged with: java
tagged with: mysql
upvote count: 1
downvote count: 1
type: Question
tagged with: database
accepted answer: http://stackoverflow.com/a/22431684
has comment: http://stackoverflow.com/comment/34111587
score: 0
tagged with: sql
has title: Movie Database Queries
answer count: 1
favorite count: 0

http://stackoverflow.com/q/22441955
has comment: http://stackoverflow.com/comment/34130788
has comment: http://stackoverflow.com/comment/34130769
has answer: http://stackoverflow.com/a/22441991
downvote count: 0
answer count: 1
favorite count: 0
has title: HashTable in java own size
type: UnansweredQuestion
tagged with: size
tagged with: hashtable
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34130810
upvote count: 1
type: Question
has body: I want to create a hashtable which is a specific size each time. I want it to be 10 x the number of blocks (using substring()) stored in "list". for (int k = 0; k &lt; foo.length() - blockSize + 1; k++) { list = foo.substring(k, k + blockSize); System.out.println(list); } I have looked online and can't find any solution for this. Can I get some clarification on this? Thanks

http://stackoverflow.com/q/22427530
has comment: http://stackoverflow.com/comment/34104329
type: Question
possible better answer: http://stackoverflow.com/a/22427623
has title: Try and catch blocks: whether in the class itself or when I call the method outside the class
answer count: 3
upvote count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22427623
has answer: http://stackoverflow.com/a/22427756
accepted answer: http://stackoverflow.com/a/22427756
has body: Could you help me understand where should I throw exceptions and catch them. Please, have a look at my code. I thought that in Thrd class I have already thrown and caught the exception. But when I wrote in the main class FirstThread.readFile("ParallelProgramming.txt");, I faced a runtime error - unhandled exception. So, I had to use try and catch. So, I somehow can't understand why in the Thd class my try and catch blocks didn't work. package parallelprogramming; import java.lang.Thread; import java.io.*; public class Thrd extends Thread { public void readFile(String File) throws FileNotFoundException { FileReader fr = new FileReader(File); BufferedReader br = new BufferedReader(fr); String s; try { while ((s = br.readLine()) != null) { System.out.println(s); } fr.close(); } catch (FileNotFoundException FNFD) { System.out.println("File not found!"); } catch (IOException IOE){ System.out.println("IOException caught!"); } } } package parallelprogramming; import java.io.FileNotFoundException; public class ParallelProgramming { public static void main(String[] args) throws FileNotFoundException { Thrd FirstThread = new Thrd(); try { FirstThread.readFile("ParallelProgramming.txt"); } catch (FileNotFoundException FNFD) { System.out.println("File not found!"); } } }
has answer: http://stackoverflow.com/a/22427789
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/34074274
comment on: http://stackoverflow.com/a/22409614
type: Comment
has text: They appear to be running different shells, one is using /usr/bin/bash the other is using /bin/sh I guess my options are editing the profiles on the servers so all shells match, or trying to find some common ground?
score: 0
type: AnswerComment

http://stackoverflow.com/a/22417891
has comment: http://stackoverflow.com/comment/34094721
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22414661
upvote count: 1
has body: There is no general rule. The parser of the namespace element decides what to do with the XML elements it processes. For example jms:listener-container creates one jms message listener container per child jms:listener but it does not create any bean for the root (at least with Spring 4.0) Explaining why you need to do this might be a better way to answer your question.

http://stackoverflow.com/a/22397932
has comment: http://stackoverflow.com/comment/34052982
answers question: http://stackoverflow.com/q/22397776
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34052807
has body: The maximum size of the byte array is Integer.MAX_VALUE. Is there something you're trying to do with the String itself that you're not showing us that could be causing this problem?

http://stackoverflow.com/comment/34001320
comment on: http://stackoverflow.com/a/22367873
type: Comment
score: 0
type: AnswerComment
has text: This answer is spot on - use loops to avoid unnecessary pushes to the stack

http://stackoverflow.com/a/22404565
accepted answer of: http://stackoverflow.com/q/22404419
upvote count: 3
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
has body: Not tested: CallableStatement cs = null; cs = conn.prepareCall("{call vivek}"); cs.executeQuery(); http://docs.oracle.com/javase/tutorial/jdbc/basics/storedprocedures.html
answers question: http://stackoverflow.com/q/22404419

http://stackoverflow.com/comment/34130722
has text: I haven't yet grasped what a servlet container actually is. I'm using Apache Tomcat if that's relevant.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22441725
type: QuestionComment

http://stackoverflow.com/q/22403920
tagged with: algorithm
has title: Java Game Creating Deterministic Tile Map
score: 0
has answer: http://stackoverflow.com/a/22404930
has comment: http://stackoverflow.com/comment/34064139
possible better answer: http://stackoverflow.com/a/22404930
has comment: http://stackoverflow.com/comment/34064838
tagged with: android
has body: I have a 800x480 screen size where I play the game. I have tiles of size 60x120 which I place on the screen in a position. From beginning I have created 8 tiles see picture below. The tiles are always moving from right to left. When the tile is out of screen I recreate the tile in a new position. The problem I have is that the tiles are not deterministic, some of the tiles overlap each other when moved to new position. The code below checks the tiles position. If the tile is out of the screen the tile is moved to the new position. The problem I have right now is that the tiles sometimes overlap each other. How can I solve the problem? tileX += speedX; // speedX is the speed of tiles moving to the left. if(tileX &lt;= -60){ // Checks if tile position is out of screen tileX += 840; }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22405053
accepted answer: http://stackoverflow.com/a/22405053
tagged with: java
has comment: http://stackoverflow.com/comment/34062879
type: Question
tagged with: deterministic
answer count: 2
has comment: http://stackoverflow.com/comment/34063631

http://stackoverflow.com/comment/34073728
comment on: http://stackoverflow.com/q/22407742
has text: Your AVD has not loaded yet. That is you problem. depending on your computer it can take upto 15 mins.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22391357
tagged with: bufferedimage
has answer: http://stackoverflow.com/a/22391796
linked to: http://stackoverflow.com/q/22133993
type: AnsweredQuestion
has body: I am doing one application in Java and I want to do this: I have a BufferedImage with a large image loaded and I want to assign a part of it to another BufferedImage. Let's say BufferedImage2 = BufferedImage1.GetWindow(From x1 y1 to x2 y2); BufferedImage2 will be just a small part of the greater BufferedImage1.
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
tagged with: clip
favorite count: 0
has comment: http://stackoverflow.com/comment/34041878
has title: Assign part of BufferedImage to another BufferedImage
linked to: http://stackoverflow.com/q/6317732
has comment: http://stackoverflow.com/comment/34041961
possible better answer: http://stackoverflow.com/a/22391796
has answer: http://stackoverflow.com/a/22402448
accepted answer: http://stackoverflow.com/a/22402448
has comment: http://stackoverflow.com/comment/34056581
upvote count: 1

http://stackoverflow.com/comment/34144600
type: Comment
type: QuestionComment
has text: Can you post a stacktrace?
score: 1
comment on: http://stackoverflow.com/q/22449793

http://stackoverflow.com/q/22392410
favorite count: 0
upvote count: 2
answer count: 2
tagged with: spring
has answer: http://stackoverflow.com/a/22393698
tagged with: java
tagged with: hibernate
has title: Hibernate: An entity copy [Event#XXX] was already assigned to a different entity [Event#XXX]
has answer: http://stackoverflow.com/a/25689222
score: 2
has body: I have two kinds of entities: Event and Schedule. I am trying to modify them avoiding transactions as much as possible not to lock the database for unnecessary time. So instead of: @Transactional public void modify() { Event event = em.find(...); //... something that might take a long time event.addSchedule(schedule); em.flush(); } I am trying rather to: public void modify() { Event event = em.find(...); //... something that might take a long time event.addSchedule(schedule); repository.merge(event); } ... @Transactional public void merge(Event event) { em.merge(event); em.flush(); } The problem is that like this I am getting exceptions: An entity copy [Event#XXX] was already assigned to a different entity [Event#XXX]. I do not copy the entity, nor do anything unexpected with it. Also, it is said that it is necessary to have properly implemented equals() and hashCode() methods. I have them, but as I've studied the stacktrace, it seems that the entities are compared not by equals, nor hashCode, they are compared with == as shown here: http://grepcode.com/file/repo1.maven.org/maven2/org.hibernate/hibernate-core/4.1.3.Final/org/hibernate/event/internal/EventCache.java#62 They use IdentityHashMap, which specifically use ==. So where can I look for problem? I've tried hibernate from 4.1.7 to current 4.3.4 and I am using hibernate.enable_lazy_load_no_trans to load entities without explicitly having session.
tagged with: jpa
downvote count: 0
type: UnansweredQuestion
type: Question
linked to: http://stackoverflow.com/q/10550511

http://stackoverflow.com/comment/34113803
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22424093
type: Comment
has text: You were right. It's not "only" the loop that was the problem but also the way the data was captured. I took your suggestion and created a similar class to do this. It did speed up substantially. Only changing the loop to do a binary search didn't help much as I had guessed.

http://stackoverflow.com/q/22348968
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33979846
has body: I want to use css jar dependencies of eclipse e4 in my SWT Application (not RCP Application), how can i do it ? can any one guide me ?
score: 0
tagged with: css
has comment: http://stackoverflow.com/comment/33968637
tagged with: e4
answer count: 0
has title: using Eclipse 4 css dependencies for a simple swt application
type: UnansweredQuestion
tagged with: swt
type: Question
has comment: http://stackoverflow.com/comment/33981813

http://stackoverflow.com/q/22357170
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: mocking
upvote count: 1
tagged with: mockito
answer count: 1
has title: What are the best practices for writing unit tests with Mock frameworks
favorite count: 0
has body: I am new to mocking and I have goggled a lot for the best practices but till now I couldn't find any satisfying resource so I thought of putting in SO. I have tried few test cases and had following doubts: Do you write a separate unit test for each method (public private etc) and mock other methods calls that's being invoked inside this method or you test only public method? Is it okay to verify the invocation of stubbed method at the end when testing a method that returns nothing e.g DB insertion? Please add other practices also that are must to know.
accepted answer: http://stackoverflow.com/a/22357610
downvote count: 0
has comment: http://stackoverflow.com/comment/33982204
has answer: http://stackoverflow.com/a/22357610
tagged with: unit-testing

http://stackoverflow.com/a/22405678
has body: RuntimeException and its subclasses are unchecked exceptions. All others are checked exceptions.
has comment: http://stackoverflow.com/comment/34066656
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22405626
has comment: http://stackoverflow.com/comment/34065701
has comment: http://stackoverflow.com/comment/34092685
score: 4
has comment: http://stackoverflow.com/comment/34066909

http://stackoverflow.com/q/22487091
has comment: http://stackoverflow.com/comment/34209514
score: -1
has comment: http://stackoverflow.com/comment/34210035
answer count: 3
has answer: http://stackoverflow.com/a/22487129
favorite count: 0
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34209492
has answer: http://stackoverflow.com/a/22487209
has body: private fields don't inheritance so in class B doesn't exist z but method setz(int a) exist! class A{ private int z=1; public void setz(int a){ z=a; } } class B extends A{ } if new an object of class B and call setz(int a) z changed but this method should have errors becuse z not exist !how can explanation it?
tagged with: java
has title: Inheritance private fields in java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22487125

http://stackoverflow.com/comment/34096799
comment on: http://stackoverflow.com/a/22423134
score: 0
type: Comment
has text: It's C style programming in the 21st century. Your school should have its license to teach revoked :)
type: AnswerComment

http://stackoverflow.com/comment/34235122
has text: You are right, I missed this point, sorry. Possibly this could be fixed but I don't see any way right now. Other alternative is to use suffix tree with deletions (as explained in [CodeChef editorial](http://discuss.codechef.com/questions/23739/tmp01-editorial)). This gives O(N^3) algorithm complexity and linear space. Btw, how do you intend to use persistence? That's far from obvious. And without it BBST variant has quadratic space requirements, which is not so good.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22464639
type: Comment

http://stackoverflow.com/a/22395146
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22395082
answers question: http://stackoverflow.com/q/22395082
has comment: http://stackoverflow.com/comment/34048125
has comment: http://stackoverflow.com/comment/34048930
type: Answer
has comment: http://stackoverflow.com/comment/34048937
has comment: http://stackoverflow.com/comment/34048737
has body: You need to catch the InputMismatchException and loop back around so that you can continue. Basically, your code needs to be: while (userChoices[num - 1] == 1) { try { System.out.print("Enter your menu choice: "); num = kb.nextInt(); kb.nextLine(); } catch (InputMismatchException e) { System.out.println("Error. Invalid input. Try again."); // Or whatever error message you want. } } To further your programming skills, you should read up more about Exception handling in Java. EDIT: Typically, you want to avoid catching Exceptions as a means of controlling program flow. The best practice is to avoid exceptions through better logic, but I'm really not well versed with console-based I/O, so I have no idea how you'd manage that. Especially when parsing numbers from Strings, I usually just use a try/catch hehe #guilty
has comment: http://stackoverflow.com/comment/34048084

http://stackoverflow.com/a/22352277
accepted answer of: http://stackoverflow.com/q/22352174
type: AcceptedAnswer
downvote count: 0
has body: Deploy a Servlet that changes an attribute on the application ServletContext that contains the mode. The value set by the servlet on the ServletContext attribute, could be read from a parameter. This way, you invoke the Servlet and send the mode you want to set, using a parameter on the servlet's url query string. This allows you to change the mode value dinamically without restarting the app. Better than that, you can do it remotely, without accessing to the server console. You could also load the ServletContext attribute using a Listener. If you don't want to use a Servlet for some reason, you could develop another web service to do the same job.
has comment: http://stackoverflow.com/comment/33974141
has comment: http://stackoverflow.com/comment/33974363
has comment: http://stackoverflow.com/comment/33974283
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22352174
upvote count: 1

http://stackoverflow.com/comment/134531083
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22442684
has text: Works on linux as well, [just a little different of course](https://stackoverflow.com/a/14986308/21851535)

http://stackoverflow.com/comment/34038856
has text: Why is it off topic? Where I should post this question?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22383142

image-scanner
tag name: image-scanner
type: Tag
tags question: http://stackoverflow.com/q/22448745

http://stackoverflow.com/comment/34090354
comment on: http://stackoverflow.com/a/22419055
has text: Thanks for your help. I'm still not sure about the answer to my first question: When starting to run something a thread, any code that it leads to, no matter how many classes it goes through and how many method calls there are, it will stay on the same thread, unless I create a new one. Is this correct?
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34347366
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22484925
has text: you explanation is really very good @Markus. Thank you very much. I would like to learn other things you mentioned at the end.

http://stackoverflow.com/comment/34166296
comment on: http://stackoverflow.com/a/22462364
has text: good point. Was trying to explain how he can pass data between activities
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/52338538
type: Comment
has text: @h4ck3r : if my hive server2 is security enabled, how do i connect to hive server in standalone mode or secured hadoop-yarn cluster mode? do i have to pass user, pass in the connection details?
comment on: http://stackoverflow.com/a/22437829
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34165204
type: Comment
score: 0
type: AnswerComment
has text: You could use e.g. a `String Tokenizer`. But it depends on what you want to do. Take a look [here](http://docs.oracle.com/javase/7/docs/api/java/util/StringTokenizer.html) for an overview.
comment on: http://stackoverflow.com/a/22461756

http://stackoverflow.com/q/22341518
answer count: 0
has comment: http://stackoverflow.com/comment/33954994
upvote count: 1
downvote count: 1
has title: Broken pipe error - while existing client terminate and new client join to ther server
type: Question
tagged with: java
has body: I am getting the broken pipe error while the client stopping the build process and new client connect with server and sending message to the server. Here my Server code: public class Server { ArrayList&lt;ObjectOutputStream&gt; ListOfclientOutputStreams; public Server() { ListOfclientOutputStreams = new ArrayList&lt;ObjectOutputStream&gt;(); try { ServerSocket serverSocket = new ServerSocket(7503); while(true) { Socket serverCommunicationSocket; serverCommunicationSocket = serverSocket.accept(); ObjectOutputStream eachClientobjectOutStream = new ObjectOutputStream(serverCommunicationSocket.getOutputStream()); ListOfclientOutputStreams.add(eachClientobjectOutStream); Thread threadForSpecificClient = new Thread(new SpecificClient(serverCommunicationSocket)); threadForSpecificClient.start(); System.out.println("Got a connection"); } }catch(IOException ex) { ex.printStackTrace(); } } private class SpecificClient implements Runnable { private ObjectInputStream eachClientObjectInputStream; private Socket sock; public SpecificClient(Socket specificSocket) { try { sock = specificSocket; eachClientObjectInputStream = new ObjectInputStream(sock.getInputStream()); }catch (IOException ex) { ex.printStackTrace(); } } public void run() { Message msgObject; try { while((msgObject = (Message) eachClientObjectInputStream.readObject()) !=null) { System.out.println("Client thread on the server read" + msgObject); broadCast(msgObject); } }catch (IOException ex) { ex.printStackTrace(); }catch(ClassNotFoundException ex){ System.out.println("Unable to read the message object in server"); ex.printStackTrace(); } } public void broadCast(Message msgObject) { Iterator&lt;ObjectOutputStream&gt; iter = ListOfclientOutputStreams.iterator(); try { while(iter.hasNext()) { ObjectOutputStream out = iter.next(); out.writeObject(msgObject); out.flush(); } }catch(IOException ex) { System.out.println("Unable to add the Message object to the outputstream in the server"); ex.printStackTrace(); } } } publi…
score: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33955410
type: UnansweredQuestion
tagged with: sockets

http://stackoverflow.com/comment/34099032
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22424354
type: QuestionComment
has text: a down vote? some people should not have access to the internet :(

http://stackoverflow.com/comment/34103050
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22426708
has text: what is the code of `drawBlocks` `drawBob` and `drawScore` ?

http://stackoverflow.com/comment/33954951
comment on: http://stackoverflow.com/q/22341470
type: Comment
type: QuestionComment
score: 0
has text: You cant access hard drive directly even if you are running the code in Emulator. You need a webservice for this. However the above will work with Java Application surely, but not with Android

http://stackoverflow.com/a/22485897
answers question: http://stackoverflow.com/q/22485715
score: 4
type: Answer
upvote count: 4
downvote count: 0
has body: Instead of passing methods and doing things reflectively, just pass in an invocable object that wraps the method and closes over this. If all the methods you'll be passing are void zero-argument methods you could just use java.lang.Runnable thus // final local variables are available to inner classes final World current = this; World.methodChecker( new Runnable() { public void run() { current.method1(); // Or alternatively {World.this.method1();} } }); If you need to actually return a value or pass parameters, then Guava's Function is not a bad choice.

http://stackoverflow.com/q/22342524
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22342561
has body: The question says 5 / 3 * 2.0 / (4 % 3) + 5 = 7.0 For some reason I don't understand why this makes sense at all. I start with dividing 5/6.0 = .83, then divide it by (4%3 which is 1) and add 5 but I'm not getting that answer. Can you explain it in detail. Thank you.
score: -2
has title: Beginner Arithmetic Math Operations (Java)
tagged with: arithmetic-expressions
downvote count: 3
upvote count: 1
answer count: 1
tagged with: operator-precedence
has comment: http://stackoverflow.com/comment/33956698
favorite count: 0

http://stackoverflow.com/a/22411802
type: Answer
has body: Another solution is to add a piece of javascript in the HTML that detects the language of you browser and set a GWT property &lt;script&gt; var search = location.search; if(search.indexOf("locale") == -1){ var lang = navigator.language!=null ? navigator.language : navigator.browserLanguage; var lang = lang.replace("-", "_"); document.write("&lt;meta name='gwt:property' content='locale="+lang +"'&gt;"); } &lt;/script&gt; In Java, you retrieve the browser local String currentLocalString = LocaleInfo.getCurrentLocale().getLocaleName(); And use the patterns here to format the date.
has comment: http://stackoverflow.com/comment/34079749
answers question: http://stackoverflow.com/q/22408685
score: 0

http://stackoverflow.com/a/22392988
accepted answer of: http://stackoverflow.com/q/22392936
type: Answer
has comment: http://stackoverflow.com/comment/34044974
has comment: http://stackoverflow.com/comment/34045203
answers question: http://stackoverflow.com/q/22392936
has comment: http://stackoverflow.com/comment/34045176
has body: Not sure your question. You want copies of ClassA's arrays in ClassB? Use System.arrayCopy() otherwise B's arrays will just be references to A's.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/22370196
type: Answer
has body: Try this @Entity @Table(name="STUDENT_INFORMATION") public class Student_Info { @Id @column(name="your id column name") private int rollNo; @column(name="your name column name") private String name; public int getRollNo() { return rollNo; } public void setRollNo(int rollNo) { this.rollNo = rollNo; } public String getName() { return name; } public void setName(String name) { this.name = name; } } You did not specify any mapping to your table and If you are not provided any mapping then ORM engine will check for same column names in database as default option and still if if did not find anything It will throw mapping exception. Enable your log and find more information how does Hibernate works... Hope this is helpful!
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34097798
answers question: http://stackoverflow.com/q/22366758
downvote count: 0

http://stackoverflow.com/comment/34025342
score: 0
has text: Sorry guys I edited the question. The text files are in the same directory.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22382262

http://stackoverflow.com/comment/34167120
score: 1
type: AnswerComment
has text: Say "static" instead of shared and I think you win this question. :)
type: Comment
comment on: http://stackoverflow.com/a/22462838

http://stackoverflow.com/comment/109730107
score: 0
has text: Ping @payne. I forgot to mention you in my answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22382818

http://stackoverflow.com/comment/35228357
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22459233
has text: Alter logging level & observe logs, you should get answer in it.

http://stackoverflow.com/q/22423677
favorite count: 0
linked to: http://stackoverflow.com/q/11696521
has answer: http://stackoverflow.com/a/43182264
upvote count: 15
has title: How to pass parameters to main method using Gradle?
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: gradle
type: Question
has comment: http://stackoverflow.com/comment/37608549
tagged with: program-entry-point
has answer: http://stackoverflow.com/a/22423778
score: 15
accepted answer: http://stackoverflow.com/a/22423778
tagged with: commandargument
answer count: 3
has body: I have to pass two arguments to my main method. My build script is // Apply the java plugin to add support for Java apply plugin: 'java' // In this section you declare where to find the dependencies of your project repositories { // Use 'maven central' for resolving your dependencies. mavenCentral() } // In this section you declare the dependencies for your production and test code dependencies { compile 'com.example:example-core:1.7.6' } task main(type: JavaExec, dependsOn: classes) { description = 'This task will start the main class of the example project' group = 'Example' main = 'com.example.core.Example' classpath = sourceSets.main.runtimeClasspath } If I try: gradlew main doc.json text.txt Then an error occured. org.gradle.execution.TaskSelectionException: Task 'doc.json' not found in root project How can I pass arguments to my main method command line easily?
possible better answer: http://stackoverflow.com/a/30180090
has answer: http://stackoverflow.com/a/30180090

http://stackoverflow.com/q/22340090
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/1090458
has comment: http://stackoverflow.com/comment/33952570
type: Question
has comment: http://stackoverflow.com/comment/33954539
upvote count: 1
tagged with: types
has comment: http://stackoverflow.com/comment/33953358
favorite count: 0
has comment: http://stackoverflow.com/comment/33954517
has title: Reflection - Java - Get Type of Generic type
tagged with: generics
duplicate of: http://stackoverflow.com/q/1090458
has body: public class superA&lt;TypeX&gt; { public superA(){ TypeX var1 = new ....... } } Imagine the above code, how do I find the type of TypeX if I wish to create a variable of that type before I receive any other information in the constructor?
downvote count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33952496
tagged with: reflection

http://stackoverflow.com/a/22355575
accepted answer of: http://stackoverflow.com/q/22355523
has comment: http://stackoverflow.com/comment/33979243
type: AcceptedAnswer
upvote count: 6
has body: == in Java compares Strings by reference (i.e. are the variables pointing to the same location in memory), not by value. Use catName.equals("Italy") to compare by value.
has comment: http://stackoverflow.com/comment/33979354
has comment: http://stackoverflow.com/comment/33979573
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22355523
score: 6

http://stackoverflow.com/comment/34067613
type: Comment
comment on: http://stackoverflow.com/a/22406750
has text: As others have mentioned if you ARE currently using Java 7 then the WatchService is probably going to be the best way to go. However if you have not migrated yet then my answer above will suffice.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22331467
answers question: http://stackoverflow.com/q/22331051
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22331051
type: Answer
has body: That depends on your purpose. If you want to create keyboard specifically to any activity then follow below tutorial. http://tutorials-android.blogspot.in/2011/06/create-your-own-custom-keyboard-for.html Or if you want to create keyboard that will replace default keyboard in all applications then following answer will be helpful to you. https://stackoverflow.com/questions/14806087/android-facebook-emoji-keyboard/14826813 As you said you want to change layout of keyboard then read this.
has comment: http://stackoverflow.com/comment/34059634
has comment: http://stackoverflow.com/comment/33962896
has comment: http://stackoverflow.com/comment/34020196
score: 0

http://stackoverflow.com/a/22366521
has body: First, new File() is just create object for file connect. you want use this file, file is exists or createNewFile(). If you want use this file to create directory, check file is exists, isDirectory() after then mkDir(). Second, check Environment.getExternalStorageDirectory is variable path. You can use DDMS or ADB for work. Additionaly, I think you add permission for read external storage for something error.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22366217
upvote count: 2
type: Answer

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/22378459
type: Tag

htmlunit
tags question: http://stackoverflow.com/q/22364920
type: Tag
tags question: http://stackoverflow.com/q/22442892
tags question: http://stackoverflow.com/q/22346638
tag name: htmlunit

http://stackoverflow.com/comment/33964334
type: Comment
type: QuestionComment
has text: Ok, this maybe works. but is not exactly this whole thing for load a json output of a rest service into own java objects like authenticationToken ?
comment on: http://stackoverflow.com/q/22345444
score: 0

http://stackoverflow.com/a/22379244
has body: I think you want String txt=nodeList.item(i).getTextContent(); instead of String txt=nodeList.item(i).getFirstChild().toString();.
score: 2
answers question: http://stackoverflow.com/q/22378880
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22378880
upvote count: 2
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/34184359
has text: ok - In the Main Activity it prints the "Error Number" Just I said, and yes it works so like you said. - Or have I something missunderstood?
comment on: http://stackoverflow.com/q/22466506
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22407504
has comment: http://stackoverflow.com/comment/34069696
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22407411
answers question: http://stackoverflow.com/q/22407411
type: Answer
has comment: http://stackoverflow.com/comment/34069250
has body: 5000 is just an initial capacity. It gets resized automatically once reaches its limit
score: 1
upvote count: 1

constructor
tags question: http://stackoverflow.com/q/22433440
tags question: http://stackoverflow.com/q/22353936
tags question: http://stackoverflow.com/q/22419349
tags question: http://stackoverflow.com/q/22391205
tags question: http://stackoverflow.com/q/22376792
tags question: http://stackoverflow.com/q/22441213
tags question: http://stackoverflow.com/q/22357680
tags question: http://stackoverflow.com/q/22336596
tag name: constructor
tags question: http://stackoverflow.com/q/22433558
tags question: http://stackoverflow.com/q/22374323
tags question: http://stackoverflow.com/q/22362302
tags question: http://stackoverflow.com/q/22356470
type: Tag
tags question: http://stackoverflow.com/q/22405234
tags question: http://stackoverflow.com/q/22365721
tags question: http://stackoverflow.com/q/22362955
tags question: http://stackoverflow.com/q/22436093
tags question: http://stackoverflow.com/q/22341018
tags question: http://stackoverflow.com/q/22394276

http://stackoverflow.com/comment/34172120
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22465479
has text: Short answer is you can't pass Android arguments through the command line.
type: QuestionComment

http://stackoverflow.com/comment/34002948
has text: No problem. Coding needs a sharp eye and you spotted his mistake when I couldn't. I spotted yours so that your answer wouldn't get downvotes ;)
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22368911
type: AnswerComment

http://stackoverflow.com/a/22394114
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22393927
has body: The problem you have is that StringBuilder is initially empty and you can't set a value/character which doesn't already exist. The simple solution to what you are attempting to do is to use a regex. private StringBuilder puzzle; Puzzle(String theSolution) { // create a buffer where all non space are turned into - puzzle = new StringBuilder(theSolution.replaceAll("\\S", "-")); }
type: Answer
accepted answer of: http://stackoverflow.com/q/22393927
score: 1

http://stackoverflow.com/q/22433085
has answer: http://stackoverflow.com/a/22433121
score: -1
tagged with: arraylist
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/34114547
favorite count: 0
has title: I call a method and it gives me an error
accepted answer: http://stackoverflow.com/a/22433121
has comment: http://stackoverflow.com/comment/34114429
has body: My source code: import java.util.*; public class Arvore { public Arvore() { root = null; } public void inserir(String x) { root = insert(x, root); } public void remove(String x) { root = remove(x, root); } private No remove(String x, No t) { if (t == null) { return t; } int comp = x.compareTo(t.str); if (comp &lt; 0) { t.left = remove(x, t.left); } else if (comp &gt; 0) { t.right = remove(x, t.right); } else if (t.left != null &amp;&amp; t.right != null) { t.str = findMin(t.right).str; t.right = remove(t.str, t.right); } else { t = (t.left != null) ? t.left : t.right; } return balance(t); } public String findMin() { return findMin(root).str; } public String findMax() { return findMax(root).str; } public boolean contains(String x) { return contains(x, root); } public void makeEmpty() { root = null; } public boolean isEmpty() { return root == null; } private static final int maxBal = 1; private No balance(No t) { if (t == null) { return t; } if (height(t.left) - height(t.right) &gt; maxBal) { if (height(t.left.left) &gt;= height(t.left.right)) { t = rotateWithLeftChild(t); } else { t = doubleWithLeftChild(t); } } else if (height(t.right) - height(t.left) &gt; maxBal) { if (height(t.right.right) &gt;= height(t.right.left)) { t = rotateWithRightChild(t); } else { t = doubleWithRightChild(t); } } t.height = Math.max(height(t.left), height(t.right)) + 1; return t; } public void checkBalance() { checkBalance(root); } private int checkBalance(No t) { if (t == null) { return -1; } if (t != null) { int hl = checkBalance(t.left); int hr = checkBalance(t.right); if (Math.abs(height(t.left) - height(t.right)) &gt; 1 || height(t.left) != hl || height(t.right) != hr) { System.out.println("OOPS!!"); } } return height(t); } private No insert(String x, No t) { if (t == null) { return new No(x, null, null); } int comp = x.compareTo(t.str); if (comp &lt; 0) { t.left = insert(x, t.left); } else if (comp &gt; 0) { t.right = insert(x, t.right); } else ; t.occ+=1; return balance(t); } priv…
type: AnsweredQuestion
tagged with: java
tagged with: warnings
tagged with: methods
downvote count: 1
has comment: http://stackoverflow.com/comment/34114436
type: Question

http://stackoverflow.com/q/22431117
tagged with: public
upvote count: 2
tagged with: tcp
tagged with: java
tagged with: forwarding
tagged with: ip
type: Question
has comment: http://stackoverflow.com/comment/34111140
has title: Connect via TCP and public IP without forwarding
has body: I'm trying to write a simple chat program using TCP in java. To connect to a server I need to know its IP address. I'm connected to a router in my network, that connects me to the Internet. When I type local IP (assigned by router) it works pretty well between my two computers. But when I typed public IP (I got it from google: "what is your ip"...) - it didn't work. So I opened router's setup and make forwarding rule from my public IP and specific port to the local IP - and it worked. --------- Question: But how to do this without forwarding? I want to write a chat program. I can't tell my users: "just do the port forwarding" ;) One opens my program and logs into central server, then writes there public IP. Some other user opens this server, download the file and gets first user's IP (or any other needed info). But if first user didn't do the port forwarding, it won't work. How to make it work?
score: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34111547
has comment: http://stackoverflow.com/comment/34113100
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22432262

http://stackoverflow.com/comment/36942443
comment on: http://stackoverflow.com/q/22426798
type: Comment
type: QuestionComment
has text: hi, did you have any success? i also need a low latency bi-directional com link between my pc app and android slave app. the app works now via wifi but the latency is too slow (about 300mS), i'm looking to get it down to 10mS or so.
score: 0

http://stackoverflow.com/a/22426062
score: 7
accepted answer of: http://stackoverflow.com/q/22426047
has comment: http://stackoverflow.com/comment/87791736
has body: The erasure of a type parameter is always the erasure of its left-most bound, doesn't matter what other classes are up there in the inheritance hierarchy (JLS §4.6). So, the method is erased to: void foo(final A) Of course, as noted in comments, if A and B both are classes, that code will not compile. The type parameter bounds can not have multiple classes as bounds, but only a single class followed by any number of interfaces. See JLS §4.4 for the syntax of type variable declaration: TypeParameter: TypeVariable TypeBoundopt TypeBound: extends TypeVariable extends ClassOrInterfaceType AdditionalBoundListopt AdditionalBoundList: AdditionalBound AdditionalBoundList AdditionalBound AdditionalBound: & InterfaceType Any AdditionalBound should always be an InterfaceType. the JVM casts to X at runtime? Yes the compiler will add appropriate cast so that the code works as intended.
upvote count: 7
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34101837
type: Answer
answers question: http://stackoverflow.com/q/22426047
downvote count: 0

http://stackoverflow.com/comment/33991789
type: Comment
comment on: http://stackoverflow.com/a/22362402
has text: COnsider what things look like to your user. It looks like you want to start by asking the user to enter the dimensions of a non-square rectangle and then accept the length and width. If the length and width represent a square prompt the user and loop (get length and width in the while loop)
type: AnswerComment
score: 0

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/22408673
tag name: maven-jaxb2-plugin

http://stackoverflow.com/comment/34036868
type: QuestionComment
comment on: http://stackoverflow.com/q/22388088
score: 0
has text: Or, instead of saying "rest of the rows" i should say, i need it to iterate through ALL rows, performing the same calculation, so that I can call it at any point and update every value in the "mpg" column of the database, based off that statement
type: Comment

http://stackoverflow.com/a/22482515
score: 1
answers question: http://stackoverflow.com/q/22481878
has body: Have a look at Executors, which is a factory for ExecutorService. With the method shutdown() you may stop the execution of tasks not yet started. With the method shutdownNow() you will interrupt already started tasks as well. Perhaps the method awaitTermination() is of interest as well to you. Just read the javadoc.
downvote count: 0
has comment: http://stackoverflow.com/comment/34202234
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34231276
has comment: http://stackoverflow.com/comment/34200727

http://stackoverflow.com/q/22440826
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22440974
accepted answer: http://stackoverflow.com/a/22440974
tagged with: java
has comment: http://stackoverflow.com/comment/34128638
has body: I have a text file with more than 20,000 lines and i need to extract specific line from it. The output of this program is completely blank file. There are 20,000 lines in the txt file and this ISDN line keeps on repeating lots of time each with different value. My text file contains following data. RecordType=0(MOC) sequenceNumber=456456456 callingIMSI=73454353911 callingIMEI=85346344 callingNumber AddInd=H45345'1 NumPlan=H34634'2 ISDN=94634564366 // Need to extract this "ISDN" line only public String readTextFile(String fileName) { String returnValue = ""; FileReader file = null; String line = ""; String line2 = ""; try { file = new FileReader(fileName); BufferedReader reader = new BufferedReader(file); while ((line = reader.readLine()) != null) { // extract logic starts here if (line.startsWith("ISDN") == true) { System.out.println("hello"); returnValue += line + "\n"; } } } catch (FileNotFoundException e) { throw new RuntimeException("File not found"); } finally { if (file != null) { try { file.close(); } catch (IOException e) { e.printStackTrace(); } } } return returnValue; }
type: Question
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/34128582
has title: How to extract starting of a String in Java
has comment: http://stackoverflow.com/comment/34128584

http://stackoverflow.com/a/22443770
answers question: http://stackoverflow.com/q/22443743
type: Answer
upvote count: 4
downvote count: 0
score: 4
has body: for(int i = 0; i &lt;cardValue.length; i++){ int k = 1; if(k &lt;=9){ ... Given the preceding code, it'll always enter on the if and never on the else. Therefore, the for that uses the f variable, will never be executed.

http://stackoverflow.com/comment/34063896
has text: http://stackoverflow.com/questions/2421826/what-is-androids-file-system
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22404750

http://stackoverflow.com/comment/96270471
comment on: http://stackoverflow.com/a/49757425
type: AnswerComment
score: 0
type: Comment
has text: @FraK, the most rated solution contains this advice. Though I had already unchecked Instant Run (several years it has bringing many bugs).

http://stackoverflow.com/comment/34184889
has text: `(elev[a][b] - elev[a+1][b]) > 0 ) ` should not compile, it has mismatched parenthesis... (Point of this sarcastic comment is: showing partial code and asking why it crashes is pointless.)
score: 0
comment on: http://stackoverflow.com/q/22471809
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34082230
comment on: http://stackoverflow.com/q/22414087
score: 0
type: QuestionComment
type: Comment
has text: can you give me an example? how can i use Handler in this case?

http://stackoverflow.com/comment/34028463
comment on: http://stackoverflow.com/q/22384031
score: 0
type: Comment
has text: @Raghunandan Yes, according to the condition
type: QuestionComment

http://stackoverflow.com/q/22430697
has body: I want to create a simple excel file to put some data in, but i have an error at Row and Cell line. What is wrong? It says: 1 .Row is an internal propery API and may be removed in future releases and 2 .Cannot find symbol cell HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Sample sheet"); //Create a new row in current sheet 1. Row row = sheet.createRow(0); //Create a new cell in current row 2. Cell cell = row.createCell(0); //Set value to new value cell.setCellValue("Blahblah"); I have include: &gt; import org.apache.poi.hssf.usermodel.HSSFSheet; import &gt; org.apache.poi.hssf.usermodel.HSSFWorkbook; import &gt; org.apache.poi.hssf.usermodel.HSSFCell; import &gt; org.apache.poi.hssf.usermodel.HSSFCellStyle; import &gt; org.apache.poi.hssf.usermodel.HSSFDataFormat; import &gt; org.apache.poi.hssf.usermodel.HSSFRow; import &gt; org.apache.poi.hssf.usermodel.HSSFSheet; import &gt; org.apache.poi.hssf.usermodel.HSSFWorkbook; import &gt; org.apache.poi.hssf.util.HSSFColor; import &gt; com.sun.rowset.internal.Row;
score: 0
has title: Cannot make sample xls file with Apache POI
has answer: http://stackoverflow.com/a/22430773
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22430813
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/34188419
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22474200
score: 0
has text: Your error appears in packed.js. But I don't see where that script is included. I don't see any reference to jquery.atmospthere.js, either. Are you including it?

http://stackoverflow.com/a/22473676
answers question: http://stackoverflow.com/q/22473333
score: 0
type: Answer
has body: If JAXB is to difficult for you, try the DOM Parser. Its pretty simple. DOM Example

http://stackoverflow.com/q/22443506
has body: I'm importing a package (in my case, mongodb.DB) into a java file with an identically named class. In python, I know I can import a module as another name to avoid conflicts. How does Java solve this problem? It's not feasible to change the name of the class I'm working in.
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22444005
type: Question
tagged with: mongodb
answer count: 2
downvote count: 0
has title: "The import [...] conflicts with a type defined in the same file" error [java]
upvote count: 1
has answer: http://stackoverflow.com/a/22444005
favorite count: 0
has answer: http://stackoverflow.com/a/22443718
accepted answer: http://stackoverflow.com/a/22443718

http://stackoverflow.com/a/22347042
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22346795
answers question: http://stackoverflow.com/q/22346795
score: 7
upvote count: 7
has body: Have a lookat the options specific for the OS X JVM. Specifically for MaxFDLimit: -XX:- MaxFDLimit Directs the VM to refrain from setting the file descriptor limit to the default maximum. The default behavior is to set the limit to the value specified by OPEN_MAX, which is 10240. Normally, this is the maximum number of files that a process may have open. It is possible, however, to increase this limit to a user-specified value with the sysctl utility. Under such circumstances, you may want to pass -XX:-MaxFDLimit to stop the Java VM from restricting the number of open files to 10240.

http://stackoverflow.com/a/22488151
type: Answer
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22482196
has body: "Do I have to make as many ActionListeners as there are elevators, so it can listen to them independently?" No, that would require multiple Timers. Avoid doing this whenever you can. "Can you guys suggest a way or give me advice to animate them separately from each other, like say move them up and down independently?" What you should do is try and implement the business logic in methods within your Elevator class and just call the those methods while looping through all the Elevators in your array. Two make the Elevators to appear to move independently, you can have flags, say in your move method, like public void move() { if (move) { // do something } } What ever is your reason for making the elevator move, that will be the reason the raise the flag. And vice versa. Maybe something like if (onFloor) { elevator.move = false }, maybe for a duration of 20 timer "iterations", and keep a count in the elevator class, that will reset back to 0 when the count hits 20, then move will be back at true. Here's an example you can play with. I was working on it for about 20 minutes then gave up. The logic is a bit off, but it basically points out the ideas i mentioned. Maybe you'll have better luck with it. You can also see a good working example of moving different object here import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.Timer; public class ElevatorAnimate extends JPanel { private static final int D_W = 300; private static final int FLOORS = 6; private static final int FLOOR_HEIGHT = 100; private static final int BUILDING_HEIGHT = FLOORS * FLOOR_HEIGHT; private static final int D_H = BUILDING_HEIGHT; private static final int BUILDING_BASE = BUILDING_HEIGHT; private static final int ELEVATOR_HEIGHT = 60; private static final int ELEVATOR_WIDTH…

http://stackoverflow.com/a/22488044
downvote count: 0
has comment: http://stackoverflow.com/comment/42524501
has comment: http://stackoverflow.com/comment/34250356
type: Answer
has body: since you have this error message: "ActivityNotFoundException: No Activity found to handle Intent", you need to define what activity must open your intent, in this case the browser. Intent i = new Intent(Intent.ACTION_VIEW); File file = new File(f.getAbsolutePath()); String extension = android.webkit.MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(file).toString()); String mimetype = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); //you need define this activity to open your html file. i.setClassName("com.google.android.browser", "com.android.browser.BrowserActivity"); //intent.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity")); i.setDataAndType(Uri.fromFile(file),mimetype); EDIT: The activity to start the browser in glass is: i.setClassName("com.google.glass.browser", "com.google.glass.browser.WebBrowserActivity")
has comment: http://stackoverflow.com/comment/34235226
accepted answer of: http://stackoverflow.com/q/22487736
answers question: http://stackoverflow.com/q/22487736
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/q/22476092
has comment: http://stackoverflow.com/comment/34190319
type: Question
has title: On Deployment file path substitution Java
has comment: http://stackoverflow.com/comment/34189848
tagged with: path
tagged with: deployment
has comment: http://stackoverflow.com/comment/34189783
tagged with: java
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34190436
has comment: http://stackoverflow.com/comment/34189928
answer count: 0
has body: I have an application with several paths and filenames to use All of them are relative, not absolute. When I was building a regular Java app, it was fine, but now I turned it into Tomcat web app timetables timteables.db .exclude .master I need to substitute something like /usr/share/&lt;APPNAME&gt; and /var/&lt;APPNAME&gt;, when I deploy my app into tomcat. I use listener-class in my web.xml. How can I correctly add them? What is the Java way to solve this? I don't want to hard-code them for several reasons: because it's not beautiful and correct, and, as my project is open-source, I don't want to reveal my own paths.
tagged with: tomcat

http://stackoverflow.com/comment/34199973
type: AnswerComment
has text: as the other responder (@lukdumi) said this is not an elegant way to do it. I think writing a specialized formatter that can convert from id to MaritalStatus object is the better one.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22458457

http://stackoverflow.com/comment/33962688
comment on: http://stackoverflow.com/q/22344063
score: 0
type: Comment
type: QuestionComment
has text: check this link: http://stackoverflow.com/questions/20136121/android-how-to-take-screenshot-programatically

http://stackoverflow.com/q/22415054
has comment: http://stackoverflow.com/comment/34083043
answer count: 0
has comment: http://stackoverflow.com/comment/34082937
type: Question
has comment: http://stackoverflow.com/comment/34083604
has title: Get 32-bit zip files using 64-bit Java
has comment: http://stackoverflow.com/comment/34082975
tagged with: http://stackoverflow.com/tag/zip
has comment: http://stackoverflow.com/comment/34083681
has comment: http://stackoverflow.com/comment/34083645
score: 0
tagged with: 64-bit
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/130581035
has body: When I zip files using 64 bit Java, the zip file show up as empty on Windows 7. Is there a way to force 32 bit version of zip using 64 bit Java? EDIT: I'm able to open/unzip it using third party tools like BeyondCompare. When I browse that file through Windows 7, the content is empty. Unzipping it using Win 7 gives me 'Invalid zip file' error. public static void zipFiles(Collection&lt;String&gt; fileLocations, String targetZipFile){ if( fileLocations == null || fileLocations.size() &lt;= 0 ){ return; } byte[] buffer = new byte[1024]; try{ ZipOutputStream out = new ZipOutputStream(new FileOutputStream(targetZipFile)); FileInputStream in = null; String fileName = null; for( String fileLoc : fileLocations ){ fileName = fileLoc.substring(fileLoc.lastIndexOf(File.separator)); // Add ZIP entry to output stream. out.putNextEntry(new ZipEntry(fileName)); in = new FileInputStream(fileLoc); int len; while ((len = in.read(buffer)) &gt; 0) { out.write(buffer, 0, len); } // Complete the entry out.closeEntry(); in.close(); } // Complete the ZIP file out.close(); }catch(IOException ioe){ LOGGER.error(ioe.getMessage(),ioe); } }

http://stackoverflow.com/comment/34044577
score: 0
comment on: http://stackoverflow.com/q/22392999
type: Comment
type: QuestionComment
has text: Second definition is wrong too.

http://stackoverflow.com/comment/34096917
comment on: http://stackoverflow.com/q/22423147
type: Comment
type: QuestionComment
score: 0
has text: @TedBigham yes indeed

http://stackoverflow.com/a/22483832
downvote count: 0
has comment: http://stackoverflow.com/comment/34203579
answers question: http://stackoverflow.com/q/22483690
type: Answer
has body: Two different data types can not be compared. Instead one of the two needs to be cast/coerced to the same data type as the other. In your case you're not doing the coercion, so the DB Engine is doing an implicit coercion. Based on data-type-order-of-precedence, the database engine chooses the string to be coerced to a numeric. The value '1adjfa' therefore becomes a 1, and then your comparison is being made. This results is your query effectively being: Select count(*) from table where `Numeric` = 1 You should either not be comparing numerics and strings, or do the coercion yourself, for example... Select count(*) from table where CAST(`Numeric` AS VARCHAR(32)) = '1adjfa' In terms of breaking the query, I'm hoping that in your application you're actually using parameterised queries. This will allow you to define the data-type of the parameter, and your application should throw the error if the wrong data-type is supplied.
accepted answer of: http://stackoverflow.com/q/22483690
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/q/22441369
has title: read the first file and write to the second
accepted answer: http://stackoverflow.com/a/22441490
type: AnsweredQuestion
tagged with: text-files
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/22441490
has body: I have a file with following text: Alan Alda 100 2 Coco Channel 103 2 Eric Edwards 105 0 ... I should use only one method for read the first file and write this information to the second and count the number of lines which means borrowers and total books borrowed which is the last number in the line. OK So in my output are 3 empty lines for this text but count and total is good processed on following lines.I had no idea how to add last number only by give a variable to each String. input = new Scanner(inFile); output = new PrintWriter(outFile); ... public void processFiles() { while(input.hasNextLine()) { count++; String firstName = input.next(); String lastName = input.next(); String libraryNumber = input.next(); total += input.nextInt(); output.println(input.nextLine());//empty strings } output.println("number of borrowers"+count); //3 output.println("number of books borrowed"+total); //2+2+0 }
score: 0
tagged with: java

http://stackoverflow.com/q/22441343
type: Question
tagged with: spring-mvc
score: 1
tagged with: java
has title: Async processing inside a Spring controller
upvote count: 1
has comment: http://stackoverflow.com/comment/34129992
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: asynchronous
answer count: 0
downvote count: 0
has body: I have a request handler which does some heavy lifting inside and takes about 5 secs to return. The request returns a Model which includes 3 collections. The heaviest collection takes about 2 secs to process and they are all independent. I wanted to try and run them in parallel inside the request but nothing I have tried seems to work. What I am seeing is that tomcat handles the first few requests but pretty soon it just chokes and stops. Here is what Iv'e tried: I have a utility that takes Callable's, runs them on a pretty big Executor, and returns FutureTasks. public class Async { public static boolean active = true; private static ExecutorService exe = active ? Executors.newFixedThreadPool(50) : null; public static FutureTask run(Callable callable) throws Exception { FutureTask f = new FutureTask(callable); if (active) { exe.execute(f); } else { f.run(); } return f; } } And i use it like this: @RequestMapping("/test") public @ResponseBody MessageDto authenticate(HttpServletRequest request, HttpServletResponse response) throws Exception { final Map&lt;String, Object&gt; responseMap = new HashMap&lt;String, Object&gt;(); FutureTask future1 = Async.run(new Callable() { @Override public Object call() throws Exception { try { [SOME PROCESS THAT TAKES ABOUT 2 SECS] } catch (Exception ex) { LOG.error(ex); } return null; //To change body of implemented methods use File | Settings | File Templates. } }); FutureTask future2 = Async.run(new Callable() { @Override public Object call() throws Exception { try { [SOME PROCESS THAT TAKES ABOUT 2 SECS] } catch (Exception ex) { LOG.error(ex); } return null; //To change body of implemented methods use File | Settings | File Templates. } }); FutureTask future3 = Async.run(new Callable() { @Override public Object call() throws Exception { try { [SOME PROCESS THAT TAKES ABOUT 1 SEC] } catch (Exception ex) { LOG.error(ex); } return null; //To change body of implemented methods use File | Settings | File Templates. } }); future1.get(); …
has comment: http://stackoverflow.com/comment/34132576

http://stackoverflow.com/comment/34151679
has text: To share information maybe? It took me pretty long to resolve the problem in my code.
comment on: http://stackoverflow.com/a/22454134
score: 4
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/61202415
type: Comment
score: 2
has text: toCharArray performs better than charAt - https://leetcode.com/discuss/77851/java-15ms-easiest-solution-100-00%25
comment on: http://stackoverflow.com/q/22445104
type: QuestionComment

http://stackoverflow.com/comment/34151754
type: QuestionComment
has text: @anirudh Good question. I forgot to say that these classes are part from a library. Class2 is declared as a public class and Class1 is not.
comment on: http://stackoverflow.com/q/22453289
score: 0
type: Comment

http://stackoverflow.com/comment/34140053
has text: Make sure the image is present in your drawable folder or will you can post your XML file
comment on: http://stackoverflow.com/a/22446765
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22467934
has comment: http://stackoverflow.com/comment/34176542
has comment: http://stackoverflow.com/comment/34177417
has comment: http://stackoverflow.com/comment/34176610
has comment: http://stackoverflow.com/comment/34176999
has comment: http://stackoverflow.com/comment/34177635
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34178487
has body: Maybe because your using cosine when calculating y value. Shouldn't it be sine?
has comment: http://stackoverflow.com/comment/34177761
accepted answer of: http://stackoverflow.com/q/22467801
answers question: http://stackoverflow.com/q/22467801
has comment: http://stackoverflow.com/comment/34177263

http://stackoverflow.com/a/22338383
answers question: http://stackoverflow.com/q/22337941
score: 0
has body: using MikeG010590's answer, you can try: Scanner in = new Scanner(System.in); String line; System.out.println("you want to continue?"); Boolean exit = null; do { line = in.nextLine(); switch (line) { case "yes": exit = false; break; case "no": exit = true; break; default: System.out.println("Please enter yes or no"); break; } } while (exit == null); System.out.println(exit ? "Thank you. Goodbye" : "Lets go");
type: Answer

http://stackoverflow.com/q/22486927
has comment: http://stackoverflow.com/comment/34209231
type: UnansweredQuestion
tagged with: soap
tagged with: web-services
tagged with: java
has answer: http://stackoverflow.com/a/46150805
type: Question
has comment: http://stackoverflow.com/comment/34209465
has title: SOAPException IOException
has body: I'm a noob in java! I have a java Application in a OAS server, When I try to call a web service in another server return this excepción [SOAPException: faultCode=SOAP-ENV:IOException; msg=Connection timed out;targetException=java.net.ConnectException: Connection timed out] I don't have idea what is the problem or the cause. Any ideas?
answer count: 1
score: 0
tagged with: oracle-database
tagged with: oas

http://stackoverflow.com/q/22343072
linked to: http://stackoverflow.com/q/17093862
type: Question
has body: I am trying to make an Ajax call to a Struts 2 action method and then displaying the value of a variable in the action class. Even though the method is getting called, I am unable to see the value of the variable. The getters and setters of the variable are in place in the action class. My action method: public String testMethod(){ //Set value of variable "myVariable" } The Ajax method: $.ajax({ type: "POST", url: "testmethod", //the declaration in struts.xml success: function(){ //how to access value of myVariable here } }); in the success callback of the Ajax call in the JSP page, I am trying to access it via the <s:property> but it does not seem to be working.
has title: How to set and access value of Struts 2 action variables using Ajax calls
tagged with: struts2
score: 0
answer count: 1
tagged with: jsp
tagged with: jquery
tagged with: ajax
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22345760
tagged with: java

http://stackoverflow.com/a/28425440
upvote count: 0
type: Answer
has body: you can also check this link on Stack Overflow which sheds more light on the "Connection Refused Error " java.net.ConnectException: Connection refused
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/22378114

tcp
type: Tag
tags question: http://stackoverflow.com/q/22476376
tags question: http://stackoverflow.com/q/22472844
tags question: http://stackoverflow.com/q/22381449
tags question: http://stackoverflow.com/q/22420342
tags question: http://stackoverflow.com/q/22417228
tags question: http://stackoverflow.com/q/22479422
tags question: http://stackoverflow.com/q/22457185
tag name: tcp
tags question: http://stackoverflow.com/q/22431117

http://stackoverflow.com/comment/34580081
has text: Sorry for such a delayed reply. I've been looking and can't find any gesture dictionaries with alphabet characters in them or anything similar to that. Are there any that you know of?
comment on: http://stackoverflow.com/a/22482338
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34258395
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22467367
type: Comment
has text: public abstract class AbstractPerson { protected String gender = "AbstractPerson"; } public class Male1 extends AbstractPerson { public String gender = "Male"; } AbstractPerson person = new Male1(); System.out.println("P = " + person.gender); Is giving "AbstractPerson"

http://stackoverflow.com/comment/34062158
type: AnswerComment
has text: thank you @ruslanys it works! may I know that why you add connection.setRequestProperty("Connection", "keep-alive");? is there any PHP code specify this?
comment on: http://stackoverflow.com/a/22403332
type: Comment
score: 0

http://stackoverflow.com/comment/34159190
type: AnswerComment
has text: trying right now. I'm getting some errors. dishQueues.get(dishID-1) is stated in your answer as a variable which is incorrect i think
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22458290

http://stackoverflow.com/comment/34044625
type: AnswerComment
has text: " In Java, a constructor is used to create an instance of the class" - i thought the "new" keyword is what created the instance of the class?
comment on: http://stackoverflow.com/a/22392389
score: 0
type: Comment

http://stackoverflow.com/q/22391650
answer count: 3
has title: Android ImageView Layout Issues
possible better answer: http://stackoverflow.com/a/22392078
tagged with: android
tagged with: android-imageview
has answer: http://stackoverflow.com/a/22394149
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22392171
accepted answer: http://stackoverflow.com/a/22392171
tagged with: java
has body: There very well may be a duplicate question, but I have yet to find it. I am doing thing all programmatically, not using the xml. Basically what I am trying to do is to have an EditText appear below an image. I am using RelativeLayout with an ImageView and and EditText. These are the parameters that I am setting up for the ImageView and EditText: RelativeLayout.LayoutParams editTextParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); editTextParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); editTextParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); editTextParams.width=500; RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); imageParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); imageParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); imageParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); imageParams.addRule(RelativeLayout.ABOVE, editText.getId()); Which I have verified correctly places the EditText in the bottom right corner and the image above. What I run into is if the picture it "too tall" then it covers the EditText. I also tried using imageView.setScaleType(ImageView.ScaleType.FIT_XY); and it stretches it over the EditText as well. The full code that I am using is this RelativeLayout layout = (RelativeLayout) findViewById(R.id.mainLayout); ImageView imageView = new ImageView(this); EditText editText = new EditText(this); RelativeLayout.LayoutParams editTextParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); editTextParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); editTextParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); editTextParams.width=500; RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); imageParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); imageParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); imageParams.addR…
type: Question
tagged with: android-layout
has answer: http://stackoverflow.com/a/22392078
has comment: http://stackoverflow.com/comment/34042920
score: 0

http://stackoverflow.com/comment/34101885
comment on: http://stackoverflow.com/q/22426181
type: QuestionComment
has text: Well, in one case you have `PupilVO` elements, in the other you have `Class` elements... Those are not the same at all
type: Comment
score: 1

http://stackoverflow.com/q/22371039
has comment: http://stackoverflow.com/comment/34006166
tagged with: jscrollpane
has comment: http://stackoverflow.com/comment/34006228
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34006184
favorite count: 0
has comment: http://stackoverflow.com/comment/34006310
has title: Adding JScrollPane to a JPanel without a Layout Manager
has comment: http://stackoverflow.com/comment/34006122
tagged with: swing
has answer: http://stackoverflow.com/a/22371272
type: AnsweredQuestion
tagged with: null-layout-manager
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22371272
has body: Before I start, I'm aware that its a bad idea to not use a Layout Manager and usually I do use one, however, I also have all my components automatically re-size and relocate based on the size of the window. In addition the program I'm working on is only intended to run on 1 machine throughout its entire lifetime. Please don't downvote me just because of lack of layout manager, I found it to be what I need for this particular program. To my issue, I found a similar post on stackoverflow but a solution was never achieved. I'm adding a dynamic amount of JLabels to my JPanel, I've noticed that when not using a layout manager, the scroller doesn't work. This is a simplified version of my initialization code. JPanel mypanel = new JPanel(); mypanel.setLayout(null); mypanel.setSize(800,450); mypanel.setForeground(Color.WHITE); mypanel.setBackground(Color.BLACK); scrollablePanel = new JScrollPane(mypanel); scrollablePanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollablePanel.setPreferredSize(new Dimension(800,300)); scrollablePanel.setSize(800,300); scrollablePanel.setLocation(250,156); myContainer.add(scrollablePanel); where myContainer would be the container (also without a layout manager). The JLabels are added later on to the JPanel with: enter code heremypanel.add(label1); after some basic settings are set for the labels such as setForeground and setBackground. Unfortunately when run, the scrollbar appears as if its not required (see image) https://i.sstatic.net/OEl5O.png The table text seen in the image is made up of multiple JLabels. If it's not possible to resolve the issue without using a Layout Manager I will switch to BoxLayout, I was just hoping there would be a solution.
tagged with: jpanel

http://stackoverflow.com/comment/34140782
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22447513
has text: I also wanted to know if Java could look as good as something made using Qt
type: AnswerComment

http://stackoverflow.com/comment/34139534
has text: I'm using TomEE+ 1.6.0
comment on: http://stackoverflow.com/q/22418299
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22539522
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22433677
has body: It appears that you are on the right track, however, I would suggest that you take a look at using a framework like jQuery because this task would be much simpler. First off, looking at the xmlhttp.responseText, it appears that you need to change your struts configuration so that the output is not a full HTML document. The way the server is returning this response is going to make it very difficult for you to process. A quick way to make this work the way you want is to have the server generate a populated select tag. When your source page renders, place a disabled select tag inside of a div element that you can reference by an ID like so - &lt;div id="dynamicSelectTagHolder"&gt; &lt;select name="foo" disabled="true" /&gt; &lt;/div&gt; Once the server has generated a result, you can assign the contents of the div#dynamicSelectTagHolder to the text returned by the server using innerHTML like so - document.getElementById("dynamicSelectTagHolder").innerHTML = xmlhttp.responseText; Be forewarned you may run into many problems with your current approach. It has been a while for me, but if I remember correctly, innerHTML and getElementById is not something that works perfectly across all browsers. That is why I suggest looking into jQuery.
type: Answer
score: 2

http://stackoverflow.com/a/22346059
accepted answer of: http://stackoverflow.com/q/22345789
answers question: http://stackoverflow.com/q/22345789
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33963175
type: Answer
downvote count: 0
has body: This line is the culprit: PdfContentByte content = stamper.getUnderContent(pageNumber); You are adding the text under the existing content. As the existing content consists of an opaque image, the text is present, but covered by white pixels. Change the line into: PdfContentByte content = stamper.getOverContent(pageNumber); and your problem will be solved. You may want to make the text slightly transparent if you don't want to cover the existing content completely.
score: 1

http://stackoverflow.com/comment/34073285
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22409768
has text: You're probably not updating the combo box that is actually displayed on the screen. But with the partial code you posted, it's hard to spot the error.

http://stackoverflow.com/a/22470148
score: 1
upvote count: 1
has body: Why don't you add another variable to store both the integer and the longest number of count and update these information only if current count is bigger than longest count stored?
has comment: http://stackoverflow.com/comment/34180691
downvote count: 0
has comment: http://stackoverflow.com/comment/34180189
has comment: http://stackoverflow.com/comment/34180234
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34180547
accepted answer of: http://stackoverflow.com/q/22469534
answers question: http://stackoverflow.com/q/22469534
type: Answer
has comment: http://stackoverflow.com/comment/34182226

http://stackoverflow.com/comment/47018450
comment on: http://stackoverflow.com/a/26240077
type: AnswerComment
type: Comment
has text: On a second attempt... This worked fine when I created my own auditing class... I'll post in an answer.
score: 1

http://stackoverflow.com/comment/34032639
has text: I have added `ClassNotFoundException`. Try it.
comment on: http://stackoverflow.com/a/22384826
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22480192
score: 11
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34196703
has title: Why Java object class remains same after casting?
tagged with: java
has comment: http://stackoverflow.com/comment/34197245
possible better answer: http://stackoverflow.com/a/22480294
type: Question
linked to: http://stackoverflow.com/q/2885385
downvote count: 0
has answer: http://stackoverflow.com/a/22480293
accepted answer: http://stackoverflow.com/a/22480293
favorite count: 0
tagged with: class
has body: I tried to upcast an objet. But at runtime object class is remained as a derived class. Derived drv = new Derived(); Base base = (Base) drv; System.out.println("Class : " + base.getClass()); //prints -&gt; Class : class packagename.Derived So Why class property didn't change?
answer count: 3
has answer: http://stackoverflow.com/a/22480294
has answer: http://stackoverflow.com/a/22480335
linked to: http://stackoverflow.com/q/5531254
upvote count: 11
tagged with: upcasting

http://stackoverflow.com/comment/34153731
score: 0
comment on: http://stackoverflow.com/q/22455381
type: Comment
type: QuestionComment
has text: You could wrap the elements in a custom type, but this solution is a bit cumbersome.

http://stackoverflow.com/comment/34209619
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22487053
has text: Please confirm the code reads correctly - HTML looks malformed.
score: 0

http://stackoverflow.com/q/22479566
tagged with: swing
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34196525
has comment: http://stackoverflow.com/comment/34196627
has answer: http://stackoverflow.com/a/22480083
has comment: http://stackoverflow.com/comment/34197032
tagged with: eclipse
has comment: http://stackoverflow.com/comment/34196444
answer count: 2
has body: I have a java swing application which reads the values for its components from a .text file. I'm trying to update one of its value and store it in .text file and then need a refresh possibly in the GUI screen as well. Value is modified in the file but GUI could not detect the change without a restart. I have went through repaint(), re-validate() with the use of timers. Can anyone specify what i could do? Thanks in advance.
has comment: http://stackoverflow.com/comment/34195911
tagged with: user-interface
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34195559
upvote count: 2
accepted answer: http://stackoverflow.com/a/22480083
tagged with: refresh
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22480010
tagged with: java
has answer: http://stackoverflow.com/a/22480010
has title: How to auto refresh gui screen in java, after update taking place in a stored file?
linked to: http://stackoverflow.com/q/16251273

http://stackoverflow.com/comment/34163163
has text: This did the trick thank you. Will set as accepted answer after the allotted waiting time. Thanks again.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22460609
type: Comment

http://stackoverflow.com/a/22420607
type: Answer
has body: The "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." is misleading. It implies you've reached some kind of quota, but that is almost never the case. The Drive quota for unauthenticated use is ZERO. So what the message is really telling you is that your Drive request isn't carrying an Auth token. You should trace the http and you will find that the requests that are failing are missing the Authorization header. As to why, well that's an exercise for the reader.
accepted answer of: http://stackoverflow.com/q/22407433
has comment: http://stackoverflow.com/comment/34232047
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22407433

http://stackoverflow.com/comment/115581408
comment on: http://stackoverflow.com/a/22353240
score: 0
type: AnswerComment
type: Comment
has text: So, if I have a function that does something, say "getTheMessages()", would I put it directly underneath `printHandler.postDelayed(this, DELAY);`? I also tried to Log.d(TAG, "postDelayed called");, but it logs nothing. I placed my method to get stuff inside that, and it works........but doesn't print my Log message? How come? I'm kind of lost. Lol. Never used Runnable before and I'm intrigued.

http://stackoverflow.com/q/22465404
tagged with: arithmetic-expressions
has comment: http://stackoverflow.com/comment/34188985
has comment: http://stackoverflow.com/comment/34175457
has comment: http://stackoverflow.com/comment/34172040
has comment: http://stackoverflow.com/comment/34172038
has comment: http://stackoverflow.com/comment/34174624
has answer: http://stackoverflow.com/a/22465561
has comment: http://stackoverflow.com/comment/34174920
score: 0
type: UnansweredQuestion
tagged with: mysql
has comment: http://stackoverflow.com/comment/34183955
has comment: http://stackoverflow.com/comment/34185857
type: Question
has body: I am trying to query my database by using a Java function with another attribute defined in the database. The statement generates no error. However, the output is wrong. The result of the output is null but from my checking it is not null. Please can anyone tell me what I need to do? How can I use JAVA functions in SQl statements? expired_rows = dbMngr.runQuery(String.format("SELECT ID FROM Student WHERE 'System.currentTimeMillis()' - ArrivalTime &gt; (%s) ", 5000));} if (expired_rows == null) { System.out.println("The number of expired row is " + expired_rows); } if (expired_rows != null) { System.out.println("The number of expired row is " + expired_rows.length ); }
tagged with: java
tagged with: sql
tagged with: function
has title: USing Variables/JAVA functions in SQL arithmetic statements in JAVA Netbeans
answer count: 1

entropy
tags question: http://stackoverflow.com/q/22346297
type: Tag
tag name: entropy

http://stackoverflow.com/q/22338741
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33982276
has comment: http://stackoverflow.com/comment/33951050
linked to: http://stackoverflow.com/q/22352205
type: Question
has comment: http://stackoverflow.com/comment/33952837
has comment: http://stackoverflow.com/comment/33950240
tagged with: many-to-many
has body: Rephrase of original question: I have your typical M:M relationship, in my case think of the User/Role example: USER, ROLE, USER_ROLE I need a second USER_ROLE table matching up Users to Roles. I won't get into specifics as to why that is (unless you need me to), but I am looking for a way to accomplish this with JPA AND without changing up the User and Role Entities. *I need a second USER_ROLE table to audit actions the User performs and which Role he was at the time the action was performed.*
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33952952
has comment: http://stackoverflow.com/comment/33952068
has comment: http://stackoverflow.com/comment/33952581
has comment: http://stackoverflow.com/comment/33975353
has comment: http://stackoverflow.com/comment/33984042
tagged with: jpa
answer count: 1
has answer: http://stackoverflow.com/a/22340124
score: 0
has comment: http://stackoverflow.com/comment/33951850
has title: JPA Hibernate intermediary table - resubmitted
has comment: http://stackoverflow.com/comment/33952631
has comment: http://stackoverflow.com/comment/33951537
has comment: http://stackoverflow.com/comment/33984108
has comment: http://stackoverflow.com/comment/33986378

http://stackoverflow.com/q/22441636
type: AnsweredQuestion
tagged with: loops
type: Question
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/22441663
has title: Need a little help my java code
answer count: 1
has body: I am teaching myself Java using Savitch's Absolute Java. I am working on the programming projects: what I am asked to do is code a game of craps. My code works overall, but I am getting an infinite loop with a portion of it. Can anybody points out what I am doing wrong? This is what I am asked to do: If 4, 5, 6, 8, 9, or 10 is rolled on the come out roll, that number becomes “the point.” The player keeps rolling the dice until either 7 or the point is rolled. If the point is rolled first, then the player wins the bet. If a 7 is rolled first, then the player loses. Here is my code: import java.util.Random; public class ProgProject2 { public static void main(String[] args) { // TODO Auto-generated method stub Random randomGeneratorDice1 = new Random(); Random randomGeneratorDice2 = new Random(); //int counter = 1; int dice1, dice2, sum, winNumber = 0, lossNumber = 0; for (int counter = 1; counter &lt;= 3; counter++) { System.out.println("Roll number " + counter + " of the dice: "); dice1 = randomGeneratorDice1.nextInt(6) + 1; dice2 = randomGeneratorDice2.nextInt(6) + 1; sum = dice1 + dice2; System.out.println("Dice1 value is: " + dice1 + " and dice2 value is: " + dice2); System.out.println("The output of the dice roll is: " + sum); if ((sum == 7) || (sum == 11)) { System.out.println("You win!!"); winNumber++; } // end if else if ((sum == 2) || (sum == 3) || (sum == 12)) { System.out.println("You lose!!"); lossNumber++; } // end else if **else { System.out.println("The point!!"); //System.out.println("The sum is: " + sum); //int point = sum; int sumElse; do { dice1 = randomGeneratorDice1.nextInt(6) + 1; dice2 = randomGeneratorDice2.nextInt(6) + 1; sumElse = dice1 + dice2; if (sumElse == sum) { System.out.println("You win!!"); winNumber++; } // end inner if else if (sumElse == 7) { System.out.println("You lose!!"); lossNumber++; } // end inner else } while ((sumElse != sum) || (sumElse != 7)); } // end else** } // end for loop System.out.println("Your total wins are: " …
accepted answer: http://stackoverflow.com/a/22441663

math
tags question: http://stackoverflow.com/q/22457149
type: Tag
tags question: http://stackoverflow.com/q/22339324
tags question: http://stackoverflow.com/q/22338519
tags question: http://stackoverflow.com/q/22428824
tags question: http://stackoverflow.com/q/22356166
tags question: http://stackoverflow.com/q/22427257
tags question: http://stackoverflow.com/q/22340313
tags question: http://stackoverflow.com/q/22364360
tags question: http://stackoverflow.com/q/22446477
tags question: http://stackoverflow.com/q/22380958
tags question: http://stackoverflow.com/q/22337802
tags question: http://stackoverflow.com/q/22436846
tags question: http://stackoverflow.com/q/22432980
tag name: math
tags question: http://stackoverflow.com/q/22463777
tags question: http://stackoverflow.com/q/22402283

http://stackoverflow.com/comment/34203262
comment on: http://stackoverflow.com/q/22481748
score: 0
type: QuestionComment
type: Comment
has text: It does not really matter how you get the code, as long as it has the right result. There is no way to answer the question because both ways are right.

http://stackoverflow.com/a/44650177
upvote count: 9
answers question: http://stackoverflow.com/q/22453550
score: 9
downvote count: 0
type: Answer
has body: Use isAssignableFrom() instead of == or equals. The problem is with the supports() method which will always return false. Change from: @Override public boolean supports(Class&lt;?&gt; authentication) { return authentication.equals(UsernamePasswordAuthenticationToken.class); } To: Java @Override public boolean supports(Class&lt;?&gt; authentication) { return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication)); } Kotlin override fun supports(authentication: Class&lt;*&gt;): Boolean { return UsernamePasswordAuthenticationToken::class.java.isAssignableFrom(authentication) } Finally the flow would pass through authenticate()

http://stackoverflow.com/a/22601239
has comment: http://stackoverflow.com/comment/34429102
has body: Yes, they have deprecated the previous ServiceRegistryBuilder(), here is how you can do it with Hibernate 4.3.4 public void testConnection() throws Exception { logger.info("Trying to Connect With a DataBase."); Configuration configuration = new Configuration(); configuration.configure("Your.cfg.xml"); ServiceRegistryBuilder serviceRegistryBuilder = new ServiceRegistryBuilder().applySettings(configuration .getProperties()); SessionFactory sessionFactory = configuration .buildSessionFactory(serviceRegistryBuilder.buildServiceRegistry()); Session session = sessionFactory.openSession(); logger.info("Database connection created successfuly."); } Source: Create session factory in Hibernate 4
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/22367759
has comment: http://stackoverflow.com/comment/34412142
score: -2
downvote count: 2

http://stackoverflow.com/q/22396224
tagged with: tomcat
has answer: http://stackoverflow.com/a/22405781
tagged with: jvm
has comment: http://stackoverflow.com/comment/34050484
has comment: http://stackoverflow.com/comment/34050299
favorite count: 0
has comment: http://stackoverflow.com/comment/34066041
tagged with: sockets
has comment: http://stackoverflow.com/comment/34049994
has comment: http://stackoverflow.com/comment/34050077
has comment: http://stackoverflow.com/comment/34050113
has body: As per clarification section(from MarkR) in link1 I felt that, Any server has single port on which server's listen() call is blocked(say tomcat) on which any client(say browser) would place connect() request, for instance, I assume, tomcat server does below(correct me) //original/main single process does below socket();bind();listen(on default port 80); loop{ accept(); //app layer logic(i.e., Below activity is done on seperate thread from a threadpool in main process) //reads in all of the HTTP request and converts it into an object called an HttpServletRequest. That object is then passed in to my servlet by Tomcat via a method call. } But As per link2, I see that tomcat can listen on multiple ports, so how is the design of tomcat server for multiple/parallel listen() calls? Is tomcat having multiple processes where listen() is blocked on different ports?
has title: Server design, when tomcat listening on multiple ports
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/15231052
has comment: http://stackoverflow.com/comment/34050824
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/34050032
has comment: http://stackoverflow.com/comment/34050456
score: 0
linked to: http://stackoverflow.com/q/670891
answer count: 1
has comment: http://stackoverflow.com/comment/34050156
has comment: http://stackoverflow.com/comment/34050047

http://stackoverflow.com/a/22429573
has comment: http://stackoverflow.com/comment/34108615
has comment: http://stackoverflow.com/comment/34108405
answers question: http://stackoverflow.com/q/22429390
has body: Something like this should work. Ask me if you have problems :) setLayout(new BorderLayout()); JPanel labelPanel = new JPanel(); labelPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); JLabel bottomRtLabel = new JLabel("BOTTOM RIGHT LABEL"); labelPanel.add(bottomRtLabel); frame.add(labelPanel,BorderLayout.SOUTH);
has comment: http://stackoverflow.com/comment/34108305
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/34108567

http://stackoverflow.com/q/22420371
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/22420653
type: Question
linked to: http://stackoverflow.com/q/7325172
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22420653
has body: I am going to run some Java files ending with .class and .jar. How could I run these files inside of MATLAB?
has comment: http://stackoverflow.com/comment/34092320
has title: Java class running with MATLAB software
tagged with: matlab
type: AnsweredQuestion

http://stackoverflow.com/comment/34180910
comment on: http://stackoverflow.com/a/22447383
has text: @Brian -- given that the poster has a "rest"full application which does not have the problem, the slowness is probably caused by a CORBA object with lots of standard OO type methods which will be vulnerable to network latency.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22333543
has comment: http://stackoverflow.com/comment/33941151
favorite count: 0
has body: Trying to sort an array of strings alphabetically without the use of the sort function. Code is as follows... public static String[] sortedAdjectives(String[] original) { String[] sortedArray; String word; sortedArray = new String[26]; for(int i = 0; i &lt;25; i++) { word = original[i]; char c = word.charAt(0); sortedArray[c-'A'] = word; } return sortedArray; } It runs, but for some reason it's not sorting the array like I thought it would. In fact it's not sorting the array at all which confuses me even further. I'm passing it an array of 26 adjectives that I want sorted, and attempting to use Char subtraction to put it in the right index. Any and all help is much appreciated.
type: UnansweredQuestion
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/33940986
score: 1
has comment: http://stackoverflow.com/comment/33940931
tagged with: java
has comment: http://stackoverflow.com/comment/33941233
type: Question
has title: Java: Char Manipulation
tagged with: arrays
has comment: http://stackoverflow.com/comment/33941458
tagged with: sorting
tagged with: char
upvote count: 1
has comment: http://stackoverflow.com/comment/33945202

http://stackoverflow.com/q/22418887
has answer: http://stackoverflow.com/a/22418911
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34089837
has answer: http://stackoverflow.com/a/22418969
has title: cannot enter value and null pointer exception
has comment: http://stackoverflow.com/comment/34090146
has comment: http://stackoverflow.com/comment/34089821
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34090037
favorite count: 0
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/34089839
has comment: http://stackoverflow.com/comment/34090016
tagged with: java
has comment: http://stackoverflow.com/comment/34090122
has comment: http://stackoverflow.com/comment/34089801
has body: import java.util.*; import java.io.*; public class Patient { private String patientId; private String patientName; private String gender; private int age; private String patientWardNumber; private int patientBedNumber; private String dateRegistered; private String treatment; private int wardedDuration; private double price; private double payment; public Patient() { String patientId =" "; String patientName =" "; String patientWardNumber =" "; String dateRegistered =" "; String treatment =" "; int patienBedDuration = 0; int wardedDuration = 0; int age = 0; String gender = " "; double price = 0.00; } public Patient(String ID,String N,String G,int A,String WN,int BN,String DR,String T,int WD) { patientId = ID; patientName = N; gender = G; age = A; patientWardNumber = WN; patientBedNumber = BN; dateRegistered = DR; treatment = T; wardedDuration = WD; } public void SetPatient(String ID,String N,String G,int A,String WN,int BN,String DR,String T,int WD) { patientId = ID; patientName = N; gender = G; age = A; patientWardNumber = WN; patientBedNumber = BN; dateRegistered = DR; treatment = T; wardedDuration = WD; } public String getPatientId() { return patientId; } public String getPatientName() { return patientName; } public String getGender() { return gender; } public int getAge() { return age; } public String getPatientWardNumber() { return patientWardNumber; } public int getPatientBedNumber() { return patientBedNumber; } public String getDateRegistered() { return dateRegistered; } public String getTreatment() { return treatment; } public int getWardedDuration() { return wardedDuration; } public double getPrice() { return price; } public double getPayment() { return payment; } public String toString() { return patientId+" "+patientName+" "+gender+" "+age+" "+patientWardNumber+" "+patientBedNumber+" "+dateRegistered+" "+treatment+" "+wardedDuration+" "+price+" "+payment; } public static void main(String[]args) { ArrayList PatientList = new ArrayList(); Scanner scan = new …

http://stackoverflow.com/q/22471906
linked to: http://stackoverflow.com/q/8587489
has title: Java Based Configuration and factory pattern
score: 1
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34183264
tagged with: java
has answer: http://stackoverflow.com/a/22472271
tagged with: factory-pattern
type: Question
has body: Suppose I've a class Fruit and it's two subclasses - Apple and Grape: class Fruit { public void grind() { } } class Apple extends Fruit { } class Grape extends Fruit { } In spring properties file, I've a property that decides which bean to register at startup. At a time, I'll only have either Apple or Grape instance registered as a bean. The property is: # This can be either apple or grape app.fruit = apple In the Java configuration file, I'm binding a String attribute using @Value with this property, and based on that, I'll create appropriate instance. I'm trying to use factory pattern here. So, I've a FruitFactory like this: class FruitFactory { private Map&lt;String, Fruit&gt; map = new HashMap&lt;String, Fruit&gt;(); public FruitFactory() { map.put("apple", new Apple()); map.put("grape", new Grape()); } public Fruit getFruit(String fruit) { return map.get(fruit); } } And here's my spring configuration class: class SpringConfig { @Value("${app.fruit}") private String fruitType; @Bean public FruitFactory fruitFactory() { return new FruitFactory(); } @Bean public Fruit getFruit() { return fruitFactory().getFruit(fruitType); } } So, here're my few questions: Will the instances stored in the map inside the factory be spring managed bean? Is there any issue with the implementation? I've tried it, and it is working fine, and I'm confused whether the instances are really spring managed. I was trying to implement it in a better way, so that when a new fruit comes, I don't have to modify my factory. On way is to provide a register() method in factory and let all the Fruit subclasses invoke it. But the issue is when and how the subclasses will be loaded? I'll not be using the classes, not before putting their instances into the map. Can anyone suggest a better way? Edit: As suggested in comment and answer, I've tried using @Profile instead of factory pattern. But I'm facing some issues in that. Here's what I've: @Configuration @Profile("apple") class AppleProfile { @Bean p…
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22472271
tagged with: spring

http://stackoverflow.com/comment/34179476
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22469711
has text: Also, if you want to see an actual code example, check out Java's [`HashMap` implementation](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/java/util/HashMap.java?av=f), in particular, `put()`, `addEntry()`, and `resize()`. For a good online read, make a cup of coffee and check out http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_hashtable.aspx, which is well-written (despite its hideous gray-blue background) and goes into great detail about all aspects of hash table implementation.
score: 0

http://stackoverflow.com/comment/34013653
has text: @kocko: it is a valid observation. As it is, the code called by the application server is just a "Hello world!". The MongoDB code lies in a part of the class that is not used by the servlet code. The OP may be just confused on how servlets work, but unless they tell us how they are using this code, there is not much more to say...
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22375584

http://stackoverflow.com/comment/34429697
type: Comment
has text: If you go with the interface route, then the enum isn't used at all so the constructor isn't called.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22490961

http://stackoverflow.com/a/22413774
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
has body: If you want to use BeansBinding: The EL language as realized in BeansBinding library does not support most of the features including primitive calculations. You have to implement a custom org.jdesktop.beansbinding.Converter and then add it using "custom code" option: In the converter adding panel, select "Custom code" in converter property combobox, then instantiate your converter in "Property code" text field. Also, consider writing your own ChangeListener that you attach to JSpinner which will update the label's text each time the spinner value will change. This is way more easy as I see it. :-)
accepted answer of: http://stackoverflow.com/q/22413136
answers question: http://stackoverflow.com/q/22413136
type: Answer

http://stackoverflow.com/comment/34122294
score: 1
comment on: http://stackoverflow.com/q/22437657
type: Comment
type: QuestionComment
has text: use maxArea = squareArray[i].sideLength;

http://stackoverflow.com/comment/34119405
type: QuestionComment
has text: I think you will need a HashhMap for this. A Hashhmap of studentname,studentGrade would be a better option.
comment on: http://stackoverflow.com/q/22435945
score: 0
type: Comment

http://stackoverflow.com/q/22393784
tagged with: design-patterns
linked to: http://stackoverflow.com/q/35785
has comment: http://stackoverflow.com/comment/34046152
tagged with: java
has body: Using java, I am trying to read XML nodes and attributes, and then create a specific language (smv language) file by using those nodes and the relation between the nodes. Lets say I have an XML classes as following (please don't mind the xml structure and/or java code, it is just for clarifying the case) Lets say the xml file is Person.xml John 25 Then I will read that XML file and create a proper java classes lets say Person.java, class Person { string name="John"; int age=25; } I just wondered, do you know is there any specific pattern or any good aproach to manage such a project? What would you advice for that case? Many Thanks
type: Question
tagged with: xml-parsing
has title: Design pattern for converting xml to a specific programming language
answer count: 1
has answer: http://stackoverflow.com/a/22395382
score: 0
has comment: http://stackoverflow.com/comment/34046021
has comment: http://stackoverflow.com/comment/34045976
type: UnansweredQuestion

http://stackoverflow.com/comment/34209898
type: QuestionComment
has text: Attaching a remote debugger is a possibility in this case, but it's a fall back. I still am curious if there is a solution to the above requirement. This seems like something that should have some 3rd party solution. Using OQL on a heap dump with MAT is another possibility, but again: flexibility is key. Being able to trigger the snapshot whenever I want is my big concern
comment on: http://stackoverflow.com/q/22486903
score: 0
type: Comment

http://stackoverflow.com/comment/33988697
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22360448
has text: I have done the above sir. But nothin is written to the file.
score: 0

http://stackoverflow.com/comment/33998013
score: 0
type: QuestionComment
type: Comment
has text: What about huge data file? Do you think you can store ALL the file content into memory? Why do you need to do with data converted to a Map<>?
comment on: http://stackoverflow.com/q/22360709

http://stackoverflow.com/q/22405801
has comment: http://stackoverflow.com/comment/34300645
has comment: http://stackoverflow.com/comment/34300449
linked to: http://stackoverflow.com/q/21365733
has answer: http://stackoverflow.com/a/35900064
downvote count: 0
favorite count: 0
has body: I have a class with a few objects as inner methods. I also asked this question a while ago and got a good answer, but that leads to fatal errors in servlet containers. Scala cannot consistently generate a TypeTag when the URLClassLoader asks for a class. The project in question is open-source, found here. The current approach is found here, but it doesn't preserve order. object members are correctly initialised, but in a random order. Question: How can you collect class members: in the order they are defined in a thread-safe way filter them by a super type and greedy initliase the objects(referencing module.instance) ? Update: Don't suggest answers based on the links here, they've been tested and known to fail. Using a val instead of object is not an option, for stylistic reasons. getMethods or getDeclaredFields is known not to guarantee order. If this is somehow possible, it's likely with Scala reflection.
possible better answer: http://stackoverflow.com/a/22406222
upvote count: 8
accepted answer: http://stackoverflow.com/a/22478436
has answer: http://stackoverflow.com/a/22406222
tagged with: scala
answer count: 4
score: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22525235
has title: Java/Scala reflection: Get class methods in order and force object init
tagged with: reflection
tagged with: java
tagged with: phantom-dsl
type: Question
has answer: http://stackoverflow.com/a/22478436

http://stackoverflow.com/a/22440258
has comment: http://stackoverflow.com/comment/34133178
has comment: http://stackoverflow.com/comment/34128244
score: 0
answers question: http://stackoverflow.com/q/22440064
type: Answer
has body: you should set a global context like this: public static Activity currentActivity=null; and after run your main activity or any activity that runs service set context like this: MainActivity.currentActivity = this; after that in toast use this context: Toast.makeText(MainActivity.currentActivity," text", Toast.LENGTH_LONG); hope use full
has comment: http://stackoverflow.com/comment/34127880

http://stackoverflow.com/q/22416226
type: AnsweredQuestion
has title: sqlite not updating record in android
tagged with: java
has answer: http://stackoverflow.com/a/22416439
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/22416439
tagged with: sqlite
answer count: 1
tagged with: android
has body: I know there is a record with id 1 in the sqlite database but for some reason it is not updating. String sql = "UPDATE "+MySQLiteHelper.TABLE_INVENTORY+ " SET "+ MySQLiteHelper.INVENTORY_ACTIVE+" = 0 " + "where "+MySQLiteHelper.INVENTORY_ID + " = " + 1; Log.v("sql",sql); database.rawQuery(sql, null); It is not showing any errors, any clue what may be happening?

http://stackoverflow.com/comment/33933996
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22328862
has text: For graphic intensive things you should take a look at the `SurfaceView` class. Check this introduction about canvas: http://developer.android.com/guide/topics/graphics/2d-graphics.html

http://stackoverflow.com/comment/33984374
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22358478
has text: maybe this can give you an idea: http://stackoverflow.com/questions/10466569/create-pdf-from-a-png-image-or-java-panel
score: 0

http://stackoverflow.com/q/22467060
tagged with: windows
answer count: 1
linked to: http://stackoverflow.com/q/875467
tagged with: restful-authentication
type: UnansweredQuestion
has title: windows azure java client calling RESTFUL API
tagged with: java
type: Question
has body: Can we connect to windows-azure mobile service from a java client as mentioned in the below url ? http://msdn.microsoft.com/en-us/library/windowsazure/jj710106.aspx because when i connected it is giving me 403 error. I was able to connect with application key but not with the auth header. Please help
score: 0
has answer: http://stackoverflow.com/a/22468984
tagged with: azure

button
tags question: http://stackoverflow.com/q/22387494
tags question: http://stackoverflow.com/q/22338870
tags question: http://stackoverflow.com/q/22335112
tags question: http://stackoverflow.com/q/22453957
tags question: http://stackoverflow.com/q/22397520
tags question: http://stackoverflow.com/q/22434905
tags question: http://stackoverflow.com/q/22486504
tags question: http://stackoverflow.com/q/22413052
tags question: http://stackoverflow.com/q/22411021
type: Tag
tags question: http://stackoverflow.com/q/22412133
tags question: http://stackoverflow.com/q/22427288
tag name: button
tags question: http://stackoverflow.com/q/22423009

http://stackoverflow.com/a/22340148
has body: Per the documentation for CursorAdapter, of which SimpleCursorAdapter is a subclass : The Cursor must include a column named "_id" or this class will not work. If your table already has a column named "_id", then just include this in the query's projection (the requested columns). String selectQuery = "select _id, customer_name, ... from Customer"; If your table doesn't have an "_id" column, you can instead alias the "rowid" that all SQLite tables have by default (excepting those explicitly created without one). String selectQuery = "select rowid as _id, customer_name, ... from Customer"; The same can be done even if you're not using raw SQL. For example, in a query() call: mCursor = db.query("Customer", new String[] {"rowid as _id", "customer_name", ...}, ...); You can, of course, alias another column you might already have, if it's equivalent to an "_id". Do note, though, that you must use the alias name - i.e., "_id" - with the Cursor, should you be manually retrieving values from it.
type: Answer
answers question: http://stackoverflow.com/q/22340020
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22340020
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33959469
has text: "could not get audio input stream from input file".
score: 0
comment on: http://stackoverflow.com/q/22344020
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33952070
score: 0
has text: @user2310289 How did you deduce that?!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22339586

http://stackoverflow.com/q/22340157
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am trying to write a program in which a player rolls a dice and if they roll a six they enter in to a game but they don't roll a six they remain outside the game until they get a six. The aim of the game is for player to reach 100 to win .I have attempted to write a program that allows each player to roll the dice and when they get six roll again. After those in game have rolled the dice those out side get a chance to roll the dice. However something about my code is seriously wrong in that when the player gets a six they can roll again but after that they fall out of the loop. Any help would be very much appreciated !! static Scanner keyboard = new Scanner(System.in); static int numberOfPlayers = 0; static int selectOption; static boolean started = false; static boolean finished = false; static boolean gameFinished = false; static int backMenu ; String winner = ""; static int diceOption; static int position = 0; static int score = 0; static int location = 0; public static void gameOptions() { System.out.println("**************************************************************"); System.out.println("\t\t\t\t\t\tWelcome to snakes and ladders!!!"); System.out.println("**************************************************************"); do { System.out.println("Please select an option: \n" + "1. Game instuctions " + "\n2. Select number of players"); selectOption = keyboard.nextInt(); } while (selectOption != 1 &amp;&amp; selectOption != 2); Player[] playerArray; { if (selectOption == 1 ) { System.out.println("Rules of snakes and ladders" + "\n1. To enter the game you have to roll a six. " + "\n2.The first player to get to square 100 wins!"); System.out.println("To go back to menu press 3"); selectOption=keyboard.nextInt(); } else if (selectOption == 2) { System.out.println("Enter number of players"); numberOfPlayers = keyboard.nextInt(); //clearing the buffer keyboard.nextLine(); } playerArray = new Player[numberOfPlayers]; for (int count = 0; count &lt; playerArray.lengt…
score: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/22340404
answer count: 1
downvote count: 1
has title: Java dice game loop problems
has comment: http://stackoverflow.com/comment/33952670
has comment: http://stackoverflow.com/comment/33952641
favorite count: 0
has comment: http://stackoverflow.com/comment/33952705
has answer: http://stackoverflow.com/a/22340404

http://stackoverflow.com/comment/33935765
comment on: http://stackoverflow.com/a/22330512
score: 0
type: AnswerComment
has text: however I found out that its the string "firstclass" of the second line where it stops working
type: Comment

http://stackoverflow.com/comment/33994215
comment on: http://stackoverflow.com/q/22362825
score: 0
has text: Have you already tried an `eclipse -clean`?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22452295
answer count: 2
has answer: http://stackoverflow.com/a/22452732
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/34148627
favorite count: 0
has answer: http://stackoverflow.com/a/22452391
has comment: http://stackoverflow.com/comment/40699985
type: UnansweredQuestion
has body: Here is my code Integer.pasrseInt(new DecimalFormat(0000).format(230)); This returns a String but I want to save it as an Integer. Thanks in advance.
tagged with: java
downvote count: 2
has title: Left pad zeros and save the result as Integer in java.
type: Question

http://stackoverflow.com/q/22357250
tagged with: jersey
has title: How can I set a mock Spring user principal during a JerseyTest?
tagged with: spring-security
score: 0
has body: I'm working on a content restriction layer of code that basically prevents certain JSON elements from being returned in a GET response. For this to happen I need to examine the authenticated user principal that is supplied by Spring's security context, customize my response, and send it back to the client. So... my question is how can I do this with JerseyTest, where there is no security context? I need in some way to set a mock authentication principal that Jersey will find while processing the GET request. Here's my test: import org.junit.Test; import org.springframework.web.context.ContextLoaderListener; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.spi.spring.container.servlet.SpringServlet; import com.sun.jersey.test.framework.JerseyTest; import com.sun.jersey.test.framework.WebAppDescriptor; public class GroupResourceTest extends JerseyTest { public GroupResourceTest() throws Exception { super(new WebAppDescriptor.Builder().contextPath("/api-resources-test") .contextParam("contextConfigLocation", "file:src/test/resources/applicationContext-test.xml") .servletClass(SpringServlet.class).contextListenerClass(ContextLoaderListener.class) .initParam("com.sun.jersey.api.json.POJOMappingFeature", "true").build()); } @Test public void testGroupsGET() { WebResource webResource = resource(); String response = webResource.path("/groups").get(String.class); System.out.println(response); } } And here is the corresponding resource I need to have a mock user associated with: @GET @Path("/groups") @Produces({ MediaType.APPLICATION_JSON }) public List&lt;Group&gt; getGroups() { Authentication user = SecurityContextHolder.getContext().getAuthentication(); // do user-based response here... } With this code the user object above is null. Any ideas?
answer count: 1
has answer: http://stackoverflow.com/a/22380929
type: UnansweredQuestion
tagged with: spring
tagged with: java
type: Question

http://stackoverflow.com/comment/33964863
has text: the webserice is already done and is in used for different other apps. and there it is like this: { "authenticationToken": { "token": "whatever" } } and so i have to handle this way
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22345444

http://stackoverflow.com/comment/34619674
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22435309
score: 0
has text: Yes, but probably not without changing the m2e or m2e Tycho connector code. If you want to contribute this code change, the [m2e-dev mailing list](https://dev.eclipse.org/mailman/listinfo/m2e-dev) may be a good starting point to discuss this.

http://stackoverflow.com/comment/34060039
has text: Not quite...I have a box(hardware equipment) it has an IP:port and it's connected to my router. I want to connect to this device from home to another location. My Router has the external IP 86.XX.XX.XX and the hardware device has also an IP 192.168.X.XX. I want to connect to 86.XX.XX.XX:8123 -> this port is bound to the IP of the hardware device that I have.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22399994

http://stackoverflow.com/q/22408680
accepted answer: http://stackoverflow.com/a/22479033
tagged with: jacoco
tagged with: jmockit
tagged with: code-coverage
has answer: http://stackoverflow.com/a/22479033
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: unit-testing
has body: I am using jmockit to test out a class which has some complex dependecies. I have marked this class as @Mocked in the test. The test runs fine. I generate a jacoco html report from the output. I do not see any coverage for the "Mocked" class under test. Am I not seeing coverage becuase the class is 'Mocked' (partially)?
type: Question
has title: JMockit - Code coverage for partially mocked class under test
answer count: 1

http://stackoverflow.com/q/22371604
has comment: http://stackoverflow.com/comment/34007301
has body: ViewHolder holder = null; if (convertView == null) { LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = vi.inflate(R.layout.row_ten_words,null); holder = new ViewHolder(); holder.txtSrc = (EditText) convertView.findViewById(R.id.txt_src_word); holder.btnTranslate = (Button) convertView.findViewById(R.id.btn_translate); holder.txtDes = (EditText) convertView.findViewById(R.id.txt_des_word);}` Here , I want to use my RelativeLayout that I have created programmatically in place of R.layout.row_ten_words Code that I want to use is: ` EditText txtSrc=new EditText(this); EditText txtDes=new EditText(this); Button btn_translate=new Button(this); translate.setText("translate"); rl=new RelativeLayout(this); rl.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); rl.addView(txtSrc); rl.addView(btn_translate); rl.addView(txtDes);` I am totally new to android but know JAVA well. Please suggest me something if I am wrong in my approach. Thanks in advance.
tagged with: android-relativelayout
tagged with: android
has answer: http://stackoverflow.com/a/22372425
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22372425
tagged with: java
type: Question
tagged with: android-inflate
tagged with: android-layout
has comment: http://stackoverflow.com/comment/34007004
score: 0
answer count: 1
has title: Android-How to replace R.layout.id by custom relativelayout in CustomAdapter?

http://stackoverflow.com/comment/34021130
has text: @James_D Can you provide me an example ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22379022

http://stackoverflow.com/comment/34087381
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22417570
has text: It's better to create an entity for tricks now
type: Comment

gwt
tags question: http://stackoverflow.com/q/22362132
tag name: gwt
tags question: http://stackoverflow.com/q/22484683
tags question: http://stackoverflow.com/q/22333941
tags question: http://stackoverflow.com/q/22452048
tags question: http://stackoverflow.com/q/22329333
tags question: http://stackoverflow.com/q/22376418
type: Tag
tags question: http://stackoverflow.com/q/22408685
tags question: http://stackoverflow.com/q/22425459
tags question: http://stackoverflow.com/q/22345761
tags question: http://stackoverflow.com/q/22485873
tags question: http://stackoverflow.com/q/22439098
tags question: http://stackoverflow.com/q/22430444
tags question: http://stackoverflow.com/q/22414195
tags question: http://stackoverflow.com/q/22465577
tags question: http://stackoverflow.com/q/22422477
tags question: http://stackoverflow.com/q/22388444
tags question: http://stackoverflow.com/q/22375568
tags question: http://stackoverflow.com/q/22382107
tags question: http://stackoverflow.com/q/22404670
tags question: http://stackoverflow.com/q/22405892
tags question: http://stackoverflow.com/q/22397776
tags question: http://stackoverflow.com/q/22393628
tags question: http://stackoverflow.com/q/22393823
tags question: http://stackoverflow.com/q/22486383
tags question: http://stackoverflow.com/q/22432277
tags question: http://stackoverflow.com/q/22414614
tags question: http://stackoverflow.com/q/22388553
tags question: http://stackoverflow.com/q/22482994
tags question: http://stackoverflow.com/q/22391645
tags question: http://stackoverflow.com/q/22362904
tags question: http://stackoverflow.com/q/22376680
tags question: http://stackoverflow.com/q/22419472
tags question: http://stackoverflow.com/q/22429774
tags question: http://stackoverflow.com/q/22356117

http://stackoverflow.com/a/22383244
has comment: http://stackoverflow.com/comment/34027328
downvote count: 0
type: Answer
upvote count: 7
has comment: http://stackoverflow.com/comment/34026907
accepted answer of: http://stackoverflow.com/q/22383217
score: 7
answers question: http://stackoverflow.com/q/22383217
has comment: http://stackoverflow.com/comment/34026960
type: AcceptedAnswer
has body: Yes, use the extends keyword for class inheritance and implements for interface implementation: public class MyClass extends SomeBaseClass implements SomeInterface From your question edit, you should use extends in class declaration for class inheritance. In other words, a class can only extend from another single class, not from interfaces. Multiple class inheritance is not allowed. In case you want to implement an interface, use implements keyword only. So, your code would be: public class InputHander implements OnTouchListener, IControlHandler More info: Java Tutorials: Inheritance
has comment: http://stackoverflow.com/comment/34027259

http://stackoverflow.com/comment/34069162
comment on: http://stackoverflow.com/q/22407651
type: Comment
type: QuestionComment
score: 1
has text: 1) [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing?](http://stackoverflow.com/questions/7229226/should-i-avoid-the-use-of-setpreferredmaximumminimumsize-methods-in-java-swi). 2) Is there a reason your extending `JPanel` or `JFrame` you are not adding functionality, 3) In java methods name starts with lower-case following a camel-case style by convention. 4) Your variables in Manager could be `final`

http://stackoverflow.com/a/22395344
type: Answer
accepted answer of: http://stackoverflow.com/q/22395080
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22395080
has body: Since the Collections.reverseOrder() method only works for reference type, my suggestion is that your "nums" should hold reference type such as Integer, Double ... Or if you defined your own class, make sure your class implemented the Comparable interface
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/34165116
comment on: http://stackoverflow.com/q/22461655
has text: What do you wish to debug?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33999787
comment on: http://stackoverflow.com/q/22366893
score: 0
type: Comment
type: QuestionComment
has text: @RafaEl You don t understand, the version is published and I can't update my code.

http://stackoverflow.com/a/22425778
answers question: http://stackoverflow.com/q/22425637
score: 1
has body: Using a regex to get the string after open is probably the most flexible way: public static void main(String args[]) { String line = "Will you open chrome?"; //will get everything after open, including punctuation like the question mark. //You need to modify the regex if that's not what you want. String pattern = "open (.*)"; // Create a Pattern object Pattern r = Pattern.compile(pattern); // Now create matcher object. Matcher m = r.matcher(line); if (m.find()) { System.out.println("Value after open is: " + m.group(1)); } else { System.out.println("NO MATCH"); } } Returns: Value after open is: chrome? If you don't want the question mark, update the regex to exclude the question mark from the matching group: String pattern = "open (.*)\\?";
accepted answer of: http://stackoverflow.com/q/22425637
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/33988329
type: QuestionComment
comment on: http://stackoverflow.com/q/22360672
has text: Welcome to SO! Please only post relevant code (if we need more, we will ask). Also, please post what line crashes, and the error type.
score: 1
type: Comment

http://stackoverflow.com/comment/34061155
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22385398
score: 1
has text: Most of this kind of problems come from small things... So what happened? I'm sending the Base64-String back inside an XML. In PL/SQL we extract that String into a clob before we decode it back to a blob. We printed and checked that String... it was correct. When we tried to check the difference between the clob we send from PL/SQL with the clob we get back in PL/SQL, we found some char(10) & char(13) - linebreaks, essentially. Not visible for the eye, but making the clob (and decoded blob) corrupt. A translate function got those out and now it works as a charm.

http://stackoverflow.com/comment/33951163
has text: @LuiggiMendoza I want that the parameter should be of type LinkedHashSet or it supertype
comment on: http://stackoverflow.com/q/22339348
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22379964
has comment: http://stackoverflow.com/comment/34430499
has comment: http://stackoverflow.com/comment/34459680
answers question: http://stackoverflow.com/q/22379588
score: 0
has comment: http://stackoverflow.com/comment/34388117
has comment: http://stackoverflow.com/comment/34288340
has comment: http://stackoverflow.com/comment/34020792
has comment: http://stackoverflow.com/comment/34042495
type: Answer
has comment: http://stackoverflow.com/comment/34021150
has body: This means your finalize() methods are taking too long resulting in objects building up in the queue waiting to be called. Objects are removed from the queue as they are being called and wont be in the queue after being called.
has comment: http://stackoverflow.com/comment/34037454

http://stackoverflow.com/comment/34019513
score: 1
has text: @KuldeepChoudhary Nice. I hope you will be solved using by this one!!!
comment on: http://stackoverflow.com/q/22378722
type: Comment
type: QuestionComment

loops
tags question: http://stackoverflow.com/q/22460190
tags question: http://stackoverflow.com/q/22362758
tags question: http://stackoverflow.com/q/22392176
tags question: http://stackoverflow.com/q/22443903
tags question: http://stackoverflow.com/q/22448630
tags question: http://stackoverflow.com/q/22428270
tags question: http://stackoverflow.com/q/22458814
tags question: http://stackoverflow.com/q/22333596
type: Tag
tags question: http://stackoverflow.com/q/22335544
tags question: http://stackoverflow.com/q/22465223
tags question: http://stackoverflow.com/q/22409059
tags question: http://stackoverflow.com/q/22458839
tags question: http://stackoverflow.com/q/22340965
tag name: loops
tags question: http://stackoverflow.com/q/22441636
tags question: http://stackoverflow.com/q/22391322
tags question: http://stackoverflow.com/q/22461475
tags question: http://stackoverflow.com/q/22361729
tags question: http://stackoverflow.com/q/22361285
tags question: http://stackoverflow.com/q/22414087
tags question: http://stackoverflow.com/q/22441276
tags question: http://stackoverflow.com/q/22344139
tags question: http://stackoverflow.com/q/22469732

http://stackoverflow.com/comment/34061063
type: QuestionComment
comment on: http://stackoverflow.com/q/22402904
has text: I do not have access to database. it is supported by someone else. I am supposed to write a code that avoid duplication when an entry should be inserted
score: 0
type: Comment

http://stackoverflow.com/q/22444901
possible better answer: http://stackoverflow.com/a/22444940
type: Question
tagged with: http://stackoverflow.com/tag/xml
score: 0
tagged with: java
has body: so I am making a game where the player's skill damage is determined by their Skill Level and their weapon Mastery. The two values are stored in an XML document, and I am using DOM to retrieve the values, and am trying to print their sum to the console. public class Damage { public String skillName = "Bash"; //name of the skill Xml config = new Xml("C:/character.xml","config");//part of the XML retrieving Xml version = config.child("Character");//another part of the XML retrieving int mastery = version.integer("Mastery"); //mastery of the skill int skillLevel = version.integer("skillName");//skill level int skillDamage = mastery + skillLevel; //adding the two values together public static void main(String[] args) { System.out.println(skillDamage); } } When I run this code, it tells me that I can't have non-static variables in the static Main method. However, when I place the static tag before the int on the variables, it results in 0. My question is: How can I make the variables static but still produce the sum of the two XML values? Could I somehow collect the non-static data from the XML, make it static, and then use that?
has answer: http://stackoverflow.com/a/22444939
tagged with: main-method
has answer: http://stackoverflow.com/a/22444941
has answer: http://stackoverflow.com/a/22444950
answer count: 4
type: AnsweredQuestion
has title: Using XML-derived Variables in the Main Method
has answer: http://stackoverflow.com/a/22444940
accepted answer: http://stackoverflow.com/a/22444939
tagged with: variables
tagged with: static

http://stackoverflow.com/comment/34189267
has text: assertTrue("ToBasket button not found", act != null); Does this work? IIRC the return is an empty list if it cannot find any matching elements, not null. Print out the list and see if it actually finds the button you want to click and not some other button.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/22475757

http://stackoverflow.com/q/22346396
answer count: 1
tagged with: junit
downvote count: 0
tagged with: suppression
linked to: http://stackoverflow.com/q/15939023
has comment: http://stackoverflow.com/comment/33979996
favorite count: 0
type: UnansweredQuestion
has title: JUnit tests: Suppress enum constructor by mocking?
has comment: http://stackoverflow.com/comment/33965026
score: 7
tagged with: java
upvote count: 7
has answer: http://stackoverflow.com/a/22490961
type: Question
has comment: http://stackoverflow.com/comment/33963794
tagged with: enums
has body: I know that it is possible to mock a single enum(using How to mock an enum singleton class using Mockito/Powermock?), but I have like 1000 of enum values and they can call 5 different constructors. The enum values are often changing in development. I want to really mock only one or two for my JUnit test. I don't care about the rest, but they are still instantiated, which calls some nasty stuff, which loads the values for the enum from the file system. Yes I know It's very bad design. But for now I don't get the time to change it. At the moment we have Mockito/powermock in use. But any framework, which can solve this sh** I mean bad design is welcome. Let's say I have an enum similar to this: public static enum MyEnum { A(OtherEnum.CONSTANT), B("1"), C("1", OtherEnum.CONSTANT), //...and so on for again 1000 enum values :( private double value; private String defaultValue; private OtherEnum value; /* Getter/Setter */ /* constructors */ }
tagged with: mocking

http://stackoverflow.com/comment/34198156
score: 0
type: AnswerComment
type: Comment
has text: I have such files, it is a means of exchanging data. They are constantly updated, and I have to enter them every transition. bulkInsert method will try thanks.
comment on: http://stackoverflow.com/a/22481016

http://stackoverflow.com/q/22453957
has answer: http://stackoverflow.com/a/22454017
has body: I'm trying to use the ImageButton in Eclipse IDE (ADT). The IDE shows no errors at the time of compiling but when I run it in emulator it never starts instead it shows like UNFORTUNATELY YOUR APP HAS STOPPED WORKING. &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;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:contentDescription="@string/app_name" android:src="@drawable/ic_launcher" /&gt; AND main.activity.java public class MainActivity extends Activity { Button button1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); addListenerOnButton(); } public void addListenerOnButton() { final Context context = this; button1 = (Button) findViewById(R.id.imageView1); button1.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(context, ImageActivity.class); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } }
type: AnsweredQuestion
tagged with: java
has title: Using ImageButton in Android Eclipse IDE
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34151375
tagged with: imageview
tagged with: button
has comment: http://stackoverflow.com/comment/34151245
has answer: http://stackoverflow.com/a/22454021
score: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/22454017
accepted answer: http://stackoverflow.com/a/22454021

object
tags question: http://stackoverflow.com/q/22435392
tag name: object
tags question: http://stackoverflow.com/q/22374747
tags question: http://stackoverflow.com/q/22399053
tags question: http://stackoverflow.com/q/22411781
tags question: http://stackoverflow.com/q/22365870
tags question: http://stackoverflow.com/q/22388079
tags question: http://stackoverflow.com/q/22426598
tags question: http://stackoverflow.com/q/22334835
tags question: http://stackoverflow.com/q/22428879
tags question: http://stackoverflow.com/q/22365721
tags question: http://stackoverflow.com/q/22381789
tags question: http://stackoverflow.com/q/22388876
tags question: http://stackoverflow.com/q/22362955
tags question: http://stackoverflow.com/q/22392521
tags question: http://stackoverflow.com/q/22362796
tags question: http://stackoverflow.com/q/22480153
tags question: http://stackoverflow.com/q/22414361
tags question: http://stackoverflow.com/q/22385040
tags question: http://stackoverflow.com/q/22343342
tags question: http://stackoverflow.com/q/22468126
tags question: http://stackoverflow.com/q/22403592
tags question: http://stackoverflow.com/q/22388666
tags question: http://stackoverflow.com/q/22437908
tags question: http://stackoverflow.com/q/22479109
tags question: http://stackoverflow.com/q/22487396
type: Tag
tags question: http://stackoverflow.com/q/22354115
tags question: http://stackoverflow.com/q/22434463
tags question: http://stackoverflow.com/q/22486903
tags question: http://stackoverflow.com/q/22436231
tags question: http://stackoverflow.com/q/22357680
tags question: http://stackoverflow.com/q/22334171
tags question: http://stackoverflow.com/q/22354564

http://stackoverflow.com/q/22379113
upvote count: 4
has title: Can @NonNull annotations finally be used in java 8 on runtime?
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34019118
type: UnansweredQuestion
tagged with: annotations
downvote count: 1
tagged with: java-8
has answer: http://stackoverflow.com/a/22382723
has comment: http://stackoverflow.com/comment/34019066
type: Question
score: 3
has comment: http://stackoverflow.com/comment/34019391
tagged with: java
has body: I am aware that there are loads of topics about @NonNull annotations already, however most of them are dated now Java 8 is there, meaning the API does not change anymore. This question is further justified by the fact that Annotations on Types are now part of Java 8. So I would want the following code: public BaseChecker(final @NonNull File directory, final @NonNull Consumer&lt;File&gt; fileConsumer) { this.directory = directory; this.fileConsumer = fileConsumer; } I have two questions: Is this kind of syntax possible, at all? Does @NonNull finally work on runtime? With working on runtime I mean: If annotated on Object value, then it should throw a NullPointerException if and only if value == null. This behaviour is similar to Objects.requireNonNull(value).

http://stackoverflow.com/q/22400131
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22471188
has title: quartz job schedular not working as OSGI bundle
tagged with: java
tagged with: quartz-scheduler
type: Question
answer count: 2
tagged with: karaf
tagged with: osgi-bundle
has body: My code contains the basic exmaple of quartz schedular.. In normal java application its running but when Im converting it as a bundle and deploying it in karaf its not working. @Component @Service public class testImpl implements testI { @Override public void test() { System.out.println("testImpl started"); try { JobDetail job = JobBuilder.newJob(TestJob.class) .withIdentity("testJob") .build(); System.out.println("job \n"); Trigger trigger = TriggerBuilder.newTrigger() .withSchedule( SimpleScheduleBuilder.simpleSchedule() .withIntervalInSeconds(5) .repeatForever()) .build(); System.out.println("trigger \n "); //THIS PARTICULAR LINE ONWARDS THE CODE IS NOT EXCUTING IM NOT GETTING SYSOUT AFTER THIS LINE. SchedulerFactory schFactory = new StdSchedulerFactory(); System.out.println("scheduler \n"); Scheduler sch = schFactory.getScheduler(); sch.start(); sch.scheduleJob(job, trigger); } catch (Exception e) { e.printStackTrace(); } } Schedular is throwing exceptions like java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at org.quartz.impl.StdSchedulerFactory.&lt;init&gt;(StdSchedulerFactory.java:298) at com.ericsson.testImpl.testImpl.test(testImpl.java:77) at com.ericsson.testConsumer.testConsumer.bindTestI(testConsumer.java:27) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) but as far as I know Karaf has a inbuilt support for slf4j. No need of explicitly adding slf4j bundle.
accepted answer: http://stackoverflow.com/a/22471188
downvote count: 0
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/22407848
tagged with: maven
has answer: http://stackoverflow.com/a/22407848
upvote count: 1

http://stackoverflow.com/a/22453547
has body: I can give you a suggestion since I have worked with Selenium webdriver for sometime. The webdriver executes very fastly. Selenium driver doesnt take care whether the page loaded or not. So I recommend you to add code just before the click/selection events to make sure that the page loaded completely. There are options like waitForPageLoad() or checkifComponent exist to make sure that page is loaded properly before the events are triggered. Hope this will help you.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22452715

http://stackoverflow.com/comment/34014010
type: Comment
has text: Weight column is a column from intermediate table(story_keywords). Here I am performing join of Story and Story_Keywords table to get the Keywords for a Story (Keyword is one of the table). Those keywords are in the scattered order. Now I have added a column "Weight" to Story_keyword table (intermediate table) and want the keywords to be fetched as per the Weight column. I have googled it a lot but didn't find any annotations which will allow me to specify an orderby criteria of intemediate table.
type: QuestionComment
comment on: http://stackoverflow.com/q/22351146
score: 0

http://stackoverflow.com/comment/34438108
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22486446
has text: Can you post the generated SQL statement that results in PSQL exception?
score: 0

http://stackoverflow.com/a/22348038
answers question: http://stackoverflow.com/q/22345011
type: Answer
upvote count: 3
score: 3
has body: run() Method of Interface B will be Implemented in class Main by overridden method of Class A. Adding an extra point, It you will not write the run() method in child class Main, You will not get well known "Unimplemented methods" error. This is true for public methods of class A for non public methods you will get compiler error : The inherited method can not hide public abstract method. That is because methods of interface are public by default and you can not hide it with default (package private) access modifier. Sample : class A{ public void run() { System.out.println("This method will be inherited."); } } interface B{ void run(); } class Main extends A implements B{ public static void main(String args[]){ Main m = new Main(); m.run(); } } OUTPUT : This method will be inherited. In above code instance, the run() method is inherited from class A that will implement run() method of interface B.
downvote count: 0

http://stackoverflow.com/comment/34177039
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22468234
type: QuestionComment
has text: Where do you register your `ApplicationContextInitializer`?

http://stackoverflow.com/q/22444643
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22467227
tagged with: sockets
has comment: http://stackoverflow.com/comment/34136703
type: AnsweredQuestion
tagged with: multicast
linked to: http://stackoverflow.com/q/2280787
upvote count: 1
has comment: http://stackoverflow.com/comment/34135902
type: Question
has comment: http://stackoverflow.com/comment/34135937
tagged with: java
has comment: http://stackoverflow.com/comment/34175304
has answer: http://stackoverflow.com/a/22467227
has comment: http://stackoverflow.com/comment/34136339
answer count: 1
has body: 1) In Java Connectionless Socket Programming, how do I make sure all the packets from my 5 processors have been received and are being stored in an array as they arrive? Basically, I want to collect all the partial sums that are being sent by all the processes (5 of them) that are part of the multicast group and store those partial sums in an array on which I will then perform a few operations. 2) Also, I would appreciate ideas for how to find the index of a given element of an array of integers in this same code. One of the operations I need to perform is to find the Max of my array and retrieve its index. Below is a snippet of my thread code that has the receiving methods. readThread(InetAddress g, int port){ group = g; multicastPort = port; } public void run(){ try { MulticastSocket readSocket = new MulticastSocket(multicastPort); readSocket.joinGroup(group); while (true) { byte[] recvBuffer = new byte[MAX_MSG_LEN]; DatagramPacket packet = new DatagramPacket(recvBuffer, recvBuffer.length, group, multicastPort); readSocket.receive(packet); String rString = new String(packet.getData()); String message = new String(rString.getBytes()).trim(); // Process the received message before use here StringTokenizer stk = new StringTokenizer(message, ","); int recvdProcessID = Integer.parseInt(stk.nextToken()); int recvdPartialSum = Integer.parseInt(stk.nextToken()); System.out.println("\n"+recvdProcessID+" "+recvdPartialSum); int[] arrayPartialSum = new int[multicastSenderReceiver.numProcesses]; // array to store partial sums /* Store each received partial sum in an array of partial sums at index corresponding to the respective */ arrayPartialSum[recvdProcessID] = recvdPartialSum; // For debug, here is another way of listing the elements of the array of partial sums. System.out.println("\nHere is the array of partial sums: "); for (int element: arrayPartialSum){ System.out.println("\n"+element); } // Compute and Display the sum of all the partial sums: int grandTotal = 0; for…
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/34136063
has title: How can I make sure that all packets have been received and stored in an array?

http://stackoverflow.com/comment/33968170
comment on: http://stackoverflow.com/a/22348083
type: AnswerComment
score: 0
type: Comment
has text: Emmm... Amir, 'finally' is not what you need. If I understand you right you must thrown your own type of exception ONLY in case of some problems with DB connection. Code inside 'finally' block will be executed always. It is not depends if you have some connection problems or not.

http://stackoverflow.com/q/22476632
has comment: http://stackoverflow.com/comment/34200153
has answer: http://stackoverflow.com/a/22497968
tagged with: spring-mvc
upvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/22497968
tagged with: java
has title: Camel Spring MVC integration
tagged with: apache-camel
score: 2
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/22514102
favorite count: 0
has answer: http://stackoverflow.com/a/22514102
has body: I want to expose RESTful service using Spring MVC and Camel integration server. This service will accept JSON as an input and return JSON output only. Main Idea - define a route which accepts POST request from some URI, the Camel forwards this request to Spring controller, Spring controller return some JSON response and Camel should process it and return to the rest client. Here the route I am defining &lt;camel:route&gt; &lt;camel:from uri="restlet:/url1?restletMethod=POST" /&gt; &lt;camel:setBody&gt; &lt;camel:simple&gt;${body}&lt;/camel:simple&gt; &lt;/camel:setBody&gt; &lt;camel:setHeader headerName="Content-Type"&gt; &lt;camel:constant&gt;{application/json}&lt;/camel:constant&gt; &lt;/camel:setHeader&gt; &lt;camel:to uri="restlet:{springMVCUrl}?restletMethod=POST" /&gt; &lt;/camel:route&gt; I hit Url1 from firefox Rest client and send my JSON, request comes from Camel to my Spring controller and it return the JSON string. If I debug the code in eclipse on camel side, it works absolutely fine. But if I run without debug mode it always return null body Is it some synch issue, or inout channel?
type: Question
tagged with: spring

http://stackoverflow.com/q/22464810
linked to: http://stackoverflow.com/q/5951962
has comment: http://stackoverflow.com/comment/54943407
tagged with: jquery
score: 0
has comment: http://stackoverflow.com/comment/56690075
favorite count: 0
tagged with: tinymce
type: UnansweredQuestion
tagged with: fancybox
tagged with: php
has comment: http://stackoverflow.com/comment/34192890
has body: I am trying to integrate tinymce with Fancybox inline popup, currently I have a tpl, template file and is able to use tinymce fine which pulls data from mysql and allows me to make edits. i've added fancybox to the page, when clicked on the fancybox popup it opens but and replaces textarea with tinymce but I cannot type anything nor does it displays data from MySQL. However if I remove tinymce it popup and display info from mysql using textarea, I can also make edits. so clearly my problem is with tinmyce. I've tried many suggestions online but nothing seems to work. tinymce code: fancybox code: html code: {$description}{$test_array [i].info} Thanks for your help in advance.
answer count: 0
has title: tinymce and fancybox integration
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/34321695
downvote count: 1
type: Question

http://stackoverflow.com/comment/33972447
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22351467
score: 1
has text: Are you sure about this output?

http://stackoverflow.com/a/22368653
type: Answer
accepted answer of: http://stackoverflow.com/q/22354395
score: 1
has body: Are there alternative multi platform frameworks for coding Android applications with Java? The short is answer is no. Qt Jambi is supposed to be the main framework for it, so if it does not work for you for some reason, that is about it. You can try to step up and participate, however. (That being said, you have not mentioned what would not work, just that it had no release in 2013.)
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34010788
has comment: http://stackoverflow.com/comment/34010627
answers question: http://stackoverflow.com/q/22354395

http://stackoverflow.com/comment/34168554
score: 0
type: Comment
has text: still No mapping found for HTTP request with URI [/NutsAboutCandyWebProject/] in DispatcherServlet with name 'appServlet'
comment on: http://stackoverflow.com/a/22462729
type: AnswerComment

http://stackoverflow.com/a/22456431
type: Answer
has comment: http://stackoverflow.com/comment/34156442
downvote count: 0
score: 1
has body: You are just linking them incorrectly. Assuming that your new node is the new top node, this should not point to the existing topNode.next but to topNode itself. Assuming this is your original list: +------+ +------+ +-------+ |node 2+-------&gt;|node 1+------&gt;| node 0| +------+ +------+ +-------+ If you want to insert a new node, why would you point it to node 1 instead of node 2? +------+ +------+ +-------+ +----+&gt;|node 2+-------&gt;|node 1+------&gt;| node 0| | +------+ +------+ +-------+ | | | | +-----------+ ++-++| new node | +-----------+ which means that you should have node.next = topnode;
answers question: http://stackoverflow.com/q/22456258
has comment: http://stackoverflow.com/comment/34155992
has comment: http://stackoverflow.com/comment/34156481
accepted answer of: http://stackoverflow.com/q/22456258
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/22471055
downvote count: 1
has body: How to prevent downloading PDF file when displaying on web pages? I tried the content disposition inline but it didn't work. How can i do this ?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22472347
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34181567
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/76256421
tagged with: javascript
accepted answer: http://stackoverflow.com/a/22472347
possible better answer: http://stackoverflow.com/a/76256421
tagged with: http://stackoverflow.com/tag/html
favorite count: 0
has comment: http://stackoverflow.com/comment/34181422
has title: How to prevent downloading PDF file when displaying on web pages?
upvote count: 1

http://stackoverflow.com/a/22348550
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33967188
has body: Make first Heap Dump by jvisualVm from JDK and analyze it with Memory Analyzer (MAT). And then see in this direction at header 'Non-Heap': http://www.yourkit.com/
has comment: http://stackoverflow.com/comment/34053347
has comment: http://stackoverflow.com/comment/33967346
type: Answer
accepted answer of: http://stackoverflow.com/q/22348271
answers question: http://stackoverflow.com/q/22348271
upvote count: 2
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/34051993
has comment: http://stackoverflow.com/comment/33967876
has comment: http://stackoverflow.com/comment/33967387
has comment: http://stackoverflow.com/comment/122293061

xquery
tags question: http://stackoverflow.com/q/22341528
type: Tag
tags question: http://stackoverflow.com/q/22400442
tag name: xquery
tags question: http://stackoverflow.com/q/22463441
tags question: http://stackoverflow.com/q/22401087
tags question: http://stackoverflow.com/q/22459406

methods
tags question: http://stackoverflow.com/q/22433085
tags question: http://stackoverflow.com/q/22369747
tags question: http://stackoverflow.com/q/22365669
tags question: http://stackoverflow.com/q/22414361
tags question: http://stackoverflow.com/q/22485715
tag name: methods
tags question: http://stackoverflow.com/q/22457761
tags question: http://stackoverflow.com/q/22445407
tags question: http://stackoverflow.com/q/22334463
tags question: http://stackoverflow.com/q/22384967
tags question: http://stackoverflow.com/q/22437908
tags question: http://stackoverflow.com/q/22444957
tags question: http://stackoverflow.com/q/22423009
tags question: http://stackoverflow.com/q/22339233
tags question: http://stackoverflow.com/q/22407538
tags question: http://stackoverflow.com/q/22445992
type: Tag
tags question: http://stackoverflow.com/q/22332730
tags question: http://stackoverflow.com/q/22469208
tags question: http://stackoverflow.com/q/22367896
tags question: http://stackoverflow.com/q/22358764
tags question: http://stackoverflow.com/q/22368164
tags question: http://stackoverflow.com/q/22440984
tags question: http://stackoverflow.com/q/22473749
tags question: http://stackoverflow.com/q/22436231
tags question: http://stackoverflow.com/q/22384106
tags question: http://stackoverflow.com/q/22442030
tags question: http://stackoverflow.com/q/22336596
tags question: http://stackoverflow.com/q/22340989
tags question: http://stackoverflow.com/q/22335918
tags question: http://stackoverflow.com/q/22345011
tags question: http://stackoverflow.com/q/22485277
tags question: http://stackoverflow.com/q/22426368
tags question: http://stackoverflow.com/q/22443560
tags question: http://stackoverflow.com/q/22366454
tags question: http://stackoverflow.com/q/22418852
tags question: http://stackoverflow.com/q/22364054
tags question: http://stackoverflow.com/q/22425955
tags question: http://stackoverflow.com/q/22451636
tags question: http://stackoverflow.com/q/22395440

http://stackoverflow.com/q/22462181
linked to: http://stackoverflow.com/q/30643006
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/27273794
has title: How do I run a selenium test using maven from the command line?
upvote count: 10
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/91289804
score: 10
has answer: http://stackoverflow.com/a/30648008
has answer: http://stackoverflow.com/a/30649794
downvote count: 0
has answer: http://stackoverflow.com/a/22463255
favorite count: 0
type: UnansweredQuestion
tagged with: maven
answer count: 4
has body: I currently use Eclipse as my Java IDE and I use Maven. I click the run button and it is able to run a Selenium Java test I wrote. I then proceeded to install Maven on my local machine. After going to the directory where my pom.xml file is located. I run the command: mvn test I receive the following results: [INFO] Scanning for projects... [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBu ilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building SeleniumWebDriver 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ SeleniumWebDriver --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platfo rm dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ SeleniumWebDriver --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ SeleniumWebDriver --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platfo rm dependent! [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ SeleniumWebDriver --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ SeleniumWebDriver --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.139 s [INFO] Finished at: 2014-03-17T14:12:27-05:00 [INFO] Final Memory: 12M/99M [INFO] ------------------------------------------------------------------------ I do not understand why the Firefox webbrowser does…

http://stackoverflow.com/a/22400871
has body: This probably depends on the CDI implementation you are using. You did inject the object, where you have the annotations, didn't you? I just tried it with WELD, which throws an exception as expected: WELD-000805: Cannot have more than one post construct method annotated with @PostConstruct for [EnhancedAnnotatedTypeImpl] public class Test
score: 9
upvote count: 9
type: Answer
answers question: http://stackoverflow.com/q/22400705
downvote count: 0

http://stackoverflow.com/comment/34039258
comment on: http://stackoverflow.com/a/22387674
has text: Try using `<sec:global-method-security pre-post-annotations="enabled" proxy-target-class="true" />` http://docs.spring.io/spring-security/site/docs/3.2.x/reference/htmlsingle/#nsa-global-method-security-proxy-target-class
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22503229
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: In your backing bean method loginaction, instead of returning null (which means that you are telling the JSF to stay at the current view) you should return a string object, where the name of the page on which you want the function to redirect should be included. This format should work if you are working on a faces application (otherwise it should be similar, just check online): return "/faces/nameOfPageToRedirect.jsf?faces-redirect=true";
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22478563
answers question: http://stackoverflow.com/q/22478563

http://stackoverflow.com/q/22450405
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22450487
has title: Elegant/efficient way reading millions of records in MySQL Database, Java
tagged with: java
tagged with: mysql
type: Question
tagged with: blockingqueue
has comment: http://stackoverflow.com/comment/34147981
has answer: http://stackoverflow.com/a/22851050
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/16793789
has body: I have a MySQL database with ~8.000.000 records. Since I need to process them all I use a BlockingQueue which as Producer reads from the database and puts 1000 records in a queue. The Consumer is the processor that takes records from the queue. I am writing this in Java, however I'm stuck to figure out how I can (in a clean, elegant way) read from my database and 'suspend' reading once the BlockingQueue is full. After this the control is being handed to the Consumer until there are free spots available again in the BlockingQueue. From here on the Producer should continue reading in records from the database. Is it clean/elegant/efficient keeping my database connection open inorder for it to continuously read? Or should, once the control is shifted from Producer to Consumer, close the connection, store the id of the record read so far and later open the connection and start reading from that id? The latter seems to me not really good since my database will have to open/close a lot! However, the former is not so elegant in my opinion either?
tagged with: database-connection

http://stackoverflow.com/q/22366380
has comment: http://stackoverflow.com/comment/33998821
has comment: http://stackoverflow.com/comment/33998888
has answer: http://stackoverflow.com/a/22381402
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
has comment: http://stackoverflow.com/comment/34045140
answer count: 1
has comment: http://stackoverflow.com/comment/33998828
has comment: http://stackoverflow.com/comment/33998818
has comment: http://stackoverflow.com/comment/33998927
has comment: http://stackoverflow.com/comment/33998987
has title: Put a Java Map to JSON
accepted answer: http://stackoverflow.com/a/22381402
type: AnsweredQuestion
has body: I have a map of string objects and keys that I wish to put to a json file. I have read that the way to do it is by converting it to an array, and it only works with maps where both the object and key are strings. I can create a JSONObject from the map fine, but cannot put that to an array. Can someone tell me why this does not work? private static final String JSON_USER_VOTES = "user_votes"; private Map&lt;String, String&gt; mCheckedPostsMap; //This is populated elsewhere JSONObject obj=new JSONObject(mCheckedPostsMap); JSONArray array=new JSONArray(obj.toString()); // &lt;&lt;&lt; Error is on this line json.put(JSON_USER_VOTES, array); Here is the error: org.json.JSONException: Value {"232":"true","294":"true"} of type org.json.JSONObject cannot be converted to JSONArray
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: dictionary

http://stackoverflow.com/comment/34057918
type: Comment
score: 0
has text: Instead of 'ostrm_.write(buffer, 0, length);' I want to send them back to JSP
type: QuestionComment
comment on: http://stackoverflow.com/q/22401131

http://stackoverflow.com/a/22407441
has body: Would it try to map the ENTIRE file into memory e.g. exactly load 1GB of data, considering this is the amount I mapped? Basically yes. The JVM will try to make that happen. But "best effort" means that that it is not guaranteed that the entire file will be loaded. And there is no guarantee that the file will stay loaded. The behaviour is ultimately determined by the operating system (which manages virtual memory resources), and it will depend on how much physical memory there is on the system, what other applications need, and potentially on other things.
accepted answer of: http://stackoverflow.com/q/22406224
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22406224
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22463052
answer count: 1
downvote count: 0
has body: I trying to have Set&lt;LocationResolver&gt; defined in a Spring context like this: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-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="org.foo"/&gt; &lt;!-- Artifact LocationResolvers --&gt; &lt;bean id="fsLocationResolver" class="org.foo.storage.resolvers.FSLocationResolver" /&gt; &lt;bean id="memoryLocationResolver" class="org.foo.storage.resolvers.InMemoryLocationResolver" /&gt; &lt;!-- The Set&lt;LocationResolver&gt; --&gt; &lt;util:set id="resolvers" value-type="org.foo.storage.resolvers.LocationResolver"&gt; &lt;ref bean="memoryLocationResolver"/&gt; &lt;ref bean="fsLocationResolver"/&gt; &lt;/util:set&gt; &lt;bean id="configurationManager" class="org.foo.configuration.ConfigurationManager" init-method="init"&gt; &lt;/bean&gt; &lt;bean id="artifactResolutionService" class="org.foo.resolvers.ArtifactResolutionService"&gt; &lt;property name="resolvers" ref="resolvers"/&gt; &lt;/bean&gt; &lt;/beans&gt; My ArtifactResolutionService: package org.foo.storage.resolvers; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class ArtifactResolutionService { @Resource(name = "resolvers") private Set&lt;LocationResolver&gt; resolvers; public Set&lt;LocationResolver&gt; getResolv…
favorite count: 0
has comment: http://stackoverflow.com/comment/34167469
has answer: http://stackoverflow.com/a/22463219
has comment: http://stackoverflow.com/comment/34168400
accepted answer: http://stackoverflow.com/a/22463219
has comment: http://stackoverflow.com/comment/34209068
has title: Autowire a Set defined as <util:set> in Spring
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34195290
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34168626
has comment: http://stackoverflow.com/comment/34209207
upvote count: 1
has comment: http://stackoverflow.com/comment/34167687

http://stackoverflow.com/comment/33945293
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22335918
has text: People may run on values,Java doesnt
score: 0

http://stackoverflow.com/a/22423235
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34096872
upvote count: 1
has body: I think you need to call bb.position(0) before you call bb.get()
answers question: http://stackoverflow.com/q/22423147

scala
tags question: http://stackoverflow.com/q/22356442
tags question: http://stackoverflow.com/q/22382333
tags question: http://stackoverflow.com/q/22467231
tags question: http://stackoverflow.com/q/22389763
tags question: http://stackoverflow.com/q/22440652
tags question: http://stackoverflow.com/q/22470666
tags question: http://stackoverflow.com/q/22349450
tags question: http://stackoverflow.com/q/22378828
tags question: http://stackoverflow.com/q/22411248
tags question: http://stackoverflow.com/q/22402255
tags question: http://stackoverflow.com/q/22457573
tags question: http://stackoverflow.com/q/22335712
tags question: http://stackoverflow.com/q/22466578
tags question: http://stackoverflow.com/q/22467765
tags question: http://stackoverflow.com/q/22452403
tags question: http://stackoverflow.com/q/22331085
tags question: http://stackoverflow.com/q/22380486
tags question: http://stackoverflow.com/q/22482067
tag name: scala
tags question: http://stackoverflow.com/q/22477194
tags question: http://stackoverflow.com/q/22405801
tags question: http://stackoverflow.com/q/22387142
tags question: http://stackoverflow.com/q/22462967
tags question: http://stackoverflow.com/q/22400064
tags question: http://stackoverflow.com/q/22435318
tags question: http://stackoverflow.com/q/22368909
tags question: http://stackoverflow.com/q/22444945
tags question: http://stackoverflow.com/q/22355238
tags question: http://stackoverflow.com/q/22404415
tags question: http://stackoverflow.com/q/22374974
type: Tag
tags question: http://stackoverflow.com/q/22432268

http://stackoverflow.com/q/22414704
has comment: http://stackoverflow.com/comment/34082993
tagged with: eclipse-plugin
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/34082790
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has title: Eclipse WST opening new XML wizard throws java.lang.NullPointerException
has body: I'm using this code I found on the internet to open the WST wizard that helps creating a new XML file. public void openWizard(String id) { // First see if this is a "new wizard". IWizardDescriptor descriptor = PlatformUI.getWorkbench() .getNewWizardRegistry().findWizard(id); // If not check if it is an "import wizard". if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getImportWizardRegistry() .findWizard(id); } // Or maybe an export wizard if (descriptor == null) { descriptor = PlatformUI.getWorkbench().getExportWizardRegistry() .findWizard(id); } try { // Then if we have a wizard, open it. if (descriptor != null) { IWizard wizard = descriptor.createWizard(); IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); WizardDialog wd = new WizardDialog(win.getShell(), wizard); wd.setTitle(wizard.getWindowTitle()); wd.open(); } } catch (CoreException e) { e.printStackTrace(); } } I also defined the id of the wizard : String XML_WIZARD_ID= "org.eclipse.wst.xml.ui.internal.wizards.NewXMLWizard"; and I call this function with : openWizard(XML_WIZARD_ID); This does't work and throws a java.lang.NullPointerException in the internal code of Eclipse. I would like to know what can cause the problem. Here is the stack trace : java.lang.NullPointerException at org.eclipse.ui.dialogs.WizardNewFileCreationPage.initialPopulateContainerNameField(WizardNewFileCreationPage.java:688) at org.eclipse.ui.dialogs.WizardNewFileCreationPage.createControl(WizardNewFileCreationPage.java:247) at org.eclipse.wst.xml.ui.internal.wizards.NewModelWizard$NewFilePage.createControl(NewModelWizard.java:283) at org.eclipse.jface.wizard.Wizard.createPageControls(Wizard.java:174) at org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:736) at org.eclipse.jface.wizard.WizardDialog.createContents(WizardDialog.java:608) at org.eclipse.jface.window.Window.create(Window.java:432) at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1104) at org.eclipse…
has answer: http://stackoverflow.com/a/22415697
accepted answer: http://stackoverflow.com/a/22415697
score: 0
answer count: 1

http://stackoverflow.com/a/22368580
answers question: http://stackoverflow.com/q/22358912
downvote count: 0
has comment: http://stackoverflow.com/comment/34035167
score: 1
has comment: http://stackoverflow.com/comment/77250313
type: Answer
has body: Try using @Convert in Party Entity. Sometimes autoApply flag will not work @Entity @Audited public class Party { @Convert(converter = NametoStringConverter.class) protected Name name; ... }
has comment: http://stackoverflow.com/comment/77249418
upvote count: 1
has comment: http://stackoverflow.com/comment/77256904
has comment: http://stackoverflow.com/comment/77249685

http://stackoverflow.com/comment/34119526
comment on: http://stackoverflow.com/q/22407742
type: Comment
has text: Here this might be of some help. http://stackoverflow.com/questions/17453105/android-open-pdf-file
type: QuestionComment
score: 0

http://stackoverflow.com/a/22469553
answers question: http://stackoverflow.com/q/22469523
downvote count: 0
has body: You can ship the JRE with your application and use that JRE for your application. The effect is the same: The application will be started through an executable (wrapper needed) or script (batch) file and the target machine does not need to have a java runtime installed. Java doesn't have to be 'installed', it just has to be 'present'. Or You may also: Use Excelsior JET compiler for that purpose. See http://www.excelsior-usa.com/ for more information on this.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/22390044
tagged with: http-headers
tagged with: blobstore
has title: Losing cache headers when serving images with Blobstore on Appengine using Java
score: 0
answer count: 1
has body: According to the documentation, I should be able to "append custom headers before or after calling this [serve] method." I serve my blobstore jpeg like this. import com.google.appengine.api.blobstore.BlobstoreService; class MyServlet extends javax.servlet.http.HttpServlet { @Override public void doAction(...) { ... response.setHeader("Cache-Control", "max-age=100000000000"); response.setDateHeader("Expires", System.currentTimeMillis() + 100000000000); blobstoreService.serve(myBlobKey, response); } } Then when I curl -i http://url-serving-my-blob-here I get the right image, but the following headers: cache-control:no-cache, must-revalidate expires:Fri, 01 Jan 1990 00:00:00 GMT Any ideas where my headers went?
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22398902

http://stackoverflow.com/comment/34126351
has text: you can have a `lv.setOnItemClickListener(new OnItemClickListener()..` and implement `onItemCLick`. But `newButton` belong to the listview row??
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22439719

http://stackoverflow.com/comment/34075507
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22411048
type: QuestionComment
has text: i find conn.setRequestProperty("firstName", "Stephen"); in this site - it is work for solve my problem?

http://stackoverflow.com/comment/33990540
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22361593
has text: @RedAlert it doesn't require to break string if a line has less then 9 characters(when newlines are around).
score: 0

http://stackoverflow.com/comment/34247559
type: AnswerComment
comment on: http://stackoverflow.com/a/22493717
has text: that is interesting. You can create a question about it just to know why was that. Sorry couldn't help you.
type: Comment
score: 0

http://stackoverflow.com/comment/33965443
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22347063
has text: I agree with you, however even I have tried using jmeter for load testing, but we have to select option from auto complete drop down and this create problem running jmeter script. I have tried and search on net but did not find any solution hence, i end up with selenium. Also, I am new to jmeter don't know how to use its regex or set parameter for posting data. Do you have any link where I can get more information about using jmeter with example or do you have sample jmeter script for clicking option from auto complete drop down.
type: AnswerComment

http://stackoverflow.com/q/22475881
has comment: http://stackoverflow.com/comment/35147990
has comment: http://stackoverflow.com/comment/34194230
has comment: http://stackoverflow.com/comment/34190599
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34196286
has answer: http://stackoverflow.com/a/23823703
has comment: http://stackoverflow.com/comment/34191459
type: Question
answer count: 2
tagged with: jersey
upvote count: 1
favorite count: 0
tagged with: rest
tagged with: file-io
has answer: http://stackoverflow.com/a/22478870
tagged with: jax-rs
has body: I want a java code which should return any kind of file as stream using JAX-RS (Jersey). to the client side. I have the following code, @GET @Path("/{name}") @Produces("*/*") public Response getFile(String name) { File file = new File("/path/of/the/file"); FileInputStream fiS = new FileInputStream(file); StreamingOutput st = new StreamingOutput() { @Override public void write(OutputStream os) throws IOException { try { int n; byte[] buffer = new byte[1024]; while ((n = fis.read(buffer)) &gt;= 0) { os.write(buffer, 0, n); } os.close(); } catch (Exception e) { throw new WebApplicationException(e); } } }; ResponseBuilder response = Response.ok(st); response.header("Content-Type", "*/*"); response.header("Content-Disposition", "inline; filename=" + fileName); return response.build(); } But it works only for .txt, .html, .properties and .rtf. Since I can download and get the actual content of the files in the client side for these file types. But not sworking for the files with extension .doc, .pdf, .png, .PNG, .jpeg, .mp3, .mp4 ..etc. But I want a common code which should return any kind of files. Output getting while returning the image. Image.PNG Tried with content-type "image/png" Can anyone help me to fix this?
has title: How can I write a server side java code to return any kind of file as stream using JAX-RS(Jersey)?
downvote count: 0
has comment: http://stackoverflow.com/comment/34196085
type: UnansweredQuestion

http://stackoverflow.com/comment/34192383
type: Comment
type: QuestionComment
has text: Thanks - I've gone the rewriting route as you suggest. Tuckey.org's [URL rewriter](https://code.google.com/p/urlrewritefilter/) works great. Would happily mark your previous comment as the solution if I could see how...
score: 0
comment on: http://stackoverflow.com/q/22464404

http://stackoverflow.com/q/22330539
tagged with: wicket
favorite count: 0
has title: Handle ManyToMany entity ralation in a wicket form
answer count: 2
possible better answer: http://stackoverflow.com/a/22343176
upvote count: 1
has answer: http://stackoverflow.com/a/22343176
tagged with: java
has answer: http://stackoverflow.com/a/22380727
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/22380727
type: Question
has body: I have a wicket page with a form to edit an entity that has a many2many relation with another entity. @Entity... class Period { ... @Column(length = 100) private String description; @ManyToMany() private List&lt;Action&gt; actions = new ArrayList&lt;Action&gt;; ... } @Entity... class Action { ... @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "join", joinColumns = @JoinColumn(name = "actionId"), inverseJoinColumns = @JoinColumn(name = "periodId")) private Set&lt;Period&gt; periods = new HashSet&lt;Period&gt;(); ... } class FormPage { public FormPage(Period period) { CompoundPropertyModel&lt;Period&gt; props = new CompoundPropertyModel&lt;Period&gt;(period); Form&lt;Period&gt; form = new Form&lt;Period&gt;("id", props); form.add(new TextField&lt;String&gt;("description")); ??? } } How do I add an 'Action' to my 'Period'? The old jsp page showed all available Action objects in the form with label and checkbox. I would like to keep the checkboxes so the look of the page doesn't change from the old jsp page. The only thing I can think of is create a hashtable the the id's of the actions available and a boolean indicating if it should be added or removed. Does anyone know a nicer way or a good example of an implementation?
type: AnsweredQuestion

http://stackoverflow.com/q/22351021
has body: Why JPanel panGraphics is not displayed in JScrollPane? However, if I put panGraphics directly on the JTabbedPane, it works: tabbedPaneData.addTab("Chart View", panGraphics); JTabbedPane tabbedPaneData = new JTabbedPane(); JScrollPane paneScrollPane = new JScrollPane(); JPanel panGraphics = createGraphics(); paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); paneScrollPane.setPreferredSize(new Dimension(550, 320)); paneScrollPane.setMinimumSize(new Dimension(10, 10)); paneScrollPane.add(panGraphics); tabbedPaneData.addTab("Chart View", paneScrollPane); tabbedPaneData.addTab("Table View", new JPanel());
has answer: http://stackoverflow.com/a/22351157
tagged with: jtabbedpane
score: 0
has title: Why JPanel is not displayed on JScrollPane?
accepted answer: http://stackoverflow.com/a/22351157
tagged with: swing
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
possible better answer: http://stackoverflow.com/a/22351178
has answer: http://stackoverflow.com/a/22351178
answer count: 2
tagged with: jscrollpane

http://stackoverflow.com/comment/34208867
score: 0
type: Comment
type: QuestionComment
has text: Are you doing this for a course or for real?
comment on: http://stackoverflow.com/q/22428434

http://stackoverflow.com/a/22338380
upvote count: 3
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/33949556
answers question: http://stackoverflow.com/q/22338203
has comment: http://stackoverflow.com/comment/33949773
downvote count: 0
has comment: http://stackoverflow.com/comment/33949468
has body: As previous posters said, the error is in your LongDate constructor. The problem is in the if expression. The variable monthName has not be initialized. Instead, it should be m as that is the parameter. if (monthName.equals("January")) { month = 1; } else if (monthName.equals("February")) { Also, you have similar problems through the class.

http://stackoverflow.com/comment/34085147
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22415278
type: AnswerComment
has text: Juan. Actually no. Stating that `a` is not a statement is not the same as stating what `ForInit` is. Actually I'm even stating that `ForInit` is not a statement according to the languages Specs:). I could write a statement about the purpose of my statements but I better not, further statements will induce everyone into a state of deeply confusion. Just don't assume that my statements are stating the obvious (they are only obvious to people that memorized the specs about statements :D). Trust me, I know my statements!

http://stackoverflow.com/comment/34157499
comment on: http://stackoverflow.com/q/22444706
score: 0
type: QuestionComment
has text: @Skyzer: While it is possible to define dependencies in a `<profile/>`, it's generally not a good idea to be using this, as it may break portability and things will not be apparent. Furthermore, reports from a `dependency:tree` will only show the dependencies which are defined in the `pom.xml` and the activated profile, meaning they will cover just one of the cases. This is generally poor design and making projects inherit this way of doing things is like spreading the disease. (Just my 5 cents of advice).
type: Comment

http://stackoverflow.com/a/22449874
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34145016
has body: You are right about them ending up in the same bucket. In the absence of an overridden equals method, the JVM will just compare the object references for equality. In your case you are passing the same object to map.get() as you put in the map, so the references will be equal and so it matches the object. Try creating: Employee emp3CantFindMe = new Employee(33, "Arunan") You'll find trying to retrieve that from the map will result in null even though it seems to be the "same" as emp3.
has comment: http://stackoverflow.com/comment/34145158
has comment: http://stackoverflow.com/comment/34144776
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22449772
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22449772

http://stackoverflow.com/comment/75351747
has text: Note that if you are using ActionBarActivity (or AppCompat theme), you'll need to use @style/Theme.AppCompat.Dialog instead.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22470737
score: 1

jettison
tags question: http://stackoverflow.com/q/22379082
tag name: jettison
type: Tag

http://stackoverflow.com/q/22469674
tagged with: flume
type: Question
type: AnsweredQuestion
tagged with: slf4j
has answer: http://stackoverflow.com/a/22499169
answer count: 1
downvote count: 0
favorite count: 0
has body: I tried to build maven package from this source https://github.com/mpercy/flume-load-gen. But, when I build it using mvn clean package, I got errors like this : [ERROR] /home/vincentius/Documents/flume-load-gen-master/src/main/java/org/apache/flume/tcphammer/Hammer.java:[67,12] error: no suitable method found for info(String,String,int) [ERROR] [ERROR] method Logger.info(Marker,String,Throwable) is not applicable [ERROR] (actual argument String cannot be converted to Marker by method invocation conversion) [ERROR] method Logger.info(Marker,String,Object[]) is not applicable [ERROR] (actual argument String cannot be converted to Marker by method invocation conversion) [ERROR] method Logger.info(Marker,String,Object,Object) is not applicable [ERROR] (actual and formal argument lists differ in length) [ERROR] method Logger.info(Marker,String,Object) is not applicable [ERROR] (actual argument String cannot be converted to Marker by method invocation conversion) [ERROR] method Logger.info(Marker,String) is not applicable [ERROR] (actual and formal argument lists differ in length) [ERROR] method Logger.info(String,Throwable) is not applicable [ERROR] (actual and formal argument lists differ in length) [ERROR] method Logger.info(String,Object[]) is not applicable [ERROR] (actual and formal argument lists differ in length) [ERROR] method Logger.info(String,Object,Object) is not applicable [ERROR] (actual argument int cannot be converted to Object by method invocation conversion) [ERROR] method Logger.info(String,Object) is not applicable [ERROR] (actual and formal argument lists differ in length) [ERROR] method Logger.info(String) is not applicable [ERROR] (actual and formal argument lists differ in length) [ERROR] /home/vincentius/Documents/flume-load-gen-master/src/main/java/org/apache/flume/tcphammer/Hammer.java:[137,25] error: incompatible types [ERROR] [ERROR] could not parse error message: required: Object [ERROR] found: long [ERROR] /home/vincentius/Documents/flume-l…
accepted answer: http://stackoverflow.com/a/22499169
score: 1
tagged with: java
upvote count: 1
tagged with: maven
has title: Maven - Failed to execute goal

http://stackoverflow.com/comment/33947132
comment on: http://stackoverflow.com/q/22336989
score: 1
type: QuestionComment
type: Comment
has text: In the above code segment, `break abc;` will cause control to flow to the first statement following the `}` closing the block labeled "abc". `continue abc;` would cause control to flow to the first statement in the so-labeled block. (This is really only useful when you want to break/continue from several levels deep in a nested block structure.)

http://stackoverflow.com/q/22392609
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/34043942
has title: Issues in BlackJack Simulation with Loops and Counters
has comment: http://stackoverflow.com/comment/34044195
type: Question
has body: Here's basically what I have to do. I'm making a simulation of blackjack, where it asks for user input. I haven't incorporated an if statement to make sure that the starting hand value is within 2-20 (aces are only worth 1 point in this version of blackjack, so smallest hand is 2 and largest is 20). Assume that the user's hand is in that range. The simulation number must also be positive. Assume the user puts in a positive number. The range for the random numbers is 1-13 with 11, 12, and 13 corresponding to a value of 10. I also don't know how to make the random number equal 10 when the random number is 11, 12, or 13. Errors The bust count is either 0 or matches the number of draws/turns in the simulation that have happened. The turn count either matches the simulation or is one more than the simulation. Any ideas on how I can get the bust to count correctly? FIXED Check edits for what I did to fix it and an explanation that may/may not be correct for why it was wrong. import java.util.*; public class BlackJack { public static void main(String[] args) { // TODO Auto-generated method stub Random r = new Random(); Scanner console = new Scanner(System.in); System.out.print("What is the value of your starting hand: "); int value = console.nextInt(); System.out.println(); System.out.print("How many deals do you want to simulate: "); int simulate = console.nextInt(); int turn = 0; int bust = 0; do { // draw a card turn += 1; int value1 = value + (r.nextInt(13)+1); if (value1 &gt; 21) { bust += 1; } else { //draw another card value1 = value1 + (r.nextInt(13)+1); if (value1 &gt; 21) { bust += 1; } } } while (turn &lt;= simulate); System.out.println(bust); System.out.println(turn); } }
has comment: http://stackoverflow.com/comment/34044254
has comment: http://stackoverflow.com/comment/34043975
tagged with: eclipse
score: 0

http://stackoverflow.com/a/22363371
upvote count: 0
has body: You can use the fonction .equals() on two objects that implements the generic java methods equals() and hashcode() in Java. The hashcode() method is used to get an integer value of your object and the equals() method uses this hash(integer) to compare and return a boolean (wheter or not they are equal). You could then compare the objects with .equals() public void insert( Town d ) { if ( d.equals(data1) &lt; 0 ) //ERROR HERE { if ( left == null ) left = new TreeNode( d ); else left.insert( d ); } else if ( d.equals(data1) &gt; 0 ) //ERROR HERE { if ( right == null ) right = new TreeNode( d ); else right.insert( d ); } } } Given that data is of the type Town of course. You can insert those two methods automtically with your IDE. Here is a full explanation/example: http://javarevisited.blogspot.ca/2011/02/how-to-write-equals-method-in-java.html
answers question: http://stackoverflow.com/q/22363119
type: Answer
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/33993477

http://stackoverflow.com/q/22439665
has comment: http://stackoverflow.com/comment/34126264
has answer: http://stackoverflow.com/a/22439763
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34126299
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has body: I am using GSON to serialize Java object. I have a Java class with following properties. String property1; Map&lt;String, HashMap&gt; property2 = new HashMap&lt;&gt;(); Map&lt;String, ArrayList&lt;String&gt;&gt; property3 = new HashMap&lt;&gt;(); Map&lt;String, String[]&gt; property4 = new HashMap&lt;&gt;(); I want to convert this to Json. Because of the maps with HashMaps inside, it has become difficult. I know I can get Json of a map with gsonObject.toJson(map). But I want all these properties in the Json Object. (all in one. not Concatenating many objects) Can anyone help me to get this done?
has comment: http://stackoverflow.com/comment/34126215
accepted answer: http://stackoverflow.com/a/22439763
score: 0
linked to: http://stackoverflow.com/q/22441134
answer count: 1
has title: Convert complex Java object to Json using Gson
has comment: http://stackoverflow.com/comment/34126252

http://stackoverflow.com/a/22371965
answers question: http://stackoverflow.com/q/22367997
has body: The verison of javac and java used have to be same, i.e. the Java version used to compile the code and the one user to run the code have to be same. Check javac and java versions on command prompt. javac -version java -version If you are using an IDE to run your project, check the jdk version in your IDE Preferences.
type: Answer
score: 0

run-configuration
type: Tag
tag name: run-configuration
tags question: http://stackoverflow.com/q/22465157

http://stackoverflow.com/comment/34030209
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22384989
has text: I've removed my downvote but this still doesn't answer why `createGUI` can't be called. It can be called so the question is invalid anyway.

http://stackoverflow.com/comment/34168962
has text: about my server socket, I want the server requires client autenticathion in a specific situation then I include there: "sslsocket.setNeedClientAuth(true)" ... but the connection inst lost as I expected (there inst client certificate in cacerts, because I deleted it before for testing) and the server continue reading the stream
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22462454

http://stackoverflow.com/comment/34162963
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22460571
has text: Hint: Search wsimport in Google :)
type: Comment

http://stackoverflow.com/a/77089001
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22477273
has body: Try this one context.Response.AddHeader("content-disposition", "attachment;filename=\"" + request.Filename + "\";");

http://stackoverflow.com/a/22398222
downvote count: 1
has comment: http://stackoverflow.com/comment/106989504
score: 47
upvote count: 48
answers question: http://stackoverflow.com/q/22397861
has comment: http://stackoverflow.com/comment/51822223
type: Answer
has comment: http://stackoverflow.com/comment/48994738
has comment: http://stackoverflow.com/comment/89991554
has comment: http://stackoverflow.com/comment/48989106
has comment: http://stackoverflow.com/comment/48989042
has body: Java Developers decide Strings are immutable due to the following aspect design, efficiency, and security. Design Strings are created in a special memory area in java heap known as "String Intern pool". While you creating new String (Not in the case of using String() constructor or any other String functions which internally use the String() constructor for creating a new String object; String() constructor always create new string constant in the pool unless we call the method intern()) variable it searches the pool to check whether is it already exist. If it is exist, then return reference of the existing String object. If the String is not immutable, changing the String with one reference will lead to the wrong value for the other references. According to this article on DZone: Security String is widely used as parameter for many java classes, e.g. network connection, opening files, etc. Were String not immutable, a connection or file would be changed and lead to serious security threat. Mutable strings could cause security problem in Reflection too, as the parameters are strings. Efficiency The hashcode of string is frequently used in Java. For example, in a HashMap. Being immutable guarantees that hashcode will always the same, so that it can be cached without worrying the changes.That means, there is no need to calculate hashcode every time it is used.
has comment: http://stackoverflow.com/comment/48981454

http://stackoverflow.com/comment/33995633
comment on: http://stackoverflow.com/q/22364347
score: 1
has text: *"This works fine when used in SQL statements"* Just pointing out that in SQL strings use `'` not `"`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33957131
type: QuestionComment
comment on: http://stackoverflow.com/q/22342500
score: 1
has text: There is, but as I understand it, it's a little more involved, as you need to provide an app bundle. You can also configure the applications to start through the settings [Mac OS X: Setting up Login, Startup](http://support.apple.com/kb/ht2602)
type: Comment

http://stackoverflow.com/comment/34090522
score: 0
comment on: http://stackoverflow.com/a/22400564
type: AnswerComment
type: Comment
has text: So for,every thing is fine.But confusion is when I have an Entity class and one more entity student.Here the parent is class and child is student.If I delete the class,Is it need to make the all child's(Students) null reference manually?

http://stackoverflow.com/a/22433373
upvote count: 2
has comment: http://stackoverflow.com/comment/34114957
type: Answer
score: 2
has body: File file =new File("xxxxx"); // file path if(file.exists()){ double bytes = file.length(); double kilobytes = (bytes / 1024); System.out.println("bytes : " + bytes); double megabytes = (kilobytes / 1024); System.out.println("kilobytes : " + kilobytes); double gigabytes = (megabytes / 1024); System.out.println("megabytes : " + megabytes); double terabytes = (gigabytes / 1024); System.out.println("gigabytes : " + gigabytes); double petabytes = (terabytes / 1024); }else{ System.out.println("File does not exists!"); }
downvote count: 0
answers question: http://stackoverflow.com/q/22433264
has comment: http://stackoverflow.com/comment/85586790

http://stackoverflow.com/q/22473154
has comment: http://stackoverflow.com/comment/34185145
upvote count: 8
type: Question
linked to: http://stackoverflow.com/q/1855170
has answer: http://stackoverflow.com/a/22473252
accepted answer: http://stackoverflow.com/a/22473252
downvote count: 0
has answer: http://stackoverflow.com/a/22473343
possible better answer: http://stackoverflow.com/a/22473308
has title: What is the purpose of Java's String.intern()?
tagged with: string
answer count: 4
score: 8
favorite count: 0
linked to: http://stackoverflow.com/q/1881922
has answer: http://stackoverflow.com/a/22473392
linked to: http://stackoverflow.com/q/22005972
linked to: http://stackoverflow.com/q/2486191
has answer: http://stackoverflow.com/a/22473308
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34185326
tagged with: java
has body: I know there are two ways of creating String in Java: String a = "aaa"; String b = new String("bbb"); With the first way Java will definitely create a String object in the string pool and make a refer to it. (Assume "aaa" wan't in the pool before.) With the second method, an object will be created in the heap, but will jvm also create an object in the string pool? In this post Questions about Java's String pool, @Jesper said: If you do this: String s = new String("abc"); then there will be one String object in the pool, the one that represents the literal "abc", > and there will be a separate String object, not in the pool, that contains a copy of the > content of the pooled object. If that's true, then every time with the new String("bbb");, a object "bbb" is created in the pool, which means by either way above, java will always create a string object in the pool. Then what is intern() used for ? In the docs http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#intern(), it says: When the intern method is invoked, if the pool already contains a string equal to this String object as determined by the equals(Object) method, then the string from the pool is returned. Otherwise, this String object is added to the pool and a reference to this String object is returned. That means there are cases that a string is not in the pool, is that possible ? Which one is true ?

http://stackoverflow.com/comment/34033604
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22386926
has text: It should be noted though that if the OP means to implement this himself, this is definitely not as easy as creating a balanced BST from a sorted array. Implementing a self-balancing BST is tricky.
score: 0

http://stackoverflow.com/comment/34160617
has text: Full Of Eles i added information at the bottom. please do check .
type: AnswerComment
comment on: http://stackoverflow.com/a/22457411
score: 0
type: Comment

http://stackoverflow.com/q/22334274
has comment: http://stackoverflow.com/comment/33943010
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33942105
tagged with: listcellrenderer
type: Question
has body: I have a JComboBox that is intended to be used to select a Font. To allow for a preview of the font when the user is making a selection I have written a custom ListCellRenderer: public class FontListCellRenderer implements ListCellRenderer&lt;String&gt;{ private ListCellRenderer&lt;Object&gt; defaultRenderer; @SuppressWarnings("unchecked") public FontListCellRenderer(){ this.defaultRenderer = (ListCellRenderer&lt;Object&gt;) new JComboBox&lt;Object&gt;().getRenderer(); } @Override public Component getListCellRendererComponent(JList&lt;? extends String&gt; list, String value, int index, boolean isSelected, boolean cellHasFocus) { Component returnVal = this.defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); returnVal.setFont(new Font((String) value, returnVal.getFont().getStyle(), returnVal.getFont().getSize())); return returnVal; } } In using this however I noticed a drastic performance hit when initializing my JComboBox with this ListCellRenderer. Upon further investigation I discovered that my ListCellRenderer was being called for many fonts when I set the default value for my item with setSelectedItem(). For now I have changed my code to set the ListCellRenderer last but I would like to know why is this happening? Even if my item were on the screen (which it is not yet) the ListCellRenderer does not render the selected item as it is shown idly in the JComboBox. Even if it was, why is it being called for non-selected items?
has comment: http://stackoverflow.com/comment/33942616
has comment: http://stackoverflow.com/comment/33946078
favorite count: 0
upvote count: 1
has title: Why is ListCellRenderer called when setSelectedItem() is used?
tagged with: jcombobox
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/comment/34159280
comment on: http://stackoverflow.com/a/22458404
has text: What if I dont know the index of the element, Ex. I tpyed 3 plate numbers, then the 2nd plate number wants to log out. How do I remove that 2nd plate number w/o knowing what the index of it?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22465607
answers question: http://stackoverflow.com/q/22465547
type: AcceptedAnswer
has body: You could do slider.putClientProperty("JSlider.isFilled", Boolean.FALSE);
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22465547
has comment: http://stackoverflow.com/comment/34173685
type: Answer
has comment: http://stackoverflow.com/comment/34174345
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/34172333

http://stackoverflow.com/comment/34150018
score: 1
has text: And the value in the database is correct? I.e. that the `\n` you want is stored as a newline in the database and not as two characters - "\" and "n" ?
type: Comment
comment on: http://stackoverflow.com/q/22406321
type: QuestionComment

http://stackoverflow.com/a/53981349
has body: If you use library Material Preference, you can do it easily: listPreference.summaryFormatter = { entry, value -&gt; "Value for $entry is $value" } It will set your ListPreference's summary to something like Value for Weekly is 7. I know that this answer is not strongly related to your question. But at least, you have found a library that can do it. With Material Preference, you don't have to set %s to the ListPreference's summary.
score: 3
answers question: http://stackoverflow.com/q/22426388
downvote count: 0
has comment: http://stackoverflow.com/comment/94801104
type: Answer
upvote count: 3

http://stackoverflow.com/a/22337640
answers question: http://stackoverflow.com/q/22337538
score: 0
has body: Assuming your action variable is what base the hitter will end up on, and first, second, third are booleans for batters on base: Instead of checking each boolean, perhaps transform them into a single array. For example, a runner on first and third looks like [1,0,1]. A runner on second and third looks like [0,1,1]. Then you can write a function that takes in your action variable and the array of bases and returns the number of runs and the new bases array. This could certainly remove the nested statements from your case statement, but maybe you can think of a way to make this work better than nested ifs?
type: Answer

http://stackoverflow.com/q/22413790
answer count: 5
has answer: http://stackoverflow.com/a/22414045
has answer: http://stackoverflow.com/a/22413872
type: Question
has answer: http://stackoverflow.com/a/22413864
type: AnsweredQuestion
tagged with: local-class
tagged with: java
possible better answer: http://stackoverflow.com/a/22413850
tagged with: class
upvote count: 2
has answer: http://stackoverflow.com/a/22413850
has body: If I have this code. public class Test{ { class People { } } public static void main(String[] args) { People person = new People();//Compile ERROR } } I can't create instance of People. Does that mean Initializer Block can't be used for defining classes?
has title: Why can't create instance of local class in Java?
tagged with: field
has comment: http://stackoverflow.com/comment/34080778
has comment: http://stackoverflow.com/comment/34080586
favorite count: 0
has answer: http://stackoverflow.com/a/22413899
score: 2
accepted answer: http://stackoverflow.com/a/22413864
downvote count: 0

http://stackoverflow.com/a/22345345
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22344721
answers question: http://stackoverflow.com/q/22344721
has body: You use private modules for creating graphs of objects which are almost the same but differ in particular details. public class DataUser1Module extends PrivateModule { @Override protected void configure() { bindConstant().annotatedWith(Names.named("First")).to("foo"); bindConstant().annotatedWith(Names.named("Second")).to("bar"); bind(Data.class); bind(DataUser1.class); expose(DataUser1.class); } } public class DataUser2Module extends PrivateModule { @Override protected void configure() { bindConstant().annotatedWith(Names.named("First")).to("foo2"); bindConstant().annotatedWith(Names.named("Second")).to("bar2"); bind(Data.class); bind(DataUser2.class); expose(DataUser2.class); } } Injector injector = Guice.createInjector(new DataUser1Module(), new DataUser2Module()); DataUser1 dataUser1 = injector.getInstance(DataUser1.class); DataUser2 dataUser2 = injector.getInstance(DataUser2.class); You do the same thing if you need two instances of DataUser1 with different Datas, but you use annotations to differentiate between them: public class DataUser1Module1 extends PrivateModule { @Override protected void configure() { bindConstant().annotatedWith(Names.named("First")).to("foo"); bindConstant().annotatedWith(Names.named("Second")).to("bar"); bind(Data.class); bind(DataUser1.class).annotatedWith(Names.named("1")).to(DataUser1.class); expose(DataUser1.class).annotatedWith(Names.named("1")); } } public class DataUser1Module2 extends PrivateModule { @Override protected void configure() { bindConstant().annotatedWith(Names.named("First")).to("foo2"); bindConstant().annotatedWith(Names.named("Second")).to("bar2"); bind(Data.class); bind(DataUser1.class).annotatedWith(Names.named("2")).to(DataUser1.class); expose(DataUser1.class).annotatedWith(Names.named("2")); } } Injector injector = Guice.createInjector(new DataUser1Module1(), new DataUser1Module2()); DataUser1 dataUser11 = injector.getInstance(Key.get(DataUser1.class, Names.named("1")); DataUser1 dataUser12 = injector.getIn…

http://stackoverflow.com/comment/82236712
score: 0
has text: If i m trying to dismiss the listening box, or it doent listen anyting then it becomes crash. Why?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22477256

http://stackoverflow.com/q/22363682
tagged with: android
has comment: http://stackoverflow.com/comment/34014232
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34013663
has body: I'm working on an android application that shows the results of a hearing test. It was made a while ago so a lot of the code is depreciated. The old code uses a TabActivity which works fine: public class TabbedResultActivity extends TabActivity { private TabHost mTabHost; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabbed_results); setTabs(); } private void setTabs() { mTabHost = getTabHost(); addTab(R.string.Left_ear, false); addTab(R.string.Right_ear, true); } private void addTab(int labelId, boolean aRight) { Intent intent = createIntent(aRight); TabHost.TabSpec spec = mTabHost.newTabSpec("tab" + labelId); View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false); TextView title = (TextView) tabIndicator.findViewById(R.id.title); title.setTextSize(14.0f); title.setText(labelId); spec.setIndicator(tabIndicator); spec.setContent(intent); mTabHost.addTab(spec); } private Intent createIntent( boolean aRight) { Intent newIntent = new Intent(getIntent()); newIntent.putExtra(ResultActivity.IS_RIGHT_EAR, aRight); newIntent.setClass(this, ResultActivity.class); return newIntent; } but, the problem I've got it that I have to add an action bar for the menu on newer devices. To make the app compatible on all devices I've used the ActionBarSherlock library. This is great but I can't figure out how to add my ResultsActivity into the Fragment as I need the ResultsActivity to extend from SherlockFragmentActivity, but to integrate it into a Fragment, I need to extend the SherlockFragment class. If I do this I get loads of errors because it doesn't extend from activity. Here's my original ResultsActivity class: public class ResultActivity extends SherlockFragmentActivity { public static final String IS_RIGHT_EAR = "is_right_ear"; private ArrayList&lt;EarSrt&gt; leftAnswerList; private ArrayList&lt;EarSrt&gt; rightAnswerList; private boolean isRightEarTab = true…
tagged with: android-fragments
tagged with: actionbarsherlock
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34010685
has title: Android Integrate Activity class into Fragment
has comment: http://stackoverflow.com/comment/34015106
has comment: http://stackoverflow.com/comment/34013533
has comment: http://stackoverflow.com/comment/34014257
score: 0

http://stackoverflow.com/comment/34147358
comment on: http://stackoverflow.com/a/22451546
has text: I don't want to have a field in `User` referencing the events. Can this be done without that?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34061614
comment on: http://stackoverflow.com/a/22403180
type: Comment
has text: Eh, unfortunately that has never been documented properly. Except for the fact that `AccessDeniedException` did _not_ exist in Java 6, and for compatibility reasons they couldn't change the exceptions thrown
score: 0
type: AnswerComment

http://stackoverflow.com/a/22449166
accepted answer of: http://stackoverflow.com/q/22448969
type: Answer
has body: An HttpServletRequest is attended by a thread. Many Servlet containers don't create a new thread for each request they receive, but recycle threads in order to save resources. In case you store data on a ThreadLocal scoped variable, this variables would survive the process of a request and still be there when the thred is used again by another request. That's why you have to clean them.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22448969
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/34804288
has text: Hello, sorry for the long absence. Your answer is being really helpful but now I'm having a problem getting the proxy ticket in the proxy application. I get the following log `INFO [org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl] - <No Proxy Ticket found for [PGTIOU-15-d4Cm3cF2StBgXXqF4dt1-cas01.example.org].>` and `casProxyProfile.getProxyTicketFor(serviceName)` returns null. Any ideas?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22501796
type: AnswerComment

http://stackoverflow.com/a/22488312
answers question: http://stackoverflow.com/q/22438030
type: Answer
upvote count: 4
downvote count: 0
score: 4
has body: It seems like you didnt add the library in the project. please add rpc jar in the project. RPC is older version of webservice for the tutorial you cans use http://docs.oracle.com/javaee/1.4/tutorial/doc/JAXRPC3.html. You can also use apache axis which more better than the rpc style of webservice.

http://stackoverflow.com/comment/34049842
type: QuestionComment
type: Comment
has text: i was able to find my asnwer and now i have another question...how can i sort the list horizontally? cause it outputs vertically
comment on: http://stackoverflow.com/q/22394301
score: 0

http://stackoverflow.com/q/22335437
has answer: http://stackoverflow.com/a/22335547
tagged with: servlets
score: 0
answer count: 2
tagged with: httpsession
possible better answer: http://stackoverflow.com/a/22335595
has answer: http://stackoverflow.com/a/22335595
accepted answer: http://stackoverflow.com/a/22335547
has body: I am practicing a little bit with sessions and servlets. I have created a servlet to test it, and I have the next "doGet" method: @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { PrintWriter out = resp.getWriter(); HttpSession session = req.getSession(); if(session.isNew()) { out.println("Welcome."); } else { out.println("Nice to see you again."); } Integer visits = (Integer)session.getAttribute("timesVisited"); if (visits == null) { visits = new Integer(1); session.setAttribute("timesVisited", visits); } else { visits = visits + 1; session.setAttribute("timesVisited", visits); } out.println(" You have visited that servlet " + visits + " times. "); out.println("&lt;a href = \"" + resp.encodeURL("SessionServlet.do") + "\"&gt;" + "hola" + "&lt;/a&gt;"); return; } What is wondering me, is that I need the line session.setAttribute("timesVisited", visits); to update the value of the "timesVisited" attribute on the session. If I comment that line, the value will be always 1 each time I call the servlet. I was expecting that, since the attribute objects are linked to the session, if I updated the value of the attribute in the servlet (as it happens in that example), it would just get the new value in the Session without me having to call "setAttribute" again. Does anyone know what I am missing? I am sure it is something completely lame that I have not seen. Thanks for your time.
has title: HttpSession attribute : Why is the attribute not updated
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/22422075
has body: I am not sure about this is a proper way to solve this error. But Its works for me. Change your web.xml to like this and try SavingServlet /save.jsp SavingServlet /save Its Working fine in my machine.
score: 0
answers question: http://stackoverflow.com/q/22421775
type: Answer

http://stackoverflow.com/q/22423992
tagged with: android
tagged with: android-intent
answer count: 0
tagged with: java
tagged with: eclipse
tagged with: android-emulator
type: Question
has comment: http://stackoverflow.com/comment/34098261
has comment: http://stackoverflow.com/comment/34099843
score: 0
has title: android ClassNotFoundException: Didn't find class---from developing android apps
upvote count: 1
has comment: http://stackoverflow.com/comment/34104760
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: i got an error like this 03-15 08:33:51.474: D/AndroidRuntime(1468): Shutting down VM 03-15 08:33:51.474: W/dalvikvm(1468): threadid=1: thread exiting with uncaught exception (group=0xb3a80ba8) 03-15 08:33:51.634: E/AndroidRuntime(1468): FATAL EXCEPTION: main 03-15 08:33:51.634: E/AndroidRuntime(1468): Process: com.pongodev.restaurant, PID: 1468 03-15 08:33:51.634: E/AndroidRuntime(1468): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.pongodev.restaurant/com.pongodev.restaurant.Home}: java.lang.ClassNotFoundException: Didn't find class "com.pongodev.restaurant.Home" on path: DexPathList[[zip file "/data/app/com.pongodev.restaurant-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.pongodev.restaurant-1, /system/lib]] 03-15 08:33:51.634: E/AndroidRuntime(1468): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) 03-15 08:33:51.634: E/AndroidRuntime(1468): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 03-15 08:33:51.634: E/AndroidRuntime(1468): at android.app.ActivityThread.access$800(ActivityThread.java:135) 03-15 08:33:51.634: E/AndroidRuntime(1468): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 03-15 08:33:51.634: E/AndroidRuntime(1468): at android.os.Handler.dispatchMessage(Handler.java:102) 03-15 08:33:51.634: E/AndroidRuntime(1468): at android.os.Looper.loop(Looper.java:136) 03-15 08:33:51.634: E/AndroidRuntime(1468): at android.app.ActivityThread.main(ActivityThread.java:5017) 03-15 08:33:51.634: E/AndroidRuntime(1468): at java.lang.reflect.Method.invokeNative(Native Method) 03-15 08:33:51.634: E/AndroidRuntime(1468): at java.lang.reflect.Method.invoke(Method.java:515) 03-15 08:33:51.634: E/AndroidRuntime(1468): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 03-15 08:33:51.634: E/AndroidRuntime(1468): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 03-15 08:33:51.634: E/AndroidRuntime(1468): at dal…

http://stackoverflow.com/comment/34005459
type: QuestionComment
has text: Line 65 you are missing a / in front of your comment block?
score: 0
comment on: http://stackoverflow.com/q/22370032
type: Comment

http://stackoverflow.com/comment/34106633
has text: the entire array of V must be updated by for loop if any one value of V violates the condition.old _Vi must be updated by new value of V which is founded by for loop.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22428387
type: Comment

http://stackoverflow.com/a/22478319
score: 1
has body: The default layout for a JFrame is BorderLayout. Try using GridLayout, for example frame.setLayout(new GridLayout(0, 3)); Don't load the image in the paintComponent method, this method should exit as fast as possible, instead, pre-load the images... public class Cards extends JPanel implements MouseMotionListener, MouseListener{ //... private Image face; private Image back; //... public Cards() { //... face = new ImageIcon(this.getClass().getResource(card)).getImage(); back = ImageIcon icon = new ImageIcon(this.getClass().getResource("/img/b1fv.gif")).getImage(); //... } public void paintComponent(Graphics g){ super.paintComponent(g); if(faceUp){ g.drawImage(face, this.X, this.Y, this); } else { g.drawImage(back , this.X, this.Y, this); } } You should also be overriding the getPreferredSize method of the JPanel, this works with the layout manager API to allow it to make decisions about how best to layout component... public Dimension getPreferredSize() { return face == null ? super.getPreferredSize() : new Dimension(face.getWidth(this), face.getHeight(this)); } This will now allow you to use JFrame#pack instead of JFrame#setSize
has comment: http://stackoverflow.com/comment/34193815
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22478249
upvote count: 1
has comment: http://stackoverflow.com/comment/34214221

http://stackoverflow.com/a/22536307
has body: I figured it out! I just needed to initialize the cubesSettings variable withing the update method again! The nullPointerException is gone! I am left with a new more confusing one but it does not pertain to this question and is material for another question. Thank you all!
type: Answer
accepted answer of: http://stackoverflow.com/q/22408730
answers question: http://stackoverflow.com/q/22408730
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/22392135
tagged with: arraylist
has comment: http://stackoverflow.com/comment/34043052
has comment: http://stackoverflow.com/comment/34043267
has comment: http://stackoverflow.com/comment/34043036
has comment: http://stackoverflow.com/comment/34043169
answer count: 1
has comment: http://stackoverflow.com/comment/34043374
downvote count: 0
has body: I'm going to show all of my code here so you guys get a gist of what I'm doing. import java.io.*; import java.util.*; public class Plagiarism { public static void main(String[] args) { Plagiarism myPlag = new Plagiarism(); if (args.length == 0) { System.out.println("Error: No files input"); } else if (args.length &gt; 0) { try { List&lt;String&gt; foo = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt; 2; i++) { BufferedReader reader = new BufferedReader (new FileReader (args[i])); foo = simplify(reader); for (int j = 0; j &lt; foo.size(); j++) { System.out.print(foo.get(j)); } } int blockSize = Integer.valueOf(args[2]); System.out.println(args[2]); // String line = foo.toString(); List&lt;String&gt; list = new ArrayList&lt;String&gt;(); for (int k = 0; k &lt; foo.size() - blockSize; k++) { list.add(foo.toString().substring(k, k+blockSize)); } System.out.println(list); } catch (Exception e) { e.printStackTrace(); } } } public static List&lt;String&gt; simplify(BufferedReader input) throws IOException { String line = null; List&lt;String&gt; myList = new ArrayList&lt;String&gt;(); while ((line = input.readLine()) != null) { myList.add(line.replaceAll("[^a-zA-Z]","").toLowerCase()); } return myList; } } This is the code that is using substring. int blockSize = Integer.valueOf(args[2]); //"foo" is an ArrayList&lt;String&gt; which I have to convert toString() to use substring(). String line = foo.toString(); List&lt;String&gt; list = new ArrayList&lt;String&gt;(); for (int k = 0; k &lt; line.length() - blockSize; k++) { list.add(line.substring(k, k+blockSize)); } System.out.println(list); When I specify blockSize as 4 in cmd this is the result: [[, a, , ab, abc ] the text file (standardised using my other code) is this: abcdzaabcdd so the result should be this: [abcd, bcdz, cdza, ] etc. Any help? Thanks in advance.
tagged with: string
has comment: http://stackoverflow.com/comment/34043209
favorite count: 0
accepted answer: http://stackoverflow.com/a/22393351
has comment: http://stackoverflow.com/comment/34043979
has comment: http://stackoverflow.com/comment/34043255
has comment: http://stackoverflow.com/comment/34043131
has comment: http://stackoverflow.com/comment/34044509
has comment: http://stackoverflow.com/comment/34043996
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34043435
has comment: http://stackoverflow.com/comment/34043193
has comment: http://stackoverflow.com/comment/34044495
score: 1
has comment: http://stackoverflow.com/comment/34044695
tagged with: java
has comment: http://stackoverflow.com/comment/34043955
upvote count: 1
has comment: http://stackoverflow.com/comment/34043560
has comment: http://stackoverflow.com/comment/34044668
type: Question
has title: Java - substring issues
has answer: http://stackoverflow.com/a/22393351
has comment: http://stackoverflow.com/comment/34043794
has comment: http://stackoverflow.com/comment/34043246
tagged with: substring

http://stackoverflow.com/comment/39689575
comment on: http://stackoverflow.com/q/22474540
score: 0
has text: downvoters please comment what's wrong you'd seen in this question
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22361654
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/22361828
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33990194
has answer: http://stackoverflow.com/a/22361721
has comment: http://stackoverflow.com/comment/33990198
has title: Discount rate with if statement
has body: im trying to apply a discount system into one of my programs. Im very new to programming so I'm sorry for the beginner questions! Okay so this is my current discount formula double discount = total - (total*number*0.025); Basically will get a 2.5% discount off the total cost for each package (number). Im wanting this to stop at 30%, so no discount can be greater than 30% off. This is what I tried if(discountOne &gt;= totalOne/3) { discountOne = totalOne*0.33; } However it didnt work. Any help is much appreciated! Also if theres a better formula I should be using feel free to let me know. Thanks again for all the help!

http://stackoverflow.com/q/22451915
type: Question
has comment: http://stackoverflow.com/comment/34148069
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22452147
has answer: http://stackoverflow.com/a/22452243
has comment: http://stackoverflow.com/comment/34148136
favorite count: 0
has title: Regex is not working
has body: Following is my program. I was trying replace @, &amp;, ;, and . with space (). But I am unable to get the correct output. public static void main(String[] args) throws IOException { final String REG_EXPR = "[!\"#$%&amp;'()*+-./:;&lt;=&gt;?@\\^_{|}~`,.\\[\\]–]*"; String Description="திகழ்கிறது.@;@;@;@;ஆனால் ஆனால் "; HashSet&lt;String&gt; line=new HashSet&lt;String&gt;(); Scanner sc2 = null; sc2 = new Scanner(Description); while (sc2.hasNextLine()) { Scanner s2 = new Scanner(sc2.nextLine()); boolean b; while (s2.hasNext()) { String s = s2.next(); String s1 = s.replaceAll(REG_EXPR, ""); s1=s1.replaceAll("[a-zA-Z0-9\\s]", ""); System.out.println("s1 value"+s1); } } } output s1 valueதிகழ்கிறதுஆனால் s1 valueஆனால் expected output s1 valueதிகழ்கிறது s1 valueஆனால் s1 valueஆனால்
tagged with: regex
answer count: 4
possible better answer: http://stackoverflow.com/a/22452043
has comment: http://stackoverflow.com/comment/34148219
has answer: http://stackoverflow.com/a/22452043
has comment: http://stackoverflow.com/comment/34147998
has comment: http://stackoverflow.com/comment/34147977
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22452174
accepted answer: http://stackoverflow.com/a/22452174
has comment: http://stackoverflow.com/comment/34148225
has comment: http://stackoverflow.com/comment/34148115
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34147924

http://stackoverflow.com/comment/34197705
type: Comment
comment on: http://stackoverflow.com/q/22480387
type: QuestionComment
has text: The problem is that one Object's size is dynamic. I cannot tell if there is just one node or many nodes and that makes each object different sized :/
score: 0

http://stackoverflow.com/a/22389231
has comment: http://stackoverflow.com/comment/34038279
answers question: http://stackoverflow.com/q/22389185
has comment: http://stackoverflow.com/comment/34038075
has comment: http://stackoverflow.com/comment/34038647
has comment: http://stackoverflow.com/comment/34038479
has comment: http://stackoverflow.com/comment/34038440
has comment: http://stackoverflow.com/comment/34037922
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34038251
score: 0
has comment: http://stackoverflow.com/comment/34038117
has body: Use the Thread#join() method. See a tutorial here: http://www.tutorialspoint.com/java/lang/thread_join.htm
type: Answer
accepted answer of: http://stackoverflow.com/q/22389185

http://stackoverflow.com/a/22385389
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22385191
answers question: http://stackoverflow.com/q/22385191
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34031055
type: Answer
has body: 1 of three things will happen: You will have a resultset filled with data (successful run with data) You will have an empty resultset (no data, but successful run) An exception will be thrown, so the resultset will not get filled at all. (problem with connection or bad query) To get the data: while (resultSet2.next()) { String regno = rs.getString("reg"); // DO something with regno } The nice thing is that even if resultSet2 is empty, the while statement will resolve as false and not run. Check here for more info: Retrieving and Modifying Values from Result Sets

http://stackoverflow.com/comment/34145829
type: Comment
comment on: http://stackoverflow.com/a/22450408
has text: Sorry, don't quite understand. Do you mean to create a library project such as libPro, I will set the data path to libPro/resources. Then when I have a new project newPro to reference this libPro, Eclipse will automatically include and search newPro/resources for data?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34039900
score: 0
type: Comment
type: QuestionComment
has text: "double xx = nextInt()" double/int.. Do you need `nextDouble()`? For the imaginary part, you might want to use an `if` to check if `Square3` is negative
comment on: http://stackoverflow.com/q/22390347

http://stackoverflow.com/a/22395138
has comment: http://stackoverflow.com/comment/34048224
has comment: http://stackoverflow.com/comment/34048139
has comment: http://stackoverflow.com/comment/34074592
upvote count: 2
has comment: http://stackoverflow.com/comment/34048208
has comment: http://stackoverflow.com/comment/34048189
has comment: http://stackoverflow.com/comment/34076884
has comment: http://stackoverflow.com/comment/34048095
has comment: http://stackoverflow.com/comment/34076375
has comment: http://stackoverflow.com/comment/34048600
has comment: http://stackoverflow.com/comment/34048659
has comment: http://stackoverflow.com/comment/34076894
has comment: http://stackoverflow.com/comment/34048068
has comment: http://stackoverflow.com/comment/34074632
type: Answer
answers question: http://stackoverflow.com/q/22395119
has body: Looks like eclipse is configured to use JRE not JDK verify &amp; change windows &gt; preference &gt; java &gt; installed JRE &gt; choose JDK here Eclipse when started using java from JRE it doesn't still respect this setting, specifying JDK;s java for eclipse fixed it -vm /home/non-admin/jdk1.7.0_02/bin/java
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34076792

http://stackoverflow.com/comment/65150806
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22397861
has text: MYSTERY CONTINUES :-D
score: 0

http://stackoverflow.com/q/22390949
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/22391803
has title: How to read an xml file when all tag names are same using java
type: UnansweredQuestion
has body: <?xml version="1.0"?> <test name="test"> <property name="username" value="abc"/> <property name="password" value="cba"/> <property name="username" value="user1"/> <property name="password" value="pass1"/> I can have the param tag where one has items or where one is empty. anyway my question is how to i read the tags using java? (there maybe more param tags later with more items)one way is taking a nodelist of tag . then taking nodelist of tag for those param which has child nodes and using the getelementbyTag(). is there any other way where the second nodelist can be avoided? if yes then how??
tagged with: java
type: Question
score: 0
tagged with: xml-parsing

http://stackoverflow.com/comment/34201765
comment on: http://stackoverflow.com/q/22483024
score: 0
has text: @CsBalazsHungary He did, just not in the form of code :-)
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34048067
comment on: http://stackoverflow.com/q/22395082
type: QuestionComment
type: Comment
has text: @Paweth: In short; you can't *prevent* the user from entering a string, but you can use `Scanner.next()` or `Scanner.nextLine()` to *read* a string, then you can attempt to parse it as an integer (see [`Integer.parseInt()`](http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#parseInt(java.lang.String))). in a separate step and notify the user that they screwed up if it fails (by handling the exception).
score: 0

http://stackoverflow.com/q/22382107
has comment: http://stackoverflow.com/comment/34024849
score: 0
has comment: http://stackoverflow.com/comment/34030989
tagged with: gwt
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34026055
tagged with: java
linked to: http://stackoverflow.com/q/138099
linked to: http://stackoverflow.com/q/9534484
accepted answer: http://stackoverflow.com/a/22382626
has comment: http://stackoverflow.com/comment/34025203
has comment: http://stackoverflow.com/comment/34025438
type: Question
has title: SerializationException GWT
has comment: http://stackoverflow.com/comment/34025600
has comment: http://stackoverflow.com/comment/34026408
answer count: 1
has comment: http://stackoverflow.com/comment/34024799
has body: I get a SerializationException at my GWT app. I was already looking for it on stackoverflow, but I don't find my mistake. I checked my classes for all points mentioned in this thread - I just can't find my mistake. Any Ideas what is wrong? Here is the Tomcat-Error log: Mär 13, 2014 2:40:07 PM org.apache.catalina.core.ApplicationContext log SEVERE: Exception while dispatching incoming RPC call com.google.gwt.user.client.rpc.SerializationException: Type 'test.shared.params.SelectParameter' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = test.shared.params.SelectParameter@376b030f at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:667) at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:126) at com.google.gwt.user.client.rpc.core.java.util.Collection_CustomFieldSerializerBase.serialize(Collection_CustomFieldSerializerBase.java:44) at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serialize(ArrayList_CustomFieldSerializer.java:39) at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:51) at com.google.gwt.user.client.rpc.core.java.util.ArrayList_CustomFieldSerializer.serializeInstance(ArrayList_CustomFieldSerializer.java:28) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeImpl(ServerSerializationStreamWriter.java:788) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:669) at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:126) at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWri…
has comment: http://stackoverflow.com/comment/34028183
linked to: http://stackoverflow.com/q/5210696
has comment: http://stackoverflow.com/comment/34026848
has comment: http://stackoverflow.com/comment/34025725
has answer: http://stackoverflow.com/a/22382626

http://stackoverflow.com/comment/34011862
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22374053
has text: @IanLundberg If the loop runs 65 times, it runs 65 times. In that case, it's probable that something else is removing the extra 20 lines or otherwise failing to display them. You can replace the code in the loop with a `println` to feel good about 65 lines.
score: 0

http://stackoverflow.com/q/22480870
has answer: http://stackoverflow.com/a/22480933
has comment: http://stackoverflow.com/comment/34198471
tagged with: model-view-controller
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22481269
tagged with: java
has comment: http://stackoverflow.com/comment/34198335
has comment: http://stackoverflow.com/comment/34197843
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/34198383
score: 0
has comment: http://stackoverflow.com/comment/34198085
possible better answer: http://stackoverflow.com/a/22481269
has body: I want run my GUI with thread to avoid freezes issues , how to add thread to view ? or Do you have any general idea to avoid GUI freeze issues. public class Vark { public static void main(String[] args) { // Object Creation For the View VarkView theView = new VarkView(); // Object Creation For the Model VarkModel theModel = new VarkModel(); // Object Creation For the Controller passing theModel and theView VarkController theController = new VarkController(theView, theModel); theView.setVisible(true); } }
accepted answer: http://stackoverflow.com/a/22480933
has title: How to add thread MVC pattern theView to avoid JFrame Freezes
tagged with: multithreading
tagged with: swing

http://stackoverflow.com/a/52726915
answers question: http://stackoverflow.com/q/22377447
type: Answer
score: 1
upvote count: 1
has body: All the answers I found are 2-dimensional only, so here's my solution to reverse deepToString(...) for any number of dimensions: Usage example: String arrString = &quot;[[[0.11695497071135137, 0.8830064157596283, 0.3433854446148375, 0.18825445694298526, 1.0441938749175883, 0.8941633746325311], [-0.089908138214512, 0.39821330927870574, 0.1365997500579524, 0.7008902956765364, 0.9897596683277262, 0.2847717055995359], [0.6450670283688857, 0.01516064860567864, -0.07904927386204857, 0.2703900981351612, 0.45402985012492075, 0.30505608337251183], [0.5122943117220898, 0.008726346575469023, 0.7734611917871235, 0.3051772999891666, 0.5237487372571624, 1.1824105144656751]]]&quot;; String[][][] arr = (String[][][]) reverseDeepToString(arrString); System.out.println(Arrays.deepToString(arr)); This code converts a string (arrString) into an array, and then the function Arrays.deepToString(...) converts it back into the same string. Function code: public static Object reverseDeepToString(String str){ int dimensions = 0; for(int x = 0; x &lt; str.length(); x++) if(str.charAt(x) == '[') dimensions++; else break; str = str.substring(dimensions, str.length() - dimensions); return createArrayRecursive(str, dimensions); } private static Object createArrayRecursive(String str, int dimension){ if(dimension == 1) return str.split(&quot;, &quot;); // modify the code here if you want to convert the strings to another variable type String[] s = str.split(getArraySeparator(dimension)); int[] lengths = new int[dimension]; lengths[0] = s.length; Object arr = Array.newInstance(String.class, lengths); // and here (see comment above) for(int x = 0; x &lt; s.length; x++) Array.set(arr, x, createArrayRecursive(s[x], dimension - 1)); return arr; } private static String getArraySeparator(int dimension){ String separator = &quot;, &quot;; for(int x = 1; x &lt; dimension; x++) separator = ']' + separator + &quot;\\[&quot;; return separator; }
downvote count: 0

http://stackoverflow.com/comment/34046835
has text: Dear 3373311, have a look at my updated answer
type: Comment
comment on: http://stackoverflow.com/a/22394265
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34087865
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22417504
has text: Nope havnt covered stringBuffer. My teacher said it will be easier if we use a subprogram to work with points

http://stackoverflow.com/q/22348086
type: UnansweredQuestion
tagged with: gis
answer count: 0
tagged with: java
type: Question
tagged with: google-maps
tagged with: jsp
has comment: http://stackoverflow.com/comment/33967818
score: 0
has title: Google Map searching using java code
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33967638
favorite count: 0
has body: Requirement: 1. jsp page contains a field that having a search button. 2. When I click on search, it should send a Http request and Response page should be of Google Map 3. That Google Map should zoom into particular Location, whatever I have typed in Search field. Please tell me how to write, because I new to this. And please tell me some tutorials where I can learn Completely about Java Code which is related to Google Map.

jpa
tags question: http://stackoverflow.com/q/22388889
tags question: http://stackoverflow.com/q/22344111
tags question: http://stackoverflow.com/q/22470589
tags question: http://stackoverflow.com/q/22447447
tags question: http://stackoverflow.com/q/22392410
tags question: http://stackoverflow.com/q/22486446
tags question: http://stackoverflow.com/q/22406303
tags question: http://stackoverflow.com/q/22417836
tags question: http://stackoverflow.com/q/22376282
tags question: http://stackoverflow.com/q/22389953
tags question: http://stackoverflow.com/q/22481140
tags question: http://stackoverflow.com/q/22345081
tags question: http://stackoverflow.com/q/22428120
tags question: http://stackoverflow.com/q/22487250
tags question: http://stackoverflow.com/q/22417570
tags question: http://stackoverflow.com/q/22439963
tags question: http://stackoverflow.com/q/22381239
tags question: http://stackoverflow.com/q/22332908
tags question: http://stackoverflow.com/q/22426018
tags question: http://stackoverflow.com/q/22369344
tags question: http://stackoverflow.com/q/22382950
tags question: http://stackoverflow.com/q/22431153
tags question: http://stackoverflow.com/q/22381535
tags question: http://stackoverflow.com/q/22338741
tags question: http://stackoverflow.com/q/22353273
tags question: http://stackoverflow.com/q/22374849
tags question: http://stackoverflow.com/q/22397593
tags question: http://stackoverflow.com/q/22366600
tags question: http://stackoverflow.com/q/22330179
tags question: http://stackoverflow.com/q/22371053
tags question: http://stackoverflow.com/q/22389060
tags question: http://stackoverflow.com/q/22370271
type: Tag
tags question: http://stackoverflow.com/q/22448511
tags question: http://stackoverflow.com/q/22450690
tags question: http://stackoverflow.com/q/22409025
tags question: http://stackoverflow.com/q/22438028
tags question: http://stackoverflow.com/q/22360136
tags question: http://stackoverflow.com/q/22389638
tags question: http://stackoverflow.com/q/22352061
tags question: http://stackoverflow.com/q/22450659
tags question: http://stackoverflow.com/q/22377934
tags question: http://stackoverflow.com/q/22413795
tags question: http://stackoverflow.com/q/22384550
tags question: http://stackoverflow.com/q/22399215
tags question: http://stackoverflow.com/q/22424825
tags question: http://stackoverflow.com/q/22366409
tags question: http://stackoverflow.com/q/22474085
tags question: http://stackoverflow.com/q/22372454
tags question: http://stackoverflow.com/q/22341841
tags question: http://stackoverflow.com/q/22349306
tags question: http://stackoverflow.com/q/22402612
tags question: http://stackoverflow.com/q/22455989
tags question: http://stackoverflow.com/q/22463902
tag name: jpa
tags question: http://stackoverflow.com/q/22351146
tags question: http://stackoverflow.com/q/22465018
tags question: http://stackoverflow.com/q/22359861
tags question: http://stackoverflow.com/q/22362534
tags question: http://stackoverflow.com/q/22352205
tags question: http://stackoverflow.com/q/22465739
tags question: http://stackoverflow.com/q/22450566
tags question: http://stackoverflow.com/q/22378771
tags question: http://stackoverflow.com/q/22350495
tags question: http://stackoverflow.com/q/22348539
tags question: http://stackoverflow.com/q/22358912
tags question: http://stackoverflow.com/q/22422722
tags question: http://stackoverflow.com/q/22413378
tags question: http://stackoverflow.com/q/22458285
tags question: http://stackoverflow.com/q/22451599
tags question: http://stackoverflow.com/q/22459233
tags question: http://stackoverflow.com/q/22372469
tags question: http://stackoverflow.com/q/22386903
tags question: http://stackoverflow.com/q/22448716
tags question: http://stackoverflow.com/q/22344870
tags question: http://stackoverflow.com/q/22377052
tags question: http://stackoverflow.com/q/22374343
tags question: http://stackoverflow.com/q/22435979
tags question: http://stackoverflow.com/q/22412234

http://stackoverflow.com/comment/34000659
type: Comment
has text: It seems like all MotionEvents are terminated by the Up action. I wonder if there'll be a correct answer here or if it's better to make your game controls work in a slightly different way.
comment on: http://stackoverflow.com/q/22367070
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34043102
has text: Edited to double. Thx.
type: AnswerComment
comment on: http://stackoverflow.com/a/22391836
type: Comment
score: 0

http://stackoverflow.com/a/22465342
type: Answer
answers question: http://stackoverflow.com/q/22464993
has body: Personally i would use keyListeners, They work best for me. Try making a simple method to check witch key was pressed and then have it move the JLable to a position on the window eg public static void moveUp() { int x; int y; x = NewJFrame.playerJLabel.getX(); y = NewJFrame.playerJLbale.getY(); y = y + 10; NewJFrame.playerJLable.setLocation(x, y); }
score: 0

http://stackoverflow.com/comment/34145330
type: Comment
comment on: http://stackoverflow.com/q/22384689
type: QuestionComment
has text: Hi Mikhail, no I hadn't tried that, but have now and it was exactly what I was after. Works perfectly! Thank you so much for that, i've been hunting for that for ages.
score: 0

http://stackoverflow.com/a/22376649
score: 0
has body: Try using ListFragment or you can follow this guide from vogella
type: Answer
answers question: http://stackoverflow.com/q/22375780

http://stackoverflow.com/a/22457069
accepted answer of: http://stackoverflow.com/q/22456970
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22456970
has comment: http://stackoverflow.com/comment/34156826
has comment: http://stackoverflow.com/comment/34156987
upvote count: 3
has body: The design pattern is called Template method and it works exactly the way you don't like, I'm afraid. For example, Spring's code is full of such empty protected methods waiting for you to add something custom into them.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34156763
has comment: http://stackoverflow.com/comment/34156840
has comment: http://stackoverflow.com/comment/34156880
type: Answer

http://stackoverflow.com/a/22441032
accepted answer of: http://stackoverflow.com/q/22440993
has comment: http://stackoverflow.com/comment/34129008
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34129043
has comment: http://stackoverflow.com/comment/34129038
has comment: http://stackoverflow.com/comment/34129150
type: Answer
score: 2
upvote count: 3
answers question: http://stackoverflow.com/q/22440993
has comment: http://stackoverflow.com/comment/34129203
downvote count: 1
has comment: http://stackoverflow.com/comment/34129070
has body: In normal circumstances, there is just one Class object per class. Not per object. If Java created all that structure for every object, it would use enormous amounts of memory; far more than is actually needed. If you are creating multiple classloaders within your application, then you may end up with multiple Class objects per class - one held by each classloader. But very few of us ever do such a thing. You might do this if you were programming an application server, or something of that type.

http://stackoverflow.com/q/22411691
tagged with: jdbc
has answer: http://stackoverflow.com/a/22411774
score: 8
tagged with: netbeans
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/34076647
has comment: http://stackoverflow.com/comment/34076674
has body: I am trying to connect to SQL Server as follows from Netbeans. I have sqljdbc4.jar in my Libraries forlder of the project. try{ Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); connRemoteforGlobal = java.sql.DriverManager.getConnection("jdbc:sqlserver://xx.xx.x.xxx:1433/test",RemoteSQLServerUser,RemoteSQLServerPass); if(connRemoteforGlobal != null) { System.out.println("Connection Successful !"); } } catch(SQLException ex2){ ex2.printStackTrace(); System.out.println("Error Trace in Connection : " + ex2.getMessage()); } And getting the following error: Is there any additional settings required in netbeans or in my connection? Port number? Error Trace in Connection : The port number 1433/test is not valid. com.microsoft.sqlserver.jdbc.SQLServerException: The port number 1433/test is not valid. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:691) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:215) at mypackage.myclass.call(myclass.java:408) at mypackage.myclass.call(myclass.java:25) at javafx.concurrent.Task$TaskCallable.call(Task.java:1259) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744)
has title: Port number is not correct while connecting to sql server
downvote count: 0
answer count: 1
tagged with: driver
favorite count: 0
upvote count: 8
type: UnansweredQuestion

http://stackoverflow.com/a/22419340
upvote count: 2
type: Answer
score: 2
has body: One option is to let the user enter one input at a time, but continuously prompt them (using nextLine() to read) until, say, the word "end" is entered. Then you can copy a line-separated list and paste it into your console; typing "end" at the end. Alternatively, if you want the user to be able to just copy and paste a bunch into one line, you can use .split("[\\s]+") to allow any amount of whitespace between entries (includes newlines; although nextLine() will eat the newlines anyways). Another option is to store the list in a text file. Then you can prompt the user for the name of the file to import. You can then open the file and read it line by line.
downvote count: 0
answers question: http://stackoverflow.com/q/22419312
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22419312

http://stackoverflow.com/comment/34048643
type: QuestionComment
has text: [It seems like][1] you would need an external library to do it in Java. [1]: https://stackoverflow.com/questions/1670038/does-java-have-a-hashmap-with-reverse-lookup?rq=1
score: 1
comment on: http://stackoverflow.com/q/22395398
type: Comment

http://stackoverflow.com/comment/34272482
comment on: http://stackoverflow.com/a/22468984
type: Comment
has text: Did n't work.. still i am getting the same issue now response code has changed to 401.
score: 0
type: AnswerComment

comparable
tags question: http://stackoverflow.com/q/22427122
tag name: comparable
type: Tag
tags question: http://stackoverflow.com/q/22450027
tags question: http://stackoverflow.com/q/22338834

http://stackoverflow.com/q/22393858
has title: java simple animation with threads
favorite count: 0
tagged with: animation
accepted answer: http://stackoverflow.com/a/22393878
has comment: http://stackoverflow.com/comment/34046056
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: multithreading
has body: I'm looking to create a simple 2D animation using a thread. Once the thread is launched, i'm having trouble figuring out exactly what to put in the run method. Right now, the objects of the Particle class are painted on the frame but there's no animation. Also i could use your help with how to close the thread when the user closes the frame public class ParticleFieldWithThread extends JPanel implements Runnable{ private ArrayList&lt;Particle&gt; particle = new ArrayList&lt;Particle&gt;(); boolean runnable; public ParticleFieldWithThread (){ this.setPreferredSize(new Dimension(500,500)); for(int i = 0; i &lt; 100; i++) { particle.add(new Particle()); } Thread t1 = new Thread(); t1.start(); } public void run () { while (true ) { try { Thread.sleep(40); for (Particle p : particle) { p.move(); } repaint(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setColor(Color.RED); for (Particle p : particle) { g2.fill(new Rectangle2D.Double(p.getX(), p.getY(), 3, 3)); } } public static void main(String[] args) { final JFrame f = new JFrame("ParticleField"); final ParticleFieldWithThread bb = new ParticleFieldWithThread(); f.setLayout(new FlowLayout()); f.add(bb); f.pack(); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } Here's the particle class public class Particle { private double x , y ; Random r = new Random(); public Particle () { x = r.nextDouble()*500; y = r.nextDouble()*500; } public double getX() { return x; } public double getY() { return y; } public void move() { x += r.nextBoolean() ? 1 : - 1; y += r.nextBoolean() ? 1 : - 1; //System.out.println("x : " + x+" y: " + y); } }
has comment: http://stackoverflow.com/comment/34046205
has answer: http://stackoverflow.com/a/22393878
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34046246
tagged with: runnable
answer count: 1

http://stackoverflow.com/comment/34039004
type: QuestionComment
comment on: http://stackoverflow.com/q/22389509
has text: The NumberFormatException is kind of misleading when it comes to something like this. The number is formatted correctly it should be like BitwiseOverflowException or something lol
score: 0
type: Comment

http://stackoverflow.com/comment/34158020
comment on: http://stackoverflow.com/q/22457756
has text: Don't create several scanners, just create one associated with `System.in` and keep reading from it.
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/34177380
type: Comment
comment on: http://stackoverflow.com/a/22468016
score: 0
type: AnswerComment
has text: @DimaMaligin The "main" reason would be how you registered the key bindings. You used `getInputMap().put("Up", "move");` when you should have used something more like `getInputMap(WHEN_IN_FOCUSED_WINDOW).put("pressed UP, "move");` - this is why I use `KeyEvent.VK_....` instead...

http://stackoverflow.com/comment/34180253
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22470275
has text: @Ami in the buildpath
score: 0

http://stackoverflow.com/q/22330906
tagged with: java
type: Question
upvote count: 4
answer count: 2
score: 4
tagged with: stack-overflow
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/33936677
has answer: http://stackoverflow.com/a/22331074
downvote count: 0
has answer: http://stackoverflow.com/a/22331211
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33936418
has comment: http://stackoverflow.com/comment/33936905
has body: I am getting a stack overflow error due to a bug I understand, but what I do not understand is why the stack overflow is occurring on the first procedure in the recursive procedure instead of on the call to the recursive procedure. In a method to solve a sudoku puzzle here is the recursive segment (the bolded text is the recursive call: System.out.print(""); &lt= stack overflow occurs here int[] move_quality_sorted_keys = Sorting_jsc.RadixSort_unsigned_1( move_quality ); for( int xPossibleMove = 1; xPossibleMove &lt;= ctPossibleMoves; xPossibleMove++ ){ int xMove = move_quality_sorted_keys[ctPossibleMoves - xPossibleMove + 1]; int[][] new_grid = new int[10][10]; for( int xRow = 1; xRow &lt;= 9; xRow++ ) for( int xColumn = 1; xColumn &lt;= 9; xColumn++ ) new_grid[xRow][xColumn] = grid[xRow][xColumn]; new_grid[move_row[xMove]][move_column[xMove]] = move_value[xMove]; int[][] solution = solveSudokuGrid( new_grid ); if( solution != null ) return solution; } The stack overflow error is the following (note it is occurring on the System.out.print() statement): Exception in thread "main" java.lang.StackOverflowError at java.io.BufferedWriter.write(BufferedWriter.java:221) at java.io.Writer.write(Writer.java:157) at java.io.PrintStream.write(PrintStream.java:525) at java.io.PrintStream.print(PrintStream.java:669) at Euler100.solveSudokuGrid(Euler100.java:2458) at Euler100.solveSudokuGrid(Euler100.java:2467) at Euler100.solveSudokuGrid(Euler100.java:2467) at Euler100.solveSudokuGrid(Euler100.java:2467) at Euler100.solveSudokuGrid(Euler100.java:2467) at Euler100.solveSudokuGrid(Euler100.java:2467) at Euler100.solveSudokuGrid(Euler100.java:2467) at Euler100.solveSudokuGrid(Euler100.java:2467) at Euler100.solveSudokuGrid(Euler100.java:2467) at Euler100.solveSudokuGrid(Euler100.java:2467) I would expect the stack overflow to occur on the call to solveSudokuGrid, not on the print statement. Why is it?
tagged with: recursion
has title: Stack overflow occurring on first procedure call inside recursive procedure

http://stackoverflow.com/a/22407186
answers question: http://stackoverflow.com/q/22406893
score: 1
type: AcceptedAnswer
upvote count: 1
type: Answer
has body: The serialization by Jackson is running in circles. When serializing the Test Jackson also serializes Test_Case objects. But to serialize a Test_Case Jackson also tries to serialize the Test object. You can add a @JsonIgnore annotation to the member test in Test_Case to break this circle. The member device in the class Test also needs the @JsonIgnore annotation.
accepted answer of: http://stackoverflow.com/q/22406893
downvote count: 0

http://stackoverflow.com/q/22347026
tagged with: java
has title: how to create general method for all type of class(object)
has comment: http://stackoverflow.com/comment/33964795
has answer: http://stackoverflow.com/a/22347085
type: Question
tagged with: oop
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/33965000
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33964823
has body: I am using db4o lib for storing data. for example I have this code for storing data (i.e News) public static void insertNewsToDB(Context context, final News news){ final String dbPath = context.getDir("news", Context.MODE_PRIVATE) + "/" + DB4O_NAME; ObjectContainer db = Db4oEmbedded.openFile(Db4oEmbedded.newConfiguration(), dbPath); try { db.store(news); db.commit(); } finally { db.close(); } } and this getting data from db: public static List&lt;News&gt; getNewsListFromDB(Context context){ final List&lt;News&gt; news = new ArrayList&lt;News&gt;(); final String dbPath = context.getDir("news", Context.MODE_PRIVATE) + "/" + DB4O_NAME; ObjectContainer db = Db4oEmbedded.openFile(Db4oEmbedded.newConfiguration(), dbPath); try { ObjectSet&lt;News&gt; result = db.queryByExample(News.class); news.addAll(result); } finally { db.close(); } return news; } How could I create method so it's not depend on what type of class I have to pass. More clearly it doesn't depend on second parameter is News,User or something else. And same when I want get news from db. I need to create general method which is not depend on type of class. EDIT: I did this but I doesn't work. More clearly trying get list it returns nothing. And I don't get it why what I did wrong public static void insertToDB(Context context, final Object obj,final String _key) { final String dbPath = context.getDir(_key, Context.MODE_PRIVATE) + "/" + DB4O_NAME; ObjectContainer db = Db4oEmbedded.openFile(Db4oEmbedded.newConfiguration(), dbPath); try { db.store(obj); db.commit(); } finally { db.close(); } } public static &lt;T&gt; void insertToDB(Context context, final List&lt;T&gt; newsList,String _key) { for (T news : newsList) { insertToDB(context, news,_key); } } public static &lt;T&gt; List&lt;T&gt; getListFromDB(Context context, final java.lang.Class&lt;T&gt; tClass,final String _key) { final List&lt;T&gt; news = new ArrayList&lt;T&gt;(); final String dbPath = context.getDir(_key, Context.MODE_PRIVATE) + "/" + DB4O_NAME;…
has comment: http://stackoverflow.com/comment/33964737
has answer: http://stackoverflow.com/a/22347340
has answer: http://stackoverflow.com/a/22347118

http://stackoverflow.com/q/22388066
tagged with: android
has body: EDIT: Even stranger. Setting the pixel format to translucent rather than opaque seems to have fixed it, i at least am unable to see the "stacked" numbers. Very strange behavior. I am using a service to draw a system_overlay view. The view adds and displays just fine. This view is meant to be a countdown timer, so I need to update the text every second. I use a handler calling postDelayed to handle that, and call textView.setText("CONTENT") from the runnable being executed by the handler. This is where it gets weird. The text updates, but seems to be stacking. I see 00:00 under the 00:01, etc etc. Each tick causes another layer. I have tested this code and view in a standard activity and the text renders perfect, no "stacks". Its not until its being added via the WindowManager that the behavior is problematic. TimerView.java /* * Copyright (C) 2013 The Android Open Source Project * * 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 com.t3hh4xx0r.lifelock.widgets; import java.util.concurrent.TimeUnit; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.PointF; import android.os.Handler; import android.os.IBinder; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.WindowManager; import android.widget.FrameLay…
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java
tagged with: window-managers
type: Question
has comment: http://stackoverflow.com/comment/42373223
downvote count: 0
has title: WindowManager updating content causes view stacking
favorite count: 0
tagged with: service
has comment: http://stackoverflow.com/comment/42371853

http://stackoverflow.com/comment/34084290
type: Comment
type: QuestionComment
has text: Don't use `double` or `Double` unless you really need to do floating point arrhythmic... And it does not sound like you really are if our worried about the 0.150000005960464
comment on: http://stackoverflow.com/q/22415699
score: 0

http://stackoverflow.com/comment/33958522
type: Comment
type: QuestionComment
has text: Why you are not trying java HTTP client ? There are lot of example on internet.
comment on: http://stackoverflow.com/q/22343522
score: 0

http://stackoverflow.com/q/22452796
type: AnsweredQuestion
has body: I tried to login into my alfresco which is deployed at : localhost:80/alfresco This is what I've done so far : public static void main(String[] args) throws Exception { WebServiceFactory.setEndpointAddress("http://localhost:80/alfresco/api/"); // Start the session AuthenticationUtils.startSession(USERNAME, PASSWORD); try { //Work to do if the login works :S } finally { // End the session AuthenticationUtils.endSession(); } } This is what I get when I run the class : WARNING: Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled. Exception in thread "main" org.alfresco.webservice.util.WebServiceException: Error starting session. at org.alfresco.webservice.util.AuthenticationUtils.startSession(AuthenticationUtils.java:94) at com.delta.logic.connect.Query1.main(Query1.java:53) Caused by: (404)Introuvable at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744) at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at org.alfresco.webservice.authentication.AuthenticationServiceSoapBindingStub.startSession(AuthenticationServiceSoapBindingStub.java:187) at org.alfresco.webservice.util.AuthenticationUtils.startSession(AuthenticationUtils.java:79) ... 1 more I'm really stuck here, HELP !
has answer: http://stackoverflow.com/a/22682615
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22682615
has comment: http://stackoverflow.com/comment/34158604
tagged with: tomcat
score: 0
has title: Connect (login) to Alfresco with a simple Java class
tagged with: alfresco
has answer: http://stackoverflow.com/a/22453012
possible better answer: http://stackoverflow.com/a/22453012

http://stackoverflow.com/q/22460197
has comment: http://stackoverflow.com/comment/34162285
answer count: 1
has answer: http://stackoverflow.com/a/22460311
favorite count: 0
has title: Trouble constructing an object and putting it into ArrayList
upvote count: 2
accepted answer: http://stackoverflow.com/a/22460311
downvote count: 1
has body: I've created an ArrayList for objects of type ProductInfo, however NetBeans is telling me that on line 256 it can't find the symbol: method ProductInfo(int, int, String, String). Here is the code code: /** * Creates new form mVentoryHome */ public mVentoryHome() { initComponents(); } public class ProductInfo{ String name, des; int ID, num; } /** * */ public static void Inventory(){ } //creat Array ArrayList &lt;ProductInfo&gt; Inventory = new ArrayList &lt;ProductInfo&gt; (); /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { IDIn = new javax.swing.JTextField(); NameIn = new javax.swing.JTextField(); DesOut = new javax.swing.JLabel(); IDOut = new javax.swing.JLabel(); NameOut = new javax.swing.JLabel(); AddGo = new javax.swing.JButton(); NameGo = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); IDGo = new javax.swing.JButton(); Title = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); NameSearch = new javax.swing.JTextField(); IDSearch = new javax.swing.JTextField(); DesIn = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); NumIn = new javax.swing.JTextField(); NumOut = new javax.swing.JLabel(); Title1 = new javax.swing.JLabel(); Title2 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(0, 0, 0)); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setEnabled(false); AddGo.setText("Add"); AddGo.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { AddGoActionPerformed(evt); } }); NameGo.setText("Sear…
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/34091397
type: QuestionComment
comment on: http://stackoverflow.com/q/22419511
score: 0
type: Comment
has text: @PSR i posted an answer to illustrate my idea..

http://stackoverflow.com/a/22465959
has body: It seems like you still have a problem with the proxy. and also you can have problem with the certificate check whether you're configuring the proxy properly Check whether your certificate is expired. if expired, request a new one Check with fiddler whether you're sending the certificate to server
upvote count: 2
answers question: http://stackoverflow.com/q/22387641
type: Answer
downvote count: 0
score: 2

http://stackoverflow.com/comment/34166053
type: AnswerComment
has text: Well, give it a try and see how well it works for you. It will certainly calculate quickly.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22447924

http://stackoverflow.com/comment/42971831
has text: Look http://stackoverflow.com/questions/27247604/java-se-sanning-api-morena7
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22399931

http://stackoverflow.com/comment/34171152
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22464915
has text: You should not `e.printStackTrace()` an `InterruptionException`. At the very least you should `Thread.currentThread().interrupt()`. Also, for readability, you could use `TimeUnit.SECONDS.sleep(5L);`.
type: QuestionComment

http://stackoverflow.com/comment/34098485
has text: Please post the stacktrace, instead of the irrelevant code. Please post the code which causes the error
comment on: http://stackoverflow.com/q/22424107
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/33974766
type: QuestionComment
has text: if the main thread exits first, then the process is destroyed along with all the threads. That is not happening in your example. If you want to see it happening that way, just remove the line t.join()
score: 1
comment on: http://stackoverflow.com/q/22351467
type: Comment

http://stackoverflow.com/q/22466409
has title: MongoDB giving NullPointerException
tagged with: database
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22466494
has comment: http://stackoverflow.com/comment/34173781
has comment: http://stackoverflow.com/comment/34175738
tagged with: nullpointerexception
tagged with: android
has body: I have a problem in my code. I have a collection of objects in Mongo, all of which have a "name", "description", "imageURL", "code". I want to do a search of my collection and return ArrayList of all the names, descriptions,codes and imageURLs I tried it like this else{ DBCursor cursair = this.searchItem(code); while(cursair.hasNext()){ this.searchNames = new ArrayList&lt;String&gt;(); this.searchBarcodes = new ArrayList&lt;String&gt;(); this.searchDescriptions = new ArrayList&lt;String&gt;(); this.searchImageURLs = new ArrayList&lt;String&gt;(); this.searchNames.add(cursair.curr().get(ITEMS_NAME).toString()); this.searchDescriptions.add(cursair.curr().get(ITEMS_DESCRIPTION).toString()); this.searchImageURLs.add(cursair.curr().get(ITEMS_IMAGEURL).toString()); this.searchBarcodes.add(cursair.next().get(ITEMS_CODE).toString()); } I have a problem with it as it gives me a NullPointerException atthis.searchNames.add(cursair.curr().get(ITEMS_NAME).toString());. ITEMS_NAME is a String constant defined in the code. the searchItem(code) method looks like this public DBCursor searchItem(String searchQuery){ BasicDBObject query = new BasicDBObject(); query.put(ITEMS_NAME, java.util.regex.Pattern.compile(searchQuery)); DBCursor cursor = itemsCollection.find(query); return cursor; } I also checked in my debugger, when I call cursor.toArray() it returns a List&lt;DBObject&gt; with a size of 5, so I am pretty confident about cursor having the right information in itself
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22466494
type: Question
tagged with: mongodb

httpsurlconnection
type: Tag
tag name: httpsurlconnection
tags question: http://stackoverflow.com/q/22358863

http://stackoverflow.com/q/22367759
downvote count: 1
tagged with: sessionfactory
type: Question
has answer: http://stackoverflow.com/a/22601239
type: AnsweredQuestion
upvote count: 5
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/22601132
linked to: http://stackoverflow.com/q/23646389
answer count: 3
has body: Previously I was using the following code to configure the sessionFactory, but after upgrading the version of my hibernate from 4.2.1.Final to 4.3.4.Final, I can not retrieve sessionFactory using the following code as ServiceRegistryBuilder() is deprecated. I used this link to create it but the provided function is not returning any thing therefore it runs into pre-compile error. private static SessionFactory configureSessionFactory() { try { Configuration configuration = new Configuration(); configuration.configure(); serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry(); sessionFactory = configuration.buildSessionFactory(serviceRegistry); return sessionFactory; } catch (HibernateException e) { System.out.append("** Exception in SessionFactory **"); e.printStackTrace(); } return sessionFactory; } static { try { sessionFactory = configureSessionFactory(); } catch (Exception e) { System.err.println("%%%% Error Creating SessionFactory %%%%"); e.printStackTrace(); } } private HibernateUtil() { } public static SessionFactory getSessionFactory() { return sessionFactory; } public static Session getSession() throws HibernateException { Session session = threadLocal.get(); if (session == null || !session.isOpen()) { if (sessionFactory == null) { rebuildSessionFactory(); } session = (sessionFactory != null) ? sessionFactory.openSession() : null; threadLocal.set(session); } return session; } public static void rebuildSessionFactory() { try { sessionFactory = configureSessionFactory(); } catch (Exception e) { System.err.println("%%%% Error Creating SessionFactory %%%%"); e.printStackTrace(); } } public static void closeSession() throws HibernateException { Session session = (Session) threadLocal.get(); threadLocal.set(null); if (session != null) { if (session.isOpen()) { session.close(); } } }
linked to: http://stackoverflow.com/q/7986750
score: 4
favorite count: 0
has title: How to retrieve sessionFactory from Hibernate 4.3.4.Final?
has comment: http://stackoverflow.com/comment/34055290
has answer: http://stackoverflow.com/a/28779710
has answer: http://stackoverflow.com/a/22601132
possible better answer: http://stackoverflow.com/a/28779710

http://stackoverflow.com/comment/34079369
type: Comment
comment on: http://stackoverflow.com/a/22409365
score: 0
type: AnswerComment
has text: Yes, I have this inherit, but when I execute: DefaultDateTimeFormatInfo formatFR = new DateTimeFormatInfoImpl_fr(); dateFormat = DateTimeFormat.getFormat(formatFR.dateFormatLong()); dateFormat.format(new Date()) - the NEw date is on English again :(

http://stackoverflow.com/comment/34174745
score: 0
type: QuestionComment
has text: You're trying to simulate url rewriting without using rewriting. The problem is rewriting maps different path parts to variables, and your approach doesn't. So say `/es/whatever/` vs `/en/whatever/` with rewriting, you would map the first folder bit to be a language parameter. With your approach, you're going to have to parse the url yourself, if you can get it to work at all.
type: Comment
comment on: http://stackoverflow.com/q/22464404

http://stackoverflow.com/q/22381970
answer count: 1
has comment: http://stackoverflow.com/comment/34024895
score: 0
has answer: http://stackoverflow.com/a/22382369
has comment: http://stackoverflow.com/comment/34024743
has body: I've connected my really basic Java application to the Wamp server on my computer using the following code try { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection( "jdbc:mysql://localhost:3306/project", "root", "password"); Obviously, this program runs on my computer, but no one else's, and I need to submit this as a project. Is there anyway I can modify this part so that my partner and teacher can run the code from their computers, without having to download any special software, and access the database on my localhost? Possibly like replacing //localhost:3306 with //my IP address:8080? All suggestions I've gotten involve networking, which I don't know anything about so I don't want to try and then mess up my computer unless I'm really sure Things I've already looked in to, but aren't sure about: C:/wamp/alias/phpmyadmin.conf and entering the line ALLOW (other person's IP) team viewer (requires the other computer to use software other than my program) opening my router port to take incoming requests Anything'll help guys, even just confirming it can't be done without some networking. If it's something an inexperienced person can do, I'll take it.
type: UnansweredQuestion
tagged with: remote-access
has comment: http://stackoverflow.com/comment/34024599
linked to: http://stackoverflow.com/q/12885836
tagged with: localhost
has comment: http://stackoverflow.com/comment/34030055
has comment: http://stackoverflow.com/comment/34030882
tagged with: java
has title: Running a Java program that connects to a localhost database on a different computer
has comment: http://stackoverflow.com/comment/34025513
tagged with: mysql
type: Question

http://stackoverflow.com/a/22386703
score: 4
answers question: http://stackoverflow.com/q/22386666
type: AcceptedAnswer
has body: You just forgot the star to import all classes in the package java.util.concurrent. import java.util.concurrent.*; Otherwise it thinks concurrent is a class to be imported from java.util, and of course it does not exist.
has comment: http://stackoverflow.com/comment/139738946
type: Answer
has comment: http://stackoverflow.com/comment/139733856
accepted answer of: http://stackoverflow.com/q/22386666
has comment: http://stackoverflow.com/comment/139776342
has comment: http://stackoverflow.com/comment/139782052
upvote count: 4
has comment: http://stackoverflow.com/comment/34033178
downvote count: 0

http://stackoverflow.com/q/22442056
has title: Best way to access an object stored in an ArrayList?
has answer: http://stackoverflow.com/a/22442144
has comment: http://stackoverflow.com/comment/34131449
tagged with: list
has answer: http://stackoverflow.com/a/22443315
tagged with: java
score: 0
upvote count: 1
downvote count: 1
possible better answer: http://stackoverflow.com/a/22443315
accepted answer: http://stackoverflow.com/a/22442144
has answer: http://stackoverflow.com/a/22442104
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22442442
favorite count: 0
has body: I have a Student class that contains an ArrayList of type Course, and Course is class with some fields like className, classTime, etc along with the appropriate getters and setters. Say I created an ArrayList of Course and have stored it into the Student class. How can I for example print the className of a particular Course object (which is stored in an ArrayList stored in the Student class)? So far I tried this, below is part of the code for class Student: class Student { ArrayList&lt;Course&gt; studentSchedule; public ArrayList&lt;Course&gt; getStudentSchedule() { return studentSchedule; } public void setStudentSchedule(ArrayList&lt;Course&gt; studentSchedule) { this.studentSchedule = studentSchedule; } } Then I have some code that created student1 of type Student and stored an ArrayList of Course into it. Say I want to access the className in the first object in the ArrayList that's in student1. So far I have this and it works... is it fine? ArrayList&lt;Course&gt; schedule = student1.getStudentSchedule(); System.out.print("\n course name at position 0 is " + student1.getStudentScheduleClassName(0)); It feels weird to create another Arraylist just for this purpose... but then I thought since in line 1, schedule will only contain the addresses that point to the location and shouldn't take much space? Is there a more appropriate way to do this?
type: Question

http://stackoverflow.com/comment/34152902
type: QuestionComment
has text: - Are cookies allowed on your pages? - Do you have multiple servers where this application is deployed?
score: 0
comment on: http://stackoverflow.com/q/22452767
type: Comment

http://stackoverflow.com/q/22467645
tagged with: casting
accepted answer: http://stackoverflow.com/a/22468599
has comment: http://stackoverflow.com/comment/34176038
downvote count: 0
possible better answer: http://stackoverflow.com/a/22467690
has title: Avoid unchecked assignment in a map with multiple value types?
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/22467690
has body: I'm having trouble with a warning in Java 7: Unchecked assignment: 'java.lang.Class' to 'java.lang.Class&lt;T&gt;' I'm getting it on the line Class&lt;T&gt; type = typeMap.get(key); in the get function below. Basically what I'm trying to do here is I want to store a bunch of key/value pairs of unknown types (but all are descendants of Object with the exception of null), but not lose the type. So I created a class with the following content using generics. It has two maps (one to store the data and one to store the class type: private Map&lt;String, Object&gt; dataMap = new HashMap&lt;&gt;(); private Map&lt;String, Class&gt; typeMap = new HashMap&lt;&gt;(); public &lt;T&gt; void put(String key, T instance){ dataMap.put(key, instance); if (instance == null){ typeMap.put(key,null); } else { typeMap.put(key, instance.getClass()); } } public &lt;T&gt; T get(String key){ Class&lt;T&gt; type = typeMap.get(key); if (type == null){ return null; } return type.cast(dataMap.get(key)); } It runs just fine, but the warning is annoying me. Is there any way to get Java to do this cast without complaining (other than suppressing it)? Or is there a better way to accomplish what I'm trying to do? How about in Java 8 as I haven't really had a chance to dive into it yet? Thanks!
has comment: http://stackoverflow.com/comment/34176040
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34176031
tagged with: java
score: 33
type: Question
has answer: http://stackoverflow.com/a/22468599
answer count: 2
upvote count: 33

http://stackoverflow.com/a/22342561
answers question: http://stackoverflow.com/q/22342524
has body: The rule of BODMAS/VBODMAS is what you've to remember here. Let's split it up and see how it goes. Expression: 5 / 3 * 2.0 / (4 % 3) + 5 Step 1: 5 /3 gives 1 - Integer division Step 2: 1 * 2.0 gives 2.0 - Multiplication Step 3: 4 % 3 gives 1 - Modulus Step 4: 2.0 / 1 gives 2.0 - Division Step 5: 2.0 + 5 gives 7.0 - Addition
upvote count: 5
downvote count: 0
score: 5
type: Answer

http://stackoverflow.com/comment/33979595
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22338180
has text: I tried again, leaving `javaEbean` in place, and adding the same two lines I added in my above comment, ran `play idea`, the `play` then `run`, and now it seems to be up and running. I'll accept your answer, but please update it to the two lines I sited, as the old `ebean` lib isn't used anymore, it's the newer `avaje-ebeanorm`. Thanks for the help!

http://stackoverflow.com/comment/34106705
type: Comment
has text: Have you looked at [javax.enterprise.concurrent](http://docs.oracle.com/javaee/7/api/javax/enterprise/concurrent/package-summary.html)? More details about the context of your problem might help (e.g., are you just using Weld on its own? or are you using a full Java EE environment? or is it like Tomcat + libraries?).
comment on: http://stackoverflow.com/a/22428490
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33986763
score: 0
comment on: http://stackoverflow.com/q/22357491
has text: Some tips: The size of your array (Rooms) can be stored as a constant and used in all loops etc.Should there be 5 or 6 rooms? You could create your room objects in the initalize function. Variablenames should start with a small letter. In your view function you are passing a string instead of a Room object.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/37232764
type: Comment
comment on: http://stackoverflow.com/a/22415260
score: 0
type: AnswerComment
has text: Yes. And it means that that parent project will publish this as its dependency to other projects that may consume it (the parent project).

http://stackoverflow.com/comment/34410258
score: 0
type: Comment
type: QuestionComment
has text: Yes, if I use capturing groups, the regex will be "(\\d+)K->(\\d+)K((\\d+)K)" and I get "154545" at '1', "12345" at '2' and "524288" at '3'. **But I need to keep the regex same, i.e "\\d+" only**. Is there any alternative?
comment on: http://stackoverflow.com/q/22471153

http://stackoverflow.com/comment/96274197
has text: @CoolMind Its just an application class which extends `MultiDexApplication` . It is necessary if you want to use multidex
type: Comment
comment on: http://stackoverflow.com/a/41479407
score: 0
type: AnswerComment

http://stackoverflow.com/a/22353977
type: Answer
answers question: http://stackoverflow.com/q/22350106
has comment: http://stackoverflow.com/comment/34290358
upvote count: 1
has comment: http://stackoverflow.com/comment/34323173
downvote count: 0
score: 1
has body: I am going to explain a few things: You do not need to hard - code the Connect URL into your code. This is why you are asking for ways of creating the database as localhost. I suggest you do not hard code the Connect URL in the code. Instead write it in an editable File either a Properties file or even a text file. Let the Application read the Editable file and pass the Parameters to the Code. An Application running in your Local Machine where the database is will connect using Localhost. But a the same Application running remotely from another Machine whether in the Internet or Local access network will not Connect this way.That is why I am insisting on NOT Hard-Coding the Connect String. The database Name, user, and Password Including the Host will change from time to Time depending on which environment the Application is running in. So again if the environment changes and the variables are not the same the Application will Not Connect to the database. Suggestion: User a Properties file: db.host=192.168.1.23 db.user=root db.password=root db.dbname=database Load the file as a Properties file: Properties prop = new Properties(); InputStream input = null; try { input = new FileInputStream("config.properties"); // load a properties file prop.load(input); // get the property value and print it out System.out.println(prop.getProperty("db.host")); System.out.println(prop.getProperty("db.user")); System.out.println(prop.getProperty("db.password")); System.out.println(prop.getProperty("db.dbname")); //PASS YOUR CONNECT STRING Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://" + prop.getProperty("db.host") + "/" + prop.getProperty("db.dbname"), prop.getProperty("db.user"), prop.getProperty("db.password")); } catch (IOException ex) { ex.printStackTrace(); } finally { if (input != null) { try { input.close(); } catch (IOException e) { e.printStackTrace(); } } } This way you will never have to worry about what database the app…

http://stackoverflow.com/comment/33962286
type: QuestionComment
has text: Do you want to modify the structure of that layout? If yes then using a single fragment which loads a xml layout based on some condition isn't the best approach. You should have a fragment for each tab that you can then modify as you want more easily.
comment on: http://stackoverflow.com/q/22345223
score: 0
type: Comment

http://stackoverflow.com/a/22387278
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22386754
type: Answer
has comment: http://stackoverflow.com/comment/34034964
has body: This sounds like a homework assignment, and so I'm going to avoid giving you the algorithm you need. Here are some tips about getting a file and going through it line by line: File filename = new File("file.txt"); Scanner file = new Scanner(filename); ArrayList&lt;String&gt; lines = new ArrayList&lt;String&gt;(); while(file.hasNextLine()){ String line = file.nextLine(); //You can manipulate the line in here and do whatever you want //This can also store the data into an ArrayList for later if you need myReverse(line); lines.add(line); } Here is a starting point for a reverse method. There are dozens of ways to accomplish this task: public void myReverse(){ //convert the string into an array //move through the array backwards printing the values }
answers question: http://stackoverflow.com/q/22386754
has comment: http://stackoverflow.com/comment/34034849
score: 0

http://stackoverflow.com/q/22427722
has answer: http://stackoverflow.com/a/22427824
has title: Syntax error on token "(", delete this token
type: UnansweredQuestion
tagged with: java
downvote count: 2
type: Question
score: -2
has body: I'm working on an app for my last year of A-Levels and I'm trying to make a colour averager. I can make the app take the picture and display it in an imageView but I can't seem to get the pixels from the image. I've tried using "imageViewName".getPixels or anything else .getPixels but the brackets after getPixels have the error "Syntax error on token "(", delete this token" and the same for the end bracket. The error occurs here: photoViewForCrop.getPixels(pixels[], x, y, imageWidth, imageHeight); Which is quite close to the end of the code. Here's my activity that takes the photo and saves it to the SD card, please ignore that it's called 'UploadPhotoActivity', not sure what I was thinking. Imports or ints that aren't used in the code were added by my teacher when he was messing with it and not helping at all. package com.colours.javerager; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import android.app.ActionBar; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; public class UploadPhotoActivity extends Activity { //Activity request codes private static final int CAMERA_CAPTURE_IMAGE_REQUEST_CODE = 100; public static final int MEDIA_TYPE_IMAGE = 1; //directory for file names private static final String IMAGE_DIRECTORY_NAME = "JAverager"; private Uri fileUri; //file url to store private ImageView photoViewForCrop; private Button takePhotoButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_upload_photo); // Show the …
tagged with: eclipse
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/34104738
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/34104672
has answer: http://stackoverflow.com/a/22427987

http://stackoverflow.com/comment/34209344
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22486997
score: 1
has text: Fixed delay vs fixed rate.

http://stackoverflow.com/q/22387677
tagged with: android
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22387754
upvote count: 1
type: Question
has body: I am trying to get this tutorial work:http://www.tutorialspoint.com/android/android_google_maps.htm This is the code: public class ViewMapActivity extends FragmentActivity { static final LatLng TutorialsPoint = new LatLng(21 , 57); private GoogleMap googleMap; @Override protected void onCreate(Bundle savedInstanceState) { //super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_map); try { if (googleMap == null) { googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); } googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); Marker TP = googleMap.addMarker(new MarkerOptions().position(TutorialsPoint).title("TutorialsPoint")); } catch (Exception e) { e.printStackTrace(); } } } The layout: <fragment android:id="@+id/map" android:name="com.google.android.gms.maps.MapFragment" android:layout_width="match_parent" android:layout_height="match_parent"/> And the manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.androidpoiservice" android:versionCode="1" android:versionName="1.0" > <uses-permission android:name="com.example.googlemaps.permission.MAPS_RECEIVE" /> <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16" /> <permission android:name="com.example.googlemaps.permission.MAPS_RECEIVE" android:protectionLevel="signature" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyAgjXQt9zYFw5m0t7BIhxGT6e82mnZQUEA" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses…
tagged with: google-maps
has title: Error inflating class fragment google maps
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22387754
favorite count: 0

http://stackoverflow.com/comment/34144360
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22449313
has text: How my game works, is I have a non-EDT thread to do calculations, update game objects, get user input from the keyboard, etc (most of these methods are inside my custom JPanel class). And from inside that thread, repaint() is called every update step, activating paintComponent() which is also inside the custom JPanel. Would you consider this safe?
type: AnswerComment

http://stackoverflow.com/q/22407318
accepted answer: http://stackoverflow.com/a/22407689
has title: java: C-like option parameters
linked to: http://stackoverflow.com/q/16595847
answer count: 3
has comment: http://stackoverflow.com/comment/34068484
linked to: http://stackoverflow.com/q/13881281
downvote count: 0
favorite count: 0
has body: I'm making this utility class and I want to make it able to pass additional options to my methods: import java.util.Random; public class DataGen { public static final int OPTION1 = 1; public static final int OPTION2 = 2; public static final int OPTION3 = 4; private static Random gen = new Random(); public static String generateString(int n, int options) // &lt;------- { if (options == OPTION1) { //... } else if (options == (OPTION1 | OPTION3)) { //... } //... return null; } } I want to invoke methods this way: public static void main(String[] args) { String k = DataGen.generateString(5, OPTION1 | OPTION2); } But this is the only way the compiler assents: public static void main(String[] args) { String k = DataGen.generateString(5, DataGen.OPTION1 | DataGen.OPTION2); } Is it possible to do this? Other than declaring constants in the main class of course.
has comment: http://stackoverflow.com/comment/34068503
possible better answer: http://stackoverflow.com/a/22407391
upvote count: 2
has answer: http://stackoverflow.com/a/22407391
has comment: http://stackoverflow.com/comment/34068510
has comment: http://stackoverflow.com/comment/34068512
tagged with: constants
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22407689
tagged with: java
tagged with: optional-parameters
has answer: http://stackoverflow.com/a/22407410
type: Question

http://stackoverflow.com/comment/34059666
score: 0
type: QuestionComment
type: Comment
has text: [Refer this link] http://stackoverflow.com/questions/9713432/drawing-simple-rectangles-on-a-jframe-in-java
comment on: http://stackoverflow.com/q/22402131

http://stackoverflow.com/a/22367873
has comment: http://stackoverflow.com/comment/34001532
has comment: http://stackoverflow.com/comment/34001592
score: 2
has comment: http://stackoverflow.com/comment/34001337
has comment: http://stackoverflow.com/comment/34001349
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34001577
has comment: http://stackoverflow.com/comment/34001659
answers question: http://stackoverflow.com/q/22367816
has comment: http://stackoverflow.com/comment/34001703
has body: Simply use a do-while loop: Scanner keyboard = new Scanner(System.in); boolean redo = false; do { System.out.println("Enter a number: "); redo = false; try { int number = keyboard.nextInt(); aryList.add(number); while(keyboard.hasNextInt()) { System.out.println("Enter a number: "); number = keyboard.nextInt(); aryList.add(number); } } catch(InputMismatchException ime) { redo = true; System.out.println("Invalid number submitted! Try again."); } } while(redo); System.out.println(aryList); Since initializing the Scanner keyboard each time is useless, it is put before the loop.
type: Answer
accepted answer of: http://stackoverflow.com/q/22367816
has comment: http://stackoverflow.com/comment/34001609
has comment: http://stackoverflow.com/comment/34001566
upvote count: 2
has comment: http://stackoverflow.com/comment/34001320

http://stackoverflow.com/comment/34129640
type: QuestionComment
has text: Explain what your expectations are and what actually happens. A small reproducible example would be best.
comment on: http://stackoverflow.com/q/22441225
score: 0
type: Comment

http://stackoverflow.com/a/24044643
answers question: http://stackoverflow.com/q/22366217
score: 7
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/56822334
has body: In terms of this being an indexing issue with the Nexus, this worked for me: MediaScannerConnection.scanFile(this, new String[] { file.toString() }, null, new MediaScannerConnection.OnScanCompletedListener() { public void onScanCompleted(String path, Uri uri) { Log.i("ExternalStorage", "Scanned " + path + ":"); Log.i("ExternalStorage", "-&gt; uri=" + uri); } }); You should call it straight after creating and saving the file. By using the scanner, I was able to see newly created files and directories simply by replugging the device in. According to the docs: MediaScannerConnection provides a way for applications to pass a newly created or downloaded media file to the media scanner service. The media scanner service will read metadata from the file and add the file to the media content provider. Hope this helps someone else.
type: Answer
accepted answer of: http://stackoverflow.com/q/22366217
upvote count: 7

http://stackoverflow.com/comment/34043787
type: QuestionComment
has text: @Louis I was under the impression that this question was specific to Javascript instead. Sorry if that was wrong, feel free to revert if you think it is appropriate.
comment on: http://stackoverflow.com/q/22392368
score: 0
type: Comment

http://stackoverflow.com/comment/34061825
score: 2
has text: To clarify, `final` guarantees a field is fully initialized before the constructor finishes. The compiler can re-order the operations inside of the constructor and they can take place after the object reference is created and the constructor finishes
type: AnswerComment
comment on: http://stackoverflow.com/a/22402489
type: Comment

import
type: Tag
tags question: http://stackoverflow.com/q/22430450
tag name: import
tags question: http://stackoverflow.com/q/22470673
tags question: http://stackoverflow.com/q/22387041
tags question: http://stackoverflow.com/q/22439719
tags question: http://stackoverflow.com/q/22344334
tags question: http://stackoverflow.com/q/22329765
tags question: http://stackoverflow.com/q/22422108
tags question: http://stackoverflow.com/q/22346246
tags question: http://stackoverflow.com/q/22425310

http://stackoverflow.com/q/22420333
has title: Apache Camel - how to use InputStream as source?
answer count: 1
accepted answer: http://stackoverflow.com/a/22420952
score: 1
favorite count: 0
has body: What I'm trying to do seems simple enough, or at least a common task. The fact that I'm unable to find any examples, however, tells me I'm going about this the wrong way. I have an InputStream I need to use as a source. The InputStream provides lines of text that I need to route to one or more destination endpoints. The source of the InputStream is a bit of a black box - it's not from a file or a URL. I have the most basic of stream examples working...using System.in and System.out: public class InOutRoute extends RouteBuilder { @Override public void configure() throws Exception { from("stream:in") .to("stream:out"); } } All I'm trying to do right now is replace stream:in with the InputStream I've been given. I thought this would be a common operation but clearly I'm thinking about this the wrong way. (Edit) More information about the stream: This "black box" I have to work with performs actions and then provides status updates about those actions via an InputStream. When the black box has completed its actions I discard the reference to the InputStream. One potential complication: I will likely have to handle multiple InputStreams at the same time.
upvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: apache-camel
has answer: http://stackoverflow.com/a/22420952
type: Question
downvote count: 0

http://stackoverflow.com/comment/34150772
score: 1
comment on: http://stackoverflow.com/q/22453682
has text: it looks like you are creating json, use gson or jackson
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/34092021
type: Comment
comment on: http://stackoverflow.com/a/22407359
score: 0
has text: no sir, not working still i get the blank output,, is it translation+= "|" + values.toString() + "|"; or translation+= "|" + iter.toString() + "|";
type: AnswerComment

http://stackoverflow.com/a/61829820
score: 0
upvote count: 1
downvote count: 1
has body: An Enum is represented by an instance of EEnum. An interface is represented by an instance of EClass that has the value of Interface set to true. The interfaces to an EClass are then available at getEAllSuperTypes(). Note that EEnum and EClass are distinct subinterfaces of EModelElement and therefore do not share any members beyond those exposed in EModelElement. This is because java is special in its treatment of Enums, implementing them as special classes. EMF is intended to allow for the more "common" understanding of Enums where they can not expose interfaces. As such it's not possible in EMF to have Enums implement an interface. Your only option when adding an interface to an Enum is to do so manually, sidestepping all code generation, because EMF doesn't support that particular behaviour. An alternative you might want to consider is to have one or more static utility methods that provide that interface by way of "currying" transforming this: interface Foo { void bar(); Baz baz(Quux quux); } enum Gen implements Foo { ... } into: class GenFoo { static void bar(Foo foo); static Baz baz(Foo foo, Quux quux); } This idea is basically what C# has implemented as "Extension methods", but they have language support for that and Java doesn't :)
type: Answer
answers question: http://stackoverflow.com/q/22479848

http://stackoverflow.com/a/72052717
answers question: http://stackoverflow.com/q/22346275
score: 0
has body: The answers so far all use the deprecated method - ExpectedException.none(). This should now be done with assertThrows, which returns the actual exception, which can then be tested in the usual ways. This gives a lot more expressive power to the test case writer as the exception is not required to be the end of the test case. @Test public void testWithIOException() { // ... IOException exception = assertThrows(IOException.class, () -> someServiceThatThrowsException.foo()); assertTrue(exception.getMessage().contains("my error message")); } many thanks to: https://jsparrow.github.io/rules/replace-j-unit-expected-exception.html#code-changes
type: Answer

http://stackoverflow.com/comment/33959546
type: Comment
has text: No, as per accepted answer of http://stackoverflow.com/questions/3456177/calling-super-super-class-method
comment on: http://stackoverflow.com/q/22343982
score: 0
type: QuestionComment

http://stackoverflow.com/comment/34125670
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22439322
has text: The JDK has nothing like that; you should use Joda Time and its `Interval`.

http://stackoverflow.com/comment/34047619
comment on: http://stackoverflow.com/a/22394788
score: 0
type: Comment
has text: Thanks a ton! That makes sense. I read the Initial Threads thing and I am not really understanding that.. Would you mind putting it in to context for me? Also what type of component should I use to display the saved input in the right side of the frame?
type: AnswerComment

http://stackoverflow.com/a/22431449
has comment: http://stackoverflow.com/comment/34218810
has body: If you have prepared a java class in the exact structure like the json, do: @RequestMapping(...) public mycontrollerfunc(@RequestBody YourJsonClass body){} If not, and you want the json as a string, do: @RequestMapping(...) public mycontrollerfunc(@RequestBody String body){} EDIT If you need to extract the request body (which is what you refer to as "Json Parameter") from a method who can't use @RequestBody and only has access to HttpServletRequest, you can do the following: String jsonFromRequestBody = CharStreams.toString(request.getReader()); In this case, request has to be HttpServletRequest, so you might need to cast it if you're in a Filter, something like: HttpServletRequest request = (HttpServletRequest) req;
has comment: http://stackoverflow.com/comment/34518836
type: Answer
has comment: http://stackoverflow.com/comment/34557133
answers question: http://stackoverflow.com/q/22429134
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34219781
downvote count: 0
has comment: http://stackoverflow.com/comment/34580640

http://stackoverflow.com/a/22476406
answers question: http://stackoverflow.com/q/22456303
type: Answer
has body: The correct answer should be: private static byte[] convert(final InputStream is) throws IOException { final byte[] END_SIG = new byte[]{"\r".getBytes()[0], "\n".getBytes()[0]}; final List&lt;Byte&gt; streamBytes = new ArrayList&lt;Byte&gt;(); int readByte; byte[] bytes; // Read HTTP header: while ((readByte = is.read()) != -1) { streamBytes.add((byte) readByte); if (streamBytes.size() &gt; 4) { int sbsize = streamBytes.size(); int rp = sbsize - 4; int np = sbsize - 2; int rn = sbsize - 3; int nn = sbsize - 1; if (END_SIG[0] == streamBytes.get(rp) &amp;&amp; END_SIG[0] == streamBytes.get(np) &amp;&amp; END_SIG[1] == streamBytes.get(rn) &amp;&amp; END_SIG[1] == streamBytes.get(nn)) { break; } } } // Convert to byte[] bytes = new byte[streamBytes.size()]; for (int i = 0, iMAX = bytes.length; i &lt; iMAX; ++i) { bytes[i] = streamBytes.get(i); } // drop header streamBytes.clear(); // Convert byte[] to String &amp; retrieve the content-length: final String HEADER = new String(bytes); int startIndex = HEADER.indexOf("Content-Length:") + "Content-Length:".length() + 1; int length = 0; int I = startIndex; while (Character.isDigit(HEADER.charAt(I++))) { ++length; } final String CL = HEADER.substring(startIndex, startIndex + length); // Determine the number of bytes to read from now on: int ContentLength = Integer.parseInt(CL); while (streamBytes.size() &lt; ContentLength) { byte[] buffer = new byte[256]; int rc = is.read(buffer); for (int irc = 0; irc &lt; rc; ++irc) { streamBytes.add(buffer[irc]); } } // Convert to byte[] bytes = new byte[streamBytes.size()]; for (int i = 0, iMAX = bytes.length; i &lt; iMAX; ++i) { bytes[i] = streamBytes.get(i); } return bytes; } And in one place this is the answer to a question.
has comment: http://stackoverflow.com/comment/40097881
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22456303

http://stackoverflow.com/a/22342985
has body: public class Launch { public static String[] josh = { "Josh", "mcMc", "16", "grade 11" }; public static void main(String[] args) { Scanner sc = new Scanner(System. in ); System.out.print("Please enter the first name of the person you would love to know about : "); String hisName = sc.next(); if(josh[0].toString().equalsIgnoreCase(hisName)){ printSomeInfoAbout(josh); } else{ System.out.println("Sorry unable to find search Name"); } } public static void printSomeInfoAbout(String[] name) { System.out.println("My name is " + name[0] + " " + name[1] + ". I am " + name[2] + " " + "Years old and I am currently in " + name[3] + "."); } }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22342663

http://stackoverflow.com/comment/34097591
type: QuestionComment
comment on: http://stackoverflow.com/q/22418299
has text: Please provide some more info. What container are you running?
score: 0
type: Comment

http://stackoverflow.com/q/22462358
has answer: http://stackoverflow.com/a/22463058
has comment: http://stackoverflow.com/comment/34166183
duplicate of: http://stackoverflow.com/q/13102045
type: Question
accepted answer: http://stackoverflow.com/a/22463058
tagged with: input
has title: Java skips input and goes straight to the if statement,
score: 0
answer count: 2
has body: I am creating a Rock, Paper, Scissors game to practise my Java skills. But right now, I am facing a problem which I cannot fix. When I ask the user to enter something, they can't enter it and it goes straight to the if statement after it. Code: package rps_game; // Rock, Paper, Scissors game import java.util.Scanner; import java.util.Random; import java.util.*; public class rock_paper_scissors { public static void main(String args[]){ Scanner input = new Scanner(System.in); Random rand = new Random(); String choices[] = {"rock", "paper", "scissors"}; int winRounds = 0; boolean running = true; int rounds = 0; int wins = 0; int loses = 0; String yourChoice=""; String compChoice=""; while (running = true){ // main loop try{ System.out.println("Enter the amount of rounds you want to play: "); rounds = input.nextInt(); // gets input winRounds = (rounds/2)+1; System.out.println("You are playing best of " + winRounds + " out of " + rounds); running = false; // breaks off from loop }catch(Exception e){ // if error pops up System.out.println("You DID NOT enter a WHOLE NUMBER."); // still runs b/c criteria has not been met. } while (wins &lt; winRounds &amp;&amp; loses &lt; winRounds){ // problem arises here System.out.println("Enter either Rock, Paper or Scissors: "); yourChoice = input.nextLine(); input.nextLine(); yourChoice.toLowerCase(); if (yourChoice.equals(Arrays.asList(choices).contains(yourChoice))){ // if array contains what use entered break; }else{ System.out.println("You did not enter either Rock, Paper or Scissors."); running = false; // exit program } compChoice = choices[rand.nextInt(choices.length)]; System.out.println(compChoice); } } } } I have not finished it yet, but what is happening?
has comment: http://stackoverflow.com/comment/34166713
tagged with: java
possible better answer: http://stackoverflow.com/a/22462513
has answer: http://stackoverflow.com/a/22462513
linked to: http://stackoverflow.com/q/13102045
has comment: http://stackoverflow.com/comment/34166294
type: AnsweredQuestion

http://stackoverflow.com/comment/34028559
comment on: http://stackoverflow.com/a/22382397
score: 0
type: AnswerComment
type: Comment
has text: Sure, thanks, new question has been asked. Once again, thanks for your help, I'd +1 you if I could!

http://stackoverflow.com/q/22439322
favorite count: 0
has comment: http://stackoverflow.com/comment/34125672
has comment: http://stackoverflow.com/comment/34126430
has comment: http://stackoverflow.com/comment/34126642
has body: I want subtract 2 dates and saving the difference: SimpleDateFormat formatter = new SimpleDateFormat("HH:mm"); Date a = formatter.parse("08:06"); Date b = formatter.parse("08:00"); Date asd = new Date(a.getTime() - b.getTime()); The problem is that asd is not 00:06, but 01:06 (Thu Jan 01 01:06:00 CET 1970), I think that this depend on timezone. But how do I solve this? Should I change the jvm timezone?
tagged with: time
tagged with: timezone
has comment: http://stackoverflow.com/comment/34125548
has comment: http://stackoverflow.com/comment/34125670
has comment: http://stackoverflow.com/comment/34125736
has answer: http://stackoverflow.com/a/22439421
answer count: 4
has comment: http://stackoverflow.com/comment/34129591
has title: Creating a new Date from a difference / subtract two periods (having negative time)
score: 1
has answer: http://stackoverflow.com/a/22439393
upvote count: 1
has answer: http://stackoverflow.com/a/22443231
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22439393
tagged with: java
tagged with: date
type: Question
has answer: http://stackoverflow.com/a/22491673
downvote count: 0
accepted answer: http://stackoverflow.com/a/22443231

http://stackoverflow.com/comment/34069992
has text: How do you know which subclass to create?
comment on: http://stackoverflow.com/q/22407945
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22440674
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22440482
score: 1
has body: We can abstract a little you have this. public class TestCircularDependency { static class A{ B b = new B(); } static class B{ A a = new A(); } public static void main(String args[]){ A a = new A(); } } This will throw a StackOverflowError. You have a circular dependency. The problem is that you are instance each one in constructor then you have infinite recursion. In java you can have circular dependency but not in object creation. You can do something like this. public class TestCircularDependency { static class A{ B b; } static class B{ A a; } public static void main(String args[]){ A a = new A(); a.b = new B(); b.a= a; } }
upvote count: 1
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22440482

http://stackoverflow.com/a/22485627
has comment: http://stackoverflow.com/comment/34206951
upvote count: 1
has comment: http://stackoverflow.com/comment/34207664
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34206764
has comment: http://stackoverflow.com/comment/34207153
type: Answer
has body: Use PreparedStatement.setBoolean(int parameterIndex, boolean x) method. For example: pst.setBoolean(11, tb9.getSelectedItem().toString().equals("Business")); Note that it is not a query that is being executed (it is an INSERT), so this is incorrect: rs = pst.executeQuery(); instead: pst.executeUpdate(); // In this case you are expecting a return value of 1, // which you should check to ensure the insert happened. And it is VALUES, not value, in the INSERT statement (case is unimportant, I just prefer uppercase for keywords when writing SQL).
score: 1
has comment: http://stackoverflow.com/comment/34207638
has comment: http://stackoverflow.com/comment/34207214
has comment: http://stackoverflow.com/comment/34206721
accepted answer of: http://stackoverflow.com/q/22485574
downvote count: 0
answers question: http://stackoverflow.com/q/22485574

http://stackoverflow.com/a/22391311
has body: for(int i=0; i&lt;numbers.size(); i++){ should be for(int i=0; i&lt;numberList.length; i++){
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22391205
score: 2
downvote count: 0

http://stackoverflow.com/comment/33966161
has text: I have solved it.. restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter()); System.out.println(restTemplate.postForObject(url, requestEntity, String.class)); AuthenticationTokenWrapper tok =restTemplate.postForObject(url, requestEntity, AuthenticationTokenWrapper.class) ; i used `MappingJackson2HttpMessageConverter` instead of `MappingJacksonHttpMessageConverter`. but now it worked with the wrapper class as you suggested!
comment on: http://stackoverflow.com/a/22345875
score: 2
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34080262
type: Comment
comment on: http://stackoverflow.com/a/22413084
score: 0
type: AnswerComment
has text: Limiting the connection pool makes sense, not limiting (until some point...) the number of idle threads. Those are two different problems and you want to avoid coupling and increase cohesion. So heandle each problem separately and let each of them lead their lives independently. The connection pool gets you the best of your database and having more idle threads just add concurrency to your app.

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/22425951
type: Tag
tags question: http://stackoverflow.com/q/22338742
tags question: http://stackoverflow.com/q/22473576
tags question: http://stackoverflow.com/q/22427479
tags question: http://stackoverflow.com/q/22388332
tags question: http://stackoverflow.com/q/22399892
tags question: http://stackoverflow.com/q/22403616
tags question: http://stackoverflow.com/q/22463829

http://stackoverflow.com/q/22388138
type: Question
tagged with: combinations
has title: Creating combination of numbers
has comment: http://stackoverflow.com/comment/34044652
has comment: http://stackoverflow.com/comment/34044397
score: 0
has body: Task is to find the permutations of numbers {1,2,3...N}. N &lt;=16. The problem is in conditions: each number must be used only one time and permutation should be of N-size . And the each permutation should be array, because it will be tested. As input is given one permutation. The main task is to find all the permutations, that have the same set of difference as the first one has. For example, is given 12 3 6 1 9 11 8 5 2 4 7 10 Difference is -9,3,-5,8,2,-3,-3,-3,2,3,10 So, there are 12 permutations, that have the same permutation of difference. 3 11 8 5 2 4 6 9 12 7 10 1 3 6 9 11 8 5 2 4 12 7 10 1 4 12 7 10 1 3 6 9 11 8 5 2 4 7 10 12 3 6 1 9 11 8 5 2 4 6 9 12 7 10 1 3 11 8 5 2 6 9 12 7 10 1 3 11 8 5 2 4 9 11 8 5 2 10 12 3 6 1 4 7 11 8 5 2 10 12 3 6 1 4 7 9 11 8 5 2 4 12 7 10 1 3 6 9 11 8 5 2 4 7 10 12 3 6 1 9 12 3 6 1 9 11 8 5 2 4 7 10 12 3 6 1 4 7 9 11 8 5 2 10 I have wrote the checking of each permutation, but now I can`t correctly find all the permutations(with no repeating numbers) to check them. Here it is in - permutation of N, de- permutation of difference boolean Check(int[] in, int[] de){ for(int i=0; i&lt;de.length;i++){ if(in[0]+de[i]==in[1]){ int[] in2=new int[in.length-1]; if(in2.length==1){ return true; } for(int j=1; j&lt;in.length;j++){ in2[j-1]=in[j]; } int[] de2=new int[de.length-1]; for(int j=0; j&lt;de.length;j++){ if(de[j]!=de[i]){ de2[j]=de[j];}} Check(in2,de2); return false; } return false; } return false; }
tagged with: combinatorics
type: UnansweredQuestion
answer count: 0
tagged with: java

http://stackoverflow.com/comment/34114500
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22433083
type: Comment
has text: @CommuSoft, I think thats what was going on there. I made a clean build. I also changed the structure to the one shown below by --Kugathasan. I need to check again with your structure.

http://stackoverflow.com/q/22406646
type: Question
has comment: http://stackoverflow.com/comment/138781170
downvote count: 8
has answer: http://stackoverflow.com/a/22406696
tagged with: for-loop
linked to: http://stackoverflow.com/q/85190
has title: Foreach loop into for loop
score: -7
has answer: http://stackoverflow.com/a/22406715
has comment: http://stackoverflow.com/comment/34067953
upvote count: 1
has answer: http://stackoverflow.com/a/22406708
has comment: http://stackoverflow.com/comment/34068660
answer count: 7
has body: I do not understand the following foreach loop. Can someone write it into a 'normal' for loop, please? :) public static String arrayToString (int[] a) { String result = ""; for (int v : a) { result = result + v + " "; } return result; }
favorite count: 0
has comment: http://stackoverflow.com/comment/34067427
has comment: http://stackoverflow.com/comment/34067439
has answer: http://stackoverflow.com/a/22407904
has comment: http://stackoverflow.com/comment/34067466
type: UnansweredQuestion
tagged with: foreach
has answer: http://stackoverflow.com/a/22407388
has answer: http://stackoverflow.com/a/22406679
has comment: http://stackoverflow.com/comment/34067239
tagged with: java
has answer: http://stackoverflow.com/a/22406687

http://stackoverflow.com/comment/104173499
has text: You don't (need the starter). The app started successfully before you did that. It also exited successfully. If you don't want it to exit you have to keep it busy, and starting a web server is one way to do that.
type: Comment
comment on: http://stackoverflow.com/a/22409655
score: 1
type: AnswerComment

http://stackoverflow.com/comment/34179460
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22469711
has text: I think you should step away from code and read a good textbook, e.g., CLRS has a great chapter about hash tables.
type: Comment

swt
tags question: http://stackoverflow.com/q/22374358
tags question: http://stackoverflow.com/q/22371348
tags question: http://stackoverflow.com/q/22350728
tags question: http://stackoverflow.com/q/22431269
tags question: http://stackoverflow.com/q/22376268
tags question: http://stackoverflow.com/q/22342843
tags question: http://stackoverflow.com/q/22382591
tags question: http://stackoverflow.com/q/22447692
tags question: http://stackoverflow.com/q/22450770
tags question: http://stackoverflow.com/q/22420956
tags question: http://stackoverflow.com/q/22393823
tags question: http://stackoverflow.com/q/22473833
tags question: http://stackoverflow.com/q/22407595
type: Tag
tags question: http://stackoverflow.com/q/22344534
tags question: http://stackoverflow.com/q/22450462
tags question: http://stackoverflow.com/q/22448049
tags question: http://stackoverflow.com/q/22348968
tag name: swt

http://stackoverflow.com/q/22486539
accepted answer: http://stackoverflow.com/a/22486578
favorite count: 0
score: -3
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22486578
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22486572
tagged with: if-statement
has title: Is it posible to make a if not?
has answer: http://stackoverflow.com/a/22486572
has body: Is it posible to make a if not statement with initers? if (Main.gold &gt;= 400) { System.out.println("Kun en Elver/Orc er stærk nok til dette/Du har ikke guld nok."); }
answer count: 2
downvote count: 4

http://stackoverflow.com/comment/34027138
comment on: http://stackoverflow.com/q/22381922
has text: http://stackoverflow.com/questions/694581/how-to-check-which-locks-are-held-on-a-table http://stackoverflow.com/questions/999181/how-to-find-who-locks-who-in-sql-server-2005
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22387023
score: 1
has title: Architecture/tools/technologies for high performance image streaming application - Java
tagged with: tomcat
has comment: http://stackoverflow.com/comment/34036778
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34033996
has comment: http://stackoverflow.com/comment/34041330
upvote count: 1
tagged with: performance
has body: Currently, we have Java webservices in both REST and SOAP that streams images to the Swing client. The Swing client is like a Video player with controls Play, Move forward, etc. It calls the Webservice and displays images. When you play, it has to get images (jpeg) continuously and display them so simulate a video. There are other custom controls as well, like move forward, which pulls an image at some given point. Tomcat Server Spring MVC REST Swing (Client) Java 1.7 2 servers on AWS On the server, the webservice calls AWS API to pull the images. The images are sent as a raw bytes. Currently, the performance is a problem. When the Swing viewer loads, we pull x number of images and start playing, while its playing, we pull same x number of images and cache them locally. I don't think more servers would solve the problem here. We need to figure out a good architecture to boost the performance. What could be done? Any idea?
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34089485
downvote count: 0
has comment: http://stackoverflow.com/comment/34073562
answer count: 0

http://stackoverflow.com/a/22466568
has body: I have to run so can't type much right now but will come back to this tomorrow. Here are my test results after running it against real world file types (.txt, .ppt, .doc, .swf, etc...). Looks like &lt;cfzip&gt; is much better than zip.cfc.
score: 1
has comment: http://stackoverflow.com/comment/77153894
downvote count: 0
answers question: http://stackoverflow.com/q/22465244
type: Answer
upvote count: 1

http://stackoverflow.com/a/51223447
answers question: http://stackoverflow.com/q/22476795
has body: OS: Windows 10 Pro Java: 10.0.1 When trying to run the JDK installer from the "Downloads" folder I kept running into the same error (only different .cab file). I tried running as admin, different compatibility mode, scanning with the Windows scanner. Nothing helped. Then I just downloaded to Desktop. I ran it as Administrator and Java installed without any problem.
score: 0
type: Answer

http://stackoverflow.com/a/22384021
has comment: http://stackoverflow.com/comment/34056975
type: Answer
has comment: http://stackoverflow.com/comment/34031118
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/34029035
answers question: http://stackoverflow.com/q/22383108
has comment: http://stackoverflow.com/comment/34069855
has body: Follow the general guidelines for Communication between Modules in App Engine Modules in Java. After the second code example it says you could also use the URL Fetch Service for an asynchronous flow control. For security the document continues with advice for the called module (your endpoints) to authenticate the request. The manual or basic scaling admin login solution will generally not work because automatic scaling is the default. The Inbound-AppId header would be a very simple and safe choice in your scenario. Just as you are willing to add more details to your question, I am happy to try to add more details to this answer.
has comment: http://stackoverflow.com/comment/34029956
has comment: http://stackoverflow.com/comment/34030285

http://stackoverflow.com/a/22713077
downvote count: 0
answers question: http://stackoverflow.com/q/22397714
upvote count: 2
has body: Found the solution. The reason I was getting the error is due to Linux version of MySQL being case sensitive to the database name. When I moved my entire stack from Windows to Linux I faced this problem. Windows MySQL database names are not case-sensitive and Linux MySQL database names are case-sensitive.
accepted answer of: http://stackoverflow.com/q/22397714
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/a/22403905
has body: You can call something like the following: (EDIT: added also the client calls) public void run() { try { String out = getAsString(istrm_); ((PrintStream) ostrm_).println(out); } catch (Exception e) { e.printStackTrace(); } } public static String getAsString(InputStream is) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int cur = -1; while((cur = is.read()) != -1 ){ baos.write(cur); } return getAsString(baos.toByteArray()); } public static String getAsString(byte[] arr) throws Exception { String res = ""; for(byte b : arr){ res+=(char)b; } return res; }
answers question: http://stackoverflow.com/q/22403386
type: Answer
score: 0

http://stackoverflow.com/comment/34182509
comment on: http://stackoverflow.com/a/22471145
type: AnswerComment
has text: Haha cheers mate, I was half way through submitting one. Have voted that up :)
score: 0
type: Comment

http://stackoverflow.com/a/22392212
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22390473
has body: Ok, after asking on processing.org forum one guy showed me code, which works, and after comparing them I found, that I have pointless line: package processing.core; Which cause problems! So the correct code: something.pde: Foo bar; void setup() { } void draw() { } Foo.java: import java.io.Serializable; import processing.core.PApplet; public class Foo implements Serializable { } http://forum.processing.org/two/discussion/comment/12111#Comment_12111 :) However - thank you both for help!
answers question: http://stackoverflow.com/q/22390473
has comment: http://stackoverflow.com/comment/34301042
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/comment/34004727
type: Comment
type: QuestionComment
has text: i mean, i want to display it without html tags.
comment on: http://stackoverflow.com/q/22369999
score: 0

http://stackoverflow.com/a/22381405
downvote count: 0
has body: ConcurrentModificationException is not about whether you have synchronized or not, its when the collection detects a modification being done concurrently with something that does not allow it. For example you might have (somewhere else in your code which you are not showing) an iterator going through the list of items. Its about protecting the integrity of the collection. What is happening in the other thread? Is it going through the list in parallel? Draw a Sequence Diagram of both threads and you should clearly find what one thread is doing in parallel of the other. Also, do you actually need to do that locking? You can get a synchronized collection through methods such as Collections.synchronizedList() Why don't you use an appropriate data structure that takes care of sorting more efficiently? If each item is unique you could use a SortedSet implementation such as TreeSet.
type: AcceptedAnswer
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/34025629
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22380781
answers question: http://stackoverflow.com/q/22380781

http://stackoverflow.com/comment/33970264
type: Comment
comment on: http://stackoverflow.com/q/22350420
has text: Use Iterator class to remove the element
score: 0
type: QuestionComment

session-timeout
type: Tag
tag name: session-timeout
tags question: http://stackoverflow.com/q/22480498

http://stackoverflow.com/q/22362302
has body: I have a class, which has subclasses for which I would like to handle copying objects properly. The superclass, called Item, has a copy constructor and the subclasses also have their own. However, what I want to know is to how to make it the following will work. Item class (simplified description) constructor: public Item(...) { } copy constructor: public Item( Item template ) { } The basic layout the same for each subclass in this regard, excepting that at the moment they just make a new instance of item using a different constructor intended for making a new object from data stored in a text file (passing it data from the template object) and then fill in the additional fields from the template object. The subclasses are things like Weapon, Armor, Shield, etc. What I want to do is to able to say: Weapon weapon = new Item( weapon ); Where weapon is a Weapon and the proper copy constructor (belonging to the specific subclass) is called, returning a new Object of type Weapon, as opposed to just getting back a new Item with only the Item parts that belonged to weapon. What is the best and/or right way to do this?
tagged with: constructor
possible better answer: http://stackoverflow.com/a/22362831
upvote count: 3
has answer: http://stackoverflow.com/a/22362831
has answer: http://stackoverflow.com/a/22362722
type: AnsweredQuestion
has title: Copy Constructors and Polymorphism
tagged with: java
has comment: http://stackoverflow.com/comment/33991299
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33992398
tagged with: copy-constructor
downvote count: 0
accepted answer: http://stackoverflow.com/a/22362722
favorite count: 0
score: 3

http://stackoverflow.com/q/22381423
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22381526
tagged with: java
accepted answer: http://stackoverflow.com/a/22381526
type: Question
upvote count: 2
has body: I was wondering how would I add a JPanel to a JFrame and make sure it is centered and had a gap of set size on either sides? I can get it in the center but it sticks to the edge.
answer count: 1
favorite count: 0
has title: JFrame and JPanel centering
has comment: http://stackoverflow.com/comment/34025210
has comment: http://stackoverflow.com/comment/34023569
tagged with: swing

http://stackoverflow.com/q/22345576
tagged with: amazon-web-services
score: 0
has answer: http://stackoverflow.com/a/22359024
tagged with: sdk
tagged with: amazon-ec2
answer count: 1
has comment: http://stackoverflow.com/comment/33962167
has body: I am using JAVA SDK for AWS. I can fetch the detail of the ec2 instances in a particular region in ec2 instance view. But how to import the result in an excel sheet. Kindly help
type: UnansweredQuestion
tagged with: java
has title: How to export the result from ec2 instance view in an excel file
type: Question
has comment: http://stackoverflow.com/comment/33964928
has comment: http://stackoverflow.com/comment/33964914

http://stackoverflow.com/comment/34091606
score: 0
comment on: http://stackoverflow.com/a/22409454
type: AnswerComment
has text: In sve method you are using the joker4 method which is defined inside that method
type: Comment

substance
tag name: substance
type: Tag
tags question: http://stackoverflow.com/q/22430879

http://stackoverflow.com/q/22452531
has title: Parsing a date which is a string from an rss feed and then displayed in a text view.
has comment: http://stackoverflow.com/comment/34148989
has comment: http://stackoverflow.com/comment/34148996
has body: I am working on an app which parses an rss feed about roadworks into a list view and having difficulties parsing the date which is contained in a tag, being a string. I have to use the date picker for when i enter a date it displays the necessary roadworks on that day. Do you have any suggestions?
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34149031
type: Question
has comment: http://stackoverflow.com/comment/34148977
has comment: http://stackoverflow.com/comment/34148916
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22452843
has comment: http://stackoverflow.com/comment/34149436
answer count: 1
has comment: http://stackoverflow.com/comment/34149036
tagged with: android
tagged with: datepicker

http://stackoverflow.com/comment/34180021
type: AnswerComment
type: Comment
has text: +1 An alternative to creating a `Comparator` is to have `Employee` implement [`Comparable`](http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html), comparing ages.
comment on: http://stackoverflow.com/a/22470111
score: 1

http://stackoverflow.com/q/22461375
tagged with: java
tagged with: sharedpreferences
possible better answer: http://stackoverflow.com/a/22462022
type: Question
has body: I'am trying to permentantly store values from 3 differenct strings into Shared Preferences. The strings definately contain the values as i have tested them by setting the strings in a textView. public class verified extends Activity{ SharedPreferences sharedpreferences; TextView textView100; String MyPREFERENCES = "MyPreferences" ; String NString; String MString; String EAString; public static final String MVerified = ""; public static final String NVerified = ""; public static final String EAVerified = ""; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.verified); sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE); Bundle bundle = getIntent().getExtras(); NString = bundle.getString("NString"); MString = bundle.getString("MString"); EAString = bundle.getString("EAString"); textView100 = (TextView) findViewById(R.id.textView100); textView100.setText(MString + " , " + NString + " , " + EAString); Button VCompleteButton = (Button) findViewById(R.id.VCompleteButton); VCompleteButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Editor editor = sharedpreferences.edit(); editor.putString(MVerified, MString); editor.putString(NVerified, NString); editor.putString(EAVerified, EAString); editor.commit(); } }); } } However the issue now is that the EAString is storing its value in all three of the. sharedPreferences. When I execute this on the main activity. It shows me the EAStrin 3 times. textView2.setText((sharedpreferences.getString(MobileVerified, "")) + " , "+ (sharedpreferences.getString(NameVerified, "")) + " , "+ (sharedpreferences.getString(EmailAddressVerified, "")));
has comment: http://stackoverflow.com/comment/34165725
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/34165821
tagged with: android
has answer: http://stackoverflow.com/a/22461480
accepted answer: http://stackoverflow.com/a/22461480
has answer: http://stackoverflow.com/a/22462173
has title: Android Java - Shared Preferences Editor Issue
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22462022

http://stackoverflow.com/a/22441228
has comment: http://stackoverflow.com/comment/34129693
downvote count: 0
has comment: http://stackoverflow.com/comment/34129424
has body: I think you mean something like this: for(int red = 0, yoffset = 0; red &lt;= 255; red += 10, yoffset++) { g.setColor(new Color(red, 0, 0)); g.fillRect(0, y * yoffset, 32, 32); }
answers question: http://stackoverflow.com/q/22441141
type: Answer
has comment: http://stackoverflow.com/comment/34129483
upvote count: 1
has comment: http://stackoverflow.com/comment/34129402
has comment: http://stackoverflow.com/comment/34129531
score: 1
has comment: http://stackoverflow.com/comment/34129478
has comment: http://stackoverflow.com/comment/34129451

http://stackoverflow.com/a/22479872
has body: I suggest you to try this API which is very easy/reliable instead of relying on the X-path of the elements. Also you cannot rely on the Xpath for dynamic pages/content.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22479598
downvote count: 0
score: 1

http://stackoverflow.com/a/22383390
answers question: http://stackoverflow.com/q/22383128
type: Answer
has comment: http://stackoverflow.com/comment/34033947
has comment: http://stackoverflow.com/comment/34033275
score: 0
has body: It sounds like you want Aspect-Oriented Programming Here's a good overview of doing AOP with Guice

http://stackoverflow.com/comment/34104723
comment on: http://stackoverflow.com/q/22427740
type: Comment
type: QuestionComment
has text: `without importing anything to achieve it` not even StringBuilder which seams perfect here?
score: 0

http://stackoverflow.com/comment/34177724
score: 0
type: AnswerComment
has text: @ajb Does it make sense to validate the input one box at a time, all at once? What if one box contains incorrect data? It still pushes a partial update! This way makes it clear to the user that what they enter is automatically updated, and it notifies them immediately when they make a mistake.
type: Comment
comment on: http://stackoverflow.com/a/22468542

http://stackoverflow.com/comment/54515120
score: 1
comment on: http://stackoverflow.com/a/22370613
has text: I don't know whether it's good practice to get the value of element again or not, but it works. Thank you!
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33963566
type: Comment
comment on: http://stackoverflow.com/a/22346479
has text: Why? This doesn't answer the question at all.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34079333
comment on: http://stackoverflow.com/a/22409622
type: AnswerComment
score: 0
type: Comment
has text: Thanks, but in step 1 - I don't have logout button in LogIn.class. Here only two textfields (login and password, I check it in "loginAllowed") and submit button, which redirect to General.class or any other in "original destination". And only in General.class I have logout button. So it is strange for me, why wicket search this logout component on LogIn.class

http://stackoverflow.com/a/39206916
answers question: http://stackoverflow.com/q/22454839
has body: Based on the answer of @Xaver Kapeller I figured out a way to create scroll animation when new views appear on the screen (and also animation to hide them). It goes from this state: Button Last Button to Button Button 1 Button 2 Button 3 Button 4 Last Button and viceversa. So, when the user clicks on the first button, the elements "Button 1", "Button 2", "Button 3" and "Button 4" will appear using fade animation and the element "Last Button" will move down till end. The height of the layout will change as well, allowing using scroll view properly. This is the code to show elements with animation: private void showElements() { // Precondition if (areElementsVisible()) { Log.w(TAG, "The view is already visible. Nothing to do here"); return; } // Animate the hidden linear layout as visible and set // the alpha as 0.0. Otherwise the animation won't be shown mHiddenLinearLayout.setVisibility(View.VISIBLE); mHiddenLinearLayout.setAlpha(0.0f); mHiddenLinearLayout .animate() .setDuration(ANIMATION_TRANSITION_TIME) .alpha(1.0f) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); updateShowElementsButton(); mHiddenLinearLayout.animate().setListener(null); } }) ; mLastButton .animate() .setDuration(ANIMATION_TRANSITION_TIME) .translationY(mHiddenLinearLayoutHeight); // Update the high of all the elements relativeLayout LayoutParams layoutParams = mAllElementsRelativeLayout.getLayoutParams(); // TODO: Add vertical margins layoutParams.height = mLastButton.getHeight() + mHiddenLinearLayoutHeight; } and this is the code to hide elements of the animation: private void hideElements() { // Precondition if (!areElementsVisible()) { Log.w(TAG, "The view is already non-visible. Nothing to do here"); return; } // Animate the hidden linear layout as visible and set mHiddenLinearLayout .animate() .setDuration(ANIMATION_TRANSITION_TIME) .alpha(0.0f) .setListener(new AnimatorListenerAdapter() { @Override pu…
type: Answer
upvote count: 16
score: 15
has comment: http://stackoverflow.com/comment/65943431
downvote count: 1
has comment: http://stackoverflow.com/comment/77529973
has comment: http://stackoverflow.com/comment/77552096

http://stackoverflow.com/a/22468428
has comment: http://stackoverflow.com/comment/34177899
answers question: http://stackoverflow.com/q/22468373
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: You might be able to establish whether the client class had access to the method by examining the packages, inheritance chain, and accessibility of the method. Take a look at the MethodModifierSpy class in the Java tutorials. But even if the client class had access, your code in Util would still need to call setAccessible(true) when Util does not have access, since the reflection code is part of Util, not the client class.
accepted answer of: http://stackoverflow.com/q/22468373

http://stackoverflow.com/a/22385762
type: Answer
answers question: http://stackoverflow.com/q/22385457
has body: Open the About Eclipse dialog (Help -> About Eclipse on Windows, Eclipse -> About Eclipse on OS X) Click "Installation Details", choose the Configuration tab, and scroll down to the "java.home" entry. The value is the path name to the JVM used.
has comment: http://stackoverflow.com/comment/34032603
has comment: http://stackoverflow.com/comment/34031717
score: 18
upvote count: 18
downvote count: 0

http://stackoverflow.com/comment/34173781
has text: Post the stack trace. As a note, it's much more difficult to debug statements that are that compound; there are four different items that could be `null` right there.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22466409
type: QuestionComment

http://stackoverflow.com/comment/33992617
comment on: http://stackoverflow.com/a/22361693
has text: Oh true, that may be what I'll have to do.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22432667
tagged with: single-sign-on
has answer: http://stackoverflow.com/a/22433185
accepted answer: http://stackoverflow.com/a/22433185
type: AnsweredQuestion
tagged with: java
tagged with: http
type: Question
has body: I'm desperate enough to get the content of the this URL. No authentication is required when trying to access this page from a web browser but when I'm trying to get the content from a web application I get sso file as a response. The code I used is as follows: HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet("http://search.lib.monash.edu/primo_library/libweb/action/search.do?dscnt=1&amp;frbg=&amp;tab=default_tab&amp;srt=rank&amp;ct=search&amp;mode=Basic&amp;dum=true&amp;tb=&amp;indx=1&amp;vl%28freeText0%29=java&amp;fn=search&amp;vid=MON"); HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity responseEntity = httpResponse.getEntity(); BufferedReader in = new BufferedReader( new InputStreamReader(responseEntity.getContent())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); and the sso file I get as response is as follows: &lt;!-- filename: sso --&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Login &lt;/title&gt; &lt;!-- START filename: meta-tags.pds --&gt; &lt;META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"&gt; &lt;META HTTP-EQUIV="Pragma" CONTENT="no-cache"&gt; &lt;META HTTP-EQUIV="Expires" CONTENT="Sun, 06 Nov 1994 08:49:37 GMT"&gt; &lt;META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"&gt; &lt;!-- END filename: meta-tags.pds --&gt; &lt;link rel="stylesheet" href="http://monash-dc05.hosted.exlibrisgroup.com:8991/PDSMExlibris.css" TYPE="text/css"&gt; &lt;/head&gt; &lt;body onload = "location = '/goto/http://search.lib.monash.edu:80/primo_library/libweb/action/login.do?afterPDS=true&amp;vid=MON&amp;vid=MON&amp;dscnt=2&amp;targetURL=http%3A%2F%2Fsearch.lib.monash.edu%2Fprimo_library%2Flibweb%2Faction%2Fsearch.do%3Fdscnt%3D0&amp;frbg=&amp;tab=default%5Ftab&amp;dstmp=1394940513823&amp;srt=rank&amp;ct=search&amp;mode=Basic&amp;dum=true&amp;indx=1&amp;tb=&amp;vl%28freeText…
answer count: 1
score: 0
has title: Cannot Read a URL from java code
tagged with: url

http://stackoverflow.com/comment/33999161
comment on: http://stackoverflow.com/q/22366525
score: 0
has text: I'm sorry, truncate. How can I do this?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22345437
answer count: 1
has answer: http://stackoverflow.com/a/22345635
has comment: http://stackoverflow.com/comment/34035687
score: 0
has body: i have a Memory issue in my application. i'm using Jobschedular as my thread class. While running my Java application memory keeps on increasing. Below is my Code. i have tried with system.gc &amp; run time garbage collection also there is no use of it. pls let me know what is wrong on the below thread class. public class JobScheduler implements Runnable { private class JobNode { public Runnable job; public Date executeAt; public long interval; public int count; private JobNode() { } } public JobScheduler() { dlock = new DaemonLock(); jobs = new Vector(); Thread js = new Thread(this); js.setDaemon(true); js.start(); } private synchronized void addJob(JobNode job) { dlock.acquire(); jobs.addElement(job); notify(); } public synchronized void relancerJOBsEnAttente() { notify(); } private synchronized void deleteJob(Runnable job) { int i = 0; do { if(i &gt;= jobs.size()) break; if(((JobNode)jobs.elementAt(i)).job.equals(job)) { jobs.removeElementAt(i); dlock.release(); break; } i++; } while(true); } private JobNode updateJobNode(JobNode jn) { Calendar cal = Calendar.getInstance(); cal.setTime(jn.executeAt); if(jn.interval == -4L) { SchedulerAction sa = (SchedulerAction)jn.job; MaDate md = MaDate.getPlusPetiteDate(sa.getElementScheduler().getListDaysOfWeek()); if(md == null) jn.count = 1; else jn.executeAt = new Date(getNextDateMD(md)); } else if(jn.interval == -3L) { //System.out.println("::: calculate WD :::"); SchedulerAction sa = (SchedulerAction)jn.job; jn.executeAt = new Date(getNextDateWD(jn.executeAt, sa.getElementScheduler().getListDaysOfWeek(), sa.getElementScheduler().getListWeeksOfMonth())); } else if(jn.interval == -1L) { cal.add(2, 1); jn.executeAt = cal.getTime(); } else if(jn.interval == -2L) { cal.add(1, 1); jn.executeAt = cal.getTime(); } else { for(jn.executeAt = new Date(jn.executeAt.getTime() + jn.interval); jn.executeAt.getTime() &lt; (new Date(System.currentTimeMillis())).getTime(); jn.executeAt = new Date(jn.executeAt.getTime() + jn.interval)); } …
has title: Thread Memory Management - Job Schedular
has comment: http://stackoverflow.com/comment/34051562
tagged with: memory-management
type: UnansweredQuestion
tagged with: multithreading
tagged with: performance
tagged with: java
type: Question

http://stackoverflow.com/q/22480749
has comment: http://stackoverflow.com/comment/34197992
has comment: http://stackoverflow.com/comment/34199597
has comment: http://stackoverflow.com/comment/34197861
type: Question
has comment: http://stackoverflow.com/comment/34200918
has comment: http://stackoverflow.com/comment/34198279
upvote count: 9
duplicate of: http://stackoverflow.com/q/4952568
has answer: http://stackoverflow.com/a/22482114
tagged with: memory
score: 9
has comment: http://stackoverflow.com/comment/34200817
has comment: http://stackoverflow.com/comment/34198410
has comment: http://stackoverflow.com/comment/34218699
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34199457
has comment: http://stackoverflow.com/comment/34200542
favorite count: 0
linked to: http://stackoverflow.com/q/4952568
tagged with: heap-memory
has comment: http://stackoverflow.com/comment/34200934
has comment: http://stackoverflow.com/comment/34200855
has title: How to shrink java heap space?
accepted answer: http://stackoverflow.com/a/22482114
type: AnsweredQuestion
tagged with: memory-management
tagged with: java
has body: I have a Java console app that's processing big xml files using DOM. Basically it creates xml files from data it takes from the DB. Now, as you guess it's using large amount of memory but, to my surprise, it's not related to bad code but to "java heap space not shrinking". I tried running my app from Eclipse using these JVM params: -Xmx700m -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 i even added the -XX:-UseSerialGC as i found out that parallel GC ignores "MinHeap" and "MaxHeap" options. Even with all those options graph of my app's memory use looks like this: As you can see, at one point my app takes ~400 MB of heap space, heap grows to ~650 MB, but few seconds later (when xml generation is done) my app goes down to 12MB of used heap, but "heap size" remains at ~650 MB. It takes 650 MB of my ram! It's bizzare, don't you think? **Is there a way to force JVS to shrink availabe heap size to, like 150% of current used heap?**Like, if my app needs 15 MB of ram, heap size is ~20MB, when my app asks for 400 MB of ram, heap grows to ~600 MB and DROPS back to ~20 MB as soon as my app finish heavy-lifting operation?

ajax
tags question: http://stackoverflow.com/q/22477899
tags question: http://stackoverflow.com/q/22436018
type: Tag
tags question: http://stackoverflow.com/q/22486201
tags question: http://stackoverflow.com/q/22338063
tags question: http://stackoverflow.com/q/22350593
tags question: http://stackoverflow.com/q/22443146
tags question: http://stackoverflow.com/q/22422160
tags question: http://stackoverflow.com/q/22343072
tags question: http://stackoverflow.com/q/22378849
tags question: http://stackoverflow.com/q/22351344
tags question: http://stackoverflow.com/q/22371801
tags question: http://stackoverflow.com/q/22388736
tags question: http://stackoverflow.com/q/22443640
tags question: http://stackoverflow.com/q/22457065
tags question: http://stackoverflow.com/q/22425550
tag name: ajax

http://stackoverflow.com/q/22409264
has comment: http://stackoverflow.com/comment/34072315
has comment: http://stackoverflow.com/comment/34073771
downvote count: 0
favorite count: 0
tagged with: logic
has comment: http://stackoverflow.com/comment/34075129
tagged with: c++
has title: Solving Programming Problems on Paper
answer count: 0
has body: It has often been emphasized that before putting anything into code one must try to solve the problem on paper. This means developing the algorithm and stuff like that. I feel it means strategizing as to how we will deal with the problem. Recently I started doing a bit of practice coding on online judges and some projects for college. I found that I have the habit of directly grabbing the problem and sitting directly on the computer and starting to code the solution. I feel this is something that is blocking me from progressing forward. I find that I have no motivation to solve it on paper. I tried many times to solve the problem on paper. But I would end up staring at the page and finally sitting back onto the computer. So I need help: What are the benefits of solving problems on paper/white boards and how can I become better at it? What kind of things should I write and how to make the most of it? (I apologize if the question is too broad or not constructive, but it is something that is troubling me and so I decided to give it a try on SO. Also I don't know if it helps but I program in Java and C++) EDIT: I discovered that the topic was put on hold as primarily opinion based. I present my case here for consideration: FROM THE FAQ Constructive subjective questions: inspire answers that explain “why” and “how” tend to have long, not short, answers have a constructive, fair, and impartial tone invite sharing experiences over opinions insist that opinion be backed up with facts and references are more than just mindless social fun Here is what I feel: My question is a question that asks for HOW TO USE PAPER / WHITE BOARD TO OUR BEST ADVANTAGE. I don't know if it has long or short answers but I feel that it will have longer answers than our usual questions. I have not placed any kind of opinion neither have I become partial towards one aspect of the question. I am obviously asking for experienced answers. I know everybody here has worked a lot more than me in this fiel…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34072277
has comment: http://stackoverflow.com/comment/34073224
type: Question
has comment: http://stackoverflow.com/comment/34075189
has comment: http://stackoverflow.com/comment/34072217
has comment: http://stackoverflow.com/comment/34073558
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/34072335
has comment: http://stackoverflow.com/comment/34072071
score: 4
upvote count: 4

http://stackoverflow.com/comment/34123326
type: Comment
type: QuestionComment
has text: In what context? You'll need to provide a lot more information.
score: 1
comment on: http://stackoverflow.com/q/22438253

http://stackoverflow.com/comment/34012358
score: 0
type: Comment
has text: Good Stuff....this helped a lot, and once I changed the string comparison method as PakkuDon mentioned and then I instantiated inside the method before the call as you said....IT WORKED!!!!!!!!!!!!!!!! Thank you very very much for your help. I truly appreciate it.
type: AnswerComment
comment on: http://stackoverflow.com/a/22374075

http://stackoverflow.com/a/22364859
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34001121
answers question: http://stackoverflow.com/q/22360709
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/22360709
score: 2
has body: Steps to follow: create a custom Item Writer class by implementing ItemWriter where we have implemented a logic to store User object in Map<String,List<String>> because a single user can have multiple associated data package com.spring.batch.domain; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.batch.item.ItemWriter; public class UserItemWriter implements ItemWriter<User> { private static Map<String, List<String>> userMap = new HashMap<String, List<String>>(); public void write(List<? extends User> users) throws Exception { for (User user : users) { List<String> list = userMap.get(user.getUserId()); if (list == null) { list = new ArrayList<String>(); } list.add(user.getUserData()); userMap.put(user.getUserId(), list); } } public static Map<String, List<String>> getUserMap() { return userMap; } } Plain User POJO class having two fieldsuserId anduserData package com.spring.batch.domain; public class User { private String userId; private String userData; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getUserData() { return userData; } public void setUserData(String userData) { this.userData = userData; } } Main class to run the job package com.spring.batch.main; import java.util.List; import java.util.Map; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobParametersBuilder; import org.springframework.batch.core.JobParametersInvalidException; import org.springframework.batch.core.launch.JobLauncher; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; import org.springframework.batch.core.repository.JobRestartException; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.support.Cla…
has comment: http://stackoverflow.com/comment/34001983
has comment: http://stackoverflow.com/comment/34009591

http://stackoverflow.com/comment/34145443
has text: com.teradata.notification.rest.controller.PushCommandsController is not component scanned? But it looks like this class is not even a class of your library.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22442822
score: 0

http://stackoverflow.com/a/22444098
has body: Recursion provides easy to read simple solutions for many problems, however it has issues related to function stack size limitation as pointed by others. My personal theory on this is that if your recursion depth is O(log n) , you are OK using recursion. To put things in perspective inorder traversal of balanced binary tree is +/- O(log n) recursion depth (Although this can be easily done with a stack, I am using it for example here) But if your recursion depth can not be constrained in O(log n), there are very good chances of running out function stack space. If you are trying to write a program to flood fill you can not use recursion.
upvote count: 3
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22443763

http://stackoverflow.com/comment/118926483
type: Comment
type: AnswerComment
has text: @VenkataRamireddyCH ResponseEntity.noContent().build();
score: 0
comment on: http://stackoverflow.com/a/22385263

http://stackoverflow.com/q/22433558
tagged with: java
answer count: 2
upvote count: 1
has title: NullPointException and length of an array of objects
has answer: http://stackoverflow.com/a/22433632
tagged with: arrays
has comment: http://stackoverflow.com/comment/34115331
possible better answer: http://stackoverflow.com/a/22433632
accepted answer: http://stackoverflow.com/a/22433627
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34115359
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34115343
favorite count: 0
tagged with: constructor
type: Question
has body: I'm having deep trouble when dealing with an array of objects. Basically what I have defined is the following: public class PlayersList { private Player[] players; private int length; private int numPlayer = 0; } Which in this case players come from the data type players: public class Player { public String UserName; public Player(String UserName) { this.UserName = UserName; } } Now, when I try to invoke methods that involve traversing through an array of objects or the length of the object array, I get a NPE. I'm starting with a 3 member array, and I have already initialized all three members so that I don't get anything like that. However, if I then try to use something like: public Player findPlayer(String Player) { for(int i = 0; i &lt; players.length; i++) { if(Player.equals(players[i].UserName)) { return players[i]; } } return null; } And as well in other types of code involving an element of the player array or its length, I get a NPE. What I'm doing wrong? Is there any way to avoid this or could someone tell me what I'm missing? Thank you so much. Edit: Here is the code for initializing players in the array: public PlayersList() { Player[] players = new Player[3]; players[0] = new Player("Hi"); players[1] = new Player("Bla"); players[2] = new Player("Foo"); length = 3; }
has comment: http://stackoverflow.com/comment/34115285
tagged with: oop
has answer: http://stackoverflow.com/a/22433627

http://stackoverflow.com/comment/34171267
comment on: http://stackoverflow.com/q/22457024
has text: I believe it's specific enough: "find all programs that are registered to listen to mouse/keyboard events?" ON "Windows 7" AND "I don't mind the programming language".
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22428490
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/34106843
answers question: http://stackoverflow.com/q/22376673
has body: First of all, the @New qualifier was replaced with the @Dependant scope, which is the default scope anyway. I'd imagine it was changed in CDI 1.1 due to the confusion that it causes. Plus, @New is a qualifier, not a scope, and is from a separate standard that can be used for multiple purposes (I don't think @New is really used by any standards). It looks like you'd want to use @Produces in AlgorithmState instead of @Inject. Check out the Weld documentation on the subject for some more details. You might want to create a specific scoped type like so: @ScopeType @Retention(RUNTIME) @Target({TYPE, METHOD, CONSTRUCTOR}) public @interface AlgorithmScoped {} Then you could modify the AlgorithmState constructor: @Produces @AlgorithmScoped public AlgorithmState() { // ... } Add that scope to AlgorithmExecutor, and then also to Algorithm. I don't think you should be trying to inject AlgorithmState into Algorithm; get that from the AlgorithmExecutor instance! In fact, if you do that, that should solve the entire problem in a nutshell.
has comment: http://stackoverflow.com/comment/34107273
has comment: http://stackoverflow.com/comment/34160852
upvote count: 3
has comment: http://stackoverflow.com/comment/34106705
has comment: http://stackoverflow.com/comment/34106811
has comment: http://stackoverflow.com/comment/34106565
has comment: http://stackoverflow.com/comment/34353371
type: Answer
has comment: http://stackoverflow.com/comment/34107186

http://stackoverflow.com/a/22393419
type: Answer
answers question: http://stackoverflow.com/q/22393302
score: 0
has body: You should try printing the line before parsing it so that you can see what causes it to blow up. String line = sc.nextLine(); String[] details = line.split("\\s+"); String regNumber = details[0]; String name = details[1]; String modOne= details[2]; You are splitting on chunks of spaces. In the event you encounter a line with no spaces, then there will only be a single element and therefore details[1] will throw an IndexOutOfBoundsException. My suggestion is to examine your input carefully. Does it have at trailing line feed? If so, that may be interpreted as a blank line 130002 Bob B2123 35 34 B2132 34 54 B2143 23 34 &lt;blank line&gt;

http://stackoverflow.com/a/22367041
answers question: http://stackoverflow.com/q/22366832
has body: MenuItem#getActionView() will return null unless you have set a custom ActionView What you should be doing is using scoreItem.setTitle()
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34000056
score: 1
accepted answer of: http://stackoverflow.com/q/22366832
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33951313
comment on: http://stackoverflow.com/a/22339254
score: 0
type: AnswerComment
type: Comment
has text: True haha just havent been finding anything in my book to help

http://stackoverflow.com/q/22355112
has answer: http://stackoverflow.com/a/22355948
has answer: http://stackoverflow.com/a/22358644
linked to: http://stackoverflow.com/q/2087108
score: 0
answer count: 3
has title: Creating tag only if value exist in source
accepted answer: http://stackoverflow.com/a/22358644
has comment: http://stackoverflow.com/comment/33979299
has answer: http://stackoverflow.com/a/22355973
type: AnsweredQuestion
has body: For example: val I want an xslt that will create aaa,bbb,ccc tags only if they contain value in source. Until now i used: <xsl:value-of select="//aaa"/> <xsl:value-of select="//bbb"/> <xsl:value-of select="//ccc"/> Which is clearly not good.
has comment: http://stackoverflow.com/comment/33978811
tagged with: java
has comment: http://stackoverflow.com/comment/33979501
tagged with: xslt
type: Question
possible better answer: http://stackoverflow.com/a/22355948

http://stackoverflow.com/q/22404493
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/67773534
tagged with: utf-16
score: 12
type: Question
has title: Is there a drastic difference between UTF-8 and UTF-16
downvote count: 1
has answer: http://stackoverflow.com/a/22404991
upvote count: 13
has body: I call a webservice, that gives me back a response xml that has UTF-8 encoding. I checked that in java using getAllHeaders() method. Now, in my java code, I take that response and then do some processing on it. And later, pass it on to a different service. Now, I googled a bit and found out that by default the encoding in Java for strings is UTF-16. In my response xml, one of the elements had a character É. Now this got screwed in the post processing request that I make to a different service. Instead of sending É, it sent some jibberish stuff. Now I wanted to know, will there be really a lot of difference in the two of these encodings? And if I wanted to know what will É convert from UTF-8 to UTF-16, then how can I do that?
possible better answer: http://stackoverflow.com/a/22404638
tagged with: java
tagged with: character-encoding
has answer: http://stackoverflow.com/a/22404638
has answer: http://stackoverflow.com/a/22404874
has comment: http://stackoverflow.com/comment/34063473
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22404874
tagged with: utf-8

http://stackoverflow.com/comment/34070176
comment on: http://stackoverflow.com/q/22408284
has text: Where does this appear?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/22368327
has comment: http://stackoverflow.com/comment/34002022
accepted answer of: http://stackoverflow.com/q/22368107
type: AcceptedAnswer
has body: Creating a temporary table in DB2 as it was mentioned , might not be the best way . Simply due to permission restrictions . The question asks clearly , how to join two result set objects. I believe there was an answer on Stackoveflow while (rs1.next) { YourClass obj = new YourClass(); obj.setSomeProperty(rs.getString(1)); obj.setAnotherProperty(rs.getString(2)); // etc.. cominbedDataSet.add(obj); } good luck
score: 0
answers question: http://stackoverflow.com/q/22368107
type: Answer

http://stackoverflow.com/comment/34340287
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22485710
type: Comment
has text: okey , I found out that the error is happening when the number is 0 in this line `URL url = new URL(f_url[0]);` I believe its a simple error with a simple fix or ? @chris

http://stackoverflow.com/comment/38737672
has text: This code not working , i am getting following error 14/07/24 14:44:06 ERROR tool.BaseSqoopTool: Error parsing arguments for import: 14/07/24 14:44:06 ERROR tool.BaseSqoopTool: Unrecognized argument: --hadoop-home 14/07/24 14:44:06 ERROR tool.BaseSqoopTool: Unrecognized argument: /opt/hadoop-1.0.4 14/07/24 14:44:06 ERROR tool.BaseSqoopTool: Unrecognized argument: --table 14/07/24 14:44:06 ERROR tool.BaseSqoopTool: Unrecognized argument: departments 14/07/24 14:44:06 ERROR tool.BaseSqoopTool: Unrecognized argument:
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22557225

http://stackoverflow.com/a/22477673
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22477410
has body: Its not possible with simple thread with sleep in android. Just use runnable thread. Start this when u need to update your textview according to seconds . In this i tried with minutes, seconds and millise3conds . Just check it out. Create a textview , nd set text with the below runnable. private Runnable updateTimerThread = new Runnable() { public void run() { timeInMilliseconds = SystemClock.uptimeMillis() - startTime; updatedTime = timeSwapBuff + timeInMilliseconds; int secs = (int) (updatedTime / 1000); int mins = secs / 60; secs = secs % 60; int milliseconds = (int) (updatedTime % 1000); t1.setText("" + mins + ":" + String.format("%02d", secs) + ":" + String.format("%03d", milliseconds)); customHandler.postDelayed(this, 0); } };

http://stackoverflow.com/comment/34082882
comment on: http://stackoverflow.com/q/22415053
has text: What error are you getting? Doing `for(; a <= z; a++) P` should work, assuming your variables `a` and `z` are in scope.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22339058
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22339027
has body: Your CompareTo method that does a comparison has a typo and is named differently. Java identifiers are case-sensitive. The compareTo that actually gets called always returns 0 (indicating all elements are equal). public class CalendarDate implements Comparable&lt;CalendarDate&gt;{ // doesn't get called by sort public int CompareTo(CalendarDate other){ if(month != other.month){ return month - other.month; } else { return day - other.day; } } // gets called by sort public int compareTo(CalendarDate other) { return 0; } } Use the @Override annotation. It will generate a compilation error if you make this kind of mistake. See also Overriding and Hiding Methods. When overriding a method, you might want to use the @Override annotation that instructs the compiler that you intend to override a method in the superclass. If, for some reason, the compiler detects that the method does not exist in one of the superclasses, then it will generate an error.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22339027

http://stackoverflow.com/a/22463207
has comment: http://stackoverflow.com/comment/34174023
type: Answer
answers question: http://stackoverflow.com/q/22462967
score: 0
has body: So, just by looking at syntax highlighting in my IDE I have been able to get something that seems to compile and work but looks deeply wrong to me. I changed it to this: def index = SecuredAction { implicit request =&gt; Assets.at("/public", "index.html").apply(request).value.get.get } Is that the correct way to do this? It looks really weird to me, am I just not familiar with the idioms?

filewriter
tag name: filewriter
type: Tag
tags question: http://stackoverflow.com/q/22432155
tags question: http://stackoverflow.com/q/22458353
tags question: http://stackoverflow.com/q/22482870

http://stackoverflow.com/q/22355567
tagged with: guava
tagged with: java
has answer: http://stackoverflow.com/a/22361012
tagged with: caching
score: 0
answer count: 2
tagged with: key
has comment: http://stackoverflow.com/comment/34253116
accepted answer: http://stackoverflow.com/a/22361012
has answer: http://stackoverflow.com/a/22355693
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22355693
has title: Choosing Keys for Guava Cache
has body: I am new to Guava cache and looking for some advice. I would like to cache "functions" - classes responsible for some calculation. Each class has 3 double attributes: start, max, increment What is the best way to create a key for storing in cache? How about complex object? I was thinking about using Hasher but for complex objects same hash does not mean same object. So the key-> value will not be unique. Also, how does Cache look up for key? I noticed that if I use 2 objects for key which pass equals, Cache considers it to be unique keys. Does it work based on key1 == key2? public static void testGuavaCache() { Cache&lt;Object, String&gt; CACHE = CacheBuilder.newBuilder().weakKeys().weakValues().build(); for (int i = 0; i &lt; 2; i++) { Joiner joiner = Joiner.on('|'); String key1 = joiner.join(i, i, i, i, i, i, i); for (int j = 0; j &lt; 2; j++) { String key = joiner.join(i, i, i, i, i, i, i); System.out.println(key1.equals(key)); System.out.println(key1 == key); try { String m = CACHE.get(key, new Callable&lt;String&gt;() { @Override public String call() throws Exception { return "test"; } }); System.out.println("Size = " + CACHE.size()); } catch (ExecutionException e) { e.printStackTrace(); } } } } Output is: true false Size = 1 true false Size = 2 true false Size = 3 true false Size = 4 Removing weakKeys() solves the problem. Is this expected?
type: Question

http://stackoverflow.com/a/22431134
score: 0
has body: list.add(e) and list.get(e) will take o(n) each time they are called. You should avoid to use them when you travel your list. Instead, if you have to write your own linked list you should keep track of the elements you are traveling. by replacing the operation i++ and get(i) by elem = elem.next or elem = elem.getnext(), (maybe something else depending on how you implemented your linked list). Then you add an element by doing: elem.next.parent = e; e.next = elem.next; elem.next = e; e.parent = elem; here my example works for a doubly linked list and elem represent the element in the linked list you are currently comparing your object you want to add.
answers question: http://stackoverflow.com/q/22431020
type: Answer

http://stackoverflow.com/comment/34026596
type: Comment
comment on: http://stackoverflow.com/q/22382818
has text: Simliar: http://stackoverflow.com/questions/32458/random-data-in-unit-tests . There is also http://pitest.org but that actually modifies your code in order to "test" your tests so not really the same as what you want. I've used http://github.com/rickynils/scalacheck for randomising data and it works pretty good.
score: 0
type: QuestionComment

nexus
type: Tag
tags question: http://stackoverflow.com/q/22485790
tag name: nexus

http://stackoverflow.com/comment/34041740
score: 0
type: Comment
type: QuestionComment
has text: Sorry, the problem is this : I want to keylistener for editbox and when a person press space I want to detect it and replace that character with another, so it will be issue because call textchanged and call and call..recursive code
comment on: http://stackoverflow.com/q/22390219

http://stackoverflow.com/a/22392389
has body: For Android when you start an activity for the first time, the onCreate is called by the Android OS. This is where you should write code to initialize all your views and variable. In the case of this.c() -or just c() - Android will automatically call it since it is in the onCreate method. Also since c() is part of the class, the instance of the class at run time is referred by "this" implicitly. I recommend understanding life cycle of android apps. it will help you with developing good apps. http://developer.android.com/training/basics/activity-lifecycle/starting.html
answers question: http://stackoverflow.com/q/22392083
has comment: http://stackoverflow.com/comment/34044679
has comment: http://stackoverflow.com/comment/34044588
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/34044505
score: 1
has comment: http://stackoverflow.com/comment/34044625
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22392083
has comment: http://stackoverflow.com/comment/34044026
has comment: http://stackoverflow.com/comment/34044299

http://stackoverflow.com/comment/34090111
has text: @JiriKremser Sorry, I deleted my comment because I had not read enough of the question before making it. Good point re. the listeners.
comment on: http://stackoverflow.com/q/22419019
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22481007
tagged with: java
type: Question
has body: I have a server application written in Java. This application uses two sqlite files to process data. The inputs are from one sqlite database and the output is written to another one in the same folder. If I start the application a second time the process starts, but then I receive this error message: [SQLITE_BUSY] The database file is locked (database is locked) The last entry in the log is the following: INFO: [sqlite] DB1: connection closed failed to remove existing native library file: C:\Users\bae\AppData\Local\Temp\sqlite-3.7.2-sqlitejdbc.dll Is SQLite not able to handle to applications doing the same with different databases, which are stored in different folders? I have folder A containing input.sqlite and output.sqlite are processed by the application instance_A. And I have folder B containing input.sqlite and output.sqlite are processed by the application instance_B. Both instances are running independent from each other. I found Getting SQLite busy database file is locked with select statements and SQLITE_BUSY The database file is locked (database is locked) in wicket. But this references didn't help me a lot.
has title: SQLite database - Only one session possible?
tagged with: database
has comment: http://stackoverflow.com/comment/34198037
linked to: http://stackoverflow.com/q/13891006
score: 0
tagged with: sqlite
has comment: http://stackoverflow.com/comment/34199561
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8559623
answer count: 0

http://stackoverflow.com/comment/34006100
comment on: http://stackoverflow.com/q/22343530
score: 0
has text: Ok we have to copy cell by cell or raw by row. Question here is we donot want to do it by loading entire excel file in to memory (content is huge). Is it possible to load the chunk of one sheet and write in to other sheet which is present in other workbook.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34129070
type: Comment
has text: Yes, @user230137, what you are saying is that there is one object per object. Nobody is disputing this.
comment on: http://stackoverflow.com/a/22441032
score: 0
type: AnswerComment

http://stackoverflow.com/a/37774361
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22365470
downvote count: 0
has body: You can't specify security group names for VPC launch (setSecurityGroups). For a non-default VPC, you must use security group IDs instead. See EC2 run-instances page (withSecurityGroupIds , or --security-group-ids from CLI). When you specify a security group for a nondefault VPC to the CLI or the API actions, you must use the security group ID and not the security group name to identify the security group. See: Security Groups for EC2-VPC Related: Terraform throws "groupName cannot be used with the parameter subnet" or "VPC security groups may not be used for a non-VPC launch"

http://stackoverflow.com/comment/33959410
comment on: http://stackoverflow.com/q/22343953
has text: @Veera is there a reason not to use a counter that you would increase?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/82230253
has text: The comparator is using `ResolveInfo` instead of `PackageInfo`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/47198817
type: Comment

http://stackoverflow.com/q/22470275
type: Question
tagged with: jar
has comment: http://stackoverflow.com/comment/34180245
has comment: http://stackoverflow.com/comment/34180271
has comment: http://stackoverflow.com/comment/34180389
score: 0
has comment: http://stackoverflow.com/comment/34180253
has comment: http://stackoverflow.com/comment/34180341
has comment: http://stackoverflow.com/comment/34180314
type: UnansweredQuestion
has body: when I add these jar on project. project is not compiling and giving an red Error on project. clear-parse-models-1.3.0.jar clear-postag-models-1.3.0.jar clear-pred-models-1.3.0.jar clear-role-models-1.3.0.jar
has comment: http://stackoverflow.com/comment/34180404
answer count: 0
tagged with: java
has title: jar not compatible with project in scala OpenIE?

http://stackoverflow.com/a/22428640
answers question: http://stackoverflow.com/q/22428627
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/34106517
has body: The EnumTest#size field is an instance field. You cannot access it from a static contex, ie. your main method. Either make the field static or create an instance of EnumTest and initialize it through a reference to that instance.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22428627

http://stackoverflow.com/a/22395488
score: 1
has body: You have problem at if(dieTosses.get(i) == dieTosses.get(i+1)) because at the last iteration of the for loop (for value 19 you are trying to access location 20 at dieTosses.get(i+1).which is not present because they are indexed through 0-19. So try this. for(int i = 1; i &lt; dieTosses.size(); i++) { if(dieTosses.get(i-1) == dieTosses.get(i)) { longestRun++; } else if(longestRun &gt; runTracker); longestRun = runTracker; } OR for(int i = 0; i &lt; dieTosses.size()-1; i++) { if(dieTosses.get(i) == dieTosses.get(i+1)) { longestRun++; } else if(longestRun &gt; runTracker); longestRun = runTracker; } which ever version you like
upvote count: 1
answers question: http://stackoverflow.com/q/22395442
type: Answer
downvote count: 0

http://stackoverflow.com/a/22332646
score: 0
has body: Going to need more details than this. But it looks like you should be passing the name of the file to your delete function and using that to create the file reference. You say you're not displaying the file extension. If you know they're all the same extension, you can add it manually. If not, you're going to have search for it.
answers question: http://stackoverflow.com/q/22332389
has comment: http://stackoverflow.com/comment/33939709
type: Answer

http://stackoverflow.com/comment/34004670
score: 0
has text: thanks for response,no errors in console and i write some println messages in edit logic those all executed and x value is incremented also what is problem i don't no
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22369857

http://stackoverflow.com/q/22426813
tagged with: swing
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/34103353
tagged with: java
has answer: http://stackoverflow.com/a/22427110
type: Question
has body: I am a beginner and java and making a ludo board. I am making a Drop Down MenuJOptionPane where Player # 1 picks what color he wants to be (green, yellow, blue, red). When it comes to Player # 2 I want him to be able to choose all the colors except for what Player # 1 chose. Here is my code so far (probably crappy but I am programming for the first time): String player1; String[] numberOfPlayers = {"two", "three", "four"}; String inputNumberOfPlayers = (String) JOptionPane.showInputDialog(null, "How many people are playing?", "Number of Players", JOptionPane.QUESTION_MESSAGE, null, numberOfPlayers, numberOfPlayers[0]); if(inputNumberOfPlayers.equals("two")) { String[] player1Color = {"green", "yellow", "blue", "red"}; String inputColorChoices1 = (String) JOptionPane.showInputDialog(null, "What color what you like to be", "Message to Player 1", JOptionPane.QUESTION_MESSAGE, null, player1Color, player1Color[0]); player1 = inputColorChoices1; String[] player2Color = {"green", "yellow", "blue", "red"}; //and then I don't know... Could anybody please help me or tell me where I can find the right answer?
score: 0
has title: JOptionPane - Drop Down: How to subtract an option that somebody has chosen?
answer count: 1
tagged with: drop-down-menu
type: UnansweredQuestion

http://stackoverflow.com/comment/34910838
comment on: http://stackoverflow.com/a/22405781
score: 0
has text: Schultz My query refers, whether tomcat maintain multiple threads to maintain multiple listen ports? or multiple processes to maintain multiple listen ports?
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/34111802
score: 0
comment on: http://stackoverflow.com/q/22429871
type: QuestionComment
type: Comment
has text: hmm, ok .. for example .. let just sat "star1" and "star2" has never worked together. so, when I ask question -- which star has not worked with "star2" ? - answer should be "star1" .. I hope that made sense

http://stackoverflow.com/q/22353669
tagged with: jenkins
tagged with: java
tagged with: noclassdeffounderror
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/22357851
has body: So this question is going to be somewhat vague, and I apologize, but I don't really even know where to start. We use Jenkins to automate some builds during the night. We execute our builds with maven. For a while, everything was working out nice. We had findbugs, and code coverage results and a steady history of successful builds. All of the sudden, seemingly out of now where we are getting random NoClassDefFound exceptions while the unit tests are being run. Its very strange, because before hand, the log messages clearly show it building the sources and succeeding. Then the unit tests start to run and they instantly die with the aforementioned exception. We did recently perform an update of Jenkins, but I'm not entirely convinced that has much to do with it. The really strange part is that the builds don't always fail with this exception. Sometimes they run and pass fine, other times they fail immediately. The failures are not consistent in terms of the specific unit tests that fail, or the specific classes which cannot be found. While they seem to revolve around the same small set of classes and unit tests, there doesn't appear to be any real pattern to it. Has anyone else out there seen this with maven builds on jenkins? I really have no idea what to do. The log messages aren't exactly useful, and I don't know what I could do to the Jenkins configuration to get better debugging information out of the failed builds. I can gather whatever information anyone may need if anyone has any ideas. Here is an example stack trace from one of the recently failed builds: com.ipti.ptl.common.problems.detectors.CMDRProblemDetectorTest.afterPropertiesSetTest Failing for the past 3 builds (Since Unstable#411 ) Took 18 ms. Error Message com/ipti/hardware/bcicinterface/CPacketReceivedArgs Stacktrace java.lang.NoClassDefFoundError: com/ipti/hardware/bcicinterface/CPacketReceivedArgs at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLo…
has comment: http://stackoverflow.com/comment/33976504
has title: Random build failures on Jenkins
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22354791
favorite count: 0
linked to: http://stackoverflow.com/q/7869711
upvote count: 2
type: UnansweredQuestion
tagged with: maven
score: 2

http://stackoverflow.com/q/22411627
linked to: http://stackoverflow.com/q/13423067
tagged with: weblogic
tagged with: java
has title: Grails app - JNDI on Tomcat Vs Weblogic
tagged with: grails
type: Question
upvote count: 4
has body: Usually my Grails app is run on Tomcat. I recently was making it work for Weblogic. I followed all the notes here: notel reference link And my app does work on Weblogic, but... I have a problem in how the datasource works... Having this in my DataSource.groovy file: production { dataSource { dbCreate = "validate" resourceRef="true" jndiName = "java:/comp/env/jdbc/myGrails" Makes it work on Tomcat. But it won't work on Weblogic. Having this in my DataSource.groovy file: production { dataSource { dbCreate = "validate" resourceRef="true" jndiName = "jdbc/myGrails" Makes it work on Weblogic, but then not on Tomcat. How can I configure the jndiName in Datasource.groovy to have it work on both Weblogic and Tomcat? I did read through this post: Tomcat vs Weblogic JNDI Lookup But couldn't find a solution that worked for me. I might not have understood since it was geared more towards Spring (which I don't know very well) and not specifically Grails. Hoping someone can help me with a Grails/Datasource.groovy solution.
answer count: 1
downvote count: 0
tagged with: tomcat
has answer: http://stackoverflow.com/a/22454149
favorite count: 0
linked to: http://stackoverflow.com/q/47676
score: 4
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34079629

http://stackoverflow.com/a/22441758
answers question: http://stackoverflow.com/q/22441425
has body: I found this to be a very good example of updating an existing excel worksheet. As you'll notice, you create your workbook with the file you want to modify. This will allow you to find where you can create your new column and write your data too. try { FileInputStream file = new FileInputStream(new File("C:\\update.xls")); HSSFWorkbook workbook = new HSSFWorkbook(file); HSSFSheet sheet = workbook.getSheetAt(0); Cell cell = null; // Find empty cell // Update the value of cell file.close(); FileOutputStream outFile = new FileOutputStream(new File("C:\\update.xls")); workbook.write(outFile); outFile.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/34134966
score: 0
has comment: http://stackoverflow.com/comment/34134853
type: Answer

http://stackoverflow.com/comment/34051285
score: 0
comment on: http://stackoverflow.com/a/22396552
type: Comment
has text: If you look at the folder structure, all the classes that seem not to be imported with these errors are actually in the same package as Test.java, so they don't need to be imported. This is the main problem, why would I get a not found error for classes within the same package?
type: AnswerComment

http://stackoverflow.com/q/22375873
possible better answer: http://stackoverflow.com/a/22376124
has answer: http://stackoverflow.com/a/22376847
tagged with: centos
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34013782
has answer: http://stackoverflow.com/a/22376124
has body: I installed a new JRE 1.7 on my Centos server. However, when I type in java -version it shows the version 1.6, which means the hosting provider preinstalled that before? How do I shift it over to the new one 1.7 I installed and make it permanent? Thank you!
tagged with: linux
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22376847
score: 1
tagged with: java
upvote count: 1
has title: Make Java 1.7 default on the Centos server
has comment: http://stackoverflow.com/comment/34014304
type: Question

http://stackoverflow.com/a/27514651
answers question: http://stackoverflow.com/q/22464484
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/123659387
score: 1
has body: If your trying to load dependencies from external jars, specify the paths using -classpath (or) -cp command line argument. It's not ideal to change the CLASSPATH environment variable for each and every program that you execute. The default ClassPath for java program is dot (.) which means current directory Remember that when you're using -cp/-classpath arguments, they'll override the default classpath settings, so you should explicitly add the default path as well like below. On Windows javac -cp pathToYourJar Main.java while executing don't forget to add your current directory java -cp .;pathToYourJar Main To make things easier, I'd recommend to use an IDE like Eclipse/NetBeans/IntellijIDEA. If your already using Eclipse, add the jars to your Project's Build Path Right Click on Project -- Properties -- Java Build Path -- Libraries -- Add External JARs

http://stackoverflow.com/comment/33959449
comment on: http://stackoverflow.com/q/22343975
score: 0
has text: Because you have extended `Exception`, as such your exception is a checked exception. This means code using your method should catch it, or the method in which `.peek()` is used should `throws` it as well.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22422977
tagged with: java
score: -1
type: Question
has title: Can we use Opencv function estimateRigidTransform() in Java-Opencv
has answer: http://stackoverflow.com/a/22423016
has body: There's one useful function estimateRigidTransform() in C++ Opencv can we find in JAVA-OPENCV in android? My code is as following: Mat preFrame; Mat curFrame; Mat T=estimateRigidTransform(preFrame,curFrame,false);
tagged with: android
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: opencv
upvote count: 0

http://stackoverflow.com/comment/34117485
score: 0
type: AnswerComment
has text: Your algorithm can't handle delta so take it out. Try removing the first delta from you bob code or turn it into a const. The previous bob velocity that you reuse each frame needs to be delta free. After you calculate bob's world velocity then make a copy and use delta to convert world velocity to pixels per frame but keep them separate so when you reuse velocity on the next frame it isn't off if the delta changes.
type: Comment
comment on: http://stackoverflow.com/a/22386803

http://stackoverflow.com/q/22453981
upvote count: 2
linked to: http://stackoverflow.com/q/2586975
answer count: 2
tagged with: url
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/32718484
tagged with: curl
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6464120
downvote count: 0
tagged with: java
has body: I'm working on a program where I'm coding in Java, and require to use certain Bitbucket features using Java code. However, BitBucket doesn't provide any nicely-packaged-use-out-of-the-box libraries for Java developers, which means I'll have to use their REST API. How would I go about this? Would I make use of java.net.URL and/or java.net.URLConnection? Or maybe use Jersey/JAX-RS? Or something else? To sum up: Which would be the simplest, most correct way of using BitBucket's REST APIs in Java? And using the suggested method, how would I, say, create an issue on the issue tracker of the tutorials repository? Thanks :) PS: This is not homework :). I have not put any code here because I don't have much of an idea about web development, let alone doing web-development-related-tasks via Java :(.
has answer: http://stackoverflow.com/a/22454076
accepted answer: http://stackoverflow.com/a/22454076
type: Question
tagged with: bitbucket-api
has title: Using BitBucket REST API with Java
possible better answer: http://stackoverflow.com/a/32718484

http://stackoverflow.com/q/22402726
answer count: 1
has body: could anyone help translate below PHP code to Java code? I prefer to use Apache cxf webclient to sent the request but any solutions are welcome. $services_url = 'http://example/services_wgea_drupal'; //(1) Server REST - user.login // REST Server URL for auth $request_url = $services_url . '/user/login'; // User data $user_data = array( 'username' =&gt; 'aaaa', 'password' =&gt; 'bbbb', ); $user_data = http_build_query($user_data); // cURL $curl = curl_init($request_url); curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/json')); // Accept JSON response curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_POST, 1); // Do a regular HTTP POST curl_setopt($curl, CURLOPT_POSTFIELDS, $user_data); // Set POST data curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); $response = curl_exec($curl); this is what I tried: WebClient client = WebClient.create("http://example/services_wgea_drupal").accept(MediaType.APPLICATION_JSON); client.path("/user/login").type(MediaType.APPLICATION_JSON); Response response = client.post("{\"username\":\"aaaa\",\"password\":\"bbbb\"}"); the response code is 200 but according to my PHP colleague, a json message including a session name and session id should be returned. But the responseMessage property of the response is something like below. I don't think it's a correct response. {org.apache.cxf.rest.message=true, org.apache.cxf.invocation.context={ResponseContext={}, RequestContext={response.class=class javax.ws.rs.core.Response, org.apache.cxf.request.method=POST, org.apache.cxf.request.uri=http://example/services_wgea_drupal/user/login, response.type=class javax.ws.rs.core.Response, request.class=class java.lang.String, jaxrs.proxy=false, org.apache.cxf.message.Message.PROTOCOL_HEADERS={Accept=[application/json], Content-Type=[application/json]}, request.type=null, org.apache.cxf.message.Message.ENDPOINT_ADDRESS=http://example/services_wgea_drupal/user/login}}, http.scheme=http, org.apache.cxf.client=tru…
favorite count: 0
has comment: http://stackoverflow.com/comment/34060836
has title: how to translate this php code to Java?
tagged with: php
has comment: http://stackoverflow.com/comment/34060373
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22403332
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/34060385
linked to: http://stackoverflow.com/q/6094996
tagged with: java
has comment: http://stackoverflow.com/comment/34060797
accepted answer: http://stackoverflow.com/a/22403332
score: 0

http://stackoverflow.com/q/22415382
favorite count: 0
has answer: http://stackoverflow.com/a/22416512
has comment: http://stackoverflow.com/comment/34084416
downvote count: 0
has comment: http://stackoverflow.com/comment/34084495
has comment: http://stackoverflow.com/comment/34084693
tagged with: spring
has comment: http://stackoverflow.com/comment/34083761
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/34083868
has comment: http://stackoverflow.com/comment/34084748
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34084166
has title: Spring's sec:intercept-url easily bypassed?
has comment: http://stackoverflow.com/comment/34084310
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34084196
has body: In our java app, we are using Spring security to handle role based authorization. Recently, we became aware that do to multiple servlet mappings in web.xml these URL checks were easily bypassed. However, after cutting it down to one servlet mapping, I'm still not sure we have our URL matchers set up right because they are ridiculously easy to bypass. For example: <sec:intercept-url pattern="/m/partner/list/**" access="hasRole('VIEW_ADMIN_PARTNER_LIST')"/> At first glance, it does prevent a user with the role VIEW_ADMIN_PARTNER_LIST from loading that page... until I add .html to the end of it. Then it loads just fine. Or, if I add .fff or any other extension, it works. So, we changed the pattern to this: <sec:intercept-url pattern="/m/partner/list**" access="hasRole('VIEW_ADMIN_PARTNER_LIST')"/> Which worked great! Now no matter what extension I add to the end of the url, I still get a 403 error. But.... adding a slash to the end of the URL bypasses the security completely. Not what we want. So it seems that to truly implement actual URL pattern security, we have to implement both of those patterns? This is less than ideal, because we have over 75 URL security rules, and duplicating them and keeping them in sync would be difficult. Is there a better way to write the pattern matchings, or Spring's security inherently broken? Edit: Here is the relevant info from our web.xml: myproject /m/* springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /*
has comment: http://stackoverflow.com/comment/34084766
has answer: http://stackoverflow.com/a/22415952
accepted answer: http://stackoverflow.com/a/22415952
type: Question
possible better answer: http://stackoverflow.com/a/22416512
has comment: http://stackoverflow.com/comment/34084507
answer count: 2
linked to: http://stackoverflow.com/q/8908052
upvote count: 1
tagged with: spring-security

http://stackoverflow.com/comment/34016656
comment on: http://stackoverflow.com/q/22377564
score: 0
has text: @RobSedgwick I thought my question related to both. I want the end result to be JavaScript, but the means by which I get that JavaScript could potentially be Java.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34050619
comment on: http://stackoverflow.com/a/22396591
type: AnswerComment
has text: I think Jon Skeet's answer to the Q this is a Dup of is far more comprehensive, especially in that regard.
score: 0
type: Comment

http://stackoverflow.com/comment/39572295
type: AnswerComment
has text: what if we not using DBCP Connection pool ? then these configurations will not have influence in the code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22474626

http://stackoverflow.com/comment/34136103
type: QuestionComment
has text: How are you restricting user to input other than digits?
comment on: http://stackoverflow.com/q/22444457
score: 0
type: Comment

http://stackoverflow.com/a/22330328
score: 1
answers question: http://stackoverflow.com/q/22329289
accepted answer of: http://stackoverflow.com/q/22329289
has body: You need to give a value to each radio button. For example: A B Then, in your servlet, you will recover its value using request.getParameter: String tomCalification = request.getParameter("tom"); System.out.println(tom); //will print A if selected radio button with A //will print B if selected radio button with B Similar for all other cases.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/a/34603515
has body: Try disabling internet explorer proxy on your pc.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22480748

http://stackoverflow.com/a/22501695
answers question: http://stackoverflow.com/q/22409102
type: Answer
upvote count: 10
score: 10
downvote count: 0
has body: The approach used by Math.min is similar to what Jesper proposes but a little clearer: private static int negativeZeroFloatBits = Float.floatToRawIntBits(-0.0f); float f = -0.0f; boolean isNegativeZero = (Float.floatToRawIntBits(f) == negativeZeroFloatBits);

http://stackoverflow.com/comment/33994942
has text: error on this line :gender.setAdapter(MyAdapter);errors are Multiple markers at this line - Syntax error on token(s), misplaced construct(s) - Syntax error on token ")", . expected - Syntax error on token "MyAdapter", VariableDeclaratorId expected after this token
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22363496

http://stackoverflow.com/comment/34196703
has text: I made [an example on ideone](http://ideone.com/dyvs8S) for you to play with this concept, but too late. T.J.'s answer is correct.
comment on: http://stackoverflow.com/q/22480192
score: 4
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/77552096
comment on: http://stackoverflow.com/a/39206916
has text: @MichalVician Glad it did!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34399195
has text: The point is that you shouldn't have been in the read() method at all: you should have known how many bytes were in the HTTP response.
type: AnswerComment
comment on: http://stackoverflow.com/a/22390810
score: 0
type: Comment

http://stackoverflow.com/a/22347685
has body: The output will depend on your system's timezone. What you're parsing is essentially 2010-08-28 00:00:00 on timezone GMT-4. And when you print it it shows this time on your system's timezone.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22347495
upvote count: 1

http://stackoverflow.com/comment/33936590
score: 0
has text: Great workaround. I'm using it now. If no one pulls a rabbit out of the hat in the next hour or so, I'll accept. Thank you!
type: AnswerComment
comment on: http://stackoverflow.com/a/22330869
type: Comment

http://stackoverflow.com/comment/34204437
comment on: http://stackoverflow.com/q/22484215
score: 0
has text: @NickHolt: OP has tried implementing Serializable in SearchResult as given in the points
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22452642
has answer: http://stackoverflow.com/a/26313423
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/22565697
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22456262
accepted answer: http://stackoverflow.com/a/22565697
has body: I use windows7 64-bit reference site : enter link description here This problem isn't solve [INFO] Final Memory: 44M/175M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar (module-javadocs) on project hadoop-common: ArchiverException: Error while creating archive: Problem creating jar: C:\hdfs\hadoop-common-project\hadoop-common\target\hadoop-common-2.2.0\bin\hadoop.dll (Access is denied) -&gt; [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] [enter link description here][1] [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn &lt;goals&gt; -rf :hadoop-common please help me
has title: maven is install error
possible better answer: http://stackoverflow.com/a/22456262
tagged with: maven
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22464508
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34187162
score: 2
has answer: http://stackoverflow.com/a/60043200
has comment: http://stackoverflow.com/comment/34188062
tagged with: java
has comment: http://stackoverflow.com/comment/34187787
has comment: http://stackoverflow.com/comment/34191388
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has title: Apache POI autoColumnWidth java.lang.OutOfMemoryError: GC overhead limit exceeded
tagged with: out-of-memory
tagged with: apache-poi
has body: Am getting the OutOfMemoryError when the autoColumnWidth function is called on all the columns in my excel containing 1,28,237 rows and 20 columns. Am using SXSSF api and allocating -Xms2048m -Xmx4096m -XX:PermSize=1024m -XX:MaxPermSize=2048m to JVM but still no success. CPU utilization goes upto 100% , my system RAM is 6gb which is used upto 5.8gb during the process and then i get OutOfMemoryError. Any solution to it ? With this, I can think of one solution i.e. taking a variable for each column, finding the max length and in the end after all data is entered set the column to respective variable. Any other solution? My Code To Create Excel public static void createVideodataExcelFile(String excelPath, int maxRiskArea){ FileOutputStream fileOut = null; XSSFWorkbook workbook = new XSSFWorkbook(); CellStyle style = workbook.createCellStyle(); XSSFFont font = workbook.createFont(); font.setColor(HSSFColor.BLACK.index); font.setBold(true); style.setFont(font); int cellCount = 0; try { File file = new File(excelPath); if(file.createNewFile()){ SXSSFWorkbook wb = new SXSSFWorkbook(workbook); wb.setCompressTempFiles(true); Sheet sheet = wb.createSheet("GLE Video Data"); int rowCount = sheet.getPhysicalNumberOfRows(); //System.out.println("Row Count ="+rowCount); Row row = sheet.createRow(rowCount); Cell cell1 = row.createCell(cellCount); createCell(cell1, row, "CourseContent name", style, cellCount); createCell(cell1, row, "lang", style, ++cellCount); createCell(cell1, row, "CourseTitle", style, ++cellCount); createCell(cell1, row, "Audience", style, ++cellCount); createCell(cell1, row, "ContentRegion", style, ++cellCount); createCell(cell1, row, "CourseTitle", style, ++cellCount); createCell(cell1, row, "DeprecatedId", style, ++cellCount); createCell(cell1, row, "GleCode", style, ++cellCount); createCell(cell1, row, "Guid", style, ++cellCount); createCell(cell1, row, "LearningFormat", style, ++cellCount); for(int i = 0 ; i &lt; maxRiskArea ; ++i){ createCell(cell1, row, "…
upvote count: 2

http://stackoverflow.com/q/22483649
has title: Android gridview getchildat() null pointer exception inside of custom arrayadapter
has body: I'm not sure how I can attack this problem. I'm trying to get to item with in a gridview but I'm getting a null pointer in trying to get the item? The function I'm doing this at is resetbutton() and line of code that seems to come up as null is gridViewlayout.getChildAt(goodguyposition).setBackgroundResource(R.drawable.goodguybutton); I don't think I'm resolving to anything so i can understand the null but I can't grab the gridview id and I dont' know why? gridViewlayout = (GridView) findViewById(R.id.gridView1); Do i need to pass it from the main activity or in the getView area? activity_main.xml layout &lt;GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridView1" android:numColumns="11" android:gravity="center" android:stretchMode="columnWidth" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;/GridView&gt; item.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Button xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="O" android:id="@+id/grid_item_label" android:layout_column="1" android:background = "@drawable/roundedbutton"/&gt; customgridviewadapter.java public class CustomGridViewAdapter extends ArrayAdapter&lt;Item&gt; { private static final String TAG = "CustomGridViewAdapter"; Context context; int layoutResourceId; ArrayList&lt;Item&gt; data = new ArrayList&lt;Item&gt;(); GridView gridViewlayout; View gridView; public CustomGridViewAdapter(Context context, int layoutResourceId, ArrayList&lt;Item&gt; data) { super(context, layoutResourceId, data); this.layoutResourceId = layoutResourceId; this.context = context; this.data = data; } @Override public View getView(final int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); Log.d(TAG, "Position before convertView " + position ); if (convertView == null)…
type: UnansweredQuestion
type: Question
tagged with: android
tagged with: gridview
score: 0
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/22483904

http://stackoverflow.com/a/22536407
type: AcceptedAnswer
has body: I think I've figured it out. I was under the impression that I could only implement an interface, but it turns out that you can also extend a concrete class -- only abstract classes throw the error I described. ScriptEngine js = new ScriptEngineManager().getEngineByExtension("js"); js.eval("new java.lang.Runnable() {run: function() { ... } }"); // works js.eval("new java.lang.Thread() {run: function() { ... } }"); // works js.eval("new java.util.TimerTask() {run: function() { ... } }"); // throws This is good enough for my needs -- the docs could definitely be clearer, though!
accepted answer of: http://stackoverflow.com/q/22486016
type: Answer
answers question: http://stackoverflow.com/q/22486016
score: 0

http://stackoverflow.com/q/22399893
has answer: http://stackoverflow.com/a/22402189
tagged with: arrays
answer count: 7
has answer: http://stackoverflow.com/a/22400095
accepted answer: http://stackoverflow.com/a/22400095
has comment: http://stackoverflow.com/comment/34055951
has title: Java Arrays and Random Numbers
upvote count: 1
has comment: http://stackoverflow.com/comment/34055982
has answer: http://stackoverflow.com/a/22400126
favorite count: 0
has body: I am trying to generate an array of random numbers. Each array entry will have a number between 0 and 31. I am trying to get the code to generate a random number and then check to see if that number exists in the array. If it does, it then generates a fresh random number and checks from the beginning again. I thought I had it sussed with the code below: public class HelloWorld{ public static void main(String []args){ int[] randArray = new int[10]; boolean firstNumber = true; int randNum = 0; for (int j=0; j &lt; randArray.length; j++) { if(firstNumber) { randNum = (int)(Math.random() * 31 + 1); randArray[j] = randNum; firstNumber = false; } else { for (int k=0; k &lt; randArray.length;) { randNum = (int)(Math.random() * 31 + 1); if(randArray[k] == randNum) { k=0; } else { k++; } } randArray[j] = randNum; System.out.println(j); } } System.out.println("-------"); for(int i=0; i &lt; randArray.length; i++) { System.out.println(randArray[i]); } } } But this is what it prints out: 1 2 3 4 5 6 7 8 9 ------- 25 17 19 20 24 4 26 30 6 24 As you can see, 24 is repeated twice. If I run the code again, you can see numbers being stored that are repeated. Logically I cannot figure out why it is doing this. It may be something simple but I just can't see it. I'm new to programming and this is something I thought I would test my knowledge with.
possible better answer: http://stackoverflow.com/a/22400014
has answer: http://stackoverflow.com/a/22400259
has answer: http://stackoverflow.com/a/22400008
downvote count: 0
has comment: http://stackoverflow.com/comment/34055888
has comment: http://stackoverflow.com/comment/34056157
has comment: http://stackoverflow.com/comment/34055878
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/34056050
has answer: http://stackoverflow.com/a/22400138
type: Question
has answer: http://stackoverflow.com/a/22400014
has comment: http://stackoverflow.com/comment/34055879

http://stackoverflow.com/q/22475350
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34188780
tagged with: java
has answer: http://stackoverflow.com/a/22480317
accepted answer: http://stackoverflow.com/a/22480317
type: Question
has title: Swing: binding complex object list with jtable
score: 0
tagged with: binding
answer count: 1
has comment: http://stackoverflow.com/comment/34196240
has comment: http://stackoverflow.com/comment/34196666
tagged with: netbeans
has body: I'm developping a small application in Swing with Netbeans. I currently can display a list of objects in a jTable with Binding. But one of the object's properties is another object: public class CustomProp { private String description; private int value; //constructor, getters and setters... } public class MainObject { private int id; private String name; private boolean aBoolProp; private CustomProp myCustomProp; //constructors, getters and setters... } I have a arraylist with 4 instanced MainObjects named mainObjectsList. The jTable Elements binding espression is ${mainObjectsList} Then in the jTable, I can see my objects properties but in myCustomProps column, I can see only the object address (mytest.CustomProp@64ca87d5). Is it possible to configure the Binding expression to display the parameters of the object property in the jTable?
linked to: http://stackoverflow.com/q/1162166
has comment: http://stackoverflow.com/comment/34195748
tagged with: swing

http://stackoverflow.com/comment/34200512
comment on: http://stackoverflow.com/q/22476852
has text: Possibly not, i'm running as a unit test through the IDE (tried running via maven install command line also). Forgive my ignorance as i'm new to hadoop - can you explain why it is important, what differs from the old API (as that did work in same fashion), etc? cheers
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33995240
type: AnswerComment
score: 0
type: Comment
has text: NumberFormatException: For input string: ""
comment on: http://stackoverflow.com/a/22364033

http://stackoverflow.com/comment/34113559
comment on: http://stackoverflow.com/a/22432469
type: AnswerComment
has text: public static class PlaceholderFragment extends Fragment {
score: 0
type: Comment

http://stackoverflow.com/q/22444956
has answer: http://stackoverflow.com/a/22444972
score: -1
has comment: http://stackoverflow.com/comment/34136457
answer count: 2
linked to: http://stackoverflow.com/q/513832
upvote count: 0
possible better answer: http://stackoverflow.com/a/22444972
favorite count: 0
has answer: http://stackoverflow.com/a/22444963
type: AnsweredQuestion
has body: I created this small loop to test out continuous input. I want to exit when exit is the input. However the while loop I created is still looping even though exit is typed in. code: String input = ""; while(input != "exit") { Scanner sc = new Scanner(System.in); input = sc.nextLine(); }
has title: Exiting continuous input
has comment: http://stackoverflow.com/comment/34136448
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22444963

http://stackoverflow.com/comment/53884022
comment on: http://stackoverflow.com/a/22362609
type: Comment
score: 0
type: AnswerComment
has text: @verbose-mode it appears the given jar file does not export any of its packages visible. Any suggestions?

http://stackoverflow.com/q/22417380
has title: Need Customize Gson deserialization, need only single element JSON, to Object
has answer: http://stackoverflow.com/a/22418727
has comment: http://stackoverflow.com/comment/34087585
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/34089342
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22418727
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has comment: http://stackoverflow.com/comment/34087550
upvote count: 1
has comment: http://stackoverflow.com/comment/34089325
type: Question
has body: I have: Json: { "id" : "1", "name": "John", "id_client": "2", ... } My class: public class Person{ private int id; private String name; private Client client; ... } public class Client{ private int id; } How i deserialize id_client: "2", to a Client object and set id(CLient) ?

http://stackoverflow.com/comment/34033037
has text: please show you entire form, does it post correctly? any stack error traced from server?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22386571

http://stackoverflow.com/comment/34209517
type: Comment
comment on: http://stackoverflow.com/a/22486582
type: AnswerComment
score: 0
has text: Considered A and B already, but I switched to GAE backend because the integration with Android is quite good and the transaction and persistence support is not bad regarding the app. Only the basic use of JPQL queries is a pity.

http://stackoverflow.com/a/22418704
answers question: http://stackoverflow.com/q/22375165
type: Answer
has body: There have been lots of enhancements and fixes since the version of Usertype you are using. I have backported as much of the functionality as possible to Hibernate 3.6 and Java 5. You can use this backport by using the module usertype.core-hibernate36. Currently you will need to build this from source until the next release. Get the sources from https://github.com/JadiraOrg/jadira Also, take a look at the documentation at http://jadira.sourceforge.net/usertype-userguide.html Let me know if you encounter any issues. Disclaimer: I maintain Jadira.
score: 0

http://stackoverflow.com/a/22432262
has comment: http://stackoverflow.com/comment/34145868
answers question: http://stackoverflow.com/q/22431117
has comment: http://stackoverflow.com/comment/34158738
type: Answer
has comment: http://stackoverflow.com/comment/34117756
score: 0
has body: For this you will need to understand how something called NAT (network address translation) works. In simple terms the NAT is responsible for sending packets to the right computer on the internal network from the external. Say for example you have computer A as a server on the internal network, and have computer B on the external. If you then try to connect to computer A from computer B, it will not work because NAT (your router) doesent know what computer to send that packet of data to, on the internal network. Its diffrent when you want to connect to an external server. Lets say computer A (client) is on the external network, and computer B (server) is on the internal network with the router port forwarded to its IP-address. Then you will be able to connect to the server because NAT knows where to send the data packets. So to keep all your users from port forwarding their routers: Port forward your server on your internal network Connect the clients on another network For clients on the internal network; use the local IP of the server Hope this helped! -Kad